bkui-vue 0.0.2-beta.78 → 0.0.2-beta.79

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (211) hide show
  1. package/dist/index.cjs.js +64 -64
  2. package/dist/index.esm.js +12188 -12269
  3. package/dist/index.umd.js +65 -65
  4. package/dist/style.css +1 -1
  5. package/dist/style.variable.css +1 -1
  6. package/lib/affix/index.js +1 -321
  7. package/lib/alert/index.js +1 -214
  8. package/lib/animate-number/index.js +1 -155
  9. package/lib/backtop/index.js +1 -188
  10. package/lib/badge/index.js +1 -235
  11. package/lib/breadcrumb/index.js +1 -309
  12. package/lib/button/index.js +1 -321
  13. package/lib/card/index.js +1 -285
  14. package/lib/cascader/index.js +2 -2036
  15. package/lib/cascader/index.js.LICENSE.txt +1 -0
  16. package/lib/checkbox/index.js +1 -542
  17. package/lib/code-diff/index.js +1 -5501
  18. package/lib/collapse/index.js +1 -570
  19. package/lib/collapse-transition/index.js +1 -178
  20. package/lib/color-picker/index.js +1 -2665
  21. package/lib/components.js +1 -530
  22. package/lib/config-provider/index.js +1 -365
  23. package/lib/container/index.js +1 -391
  24. package/lib/date-picker/index.js +1 -5527
  25. package/lib/dialog/dialog.css +2 -0
  26. package/lib/dialog/dialog.variable.css +2 -0
  27. package/lib/dialog/index.js +2 -975
  28. package/lib/dialog/index.js.LICENSE.txt +1 -0
  29. package/lib/directives/index.js +2 -1375
  30. package/lib/directives/index.js.LICENSE.txt +14 -0
  31. package/lib/dist.index.js +1 -87
  32. package/lib/divider/index.js +1 -169
  33. package/lib/dropdown/index.js +1 -369
  34. package/lib/exception/index.js +1 -385
  35. package/lib/fixed-navbar/index.js +1 -154
  36. package/lib/form/index.js +1 -924
  37. package/lib/hooks.js +1 -73
  38. package/lib/icon/angle-double-down-line.js +1 -191
  39. package/lib/icon/angle-double-left-line.js +1 -191
  40. package/lib/icon/angle-double-left.js +1 -191
  41. package/lib/icon/angle-double-right-line.js +1 -191
  42. package/lib/icon/angle-double-right.js +1 -191
  43. package/lib/icon/angle-double-up-line.js +1 -191
  44. package/lib/icon/angle-down-fill.js +1 -191
  45. package/lib/icon/angle-down-line.js +1 -191
  46. package/lib/icon/angle-down.js +1 -191
  47. package/lib/icon/angle-left.js +1 -191
  48. package/lib/icon/angle-right.js +1 -191
  49. package/lib/icon/angle-up-fill.js +1 -191
  50. package/lib/icon/angle-up.js +1 -191
  51. package/lib/icon/archive-fill.js +1 -191
  52. package/lib/icon/arrows-left.js +1 -191
  53. package/lib/icon/arrows-right.js +1 -191
  54. package/lib/icon/assistant.js +1 -191
  55. package/lib/icon/audio-fill.js +1 -191
  56. package/lib/icon/bk.js +1 -191
  57. package/lib/icon/circle.js +1 -191
  58. package/lib/icon/close-line.js +1 -191
  59. package/lib/icon/close.js +1 -191
  60. package/lib/icon/code.js +1 -191
  61. package/lib/icon/cog-shape.js +1 -191
  62. package/lib/icon/collapse-left.js +1 -191
  63. package/lib/icon/copy-shape.js +1 -191
  64. package/lib/icon/copy.js +1 -191
  65. package/lib/icon/data-shape.js +1 -191
  66. package/lib/icon/del.js +1 -191
  67. package/lib/icon/doc-fill.js +1 -191
  68. package/lib/icon/done.js +1 -191
  69. package/lib/icon/down-shape.js +1 -191
  70. package/lib/icon/down-small.js +1 -191
  71. package/lib/icon/edit-line.js +1 -191
  72. package/lib/icon/ellipsis.js +1 -191
  73. package/lib/icon/enlarge-line.js +1 -191
  74. package/lib/icon/error.js +1 -191
  75. package/lib/icon/excel-fill.js +1 -191
  76. package/lib/icon/exclamation-circle-shape.js +1 -191
  77. package/lib/icon/eye.js +1 -191
  78. package/lib/icon/filliscreen-line.js +1 -191
  79. package/lib/icon/fix-line.js +1 -191
  80. package/lib/icon/fix-shape.js +1 -191
  81. package/lib/icon/folder-open.js +1 -191
  82. package/lib/icon/folder-shape-open.js +1 -191
  83. package/lib/icon/folder-shape.js +1 -191
  84. package/lib/icon/folder.js +1 -191
  85. package/lib/icon/funnel.js +1 -191
  86. package/lib/icon/help-document-fill.js +1 -191
  87. package/lib/icon/help-fill.js +1 -191
  88. package/lib/icon/help.js +1 -191
  89. package/lib/icon/image-fill.js +1 -276
  90. package/lib/icon/img-error.js +1 -276
  91. package/lib/icon/img-placehoulder.js +1 -276
  92. package/lib/icon/index.js +1 -2399
  93. package/lib/icon/info-line.js +1 -276
  94. package/lib/icon/info.js +1 -276
  95. package/lib/icon/left-shape.js +1 -276
  96. package/lib/icon/left-turn-line.js +1 -276
  97. package/lib/icon/narrow-line.js +1 -276
  98. package/lib/icon/original.js +1 -276
  99. package/lib/icon/pdf-fill.js +1 -276
  100. package/lib/icon/play-shape.js +1 -276
  101. package/lib/icon/plus.js +1 -276
  102. package/lib/icon/ppt-fill.js +1 -276
  103. package/lib/icon/qq.js +1 -276
  104. package/lib/icon/right-shape.js +1 -276
  105. package/lib/icon/right-turn-line.js +1 -276
  106. package/lib/icon/search.js +1 -276
  107. package/lib/icon/share.js +1 -276
  108. package/lib/icon/spinner.js +1 -276
  109. package/lib/icon/success.js +1 -276
  110. package/lib/icon/switcher-loading.js +1 -276
  111. package/lib/icon/text-file.js +1 -276
  112. package/lib/icon/text-fill.js +1 -276
  113. package/lib/icon/transfer.js +1 -276
  114. package/lib/icon/tree-application-shape.js +1 -276
  115. package/lib/icon/unfull-screen.js +1 -276
  116. package/lib/icon/unvisible.js +1 -276
  117. package/lib/icon/up-shape.js +1 -276
  118. package/lib/icon/upload.js +1 -276
  119. package/lib/icon/video-fill.js +1 -276
  120. package/lib/icon/warn.js +1 -276
  121. package/lib/icon/weixin-pro.js +1 -276
  122. package/lib/icon/weixin.js +1 -276
  123. package/lib/image/index.js +1 -641
  124. package/lib/index.js +1 -97
  125. package/lib/info-box/index.js +2 -1165
  126. package/lib/info-box/index.js.LICENSE.txt +1 -0
  127. package/lib/info-box/info-box.css +2 -0
  128. package/lib/info-box/info-box.less +2 -1
  129. package/lib/info-box/info-box.variable.css +2 -0
  130. package/lib/input/index.js +2 -1218
  131. package/lib/input/index.js.LICENSE.txt +1 -0
  132. package/lib/link/index.js +1 -160
  133. package/lib/loading/index.js +1 -381
  134. package/lib/locale/index.js +1 -465
  135. package/lib/menu/index.js +1 -724
  136. package/lib/message/index.js +2 -1795
  137. package/lib/message/index.js.LICENSE.txt +6 -0
  138. package/lib/modal/index.js +1 -396
  139. package/lib/modal/modal.css +2 -0
  140. package/lib/modal/modal.variable.css +2 -0
  141. package/lib/navigation/index.js +1 -367
  142. package/lib/notify/index.js +1 -397
  143. package/lib/overflow-title/index.js +1 -486
  144. package/lib/pagination/index.js +1 -880
  145. package/lib/plugin-popover/index.js +1 -3905
  146. package/lib/plugins/index.js +1 -63
  147. package/lib/pop-confirm/index.js +1 -273
  148. package/lib/popover/index.js +1 -3913
  149. package/lib/popover2/index.js +1 -107
  150. package/lib/preset.js +1 -93
  151. package/lib/process/index.js +2 -759
  152. package/lib/process/index.js.LICENSE.txt +1 -0
  153. package/lib/progress/index.js +1 -431
  154. package/lib/radio/index.js +1 -627
  155. package/lib/rate/index.js +1 -338
  156. package/lib/resize-layout/index.js +1 -429
  157. package/lib/search-select/index.js +2 -2729
  158. package/lib/search-select/index.js.LICENSE.txt +1 -0
  159. package/lib/select/index.js +2 -2240
  160. package/lib/select/index.js.LICENSE.txt +1 -0
  161. package/lib/shared/index.js +1 -2689
  162. package/lib/sideslider/index.js +2 -714
  163. package/lib/sideslider/index.js.LICENSE.txt +1 -0
  164. package/lib/slider/index.js +2 -1291
  165. package/lib/slider/index.js.LICENSE.txt +1 -0
  166. package/lib/steps/index.js +2 -825
  167. package/lib/steps/index.js.LICENSE.txt +1 -0
  168. package/lib/swiper/index.js +1 -336
  169. package/lib/switcher/index.js +1 -277
  170. package/lib/tab/index.js +1 -914
  171. package/lib/table/components/table-column.d.ts +2 -0
  172. package/lib/table/const.d.ts +24 -2
  173. package/lib/table/index.d.ts +38 -0
  174. package/lib/table/index.js +1 -6406
  175. package/lib/table/plugins/use-column-resize.d.ts +30 -10
  176. package/lib/table/plugins/use-fixed-column.d.ts +9 -9
  177. package/lib/table/plugins/use-pagination.d.ts +7 -4
  178. package/lib/table/props.d.ts +22 -1
  179. package/lib/table/render.d.ts +7 -17
  180. package/lib/table/table.css +4 -1
  181. package/lib/table/table.d.ts +44 -23
  182. package/lib/table/table.less +4 -1
  183. package/lib/table/table.variable.css +4 -1
  184. package/lib/table/use-attributes.d.ts +55 -0
  185. package/lib/table/use-column.d.ts +177 -53
  186. package/lib/table/use-common.d.ts +1602 -76
  187. package/lib/table/use-render.d.ts +11 -0
  188. package/lib/table/utils.d.ts +22 -16
  189. package/lib/table-column/index.d.ts +6 -0
  190. package/lib/table-column/index.js +1 -731
  191. package/lib/tag/index.js +1 -233
  192. package/lib/tag-input/index.js +1 -1660
  193. package/lib/time-picker/index.js +1 -71
  194. package/lib/timeline/index.js +1 -241
  195. package/lib/transfer/index.js +1 -673
  196. package/lib/tree/index.d.ts +12 -0
  197. package/lib/tree/index.js +1 -2445
  198. package/lib/tree/props.d.ts +8 -1
  199. package/lib/tree/tree.d.ts +7 -0
  200. package/lib/tree/use-node-action.d.ts +2 -1
  201. package/lib/tree/use-node-attribute.d.ts +2 -0
  202. package/lib/tree/use-search.d.ts +2 -2
  203. package/lib/tree/util.d.ts +2 -2
  204. package/lib/upload/index.js +2 -2874
  205. package/lib/upload/index.js.LICENSE.txt +1 -0
  206. package/lib/virtual-render/index.d.ts +12 -0
  207. package/lib/virtual-render/index.js +1 -792
  208. package/lib/virtual-render/props.d.ts +4 -0
  209. package/lib/virtual-render/v-virtual-render.d.ts +19 -1
  210. package/lib/virtual-render/virtual-render.d.ts +7 -0
  211. package/package.json +1 -2
