Commit 061629e708f2a86c6de346ec5b7d1c6204f44c53

Authored by Imshann
1 parent 710b4ac0

add

build/Button/Button.html
1   -<button ng-class="state.className" ng-disabled="{{state.disabled}}">
  1 +<button ng-class="state.className">
2 2 <span ng-if="loading" class="ant-btn-loading-icon">
3 3 <span class="anticon anticon-loading anticon-spin">
4 4 <es-icon type="LoadingOutlined"></es-icon>
... ...
build/Button/Button.js
... ... @@ -9,13 +9,12 @@ angular.module(&quot;esNgAntd&quot;).directive(&quot;esButton&quot;, function (esNgAntd) {
9 9 scope: {
10 10 type: "@",
11 11 size: "@",
12   - disabled: "@",
13 12 ghost: "@",
14 13 loading: "@",
15 14 htmlType: "@",
16 15 },
17 16 template: template,
18   - controller: function ($scope, $element) {
  17 + controller: function ($scope, $element, $attrs) {
19 18 this.getContext = function () {
20 19 return $scope;
21 20 };
... ... @@ -47,8 +46,6 @@ angular.module(&quot;esNgAntd&quot;).directive(&quot;esButton&quot;, function (esNgAntd) {
47 46 link: function ($scope, $element, $attrs, $controllers, $transclude) {
48 47 esNgAntd.createStyle("ant-btn", style);
49 48 let className = ["ant-btn"];
50   - $scope.state.disabled =
51   - $scope.disabled === "true" || $scope.disabled === "disabled";
52 49  
53 50 if ($scope.type) {
54 51 className.push("ant-btn-" + $scope.type);
... ...
build/Common/Common.js
... ... @@ -35,9 +35,10 @@ angular.module(&quot;esNgAntd&quot;).service(&quot;esNgAntd&quot;, [
35 35 rule.selectorText.indexOf(name) !== -1
36 36 ) {
37 37 rule.selectorText = rule.selectorText.replace(
38   - /\.ant-/g,
  38 + /\.ant\-/g,
39 39 ".disabled-ant-"
40 40 );
  41 + console.log(rule.selectorText);
41 42 }
42 43 }
43 44 };
... ...
build/Form/Form.js
... ... @@ -14,7 +14,7 @@ angular.module(&quot;esNgAntd&quot;).directive(&quot;esForm&quot;, function (esNgAntd) {
14 14 form: "=",
15 15 },
16 16 template: template,
17   - controller: function ($scope, $element) {
  17 + controller: function ($scope, $element, $attrs) {
18 18 this.getContext = function () {
19 19 return $scope;
20 20 };
... ... @@ -33,24 +33,17 @@ angular.module(&quot;esNgAntd&quot;).directive(&quot;esForm&quot;, function (esNgAntd) {
33 33 });
34 34 };
35 35  
  36 + $scope.submit = function () {
  37 + $scope.handleSubmit();
  38 + };
  39 +
36 40 $scope.handleSubmit = function () {
37 41 let values = {};
38 42 $scope.state.formItems.forEach(function (item) {
39 43 let name = item.esFormItem && item.esFormItem.name;
40 44 let value = item.value || item.state.value || null;
41 45 values[name] = value;
42   - }); // for (let i = 0; i < inputs.length; i++) {
43   - // const element = inputs[i];
44   - // const value = element.value === "" ? null : element.value;
45   - // if (element.id) {
46   - // if (element.id.split("_").length > 1) {
47   - // values[element.id.split("_")[1]] = value;
48   - // } else {
49   - // values[element.id] = value;
50   - // }
51   - // }
52   - // }
53   -
  46 + });
54 47 $scope.onFinish({
55 48 values: values,
56 49 });
... ...
build/Pagination/Pagination.html
... ... @@ -4,8 +4,15 @@
4 4 <es-icon type="LeftOutlined"></es-icon>
5 5 </button>
6 6 </li>
7   - <li ng-repeat="value in state.pageNumList" ng-class="'ant-pagination-item'+(state.current===value?' ant-pagination-item-active':'')" ng-click="handleClick(value)">
8   - <a>{{value}}</a>
  7 + <li ng-repeat="(key, value) in state.pageNumList track by key" ng-class="''+getItemLinkClassName(value)" ng-click="handleClick(value)">
  8 + <a ng-if="value!=='prev'&&value!=='next'">{{value}}</a>
  9 + <a ng-if="value==='prev'||value==='next'" class="ant-pagination-item-link">
  10 + <div class="ant-pagination-item-container">
  11 + <es-icon ng-if="value==='prev'" type="DoubleLeftOutlined" class="ant-pagination-item-link-icon"></es-icon>
  12 + <es-icon ng-if="value==='next'" type="DoubleRightOutlined" class="ant-pagination-item-link-icon"></es-icon>
  13 + <span class="ant-pagination-item-ellipsis">•••</span>
  14 + </div>
  15 + </a>
9 16 </li>
10 17 <li ng-class="'ant-pagination-next'+(state.current===state.pageNum?' ant-pagination-disabled':'')" ng-click="handleNext()">
11 18 <button type="button" class="ant-pagination-item-link">
... ...
build/Pagination/Pagination.js
... ... @@ -32,6 +32,70 @@ angular.module(&quot;esNgAntd&quot;).directive(&quot;esPagination&quot;, function (esNgAntd) {
32 32 pageNumList: null,
33 33 };
34 34  
  35 + $scope.getItemLinkClassName = function (value) {
  36 + if (typeof value === "number") {
  37 + return (
  38 + "ant-pagination-item" +
  39 + ($scope.state.current === value
  40 + ? " ant-pagination-item-active"
  41 + : "")
  42 + );
  43 + } else {
  44 + return "ant-pagination-jump-next ant-pagination-jump-next-custom-icon";
  45 + }
  46 + };
  47 +
  48 + $scope.getPageNumList = function () {
  49 + let pageNumList = [$scope.state.current];
  50 + let pageNum = $scope.getPageNum();
  51 +
  52 + if (pageNum <= 7 || $scope.state.current - 1 < 4) {
  53 + for (let i = $scope.state.current - 1; i > 0; i--) {
  54 + pageNumList.unshift(i);
  55 + }
  56 + } else {
  57 + let len =
  58 + $scope.state.current - 1 > 2
  59 + ? 2
  60 + : $scope.state.current - 1;
  61 +
  62 + for (let i = 1; i <= len; i++) {
  63 + pageNumList.unshift($scope.state.current - i);
  64 + }
  65 +
  66 + if ($scope.state.current - 2 > 2) {
  67 + pageNumList.unshift("prev");
  68 + pageNumList.unshift(1);
  69 + }
  70 + }
  71 +
  72 + if (pageNum <= 7 || pageNum - $scope.state.current < 4) {
  73 + for (let i = $scope.state.current + 1; i <= pageNum; i++) {
  74 + pageNumList.push(i);
  75 + }
  76 + } else {
  77 + let limit =
  78 + 3 - $scope.state.current > 0
  79 + ? 2 + (3 - $scope.state.current)
  80 + : 2;
  81 + let len =
  82 + pageNum - $scope.state.current > limit
  83 + ? limit
  84 + : pageNum - $scope.state.current;
  85 +
  86 + for (let i = 1; i <= len; i++) {
  87 + pageNumList.push($scope.state.current + i);
  88 + }
  89 +
  90 + if (pageNum - $scope.state.current > 2) {
  91 + pageNumList.push("next");
  92 + pageNumList.push(pageNum);
  93 + }
  94 + }
  95 +
  96 + return pageNumList;
  97 + };
  98 +
35 99 $scope.getPageNum = function () {
36 100 return (
37 101 Math.ceil(
... ... @@ -41,6 +105,10 @@ angular.module(&quot;esNgAntd&quot;).directive(&quot;esPagination&quot;, function (esNgAntd) {
41 105 );
42 106 };
43 107  
  108 + $scope.getPopupContainer = function () {
  109 + return $element[0].querySelector(".ant-pagination-options");
  110 + };
  111 +
44 112 $scope.handleNext = function () {
45 113 if ($scope.state.current === $scope.state.pageNum) {
46 114 return false;
... ... @@ -49,10 +117,6 @@ angular.module(&quot;esNgAntd&quot;).directive(&quot;esPagination&quot;, function (esNgAntd) {
49 117 $scope.handleClick(++$scope.state.current);
50 118 };
51 119  
52   - $scope.getPopupContainer = function () {
53   - return $element[0].querySelector(".ant-pagination-options");
54   - };
55   -
56 120 $scope.handlePrev = function () {
57 121 if ($scope.state.current === 1) {
58 122 return false;
... ... @@ -62,7 +126,15 @@ angular.module(&quot;esNgAntd&quot;).directive(&quot;esPagination&quot;, function (esNgAntd) {
62 126 };
63 127  
64 128 $scope.handleClick = function (value) {
65   - $scope.state.current = value; // 更新回调
  129 + if (value === "next") {
  130 + value = $scope.state.current + 5;
  131 + }
  132 +
  133 + if (value === "prev") {
  134 + value = $scope.state.current - 5;
  135 + }
  136 +
  137 + $scope.setCurrent($scope.getCurrent(value)); // 更新回调
66 138  
67 139 $scope.onChange({
68 140 page: $scope.state.current,
... ... @@ -109,6 +181,7 @@ angular.module(&quot;esNgAntd&quot;).directive(&quot;esPagination&quot;, function (esNgAntd) {
109 181 }
110 182  
111 183 $scope.state.current = $scope.getCurrent(value);
  184 + $scope.state.pageNumList = $scope.getPageNumList();
112 185 $scope.handleChange();
113 186 };
114 187  
... ... @@ -133,9 +206,7 @@ angular.module(&quot;esNgAntd&quot;).directive(&quot;esPagination&quot;, function (esNgAntd) {
133 206 $scope.state.pageSize =
134 207 $scope.pageSize || $scope.defaultPageSize || 10;
135 208 $scope.state.pageNum = $scope.getPageNum();
136   - $scope.state.pageNumList = Array($scope.state.pageNum)
137   - .fill(0)
138   - .map((v, i) => i + 1);
  209 + $scope.state.pageNumList = $scope.getPageNumList();
139 210 },
140 211 };
141 212 });
... ...
build/Select/Select.js
... ... @@ -67,6 +67,8 @@ angular
67 67 let func = $scope.getPopupContainer();
68 68  
69 69 if (typeof func === "function" && func() !== undefined) {
  70 + let containerElement = func();
  71 + containerElement.style.position = "relative";
70 72 return {
71 73 top: $element[0].offsetTop,
72 74 left: $element[0].offsetLeft,
... ...
build/Table/Table.js
... ... @@ -59,6 +59,13 @@ angular.module(&quot;esNgAntd&quot;).directive(&quot;esTable&quot;, function (esNgAntd) {
59 59 }
60 60  
61 61 $scope.columns.forEach((column) => {
  62 + // 排序
  63 + if (column.sortOrder) {
  64 + $scope.state.sorter.field = column.key;
  65 + $scope.state.sorter.order =
  66 + column.sortOrder;
  67 + }
  68 +
62 69 row[column.key] = column.render
63 70 ? column.render(
64 71 record[column.key],
... ...
dist/ng-antd.js
... ... @@ -49,7 +49,7 @@ eval(&quot;__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Bre
49 49 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
50 50  
51 51 "use strict";
52   -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Button_html__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Button.html */ \"./build/Button/Button.html\");\n/* harmony import */ var antd_lib_button_style_index_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! antd/lib/button/style/index.css */ \"./node_modules/antd/lib/button/style/index.css\");\n\n\nangular.module(\"esNgAntd\").directive(\"esButton\", function (esNgAntd) {\n return {\n controllerAs: \"esButton\",\n restrict: \"E\",\n transclude: true,\n replace: true,\n scope: {\n type: \"@\",\n size: \"@\",\n disabled: \"@\",\n ghost: \"@\",\n loading: \"@\",\n htmlType: \"@\",\n },\n template: _Button_html__WEBPACK_IMPORTED_MODULE_0__[\"default\"],\n controller: function ($scope, $element) {\n this.getContext = function () {\n return $scope;\n };\n\n $scope.state = {\n disabled: null,\n className: \"\",\n };\n $scope.watch = {\n loading: (newVal) => {\n if (newVal !== undefined) {\n if (newVal === \"true\") {\n $scope.state.className += \" ant-btn-loading\";\n } else {\n $scope.state.className =\n $scope.state.className.replace(\n \" ant-btn-loading\",\n \"\"\n );\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 esNgAntd.createStyle(\"ant-btn\", antd_lib_button_style_index_css__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\n let className = [\"ant-btn\"];\n $scope.state.disabled =\n $scope.disabled === \"true\" || $scope.disabled === \"disabled\";\n\n if ($scope.type) {\n className.push(\"ant-btn-\" + $scope.type);\n }\n\n if ($scope.size && [\"lg\", \"sm\", \"xs\"].includes($scope.size)) {\n className.push(\"ant-btn-\" + $scope.size);\n }\n\n if ($scope.ghost) {\n className.push(\"ant-btn-background-ghost\");\n }\n\n $scope.state.className = className.join(\" \");\n\n if ($scope.htmlType) {\n $element[0].setAttribute(\"type\", $scope.htmlType);\n }\n },\n };\n});\n\n\n//# sourceURL=webpack://ng-antd/./build/Button/Button.js?");
  52 +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Button_html__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Button.html */ \"./build/Button/Button.html\");\n/* harmony import */ var antd_lib_button_style_index_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! antd/lib/button/style/index.css */ \"./node_modules/antd/lib/button/style/index.css\");\n\n\nangular.module(\"esNgAntd\").directive(\"esButton\", function (esNgAntd) {\n return {\n controllerAs: \"esButton\",\n restrict: \"E\",\n transclude: true,\n replace: true,\n scope: {\n type: \"@\",\n size: \"@\",\n ghost: \"@\",\n loading: \"@\",\n htmlType: \"@\",\n },\n template: _Button_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 disabled: null,\n className: \"\",\n };\n $scope.watch = {\n loading: (newVal) => {\n if (newVal !== undefined) {\n if (newVal === \"true\") {\n $scope.state.className += \" ant-btn-loading\";\n } else {\n $scope.state.className =\n $scope.state.className.replace(\n \" ant-btn-loading\",\n \"\"\n );\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 esNgAntd.createStyle(\"ant-btn\", antd_lib_button_style_index_css__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\n let className = [\"ant-btn\"];\n\n if ($scope.type) {\n className.push(\"ant-btn-\" + $scope.type);\n }\n\n if ($scope.size && [\"lg\", \"sm\", \"xs\"].includes($scope.size)) {\n className.push(\"ant-btn-\" + $scope.size);\n }\n\n if ($scope.ghost) {\n className.push(\"ant-btn-background-ghost\");\n }\n\n $scope.state.className = className.join(\" \");\n\n if ($scope.htmlType) {\n $element[0].setAttribute(\"type\", $scope.htmlType);\n }\n },\n };\n});\n\n\n//# sourceURL=webpack://ng-antd/./build/Button/Button.js?");
53 53  
54 54 /***/ }),
55 55  
... ... @@ -104,7 +104,7 @@ eval(&quot;__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 }\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]);\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 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]);\n\n\n//# sourceURL=webpack://ng-antd/./build/Common/Common.js?");
108 108  
109 109 /***/ }),
110 110  
... ... @@ -280,7 +280,7 @@ eval(&quot;__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 },\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\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.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.getPopupContainer = function () {\n return $element[0].querySelector(\".ant-pagination-options\");\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 $scope.state.current = 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.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 = Array($scope.state.pageNum)\n .fill(0)\n .map((v, i) => i + 1);\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 },\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\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?");
284 284  
285 285 /***/ }),
286 286  
... ... @@ -346,7 +346,7 @@ eval(&quot;__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Row
346 346 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
347 347  
348 348 "use strict";
349   -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Select_html__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Select.html */ \"./build/Select/Select.html\");\n/* harmony import */ var antd_lib_select_style_index_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! antd/lib/select/style/index.css */ \"./node_modules/antd/lib/select/style/index.css\");\n\n\nangular\n .module(\"esNgAntd\")\n .directive(\"esSelect\", function ($compile, $timeout, esNgAntd) {\n return {\n controllerAs: \"esSelect\",\n restrict: \"E\",\n transclude: true,\n replace: true,\n scope: {\n value: \"@\",\n defaultValue: \"@\",\n placeholder: \"@\",\n onChange: \"&\",\n placeholder: \"@\",\n getPopupContainer: \"&\",\n size: \"@\",\n },\n template: _Select_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 open: false,\n childrens: [],\n label: null,\n value: $scope.value || $scope.defaultValue,\n popup: null,\n };\n\n $scope.setValue = function (value) {\n let option = $scope.state.childrens.find(function (option) {\n return option.value === value;\n });\n\n if (option) {\n option.label = option.element.text();\n $scope.state.label = option.label;\n $scope.state.value = option.value;\n } else {\n $scope.state.label = null;\n $scope.state.value = null;\n }\n };\n\n $scope.addOption = function (option) {\n $scope.state.childrens.push(option);\n };\n\n $scope.handleClick = function (option) {\n $scope.state.open = !$scope.state.open;\n $scope.state.label = option.label;\n $scope.state.value = option.value;\n $scope.onChange({\n value: $scope.state.value,\n });\n };\n\n $scope.getOffset = function (ele) {\n if (!ele || ele.nodeType != 1) {\n return;\n }\n\n let func = $scope.getPopupContainer();\n\n if (typeof func === \"function\" && func() !== undefined) {\n return {\n top: $element[0].offsetTop,\n left: $element[0].offsetLeft,\n };\n } else {\n let rect = ele.getBoundingClientRect();\n let doc = ele.ownerDocument.documentElement;\n return {\n top: rect.top + window.pageYOffset - doc.clientTop,\n left:\n rect.left + window.pageXOffset - doc.clientLeft,\n };\n }\n };\n\n $scope.myEvent = function () {\n $timeout(() => {\n $scope.state.open = false;\n document.body.removeEventListener(\n \"click\",\n $scope.myEvent\n );\n }, 0);\n };\n\n $scope.handleBlur = function () {\n // 事件绑定\n document.body.addEventListener(\"click\", $scope.myEvent);\n };\n\n $scope.handleOpen = function (event) {\n event.stopPropagation();\n const { height, width } =\n $element[0].getBoundingClientRect();\n const { top, left } = $scope.getOffset($element[0]); // 处理标签\n\n $scope.state.childrens.forEach(function (item) {\n item.label = item.element.text();\n });\n let div = document.createElement(\"div\");\n div.style.position = \"absolute\";\n div.style.left = 0;\n div.style.top = 0;\n div.style.width = \"100%\";\n div.appendChild(\n $compile(`<div><div ng-class=\"'ant-select-dropdown ant-select-dropdown-placement-bottomLeft'+(!state.open?' ant-select-dropdown-hidden':'')\" style=\"width: ${width}px; left: ${left}px; top: ${\n top + height + 2\n }px;\">\n <div class=\"ant-select-item ant-select-item-option\" ng-click=\"handleClick(option)\" ng-repeat=\"option in state.childrens\">\n <div class=\"ant-select-item-option-content\">{{option.label}}</div>\n </div>\n </div></div>`)($scope)[0]\n );\n\n if ($scope.state.popup === null) {\n let func = $scope.getPopupContainer();\n\n if (\n typeof func === \"function\" &&\n func() !== undefined\n ) {\n $element[0].style.position = \"relative\";\n $scope.getPopupContainer()().appendChild(div);\n } else {\n document.body.appendChild(div);\n }\n\n $scope.state.popup = div;\n }\n\n $scope.state.open = !$scope.state.open;\n $scope.handleBlur();\n };\n },\n require: [\"?^esForm\", \"?^esFormItem\"],\n link: function (\n $scope,\n $element,\n $attrs,\n $controllers,\n $transclude\n ) {\n let [esForm, esFormItem] = $controllers;\n esNgAntd.createStyle(\"ant-select\", antd_lib_select_style_index_css__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\n\n if (esForm) {\n $scope.esForm = esForm.getContext();\n $scope.esForm.state.formItems.push($scope);\n }\n\n if (esFormItem) {\n $scope.esFormItem = esFormItem.getContext();\n }\n\n $timeout(function () {\n $scope.setValue($scope.value || $scope.defaultValue);\n }, 100);\n },\n };\n });\n\n\n//# sourceURL=webpack://ng-antd/./build/Select/Select.js?");
  349 +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Select_html__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Select.html */ \"./build/Select/Select.html\");\n/* harmony import */ var antd_lib_select_style_index_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! antd/lib/select/style/index.css */ \"./node_modules/antd/lib/select/style/index.css\");\n\n\nangular\n .module(\"esNgAntd\")\n .directive(\"esSelect\", function ($compile, $timeout, esNgAntd) {\n return {\n controllerAs: \"esSelect\",\n restrict: \"E\",\n transclude: true,\n replace: true,\n scope: {\n value: \"@\",\n defaultValue: \"@\",\n placeholder: \"@\",\n onChange: \"&\",\n placeholder: \"@\",\n getPopupContainer: \"&\",\n size: \"@\",\n },\n template: _Select_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 open: false,\n childrens: [],\n label: null,\n value: $scope.value || $scope.defaultValue,\n popup: null,\n };\n\n $scope.setValue = function (value) {\n let option = $scope.state.childrens.find(function (option) {\n return option.value === value;\n });\n\n if (option) {\n option.label = option.element.text();\n $scope.state.label = option.label;\n $scope.state.value = option.value;\n } else {\n $scope.state.label = null;\n $scope.state.value = null;\n }\n };\n\n $scope.addOption = function (option) {\n $scope.state.childrens.push(option);\n };\n\n $scope.handleClick = function (option) {\n $scope.state.open = !$scope.state.open;\n $scope.state.label = option.label;\n $scope.state.value = option.value;\n $scope.onChange({\n value: $scope.state.value,\n });\n };\n\n $scope.getOffset = function (ele) {\n if (!ele || ele.nodeType != 1) {\n return;\n }\n\n let func = $scope.getPopupContainer();\n\n if (typeof func === \"function\" && func() !== undefined) {\n let containerElement = func();\n containerElement.style.position = \"relative\";\n return {\n top: $element[0].offsetTop,\n left: $element[0].offsetLeft,\n };\n } else {\n let rect = ele.getBoundingClientRect();\n let doc = ele.ownerDocument.documentElement;\n return {\n top: rect.top + window.pageYOffset - doc.clientTop,\n left:\n rect.left + window.pageXOffset - doc.clientLeft,\n };\n }\n };\n\n $scope.myEvent = function () {\n $timeout(() => {\n $scope.state.open = false;\n document.body.removeEventListener(\n \"click\",\n $scope.myEvent\n );\n }, 0);\n };\n\n $scope.handleBlur = function () {\n // 事件绑定\n document.body.addEventListener(\"click\", $scope.myEvent);\n };\n\n $scope.handleOpen = function (event) {\n event.stopPropagation();\n const { height, width } =\n $element[0].getBoundingClientRect();\n const { top, left } = $scope.getOffset($element[0]); // 处理标签\n\n $scope.state.childrens.forEach(function (item) {\n item.label = item.element.text();\n });\n let div = document.createElement(\"div\");\n div.style.position = \"absolute\";\n div.style.left = 0;\n div.style.top = 0;\n div.style.width = \"100%\";\n div.appendChild(\n $compile(`<div><div ng-class=\"'ant-select-dropdown ant-select-dropdown-placement-bottomLeft'+(!state.open?' ant-select-dropdown-hidden':'')\" style=\"width: ${width}px; left: ${left}px; top: ${\n top + height + 2\n }px;\">\n <div class=\"ant-select-item ant-select-item-option\" ng-click=\"handleClick(option)\" ng-repeat=\"option in state.childrens\">\n <div class=\"ant-select-item-option-content\">{{option.label}}</div>\n </div>\n </div></div>`)($scope)[0]\n );\n\n if ($scope.state.popup === null) {\n let func = $scope.getPopupContainer();\n\n if (\n typeof func === \"function\" &&\n func() !== undefined\n ) {\n $element[0].style.position = \"relative\";\n $scope.getPopupContainer()().appendChild(div);\n } else {\n document.body.appendChild(div);\n }\n\n $scope.state.popup = div;\n }\n\n $scope.state.open = !$scope.state.open;\n $scope.handleBlur();\n };\n },\n require: [\"?^esForm\", \"?^esFormItem\"],\n link: function (\n $scope,\n $element,\n $attrs,\n $controllers,\n $transclude\n ) {\n let [esForm, esFormItem] = $controllers;\n esNgAntd.createStyle(\"ant-select\", antd_lib_select_style_index_css__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\n\n if (esForm) {\n $scope.esForm = esForm.getContext();\n $scope.esForm.state.formItems.push($scope);\n }\n\n if (esFormItem) {\n $scope.esFormItem = esFormItem.getContext();\n }\n\n $timeout(function () {\n $scope.setValue($scope.value || $scope.defaultValue);\n }, 100);\n },\n };\n });\n\n\n//# sourceURL=webpack://ng-antd/./build/Select/Select.js?");
350 350  
351 351 /***/ }),
352 352  
... ... @@ -400,7 +400,7 @@ eval(&quot;__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Tab
400 400 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
401 401  
402 402 "use strict";
403   -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(\"esTable\", function (esNgAntd) {\n return {\n controllerAs: \"esTable\",\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 row[column.key] = column.render\n ? column.render(\n record[column.key],\n record,\n index\n )\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 };\n\n for (const key in $scope.watch) {\n $scope.$watch(key, $scope.watch[key], true);\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 $scope.rowSelection.onChange(\n $scope.state.selectedrecordKeys,\n $scope.state.selectedrecords\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 $scope.rowSelection.onChange(\n $scope.state.selectedrecordKeys,\n $scope.state.selectedrecords\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?");
  403 +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(\"esTable\", function (esNgAntd) {\n return {\n controllerAs: \"esTable\",\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 ? column.render(\n record[column.key],\n record,\n index\n )\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 };\n\n for (const key in $scope.watch) {\n $scope.$watch(key, $scope.watch[key], true);\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 $scope.rowSelection.onChange(\n $scope.state.selectedrecordKeys,\n $scope.state.selectedrecords\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 $scope.rowSelection.onChange(\n $scope.state.selectedrecordKeys,\n $scope.state.selectedrecords\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?");
404 404  
405 405 /***/ }),
406 406  
... ... @@ -9430,7 +9430,7 @@ eval(&quot;__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
9430 9430 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
9431 9431  
9432 9432 "use strict";
9433   -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 = \"<button ng-class=\\\"state.className\\\" ng-disabled=\\\"{{state.disabled}}\\\">\n <span ng-if=\\"loading\\" class=\\"ant-btn-loading-icon\\">\n <span class=\\"anticon anticon-loading anticon-spin\\">\n <es-icon type=\\"LoadingOutlined\\"></es-icon>\n </span>\n </span>\n <span ng-transclude></span>\n</button>\";\n// Exports\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (code);\n\n//# sourceURL=webpack://ng-antd/./build/Button/Button.html?");
  9433 +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 = \"<button ng-class=\\\"state.className\\\">\n <span ng-if=\\"loading\\" class=\\"ant-btn-loading-icon\\">\n <span class=\\"anticon anticon-loading anticon-spin\\">\n <es-icon type=\\"LoadingOutlined\\"></es-icon>\n </span>\n </span>\n <span ng-transclude></span>\n</button>\";\n// Exports\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (code);\n\n//# sourceURL=webpack://ng-antd/./build/Button/Button.html?");
9434 9434  
9435 9435 /***/ }),
9436 9436  
... ... @@ -9617,7 +9617,7 @@ eval(&quot;__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
9617 9617 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
9618 9618  
9619 9619 "use strict";
9620   -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-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=\\\"value in state.pageNumList\\\" ng-class=\\\"'ant-pagination-item'+(state.current===value?' ant-pagination-item-active':'')\\\" ng-click=\\\"handleClick(value)\\\">\\n <a>{{value}}</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?");
  9620 +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-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?");
9621 9621  
9622 9622 /***/ }),
9623 9623  
... ...
example/button.html
... ... @@ -20,6 +20,7 @@
20 20 <es-button>I am button.</es-button>
21 21 <h2>Link</h2>
22 22 <es-button type="link" ng-click="handleClick()">Link</es-button>
  23 + <es-button type="link" disabled="disabled">Link</es-button>
23 24 <h2>Ghost</h2>
24 25 <es-button type="primary" ghost="ghost">Link</es-button>
25 26 <h2>Loading</h2>
... ...
example/pagination.html
... ... @@ -9,8 +9,8 @@
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="50" on-change="handleChange(page, pageSize)" show-quick-jumper="true" show-size-changer="true"></es-pagination>
13   - <es-pagination size="small" default-current="1" total="50" on-change="handleChange(page, pageSize)" show-quick-jumper="true" show-size-changer="true"></es-pagination>
  12 + <es-pagination default-current="1" total="1" on-change="handleChange(page, pageSize)" show-quick-jumper="true" show-size-changer="true"></es-pagination>
  13 + <!-- <es-pagination size="small" default-current="1" total="50" on-change="handleChange(page, pageSize)" show-quick-jumper="true" show-size-changer="true"></es-pagination> -->
14 14 </div>
15 15 </div>
16 16 <script src="https://cdn.staticfile.org/angular.js/1.2.28/angular.min.js"></script>
... ...
example/table.html
... ... @@ -30,6 +30,7 @@
30 30 title: "航线",
31 31 key: "age",
32 32 sorter: true,
  33 + sortOrder: "ascend"
33 34 },
34 35 {
35 36 title: "状态",
... ...
src/Button/Button.html
1   -<button className={state.className} disabled={state.disabled}>
  1 +<button className={state.className}>
2 2 {loading && <span className="ant-btn-loading-icon">
3 3 <span className="anticon anticon-loading anticon-spin">
4 4 <es-icon type="LoadingOutlined"></es-icon>
... ...
src/Button/Button.js
... ... @@ -8,7 +8,6 @@ class Button {
8 8 props = {
9 9 type: String,
10 10 size: String,
11   - disabled: Boolean,
12 11 ghost: Boolean,
13 12 loading: Boolean,
14 13 htmlType: String,
... ... @@ -40,9 +39,6 @@ class Button {
40 39 esNgAntd.createStyle("ant-btn", style);
41 40  
42 41 let className = ["ant-btn"];
43   - this.state.disabled =
44   - this.props.disabled === "true" ||
45   - this.props.disabled === "disabled";
46 42 if (this.props.type) {
47 43 className.push("ant-btn-" + this.props.type);
48 44 }
... ...
src/Common/Common.js
... ... @@ -28,9 +28,10 @@ angular.module(&quot;esNgAntd&quot;).service(&quot;esNgAntd&quot;, [&quot;$compile&quot;, function ($compile)
28 28 let rule = this.styleSheets.cssRules[i];
29 29 if (rule.selectorText && rule.selectorText.indexOf(name) !== -1) {
30 30 rule.selectorText = rule.selectorText.replace(
31   - /\.ant-/g,
  31 + /\.ant\-/g,
32 32 ".disabled-ant-"
33 33 );
  34 + console.log(rule.selectorText);
34 35 }
35 36 }
36 37 };
... ...
src/Form/Form.js
... ... @@ -42,6 +42,10 @@ class Form {
42 42 });
43 43 }
44 44  
  45 + submit() {
  46 + this.handleSubmit();
  47 + }
  48 +
45 49 handleSubmit() {
46 50 let values = {};
47 51 this.state.formItems.forEach(function (item) {
... ... @@ -49,17 +53,6 @@ class Form {
49 53 let value = item.value || item.state.value || null;
50 54 values[name] = value;
51 55 });
52   - // for (let i = 0; i < inputs.length; i++) {
53   - // const element = inputs[i];
54   - // const value = element.value === "" ? null : element.value;
55   - // if (element.id) {
56   - // if (element.id.split("_").length > 1) {
57   - // values[element.id.split("_")[1]] = value;
58   - // } else {
59   - // values[element.id] = value;
60   - // }
61   - // }
62   - // }
63 56 this.props.onFinish({
64 57 values: values,
65 58 });
... ...
src/Pagination/Pagination.html
... ... @@ -4,9 +4,16 @@
4 4 <es-icon type="LeftOutlined"></es-icon>
5 5 </button>
6 6 </li>
7   - {state.pageNumList.map(function (value) {
8   - return <li className={"ant-pagination-item" + (state.current === value ? " ant-pagination-item-active" : "")} onClick={this.handleClick.bind(this, value)}>
9   - <a>{value}</a>
  7 + {state.pageNumList.map(function (value, key) {
  8 + return <li key="key" className={""+getItemLinkClassName(value)} onClick={this.handleClick.bind(this, value)}>
  9 + {(value!=='prev'&&value!=='next')&&<a>{value}</a>}
  10 + {(value==='prev'||value==='next')&&<a className="ant-pagination-item-link">
  11 + <div className="ant-pagination-item-container">
  12 + {value==="prev"&&<es-icon type="DoubleLeftOutlined" className="ant-pagination-item-link-icon"></es-icon>}
  13 + {value==="next"&&<es-icon type="DoubleRightOutlined" className="ant-pagination-item-link-icon"></es-icon>}
  14 + <span className="ant-pagination-item-ellipsis">•••</span>
  15 + </div>
  16 + </a>}
10 17 </li>
11 18 })}
12 19 <li className={"ant-pagination-next" + (state.current === state.pageNum ? " ant-pagination-disabled" : "")} onClick={this.handleNext}>
... ...
src/Pagination/Pagination.js
... ... @@ -2,7 +2,6 @@ import template from &quot;./Pagination.html&quot;;
2 2 import style from "antd/lib/pagination/style/index.css";
3 3  
4 4 class Pagination {
5   -
6 5 useModules = ["esNgAntd"];
7 6  
8 7 template = template;
... ... @@ -31,16 +30,79 @@ class Pagination {
31 30 constructor() {
32 31 esNgAntd.createStyle("ant-pagination", style);
33 32 this.state.total = Number(this.props.total || 0);
34   - this.state.current = Number(this.props.current || this.props.defaultCurrent || 1);
35   - this.state.pageSize = this.props.pageSize || this.props.defaultPageSize || 10;
  33 + this.state.current = Number(
  34 + this.props.current || this.props.defaultCurrent || 1
  35 + );
  36 + this.state.pageSize =
  37 + this.props.pageSize || this.props.defaultPageSize || 10;
36 38 this.state.pageNum = this.getPageNum();
37   - this.state.pageNumList = Array(this.state.pageNum)
38   - .fill(0)
39   - .map((v, i) => i + 1);
  39 + this.state.pageNumList = this.getPageNumList();
  40 + }
  41 +
  42 + getItemLinkClassName(value) {
  43 + if (typeof value === "number") {
  44 + return (
  45 + "ant-pagination-item" +
  46 + (this.state.current === value
  47 + ? " ant-pagination-item-active"
  48 + : "")
  49 + );
  50 + } else {
  51 + return "ant-pagination-jump-next ant-pagination-jump-next-custom-icon";
  52 + }
  53 + }
  54 +
  55 + getPageNumList() {
  56 + let pageNumList = [this.state.current];
  57 + let pageNum = this.getPageNum();
  58 + if (pageNum <= 7 || this.state.current - 1 < 4) {
  59 + for (let i = this.state.current - 1; i > 0; i--) {
  60 + pageNumList.unshift(i);
  61 + }
  62 + } else {
  63 + let len = this.state.current - 1 > 2 ? 2 : this.state.current - 1;
  64 + for (let i = 1; i <= len; i++) {
  65 + pageNumList.unshift(this.state.current - i);
  66 + }
  67 + if (this.state.current - 2 > 2) {
  68 + pageNumList.unshift("prev");
  69 + pageNumList.unshift(1);
  70 + }
  71 + }
  72 +
  73 + if (pageNum <= 7 || pageNum - this.state.current < 4) {
  74 + for (let i = this.state.current + 1; i <= pageNum; i++) {
  75 + pageNumList.push(i);
  76 + }
  77 + } else {
  78 + let limit =
  79 + 3 - this.state.current > 0 ? 2 + (3 - this.state.current) : 2;
  80 + let len =
  81 + pageNum - this.state.current > limit
  82 + ? limit
  83 + : pageNum - this.state.current;
  84 + for (let i = 1; i <= len; i++) {
  85 + pageNumList.push(this.state.current + i);
  86 + }
  87 + if (pageNum - this.state.current > 2) {
  88 + pageNumList.push("next");
  89 + pageNumList.push(pageNum);
  90 + }
  91 + }
  92 + return pageNumList;
40 93 }
41 94  
42 95 getPageNum() {
43   - return Math.ceil(this.state.total / (this.props.pageSize || this.props.defaultPageSize || 10)) || 1;
  96 + return (
  97 + Math.ceil(
  98 + this.state.total /
  99 + (this.props.pageSize || this.props.defaultPageSize || 10)
  100 + ) || 1
  101 + );
  102 + }
  103 +
  104 + getPopupContainer() {
  105 + return $element[0].querySelector(".ant-pagination-options");
44 106 }
45 107  
46 108 handleNext() {
... ... @@ -50,10 +112,6 @@ class Pagination {
50 112 this.handleClick(++this.state.current);
51 113 }
52 114  
53   - getPopupContainer() {
54   - return $element[0].querySelector(".ant-pagination-options");
55   - }
56   -
57 115 handlePrev() {
58 116 if (this.state.current === 1) {
59 117 return false;
... ... @@ -62,7 +120,13 @@ class Pagination {
62 120 }
63 121  
64 122 handleClick(value) {
65   - this.state.current = value;
  123 + if (value === "next") {
  124 + value = this.state.current + 5;
  125 + }
  126 + if (value === "prev") {
  127 + value = this.state.current - 5;
  128 + }
  129 + this.setCurrent(this.getCurrent(value));
66 130 // 更新回调
67 131 this.props.onChange({
68 132 page: this.state.current,
... ... @@ -88,7 +152,7 @@ class Pagination {
88 152 this.state.pageSize = parseInt(value);
89 153 this.handleChange();
90 154 }
91   -
  155 +
92 156 getCurrent(number) {
93 157 if (number > this.state.pageNum) {
94 158 return this.state.pageNum;
... ... @@ -104,6 +168,7 @@ class Pagination {
104 168 return;
105 169 }
106 170 this.state.current = this.getCurrent(value);
  171 + this.state.pageNumList = this.getPageNumList();
107 172 this.handleChange();
108 173 }
109 174  
... ...
src/Select/Select.js
... ... @@ -72,6 +72,8 @@ class Select {
72 72 }
73 73 let func = this.props.getPopupContainer();
74 74 if (typeof func === "function" && func() !== undefined) {
  75 + let containerElement = func();
  76 + containerElement.style.position = "relative";
75 77 return {
76 78 top: $element[0].offsetTop,
77 79 left: $element[0].offsetLeft,
... ...
src/Table/Table.js
... ... @@ -25,7 +25,7 @@ class Table {
25 25 sorter: {
26 26 field: null,
27 27 order: null,
28   - },
  28 + }
29 29 };
30 30  
31 31 template = template;
... ... @@ -50,6 +50,11 @@ class Table {
50 50 row = Object.assign(row, extraAttr);
51 51 }
52 52 this.props.columns.forEach((column) => {
  53 + // 排序
  54 + if (column.sortOrder) {
  55 + this.state.sorter.field = column.key;
  56 + this.state.sorter.order = column.sortOrder;
  57 + }
53 58 row[column.key] = column.render
54 59 ? column.render(record[column.key], record, index)
55 60 : record[column.key];
... ...
webpack.config.js
... ... @@ -6,9 +6,9 @@ module.exports = {
6 6 entry: "./build/index.js",
7 7 output: {
8 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 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
... ...