vue-devui 1.0.0-pre.0 → 1.0.0-rc.2

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 (264) hide show
  1. package/README.md +126 -187
  2. package/alert/index.es.js +28 -30
  3. package/alert/index.umd.js +1 -1
  4. package/auto-complete/index.es.js +67 -82
  5. package/auto-complete/index.umd.js +3 -1
  6. package/auto-complete/style.css +1 -1
  7. package/badge/index.es.js +1 -1
  8. package/badge/index.umd.js +1 -1
  9. package/badge/style.css +1 -1
  10. package/button/index.es.js +39 -40
  11. package/button/index.umd.js +1 -1
  12. package/countdown/index.es.js +2 -1
  13. package/editable-select/index.es.js +122 -163
  14. package/editable-select/index.umd.js +1 -1
  15. package/fullscreen/index.es.js +13 -16
  16. package/fullscreen/index.umd.js +1 -1
  17. package/icon/index.es.js +39 -57
  18. package/icon/index.umd.js +1 -1
  19. package/image-preview/index.es.js +2 -1
  20. package/modal/index.es.js +81 -76
  21. package/modal/index.umd.js +1 -1
  22. package/modal/style.css +1 -1
  23. package/notification/index.es.js +38 -40
  24. package/notification/index.umd.js +1 -1
  25. package/nuxt/components/PanelBody.js +3 -0
  26. package/nuxt/components/PanelFooter.js +3 -0
  27. package/nuxt/components/PanelHeader.js +3 -0
  28. package/nuxt/components/Timeline.js +3 -0
  29. package/nuxt/components/TimelineItem.js +3 -0
  30. package/nuxt/components/alertProps.js +3 -0
  31. package/nuxt/components/fullscreenProps.js +3 -0
  32. package/nuxt/components/iconProps.js +2 -0
  33. package/nuxt/components/paginationProps.js +3 -0
  34. package/nuxt/components/panelProps.js +3 -0
  35. package/nuxt/components/searchProps.js +3 -0
  36. package/nuxt/components/tagProps.js +3 -0
  37. package/overlay/index.es.js +44 -37
  38. package/overlay/index.umd.js +1 -1
  39. package/overlay/style.css +1 -1
  40. package/package.json +8 -43
  41. package/pagination/index.es.js +10 -12
  42. package/pagination/index.umd.js +1 -1
  43. package/panel/index.es.js +45 -32
  44. package/panel/index.umd.js +1 -1
  45. package/popover/index.es.js +46 -39
  46. package/popover/index.umd.js +6 -6
  47. package/popover/style.css +1 -1
  48. package/progress/index.es.js +1 -1
  49. package/progress/index.umd.js +1 -1
  50. package/progress/style.css +1 -1
  51. package/radio/index.es.js +11 -11
  52. package/radio/index.umd.js +1 -1
  53. package/radio/style.css +1 -1
  54. package/read-tip/index.es.js +6 -3
  55. package/result/index.es.js +38 -53
  56. package/result/index.umd.js +1 -1
  57. package/ripple/index.es.js +47 -42
  58. package/ripple/index.umd.js +1 -1
  59. package/search/index.es.js +2 -5
  60. package/search/index.umd.js +4 -4
  61. package/skeleton/index.es.js +17 -17
  62. package/skeleton/index.umd.js +1 -1
  63. package/slider/index.es.js +60 -59
  64. package/slider/index.umd.js +1 -1
  65. package/splitter/index.es.js +215 -160
  66. package/splitter/index.umd.js +11 -11
  67. package/splitter/style.css +1 -1
  68. package/status/index.es.js +1 -4
  69. package/status/index.umd.js +1 -1
  70. package/status/style.css +1 -1
  71. package/style.css +1 -1
  72. package/tag/index.es.js +15 -18
  73. package/tag/index.umd.js +1 -1
  74. package/tag/style.css +1 -1
  75. package/tag-input/index.es.js +4 -2
  76. package/{accordion → timeline}/index.d.ts +0 -0
  77. package/{time-axis → timeline}/index.es.js +65 -78
  78. package/timeline/index.umd.js +1 -0
  79. package/{anchor → timeline}/package.json +1 -1
  80. package/timeline/style.css +1 -0
  81. package/upload/index.es.js +38 -40
  82. package/upload/index.umd.js +1 -1
  83. package/vue-devui.es.js +1478 -1196
  84. package/vue-devui.umd.js +19 -17
  85. package/accordion/index.es.js +0 -720
  86. package/accordion/index.umd.js +0 -1
  87. package/accordion/package.json +0 -7
  88. package/accordion/style.css +0 -1
  89. package/anchor/index.d.ts +0 -7
  90. package/anchor/index.es.js +0 -263
  91. package/anchor/index.umd.js +0 -1
  92. package/anchor/style.css +0 -1
  93. package/back-top/index.d.ts +0 -7
  94. package/back-top/index.es.js +0 -128
  95. package/back-top/index.umd.js +0 -1
  96. package/back-top/package.json +0 -7
  97. package/back-top/style.css +0 -1
  98. package/breadcrumb/index.d.ts +0 -7
  99. package/breadcrumb/index.es.js +0 -127
  100. package/breadcrumb/index.umd.js +0 -1
  101. package/breadcrumb/package.json +0 -7
  102. package/breadcrumb/style.css +0 -1
  103. package/carousel/index.d.ts +0 -7
  104. package/carousel/index.es.js +0 -329
  105. package/carousel/index.umd.js +0 -1
  106. package/carousel/package.json +0 -7
  107. package/carousel/style.css +0 -1
  108. package/cascader/index.d.ts +0 -7
  109. package/cascader/index.es.js +0 -5963
  110. package/cascader/index.umd.js +0 -27
  111. package/cascader/package.json +0 -7
  112. package/cascader/style.css +0 -1
  113. package/color-picker/index.d.ts +0 -7
  114. package/color-picker/index.es.js +0 -8187
  115. package/color-picker/index.umd.js +0 -27
  116. package/color-picker/package.json +0 -7
  117. package/color-picker/style.css +0 -1
  118. package/date-picker/index.d.ts +0 -7
  119. package/date-picker/index.es.js +0 -1171
  120. package/date-picker/index.umd.js +0 -1
  121. package/date-picker/package.json +0 -7
  122. package/date-picker/style.css +0 -1
  123. package/dragdrop/index.d.ts +0 -7
  124. package/dragdrop/index.es.js +0 -157
  125. package/dragdrop/index.umd.js +0 -1
  126. package/dragdrop/package.json +0 -7
  127. package/drawer/index.d.ts +0 -7
  128. package/drawer/index.es.js +0 -234
  129. package/drawer/index.umd.js +0 -1
  130. package/drawer/package.json +0 -7
  131. package/drawer/style.css +0 -1
  132. package/dropdown/index.d.ts +0 -7
  133. package/dropdown/index.es.js +0 -638
  134. package/dropdown/index.umd.js +0 -1
  135. package/dropdown/package.json +0 -7
  136. package/dropdown/style.css +0 -1
  137. package/form/index.d.ts +0 -7
  138. package/form/index.es.js +0 -7865
  139. package/form/index.umd.js +0 -27
  140. package/form/package.json +0 -7
  141. package/form/style.css +0 -1
  142. package/gantt/index.d.ts +0 -7
  143. package/gantt/index.es.js +0 -523
  144. package/gantt/index.umd.js +0 -1
  145. package/gantt/package.json +0 -7
  146. package/gantt/style.css +0 -1
  147. package/input-icon/index.d.ts +0 -7
  148. package/input-icon/index.es.js +0 -331
  149. package/input-icon/index.umd.js +0 -1
  150. package/input-icon/package.json +0 -7
  151. package/input-icon/style.css +0 -1
  152. package/input-number/index.d.ts +0 -7
  153. package/input-number/index.es.js +0 -240
  154. package/input-number/index.umd.js +0 -1
  155. package/input-number/package.json +0 -7
  156. package/input-number/style.css +0 -1
  157. package/list/index.d.ts +0 -7
  158. package/list/index.es.js +0 -39
  159. package/list/index.umd.js +0 -1
  160. package/list/package.json +0 -7
  161. package/list/style.css +0 -1
  162. package/nav-sprite/index.d.ts +0 -7
  163. package/nav-sprite/index.es.js +0 -68
  164. package/nav-sprite/index.umd.js +0 -1
  165. package/nav-sprite/package.json +0 -7
  166. package/nuxt/components/Accordion.js +0 -3
  167. package/nuxt/components/Anchor.js +0 -3
  168. package/nuxt/components/BackTop.js +0 -3
  169. package/nuxt/components/Breadcrumb.js +0 -3
  170. package/nuxt/components/Carousel.js +0 -3
  171. package/nuxt/components/CarouselItem.js +0 -3
  172. package/nuxt/components/Cascader.js +0 -3
  173. package/nuxt/components/ColorPicker.js +0 -3
  174. package/nuxt/components/Column.js +0 -3
  175. package/nuxt/components/DatePicker.js +0 -3
  176. package/nuxt/components/Drawer.js +0 -3
  177. package/nuxt/components/DrawerService.js +0 -3
  178. package/nuxt/components/Dropdown.js +0 -3
  179. package/nuxt/components/DropdownMenu.js +0 -3
  180. package/nuxt/components/Form.js +0 -3
  181. package/nuxt/components/FormControl.js +0 -3
  182. package/nuxt/components/FormItem.js +0 -3
  183. package/nuxt/components/FormLabel.js +0 -3
  184. package/nuxt/components/FormOperation.js +0 -3
  185. package/nuxt/components/Gantt.js +0 -3
  186. package/nuxt/components/InputIcon.js +0 -3
  187. package/nuxt/components/InputNumber.js +0 -3
  188. package/nuxt/components/List.js +0 -3
  189. package/nuxt/components/ListItem.js +0 -3
  190. package/nuxt/components/NavSprite.js +0 -2
  191. package/nuxt/components/QuadrantDiagram.js +0 -3
  192. package/nuxt/components/Select.js +0 -3
  193. package/nuxt/components/StepsGuide.js +0 -3
  194. package/nuxt/components/StickSlider.js +0 -3
  195. package/nuxt/components/Sticky.js +0 -2
  196. package/nuxt/components/Table.js +0 -3
  197. package/nuxt/components/Tabs.js +0 -3
  198. package/nuxt/components/TimeAxis.js +0 -3
  199. package/nuxt/components/TimeAxisItem.js +0 -3
  200. package/nuxt/components/TimePicker.js +0 -3
  201. package/nuxt/components/Tooltip.js +0 -3
  202. package/nuxt/components/Transfer.js +0 -3
  203. package/nuxt/components/Tree.js +0 -3
  204. package/nuxt/components/TreeSelect.js +0 -3
  205. package/nuxt/components/dropdownMenuProps.js +0 -3
  206. package/nuxt/components/tooltipProps.js +0 -3
  207. package/quadrant-diagram/index.d.ts +0 -7
  208. package/quadrant-diagram/index.es.js +0 -5728
  209. package/quadrant-diagram/index.umd.js +0 -27
  210. package/quadrant-diagram/package.json +0 -7
  211. package/quadrant-diagram/style.css +0 -1
  212. package/select/index.d.ts +0 -7
  213. package/select/index.es.js +0 -706
  214. package/select/index.umd.js +0 -1
  215. package/select/package.json +0 -7
  216. package/select/style.css +0 -1
  217. package/steps-guide/index.d.ts +0 -7
  218. package/steps-guide/index.es.js +0 -239
  219. package/steps-guide/index.umd.js +0 -1
  220. package/steps-guide/package.json +0 -7
  221. package/steps-guide/style.css +0 -1
  222. package/sticky/index.d.ts +0 -7
  223. package/sticky/index.es.js +0 -197
  224. package/sticky/index.umd.js +0 -1
  225. package/sticky/package.json +0 -7
  226. package/table/index.d.ts +0 -7
  227. package/table/index.es.js +0 -1969
  228. package/table/index.umd.js +0 -1
  229. package/table/package.json +0 -7
  230. package/table/style.css +0 -1
  231. package/tabs/index.d.ts +0 -7
  232. package/tabs/index.es.js +0 -194
  233. package/tabs/index.umd.js +0 -1
  234. package/tabs/package.json +0 -7
  235. package/tabs/style.css +0 -1
  236. package/time-axis/index.d.ts +0 -7
  237. package/time-axis/index.umd.js +0 -1
  238. package/time-axis/package.json +0 -7
  239. package/time-axis/style.css +0 -1
  240. package/time-picker/index.d.ts +0 -7
  241. package/time-picker/index.es.js +0 -1237
  242. package/time-picker/index.umd.js +0 -1
  243. package/time-picker/package.json +0 -7
  244. package/time-picker/style.css +0 -1
  245. package/tooltip/index.d.ts +0 -7
  246. package/tooltip/index.es.js +0 -5828
  247. package/tooltip/index.umd.js +0 -27
  248. package/tooltip/package.json +0 -7
  249. package/tooltip/style.css +0 -1
  250. package/transfer/index.d.ts +0 -7
  251. package/transfer/index.es.js +0 -7608
  252. package/transfer/index.umd.js +0 -27
  253. package/transfer/package.json +0 -7
  254. package/transfer/style.css +0 -1
  255. package/tree/index.d.ts +0 -7
  256. package/tree/index.es.js +0 -6490
  257. package/tree/index.umd.js +0 -27
  258. package/tree/package.json +0 -7
  259. package/tree/style.css +0 -1
  260. package/tree-select/index.d.ts +0 -7
  261. package/tree-select/index.es.js +0 -623
  262. package/tree-select/index.umd.js +0 -1
  263. package/tree-select/package.json +0 -7
  264. package/tree-select/style.css +0 -1
