Commit f886eef1c9c8691c649078a0e55b887c0d82ea39
1 parent
d6436262
优化Alert、Breadcrumb
Showing
18 changed files
with
177 additions
and
138 deletions
Show diff stats
build/Alert/Alert.html
1 | 1 | <div ng-class="'ant-alert'+(type?' ant-alert-'+type:'')+(!showIcon?' ant-alert-no-icon':'')+(description?' ant-alert-with-description':'')"> |
2 | - <span ng-if="showIcon&&type==='warning'" class="anticon ant-alert-icon"><antd-icon type="ExclamationCircleFilled"></antd-icon></span> | |
3 | - <span ng-if="showIcon&&type==='success'" class="anticon ant-alert-icon"><antd-icon type="CheckCircleFilled"></antd-icon></span> | |
4 | - <span ng-if="showIcon&&type==='info'" class="anticon ant-alert-icon"><antd-icon type="InfoCircleFilled"></antd-icon></span> | |
5 | - <span ng-if="showIcon&&type==='error'" class="anticon ant-alert-icon"><antd-icon type="CloseCircleFilled"></antd-icon></span> | |
2 | + <antd-icon ng-if="showIcon" type="{{state.icons[type]}}" class="ant-alert-icon"></antd-icon> | |
6 | 3 | <div class="ant-alert-content"> |
7 | 4 | <div class="ant-alert-message">{{message}}</div> |
8 | 5 | <div ng-if="description" class="ant-alert-description"><antd-slot content="{{description}}"></antd-slot></div> | ... | ... |
build/Alert/Alert.js
1 | -import template from "./Alert.html"; | |
2 | 1 | import style from "antd/lib/alert/style/index.css"; |
3 | -angular.module("esNgAntd").directive("antdAlert", function (esNgAntd) { | |
4 | - return { | |
5 | - controllerAs: "antdAlert", | |
6 | - restrict: "E", | |
7 | - transclude: true, | |
8 | - replace: true, | |
9 | - scope: { | |
10 | - type: "@", | |
11 | - message: "@", | |
12 | - showIcon: "@", | |
13 | - description: "@", | |
14 | - }, | |
15 | - template: template, | |
16 | - link: function ($scope, $element, $attrs, $controllers, $transclude) { | |
17 | - esNgAntd.createStyle("ant-alert", style); | |
18 | - }, | |
19 | - }; | |
20 | -}); | |
2 | +import template from "./Alert.html"; | |
3 | +angular.module("esNgAntd").directive("antdAlert", ["esNgAntd", function (esNgAntd) { | |
4 | + return { | |
5 | + template: template, | |
6 | + restrict: "E", | |
7 | + replace: true, | |
8 | + transclude: true, | |
9 | + scope: { | |
10 | + type: "@", | |
11 | + message: "@", | |
12 | + showIcon: "=", | |
13 | + description: "@" | |
14 | + }, | |
15 | + controller: function ($scope) { | |
16 | + $scope.state = { | |
17 | + icons: { | |
18 | + warning: "ExclamationCircleFilled", | |
19 | + success: "CheckCircleFilled", | |
20 | + info: "InfoCircleFilled", | |
21 | + error: "CloseCircleFilled" | |
22 | + } | |
23 | + }; | |
24 | + }, | |
25 | + link: function ($scope, $element, $attrs, $controllers, $transclude) { | |
26 | + esNgAntd.createStyle("ant-alert", style); | |
27 | + esNgAntd.clearAttribute($element[0], ["ng-class", "type", "message", "show-icon", "description"]); | |
28 | + } | |
29 | + }; | |
30 | +}]); | |
21 | 31 | \ No newline at end of file | ... | ... |
build/Breadcrumb/Breadcrumb.js
1 | -import template from "./Breadcrumb.html"; | |
2 | 1 | import style from "antd/lib/breadcrumb/style/index.css"; |
3 | -angular.module("esNgAntd").directive("antdBreadcrumb", function (esNgAntd) { | |
4 | - return { | |
5 | - controllerAs: "antdBreadcrumb", | |
6 | - restrict: "E", | |
7 | - transclude: true, | |
8 | - replace: true, | |
9 | - template: template, | |
10 | - link: function ($scope, $element, $attrs, $controllers, $transclude) { | |
11 | - esNgAntd.createStyle("ant-breadcrumb", style); | |
12 | - }, | |
13 | - }; | |
14 | -}); | |
2 | +import template from "./Breadcrumb.html"; | |
3 | +angular.module("esNgAntd").directive("antdBreadcrumb", ["esNgAntd", function (esNgAntd) { | |
4 | + return { | |
5 | + template: template, | |
6 | + restrict: "E", | |
7 | + replace: true, | |
8 | + transclude: true, | |
9 | + link: function ($scope, $element, $attrs, $controllers, $transclude) { | |
10 | + esNgAntd.createStyle("ant-breadcrumb", style); | |
11 | + } | |
12 | + }; | |
13 | +}]); | |
15 | 14 | \ No newline at end of file | ... | ... |
build/BreadcrumbItem/BreadcrumbItem.js
1 | 1 | import template from "./BreadcrumbItem.html"; |
2 | -angular.module("esNgAntd").directive("antdBreadcrumbItem", function () { | |
3 | - return { | |
4 | - controllerAs: "antdBreadcrumbItem", | |
5 | - restrict: "E", | |
6 | - transclude: true, | |
7 | - replace: true, | |
8 | - scope: { | |
9 | - href: "@", | |
10 | - }, | |
11 | - template: template, | |
12 | - }; | |
13 | -}); | |
2 | +angular.module("esNgAntd").directive("antdBreadcrumbItem", ["esNgAntd", function (esNgAntd) { | |
3 | + return { | |
4 | + template: template, | |
5 | + restrict: "E", | |
6 | + replace: true, | |
7 | + transclude: true, | |
8 | + scope: { | |
9 | + href: "@" | |
10 | + }, | |
11 | + link: function ($scope, $element, $attrs, $controllers, $transclude) { | |
12 | + esNgAntd.clearAttribute($element[0], ["href"]); | |
13 | + } | |
14 | + }; | |
15 | +}]); | |
14 | 16 | \ No newline at end of file | ... | ... |
build/Common/Common.js
1 | 1 | import baseStyle from "antd/lib/style/index.css"; |
2 | + | |
2 | 3 | angular.module("esNgAntd").service("esNgAntd", [ |
3 | 4 | "$compile", |
4 | 5 | function ($compile) { |
5 | 6 | this.styleSheets = null; |
7 | + | |
6 | 8 | this.conflictType = null; |
7 | 9 | |
8 | 10 | this.createStyle = function (key, style) { |
... | ... | @@ -12,19 +14,16 @@ angular.module("esNgAntd").service("esNgAntd", [ |
12 | 14 | styleElement.setAttribute("type", "text/css"); |
13 | 15 | styleElement.innerHTML = baseStyle.toString(); |
14 | 16 | document.head.appendChild(styleElement); |
15 | - | |
16 | 17 | if (this.styleSheets) { |
17 | 18 | this.disableStyle("anticon"); |
18 | 19 | } |
19 | 20 | } |
20 | - | |
21 | 21 | if (!document.querySelector("#" + key)) { |
22 | 22 | let styleElement = document.createElement("style"); |
23 | 23 | styleElement.setAttribute("id", key); |
24 | 24 | styleElement.setAttribute("type", "text/css"); |
25 | 25 | styleElement.innerHTML = style.toString(); |
26 | 26 | document.head.appendChild(styleElement); |
27 | - | |
28 | 27 | if (this.styleSheets) { |
29 | 28 | this.disableStyle(key); |
30 | 29 | } |
... | ... | @@ -34,7 +33,6 @@ angular.module("esNgAntd").service("esNgAntd", [ |
34 | 33 | this.disableStyle = function (name) { |
35 | 34 | for (let i = 0; i < this.styleSheets.cssRules.length; i++) { |
36 | 35 | let rule = this.styleSheets.cssRules[i]; |
37 | - | |
38 | 36 | if ( |
39 | 37 | rule.selectorText && |
40 | 38 | rule.selectorText.indexOf(name) !== -1 && |
... | ... | @@ -52,16 +50,20 @@ angular.module("esNgAntd").service("esNgAntd", [ |
52 | 50 | |
53 | 51 | this.conflict = function (filename, type) { |
54 | 52 | this.conflictType = type; |
55 | - | |
56 | 53 | for (let i = 0; i < document.styleSheets.length; i++) { |
57 | 54 | const element = document.styleSheets[i]; |
58 | - | |
59 | 55 | if (element.href && element.href.indexOf(filename) !== -1) { |
60 | 56 | this.styleSheets = element; |
61 | 57 | } |
62 | 58 | } |
63 | 59 | }; |
64 | 60 | |
61 | + this.clearAttribute = function (element, attrs) { | |
62 | + for (const attr of attrs) { | |
63 | + element.removeAttribute(attr) | |
64 | + } | |
65 | + } | |
66 | + | |
65 | 67 | this.createLayer = function (content, scope) { |
66 | 68 | let div = document.createElement("div"); |
67 | 69 | div.innerHTML = content; |
... | ... | @@ -73,7 +75,6 @@ angular.module("esNgAntd").service("esNgAntd", [ |
73 | 75 | if (!ele || ele.nodeType != 1) { |
74 | 76 | return; |
75 | 77 | } |
76 | - | |
77 | 78 | let rect = ele.getBoundingClientRect(); |
78 | 79 | let doc = ele.ownerDocument.documentElement; |
79 | 80 | return { | ... | ... |
build/Icon/Icon.js
1 | -import * as iconsSvg from "@ant-design/icons-svg"; | |
2 | 1 | import { renderIconDefinitionToSVGElement } from "@ant-design/icons-svg/es/helpers"; |
3 | -angular.module("esNgAntd").directive("antdIcon", function ($compile) { | |
4 | - return { | |
5 | - controllerAs: "antdIcon", | |
6 | - restrict: "E", | |
7 | - transclude: true, | |
8 | - replace: true, | |
9 | - scope: { | |
10 | - type: "@", | |
11 | - }, | |
12 | - template: `<span class="anticon"></span>`, | |
13 | - link: function ($scope, $element, $attrs, $controllers, $transclude) { | |
14 | - let template = renderIconDefinitionToSVGElement( | |
15 | - iconsSvg[$scope.type], | |
16 | - { | |
17 | - extraSVGAttrs: { | |
18 | - width: "1em", | |
19 | - height: "1em", | |
20 | - fill: "currentColor", | |
21 | - }, | |
22 | - } | |
23 | - ); | |
24 | - $element.append(template); | |
25 | - }, | |
26 | - }; | |
27 | -}); | |
2 | +import * as iconsSvg from "@ant-design/icons-svg"; | |
3 | +angular.module("esNgAntd").directive("antdIcon", ["$compile", function ($compile) { | |
4 | + return { | |
5 | + template: `<span class="anticon"></span>`, | |
6 | + restrict: "E", | |
7 | + replace: true, | |
8 | + transclude: true, | |
9 | + scope: { | |
10 | + type: "@" | |
11 | + }, | |
12 | + link: function ($scope, $element, $attrs, $controllers, $transclude) { | |
13 | + let template = renderIconDefinitionToSVGElement(iconsSvg[$scope.type], { | |
14 | + extraSVGAttrs: { | |
15 | + width: "1em", | |
16 | + height: "1em", | |
17 | + fill: "currentColor" | |
18 | + } | |
19 | + }); | |
20 | + $element.append(template); | |
21 | + } | |
22 | + }; | |
23 | +}]); | |
28 | 24 | \ No newline at end of file | ... | ... |
dist/ng-antd.js
... | ... | @@ -16,7 +16,7 @@ |
16 | 16 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
17 | 17 | |
18 | 18 | "use strict"; |
19 | -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Alert_html__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Alert.html */ \"./build/Alert/Alert.html\");\n/* harmony import */ var antd_lib_alert_style_index_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! antd/lib/alert/style/index.css */ \"./node_modules/antd/lib/alert/style/index.css\");\n\n\nangular.module(\"esNgAntd\").directive(\"antdAlert\", function (esNgAntd) {\n return {\n controllerAs: \"antdAlert\",\n restrict: \"E\",\n transclude: true,\n replace: true,\n scope: {\n type: \"@\",\n message: \"@\",\n showIcon: \"@\",\n description: \"@\",\n },\n template: _Alert_html__WEBPACK_IMPORTED_MODULE_0__[\"default\"],\n link: function ($scope, $element, $attrs, $controllers, $transclude) {\n esNgAntd.createStyle(\"ant-alert\", antd_lib_alert_style_index_css__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\n },\n };\n});\n\n\n//# sourceURL=webpack://ng-antd/./build/Alert/Alert.js?"); | |
19 | +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var antd_lib_alert_style_index_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! antd/lib/alert/style/index.css */ \"./node_modules/antd/lib/alert/style/index.css\");\n/* harmony import */ var _Alert_html__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Alert.html */ \"./build/Alert/Alert.html\");\n\n\nangular.module(\"esNgAntd\").directive(\"antdAlert\", [\"esNgAntd\", function (esNgAntd) {\n return {\n template: _Alert_html__WEBPACK_IMPORTED_MODULE_1__[\"default\"],\n restrict: \"E\",\n replace: true,\n transclude: true,\n scope: {\n type: \"@\",\n message: \"@\",\n showIcon: \"=\",\n description: \"@\"\n },\n controller: function ($scope) {\n $scope.state = {\n icons: {\n warning: \"ExclamationCircleFilled\",\n success: \"CheckCircleFilled\",\n info: \"InfoCircleFilled\",\n error: \"CloseCircleFilled\"\n }\n };\n },\n link: function ($scope, $element, $attrs, $controllers, $transclude) {\n esNgAntd.createStyle(\"ant-alert\", antd_lib_alert_style_index_css__WEBPACK_IMPORTED_MODULE_0__[\"default\"]);\n esNgAntd.clearAttribute($element[0], [\"ng-class\", \"type\", \"message\", \"show-icon\", \"description\"]);\n }\n };\n}]);\n\n//# sourceURL=webpack://ng-antd/./build/Alert/Alert.js?"); | |
20 | 20 | |
21 | 21 | /***/ }), |
22 | 22 | |
... | ... | @@ -27,7 +27,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Ale |
27 | 27 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
28 | 28 | |
29 | 29 | "use strict"; |
30 | -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Breadcrumb_html__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Breadcrumb.html */ \"./build/Breadcrumb/Breadcrumb.html\");\n/* harmony import */ var antd_lib_breadcrumb_style_index_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! antd/lib/breadcrumb/style/index.css */ \"./node_modules/antd/lib/breadcrumb/style/index.css\");\n\n\nangular.module(\"esNgAntd\").directive(\"antdBreadcrumb\", function (esNgAntd) {\n return {\n controllerAs: \"antdBreadcrumb\",\n restrict: \"E\",\n transclude: true,\n replace: true,\n template: _Breadcrumb_html__WEBPACK_IMPORTED_MODULE_0__[\"default\"],\n link: function ($scope, $element, $attrs, $controllers, $transclude) {\n esNgAntd.createStyle(\"ant-breadcrumb\", antd_lib_breadcrumb_style_index_css__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\n },\n };\n});\n\n\n//# sourceURL=webpack://ng-antd/./build/Breadcrumb/Breadcrumb.js?"); | |
30 | +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var antd_lib_breadcrumb_style_index_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! antd/lib/breadcrumb/style/index.css */ \"./node_modules/antd/lib/breadcrumb/style/index.css\");\n/* harmony import */ var _Breadcrumb_html__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Breadcrumb.html */ \"./build/Breadcrumb/Breadcrumb.html\");\n\n\nangular.module(\"esNgAntd\").directive(\"antdBreadcrumb\", [\"esNgAntd\", function (esNgAntd) {\n return {\n template: _Breadcrumb_html__WEBPACK_IMPORTED_MODULE_1__[\"default\"],\n restrict: \"E\",\n replace: true,\n transclude: true,\n link: function ($scope, $element, $attrs, $controllers, $transclude) {\n esNgAntd.createStyle(\"ant-breadcrumb\", antd_lib_breadcrumb_style_index_css__WEBPACK_IMPORTED_MODULE_0__[\"default\"]);\n }\n };\n}]);\n\n//# sourceURL=webpack://ng-antd/./build/Breadcrumb/Breadcrumb.js?"); | |
31 | 31 | |
32 | 32 | /***/ }), |
33 | 33 | |
... | ... | @@ -38,7 +38,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Bre |
38 | 38 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
39 | 39 | |
40 | 40 | "use strict"; |
41 | -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _BreadcrumbItem_html__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BreadcrumbItem.html */ \"./build/BreadcrumbItem/BreadcrumbItem.html\");\n\nangular.module(\"esNgAntd\").directive(\"antdBreadcrumbItem\", function () {\n return {\n controllerAs: \"antdBreadcrumbItem\",\n restrict: \"E\",\n transclude: true,\n replace: true,\n template: _BreadcrumbItem_html__WEBPACK_IMPORTED_MODULE_0__[\"default\"],\n };\n});\n\n\n//# sourceURL=webpack://ng-antd/./build/BreadcrumbItem/BreadcrumbItem.js?"); | |
41 | +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _BreadcrumbItem_html__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BreadcrumbItem.html */ \"./build/BreadcrumbItem/BreadcrumbItem.html\");\n\nangular.module(\"esNgAntd\").directive(\"antdBreadcrumbItem\", [\"esNgAntd\", function (esNgAntd) {\n return {\n template: _BreadcrumbItem_html__WEBPACK_IMPORTED_MODULE_0__[\"default\"],\n restrict: \"E\",\n replace: true,\n transclude: true,\n scope: {\n href: \"@\"\n },\n link: function ($scope, $element, $attrs, $controllers, $transclude) {\n esNgAntd.clearAttribute($element[0], [\"href\"]);\n }\n };\n}]);\n\n//# sourceURL=webpack://ng-antd/./build/BreadcrumbItem/BreadcrumbItem.js?"); | |
42 | 42 | |
43 | 43 | /***/ }), |
44 | 44 | |
... | ... | @@ -93,7 +93,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Che |
93 | 93 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
94 | 94 | |
95 | 95 | "use strict"; |
96 | -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Col_html__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Col.html */ \"./build/Col/Col.html\");\n/* harmony import */ var antd_lib_grid_style_index_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! antd/lib/grid/style/index.css */ \"./node_modules/antd/lib/grid/style/index.css\");\n/**\n * 列\n */\n\n\nangular.module(\"esNgAntd\").directive(\"antdCol\", function (esNgAntd) {\n return {\n controllerAs: \"antdCol\",\n restrict: \"E\",\n transclude: true,\n replace: true,\n scope: {\n span: \"@\",\n },\n template: _Col_html__WEBPACK_IMPORTED_MODULE_0__[\"default\"],\n controller: function ($scope, $element, $attrs) {\n this.getContext = function () {\n return $scope;\n };\n\n $scope.state = {\n className: [\"ant-col\"],\n };\n },\n require: [\"?^antdRow\"],\n link: function ($scope, $element, $attrs, $controllers, $transclude) {\n let [antdRow] = $controllers;\n esNgAntd.createStyle(\"ant-grid\", antd_lib_grid_style_index_css__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\n $element[0].removeAttribute(\"ng-style\");\n $element[0].removeAttribute(\"ng-transclude\");\n $element[0].removeAttribute(\"ng-class\");\n $element[0].removeAttribute(\"span\");\n\n if (antdRow) {\n $scope.antdRow = antdRow.getContext();\n }\n\n if ($scope.span) {\n $scope.state.className.push(\"ant-col-\" + $scope.span);\n } // if (this.props.xs) {\n // this.state.className.push(\"col-xs-\" + this.props.xs);\n // }\n // if (this.props.sm) {\n // this.state.className.push(\"col-sm-\" + this.props.sm);\n // }\n // if (this.props.md) {\n // this.state.className.push(\"col-md-\" + this.props.md);\n // }\n // if (this.props.lg) {\n // this.state.className.push(\"col-lg-\" + this.props.lg);\n // }\n // this.state.className = this.state.className.join(\" \");\n },\n };\n});\n\n\n//# sourceURL=webpack://ng-antd/./build/Col/Col.js?"); | |
96 | +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Col_html__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Col.html */ \"./build/Col/Col.html\");\n/* harmony import */ var antd_lib_grid_style_index_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! antd/lib/grid/style/index.css */ \"./node_modules/antd/lib/grid/style/index.css\");\n/**\n * 列\n */\n\n\nangular.module(\"esNgAntd\").directive(\"antdCol\", function (esNgAntd) {\n return {\n controllerAs: \"antdCol\",\n restrict: \"E\",\n transclude: true,\n replace: true,\n scope: {\n span: \"@\",\n offset: \"@\",\n },\n template: _Col_html__WEBPACK_IMPORTED_MODULE_0__[\"default\"],\n controller: function ($scope, $element, $attrs) {\n this.getContext = function () {\n return $scope;\n };\n\n $scope.state = {\n className: [\"ant-col\"],\n };\n },\n require: [\"?^antdRow\"],\n link: function ($scope, $element, $attrs, $controllers, $transclude) {\n let [antdRow] = $controllers;\n esNgAntd.createStyle(\"ant-grid\", antd_lib_grid_style_index_css__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\n $element[0].removeAttribute(\"ng-style\");\n $element[0].removeAttribute(\"ng-transclude\");\n $element[0].removeAttribute(\"ng-class\");\n $element[0].removeAttribute(\"span\");\n\n if (antdRow) {\n $scope.antdRow = antdRow.getContext();\n }\n\n if ($scope.span) {\n $scope.state.className.push(\"ant-col-\" + $scope.span);\n } // if (this.props.xs) {\n // this.state.className.push(\"col-xs-\" + this.props.xs);\n // }\n // if (this.props.sm) {\n // this.state.className.push(\"col-sm-\" + this.props.sm);\n // }\n // if (this.props.md) {\n // this.state.className.push(\"col-md-\" + this.props.md);\n // }\n // if (this.props.lg) {\n // this.state.className.push(\"col-lg-\" + this.props.lg);\n // }\n // this.state.className = this.state.className.join(\" \");\n },\n };\n});\n\n\n//# sourceURL=webpack://ng-antd/./build/Col/Col.js?"); | |
97 | 97 | |
98 | 98 | /***/ }), |
99 | 99 | |
... | ... | @@ -104,7 +104,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Col |
104 | 104 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
105 | 105 | |
106 | 106 | "use strict"; |
107 | -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var antd_lib_style_index_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! antd/lib/style/index.css */ \"./node_modules/antd/lib/style/index.css\");\n\nangular.module(\"esNgAntd\").service(\"esNgAntd\", [\n \"$compile\",\n function ($compile) {\n this.styleSheets = null;\n this.conflictType = 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 if (this.styleSheets) {\n this.disableStyle(\"anticon\");\n }\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 rule.selectorText.indexOf(\"ant3\") === -1\n ) {\n rule.selectorText = rule.selectorText\n .split(\",\")\n .map(function (item) {\n return \".ant3 \" + item;\n })\n .join(\",\");\n }\n }\n };\n\n this.conflict = function (filename, type) {\n this.conflictType = type;\n\n for (let i = 0; i < document.styleSheets.length; i++) {\n const element = document.styleSheets[i];\n\n if (element.href && element.href.indexOf(filename) !== -1) {\n this.styleSheets = element;\n }\n }\n };\n\n this.createLayer = function (content, scope) {\n let div = document.createElement(\"div\");\n div.innerHTML = content;\n document.body.appendChild(div);\n $compile(div)(scope);\n };\n\n this.getOffset = function (ele) {\n if (!ele || ele.nodeType != 1) {\n return;\n }\n\n let rect = ele.getBoundingClientRect();\n let doc = ele.ownerDocument.documentElement;\n return {\n top: rect.top + window.pageYOffset - doc.clientTop,\n left: rect.left + window.pageXOffset - doc.clientLeft,\n };\n };\n },\n]);\n\n\n//# sourceURL=webpack://ng-antd/./build/Common/Common.js?"); | |
107 | +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var antd_lib_style_index_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! antd/lib/style/index.css */ \"./node_modules/antd/lib/style/index.css\");\n\n\nangular.module(\"esNgAntd\").service(\"esNgAntd\", [\n \"$compile\",\n function ($compile) {\n this.styleSheets = null;\n\n this.conflictType = 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 if (this.styleSheets) {\n this.disableStyle(\"anticon\");\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 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 if (\n rule.selectorText &&\n rule.selectorText.indexOf(name) !== -1 &&\n rule.selectorText.indexOf(\"ant3\") === -1\n ) {\n rule.selectorText = rule.selectorText\n .split(\",\")\n .map(function (item) {\n return \".ant3 \" + item;\n })\n .join(\",\");\n }\n }\n };\n\n this.conflict = function (filename, type) {\n this.conflictType = type;\n for (let i = 0; i < document.styleSheets.length; i++) {\n const element = document.styleSheets[i];\n if (element.href && element.href.indexOf(filename) !== -1) {\n this.styleSheets = element;\n }\n }\n };\n\n this.clearAttribute = function (element, attrs) {\n for (const attr of attrs) {\n element.removeAttribute(attr)\n }\n }\n\n this.createLayer = function (content, scope) {\n let div = document.createElement(\"div\");\n div.innerHTML = content;\n document.body.appendChild(div);\n $compile(div)(scope);\n };\n\n this.getOffset = function (ele) {\n if (!ele || ele.nodeType != 1) {\n return;\n }\n let rect = ele.getBoundingClientRect();\n let doc = ele.ownerDocument.documentElement;\n return {\n top: rect.top + window.pageYOffset - doc.clientTop,\n left: rect.left + window.pageXOffset - doc.clientLeft,\n };\n };\n },\n]);\n\n\n//# sourceURL=webpack://ng-antd/./build/Common/Common.js?"); | |
108 | 108 | |
109 | 109 | /***/ }), |
110 | 110 | |
... | ... | @@ -159,7 +159,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _For |
159 | 159 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
160 | 160 | |
161 | 161 | "use strict"; |
162 | -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _ant_design_icons_svg__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ant-design/icons-svg */ \"./node_modules/@ant-design/icons-svg/es/index.js\");\n/* harmony import */ var _ant_design_icons_svg_es_helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/icons-svg/es/helpers */ \"./node_modules/@ant-design/icons-svg/es/helpers.js\");\n\n\nangular.module(\"esNgAntd\").directive(\"antdIcon\", function ($compile) {\n return {\n controllerAs: \"antdIcon\",\n restrict: \"E\",\n transclude: true,\n replace: true,\n scope: {\n type: \"@\",\n },\n template: `<span class=\"anticon\"></span>`,\n link: function ($scope, $element, $attrs, $controllers, $transclude) {\n let template = (0,_ant_design_icons_svg_es_helpers__WEBPACK_IMPORTED_MODULE_0__.renderIconDefinitionToSVGElement)(\n _ant_design_icons_svg__WEBPACK_IMPORTED_MODULE_1__[$scope.type],\n {\n extraSVGAttrs: {\n width: \"1em\",\n height: \"1em\",\n fill: \"currentColor\",\n },\n }\n );\n $element.append(template);\n },\n };\n});\n\n\n//# sourceURL=webpack://ng-antd/./build/Icon/Icon.js?"); | |
162 | +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _ant_design_icons_svg_es_helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/icons-svg/es/helpers */ \"./node_modules/@ant-design/icons-svg/es/helpers.js\");\n/* harmony import */ var _ant_design_icons_svg__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ant-design/icons-svg */ \"./node_modules/@ant-design/icons-svg/es/index.js\");\n\n\nangular.module(\"esNgAntd\").directive(\"antdIcon\", [\"$compile\", function ($compile) {\n return {\n template: `<span class=\"anticon\"></span>`,\n restrict: \"E\",\n replace: true,\n transclude: true,\n scope: {\n type: \"@\"\n },\n link: function ($scope, $element, $attrs, $controllers, $transclude) {\n let template = (0,_ant_design_icons_svg_es_helpers__WEBPACK_IMPORTED_MODULE_0__.renderIconDefinitionToSVGElement)(_ant_design_icons_svg__WEBPACK_IMPORTED_MODULE_1__[$scope.type], {\n extraSVGAttrs: {\n width: \"1em\",\n height: \"1em\",\n fill: \"currentColor\"\n }\n });\n $element.append(template);\n }\n };\n}]);\n\n//# sourceURL=webpack://ng-antd/./build/Icon/Icon.js?"); | |
163 | 163 | |
164 | 164 | /***/ }), |
165 | 165 | |
... | ... | @@ -9430,7 +9430,7 @@ eval("\n\nmodule.exports = function (i) {\n return i[1];\n};\n\n//# sourceURL=w |
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 = \"<div ng-class=\\\"'ant-alert'+(type?' ant-alert-'+type:'')+(!showIcon?' ant-alert-no-icon':'')+(description?' ant-alert-with-description':'')\\\">\\n <span ng-if=\\\"showIcon&&type==='warning'\\\" class=\\\"anticon ant-alert-icon\\\"><antd-icon type=\\\"ExclamationCircleFilled\\\"></antd-icon></span>\\n <span ng-if=\\\"showIcon&&type==='success'\\\" class=\\\"anticon ant-alert-icon\\\"><antd-icon type=\\\"CheckCircleFilled\\\"></antd-icon></span>\\n <span ng-if=\\\"showIcon&&type==='info'\\\" class=\\\"anticon ant-alert-icon\\\"><antd-icon type=\\\"InfoCircleFilled\\\"></antd-icon></span>\\n <span ng-if=\\\"showIcon&&type==='error'\\\" class=\\\"anticon ant-alert-icon\\\"><antd-icon type=\\\"CloseCircleFilled\\\"></antd-icon></span>\n <div class=\\"ant-alert-content\\">\n <div class=\\"ant-alert-message\\">{{message}}</div>\n <div ng-if=\\"description\\" class=\\"ant-alert-description\\"><antd-slot content=\\"{{description}}\\"></antd-slot></div>\n </div>\n</div>\";\n// Exports\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (code);\n\n//# sourceURL=webpack://ng-antd/./build/Alert/Alert.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 = \"<div ng-class=\\\"'ant-alert'+(type?' ant-alert-'+type:'')+(!showIcon?' ant-alert-no-icon':'')+(description?' ant-alert-with-description':'')\\\">\\n <antd-icon ng-if=\\\"showIcon\\\" type=\\\"{{state.icons[type]}}\\\" class=\\\"ant-alert-icon\\\"></antd-icon>\n <div class=\\"ant-alert-content\\">\n <div class=\\"ant-alert-message\\">{{message}}</div>\n <div ng-if=\\"description\\" class=\\"ant-alert-description\\"><antd-slot content=\\"{{description}}\\"></antd-slot></div>\n </div>\n</div>\";\n// Exports\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (code);\n\n//# sourceURL=webpack://ng-antd/./build/Alert/Alert.html?"); | |
9434 | 9434 | |
9435 | 9435 | /***/ }), |
9436 | 9436 | |
... | ... | @@ -9452,7 +9452,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac |
9452 | 9452 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
9453 | 9453 | |
9454 | 9454 | "use strict"; |
9455 | -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Module\nvar code = \"<span>\\n <span class=\\\"ant-breadcrumb-link\\\" ng-transclude></span>\n <span class=\\"ant-breadcrumb-separator\\">/</span>\n</span>\";\n// Exports\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (code);\n\n//# sourceURL=webpack://ng-antd/./build/BreadcrumbItem/BreadcrumbItem.html?"); | |
9455 | +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Module\nvar code = \"<span>\\n <span class=\\\"ant-breadcrumb-link\\\">\\n <a ng-href=\\\"{{href}}\\\" target=\\\"_self\\\" ng-transclude></a>\\n </span>\n <span class=\\"ant-breadcrumb-separator\\">/</span>\n</span>\";\n// Exports\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (code);\n\n//# sourceURL=webpack://ng-antd/./build/BreadcrumbItem/BreadcrumbItem.html?"); | |
9456 | 9456 | |
9457 | 9457 | /***/ }), |
9458 | 9458 | |
... | ... | @@ -9507,7 +9507,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac |
9507 | 9507 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
9508 | 9508 | |
9509 | 9509 | "use strict"; |
9510 | -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Module\nvar code = \"<div ng-class=\\\"'ant-col'+(span?' ant-col-'+span:'')\\" ng-style=\\"{paddingLeft:antdRow.state.gutterHalf+'px',paddingRight:antdRow.state.gutterHalf+'px'}\\" ng-transclude></div>\";\n// Exports\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (code);\n\n//# sourceURL=webpack://ng-antd/./build/Col/Col.html?"); | |
9510 | +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Module\nvar code = \"<div ng-class=\\\"'ant-col'+(span?' ant-col-'+span:'')+(offset?' ant-col-offset-'+offset:'')\\" ng-style=\\"{paddingLeft:antdRow.state.gutterHalf+'px',paddingRight:antdRow.state.gutterHalf+'px'}\\" ng-transclude></div>\";\n// Exports\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (code);\n\n//# sourceURL=webpack://ng-antd/./build/Col/Col.html?"); | |
9511 | 9511 | |
9512 | 9512 | /***/ }), |
9513 | 9513 | |
... | ... | @@ -9771,7 +9771,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac |
9771 | 9771 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
9772 | 9772 | |
9773 | 9773 | "use strict"; |
9774 | -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Module\nvar code = \"<div class=\\\"ant-table-wrapper\\\">\\n <div ng-class=\\\"'ant-table ant-table-'+state.size\\\">\\n <div class=\\\"ant-table-content\\\">\\n <table>\\n <thead class=\\\"ant-table-thead\\\">\\n <tr>\\n <th ng-if=\\\"rowSelection\\\" class=\\\"ant-table-selection-column\\\">\\n <span ng-if=\\\"!rowSelection.hideSelectAll\\\" class=\\\"ant-table-header-column\\\">\\n <div>\\n <span class=\\\"ant-table-column-title\\\">\\n <div class=\\\"ant-table-selection\\\">\\n <antd-checkbox on-change=\\\"handleSelectAll(event)\\\" checked=\\\"{{state.isSelectAll}}\\\" />\\n </div>\\n </span>\\n </div>\\n </span>\\n </th>\\n <th ng-repeat=\\\"(key, column) in columns track by key\\\" class=\\\"ant-table-cell ant-table-column-has-sorters\\\" ng-style=\\\"{width:column.width}\\\">\\n <span ng-if=\\\"!column.sorter\\\">{{column.title}}</span>\\n <div ng-if=\\\"column.sorter\\\" class=\\\"ant-table-column-sorters\\\" ng-click=\\\"handleSorter(column.key)\\\">\\n <span class=\\\"ant-table-column-title\\\">{{column.title}}</span>\\n <span class=\\\"ant-table-column-sorter ant-table-column-sorter-full\\\">\\n <span class=\\\"ant-table-column-sorter-inner\\\">\\n <antd-icon type=\\\"CaretUpOutlined\\\" ng-class=\\\"'ant-table-column-sorter-up'+(state.sorter.field===column.key&&state.sorter.order==='ascend'?' active':'')\\\"></antd-icon>\\n <antd-icon type=\\\"CaretDownOutlined\\\" ng-class=\\\"'ant-table-column-sorter-down'+(state.sorter.field===column.key&&state.sorter.order==='descend'?' active':'')\\\"></antd-icon>\\n </span>\\n </span>\\n </div>\\n </th>\\n </tr>\\n </thead>\\n <tbody class=\\\"ant-table-tbody\\\">\\n <tr ng-repeat=\\\"(key, record) in state.dataSource track by record[state.rowKey]\\" class=\\"ant-table-row\\">\n <td ng-if=\\"rowSelection\\" class=\\"ant-table-selection-column\\">\n <span>\n <antd-checkbox checked=\\"{{record.checked}}\\" disabled=\\"{{record.disabled}}\\" on-change=\\"handleSelect(event,$index)\\" />\n </span>\n </td>\n <td ng-repeat=\\"(key, column) in columns track by key\\" data-key=\\"{{column.key}}\\">\n <antd-slot content=\\"{{record[column.key]}}\\" context=\\"antdTable.getContext().$parent\\" />\n </td>\n </tr>\n <tr ng-if=\\"state.dataSource.length===0\\" class=\\"ant-table-placeholder\\">\n <td colspan=\\"{{rowSelection?columns.length+1:columns.length}}\\">\n <antd-empty image=\\"presented_image_simple\\"></antd-empty>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n </div>\n</div>\";\n// Exports\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (code);\n\n//# sourceURL=webpack://ng-antd/./build/Table/Table.html?"); | |
9774 | +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Module\nvar code = \"<div class=\\\"ant-table-wrapper\\\">\\n <div ng-class=\\\"'ant-table ant-table-'+state.size\\\">\\n <div class=\\\"ant-table-content\\\">\\n <table>\\n <thead class=\\\"ant-table-thead\\\">\\n <tr>\\n <th ng-if=\\\"rowSelection\\\" class=\\\"ant-table-selection-column\\\">\\n <span ng-if=\\\"!rowSelection.hideSelectAll\\\" class=\\\"ant-table-header-column\\\">\\n <div>\\n <span class=\\\"ant-table-column-title\\\">\\n <div class=\\\"ant-table-selection\\\">\\n <antd-checkbox on-change=\\\"handleSelectAll(event)\\\" checked=\\\"{{state.isSelectAll}}\\\" />\\n </div>\\n </span>\\n </div>\\n </span>\\n </th>\\n <th ng-repeat=\\\"(key, column) in columns track by key\\\" class=\\\"ant-table-cell ant-table-column-has-sorters\\\" ng-style=\\\"{width:column.width}\\\">\\n <span ng-if=\\\"!column.sorter\\\">{{column.title}}</span>\\n <div ng-if=\\\"column.sorter\\\" class=\\\"ant-table-column-sorters\\\" ng-click=\\\"handleSorter(column.key)\\\">\\n <span class=\\\"ant-table-column-title\\\">{{column.title}}</span>\\n <span class=\\\"ant-table-column-sorter ant-table-column-sorter-full\\\">\\n <span class=\\\"ant-table-column-sorter-inner\\\">\\n <antd-icon type=\\\"CaretUpOutlined\\\" ng-class=\\\"'ant-table-column-sorter-up'+(state.sorter.field===column.key&&state.sorter.order==='ascend'?' active':'')\\\"></antd-icon>\\n <antd-icon type=\\\"CaretDownOutlined\\\" ng-class=\\\"'ant-table-column-sorter-down'+(state.sorter.field===column.key&&state.sorter.order==='descend'?' active':'')\\\"></antd-icon>\\n </span>\\n </span>\\n </div>\\n </th>\\n </tr>\\n </thead>\\n <tbody class=\\\"ant-table-tbody\\\">\\n <tr ng-repeat=\\\"(key, record) in state.dataSource track by record[state.rowKey]+'-'+$index\\" class=\\"ant-table-row\\">\n <td ng-if=\\"rowSelection\\" class=\\"ant-table-selection-column\\">\n <span>\n <antd-checkbox checked=\\"{{record.checked}}\\" disabled=\\"{{record.disabled}}\\" on-change=\\"handleSelect(event,$index)\\" />\n </span>\n </td>\n <td ng-repeat=\\"(key, column) in columns track by key\\" data-key=\\"{{column.key}}\\">\n <antd-slot content=\\"{{record[column.key]}}\\" context=\\"antdTable.getContext().$parent\\" />\n </td>\n </tr>\n <tr ng-if=\\"state.dataSource.length===0\\" class=\\"ant-table-placeholder\\">\n <td colspan=\\"{{rowSelection?columns.length+1:columns.length}}\\">\n <antd-empty image=\\"presented_image_simple\\"></antd-empty>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n </div>\n</div>\";\n// Exports\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (code);\n\n//# sourceURL=webpack://ng-antd/./build/Table/Table.html?"); | |
9775 | 9775 | |
9776 | 9776 | /***/ }), |
9777 | 9777 | ... | ... |
example/alert.html
... | ... | @@ -14,15 +14,15 @@ |
14 | 14 | <body> |
15 | 15 | <div ng-app="esNgAntd" ng-controller="mainCtrl"> |
16 | 16 | <div class="container" style="padding: 50px"> |
17 | - <es-alert type="info" message="Info Text" show-icon="true"></es-alert> | |
18 | - <es-alert type="info" message="Info Text"></es-alert> | |
19 | - <es-alert type="success" message="Success Text" show-icon="true"></es-alert> | |
20 | - <es-alert type="success" message="Success Text"></es-alert> | |
21 | - <es-alert type="warning" message="Warning Text" show-icon="true"></es-alert> | |
22 | - <es-alert type="warning" message="Warning Text"></es-alert> | |
23 | - <es-alert type="error" message="Error Text" show-icon="true"></es-alert> | |
24 | - <es-alert type="error" message="Error Text"></es-alert> | |
25 | - <es-alert type="info" message="Info Text" description="Info Description"></es-alert> | |
17 | + <antd-alert type="info" message="Info Text" show-icon="true"></antd-alert> | |
18 | + <antd-alert type="info" message="Info Text"></antd-alert> | |
19 | + <antd-alert type="success" message="Success Text" show-icon="true"></antd-alert> | |
20 | + <antd-alert type="success" message="Success Text"></antd-alert> | |
21 | + <antd-alert type="warning" message="Warning Text" show-icon="true"></antd-alert> | |
22 | + <antd-alert type="warning" message="Warning Text"></antd-alert> | |
23 | + <antd-alert type="error" message="Error Text" show-icon="true"></antd-alert> | |
24 | + <antd-alert type="error" message="Error Text"></antd-alert> | |
25 | + <antd-alert type="info" message="Info Text" description="Info Description"></antd-alert> | |
26 | 26 | </div> |
27 | 27 | </div> |
28 | 28 | <script src="https://cdn.staticfile.org/angular.js/1.2.28/angular.min.js"></script> |
... | ... | @@ -30,8 +30,7 @@ |
30 | 30 | <script> |
31 | 31 | angular |
32 | 32 | .module("esNgAntd") |
33 | - .controller("mainCtrl", function ($scope) { | |
34 | - }); | |
33 | + .controller("mainCtrl", function ($scope) {}); | |
35 | 34 | </script> |
36 | 35 | </body> |
37 | 36 | ... | ... |
example/breadcrumb.html
... | ... | @@ -9,10 +9,10 @@ |
9 | 9 | <body> |
10 | 10 | <div ng-app="esNgAntd" ng-controller="mainCtrl"> |
11 | 11 | <div class="container" style="padding: 50px"> |
12 | - <es-breadcrumb> | |
13 | - <es-breadcrumb-item>Home</es-breadcrumb-item> | |
14 | - <es-breadcrumb-item>Article</es-breadcrumb-item> | |
15 | - </es-breadcrumb> | |
12 | + <antd-breadcrumb> | |
13 | + <antd-breadcrumb-item href="https://www.baidu.com">Home</antd-breadcrumb-item> | |
14 | + <antd-breadcrumb-item>Article</antd-breadcrumb-item> | |
15 | + </antd-breadcrumb> | |
16 | 16 | </div> |
17 | 17 | </div> |
18 | 18 | <script src="https://cdn.staticfile.org/angular.js/1.2.28/angular.min.js"></script> | ... | ... |
package.json
src/Alert/Alert.html
1 | 1 | <div className={'ant-alert' + (type ? " ant-alert-" + type : "") + (!showIcon ? " ant-alert-no-icon" : "") + (description?" ant-alert-with-description":"")}> |
2 | - {showIcon && type === 'warning' && <span className="anticon ant-alert-icon"><antd-icon type="ExclamationCircleFilled"></antd-icon></span>} | |
3 | - {showIcon && type === 'success' && <span className="anticon ant-alert-icon"><antd-icon type="CheckCircleFilled"></antd-icon></span>} | |
4 | - {showIcon && type === 'info' && <span className="anticon ant-alert-icon"><antd-icon type="InfoCircleFilled"></antd-icon></span>} | |
5 | - {showIcon && type === 'error' && <span className="anticon ant-alert-icon"><antd-icon type="CloseCircleFilled"></antd-icon></span>} | |
2 | + {showIcon && <antd-icon type="{{state.icons[type]}}" className="ant-alert-icon"></antd-icon>} | |
6 | 3 | <div className="ant-alert-content"> |
7 | 4 | <div className="ant-alert-message">{message}</div> |
8 | - {description && <div className="ant-alert-description" ><antd-slot content="{{description}}"></antd-slot></div>} | |
5 | + {description && <div className="ant-alert-description"><antd-slot content="{{description}}"></antd-slot></div>} | |
9 | 6 | </div> |
10 | 7 | </div> |
11 | 8 | \ No newline at end of file | ... | ... |
src/Alert/Alert.js
... | ... | @@ -2,18 +2,36 @@ import template from "./Alert.html"; |
2 | 2 | import style from "antd/lib/alert/style/index.css"; |
3 | 3 | |
4 | 4 | class Alert { |
5 | - props = { | |
6 | - type: String, | |
7 | - message: String, | |
8 | - showIcon: Boolean, | |
9 | - description: String, | |
10 | - }; | |
11 | - | |
12 | 5 | useModules = ["esNgAntd"]; |
13 | 6 | |
14 | - template = template; | |
7 | + state = { | |
8 | + icons: { | |
9 | + warning: "ExclamationCircleFilled", | |
10 | + success: "CheckCircleFilled", | |
11 | + info: "InfoCircleFilled", | |
12 | + error: "CloseCircleFilled", | |
13 | + }, | |
14 | + }; | |
15 | 15 | |
16 | 16 | constructor() { |
17 | 17 | esNgAntd.createStyle("ant-alert", style); |
18 | + esNgAntd.clearAttribute($element[0], [ | |
19 | + "ng-class", | |
20 | + "type", | |
21 | + "message", | |
22 | + "show-icon", | |
23 | + "description", | |
24 | + ]); | |
25 | + } | |
26 | + | |
27 | + render() { | |
28 | + return template; | |
18 | 29 | } |
19 | 30 | } |
31 | + | |
32 | +Alert.propTypes = { | |
33 | + type: PropTypes.string, | |
34 | + message: PropTypes.string, | |
35 | + showIcon: PropTypes.boolean, | |
36 | + description: PropTypes.string, | |
37 | +}; | ... | ... |
src/Breadcrumb/Breadcrumb.js
src/BreadcrumbItem/BreadcrumbItem.js
1 | 1 | import template from "./BreadcrumbItem.html"; |
2 | 2 | |
3 | 3 | class BreadcrumbItem { |
4 | - props = { | |
5 | - href: String, | |
6 | - }; | |
7 | - template = template; | |
4 | + useModules = ["esNgAntd"]; | |
5 | + | |
6 | + constructor() { | |
7 | + esNgAntd.clearAttribute($element[0], ["href"]); | |
8 | + } | |
9 | + | |
10 | + render() { | |
11 | + return template; | |
12 | + } | |
8 | 13 | } |
14 | + | |
15 | +BreadcrumbItem.propTypes = { | |
16 | + href: PropTypes.string, | |
17 | +}; | ... | ... |
src/Common/Common.js
... | ... | @@ -58,6 +58,12 @@ angular.module("esNgAntd").service("esNgAntd", [ |
58 | 58 | } |
59 | 59 | }; |
60 | 60 | |
61 | + this.clearAttribute = function (element, attrs) { | |
62 | + for (const attr of attrs) { | |
63 | + element.removeAttribute(attr) | |
64 | + } | |
65 | + } | |
66 | + | |
61 | 67 | this.createLayer = function (content, scope) { |
62 | 68 | let div = document.createElement("div"); |
63 | 69 | div.innerHTML = content; | ... | ... |
src/Icon/Icon.js
... | ... | @@ -2,14 +2,9 @@ import * as iconsSvg from "@ant-design/icons-svg"; |
2 | 2 | import { renderIconDefinitionToSVGElement } from "@ant-design/icons-svg/es/helpers"; |
3 | 3 | |
4 | 4 | class Icon { |
5 | + | |
5 | 6 | useModules = ["$compile"]; |
6 | 7 | |
7 | - template = `<span class="anticon"></span>` | |
8 | - | |
9 | - props = { | |
10 | - type: String, | |
11 | - }; | |
12 | - | |
13 | 8 | constructor() { |
14 | 9 | let template = renderIconDefinitionToSVGElement( |
15 | 10 | iconsSvg[$scope.type], |
... | ... | @@ -23,4 +18,12 @@ class Icon { |
23 | 18 | ) |
24 | 19 | $element.append(template); |
25 | 20 | } |
21 | + | |
22 | + render() { | |
23 | + return `<span class="anticon"></span>` | |
24 | + } | |
26 | 25 | } |
26 | + | |
27 | +Icon.propTypes = { | |
28 | + type: PropTypes.string, | |
29 | +}; | ... | ... |
webpack.config.js
... | ... | @@ -6,13 +6,13 @@ 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 | 11 | // path: "/Users/shann/Project/essa/boss/trunk/vendor-lib/ng-antd", |
12 | 12 | // mvo |
13 | 13 | // path: "/Users/shann/Project/essa/mvo/mvo-webapp/public/browser-vendor/ng-antd", |
14 | 14 | // local |
15 | - // path: path.resolve(__dirname, "dist"), | |
15 | + path: path.resolve(__dirname, "dist"), | |
16 | 16 | filename: "ng-antd.js", |
17 | 17 | }, |
18 | 18 | module: { | ... | ... |
yarn.lock
... | ... | @@ -1320,10 +1320,10 @@ babel-plugin-polyfill-regenerator@^0.2.3: |
1320 | 1320 | dependencies: |
1321 | 1321 | "@babel/helper-define-polyfill-provider" "^0.2.4" |
1322 | 1322 | |
1323 | -beanboom@0.8.7: | |
1324 | - version "0.8.7" | |
1325 | - resolved "https://registry.npmmirror.com/beanboom/download/beanboom-0.8.7.tgz#64c3b6b874bd8c271ee1dfd9babfaa9a621ec1d6" | |
1326 | - integrity sha512-/P0cRqcxybyx/ynRd9K12n++OrVj/NTUW5lJQ6ToqbrY/JPIHvGQGZnnLyQ1thzSIKl+0jaz/pvHlRF1TYOc7Q== | |
1323 | +beanboom@^0.9.4: | |
1324 | + version "0.9.4" | |
1325 | + resolved "https://registry.npmmirror.com/beanboom/-/beanboom-0.9.4.tgz#efde9461228151689a82f88610ce58b80d11369f" | |
1326 | + integrity sha512-fnz4cE8ZC5Nks8Off/vQTWYfNjLQDfGM34uoNt5+BhK6RlbgIbomQ5g37kXnViTwXrFD6nry7xcowt7wFF5nOw== | |
1327 | 1327 | dependencies: |
1328 | 1328 | "@babel/core" "^7.12.10" |
1329 | 1329 | "@babel/plugin-proposal-class-properties" "^7.13.0" | ... | ... |