eoss 0.1.0-alpha.20 → 0.1.0-alpha.21

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 (207) hide show
  1. package/lib/account-login.js +1943 -1890
  2. package/lib/alert.js +4 -4
  3. package/lib/aside.js +4 -4
  4. package/lib/autocomplete.js +4936 -4834
  5. package/lib/avatar.js +4 -4
  6. package/lib/backtop.js +4 -4
  7. package/lib/badge.js +4 -4
  8. package/lib/breadcrumb-item.js +6 -6
  9. package/lib/breadcrumb.js +7 -7
  10. package/lib/button-group.js +11 -14
  11. package/lib/button.js +6 -6
  12. package/lib/ca-login.js +2480 -2382
  13. package/lib/calendar.js +798 -798
  14. package/lib/card.js +4 -4
  15. package/lib/carousel-item.js +911 -813
  16. package/lib/carousel.js +1646 -1548
  17. package/lib/cascader-panel.js +2556 -2458
  18. package/lib/cascader.js +4546 -4444
  19. package/lib/checkbox-button.js +4 -4
  20. package/lib/checkbox-group.js +2894 -2841
  21. package/lib/checkbox.js +4 -4
  22. package/lib/col.js +2 -2
  23. package/lib/collapse-item.js +35159 -2572
  24. package/lib/collapse.js +35410 -2762
  25. package/lib/color-picker.js +494 -490
  26. package/lib/config/api.js +15 -1
  27. package/lib/container.js +4 -4
  28. package/lib/cron.js +4 -4
  29. package/lib/data-table.js +1895 -1842
  30. package/lib/date-picker.js +6422 -6320
  31. package/lib/dialog.js +2912 -2806
  32. package/lib/divider.js +4 -4
  33. package/lib/drawer.js +311 -299
  34. package/lib/dropdown-item.js +6 -6
  35. package/lib/dropdown-menu.js +539 -535
  36. package/lib/dropdown.js +2270 -2172
  37. package/lib/email-login.js +1783 -1730
  38. package/lib/empty.js +723 -0
  39. package/lib/eoss.common.js +63680 -56193
  40. package/lib/flip.js +4 -4
  41. package/lib/flow-group.js +2985 -2887
  42. package/lib/flow.js +28067 -28022
  43. package/lib/footer.js +4 -4
  44. package/lib/form-item.js +1935 -1837
  45. package/lib/form.js +9230 -9092
  46. package/lib/header.js +4 -4
  47. package/lib/icon.js +1708 -1590
  48. package/lib/icons.js +4 -4
  49. package/lib/image-viewer.js +1660 -1562
  50. package/lib/image.js +162 -162
  51. package/lib/index.js +1 -1
  52. package/lib/infinite-scroll.js +76 -76
  53. package/lib/input-number.js +172 -172
  54. package/lib/input.js +1362 -1264
  55. package/lib/link.js +4 -4
  56. package/lib/loading.js +321 -317
  57. package/lib/login.js +3306 -3300
  58. package/lib/lowcode.js +13320 -0
  59. package/lib/main.js +14465 -14339
  60. package/lib/marquee.js +1237 -1139
  61. package/lib/menu-item-group.js +119 -119
  62. package/lib/menu-item.js +114 -114
  63. package/lib/menu.js +6193 -6091
  64. package/lib/message-box.js +3582 -3480
  65. package/lib/message.js +2265 -2163
  66. package/lib/notification.js +2430 -2328
  67. package/lib/option-group.js +4 -4
  68. package/lib/option.js +842 -744
  69. package/lib/page-header.js +4 -4
  70. package/lib/pagination.js +1916 -1815
  71. package/lib/phone-login.js +1788 -1735
  72. package/lib/popconfirm.js +8 -8
  73. package/lib/popover.js +4559 -4457
  74. package/lib/progress.js +4 -4
  75. package/lib/qr-code.js +9 -9
  76. package/lib/qrcode-login.js +1600 -1543
  77. package/lib/radio-button.js +6 -6
  78. package/lib/radio-group.js +2142 -2089
  79. package/lib/radio.js +6 -6
  80. package/lib/rate.js +1226 -1128
  81. package/lib/row.js +2 -2
  82. package/lib/scrollbar.js +2695 -2597
  83. package/lib/select.js +5985 -5961
  84. package/lib/selector-panel.js +5239 -5186
  85. package/lib/selector.js +1712 -1659
  86. package/lib/slider.js +16 -16
  87. package/lib/step.js +35836 -2736
  88. package/lib/steps.js +1281 -1183
  89. package/lib/submenu.js +461 -457
  90. package/lib/switch.js +1010 -912
  91. package/lib/tab-pane.js +4 -4
  92. package/lib/table-column.js +2595 -2497
  93. package/lib/table.js +9225 -9239
  94. package/lib/tabs.js +2414 -2320
  95. package/lib/tag.js +4 -4
  96. package/lib/theme-chalk/account-login.css +1 -1
  97. package/lib/theme-chalk/autocomplete.css +1 -1
  98. package/lib/theme-chalk/base.css +1 -1
  99. package/lib/theme-chalk/cascader.css +1 -1
  100. package/lib/theme-chalk/date-picker.css +1 -1
  101. package/lib/theme-chalk/empty.css +1 -0
  102. package/lib/theme-chalk/fonts/iconfont.ttf +0 -0
  103. package/lib/theme-chalk/fonts/iconfont.woff +0 -0
  104. package/lib/theme-chalk/form.css +1 -1
  105. package/lib/theme-chalk/icon.css +1 -1
  106. package/lib/theme-chalk/index.css +1 -1
  107. package/lib/theme-chalk/input-number.css +1 -1
  108. package/lib/theme-chalk/input.css +1 -1
  109. package/lib/theme-chalk/login.css +1 -1
  110. package/lib/theme-chalk/lowcode.css +1 -0
  111. package/lib/theme-chalk/main.css +1 -1
  112. package/lib/theme-chalk/message-box.css +1 -1
  113. package/lib/theme-chalk/pagination.css +1 -1
  114. package/lib/theme-chalk/qrcode-login.css +1 -1
  115. package/lib/theme-chalk/select.css +1 -1
  116. package/lib/theme-chalk/slider.css +1 -1
  117. package/lib/theme-chalk/tabs.css +1 -1
  118. package/lib/theme-chalk/time-picker.css +1 -1
  119. package/lib/theme-chalk/transfer.css +1 -1
  120. package/lib/time-picker.js +5823 -5819
  121. package/lib/time-select.js +3578 -3574
  122. package/lib/timeline-item.js +4 -4
  123. package/lib/timeline.js +4 -4
  124. package/lib/tips.js +1633 -1580
  125. package/lib/toolbar.js +213 -213
  126. package/lib/tooltip.js +4441 -4339
  127. package/lib/transfer.js +938 -840
  128. package/lib/tree-group.js +1875 -1757
  129. package/lib/tree.js +2626 -2573
  130. package/lib/upload.js +7209 -7156
  131. package/lib/utils/ajax.js +185 -243
  132. package/lib/utils/bus.js +2 -2
  133. package/lib/utils/popup/index.js +5 -1
  134. package/lib/utils/util.js +108 -11
  135. package/package.json +2 -2
  136. package/packages/button/src/button-group.vue +1 -4
  137. package/packages/collapse/src/collapse-item.vue +47 -33
  138. package/packages/dialog/src/dialog.vue +4 -1
  139. package/packages/drawer/src/drawer.vue +12 -4
  140. package/packages/empty/index.js +7 -0
  141. package/packages/empty/src/img-empty.vue +132 -0
  142. package/packages/empty/src/index.vue +49 -0
  143. package/packages/form/src/form-item-render.vue +16 -18
  144. package/packages/form/src/form.vue +27 -5
  145. package/packages/icons/src/icon.json +1 -1
  146. package/packages/login/src/login.vue +19 -21
  147. package/packages/login/src/mixins.js +2 -1
  148. package/packages/lowcode/index.js +5 -0
  149. package/packages/lowcode/src/aside.vue +331 -0
  150. package/packages/lowcode/src/attribute/bind.vue +441 -0
  151. package/packages/lowcode/src/attribute/dependency.vue +325 -0
  152. package/packages/lowcode/src/attribute/function.vue +112 -0
  153. package/packages/lowcode/src/attribute/property.vue +331 -0
  154. package/packages/lowcode/src/attribute/styles.vue +318 -0
  155. package/packages/lowcode/src/attribute.vue +135 -0
  156. package/packages/lowcode/src/canvas.vue +296 -0
  157. package/packages/lowcode/src/json.vue +32 -0
  158. package/packages/lowcode/src/lowcode.vue +539 -0
  159. package/packages/lowcode/src/modules.vue +93 -0
  160. package/packages/lowcode/src/pages.vue +91 -0
  161. package/packages/lowcode/src/render.vue +247 -0
  162. package/packages/lowcode/src/source.vue +32 -0
  163. package/packages/lowcode/src/toolbar.vue +162 -0
  164. package/packages/main/src/components/pages.vue +28 -2
  165. package/packages/main/src/components/set-menus.vue +3 -3
  166. package/packages/main/src/components/user.vue +6 -1
  167. package/packages/main/src/early.vue +2 -2
  168. package/packages/main/src/gzw.vue +55 -61
  169. package/packages/main/src/minxs.js +113 -36
  170. package/packages/pagination/src/pager.vue +2 -2
  171. package/packages/pagination/src/pagination.js +4 -1
  172. package/packages/qrcode-login/src/qrcode-login.vue +6 -2
  173. package/packages/select/src/select.vue +28 -6
  174. package/packages/steps/src/step.vue +7 -5
  175. package/packages/tabs/src/tab-nav.vue +1 -0
  176. package/packages/tabs/src/tabs.vue +0 -2
  177. package/packages/theme-chalk/dist/fonts/iconfont.ttf +0 -0
  178. package/packages/theme-chalk/dist/fonts/iconfont.woff +0 -0
  179. package/packages/theme-chalk/gulpfile.js +3 -0
  180. package/packages/theme-chalk/src/account-login.scss +1 -0
  181. package/packages/theme-chalk/src/base.scss +1 -1
  182. package/packages/theme-chalk/src/common/var.scss +16 -0
  183. package/packages/theme-chalk/src/empty.scss +45 -0
  184. package/packages/theme-chalk/src/fonts/iconfont.ttf +0 -0
  185. package/packages/theme-chalk/src/fonts/iconfont.woff +0 -0
  186. package/packages/theme-chalk/src/form.scss +1 -8
  187. package/packages/theme-chalk/src/icon.scss +30 -1
  188. package/packages/theme-chalk/src/index.scss +2 -0
  189. package/packages/theme-chalk/src/input-number.scss +0 -4
  190. package/packages/theme-chalk/src/input.scss +9 -0
  191. package/packages/theme-chalk/src/login.scss +32 -29
  192. package/packages/theme-chalk/src/lowcode.scss +461 -0
  193. package/packages/theme-chalk/src/main.scss +28 -65
  194. package/packages/theme-chalk/src/pagination.scss +4 -55
  195. package/packages/theme-chalk/src/qrcode-login.scss +3 -1
  196. package/packages/theme-chalk/src/tabs.scss +81 -50
  197. package/src/config/api.js +13 -0
  198. package/src/index.js +17 -4
  199. package/src/utils/ajax.js +61 -65
  200. package/src/utils/bus.js +2 -2
  201. package/src/utils/popup/index.js +5 -1
  202. package/src/utils/util.js +104 -7
  203. package/lib/index_/345/211/257/346/234/254.js +0 -583
  204. package/packages/dialog copy/index.js +0 -8
  205. package/packages/dialog copy/src/dialog.vue +0 -615
  206. package/src/index_/345/211/257/346/234/254.js +0 -359
  207. /package/{packages/form/src → src/components}/field-render.vue +0 -0
package/lib/form-item.js CHANGED
@@ -82,7 +82,7 @@ module.exports =
82
82
  /******/
83
83
  /******/
84
84
  /******/ // Load entry module and return exports
85
- /******/ return __webpack_require__(__webpack_require__.s = 164);
85
+ /******/ return __webpack_require__(__webpack_require__.s = 168);
86
86
  /******/ })
87
87
  /************************************************************************/
88
88
  /******/ ({
@@ -91,13 +91,13 @@ module.exports =
91
91
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
92
92
 
93
93
  "use strict";
94
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "K", function() { return noop; });
94
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "L", function() { return noop; });
95
95
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "x", function() { return hasOwn; });
96
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "U", function() { return toObject; });
96
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "V", function() { return toObject; });
97
97
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "v", function() { return getValueByPath; });
98
98
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "t", function() { return getPropByPath; });
99
99
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return generateId; });
100
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Y", function() { return valueEquals; });
100
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Z", function() { return valueEquals; });
101
101
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return escapeRegexpString; });
102
102
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return arrayFindIndex; });
103
103
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return arrayFind; });
@@ -111,12 +111,12 @@ module.exports =
111
111
  /* unused harmony export looseEqual */
112
112
  /* unused harmony export arrayEquals */
113
113
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "C", function() { return isEqual; });
114
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "M", function() { return rafThrottle; });
114
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "N", function() { return rafThrottle; });
115
115
  /* unused harmony export objToArray */
116
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "O", function() { return requestAnimationFrame; });
116
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "P", function() { return requestAnimationFrame; });
117
117
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return cancelAnimationFrame; });
118
118
  /* unused harmony export debounce */
119
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "R", function() { return throttle; });
119
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "S", function() { return throttle; });
120
120
  /* unused harmony export guid */
121
121
  /* unused harmony export uid */
122
122
  /* unused harmony export get */
@@ -150,7 +150,7 @@ module.exports =
150
150
  /* unused harmony export getValues */
151
151
  /* unused harmony export getZoom */
152
152
  /* unused harmony export getLength */
153
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "S", function() { return timestampUrl; });
153
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "T", function() { return timestampUrl; });
154
154
  /* unused harmony export hasChars */
155
155
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "y", function() { return identical; });
156
156
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "z", function() { return indexOfObj; });
@@ -159,41 +159,42 @@ module.exports =
159
159
  /* unused harmony export isFunction */
160
160
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "G", function() { return isObjectEqual; });
161
161
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "H", function() { return joinUrl; });
162
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "J", function() { return layoutWaterfall; });
162
163
  /* unused harmony export loadJs */
163
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "J", function() { return loading; });
164
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "K", function() { return loading; });
164
165
  /* unused harmony export lowerCase */
165
166
  /* unused harmony export overbrim */
166
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "L", function() { return queryParams; });
167
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "M", function() { return queryParams; });
167
168
  /* unused harmony export receiveMessage */
168
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "N", function() { return renderIcon; });
169
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "O", function() { return renderIcon; });
169
170
  /* unused harmony export replenish */
170
171
  /* unused harmony export rmbToCapital */
171
172
  /* unused harmony export setScale */
172
173
  /* unused harmony export sendMessage */
173
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "P", function() { return setFavicon; });
174
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Q", function() { return setFavicon; });
174
175
  /* unused harmony export sum */
175
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Q", function() { return startWith; });
176
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "R", function() { return startWith; });
176
177
  /* unused harmony export takeLeft */
177
178
  /* unused harmony export takeRight */
178
179
  /* unused harmony export trimWhitespace */
179
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "T", function() { return toFixed; });
180
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "U", function() { return toFixed; });
180
181
  /* unused harmony export toFunction */
181
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "V", function() { return updateTheme; });
182
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "W", function() { return updateTheme; });
182
183
  /* unused harmony export upperType */
183
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "W", function() { return urlJoinParams; });
184
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "X", function() { return uuid; });
185
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ab", function() { return watermark; });
184
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "X", function() { return urlJoinParams; });
185
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Y", function() { return uuid; });
186
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bb", function() { return watermark; });
186
187
  /* unused harmony export winTopOpen */
187
188
  /* unused harmony export confirm */
188
189
  /* unused harmony export success */
189
190
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return error; });
190
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Z", function() { return warning; });
191
- /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
191
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ab", function() { return warning; });
192
+ /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4);
192
193
  /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
193
- /* harmony import */ var _color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(12);
194
- /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(3);
195
- /* harmony import */ var _storage__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(1);
196
- /* harmony import */ var _date__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(6);
194
+ /* harmony import */ var _color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(13);
195
+ /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6);
196
+ /* harmony import */ var _storage__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(2);
197
+ /* harmony import */ var _date__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(1);
197
198
  var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
198
199
 
199
200
  var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
@@ -203,9 +204,9 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
203
204
 
204
205
 
205
206
 
206
- var _get = __webpack_require__(15);
207
- var _set = __webpack_require__(16);
208
- var _cloneDeep = __webpack_require__(17);
207
+ var _get = __webpack_require__(20);
208
+ var _set = __webpack_require__(21);
209
+ var _cloneDeep = __webpack_require__(22);
209
210
  var hasOwnProperty = Object.prototype.hasOwnProperty;
210
211
 
211
212
  // 导入date中的formatDate函数
