vue-devui 1.0.0-rc.6 → 1.0.0-rc.9

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 (168) hide show
  1. package/README.md +5 -0
  2. package/alert/index.es.js +37 -11
  3. package/alert/index.umd.js +1 -1
  4. package/alert/style.css +1 -1
  5. package/auto-complete/index.es.js +311 -77
  6. package/auto-complete/index.umd.js +3 -5
  7. package/auto-complete/style.css +1 -1
  8. package/avatar/index.es.js +81 -70
  9. package/avatar/index.umd.js +1 -1
  10. package/avatar/style.css +1 -1
  11. package/badge/index.es.js +29 -4
  12. package/badge/index.umd.js +1 -1
  13. package/badge/style.css +1 -1
  14. package/button/index.es.js +5632 -87
  15. package/button/index.umd.js +27 -1
  16. package/button/style.css +1 -1
  17. package/card/index.es.js +56 -29
  18. package/card/index.umd.js +1 -1
  19. package/card/style.css +1 -1
  20. package/checkbox/index.es.js +364 -234
  21. package/checkbox/index.umd.js +1 -1
  22. package/checkbox/style.css +1 -1
  23. package/date-picker/index.es.js +310 -157
  24. package/date-picker/index.umd.js +1 -1
  25. package/date-picker/style.css +1 -1
  26. package/drawer/index.es.js +28 -3
  27. package/drawer/index.umd.js +1 -1
  28. package/drawer/style.css +1 -1
  29. package/dropdown/index.es.js +125 -45
  30. package/dropdown/index.umd.js +1 -1
  31. package/dropdown/style.css +1 -1
  32. package/editable-select/index.es.js +437 -22
  33. package/editable-select/index.umd.js +1 -1
  34. package/editable-select/style.css +1 -1
  35. package/form/index.es.js +490 -605
  36. package/form/index.umd.js +15 -15
  37. package/form/style.css +1 -1
  38. package/fullscreen/index.es.js +29 -5
  39. package/fullscreen/index.umd.js +1 -1
  40. package/fullscreen/style.css +1 -1
  41. package/grid/index.es.js +71 -50
  42. package/grid/index.umd.js +1 -1
  43. package/grid/style.css +1 -1
  44. package/icon/index.es.js +109 -13
  45. package/icon/index.umd.js +1 -1
  46. package/icon/style.css +1 -0
  47. package/image-preview/index.es.js +34 -11
  48. package/image-preview/index.umd.js +1 -1
  49. package/image-preview/style.css +1 -1
  50. package/input/index.es.js +330 -130
  51. package/input/index.umd.js +1 -1
  52. package/input/style.css +1 -1
  53. package/input-number/index.es.js +272 -199
  54. package/input-number/index.umd.js +1 -1
  55. package/input-number/style.css +1 -1
  56. package/layout/index.es.js +34 -6
  57. package/layout/index.umd.js +1 -1
  58. package/layout/style.css +1 -1
  59. package/loading/index.es.js +34 -10
  60. package/loading/index.umd.js +1 -1
  61. package/loading/style.css +1 -1
  62. package/modal/index.es.js +126 -27
  63. package/modal/index.umd.js +1 -1
  64. package/modal/style.css +1 -1
  65. package/notification/index.es.js +125 -25
  66. package/notification/index.umd.js +1 -1
  67. package/notification/style.css +1 -1
  68. package/nuxt/components/ButtonGroup.js +3 -0
  69. package/nuxt/components/CheckboxButton.js +3 -0
  70. package/nuxt/components/CheckboxGroup.js +3 -0
  71. package/nuxt/components/FORM_ITEM_TOKEN.js +3 -0
  72. package/nuxt/components/FORM_TOKEN.js +3 -0
  73. package/nuxt/components/Icon.js +1 -0
  74. package/nuxt/components/LABEL_DATA.js +3 -0
  75. package/nuxt/components/Option.js +3 -0
  76. package/nuxt/components/buttonGroupInjectionKey.js +3 -0
  77. package/nuxt/components/buttonGroupProps.js +3 -0
  78. package/nuxt/components/formControlProps.js +3 -0
  79. package/nuxt/components/formItemProps.js +3 -0
  80. package/nuxt/components/formProps.js +3 -0
  81. package/nuxt/components/iconProps.js +1 -0
  82. package/nuxt/components/svgIconProps.js +3 -0
  83. package/overlay/index.es.js +31 -9
  84. package/overlay/index.umd.js +1 -1
  85. package/overlay/style.css +1 -1
  86. package/package.json +2 -1
  87. package/pagination/index.es.js +135 -124
  88. package/pagination/index.umd.js +1 -1
  89. package/pagination/style.css +1 -1
  90. package/popover/index.es.js +198 -83
  91. package/popover/index.umd.js +16 -16
  92. package/popover/style.css +1 -1
  93. package/progress/index.es.js +76 -20
  94. package/progress/index.umd.js +3 -3
  95. package/progress/style.css +1 -1
  96. package/radio/index.es.js +161 -140
  97. package/radio/index.umd.js +1 -1
  98. package/radio/style.css +1 -1
  99. package/rate/index.es.js +48 -16
  100. package/rate/index.umd.js +1 -1
  101. package/rate/style.css +1 -1
  102. package/result/index.es.js +108 -12
  103. package/result/index.umd.js +1 -1
  104. package/result/style.css +1 -1
  105. package/search/index.es.js +379 -167
  106. package/search/index.umd.js +17 -17
  107. package/search/style.css +1 -1
  108. package/select/index.es.js +7339 -556
  109. package/select/index.umd.js +27 -1
  110. package/select/style.css +1 -1
  111. package/skeleton/index.es.js +37 -12
  112. package/skeleton/index.umd.js +1 -1
  113. package/skeleton/style.css +1 -1
  114. package/slider/index.es.js +34 -10
  115. package/slider/index.umd.js +1 -1
  116. package/slider/style.css +1 -1
  117. package/splitter/index.es.js +201 -84
  118. package/splitter/index.umd.js +14 -14
  119. package/splitter/style.css +1 -1
  120. package/status/index.es.js +26 -2
  121. package/status/index.umd.js +1 -1
  122. package/status/style.css +1 -1
  123. package/style.css +1 -1
  124. package/switch/index.es.js +30 -6
  125. package/switch/index.umd.js +1 -1
  126. package/switch/style.css +1 -1
  127. package/table/index.es.js +6808 -585
  128. package/table/index.umd.js +27 -1
  129. package/table/style.css +1 -1
  130. package/tabs/index.es.js +136 -70
  131. package/tabs/index.umd.js +1 -1
  132. package/tabs/style.css +1 -1
  133. package/tag/index.es.js +31 -7
  134. package/tag/index.umd.js +1 -1
  135. package/tag/style.css +1 -1
  136. package/textarea/index.es.js +5631 -80
  137. package/textarea/index.umd.js +35 -1
  138. package/textarea/style.css +1 -1
  139. package/timeline/index.es.js +108 -12
  140. package/timeline/index.umd.js +1 -1
  141. package/timeline/style.css +1 -1
  142. package/tooltip/index.es.js +190 -74
  143. package/tooltip/index.umd.js +17 -17
  144. package/tooltip/style.css +1 -1
  145. package/tree/index.es.js +376 -256
  146. package/tree/index.umd.js +1 -1
  147. package/tree/style.css +1 -1
  148. package/upload/index.es.js +138 -34
  149. package/upload/index.umd.js +1 -1
  150. package/upload/style.css +1 -1
  151. package/vue-devui.es.js +6770 -5769
  152. package/vue-devui.umd.js +27 -21
  153. package/comment/index.d.ts +0 -7
  154. package/comment/index.es.js +0 -84
  155. package/comment/index.umd.js +0 -1
  156. package/comment/package.json +0 -7
  157. package/comment/style.css +0 -1
  158. package/nuxt/components/Comment.js +0 -3
  159. package/nuxt/components/FormControl.js +0 -3
  160. package/nuxt/components/FormLabel.js +0 -3
  161. package/nuxt/components/ReadTip.js +0 -3
  162. package/nuxt/components/commentProps.js +0 -3
  163. package/nuxt/components/readTipProps.js +0 -3
  164. package/read-tip/index.d.ts +0 -7
  165. package/read-tip/index.es.js +0 -261
  166. package/read-tip/index.umd.js +0 -1
  167. package/read-tip/package.json +0 -7
  168. package/read-tip/style.css +0 -1
