Commit 710b4ac01cb0063fa978da3d1c0e88c0b665dd61
1 parent
4c519425
优化
Showing
21 changed files
with
147 additions
and
73 deletions
Show diff stats
build/Message/Message.js
1 | import style from "antd/lib/message/style/index.css"; | 1 | import style from "antd/lib/message/style/index.css"; |
2 | -angular.module("esNgAntd").factory("message", function () { | ||
3 | - return { | ||
4 | - info: function (content, second = 3) { | ||
5 | - if (!document.querySelector("#ant-message")) { | ||
6 | - let styleElement = document.createElement("style"); | ||
7 | - styleElement.setAttribute("id", "ant-message"); | ||
8 | - styleElement.setAttribute("type", "text/css"); | ||
9 | - styleElement.innerHTML = style.toString(); | ||
10 | - document.head.appendChild(styleElement); | ||
11 | - } | ||
12 | - | ||
13 | - let antMessage = document.querySelector(".ant-message"); | 2 | +angular |
3 | + .module("esNgAntd") | ||
4 | + .factory("message", function ($compile, $rootScope, esNgAntd) { | ||
5 | + function Message(type, content, second = 3) { | ||
6 | + esNgAntd.createStyle("ant-message", style); | ||
14 | 7 | ||
15 | - if (!antMessage) { | 8 | + if (!document.querySelector(".ant-message")) { |
16 | let wrapperTemplate = `<div class="ant-message"><span></span></div>`; | 9 | let wrapperTemplate = `<div class="ant-message"><span></span></div>`; |
17 | let wrapperElement = document.createElement("div"); | 10 | let wrapperElement = document.createElement("div"); |
18 | wrapperElement.innerHTML = wrapperTemplate; | 11 | wrapperElement.innerHTML = wrapperTemplate; |
19 | document.body.appendChild(wrapperElement); | 12 | document.body.appendChild(wrapperElement); |
20 | } | 13 | } |
21 | 14 | ||
22 | - let messageTemplate = `<div class="ant-message-notice"><div class="ant-message-notice-content"><div class="ant-message-custom-content ant-message-info"><i class="anticon anticon-info-circle"></i><span>${content}</span></div></div></div>`; | ||
23 | let messageWrapperElement = document.createElement("div"); | 15 | let messageWrapperElement = document.createElement("div"); |
24 | - messageWrapperElement.innerHTML = messageTemplate; | 16 | + messageWrapperElement.innerHTML = this.getTemplate(type, content); |
25 | let messageElement = messageWrapperElement.childNodes[0]; | 17 | let messageElement = messageWrapperElement.childNodes[0]; |
26 | document | 18 | document |
27 | .querySelector(".ant-message span") | 19 | .querySelector(".ant-message span") |
28 | .appendChild(messageElement); | 20 | .appendChild(messageElement); |
21 | + $compile(messageElement)($rootScope); | ||
29 | setTimeout(() => { | 22 | setTimeout(() => { |
30 | messageElement.remove(); | 23 | messageElement.remove(); |
31 | }, second * 1000); | 24 | }, second * 1000); |
32 | - }, | ||
33 | - }; | ||
34 | -}); | 25 | + } |
26 | + | ||
27 | + Message.prototype.getTemplate = function (type, content) { | ||
28 | + let icon = { | ||
29 | + info: "InfoCircleFilled", | ||
30 | + success: "CheckCircleFilled", | ||
31 | + error: "CloseCircleFilled", | ||
32 | + warning: "InfoCircleFilled", | ||
33 | + }; | ||
34 | + return `<div class="ant-message-notice"><div class="ant-message-notice-content"><div class="ant-message-custom-content ant-message-${type}"><es-icon type="${icon[type]}"></es-icon><span>${content}</span></div></div></div>`; | ||
35 | + }; | ||
36 | + | ||
37 | + return { | ||
38 | + info: function (content, second) { | ||
39 | + new Message("info", content, second); | ||
40 | + }, | ||
41 | + success: function (content, second) { | ||
42 | + new Message("success", content, second); | ||
43 | + }, | ||
44 | + error: function (content, second) { | ||
45 | + new Message("error", content, second); | ||
46 | + }, | ||
47 | + warning: function (content, second) { | ||
48 | + new Message("warning", content, second); | ||
49 | + }, | ||
50 | + }; | ||
51 | + }); |
build/Pagination/Pagination.html
1 | -<ul class="ant-pagination"> | 1 | +<ul ng-class="'ant-pagination'+(size==='small'?' mini':'')"> |
2 | <li ng-class="'ant-pagination-prev'+(state.current===1?' ant-pagination-disabled':'')" ng-click="handlePrev()"> | 2 | <li ng-class="'ant-pagination-prev'+(state.current===1?' ant-pagination-disabled':'')" ng-click="handlePrev()"> |
3 | <button type="button" class="ant-pagination-item-link"> | 3 | <button type="button" class="ant-pagination-item-link"> |
4 | <es-icon type="LeftOutlined"></es-icon> | 4 | <es-icon type="LeftOutlined"></es-icon> |
@@ -13,7 +13,7 @@ | @@ -13,7 +13,7 @@ | ||
13 | </button> | 13 | </button> |
14 | </li> | 14 | </li> |
15 | <li class="ant-pagination-options"> | 15 | <li class="ant-pagination-options"> |
16 | - <es-select ng-if="showSizeChanger==='true'" class="ant-pagination-options-size-changer" value="10" get-popup-container="getPopupContainer" on-change="handleSelectChange(value)"> | 16 | + <es-select ng-if="showSizeChanger==='true'" class="ant-pagination-options-size-changer" size="{{size}}" value="10" get-popup-container="getPopupContainer" on-change="handleSelectChange(value)"> |
17 | <es-select-option value="10">10 条/页</es-select-option> | 17 | <es-select-option value="10">10 条/页</es-select-option> |
18 | <es-select-option value="20">20 条/页</es-select-option> | 18 | <es-select-option value="20">20 条/页</es-select-option> |
19 | <es-select-option value="30">30 条/页</es-select-option> | 19 | <es-select-option value="30">30 条/页</es-select-option> |
build/Pagination/Pagination.js
@@ -16,9 +16,10 @@ angular.module("esNgAntd").directive("esPagination", function (esNgAntd) { | @@ -16,9 +16,10 @@ angular.module("esNgAntd").directive("esPagination", function (esNgAntd) { | ||
16 | onShowSizeChange: "&", | 16 | onShowSizeChange: "&", |
17 | showQuickJumper: "@", | 17 | showQuickJumper: "@", |
18 | showSizeChanger: "@", | 18 | showSizeChanger: "@", |
19 | + size: "@", | ||
19 | }, | 20 | }, |
20 | template: template, | 21 | template: template, |
21 | - controller: function ($scope, $element) { | 22 | + controller: function ($scope, $element, $attrs) { |
22 | this.getContext = function () { | 23 | this.getContext = function () { |
23 | return $scope; | 24 | return $scope; |
24 | }; | 25 | }; |
@@ -0,0 +1,14 @@ | @@ -0,0 +1,14 @@ | ||
1 | +<div> | ||
2 | + <div ng-class="`ant-select-dropdown'\n ant-select-dropdown--single\n ant-select-dropdown-placement-bottomLeft\n ant-select-dropdown-hidden`" style="width: 200px; left: ${left}px; top: ${ | ||
3 | + top + height + 2 | ||
4 | +}px;"> | ||
5 | + <ul class=" | ||
6 | + ant-select-dropdown-menu | ||
7 | + ant-select-dropdown-menu-root | ||
8 | + ant-select-dropdown-menu-vertical | ||
9 | + "> | ||
10 | + <li class="ant-select-dropdown-menu-item">ABC</li> | ||
11 | + <li class="ant-select-dropdown-menu-item">EFG</li> | ||
12 | + </ul> | ||
13 | + </div> | ||
14 | +</div> | ||
0 | \ No newline at end of file | 15 | \ No newline at end of file |
build/Select/Select.html
1 | -<div class="ant-select ant-select-single ant-select-show-arrow" ng-click="handleOpen($event)"> | 1 | +<div ng-class="'ant-select ant-select-single ant-select-show-arrow'+(size==='small'?' ant-select-sm':'')" ng-click="handleOpen($event)"> |
2 | <div class="ant-select-selector"> | 2 | <div class="ant-select-selector"> |
3 | <span class="ant-select-selection-item">{{state.label}}</span> | 3 | <span class="ant-select-selection-item">{{state.label}}</span> |
4 | </div> | 4 | </div> |
build/Select/Select.js
@@ -15,9 +15,10 @@ angular | @@ -15,9 +15,10 @@ angular | ||
15 | onChange: "&", | 15 | onChange: "&", |
16 | placeholder: "@", | 16 | placeholder: "@", |
17 | getPopupContainer: "&", | 17 | getPopupContainer: "&", |
18 | + size: "@", | ||
18 | }, | 19 | }, |
19 | template: template, | 20 | template: template, |
20 | - controller: function ($scope, $element) { | 21 | + controller: function ($scope, $element, $attrs) { |
21 | this.getContext = function () { | 22 | this.getContext = function () { |
22 | return $scope; | 23 | return $scope; |
23 | }; | 24 | }; |
build/Table/Table.html
1 | <div class="ant-table-wrapper"> | 1 | <div class="ant-table-wrapper"> |
2 | <es-spin spinning="{{loading}}"> | 2 | <es-spin spinning="{{loading}}"> |
3 | - <div class="ant-table ant-table-default"> | 3 | + <div ng-class="'ant-table ant-table-'+state.size"> |
4 | <div class="ant-table-content"> | 4 | <div class="ant-table-content"> |
5 | <table> | 5 | <table> |
6 | <thead class="ant-table-thead"> | 6 | <thead class="ant-table-thead"> |
build/Table/Table.js
@@ -13,14 +13,16 @@ angular.module("esNgAntd").directive("esTable", function (esNgAntd) { | @@ -13,14 +13,16 @@ angular.module("esNgAntd").directive("esTable", function (esNgAntd) { | ||
13 | rowKey: "@", | 13 | rowKey: "@", |
14 | loading: "@", | 14 | loading: "@", |
15 | onChange: "&", | 15 | onChange: "&", |
16 | + size: "@", | ||
16 | }, | 17 | }, |
17 | template: template, | 18 | template: template, |
18 | - controller: function ($scope, $element) { | 19 | + controller: function ($scope, $element, $attrs) { |
19 | this.getContext = function () { | 20 | this.getContext = function () { |
20 | return $scope; | 21 | return $scope; |
21 | }; | 22 | }; |
22 | 23 | ||
23 | $scope.state = { | 24 | $scope.state = { |
25 | + size: $scope.size || "default", | ||
24 | dataSource: [], | 26 | dataSource: [], |
25 | selectedrecordKeys: [], | 27 | selectedrecordKeys: [], |
26 | selectedrecords: [], | 28 | selectedrecords: [], |
dist/ng-antd.js
@@ -181,7 +181,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Ima | @@ -181,7 +181,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Ima | ||
181 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | 181 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
182 | 182 | ||
183 | "use strict"; | 183 | "use strict"; |
184 | -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _ImagePreviewGroup_html__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ImagePreviewGroup.html */ \"./build/ImagePreviewGroup/ImagePreviewGroup.html\");\n\nangular\n .module(\"esNgAntd\")\n .directive(\"esImagePreviewGroup\", function (esNgAntd) {\n return {\n controllerAs: \"esImagePreviewGroup\",\n restrict: \"E\",\n transclude: true,\n replace: true,\n template: _ImagePreviewGroup_html__WEBPACK_IMPORTED_MODULE_0__[\"default\"],\n controller: function ($scope, $element) {\n this.getContext = function () {\n return $scope;\n };\n\n $scope.state = {\n current: 0,\n visible: false,\n src: null,\n childrens: [],\n };\n\n $scope.addChildren = function (children) {\n $scope.state.childrens.push(children);\n return $scope.state.childrens.length - 1;\n };\n\n $scope.handleOpen = function (index) {\n $scope.state.current = index;\n $scope.state.src = $scope.state.childrens[index].state.src;\n $scope.state.visible = true;\n };\n\n $scope.handleClose = function () {\n $scope.state.visible = false;\n };\n\n $scope.handlePrev = function () {\n $scope.state.current =\n $scope.state.current > 0 ? $scope.state.current - 1 : 0;\n $scope.state.src =\n $scope.state.childrens[$scope.state.current].state.src;\n };\n\n $scope.handleNext = function () {\n $scope.state.current =\n $scope.state.current < $scope.state.childrens.length - 1\n ? $scope.state.current + 1\n : $scope.state.childrens.length - 1;\n $scope.state.src =\n $scope.state.childrens[$scope.state.current].state.src;\n };\n\n $scope.handlePreview = function () {\n esNgAntd.createLayer(\n `\n <div class=\"ant-image-preview-root\">\n <div class=\"ant-image-preview-mask\" ng-if=\"state.visible\"></div>\n <div class=\"ant-image-preview-wrap\" ng-show=\"state.visible\">\n <div class=\"ant-image-preview\">\n <div class=\"ant-image-preview-content\">\n <div class=\"ant-image-preview-body\">\n <ul class=\"ant-image-preview-operations\">\n <li class=\"ant-image-preview-operations-operation\">\n <span class=\"anticon anticon-close ant-image-preview-operations-icon\" ng-click=\"handleClose()\">\n <es-icon type=\"CloseOutlined\"></es-icon>\n </span>\n </li> \n </ul>\n <div class=\"ant-image-preview-img-wrapper\">\n <img class=\"ant-image-preview-img\" ng-src=\"{{state.src}}\"/>\n </div>\n <div ng-class=\"{'ant-image-preview-switch-left': true, 'ant-image-preview-switch-left-disabled': state.current===0}\" ng-click=\"handlePrev()\">\n <es-icon type=\"LeftOutlined\"></es-icon>\n </div>\n <div ng-class=\"{'ant-image-preview-switch-right': true,'ant-image-preview-switch-right-disabled': (state.childrens.length-1)===state.current}\" ng-click=\"handleNext()\">\n <es-icon type=\"RightOutlined\"></es-icon>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n `,\n $scope\n );\n };\n },\n link: function (\n $scope,\n $element,\n $attrs,\n $controllers,\n $transclude\n ) {\n $scope.handlePreview();\n },\n };\n });\n\n\n//# sourceURL=webpack://ng-antd/./build/ImagePreviewGroup/ImagePreviewGroup.js?"); | 184 | +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _ImagePreviewGroup_html__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ImagePreviewGroup.html */ \"./build/ImagePreviewGroup/ImagePreviewGroup.html\");\n\nangular\n .module(\"esNgAntd\")\n .directive(\"esImagePreviewGroup\", function (esNgAntd) {\n return {\n controllerAs: \"esImagePreviewGroup\",\n restrict: \"E\",\n transclude: true,\n replace: true,\n scope: {\n preview: \"=\",\n },\n template: _ImagePreviewGroup_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 current: 0,\n visible: false,\n src: null,\n childrens: [],\n };\n\n $scope.addChildren = function (children) {\n $scope.state.childrens.push(children);\n return $scope.state.childrens.length - 1;\n };\n\n $scope.setCurrent = function (value) {\n $scope.state.current = value;\n\n if (\n typeof $scope.preview === \"object\" &&\n typeof $scope.preview.onCurrentChange === \"function\"\n ) {\n $scope.preview.onCurrentChange(value);\n }\n };\n\n $scope.setVisible = function (value) {\n $scope.state.visible = value;\n\n if (\n typeof $scope.preview === \"object\" &&\n typeof $scope.preview.onVisibleChange === \"function\"\n ) {\n $scope.preview.onVisibleChange(value);\n }\n };\n\n $scope.handleOpen = function (index) {\n $scope.setCurrent(index);\n $scope.state.src = $scope.state.childrens[index].state.src;\n $scope.setVisible(true);\n };\n\n $scope.handleClose = function () {\n $scope.setVisible(false);\n };\n\n $scope.handlePrev = function () {\n $scope.setCurrent(\n $scope.state.current > 0 ? $scope.state.current - 1 : 0\n );\n $scope.state.src =\n $scope.state.childrens[$scope.state.current].state.src;\n };\n\n $scope.handleNext = function () {\n $scope.setCurrent(\n $scope.state.current < $scope.state.childrens.length - 1\n ? $scope.state.current + 1\n : $scope.state.childrens.length - 1\n );\n $scope.state.src =\n $scope.state.childrens[$scope.state.current].state.src;\n };\n\n $scope.handlePreview = function () {\n let className;\n\n if ($attrs.class) {\n className = ` ${$attrs.class}`;\n }\n\n esNgAntd.createLayer(\n `\n <div class=\"ant-image-preview-root${className}\">\n <div class=\"ant-image-preview-mask\" ng-if=\"state.visible\"></div>\n <div class=\"ant-image-preview-wrap\" ng-show=\"state.visible\">\n <div class=\"ant-image-preview\">\n <div class=\"ant-image-preview-content\">\n <div class=\"ant-image-preview-body\">\n <ul class=\"ant-image-preview-operations\">\n <li class=\"ant-image-preview-operations-operation\">\n <span class=\"anticon anticon-close ant-image-preview-operations-icon\" ng-click=\"handleClose()\">\n <es-icon type=\"CloseOutlined\"></es-icon>\n </span>\n </li> \n </ul>\n <div class=\"ant-image-preview-img-wrapper\">\n <img class=\"ant-image-preview-img\" ng-src=\"{{state.src}}\"/>\n </div>\n <div ng-class=\"{'ant-image-preview-switch-left': true, 'ant-image-preview-switch-left-disabled': state.current===0}\" ng-click=\"handlePrev()\">\n <es-icon type=\"LeftOutlined\"></es-icon>\n </div>\n <div ng-class=\"{'ant-image-preview-switch-right': true,'ant-image-preview-switch-right-disabled': (state.childrens.length-1)===state.current}\" ng-click=\"handleNext()\">\n <es-icon type=\"RightOutlined\"></es-icon>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n `,\n $scope\n );\n };\n },\n link: function (\n $scope,\n $element,\n $attrs,\n $controllers,\n $transclude\n ) {\n $scope.handlePreview();\n },\n };\n });\n\n\n//# sourceURL=webpack://ng-antd/./build/ImagePreviewGroup/ImagePreviewGroup.js?"); |
185 | 185 | ||
186 | /***/ }), | 186 | /***/ }), |
187 | 187 | ||
@@ -258,7 +258,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Lis | @@ -258,7 +258,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Lis | ||
258 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | 258 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
259 | 259 | ||
260 | "use strict"; | 260 | "use strict"; |
261 | -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var antd_lib_message_style_index_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! antd/lib/message/style/index.css */ \"./node_modules/antd/lib/message/style/index.css\");\n\nangular.module(\"esNgAntd\").factory(\"message\", function () {\n return {\n info: function (content, second = 3) {\n if (!document.querySelector(\"#ant-message\")) {\n let styleElement = document.createElement(\"style\");\n styleElement.setAttribute(\"id\", \"ant-message\");\n styleElement.setAttribute(\"type\", \"text/css\");\n styleElement.innerHTML = antd_lib_message_style_index_css__WEBPACK_IMPORTED_MODULE_0__[\"default\"].toString();\n document.head.appendChild(styleElement);\n }\n\n let antMessage = document.querySelector(\".ant-message\");\n\n if (!antMessage) {\n let wrapperTemplate = `<div class=\"ant-message\"><span></span></div>`;\n let wrapperElement = document.createElement(\"div\");\n wrapperElement.innerHTML = wrapperTemplate;\n document.body.appendChild(wrapperElement);\n }\n\n let messageTemplate = `<div class=\"ant-message-notice\"><div class=\"ant-message-notice-content\"><div class=\"ant-message-custom-content ant-message-info\"><i class=\"anticon anticon-info-circle\"></i><span>${content}</span></div></div></div>`;\n let messageWrapperElement = document.createElement(\"div\");\n messageWrapperElement.innerHTML = messageTemplate;\n let messageElement = messageWrapperElement.childNodes[0];\n document\n .querySelector(\".ant-message span\")\n .appendChild(messageElement);\n setTimeout(() => {\n messageElement.remove();\n }, second * 1000);\n },\n };\n});\n\n\n//# sourceURL=webpack://ng-antd/./build/Message/Message.js?"); | 261 | +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var antd_lib_message_style_index_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! antd/lib/message/style/index.css */ \"./node_modules/antd/lib/message/style/index.css\");\n\nangular\n .module(\"esNgAntd\")\n .factory(\"message\", function ($compile, $rootScope, esNgAntd) {\n function Message(type, content, second = 3) {\n esNgAntd.createStyle(\"ant-message\", antd_lib_message_style_index_css__WEBPACK_IMPORTED_MODULE_0__[\"default\"]);\n\n if (!document.querySelector(\".ant-message\")) {\n let wrapperTemplate = `<div class=\"ant-message\"><span></span></div>`;\n let wrapperElement = document.createElement(\"div\");\n wrapperElement.innerHTML = wrapperTemplate;\n document.body.appendChild(wrapperElement);\n }\n\n let messageWrapperElement = document.createElement(\"div\");\n messageWrapperElement.innerHTML = this.getTemplate(type, content);\n let messageElement = messageWrapperElement.childNodes[0];\n document\n .querySelector(\".ant-message span\")\n .appendChild(messageElement);\n $compile(messageElement)($rootScope);\n setTimeout(() => {\n messageElement.remove();\n }, second * 1000);\n }\n\n Message.prototype.getTemplate = function (type, content) {\n let icon = {\n info: \"InfoCircleFilled\",\n success: \"CheckCircleFilled\",\n error: \"CloseCircleFilled\",\n warning: \"InfoCircleFilled\",\n };\n return `<div class=\"ant-message-notice\"><div class=\"ant-message-notice-content\"><div class=\"ant-message-custom-content ant-message-${type}\"><es-icon type=\"${icon[type]}\"></es-icon><span>${content}</span></div></div></div>`;\n };\n\n return {\n info: function (content, second) {\n new Message(\"info\", content, second);\n },\n success: function (content, second) {\n new Message(\"success\", content, second);\n },\n error: function (content, second) {\n new Message(\"error\", content, second);\n },\n warning: function (content, second) {\n new Message(\"warning\", content, second);\n },\n };\n });\n\n\n//# sourceURL=webpack://ng-antd/./build/Message/Message.js?"); |
262 | 262 | ||
263 | /***/ }), | 263 | /***/ }), |
264 | 264 | ||
@@ -280,7 +280,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Mod | @@ -280,7 +280,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Mod | ||
280 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | 280 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
281 | 281 | ||
282 | "use strict"; | 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 },\n template: _Pagination_html__WEBPACK_IMPORTED_MODULE_0__[\"default\"],\n controller: function ($scope, $element) {\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.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?"); |
284 | 284 | ||
285 | /***/ }), | 285 | /***/ }), |
286 | 286 | ||
@@ -346,7 +346,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Row | @@ -346,7 +346,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Row | ||
346 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | 346 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
347 | 347 | ||
348 | "use strict"; | 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 },\n template: _Select_html__WEBPACK_IMPORTED_MODULE_0__[\"default\"],\n controller: function ($scope, $element) {\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 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("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Tab | @@ -400,7 +400,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Tab | ||
400 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | 400 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
401 | 401 | ||
402 | "use strict"; | 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 },\n template: _Table_html__WEBPACK_IMPORTED_MODULE_0__[\"default\"],\n controller: function ($scope, $element) {\n this.getContext = function () {\n return $scope;\n };\n\n $scope.state = {\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 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 | ||
@@ -9617,7 +9617,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac | @@ -9617,7 +9617,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac | ||
9617 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | 9617 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
9618 | 9618 | ||
9619 | "use strict"; | 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 class=\\\"ant-pagination\\\">\\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\\" 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=\\\"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?"); |
9621 | 9621 | ||
9622 | /***/ }), | 9622 | /***/ }), |
9623 | 9623 | ||
@@ -9683,7 +9683,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac | @@ -9683,7 +9683,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac | ||
9683 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | 9683 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
9684 | 9684 | ||
9685 | "use strict"; | 9685 | "use strict"; |
9686 | -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Module\nvar code = \"<div class=\\\"ant-select ant-select-single ant-select-show-arrow\\" ng-click=\\"handleOpen($event)\\">\n <div class=\\"ant-select-selector\\">\n <span class=\\"ant-select-selection-item\\">{{state.label}}</span>\n </div>\n <span class=\\"ant-select-arrow\\">\n <es-icon type=\\"DownOutlined\\"></es-icon>\n </span>\n <span hidden ng-transclude></span>\n</div>\";\n// Exports\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (code);\n\n//# sourceURL=webpack://ng-antd/./build/Select/Select.html?"); | 9686 | +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Module\nvar code = \"<div ng-class=\\\"'ant-select ant-select-single ant-select-show-arrow'+(size==='small'?' ant-select-sm':'')\\" ng-click=\\"handleOpen($event)\\">\n <div class=\\"ant-select-selector\\">\n <span class=\\"ant-select-selection-item\\">{{state.label}}</span>\n </div>\n <span class=\\"ant-select-arrow\\">\n <es-icon type=\\"DownOutlined\\"></es-icon>\n </span>\n <span hidden ng-transclude></span>\n</div>\";\n// Exports\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (code);\n\n//# sourceURL=webpack://ng-antd/./build/Select/Select.html?"); |
9687 | 9687 | ||
9688 | /***/ }), | 9688 | /***/ }), |
9689 | 9689 | ||
@@ -9727,7 +9727,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac | @@ -9727,7 +9727,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac | ||
9727 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | 9727 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
9728 | 9728 | ||
9729 | "use strict"; | 9729 | "use strict"; |
9730 | -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Module\nvar code = \"<div class=\\\"ant-table-wrapper\\\">\\n <es-spin spinning=\\\"{{loading}}\\\">\\n <div class=\\\"ant-table ant-table-default\\">\n <div class=\\"ant-table-content\\">\n <table>\n <thead class=\\"ant-table-thead\\">\n <tr>\n <th ng-if=\\"rowSelection\\" class=\\"ant-table-selection-column\\">\n <span class=\\"ant-table-header-column\\">\n <div>\n <span class=\\"ant-table-column-title\\">\n <div class=\\"ant-table-selection\\">\n <es-checkbox on-change=\\"handleSelectAll(event)\\" checked=\\"{{state.isSelectAll}}\\" />\n </div>\n </span>\n </div>\n </span>\n </th>\n <th ng-repeat=\\"(key, column) in columns track by key\\" class=\\"ant-table-cell ant-table-column-has-sorters\\" ng-style=\\"{width:column.width}\\">\n <span ng-if=\\"!column.sorter\\">{{column.title}}</span>\n <div ng-if=\\"column.sorter\\" class=\\"ant-table-column-sorters\\" ng-click=\\"handleSorter(column.key)\\">\n <span class=\\"ant-table-column-title\\">{{column.title}}</span>\n <span class=\\"ant-table-column-sorter ant-table-column-sorter-full\\">\n <span class=\\"ant-table-column-sorter-inner\\">\n <es-icon type=\\"CaretUpOutlined\\" ng-class=\\"'ant-table-column-sorter-up'+(state.sorter.field===column.key&&state.sorter.order==='ascend'?' active':'')\\"></es-icon>\n <es-icon type=\\"CaretDownOutlined\\" ng-class=\\"'ant-table-column-sorter-down'+(state.sorter.field===column.key&&state.sorter.order==='descend'?' active':'')\\"></es-icon>\n </span>\n </span>\n </div>\n </th>\n </tr>\n </thead>\n <tbody class=\\"ant-table-tbody\\">\n <tr ng-repeat=\\"(key, record) in state.dataSource track by record[state.rowKey]\\" class=\\"ant-table-row\\">\n <td ng-if=\\"rowSelection\\" class=\\"ant-table-selection-column\\">\n <span>\n <es-checkbox checked=\\"record.checked\\" disabled=\\"record.disabled\\" on-change=\\"handleSelect(event,$index)\\" />\n </span>\n </td>\n <td ng-repeat=\\"(key, column) in columns track by key\\" data-key=\\"{{column.key}}\\">\n <es-slot content=\\"{{record[column.key]}}\\" context=\\"esTable.getContext().$parent\\" />\n </td>\n </tr>\n <tr ng-if=\\"state.dataSource.length===0\\" class=\\"ant-table-placeholder\\">\n <td colspan=\\"{{columns.length}}\\">\n <es-empty image=\\"presented_image_simple\\"></es-empty>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n </div>\n </es-spin>\n</div>\";\n// Exports\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (code);\n\n//# sourceURL=webpack://ng-antd/./build/Table/Table.html?"); | 9730 | +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Module\nvar code = \"<div class=\\\"ant-table-wrapper\\\">\\n <es-spin spinning=\\\"{{loading}}\\\">\\n <div ng-class=\\\"'ant-table ant-table-'+state.size\\">\n <div class=\\"ant-table-content\\">\n <table>\n <thead class=\\"ant-table-thead\\">\n <tr>\n <th ng-if=\\"rowSelection\\" class=\\"ant-table-selection-column\\">\n <span class=\\"ant-table-header-column\\">\n <div>\n <span class=\\"ant-table-column-title\\">\n <div class=\\"ant-table-selection\\">\n <es-checkbox on-change=\\"handleSelectAll(event)\\" checked=\\"{{state.isSelectAll}}\\" />\n </div>\n </span>\n </div>\n </span>\n </th>\n <th ng-repeat=\\"(key, column) in columns track by key\\" class=\\"ant-table-cell ant-table-column-has-sorters\\" ng-style=\\"{width:column.width}\\">\n <span ng-if=\\"!column.sorter\\">{{column.title}}</span>\n <div ng-if=\\"column.sorter\\" class=\\"ant-table-column-sorters\\" ng-click=\\"handleSorter(column.key)\\">\n <span class=\\"ant-table-column-title\\">{{column.title}}</span>\n <span class=\\"ant-table-column-sorter ant-table-column-sorter-full\\">\n <span class=\\"ant-table-column-sorter-inner\\">\n <es-icon type=\\"CaretUpOutlined\\" ng-class=\\"'ant-table-column-sorter-up'+(state.sorter.field===column.key&&state.sorter.order==='ascend'?' active':'')\\"></es-icon>\n <es-icon type=\\"CaretDownOutlined\\" ng-class=\\"'ant-table-column-sorter-down'+(state.sorter.field===column.key&&state.sorter.order==='descend'?' active':'')\\"></es-icon>\n </span>\n </span>\n </div>\n </th>\n </tr>\n </thead>\n <tbody class=\\"ant-table-tbody\\">\n <tr ng-repeat=\\"(key, record) in state.dataSource track by record[state.rowKey]\\" class=\\"ant-table-row\\">\n <td ng-if=\\"rowSelection\\" class=\\"ant-table-selection-column\\">\n <span>\n <es-checkbox checked=\\"record.checked\\" disabled=\\"record.disabled\\" on-change=\\"handleSelect(event,$index)\\" />\n </span>\n </td>\n <td ng-repeat=\\"(key, column) in columns track by key\\" data-key=\\"{{column.key}}\\">\n <es-slot content=\\"{{record[column.key]}}\\" context=\\"esTable.getContext().$parent\\" />\n </td>\n </tr>\n <tr ng-if=\\"state.dataSource.length===0\\" class=\\"ant-table-placeholder\\">\n <td colspan=\\"{{columns.length}}\\">\n <es-empty image=\\"presented_image_simple\\"></es-empty>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n </div>\n </es-spin>\n</div>\";\n// Exports\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (code);\n\n//# sourceURL=webpack://ng-antd/./build/Table/Table.html?"); |
9731 | 9731 | ||
9732 | /***/ }), | 9732 | /***/ }), |
9733 | 9733 |
example/message.html
@@ -4,7 +4,6 @@ | @@ -4,7 +4,6 @@ | ||
4 | <head> | 4 | <head> |
5 | <meta charset="UTF-8" /> | 5 | <meta charset="UTF-8" /> |
6 | <title></title> | 6 | <title></title> |
7 | - <link href="https://cdn.staticfile.org/antd/3.26.9/antd.css" rel="stylesheet" /> | ||
8 | <style> | 7 | <style> |
9 | div.row { | 8 | div.row { |
10 | margin-bottom: 16px; | 9 | margin-bottom: 16px; |
@@ -15,7 +14,10 @@ | @@ -15,7 +14,10 @@ | ||
15 | <body> | 14 | <body> |
16 | <div ng-app="esNgAntd" ng-controller="mainCtrl"> | 15 | <div ng-app="esNgAntd" ng-controller="mainCtrl"> |
17 | <div class="container" style="padding: 50px"> | 16 | <div class="container" style="padding: 50px"> |
18 | - <button ng-click="handleClick()">Click Me</button> | 17 | + <es-button ng-click="handleClick('info')">Info</es-button> |
18 | + <es-button ng-click="handleClick('success')">Success</es-button> | ||
19 | + <es-button ng-click="handleClick('error')">Error</es-button> | ||
20 | + <es-button ng-click="handleClick('warning')">Warning</es-button> | ||
19 | </div> | 21 | </div> |
20 | </div> | 22 | </div> |
21 | 23 | ||
@@ -26,8 +28,8 @@ | @@ -26,8 +28,8 @@ | ||
26 | angular | 28 | angular |
27 | .module("esNgAntd") | 29 | .module("esNgAntd") |
28 | .controller("mainCtrl", function ($scope, message) { | 30 | .controller("mainCtrl", function ($scope, message) { |
29 | - $scope.handleClick = function () { | ||
30 | - message.info("12312"); | 31 | + $scope.handleClick = function (type) { |
32 | + message[type]("12312"); | ||
31 | } | 33 | } |
32 | }); | 34 | }); |
33 | </script> | 35 | </script> |
example/pagination.html
@@ -9,7 +9,8 @@ | @@ -9,7 +9,8 @@ | ||
9 | <body> | 9 | <body> |
10 | <div ng-app="esNgAntd" ng-controller="mainCtrl"> | 10 | <div ng-app="esNgAntd" ng-controller="mainCtrl"> |
11 | <div class="container" style="padding: 50px"> | 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"/> | 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> | ||
13 | </div> | 14 | </div> |
14 | </div> | 15 | </div> |
15 | <script src="https://cdn.staticfile.org/angular.js/1.2.28/angular.min.js"></script> | 16 | <script src="https://cdn.staticfile.org/angular.js/1.2.28/angular.min.js"></script> |
example/select.html
@@ -10,6 +10,10 @@ | @@ -10,6 +10,10 @@ | ||
10 | <es-select style="width: 200px;" value="AAA" on-change="handleChange(value)" placeholder="请选择..."> | 10 | <es-select style="width: 200px;" value="AAA" on-change="handleChange(value)" placeholder="请选择..."> |
11 | <es-select-option value="{{value}}" ng-repeat="value in options">{{value}}</es-select-option> | 11 | <es-select-option value="{{value}}" ng-repeat="value in options">{{value}}</es-select-option> |
12 | </es-select> | 12 | </es-select> |
13 | + | ||
14 | + <es-select style="width: 200px;" size="small" value="AAA" on-change="handleChange(value)" placeholder="请选择..."> | ||
15 | + <es-select-option value="{{value}}" ng-repeat="value in options">{{value}}</es-select-option> | ||
16 | + </es-select> | ||
13 | </div> | 17 | </div> |
14 | </div> | 18 | </div> |
15 | <script src="https://cdn.staticfile.org/angular.js/1.2.28/angular.min.js"></script> | 19 | <script src="https://cdn.staticfile.org/angular.js/1.2.28/angular.min.js"></script> |
example/table.html
@@ -9,7 +9,7 @@ | @@ -9,7 +9,7 @@ | ||
9 | <body> | 9 | <body> |
10 | <div ng-app="esNgAntd" ng-controller="mainCtrl"> | 10 | <div ng-app="esNgAntd" ng-controller="mainCtrl"> |
11 | <div class="container" style="padding: 50px"> | 11 | <div class="container" style="padding: 50px"> |
12 | - <es-table columns="columns" d-source="dataSource" row-selection="rowSelection" loading="{{loading}}" on-change="handleChange(sorter)"/> | 12 | + <es-table columns="columns" d-source="dataSource" row-selection="rowSelection" loading="{{loading}}" on-change="handleChange(sorter)" size="small"/> |
13 | </div> | 13 | </div> |
14 | </div> | 14 | </div> |
15 | <script src="https://cdn.staticfile.org/angular.js/1.2.28/angular.min.js"></script> | 15 | <script src="https://cdn.staticfile.org/angular.js/1.2.28/angular.min.js"></script> |
src/Message/Message.js
1 | import style from "antd/lib/message/style/index.css"; | 1 | import style from "antd/lib/message/style/index.css"; |
2 | 2 | ||
3 | -angular.module("esNgAntd").factory("message", function () { | ||
4 | - return { | ||
5 | - info: function (content, second = 3) { | ||
6 | - if (!document.querySelector("#ant-message")) { | ||
7 | - let styleElement = document.createElement("style"); | ||
8 | - styleElement.setAttribute("id", "ant-message"); | ||
9 | - styleElement.setAttribute("type", "text/css"); | ||
10 | - styleElement.innerHTML = style.toString(); | ||
11 | - document.head.appendChild(styleElement); | ||
12 | - } | ||
13 | - let antMessage = document.querySelector(".ant-message"); | ||
14 | - if (!antMessage) { | ||
15 | - let wrapperTemplate = `<div class="ant-message"><span></span></div>`; | ||
16 | - let wrapperElement = document.createElement("div"); | ||
17 | - wrapperElement.innerHTML = wrapperTemplate; | ||
18 | - document.body.appendChild(wrapperElement); | ||
19 | - } | ||
20 | - let messageTemplate = `<div class="ant-message-notice"><div class="ant-message-notice-content"><div class="ant-message-custom-content ant-message-info"><i class="anticon anticon-info-circle"></i><span>${content}</span></div></div></div>`; | ||
21 | - let messageWrapperElement = document.createElement("div"); | ||
22 | - messageWrapperElement.innerHTML = messageTemplate; | ||
23 | - let messageElement = messageWrapperElement.childNodes[0]; | ||
24 | - document.querySelector(".ant-message span").appendChild(messageElement); | ||
25 | - setTimeout(() => { | ||
26 | - messageElement.remove(); | ||
27 | - }, second * 1000); | ||
28 | - }, | ||
29 | - }; | ||
30 | -}); | 3 | +angular |
4 | + .module("esNgAntd") | ||
5 | + .factory("message", function ($compile, $rootScope, esNgAntd) { | ||
6 | + | ||
7 | + function Message(type, content, second = 3) { | ||
8 | + esNgAntd.createStyle("ant-message", style); | ||
9 | + | ||
10 | + if (!document.querySelector(".ant-message")) { | ||
11 | + let wrapperTemplate = `<div class="ant-message"><span></span></div>`; | ||
12 | + let wrapperElement = document.createElement("div"); | ||
13 | + wrapperElement.innerHTML = wrapperTemplate; | ||
14 | + document.body.appendChild(wrapperElement); | ||
15 | + } | ||
16 | + | ||
17 | + let messageWrapperElement = document.createElement("div"); | ||
18 | + messageWrapperElement.innerHTML = this.getTemplate( | ||
19 | + type, | ||
20 | + content | ||
21 | + ); | ||
22 | + let messageElement = messageWrapperElement.childNodes[0]; | ||
23 | + document | ||
24 | + .querySelector(".ant-message span") | ||
25 | + .appendChild(messageElement); | ||
26 | + $compile(messageElement)($rootScope); | ||
27 | + | ||
28 | + setTimeout(() => { | ||
29 | + messageElement.remove(); | ||
30 | + }, second * 1000); | ||
31 | + } | ||
32 | + | ||
33 | + Message.prototype.getTemplate = function (type, content) { | ||
34 | + let icon = { | ||
35 | + info: "InfoCircleFilled", | ||
36 | + success: "CheckCircleFilled", | ||
37 | + error: "CloseCircleFilled", | ||
38 | + warning: "InfoCircleFilled", | ||
39 | + }; | ||
40 | + return `<div class="ant-message-notice"><div class="ant-message-notice-content"><div class="ant-message-custom-content ant-message-${type}"><es-icon type="${icon[type]}"></es-icon><span>${content}</span></div></div></div>`; | ||
41 | + | ||
42 | + } | ||
43 | + | ||
44 | + return { | ||
45 | + info: function (content, second) { | ||
46 | + new Message("info", content, second); | ||
47 | + }, | ||
48 | + success: function (content, second) { | ||
49 | + new Message("success", content, second); | ||
50 | + }, | ||
51 | + error: function (content, second) { | ||
52 | + new Message("error", content, second); | ||
53 | + }, | ||
54 | + warning: function (content, second) { | ||
55 | + new Message("warning", content, second); | ||
56 | + }, | ||
57 | + }; | ||
58 | + }); |
src/Pagination/Pagination.html
1 | -<ul class="ant-pagination"> | 1 | +<ul className={"ant-pagination"+(size==="small"?" mini": "")}> |
2 | <li className={"ant-pagination-prev" + (state.current === 1 ? " ant-pagination-disabled" : "")} onClick={this.handlePrev}> | 2 | <li className={"ant-pagination-prev" + (state.current === 1 ? " ant-pagination-disabled" : "")} onClick={this.handlePrev}> |
3 | <button type="button" class="ant-pagination-item-link"> | 3 | <button type="button" class="ant-pagination-item-link"> |
4 | <es-icon type="LeftOutlined"></es-icon> | 4 | <es-icon type="LeftOutlined"></es-icon> |
@@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
15 | </button> | 15 | </button> |
16 | </li> | 16 | </li> |
17 | <li className="ant-pagination-options"> | 17 | <li className="ant-pagination-options"> |
18 | - {showSizeChanger === 'true' && <es-select className="ant-pagination-options-size-changer" value="10" get-popup-container="getPopupContainer" on-change="handleSelectChange(value)"> | 18 | + {showSizeChanger === 'true' && <es-select className="ant-pagination-options-size-changer" size="{{size}}" value="10" get-popup-container="getPopupContainer" on-change="handleSelectChange(value)"> |
19 | <es-select-option value="10">10 条/页</es-select-option> | 19 | <es-select-option value="10">10 条/页</es-select-option> |
20 | <es-select-option value="20">20 条/页</es-select-option> | 20 | <es-select-option value="20">20 条/页</es-select-option> |
21 | <es-select-option value="30">30 条/页</es-select-option> | 21 | <es-select-option value="30">30 条/页</es-select-option> |
src/Pagination/Pagination.js
@@ -17,6 +17,7 @@ class Pagination { | @@ -17,6 +17,7 @@ class Pagination { | ||
17 | onShowSizeChange: Function, | 17 | onShowSizeChange: Function, |
18 | showQuickJumper: Boolean, | 18 | showQuickJumper: Boolean, |
19 | showSizeChanger: Boolean, | 19 | showSizeChanger: Boolean, |
20 | + size: String, | ||
20 | }; | 21 | }; |
21 | 22 | ||
22 | state = { | 23 | state = { |
src/Select/Select.html
1 | -<div className="ant-select ant-select-single ant-select-show-arrow" onClick={this.handleOpen.bind(this, $event)}> | 1 | +<div className={"ant-select ant-select-single ant-select-show-arrow"+(size==="small"?" ant-select-sm":"")} onClick={this.handleOpen.bind(this, $event)}> |
2 | <div className="ant-select-selector"> | 2 | <div className="ant-select-selector"> |
3 | <span className="ant-select-selection-item">{state.label}</span> | 3 | <span className="ant-select-selection-item">{state.label}</span> |
4 | </div> | 4 | </div> |
src/Select/Select.js
src/Table/Table.html
1 | <div className="ant-table-wrapper"> | 1 | <div className="ant-table-wrapper"> |
2 | <es-spin spinning="{{loading}}"> | 2 | <es-spin spinning="{{loading}}"> |
3 | - <div className="ant-table ant-table-default"> | 3 | + <div className={"ant-table ant-table-"+state.size}> |
4 | <div className="ant-table-content"> | 4 | <div className="ant-table-content"> |
5 | <table> | 5 | <table> |
6 | <thead className="ant-table-thead"> | 6 | <thead className="ant-table-thead"> |
src/Table/Table.js
@@ -11,9 +11,11 @@ class Table { | @@ -11,9 +11,11 @@ class Table { | ||
11 | rowKey: String, | 11 | rowKey: String, |
12 | loading: Number, | 12 | loading: Number, |
13 | onChange: Function, | 13 | onChange: Function, |
14 | + size: String, | ||
14 | }; | 15 | }; |
15 | 16 | ||
16 | state = { | 17 | state = { |
18 | + size: this.props.size || "default", | ||
17 | dataSource: [], | 19 | dataSource: [], |
18 | selectedrecordKeys: [], | 20 | selectedrecordKeys: [], |
19 | selectedrecords: [], | 21 | selectedrecords: [], |
webpack.config.js
@@ -6,11 +6,11 @@ module.exports = { | @@ -6,11 +6,11 @@ module.exports = { | ||
6 | entry: "./build/index.js", | 6 | entry: "./build/index.js", |
7 | output: { | 7 | output: { |
8 | // bpms | 8 | // bpms |
9 | - // path: "/Users/shann/Project/essa/bpms/bpms-webapp/src/main/webapp/lib/ng-antd", | 9 | + path: "/Users/shann/Project/essa/bpms/bpms-webapp/src/main/webapp/lib/ng-antd", |
10 | // boss | 10 | // boss |
11 | // path: "/Users/shann/Project/essa/boss/trunk/vendor-lib/ng-antd", | 11 | // path: "/Users/shann/Project/essa/boss/trunk/vendor-lib/ng-antd", |
12 | // mvo | 12 | // mvo |
13 | - path: "/Users/shann/Project/essa/mvo/mvo-webapp/public/browser-vendor/ng-antd", | 13 | + // path: "/Users/shann/Project/essa/mvo/mvo-webapp/public/browser-vendor/ng-antd", |
14 | // local | 14 | // local |
15 | // path: path.resolve(__dirname, "dist"), | 15 | // path: path.resolve(__dirname, "dist"), |
16 | filename: "ng-antd.js", | 16 | filename: "ng-antd.js", |