@@ -1404,7 +1405,9 @@ var getObjectType = function getObjectType(obj) {
1404
1405
  * @return {Object|string} 参数对象或指定参数值
1405
1406
  **/
1406
1407
  var getParams = function getParams() {
1407
- var _ref5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1408
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1409
+
1410
+ var _ref5 = typeof options === 'string' ? { name: options } : options,
1408
1411
  url = _ref5.url,
1409
1412
  name = _ref5.name;
1410
1413
 
@@ -1816,10 +1819,7 @@ var indexOfObj = function indexOfObj(arry, target, key) {
1816
1819
  return _i3;
1817
1820
  }
1818
1821
  } else if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object') {
1819
- if (currentItem[currentKey] === undefined) {
1820
- throw new Error('\u5C5E\u6027' + currentKey + '\u4E0D\u5B58\u5728');
1821
- }
1822
- if (currentItem[currentKey] === target[currentKey]) {
1822
+ if (currentItem[currentKey] !== undefined && currentItem[currentKey] === target[currentKey]) {
1823
1823
  return _i3;
1824
1824
  }
1825
1825
  }
@@ -2014,7 +2014,105 @@ var joinUrl = function joinUrl(_ref8) {
2014
2014
  // 如果前缀类型无效,直接返回URL
2015
2015
  return url;
2016
2016
  };
2017
+ /**
2018
+ * layoutWaterfall
2019
+ * @desc 布布流布局计算
2020
+ * @author huangbo
2021
+ * @date 2022年5月7日
2022
+ * @param {String} url - JS文件地址
2023
+ * @param {Function} [callback] - 回调函数
2024
+ **/
2025
+ var layoutWaterfall = function layoutWaterfall(self, container, pages, columns, gap) {
2026
+ if (!container) return;
2027
+
2028
+ if (pages.length === 0) return;
2029
+
2030
+ // 获取容器实际内容宽度(减去 padding)
2031
+ var computedStyle = getComputedStyle(container);
2032
+ var paddingLeft = parseFloat(computedStyle.paddingLeft) || 0;
2033
+ var paddingRight = parseFloat(computedStyle.paddingRight) || 0;
2034
+ var paddingTop = parseFloat(computedStyle.paddingTop) || 0;
2035
+ var containerWidth = container.clientWidth - paddingLeft - paddingRight;
2036
+ if (containerWidth === 0) return;
2037
+
2038
+ // 计算每列宽度
2039
+ var columnWidth = (containerWidth - gap * (columns - 1)) / columns;
2040
+
2041
+ // 初始化每列高度数组(以 paddingTop 为起始偏移)
2042
+ var columnHeights = new Array(columns).fill(paddingTop);
2043
+
2044
+ // 遍历所有元素,分配到高度最小的列
2045
+ pages.forEach(function (item) {
2046
+ // 确保span在有效范围内
2047
+ var span = Math.max(1, Math.min(item.style ? item.style.span || item.span || 1 : item.span || 1, columns));
2048
+
2049
+ // 找到可以容纳当前元素span宽度的最小高度起始列
2050
+ var minHeight = Infinity;
2051
+ var startColumn = 0;
2052
+
2053
+ // 遍历所有可能的起始列,找到可以放置span列元素的位置
2054
+ for (var i = 0; i <= columns - span; i++) {
2055
+ // 计算当前连续span列的最大高度
2056
+ var currentMaxHeight = 0;
2057
+ for (var j = i; j < i + span; j++) {
2058
+ if (columnHeights[j] > currentMaxHeight) {
2059
+ currentMaxHeight = columnHeights[j];
2060
+ }
2061
+ }
2062
+
2063
+ // 找到最小的最大高度
2064
+ if (currentMaxHeight < minHeight) {
2065
+ minHeight = currentMaxHeight;
2066
+ startColumn = i;
2067
+ }
2068
+ }
2069
+
2070
+ // 计算元素宽度和位置
2071
+ var existingWidth = item.style && item.style.width ? parseInt(item.style.width, 10) : null;
2072
+ var hasSpan = item.style && item.style.span || item.span;
2073
+ var calculatedWidth = columnWidth * span + gap * (span - 1);
2074
+ var useCustomWidth = !hasSpan && existingWidth;
2075
+ var elementWidth = useCustomWidth ? existingWidth : calculatedWidth;
2076
+
2077
+ // 根据是否使用自定义宽度计算 left(加上 padding 偏移)
2078
+ var left = void 0;
2079
+ if (useCustomWidth) {
2080
+ // 自定义宽度:在分配的列范围内居中(取整避免亚像素)
2081
+ var columnSpaceWidth = columnWidth * span + gap * (span - 1);
2082
+ left = Math.round(paddingLeft + startColumn * columnWidth + startColumn * gap + (columnSpaceWidth - elementWidth) / 2);
2083
+ } else {
2084
+ // 标准 span 宽度:正常计算位置
2085
+ left = paddingLeft + startColumn * columnWidth + startColumn * gap;
2086
+ }
2087
+ var top = minHeight;
2017
2088
 
2089
+ // 设置元素样式(使用Vue的$set确保响应式)
2090
+ if (!item.style) {
2091
+ self.$set(item, 'style', {});
2092
+ }
2093
+ var height = item.style.height ? parseInt(item.style.height, 10) : 30;
2094
+ self.$set(item.style, 'position', 'absolute');
2095
+ self.$set(item.style, 'width', elementWidth + 'px');
2096
+ self.$set(item.style, 'height', height + 'px');
2097
+ self.$set(item.style, 'left', left + 'px');
2098
+ self.$set(item.style, 'top', top + 'px');
2099
+ if (!useCustomWidth) {
2100
+ self.$set(item.style, 'span', span);
2101
+ }
2102
+
2103
+ // 更新所有被占用列的高度
2104
+ var newHeight = top + height + gap;
2105
+ for (var _i5 = startColumn; _i5 < startColumn + span; _i5++) {
2106
+ columnHeights[_i5] = newHeight;
2107
+ }
2108
+ });
2109
+
2110
+ // 设置容器高度
2111
+ var maxHeight = Math.max.apply(Math, columnHeights);
2112
+ container.style.position = 'relative';
2113
+ container.style.height = maxHeight - gap + 'px'; // 减去最后一个间隙
2114
+ return { columnWidth: columnWidth, width: containerWidth };
2115
+ };
2018
2116
  /**
2019
2117
  * loadJs
2020
2118
  * @desc 加载JS文件
@@ -2045,7 +2143,7 @@ var loadJs = function loadJs(url, callback) {
2045
2143
  var loading = function loading() {
2046
2144
  var text = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '请求中...';
2047
2145
 
2048
- var Loading = __webpack_require__(13).default;
2146
+ var Loading = __webpack_require__(19).default;
2049
2147
  return Loading.service({
2050
2148
  text: text,
2051
2149
  spinner: 'es-icon-jiazai',
@@ -2163,8 +2261,8 @@ var renderIcon = function renderIcon(data, node, icons) {
2163
2261
  var _ref9 = data || {},
2164
2262
  attributes = _ref9.attributes;
2165
2263
 
2166
- var orgType = attributes.orgType || data.orgType;
2167
- var layerlevel = attributes.layerlevel || data.layerlevel;
2264
+ var orgType = attributes ? attributes.orgType : data.orgType;
2265
+ var layerlevel = attributes ? attributes.layerlevel : data.layerlevel;
2168
2266
  if (!orgType) return '';
2169
2267
  var key = orgType === 'org' ? layerlevel ? 'bumen' : 'gongsi' : 'bumen';
2170
2268
  if (node.level === 1 && (data.subNode || data.isParent || data.hasChildren)) {
@@ -2243,10 +2341,10 @@ var rmbToCapital = function rmbToCapital(num) {
2243
2341
  // 处理小数部分
2244
2342
  var decimalCapital = '';
2245
2343
  if (parseInt(decimalPart, 10) > 0) {
2246
- for (var _i5 = 0; _i5 < decimalPart.length; _i5++) {
2247
- var _digit = parseInt(decimalPart[_i5], 10);
2344
+ for (var _i6 = 0; _i6 < decimalPart.length; _i6++) {
2345
+ var _digit = parseInt(decimalPart[_i6], 10);
2248
2346
  if (_digit > 0) {
2249
- decimalCapital += chineseNumbers[_digit] + decimalUnits[_i5];
2347
+ decimalCapital += chineseNumbers[_digit] + decimalUnits[_i6];
2250
2348
  } else if (decimalCapital[decimalCapital.length - 1] !== chineseNumbers[0]) {
2251
2349
  decimalCapital += chineseNumbers[_digit];
2252
2350
  }
@@ -2912,1702 +3010,6 @@ var warning = function warning(content, _callback3) {
2912
3010
  /***/ 1:
2913
3011
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
2914
3012
 
2915
- "use strict";
2916
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return setStorage; });
2917
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getStorage; });
2918
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return removeStorage; });
2919
- /* unused harmony export setCookie */
2920
- /* unused harmony export getCookie */
2921
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
2922
-
2923
- /**
2924
- * setStorage
2925
- * @desc:设置本地储存数据
2926
- * @author huangbo
2927
- * @date 2022年5月7日
2928
- * @param {String|Object} [key] - 数据的名称或包含type、key、value的对象
2929
- * @param {String} [value] - 数据的值(当第一个参数为字符串时使用)
2930
- **/
2931
- var setStorage = function setStorage(key, value) {
2932
- // 解析参数,支持两种调用方式:setStorage(key, value) 和 setStorage({type, key, value})
2933
- var type = void 0,
2934
- finalKey = void 0,
2935
- finalValue = void 0;
2936
-
2937
- if ((typeof key === 'undefined' ? 'undefined' : _typeof(key)) === 'object' && key !== null) {
2938
- // 对象调用方式:setStorage({type, key, value})
2939
- type = key.type;
2940
- finalKey = key.key;
2941
- finalValue = key.value;
2942
- } else {
2943
- // 字符串调用方式:setStorage(key, value)
2944
- type = getStorage('storageType');
2945
- finalKey = key;
2946
- finalValue = value;
2947
- }
2948
-
2949
- // 使用默认存储类型如果未指定
2950
- type = type || getStorage('storageType');
2951
-
2952
- // 获取存储对象
2953
- var storage = type === 'localStorage' ? localStorage : sessionStorage;
2954
-
2955
- // 处理不同类型的key
2956
- if (typeof finalKey === 'string') {
2957
- // 单个字符串key
2958
- var storedValue = (typeof finalValue === 'undefined' ? 'undefined' : _typeof(finalValue)) === 'object' ? JSON.stringify(finalValue) : finalValue;
2959
- storage.setItem(finalKey, storedValue);
2960
- if (finalKey === 'token') {
2961
- setCookie('token', storedValue);
2962
- }
2963
- } else if (Array.isArray(finalKey)) {
2964
- // 数组key,为多个key设置同一个value
2965
- var _storedValue = (typeof finalValue === 'undefined' ? 'undefined' : _typeof(finalValue)) === 'object' ? JSON.stringify(finalValue) : finalValue;
2966
- for (var i = 0; i < finalKey.length; i++) {
2967
- storage.setItem(finalKey[i], _storedValue);
2968
- if (finalKey[i] === 'token') {
2969
- setCookie('token', _storedValue);
2970
- }
2971
- }
2972
- } else if ((typeof finalKey === 'undefined' ? 'undefined' : _typeof(finalKey)) === 'object' && finalKey !== null) {
2973
- // 对象key,对象的属性名称作为key,属性值作为value
2974
- for (var k in finalKey) {
2975
- if (Object.prototype.hasOwnProperty.call(finalKey, k)) {
2976
- var _storedValue2 = _typeof(finalKey[k]) === 'object' ? JSON.stringify(finalKey[k]) : finalKey[k];
2977
- storage.setItem(k, _storedValue2);
2978
- if (k === 'token') {
2979
- setCookie('token', _storedValue2);
2980
- }
2981
- }
2982
- }
2983
- }
2984
- };
2985
-
2986
- /**
2987
- * getStorage
2988
- * @desc:获取本地储存数据
2989
- * @author huangbo
2990
- * @date 2022年5月7日
2991
- * @param {String} [key] - 获取的名称
2992
- **/
2993
- var getStorage = function getStorage(key) {
2994
- if (key) {
2995
- var res = sessionStorage.getItem(key) || localStorage.getItem(key);
2996
- if (!res && key === 'token') {
2997
- res = getCookie('token');
2998
- }
2999
- if (key === 'host' && !res) {
3000
- res = '';
3001
- }
3002
- return res;
3003
- }
3004
- var defaults = {};
3005
- var token = sessionStorage.getItem('token') || localStorage.getItem('token') || getCookie('token');
3006
- var ssId = sessionStorage.getItem('ssId') || localStorage.getItem('ssId') || getCookie('ssId');
3007
-
3008
- var deviceUnique = sessionStorage.getItem('deviceUnique') || localStorage.getItem('deviceUnique') || getCookie('deviceUnique');
3009
- if (token) {
3010
- defaults.Authorization = token;
3011
- }
3012
- if (ssId) {
3013
- defaults.ssId = ssId;
3014
- }
3015
- if (deviceUnique) {
3016
- defaults.deviceUnique = deviceUnique;
3017
- }
3018
- return defaults;
3019
- };
3020
-
3021
- /**
3022
- * removeStorage
3023
- * @desc:删除本地储存数据
3024
- * @author huangbo
3025
- * @date 2022年5月7日
3026
- * @param {String, Array} [key] - 获取的名称
3027
- **/
3028
- var removeStorage = function removeStorage(key) {
3029
- if (Array.isArray(key)) {
3030
- for (var i = 0; i < key.length; i++) {
3031
- sessionStorage.removeItem(key[i]);
3032
- localStorage.removeItem(key[i]);
3033
- if (key[i] === 'token') {
3034
- removeCookie('token');
3035
- }
3036
- }
3037
- } else if (key) {
3038
- sessionStorage.removeItem(key);
3039
- localStorage.removeItem(key);
3040
- if (key === 'token') {
3041
- removeCookie('token');
3042
- }
3043
- } else {
3044
- sessionStorage.clear();
3045
- localStorage.clear();
3046
- removeCookie('token');
3047
- }
3048
- };
3049
-
3050
- /**
3051
- * setCookie
3052
- * @desc 设置cookie
3053
- * @author huangbo
3054
- * @param {string} [name] cookie名称
3055
- * @param {string} [value] cookie值
3056
- * @param {boolean} [isSession] 是否是会话cookie
3057
- **/
3058
- var setCookie = function setCookie(name, value) {
3059
- var isSession = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
3060
- var time = arguments[3];
3061
-
3062
- try {
3063
- var cookieParts = [encodeURIComponent(name) + '=' + encodeURIComponent(value), 'path=/' // 仅保留path设置,确保全站访问
3064
- ];
3065
- // 会话/持久Cookie设置
3066
- if (!isSession) {
3067
- if (/MSIE|Trident/.test(navigator.userAgent)) {
3068
- // IE使用expires
3069
- var date = new Date();
3070
- date.setTime(date.getTime() + (time || 7 * 24 * 60 * 60 * 1000));
3071
- cookieParts.push('expires=' + date.toUTCString());
3072
- } else {
3073
- // 其他浏览器使用max-age
3074
- cookieParts.push('max-age=' + (time || 7 * 24 * 60 * 60));
3075
- }
3076
- }
3077
- // 内核兼容处理
3078
- if (/MSIE|Trident/.test(navigator.userAgent)) {
3079
- // IE特殊处理:添加P3P协议头
3080
- cookieParts.push('P3P=CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"');
3081
- } else {
3082
- // 现代浏览器设置
3083
- cookieParts.push('samesite=lax');
3084
- if (window.location.protocol === 'https:') {
3085
- cookieParts.push('secure');
3086
- }
3087
- }
3088
-
3089
- // 设置Cookie
3090
- document.cookie = cookieParts.join('; ');
3091
- return true;
3092
- } catch (e) {
3093
- console.error('Cookie设置失败:', e);
3094
- return false;
3095
- }
3096
- };
3097
-
3098
- /**
3099
- * getCookie
3100
- * @desc 获取cookie中指定名称的值
3101
- * @author huangbo
3102
- * @param {string} [name] cookie名称
3103
- **/
3104
- var getCookie = function getCookie(name) {
3105
- var cookies = document.cookie.split(';');
3106
- for (var _iterator = cookies, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
3107
- var _ref;
3108
-
3109
- if (_isArray) {
3110
- if (_i >= _iterator.length) break;
3111
- _ref = _iterator[_i++];
3112
- } else {
3113
- _i = _iterator.next();
3114
- if (_i.done) break;
3115
- _ref = _i.value;
3116
- }
3117
-
3118
- var cookie = _ref;
3119
-
3120
- var _cookie$trim$split = cookie.trim().split('='),
3121
- cookieName = _cookie$trim$split[0],
3122
- cookieValue = _cookie$trim$split[1];
3123
-
3124
- if (decodeURIComponent(cookieName) === name) {
3125
- return decodeURIComponent(cookieValue);
3126
- }
3127
- }
3128
- return null;
3129
- };
3130
-
3131
- /**
3132
- * removeCookie
3133
- * @desc:删除cookie
3134
- * @author huangbo
3135
- * @date 2022年5月7日
3136
- * @param {String, Array} [key] - 获取的名称
3137
- **/
3138
- var removeCookie = function removeCookie(key) {
3139
- if (Array.isArray(key)) {
3140
- for (var i = 0; i < key.length; i++) {
3141
- document.cookie = encodeURIComponent(key[i]) + '=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;';
3142
- }
3143
- } else {
3144
- document.cookie = encodeURIComponent(key) + '=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;';
3145
- }
3146
- };
3147
-
3148
- /***/ }),
3149
-
3150
- /***/ 10:
3151
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
3152
-
3153
- "use strict";
3154
- function _broadcast(componentName, eventName, params) {
3155
- this.$children.forEach(function (child) {
3156
- var name = child.$options.componentName;
3157
-
3158
- if (name === componentName) {
3159
- child.$emit.apply(child, [eventName].concat(params));
3160
- } else {
3161
- _broadcast.apply(child, [componentName, eventName].concat([params]));
3162
- }
3163
- });
3164
- }
3165
- /* harmony default export */ __webpack_exports__["a"] = ({
3166
- methods: {
3167
- dispatch: function dispatch(componentName, eventName, params) {
3168
- var parent = this.$parent || this.$root;
3169
- var name = parent.$options.componentName;
3170
-
3171
- while (parent && (!name || name !== componentName)) {
3172
- parent = parent.$parent;
3173
-
3174
- if (parent) {
3175
- name = parent.$options.componentName;
3176
- }
3177
- }
3178
- if (parent) {
3179
- parent.$emit.apply(parent, [eventName].concat(params));
3180
- }
3181
- },
3182
- broadcast: function broadcast(componentName, eventName, params) {
3183
- _broadcast.call(this, componentName, eventName, params);
3184
- }
3185
- }
3186
- });
3187
-
3188
- /***/ }),
3189
-
3190
- /***/ 102:
3191
- /***/ (function(module, exports) {
3192
-
3193
- module.exports = require("async-validator");
3194
-
3195
- /***/ }),
3196
-
3197
- /***/ 12:
3198
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
3199
-
3200
- "use strict";
3201
- /* unused harmony export getHue */
3202
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getColor; });
3203
- /* unused harmony export getLightness */
3204
- /* unused harmony export getSaturation */
3205
- /* unused harmony export rgbToHsv */
3206
- /* unused harmony export hsvTorgb */
3207
- /* unused harmony export mixColor */
3208
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getRgb; });
3209
- /* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
3210
-
3211
- var $hueStep = 2;
3212
- var $saturationStep1 = 0.16;
3213
- var $saturationStep2 = 0.05;
3214
- var $brightnessStep1 = 0.05;
3215
- var $brightnessStep2 = 0.15;
3216
- var $lightColorCount = 5;
3217
- var $darkColorCount = 4;
3218
- /**
3219
- * getHue
3220
- * @desc:转换色相
3221
- * @author huangbo
3222
- * @date 2022年5月7日
3223
- **/
3224
- var getHue = function getHue($h, $i, $isLight) {
3225
- var $hue = void 0;
3226
- if ($h >= 60 && $h <= 240) {
3227
- $hue = $isLight ? $h - $hueStep * $i : $h + $hueStep * $i;
3228
- } else {
3229
- $hue = $isLight ? $h + $hueStep * $i : $h - $hueStep * $i;
3230
- }
3231
- $hue = ($hue + 360) % 360;
3232
- return Math.round($hue);
3233
- };
3234
-
3235
- /**
3236
- * getColor
3237
- * @desc:根据颜色和对应的色板位置,计算出对应的色板颜色
3238
- * @author huangbo
3239
- * @date 2022年5月7日
3240
- **/
3241
- var getColor = function getColor($color, $n) {
3242
- var $isLight = $n < 7;
3243
- var $hsv = rgbToHsv($color);
3244
- // 这里将i转换成以主色为中心,两侧的i值逐渐增大
3245
- var $i = $isLight ? $lightColorCount + 1 - $n : $n - $lightColorCount - 1;
3246
- var color = hsvTorgb(getHue($hsv[0], $i, $isLight), getSaturation($hsv[1], $i, $isLight), getLightness($hsv[2], $i, $isLight));
3247
- return color;
3248
- };
3249
-
3250
- /**
3251
- * getLightness
3252
- * @desc:转换明度
3253
- * @author huangbo
3254
- * @date 2022年5月7日
3255
- * @return {string,array} 元素类名或者id
3256
- **/
3257
- var getLightness = function getLightness($v, $i, $isLight) {
3258
- var $value = $isLight ? $v + $brightnessStep1 * $i : $v - $brightnessStep2 * $i;
3259
- $value = $value < 1 ? $value : 1;
3260
- return Object(_util__WEBPACK_IMPORTED_MODULE_0__[/* toFixed */ "T"])($value, 2);
3261
- };
3262
-
3263
- /**
3264
- * getSaturation
3265
- * @desc:转换饱和度
3266
- * @author huangbo
3267
- * @date 2022年5月7日
3268
- **/
3269
- var getSaturation = function getSaturation($s, $i, $isLight) {
3270
- var $saturation = void 0;
3271
- if ($isLight) {
3272
- $saturation = $s - $saturationStep1 * $i;
3273
- } else if ($i === $darkColorCount) {
3274
- $saturation = $s + $saturationStep1;
3275
- } else {
3276
- $saturation = $s + $saturationStep2 * $i;
3277
- }
3278
- $saturation = $saturation < 1 ? $saturation : 1;
3279
-
3280
- if ($isLight && $i === $lightColorCount && $saturation > 0.1) {
3281
- $saturation = 0.1;
3282
- }
3283
- $saturation = $saturation > 0.06 ? $saturation : 0.06;
3284
- return Object(_util__WEBPACK_IMPORTED_MODULE_0__[/* toFixed */ "T"])($saturation, 2);
3285
- };
3286
-
3287
- /**
3288
- * rgbToHsv
3289
- * @desc:rgb转化成hsv
3290
- * @author huangbo
3291
- * @date 2022年5月7日
3292
- * @param {string} [$color] - 颜色值
3293
- **/
3294
- var rgbToHsv = function rgbToHsv($color) {
3295
- var rgb = getRgb($color);
3296
- var $red = rgb[0];
3297
- var $green = rgb[1];
3298
- var $blue = rgb[2];
3299
- var $max = Math.max($red, $green, $blue);
3300
- var $min = Math.min($red, $green, $blue);
3301
- var $diff = $max - $min;
3302
- var $h = 0;
3303
- if ($max === $min) {
3304
- $h = 0;
3305
- } else if ($max === $red) {
3306
- $h = 60 * ($green - $blue) / $diff + ($green > $blue - 1 ? 0 : 360);
3307
- } else if ($max === $green) {
3308
- $h = 60 * ($blue - $red) / $diff + 120;
3309
- } else if ($max === $blue) {
3310
- $h = 60 * ($red - $green) / $diff + 240;
3311
- }
3312
- var $s = $max === 0 ? 0 : $diff / $max;
3313
- var $v = $max / 255;
3314
- return [$h, $s, $v];
3315
- };
3316
-
3317
- /**
3318
- * hsvTorgb
3319
- * @desc:hsv转化成rgb
3320
- * @author huangbo
3321
- * @date 2022年5月7日
3322
- * @param {string} [$color] - 颜色值
3323
- **/
3324
- var hsvTorgb = function hsvTorgb($h, $s, $v) {
3325
- var $th = Math.floor($h / 60);
3326
- var $t1 = $h / 60 - $th;
3327
- var $t2 = $v * (1 - $s);
3328
- var $t3 = $v * (1 - $t1 * $s);
3329
- var $t4 = $v * (1 - (1 - $t1) * $s);
3330
- var $r = [$v, $t3, $t2, $t2, $t4, $v][$th % 6];
3331
- var $g = [$t4, $v, $v, $t3, $t2, $t2][$th % 6];
3332
- var $b = [$t2, $t2, $t4, $v, $v, $t3][$th % 6];
3333
- // return `rgb(${Math.round($r * 255)}, ${Math.round($g * 255)}, ${Math.round($b * 255)})`;
3334
- var red = Math.round($r * 255);
3335
- var green = Math.round($g * 255);
3336
- var blue = Math.round($b * 255);
3337
- red = red.toString(16);
3338
- green = green.toString(16);
3339
- blue = blue.toString(16);
3340
- red = red.length === 1 ? '0' + red : red;
3341
- green = green.length === 1 ? '0' + green : green;
3342
- blue = blue.length === 1 ? '0' + blue : blue;
3343
- return '#' + red + green + blue;
3344
- };
3345
-
3346
- /**
3347
- * mixColor
3348
- * @desc:生成混合色
3349
- * @author huangbo
3350
- * @date 2022年5月7日
3351
- * @param {string} [$color1] - 颜色值
3352
- * @param {string} [$color2] - 颜色值
3353
- * @param {string} [$n] - 百分比 0~1
3354
- **/
3355
- var mixColor = function mixColor($color1, $color2, $n) {
3356
- var rgb1 = getRgb($color1);
3357
- var rgb2 = getRgb($color2);
3358
- var r = rgb1[0] * $n + rgb2[0] * (1 - $n);
3359
- var g = rgb1[1] * $n + rgb2[1] * (1 - $n);
3360
- var b = rgb1[2] * $n + rgb2[2] * (1 - $n);
3361
- return '#' + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
3362
- };
3363
-
3364
- /**
3365
- * getRgb
3366
- * @desc:获取颜色值的rgb值
3367
- * @author huangbo
3368
- * @date 2022年5月7日
3369
- * @param {string} [$color] - 颜色值
3370
- **/
3371
- var getRgb = function getRgb($color) {
3372
- var rgb = [];
3373
- // 16进制颜色值的正则
3374
- var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
3375
- // 把颜色值变成小写
3376
- $color = $color.toLowerCase();
3377
- if (reg.test($color)) {
3378
- // 如果只有三位的值,需变成六位,如:#fff => #ffffff
3379
- if ($color.length === 4) {
3380
- var colorNew = '#';
3381
- for (var i = 1; i < 4; i++) {
3382
- colorNew += $color.slice(i, i + 1).concat($color.slice(i, i + 1));
3383
- }
3384
- $color = colorNew;
3385
- }
3386
- // 处理六位的颜色值,转为RGB
3387
- for (var _i = 1; _i < 7; _i += 2) {
3388
- rgb.push(parseInt('0x' + $color.slice(_i, _i + 2), 16));
3389
- }
3390
- } else {
3391
- rgb = $color.replace(/(?:\(|\)|rgb|RGB)*/g, '').split(',');
3392
- }
3393
- return rgb;
3394
- };
3395
-
3396
- /***/ }),
3397
-
3398
- /***/ 13:
3399
- /***/ (function(module, exports) {
3400
-
3401
- module.exports = require("eoss/lib/loading");
3402
-
3403
- /***/ }),
3404
-
3405
- /***/ 15:
3406
- /***/ (function(module, exports) {
3407
-
3408
- module.exports = require("lodash/get");
3409
-
3410
- /***/ }),
3411
-
3412
- /***/ 16:
3413
- /***/ (function(module, exports) {
3414
-
3415
- module.exports = require("lodash/set");
3416
-
3417
- /***/ }),
3418
-
3419
- /***/ 164:
3420
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
3421
-
3422
- "use strict";
3423
- // ESM COMPAT FLAG
3424
- __webpack_require__.r(__webpack_exports__);
3425
-
3426
- // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/form/src/form-item.vue?vue&type=template&id=3f3640aa&
3427
- var render = function () {
3428
- var _vm = this
3429
- var _h = _vm.$createElement
3430
- var _c = _vm._self._c || _h
3431
- return _c(
3432
- "div",
3433
- {
3434
- staticClass: "es-form-item",
3435
- class: [
3436
- {
3437
- "es-form-item--feedback": _vm.esForm && _vm.esForm.statusIcon,
3438
- "is-error": _vm.validateState === "error",
3439
- "is-validating": _vm.validateState === "validating",
3440
- "is-success": _vm.validateState === "success",
3441
- "is-required": _vm.isRequired || _vm.required,
3442
- "is-no-asterisk": _vm.esForm && _vm.esForm.hideRequiredAsterisk,
3443
- "is-last": _vm.last,
3444
- },
3445
- _vm.sizeClass ? "es-form-item--" + _vm.sizeClass : "",
3446
- ],
3447
- style: _vm.itemStyle,
3448
- },
3449
- [
3450
- _vm.label || _vm.$slots.label
3451
- ? _c(
3452
- "label-wrap",
3453
- {
3454
- class: _vm.labelClass,
3455
- attrs: {
3456
- "auto-width": _vm.esForm.inline,
3457
- "update-all": _vm.esForm.labelWidth === "auto",
3458
- labelFor: _vm.labelFor,
3459
- contents: _vm.label,
3460
- },
3461
- },
3462
- [_vm.$slots.label ? _vm._t("label") : _vm._e()],
3463
- 2
3464
- )
3465
- : _vm._e(),
3466
- _c(
3467
- "div",
3468
- {
3469
- staticClass: "es-form-item__content",
3470
- class: _vm.contentClass,
3471
- style: _vm.contentStyle,
3472
- },
3473
- [
3474
- _vm._t("default"),
3475
- _c(
3476
- "transition",
3477
- { attrs: { name: "es-zoom-in-top" } },
3478
- [
3479
- _vm.validateState === "error" &&
3480
- _vm.showMessage &&
3481
- _vm.esForm.showMessage
3482
- ? _vm._t(
3483
- "error",
3484
- function () {
3485
- return [
3486
- _c(
3487
- "div",
3488
- {
3489
- staticClass: "es-form-item__error",
3490
- class: {
3491
- "es-form-item__error--inline":
3492
- typeof _vm.inlineMessage === "boolean"
3493
- ? _vm.inlineMessage
3494
- : (_vm.esForm && _vm.esForm.inlineMessage) ||
3495
- false,
3496
- },
3497
- },
3498
- [
3499
- _vm._v(
3500
- "\n " +
3501
- _vm._s(_vm.validateMessage) +
3502
- "\n "
3503
- ),
3504
- ]
3505
- ),
3506
- ]
3507
- },
3508
- { error: _vm.validateMessage }
3509
- )
3510
- : _vm._e(),
3511
- ],
3512
- 2
3513
- ),
3514
- ],
3515
- 2
3516
- ),
3517
- ],
3518
- 1
3519
- )
3520
- }
3521
- var staticRenderFns = []
3522
- render._withStripped = true
3523
-
3524
-
3525
- // CONCATENATED MODULE: ./packages/form/src/form-item.vue?vue&type=template&id=3f3640aa&
3526
-
3527
- // EXTERNAL MODULE: external "async-validator"
3528
- var external_async_validator_ = __webpack_require__(102);
3529
- var external_async_validator_default = /*#__PURE__*/__webpack_require__.n(external_async_validator_);
3530
-
3531
- // EXTERNAL MODULE: ./src/mixins/emitter.js
3532
- var emitter = __webpack_require__(10);
3533
-
3534
- // EXTERNAL MODULE: ./src/utils/merge.js
3535
- var merge = __webpack_require__(18);
3536
-
3537
- // EXTERNAL MODULE: ./src/utils/util.js
3538
- var util = __webpack_require__(0);
3539
-
3540
- // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/form/src/label-wrap.vue?vue&type=template&id=4ce8e097&
3541
- var label_wrapvue_type_template_id_4ce8e097_render = function () {
3542
- var _vm = this
3543
- var _h = _vm.$createElement
3544
- var _c = _vm._self._c || _h
3545
- return _c(
3546
- "label",
3547
- {
3548
- staticClass: "es-form-item__label",
3549
- class: _vm.labelContainerClass,
3550
- style: _vm.labelWrapStyle,
3551
- attrs: { for: _vm.labelFor },
3552
- },
3553
- [
3554
- _vm._t("prepend"),
3555
- _vm._t("default", function () {
3556
- return [
3557
- Array.isArray(_vm.contents)
3558
- ? [
3559
- _vm._l(_vm.contents, function (item, index) {
3560
- return [
3561
- item.type === "icon"
3562
- ? _c(
3563
- "es-icon",
3564
- _vm._b(
3565
- { key: item.key || item.id || "label_" + index },
3566
- "es-icon",
3567
- _vm.getProps(item, index),
3568
- false
3569
- )
3570
- )
3571
- : _vm._e(),
3572
- item.type === "tips"
3573
- ? _c(
3574
- "es-tips",
3575
- _vm._b(
3576
- { key: item.key || item.id || "label_" + index },
3577
- "es-tips",
3578
- _vm.getProps(item, index),
3579
- false
3580
- )
3581
- )
3582
- : _vm._e(),
3583
- item.type === "text"
3584
- ? _c(
3585
- "span",
3586
- { key: item.key || item.id || "label_" + index },
3587
- [
3588
- _vm._v(
3589
- "\n " +
3590
- _vm._s(item.contents) +
3591
- "\n "
3592
- ),
3593
- ]
3594
- )
3595
- : _vm._e(),
3596
- ]
3597
- }),
3598
- ]
3599
- : [_vm._v("\n " + _vm._s(_vm.contents) + "\n ")],
3600
- ]
3601
- }),
3602
- _vm._t("append"),
3603
- ],
3604
- 2
3605
- )
3606
- }
3607
- var label_wrapvue_type_template_id_4ce8e097_staticRenderFns = []
3608
- label_wrapvue_type_template_id_4ce8e097_render._withStripped = true
3609
-
3610
-
3611
- // CONCATENATED MODULE: ./packages/form/src/label-wrap.vue?vue&type=template&id=4ce8e097&
3612
-
3613
- // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/form/src/label-wrap.vue?vue&type=script&lang=js&
3614
- //
3615
- //
3616
- //
3617
- //
3618
- //
3619
- //
3620
- //
3621
- //
3622
- //
3623
- //
3624
- //
3625
- //
3626
- //
3627
- //
3628
- //
3629
- //
3630
- //
3631
- //
3632
- //
3633
- //
3634
- //
3635
- //
3636
- //
3637
- //
3638
- //
3639
- //
3640
- //
3641
- //
3642
- //
3643
- //
3644
- //
3645
- //
3646
- //
3647
- //
3648
- //
3649
- //
3650
- //
3651
- //
3652
- //
3653
- //
3654
-
3655
- /* harmony default export */ var label_wrapvue_type_script_lang_js_ = ({
3656
- name: 'LabelWrap',
3657
- componentsName: 'LabelWrap',
3658
- inheritAttrs: false,
3659
- props: {
3660
- // 标签关联的表单字段ID,确保label与form field正确关联
3661
- labelFor: String,
3662
- // 统一使用isAutoWidth来控制自动宽度计算
3663
- autoWidth: {
3664
- type: Boolean,
3665
- default: false
3666
- },
3667
- // 基本标签属性
3668
- contents: {
3669
- type: [Array, String],
3670
- default: ''
3671
- },
3672
- updateAll: Boolean
3673
- },
3674
- inject: {
3675
- esForm: {
3676
- default: ''
3677
- },
3678
- esFormItem: {
3679
- default: ''
3680
- }
3681
- },
3682
- computed: {
3683
- // 标签容器样式类
3684
- labelContainerClass: function labelContainerClass() {
3685
- return this.autoWidth ? {
3686
- 'es-form-item__label-wrap': true,
3687
- 'es-label-wrapper': true
3688
- } : {};
3689
- },
3690
-
3691
- // 标签容器样式
3692
- labelWrapStyle: function labelWrapStyle() {
3693
- // 非自动宽度模式下才设置固定宽度
3694
- if (!this.autoWidth && this.esForm && this.esForm.labelPosition !== 'top') {
3695
- var labelWidth = parseInt((this.esFormItem || {}).labelWidth || this.esForm.labelWidth || this.computedWidth, 10);
3696
- return this.$slots.default || this.contents && this.contents.length > 0 ? labelWidth ? { width: labelWidth + 'px' } : {} : { width: '0' };
3697
- }
3698
- return {};
3699
- }
3700
- },
3701
- data: function data() {
3702
- return {
3703
- computedWidth: 0,
3704
- props: new Map()
3705
- };
3706
- },
3707
-
3708
- watch: {
3709
- computedWidth: function computedWidth(val, oldVal) {
3710
- if (this.updateAll && this.esForm) {
3711
- this.esForm.registerLabelWidth(val, oldVal);
3712
- if (this.esFormItem && this.esFormItem.updateComputedLabelWidth) {
3713
- this.esFormItem.updateComputedLabelWidth(val);
3714
- }
3715
- }
3716
- }
3717
- },
3718
-
3719
- // 生命周期钩子
3720
- mounted: function mounted() {
3721
- if (this.autoWidth) {
3722
- this.updateLabelWidth('update');
3723
- }
3724
- },
3725
-
3726
- methods: {
3727
- // 获取标签宽度
3728
- getLabelWidth: function getLabelWidth() {
3729
- if (this.$el && this.$el.firstElementChild) {
3730
- var computedWidth = window.getComputedStyle(this.$el.firstElementChild).width;
3731
- return Math.ceil(parseFloat(computedWidth));
3732
- }
3733
- return 0;
3734
- },
3735
-
3736
-
3737
- // 更新标签宽度
3738
- updateLabelWidth: function updateLabelWidth() {
3739
- var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'update';
3740
-
3741
- if (this.$slots.default && this.autoWidth && this.$el && this.$el.firstElementChild) {
3742
- if (action === 'update') {
3743
- this.computedWidth = this.getLabelWidth();
3744
- } else if (action === 'remove' && this.esForm) {
3745
- this.esForm.deregisterLabelWidth(this.computedWidth);
3746
- }
3747
- }
3748
- },
3749
- getProps: function getProps(item, index) {
3750
- var key = item.key || item.id || 'label_' + index;
3751
- if (this.props.has(key)) {
3752
- return this.props.get(key);
3753
- }
3754
- var props = {};
3755
- Object.keys(item).forEach(function (key) {
3756
- if (key !== 'type') {
3757
- props[key] = item[key];
3758
- }
3759
- });
3760
- this.props.set(key, props);
3761
- return props;
3762
- }
3763
- },
3764
-
3765
- updated: function updated() {
3766
- if (this.autoWidth) {
3767
- this.updateLabelWidth('update');
3768
- }
3769
- },
3770
- beforeDestroy: function beforeDestroy() {
3771
- if (this.autoWidth && this.esForm) {
3772
- this.updateLabelWidth('remove');
3773
- }
3774
- }
3775
- });
3776
- // CONCATENATED MODULE: ./packages/form/src/label-wrap.vue?vue&type=script&lang=js&
3777
- /* harmony default export */ var src_label_wrapvue_type_script_lang_js_ = (label_wrapvue_type_script_lang_js_);
3778
- // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
3779
- var componentNormalizer = __webpack_require__(5);
3780
-
3781
- // CONCATENATED MODULE: ./packages/form/src/label-wrap.vue
3782
-
3783
-
3784
-
3785
-
3786
-
3787
- /* normalize component */
3788
-
3789
- var component = Object(componentNormalizer["a" /* default */])(
3790
- src_label_wrapvue_type_script_lang_js_,
3791
- label_wrapvue_type_template_id_4ce8e097_render,
3792
- label_wrapvue_type_template_id_4ce8e097_staticRenderFns,
3793
- false,
3794
- null,
3795
- null,
3796
- null
3797
-
3798
- )
3799
-
3800
- /* harmony default export */ var label_wrap = (component.exports);
3801
- // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/form/src/form-item.vue?vue&type=script&lang=js&
3802
- //
3803
- //
3804
- //
3805
- //
3806
- //
3807
- //
3808
- //
3809
- //
3810
- //
3811
- //
3812
- //
3813
- //
3814
- //
3815
- //
3816
- //
3817
- //
3818
- //
3819
- //
3820
- //
3821
- //
3822
- //
3823
- //
3824
- //
3825
- //
3826
- //
3827
- //
3828
- //
3829
- //
3830
- //
3831
- //
3832
- //
3833
- //
3834
- //
3835
- //
3836
- //
3837
- //
3838
- //
3839
- //
3840
- //
3841
- //
3842
- //
3843
- //
3844
- //
3845
- //
3846
- //
3847
- //
3848
- //
3849
- //
3850
- //
3851
- //
3852
- //
3853
- //
3854
- //
3855
- //
3856
- //
3857
-
3858
-
3859
-
3860
-
3861
-
3862
-
3863
-
3864
- // 防抖函数,优化频繁触发的验证
3865
- function debounce(fn) {
3866
- var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 100;
3867
-
3868
- var timer = null;
3869
- return function () {
3870
- var _this = this;
3871
-
3872
- for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
3873
- args[_key] = arguments[_key];
3874
- }
3875
-
3876
- if (timer) clearTimeout(timer);
3877
- timer = setTimeout(function () {
3878
- fn.apply(_this, args);
3879
- }, delay);
3880
- };
3881
- }
3882
-
3883
- /**
3884
- * 表单项组件
3885
- * 功能说明:用于表单中的单个表单项,支持标签展示、验证信息显示等功能
3886
- * 适用场景:表单中的各种输入控件、选择器等表单项
3887
- */
3888
- /* harmony default export */ var form_itemvue_type_script_lang_js_ = ({
3889
- name: 'EsFormItem',
3890
-
3891
- componentName: 'EsFormItem',
3892
-
3893
- mixins: [emitter["a" /* default */]],
3894
-
3895
- provide: function provide() {
3896
- return {
3897
- esFormItem: this
3898
- };
3899
- },
3900
-
3901
-
3902
- inject: {
3903
- esForm: {
3904
- default: ''
3905
- }
3906
- },
3907
-
3908
- props: {
3909
- /**
3910
- * 标签文本
3911
- */
3912
- label: [String, Array],
3913
- /**
3914
- * 标签宽度
3915
- */
3916
- labelWidth: String,
3917
- /**
3918
- * 字段名,用于表单验证和数据绑定
3919
- */
3920
- prop: String,
3921
- /**
3922
- * 字段名称
3923
- */
3924
- name: String,
3925
- /**
3926
- * 索引值
3927
- */
3928
- index: Number,
3929
- /**
3930
- * 是否必填
3931
- */
3932
- required: {
3933
- type: Boolean,
3934
- default: undefined
3935
- },
3936
- /**
3937
- * 验证规则
3938
- */
3939
- rules: [Object, Array],
3940
- /**
3941
- * 错误信息
3942
- */
3943
- error: String,
3944
- /**
3945
- * 验证状态
3946
- */
3947
- validateStatus: String,
3948
- /**
3949
- * 标签关联的输入框ID
3950
- */
3951
- for: String,
3952
- /**
3953
- * 是否内联显示错误信息
3954
- */
3955
- inlineMessage: {
3956
- type: [String, Boolean],
3957
- default: ''
3958
- },
3959
- /**
3960
- * 标签样式类
3961
- */
3962
- labelClass: {
3963
- type: [String, Object, Array],
3964
- default: ''
3965
- },
3966
- /**
3967
- * 内容样式类
3968
- */
3969
- contentClass: {
3970
- type: [String, Object, Array],
3971
- default: ''
3972
- },
3973
- /**
3974
- * 是否显示验证信息
3975
- */
3976
- showMessage: {
3977
- type: Boolean,
3978
- default: true
3979
- },
3980
- /**
3981
- * 表单项大小
3982
- */
3983
- size: String,
3984
- /**
3985
- * 是否固定宽度
3986
- */
3987
- fixed: {
3988
- type: Boolean,
3989
- default: false
3990
- },
3991
- /**
3992
- * 是否内联
3993
- */
3994
- inline: Boolean,
3995
- /**
3996
- * 占比列数
3997
- */
3998
- span: {
3999
- type: Number,
4000
- validator: function validator(value) {
4001
- return value >= 1 && value <= 12;
4002
- }
4003
- },
4004
- /**
4005
- * 是否最后一个表单项
4006
- */
4007
- last: {
4008
- type: Boolean,
4009
- default: false
4010
- }
4011
- },
4012
- components: {
4013
- LabelWrap: label_wrap
4014
- },
4015
- watch: {
4016
- error: {
4017
- immediate: true,
4018
- handler: function handler(value) {
4019
- this.validateMessage = value;
4020
- this.validateState = value ? 'error' : '';
4021
- }
4022
- },
4023
- validateStatus: function validateStatus(value) {
4024
- this.validateState = value;
4025
- },
4026
-
4027
- // 监听prop变化,重新绑定事件
4028
- prop: {
4029
- immediate: false,
4030
- handler: function handler() {
4031
- if (this._hasBindEvents) {
4032
- this.removeValidateEvents();
4033
- this.addValidateEvents();
4034
- }
4035
- }
4036
- }
4037
- },
4038
- computed: {
4039
- labelFor: function labelFor() {
4040
- return this.for || this.prop || this.name;
4041
- },
4042
-
4043
- // 表单项样式
4044
- itemStyle: function itemStyle() {
4045
- if (this.esForm.inline) {
4046
- return {};
4047
- }
4048
- if (this.inline) {
4049
- return {
4050
- flex: this.span
4051
- };
4052
- }
4053
- if (this.span && this.span < 12) {
4054
- return {
4055
- width: this.span / 12 * 100 + '%'
4056
- };
4057
- }
4058
- var col = this.esForm.col;
4059
- if (col > 1) {
4060
- return {
4061
- width: 100 / col + '%'
4062
- };
4063
- }
4064
- return {};
4065
- },
4066
- contentStyle: function contentStyle() {
4067
- // 缓存form和相关配置,避免多次访问
4068
- var form = this.esForm;
4069
- var labelWidth = this.labelWidth || form.labelWidth;
4070
- var label = this.label || this.$slots.label;
4071
- // 快速路径:无需计算样式
4072
- if (!label || form.labelPosition === 'top' || form.inline) return {};
4073
- if (!this.labelWidth && this.isNested) return {};
4074
-
4075
- // 构建样式对象
4076
- var ret = {};
4077
- if (labelWidth === 'auto') {
4078
- ret.marginLeft = this.labelWidth === 'auto' ? this.computedLabelWidth : form.autoLabelWidth;
4079
- } else {
4080
- ret.marginLeft = labelWidth;
4081
- }
4082
- return ret;
4083
- },
4084
- fieldValue: function fieldValue() {
4085
- var model = this.esForm.models;
4086
- if (!model || !this.prop) {
4087
- return;
4088
- }
4089
-
4090
- var path = this.prop;
4091
- if (path.indexOf(':') !== -1) {
4092
- path = path.replace(/:/, '.');
4093
- }
4094
-
4095
- // 优化路径解析逻辑
4096
- var target = this.index === undefined ? model : this.name ? model[this.name] && model[this.name][this.index] : model[this.index];
4097
-
4098
- return target ? Object(util["t" /* getPropByPath */])(target, path, true).v : undefined;
4099
- },
4100
- isRequired: function isRequired() {
4101
- // 缓存规则计算结果
4102
- if (this._requiredCache !== undefined && !this._needUpdateRequired) {
4103
- return this._requiredCache;
4104
- }
4105
-
4106
- var rules = this.getRules();
4107
- this._requiredCache = rules && rules.length > 0 && rules.some(function (rule) {
4108
- return rule && rule.required;
4109
- });
4110
- this._needUpdateRequired = false;
4111
- return this._requiredCache;
4112
- },
4113
- esFormItemSize: function esFormItemSize() {
4114
- return this.size || this.esForm.size;
4115
- },
4116
- sizeClass: function sizeClass() {
4117
- return this.esFormItemSize || (this.$ELEMENT || {}).size;
4118
- }
4119
- },
4120
- data: function data() {
4121
- return {
4122
- validateState: '',
4123
- validateMessage: '',
4124
- validateDisabled: false,
4125
- validator: null,
4126
- isNested: false,
4127
- computedLabelWidth: '',
4128
- _hasBindEvents: false,
4129
- _formCache: null,
4130
- _requiredCache: undefined,
4131
- _needUpdateRequired: true,
4132
- // 缓存验证Promise避免重复验证
4133
- _validatePromise: null
4134
- };
4135
- },
4136
-
4137
- methods: {
4138
- // 使用防抖优化change事件的验证
4139
- onFieldChange: debounce(function () {
4140
- if (this.validateDisabled) {
4141
- this.validateDisabled = false;
4142
- return;
4143
- }
4144
- this.validate('change');
4145
- }, 100),
4146
-
4147
- validate: function validate(trigger) {
4148
- var _this2 = this;
4149
-
4150
- var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : util["K" /* noop */];
4151
-
4152
- this.validateDisabled = false;
4153
- var rules = this.getFilteredRule(trigger);
4154
- if ((!rules || rules.length === 0) && this.required === undefined) {
4155
- callback();
4156
- return true;
4157
- }
4158
-
4159
- this.validateState = 'validating';
4160
-
4161
- var descriptor = {};
4162
- if (rules && rules.length > 0) {
4163
- rules.forEach(function (rule) {
4164
- delete rule.trigger;
4165
- });
4166
- }
4167
- descriptor[this.prop] = rules;
4168
-
4169
- var validator = new external_async_validator_default.a(descriptor);
4170
- var model = {};
4171
-
4172
- model[this.prop] = this.fieldValue;
4173
- validator.validate(model, { firstFields: true }, function (errors, invalidFields) {
4174
- _this2.validateState = !errors ? 'success' : 'error';
4175
- _this2.validateMessage = errors ? errors[0].message : '';
4176
- callback(_this2.validateMessage, invalidFields, errors ? _this2.$el : null);
4177
- _this2.esForm && _this2.esForm.$emit('validate', _this2.prop, !errors, _this2.validateMessage || null, _this2.$el);
4178
- });
4179
- },
4180
- clearValidate: function clearValidate() {
4181
- // 重置验证状态
4182
- this.validateState = '';
4183
- this.validateMessage = '';
4184
- this.validateDisabled = false;
4185
- this._validatePromise = null;
4186
- },
4187
- resetField: function resetField() {
4188
- var _this3 = this;
4189
-
4190
- this.validateState = '';
4191
- this.validateMessage = '';
4192
- this._validatePromise = null;
4193
-
4194
- var model = this.esForm.models;
4195
- var path = this.prop;
4196
- if (!model || !path) return;
4197
-
4198
- // 优化对象路径访问
4199
- var normalizedPath = path;
4200
- if (path.indexOf(':') !== -1) {
4201
- normalizedPath = path.replace(/:/, '.');
4202
- }
4203
-
4204
- var prop = void 0;
4205
- try {
4206
- prop = Object(util["t" /* getPropByPath */])(model, normalizedPath, true);
4207
- } catch (error) {
4208
- console.error('获取属性路径失败:', error);
4209
- return;
4210
- }
4211
-
4212
- if (!prop.o || !prop.k) return;
4213
-
4214
- this.validateDisabled = true;
4215
- try {
4216
- if (Array.isArray(this.initialValue)) {
4217
- prop.o[prop.k] = [].concat(this.initialValue);
4218
- } else {
4219
- prop.o[prop.k] = this.initialValue;
4220
- }
4221
- } catch (error) {
4222
- console.error('重置字段值失败:', error);
4223
- }
4224
-
4225
- // reset validateDisabled after onFieldChange triggered
4226
- this.$nextTick(function () {
4227
- _this3.validateDisabled = false;
4228
- });
4229
-
4230
- // 使用try-catch避免广播失败
4231
- try {
4232
- this.broadcast('EsTimeSelect', 'fieldReset', this.initialValue);
4233
- } catch (error) {
4234
- // 忽略广播错误,不影响主要功能
4235
- }
4236
- },
4237
- getRules: function getRules() {
4238
- // 标记需要更新required状态
4239
- this._needUpdateRequired = true;
4240
-
4241
- var formRules = this.esForm.rules;
4242
- var selfRules = this.rules;
4243
-
4244
- // 构建必填规则
4245
- var requiredRule = this.required !== undefined ? [{ required: !!this.required }] : [];
4246
-
4247
- // 获取表单规则,增加空值检查
4248
- var formFieldRules = [];
4249
- if (formRules && this.prop) {
4250
- try {
4251
- var prop = Object(util["t" /* getPropByPath */])(formRules, this.prop);
4252
- formFieldRules = prop.o[this.prop] || prop.v || [];
4253
- } catch (error) {
4254
- console.warn('\u83B7\u53D6\u8868\u5355\u89C4\u5219\u5931\u8D25: ' + this.prop, error);
4255
- }
4256
- }
4257
-
4258
- // 合并规则,避免多次concat
4259
- var result = [];
4260
- if (selfRules) result.push.apply(result, Array.isArray(selfRules) ? selfRules : [selfRules]);
4261
- if (formFieldRules) result.push.apply(result, Array.isArray(formFieldRules) ? formFieldRules : [formFieldRules]);
4262
- if (requiredRule.length) result.push.apply(result, requiredRule);
4263
-
4264
- return result;
4265
- },
4266
- getFilteredRule: function getFilteredRule(trigger) {
4267
- var rules = this.getRules();
4268
-
4269
- if (!rules || rules.length === 0) {
4270
- return [];
4271
- }
4272
-
4273
- // 优化规则过滤
4274
- var filteredRules = [];
4275
- for (var i = 0; i < rules.length; i++) {
4276
- var rule = rules[i];
4277
- // 无trigger或空trigger时返回所有规则(确保直接传入rules数组时规则能被正确应用)
4278
- if (!rule.trigger || trigger === '') {
4279
- filteredRules.push(Object(merge["a" /* default */])({}, rule));
4280
- } else if (Array.isArray(rule.trigger)) {
4281
- if (rule.trigger.includes(trigger)) {
4282
- filteredRules.push(Object(merge["a" /* default */])({}, rule));
4283
- }
4284
- } else if (rule.trigger === trigger) {
4285
- filteredRules.push(Object(merge["a" /* default */])({}, rule));
4286
- }
4287
- }
4288
-
4289
- return filteredRules;
4290
- },
4291
- onFieldBlur: function onFieldBlur() {
4292
- this.validate('blur');
4293
- },
4294
- updateComputedLabelWidth: function updateComputedLabelWidth(width) {
4295
- this.computedLabelWidth = width ? width + 'px' : '';
4296
- },
4297
- addValidateEvents: function addValidateEvents() {
4298
- // 优化事件绑定,避免重复绑定
4299
- if (!this._hasBindEvents && this.prop) {
4300
- var rules = this.getRules();
4301
-
4302
- if (rules.length > 0 || this.required !== undefined) {
4303
- // 使用事件委托模式,减少事件监听器数量
4304
- this.$on('es.form.blur', this.onFieldBlur);
4305
- this.$on('es.form.change', this.onFieldChange);
4306
- this._hasBindEvents = true;
4307
- }
4308
- }
4309
- },
4310
- removeValidateEvents: function removeValidateEvents() {
4311
- // 优化事件解绑,确保清理干净
4312
- if (this._hasBindEvents) {
4313
- this.$off('es.form.blur', this.onFieldBlur);
4314
- this.$off('es.form.change', this.onFieldChange);
4315
- this._hasBindEvents = false;
4316
- }
4317
- // 避免移除所有事件,只移除我们添加的
4318
- }
4319
- },
4320
-
4321
- mounted: function mounted() {
4322
- if (this.prop) {
4323
- try {
4324
- this.dispatch('EsForm', 'es.form.addField', [this]);
4325
-
4326
- // 保存初始值
4327
- var initialValue = this.fieldValue;
4328
- if (Array.isArray(initialValue)) {
4329
- initialValue = [].concat(initialValue);
4330
- }
4331
- Object.defineProperty(this, 'initialValue', {
4332
- value: initialValue,
4333
- enumerable: false,
4334
- configurable: false
4335
- });
4336
-
4337
- this.addValidateEvents();
4338
- } catch (error) {
4339
- console.error('表单字段初始化失败:', error);
4340
- }
4341
- }
4342
- },
4343
- beforeDestroy: function beforeDestroy() {
4344
- try {
4345
- // 确保移除所有事件监听器
4346
- this.removeValidateEvents();
4347
-
4348
- // 派发移除字段事件
4349
- if (this.form) {
4350
- this.dispatch('EsForm', 'es.form.removeField', [this]);
4351
- }
4352
-
4353
- // 清理引用,帮助垃圾回收
4354
- this._formCache = null;
4355
- this.validator = null;
4356
- this._validatePromise = null;
4357
- // 避免循环引用
4358
- if (this.$parent && this.$parent.$options && this.$parent.$options.componentName === 'EsForm') {
4359
- // 清理对父组件的引用
4360
- }
4361
- } catch (error) {
4362
- console.error('表单字段销毁失败:', error);
4363
- }
4364
- }
4365
- });
4366
- // CONCATENATED MODULE: ./packages/form/src/form-item.vue?vue&type=script&lang=js&
4367
- /* harmony default export */ var src_form_itemvue_type_script_lang_js_ = (form_itemvue_type_script_lang_js_);
4368
- // CONCATENATED MODULE: ./packages/form/src/form-item.vue
4369
-
4370
-
4371
-
4372
-
4373
-
4374
- /* normalize component */
4375
-
4376
- var form_item_component = Object(componentNormalizer["a" /* default */])(
4377
- src_form_itemvue_type_script_lang_js_,
4378
- render,
4379
- staticRenderFns,
4380
- false,
4381
- null,
4382
- null,
4383
- null
4384
-
4385
- )
4386
-
4387
- /* harmony default export */ var form_item = (form_item_component.exports);
4388
- // CONCATENATED MODULE: ./packages/form-item/index.js
4389
-
4390
-
4391
- /* istanbul ignore next */
4392
- form_item.install = function (Vue) {
4393
- Vue.component(form_item.name, form_item);
4394
- };
4395
-
4396
- /* harmony default export */ var packages_form_item = __webpack_exports__["default"] = (form_item);
4397
-
4398
- /***/ }),
4399
-
4400
- /***/ 17:
4401
- /***/ (function(module, exports) {
4402
-
4403
- module.exports = require("lodash/cloneDeep");
4404
-
4405
- /***/ }),
4406
-
4407
- /***/ 18:
4408
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
4409
-
4410
- "use strict";
4411
- /* harmony default export */ __webpack_exports__["a"] = (function (target) {
4412
- for (var i = 1, j = arguments.length; i < j; i++) {
4413
- var source = arguments[i] || {};
4414
- for (var prop in source) {
4415
- if (source.hasOwnProperty(prop)) {
4416
- var value = source[prop];
4417
- if (value !== undefined) {
4418
- target[prop] = value;
4419
- }
4420
- }
4421
- }
4422
- }
4423
-
4424
- return target;
4425
- });;
4426
-
4427
- /***/ }),
4428
-
4429
- /***/ 2:
4430
- /***/ (function(module, exports) {
4431
-
4432
- module.exports = require("vue");
4433
-
4434
- /***/ }),
4435
-
4436
- /***/ 3:
4437
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
4438
-
4439
- "use strict";
4440
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return isString; });
4441
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return isObject; });
4442
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return isHtmlElement; });
4443
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return isFunction; });
4444
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return isUndefined; });
4445
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return isDefined; });
4446
- /**
4447
- * 检查一个值是否为字符串类型
4448
- * @param {*} obj 要检查的值
4449
- * @returns {boolean} 如果值为字符串则返回true,否则返回false
4450
- */
4451
- function isString(obj) {
4452
- return Object.prototype.toString.call(obj) === '[object String]';
4453
- }
4454
-
4455
- /**
4456
- * 检查一个值是否为对象类型
4457
- * @param {*} obj 要检查的值
4458
- * @returns {boolean} 如果值为对象则返回true,否则返回false
4459
- */
4460
- function isObject(obj) {
4461
- return Object.prototype.toString.call(obj) === '[object Object]';
4462
- }
4463
-
4464
- /**
4465
- * 检查一个节点是否为HTML元素
4466
- * @param {Node} node 要检查的节点
4467
- * @returns {boolean} 如果节点为HTML元素则返回true,否则返回false
4468
- */
4469
- function isHtmlElement(node) {
4470
- return node && node.nodeType === Node.ELEMENT_NODE;
4471
- }
4472
-
4473
- /**
4474
- * 检查一个值是否为函数类型
4475
- * @param {*} functionToCheck 要检查的值
4476
- * @returns {boolean} 如果值为函数则返回true,否则返回false
4477
- */
4478
- function isFunction(functionToCheck) {
4479
- var getType = {};
4480
- return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
4481
- }
4482
-
4483
- /**
4484
- * 检查一个值是否为undefined
4485
- * @param {*} val 要检查的值
4486
- * @returns {boolean} 如果值为undefined则返回true,否则返回false
4487
- */
4488
- function isUndefined(val) {
4489
- return val === void 0;
4490
- }
4491
-
4492
- /**
4493
- * 检查一个值是否已定义(不是undefined或null)
4494
- * @param {*} val 要检查的值
4495
- * @returns {boolean} 如果值已定义则返回true,否则返回false
4496
- */
4497
- function isDefined(val) {
4498
- return val !== undefined && val !== null;
4499
- }
4500
-
4501
- /***/ }),
4502
-
4503
- /***/ 5:
4504
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
4505
-
4506
- "use strict";
4507
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
4508
- /* globals __VUE_SSR_CONTEXT__ */
4509
-
4510
- // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
4511
- // This module is a runtime utility for cleaner component module output and will
4512
- // be included in the final webpack user bundle.
4513
-
4514
- function normalizeComponent(
4515
- scriptExports,
4516
- render,
4517
- staticRenderFns,
4518
- functionalTemplate,
4519
- injectStyles,
4520
- scopeId,
4521
- moduleIdentifier /* server only */,
4522
- shadowMode /* vue-cli only */
4523
- ) {
4524
- // Vue.extend constructor export interop
4525
- var options =
4526
- typeof scriptExports === 'function' ? scriptExports.options : scriptExports
4527
-
4528
- // render functions
4529
- if (render) {
4530
- options.render = render
4531
- options.staticRenderFns = staticRenderFns
4532
- options._compiled = true
4533
- }
4534
-
4535
- // functional template
4536
- if (functionalTemplate) {
4537
- options.functional = true
4538
- }
4539
-
4540
- // scopedId
4541
- if (scopeId) {
4542
- options._scopeId = 'data-v-' + scopeId
4543
- }
4544
-
4545
- var hook
4546
- if (moduleIdentifier) {
4547
- // server build
4548
- hook = function (context) {
4549
- // 2.3 injection
4550
- context =
4551
- context || // cached call
4552
- (this.$vnode && this.$vnode.ssrContext) || // stateful
4553
- (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
4554
- // 2.2 with runInNewContext: true
4555
- if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
4556
- context = __VUE_SSR_CONTEXT__
4557
- }
4558
- // inject component styles
4559
- if (injectStyles) {
4560
- injectStyles.call(this, context)
4561
- }
4562
- // register component module identifier for async chunk inferrence
4563
- if (context && context._registeredComponents) {
4564
- context._registeredComponents.add(moduleIdentifier)
4565
- }
4566
- }
4567
- // used by ssr in case component is cached and beforeCreate
4568
- // never gets called
4569
- options._ssrRegister = hook
4570
- } else if (injectStyles) {
4571
- hook = shadowMode
4572
- ? function () {
4573
- injectStyles.call(
4574
- this,
4575
- (options.functional ? this.parent : this).$root.$options.shadowRoot
4576
- )
4577
- }
4578
- : injectStyles
4579
- }
4580
-
4581
- if (hook) {
4582
- if (options.functional) {
4583
- // for template-only hot-reload because in that case the render fn doesn't
4584
- // go through the normalizer
4585
- options._injectStyles = hook
4586
- // register for functional component in vue file
4587
- var originalRender = options.render
4588
- options.render = function renderWithStyleInjection(h, context) {
4589
- hook.call(context)
4590
- return originalRender(h, context)
4591
- }
4592
- } else {
4593
- // inject component registration as beforeCreate hook
4594
- var existing = options.beforeCreate
4595
- options.beforeCreate = existing ? [].concat(existing, hook) : [hook]
4596
- }
4597
- }
4598
-
4599
- return {
4600
- exports: scriptExports,
4601
- options: options
4602
- }
4603
- }
4604
-
4605
-
4606
- /***/ }),
4607
-
4608
- /***/ 6:
4609
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
4610
-
4611
3013
  "use strict";