@@ -1,24 +1,5 @@
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
- import { computed, nextTick, defineComponent, ref, reactive, watch, withDirectives, createVNode, withModifiers, resolveComponent, resolveDirective, vShow, Transition } from "vue";
1
+ import { computed, ref, nextTick, defineComponent, watch, withDirectives, createVNode, withModifiers, resolveComponent, vShow, resolveDirective } from "vue";
18
2
  const editableSelectProps = {
19
- appendToBody: {
20
- type: Boolean
21
- },
22
3
  options: {
23
4
  type: Array,
24
5
  default: () => []
@@ -48,9 +29,6 @@ const editableSelectProps = {
48
29
  },
49
30
  filterOption: {
50
31
  type: [Function, Boolean]
51
- },
52
- loadMore: {
53
- type: Function
54
32
  }
55
33
  };
56
34
  const inBrowser = typeof window !== "undefined";
@@ -145,17 +123,21 @@ const useInput = (inputValue, ctx2) => {
145
123
  handleInput
146
124
  };
147
125
  };
148
- const useLazyLoad = (dropdownRef, inputValue, filterOtion, load) => {
126
+ const useLazyLoad = (dropdownRef, inputValue, filterOtion, ctx2) => {
149
127
  const loadMore = () => {
150
- if (filterOtion !== false)
128
+ const dropdownVal = dropdownRef.value;
129
+ if (filterOtion !== false) {
151
130
  return;
152
- if (dropdownRef.value.clientHeight + dropdownRef.value.scrollTop >= dropdownRef.value.scrollHeight) {
153
- load(inputValue.value);
131
+ }
132
+ if (dropdownVal.clientHeight + dropdownVal.scrollTop >= dropdownVal.scrollHeight) {
133
+ ctx2.emit("loadMore", inputValue.value);
154
134
  }
155
135
  };
156
136
  return { loadMore };
157
137
  };
158
- const useKeyboardSelect = (dropdownRef, disabled, visible, hoverIndex, selectedIndex, options, toggleMenu, closeMenu, handleClick) => {
138
+ const useKeyboardSelect = (dropdownRef, visible, inputValue, filteredOptions, optionDisabledKey, filterOption, loading, handleClick, closeMenu, toggleMenu) => {
139
+ const hoverIndex = ref(0);
140
+ const selectedIndex = ref(0);
159
141
  const updateHoveringIndex = (index2) => {
160
142
  hoverIndex.value = index2;
161
143
  };
@@ -174,64 +156,71 @@ const useKeyboardSelect = (dropdownRef, disabled, visible, hoverIndex, selectedI
174
156
  }
175
157
  });
176
158
  };
177
- const onKeyboardNavigation = (direction, newIndex) => {
178
- if (!newIndex) {
179
- newIndex = hoverIndex.value;
159
+ const handleEscape = () => {
160
+ if (inputValue.value) {
161
+ inputValue.value = "";
162
+ } else {
163
+ closeMenu();
164
+ }
165
+ };
166
+ const handleEnter = () => {
167
+ 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();
175
+ }
176
+ };
177
+ const handleKeyboardNavigation = (direction) => {
178
+ const len = filteredOptions.value.length;
179
+ if (!len || len === 1) {
180
+ return;
180
181
  }
181
- if (!["ArrowDown", "ArrowUp"].includes(direction))
182
+ if (!["ArrowDown", "ArrowUp"].includes(direction)) {
182
183
  return;
184
+ }
185
+ if (filterOption === false && loading.value) {
186
+ return;
187
+ }
188
+ let newIndex = 0;
189
+ newIndex = hoverIndex.value;
183
190
  if (direction === "ArrowUp") {
184
- if (newIndex === 0) {
185
- newIndex = options.value.length - 1;
186
- scrollToItem(newIndex);
187
- updateHoveringIndex(newIndex);
188
- return;
191
+ newIndex -= 1;
192
+ if (newIndex === -1) {
193
+ newIndex = len - 1;
189
194
  }
190
- newIndex = newIndex - 1;
191
195
  } else if (direction === "ArrowDown") {
192
- if (newIndex === options.value.length - 1) {
196
+ newIndex += 1;
197
+ if (newIndex === len) {
193
198
  newIndex = 0;
194
- scrollToItem(newIndex);
195
- updateHoveringIndex(newIndex);
196
- return;
197
199
  }
198
- newIndex = newIndex + 1;
199
200
  }
200
- const option = options.value[newIndex];
201
- if (option[disabled]) {
202
- return onKeyboardNavigation(direction, newIndex);
201
+ hoverIndex.value = newIndex;
202
+ const option = filteredOptions.value[newIndex];
203
+ if (option[optionDisabledKey]) {
204
+ return handleKeyboardNavigation(direction);
203
205
  }
204
- scrollToItem(newIndex);
205
206
  updateHoveringIndex(newIndex);
207
+ scrollToItem(newIndex);
206
208
  };
207
209
  const handleKeydown = (event) => {
208
210
  const keyCode = event.key || event.code;
209
- if (options.value.length === 0)
210
- return;
211
- if (!visible.value) {
212
- return toggleMenu();
213
- }
214
- const onKeydownEnter = () => {
215
- handleClick(options.value[hoverIndex.value]);
216
- closeMenu();
217
- };
218
- const onKeydownEsc = () => {
219
- closeMenu();
220
- };
221
211
  switch (keyCode) {
222
- case "Enter":
223
- onKeydownEnter();
224
- break;
225
212
  case "Escape":
226
- onKeydownEsc();
213
+ event.preventDefault();
214
+ handleEscape();
215
+ break;
216
+ case "Enter":
217
+ handleEnter();
227
218
  break;
228
219
  default:
229
- onKeyboardNavigation(keyCode);
220
+ handleKeyboardNavigation(keyCode);
230
221
  }
231
222
  };
232
- return {
233
- handleKeydown
234
- };
223
+ return { handleKeydown, hoverIndex, selectedIndex };
235
224
  };
236
225
  var EditableSelect = defineComponent({
237
226
  name: "DEditableSelect",
@@ -241,101 +230,19 @@ var EditableSelect = defineComponent({
241
230
  props: editableSelectProps,
242
231
  emits: ["update:modelValue", "search", "loadMore"],
243
232
  setup(props, ctx2) {
244
- const getItemCls = (option, index2) => {
245
- const {
246
- optionDisabledKey: disabledKey
247
- } = props;
248
- return className("devui-dropdown-item", {
249
- disabled: disabledKey ? !!option[disabledKey] : false,
250
- selected: index2 === selectIndex.value,
251
- "devui-dropdown-bg": index2 === hoverIndex.value
252
- });
253
- };
254
- const renderDropdown = () => {
255
- if (props.appendToBody) {
256
- return createVNode(resolveComponent("d-flexible-overlay"), {
257
- "origin": origin,
258
- "visible": visible.value,
259
- "onUpdate:visible": ($event) => visible.value = $event,
260
- "position": position,
261
- "hasBackdrop": false
262
- }, {
263
- default: () => [createVNode("div", {
264
- "class": "devui-editable-select-dropdown",
265
- "style": {
266
- width: props.width + "px"
267
- }
268
- }, [withDirectives(createVNode("div", {
269
- "class": "devui-dropdown-menu"
270
- }, [createVNode("ul", {
271
- "ref": dopdownRef,
272
- "class": "devui-list-unstyled scroll-height",
273
- "style": {
274
- maxHeight: props.maxHeight + "px"
275
- },
276
- "onScroll": loadMore
277
- }, [filteredOptions.value.map((option, index2) => {
278
- return createVNode("li", {
279
- "class": getItemCls(option, index2),
280
- "onClick": (e) => {
281
- e.stopPropagation();
282
- handleClick(option);
283
- }
284
- }, [ctx2.slots.itemTemplate ? ctx2.slots.itemTemplate(option) : option.label]);
285
- }), withDirectives(createVNode("li", {
286
- "class": "devui-no-result-template"
287
- }, [createVNode("div", {
288
- "class": "devui-no-data-tip"
289
- }, [emptyText.value])]), [[vShow, !filteredOptions.value.length]])])]), [[resolveDirective("dLoading"), props.loading], [vShow, visible.value]])])]
290
- });
291
- } else {
292
- return createVNode(Transition, {
293
- "name": "fade"
294
- }, {
295
- default: () => [withDirectives(createVNode("div", {
296
- "class": "devui-dropdown-menu"
297
- }, [createVNode("ul", {
298
- "ref": dopdownRef,
299
- "class": "devui-list-unstyled scroll-height",
300
- "style": {
301
- maxHeight: props.maxHeight + "px"
302
- },
303
- "onScroll": loadMore
304
- }, [filteredOptions.value.map((option, index2) => {
305
- return createVNode("li", {
306
- "class": getItemCls(option, index2),
307
- "onClick": (e) => {
308
- e.stopPropagation();
309
- handleClick(option);
310
- }
311
- }, [ctx2.slots.itemTemplate ? ctx2.slots.itemTemplate(option) : option.label]);
312
- }), withDirectives(createVNode("li", {
313
- "class": "devui-no-result-template"
314
- }, [createVNode("div", {
315
- "class": "devui-no-data-tip"
316
- }, [emptyText.value])]), [[vShow, !filteredOptions.value.length]])])]), [[vShow, visible.value]])]
317
- });
318
- }
319
- };
320
- const dopdownRef = ref();
233
+ const dropdownRef = ref();
321
234
  const origin = ref();
322
- const position = reactive({
323
- originX: "left",
324
- originY: "bottom",
325
- overlayX: "left",
326
- overlayY: "top"
327
- });
235
+ const position = ref(["bottom", "left"]);
328
236
  const visible = ref(false);
329
- const inputValue = ref(props.modelValue);
330
- const hoverIndex = ref(0);
331
- const selectIndex = ref(0);
237
+ const inputValue = ref(props.modelValue || "");
238
+ const loading = ref(props.loading);
332
239
  const normalizeOptions = computed(() => {
333
240
  return props.options.map((option) => {
334
241
  if (typeof option === "object") {
335
- return __spreadValues({
242
+ return Object.assign({}, option, {
336
243
  label: option.label ? option.label : option.value,
337
244
  value: option.value
338
- }, option);
245
+ });
339
246
  }
340
247
  return {
341
248
  label: option + "",
@@ -345,13 +252,16 @@ var EditableSelect = defineComponent({
345
252
  });
346
253
  const filteredOptions = userFilterOptions(normalizeOptions, inputValue, props.filterOption);
347
254
  const emptyText = computed(() => {
348
- let text;
255
+ let text = "";
349
256
  if (props.filterOption !== false && !filteredOptions.value.length) {
350
257
  text = "\u627E\u4E0D\u5230\u76F8\u5173\u8BB0\u5F55";
351
258
  } else if (props.filterOption === false && !filteredOptions.value.length) {
352
259
  text = "\u6CA1\u6709\u6570\u636E";
353
260
  }
354
- return ctx2.slots.noResultItemTemplate ? ctx2.slots.noResultItemTemplate() : text;
261
+ return text;
262
+ });
263
+ watch(() => props.loading, (newVal) => {
264
+ loading.value = newVal;
355
265
  });
356
266
  const toggleMenu = () => {
357
267
  visible.value = !visible.value;
@@ -361,7 +271,7 @@ var EditableSelect = defineComponent({
361
271
  };
362
272
  const {
363
273
  loadMore
364
- } = useLazyLoad(dopdownRef, inputValue, props.filterOption, props.loadMore);
274
+ } = useLazyLoad(dropdownRef, inputValue, props.filterOption, ctx2);
365
275
  const {
366
276
  handleInput
367
277
  } = useInput(inputValue, ctx2);
@@ -369,17 +279,32 @@ var EditableSelect = defineComponent({
369
279
  const {
370
280
  optionDisabledKey: disabledKey
371
281
  } = props;
372
- if (disabledKey && !!option[disabledKey])
282
+ if (disabledKey && !!option[disabledKey]) {
373
283
  return;
284
+ }
374
285
  ctx2.emit("update:modelValue", option.label);
375
286
  closeMenu();
376
287
  };
377
288
  const {
378
- handleKeydown
379
- } = useKeyboardSelect(dopdownRef, props.optionDisabledKey, visible, hoverIndex, selectIndex, filteredOptions, toggleMenu, closeMenu, handleClick);
289
+ handleKeydown,
290
+ hoverIndex,
291
+ selectedIndex
292
+ } = useKeyboardSelect(dropdownRef, visible, inputValue, filteredOptions, props.optionDisabledKey, props.filterOption, loading, handleClick, closeMenu, toggleMenu);
380
293
  watch(() => props.modelValue, (newVal) => {
381
- inputValue.value = newVal;
294
+ if (newVal) {
295
+ inputValue.value = newVal;
296
+ }
382
297
  });
298
+ const getItemCls = (option, index2) => {
299
+ const {
300
+ optionDisabledKey: disabledKey
301
+ } = props;
302
+ return className("devui-dropdown-item", {
303
+ disabled: disabledKey ? !!option[disabledKey] : false,
304
+ selected: index2 === selectedIndex.value,
305
+ "devui-dropdown-bg": index2 === hoverIndex.value
306
+ });
307
+ };
383
308
  return () => {
384
309
  const selectCls = className("devui-editable-select devui-form-group devui-has-feedback", {
385
310
  "devui-select-open": visible.value === true
@@ -405,7 +330,41 @@ var EditableSelect = defineComponent({
405
330
  "class": "devui-select-chevron-icon"
406
331
  }, [createVNode(resolveComponent("d-icon"), {
407
332
  "name": "select-arrow"
408
- }, null)])]), renderDropdown()]), [[resolveDirective("click-outside"), closeMenu]]);
333
+ }, null)])]), createVNode(resolveComponent("d-flexible-overlay"), {
334
+ "origin": origin.value,
335
+ "modelValue": visible.value,
336
+ "onUpdate:modelValue": ($event) => visible.value = $event,
337
+ "position": position.value,
338
+ "hasBackdrop": false
339
+ }, {
340
+ default: () => [createVNode("div", {
341
+ "class": "devui-editable-select-dropdown",
342
+ "style": {
343
+ width: props.width + "px"
344
+ }
345
+ }, [withDirectives(createVNode("div", {
346
+ "class": "devui-dropdown-menu"
347
+ }, [createVNode("ul", {
348
+ "ref": dropdownRef,
349
+ "class": "devui-list-unstyled scroll-height",
350
+ "style": {
351
+ maxHeight: props.maxHeight + "px"
352
+ },
353
+ "onScroll": loadMore
354
+ }, [filteredOptions.value.map((option, index2) => {
355
+ return createVNode("li", {
356
+ "class": getItemCls(option, index2),
357
+ "onClick": (e) => {
358
+ e.stopPropagation();
359
+ handleClick(option);
360
+ }
361
+ }, [ctx2.slots.item ? ctx2.slots.item(option) : option.label]);
362
+ }), withDirectives(createVNode("li", {
363
+ "class": "devui-no-result-template"
364
+ }, [createVNode("div", {
365
+ "class": "devui-no-data-tip"
366
+ }, [ctx2.slots.noResultItem ? ctx2.slots.noResultItem() : emptyText.value])]), [[vShow, !filteredOptions.value.length]])])]), [[resolveDirective("dLoading"), props.loading], [vShow, visible.value]])])]
367
+ })]), [[resolveDirective("click-outside"), closeMenu]]);
409
368
  };
410
369
  }
411
370
  });