package/lib/form/index.js CHANGED
@@ -1,924 +1 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE__shared_65459f0a__ from "../shared";
2
- import * as __WEBPACK_EXTERNAL_MODULE_vue__ from "vue";
3
- import * as __WEBPACK_EXTERNAL_MODULE__config_provider_9d0186d9__ from "../config-provider";
4
- import * as __WEBPACK_EXTERNAL_MODULE_lodash__ from "lodash";
5
- import * as __WEBPACK_EXTERNAL_MODULE__directives_9cc9ba10__ from "../directives";
6
- import * as __WEBPACK_EXTERNAL_MODULE__icon_85385c3e__ from "../icon";
7
- /******/ // The require scope
8
- /******/ var __webpack_require__ = {};
9
- /******/
10
- /************************************************************************/
11
- /******/ /* webpack/runtime/define property getters */
12
- /******/ (() => {
13
- /******/ // define getter functions for harmony exports
14
- /******/ __webpack_require__.d = (exports, definition) => {
15
- /******/ for(var key in definition) {
16
- /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
17
- /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
18
- /******/ }
19
- /******/ }
20
- /******/ };
21
- /******/ })();
22
- /******/
23
- /******/ /* webpack/runtime/hasOwnProperty shorthand */
24
- /******/ (() => {
25
- /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
26
- /******/ })();
27
- /******/
28
- /************************************************************************/
29
- var __webpack_exports__ = {};
30
-
31
- // EXPORTS
32
- __webpack_require__.d(__webpack_exports__, {
33
- kq: () => (/* reexport */ compose_form_item),
34
- ZD: () => (/* binding */ BkForm),
35
- a_: () => (/* reexport */ form_item),
36
- ZP: () => (/* binding */ src),
37
- xE: () => (/* reexport */ external_shared_namespaceObject.formItemKey),
38
- vh: () => (/* reexport */ external_shared_namespaceObject.formKey),
39
- A9: () => (/* reexport */ external_shared_namespaceObject.useFormItem)
40
- });
41
-
42
- ;// CONCATENATED MODULE: external "../shared"
43
- var x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
44
- var y = x => () => x
45
- const external_shared_namespaceObject = x({ ["PropTypes"]: () => __WEBPACK_EXTERNAL_MODULE__shared_65459f0a__.PropTypes, ["classes"]: () => __WEBPACK_EXTERNAL_MODULE__shared_65459f0a__.classes, ["formItemKey"]: () => __WEBPACK_EXTERNAL_MODULE__shared_65459f0a__.formItemKey, ["formKey"]: () => __WEBPACK_EXTERNAL_MODULE__shared_65459f0a__.formKey, ["useForm"]: () => __WEBPACK_EXTERNAL_MODULE__shared_65459f0a__.useForm, ["useFormItem"]: () => __WEBPACK_EXTERNAL_MODULE__shared_65459f0a__.useFormItem, ["withInstallProps"]: () => __WEBPACK_EXTERNAL_MODULE__shared_65459f0a__.withInstallProps });
46
- ;// CONCATENATED MODULE: external "vue"
47
- var external_vue_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
48
- var external_vue_y = x => () => x
49
- const external_vue_namespaceObject = external_vue_x({ ["computed"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.computed, ["createVNode"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.createVNode, ["defineComponent"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent, ["getCurrentInstance"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.getCurrentInstance, ["h"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.h, ["onBeforeUnmount"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.onBeforeUnmount, ["onMounted"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.onMounted, ["provide"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.provide, ["reactive"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.reactive, ["resolveDirective"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.resolveDirective, ["toRefs"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.toRefs, ["withDirectives"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.withDirectives });
50
- ;// CONCATENATED MODULE: external "../config-provider"
51
- var external_config_provider_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
52
- var external_config_provider_y = x => () => x
53
- const external_config_provider_namespaceObject = external_config_provider_x({ ["useLocale"]: () => __WEBPACK_EXTERNAL_MODULE__config_provider_9d0186d9__.useLocale, ["usePrefix"]: () => __WEBPACK_EXTERNAL_MODULE__config_provider_9d0186d9__.usePrefix });
54
- ;// CONCATENATED MODULE: ../../packages/form/src/compose-form-item.tsx
55
- /*
56
- * Tencent is pleased to support the open source community by making
57
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
58
- *
59
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
60
- *
61
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
62
- *
63
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
64
- *
65
- * ---------------------------------------------------
66
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
67
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
68
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
69
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
70
- *
71
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
72
- * the Software.
73
- *
74
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
75
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
76
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
77
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
78
- * IN THE SOFTWARE.
79
- */
80
-
81
-
82
- var isCustomComponent = function isCustomComponent(node) {
83
- return node.__v_isVNode;
84
- };
85
- /* harmony default export */ const compose_form_item = ((0,external_vue_namespaceObject.defineComponent)({
86
- name: 'ComposeFormItem',
87
- props: {
88
- headBackgroundColor: {
89
- type: String,
90
- "default": '#FAFBFD'
91
- },
92
- tailBackgroundColor: String
93
- },
94
- setup: function setup() {
95
- var _usePrefix = (0,external_config_provider_namespaceObject.usePrefix)(),
96
- resolveClassName = _usePrefix.resolveClassName;
97
- return {
98
- resolveClassName: resolveClassName
99
- };
100
- },
101
- render: function render() {
102
- if (!this.$slots["default"]) {
103
- return null;
104
- }
105
- var childrenArr = this.$slots["default"]();
106
- if (childrenArr.length > 1) {
107
- var childrenLength = childrenArr.length;
108
- var startIndex = 0;
109
- var headChildren = null;
110
- while (startIndex < childrenLength) {
111
- if (isCustomComponent(childrenArr[startIndex])) {
112
- headChildren = childrenArr[startIndex];
113
- break;
114
- }
115
- startIndex = startIndex + 1;
116
- }
117
- var tailIndex = childrenLength - 1;
118
- var tailChildren = null;
119
- while (tailIndex >= 0 && tailIndex > startIndex) {
120
- if (isCustomComponent(childrenArr[tailIndex])) {
121
- tailChildren = childrenArr[tailIndex];
122
- break;
123
- }
124
- tailIndex = tailIndex - 1;
125
- }
126
- if (headChildren && tailChildren) {
127
- if (!headChildren.props) {
128
- headChildren.props = {};
129
- }
130
- var headChildClass = "".concat(this.resolveClassName('compose-form-item-head'));
131
- if (headChildren.props["class"]) {
132
- headChildClass += " ".concat(headChildren.props["class"]);
133
- }
134
- if (this.headBackgroundColor) {
135
- headChildren.props.style = Object.assign(headChildren.props.style || {}, {
136
- 'background-color': this.headBackgroundColor
137
- });
138
- }
139
- headChildren.props["class"] = headChildClass;
140
- if (!tailChildren.props) {
141
- tailChildren.props = {};
142
- }
143
- var tailChildStaticClass = "".concat(this.resolveClassName('compose-form-item-tail'));
144
- if (tailChildren.props["class"]) {
145
- tailChildStaticClass += " ".concat(tailChildren.props["class"]);
146
- }
147
- if (this.tailBackgroundColor) {
148
- tailChildren.props.style = Object.assign(tailChildren.props.style || {}, {
149
- 'background-color': this.tailBackgroundColor
150
- });
151
- }
152
- tailChildren.props["class"] = tailChildStaticClass;
153
- }
154
- }
155
- return (0,external_vue_namespaceObject.h)('div', {
156
- "class": "".concat(this.resolveClassName('compose-form-item'))
157
- }, childrenArr);
158
- }
159
- }));
160
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/typeof.js
161
- function _typeof(obj) {
162
- "@babel/helpers - typeof";
163
-
164
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
165
- return typeof obj;
166
- } : function (obj) {
167
- return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
168
- }, _typeof(obj);
169
- }
170
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js
171
-
172
- function _toPrimitive(input, hint) {
173
- if (_typeof(input) !== "object" || input === null) return input;
174
- var prim = input[Symbol.toPrimitive];
175
- if (prim !== undefined) {
176
- var res = prim.call(input, hint || "default");
177
- if (_typeof(res) !== "object") return res;
178
- throw new TypeError("@@toPrimitive must return a primitive value.");
179
- }
180
- return (hint === "string" ? String : Number)(input);
181
- }
182
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
183
-
184
-
185
- function _toPropertyKey(arg) {
186
- var key = _toPrimitive(arg, "string");
187
- return _typeof(key) === "symbol" ? key : String(key);
188
- }
189
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/defineProperty.js
190
-
191
- function _defineProperty(obj, key, value) {
192
- key = _toPropertyKey(key);
193
- if (key in obj) {
194
- Object.defineProperty(obj, key, {
195
- value: value,
196
- enumerable: true,
197
- configurable: true,
198
- writable: true
199
- });
200
- } else {
201
- obj[key] = value;
202
- }
203
- return obj;
204
- }
205
- ;// CONCATENATED MODULE: external "lodash"
206
- var external_lodash_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
207
- var external_lodash_y = x => () => x
208
- const external_lodash_namespaceObject = external_lodash_x({ ["get"]: () => __WEBPACK_EXTERNAL_MODULE_lodash__.get, ["isBoolean"]: () => __WEBPACK_EXTERNAL_MODULE_lodash__.isBoolean, ["isDate"]: () => __WEBPACK_EXTERNAL_MODULE_lodash__.isDate, ["isEmpty"]: () => __WEBPACK_EXTERNAL_MODULE_lodash__.isEmpty, ["isFunction"]: () => __WEBPACK_EXTERNAL_MODULE_lodash__.isFunction, ["isString"]: () => __WEBPACK_EXTERNAL_MODULE_lodash__.isString });
209
- ;// CONCATENATED MODULE: ../../packages/form/src/form.tsx
210
-
211
-
212
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
213
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
214
- /*
215
- * Tencent is pleased to support the open source community by making
216
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
217
- *
218
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
219
- *
220
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
221
- *
222
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
223
- *
224
- * ---------------------------------------------------
225
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
226
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
227
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
228
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
229
- *
230
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
231
- * the Software.
232
- *
233
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
234
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
235
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
236
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
237
- * IN THE SOFTWARE.
238
- */
239
-
240
-
241
-
242
-
243
- var formProps = {
244
- formType: external_shared_namespaceObject.PropTypes.oneOf(['default', 'vertical']).def('default'),
245
- labelWidth: external_shared_namespaceObject.PropTypes.oneOfType([Number, String]).def(150),
246
- labelPosition: external_shared_namespaceObject.PropTypes.oneOf(['left', 'center', 'right']),
247
- model: external_shared_namespaceObject.PropTypes.object,
248
- rules: external_shared_namespaceObject.PropTypes.object
249
- };
250
- var formEvents = {
251
- submit: null,
252
- validate: function validate(property, result, message) {
253
- return (0,external_lodash_namespaceObject.isString)(property) && (0,external_lodash_namespaceObject.isBoolean)(result) && (0,external_lodash_namespaceObject.isString)(message);
254
- }
255
- };
256
- /* harmony default export */ const src_form = ((0,external_vue_namespaceObject.defineComponent)({
257
- // eslint-disable-next-line vue/no-reserved-component-names
258
- name: 'Form',
259
- props: formProps,
260
- emits: formEvents,
261
- setup: function setup(props, context) {
262
- // form-item 列表
263
- var formItemInstanceList = [];
264
- /**
265
- * @desc 注册 form-item
266
- * @param { IFormItemContext } formItemInstance
267
- */
268
- var register = function register(formItemInstance) {
269
- formItemInstanceList.push(formItemInstance);
270
- };
271
- /**
272
- * @desc 卸载 form-item
273
- * @param { IFormItemContext } formItemInstance
274
- */
275
- var unregister = function unregister(formItemInstance) {
276
- formItemInstanceList = formItemInstanceList.reduce(function (result, item) {
277
- if (item !== formItemInstance) {
278
- result.push(item);
279
- }
280
- return result;
281
- }, []);
282
- };
283
- (0,external_vue_namespaceObject.provide)(external_shared_namespaceObject.formKey, {
284
- props: props,
285
- emit: context.emit,
286
- register: register,
287
- unregister: unregister
288
- });
289
- var handleSubmit = function handleSubmit(event) {
290
- event.preventDefault();
291
- context.emit('submit');
292
- };
293
- /**
294
- * @desc 验证表单
295
- * @param { string | Array<string> } fields 指定表单字段
296
- * @returns { Promise<[]> }
297
- */
298
- var validate = function validate(fields) {
299
- var fieldMap = {};
300
- if (fields) {
301
- var fieldList = typeof fields === 'string' ? [fields] : fields;
302
- fieldMap = fieldList.reduce(function (result, item) {
303
- return _objectSpread(_objectSpread({}, result), {}, _defineProperty({}, item, true));
304
- }, {});
305
- } else {
306
- fieldMap = formItemInstanceList.reduce(function (result, item) {
307
- if (item.property) {
308
- return _objectSpread(_objectSpread({}, result), {}, _defineProperty({}, item.property, true));
309
- }
310
- return result;
311
- }, {});
312
- }
313
- return Promise.all(formItemInstanceList.reduce(function (result, formItem) {
314
- if (fieldMap[formItem.property]) {
315
- result.push(formItem.validate());
316
- }
317
- return result;
318
- }, [])).then(function () {
319
- return Promise.resolve(props.model);
320
- });
321
- };
322
- /**
323
- * @desc 获取表单的验证的结果(所有表单项验证成功返回 true)
324
- * @returns { Promise<Boolean> }
325
- */
326
- var getValidateResult = function getValidateResult() {
327
- return Promise.all(formItemInstanceList.map(function (formItem) {
328
- return formItem.validate(undefined, false);
329
- })).then(function () {
330
- return true;
331
- })["catch"](function () {
332
- return false;
333
- });
334
- };
335
- /**
336
- * @desc 清除表单验证错误信息
337
- * @param { string | Array<string> } fields 指定表单字段
338
- */
339
- var clearValidate = function clearValidate(fields) {
340
- var fieldMap = {};
341
- if (fields) {
342
- var fieldList = typeof fields === 'string' ? [fields] : fields;
343
- fieldMap = fieldList.reduce(function (result, item) {
344
- return _objectSpread(_objectSpread({}, result), {}, _defineProperty({}, item, true));
345
- }, {});
346
- } else {
347
- fieldMap = formItemInstanceList.reduce(function (result, item) {
348
- return _objectSpread(_objectSpread({}, result), {}, _defineProperty({}, item.property, true));
349
- }, {});
350
- }
351
- formItemInstanceList.forEach(function (formItem) {
352
- return fieldMap[formItem.property] && formItem.clearValidate();
353
- });
354
- };
355
- var _usePrefix = (0,external_config_provider_namespaceObject.usePrefix)(),
356
- resolveClassName = _usePrefix.resolveClassName;
357
- return {
358
- handleSubmit: handleSubmit,
359
- validate: validate,
360
- getValidateResult: getValidateResult,
361
- clearValidate: clearValidate,
362
- resolveClassName: resolveClassName
363
- };
364
- },
365
- render: function render() {
366
- var _classes, _this$$slots$default, _this$$slots;
367
- var formClasses = (0,external_shared_namespaceObject.classes)((_classes = {}, _defineProperty(_classes, "".concat(this.resolveClassName('form')), true), _defineProperty(_classes, "".concat(this.resolveClassName("form--".concat(this.formType))), true), _classes));
368
- return (0,external_vue_namespaceObject.createVNode)("form", {
369
- "class": formClasses,
370
- "onSubmit": this.handleSubmit
371
- }, [(_this$$slots$default = (_this$$slots = this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)]);
372
- }
373
- }));
374
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
375
- function _arrayLikeToArray(arr, len) {
376
- if (len == null || len > arr.length) len = arr.length;
377
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
378
- return arr2;
379
- }
380
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
381
-
382
- function _arrayWithoutHoles(arr) {
383
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
384
- }
385
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/iterableToArray.js
386
- function _iterableToArray(iter) {
387
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
388
- }
389
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
390
-
391
- function _unsupportedIterableToArray(o, minLen) {
392
- if (!o) return;
393
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
394
- var n = Object.prototype.toString.call(o).slice(8, -1);
395
- if (n === "Object" && o.constructor) n = o.constructor.name;
396
- if (n === "Map" || n === "Set") return Array.from(o);
397
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
398
- }
399
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
400
- function _nonIterableSpread() {
401
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
402
- }
403
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
404
-
405
-
406
-
407
-
408
- function _toConsumableArray(arr) {
409
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
410
- }
411
- ;// CONCATENATED MODULE: external "../directives"
412
- var external_directives_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
413
- var external_directives_y = x => () => x
414
- const external_directives_namespaceObject = external_directives_x({ ["bkTooltips"]: () => __WEBPACK_EXTERNAL_MODULE__directives_9cc9ba10__.bkTooltips });
415
- ;// CONCATENATED MODULE: external "../icon"
416
- var external_icon_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
417
- var external_icon_y = x => () => x
418
- const external_icon_namespaceObject = external_icon_x({ ["ExclamationCircleShape"]: () => __WEBPACK_EXTERNAL_MODULE__icon_85385c3e__.ExclamationCircleShape });
419
- ;// CONCATENATED MODULE: ../../packages/form/src/utils.ts
420
- /*
421
- * Tencent is pleased to support the open source community by making
422
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
423
- *
424
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
425
- *
426
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
427
- *
428
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
429
- *
430
- * ---------------------------------------------------
431
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
432
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
433
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
434
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
435
- *
436
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
437
- * the Software.
438
- *
439
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
440
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
441
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
442
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
443
- * IN THE SOFTWARE.
444
- */
445
- var getRuleMessage = function getRuleMessage(rule) {
446
- if (typeof rule.message === 'function') {
447
- return rule.message();
448
- }
449
- return rule.message;
450
- };
451
- ;// CONCATENATED MODULE: ../../packages/form/src/validator.ts
452
- /*
453
- * Tencent is pleased to support the open source community by making
454
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
455
- *
456
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
457
- *
458
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
459
- *
460
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
461
- *
462
- * ---------------------------------------------------
463
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
464
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
465
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
466
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
467
- *
468
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
469
- * the Software.
470
- *
471
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
472
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
473
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
474
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
475
- * IN THE SOFTWARE.
476
- */
477
-
478
- /* harmony default export */ const src_validator = ({
479
- required: function required(value) {
480
- if (typeof value === 'number' || typeof value === 'boolean' || (0,external_lodash_namespaceObject.isDate)(value)) {
481
- return true;
482
- }
483
- return !(0,external_lodash_namespaceObject.isEmpty)(value);
484
- },
485
- min: function min(value, _min) {
486
- return value >= _min;
487
- },
488
- max: function max(value, _max) {
489
- return _max >= value;
490
- },
491
- email: function email(value) {
492
- return /^[A-Za-z\d]+([-_.][A-Za-z\d]+)*@([A-Za-z\d]+[-.])+[A-Za-z\d]{2,4}$/.test(value);
493
- },
494
- maxlength: function maxlength(value, _maxlength) {
495
- return value.length <= _maxlength;
496
- },
497
- pattern: function pattern(value, _pattern) {
498
- return _pattern.test(value);
499
- }
500
- });
501
- ;// CONCATENATED MODULE: ../../packages/form/src/form-item.tsx
502
-
503
-
504
-
505
- function form_item_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
506
- function form_item_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? form_item_ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : form_item_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
507
- /*
508
- * Tencent is pleased to support the open source community by making
509
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
510
- *
511
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
512
- *
513
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
514
- *
515
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
516
- *
517
- * ---------------------------------------------------
518
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
519
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
520
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
521
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
522
- *
523
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
524
- * the Software.
525
- *
526
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
527
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
528
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
529
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
530
- * IN THE SOFTWARE.
531
- */
532
-
533
-
534
-
535
-
536
-
537
-
538
-
539
-
540
- var formItemProps = {
541
- label: external_shared_namespaceObject.PropTypes.string,
542
- labelWidth: external_shared_namespaceObject.PropTypes.oneOfType([Number, String]),
543
- labelPosition: external_shared_namespaceObject.PropTypes.oneOf(['left', 'center', 'right']),
544
- property: external_shared_namespaceObject.PropTypes.string.def(''),
545
- required: external_shared_namespaceObject.PropTypes.bool.def(false),
546
- email: external_shared_namespaceObject.PropTypes.bool.def(false),
547
- max: external_shared_namespaceObject.PropTypes.number,
548
- min: external_shared_namespaceObject.PropTypes.number,
549
- maxlength: external_shared_namespaceObject.PropTypes.number,
550
- rules: external_shared_namespaceObject.PropTypes.array,
551
- autoCheck: external_shared_namespaceObject.PropTypes.bool.def(false),
552
- description: external_shared_namespaceObject.PropTypes.string,
553
- errorDisplayType: external_shared_namespaceObject.PropTypes.oneOf(['tooltips', 'normal']).def('normal')
554
- };
555
- var hasOwn = function hasOwn(obj, key) {
556
- return Object.prototype.hasOwnProperty.call(obj, key);
557
- };
558
- var getRulesFromProps = function getRulesFromProps(props, t) {
559
- var rules = [];
560
- var label = props.label || '';
561
- if (props.required) {
562
- rules.push({
563
- required: true,
564
- validator: src_validator.required,
565
- message: "".concat(label).concat(t.value.notBeEmpty),
566
- trigger: 'change'
567
- });
568
- }
569
- if (props.email) {
570
- rules.push({
571
- email: true,
572
- validator: src_validator.email,
573
- message: "".concat(label).concat(t.value.incorrectFormat),
574
- trigger: 'change'
575
- });
576
- }
577
- if (Number(props.max) > -1) {
578
- rules.push({
579
- validator: function validator(value) {
580
- return src_validator.max(value, props.max);
581
- },
582
- message: "".concat(label).concat(t.value.max, " ").concat(props.max),
583
- trigger: 'change'
584
- });
585
- }
586
- if (Number(props.min) > -1) {
587
- rules.push({
588
- validator: function validator(value) {
589
- return src_validator.min(value, props.min);
590
- },
591
- message: "".concat(label).concat(t.value.min, " ").concat(props.min),
592
- trigger: 'change'
593
- });
594
- }
595
- if (Number(props.maxlength) > -1) {
596
- rules.push({
597
- validator: function validator(value) {
598
- return src_validator.maxlength(value, props.maxlength);
599
- },
600
- message: "".concat(label).concat(t.value.maxLen, " ").concat(props.maxlength),
601
- trigger: 'change'
602
- });
603
- }
604
- return rules;
605
- };
606
- var mergeRules = function mergeRules(configRules, propRules, t) {
607
- var customRequired = false;
608
- var customEmail = false;
609
- var formatConfigRules = configRules.reduce(function (result, rule) {
610
- var rulevalidator;
611
- if (rule.required) {
612
- rulevalidator = (0,external_lodash_namespaceObject.isFunction)(rule.validator) ? rule.validator : src_validator.required;
613
- customRequired = true;
614
- } else if (rule.email) {
615
- rulevalidator = (0,external_lodash_namespaceObject.isFunction)(rule.validator) ? rule.validator : src_validator.email;
616
- customEmail = true;
617
- } else if (Number(rule.max) > -1) {
618
- rulevalidator = function rulevalidator(value) {
619
- return src_validator.max(value, rule.max);
620
- };
621
- } else if (Number(rule.min) > -1) {
622
- rulevalidator = function rulevalidator(value) {
623
- return src_validator.min(value, rule.max);
624
- };
625
- } else if (Number(rule.maxlength) > -1) {
626
- rulevalidator = function rulevalidator(value) {
627
- return src_validator.min(value, rule.max);
628
- };
629
- } else if (Object.prototype.toString.call(rule.pattern) === '[object RegExp]') {
630
- rulevalidator = function rulevalidator(value) {
631
- return src_validator.pattern(value, rule.pattern);
632
- };
633
- } else if ((0,external_lodash_namespaceObject.isFunction)(rule.validator)) {
634
- rulevalidator = rule.validator;
635
- } else {
636
- // 不支持的配置规则
637
- return result;
638
- }
639
- result.push({
640
- validator: rulevalidator,
641
- message: rule.message || t.value.verifyError,
642
- trigger: rule.trigger || 'blur'
643
- });
644
- return result;
645
- }, []);
646
- // 自定义配置验证规则覆盖内置验证规则
647
- var filterPropRules = propRules.reduce(function (result, ruleItem) {
648
- if (ruleItem.required && customRequired) {
649
- return result;
650
- }
651
- if (ruleItem.email && customEmail) {
652
- return result;
653
- }
654
- result.push(ruleItem);
655
- return result;
656
- }, []);
657
- return [].concat(_toConsumableArray(filterPropRules), _toConsumableArray(formatConfigRules));
658
- };
659
- var getTriggerRules = function getTriggerRules(trigger, rules) {
660
- return rules.reduce(function (result, rule) {
661
- if (!rule.trigger || !trigger) {
662
- result.push(rule);
663
- return result;
664
- }
665
- var ruleTriggerList = Array.isArray(rule.trigger) ? rule.trigger : [rule.trigger];
666
- if (ruleTriggerList.includes(trigger)) {
667
- result.push(rule);
668
- }
669
- return result;
670
- }, []);
671
- };
672
- var isValid = function isValid(value) {
673
- return value !== undefined;
674
- };
675
- /* harmony default export */ const form_item = ((0,external_vue_namespaceObject.defineComponent)({
676
- name: 'FormItem',
677
- directives: {
678
- bkTooltips: external_directives_namespaceObject.bkTooltips
679
- },
680
- props: formItemProps,
681
- setup: function setup(props, context) {
682
- var t = (0,external_config_provider_namespaceObject.useLocale)('form');
683
- var form = (0,external_shared_namespaceObject.useForm)();
684
- var isForm = Boolean(form);
685
- var parentFormItem = (0,external_shared_namespaceObject.useFormItem)();
686
- var isNested = Boolean(parentFormItem);
687
- var currentInstance = (0,external_vue_namespaceObject.getCurrentInstance)();
688
- var state = (0,external_vue_namespaceObject.reactive)({
689
- isError: false,
690
- errorMessage: ''
691
- });
692
- var isFormTypeVertical = (0,external_vue_namespaceObject.computed)(function () {
693
- if (!isForm) {
694
- return false;
695
- }
696
- return form.props.formType === 'vertical';
697
- });
698
- var isShowLabel = (0,external_vue_namespaceObject.computed)(function () {
699
- if (props.label || context.slots.label) {
700
- return true;
701
- }
702
- return false;
703
- });
704
- var labelStyles = (0,external_vue_namespaceObject.computed)(function () {
705
- var styles = {
706
- width: '',
707
- paddingRight: '',
708
- textAlign: ''
709
- };
710
- var labelPosition = props.labelPosition || isForm && form.props.labelPosition;
711
- if (labelPosition) {
712
- styles['text-align'] = labelPosition;
713
- }
714
- if (form.props.formType === 'vertical' || !props.label && isNested) {
715
- return styles;
716
- }
717
- var labelWidth = isValid(props.labelWidth) ? props.labelWidth : isForm && form.props.labelWidth;
718
- if (isValid(labelWidth)) {
719
- styles.width = "".concat(labelWidth, "px");
720
- styles.paddingRight = labelWidth ? '' : '0px';
721
- }
722
- return styles;
723
- });
724
- var contentStyles = (0,external_vue_namespaceObject.computed)(function () {
725
- return _defineProperty({}, 'margin-left', labelStyles.value.width);
726
- });
727
- /**
728
- * @desc 验证字段
729
- *
730
- * @param { undefined | string } trigger 验证触发方式
731
- * @param { boolean } showError 是否展示错误信息
732
- */
733
- var validate = function validate(trigger) {
734
- var showError = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
735
- // 没有设置 property 不进行验证
736
- if (!props.property || isForm && !form.props.model) {
737
- return Promise.resolve(true);
738
- }
739
- var rules = [];
740
- // 继承 form 的验证规则
741
- if (isForm && form.props.rules && hasOwn(form.props.rules, props.property)) {
742
- rules = form.props.rules[props.property];
743
- }
744
- // form-item 自己的 rules 规则优先级更高
745
- if (props.rules) {
746
- rules = props.rules;
747
- }
748
- // 合并规则属性配置
749
- rules = getTriggerRules(trigger, mergeRules(rules, getRulesFromProps(props, t), t));
750
- // 重新触发验证重置上次的验证状态
751
- if (rules.length > 0 && showError) {
752
- state.isError = false;
753
- state.errorMessage = '';
754
- }
755
- var value = (0,external_lodash_namespaceObject.get)(form.props.model, props.property);
756
- var doValidate = function () {
757
- var stepIndex = -1;
758
- return function () {
759
- stepIndex = stepIndex + 1;
760
- // form-item 验证通过
761
- if (stepIndex >= rules.length) {
762
- form.emit('validate', props.property, true, '');
763
- return Promise.resolve(true);
764
- }
765
- var rule = rules[stepIndex];
766
- return Promise.resolve().then(function () {
767
- var result = rule.validator(value);
768
- var errorMessage = getRuleMessage(rule);
769
- // 异步验证(validator 返回一个 Promise)
770
- if (typeof result !== 'boolean' && typeof result.then === 'function') {
771
- return result.then(function (data) {
772
- // 异步验证结果为 false
773
- if (data === false) {
774
- return Promise.reject(errorMessage);
775
- }
776
- }).then(function () {
777
- return doValidate();
778
- }, function () {
779
- if (showError) {
780
- state.isError = true;
781
- state.errorMessage = errorMessage;
782
- }
783
- form.emit('validate', props.property, false, errorMessage);
784
- return Promise.reject(state.errorMessage);
785
- });
786
- }
787
- // 同步验证失败
788
- if (!result) {
789
- if (showError) {
790
- state.isError = true;
791
- // 验证结果返回的是 String 表示验证失败,返回结果作为错误信息
792
- state.errorMessage = typeof result === 'string' ? result : errorMessage;
793
- }
794
- form.emit('validate', props.property, false, errorMessage);
795
- return Promise.reject(state.errorMessage);
796
- }
797
- // 下一步
798
- return doValidate();
799
- });
800
- };
801
- }();
802
- return doValidate();
803
- };
804
- /**
805
- * @desc 清除验证状态
806
- */
807
- var clearValidate = function clearValidate() {
808
- state.isError = false;
809
- state.errorMessage = '';
810
- };
811
- (0,external_vue_namespaceObject.provide)(external_shared_namespaceObject.formItemKey, form_item_objectSpread(form_item_objectSpread({}, props), {}, {
812
- validate: validate,
813
- clearValidate: clearValidate
814
- }));
815
- (0,external_vue_namespaceObject.onMounted)(function () {
816
- if (isForm) {
817
- form.register(currentInstance.proxy);
818
- }
819
- });
820
- (0,external_vue_namespaceObject.onBeforeUnmount)(function () {
821
- if (isForm) {
822
- form.unregister(currentInstance.proxy);
823
- }
824
- });
825
- var _usePrefix = (0,external_config_provider_namespaceObject.usePrefix)(),
826
- resolveClassName = _usePrefix.resolveClassName;
827
- return form_item_objectSpread(form_item_objectSpread({}, (0,external_vue_namespaceObject.toRefs)(state)), {}, {
828
- isShowLabel: isShowLabel,
829
- labelStyles: labelStyles,
830
- contentStyles: contentStyles,
831
- isFormTypeVertical: isFormTypeVertical,
832
- validate: validate,
833
- clearValidate: clearValidate,
834
- resolveClassName: resolveClassName
835
- });
836
- },
837
- render: function render() {
838
- var _classes,
839
- _this = this,
840
- _this$$slots$labelApp,
841
- _this$$slots,
842
- _this$$slots$default,
843
- _this$$slots2;
844
- var itemClassees = (0,external_shared_namespaceObject.classes)((_classes = {}, _defineProperty(_classes, "".concat(this.resolveClassName('form-item')), true), _defineProperty(_classes, 'is-error', this.isError), _defineProperty(_classes, 'is-required', this.required), _classes));
845
- var renderLabel = function renderLabel() {
846
- if (_this.$slots.label) {
847
- return (0,external_vue_namespaceObject.createVNode)("span", null, [_this.$slots.label()]);
848
- }
849
- if (_this.description) {
850
- return (0,external_vue_namespaceObject.withDirectives)((0,external_vue_namespaceObject.createVNode)("span", {
851
- "class": _defineProperty({}, "".concat(_this.resolveClassName('form-label-description')), Boolean(_this.description))
852
- }, [_this.label]), [[(0,external_vue_namespaceObject.resolveDirective)("bk-tooltips"), _this.description]]);
853
- }
854
- return (0,external_vue_namespaceObject.createVNode)("span", null, [_this.label]);
855
- };
856
- var renderError = function renderError() {
857
- if (!_this.isError) {
858
- return null;
859
- }
860
- if (_this.errorDisplayType === 'tooltips') {
861
- return (0,external_vue_namespaceObject.withDirectives)((0,external_vue_namespaceObject.createVNode)("div", {
862
- "class": "".concat(_this.resolveClassName('form-error-tips'))
863
- }, [(0,external_vue_namespaceObject.createVNode)(external_icon_namespaceObject.ExclamationCircleShape, null, null)]), [[(0,external_vue_namespaceObject.resolveDirective)("bk-tooltips"), _this.errorMessage]]);
864
- }
865
- return (0,external_vue_namespaceObject.createVNode)("div", {
866
- "class": "".concat(_this.resolveClassName('form-error'))
867
- }, [_this.$slots.error ? _this.$slots.error(_this.errorMessage) : _this.errorMessage]);
868
- };
869
- return (0,external_vue_namespaceObject.createVNode)("div", {
870
- "class": itemClassees
871
- }, [this.isShowLabel && (0,external_vue_namespaceObject.createVNode)("div", {
872
- "class": "".concat(this.resolveClassName('form-label')),
873
- "style": this.labelStyles
874
- }, [renderLabel(), this.isFormTypeVertical && ((_this$$slots$labelApp = (_this$$slots = this.$slots).labelAppend) === null || _this$$slots$labelApp === void 0 ? void 0 : _this$$slots$labelApp.call(_this$$slots))]), (0,external_vue_namespaceObject.createVNode)("div", {
875
- "class": "".concat(this.resolveClassName('form-content')),
876
- "style": this.contentStyles
877
- }, [(_this$$slots$default = (_this$$slots2 = this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots2), renderError()])]);
878
- }
879
- }));
880
- ;// CONCATENATED MODULE: ../../packages/form/src/index.ts
881
- /*
882
- * Tencent is pleased to support the open source community by making
883
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
884
- *
885
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
886
- *
887
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
888
- *
889
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
890
- *
891
- * ---------------------------------------------------
892
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
893
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
894
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
895
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
896
- *
897
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
898
- * the Software.
899
- *
900
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
901
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
902
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
903
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
904
- * IN THE SOFTWARE.
905
- */
906
-
907
-
908
-
909
-
910
-
911
- var BkForm = (0,external_shared_namespaceObject.withInstallProps)(src_form, {
912
- FormItem: form_item,
913
- ComposeFormItem: compose_form_item
914
- });
915
- /* harmony default export */ const src = (BkForm);
916
-
917
- var __webpack_exports__BkComposeFormItem = __webpack_exports__.kq;
918
- var __webpack_exports__BkForm = __webpack_exports__.ZD;
919
- var __webpack_exports__BkFormItem = __webpack_exports__.a_;
920
- var __webpack_exports__default = __webpack_exports__.ZP;
921
- var __webpack_exports__formItemKey = __webpack_exports__.xE;
922
- var __webpack_exports__formKey = __webpack_exports__.vh;
923
- var __webpack_exports__useFormItem = __webpack_exports__.A9;
924
- export { __webpack_exports__BkComposeFormItem as BkComposeFormItem, __webpack_exports__BkForm as BkForm, __webpack_exports__BkFormItem as BkFormItem, __webpack_exports__default as default, __webpack_exports__formItemKey as formItemKey, __webpack_exports__formKey as formKey, __webpack_exports__useFormItem as useFormItem };
1
+ import*as e from"../shared";import*as r from"vue";import*as t from"../config-provider";import*as o from"lodash";import*as n from"../directives";import*as s from"../icon";var a={d:(e,r)=>{for(var t in r)a.o(r,t)&&!a.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r)},i={};a.d(i,{kq:()=>d,ZD:()=>I,a_:()=>F,ZP:()=>k,xE:()=>l.formItemKey,vh:()=>l.formKey,A9:()=>l.useFormItem});const l=(c={PropTypes:()=>e.PropTypes,classes:()=>e.classes,formItemKey:()=>e.formItemKey,formKey:()=>e.formKey,useForm:()=>e.useForm,useFormItem:()=>e.useFormItem,withInstallProps:()=>e.withInstallProps},u={},a.d(u,c),u);var c,u;const p=(e=>{var r={};return a.d(r,e),r})({computed:()=>r.computed,createVNode:()=>r.createVNode,defineComponent:()=>r.defineComponent,getCurrentInstance:()=>r.getCurrentInstance,h:()=>r.h,onBeforeUnmount:()=>r.onBeforeUnmount,onMounted:()=>r.onMounted,provide:()=>r.provide,reactive:()=>r.reactive,resolveDirective:()=>r.resolveDirective,toRefs:()=>r.toRefs,withDirectives:()=>r.withDirectives}),m=(e=>{var r={};return a.d(r,e),r})({useLocale:()=>t.useLocale,usePrefix:()=>t.usePrefix});var f=function(e){return e.__v_isVNode};const d=(0,p.defineComponent)({name:"ComposeFormItem",props:{headBackgroundColor:{type:String,default:"#FAFBFD"},tailBackgroundColor:String},setup:function(){return{resolveClassName:(0,m.usePrefix)().resolveClassName}},render:function(){if(!this.$slots.default)return null;var e=this.$slots.default();if(e.length>1){for(var r=e.length,t=0,o=null;t<r;){if(f(e[t])){o=e[t];break}t+=1}for(var n=r-1,s=null;n>=0&&n>t;){if(f(e[n])){s=e[n];break}n-=1}if(o&&s){o.props||(o.props={});var a="".concat(this.resolveClassName("compose-form-item-head"));o.props.class&&(a+=" ".concat(o.props.class)),this.headBackgroundColor&&(o.props.style=Object.assign(o.props.style||{},{"background-color":this.headBackgroundColor})),o.props.class=a,s.props||(s.props={});var i="".concat(this.resolveClassName("compose-form-item-tail"));s.props.class&&(i+=" ".concat(s.props.class)),this.tailBackgroundColor&&(s.props.style=Object.assign(s.props.style||{},{"background-color":this.tailBackgroundColor})),s.props.class=i}}return(0,p.h)("div",{class:"".concat(this.resolveClassName("compose-form-item"))},e)}});function v(e){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},v(e)}function g(e,r,t){return(r=function(e){var r=function(e,r){if("object"!==v(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var o=t.call(e,"string");if("object"!==v(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===v(r)?r:String(r)}(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}const y=(e=>{var r={};return a.d(r,e),r})({default:()=>o.default,get:()=>o.get,isBoolean:()=>o.isBoolean,isFunction:()=>o.isFunction,isString:()=>o.isString});var h={formType:l.PropTypes.oneOf(["default","vertical"]).def("default"),labelWidth:l.PropTypes.oneOfType([Number,String]).def(150),labelPosition:l.PropTypes.oneOf(["left","center","right"]),model:l.PropTypes.object,rules:l.PropTypes.object},b={submit:null,validate:function(e,r,t){return(0,y.isString)(e)&&(0,y.isBoolean)(r)&&(0,y.isString)(t)}};const P=(0,p.defineComponent)({name:"Form",props:h,emits:b,setup:function(e,r){var t=[];return(0,p.provide)(l.formKey,{props:e,emit:r.emit,register:function(e){t.push(e)},unregister:function(e){t=t.reduce((function(r,t){return t!==e&&r.push(t),r}),[])}}),{handleSubmit:function(e){e.preventDefault(),r.emit("submit")},validate:function(r){var o={};return o=r?("string"==typeof r?[r]:r).reduce((function(e,r){return Object.assign(Object.assign({},e),g({},r,!0))}),{}):t.reduce((function(e,r){return r.property?Object.assign(Object.assign({},e),g({},r.property,!0)):e}),{}),Promise.all(t.reduce((function(e,r){return o[r.property]&&e.push(r.validate()),e}),[])).then((function(){return Promise.resolve(e.model)}))},getValidateResult:function(){return Promise.all(t.map((function(e){return e.validate(void 0,!1)}))).then((function(){return!0})).catch((function(){return!1}))},clearValidate:function(e){var r={};r=e?("string"==typeof e?[e]:e).reduce((function(e,r){return Object.assign(Object.assign({},e),g({},r,!0))}),{}):t.reduce((function(e,r){return Object.assign(Object.assign({},e),g({},r.property,!0))}),{}),t.forEach((function(e){return r[e.property]&&e.clearValidate()}))},resolveClassName:(0,m.usePrefix)().resolveClassName}},render:function(){var e,r,t,o=(0,l.classes)((g(e={},"".concat(this.resolveClassName("form")),!0),g(e,"".concat(this.resolveClassName("form--".concat(this.formType))),!0),e));return(0,p.createVNode)("form",{class:o,onSubmit:this.handleSubmit},[null===(t=(r=this.$slots).default)||void 0===t?void 0:t.call(r)])}});function C(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,o=new Array(r);t<r;t++)o[t]=e[t];return o}function x(e){return function(e){if(Array.isArray(e))return C(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,r){if(e){if("string"==typeof e)return C(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?C(e,r):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const N=(e=>{var r={};return a.d(r,e),r})({bkTooltips:()=>n.bkTooltips}),T=(e=>{var r={};return a.d(r,e),r})({ExclamationCircleShape:()=>s.ExclamationCircleShape}),S={required:function(e){return!("number"!=typeof e&&"boolean"!=typeof e&&!y.default.isDate(e)&&y.default.isEmpty(e))},min:function(e,r){return e>=r},max:function(e,r){return r>=e},email:function(e){return/^[A-Za-z\d]+([-_.][A-Za-z\d]+)*@([A-Za-z\d]+[-.])+[A-Za-z\d]{2,4}$/.test(e)},maxlength:function(e,r){return e.length<=r},pattern:function(e,r){return r.test(e)}};var j={label:l.PropTypes.string,labelWidth:l.PropTypes.oneOfType([Number,String]),labelPosition:l.PropTypes.oneOf(["left","center","right"]),property:l.PropTypes.string.def(""),required:l.PropTypes.bool.def(!1),email:l.PropTypes.bool.def(!1),max:l.PropTypes.number,min:l.PropTypes.number,maxlength:l.PropTypes.number,rules:l.PropTypes.array,autoCheck:l.PropTypes.bool.def(!1),description:l.PropTypes.string,errorDisplayType:l.PropTypes.oneOf(["tooltips","normal"]).def("normal")},O=function(e){return void 0!==e};const F=(0,p.defineComponent)({name:"FormItem",directives:{bkTooltips:N.bkTooltips},props:j,setup:function(e,r){var t=(0,m.useLocale)("form"),o=(0,l.useForm)(),n=Boolean(o),s=(0,l.useFormItem)(),a=Boolean(s),i=(0,p.getCurrentInstance)(),c=(0,p.reactive)({isError:!1,errorMessage:""}),u=(0,p.computed)((function(){return!!n&&"vertical"===o.props.formType})),f=(0,p.computed)((function(){return!(!e.label&&!r.slots.label)})),d=(0,p.computed)((function(){var r={width:"",paddingRight:"",textAlign:""},t=e.labelPosition||n&&o.props.labelPosition;if(t&&(r["text-align"]=t),"vertical"===o.props.formType||!e.label&&a)return r;var s=O(e.labelWidth)?e.labelWidth:n&&o.props.labelWidth;return O(s)&&(r.width="".concat(s,"px"),r.paddingRight=s?"":"0px"),r})),v=(0,p.computed)((function(){return g({},"margin-left",d.value.width)})),h=function(r){var s=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!e.property||n&&!o.props.model)return Promise.resolve(!0);var a,i,l=[];n&&o.props.rules&&(a=o.props.rules,i=e.property,Object.prototype.hasOwnProperty.call(a,i))&&(l=o.props.rules[e.property]),e.rules&&(l=e.rules),l=function(e,r){return r.reduce((function(r,t){return t.trigger&&e?((Array.isArray(t.trigger)?t.trigger:[t.trigger]).includes(e)&&r.push(t),r):(r.push(t),r)}),[])}(r,function(e,r,t){var o=!1,n=!1,s=e.reduce((function(e,r){var s;if(r.required)s=(0,y.isFunction)(r.validator)?r.validator:S.required,o=!0;else if(r.email)s=(0,y.isFunction)(r.validator)?r.validator:S.email,n=!0;else if(Number(r.max)>-1)s=function(e){return S.max(e,r.max)};else if(Number(r.min)>-1)s=function(e){return S.min(e,r.max)};else if(Number(r.maxlength)>-1)s=function(e){return S.min(e,r.max)};else if("[object RegExp]"===Object.prototype.toString.call(r.pattern))s=function(e){return S.pattern(e,r.pattern)};else{if(!(0,y.isFunction)(r.validator))return e;s=r.validator}return e.push({validator:s,message:r.message||t.value.verifyError,trigger:r.trigger||"blur"}),e}),[]),a=r.reduce((function(e,r){return r.required&&o||r.email&&n||e.push(r),e}),[]);return[].concat(x(a),x(s))}(l,function(e,r){var t=[],o=e.label||"";return e.required&&t.push({required:!0,validator:S.required,message:"".concat(o).concat(r.value.notBeEmpty),trigger:"change"}),e.email&&t.push({email:!0,validator:S.email,message:"".concat(o).concat(r.value.incorrectFormat),trigger:"change"}),Number(e.max)>-1&&t.push({validator:function(r){return S.max(r,e.max)},message:"".concat(o).concat(r.value.max," ").concat(e.max),trigger:"change"}),Number(e.min)>-1&&t.push({validator:function(r){return S.min(r,e.min)},message:"".concat(o).concat(r.value.min," ").concat(e.min),trigger:"change"}),Number(e.maxlength)>-1&&t.push({validator:function(r){return S.maxlength(r,e.maxlength)},message:"".concat(o).concat(r.value.maxLen," ").concat(e.maxlength),trigger:"change"}),t}(e,t),t)),l.length>0&&s&&(c.isError=!1,c.errorMessage="");var u,p=(0,y.get)(o.props.model,e.property),m=(u=-1,function(){if((u+=1)>=l.length)return o.emit("validate",e.property,!0,""),Promise.resolve(!0);var r=l[u];return Promise.resolve().then((function(){var t=r.validator(p),n=function(e){return"function"==typeof e.message?e.message():e.message}(r);return"boolean"!=typeof t&&"function"==typeof t.then?t.then((function(e){if(!1===e)return Promise.reject(n)})).then((function(){return m()}),(function(){return s&&(c.isError=!0,c.errorMessage=n),o.emit("validate",e.property,!1,n),Promise.reject(c.errorMessage)})):t?m():(s&&(c.isError=!0,c.errorMessage="string"==typeof t?t:n),o.emit("validate",e.property,!1,n),Promise.reject(c.errorMessage))}))});return m()},b=function(){c.isError=!1,c.errorMessage=""};(0,p.provide)(l.formItemKey,Object.assign(Object.assign({},e),{validate:h,clearValidate:b})),(0,p.onMounted)((function(){n&&o.register(i.proxy)})),(0,p.onBeforeUnmount)((function(){n&&o.unregister(i.proxy)}));var P=(0,m.usePrefix)().resolveClassName;return Object.assign(Object.assign({},(0,p.toRefs)(c)),{isShowLabel:f,labelStyles:d,contentStyles:v,isFormTypeVertical:u,validate:h,clearValidate:b,resolveClassName:P})},render:function(){var e,r,t,o,n,s=this,a=(0,l.classes)((g(e={},"".concat(this.resolveClassName("form-item")),!0),g(e,"is-error",this.isError),g(e,"is-required",this.required),e));return(0,p.createVNode)("div",{class:a},[this.isShowLabel&&(0,p.createVNode)("div",{class:"".concat(this.resolveClassName("form-label")),style:this.labelStyles},[s.$slots.label?(0,p.createVNode)("span",null,[s.$slots.label()]):s.description?(0,p.withDirectives)((0,p.createVNode)("span",{class:g({},"".concat(s.resolveClassName("form-label-description")),Boolean(s.description))},[s.label]),[[(0,p.resolveDirective)("bk-tooltips"),s.description]]):(0,p.createVNode)("span",null,[s.label]),this.isFormTypeVertical&&(null===(t=(r=this.$slots).labelAppend)||void 0===t?void 0:t.call(r))]),(0,p.createVNode)("div",{class:"".concat(this.resolveClassName("form-content")),style:this.contentStyles},[null===(n=(o=this.$slots).default)||void 0===n?void 0:n.call(o),s.isError?"tooltips"===s.errorDisplayType?(0,p.withDirectives)((0,p.createVNode)("div",{class:"".concat(s.resolveClassName("form-error-tips"))},[(0,p.createVNode)(T.ExclamationCircleShape,null,null)]),[[(0,p.resolveDirective)("bk-tooltips"),s.errorMessage]]):(0,p.createVNode)("div",{class:"".concat(s.resolveClassName("form-error"))},[s.$slots.error?s.$slots.error(s.errorMessage):s.errorMessage]):null])])}});var I=(0,l.withInstallProps)(P,{FormItem:F,ComposeFormItem:d});const k=I;var w=i.kq,B=i.ZD,V=i.a_,E=i.ZP,A=i.xE,D=i.vh,M=i.A9;export{w as BkComposeFormItem,B as BkForm,V as BkFormItem,E as default,A as formItemKey,D as formKey,M as useFormItem};