From 2c0a9da3f48344d8737a394c8e324889ca2d1203 Mon Sep 17 00:00:00 2001 From: Imshann <851188611@qq.com> Date: Tue, 18 Jan 2022 15:33:58 +0800 Subject: [PATCH] 优化 --- build/Form/Form.js | 1 - build/Space/Space.html | 2 +- dist/ng-antd.js | 6 +++--- src/Form/Form.js | 4 +--- src/Space/Space.html | 2 +- 5 files changed, 6 insertions(+), 9 deletions(-) diff --git a/build/Form/Form.js b/build/Form/Form.js index 40420aa..e1ce10c 100644 --- a/build/Form/Form.js +++ b/build/Form/Form.js @@ -51,7 +51,6 @@ angular.module("esNgAntd").directive("esForm", function (esNgAntd) { }, link: function ($scope, $element, $attrs, $controllers, $transclude) { esNgAntd.createStyle("ant-form", style); - $scope.form = $scope; if ($scope.name) { let inputs = $element[0].querySelectorAll("input"); diff --git a/build/Space/Space.html b/build/Space/Space.html index dabef42..a0b2001 100644 --- a/build/Space/Space.html +++ b/build/Space/Space.html @@ -1 +1 @@ -
\ No newline at end of file + \ No newline at end of file diff --git a/dist/ng-antd.js b/dist/ng-antd.js index 4da149f..bae7b50 100644 --- a/dist/ng-antd.js +++ b/dist/ng-antd.js @@ -137,7 +137,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; -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?"); +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?"); /***/ }), @@ -378,7 +378,7 @@ eval("angular.module(\"esNgAntd\").directive(\"esSlot\", function ($compile) {\n /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; -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(\"