Commit fe4cf8e27efa4c86bb0409400d27a55f1ce15d49
1 parent
d6436262
修复BUG
Showing
7 changed files
with
25 additions
and
32 deletions
Show diff stats
build/Checkbox/Checkbox.js
@@ -46,6 +46,7 @@ angular.module("esNgAntd").directive("antdCheckbox", function (esNgAntd) { | @@ -46,6 +46,7 @@ angular.module("esNgAntd").directive("antdCheckbox", function (esNgAntd) { | ||
46 | 46 | ||
47 | $scope.handleClick = function ($event) { | 47 | $scope.handleClick = function ($event) { |
48 | $scope.state.checked = !$scope.state.checked; | 48 | $scope.state.checked = !$scope.state.checked; |
49 | + $event.target.checked = $scope.state.checked; | ||
49 | $scope.onChange({ | 50 | $scope.onChange({ |
50 | event: $event, | 51 | event: $event, |
51 | }); | 52 | }); |
build/Pagination/Pagination.js
@@ -121,7 +121,9 @@ angular.module("esNgAntd").directive("antdPagination", function (esNgAntd) { | @@ -121,7 +121,9 @@ angular.module("esNgAntd").directive("antdPagination", function (esNgAntd) { | ||
121 | return ( | 121 | return ( |
122 | Math.ceil( | 122 | Math.ceil( |
123 | $scope.state.total / | 123 | $scope.state.total / |
124 | - ($scope.pageSize || $scope.defaultPageSize || 10) | 124 | + ($scope.state.pageSize || |
125 | + $scope.defaultPageSize || | ||
126 | + 10) | ||
125 | ) || 1 | 127 | ) || 1 |
126 | ); | 128 | ); |
127 | }; | 129 | }; |
@@ -164,6 +166,8 @@ angular.module("esNgAntd").directive("antdPagination", function (esNgAntd) { | @@ -164,6 +166,8 @@ angular.module("esNgAntd").directive("antdPagination", function (esNgAntd) { | ||
164 | 166 | ||
165 | $scope.handleChange = function () { | 167 | $scope.handleChange = function () { |
166 | let current = $scope.state.current; | 168 | let current = $scope.state.current; |
169 | + $scope.state.pageNum = $scope.getPageNum(); | ||
170 | + $scope.state.pageNumList = $scope.getPageNumList(); | ||
167 | 171 | ||
168 | if ($scope.state.current > $scope.state.pageNum) { | 172 | if ($scope.state.current > $scope.state.pageNum) { |
169 | current = $scope.state.pageNum; | 173 | current = $scope.state.pageNum; |
build/Table/Table.js
@@ -85,17 +85,10 @@ angular.module("esNgAntd").directive("antdTable", function (esNgAntd) { | @@ -85,17 +85,10 @@ angular.module("esNgAntd").directive("antdTable", function (esNgAntd) { | ||
85 | }, | 85 | }, |
86 | "rowSelection.selectedRowKeys": (newVal) => { | 86 | "rowSelection.selectedRowKeys": (newVal) => { |
87 | if (Array.isArray(newVal)) { | 87 | if (Array.isArray(newVal)) { |
88 | - if (newVal.length > 0) { | ||
89 | - $scope.state.dataSource.map(function (row, key) { | ||
90 | - if (newVal.includes(key)) { | ||
91 | - row.checked = true; | ||
92 | - } | ||
93 | - }); | ||
94 | - } else { | ||
95 | - $scope.state.dataSource.map(function (row) { | ||
96 | - row.checked = false; | ||
97 | - }); | ||
98 | - } | 88 | + $scope.state.selectedrecordKeys = newVal; |
89 | + $scope.state.dataSource.map(function (row, key) { | ||
90 | + row.checked = newVal.includes(key); | ||
91 | + }); | ||
99 | } | 92 | } |
100 | }, | 93 | }, |
101 | }; | 94 | }; |
dist/ng-antd.js
@@ -38,7 +38,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Bre | @@ -38,7 +38,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Bre | ||
38 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | 38 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
39 | 39 | ||
40 | "use strict"; | 40 | "use strict"; |
41 | -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?"); | 41 | +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?"); |
42 | 42 | ||
43 | /***/ }), | 43 | /***/ }), |
44 | 44 | ||
@@ -93,7 +93,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Che | @@ -93,7 +93,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Che | ||
93 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | 93 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
94 | 94 | ||
95 | "use strict"; | 95 | "use strict"; |
96 | -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?"); | 96 | +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?"); |
97 | 97 | ||
98 | /***/ }), | 98 | /***/ }), |
99 | 99 | ||
@@ -411,7 +411,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Tab | @@ -411,7 +411,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Tab | ||
411 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | 411 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
412 | 412 | ||
413 | "use strict"; | 413 | "use strict"; |
414 | -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?"); | 414 | +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?"); |
415 | 415 | ||
416 | /***/ }), | 416 | /***/ }), |
417 | 417 | ||
@@ -9452,7 +9452,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac | @@ -9452,7 +9452,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac | ||
9452 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | 9452 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
9453 | 9453 | ||
9454 | "use strict"; | 9454 | "use strict"; |
9455 | -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 = \"<span>\\n <span class=\\\"ant-breadcrumb-link\\\" ng-transclude></span>\n <span class=\\"ant-breadcrumb-separator\\">/</span>\n</span>\";\n// Exports\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (code);\n\n//# sourceURL=webpack://ng-antd/./build/BreadcrumbItem/BreadcrumbItem.html?"); | 9455 | +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 = \"<span>\\n <span class=\\\"ant-breadcrumb-link\\\">\\n <a ng-href=\\\"{{href}}\\\" target=\\\"_self\\\" ng-transclude></a>\\n </span>\n <span class=\\"ant-breadcrumb-separator\\">/</span>\n</span>\";\n// Exports\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (code);\n\n//# sourceURL=webpack://ng-antd/./build/BreadcrumbItem/BreadcrumbItem.html?"); |
9456 | 9456 | ||
9457 | /***/ }), | 9457 | /***/ }), |
9458 | 9458 | ||
@@ -9507,7 +9507,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac | @@ -9507,7 +9507,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac | ||
9507 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | 9507 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
9508 | 9508 | ||
9509 | "use strict"; | 9509 | "use strict"; |
9510 | -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 = \"<div ng-class=\\\"'ant-col'+(span?' ant-col-'+span:'')\\" ng-style=\\"{paddingLeft:antdRow.state.gutterHalf+'px',paddingRight:antdRow.state.gutterHalf+'px'}\\" ng-transclude></div>\";\n// Exports\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (code);\n\n//# sourceURL=webpack://ng-antd/./build/Col/Col.html?"); | 9510 | +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 = \"<div ng-class=\\\"'ant-col'+(span?' ant-col-'+span:'')+(offset?' ant-col-offset-'+offset:'')\\" ng-style=\\"{paddingLeft:antdRow.state.gutterHalf+'px',paddingRight:antdRow.state.gutterHalf+'px'}\\" ng-transclude></div>\";\n// Exports\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (code);\n\n//# sourceURL=webpack://ng-antd/./build/Col/Col.html?"); |
9511 | 9511 | ||
9512 | /***/ }), | 9512 | /***/ }), |
9513 | 9513 | ||
@@ -9771,7 +9771,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac | @@ -9771,7 +9771,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac | ||
9771 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | 9771 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
9772 | 9772 | ||
9773 | "use strict"; | 9773 | "use strict"; |
9774 | -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 = \"<div class=\\\"ant-table-wrapper\\\">\\n <div ng-class=\\\"'ant-table ant-table-'+state.size\\\">\\n <div class=\\\"ant-table-content\\\">\\n <table>\\n <thead class=\\\"ant-table-thead\\\">\\n <tr>\\n <th ng-if=\\\"rowSelection\\\" class=\\\"ant-table-selection-column\\\">\\n <span ng-if=\\\"!rowSelection.hideSelectAll\\\" class=\\\"ant-table-header-column\\\">\\n <div>\\n <span class=\\\"ant-table-column-title\\\">\\n <div class=\\\"ant-table-selection\\\">\\n <antd-checkbox on-change=\\\"handleSelectAll(event)\\\" checked=\\\"{{state.isSelectAll}}\\\" />\\n </div>\\n </span>\\n </div>\\n </span>\\n </th>\\n <th ng-repeat=\\\"(key, column) in columns track by key\\\" class=\\\"ant-table-cell ant-table-column-has-sorters\\\" ng-style=\\\"{width:column.width}\\\">\\n <span ng-if=\\\"!column.sorter\\\">{{column.title}}</span>\\n <div ng-if=\\\"column.sorter\\\" class=\\\"ant-table-column-sorters\\\" ng-click=\\\"handleSorter(column.key)\\\">\\n <span class=\\\"ant-table-column-title\\\">{{column.title}}</span>\\n <span class=\\\"ant-table-column-sorter ant-table-column-sorter-full\\\">\\n <span class=\\\"ant-table-column-sorter-inner\\\">\\n <antd-icon type=\\\"CaretUpOutlined\\\" ng-class=\\\"'ant-table-column-sorter-up'+(state.sorter.field===column.key&&state.sorter.order==='ascend'?' active':'')\\\"></antd-icon>\\n <antd-icon type=\\\"CaretDownOutlined\\\" ng-class=\\\"'ant-table-column-sorter-down'+(state.sorter.field===column.key&&state.sorter.order==='descend'?' active':'')\\\"></antd-icon>\\n </span>\\n </span>\\n </div>\\n </th>\\n </tr>\\n </thead>\\n <tbody class=\\\"ant-table-tbody\\\">\\n <tr ng-repeat=\\\"(key, record) in state.dataSource track by record[state.rowKey]\\" class=\\"ant-table-row\\">\n <td ng-if=\\"rowSelection\\" class=\\"ant-table-selection-column\\">\n <span>\n <antd-checkbox checked=\\"{{record.checked}}\\" disabled=\\"{{record.disabled}}\\" on-change=\\"handleSelect(event,$index)\\" />\n </span>\n </td>\n <td ng-repeat=\\"(key, column) in columns track by key\\" data-key=\\"{{column.key}}\\">\n <antd-slot content=\\"{{record[column.key]}}\\" context=\\"antdTable.getContext().$parent\\" />\n </td>\n </tr>\n <tr ng-if=\\"state.dataSource.length===0\\" class=\\"ant-table-placeholder\\">\n <td colspan=\\"{{rowSelection?columns.length+1:columns.length}}\\">\n <antd-empty image=\\"presented_image_simple\\"></antd-empty>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n </div>\n</div>\";\n// Exports\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (code);\n\n//# sourceURL=webpack://ng-antd/./build/Table/Table.html?"); | 9774 | +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 = \"<div class=\\\"ant-table-wrapper\\\">\\n <div ng-class=\\\"'ant-table ant-table-'+state.size\\\">\\n <div class=\\\"ant-table-content\\\">\\n <table>\\n <thead class=\\\"ant-table-thead\\\">\\n <tr>\\n <th ng-if=\\\"rowSelection\\\" class=\\\"ant-table-selection-column\\\">\\n <span ng-if=\\\"!rowSelection.hideSelectAll\\\" class=\\\"ant-table-header-column\\\">\\n <div>\\n <span class=\\\"ant-table-column-title\\\">\\n <div class=\\\"ant-table-selection\\\">\\n <antd-checkbox on-change=\\\"handleSelectAll(event)\\\" checked=\\\"{{state.isSelectAll}}\\\" />\\n </div>\\n </span>\\n </div>\\n </span>\\n </th>\\n <th ng-repeat=\\\"(key, column) in columns track by key\\\" class=\\\"ant-table-cell ant-table-column-has-sorters\\\" ng-style=\\\"{width:column.width}\\\">\\n <span ng-if=\\\"!column.sorter\\\">{{column.title}}</span>\\n <div ng-if=\\\"column.sorter\\\" class=\\\"ant-table-column-sorters\\\" ng-click=\\\"handleSorter(column.key)\\\">\\n <span class=\\\"ant-table-column-title\\\">{{column.title}}</span>\\n <span class=\\\"ant-table-column-sorter ant-table-column-sorter-full\\\">\\n <span class=\\\"ant-table-column-sorter-inner\\\">\\n <antd-icon type=\\\"CaretUpOutlined\\\" ng-class=\\\"'ant-table-column-sorter-up'+(state.sorter.field===column.key&&state.sorter.order==='ascend'?' active':'')\\\"></antd-icon>\\n <antd-icon type=\\\"CaretDownOutlined\\\" ng-class=\\\"'ant-table-column-sorter-down'+(state.sorter.field===column.key&&state.sorter.order==='descend'?' active':'')\\\"></antd-icon>\\n </span>\\n </span>\\n </div>\\n </th>\\n </tr>\\n </thead>\\n <tbody class=\\\"ant-table-tbody\\\">\\n <tr ng-repeat=\\\"(key, record) in state.dataSource track by record[state.rowKey]+'-'+$index\\" class=\\"ant-table-row\\">\n <td ng-if=\\"rowSelection\\" class=\\"ant-table-selection-column\\">\n <span>\n <antd-checkbox checked=\\"{{record.checked}}\\" disabled=\\"{{record.disabled}}\\" on-change=\\"handleSelect(event,$index)\\" />\n </span>\n </td>\n <td ng-repeat=\\"(key, column) in columns track by key\\" data-key=\\"{{column.key}}\\">\n <antd-slot content=\\"{{record[column.key]}}\\" context=\\"antdTable.getContext().$parent\\" />\n </td>\n </tr>\n <tr ng-if=\\"state.dataSource.length===0\\" class=\\"ant-table-placeholder\\">\n <td colspan=\\"{{rowSelection?columns.length+1:columns.length}}\\">\n <antd-empty image=\\"presented_image_simple\\"></antd-empty>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n </div>\n</div>\";\n// Exports\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (code);\n\n//# sourceURL=webpack://ng-antd/./build/Table/Table.html?"); |
9775 | 9775 | ||
9776 | /***/ }), | 9776 | /***/ }), |
9777 | 9777 |
src/Pagination/Pagination.js
@@ -114,7 +114,7 @@ class Pagination { | @@ -114,7 +114,7 @@ class Pagination { | ||
114 | return ( | 114 | return ( |
115 | Math.ceil( | 115 | Math.ceil( |
116 | this.state.total / | 116 | this.state.total / |
117 | - (this.props.pageSize || this.props.defaultPageSize || 10) | 117 | + (this.state.pageSize || this.props.defaultPageSize || 10) |
118 | ) || 1 | 118 | ) || 1 |
119 | ); | 119 | ); |
120 | } | 120 | } |
@@ -152,6 +152,8 @@ class Pagination { | @@ -152,6 +152,8 @@ class Pagination { | ||
152 | 152 | ||
153 | handleChange() { | 153 | handleChange() { |
154 | let current = this.state.current; | 154 | let current = this.state.current; |
155 | + this.state.pageNum = this.getPageNum(); | ||
156 | + this.state.pageNumList = this.getPageNumList(); | ||
155 | if (this.state.current > this.state.pageNum) { | 157 | if (this.state.current > this.state.pageNum) { |
156 | current = this.state.pageNum; | 158 | current = this.state.pageNum; |
157 | } else if (this.state.current < 1) { | 159 | } else if (this.state.current < 1) { |
src/Table/Table.js
@@ -72,17 +72,10 @@ class Table { | @@ -72,17 +72,10 @@ class Table { | ||
72 | }, | 72 | }, |
73 | "rowSelection.selectedRowKeys": (newVal) => { | 73 | "rowSelection.selectedRowKeys": (newVal) => { |
74 | if (Array.isArray(newVal)) { | 74 | if (Array.isArray(newVal)) { |
75 | - if (newVal.length > 0) { | ||
76 | - this.state.dataSource.map(function (row, key) { | ||
77 | - if (newVal.includes(key)) { | ||
78 | - row.checked = true; | ||
79 | - } | ||
80 | - }); | ||
81 | - } else { | ||
82 | - this.state.dataSource.map(function (row) { | ||
83 | - row.checked = false; | ||
84 | - }); | ||
85 | - } | 75 | + this.state.selectedrecordKeys = newVal; |
76 | + this.state.dataSource.map(function (row, key) { | ||
77 | + row.checked = newVal.includes(key); | ||
78 | + }); | ||
86 | } | 79 | } |
87 | }, | 80 | }, |
88 | }; | 81 | }; |
webpack.config.js
@@ -6,11 +6,11 @@ module.exports = { | @@ -6,11 +6,11 @@ module.exports = { | ||
6 | entry: "./build/index.js", | 6 | entry: "./build/index.js", |
7 | output: { | 7 | output: { |
8 | // bpms | 8 | // bpms |
9 | - path: "/Users/shann/Project/essa/bpms/bpms-webapp/src/main/webapp/lib/ng-antd", | 9 | + // path: "/Users/shann/Project/essa/bpms/bpms-webapp/src/main/webapp/lib/ng-antd", |
10 | // boss | 10 | // boss |
11 | // path: "/Users/shann/Project/essa/boss/trunk/vendor-lib/ng-antd", | 11 | // path: "/Users/shann/Project/essa/boss/trunk/vendor-lib/ng-antd", |
12 | // mvo | 12 | // mvo |
13 | - // path: "/Users/shann/Project/essa/mvo/mvo-webapp/public/browser-vendor/ng-antd", | 13 | + path: "/Users/shann/Project/essa/mvo/mvo-webapp/public/browser-vendor/ng-antd", |
14 | // local | 14 | // local |
15 | // path: path.resolve(__dirname, "dist"), | 15 | // path: path.resolve(__dirname, "dist"), |
16 | filename: "ng-antd.js", | 16 | filename: "ng-antd.js", |