diff --git a/app/client/package.json b/app/client/package.json index 5056f027800cb75d74012a38544c11c44f7db0cf..27eaada394f0972a394c4282cec647ba7482e57d 100644 --- a/app/client/package.json +++ b/app/client/package.json @@ -23,6 +23,7 @@ "@fusioncharts/powercharts": "^3.16.0", "@github/g-emoji-element": "^1.1.5", "@manaflair/redux-batch": "^1.0.0", + "@sentry/cli": "^2.17.5", "@sentry/react": "^6.2.4", "@sentry/tracing": "^6.2.4", "@taroify/core": "^0.0.28-alpha.1", @@ -84,6 +85,7 @@ "jshint": "^2.13.4", "klona": "^2.0.5", "libphonenumber-js": "^1.9.44", + "link-package": "^0.1.0", "lint-staged": "^13.0.3", "localforage": "^1.7.3", "lodash": "^4.17.21", @@ -196,8 +198,8 @@ "test:unit": "$(npm bin)/jest -b --colors --no-cache --silent --coverage --collectCoverage=true --coverageDirectory='../../' --coverageReporters='json-summary'", "test:jest": "$(npm bin)/jest --watch", "generate:widget": "plop --plopfile generators/index.js", - "postinstall": "patch-package && cross-env CURRENT_SCOPE=client node ../shared/install-dependencies.js", - "preinstall": "cross-env CURRENT_SCOPE=client node ../shared/build-shared-dep.js", + "postinstall": "patch-package && set CURRENT_SCOPE=client node ../shared/install-dependencies.js", + "preinstall": "set CURRENT_SCOPE=client node ../shared/build-shared-dep.js", "install": "node cypress/apply-patches.js" }, "browserslist": [ @@ -265,7 +267,6 @@ "chalk": "^4.1.1", "compression-webpack-plugin": "^10.0.0", "cra-bundle-analyzer": "^0.1.0", - "cross-env": "^7.0.3", "cy-verify-downloads": "^0.0.5", "cypress": "9.7.0", "cypress-file-upload": "^4.1.1", @@ -306,6 +307,7 @@ "redux-mock-store": "^1.5.4", "sass": "^1.52.3", "semver": "^7.3.5", + "set": "^7.0.3", "ts-jest": "27.0.0", "ts-jest-mock-import-meta": "^0.12.0", "ts-loader": "^9.4.1", diff --git a/app/client/src/pages/Editor/SaaSEditor/__data__/FinalState.json b/app/client/src/pages/Editor/SaaSEditor/__data__/FinalState.json index d244b55b414a24820c81aad6ed507b2276979639..da01c926a6d75c85920773259962f629b21590cf 100644 --- a/app/client/src/pages/Editor/SaaSEditor/__data__/FinalState.json +++ b/app/client/src/pages/Editor/SaaSEditor/__data__/FinalState.json @@ -1290,8 +1290,8 @@ } }, { - "label": "Use Prepared Statement", - "info": "Turning on Prepared Statement makes your queries resilient against bad things like SQL injections. However, it cannot be used if your dynamic binding contains any SQL keywords like 'SELECT', 'WHERE', 'AND', etc.", + "label": "使用", + "info": "1", "configProperty": "actionConfiguration.pluginSpecifiedTemplates[0].value", "controlType": "SWITCH", "initialValue": true @@ -2624,8 +2624,8 @@ "info": "Ask confirmation from the user each time before refreshing data" }, { - "label": "Use Prepared Statement", - "info": "Turning on Prepared Statement makes your queries resilient against bad things like SQL injections. However, it cannot be used if your dynamic binding contains any SQL keywords like 'SELECT', 'WHERE', 'AND', etc.", + "label": "使用", + "info": "1", "configProperty": "actionConfiguration.pluginSpecifiedTemplates[0].value", "controlType": "SWITCH", "initialValue": true @@ -2811,4 +2811,4 @@ "app": "undefined", "jsActions": [] } - } \ No newline at end of file + } diff --git a/app/client/src/pages/Editor/SaaSEditor/__data__/InitialState.json b/app/client/src/pages/Editor/SaaSEditor/__data__/InitialState.json index 1b9a7da90d604666b9202b797f4e113d9bf28c83..b2ff6cb6dbd187b694d3fe4ce957966e320cecd4 100644 --- a/app/client/src/pages/Editor/SaaSEditor/__data__/InitialState.json +++ b/app/client/src/pages/Editor/SaaSEditor/__data__/InitialState.json @@ -1289,8 +1289,8 @@ } }, { - "label": "Use Prepared Statement", - "info": "Turning on Prepared Statement makes your queries resilient against bad things like SQL injections. However, it cannot be used if your dynamic binding contains any SQL keywords like 'SELECT', 'WHERE', 'AND', etc.", + "label": "使用", + "info": "1", "configProperty": "actionConfiguration.pluginSpecifiedTemplates[0].value", "controlType": "SWITCH", "initialValue": true @@ -2623,8 +2623,8 @@ "info": "Ask confirmation from the user each time before refreshing data" }, { - "label": "Use Prepared Statement", - "info": "Turning on Prepared Statement makes your queries resilient against bad things like SQL injections. However, it cannot be used if your dynamic binding contains any SQL keywords like 'SELECT', 'WHERE', 'AND', etc.", + "label": "使用", + "info": "1", "configProperty": "actionConfiguration.pluginSpecifiedTemplates[0].value", "controlType": "SWITCH", "initialValue": true @@ -2810,4 +2810,4 @@ "app": "undefined", "jsActions": [] } - } \ No newline at end of file + } diff --git a/app/client/src/utils/WidgetRegisterHelpers.tsx b/app/client/src/utils/WidgetRegisterHelpers.tsx index 0bad7a00427686096efd938fa5be3df15b3e45f4..8a52725e97a2d34491e88ef710dbc400ad8785a8 100644 --- a/app/client/src/utils/WidgetRegisterHelpers.tsx +++ b/app/client/src/utils/WidgetRegisterHelpers.tsx @@ -56,6 +56,7 @@ export const registerWidget = (Widget: any, config: WidgetConfiguration) => { export const configureWidget = (config: WidgetConfiguration) => { let features: Record = {}; + // 处理features if (config.features) { Object.keys(config.features).forEach((registeredFeature: string) => { features = Object.assign( @@ -68,6 +69,7 @@ export const configureWidget = (config: WidgetConfiguration) => { }); } + // 合并config const _config = { ...config.defaults, ...features, diff --git a/app/client/src/widgets/TableWidget/component/TableHeader.tsx b/app/client/src/widgets/TableWidget/component/TableHeader.tsx index 9f1b83a131bb6d0ed36212738c8fe2d14d3800ef..30f6dd161ee0e00776684c72891edc5942a40ce0 100644 --- a/app/client/src/widgets/TableWidget/component/TableHeader.tsx +++ b/app/client/src/widgets/TableWidget/component/TableHeader.tsx @@ -192,7 +192,7 @@ function TableHeader(props: TableHeaderProps) { {props.totalRecordsCount ? ( - {props.totalRecordsCount} 条记录 + {props.totalRecordsCount} 条记录123 ) : null} { ) { const maxAllowedPageNumber = Math.ceil( this.props.totalRecordsCount / this.props.pageSize, + // this.props.totalRecordsCount / 2, ); if (this.props.pageNo > maxAllowedPageNumber) { this.props.updateWidgetMetaProperty("pageNo", maxAllowedPageNumber); @@ -1053,6 +1054,7 @@ class TableWidget extends BaseWidget { } }; + // 修改页码 updatePageNumber = (pageNo: number, event?: EventType) => { if (event) { this.props.updateWidgetMetaProperty("pageNo", pageNo, { diff --git a/app/client/src/widgets/TableWidgetV2/component/Table.tsx b/app/client/src/widgets/TableWidgetV2/component/Table.tsx index da02236979f3ee3c300e024d43792a8979a063ce..94a7dcc9826878a09612df52258bc282db53f41b 100644 --- a/app/client/src/widgets/TableWidgetV2/component/Table.tsx +++ b/app/client/src/widgets/TableWidgetV2/component/Table.tsx @@ -152,11 +152,17 @@ export function Table(props: TableProps) { it will not give the correct count of records in the current page when query limit is set higher/lower than the visible number of rows in the table */ + // const pageCount = + // props.serverSidePaginationEnabled && + // props.totalRecordsCount && + // props.data.length + // ? Math.ceil(props.totalRecordsCount / props.data.length) + // : Math.ceil(props.data.length / props.pageSize); const pageCount = props.serverSidePaginationEnabled && props.totalRecordsCount && props.data.length - ? Math.ceil(props.totalRecordsCount / props.data.length) + ? Math.ceil(props.totalRecordsCount / props.pageSize) : Math.ceil(props.data.length / props.pageSize); const currentPageIndex = props.pageNo < pageCount ? props.pageNo : 0; const { diff --git a/app/client/src/widgets/TableWidgetV2/component/index.tsx b/app/client/src/widgets/TableWidgetV2/component/index.tsx index 4f643d3e9e8aaf835d5577dbb86a830c99df8199..52ae86302a2ae1c6043ccc4de281f0f644cea9a6 100644 --- a/app/client/src/widgets/TableWidgetV2/component/index.tsx +++ b/app/client/src/widgets/TableWidgetV2/component/index.tsx @@ -11,7 +11,7 @@ import { Row } from "react-table"; import { EventType } from "constants/AppsmithActionConstants/ActionConstants"; import equal from "fast-deep-equal/es6"; import { ColumnTypes, EditableCell, TableVariant } from "../constants"; -import { useCallback } from "react"; +import { useCallback, useRef } from "react"; export interface ColumnMenuOptionProps { content: string | JSX.Element; @@ -155,7 +155,31 @@ function ReactTableComponent(props: ReactTableComponentProps) { widgetName, width, } = props; + // 修改区--start + // 获取表格组件实例 + // const tableRef = useRef(null); + useEffect(() => { + updatePageSize(); + }, [props.height]); + const updatePageSize = () => { + console.log(props.height); + // const tableHeight = tableRef.current.clientHeight; + const tableHeight = props.height; + const rowHeight = 42; + const newPageSize = Math.floor((tableHeight - 70) / rowHeight); + console.log(newPageSize); + // props.pageSize = newPageSize; + // this.props.updateWidgetMetaProperty("pageSize", newPageSize, { + // triggerPropertyName: "onPageSizeChange", + // dynamicString: this.props.onPageSizeChange, + // event: { + // type: EventType.ON_PAGE_SIZE_CHANGE, + // }, + // }); + // props.updateWidgetProperty("pageSize", pageSize); + }; + // 修改区--end const { columnOrder, hiddenColumns } = useMemo(() => { const order: string[] = []; const hidden: string[] = []; diff --git a/app/client/src/widgets/TableWidgetV2/widget/index.tsx b/app/client/src/widgets/TableWidgetV2/widget/index.tsx index 1946b090c39019d89e88508ebba829ca3ce21506..503a7e5446d14c6e05fa4e79cef73cd9bfe90884 100644 --- a/app/client/src/widgets/TableWidgetV2/widget/index.tsx +++ b/app/client/src/widgets/TableWidgetV2/widget/index.tsx @@ -587,6 +587,7 @@ class TableWidgetV2 extends BaseWidget { serverSidePaginationEnabled, totalRecordsCount, } = this.props; + console.log(pageSize); // Bail out if tableData is a string. This signifies an error in evaluations if (isString(this.props.tableData)) { @@ -674,8 +675,7 @@ class TableWidgetV2 extends BaseWidget { } resetPageNo = (prevProps: TableWidgetProps) => { - const { onPageSizeChange, pageSize } = this.props; - + const { onPageSizeChange, pageSize, totalRecords, pageCount } = this.props; if (pageSize !== prevProps.pageSize) { if (onPageSizeChange) { this.props.updateWidgetMetaProperty("pageNo", 1, { @@ -689,6 +689,9 @@ class TableWidgetV2 extends BaseWidget { this.props.updateWidgetMetaProperty("pageNo", 1); } } + // 更新pageCount + // const newPageCount = Math.ceil(totalRecords / pageSize); + // this.props.updateWidgetMetaProperty("pageCount", newPageCount); }; resetRowSelectionProperties = (prevProps: TableWidgetProps) => { diff --git a/app/client/yarn.lock b/app/client/yarn.lock index 47d7b0ac10ce14832bd75763ade1ce7aa59dfb15..2383c5c781fb65aa2f3da4e9b97bf1cc696923e0 100644 --- a/app/client/yarn.lock +++ b/app/client/yarn.lock @@ -2686,6 +2686,17 @@ proxy-from-env "^1.1.0" which "^2.0.2" +"@sentry/cli@^2.17.5": + version "2.17.5" + resolved "https://registry.npmmirror.com/@sentry/cli/-/cli-2.17.5.tgz#d41e24893a843bcd41e14274044a7ddea9332824" + integrity sha512-0tXjLDpaKB46851EMJ6NbP0o9/gdEaDSLAyjEtXxlVO6+RyhUj6x6jDwn0vis8n/7q0AvbIjAcJrot+TbZP+WQ== + dependencies: + https-proxy-agent "^5.0.0" + node-fetch "^2.6.7" + progress "^2.0.3" + proxy-from-env "^1.1.0" + which "^2.0.2" + "@sentry/core@6.19.7": version "6.19.7" resolved "https://registry.npmmirror.com/@sentry/core/-/core-6.19.7.tgz#156aaa56dd7fad8c89c145be6ad7a4f7209f9785" @@ -6194,13 +6205,6 @@ cropperjs@1.5.7: resolved "https://registry.npmmirror.com/cropperjs/-/cropperjs-1.5.7.tgz#b65019725bae1c6285e881fb661b2141fa57025b" integrity sha512-sGj+G/ofKh+f6A4BtXLJwtcKJgMUsXYVUubfTo9grERiDGXncttefmue/fyQFvn8wfdyoD1KhDRYLfjkJFl0yw== -cross-env@^7.0.3: - version "7.0.3" - resolved "https://registry.npmmirror.com/cross-env/-/cross-env-7.0.3.tgz#865264b29677dc015ba8418918965dd232fc54cf" - integrity sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw== - dependencies: - cross-spawn "^7.0.1" - cross-fetch@^3.0.4, cross-fetch@^3.1.5: version "3.1.5" resolved "https://registry.npmmirror.com/cross-fetch/-/cross-fetch-3.1.5.tgz#e1389f44d9e7ba767907f7af8454787952ab534f" @@ -6219,7 +6223,7 @@ cross-spawn@^6.0.0, cross-spawn@^6.0.5: shebang-command "^1.2.0" which "^1.2.9" -cross-spawn@^7.0.0, cross-spawn@^7.0.1, cross-spawn@^7.0.2, cross-spawn@^7.0.3: +cross-spawn@^7.0.0, cross-spawn@^7.0.2, cross-spawn@^7.0.3: version "7.0.3" resolved "https://registry.npmmirror.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== @@ -11018,6 +11022,11 @@ lines-and-columns@^1.1.6: resolved "https://registry.npmmirror.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== +link-package@^0.1.0: + version "0.1.0" + resolved "https://registry.npmmirror.com/link-package/-/link-package-0.1.0.tgz#aaf35a214420bf31115887641bfb527e3f5e4f22" + integrity sha512-ZB4o7kZzSMGOzHI2dvXGP4mz1AmZHEaC4uuyzg3DBNfW/4yIMG8vyJeEoj14stsOH0zAL1DfvCwxiuGVAPouGA== + lint-staged@^13.0.3: version "13.1.0" resolved "https://registry.npmmirror.com/lint-staged/-/lint-staged-13.1.0.tgz#d4c61aec939e789e489fa51987ec5207b50fd37e" @@ -15534,6 +15543,11 @@ set-cookie-parser@^2.4.6: resolved "https://registry.npmmirror.com/set-cookie-parser/-/set-cookie-parser-2.5.1.tgz#ddd3e9a566b0e8e0862aca974a6ac0e01349430b" integrity sha512-1jeBGaKNGdEq4FgIrORu/N570dwoPYio8lSoYLWmX7sQ//0JY08Xh9o5pBcgmHQ/MbsYp/aZnOe1s1lIsbLprQ== +set@^7.0.3: + version "1.1.1" + resolved "https://registry.npmmirror.com/set/-/set-1.1.1.tgz#b91d758036844b3bf4d4b7ae605bdf92a304746c" + integrity sha512-DX5VQNZBBaraepDszUGMP+b0ztJqRD2WK8aAc2YUgYsf9Hc5EwabiqV6uqL6//em9VR8FS7b1rMcszKS9nQGJg== + setimmediate@^1.0.5, setimmediate@~1.0.4: version "1.0.5" resolved "https://registry.npmmirror.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" diff --git a/app/server/appsmith-plugins/mssqlPlugin/src/main/resources/editor.json b/app/server/appsmith-plugins/mssqlPlugin/src/main/resources/editor.json index 70bd41e87e4007e38b40ddb65c76cdc813c77181..356416ec00e7cb73e7e2bf90770b89e63a9756eb 100644 --- a/app/server/appsmith-plugins/mssqlPlugin/src/main/resources/editor.json +++ b/app/server/appsmith-plugins/mssqlPlugin/src/main/resources/editor.json @@ -29,8 +29,8 @@ } }, { - "label": "Use Prepared Statement", - "info": "Turning on Prepared Statement makes your queries resilient against bad things like SQL injections. However, it cannot be used if your dynamic binding contains any SQL keywords like 'SELECT', 'WHERE', 'AND', etc.", + "label": "使用", + "info": "1", "configProperty": "actionConfiguration.pluginSpecifiedTemplates[0].value", "controlType": "SWITCH", "initialValue": true diff --git a/app/server/appsmith-plugins/mssqlPlugin/src/main/resources/setting.json b/app/server/appsmith-plugins/mssqlPlugin/src/main/resources/setting.json index 51484a26d59cd598730c82ba84456869fa0af5d4..07986b1ea128cd4ee18e0ec1ffdaaae4e1cb5b0c 100644 --- a/app/server/appsmith-plugins/mssqlPlugin/src/main/resources/setting.json +++ b/app/server/appsmith-plugins/mssqlPlugin/src/main/resources/setting.json @@ -17,8 +17,8 @@ "subtitle": "Ask confirmation from the user each time before refreshing data" }, { - "label": "Use Prepared Statement", - "subtitle": "Turning on Prepared Statement makes your queries resilient against bad things like SQL injections. However, it cannot be used if your dynamic binding contains any SQL keywords like 'SELECT', 'WHERE', 'AND', etc.", + "label": "使用", + "subtitle": "1", "configProperty": "actionConfiguration.pluginSpecifiedTemplates[0].value", "controlType": "SWITCH", "initialValue": true diff --git a/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/editor.json b/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/editor.json index 70bd41e87e4007e38b40ddb65c76cdc813c77181..356416ec00e7cb73e7e2bf90770b89e63a9756eb 100644 --- a/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/editor.json +++ b/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/editor.json @@ -29,8 +29,8 @@ } }, { - "label": "Use Prepared Statement", - "info": "Turning on Prepared Statement makes your queries resilient against bad things like SQL injections. However, it cannot be used if your dynamic binding contains any SQL keywords like 'SELECT', 'WHERE', 'AND', etc.", + "label": "使用", + "info": "1", "configProperty": "actionConfiguration.pluginSpecifiedTemplates[0].value", "controlType": "SWITCH", "initialValue": true diff --git a/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/setting.json b/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/setting.json index 51484a26d59cd598730c82ba84456869fa0af5d4..07986b1ea128cd4ee18e0ec1ffdaaae4e1cb5b0c 100644 --- a/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/setting.json +++ b/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/setting.json @@ -17,8 +17,8 @@ "subtitle": "Ask confirmation from the user each time before refreshing data" }, { - "label": "Use Prepared Statement", - "subtitle": "Turning on Prepared Statement makes your queries resilient against bad things like SQL injections. However, it cannot be used if your dynamic binding contains any SQL keywords like 'SELECT', 'WHERE', 'AND', etc.", + "label": "使用", + "subtitle": "1", "configProperty": "actionConfiguration.pluginSpecifiedTemplates[0].value", "controlType": "SWITCH", "initialValue": true diff --git a/app/server/appsmith-plugins/postgresPlugin/src/main/resources/editor.json b/app/server/appsmith-plugins/postgresPlugin/src/main/resources/editor.json index 32f522a72da89f718f60d77039d5301b9501f280..0a8c7a65dee9d6ee6511b36e1d5af34323320288 100644 --- a/app/server/appsmith-plugins/postgresPlugin/src/main/resources/editor.json +++ b/app/server/appsmith-plugins/postgresPlugin/src/main/resources/editor.json @@ -29,7 +29,7 @@ } }, { - "label": "Use Prepared Statement", + "label": "使用", "info": "Turning on Prepared Statement makes your queries resilient against bad things like SQL injections. However, it cannot be used if your dynamic binding contains any SQL keywords like 'SELECT', 'WHERE', 'AND', etc.", "configProperty": "actionConfiguration.pluginSpecifiedTemplates[0].value", "controlType": "SWITCH", diff --git a/app/shared/ast/package.json b/app/shared/ast/package.json index 21a96f9c8b46d7682233814b2bb67fd63a059b1d..3ca4d80638b98cb4efd8519714c6d32b5c199cf7 100644 --- a/app/shared/ast/package.json +++ b/app/shared/ast/package.json @@ -17,6 +17,7 @@ "test:jest": "$(npm bin)/jest --watch", "build": "rollup -c", "start": "rollup -c", + "test-yarn": "yarn -v", "link-package-win": "yarn install && rollup -c && cd build && xcopy ..\\node_modules .\\node_modules\\ /y/s/i && yarn link", "link-package": "yarn install && rollup -c && cd build && cp -R ../node_modules ./node_modules && yarn link" },