@@ -1 +1 @@
1
- var z=Object.defineProperty;var L=Object.getOwnPropertySymbols;var $=Object.prototype.hasOwnProperty,G=Object.prototype.propertyIsEnumerable;var O=(s,e,u)=>e in s?z(s,e,{enumerable:!0,configurable:!0,writable:!0,value:u}):s[e]=u,j=(s,e)=>{for(var u in e||(e={}))$.call(e,u)&&O(s,u,e[u]);if(L)for(var u of L(e))G.call(e,u)&&O(s,u,e[u]);return s};(function(s,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(s=typeof globalThis!="undefined"?globalThis:s||self,e(s.index={},s.Vue))})(this,function(s,e){"use strict";const u={appendToBody:{type:Boolean},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]},loadMore:{type:Function}},A=typeof window!="undefined";function F(t,l,n){document.addEventListener?t&&l&&n&&t.addEventListener(l,n,!1):t&&l&&n&&t.attachEvent("on"+l,n)}const h=Symbol("@@clickoutside"),C=new Map;let K,D=0,H=!0;function M(t,l,n){return A&&H&&(H=!1,F(document,"mousedown",i=>{K=i}),F(document,"mouseup",i=>{for(const[r,c]of C)c[h].documentHandler(i,K)})),function(i,r){!n||!l.instance||!i.target||!r.target||t.contains(i.target)||t.contains(r.target)||t===i.target||t[h].bindingFn&&t[h].bindingFn()}}const P={beforeMount:function(t,l,n){D++,C.set(D,t),t[h]={nid:D,documentHandler:M(t,l,n),bindingFn:l.value}},updated:function(t,l,n){t[h].documentHandler=M(t,l,n),t[h].bindingFn=l.value},unmounted:function(t){C.delete(t[h].nid),delete t[h]}};function B(t,l){let n=t;return typeof l=="object"&&Object.keys(l).forEach(i=>{l[i]&&(n+=` ${i}`)}),n}var J="";const R=()=>(t,l)=>l.label.toLocaleLowerCase().indexOf(t.toLocaleLowerCase())>-1,U=(t,l,n)=>e.computed(()=>{const i=[];if(!l.value||n===!1)return t.value;const r=typeof n=="function"?n:R();return t.value.forEach(c=>{r(l.value,c)&&i.push(c)}),i}),I=(t,l)=>{const n=r=>{l.emit("search",r)};return{handleInput:r=>{const c=r.target.value;t.value=c,n(c)}}},X=(t,l,n,i)=>({loadMore:()=>{n===!1&&t.value.clientHeight+t.value.scrollTop>=t.value.scrollHeight&&i(l.value)}}),Y=(t,l,n,i,r,c,E,f,p)=>{const b=d=>{i.value=d},w=d=>{const a=t.value,m=a.children[d];e.nextTick(()=>{if(m.scrollIntoViewIfNeeded)m.scrollIntoViewIfNeeded(!1);else{const y=a.getBoundingClientRect(),k=m.getBoundingClientRect();(k.bottom>y.bottom||k.top<y.top)&&m.scrollIntoView(!1)}})},S=(d,a)=>{if(a||(a=i.value),!["ArrowDown","ArrowUp"].includes(d))return;if(d==="ArrowUp"){if(a===0){a=c.value.length-1,w(a),b(a);return}a=a-1}else if(d==="ArrowDown"){if(a===c.value.length-1){a=0,w(a),b(a);return}a=a+1}if(c.value[a][l])return S(d,a);w(a),b(a)};return{handleKeydown:d=>{const a=d.key||d.code;if(c.value.length===0)return;if(!n.value)return E();const m=()=>{p(c.value[i.value]),f()},y=()=>{f()};switch(a){case"Enter":m();break;case"Escape":y();break;default:S(a)}}}};var N=e.defineComponent({name:"DEditableSelect",directives:{clickOutside:P},props:u,emits:["update:modelValue","search","loadMore"],setup(t,l){const n=(o,v)=>{const{optionDisabledKey:V}=t;return B("devui-dropdown-item",{disabled:V?!!o[V]:!1,selected:v===w.value,"devui-dropdown-bg":v===b.value})},i=()=>t.appendToBody?e.createVNode(e.resolveComponent("d-flexible-overlay"),{origin:c,visible:f.value,"onUpdate:visible":o=>f.value=o,position:E,hasBackdrop:!1},{default:()=>[e.createVNode("div",{class:"devui-editable-select-dropdown",style:{width:t.width+"px"}},[e.withDirectives(e.createVNode("div",{class:"devui-dropdown-menu"},[e.createVNode("ul",{ref:r,class:"devui-list-unstyled scroll-height",style:{maxHeight:t.maxHeight+"px"},onScroll:y},[g.value.map((o,v)=>e.createVNode("li",{class:n(o,v),onClick:V=>{V.stopPropagation(),T(o)}},[l.slots.itemTemplate?l.slots.itemTemplate(o):o.label])),e.withDirectives(e.createVNode("li",{class:"devui-no-result-template"},[e.createVNode("div",{class:"devui-no-data-tip"},[d.value])]),[[e.vShow,!g.value.length]])])]),[[e.resolveDirective("dLoading"),t.loading],[e.vShow,f.value]])])]}):e.createVNode(e.Transition,{name:"fade"},{default:()=>[e.withDirectives(e.createVNode("div",{class:"devui-dropdown-menu"},[e.createVNode("ul",{ref:r,class:"devui-list-unstyled scroll-height",style:{maxHeight:t.maxHeight+"px"},onScroll:y},[g.value.map((o,v)=>e.createVNode("li",{class:n(o,v),onClick:V=>{V.stopPropagation(),T(o)}},[l.slots.itemTemplate?l.slots.itemTemplate(o):o.label])),e.withDirectives(e.createVNode("li",{class:"devui-no-result-template"},[e.createVNode("div",{class:"devui-no-data-tip"},[d.value])]),[[e.vShow,!g.value.length]])])]),[[e.vShow,f.value]])]}),r=e.ref(),c=e.ref(),E=e.reactive({originX:"left",originY:"bottom",overlayX:"left",overlayY:"top"}),f=e.ref(!1),p=e.ref(t.modelValue),b=e.ref(0),w=e.ref(0),S=e.computed(()=>t.options.map(o=>typeof o=="object"?j({label:o.label?o.label:o.value,value:o.value},o):{label:o+"",value:o})),g=U(S,p,t.filterOption),d=e.computed(()=>{let o;return t.filterOption!==!1&&!g.value.length?o="\u627E\u4E0D\u5230\u76F8\u5173\u8BB0\u5F55":t.filterOption===!1&&!g.value.length&&(o="\u6CA1\u6709\u6570\u636E"),l.slots.noResultItemTemplate?l.slots.noResultItemTemplate():o}),a=()=>{f.value=!f.value},m=()=>{f.value=!1},{loadMore:y}=X(r,p,t.filterOption,t.loadMore),{handleInput:k}=I(p,l),T=o=>{const{optionDisabledKey:v}=t;v&&!!o[v]||(l.emit("update:modelValue",o.label),m())},{handleKeydown:q}=Y(r,t.optionDisabledKey,f,b,w,g,a,m,T);return e.watch(()=>t.modelValue,o=>{p.value=o}),()=>{const o=B("devui-editable-select devui-form-group devui-has-feedback",{"devui-select-open":f.value===!0});return e.withDirectives(e.createVNode("div",{class:o,ref:c,style:{width:t.width+"px"}},[e.createVNode("input",{class:"devui-form-control devui-dropdown-origin devui-dropdown-origin-open",onClick:e.withModifiers(a,["self"]),onInput:k,onKeydown:q,value:p.value,disabled:t.disabled,placeholder:t.placeholder,type:"text"},null),e.createVNode("span",{class:"devui-form-control-feedback"},[e.createVNode("span",{class:"devui-select-chevron-icon"},[e.createVNode(e.resolveComponent("d-icon"),{name:"select-arrow"},null)])]),i()]),[[e.resolveDirective("click-outside"),m]])}}});N.install=function(t){t.component(N.name,N)};var _={title:"EditableSelect \u53EF\u8F93\u5165\u4E0B\u62C9\u9009\u62E9\u6846",category:"\u6570\u636E\u5F55\u5165",status:"100%",install(t){t.use(N)}};s.EditableSelect=N,s.default=_,Object.defineProperty(s,"__esModule",{value:!0}),s[Symbol.toStringTag]="Module"});
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 M={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 N(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 x,k=0,F=!0;function K(e,l,o){return B&&F&&(F=!1,N(document,"mousedown",a=>{x=a}),N(document,"mouseup",a=>{for(const[c,i]of S)i[f].documentHandler(a,x)})),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){k++,S.set(k,e),e[f]={nid:k,documentHandler:K(e,l,o),bindingFn:l.value}},updated:function(e,l,o){e[f].documentHandler=K(e,l,o),e[f].bindingFn=l.value},unmounted:function(e){S.delete(e[f].nid),delete e[f]}};function H(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,p,w,h)=>{const m=t.ref(0),I=t.ref(0),y=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="":w()},V=()=>{const d=a.value.length;l.value?!d||d===1?w():d&&d!==1&&(p(a.value[m.value]),w()):h()},E=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 E(d);y(n),C(n)};return{handleKeydown:d=>{const r=d.key||d.code;switch(r){case"Escape":d.preventDefault(),D();break;case"Enter":V();break;default:E(r)}},hoverIndex:m,selectedIndex:I}};var g=t.defineComponent({name:"DEditableSelect",directives:{clickOutside:O},props:M,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||""),p=t.ref(e.loading),w=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(w,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=>{p.value=n});const I=()=>{i.value=!i.value},y=()=>{i.value=!1},{loadMore:C}=R(o,v,e.filterOption,l),{handleInput:D}=A(v,l),V=n=>{const{optionDisabledKey:s}=e;s&&!!n[s]||(l.emit("update:modelValue",n.label),y())},{handleKeydown:E,hoverIndex:L,selectedIndex:d}=P(o,i,v,h,e.optionDisabledKey,e.filterOption,p,V,y,I);t.watch(()=>e.modelValue,n=>{n&&(v.value=n)});const r=(n,s)=>{const{optionDisabledKey:b}=e;return H("devui-dropdown-item",{disabled:b?!!n[b]:!1,selected:s===d.value,"devui-dropdown-bg":s===L.value})};return()=>{const n=H("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(I,["self"]),onInput:D,onKeydown:E,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(),V(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"),y]])}}});g.install=function(e){e.component(g.name,g)};var U={title:"EditableSelect \u53EF\u8F93\u5165\u4E0B\u62C9\u9009\u62E9\u6846",category:"\u6570\u636E\u5F55\u5165",status:"100%",install(e){e.use(g)}};u.EditableSelect=g,u.default=U,Object.defineProperty(u,"__esModule",{value:!0}),u[Symbol.toStringTag]="Module"});
@@ -36,7 +36,7 @@ const launchNormalFullscreen = (targetElement, props) => {
36
36
  };
