From fe4cf8e27efa4c86bb0409400d27a55f1ce15d49 Mon Sep 17 00:00:00 2001 From: Imshann <851188611@qq.com> Date: Thu, 17 Feb 2022 17:16:43 +0800 Subject: [PATCH] 修复BUG --- build/Checkbox/Checkbox.js | 1 + build/Pagination/Pagination.js | 6 +++++- build/Table/Table.js | 15 ++++----------- dist/ng-antd.js | 12 ++++++------ src/Pagination/Pagination.js | 4 +++- src/Table/Table.js | 15 ++++----------- webpack.config.js | 4 ++-- 7 files changed, 25 insertions(+), 32 deletions(-) diff --git a/build/Checkbox/Checkbox.js b/build/Checkbox/Checkbox.js index 6535027..9fa20d2 100644 --- a/build/Checkbox/Checkbox.js +++ b/build/Checkbox/Checkbox.js @@ -46,6 +46,7 @@ angular.module("esNgAntd").directive("antdCheckbox", function (esNgAntd) { $scope.handleClick = function ($event) { $scope.state.checked = !$scope.state.checked; + $event.target.checked = $scope.state.checked; $scope.onChange({ event: $event, }); diff --git a/build/Pagination/Pagination.js b/build/Pagination/Pagination.js index f6c8909..d3682dc 100644 --- a/build/Pagination/Pagination.js +++ b/build/Pagination/Pagination.js @@ -121,7 +121,9 @@ angular.module("esNgAntd").directive("antdPagination", function (esNgAntd) { return ( Math.ceil( $scope.state.total / - ($scope.pageSize || $scope.defaultPageSize || 10) + ($scope.state.pageSize || + $scope.defaultPageSize || + 10) ) || 1 ); }; @@ -164,6 +166,8 @@ angular.module("esNgAntd").directive("antdPagination", function (esNgAntd) { $scope.handleChange = function () { let current = $scope.state.current; + $scope.state.pageNum = $scope.getPageNum(); + $scope.state.pageNumList = $scope.getPageNumList(); if ($scope.state.current > $scope.state.pageNum) { current = $scope.state.pageNum; diff --git a/build/Table/Table.js b/build/Table/Table.js index 27bea95..d00f392 100644 --- a/build/Table/Table.js +++ b/build/Table/Table.js @@ -85,17 +85,10 @@ angular.module("esNgAntd").directive("antdTable", function (esNgAntd) { }, "rowSelection.selectedRowKeys": (newVal) => { if (Array.isArray(newVal)) { - if (newVal.length > 0) { - $scope.state.dataSource.map(function (row, key) { - if (newVal.includes(key)) { - row.checked = true; - } - }); - } else { - $scope.state.dataSource.map(function (row) { - row.checked = false; - }); - } + $scope.state.selectedrecordKeys = newVal; + $scope.state.dataSource.map(function (row, key) { + row.checked = newVal.includes(key); + }); } }, }; diff --git a/dist/ng-antd.js b/dist/ng-antd.js index d55dbed..75e6c0f 100644 --- a/dist/ng-antd.js +++ b/dist/ng-antd.js @@ -38,7 +38,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Bre /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _BreadcrumbItem_html__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BreadcrumbItem.html */ \"./build/BreadcrumbItem/BreadcrumbItem.html\");\n\nangular.module(\"esNgAntd\").directive(\"antdBreadcrumbItem\", function () {\n return {\n controllerAs: \"antdBreadcrumbItem\",\n restrict: \"E\",\n transclude: true,\n replace: true,\n template: _BreadcrumbItem_html__WEBPACK_IMPORTED_MODULE_0__[\"default\"],\n };\n});\n\n\n//# sourceURL=webpack://ng-antd/./build/BreadcrumbItem/BreadcrumbItem.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _BreadcrumbItem_html__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BreadcrumbItem.html */ \"./build/BreadcrumbItem/BreadcrumbItem.html\");\n\nangular.module(\"esNgAntd\").directive(\"antdBreadcrumbItem\", function () {\n return {\n controllerAs: \"antdBreadcrumbItem\",\n restrict: \"E\",\n transclude: true,\n replace: true,\n scope: {\n href: \"@\",\n },\n template: _BreadcrumbItem_html__WEBPACK_IMPORTED_MODULE_0__[\"default\"],\n };\n});\n\n\n//# sourceURL=webpack://ng-antd/./build/BreadcrumbItem/BreadcrumbItem.js?"); /***/ }), @@ -93,7 +93,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Che /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Col_html__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Col.html */ \"./build/Col/Col.html\");\n/* harmony import */ var antd_lib_grid_style_index_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! antd/lib/grid/style/index.css */ \"./node_modules/antd/lib/grid/style/index.css\");\n/**\n * 列\n */\n\n\nangular.module(\"esNgAntd\").directive(\"antdCol\", function (esNgAntd) {\n return {\n controllerAs: \"antdCol\",\n restrict: \"E\",\n transclude: true,\n replace: true,\n scope: {\n span: \"@\",\n },\n template: _Col_html__WEBPACK_IMPORTED_MODULE_0__[\"default\"],\n controller: function ($scope, $element, $attrs) {\n this.getContext = function () {\n return $scope;\n };\n\n $scope.state = {\n className: [\"ant-col\"],\n };\n },\n require: [\"?^antdRow\"],\n link: function ($scope, $element, $attrs, $controllers, $transclude) {\n let [antdRow] = $controllers;\n esNgAntd.createStyle(\"ant-grid\", antd_lib_grid_style_index_css__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\n $element[0].removeAttribute(\"ng-style\");\n $element[0].removeAttribute(\"ng-transclude\");\n $element[0].removeAttribute(\"ng-class\");\n $element[0].removeAttribute(\"span\");\n\n if (antdRow) {\n $scope.antdRow = antdRow.getContext();\n }\n\n if ($scope.span) {\n $scope.state.className.push(\"ant-col-\" + $scope.span);\n } // if (this.props.xs) {\n // this.state.className.push(\"col-xs-\" + this.props.xs);\n // }\n // if (this.props.sm) {\n // this.state.className.push(\"col-sm-\" + this.props.sm);\n // }\n // if (this.props.md) {\n // this.state.className.push(\"col-md-\" + this.props.md);\n // }\n // if (this.props.lg) {\n // this.state.className.push(\"col-lg-\" + this.props.lg);\n // }\n // this.state.className = this.state.className.join(\" \");\n },\n };\n});\n\n\n//# sourceURL=webpack://ng-antd/./build/Col/Col.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Col_html__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Col.html */ \"./build/Col/Col.html\");\n/* harmony import */ var antd_lib_grid_style_index_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! antd/lib/grid/style/index.css */ \"./node_modules/antd/lib/grid/style/index.css\");\n/**\n * 列\n */\n\n\nangular.module(\"esNgAntd\").directive(\"antdCol\", function (esNgAntd) {\n return {\n controllerAs: \"antdCol\",\n restrict: \"E\",\n transclude: true,\n replace: true,\n scope: {\n span: \"@\",\n offset: \"@\",\n },\n template: _Col_html__WEBPACK_IMPORTED_MODULE_0__[\"default\"],\n controller: function ($scope, $element, $attrs) {\n this.getContext = function () {\n return $scope;\n };\n\n $scope.state = {\n className: [\"ant-col\"],\n };\n },\n require: [\"?^antdRow\"],\n link: function ($scope, $element, $attrs, $controllers, $transclude) {\n let [antdRow] = $controllers;\n esNgAntd.createStyle(\"ant-grid\", antd_lib_grid_style_index_css__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\n $element[0].removeAttribute(\"ng-style\");\n $element[0].removeAttribute(\"ng-transclude\");\n $element[0].removeAttribute(\"ng-class\");\n $element[0].removeAttribute(\"span\");\n\n if (antdRow) {\n $scope.antdRow = antdRow.getContext();\n }\n\n if ($scope.span) {\n $scope.state.className.push(\"ant-col-\" + $scope.span);\n } // if (this.props.xs) {\n // this.state.className.push(\"col-xs-\" + this.props.xs);\n // }\n // if (this.props.sm) {\n // this.state.className.push(\"col-sm-\" + this.props.sm);\n // }\n // if (this.props.md) {\n // this.state.className.push(\"col-md-\" + this.props.md);\n // }\n // if (this.props.lg) {\n // this.state.className.push(\"col-lg-\" + this.props.lg);\n // }\n // this.state.className = this.state.className.join(\" \");\n },\n };\n});\n\n\n//# sourceURL=webpack://ng-antd/./build/Col/Col.js?"); /***/ }), @@ -411,7 +411,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Tab /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Table_html__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Table.html */ \"./build/Table/Table.html\");\n/* harmony import */ var antd_lib_table_style_index_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! antd/lib/table/style/index.css */ \"./node_modules/antd/lib/table/style/index.css\");\n\n\nangular.module(\"esNgAntd\").directive(\"antdTable\", function (esNgAntd) {\n return {\n controllerAs: \"antdTable\",\n restrict: \"E\",\n transclude: true,\n replace: true,\n scope: {\n columns: \"=\",\n dSource: \"=\",\n rowSelection: \"=\",\n rowKey: \"@\",\n loading: \"@\",\n onChange: \"&\",\n size: \"@\",\n },\n template: _Table_html__WEBPACK_IMPORTED_MODULE_0__[\"default\"],\n controller: function ($scope, $element, $attrs) {\n this.getContext = function () {\n return $scope;\n };\n\n $scope.state = {\n size: $scope.size || \"default\",\n dataSource: [],\n selectedrecordKeys: [],\n selectedrecords: [],\n isSelectAll: false,\n rowKey: $scope.rowKey || \"id\",\n sortDirections: [\"ascend\", \"descend\"],\n sorter: {\n field: null,\n order: null,\n },\n };\n $scope.watch = {\n dSource: (newValue) => {\n if (newValue !== undefined) {\n let dataSource = [];\n newValue.forEach((record, index) => {\n let row = {};\n\n if ($scope.rowSelection) {\n row.checked = false;\n row.disabled = false;\n }\n\n if (\n $scope.rowSelection &&\n typeof $scope.rowSelection.getCheckboxProps ===\n \"function\"\n ) {\n let extraAttr =\n $scope.rowSelection.getCheckboxProps(\n record\n );\n row = Object.assign(row, extraAttr);\n }\n\n $scope.columns.forEach((column) => {\n // 排序\n if (column.sortOrder) {\n $scope.state.sorter.field = column.key;\n $scope.state.sorter.order =\n column.sortOrder;\n }\n\n row[column.key] = column.render\n ? $scope.getRender(column, record, index)\n : record[column.key];\n }); // 主键\n\n if ($scope.rowKey !== undefined) {\n row[$scope.state.rowKey] =\n record[$scope.state.rowKey];\n } else {\n row[$scope.state.rowKey] = index + 1;\n }\n\n dataSource[index] = row;\n });\n $scope.state.dataSource = dataSource;\n }\n },\n \"rowSelection.selectedRowKeys\": (newVal) => {\n if (Array.isArray(newVal)) {\n if (newVal.length > 0) {\n $scope.state.dataSource.map(function (row, key) {\n if (newVal.includes(key)) {\n row.checked = true;\n }\n });\n } else {\n $scope.state.dataSource.map(function (row) {\n row.checked = false;\n });\n }\n }\n },\n };\n\n for (const key in $scope.watch) {\n $scope.$watch(key, $scope.watch[key], true);\n }\n\n $scope.getParameterName = function (fn) {\n if (typeof fn !== \"object\" && typeof fn !== \"function\") return;\n const COMMENTS = /((\\/\\/.*$)|(\\/\\*[\\s\\S]*?\\*\\/))/gm;\n const DEFAULT_PARAMS = /=[^,)]+/gm;\n const FAT_ARROWS = /=>.*$/gm;\n let code = fn.prototype\n ? fn.prototype.constructor.toString()\n : fn.toString();\n code = code\n .replace(COMMENTS, \"\")\n .replace(FAT_ARROWS, \"\")\n .replace(DEFAULT_PARAMS, \"\");\n let result = code\n .slice(code.indexOf(\"(\") + 1, code.indexOf(\")\"))\n .match(/([^\\s,]+)/g);\n return result === null ? [] : result;\n };\n\n $scope.getRender = function (column, record, index) {\n let params = $scope.getParameterName(column.render);\n let render = column.render(record[column.key], record, index);\n\n if ($attrs.dSource) {\n if (params[0]) {\n render = render.replace(\n new RegExp(`(\\{\\{.*?)${params[0]}(.*?\\}\\})`, \"g\"),\n `$1${$attrs.dSource}[${index}].${column.key}$2`\n );\n }\n\n if (params[1]) {\n render = render.replace(\n new RegExp(`(\\{\\{.*?)${params[1]}(.*?\\}\\})`, \"g\"),\n `$1${$attrs.dSource}[${index}]$2`\n );\n }\n\n if (params[2]) {\n render = render.replace(\n new RegExp(`(\\{\\{.*?)${params[2]}(.*?\\}\\})`, \"g\"),\n `$1${index}$2`\n );\n }\n }\n\n return render;\n };\n\n $scope.handleSelectAll = function (event) {\n $scope.state.isSelectAll = event.target.checked;\n $scope.state.selectedrecordKeys = [];\n $scope.state.selectedrecords = [];\n $scope.state.dataSource.map((record, key) => {\n if (record.disabled === false) {\n record.checked = event.target.checked;\n }\n\n if (record.checked) {\n $scope.state.selectedrecordKeys.push(key);\n $scope.state.selectedrecords.push($scope.dSource[key]);\n }\n\n return record;\n });\n\n if (typeof $scope.rowSelection.onChange === \"function\") {\n $scope.rowSelection.onChange(\n $scope.state.selectedrecordKeys,\n $scope.state.selectedrecords\n );\n }\n };\n\n $scope.handleSelect = function (event, index) {\n let pos = $scope.state.selectedrecordKeys.findIndex(\n (value) => value === index\n );\n\n if (event.target.checked && pos === -1) {\n $scope.state.selectedrecordKeys.push(index);\n $scope.state.selectedrecords.push($scope.dSource[index]);\n } else {\n $scope.state.selectedrecordKeys.splice(pos, 1);\n $scope.state.selectedrecords.splice(pos, 1);\n }\n\n if ($scope.state.selectedrecordKeys.length === 0) {\n $scope.state.isSelectAll = false;\n }\n\n if (typeof $scope.rowSelection.onChange === \"function\") {\n $scope.rowSelection.onChange(\n $scope.state.selectedrecordKeys,\n $scope.state.selectedrecords\n );\n }\n };\n\n $scope.handleSorter = function (key) {\n $scope.state.sorter.field = key;\n\n if ($scope.state.sorter.order === null) {\n $scope.state.sorter.order = \"ascend\";\n } else if ($scope.state.sorter.order === \"ascend\") {\n $scope.state.sorter.order = \"descend\";\n } else if ($scope.state.sorter.order === \"descend\") {\n $scope.state.sorter.order = null;\n $scope.state.sorter.field = null;\n }\n\n $scope.onChange({\n sorter: $scope.state.sorter,\n });\n };\n },\n link: function ($scope, $element, $attrs, $controllers, $transclude) {\n esNgAntd.createStyle(\"ant-table\", antd_lib_table_style_index_css__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\n },\n };\n});\n\n\n//# sourceURL=webpack://ng-antd/./build/Table/Table.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Table_html__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Table.html */ \"./build/Table/Table.html\");\n/* harmony import */ var antd_lib_table_style_index_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! antd/lib/table/style/index.css */ \"./node_modules/antd/lib/table/style/index.css\");\n\n\nangular.module(\"esNgAntd\").directive(\"antdTable\", function (esNgAntd) {\n return {\n controllerAs: \"antdTable\",\n restrict: \"E\",\n transclude: true,\n replace: true,\n scope: {\n columns: \"=\",\n dSource: \"=\",\n rowSelection: \"=\",\n rowKey: \"@\",\n loading: \"@\",\n onChange: \"&\",\n size: \"@\",\n },\n template: _Table_html__WEBPACK_IMPORTED_MODULE_0__[\"default\"],\n controller: function ($scope, $element, $attrs) {\n this.getContext = function () {\n return $scope;\n };\n\n $scope.state = {\n size: $scope.size || \"default\",\n dataSource: [],\n selectedrecordKeys: [],\n selectedrecords: [],\n isSelectAll: false,\n rowKey: $scope.rowKey || \"id\",\n sortDirections: [\"ascend\", \"descend\"],\n sorter: {\n field: null,\n order: null,\n },\n };\n $scope.watch = {\n dSource: (newValue) => {\n if (newValue !== undefined) {\n let dataSource = [];\n newValue.forEach((record, index) => {\n let row = {};\n\n if ($scope.rowSelection) {\n row.checked = false;\n row.disabled = false;\n }\n\n if (\n $scope.rowSelection &&\n typeof $scope.rowSelection.getCheckboxProps ===\n \"function\"\n ) {\n let extraAttr =\n $scope.rowSelection.getCheckboxProps(\n record\n );\n row = Object.assign(row, extraAttr);\n }\n\n $scope.columns.forEach((column) => {\n // 排序\n if (column.sortOrder) {\n $scope.state.sorter.field = column.key;\n $scope.state.sorter.order =\n column.sortOrder;\n }\n\n row[column.key] = column.render\n ? $scope.getRender(column, record, index)\n : record[column.key];\n }); // 主键\n\n if ($scope.rowKey !== undefined) {\n row[$scope.state.rowKey] =\n record[$scope.state.rowKey];\n } else {\n row[$scope.state.rowKey] = index + 1;\n }\n\n dataSource[index] = row;\n });\n $scope.state.dataSource = dataSource;\n }\n },\n \"rowSelection.selectedRowKeys\": (newVal) => {\n if (Array.isArray(newVal)) {\n $scope.state.dataSource.map(function (row, key) {\n row.checked = newVal.includes(key);\n }); // if (newVal.length > 0) {\n // this.state.dataSource.map(function (row, key) {\n // if (newVal.includes(key)) {\n // row.checked = true;\n // }\n // });\n // } else {\n // this.state.dataSource.map(function (row) {\n // row.checked = false;\n // });\n // }\n }\n },\n };\n\n for (const key in $scope.watch) {\n $scope.$watch(key, $scope.watch[key], true);\n }\n\n $scope.getParameterName = function (fn) {\n if (typeof fn !== \"object\" && typeof fn !== \"function\") return;\n const COMMENTS = /((\\/\\/.*$)|(\\/\\*[\\s\\S]*?\\*\\/))/gm;\n const DEFAULT_PARAMS = /=[^,)]+/gm;\n const FAT_ARROWS = /=>.*$/gm;\n let code = fn.prototype\n ? fn.prototype.constructor.toString()\n : fn.toString();\n code = code\n .replace(COMMENTS, \"\")\n .replace(FAT_ARROWS, \"\")\n .replace(DEFAULT_PARAMS, \"\");\n let result = code\n .slice(code.indexOf(\"(\") + 1, code.indexOf(\")\"))\n .match(/([^\\s,]+)/g);\n return result === null ? [] : result;\n };\n\n $scope.getRender = function (column, record, index) {\n let params = $scope.getParameterName(column.render);\n let render = column.render(record[column.key], record, index);\n\n if ($attrs.dSource) {\n if (params[0]) {\n render = render.replace(\n new RegExp(`(\\{\\{.*?)${params[0]}(.*?\\}\\})`, \"g\"),\n `$1${$attrs.dSource}[${index}].${column.key}$2`\n );\n }\n\n if (params[1]) {\n render = render.replace(\n new RegExp(`(\\{\\{.*?)${params[1]}(.*?\\}\\})`, \"g\"),\n `$1${$attrs.dSource}[${index}]$2`\n );\n }\n\n if (params[2]) {\n render = render.replace(\n new RegExp(`(\\{\\{.*?)${params[2]}(.*?\\}\\})`, \"g\"),\n `$1${index}$2`\n );\n }\n }\n\n return render;\n };\n\n $scope.handleSelectAll = function (event) {\n $scope.state.isSelectAll = event.target.checked;\n $scope.state.selectedrecordKeys = [];\n $scope.state.selectedrecords = [];\n $scope.state.dataSource.map((record, key) => {\n if (record.disabled === false) {\n record.checked = event.target.checked;\n }\n\n if (record.checked) {\n $scope.state.selectedrecordKeys.push(key);\n $scope.state.selectedrecords.push($scope.dSource[key]);\n }\n\n return record;\n });\n\n if (typeof $scope.rowSelection.onChange === \"function\") {\n $scope.rowSelection.onChange(\n $scope.state.selectedrecordKeys,\n $scope.state.selectedrecords\n );\n }\n };\n\n $scope.handleSelect = function (event, index) {\n let pos = $scope.state.selectedrecordKeys.findIndex(\n (value) => value === index\n );\n\n if (event.target.checked && pos === -1) {\n $scope.state.selectedrecordKeys.push(index);\n $scope.state.selectedrecords.push($scope.dSource[index]);\n } else {\n $scope.state.selectedrecordKeys.splice(pos, 1);\n $scope.state.selectedrecords.splice(pos, 1);\n }\n\n if ($scope.state.selectedrecordKeys.length === 0) {\n $scope.state.isSelectAll = false;\n }\n\n if (typeof $scope.rowSelection.onChange === \"function\") {\n $scope.rowSelection.onChange(\n $scope.state.selectedrecordKeys,\n $scope.state.selectedrecords\n );\n }\n };\n\n $scope.handleSorter = function (key) {\n $scope.state.sorter.field = key;\n\n if ($scope.state.sorter.order === null) {\n $scope.state.sorter.order = \"ascend\";\n } else if ($scope.state.sorter.order === \"ascend\") {\n $scope.state.sorter.order = \"descend\";\n } else if ($scope.state.sorter.order === \"descend\") {\n $scope.state.sorter.order = null;\n $scope.state.sorter.field = null;\n }\n\n $scope.onChange({\n sorter: $scope.state.sorter,\n });\n };\n },\n link: function ($scope, $element, $attrs, $controllers, $transclude) {\n esNgAntd.createStyle(\"ant-table\", antd_lib_table_style_index_css__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\n },\n };\n});\n\n\n//# sourceURL=webpack://ng-antd/./build/Table/Table.js?"); /***/ }), @@ -9452,7 +9452,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Module\nvar code = \"\\n \\n /\\n\";\n// Exports\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (code);\n\n//# sourceURL=webpack://ng-antd/./build/BreadcrumbItem/BreadcrumbItem.html?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Module\nvar code = \"\\n \\n \\n \\n /\\n\";\n// Exports\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (code);\n\n//# sourceURL=webpack://ng-antd/./build/BreadcrumbItem/BreadcrumbItem.html?"); /***/ }), @@ -9507,7 +9507,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Module\nvar code = \"
\";\n// Exports\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (code);\n\n//# sourceURL=webpack://ng-antd/./build/Col/Col.html?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Module\nvar code = \"
\";\n// Exports\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (code);\n\n//# sourceURL=webpack://ng-antd/./build/Col/Col.html?"); /***/ }), @@ -9771,7 +9771,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Module\nvar code = \"
\\n
\\n
\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n
\\n \\n
\\n \\n
\\n \\n
\\n
\\n
\\n
\\n
\\n {{column.title}}\\n
\\n {{column.title}}\\n \\n \\n \\n \\n \\n \\n
\\n
\\n \\n \\n \\n \\n \\n
\\n \\n
\\n
\\n
\\n
\";\n// Exports\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (code);\n\n//# sourceURL=webpack://ng-antd/./build/Table/Table.html?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Module\nvar code = \"
\\n
\\n
\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n
\\n \\n
\\n \\n
\\n \\n
\\n
\\n
\\n
\\n
\\n {{column.title}}\\n
\\n {{column.title}}\\n \\n \\n \\n \\n \\n \\n
\\n
\\n \\n \\n \\n \\n \\n
\\n \\n
\\n
\\n
\\n
\";\n// Exports\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (code);\n\n//# sourceURL=webpack://ng-antd/./build/Table/Table.html?"); /***/ }), diff --git a/src/Pagination/Pagination.js b/src/Pagination/Pagination.js index 540fa93..f2f8a1c 100644 --- a/src/Pagination/Pagination.js +++ b/src/Pagination/Pagination.js @@ -114,7 +114,7 @@ class Pagination { return ( Math.ceil( this.state.total / - (this.props.pageSize || this.props.defaultPageSize || 10) + (this.state.pageSize || this.props.defaultPageSize || 10) ) || 1 ); } @@ -152,6 +152,8 @@ class Pagination { handleChange() { let current = this.state.current; + this.state.pageNum = this.getPageNum(); + this.state.pageNumList = this.getPageNumList(); if (this.state.current > this.state.pageNum) { current = this.state.pageNum; } else if (this.state.current < 1) { diff --git a/src/Table/Table.js b/src/Table/Table.js index 07a4358..d7d4c26 100644 --- a/src/Table/Table.js +++ b/src/Table/Table.js @@ -72,17 +72,10 @@ class Table { }, "rowSelection.selectedRowKeys": (newVal) => { if (Array.isArray(newVal)) { - if (newVal.length > 0) { - this.state.dataSource.map(function (row, key) { - if (newVal.includes(key)) { - row.checked = true; - } - }); - } else { - this.state.dataSource.map(function (row) { - row.checked = false; - }); - } + this.state.selectedrecordKeys = newVal; + this.state.dataSource.map(function (row, key) { + row.checked = newVal.includes(key); + }); } }, }; diff --git a/webpack.config.js b/webpack.config.js index 8aeae93..700bc4e 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -6,11 +6,11 @@ module.exports = { entry: "./build/index.js", output: { // bpms - path: "/Users/shann/Project/essa/bpms/bpms-webapp/src/main/webapp/lib/ng-antd", + // path: "/Users/shann/Project/essa/bpms/bpms-webapp/src/main/webapp/lib/ng-antd", // boss // path: "/Users/shann/Project/essa/boss/trunk/vendor-lib/ng-antd", // mvo - // path: "/Users/shann/Project/essa/mvo/mvo-webapp/public/browser-vendor/ng-antd", + path: "/Users/shann/Project/essa/mvo/mvo-webapp/public/browser-vendor/ng-antd", // local // path: path.resolve(__dirname, "dist"), filename: "ng-antd.js", -- libgit2 0.21.2