@@ -1,4 +1,25 @@
1
- import { computed, ref, nextTick, defineComponent, watch, withDirectives, createVNode, withModifiers, resolveComponent, vShow, resolveDirective } from "vue";
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
4
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __spreadValues = (a, b) => {
7
+ for (var prop in b || (b = {}))
8
+ if (__hasOwnProp.call(b, prop))
9
+ __defNormalProp(a, prop, b[prop]);
10
+ if (__getOwnPropSymbols)
11
+ for (var prop of __getOwnPropSymbols(b)) {
12
+ if (__propIsEnum.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ }
15
+ return a;
16
+ };
17
+ var __publicField = (obj, key, value) => {
18
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
19
+ return value;
20
+ };
21
+ import { defineComponent, ref, createVNode, h, render, computed, nextTick, unref, watch, onUnmounted, mergeProps, withDirectives, withModifiers, resolveComponent, vShow, resolveDirective } from "vue";
22
+ import { offset, autoPlacement, arrow, shift, computePosition } from "@floating-ui/dom";
2
23
  const editableSelectProps = {
3
24
  options: {
4
25
  type: Array,
@@ -19,7 +40,8 @@ const editableSelectProps = {
19
40
  default: "Search"
20
41
  },
21
42
  modelValue: {
22
- type: String
43
+ type: String,
44
+ default: ""
23
45
  },
24
46
  width: {
25
47
  type: Number
@@ -86,6 +108,234 @@ const clickoutsideDirective = {
86
108
  delete el[ctx];
87
109
  }
88
110
  };
111
+ class View {
112
+ constructor() {
113
+ __publicField(this, "top", "50%");
114
+ __publicField(this, "left", "50%");
115
+ }
116
+ }
117
+ const loadingProps = {
118
+ message: String,
119
+ backdrop: Boolean,
120
+ view: {
121
+ type: Object,
122
+ default: () => new View()
123
+ },
124
+ zIndex: Number,
125
+ isFull: {
126
+ type: Boolean,
127
+ default: false
128
+ }
129
+ };
130
+ class LoadingOptions {
131
+ constructor() {
132
+ __publicField(this, "target");
133
+ __publicField(this, "message");
134
+ __publicField(this, "loadingTemplateRef");
135
+ __publicField(this, "backdrop", true);
136
+ __publicField(this, "positionType", "relative");
137
+ __publicField(this, "view", new View());
138
+ __publicField(this, "zIndex");
139
+ }
140
+ }
141
+ function createBem(namespace, element, modifier) {
142
+ let cls = namespace;
143
+ if (element) {
144
+ cls += `__${element}`;
145
+ }
146
+ if (modifier) {
147
+ cls += `--${modifier}`;
148
+ }
149
+ return cls;
150
+ }
151
+ function useNamespace(block, needDot = false) {
152
+ const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
153
+ const b = () => createBem(namespace);
154
+ const e = (element) => element ? createBem(namespace, element) : "";
155
+ const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
156
+ const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
157
+ return {
158
+ b,
159
+ e,
160
+ m,
161
+ em
162
+ };
163
+ }
164
+ var loading = "";
165
+ var Loading = defineComponent({
166
+ name: "DLoading",
167
+ inheritAttrs: false,
168
+ props: loadingProps,
169
+ setup(props) {
170
+ const style = {
171
+ top: props.view.top,
172
+ left: props.view.left,
173
+ zIndex: props.zIndex
174
+ };
175
+ if (!props.message) {
176
+ style.background = "none";
177
+ }
178
+ const isShow = ref(false);
179
+ const open = () => {
180
+ isShow.value = true;
181
+ };
182
+ const close = () => {
183
+ isShow.value = false;
184
+ };
185
+ return {
186
+ style,
187
+ isShow,
188
+ open,
189
+ close
190
+ };
191
+ },
192
+ render() {
193
+ var _a;
194
+ const {
195
+ isShow,
196
+ isFull,
197
+ backdrop,
198
+ style,
199
+ message,
200
+ $slots
201
+ } = this;
202
+ const ns = useNamespace("loading");
203
+ return isShow && createVNode("div", {
204
+ "class": [ns.b(), isFull ? ns.m("full") : ""]
205
+ }, [((_a = $slots.default) == null ? void 0 : _a.call($slots)) || createVNode("div", {
206
+ "class": ns.e("wrapper")
207
+ }, [backdrop ? createVNode("div", {
208
+ "class": ns.e("mask")
209
+ }, null) : null, createVNode("div", {
210
+ "style": style,
211
+ "class": ns.e("area")
212
+ }, [createVNode("div", {
213
+ "class": ns.e("busy-default-spinner")
214
+ }, [createVNode("div", {
215
+ "class": ns.e("bar1")
216
+ }, null), createVNode("div", {
217
+ "class": ns.e("bar2")
218
+ }, null), createVNode("div", {
219
+ "class": ns.e("bar3")
220
+ }, null), createVNode("div", {
221
+ "class": ns.e("bar4")
222
+ }, null)]), message ? createVNode("span", {
223
+ "class": ns.e("text")
224
+ }, [message]) : null])])]);
225
+ }
226
+ });
227
+ const COMPONENT_CONTAINER_SYMBOL = Symbol("dev_component_container");
228
+ function createComponent(component, props, children = null) {
229
+ const vnode = h(component, __spreadValues({}, props), children);
230
+ const container = document.createElement("div");
231
+ vnode[COMPONENT_CONTAINER_SYMBOL] = container;
232
+ render(vnode, container);
233
+ return vnode.component;
234
+ }
235
+ function unmountComponent(ComponnetInstance) {
236
+ render(null, ComponnetInstance == null ? void 0 : ComponnetInstance.vnode[COMPONENT_CONTAINER_SYMBOL]);
237
+ }
238
+ const loadingConstructor = defineComponent(Loading);
239
+ const cacheInstance = /* @__PURE__ */ new WeakSet();
240
+ const isEmpty = (val) => {
241
+ if (!val) {
242
+ return true;
243
+ }
244
+ if (Array.isArray(val)) {
245
+ return val.length === 0;
246
+ }
247
+ if (val instanceof Set || val instanceof Map) {
248
+ return val.size === 0;
249
+ }
250
+ if (val instanceof Promise) {
251
+ return false;
252
+ }
253
+ if (typeof val === "object") {
254
+ try {
255
+ return Object.keys(val).length === 0;
256
+ } catch (e) {
257
+ return false;
258
+ }
259
+ }
260
+ return false;
261
+ };
262
+ const getType = (vari) => {
263
+ return Object.prototype.toString.call(vari).slice(8, -1).toLowerCase();
264
+ };
265
+ const isPromise = (value) => {
266
+ const type = getType(value);
267
+ switch (type) {
268
+ case "promise":
269
+ return [value];
270
+ case "array":
271
+ if (value.some((val) => getType(val) !== "promise")) {
272
+ console.error(new TypeError("Binding values should all be of type Promise"));
273
+ return "error";
274
+ }
275
+ return value;
276
+ default:
277
+ return false;
278
+ }
279
+ };
280
+ const unmount = (el) => {
281
+ cacheInstance.delete(el);
282
+ el.instance.proxy.close();
283
+ unmountComponent(el.instance);
284
+ };
285
+ const toggleLoading = (el, binding) => {
286
+ var _a, _b, _c;
287
+ if (binding.value) {
288
+ const vals = isPromise(binding.value);
289
+ if (vals === "error") {
290
+ return;
291
+ }
292
+ (_c = (_b = (_a = el == null ? void 0 : el.instance) == null ? void 0 : _a.proxy) == null ? void 0 : _b.open) == null ? void 0 : _c.call(_b);
293
+ el.appendChild(el.mask);
294
+ cacheInstance.add(el);
295
+ if (vals) {
296
+ Promise.all(vals).catch((err) => {
297
+ console.error(new Error("Promise handling errors"), err);
298
+ }).finally(() => {
299
+ unmount(el);
300
+ });
301
+ }
302
+ } else {
303
+ unmount(el);
304
+ }
305
+ };
306
+ const removeAttribute = (el) => {
307
+ el.removeAttribute("zindex");
308
+ el.removeAttribute("positiontype");
309
+ el.removeAttribute("backdrop");
310
+ el.removeAttribute("message");
311
+ el.removeAttribute("view");
312
+ el.removeAttribute("loadingtemplateref");
313
+ };
314
+ const handleProps = (el, vprops) => {
315
+ var _a;
316
+ const props = __spreadValues(__spreadValues({}, new LoadingOptions()), vprops);
317
+ const loadingTemplateRef = props.loadingTemplateRef;
318
+ const loadingInstance = createComponent(loadingConstructor, __spreadValues({}, props), loadingTemplateRef ? () => loadingTemplateRef : null);
319
+ el.style.position = props.positionType;
320
+ el.options = props;
321
+ el.instance = loadingInstance;
322
+ el.mask = (_a = loadingInstance == null ? void 0 : loadingInstance.proxy) == null ? void 0 : _a.$el;
323
+ };
324
+ const loadingDirective = {
325
+ mounted: function(el, binding, vnode) {
326
+ handleProps(el, vnode.props);
327
+ removeAttribute(el);
328
+ !isEmpty(binding.value) && toggleLoading(el, binding);
329
+ },
330
+ updated: function(el, binding, vnode) {
331
+ if (!isEmpty(binding.value) && cacheInstance.has(el) || isEmpty(binding.value) && !cacheInstance.has(el)) {
332
+ return;
333
+ }
334
+ !cacheInstance.has(el) && handleProps(el, vnode.props);
335
+ removeAttribute(el);
336
+ toggleLoading(el, binding);
337
+ }
338
+ };
89
339
  function className(classStr, classOpt) {
90
340
  let classname = classStr;
91
341
  if (typeof classOpt === "object") {
@@ -117,6 +367,7 @@ const useInput = (inputValue, ctx2) => {
117
367
  const handleInput = (event) => {
118
368
  const value = event.target.value;
119
369
  inputValue.value = value;
370
+ ctx2.emit("update:modelValue", value);
120
371
  onInputChange(value);
121
372
  };
122
373
  return {
@@ -135,7 +386,7 @@ const useLazyLoad = (dropdownRef, inputValue, filterOtion, ctx2) => {
135
386
  };
136
387
  return { loadMore };
137
388
  };
138
- const useKeyboardSelect = (dropdownRef, visible, inputValue, filteredOptions, optionDisabledKey, filterOption, loading, handleClick, closeMenu, toggleMenu) => {
389
+ const useKeyboardSelect = (dropdownRef, visible, inputValue, filteredOptions, optionDisabledKey, filterOption, loading2, handleClick, closeMenu, toggleMenu) => {
139
390
  const hoverIndex = ref(0);
140
391
  const selectedIndex = ref(0);
141
392
  const updateHoveringIndex = (index2) => {
@@ -165,14 +416,11 @@ const useKeyboardSelect = (dropdownRef, visible, inputValue, filteredOptions, op
165
416
  };
166
417
  const handleEnter = () => {
167
418
  const len = filteredOptions.value.length;
168
- if (!visible.value) {
169
- toggleMenu();
170
- } else if (!len || len === 1) {
171
- closeMenu();
172
- } else if (len && len !== 1) {
173
- handleClick(filteredOptions.value[hoverIndex.value]);
174
- closeMenu();
419
+ if (!visible.value || !len) {
420
+ return toggleMenu();
175
421
  }
422
+ len && len === 1 ? handleClick(filteredOptions.value[0]) : handleClick(filteredOptions.value[hoverIndex.value]);
423
+ return closeMenu();
176
424
  };
177
425
  const handleKeyboardNavigation = (direction) => {
178
426
  const len = filteredOptions.value.length;
@@ -182,7 +430,7 @@ const useKeyboardSelect = (dropdownRef, visible, inputValue, filteredOptions, op
182
430
  if (!["ArrowDown", "ArrowUp"].includes(direction)) {
183
431
  return;
184
432
  }
185
- if (filterOption === false && loading.value) {
433
+ if (filterOption === false && loading2.value) {
186
434
  return;
187
435
  }
188
436
  let newIndex = 0;
@@ -210,7 +458,6 @@ const useKeyboardSelect = (dropdownRef, visible, inputValue, filteredOptions, op
210
458
  const keyCode = event.key || event.code;
211
459
  switch (keyCode) {
212
460
  case "Escape":
213
- event.preventDefault();
214
461
  handleEscape();
215
462
  break;
216
463
  case "Enter":
@@ -222,20 +469,186 @@ const useKeyboardSelect = (dropdownRef, visible, inputValue, filteredOptions, op
222
469
  };
223
470
  return { handleKeydown, hoverIndex, selectedIndex };
224
471
  };
472
+ const flexibleOverlayProps = {
473
+ modelValue: {
474
+ type: Boolean,
475
+ default: false
476
+ },
477
+ origin: {
478
+ type: Object,
479
+ require: true
480
+ },
481
+ position: {
482
+ type: Array,
483
+ default: ["bottom"]
484
+ },
485
+ offset: {
486
+ type: [Number, Object],
487
+ default: 8
488
+ },
489
+ shiftOffset: {
490
+ type: Number
491
+ },
492
+ align: {
493
+ type: String,
494
+ default: null
495
+ },
496
+ showArrow: {
497
+ type: Boolean,
498
+ default: false
499
+ },
500
+ isArrowCenter: {
501
+ type: Boolean,
502
+ default: true
503
+ }
504
+ };
505
+ function getScrollParent(element) {
506
+ const overflowRegex = /(auto|scroll|hidden)/;
507
+ for (let parent = element; parent = parent.parentElement; parent.parentElement !== document.body) {
508
+ const style = window.getComputedStyle(parent);
509
+ if (overflowRegex.test(style.overflow + style.overflowX + style.overflowY)) {
510
+ return parent;
511
+ }
512
+ }
513
+ return window;
514
+ }
515
+ function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
516
+ let { x, y } = point;
517
+ if (!isArrowCenter) {
518
+ const { width, height } = originRect;
519
+ if (x && placement.includes("start")) {
520
+ x = 12;
521
+ }
522
+ if (x && placement.includes("end")) {
523
+ x = Math.round(width - 24);
524
+ }
525
+ if (y && placement.includes("start")) {
526
+ y = 10;
527
+ }
528
+ if (y && placement.includes("end")) {
529
+ y = height - 14;
530
+ }
531
+ }
532
+ return { x, y };
533
+ }
534
+ function useOverlay(props, emit) {
535
+ const overlayRef = ref();
536
+ const arrowRef = ref();
537
+ let originParent = null;
538
+ const updateArrowPosition = (arrowEl, placement, point, overlayEl) => {
539
+ const { x, y } = adjustArrowPosition(props.isArrowCenter, point, placement, overlayEl.getBoundingClientRect());
540
+ const staticSide = {
541
+ top: "bottom",
542
+ right: "left",
543
+ bottom: "top",
544
+ left: "right"
545
+ }[placement.split("-")[0]];
546
+ Object.assign(arrowEl.style, {
547
+ left: x ? `${x}px` : "",
548
+ top: y ? `${y}px` : "",
549
+ right: "",
550
+ bottom: "",
551
+ [staticSide]: "-4px"
552
+ });
553
+ };
554
+ const updatePosition = async () => {
555
+ const hostEl = props.origin;
556
+ const overlayEl = unref(overlayRef.value);
557
+ const arrowEl = unref(arrowRef.value);
558
+ const middleware = [
559
+ offset(props.offset),
560
+ autoPlacement({
561
+ alignment: props.align,
562
+ allowedPlacements: props.position
563
+ })
564
+ ];
565
+ props.showArrow && middleware.push(arrow({ element: arrowEl }));
566
+ props.shiftOffset !== void 0 && middleware.push(shift());
567
+ const { x, y, placement, middlewareData } = await computePosition(hostEl, overlayEl, {
568
+ strategy: "fixed",
569
+ middleware
570
+ });
571
+ let applyX = x;
572
+ let applyY = y;
573
+ if (props.shiftOffset !== void 0) {
574
+ const { x: shiftX, y: shiftY } = middlewareData.shift;
575
+ shiftX < 0 && (applyX -= props.shiftOffset);
576
+ shiftX > 0 && (applyX += props.shiftOffset);
577
+ shiftY < 0 && (applyY -= props.shiftOffset);
578
+ shiftY > 0 && (applyY += props.shiftOffset);
579
+ }
580
+ emit("positionChange", placement);
581
+ Object.assign(overlayEl.style, { top: `${applyY}px`, left: `${applyX}px` });
582
+ props.showArrow && updateArrowPosition(arrowEl, placement, middlewareData.arrow, overlayEl);
583
+ };
584
+ watch(() => props.modelValue, () => {
585
+ if (props.modelValue && props.origin) {
586
+ originParent = getScrollParent(props.origin);
587
+ nextTick(updatePosition);
588
+ originParent == null ? void 0 : originParent.addEventListener("scroll", updatePosition);
589
+ originParent !== window && window.addEventListener("scroll", updatePosition);
590
+ window.addEventListener("resize", updatePosition);
591
+ } else {
592
+ originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
593
+ originParent !== window && window.removeEventListener("scroll", updatePosition);
594
+ window.removeEventListener("resize", updatePosition);
595
+ }
596
+ });
597
+ onUnmounted(() => {
598
+ originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
599
+ originParent !== window && window.removeEventListener("scroll", updatePosition);
600
+ window.removeEventListener("resize", updatePosition);
601
+ });
602
+ return { arrowRef, overlayRef, updatePosition };
603
+ }
604
+ var flexibleOverlay = "";
605
+ const FlexibleOverlay = defineComponent({
606
+ name: "DFlexibleOverlay",
607
+ inheritAttrs: false,
608
+ props: flexibleOverlayProps,
609
+ emits: ["update:modelValue", "positionChange"],
610
+ setup(props, {
611
+ slots,
612
+ attrs,
613
+ emit,
614
+ expose
615
+ }) {
616
+ const ns = useNamespace("flexible-overlay");
617
+ const {
618
+ arrowRef,
619
+ overlayRef,
620
+ updatePosition
621
+ } = useOverlay(props, emit);
622
+ expose({
623
+ updatePosition
624
+ });
625
+ return () => {
626
+ var _a;
627
+ return props.modelValue && createVNode("div", mergeProps({
628
+ "ref": overlayRef,
629
+ "class": ns.b()
630
+ }, attrs), [(_a = slots.default) == null ? void 0 : _a.call(slots), props.showArrow && createVNode("div", {
631
+ "ref": arrowRef,
632
+ "class": ns.e("arrow")
633
+ }, null)]);
634
+ };
635
+ }
636
+ });
225
637
  var EditableSelect = defineComponent({
226
638
  name: "DEditableSelect",
227
639
  directives: {
228
- clickOutside: clickoutsideDirective
640
+ clickOutside: clickoutsideDirective,
641
+ dLoading: loadingDirective
229
642
  },
230
643
  props: editableSelectProps,
231
644
  emits: ["update:modelValue", "search", "loadMore"],
232
645
  setup(props, ctx2) {
233
646
  const dropdownRef = ref();
234
647
  const origin = ref();
235
- const position = ref(["bottom", "left"]);
648
+ const position = ref(["bottom"]);
236
649
  const visible = ref(false);
237
- const inputValue = ref(props.modelValue || "");
238
- const loading = ref(props.loading);
650
+ const inputValue = ref(props.modelValue);
651
+ const loading2 = ref(props.loading);
239
652
  const normalizeOptions = computed(() => {
240
653
  return props.options.map((option) => {
241
654
  if (typeof option === "object") {
@@ -261,7 +674,7 @@ var EditableSelect = defineComponent({
261
674
  return text;
262
675
  });
263
676
  watch(() => props.loading, (newVal) => {
264
- loading.value = newVal;
677
+ loading2.value = newVal;
265
678
  });
266
679
  const toggleMenu = () => {
267
680
  visible.value = !visible.value;
@@ -289,7 +702,7 @@ var EditableSelect = defineComponent({
289
702
  handleKeydown,
290
703
  hoverIndex,
291
704
  selectedIndex
292
- } = useKeyboardSelect(dropdownRef, visible, inputValue, filteredOptions, props.optionDisabledKey, props.filterOption, loading, handleClick, closeMenu, toggleMenu);
705
+ } = useKeyboardSelect(dropdownRef, visible, inputValue, filteredOptions, props.optionDisabledKey, props.filterOption, loading2, handleClick, closeMenu, toggleMenu);
293
706
  watch(() => props.modelValue, (newVal) => {
294
707
  if (newVal) {
295
708
  inputValue.value = newVal;
@@ -309,6 +722,9 @@ var EditableSelect = defineComponent({
309
722
  const selectCls = className("devui-editable-select devui-form-group devui-has-feedback", {
310
723
  "devui-select-open": visible.value === true
311
724
  });
725
+ const inputCls = className("devui-form-control devui-dropdown-origin", {
726
+ "devui-dropdown-origin-open": visible.value === true
727
+ });
312
728
  return withDirectives(createVNode("div", {
313
729
  "class": selectCls,
314
730
  "ref": origin,
@@ -316,7 +732,7 @@ var EditableSelect = defineComponent({
316
732
  width: props.width + "px"
317
733
  }
318
734
  }, [createVNode("input", {
319
- "class": "devui-form-control devui-dropdown-origin devui-dropdown-origin-open",
735
+ "class": inputCls,
320
736
  "onClick": withModifiers(toggleMenu, ["self"]),
321
737
  "onInput": handleInput,
322
738
  "onKeydown": handleKeydown,
@@ -330,7 +746,7 @@ var EditableSelect = defineComponent({
330
746
  "class": "devui-select-chevron-icon"
331
747
  }, [createVNode(resolveComponent("d-icon"), {
332
748
  "name": "select-arrow"
333
- }, null)])]), createVNode(resolveComponent("d-flexible-overlay"), {
749
+ }, null)])]), createVNode(FlexibleOverlay, {
334
750
  "origin": origin.value,
335
751
  "modelValue": visible.value,
336
752
  "onUpdate:modelValue": ($event) => visible.value = $event,
@@ -338,12 +754,11 @@ var EditableSelect = defineComponent({
338
754
  "hasBackdrop": false
339
755
  }, {
340
756
  default: () => [createVNode("div", {
341
- "class": "devui-editable-select-dropdown",
342
757
  "style": {
343
758
  width: props.width + "px"
344
759
  }
345
760
  }, [withDirectives(createVNode("div", {
346
- "class": "devui-dropdown-menu"
761
+ "class": "devui-dropdown-menu "
347
762
  }, [createVNode("ul", {
348
763
  "ref": dropdownRef,
349
764
  "class": "devui-list-unstyled scroll-height",
@@ -1 +1 @@
1
- (function(u,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(u=typeof globalThis!="undefined"?globalThis:u||self,t(u.index={},u.Vue))})(this,function(u,t){"use strict";const N={options:{type:Array,default:()=>[]},disabled:{type:Boolean},loading:{type:Boolean},optionDisabledKey:{type:String,default:""},placeholder:{type:String,default:"Search"},modelValue:{type:String},width:{type:Number},maxHeight:{type:Number},filterOption:{type:[Function,Boolean]}},B=typeof window!="undefined";function x(e,l,o){document.addEventListener?e&&l&&o&&e.addEventListener(l,o,!1):e&&l&&o&&e.attachEvent("on"+l,o)}const f=Symbol("@@clickoutside"),S=new Map;let F,E=0,K=!0;function H(e,l,o){return B&&K&&(K=!1,x(document,"mousedown",a=>{F=a}),x(document,"mouseup",a=>{for(const[c,i]of S)i[f].documentHandler(a,F)})),function(a,c){!o||!l.instance||!a.target||!c.target||e.contains(a.target)||e.contains(c.target)||e===a.target||e[f].bindingFn&&e[f].bindingFn()}}const O={beforeMount:function(e,l,o){E++,S.set(E,e),e[f]={nid:E,documentHandler:H(e,l,o),bindingFn:l.value}},updated:function(e,l,o){e[f].documentHandler=H(e,l,o),e[f].bindingFn=l.value},unmounted:function(e){S.delete(e[f].nid),delete e[f]}};function L(e,l){let o=e;return typeof l=="object"&&Object.keys(l).forEach(a=>{l[a]&&(o+=` ${a}`)}),o}var q="";const T=()=>(e,l)=>l.label.toLocaleLowerCase().indexOf(e.toLocaleLowerCase())>-1,j=(e,l,o)=>t.computed(()=>{const a=[];if(!l.value||o===!1)return e.value;const c=typeof o=="function"?o:T();return e.value.forEach(i=>{c(l.value,i)&&a.push(i)}),a}),A=(e,l)=>{const o=c=>{l.emit("search",c)};return{handleInput:c=>{const i=c.target.value;e.value=i,o(i)}}},R=(e,l,o,a)=>({loadMore:()=>{const i=e.value;o===!1&&i.clientHeight+i.scrollTop>=i.scrollHeight&&a.emit("loadMore",l.value)}}),P=(e,l,o,a,c,i,v,y,g,h)=>{const m=t.ref(0),p=t.ref(0),w=d=>{m.value=d},C=d=>{const r=e.value,n=r.children[d];t.nextTick(()=>{if(n.scrollIntoViewIfNeeded)n.scrollIntoViewIfNeeded(!1);else{const s=r.getBoundingClientRect(),b=n.getBoundingClientRect();(b.bottom>s.bottom||b.top<s.top)&&n.scrollIntoView(!1)}})},D=()=>{o.value?o.value="":g()},I=()=>{const d=a.value.length;l.value?!d||d===1?g():d&&d!==1&&(y(a.value[m.value]),g()):h()},V=d=>{const r=a.value.length;if(!r||r===1||!["ArrowDown","ArrowUp"].includes(d)||i===!1&&v.value)return;let n=0;if(n=m.value,d==="ArrowUp"?(n-=1,n===-1&&(n=r-1)):d==="ArrowDown"&&(n+=1,n===r&&(n=0)),m.value=n,a.value[n][c])return V(d);w(n),C(n)};return{handleKeydown:d=>{const r=d.key||d.code;switch(r){case"Escape":d.preventDefault(),D();break;case"Enter":I();break;default:V(r)}},hoverIndex:m,selectedIndex:p}};var k=t.defineComponent({name:"DEditableSelect",directives:{clickOutside:O},props:N,emits:["update:modelValue","search","loadMore"],setup(e,l){const o=t.ref(),a=t.ref(),c=t.ref(["bottom","left"]),i=t.ref(!1),v=t.ref(e.modelValue||""),y=t.ref(e.loading),g=t.computed(()=>e.options.map(n=>typeof n=="object"?Object.assign({},n,{label:n.label?n.label:n.value,value:n.value}):{label:n+"",value:n})),h=j(g,v,e.filterOption),m=t.computed(()=>{let n="";return e.filterOption!==!1&&!h.value.length?n="\u627E\u4E0D\u5230\u76F8\u5173\u8BB0\u5F55":e.filterOption===!1&&!h.value.length&&(n="\u6CA1\u6709\u6570\u636E"),n});t.watch(()=>e.loading,n=>{y.value=n});const p=()=>{i.value=!i.value},w=()=>{i.value=!1},{loadMore:C}=R(o,v,e.filterOption,l),{handleInput:D}=A(v,l),I=n=>{const{optionDisabledKey:s}=e;s&&!!n[s]||(l.emit("update:modelValue",n.label),w())},{handleKeydown:V,hoverIndex:M,selectedIndex:d}=P(o,i,v,h,e.optionDisabledKey,e.filterOption,y,I,w,p);t.watch(()=>e.modelValue,n=>{n&&(v.value=n)});const r=(n,s)=>{const{optionDisabledKey:b}=e;return L("devui-dropdown-item",{disabled:b?!!n[b]:!1,selected:s===d.value,"devui-dropdown-bg":s===M.value})};return()=>{const n=L("devui-editable-select devui-form-group devui-has-feedback",{"devui-select-open":i.value===!0});return t.withDirectives(t.createVNode("div",{class:n,ref:a,style:{width:e.width+"px"}},[t.createVNode("input",{class:"devui-form-control devui-dropdown-origin devui-dropdown-origin-open",onClick:t.withModifiers(p,["self"]),onInput:D,onKeydown:V,value:v.value,disabled:e.disabled,placeholder:e.placeholder,type:"text"},null),t.createVNode("span",{class:"devui-form-control-feedback"},[t.createVNode("span",{class:"devui-select-chevron-icon"},[t.createVNode(t.resolveComponent("d-icon"),{name:"select-arrow"},null)])]),t.createVNode(t.resolveComponent("d-flexible-overlay"),{origin:a.value,modelValue:i.value,"onUpdate:modelValue":s=>i.value=s,position:c.value,hasBackdrop:!1},{default:()=>[t.createVNode("div",{class:"devui-editable-select-dropdown",style:{width:e.width+"px"}},[t.withDirectives(t.createVNode("div",{class:"devui-dropdown-menu"},[t.createVNode("ul",{ref:o,class:"devui-list-unstyled scroll-height",style:{maxHeight:e.maxHeight+"px"},onScroll:C},[h.value.map((s,b)=>t.createVNode("li",{class:r(s,b),onClick:_=>{_.stopPropagation(),I(s)}},[l.slots.item?l.slots.item(s):s.label])),t.withDirectives(t.createVNode("li",{class:"devui-no-result-template"},[t.createVNode("div",{class:"devui-no-data-tip"},[l.slots.noResultItem?l.slots.noResultItem():m.value])]),[[t.vShow,!h.value.length]])])]),[[t.resolveDirective("dLoading"),e.loading],[t.vShow,i.value]])])]})]),[[t.resolveDirective("click-outside"),w]])}}}),U={title:"EditableSelect \u53EF\u8F93\u5165\u4E0B\u62C9\u9009\u62E9\u6846",category:"\u6570\u636E\u5F55\u5165",status:"100%",install(e){e.component(k.name,k)}};u.EditableSelect=k,u.default=U,u.editableSelectProps=N,Object.defineProperty(u,"__esModule",{value:!0}),u[Symbol.toStringTag]="Module"});
1
+ var be=Object.defineProperty;var G=Object.getOwnPropertySymbols;var Ve=Object.prototype.hasOwnProperty,xe=Object.prototype.propertyIsEnumerable;var T=(d,t,f)=>t in d?be(d,t,{enumerable:!0,configurable:!0,writable:!0,value:f}):d[t]=f,L=(d,t)=>{for(var f in t||(t={}))Ve.call(t,f)&&T(d,f,t[f]);if(G)for(var f of G(t))xe.call(t,f)&&T(d,f,t[f]);return d};var b=(d,t,f)=>(T(d,typeof t!="symbol"?t+"":t,f),f);(function(d,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue"),require("@floating-ui/dom")):typeof define=="function"&&define.amd?define(["exports","vue","@floating-ui/dom"],t):(d=typeof globalThis!="undefined"?globalThis:d||self,t(d.index={},d.Vue,d.dom))})(this,function(d,t,f){"use strict";const j={options:{type:Array,default:()=>[]},disabled:{type:Boolean},loading:{type:Boolean},optionDisabledKey:{type:String,default:""},placeholder:{type:String,default:"Search"},modelValue:{type:String,default:""},width:{type:Number},maxHeight:{type:Number},filterOption:{type:[Function,Boolean]}},J=typeof window!="undefined";function M(e,o,n){document.addEventListener?e&&o&&n&&e.addEventListener(o,n,!1):e&&o&&n&&e.attachEvent("on"+o,n)}const x=Symbol("@@clickoutside"),I=new Map;let R,D=0,K=!0;function z(e,o,n){return J&&K&&(K=!1,M(document,"mousedown",l=>{R=l}),M(document,"mouseup",l=>{for(const[a,i]of I)i[x].documentHandler(l,R)})),function(l,a){!n||!o.instance||!l.target||!a.target||e.contains(l.target)||e.contains(a.target)||e===l.target||e[x].bindingFn&&e[x].bindingFn()}}const Q={beforeMount:function(e,o,n){D++,I.set(D,e),e[x]={nid:D,documentHandler:z(e,o,n),bindingFn:o.value}},updated:function(e,o,n){e[x].documentHandler=z(e,o,n),e[x].bindingFn=o.value},unmounted:function(e){I.delete(e[x].nid),delete e[x]}};class H{constructor(){b(this,"top","50%");b(this,"left","50%")}}const Z={message:String,backdrop:Boolean,view:{type:Object,default:()=>new H},zIndex:Number,isFull:{type:Boolean,default:!1}};class ee{constructor(){b(this,"target");b(this,"message");b(this,"loadingTemplateRef");b(this,"backdrop",!0);b(this,"positionType","relative");b(this,"view",new H);b(this,"zIndex")}}function k(e,o,n){let l=e;return o&&(l+=`__${o}`),n&&(l+=`--${n}`),l}function $(e,o=!1){const n=o?`.devui-${e}`:`devui-${e}`;return{b:()=>k(n),e:c=>c?k(n,c):"",m:c=>c?k(n,"",c):"",em:(c,m)=>c&&m?k(n,c,m):""}}var Ee="",te=t.defineComponent({name:"DLoading",inheritAttrs:!1,props:Z,setup(e){const o={top:e.view.top,left:e.view.left,zIndex:e.zIndex};e.message||(o.background="none");const n=t.ref(!1);return{style:o,isShow:n,open:()=>{n.value=!0},close:()=>{n.value=!1}}},render(){var c;const{isShow:e,isFull:o,backdrop:n,style:l,message:a,$slots:i}=this,s=$("loading");return e&&t.createVNode("div",{class:[s.b(),o?s.m("full"):""]},[((c=i.default)==null?void 0:c.call(i))||t.createVNode("div",{class:s.e("wrapper")},[n?t.createVNode("div",{class:s.e("mask")},null):null,t.createVNode("div",{style:l,class:s.e("area")},[t.createVNode("div",{class:s.e("busy-default-spinner")},[t.createVNode("div",{class:s.e("bar1")},null),t.createVNode("div",{class:s.e("bar2")},null),t.createVNode("div",{class:s.e("bar3")},null),t.createVNode("div",{class:s.e("bar4")},null)]),a?t.createVNode("span",{class:s.e("text")},[a]):null])])])}});const _=Symbol("dev_component_container");function ne(e,o,n=null){const l=t.h(e,L({},o),n),a=document.createElement("div");return l[_]=a,t.render(l,a),l.component}function oe(e){t.render(null,e==null?void 0:e.vnode[_])}const le=t.defineComponent(te),C=new WeakSet,B=e=>{if(!e)return!0;if(Array.isArray(e))return e.length===0;if(e instanceof Set||e instanceof Map)return e.size===0;if(e instanceof Promise)return!1;if(typeof e=="object")try{return Object.keys(e).length===0}catch{return!1}return!1},U=e=>Object.prototype.toString.call(e).slice(8,-1).toLowerCase(),ae=e=>{switch(U(e)){case"promise":return[e];case"array":return e.some(n=>U(n)!=="promise")?(console.error(new TypeError("Binding values should all be of type Promise")),"error"):e;default:return!1}},Y=e=>{C.delete(e),e.instance.proxy.close(),oe(e.instance)},q=(e,o)=>{var n,l,a;if(o.value){const i=ae(o.value);if(i==="error")return;(a=(l=(n=e==null?void 0:e.instance)==null?void 0:n.proxy)==null?void 0:l.open)==null||a.call(l),e.appendChild(e.mask),C.add(e),i&&Promise.all(i).catch(s=>{console.error(new Error("Promise handling errors"),s)}).finally(()=>{Y(e)})}else Y(e)},X=e=>{e.removeAttribute("zindex"),e.removeAttribute("positiontype"),e.removeAttribute("backdrop"),e.removeAttribute("message"),e.removeAttribute("view"),e.removeAttribute("loadingtemplateref")},W=(e,o)=>{var i;const n=L(L({},new ee),o),l=n.loadingTemplateRef,a=ne(le,L({},n),l?()=>l:null);e.style.position=n.positionType,e.options=n,e.instance=a,e.mask=(i=a==null?void 0:a.proxy)==null?void 0:i.$el},ie={mounted:function(e,o,n){W(e,n.props),X(e),!B(o.value)&&q(e,o)},updated:function(e,o,n){!B(o.value)&&C.has(e)||B(o.value)&&!C.has(e)||(!C.has(e)&&W(e,n.props),X(e),q(e,o))}};function F(e,o){let n=e;return typeof o=="object"&&Object.keys(o).forEach(l=>{o[l]&&(n+=` ${l}`)}),n}var Ne="";const re=()=>(e,o)=>o.label.toLocaleLowerCase().indexOf(e.toLocaleLowerCase())>-1,se=(e,o,n)=>t.computed(()=>{const l=[];if(!o.value||n===!1)return e.value;const a=typeof n=="function"?n:re();return e.value.forEach(i=>{a(o.value,i)&&l.push(i)}),l}),ce=(e,o)=>{const n=a=>{o.emit("search",a)};return{handleInput:a=>{const i=a.target.value;e.value=i,o.emit("update:modelValue",i),n(i)}}},de=(e,o,n,l)=>({loadMore:()=>{const i=e.value;n===!1&&i.clientHeight+i.scrollTop>=i.scrollHeight&&l.emit("loadMore",o.value)}}),ue=(e,o,n,l,a,i,s,c,m,w)=>{const h=t.ref(0),V=t.ref(0),g=u=>{h.value=u},E=u=>{const y=e.value,r=y.children[u];t.nextTick(()=>{if(r.scrollIntoViewIfNeeded)r.scrollIntoViewIfNeeded(!1);else{const v=y.getBoundingClientRect(),p=r.getBoundingClientRect();(p.bottom>v.bottom||p.top<v.top)&&r.scrollIntoView(!1)}})},S=()=>{n.value?n.value="":m()},N=()=>{const u=l.value.length;return!o.value||!u?w():(c(u&&u===1?l.value[0]:l.value[h.value]),m())},O=u=>{const y=l.value.length;if(!y||y===1||!["ArrowDown","ArrowUp"].includes(u)||i===!1&&s.value)return;let r=0;if(r=h.value,u==="ArrowUp"?(r-=1,r===-1&&(r=y-1)):u==="ArrowDown"&&(r+=1,r===y&&(r=0)),h.value=r,l.value[r][a])return O(u);g(r),E(r)};return{handleKeydown:u=>{const y=u.key||u.code;switch(y){case"Escape":S();break;case"Enter":N();break;default:O(y)}},hoverIndex:h,selectedIndex:V}},fe={modelValue:{type:Boolean,default:!1},origin:{type:Object,require:!0},position:{type:Array,default:["bottom"]},offset:{type:[Number,Object],default:8},shiftOffset:{type:Number},align:{type:String,default:null},showArrow:{type:Boolean,default:!1},isArrowCenter:{type:Boolean,default:!0}};function me(e){const o=/(auto|scroll|hidden)/;for(let n=e;n=n.parentElement;n.parentElement!==document.body){const l=window.getComputedStyle(n);if(o.test(l.overflow+l.overflowX+l.overflowY))return n}return window}function we(e,o,n,l){let{x:a,y:i}=o;if(!e){const{width:s,height:c}=l;a&&n.includes("start")&&(a=12),a&&n.includes("end")&&(a=Math.round(s-24)),i&&n.includes("start")&&(i=10),i&&n.includes("end")&&(i=c-14)}return{x:a,y:i}}function he(e,o){const n=t.ref(),l=t.ref();let a=null;const i=(c,m,w,h)=>{const{x:V,y:g}=we(e.isArrowCenter,w,m,h.getBoundingClientRect()),E={top:"bottom",right:"left",bottom:"top",left:"right"}[m.split("-")[0]];Object.assign(c.style,{left:V?`${V}px`:"",top:g?`${g}px`:"",right:"",bottom:"",[E]:"-4px"})},s=async()=>{const c=e.origin,m=t.unref(n.value),w=t.unref(l.value),h=[f.offset(e.offset),f.autoPlacement({alignment:e.align,allowedPlacements:e.position})];e.showArrow&&h.push(f.arrow({element:w})),e.shiftOffset!==void 0&&h.push(f.shift());const{x:V,y:g,placement:E,middlewareData:S}=await f.computePosition(c,m,{strategy:"fixed",middleware:h});let N=V,O=g;if(e.shiftOffset!==void 0){const{x:A,y:u}=S.shift;A<0&&(N-=e.shiftOffset),A>0&&(N+=e.shiftOffset),u<0&&(O-=e.shiftOffset),u>0&&(O+=e.shiftOffset)}o("positionChange",E),Object.assign(m.style,{top:`${O}px`,left:`${N}px`}),e.showArrow&&i(w,E,S.arrow,m)};return t.watch(()=>e.modelValue,()=>{e.modelValue&&e.origin?(a=me(e.origin),t.nextTick(s),a==null||a.addEventListener("scroll",s),a!==window&&window.addEventListener("scroll",s),window.addEventListener("resize",s)):(a==null||a.removeEventListener("scroll",s),a!==window&&window.removeEventListener("scroll",s),window.removeEventListener("resize",s))}),t.onUnmounted(()=>{a==null||a.removeEventListener("scroll",s),a!==window&&window.removeEventListener("scroll",s),window.removeEventListener("resize",s)}),{arrowRef:l,overlayRef:n,updatePosition:s}}var Oe="";const ye=t.defineComponent({name:"DFlexibleOverlay",inheritAttrs:!1,props:fe,emits:["update:modelValue","positionChange"],setup(e,{slots:o,attrs:n,emit:l,expose:a}){const i=$("flexible-overlay"),{arrowRef:s,overlayRef:c,updatePosition:m}=he(e,l);return a({updatePosition:m}),()=>{var w;return e.modelValue&&t.createVNode("div",t.mergeProps({ref:c,class:i.b()},n),[(w=o.default)==null?void 0:w.call(o),e.showArrow&&t.createVNode("div",{ref:s,class:i.e("arrow")},null)])}}});var P=t.defineComponent({name:"DEditableSelect",directives:{clickOutside:Q,dLoading:ie},props:j,emits:["update:modelValue","search","loadMore"],setup(e,o){const n=t.ref(),l=t.ref(),a=t.ref(["bottom"]),i=t.ref(!1),s=t.ref(e.modelValue),c=t.ref(e.loading),m=t.computed(()=>e.options.map(r=>typeof r=="object"?Object.assign({},r,{label:r.label?r.label:r.value,value:r.value}):{label:r+"",value:r})),w=se(m,s,e.filterOption),h=t.computed(()=>{let r="";return e.filterOption!==!1&&!w.value.length?r="\u627E\u4E0D\u5230\u76F8\u5173\u8BB0\u5F55":e.filterOption===!1&&!w.value.length&&(r="\u6CA1\u6709\u6570\u636E"),r});t.watch(()=>e.loading,r=>{c.value=r});const V=()=>{i.value=!i.value},g=()=>{i.value=!1},{loadMore:E}=de(n,s,e.filterOption,o),{handleInput:S}=ce(s,o),N=r=>{const{optionDisabledKey:v}=e;v&&!!r[v]||(o.emit("update:modelValue",r.label),g())},{handleKeydown:O,hoverIndex:A,selectedIndex:u}=ue(n,i,s,w,e.optionDisabledKey,e.filterOption,c,N,g,V);t.watch(()=>e.modelValue,r=>{r&&(s.value=r)});const y=(r,v)=>{const{optionDisabledKey:p}=e;return F("devui-dropdown-item",{disabled:p?!!r[p]:!1,selected:v===u.value,"devui-dropdown-bg":v===A.value})};return()=>{const r=F("devui-editable-select devui-form-group devui-has-feedback",{"devui-select-open":i.value===!0}),v=F("devui-form-control devui-dropdown-origin",{"devui-dropdown-origin-open":i.value===!0});return t.withDirectives(t.createVNode("div",{class:r,ref:l,style:{width:e.width+"px"}},[t.createVNode("input",{class:v,onClick:t.withModifiers(V,["self"]),onInput:S,onKeydown:O,value:s.value,disabled:e.disabled,placeholder:e.placeholder,type:"text"},null),t.createVNode("span",{class:"devui-form-control-feedback"},[t.createVNode("span",{class:"devui-select-chevron-icon"},[t.createVNode(t.resolveComponent("d-icon"),{name:"select-arrow"},null)])]),t.createVNode(ye,{origin:l.value,modelValue:i.value,"onUpdate:modelValue":p=>i.value=p,position:a.value,hasBackdrop:!1},{default:()=>[t.createVNode("div",{style:{width:e.width+"px"}},[t.withDirectives(t.createVNode("div",{class:"devui-dropdown-menu "},[t.createVNode("ul",{ref:n,class:"devui-list-unstyled scroll-height",style:{maxHeight:e.maxHeight+"px"},onScroll:E},[w.value.map((p,ve)=>t.createVNode("li",{class:y(p,ve),onClick:ge=>{ge.stopPropagation(),N(p)}},[o.slots.item?o.slots.item(p):p.label])),t.withDirectives(t.createVNode("li",{class:"devui-no-result-template"},[t.createVNode("div",{class:"devui-no-data-tip"},[o.slots.noResultItem?o.slots.noResultItem():h.value])]),[[t.vShow,!w.value.length]])])]),[[t.resolveDirective("dLoading"),e.loading],[t.vShow,i.value]])])]})]),[[t.resolveDirective("click-outside"),g]])}}}),pe={title:"EditableSelect \u53EF\u8F93\u5165\u4E0B\u62C9\u9009\u62E9\u6846",category:"\u6570\u636E\u5F55\u5165",status:"100%",install(e){e.component(P.name,P)}};d.EditableSelect=P,d.default=pe,d.editableSelectProps=j,Object.defineProperty(d,"__esModule",{value:!0}),d[Symbol.toStringTag]="Module"});
@@ -1 +1 @@
1
- @charset "UTF-8";.devui-editable-select .devui-select-chevron-icon{display:inline-flex;vertical-align:middle;transition:transform var(--devui-animation-duration-slow, .3s) var(--devui-animation-ease-in-out-smooth, cubic-bezier(.645, .045, .355, 1))}.devui-editable-select input::-ms-clear{display:none}.devui-editable-select .devui-no-data-tip{user-select:none;cursor:not-allowed}.devui-editable-select .devui-form-control{outline:none;padding-right:24px}.devui-editable-select .devui-dropdown-menu{width:100%;display:block;top:auto!important;left:auto!important}.devui-editable-select .devui-dropdown-menu-cdk{position:static}.devui-editable-select .devui-dropdown-item{cursor:pointer;display:block;width:100%;padding:8px 12px;clear:both;border:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:14px}.devui-editable-select .devui-dropdown-menu .devui-dropdown-item:not(.disabled).selected{color:var(--devui-list-item-active-text, #ffffff);background-color:var(--devui-list-item-active-bg, #5e7ce0)}.devui-editable-select .devui-no-result-template,.devui-editable-select .devui-is-searching-template{display:block;width:100%;padding:8px 12px;clear:both;border:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:not-allowed;background-color:var(--devui-disabled-bg, #f5f5f6);color:var(--devui-disabled-text, #adb0b8);line-height:14px}.devui-editable-select .devui-no-result-template:hover,.devui-editable-select .devui-no-result-template:active,.devui-editable-select .devui-no-result-template:hover:active,.devui-editable-select .devui-is-searching-template:hover,.devui-editable-select .devui-is-searching-template:active,.devui-editable-select .devui-is-searching-template:hover:active{background-color:var(--devui-unavailable, #f5f5f6)}.devui-editable-select .devui-dropdown-item.disabled,.devui-editable-select .devui-dropdown-item.disabled:hover{cursor:not-allowed;color:var(--devui-disabled-text, #adb0b8)}.devui-editable-select ul.devui-list-unstyled{margin:0;overflow-y:auto;padding:0}.devui-editable-select .devui-dropdown-bg{background:var(--devui-list-item-hover-bg, #f2f5fc)}.devui-editable-select .devui-popup-tips{color:var(--devui-text-weak, #575d6c);padding:4px 12px}.devui-editable-select.devui-select-open .devui-select-chevron-icon{transform:rotate(180deg)}.devui-editable-select.devui-select-open .devui-select-chevron-icon svg path{fill:var(--devui-text-weak, #575d6c)}.devui-editable-select.devui-form-group.devui-has-feedback>.devui-form-control-feedback{line-height:26px}.devui-editable-select-dropdown .devui-dropdown-menu{width:100%;display:block;top:auto!important;left:auto!important}.devui-editable-select-dropdown .devui-dropdown-menu-cdk{position:static}.devui-editable-select-dropdown .devui-dropdown-item{cursor:pointer;display:block;width:100%;padding:8px 12px;clear:both;border:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:14px}.devui-editable-select-dropdown .devui-dropdown-menu .devui-dropdown-item:not(.disabled).selected{color:var(--devui-list-item-active-text, #ffffff);background-color:var(--devui-list-item-active-bg, #5e7ce0)}.devui-editable-select-dropdown .devui-no-result-template,.devui-editable-select-dropdown .devui-is-searching-template{display:block;width:100%;padding:8px 12px;clear:both;border:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:not-allowed;background-color:var(--devui-disabled-bg, #f5f5f6);color:var(--devui-disabled-text, #adb0b8);line-height:14px}.devui-editable-select-dropdown .devui-no-result-template:hover,.devui-editable-select-dropdown .devui-no-result-template:active,.devui-editable-select-dropdown .devui-no-result-template:hover:active,.devui-editable-select-dropdown .devui-is-searching-template:hover,.devui-editable-select-dropdown .devui-is-searching-template:active,.devui-editable-select-dropdown .devui-is-searching-template:hover:active{background-color:var(--devui-unavailable, #f5f5f6)}.devui-editable-select-dropdown .devui-dropdown-item.disabled,.devui-editable-select-dropdown .devui-dropdown-item.disabled:hover{cursor:not-allowed;color:var(--devui-disabled-text, #adb0b8)}.devui-editable-select-dropdown ul.devui-list-unstyled{margin:0;overflow-y:auto;padding:0}.devui-editable-select-dropdown .devui-dropdown-bg{background:var(--devui-list-item-hover-bg, #f2f5fc)}.devui-editable-select-dropdown .devui-popup-tips{color:var(--devui-text-weak, #575d6c);padding:4px 12px}
1
+ @keyframes devui-busy-spinner-anim{0%{transform:rotate(0) scale(1)}50%{transform:rotate(180deg) scale(1.5)}to{transform:rotate(360deg) scale(1)}}.devui-loading__mask{position:absolute;left:0;right:0;bottom:0;top:0;background-color:var(--devui-line, #adb0b8);opacity:.3}.devui-loading__wrapper{text-align:center}.devui-loading--full{position:fixed;left:0;right:0;bottom:0;top:0;z-index:9999}.devui-loading--hidden{overflow:hidden}.devui-loading__text{margin-left:10px}.devui-loading__area{position:absolute;transform:translate(-50%,-50%);padding:12px 14px;background:var(--devui-base-bg, #ffffff);border-radius:var(--devui-border-radius-card, 6px)}.devui-loading__busy-default-spinner{position:relative;display:inline-block;width:15px;height:15px;animation:devui-busy-spinner-anim 1s linear infinite}.devui-loading__busy-default-spinner div{position:absolute;left:44.5%;top:37%;width:6px;height:6px;border-radius:50%}.devui-loading__busy-default-spinner .devui-loading__bar1{top:0;left:0;background:#5e7ce0;background:var(--devui-brand, #5e7ce0)}.devui-loading__busy-default-spinner .devui-loading__bar2{top:0;left:9px;background:#859bff;background:var(--devui-brand-foil, #859bff)}.devui-loading__busy-default-spinner .devui-loading__bar3{top:9px;left:0;background:#859bff;background:var(--devui-brand-foil, #859bff)}.devui-loading__busy-default-spinner .devui-loading__bar4{top:9px;left:9px;background:#5e7ce0;background:var(--devui-brand, #5e7ce0)}@charset "UTF-8";.devui-editable-select .devui-select-chevron-icon{display:inline-flex;vertical-align:middle;transition:transform var(--devui-animation-duration-slow, .3s) var(--devui-animation-ease-in-out-smooth, cubic-bezier(.645, .045, .355, 1))}.devui-editable-select input::-ms-clear{display:none}.devui-editable-select .devui-no-data-tip{user-select:none;cursor:not-allowed}.devui-editable-select .devui-form-control{padding-right:24px}.devui-editable-select .devui-dropdown-menu{width:100%;margin:0;display:block;top:auto!important;left:auto!important}.devui-editable-select .devui-dropdown-menu-cdk{position:static}.devui-editable-select .devui-dropdown-item{cursor:pointer;display:block;width:100%;padding:8px 12px;clear:both;border:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:14px}.devui-editable-select .devui-dropdown-menu .devui-dropdown-item:not(.disabled).selected{color:var(--devui-list-item-active-text, #ffffff);background-color:var(--devui-list-item-active-bg, #5e7ce0)}.devui-editable-select .devui-no-result-template,.devui-editable-select .devui-is-searching-template{display:block;width:100%;padding:8px 12px;clear:both;border:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:not-allowed;background-color:var(--devui-disabled-bg, #f5f5f6);color:var(--devui-disabled-text, #adb0b8);line-height:14px}.devui-editable-select .devui-no-result-template:hover,.devui-editable-select .devui-no-result-template:active,.devui-editable-select .devui-no-result-template:hover:active,.devui-editable-select .devui-is-searching-template:hover,.devui-editable-select .devui-is-searching-template:active,.devui-editable-select .devui-is-searching-template:hover:active{background-color:var(--devui-unavailable, #f5f5f6)}.devui-editable-select .devui-dropdown-item.disabled,.devui-editable-select .devui-dropdown-item.disabled:hover{cursor:not-allowed;color:var(--devui-disabled-text, #adb0b8)}.devui-editable-select ul.devui-list-unstyled{margin:0;overflow-y:auto;padding:0}.devui-editable-select .devui-dropdown-bg{background:var(--devui-list-item-hover-bg, #f2f5fc)}.devui-editable-select .devui-popup-tips{color:var(--devui-text-weak, #575d6c);padding:4px 12px}.devui-editable-select.devui-select-open .devui-select-chevron-icon{transform:rotate(180deg)}.devui-editable-select.devui-select-open .devui-select-chevron-icon svg path{fill:var(--devui-text-weak, #575d6c)}.devui-editable-select.devui-form-group.devui-has-feedback>.devui-form-control-feedback{line-height:26px}.devui-flexible-overlay{position:fixed;border-radius:var(--devui-border-radius, 2px);background-color:var(--devui-connected-overlay-bg, #ffffff);box-shadow:var(--devui-shadow-connected-overlay, 0 2px 8px 0) var(--devui-shadow, rgba(37, 43, 58, .2));z-index:1000}.devui-flexible-overlay__arrow{position:absolute;width:8px;height:8px;transform:rotate(45deg);background-color:inherit}