Commit 2c0a9da3f48344d8737a394c8e324889ca2d1203
1 parent
3c86e8de
优化
Showing
5 changed files
with
6 additions
and
9 deletions
Show diff stats
build/Form/Form.js
... | ... | @@ -51,7 +51,6 @@ angular.module("esNgAntd").directive("esForm", function (esNgAntd) { |
51 | 51 | }, |
52 | 52 | link: function ($scope, $element, $attrs, $controllers, $transclude) { |
53 | 53 | esNgAntd.createStyle("ant-form", style); |
54 | - $scope.form = $scope; | |
55 | 54 | |
56 | 55 | if ($scope.name) { |
57 | 56 | let inputs = $element[0].querySelectorAll("input"); | ... | ... |
build/Space/Space.html
1 | -<div ng-class="'ant-space ant-space-'+state.direction+' ant-space-align-center'" ng-style="{gap:state.size+'px'}"></div> | |
2 | 1 | \ No newline at end of file |
2 | +<div ng-class="'ant-space ant-space-'+state.direction+' ant-space-align-center'" ng-style="{gap:state.size+'px'}" data-foo="{{foo}}"></div> | |
3 | 3 | \ No newline at end of file | ... | ... |
dist/ng-antd.js
... | ... | @@ -137,7 +137,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac |
137 | 137 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
138 | 138 | |
139 | 139 | "use strict"; |
140 | -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Form_html__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Form.html */ \"./build/Form/Form.html\");\n/* harmony import */ var antd_lib_form_style_index_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! antd/lib/form/style/index.css */ \"./node_modules/antd/lib/form/style/index.css\");\n\n\nangular.module(\"esNgAntd\").directive(\"esForm\", function (esNgAntd) {\n return {\n controllerAs: \"esForm\",\n restrict: \"E\",\n transclude: true,\n replace: true,\n scope: {\n name: \"@\",\n labelCol: \"=\",\n wrapperCol: \"=\",\n onFinish: \"&\",\n form: \"=\",\n },\n template: _Form_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 formItems: [],\n };\n\n $scope.resetFields = function () {\n $scope.state.formItems.forEach(function (item) {\n if (typeof item.setValue === \"function\") {\n item.setValue(item.defaultValue || null);\n } else {\n item.value = null;\n }\n });\n };\n\n $scope.submit = function () {\n $scope.handleSubmit();\n };\n\n $scope.handleSubmit = function () {\n let values = {};\n $scope.state.formItems.forEach(function (item) {\n let name = item.esFormItem && item.esFormItem.name;\n let value = item.value || item.state.value || null;\n values[name] = value;\n });\n $scope.onFinish({\n values: values,\n });\n };\n },\n link: function ($scope, $element, $attrs, $controllers, $transclude) {\n esNgAntd.createStyle(\"ant-form\", antd_lib_form_style_index_css__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\n $scope.form = $scope;\n\n if ($scope.name) {\n let inputs = $element[0].querySelectorAll(\"input\");\n\n for (let i = 0; i < inputs.length; i++) {\n const element = inputs[i];\n element.id = $scope.name + \"_\" + element.id;\n }\n }\n },\n };\n});\n\n\n//# sourceURL=webpack://ng-antd/./build/Form/Form.js?"); | |
140 | +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Form_html__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Form.html */ \"./build/Form/Form.html\");\n/* harmony import */ var antd_lib_form_style_index_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! antd/lib/form/style/index.css */ \"./node_modules/antd/lib/form/style/index.css\");\n\n\nangular.module(\"esNgAntd\").directive(\"esForm\", function (esNgAntd) {\n return {\n controllerAs: \"esForm\",\n restrict: \"E\",\n transclude: true,\n replace: true,\n scope: {\n name: \"@\",\n labelCol: \"=\",\n wrapperCol: \"=\",\n onFinish: \"&\",\n form: \"=\",\n },\n template: _Form_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 formItems: [],\n };\n\n $scope.resetFields = function () {\n $scope.state.formItems.forEach(function (item) {\n if (typeof item.setValue === \"function\") {\n item.setValue(item.defaultValue || null);\n } else {\n item.value = null;\n }\n });\n };\n\n $scope.submit = function () {\n $scope.handleSubmit();\n };\n\n $scope.handleSubmit = function () {\n let values = {};\n $scope.state.formItems.forEach(function (item) {\n let name = item.esFormItem && item.esFormItem.name;\n let value = item.value || item.state.value || null;\n values[name] = value;\n });\n $scope.onFinish({\n values: values,\n });\n };\n },\n link: function ($scope, $element, $attrs, $controllers, $transclude) {\n esNgAntd.createStyle(\"ant-form\", antd_lib_form_style_index_css__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\n\n if ($scope.name) {\n let inputs = $element[0].querySelectorAll(\"input\");\n\n for (let i = 0; i < inputs.length; i++) {\n const element = inputs[i];\n element.id = $scope.name + \"_\" + element.id;\n }\n }\n },\n };\n});\n\n\n//# sourceURL=webpack://ng-antd/./build/Form/Form.js?"); | |
141 | 141 | |
142 | 142 | /***/ }), |
143 | 143 | |
... | ... | @@ -378,7 +378,7 @@ eval("angular.module(\"esNgAntd\").directive(\"esSlot\", function ($compile) {\n |
378 | 378 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
379 | 379 | |
380 | 380 | "use strict"; |
381 | -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Space_html__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Space.html */ \"./build/Space/Space.html\");\n/* harmony import */ var antd_lib_space_style_index_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! antd/lib/space/style/index.css */ \"./node_modules/antd/lib/space/style/index.css\");\n\n\nangular.module(\"esNgAntd\").directive(\"esSpace\", function (esNgAntd) {\n return {\n controllerAs: \"esSpace\",\n restrict: \"E\",\n transclude: true,\n replace: true,\n scope: {\n direction: \"@\",\n size: \"@\",\n },\n template: _Space_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 direction: $scope.direction || \"horizontal\",\n size: $scope.size || 8,\n };\n },\n link: function ($scope, $element, $attrs, $controllers, $transclude) {\n esNgAntd.createStyle(\"ant-space\", antd_lib_space_style_index_css__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\n $element.removeAttr(\"ng-class\");\n $element.removeAttr(\"ng-style\");\n let childrens = $transclude();\n\n for (const key in childrens) {\n if (Object.hasOwnProperty.call(childrens, key)) {\n const children = childrens[key];\n\n if (children.nodeType === 1) {\n let item = angular\n .element(\"<div>\")\n .addClass(\"ant-space-item\")\n .append(children);\n $element.append(item);\n }\n }\n }\n },\n };\n});\n\n\n//# sourceURL=webpack://ng-antd/./build/Space/Space.js?"); | |
381 | +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Space_html__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Space.html */ \"./build/Space/Space.html\");\n/* harmony import */ var antd_lib_space_style_index_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! antd/lib/space/style/index.css */ \"./node_modules/antd/lib/space/style/index.css\");\n\n\nangular.module(\"esNgAntd\").directive(\"esSpace\", function (esNgAntd) {\n return {\n controllerAs: \"esSpace\",\n restrict: \"E\",\n transclude: true,\n replace: true,\n scope: {\n direction: \"@\",\n size: \"@\",\n },\n template: _Space_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 direction: $scope.direction || \"horizontal\",\n size: $scope.size || 8,\n };\n },\n link: function ($scope, $element, $attrs, $controllers, $transclude) {\n esNgAntd.createStyle(\"ant-space\", antd_lib_space_style_index_css__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\n $element.removeAttr(\"ng-class\");\n $element.removeAttr(\"ng-style\");\n let childrens = $transclude();\n\n for (let i = 0; i < childrens.length; i++) {\n const children = childrens[i];\n\n if (children.nodeType === 1) {\n let item = angular\n .element(\"<div>\")\n .addClass(\"ant-space-item\")\n .append(children);\n $element.append(item);\n }\n }\n },\n };\n});\n\n\n//# sourceURL=webpack://ng-antd/./build/Space/Space.js?"); | |
382 | 382 | |
383 | 383 | /***/ }), |
384 | 384 | |
... | ... | @@ -9727,7 +9727,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac |
9727 | 9727 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
9728 | 9728 | |
9729 | 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 ng-class=\\\"'ant-space ant-space-'+state.direction+' ant-space-align-center'\\\" ng-style=\\\"{gap:state.size+'px'}\\\"></div>\";\n// Exports\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (code);\n\n//# sourceURL=webpack://ng-antd/./build/Space/Space.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 ng-class=\\\"'ant-space ant-space-'+state.direction+' ant-space-align-center'\\\" ng-style=\\\"{gap:state.size+'px'}\\\" data-foo=\\\"{{foo}}\\\"></div>\";\n// Exports\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (code);\n\n//# sourceURL=webpack://ng-antd/./build/Space/Space.html?"); | |
9731 | 9731 | |
9732 | 9732 | /***/ }), |
9733 | 9733 | ... | ... |
src/Form/Form.js
src/Space/Space.html
1 | -<div className={"ant-space ant-space-"+state.direction+" ant-space-align-center"} style={{gap: state.size+'px'}}></div> | |
2 | 1 | \ No newline at end of file |
2 | +<div className={"ant-space ant-space-" + state.direction + " ant-space-align-center"} style={{ gap: state.size + 'px' }} data-foo={foo}></div> | |
3 | 3 | \ No newline at end of file | ... | ... |