37
37
  const exitNormalFullscreen = (targetElement) => {
38
38
  targetElement.classList.remove("devui-fullscreen");
39
- targetElement.style.zIndex = null;
39
+ targetElement.style.zIndex = "";
40
40
  };
41
41
  const launchImmersiveFullScreen = async (docElement) => {
42
42
  let fullscreenLaunch = null;
@@ -49,7 +49,7 @@ const launchImmersiveFullScreen = async (docElement) => {
49
49
  } else if (docElement.msRequestFullscreen) {
50
50
  fullscreenLaunch = Promise.resolve(docElement.msRequestFullscreen());
51
51
  }
52
- return await fullscreenLaunch.then(() => !!document.fullscreenElement);
52
+ return await (fullscreenLaunch == null ? void 0 : fullscreenLaunch.then(() => !!document.fullscreenElement));
53
53
  };
54
54
  const exitImmersiveFullScreen = async (doc) => {
55
55
  let fullscreenExit = null;
@@ -62,7 +62,7 @@ const exitImmersiveFullScreen = async (doc) => {
62
62
  } else if (doc.msExitFullscreen) {
63
63
  fullscreenExit = Promise.resolve(doc.msExitFullscreen());
64
64
  }
65
- return await fullscreenExit.then(() => !!document.fullscreenElement);
65
+ return await (fullscreenExit == null ? void 0 : fullscreenExit.then(() => !!document.fullscreenElement));
66
66
  };
