Commit e7610b685a86ed0e60ca02234da161c9bc20b234
1 parent
ff56db90
feat(pagination): 优化组件
Showing
12 changed files
with
40 additions
and
37 deletions
Show diff stats
build/Common/Common.js
build/Pagination/Pagination.html
... | ... | @@ -21,11 +21,11 @@ |
21 | 21 | </button> |
22 | 22 | </li> |
23 | 23 | <li class="ant-pagination-options"> |
24 | - <es-select ng-if="showSizeChanger==='true'" class="ant-pagination-options-size-changer" size="{{size}}" value="10" get-popup-container="getPopupContainer" on-change="handleSelectChange(value)"> | |
24 | + <es-select ng-if="showSizeChanger==='true'" class="ant-pagination-options-size-changer" size="{{size}}" value="{{defaultPageSize}}" get-popup-container="getPopupContainer" on-change="handleSelectChange(value)"> | |
25 | 25 | <es-select-option value="10">10 条/页</es-select-option> |
26 | 26 | <es-select-option value="20">20 条/页</es-select-option> |
27 | - <es-select-option value="30">30 条/页</es-select-option> | |
28 | - <es-select-option value="40">40 条/页</es-select-option> | |
27 | + <es-select-option value="50">50 条/页</es-select-option> | |
28 | + <es-select-option value="100">100 条/页</es-select-option> | |
29 | 29 | </es-select> |
30 | 30 | <div ng-if="showQuickJumper==='true'" class="ant-pagination-options-quick-jumper"> |
31 | 31 | 跳至<input type="text" ng-blur="handleBlur($event)" ng-keypress="onKeyPress($event)" />页 | ... | ... |
build/Pagination/Pagination.js
... | ... | @@ -146,6 +146,10 @@ angular.module("esNgAntd").directive("esPagination", function (esNgAntd) { |
146 | 146 | }; |
147 | 147 | |
148 | 148 | $scope.handleClick = function (value) { |
149 | + if (value === $scope.state.current) { | |
150 | + return; | |
151 | + } | |
152 | + | |
149 | 153 | if (value === "next") { |
150 | 154 | value = $scope.state.current + 5; |
151 | 155 | } |
... | ... | @@ -154,12 +158,7 @@ angular.module("esNgAntd").directive("esPagination", function (esNgAntd) { |
154 | 158 | value = $scope.state.current - 5; |
155 | 159 | } |
156 | 160 | |
157 | - $scope.setCurrent($scope.getCurrent(value)); // 更新回调 | |
158 | - | |
159 | - $scope.onChange({ | |
160 | - page: $scope.state.current, | |
161 | - pageSize: $scope.state.pageSize, | |
162 | - }); | |
161 | + $scope.setCurrent($scope.getCurrent(value)); | |
163 | 162 | }; |
164 | 163 | |
165 | 164 | $scope.handleChange = function () { |
... | ... | @@ -173,7 +172,7 @@ angular.module("esNgAntd").directive("esPagination", function (esNgAntd) { |
173 | 172 | |
174 | 173 | $scope.onChange({ |
175 | 174 | page: current, |
176 | - pageSize: $scope.state.pageSize, | |
175 | + pageSize: parseInt($scope.state.pageSize), | |
177 | 176 | }); |
178 | 177 | }; |
179 | 178 | ... | ... |
build/Popover/Popover.js
... | ... | @@ -160,6 +160,7 @@ angular |
160 | 160 | } |
161 | 161 | }; |
162 | 162 | }, |
163 | + require: ["?^esTable"], | |
163 | 164 | link: function ( |
164 | 165 | $scope, |
165 | 166 | $element, |
... | ... | @@ -167,6 +168,7 @@ angular |
167 | 168 | $controllers, |
168 | 169 | $transclude |
169 | 170 | ) { |
171 | + let [esTable] = $controllers; | |
170 | 172 | esNgAntd.createStyle("ant-popover", style); |
171 | 173 | $scope.state.target = $element[0]; |
172 | 174 | let title = $scope.title |
... | ... | @@ -213,9 +215,13 @@ angular |
213 | 215 | $compile(div)($scope); |
214 | 216 | div.querySelector(".ant-popover-inner-content").innerHTML = |
215 | 217 | $scope.state.content; |
216 | - $compile(div.querySelector(".ant-popover-inner-content"))( | |
217 | - $scope.$parent | |
218 | - ); | |
218 | + | |
219 | + if (!esTable) { | |
220 | + $compile(div.querySelector(".ant-popover-inner-content"))( | |
221 | + $scope.$parent | |
222 | + ); | |
223 | + } | |
224 | + | |
219 | 225 | $scope.state.popover = div; |
220 | 226 | }, |
221 | 227 | }; | ... | ... |
build/Slot/Slot.js
... | ... | @@ -8,7 +8,7 @@ angular.module("esNgAntd").directive("esSlot", function ($compile) { |
8 | 8 | content: "@", |
9 | 9 | context: "=", |
10 | 10 | }, |
11 | - controller: function ($scope, $element) { | |
11 | + controller: function ($scope, $element, $attrs) { | |
12 | 12 | this.getContext = function () { |
13 | 13 | return $scope; |
14 | 14 | }; | ... | ... |
dist/ng-antd.js
... | ... | @@ -104,7 +104,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Col |
104 | 104 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
105 | 105 | |
106 | 106 | "use strict"; |
107 | -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var antd_lib_style_index_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! antd/lib/style/index.css */ \"./node_modules/antd/lib/style/index.css\");\n\nangular.module(\"esNgAntd\").service(\"esNgAntd\", [\n \"$compile\",\n function ($compile) {\n this.styleSheets = null;\n\n this.createStyle = function (key, style) {\n if (!document.querySelector(\"#antd\")) {\n let styleElement = document.createElement(\"style\");\n styleElement.setAttribute(\"id\", \"antd\");\n styleElement.setAttribute(\"type\", \"text/css\");\n styleElement.innerHTML = antd_lib_style_index_css__WEBPACK_IMPORTED_MODULE_0__[\"default\"].toString();\n document.head.appendChild(styleElement);\n }\n\n if (!document.querySelector(\"#\" + key)) {\n let styleElement = document.createElement(\"style\");\n styleElement.setAttribute(\"id\", key);\n styleElement.setAttribute(\"type\", \"text/css\");\n styleElement.innerHTML = style.toString();\n document.head.appendChild(styleElement);\n\n if (this.styleSheets) {\n this.disableStyle(key);\n }\n }\n };\n\n this.disableStyle = function (name) {\n for (let i = 0; i < this.styleSheets.cssRules.length; i++) {\n let rule = this.styleSheets.cssRules[i];\n\n if (\n rule.selectorText &&\n rule.selectorText.indexOf(name) !== -1\n ) {\n rule.selectorText = rule.selectorText.replace(\n /\\.ant\\-/g,\n \".disabled-ant-\"\n );\n console.log(rule.selectorText);\n }\n }\n };\n\n this.conflict = function (filename) {\n for (let i = 0; i < document.styleSheets.length; i++) {\n const element = document.styleSheets[i];\n\n if (element.href && element.href.indexOf(filename) !== -1) {\n this.styleSheets = element;\n }\n }\n };\n\n this.createLayer = function (content, scope) {\n let div = document.createElement(\"div\");\n div.innerHTML = content;\n document.body.appendChild(div);\n $compile(div)(scope);\n };\n\n this.getOffset = function (ele) {\n if (!ele || ele.nodeType != 1) {\n return;\n }\n\n let rect = ele.getBoundingClientRect();\n let doc = ele.ownerDocument.documentElement;\n return {\n top: rect.top + window.pageYOffset - doc.clientTop,\n left: rect.left + window.pageXOffset - doc.clientLeft,\n };\n };\n },\n]);\n\n\n//# sourceURL=webpack://ng-antd/./build/Common/Common.js?"); | |
107 | +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var antd_lib_style_index_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! antd/lib/style/index.css */ \"./node_modules/antd/lib/style/index.css\");\n\nangular.module(\"esNgAntd\").service(\"esNgAntd\", [\n \"$compile\",\n function ($compile) {\n this.styleSheets = null;\n\n this.createStyle = function (key, style) {\n if (!document.querySelector(\"#antd\")) {\n let styleElement = document.createElement(\"style\");\n styleElement.setAttribute(\"id\", \"antd\");\n styleElement.setAttribute(\"type\", \"text/css\");\n styleElement.innerHTML = antd_lib_style_index_css__WEBPACK_IMPORTED_MODULE_0__[\"default\"].toString();\n document.head.appendChild(styleElement);\n }\n\n if (!document.querySelector(\"#\" + key)) {\n let styleElement = document.createElement(\"style\");\n styleElement.setAttribute(\"id\", key);\n styleElement.setAttribute(\"type\", \"text/css\");\n styleElement.innerHTML = style.toString();\n document.head.appendChild(styleElement);\n\n if (this.styleSheets) {\n this.disableStyle(key);\n }\n }\n };\n\n this.disableStyle = function (name) {\n for (let i = 0; i < this.styleSheets.cssRules.length; i++) {\n let rule = this.styleSheets.cssRules[i];\n\n if (\n rule.selectorText &&\n rule.selectorText.indexOf(name) !== -1\n ) {\n rule.selectorText = rule.selectorText.replace(\n /\\.ant\\-/g,\n \".disabled-ant-\"\n );\n }\n }\n };\n\n this.conflict = function (filename) {\n for (let i = 0; i < document.styleSheets.length; i++) {\n const element = document.styleSheets[i];\n\n if (element.href && element.href.indexOf(filename) !== -1) {\n this.styleSheets = element;\n }\n }\n };\n\n this.createLayer = function (content, scope) {\n let div = document.createElement(\"div\");\n div.innerHTML = content;\n document.body.appendChild(div);\n $compile(div)(scope);\n };\n\n this.getOffset = function (ele) {\n if (!ele || ele.nodeType != 1) {\n return;\n }\n\n let rect = ele.getBoundingClientRect();\n let doc = ele.ownerDocument.documentElement;\n return {\n top: rect.top + window.pageYOffset - doc.clientTop,\n left: rect.left + window.pageXOffset - doc.clientLeft,\n };\n };\n },\n]);\n\n\n//# sourceURL=webpack://ng-antd/./build/Common/Common.js?"); | |
108 | 108 | |
109 | 109 | /***/ }), |
110 | 110 | |
... | ... | @@ -280,7 +280,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Mod |
280 | 280 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
281 | 281 | |
282 | 282 | "use strict"; |
283 | -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Pagination_html__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Pagination.html */ \"./build/Pagination/Pagination.html\");\n/* harmony import */ var antd_lib_pagination_style_index_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! antd/lib/pagination/style/index.css */ \"./node_modules/antd/lib/pagination/style/index.css\");\n\n\nangular.module(\"esNgAntd\").directive(\"esPagination\", function (esNgAntd) {\n return {\n controllerAs: \"esPagination\",\n restrict: \"E\",\n transclude: true,\n replace: true,\n scope: {\n defaultCurrent: \"@\",\n current: \"@\",\n total: \"@\",\n defaultPageSize: \"@\",\n pageSize: \"@\",\n onChange: \"&\",\n onShowSizeChange: \"&\",\n showQuickJumper: \"@\",\n showSizeChanger: \"@\",\n size: \"@\",\n showTotal: \"&\",\n },\n template: _Pagination_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 total: null,\n current: null,\n pageSize: null,\n pageNum: null,\n pageNumList: null,\n };\n $scope.watch = {\n total: function (newVal, oldVal) {\n if (newVal && oldVal) {\n $scope.state.total = Number(newVal);\n $scope.state.pageNum = $scope.getPageNum();\n $scope.state.pageNumList = $scope.getPageNumList();\n }\n },\n };\n\n for (const key in $scope.watch) {\n $scope.$watch(key, $scope.watch[key], true);\n }\n\n $scope.handleShowTotal = function () {\n return $scope.showTotal({\n total: $scope.state.total,\n });\n };\n\n $scope.getItemLinkClassName = function (value) {\n if (typeof value === \"number\") {\n return (\n \"ant-pagination-item\" +\n ($scope.state.current === value\n ? \" ant-pagination-item-active\"\n : \"\")\n );\n } else {\n return \"ant-pagination-jump-next ant-pagination-jump-next-custom-icon\";\n }\n };\n\n $scope.getPageNumList = function () {\n let pageNumList = [$scope.state.current];\n let pageNum = $scope.getPageNum();\n\n if (pageNum <= 7 || $scope.state.current - 1 < 4) {\n for (let i = $scope.state.current - 1; i > 0; i--) {\n pageNumList.unshift(i);\n }\n } else {\n let len =\n $scope.state.current - 1 > 2\n ? 2\n : $scope.state.current - 1;\n\n for (let i = 1; i <= len; i++) {\n pageNumList.unshift($scope.state.current - i);\n }\n\n if ($scope.state.current - 2 > 2) {\n pageNumList.unshift(\"prev\");\n pageNumList.unshift(1);\n }\n }\n\n if (pageNum <= 7 || pageNum - $scope.state.current < 4) {\n for (let i = $scope.state.current + 1; i <= pageNum; i++) {\n pageNumList.push(i);\n }\n } else {\n let limit =\n 3 - $scope.state.current > 0\n ? 2 + (3 - $scope.state.current)\n : 2;\n let len =\n pageNum - $scope.state.current > limit\n ? limit\n : pageNum - $scope.state.current;\n\n for (let i = 1; i <= len; i++) {\n pageNumList.push($scope.state.current + i);\n }\n\n if (pageNum - $scope.state.current > 2) {\n pageNumList.push(\"next\");\n pageNumList.push(pageNum);\n }\n }\n\n return pageNumList;\n };\n\n $scope.getPageNum = function () {\n return (\n Math.ceil(\n $scope.state.total /\n ($scope.pageSize || $scope.defaultPageSize || 10)\n ) || 1\n );\n };\n\n $scope.getPopupContainer = function () {\n return $element[0].querySelector(\".ant-pagination-options\");\n };\n\n $scope.handleNext = function () {\n if ($scope.state.current === $scope.state.pageNum) {\n return false;\n }\n\n $scope.handleClick(++$scope.state.current);\n };\n\n $scope.handlePrev = function () {\n if ($scope.state.current === 1) {\n return false;\n }\n\n $scope.handleClick(--$scope.state.current);\n };\n\n $scope.handleClick = function (value) {\n if (value === \"next\") {\n value = $scope.state.current + 5;\n }\n\n if (value === \"prev\") {\n value = $scope.state.current - 5;\n }\n\n $scope.setCurrent($scope.getCurrent(value)); // 更新回调\n\n $scope.onChange({\n page: $scope.state.current,\n pageSize: $scope.state.pageSize,\n });\n };\n\n $scope.handleChange = function () {\n let current = $scope.state.current;\n\n if ($scope.state.current > $scope.state.pageNum) {\n current = $scope.state.pageNum;\n } else if ($scope.state.current < 1) {\n current = 1;\n }\n\n $scope.onChange({\n page: current,\n pageSize: $scope.state.pageSize,\n });\n };\n\n $scope.handleSelectChange = function (value) {\n $scope.state.current = 1;\n $scope.state.pageSize = parseInt(value);\n $scope.handleChange();\n };\n\n $scope.getCurrent = function (number) {\n if (number > $scope.state.pageNum) {\n return $scope.state.pageNum;\n }\n\n if (number < 1) {\n return 1;\n }\n\n return parseInt(number);\n };\n\n $scope.setCurrent = function (value) {\n if (!value) {\n return;\n }\n\n $scope.state.current = $scope.getCurrent(value);\n $scope.state.pageNumList = $scope.getPageNumList();\n $scope.handleChange();\n };\n\n $scope.handleBlur = function (event) {\n $scope.setCurrent(event.target.value);\n event.target.value = null;\n };\n\n $scope.onKeyPress = function (event) {\n if (event.keyCode === 13 || event.keyCode === 32) {\n $scope.setCurrent(event.target.value);\n event.target.value = null;\n }\n };\n },\n link: function ($scope, $element, $attrs, $controllers, $transclude) {\n esNgAntd.createStyle(\"ant-pagination\", antd_lib_pagination_style_index_css__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\n $scope.state.total = Number($scope.total || 0);\n $scope.state.current = Number(\n $scope.current || $scope.defaultCurrent || 1\n );\n $scope.state.pageSize =\n $scope.pageSize || $scope.defaultPageSize || 10;\n $scope.state.pageNum = $scope.getPageNum();\n $scope.state.pageNumList = $scope.getPageNumList();\n },\n };\n});\n\n\n//# sourceURL=webpack://ng-antd/./build/Pagination/Pagination.js?"); | |
283 | +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Pagination_html__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Pagination.html */ \"./build/Pagination/Pagination.html\");\n/* harmony import */ var antd_lib_pagination_style_index_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! antd/lib/pagination/style/index.css */ \"./node_modules/antd/lib/pagination/style/index.css\");\n\n\nangular.module(\"esNgAntd\").directive(\"esPagination\", function (esNgAntd) {\n return {\n controllerAs: \"esPagination\",\n restrict: \"E\",\n transclude: true,\n replace: true,\n scope: {\n defaultCurrent: \"@\",\n current: \"@\",\n total: \"@\",\n defaultPageSize: \"@\",\n pageSize: \"@\",\n onChange: \"&\",\n onShowSizeChange: \"&\",\n showQuickJumper: \"@\",\n showSizeChanger: \"@\",\n size: \"@\",\n showTotal: \"&\",\n },\n template: _Pagination_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 total: null,\n current: null,\n pageSize: null,\n pageNum: null,\n pageNumList: null,\n };\n $scope.watch = {\n total: function (newVal, oldVal) {\n if (newVal && oldVal) {\n $scope.state.total = Number(newVal);\n $scope.state.pageNum = $scope.getPageNum();\n $scope.state.pageNumList = $scope.getPageNumList();\n }\n },\n };\n\n for (const key in $scope.watch) {\n $scope.$watch(key, $scope.watch[key], true);\n }\n\n $scope.handleShowTotal = function () {\n return $scope.showTotal({\n total: $scope.state.total,\n });\n };\n\n $scope.getItemLinkClassName = function (value) {\n if (typeof value === \"number\") {\n return (\n \"ant-pagination-item\" +\n ($scope.state.current === value\n ? \" ant-pagination-item-active\"\n : \"\")\n );\n } else {\n return \"ant-pagination-jump-next ant-pagination-jump-next-custom-icon\";\n }\n };\n\n $scope.getPageNumList = function () {\n let pageNumList = [$scope.state.current];\n let pageNum = $scope.getPageNum();\n\n if (pageNum <= 7 || $scope.state.current - 1 < 4) {\n for (let i = $scope.state.current - 1; i > 0; i--) {\n pageNumList.unshift(i);\n }\n } else {\n let len =\n $scope.state.current - 1 > 2\n ? 2\n : $scope.state.current - 1;\n\n for (let i = 1; i <= len; i++) {\n pageNumList.unshift($scope.state.current - i);\n }\n\n if ($scope.state.current - 2 > 2) {\n pageNumList.unshift(\"prev\");\n pageNumList.unshift(1);\n }\n }\n\n if (pageNum <= 7 || pageNum - $scope.state.current < 4) {\n for (let i = $scope.state.current + 1; i <= pageNum; i++) {\n pageNumList.push(i);\n }\n } else {\n let limit =\n 3 - $scope.state.current > 0\n ? 2 + (3 - $scope.state.current)\n : 2;\n let len =\n pageNum - $scope.state.current > limit\n ? limit\n : pageNum - $scope.state.current;\n\n for (let i = 1; i <= len; i++) {\n pageNumList.push($scope.state.current + i);\n }\n\n if (pageNum - $scope.state.current > 2) {\n pageNumList.push(\"next\");\n pageNumList.push(pageNum);\n }\n }\n\n return pageNumList;\n };\n\n $scope.getPageNum = function () {\n return (\n Math.ceil(\n $scope.state.total /\n ($scope.pageSize || $scope.defaultPageSize || 10)\n ) || 1\n );\n };\n\n $scope.getPopupContainer = function () {\n return $element[0].querySelector(\".ant-pagination-options\");\n };\n\n $scope.handleNext = function () {\n if ($scope.state.current === $scope.state.pageNum) {\n return false;\n }\n\n $scope.handleClick(++$scope.state.current);\n };\n\n $scope.handlePrev = function () {\n if ($scope.state.current === 1) {\n return false;\n }\n\n $scope.handleClick(--$scope.state.current);\n };\n\n $scope.handleClick = function (value) {\n if (value === $scope.state.current) {\n return;\n }\n\n if (value === \"next\") {\n value = $scope.state.current + 5;\n }\n\n if (value === \"prev\") {\n value = $scope.state.current - 5;\n }\n\n $scope.setCurrent($scope.getCurrent(value));\n };\n\n $scope.handleChange = function () {\n let current = $scope.state.current;\n\n if ($scope.state.current > $scope.state.pageNum) {\n current = $scope.state.pageNum;\n } else if ($scope.state.current < 1) {\n current = 1;\n }\n\n $scope.onChange({\n page: current,\n pageSize: parseInt($scope.state.pageSize),\n });\n };\n\n $scope.handleSelectChange = function (value) {\n $scope.state.current = 1;\n $scope.state.pageSize = parseInt(value);\n $scope.handleChange();\n };\n\n $scope.getCurrent = function (number) {\n if (number > $scope.state.pageNum) {\n return $scope.state.pageNum;\n }\n\n if (number < 1) {\n return 1;\n }\n\n return parseInt(number);\n };\n\n $scope.setCurrent = function (value) {\n if (!value) {\n return;\n }\n\n $scope.state.current = $scope.getCurrent(value);\n $scope.state.pageNumList = $scope.getPageNumList();\n $scope.handleChange();\n };\n\n $scope.handleBlur = function (event) {\n $scope.setCurrent(event.target.value);\n event.target.value = null;\n };\n\n $scope.onKeyPress = function (event) {\n if (event.keyCode === 13 || event.keyCode === 32) {\n $scope.setCurrent(event.target.value);\n event.target.value = null;\n }\n };\n },\n link: function ($scope, $element, $attrs, $controllers, $transclude) {\n esNgAntd.createStyle(\"ant-pagination\", antd_lib_pagination_style_index_css__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\n $scope.state.total = Number($scope.total || 0);\n $scope.state.current = Number(\n $scope.current || $scope.defaultCurrent || 1\n );\n $scope.state.pageSize =\n $scope.pageSize || $scope.defaultPageSize || 10;\n $scope.state.pageNum = $scope.getPageNum();\n $scope.state.pageNumList = $scope.getPageNumList();\n },\n };\n});\n\n\n//# sourceURL=webpack://ng-antd/./build/Pagination/Pagination.js?"); | |
284 | 284 | |
285 | 285 | /***/ }), |
286 | 286 | |
... | ... | @@ -291,7 +291,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Pag |
291 | 291 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
292 | 292 | |
293 | 293 | "use strict"; |
294 | -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Popover_html__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Popover.html */ \"./build/Popover/Popover.html\");\n/* harmony import */ var antd_lib_popover_style_index_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! antd/lib/popover/style/index.css */ \"./node_modules/antd/lib/popover/style/index.css\");\n\n\nangular\n .module(\"esNgAntd\")\n .directive(\"esPopover\", function ($compile, $timeout, esNgAntd) {\n return {\n controllerAs: \"esPopover\",\n restrict: \"E\",\n transclude: true,\n replace: true,\n scope: {\n title: \"@\",\n content: \"@\",\n context: \"=\",\n placement: \"@\",\n getPopupContainer: \"&\",\n trigger: \"@\",\n },\n template: _Popover_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 visible: false,\n content: $scope.content ? $scope.content : \"\",\n clickTarget: null,\n trigger: $scope.trigger || \"hover\",\n closing: false,\n };\n\n $scope.myEvent = function () {\n setTimeout(() => {\n $scope.state.visible = false;\n $scope.$apply();\n document.body.removeEventListener(\n \"click\",\n $scope.myEvent\n );\n }, 0);\n };\n\n $scope.handleClick = function () {\n if ($scope.state.trigger !== \"click\") {\n return;\n }\n\n if ($scope.state.visible === false) {\n // 气泡层(显示)\n $scope.state.visible = true; // 处理位置\n\n $scope.handlePosition(); // 事件绑定\n\n document.body.addEventListener(\"click\", $scope.myEvent);\n } else {\n setTimeout(() => {\n $scope.state.visible = false;\n $scope.$apply();\n document.body.removeEventListener(\n \"click\",\n $scope.myEvent\n );\n }, 0);\n }\n };\n\n $scope.showPopover = function () {\n // 气泡层(显示)\n $scope.state.visible = true; // 调整位置\n\n $scope.handlePosition();\n };\n\n $scope.hidePopover = function () {\n $scope.state.closing = true;\n $timeout(function () {\n if ($scope.state.closing === false) {\n return;\n }\n\n $scope.state.visible = false;\n }, 100);\n };\n\n $scope.onMouseEnter = function () {\n if ($scope.state.trigger !== \"hover\") {\n return;\n }\n\n if ($scope.state.closing === true) {\n $scope.state.closing = false;\n }\n\n $scope.showPopover();\n };\n\n $scope.onMouseLeave = function () {\n if ($scope.state.trigger !== \"hover\") {\n return;\n }\n\n $scope.hidePopover();\n };\n\n $scope.handlePosition = function () {\n setTimeout(function () {\n let popover =\n $scope.state.popover.querySelector(\".ant-popover\");\n\n if ($scope.placement === \"top\") {\n popover.style[\"top\"] = $scope.getTop();\n } else if ($scope.placement === \"bottom\") {\n popover.style[\"top\"] = $scope.getTop();\n }\n\n popover.style.left = $scope.getLeft() + \"px\";\n }, 0);\n };\n\n $scope.getLeft = function () {\n let parent = $scope.getPopupContainer();\n let popover =\n $scope.state.popover.querySelector(\".ant-popover\");\n let target = $scope.state.target;\n\n if (parent) {\n return -(\n popover.clientWidth / 2 -\n target.clientWidth / 2\n );\n } else {\n let offset = esNgAntd.getOffset(target);\n return (\n offset.left -\n (popover.clientWidth / 2 - target.clientWidth / 2)\n );\n }\n };\n\n $scope.getTop = function () {\n let parent = $scope.getPopupContainer();\n let popover =\n $scope.state.popover.querySelector(\".ant-popover\");\n let target = $scope.state.target;\n\n if (parent) {\n if ($scope.placement === \"top\") {\n return -popover.clientHeight + \"px\";\n } else if ($scope.placement === \"bottom\") {\n }\n } else {\n let offset = esNgAntd.getOffset(target);\n\n if ($scope.placement === \"top\") {\n return offset.top - popover.clientHeight - 4 + \"px\";\n } else if ($scope.placement === \"bottom\") {\n return offset.top + target.clientHeight + 4 + \"px\";\n }\n }\n };\n },\n link: function (\n $scope,\n $element,\n $attrs,\n $controllers,\n $transclude\n ) {\n esNgAntd.createStyle(\"ant-popover\", antd_lib_popover_style_index_css__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\n $scope.state.target = $element[0];\n let title = $scope.title\n ? `<div class=\"ant-popover-title\"><span>${$scope.title}</span></div>`\n : \"\";\n let content = `<div>\n <div style=\"outline:none\" ng-class=\"'ant-popover ant-popover-placement-${$scope.placement}'+(!state.visible?' ant-popover-hidden': '')+(state.visible?' ant-zoom-big-enter ant-zoom-big-enter-active': '')\" ng-mouseleave=\"onMouseLeave()\" ng-mouseenter=\"onMouseEnter()\">\n <div class=\"ant-popover-content\">\n <div class=\"ant-popover-arrow\">\n <span class=\"ant-popover-arrow-content\"></span>\n </div>\n <div class=\"ant-popover-inner\">\n <div>\n ${title}\n <div class=\"ant-popover-inner-content\"></div>\n </div>\n </div>\n </div>\n </div>\n </div>`;\n let div = document.createElement(\"div\");\n\n if (typeof $scope.getPopupContainer() === \"function\") {\n $scope.state.popupContainer = $scope.getPopupContainer()();\n }\n\n if (!$scope.state.popupContainer) {\n div.style.position = \"absolute\";\n div.style.top = \"0px\";\n div.style.left = \"0px\";\n div.style.width = \"100%\";\n div.innerHTML = content;\n document.body.appendChild(div);\n } else {\n $scope.state.popupContainer.appendChild(div);\n }\n\n div.addEventListener(\"click\", function (event) {\n event.stopPropagation();\n });\n $scope.state.target.addEventListener(\"click\", (e) => {\n e.stopPropagation();\n });\n $compile(div)($scope);\n div.querySelector(\".ant-popover-inner-content\").innerHTML =\n $scope.state.content;\n $compile(div.querySelector(\".ant-popover-inner-content\"))(\n $scope.$parent\n );\n $scope.state.popover = div;\n },\n };\n });\n\n\n//# sourceURL=webpack://ng-antd/./build/Popover/Popover.js?"); | |
294 | +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Popover_html__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Popover.html */ \"./build/Popover/Popover.html\");\n/* harmony import */ var antd_lib_popover_style_index_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! antd/lib/popover/style/index.css */ \"./node_modules/antd/lib/popover/style/index.css\");\n\n\nangular\n .module(\"esNgAntd\")\n .directive(\"esPopover\", function ($compile, $timeout, esNgAntd) {\n return {\n controllerAs: \"esPopover\",\n restrict: \"E\",\n transclude: true,\n replace: true,\n scope: {\n title: \"@\",\n content: \"@\",\n context: \"=\",\n placement: \"@\",\n getPopupContainer: \"&\",\n trigger: \"@\",\n },\n template: _Popover_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 visible: false,\n content: $scope.content ? $scope.content : \"\",\n clickTarget: null,\n trigger: $scope.trigger || \"hover\",\n closing: false,\n };\n\n $scope.myEvent = function () {\n setTimeout(() => {\n $scope.state.visible = false;\n $scope.$apply();\n document.body.removeEventListener(\n \"click\",\n $scope.myEvent\n );\n }, 0);\n };\n\n $scope.handleClick = function () {\n if ($scope.state.trigger !== \"click\") {\n return;\n }\n\n if ($scope.state.visible === false) {\n // 气泡层(显示)\n $scope.state.visible = true; // 处理位置\n\n $scope.handlePosition(); // 事件绑定\n\n document.body.addEventListener(\"click\", $scope.myEvent);\n } else {\n setTimeout(() => {\n $scope.state.visible = false;\n $scope.$apply();\n document.body.removeEventListener(\n \"click\",\n $scope.myEvent\n );\n }, 0);\n }\n };\n\n $scope.showPopover = function () {\n // 气泡层(显示)\n $scope.state.visible = true; // 调整位置\n\n $scope.handlePosition();\n };\n\n $scope.hidePopover = function () {\n $scope.state.closing = true;\n $timeout(function () {\n if ($scope.state.closing === false) {\n return;\n }\n\n $scope.state.visible = false;\n }, 100);\n };\n\n $scope.onMouseEnter = function () {\n if ($scope.state.trigger !== \"hover\") {\n return;\n }\n\n if ($scope.state.closing === true) {\n $scope.state.closing = false;\n }\n\n $scope.showPopover();\n };\n\n $scope.onMouseLeave = function () {\n if ($scope.state.trigger !== \"hover\") {\n return;\n }\n\n $scope.hidePopover();\n };\n\n $scope.handlePosition = function () {\n setTimeout(function () {\n let popover =\n $scope.state.popover.querySelector(\".ant-popover\");\n\n if ($scope.placement === \"top\") {\n popover.style[\"top\"] = $scope.getTop();\n } else if ($scope.placement === \"bottom\") {\n popover.style[\"top\"] = $scope.getTop();\n }\n\n popover.style.left = $scope.getLeft() + \"px\";\n }, 0);\n };\n\n $scope.getLeft = function () {\n let parent = $scope.getPopupContainer();\n let popover =\n $scope.state.popover.querySelector(\".ant-popover\");\n let target = $scope.state.target;\n\n if (parent) {\n return -(\n popover.clientWidth / 2 -\n target.clientWidth / 2\n );\n } else {\n let offset = esNgAntd.getOffset(target);\n return (\n offset.left -\n (popover.clientWidth / 2 - target.clientWidth / 2)\n );\n }\n };\n\n $scope.getTop = function () {\n let parent = $scope.getPopupContainer();\n let popover =\n $scope.state.popover.querySelector(\".ant-popover\");\n let target = $scope.state.target;\n\n if (parent) {\n if ($scope.placement === \"top\") {\n return -popover.clientHeight + \"px\";\n } else if ($scope.placement === \"bottom\") {\n }\n } else {\n let offset = esNgAntd.getOffset(target);\n\n if ($scope.placement === \"top\") {\n return offset.top - popover.clientHeight - 4 + \"px\";\n } else if ($scope.placement === \"bottom\") {\n return offset.top + target.clientHeight + 4 + \"px\";\n }\n }\n };\n },\n require: [\"?^esTable\"],\n link: function (\n $scope,\n $element,\n $attrs,\n $controllers,\n $transclude\n ) {\n let [esTable] = $controllers;\n esNgAntd.createStyle(\"ant-popover\", antd_lib_popover_style_index_css__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\n $scope.state.target = $element[0];\n let title = $scope.title\n ? `<div class=\"ant-popover-title\"><span>${$scope.title}</span></div>`\n : \"\";\n let content = `<div>\n <div style=\"outline:none\" ng-class=\"'ant-popover ant-popover-placement-${$scope.placement}'+(!state.visible?' ant-popover-hidden': '')+(state.visible?' ant-zoom-big-enter ant-zoom-big-enter-active': '')\" ng-mouseleave=\"onMouseLeave()\" ng-mouseenter=\"onMouseEnter()\">\n <div class=\"ant-popover-content\">\n <div class=\"ant-popover-arrow\">\n <span class=\"ant-popover-arrow-content\"></span>\n </div>\n <div class=\"ant-popover-inner\">\n <div>\n ${title}\n <div class=\"ant-popover-inner-content\"></div>\n </div>\n </div>\n </div>\n </div>\n </div>`;\n let div = document.createElement(\"div\");\n\n if (typeof $scope.getPopupContainer() === \"function\") {\n $scope.state.popupContainer = $scope.getPopupContainer()();\n }\n\n if (!$scope.state.popupContainer) {\n div.style.position = \"absolute\";\n div.style.top = \"0px\";\n div.style.left = \"0px\";\n div.style.width = \"100%\";\n div.innerHTML = content;\n document.body.appendChild(div);\n } else {\n $scope.state.popupContainer.appendChild(div);\n }\n\n div.addEventListener(\"click\", function (event) {\n event.stopPropagation();\n });\n $scope.state.target.addEventListener(\"click\", (e) => {\n e.stopPropagation();\n });\n $compile(div)($scope);\n div.querySelector(\".ant-popover-inner-content\").innerHTML =\n $scope.state.content;\n\n if (!esTable) {\n $compile(div.querySelector(\".ant-popover-inner-content\"))(\n $scope.$parent\n );\n }\n\n $scope.state.popover = div;\n },\n };\n });\n\n\n//# sourceURL=webpack://ng-antd/./build/Popover/Popover.js?"); | |
295 | 295 | |
296 | 296 | /***/ }), |
297 | 297 | |
... | ... | @@ -367,7 +367,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Sel |
367 | 367 | \****************************/ |
368 | 368 | /***/ (() => { |
369 | 369 | |
370 | -eval("angular.module(\"esNgAntd\").directive(\"esSlot\", function ($compile) {\n return {\n controllerAs: \"esSlot\",\n restrict: \"E\",\n transclude: true,\n replace: true,\n scope: {\n content: \"@\",\n context: \"=\",\n },\n controller: function ($scope, $element) {\n this.getContext = function () {\n return $scope;\n };\n\n $scope.watch = {\n content: (newValue) => {\n if (newValue !== undefined) {\n if (/<[^>]+>/.test(newValue)) {\n $element.replaceWith(\n $compile(newValue)(\n $scope.context ? $scope.context : $scope\n )\n );\n } else {\n $element.text(newValue);\n }\n }\n },\n };\n\n for (const key in $scope.watch) {\n $scope.$watch(key, $scope.watch[key], true);\n }\n },\n link: function ($scope, $element, $attrs, $controllers, $transclude) {},\n };\n});\n\n\n//# sourceURL=webpack://ng-antd/./build/Slot/Slot.js?"); | |
370 | +eval("angular.module(\"esNgAntd\").directive(\"esSlot\", function ($compile) {\n return {\n controllerAs: \"esSlot\",\n restrict: \"E\",\n transclude: true,\n replace: true,\n scope: {\n content: \"@\",\n context: \"=\",\n },\n controller: function ($scope, $element, $attrs) {\n this.getContext = function () {\n return $scope;\n };\n\n $scope.watch = {\n content: (newValue) => {\n if (newValue !== undefined) {\n if (/<[^>]+>/.test(newValue)) {\n $element.replaceWith(\n $compile(newValue)(\n $scope.context ? $scope.context : $scope\n )\n );\n } else {\n $element.text(newValue);\n }\n }\n },\n };\n\n for (const key in $scope.watch) {\n $scope.$watch(key, $scope.watch[key], true);\n }\n },\n link: function ($scope, $element, $attrs, $controllers, $transclude) {},\n };\n});\n\n\n//# sourceURL=webpack://ng-antd/./build/Slot/Slot.js?"); | |
371 | 371 | |
372 | 372 | /***/ }), |
373 | 373 | |
... | ... | @@ -9650,7 +9650,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac |
9650 | 9650 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
9651 | 9651 | |
9652 | 9652 | "use strict"; |
9653 | -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 = \"<ul ng-class=\\\"'ant-pagination'+(size==='small'?' mini':'')\\\">\\n <li ng-if=\\\"showTotal()\\\" class=\\\"ant-pagination-total-text\\\">{{handleShowTotal()}}</li>\\n <li ng-class=\\\"'ant-pagination-prev'+(state.current===1?' ant-pagination-disabled':'')\\\" ng-click=\\\"handlePrev()\\\">\\n <button type=\\\"button\\\" class=\\\"ant-pagination-item-link\\\">\\n <es-icon type=\\\"LeftOutlined\\\"></es-icon>\\n </button>\\n </li>\\n <li ng-repeat=\\\"(key, value) in state.pageNumList track by key\\\" ng-class=\\\"''+getItemLinkClassName(value)\\\" ng-click=\\\"handleClick(value)\\\">\\n <a ng-if=\\\"value!=='prev'&&value!=='next'\\\">{{value}}</a>\\n <a ng-if=\\\"value==='prev'||value==='next'\\\" class=\\\"ant-pagination-item-link\\\">\\n <div class=\\\"ant-pagination-item-container\\\">\\n <es-icon ng-if=\\\"value==='prev'\\\" type=\\\"DoubleLeftOutlined\\\" class=\\\"ant-pagination-item-link-icon\\\"></es-icon>\\n <es-icon ng-if=\\\"value==='next'\\\" type=\\\"DoubleRightOutlined\\\" class=\\\"ant-pagination-item-link-icon\\\"></es-icon>\\n <span class=\\\"ant-pagination-item-ellipsis\\\">•••</span>\\n </div>\\n </a>\\n </li>\\n <li ng-class=\\\"'ant-pagination-next'+(state.current===state.pageNum?' ant-pagination-disabled':'')\\\" ng-click=\\\"handleNext()\\\">\\n <button type=\\\"button\\\" class=\\\"ant-pagination-item-link\\\">\\n <es-icon type=\\\"RightOutlined\\\"></es-icon>\\n </button>\\n </li>\\n <li class=\\\"ant-pagination-options\\\">\\n <es-select ng-if=\\\"showSizeChanger==='true'\\\" class=\\\"ant-pagination-options-size-changer\\\" size=\\\"{{size}}\\\" value=\\\"10\\\" get-popup-container=\\\"getPopupContainer\\\" on-change=\\\"handleSelectChange(value)\\\">\\n <es-select-option value=\\\"10\\\">10 条/页</es-select-option>\\n <es-select-option value=\\\"20\\\">20 条/页</es-select-option>\\n <es-select-option value=\\\"30\\\">30 条/页</es-select-option>\\n <es-select-option value=\\\"40\\\">40 条/页</es-select-option>\n </es-select>\n <div ng-if=\\"showQuickJumper==='true'\\" class=\\"ant-pagination-options-quick-jumper\\">\n 跳至<input type=\\"text\\" ng-blur=\\"handleBlur($event)\\" ng-keypress=\\"onKeyPress($event)\\" />页\n </div>\n </li>\n</ul>\";\n// Exports\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (code);\n\n//# sourceURL=webpack://ng-antd/./build/Pagination/Pagination.html?"); | |
9653 | +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 = \"<ul ng-class=\\\"'ant-pagination'+(size==='small'?' mini':'')\\\">\\n <li ng-if=\\\"showTotal()\\\" class=\\\"ant-pagination-total-text\\\">{{handleShowTotal()}}</li>\\n <li ng-class=\\\"'ant-pagination-prev'+(state.current===1?' ant-pagination-disabled':'')\\\" ng-click=\\\"handlePrev()\\\">\\n <button type=\\\"button\\\" class=\\\"ant-pagination-item-link\\\">\\n <es-icon type=\\\"LeftOutlined\\\"></es-icon>\\n </button>\\n </li>\\n <li ng-repeat=\\\"(key, value) in state.pageNumList track by key\\\" ng-class=\\\"''+getItemLinkClassName(value)\\\" ng-click=\\\"handleClick(value)\\\">\\n <a ng-if=\\\"value!=='prev'&&value!=='next'\\\">{{value}}</a>\\n <a ng-if=\\\"value==='prev'||value==='next'\\\" class=\\\"ant-pagination-item-link\\\">\\n <div class=\\\"ant-pagination-item-container\\\">\\n <es-icon ng-if=\\\"value==='prev'\\\" type=\\\"DoubleLeftOutlined\\\" class=\\\"ant-pagination-item-link-icon\\\"></es-icon>\\n <es-icon ng-if=\\\"value==='next'\\\" type=\\\"DoubleRightOutlined\\\" class=\\\"ant-pagination-item-link-icon\\\"></es-icon>\\n <span class=\\\"ant-pagination-item-ellipsis\\\">•••</span>\\n </div>\\n </a>\\n </li>\\n <li ng-class=\\\"'ant-pagination-next'+(state.current===state.pageNum?' ant-pagination-disabled':'')\\\" ng-click=\\\"handleNext()\\\">\\n <button type=\\\"button\\\" class=\\\"ant-pagination-item-link\\\">\\n <es-icon type=\\\"RightOutlined\\\"></es-icon>\\n </button>\\n </li>\\n <li class=\\\"ant-pagination-options\\\">\\n <es-select ng-if=\\\"showSizeChanger==='true'\\\" class=\\\"ant-pagination-options-size-changer\\\" size=\\\"{{size}}\\\" value=\\\"{{defaultPageSize}}\\\" get-popup-container=\\\"getPopupContainer\\\" on-change=\\\"handleSelectChange(value)\\\">\\n <es-select-option value=\\\"10\\\">10 条/页</es-select-option>\\n <es-select-option value=\\\"20\\\">20 条/页</es-select-option>\\n <es-select-option value=\\\"50\\\">50 条/页</es-select-option>\\n <es-select-option value=\\\"100\\\">100 条/页</es-select-option>\n </es-select>\n <div ng-if=\\"showQuickJumper==='true'\\" class=\\"ant-pagination-options-quick-jumper\\">\n 跳至<input type=\\"text\\" ng-blur=\\"handleBlur($event)\\" ng-keypress=\\"onKeyPress($event)\\" />页\n </div>\n </li>\n</ul>\";\n// Exports\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (code);\n\n//# sourceURL=webpack://ng-antd/./build/Pagination/Pagination.html?"); | |
9654 | 9654 | |
9655 | 9655 | /***/ }), |
9656 | 9656 | ... | ... |
example/pagination.html
... | ... | @@ -9,7 +9,7 @@ |
9 | 9 | <body> |
10 | 10 | <div ng-app="esNgAntd" ng-controller="mainCtrl"> |
11 | 11 | <div class="container" style="padding: 50px"> |
12 | - <es-pagination default-current="1" total="{{total}}" on-change="handleChange(page, pageSize)" | |
12 | + <es-pagination default-current="1" total="{{total}}" default-page-size="20" on-change="handleChange(page, pageSize)" | |
13 | 13 | show-quick-jumper="true" show-size-changer="true" show-total="showTotal(total)"></es-pagination> |
14 | 14 | <!-- <es-pagination size="small" default-current="1" total="50" on-change="handleChange(page, pageSize)" show-quick-jumper="true" show-size-changer="true"></es-pagination> --> |
15 | 15 | </div> | ... | ... |
src/Common/Common.js
src/Pagination/Pagination.html
... | ... | @@ -23,11 +23,11 @@ |
23 | 23 | </button> |
24 | 24 | </li> |
25 | 25 | <li className="ant-pagination-options"> |
26 | - {showSizeChanger === 'true' && <es-select className="ant-pagination-options-size-changer" size="{{size}}" value="10" get-popup-container="getPopupContainer" on-change="handleSelectChange(value)"> | |
26 | + {showSizeChanger === 'true' && <es-select className="ant-pagination-options-size-changer" size="{{size}}" value={defaultPageSize} get-popup-container="getPopupContainer" on-change="handleSelectChange(value)"> | |
27 | 27 | <es-select-option value="10">10 条/页</es-select-option> |
28 | 28 | <es-select-option value="20">20 条/页</es-select-option> |
29 | - <es-select-option value="30">30 条/页</es-select-option> | |
30 | - <es-select-option value="40">40 条/页</es-select-option> | |
29 | + <es-select-option value="50">50 条/页</es-select-option> | |
30 | + <es-select-option value="100">100 条/页</es-select-option> | |
31 | 31 | </es-select>} |
32 | 32 | {showQuickJumper === 'true' && <div className="ant-pagination-options-quick-jumper"> |
33 | 33 | 跳至<input type="text" onBlur={this.handleBlur.bind(this, $event)} onKeyPress={this.onKeyPress.bind(this, $event)}/>页 | ... | ... |
src/Pagination/Pagination.js
... | ... | @@ -137,6 +137,9 @@ class Pagination { |
137 | 137 | } |
138 | 138 | |
139 | 139 | handleClick(value) { |
140 | + if (value === this.state.current) { | |
141 | + return; | |
142 | + } | |
140 | 143 | if (value === "next") { |
141 | 144 | value = this.state.current + 5; |
142 | 145 | } |
... | ... | @@ -144,11 +147,6 @@ class Pagination { |
144 | 147 | value = this.state.current - 5; |
145 | 148 | } |
146 | 149 | this.setCurrent(this.getCurrent(value)); |
147 | - // 更新回调 | |
148 | - this.props.onChange({ | |
149 | - page: this.state.current, | |
150 | - pageSize: this.state.pageSize, | |
151 | - }); | |
152 | 150 | } |
153 | 151 | |
154 | 152 | handleChange() { |
... | ... | @@ -160,7 +158,7 @@ class Pagination { |
160 | 158 | } |
161 | 159 | this.props.onChange({ |
162 | 160 | page: current, |
163 | - pageSize: this.state.pageSize, | |
161 | + pageSize: parseInt(this.state.pageSize), | |
164 | 162 | }); |
165 | 163 | } |
166 | 164 | ... | ... |
src/Popover/Popover.js
... | ... | @@ -23,7 +23,7 @@ class Popover { |
23 | 23 | closing: false, |
24 | 24 | }; |
25 | 25 | |
26 | - constructor() { | |
26 | + constructor(esTable) { | |
27 | 27 | esNgAntd.createStyle("ant-popover", style); |
28 | 28 | this.state.target = $element[0]; |
29 | 29 | let title = this.props.title |
... | ... | @@ -67,9 +67,11 @@ class Popover { |
67 | 67 | $compile(div)($scope); |
68 | 68 | div.querySelector(".ant-popover-inner-content").innerHTML = |
69 | 69 | this.state.content; |
70 | - $compile(div.querySelector(".ant-popover-inner-content"))( | |
71 | - $scope.$parent | |
72 | - ); | |
70 | + if (!esTable) { | |
71 | + $compile(div.querySelector(".ant-popover-inner-content"))( | |
72 | + $scope.$parent | |
73 | + ); | |
74 | + } | |
73 | 75 | this.state.popover = div; |
74 | 76 | } |
75 | 77 | ... | ... |
webpack.config.js
... | ... | @@ -8,11 +8,11 @@ module.exports = { |
8 | 8 | // bpms |
9 | 9 | // path: "/Usersc/shann/Project/essa/bpms/bpms-webapp/src/main/webapp/lib/ng-antd", |
10 | 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 | 12 | // mvo |
13 | 13 | // path: "/Users/shann/Project/essa/mvo/mvo-webapp/public/browser-vendor/ng-antd", |
14 | 14 | // local |
15 | - // path: path.resolve(__dirname, "dist"), | |
15 | + path: path.resolve(__dirname, "dist"), | |
16 | 16 | filename: "ng-antd.js", |
17 | 17 | }, |
18 | 18 | module: { | ... | ... |