4612
3014
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return fecha; });
4613
3015
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return getSettings; });
@@ -5484,114 +3886,1810 @@ const getCurrentDateTime = function (format = 'YYYY-MM-DD HH:mm:ss') {
5484
3886
  };
5485
3887
 
5486
3888
  /**
5487
- * 获取小时
5488
- * @date 2022年5月7日
5489
- * @param {Date|string} [date] - 日期对象或日期字符串
5490
- * @returns {number} 小时数(0-23)
5491
- */
5492
- const getHour = function (date) {
5493
- if (!date) {
5494
- return new Date().getHours();
5495
- }
5496
- if (typeof date === 'string') {
5497
- date = new Date(date);
5498
- }
5499
- return date.getHours();
5500
- };
5501
-
3889
+ * 获取小时
3890
+ * @date 2022年5月7日
3891
+ * @param {Date|string} [date] - 日期对象或日期字符串
3892
+ * @returns {number} 小时数(0-23)
3893
+ */
3894
+ const getHour = function (date) {
3895
+ if (!date) {
3896
+ return new Date().getHours();
3897
+ }
3898
+ if (typeof date === 'string') {
3899
+ date = new Date(date);
3900
+ }
3901
+ return date.getHours();
3902
+ };
3903
+
3904
+ /**
3905
+ * 获取分钟
3906
+ * @date 2022年5月7日
3907
+ * @param {Date|string} [date] - 日期对象或日期字符串
3908
+ * @returns {number} 分钟数(0-59)
3909
+ */
3910
+ const getMinute = function (date) {
3911
+ if (!date) {
3912
+ return new Date().getMinutes();
3913
+ }
3914
+ if (typeof date === 'string') {
3915
+ date = new Date(date);
3916
+ }
3917
+ return date.getMinutes();
3918
+ };
3919
+
3920
+ /**
3921
+ * 获取月份
3922
+ * @date 2022年5月7日
3923
+ * @param {Date|string} [date] - 日期对象或日期字符串
3924
+ * @returns {number} 月份数(1-12)
3925
+ */
3926
+ const getMonth = function (date) {
3927
+ if (!date) {
3928
+ return new Date().getMonth() + 1;
3929
+ }
3930
+ if (typeof date === 'string') {
3931
+ date = new Date(date);
3932
+ }
3933
+ return date.getMonth() + 1;
3934
+ };
3935
+
3936
+ /**
3937
+ * 获取秒
3938
+ * @date 2022年5月7日
3939
+ * @param {Date|string} [date] - 日期对象或日期字符串
3940
+ * @returns {number} 秒数(0-59)
3941
+ */
3942
+ const getSecond = function (date) {
3943
+ if (!date) {
3944
+ return new Date().getSeconds();
3945
+ }
3946
+ if (typeof date === 'string') {
3947
+ date = new Date(date);
3948
+ }
3949
+ return date.getSeconds();
3950
+ };
3951
+
3952
+ /**
3953
+ * 获取星期几
3954
+ * @date 2022年5月7日
3955
+ * @param {Date|string} [date] - 日期对象或日期字符串
3956
+ * @returns {number} 星期几(0-6,0表示星期日)
3957
+ */
3958
+ const getWeekday = function (date) {
3959
+ if (!date) {
3960
+ return new Date().getDay();
3961
+ }
3962
+ if (typeof date === 'string') {
3963
+ date = new Date(date);
3964
+ }
3965
+ return date.getDay();
3966
+ };
3967
+
3968
+
3969
+ /**
3970
+ * @desc 获取上午/下午/晚上
3971
+ * @author huangbo
3972
+ * @date 2022年5月7日
3973
+ * @param {String} [time] - 时间
3974
+ **/
3975
+ const timeCycle = function (time) {
3976
+ let hour = 0;
3977
+ if (!time) {
3978
+ hour = new Date().getHours();
3979
+ } else if (typeof time === 'string') {
3980
+ // 从时间字符串中提取小时
3981
+ const match = time.match(/^(\d{1,2})/);
3982
+ if (match) {
3983
+ hour = parseInt(match[1], 10);
3984
+ }
3985
+ } else if (typeof time === 'number') {
3986
+ hour = time;
3987
+ }
3988
+ // 判断时间段
3989
+ if (hour >= 5 && hour < 12) {
3990
+ return '上午';
3991
+ } else if (hour >= 12 && hour < 18) {
3992
+ return '下午';
3993
+ } else {
3994
+ return '晚上';
3995
+ }
3996
+ };
3997
+
3998
+ /***/ }),
3999
+
4000
+ /***/ 10:
4001
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
4002
+
4003
+ "use strict";
4004
+ function _broadcast(componentName, eventName, params) {
4005
+ this.$children.forEach(function (child) {
4006
+ var name = child.$options.componentName;
4007
+
4008
+ if (name === componentName) {
4009
+ child.$emit.apply(child, [eventName].concat(params));
4010
+ } else {
4011
+ _broadcast.apply(child, [componentName, eventName].concat([params]));
4012
+ }
4013
+ });
4014
+ }
4015
+ /* harmony default export */ __webpack_exports__["a"] = ({
4016
+ methods: {
4017
+ dispatch: function dispatch(componentName, eventName, params) {
4018
+ var parent = this.$parent || this.$root;
4019
+ var name = parent.$options.componentName;
4020
+
4021
+ while (parent && (!name || name !== componentName)) {
4022
+ parent = parent.$parent;
4023
+
4024
+ if (parent) {
4025
+ name = parent.$options.componentName;
4026
+ }
4027
+ }
4028
+ if (parent) {
4029
+ parent.$emit.apply(parent, [eventName].concat(params));
4030
+ }
4031
+ },
4032
+ broadcast: function broadcast(componentName, eventName, params) {
4033
+ _broadcast.call(this, componentName, eventName, params);
4034
+ }
4035
+ }
4036
+ });
4037
+
4038
+ /***/ }),
4039
+
4040
+ /***/ 102:
4041
+ /***/ (function(module, exports) {
4042
+
4043
+ module.exports = require("async-validator");
4044
+
4045
+ /***/ }),
4046
+
4047
+ /***/ 13:
4048
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
4049
+
4050
+ "use strict";
4051
+ /* unused harmony export getHue */
4052
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getColor; });
4053
+ /* unused harmony export getLightness */
4054
+ /* unused harmony export getSaturation */
4055
+ /* unused harmony export rgbToHsv */
4056
+ /* unused harmony export hsvTorgb */
4057
+ /* unused harmony export mixColor */
4058
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getRgb; });
4059
+ /* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
4060
+
4061
+ var $hueStep = 2;
4062
+ var $saturationStep1 = 0.16;
4063
+ var $saturationStep2 = 0.05;
4064
+ var $brightnessStep1 = 0.05;
4065
+ var $brightnessStep2 = 0.15;
4066
+ var $lightColorCount = 5;
4067
+ var $darkColorCount = 4;
4068
+ /**
4069
+ * getHue
4070
+ * @desc:转换色相
4071
+ * @author huangbo
4072
+ * @date 2022年5月7日
4073
+ **/
4074
+ var getHue = function getHue($h, $i, $isLight) {
4075
+ var $hue = void 0;
4076
+ if ($h >= 60 && $h <= 240) {
4077
+ $hue = $isLight ? $h - $hueStep * $i : $h + $hueStep * $i;
4078
+ } else {
4079
+ $hue = $isLight ? $h + $hueStep * $i : $h - $hueStep * $i;
4080
+ }
4081
+ $hue = ($hue + 360) % 360;
4082
+ return Math.round($hue);
4083
+ };
4084
+
4085
+ /**
4086
+ * getColor
4087
+ * @desc:根据颜色和对应的色板位置,计算出对应的色板颜色
4088
+ * @author huangbo
4089
+ * @date 2022年5月7日
4090
+ **/
4091
+ var getColor = function getColor($color, $n) {
4092
+ var $isLight = $n < 7;
4093
+ var $hsv = rgbToHsv($color);
4094
+ // 这里将i转换成以主色为中心,两侧的i值逐渐增大
4095
+ var $i = $isLight ? $lightColorCount + 1 - $n : $n - $lightColorCount - 1;
4096
+ var color = hsvTorgb(getHue($hsv[0], $i, $isLight), getSaturation($hsv[1], $i, $isLight), getLightness($hsv[2], $i, $isLight));
4097
+ return color;
4098
+ };
4099
+
4100
+ /**
4101
+ * getLightness
4102
+ * @desc:转换明度
4103
+ * @author huangbo
4104
+ * @date 2022年5月7日
4105
+ * @return {string,array} 元素类名或者id
4106
+ **/
4107
+ var getLightness = function getLightness($v, $i, $isLight) {
4108
+ var $value = $isLight ? $v + $brightnessStep1 * $i : $v - $brightnessStep2 * $i;
4109
+ $value = $value < 1 ? $value : 1;
4110
+ return Object(_util__WEBPACK_IMPORTED_MODULE_0__[/* toFixed */ "U"])($value, 2);
4111
+ };
4112
+
4113
+ /**
4114
+ * getSaturation
4115
+ * @desc:转换饱和度
4116
+ * @author huangbo
4117
+ * @date 2022年5月7日
4118
+ **/
4119
+ var getSaturation = function getSaturation($s, $i, $isLight) {
4120
+ var $saturation = void 0;
4121
+ if ($isLight) {
4122
+ $saturation = $s - $saturationStep1 * $i;
4123
+ } else if ($i === $darkColorCount) {
4124
+ $saturation = $s + $saturationStep1;
4125
+ } else {
4126
+ $saturation = $s + $saturationStep2 * $i;
4127
+ }
4128
+ $saturation = $saturation < 1 ? $saturation : 1;
4129
+
4130
+ if ($isLight && $i === $lightColorCount && $saturation > 0.1) {
4131
+ $saturation = 0.1;
4132
+ }
4133
+ $saturation = $saturation > 0.06 ? $saturation : 0.06;
4134
+ return Object(_util__WEBPACK_IMPORTED_MODULE_0__[/* toFixed */ "U"])($saturation, 2);
4135
+ };
4136
+
4137
+ /**
4138
+ * rgbToHsv
4139
+ * @desc:rgb转化成hsv
4140
+ * @author huangbo
4141
+ * @date 2022年5月7日
4142
+ * @param {string} [$color] - 颜色值
4143
+ **/
4144
+ var rgbToHsv = function rgbToHsv($color) {
4145
+ var rgb = getRgb($color);
4146
+ var $red = rgb[0];
4147
+ var $green = rgb[1];
4148
+ var $blue = rgb[2];
4149
+ var $max = Math.max($red, $green, $blue);
4150
+ var $min = Math.min($red, $green, $blue);
4151
+ var $diff = $max - $min;
4152
+ var $h = 0;
4153
+ if ($max === $min) {
4154
+ $h = 0;
4155
+ } else if ($max === $red) {
4156
+ $h = 60 * ($green - $blue) / $diff + ($green > $blue - 1 ? 0 : 360);
4157
+ } else if ($max === $green) {
4158
+ $h = 60 * ($blue - $red) / $diff + 120;
4159
+ } else if ($max === $blue) {
4160
+ $h = 60 * ($red - $green) / $diff + 240;
4161
+ }
4162
+ var $s = $max === 0 ? 0 : $diff / $max;
4163
+ var $v = $max / 255;
4164
+ return [$h, $s, $v];
4165
+ };
4166
+
4167
+ /**
4168
+ * hsvTorgb
4169
+ * @desc:hsv转化成rgb
4170
+ * @author huangbo
4171
+ * @date 2022年5月7日
4172
+ * @param {string} [$color] - 颜色值
4173
+ **/
4174
+ var hsvTorgb = function hsvTorgb($h, $s, $v) {
4175
+ var $th = Math.floor($h / 60);
4176
+ var $t1 = $h / 60 - $th;
4177
+ var $t2 = $v * (1 - $s);
4178
+ var $t3 = $v * (1 - $t1 * $s);
4179
+ var $t4 = $v * (1 - (1 - $t1) * $s);
4180
+ var $r = [$v, $t3, $t2, $t2, $t4, $v][$th % 6];
4181
+ var $g = [$t4, $v, $v, $t3, $t2, $t2][$th % 6];
4182
+ var $b = [$t2, $t2, $t4, $v, $v, $t3][$th % 6];
4183
+ // return `rgb(${Math.round($r * 255)}, ${Math.round($g * 255)}, ${Math.round($b * 255)})`;
4184
+ var red = Math.round($r * 255);
4185
+ var green = Math.round($g * 255);
4186
+ var blue = Math.round($b * 255);
4187
+ red = red.toString(16);
4188
+ green = green.toString(16);
4189
+ blue = blue.toString(16);
4190
+ red = red.length === 1 ? '0' + red : red;
4191
+ green = green.length === 1 ? '0' + green : green;
4192
+ blue = blue.length === 1 ? '0' + blue : blue;
4193
+ return '#' + red + green + blue;
4194
+ };
4195
+
4196
+ /**
4197
+ * mixColor
4198
+ * @desc:生成混合色
4199
+ * @author huangbo
4200
+ * @date 2022年5月7日
4201
+ * @param {string} [$color1] - 颜色值
4202
+ * @param {string} [$color2] - 颜色值
4203
+ * @param {string} [$n] - 百分比 0~1
4204
+ **/
4205
+ var mixColor = function mixColor($color1, $color2, $n) {
4206
+ var rgb1 = getRgb($color1);
4207
+ var rgb2 = getRgb($color2);
4208
+ var r = rgb1[0] * $n + rgb2[0] * (1 - $n);
4209
+ var g = rgb1[1] * $n + rgb2[1] * (1 - $n);
4210
+ var b = rgb1[2] * $n + rgb2[2] * (1 - $n);
4211
+ return '#' + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
4212
+ };
4213
+
4214
+ /**
4215
+ * getRgb
4216
+ * @desc:获取颜色值的rgb值
4217
+ * @author huangbo
4218
+ * @date 2022年5月7日
4219
+ * @param {string} [$color] - 颜色值
4220
+ **/
4221
+ var getRgb = function getRgb($color) {
4222
+ var rgb = [];
4223
+ // 16进制颜色值的正则
4224
+ var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
4225
+ // 把颜色值变成小写
4226
+ $color = $color.toLowerCase();
4227
+ if (reg.test($color)) {
4228
+ // 如果只有三位的值,需变成六位,如:#fff => #ffffff
4229
+ if ($color.length === 4) {
4230
+ var colorNew = '#';
4231
+ for (var i = 1; i < 4; i++) {
4232
+ colorNew += $color.slice(i, i + 1).concat($color.slice(i, i + 1));
4233
+ }
4234
+ $color = colorNew;
4235
+ }
4236
+ // 处理六位的颜色值,转为RGB
4237
+ for (var _i = 1; _i < 7; _i += 2) {
4238
+ rgb.push(parseInt('0x' + $color.slice(_i, _i + 2), 16));
4239
+ }
4240
+ } else {
4241
+ rgb = $color.replace(/(?:\(|\)|rgb|RGB)*/g, '').split(',');
4242
+ }
4243
+ return rgb;
4244
+ };
4245
+
4246
+ /***/ }),
4247
+
4248
+ /***/ 16:
4249
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
4250
+
4251
+ "use strict";
4252
+ /* harmony default export */ __webpack_exports__["a"] = (function (target) {
4253
+ for (var i = 1, j = arguments.length; i < j; i++) {
4254
+ var source = arguments[i] || {};
4255
+ for (var prop in source) {
4256
+ if (source.hasOwnProperty(prop)) {
4257
+ var value = source[prop];
4258
+ if (value !== undefined) {
4259
+ target[prop] = value;
4260
+ }
4261
+ }
4262
+ }
4263
+ }
4264
+
4265
+ return target;
4266
+ });;
4267
+
4268
+ /***/ }),
4269
+
4270
+ /***/ 168:
4271
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
4272
+
4273
+ "use strict";
4274
+ // ESM COMPAT FLAG
4275
+ __webpack_require__.r(__webpack_exports__);
4276
+
4277
+ // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/form/src/form-item.vue?vue&type=template&id=3f3640aa&
4278
+ var render = function () {
4279
+ var _vm = this
4280
+ var _h = _vm.$createElement
4281
+ var _c = _vm._self._c || _h
4282
+ return _c(
4283
+ "div",
4284
+ {
4285
+ staticClass: "es-form-item",
4286
+ class: [
4287
+ {
4288
+ "es-form-item--feedback": _vm.esForm && _vm.esForm.statusIcon,
4289
+ "is-error": _vm.validateState === "error",
4290
+ "is-validating": _vm.validateState === "validating",
4291
+ "is-success": _vm.validateState === "success",
4292
+ "is-required": _vm.isRequired || _vm.required,
4293
+ "is-no-asterisk": _vm.esForm && _vm.esForm.hideRequiredAsterisk,
4294
+ "is-last": _vm.last,
4295
+ },
4296
+ _vm.sizeClass ? "es-form-item--" + _vm.sizeClass : "",
4297
+ ],
4298
+ style: _vm.itemStyle,
4299
+ },
4300
+ [
4301
+ _vm.label || _vm.$slots.label
4302
+ ? _c(
4303
+ "label-wrap",
4304
+ {
4305
+ class: _vm.labelClass,
4306
+ attrs: {
4307
+ "auto-width": _vm.esForm.inline,
4308
+ "update-all": _vm.esForm.labelWidth === "auto",
4309
+ labelFor: _vm.labelFor,
4310
+ contents: _vm.label,
4311
+ },
4312
+ },
4313
+ [_vm.$slots.label ? _vm._t("label") : _vm._e()],
4314
+ 2
4315
+ )
4316
+ : _vm._e(),
4317
+ _c(
4318
+ "div",
4319
+ {
4320
+ staticClass: "es-form-item__content",
4321
+ class: _vm.contentClass,
4322
+ style: _vm.contentStyle,
4323
+ },
4324
+ [
4325
+ _vm._t("default"),
4326
+ _c(
4327
+ "transition",
4328
+ { attrs: { name: "es-zoom-in-top" } },
4329
+ [
4330
+ _vm.validateState === "error" &&
4331
+ _vm.showMessage &&
4332
+ _vm.esForm.showMessage
4333
+ ? _vm._t(
4334
+ "error",
4335
+ function () {
4336
+ return [
4337
+ _c(
4338
+ "div",
4339
+ {
4340
+ staticClass: "es-form-item__error",
4341
+ class: {
4342
+ "es-form-item__error--inline":
4343
+ typeof _vm.inlineMessage === "boolean"
4344
+ ? _vm.inlineMessage
4345
+ : (_vm.esForm && _vm.esForm.inlineMessage) ||
4346
+ false,
4347
+ },
4348
+ },
4349
+ [
4350
+ _vm._v(
4351
+ "\n " +
4352
+ _vm._s(_vm.validateMessage) +
4353
+ "\n "
4354
+ ),
4355
+ ]
4356
+ ),
4357
+ ]
4358
+ },
4359
+ { error: _vm.validateMessage }
4360
+ )
4361
+ : _vm._e(),
4362
+ ],
4363
+ 2
4364
+ ),
4365
+ ],
4366
+ 2
4367
+ ),
4368
+ ],
4369
+ 1
4370
+ )
4371
+ }
4372
+ var staticRenderFns = []
4373
+ render._withStripped = true
4374
+
4375
+
4376
+ // CONCATENATED MODULE: ./packages/form/src/form-item.vue?vue&type=template&id=3f3640aa&
4377
+
4378
+ // EXTERNAL MODULE: external "async-validator"
4379
+ var external_async_validator_ = __webpack_require__(102);
4380
+ var external_async_validator_default = /*#__PURE__*/__webpack_require__.n(external_async_validator_);
4381
+
4382
+ // EXTERNAL MODULE: ./src/mixins/emitter.js
4383
+ var emitter = __webpack_require__(10);
4384
+
4385
+ // EXTERNAL MODULE: ./src/utils/merge.js
4386
+ var merge = __webpack_require__(16);
4387
+
4388
+ // EXTERNAL MODULE: ./src/utils/util.js
4389
+ var util = __webpack_require__(0);
4390
+
4391
+ // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/form/src/label-wrap.vue?vue&type=template&id=4ce8e097&
4392
+ var label_wrapvue_type_template_id_4ce8e097_render = function () {
4393
+ var _vm = this
4394
+ var _h = _vm.$createElement
4395
+ var _c = _vm._self._c || _h
4396
+ return _c(
4397
+ "label",
4398
+ {
4399
+ staticClass: "es-form-item__label",
4400
+ class: _vm.labelContainerClass,
4401
+ style: _vm.labelWrapStyle,
4402
+ attrs: { for: _vm.labelFor },
4403
+ },
4404
+ [
4405
+ _vm._t("prepend"),
4406
+ _vm._t("default", function () {
4407
+ return [
4408
+ Array.isArray(_vm.contents)
4409
+ ? [
4410
+ _vm._l(_vm.contents, function (item, index) {
4411
+ return [
4412
+ item.type === "icon"
4413
+ ? _c(
4414
+ "es-icon",
4415
+ _vm._b(
4416
+ { key: item.key || item.id || "label_" + index },
4417
+ "es-icon",
4418
+ _vm.getProps(item, index),
4419
+ false
4420
+ )
4421
+ )
4422
+ : _vm._e(),
4423
+ item.type === "tips"
4424
+ ? _c(
4425
+ "es-tips",
4426
+ _vm._b(
4427
+ { key: item.key || item.id || "label_" + index },
4428
+ "es-tips",
4429
+ _vm.getProps(item, index),
4430
+ false
4431
+ )
4432
+ )
4433
+ : _vm._e(),
4434
+ item.type === "text"
4435
+ ? _c(
4436
+ "span",
4437
+ { key: item.key || item.id || "label_" + index },
4438
+ [
4439
+ _vm._v(
4440
+ "\n " +
4441
+ _vm._s(item.contents) +
4442
+ "\n "
4443
+ ),
4444
+ ]
4445
+ )
4446
+ : _vm._e(),
4447
+ ]
4448
+ }),
4449
+ ]
4450
+ : [_vm._v("\n " + _vm._s(_vm.contents) + "\n ")],
4451
+ ]
4452
+ }),
4453
+ _vm._t("append"),
4454
+ ],
4455
+ 2
4456
+ )
4457
+ }
4458
+ var label_wrapvue_type_template_id_4ce8e097_staticRenderFns = []
4459
+ label_wrapvue_type_template_id_4ce8e097_render._withStripped = true
4460
+
4461
+
4462
+ // CONCATENATED MODULE: ./packages/form/src/label-wrap.vue?vue&type=template&id=4ce8e097&
4463
+
4464
+ // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/form/src/label-wrap.vue?vue&type=script&lang=js&
4465
+ //
4466
+ //
4467
+ //
4468
+ //
4469
+ //
4470
+ //
4471
+ //
4472
+ //
4473
+ //
4474
+ //
4475
+ //
4476
+ //
4477
+ //
4478
+ //
4479
+ //
4480
+ //
4481
+ //
4482
+ //
4483
+ //
4484
+ //
4485
+ //
4486
+ //
4487
+ //
4488
+ //
4489
+ //
4490
+ //
4491
+ //
4492
+ //
4493
+ //
4494
+ //
4495
+ //
4496
+ //
4497
+ //
4498
+ //
4499
+ //
4500
+ //
4501
+ //
4502
+ //
4503
+ //
4504
+ //
4505
+
4506
+ /* harmony default export */ var label_wrapvue_type_script_lang_js_ = ({
4507
+ name: 'LabelWrap',
4508
+ componentsName: 'LabelWrap',
4509
+ inheritAttrs: false,
4510
+ props: {
4511
+ // 标签关联的表单字段ID,确保label与form field正确关联
4512
+ labelFor: String,
4513
+ // 统一使用isAutoWidth来控制自动宽度计算
4514
+ autoWidth: {
4515
+ type: Boolean,
4516
+ default: false
4517
+ },
4518
+ // 基本标签属性
4519
+ contents: {
4520
+ type: [Array, String],
4521
+ default: ''
4522
+ },
4523
+ updateAll: Boolean
4524
+ },
4525
+ inject: {
4526
+ esForm: {
4527
+ default: ''
4528
+ },
4529
+ esFormItem: {
4530
+ default: ''
4531
+ }
4532
+ },
4533
+ computed: {
4534
+ // 标签容器样式类
4535
+ labelContainerClass: function labelContainerClass() {
4536
+ return this.autoWidth ? {
4537
+ 'es-form-item__label-wrap': true,
4538
+ 'es-label-wrapper': true
4539
+ } : {};
4540
+ },
4541
+
4542
+ // 标签容器样式
4543
+ labelWrapStyle: function labelWrapStyle() {
4544
+ // 非自动宽度模式下才设置固定宽度
4545
+ if (!this.autoWidth && this.esForm && this.esForm.labelPosition !== 'top') {
4546
+ var labelWidth = parseInt((this.esFormItem || {}).labelWidth || this.esForm.labelWidth || this.computedWidth, 10);
4547
+ return this.$slots.default || this.contents && this.contents.length > 0 ? labelWidth ? { width: labelWidth + 'px' } : {} : { width: '0' };
4548
+ }
4549
+ return {};
4550
+ }
4551
+ },
4552
+ data: function data() {
4553
+ return {
4554
+ computedWidth: 0,
4555
+ props: new Map()
4556
+ };
4557
+ },
4558
+
4559
+ watch: {
4560
+ computedWidth: function computedWidth(val, oldVal) {
4561
+ if (this.updateAll && this.esForm) {
4562
+ this.esForm.registerLabelWidth(val, oldVal);
4563
+ if (this.esFormItem && this.esFormItem.updateComputedLabelWidth) {
4564
+ this.esFormItem.updateComputedLabelWidth(val);
4565
+ }
4566
+ }
4567
+ }
4568
+ },
4569
+
4570
+ // 生命周期钩子
4571
+ mounted: function mounted() {
4572
+ if (this.autoWidth) {
4573
+ this.updateLabelWidth('update');
4574
+ }
4575
+ },
4576
+
4577
+ methods: {
4578
+ // 获取标签宽度
4579
+ getLabelWidth: function getLabelWidth() {
4580
+ if (this.$el && this.$el.firstElementChild) {
4581
+ var computedWidth = window.getComputedStyle(this.$el.firstElementChild).width;
4582
+ return Math.ceil(parseFloat(computedWidth));
4583
+ }
4584
+ return 0;
4585
+ },
4586
+
4587
+
4588
+ // 更新标签宽度
4589
+ updateLabelWidth: function updateLabelWidth() {
4590
+ var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'update';
4591
+
4592
+ if (this.$slots.default && this.autoWidth && this.$el && this.$el.firstElementChild) {
4593
+ if (action === 'update') {
4594
+ this.computedWidth = this.getLabelWidth();
4595
+ } else if (action === 'remove' && this.esForm) {
4596
+ this.esForm.deregisterLabelWidth(this.computedWidth);
4597
+ }
4598
+ }
4599
+ },
4600
+ getProps: function getProps(item, index) {
4601
+ var key = item.key || item.id || 'label_' + index;
4602
+ if (this.props.has(key)) {
4603
+ return this.props.get(key);
4604
+ }
4605
+ var props = {};
4606
+ Object.keys(item).forEach(function (key) {
4607
+ if (key !== 'type') {
4608
+ props[key] = item[key];
4609
+ }
4610
+ });
4611
+ this.props.set(key, props);
4612
+ return props;
4613
+ }
4614
+ },
4615
+
4616
+ updated: function updated() {
4617
+ if (this.autoWidth) {
4618
+ this.updateLabelWidth('update');
4619
+ }
4620
+ },
4621
+ beforeDestroy: function beforeDestroy() {
4622
+ if (this.autoWidth && this.esForm) {
4623
+ this.updateLabelWidth('remove');
4624
+ }
4625
+ }
4626
+ });
4627
+ // CONCATENATED MODULE: ./packages/form/src/label-wrap.vue?vue&type=script&lang=js&
4628
+ /* harmony default export */ var src_label_wrapvue_type_script_lang_js_ = (label_wrapvue_type_script_lang_js_);
4629
+ // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
4630
+ var componentNormalizer = __webpack_require__(3);
4631
+
4632
+ // CONCATENATED MODULE: ./packages/form/src/label-wrap.vue
4633
+
4634
+
4635
+
4636
+
4637
+
4638
+ /* normalize component */
4639
+
4640
+ var component = Object(componentNormalizer["a" /* default */])(
4641
+ src_label_wrapvue_type_script_lang_js_,
4642
+ label_wrapvue_type_template_id_4ce8e097_render,
4643
+ label_wrapvue_type_template_id_4ce8e097_staticRenderFns,
4644
+ false,
4645
+ null,
4646
+ null,
4647
+ null
4648
+
4649
+ )
4650
+
4651
+ /* harmony default export */ var label_wrap = (component.exports);
4652
+ // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/form/src/form-item.vue?vue&type=script&lang=js&
4653
+ //
4654
+ //
4655
+ //
4656
+ //
4657
+ //
4658
+ //
4659
+ //
4660
+ //
4661
+ //
4662
+ //
4663
+ //
4664
+ //
4665
+ //
4666
+ //
4667
+ //
4668
+ //
4669
+ //
4670
+ //
4671
+ //
4672
+ //
4673
+ //
4674
+ //
4675
+ //
4676
+ //
4677
+ //
4678
+ //
4679
+ //
4680
+ //
4681
+ //
4682
+ //
4683
+ //
4684
+ //
4685
+ //
4686
+ //
4687
+ //
4688
+ //
4689
+ //
4690
+ //
4691
+ //
4692
+ //
4693
+ //
4694
+ //
4695
+ //
4696
+ //
4697
+ //
4698
+ //
4699
+ //
4700
+ //
4701
+ //
4702
+ //
4703
+ //
4704
+ //
4705
+ //
4706
+ //
4707
+ //
4708
+
4709
+
4710
+
4711
+
4712
+
4713
+
4714
+
4715
+ // 防抖函数,优化频繁触发的验证
4716
+ function debounce(fn) {
4717
+ var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 100;
4718
+
4719
+ var timer = null;
4720
+ return function () {
4721
+ var _this = this;
4722
+
4723
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
4724
+ args[_key] = arguments[_key];
4725
+ }
4726
+
4727
+ if (timer) clearTimeout(timer);
4728
+ timer = setTimeout(function () {
4729
+ fn.apply(_this, args);
4730
+ }, delay);
4731
+ };
4732
+ }
4733
+
4734
+ /**
4735
+ * 表单项组件
4736
+ * 功能说明:用于表单中的单个表单项,支持标签展示、验证信息显示等功能
4737
+ * 适用场景:表单中的各种输入控件、选择器等表单项
4738
+ */
4739
+ /* harmony default export */ var form_itemvue_type_script_lang_js_ = ({
4740
+ name: 'EsFormItem',
4741
+
4742
+ componentName: 'EsFormItem',
4743
+
4744
+ mixins: [emitter["a" /* default */]],
4745
+
4746
+ provide: function provide() {
4747
+ return {
4748
+ esFormItem: this
4749
+ };
4750
+ },
4751
+
4752
+
4753
+ inject: {
4754
+ esForm: {
4755
+ default: ''
4756
+ }
4757
+ },
4758
+
4759
+ props: {
4760
+ /**
4761
+ * 标签文本
4762
+ */
4763
+ label: [String, Array],
4764
+ /**
4765
+ * 标签宽度
4766
+ */
4767
+ labelWidth: String,
4768
+ /**
4769
+ * 字段名,用于表单验证和数据绑定
4770
+ */
4771
+ prop: String,
4772
+ /**
4773
+ * 字段名称
4774
+ */
4775
+ name: String,
4776
+ /**
4777
+ * 索引值
4778
+ */
4779
+ index: Number,
4780
+ /**
4781
+ * 是否必填
4782
+ */
4783
+ required: {
4784
+ type: Boolean,
4785
+ default: undefined
4786
+ },
4787
+ /**
4788
+ * 验证规则
4789
+ */
4790
+ rules: [Object, Array],
4791
+ /**
4792
+ * 错误信息
4793
+ */
4794
+ error: String,
4795
+ /**
4796
+ * 验证状态
4797
+ */
4798
+ validateStatus: String,
4799
+ /**
4800
+ * 标签关联的输入框ID
4801
+ */
4802
+ for: String,
4803
+ /**
4804
+ * 是否内联显示错误信息
4805
+ */
4806
+ inlineMessage: {
4807
+ type: [String, Boolean],
4808
+ default: ''
4809
+ },
4810
+ /**
4811
+ * 标签样式类
4812
+ */
4813
+ labelClass: {
4814
+ type: [String, Object, Array],
4815
+ default: ''
4816
+ },
4817
+ /**
4818
+ * 内容样式类
4819
+ */
4820
+ contentClass: {
4821
+ type: [String, Object, Array],
4822
+ default: ''
4823
+ },
4824
+ /**
4825
+ * 是否显示验证信息
4826
+ */
4827
+ showMessage: {
4828
+ type: Boolean,
4829
+ default: true
4830
+ },
4831
+ /**
4832
+ * 表单项大小
4833
+ */
4834
+ size: String,
4835
+ /**
4836
+ * 是否固定宽度
4837
+ */
4838
+ fixed: {
4839
+ type: Boolean,
4840
+ default: false
4841
+ },
4842
+ /**
4843
+ * 是否内联
4844
+ */
4845
+ inline: Boolean,
4846
+ /**
4847
+ * 占比列数
4848
+ */
4849
+ span: {
4850
+ type: Number,
4851
+ validator: function validator(value) {
4852
+ return value >= 1 && value <= 12;
4853
+ }
4854
+ },
4855
+ /**
4856
+ * 是否最后一个表单项
4857
+ */
4858
+ last: {
4859
+ type: Boolean,
4860
+ default: false
4861
+ }
4862
+ },
4863
+ components: {
4864
+ LabelWrap: label_wrap
4865
+ },
4866
+ watch: {
4867
+ error: {
4868
+ immediate: true,
4869
+ handler: function handler(value) {
4870
+ this.validateMessage = value;
4871
+ this.validateState = value ? 'error' : '';
4872
+ }
4873
+ },
4874
+ validateStatus: function validateStatus(value) {
4875
+ this.validateState = value;
4876
+ },
4877
+
4878
+ // 监听prop变化,重新绑定事件
4879
+ prop: {
4880
+ immediate: false,
4881
+ handler: function handler() {
4882
+ if (this._hasBindEvents) {
4883
+ this.removeValidateEvents();
4884
+ this.addValidateEvents();
4885
+ }
4886
+ }
4887
+ }
4888
+ },
4889
+ computed: {
4890
+ labelFor: function labelFor() {
4891
+ return this.for || this.prop || this.name;
4892
+ },
4893
+
4894
+ // 表单项样式
4895
+ itemStyle: function itemStyle() {
4896
+ if (this.esForm.inline) {
4897
+ return {};
4898
+ }
4899
+ if (this.inline) {
4900
+ return {
4901
+ flex: this.span
4902
+ };
4903
+ }
4904
+ if (this.span && this.span < 12) {
4905
+ return {
4906
+ width: this.span / 12 * 100 + '%'
4907
+ };
4908
+ }
4909
+ var col = this.esForm.col;
4910
+ if (col > 1) {
4911
+ return {
4912
+ width: 100 / col + '%'
4913
+ };
4914
+ }
4915
+ return {};
4916
+ },
4917
+ contentStyle: function contentStyle() {
4918
+ // 缓存form和相关配置,避免多次访问
4919
+ var form = this.esForm;
4920
+ var labelWidth = this.labelWidth || form.labelWidth;
4921
+ var label = this.label || this.$slots.label;
4922
+ // 快速路径:无需计算样式
4923
+ if (!label || form.labelPosition === 'top' || form.inline) return {};
4924
+ if (!this.labelWidth && this.isNested) return {};
4925
+
4926
+ // 构建样式对象
4927
+ var ret = {};
4928
+ if (labelWidth === 'auto') {
4929
+ ret.marginLeft = this.labelWidth === 'auto' ? this.computedLabelWidth : form.autoLabelWidth;
4930
+ } else {
4931
+ ret.marginLeft = labelWidth;
4932
+ }
4933
+ return ret;
4934
+ },
4935
+ fieldValue: function fieldValue() {
4936
+ var model = this.esForm.models;
4937
+ if (!model || !this.prop) {
4938
+ return;
4939
+ }
4940
+
4941
+ var path = this.prop;
4942
+ if (path.indexOf(':') !== -1) {
4943
+ path = path.replace(/:/, '.');
4944
+ }
4945
+
4946
+ // 优化路径解析逻辑
4947
+ var target = this.index === undefined ? model : this.name ? model[this.name] && model[this.name][this.index] : model[this.index];
4948
+
4949
+ return target ? Object(util["t" /* getPropByPath */])(target, path, true).v : undefined;
4950
+ },
4951
+ isRequired: function isRequired() {
4952
+ // 缓存规则计算结果
4953
+ if (this._requiredCache !== undefined && !this._needUpdateRequired) {
4954
+ return this._requiredCache;
4955
+ }
4956
+
4957
+ var rules = this.getRules();
4958
+ this._requiredCache = rules && rules.length > 0 && rules.some(function (rule) {
4959
+ return rule && rule.required;
4960
+ });
4961
+ this._needUpdateRequired = false;
4962
+ return this._requiredCache;
4963
+ },
4964
+ esFormItemSize: function esFormItemSize() {
4965
+ return this.size || this.esForm.size;
4966
+ },
4967
+ sizeClass: function sizeClass() {
4968
+ return this.esFormItemSize || (this.$ELEMENT || {}).size;
4969
+ }
4970
+ },
4971
+ data: function data() {
4972
+ return {
4973
+ validateState: '',
4974
+ validateMessage: '',
4975
+ validateDisabled: false,
4976
+ validator: null,
4977
+ isNested: false,
4978
+ computedLabelWidth: '',
4979
+ _hasBindEvents: false,
4980
+ _formCache: null,
4981
+ _requiredCache: undefined,
4982
+ _needUpdateRequired: true,
4983
+ // 缓存验证Promise避免重复验证
4984
+ _validatePromise: null
4985
+ };
4986
+ },
4987
+
4988
+ methods: {
4989
+ // 使用防抖优化change事件的验证
4990
+ onFieldChange: debounce(function () {
4991
+ if (this.validateDisabled) {
4992
+ this.validateDisabled = false;
4993
+ return;
4994
+ }
4995
+ this.validate('change');
4996
+ }, 100),
4997
+
4998
+ validate: function validate(trigger) {
4999
+ var _this2 = this;
5000
+
5001
+ var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : util["L" /* noop */];
5002
+
5003
+ this.validateDisabled = false;
5004
+ var rules = this.getFilteredRule(trigger);
5005
+ if ((!rules || rules.length === 0) && this.required === undefined) {
5006
+ callback();
5007
+ return true;
5008
+ }
5009
+
5010
+ this.validateState = 'validating';
5011
+
5012
+ var descriptor = {};
5013
+ if (rules && rules.length > 0) {
5014
+ rules.forEach(function (rule) {
5015
+ delete rule.trigger;
5016
+ });
5017
+ }
5018
+ descriptor[this.prop] = rules;
5019
+
5020
+ var validator = new external_async_validator_default.a(descriptor);
5021
+ var model = {};
5022
+
5023
+ model[this.prop] = this.fieldValue;
5024
+ validator.validate(model, { firstFields: true }, function (errors, invalidFields) {
5025
+ _this2.validateState = !errors ? 'success' : 'error';
5026
+ _this2.validateMessage = errors ? errors[0].message : '';
5027
+ callback(_this2.validateMessage, invalidFields, errors ? _this2.$el : null);
5028
+ _this2.esForm && _this2.esForm.$emit('validate', _this2.prop, !errors, _this2.validateMessage || null, _this2.$el);
5029
+ });
5030
+ },
5031
+ clearValidate: function clearValidate() {
5032
+ // 重置验证状态
5033
+ this.validateState = '';
5034
+ this.validateMessage = '';
5035
+ this.validateDisabled = false;
5036
+ this._validatePromise = null;
5037
+ },
5038
+ resetField: function resetField() {
5039
+ var _this3 = this;
5040
+
5041
+ this.validateState = '';
5042
+ this.validateMessage = '';
5043
+ this._validatePromise = null;
5044
+
5045
+ var model = this.esForm.models;
5046
+ var path = this.prop;
5047
+ if (!model || !path) return;
5048
+
5049
+ // 优化对象路径访问
5050
+ var normalizedPath = path;
5051
+ if (path.indexOf(':') !== -1) {
5052
+ normalizedPath = path.replace(/:/, '.');
5053
+ }
5054
+
5055
+ var prop = void 0;
5056
+ try {
5057
+ prop = Object(util["t" /* getPropByPath */])(model, normalizedPath, true);
5058
+ } catch (error) {
5059
+ console.error('获取属性路径失败:', error);
5060
+ return;
5061
+ }
5062
+
5063
+ if (!prop.o || !prop.k) return;
5064
+
5065
+ this.validateDisabled = true;
5066
+ try {
5067
+ if (Array.isArray(this.initialValue)) {
5068
+ prop.o[prop.k] = [].concat(this.initialValue);
5069
+ } else {
5070
+ prop.o[prop.k] = this.initialValue;
5071
+ }
5072
+ } catch (error) {
5073
+ console.error('重置字段值失败:', error);
5074
+ }
5075
+
5076
+ // reset validateDisabled after onFieldChange triggered
5077
+ this.$nextTick(function () {
5078
+ _this3.validateDisabled = false;
5079
+ });
5080
+
5081
+ // 使用try-catch避免广播失败
5082
+ try {
5083
+ this.broadcast('EsTimeSelect', 'fieldReset', this.initialValue);
5084
+ } catch (error) {
5085
+ // 忽略广播错误,不影响主要功能
5086
+ }
5087
+ },
5088
+ getRules: function getRules() {
5089
+ // 标记需要更新required状态
5090
+ this._needUpdateRequired = true;
5091
+
5092
+ var formRules = this.esForm.rules;
5093
+ var selfRules = this.rules;
5094
+
5095
+ // 构建必填规则
5096
+ var requiredRule = this.required !== undefined ? [{ required: !!this.required }] : [];
5097
+
5098
+ // 获取表单规则,增加空值检查
5099
+ var formFieldRules = [];
5100
+ if (formRules && this.prop) {
5101
+ try {
5102
+ var prop = Object(util["t" /* getPropByPath */])(formRules, this.prop);
5103
+ formFieldRules = prop.o[this.prop] || prop.v || [];
5104
+ } catch (error) {
5105
+ console.warn('\u83B7\u53D6\u8868\u5355\u89C4\u5219\u5931\u8D25: ' + this.prop, error);
5106
+ }
5107
+ }
5108
+
5109
+ // 合并规则,避免多次concat
5110
+ var result = [];
5111
+ if (selfRules) result.push.apply(result, Array.isArray(selfRules) ? selfRules : [selfRules]);
5112
+ if (formFieldRules) result.push.apply(result, Array.isArray(formFieldRules) ? formFieldRules : [formFieldRules]);
5113
+ if (requiredRule.length) result.push.apply(result, requiredRule);
5114
+
5115
+ return result;
5116
+ },
5117
+ getFilteredRule: function getFilteredRule(trigger) {
5118
+ var rules = this.getRules();
5119
+
5120
+ if (!rules || rules.length === 0) {
5121
+ return [];
5122
+ }
5123
+
5124
+ // 优化规则过滤
5125
+ var filteredRules = [];
5126
+ for (var i = 0; i < rules.length; i++) {
5127
+ var rule = rules[i];
5128
+ // 无trigger或空trigger时返回所有规则(确保直接传入rules数组时规则能被正确应用)
5129
+ if (!rule.trigger || trigger === '') {
5130
+ filteredRules.push(Object(merge["a" /* default */])({}, rule));
5131
+ } else if (Array.isArray(rule.trigger)) {
5132
+ if (rule.trigger.includes(trigger)) {
5133
+ filteredRules.push(Object(merge["a" /* default */])({}, rule));
5134
+ }
5135
+ } else if (rule.trigger === trigger) {
5136
+ filteredRules.push(Object(merge["a" /* default */])({}, rule));
5137
+ }
5138
+ }
5139
+
5140
+ return filteredRules;
5141
+ },
5142
+ onFieldBlur: function onFieldBlur() {
5143
+ this.validate('blur');
5144
+ },
5145
+ updateComputedLabelWidth: function updateComputedLabelWidth(width) {
5146
+ this.computedLabelWidth = width ? width + 'px' : '';
5147
+ },
5148
+ addValidateEvents: function addValidateEvents() {
5149
+ // 优化事件绑定,避免重复绑定
5150
+ if (!this._hasBindEvents && this.prop) {
5151
+ var rules = this.getRules();
5152
+
5153
+ if (rules.length > 0 || this.required !== undefined) {
5154
+ // 使用事件委托模式,减少事件监听器数量
5155
+ this.$on('es.form.blur', this.onFieldBlur);
5156
+ this.$on('es.form.change', this.onFieldChange);
5157
+ this._hasBindEvents = true;
5158
+ }
5159
+ }
5160
+ },
5161
+ removeValidateEvents: function removeValidateEvents() {
5162
+ // 优化事件解绑,确保清理干净
5163
+ if (this._hasBindEvents) {
5164
+ this.$off('es.form.blur', this.onFieldBlur);
5165
+ this.$off('es.form.change', this.onFieldChange);
5166
+ this._hasBindEvents = false;
5167
+ }
5168
+ // 避免移除所有事件,只移除我们添加的
5169
+ }
5170
+ },
5171
+
5172
+ mounted: function mounted() {
5173
+ if (this.prop) {
5174
+ try {
5175
+ this.dispatch('EsForm', 'es.form.addField', [this]);
5176
+
5177
+ // 保存初始值
5178
+ var initialValue = this.fieldValue;
5179
+ if (Array.isArray(initialValue)) {
5180
+ initialValue = [].concat(initialValue);
5181
+ }
5182
+ Object.defineProperty(this, 'initialValue', {
5183
+ value: initialValue,
5184
+ enumerable: false,
5185
+ configurable: false
5186
+ });
5187
+
5188
+ this.addValidateEvents();
5189
+ } catch (error) {
5190
+ console.error('表单字段初始化失败:', error);
5191
+ }
5192
+ }
5193
+ },
5194
+ beforeDestroy: function beforeDestroy() {
5195
+ try {
5196
+ // 确保移除所有事件监听器
5197
+ this.removeValidateEvents();
5198
+
5199
+ // 派发移除字段事件
5200
+ if (this.form) {
5201
+ this.dispatch('EsForm', 'es.form.removeField', [this]);
5202
+ }
5203
+
5204
+ // 清理引用,帮助垃圾回收
5205
+ this._formCache = null;
5206
+ this.validator = null;
5207
+ this._validatePromise = null;
5208
+ // 避免循环引用
5209
+ if (this.$parent && this.$parent.$options && this.$parent.$options.componentName === 'EsForm') {
5210
+ // 清理对父组件的引用
5211
+ }
5212
+ } catch (error) {
5213
+ console.error('表单字段销毁失败:', error);
5214
+ }
5215
+ }
5216
+ });
5217
+ // CONCATENATED MODULE: ./packages/form/src/form-item.vue?vue&type=script&lang=js&
5218
+ /* harmony default export */ var src_form_itemvue_type_script_lang_js_ = (form_itemvue_type_script_lang_js_);
5219
+ // CONCATENATED MODULE: ./packages/form/src/form-item.vue
5220
+
5221
+
5222
+
5223
+
5224
+
5225
+ /* normalize component */
5226
+
5227
+ var form_item_component = Object(componentNormalizer["a" /* default */])(
5228
+ src_form_itemvue_type_script_lang_js_,
5229
+ render,
5230
+ staticRenderFns,
5231
+ false,
5232
+ null,
5233
+ null,
5234
+ null
5235
+
5236
+ )
5237
+
5238
+ /* harmony default export */ var form_item = (form_item_component.exports);
5239
+ // CONCATENATED MODULE: ./packages/form-item/index.js
5240
+
5241
+
5242
+ /* istanbul ignore next */
5243
+ form_item.install = function (Vue) {
5244
+ Vue.component(form_item.name, form_item);
5245
+ };
5246
+
5247
+ /* harmony default export */ var packages_form_item = __webpack_exports__["default"] = (form_item);
5248
+
5249
+ /***/ }),
5250
+
5251
+ /***/ 19:
5252
+ /***/ (function(module, exports) {
5253
+
5254
+ module.exports = require("eoss/lib/loading");
5255
+
5256
+ /***/ }),
5257
+
5258
+ /***/ 2:
5259
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
5260
+
5261
+ "use strict";
5262
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return setStorage; });
5263
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getStorage; });
5264
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return removeStorage; });
5265
+ /* unused harmony export setCookie */
5266
+ /* unused harmony export getCookie */
5267
+ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
5268
+
5269
+ /**
5270
+ * setStorage
5271
+ * @desc:设置本地储存数据
5272
+ * @author huangbo
5273
+ * @date 2022年5月7日
5274
+ * @param {String|Object} [key] - 数据的名称或包含type、key、value的对象
5275
+ * @param {String} [value] - 数据的值(当第一个参数为字符串时使用)
5276
+ **/
5277
+ var setStorage = function setStorage(key, value) {
5278
+ // 解析参数,支持两种调用方式:setStorage(key, value) 和 setStorage({type, key, value})
5279
+ var type = void 0,
5280
+ finalKey = void 0,
5281
+ finalValue = void 0;
5282
+
5283
+ if ((typeof key === 'undefined' ? 'undefined' : _typeof(key)) === 'object' && key !== null) {
5284
+ // 对象调用方式:setStorage({type, key, value})
5285
+ type = key.type;
5286
+ finalKey = key.key;
5287
+ finalValue = key.value;
5288
+ } else {
5289
+ // 字符串调用方式:setStorage(key, value)
5290
+ type = getStorage('storageType');
5291
+ finalKey = key;
5292
+ finalValue = value;
5293
+ }
5294
+
5295
+ // 使用默认存储类型如果未指定
5296
+ type = type || getStorage('storageType');
5297
+
5298
+ // 获取存储对象
5299
+ var storage = type === 'localStorage' ? localStorage : sessionStorage;
5300
+
5301
+ // 处理不同类型的key
5302
+ if (typeof finalKey === 'string') {
5303
+ // 单个字符串key
5304
+ var storedValue = (typeof finalValue === 'undefined' ? 'undefined' : _typeof(finalValue)) === 'object' ? JSON.stringify(finalValue) : finalValue;
5305
+ storage.setItem(finalKey, storedValue);
5306
+ if (finalKey === 'token') {
5307
+ setCookie('token', storedValue);
5308
+ }
5309
+ } else if (Array.isArray(finalKey)) {
5310
+ // 数组key,为多个key设置同一个value
5311
+ var _storedValue = (typeof finalValue === 'undefined' ? 'undefined' : _typeof(finalValue)) === 'object' ? JSON.stringify(finalValue) : finalValue;
5312
+ for (var i = 0; i < finalKey.length; i++) {
5313
+ storage.setItem(finalKey[i], _storedValue);
5314
+ if (finalKey[i] === 'token') {
5315
+ setCookie('token', _storedValue);
5316
+ }
5317
+ }
5318
+ } else if ((typeof finalKey === 'undefined' ? 'undefined' : _typeof(finalKey)) === 'object' && finalKey !== null) {
5319
+ // 对象key,对象的属性名称作为key,属性值作为value
5320
+ for (var k in finalKey) {
5321
+ if (Object.prototype.hasOwnProperty.call(finalKey, k)) {
5322
+ var _storedValue2 = _typeof(finalKey[k]) === 'object' ? JSON.stringify(finalKey[k]) : finalKey[k];
5323
+ storage.setItem(k, _storedValue2);
5324
+ if (k === 'token') {
5325
+ setCookie('token', _storedValue2);
5326
+ }
5327
+ }
5328
+ }
5329
+ }
5330
+ };
5331
+
5332
+ /**
5333
+ * getStorage
5334
+ * @desc:获取本地储存数据
5335
+ * @author huangbo
5336
+ * @date 2022年5月7日
5337
+ * @param {String} [key] - 获取的名称
5338
+ **/
5339
+ var getStorage = function getStorage(key) {
5340
+ if (key) {
5341
+ var res = sessionStorage.getItem(key) || localStorage.getItem(key);
5342
+ if (!res && key === 'token') {
5343
+ res = getCookie('token');
5344
+ }
5345
+ if (key === 'host' && !res) {
5346
+ res = '';
5347
+ }
5348
+ return res;
5349
+ }
5350
+ var defaults = {};
5351
+ var token = sessionStorage.getItem('token') || localStorage.getItem('token') || getCookie('token');
5352
+ var ssId = sessionStorage.getItem('ssId') || localStorage.getItem('ssId') || getCookie('ssId');
5353
+
5354
+ var deviceUnique = sessionStorage.getItem('deviceUnique') || localStorage.getItem('deviceUnique') || getCookie('deviceUnique');
5355
+ if (token) {
5356
+ defaults.Authorization = token;
5357
+ }
5358
+ if (ssId) {
5359
+ defaults.ssId = ssId;
5360
+ }
5361
+ if (deviceUnique) {
5362
+ defaults.deviceUnique = deviceUnique;
5363
+ }
5364
+ return defaults;
5365
+ };
5366
+
5367
+ /**
5368
+ * removeStorage
5369
+ * @desc:删除本地储存数据
5370
+ * @author huangbo
5371
+ * @date 2022年5月7日
5372
+ * @param {String, Array} [key] - 获取的名称
5373
+ **/
5374
+ var removeStorage = function removeStorage(key) {
5375
+ if (Array.isArray(key)) {
5376
+ for (var i = 0; i < key.length; i++) {
5377
+ sessionStorage.removeItem(key[i]);
5378
+ localStorage.removeItem(key[i]);
5379
+ if (key[i] === 'token') {
5380
+ removeCookie('token');
5381
+ }
5382
+ }
5383
+ } else if (key) {
5384
+ sessionStorage.removeItem(key);
5385
+ localStorage.removeItem(key);
5386
+ if (key === 'token') {
5387
+ removeCookie('token');
5388
+ }
5389
+ } else {
5390
+ sessionStorage.clear();
5391
+ localStorage.clear();
5392
+ removeCookie('token');
5393
+ }
5394
+ };
5395
+
5396
+ /**
5397
+ * setCookie
5398
+ * @desc 设置cookie
5399
+ * @author huangbo
5400
+ * @param {string} [name] cookie名称
5401
+ * @param {string} [value] cookie值
5402
+ * @param {boolean} [isSession] 是否是会话cookie
5403
+ **/
5404
+ var setCookie = function setCookie(name, value) {
5405
+ var isSession = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
5406
+ var time = arguments[3];
5407
+
5408
+ try {
5409
+ var cookieParts = [encodeURIComponent(name) + '=' + encodeURIComponent(value), 'path=/' // 仅保留path设置,确保全站访问
5410
+ ];
5411
+ // 会话/持久Cookie设置
5412
+ if (!isSession) {
5413
+ if (/MSIE|Trident/.test(navigator.userAgent)) {
5414
+ // IE使用expires
5415
+ var date = new Date();
5416
+ date.setTime(date.getTime() + (time || 7 * 24 * 60 * 60 * 1000));
5417
+ cookieParts.push('expires=' + date.toUTCString());
5418
+ } else {
5419
+ // 其他浏览器使用max-age
5420
+ cookieParts.push('max-age=' + (time || 7 * 24 * 60 * 60));
5421
+ }
5422
+ }
5423
+ // 内核兼容处理
5424
+ if (/MSIE|Trident/.test(navigator.userAgent)) {
5425
+ // IE特殊处理:添加P3P协议头
5426
+ cookieParts.push('P3P=CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"');
5427
+ } else {
5428
+ // 现代浏览器设置
5429
+ cookieParts.push('samesite=lax');
5430
+ if (window.location.protocol === 'https:') {
5431
+ cookieParts.push('secure');
5432
+ }
5433
+ }
5434
+
5435
+ // 设置Cookie
5436
+ document.cookie = cookieParts.join('; ');
5437
+ return true;
5438
+ } catch (e) {
5439
+ console.error('Cookie设置失败:', e);
5440
+ return false;
5441
+ }
5442
+ };
5443
+
5444
+ /**
5445
+ * getCookie
5446
+ * @desc 获取cookie中指定名称的值
5447
+ * @author huangbo
5448
+ * @param {string} [name] cookie名称
5449
+ **/
5450
+ var getCookie = function getCookie(name) {
5451
+ var cookies = document.cookie.split(';');
5452
+ for (var _iterator = cookies, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
5453
+ var _ref;
5454
+
5455
+ if (_isArray) {
5456
+ if (_i >= _iterator.length) break;
5457
+ _ref = _iterator[_i++];
5458
+ } else {
5459
+ _i = _iterator.next();
5460
+ if (_i.done) break;
5461
+ _ref = _i.value;
5462
+ }
5463
+
5464
+ var cookie = _ref;
5465
+
5466
+ var _cookie$trim$split = cookie.trim().split('='),
5467
+ cookieName = _cookie$trim$split[0],
5468
+ cookieValue = _cookie$trim$split[1];
5469
+
5470
+ if (decodeURIComponent(cookieName) === name) {
5471
+ return decodeURIComponent(cookieValue);
5472
+ }
5473
+ }
5474
+ return null;
5475
+ };
5476
+
5477
+ /**
5478
+ * removeCookie
5479
+ * @desc:删除cookie
5480
+ * @author huangbo
5481
+ * @date 2022年5月7日
5482
+ * @param {String, Array} [key] - 获取的名称
5483
+ **/
5484
+ var removeCookie = function removeCookie(key) {
5485
+ if (Array.isArray(key)) {
5486
+ for (var i = 0; i < key.length; i++) {
5487
+ document.cookie = encodeURIComponent(key[i]) + '=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;';
5488
+ }
5489
+ } else {
5490
+ document.cookie = encodeURIComponent(key) + '=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;';
5491
+ }
5492
+ };
5493
+
5494
+ /***/ }),
5495
+
5496
+ /***/ 20:
5497
+ /***/ (function(module, exports) {
5498
+
5499
+ module.exports = require("lodash/get");
5500
+
5501
+ /***/ }),
5502
+
5503
+ /***/ 21:
5504
+ /***/ (function(module, exports) {
5505
+
5506
+ module.exports = require("lodash/set");
5507
+
5508
+ /***/ }),
5509
+
5510
+ /***/ 22:
5511
+ /***/ (function(module, exports) {
5512
+
5513
+ module.exports = require("lodash/cloneDeep");
5514
+
5515
+ /***/ }),
5516
+
5517
+ /***/ 3:
5518
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
5519
+
5520
+ "use strict";
5521
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
5522
+ /* globals __VUE_SSR_CONTEXT__ */
5523
+
5524
+ // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
5525
+ // This module is a runtime utility for cleaner component module output and will
5526
+ // be included in the final webpack user bundle.
5527
+
5528
+ function normalizeComponent(
5529
+ scriptExports,
5530
+ render,
5531
+ staticRenderFns,
5532
+ functionalTemplate,
5533
+ injectStyles,
5534
+ scopeId,
5535
+ moduleIdentifier /* server only */,
5536
+ shadowMode /* vue-cli only */
5537
+ ) {
5538
+ // Vue.extend constructor export interop
5539
+ var options =
5540
+ typeof scriptExports === 'function' ? scriptExports.options : scriptExports
5541
+
5542
+ // render functions
5543
+ if (render) {
5544
+ options.render = render
5545
+ options.staticRenderFns = staticRenderFns
5546
+ options._compiled = true
5547
+ }
5548
+
5549
+ // functional template
5550
+ if (functionalTemplate) {
5551
+ options.functional = true
5552
+ }
5553
+
5554
+ // scopedId
5555
+ if (scopeId) {
5556
+ options._scopeId = 'data-v-' + scopeId
5557
+ }
5558
+
5559
+ var hook
5560
+ if (moduleIdentifier) {
5561
+ // server build
5562
+ hook = function (context) {
5563
+ // 2.3 injection
5564
+ context =
5565
+ context || // cached call
5566
+ (this.$vnode && this.$vnode.ssrContext) || // stateful
5567
+ (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
5568
+ // 2.2 with runInNewContext: true
5569
+ if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
5570
+ context = __VUE_SSR_CONTEXT__
5571
+ }
5572
+ // inject component styles
5573
+ if (injectStyles) {
5574
+ injectStyles.call(this, context)
5575
+ }
5576
+ // register component module identifier for async chunk inferrence
5577
+ if (context && context._registeredComponents) {
5578
+ context._registeredComponents.add(moduleIdentifier)
5579
+ }
5580
+ }
5581
+ // used by ssr in case component is cached and beforeCreate
5582
+ // never gets called
5583
+ options._ssrRegister = hook
5584
+ } else if (injectStyles) {
5585
+ hook = shadowMode
5586
+ ? function () {
5587
+ injectStyles.call(
5588
+ this,
5589
+ (options.functional ? this.parent : this).$root.$options.shadowRoot
5590
+ )
5591
+ }
5592
+ : injectStyles
5593
+ }
5594
+
5595
+ if (hook) {
5596
+ if (options.functional) {
5597
+ // for template-only hot-reload because in that case the render fn doesn't
5598
+ // go through the normalizer
5599
+ options._injectStyles = hook
5600
+ // register for functional component in vue file
5601
+ var originalRender = options.render
5602
+ options.render = function renderWithStyleInjection(h, context) {
5603
+ hook.call(context)
5604
+ return originalRender(h, context)
5605
+ }
5606
+ } else {
5607
+ // inject component registration as beforeCreate hook
5608
+ var existing = options.beforeCreate
5609
+ options.beforeCreate = existing ? [].concat(existing, hook) : [hook]
5610
+ }
5611
+ }
5612
+
5613
+ return {
5614
+ exports: scriptExports,
5615
+ options: options
5616
+ }
5617
+ }
5618
+
5619
+
5620
+ /***/ }),
5621
+
5622
+ /***/ 4:
5623
+ /***/ (function(module, exports) {
5624
+
5625
+ module.exports = require("vue");
5626
+
5627
+ /***/ }),
5628
+
5629
+ /***/ 6:
5630
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
5631
+
5632
+ "use strict";
5633
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return isString; });
5634
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return isObject; });
5635
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return isHtmlElement; });
5636
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return isFunction; });
5637
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return isUndefined; });
5638
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return isDefined; });
5639
+ /**
5640
+ * 检查一个值是否为字符串类型
5641
+ * @param {*} obj 要检查的值
5642
+ * @returns {boolean} 如果值为字符串则返回true,否则返回false
5643
+ */
5644
+ function isString(obj) {
5645
+ return Object.prototype.toString.call(obj) === '[object String]';
5646
+ }
5647
+
5502
5648
  /**
5503
- * 获取分钟
5504
- * @date 2022年5月7日
5505
- * @param {Date|string} [date] - 日期对象或日期字符串
5506
- * @returns {number} 分钟数(0-59)
5507
- */
5508
- const getMinute = function (date) {
5509
- if (!date) {
5510
- return new Date().getMinutes();
5511
- }
5512
- if (typeof date === 'string') {
5513
- date = new Date(date);
5514
- }
5515
- return date.getMinutes();
5516
- };
5517
-
5649
+ * 检查一个值是否为对象类型
5650
+ * @param {*} obj 要检查的值
5651
+ * @returns {boolean} 如果值为对象则返回true,否则返回false
5652
+ */
5653
+ function isObject(obj) {
5654
+ return Object.prototype.toString.call(obj) === '[object Object]';
5655
+ }
5656
+
5518
5657
  /**
5519
- * 获取月份
5520
- * @date 2022年5月7日
5521
- * @param {Date|string} [date] - 日期对象或日期字符串
5522
- * @returns {number} 月份数(1-12)
5523
- */
5524
- const getMonth = function (date) {
5525
- if (!date) {
5526
- return new Date().getMonth() + 1;
5527
- }
5528
- if (typeof date === 'string') {
5529
- date = new Date(date);
5530
- }
5531
- return date.getMonth() + 1;
5532
- };
5533
-
5658
+ * 检查一个节点是否为HTML元素
5659
+ * @param {Node} node 要检查的节点
5660
+ * @returns {boolean} 如果节点为HTML元素则返回true,否则返回false
5661
+ */
5662
+ function isHtmlElement(node) {
5663
+ return node && node.nodeType === Node.ELEMENT_NODE;
5664
+ }
5665
+
5534
5666
  /**
5535
- * 获取秒
5536
- * @date 2022年5月7日
5537
- * @param {Date|string} [date] - 日期对象或日期字符串
5538
- * @returns {number} 秒数(0-59)
5539
- */
5540
- const getSecond = function (date) {
5541
- if (!date) {
5542
- return new Date().getSeconds();
5543
- }
5544
- if (typeof date === 'string') {
5545
- date = new Date(date);
5546
- }
5547
- return date.getSeconds();
5548
- };
5549
-
5667
+ * 检查一个值是否为函数类型
5668
+ * @param {*} functionToCheck 要检查的值
5669
+ * @returns {boolean} 如果值为函数则返回true,否则返回false
5670
+ */
5671
+ function isFunction(functionToCheck) {
5672
+ var getType = {};
5673
+ return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
5674
+ }
5675
+
5550
5676
  /**
5551
- * 获取星期几
5552
- * @date 2022年5月7日
5553
- * @param {Date|string} [date] - 日期对象或日期字符串
5554
- * @returns {number} 星期几(0-6,0表示星期日)
5555
- */
5556
- const getWeekday = function (date) {
5557
- if (!date) {
5558
- return new Date().getDay();
5559
- }
5560
- if (typeof date === 'string') {
5561
- date = new Date(date);
5562
- }
5563
- return date.getDay();
5564
- };
5565
-
5566
-
5677
+ * 检查一个值是否为undefined
5678
+ * @param {*} val 要检查的值
5679
+ * @returns {boolean} 如果值为undefined则返回true,否则返回false
5680
+ */
5681
+ function isUndefined(val) {
5682
+ return val === void 0;
5683
+ }
5684
+
5567
5685
  /**
5568
- * @desc 获取上午/下午/晚上
5569
- * @author huangbo
5570
- * @date 2022年5月7日
5571
- * @param {String} [time] - 时间
5572
- **/
5573
- const timeCycle = function (time) {
5574
- let hour = 0;
5575
- if (!time) {
5576
- hour = new Date().getHours();
5577
- } else if (typeof time === 'string') {
5578
- // 从时间字符串中提取小时
5579
- const match = time.match(/^(\d{1,2})/);
5580
- if (match) {
5581
- hour = parseInt(match[1], 10);
5582
- }
5583
- } else if (typeof time === 'number') {
5584
- hour = time;
5585
- }
5586
- // 判断时间段
5587
- if (hour >= 5 && hour < 12) {
5588
- return '上午';
5589
- } else if (hour >= 12 && hour < 18) {
5590
- return '下午';
5591
- } else {
5592
- return '晚上';
5593
- }
5594
- };
5686
+ * 检查一个值是否已定义(不是undefined或null)
5687
+ * @param {*} val 要检查的值
5688
+ * @returns {boolean} 如果值已定义则返回true,否则返回false
5689
+ */
5690
+ function isDefined(val) {
5691
+ return val !== undefined && val !== null;
5692
+ }
5595
5693
 
5596
5694
  /***/ }),
5597
5695