67
67
  const addFullScreenStyle = () => {
68
68
  document.getElementsByTagName("html")[0].classList.add("devui-fullscreen-html");
@@ -73,14 +73,6 @@ const removeFullScreenStyle = () => {
73
73
  function useFullscreen(props, slotElement, ctx) {
74
74
  const { modelValue, mode } = toRefs(props);
75
75
  let exitByKeydown = false;
76
- watch(modelValue, (newVal) => {
77
- if (mode.value === "normal") {
78
- handleNormalFullscreen(newVal);
79
- }
80
- if (mode.value === "immersive") {
81
- handleImmersiveFullscreen(newVal);
82
- }
83
- });
84
76
  const handleNormalFullscreen = (isOpen) => {
85
77
  if (isOpen) {
86
78
  launchNormalFullscreen(slotElement.value, props);
@@ -99,6 +91,14 @@ function useFullscreen(props, slotElement, ctx) {
99
91
  }
100
92
  }
101
93
  };
94
+ watch(modelValue, (newVal) => {
95
+ if (mode.value === "normal") {
96
+ handleNormalFullscreen(newVal);
97
+ }
98
+ if (mode.value === "immersive") {
99
+ handleImmersiveFullscreen(newVal);
100
+ }
101
+ });
102
102
  const handleFullscreenChange = () => {
103
103
  if (!document.fullscreenElement) {
104
104
  ctx.emit("update:modelValue");
@@ -131,15 +131,12 @@ var Fullscreen = defineComponent({
131
131
  };
132
132
  }
133
133
  });
134
- Fullscreen.install = function(app) {
135
- app.component(Fullscreen.name, Fullscreen);
136
- };
137
134
  var index = {
138
135
  title: "Fullscreen \u5168\u5C4F",
139
136
  category: "\u901A\u7528",
140
137
  status: "100%",
141
138
  install(app) {
142
- app.use(Fullscreen);
139
+ app.component(Fullscreen.name, Fullscreen);
143
140
  }
144
141
  };
145
- export { Fullscreen, index as default };
142
+ export { Fullscreen, index as default, fullscreenProps };
@@ -1 +1 @@
1
- (function(t,n){typeof exports=="object"&&typeof module!="undefined"?n(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],n):(t=typeof globalThis!="undefined"?globalThis:t||self,n(t.index={},t.Vue))})(this,function(t,n){"use strict";const d={modelValue:{type:Boolean,default:!1},mode:{type:String,default:"normal"},zIndex:{type:Number,default:10}},m=27;function f(e,l){const{modelValue:s}=n.toRefs(e),u=o=>{o.keyCode===m&&s&&l.emit("update:modelValue",!1)};n.onMounted(()=>{document.addEventListener("keydown",u)}),n.onUnmounted(()=>{document.removeEventListener("keydown",u)})}const F=(e,l)=>{e.classList.add("devui-fullscreen"),l.zIndex&&e.setAttribute("style",`z-index: ${l.zIndex}`)},y=e=>{e.classList.remove("devui-fullscreen"),e.style.zIndex=null},v=async e=>{let l=null;return e.requestFullscreen?l=e.requestFullscreen():e.mozRequestFullScreen?l=e.mozRequestFullScreen():e.webkitRequestFullScreen?l=Promise.resolve(e.webkitRequestFullScreen()):e.msRequestFullscreen&&(l=Promise.resolve(e.msRequestFullscreen())),await l.then(()=>!!document.fullscreenElement)},S=async e=>{let l=null;return e.exitFullscreen?l=e.exitFullscreen():e.mozCancelFullScreen?l=e.mozCancelFullScreen():e.webkitCancelFullScreen?l=Promise.resolve(e.webkitCancelFullScreen()):e.msExitFullscreen&&(l=Promise.resolve(e.msExitFullscreen())),await l.then(()=>!!document.fullscreenElement)},h=()=>{document.getElementsByTagName("html")[0].classList.add("devui-fullscreen-html")},x=()=>{document.getElementsByTagName("html")[0].classList.remove("devui-fullscreen-html")};function p(e,l,s){const{modelValue:u,mode:o}=n.toRefs(e);let c=!1;n.watch(u,r=>{o.value==="normal"&&C(r),o.value==="immersive"&&q(r)});const C=r=>{r?(F(l.value,e),h()):(y(l.value),x())},q=r=>{r?v(l.value):c||S(document)},a=()=>{document.fullscreenElement?c=!1:(s.emit("update:modelValue"),c=!0)};n.onMounted(()=>{document.addEventListener("fullscreenchange",a)}),n.onUnmounted(()=>{document.removeEventListener("fullscreenchange",a)})}var z="",i=n.defineComponent({name:"DFullscreen",props:d,emits:["update:modelValue"],setup(e,l){const s=n.ref(null);return p(e,s,l),f(e,l),()=>{const u=n.renderSlot(n.useSlots(),"default");return n.createVNode("div",{ref:s},[u])}}});i.install=function(e){e.component(i.name,i)};var w={title:"Fullscreen \u5168\u5C4F",category:"\u901A\u7528",status:"100%",install(e){e.use(i)}};t.Fullscreen=i,t.default=w,Object.defineProperty(t,"__esModule",{value:!0}),t[Symbol.toStringTag]="Module"});
1
+ (function(t,n){typeof exports=="object"&&typeof module!="undefined"?n(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],n):(t=typeof globalThis!="undefined"?globalThis:t||self,n(t.index={},t.Vue))})(this,function(t,n){"use strict";const a={modelValue:{type:Boolean,default:!1},mode:{type:String,default:"normal"},zIndex:{type:Number,default:10}},m=27;function f(e,l){const{modelValue:s}=n.toRefs(e),u=o=>{o.keyCode===m&&s&&l.emit("update:modelValue",!1)};n.onMounted(()=>{document.addEventListener("keydown",u)}),n.onUnmounted(()=>{document.removeEventListener("keydown",u)})}const F=(e,l)=>{e.classList.add("devui-fullscreen"),l.zIndex&&e.setAttribute("style",`z-index: ${l.zIndex}`)},y=e=>{e.classList.remove("devui-fullscreen"),e.style.zIndex=""},v=async e=>{let l=null;return e.requestFullscreen?l=e.requestFullscreen():e.mozRequestFullScreen?l=e.mozRequestFullScreen():e.webkitRequestFullScreen?l=Promise.resolve(e.webkitRequestFullScreen()):e.msRequestFullscreen&&(l=Promise.resolve(e.msRequestFullscreen())),await(l==null?void 0:l.then(()=>!!document.fullscreenElement))},S=async e=>{let l=null;return e.exitFullscreen?l=e.exitFullscreen():e.mozCancelFullScreen?l=e.mozCancelFullScreen():e.webkitCancelFullScreen?l=Promise.resolve(e.webkitCancelFullScreen()):e.msExitFullscreen&&(l=Promise.resolve(e.msExitFullscreen())),await(l==null?void 0:l.then(()=>!!document.fullscreenElement))},h=()=>{document.getElementsByTagName("html")[0].classList.add("devui-fullscreen-html")},p=()=>{document.getElementsByTagName("html")[0].classList.remove("devui-fullscreen-html")};function w(e,l,s){const{modelValue:u,mode:o}=n.toRefs(e);let c=!1;const C=r=>{r?(F(l.value,e),h()):(y(l.value),p())},q=r=>{r?v(l.value):c||S(document)};n.watch(u,r=>{o.value==="normal"&&C(r),o.value==="immersive"&&q(r)});const d=()=>{document.fullscreenElement?c=!1:(s.emit("update:modelValue"),c=!0)};n.onMounted(()=>{document.addEventListener("fullscreenchange",d)}),n.onUnmounted(()=>{document.removeEventListener("fullscreenchange",d)})}var z="",i=n.defineComponent({name:"DFullscreen",props:a,emits:["update:modelValue"],setup(e,l){const s=n.ref(null);return w(e,s,l),f(e,l),()=>{const u=n.renderSlot(n.useSlots(),"default");return n.createVNode("div",{ref:s},[u])}}}),x={title:"Fullscreen \u5168\u5C4F",category:"\u901A\u7528",status:"100%",install(e){e.component(i.name,i)}};t.Fullscreen=i,t.default=x,t.fullscreenProps=a,Object.defineProperty(t,"__esModule",{value:!0}),t[Symbol.toStringTag]="Module"});
package/icon/index.es.js CHANGED
@@ -1,75 +1,57 @@
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;
1
+ import { defineComponent, toRefs, createVNode } from "vue";
2
+ const iconProps = {
3
+ name: {
4
+ type: String,
5
+ default: "",
6
+ required: true
7
+ },
8
+ size: {
9
+ type: String,
10
+ default: "inherit"
11
+ },
12
+ color: {
13
+ type: String,
14
+ default: "inherit"
15
+ },
16
+ classPrefix: {
17
+ type: String,
18
+ default: "icon"
19
+ }
16
20
  };
17
- import { defineComponent, createVNode } from "vue";
18
21
  var Icon = defineComponent({
19
22
  name: "DIcon",
20
- props: {
21
- name: {
22
- type: String,
23
- required: true
24
- },
25
- size: {
26
- type: String,
27
- default: "inherit"
28
- },
29
- color: {
30
- type: String,
31
- default: "inherit"
32
- },
33
- classPrefix: {
34
- type: String,
35
- default: "icon"
36
- }
37
- },
23
+ props: iconProps,
38
24
  setup(props) {
39
- return __spreadValues({}, props);
40
- },
41
- render() {
42
25
  const {
43
26
  name,
44
27
  size,
45
28
  color,
46
29
  classPrefix
47
- } = this;
48
- return /^((https?):)?\/\//.test(name) ? createVNode("img", {
49
- "src": name,
50
- "alt": name.split("/")[name.split("/").length - 1],
51
- "style": {
52
- width: size,
53
- verticalAlign: "text-bottom"
54
- }
55
- }, null) : createVNode("i", {
56
- "class": `${classPrefix} ${classPrefix}-${name}`,
57
- "style": {
58
- fontSize: size,
59
- color
60
- }
61
- }, null);
30
+ } = toRefs(props);
31
+ return () => {
32
+ return /^((https?):)?\/\//.test(name.value) ? createVNode("img", {
33
+ "src": name.value,
34
+ "alt": name.value.split("/")[name.value.split("/").length - 1],
35
+ "style": {
36
+ width: size.value,
37
+ verticalAlign: "text-bottom"
38
+ }
39
+ }, null) : createVNode("i", {
40
+ "class": `${classPrefix.value} ${classPrefix.value}-${name.value}`,
41
+ "style": {
42
+ fontSize: size.value,
43
+ color: color.value
44
+ }
45
+ }, null);
46
+ };
62
47
  }
63
48
  });
64
- Icon.install = function(app) {
65
- app.component(Icon.name, Icon);
66
- };
67
49
  var index = {
68
50
  title: "Icon \u56FE\u6807",
69
51
  category: "\u901A\u7528",
70
52
  status: "100%",
71
53
  install(app) {
72
- app.use(Icon);
54
+ app.component(Icon.name, Icon);
73
55
  }
74
56
  };
75
- export { Icon, index as default };
57
+ export { Icon, index as default, iconProps };
package/icon/index.umd.js CHANGED
@@ -1 +1 @@
1
- var a=Object.defineProperty;var s=Object.getOwnPropertySymbols;var f=Object.prototype.hasOwnProperty,p=Object.prototype.propertyIsEnumerable;var u=(t,e,n)=>e in t?a(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,l=(t,e)=>{for(var n in e||(e={}))f.call(e,n)&&u(t,n,e[n]);if(s)for(var n of s(e))p.call(e,n)&&u(t,n,e[n]);return t};(function(t,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(t=typeof globalThis!="undefined"?globalThis:t||self,e(t.index={},t.Vue))})(this,function(t,e){"use strict";var n=e.defineComponent({name:"DIcon",props:{name:{type:String,required:!0},size:{type:String,default:"inherit"},color:{type:String,default:"inherit"},classPrefix:{type:String,default:"icon"}},setup(i){return l({},i)},render(){const{name:i,size:o,color:c,classPrefix:r}=this;return/^((https?):)?\/\//.test(i)?e.createVNode("img",{src:i,alt:i.split("/")[i.split("/").length-1],style:{width:o,verticalAlign:"text-bottom"}},null):e.createVNode("i",{class:`${r} ${r}-${i}`,style:{fontSize:o,color:c}},null)}});n.install=function(i){i.component(n.name,n)};var d={title:"Icon \u56FE\u6807",category:"\u901A\u7528",status:"100%",install(i){i.use(n)}};t.Icon=n,t.default=d,Object.defineProperty(t,"__esModule",{value:!0}),t[Symbol.toStringTag]="Module"});
1
+ (function(e,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(e=typeof globalThis!="undefined"?globalThis:e||self,t(e.index={},e.Vue))})(this,function(e,t){"use strict";const o={name:{type:String,default:"",required:!0},size:{type:String,default:"inherit"},color:{type:String,default:"inherit"},classPrefix:{type:String,default:"icon"}};var i=t.defineComponent({name:"DIcon",props:o,setup(l){const{name:n,size:u,color:s,classPrefix:r}=t.toRefs(l);return()=>/^((https?):)?\/\//.test(n.value)?t.createVNode("img",{src:n.value,alt:n.value.split("/")[n.value.split("/").length-1],style:{width:u.value,verticalAlign:"text-bottom"}},null):t.createVNode("i",{class:`${r.value} ${r.value}-${n.value}`,style:{fontSize:u.value,color:s.value}},null)}}),a={title:"Icon \u56FE\u6807",category:"\u901A\u7528",status:"100%",install(l){l.component(i.name,i)}};e.Icon=i,e.default=a,e.iconProps=o,Object.defineProperty(e,"__esModule",{value:!0}),e[Symbol.toStringTag]="Module"});
@@ -188,8 +188,9 @@ var imagePreview = defineComponent({
188
188
  transform.setZoomOriginal();
189
189
  }
190
190
  function onKeyDown(event) {
191
- if (event.defaultPrevented)
191
+ if (event.defaultPrevented) {
192
192
  return;
193
+ }
193
194
  if (event.code == "Escape") {
194
195
  onClose();
195
196
  } else if (event.code == "ArrowLeft") {