hys-ui 0.2.0 → 0.3.0

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 (201) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +15 -1
  3. package/dist/components/HysAlert/HysAlert.vue.js +5 -54
  4. package/dist/components/HysAlert/HysAlert2.vue.js +159 -2
  5. package/dist/components/HysAutocomplete/HysAutocomplete.vue.js +2 -2
  6. package/dist/components/HysAutocomplete/HysAutocomplete2.vue.js +285 -273
  7. package/dist/components/HysAvatarGroup/HysAvatarGroup.vue.js +1 -1
  8. package/dist/components/HysAvatarGroup/HysAvatarGroup2.vue.js +102 -98
  9. package/dist/components/HysBreadcrumb/HysBreadcrumb.vue.js +1 -1
  10. package/dist/components/HysBreadcrumb/HysBreadcrumb2.vue.js +273 -59
  11. package/dist/components/HysCalendar/HysCalendar.vue.js +3 -3
  12. package/dist/components/HysCalendar/HysCalendar2.vue.js +237 -225
  13. package/dist/components/HysCascader/HysCascader.vue.js +2 -2
  14. package/dist/components/HysCascader/HysCascader2.vue.js +337 -324
  15. package/dist/components/HysColorPicker/HysColorPanel.vue.js +7 -0
  16. package/dist/components/HysColorPicker/HysColorPanel2.vue.js +238 -0
  17. package/dist/components/HysColorPicker/HysColorPicker.vue.js +2 -2
  18. package/dist/components/HysColorPicker/HysColorPicker2.vue.js +239 -217
  19. package/dist/components/HysCommandPalette/HysCommandPalette.vue.js +90 -76
  20. package/dist/components/HysContextMenu/HysContextMenu.vue.js +5 -89
  21. package/dist/components/HysContextMenu/HysContextMenu2.vue.js +247 -2
  22. package/dist/components/HysContextMenu/HysMenuPanel.vue.js +7 -0
  23. package/dist/components/HysContextMenu/HysMenuPanel2.vue.js +208 -0
  24. package/dist/components/HysContextMenu/HysMenuSlot.js +10 -0
  25. package/dist/components/HysDataGrid/HysDataGrid.vue.js +1 -1
  26. package/dist/components/HysDataGrid/HysDataGrid2.vue.js +1008 -559
  27. package/dist/components/HysDatePicker/HysDatePicker.vue.js +2 -0
  28. package/dist/components/HysDatePicker/HysDatePickerControl.vue.js +2 -2
  29. package/dist/components/HysDatePicker/HysDatePickerControl2.vue.js +539 -526
  30. package/dist/components/HysDateRangePicker/HysDateRangePicker.vue.js +5 -3
  31. package/dist/components/HysDrawer/HysDrawer.vue.js +1 -1
  32. package/dist/components/HysDrawer/HysDrawer2.vue.js +434 -84
  33. package/dist/components/HysEmpty/HysEmpty.vue.js +5 -41
  34. package/dist/components/HysEmpty/HysEmpty2.vue.js +181 -2
  35. package/dist/components/HysFormItem/HysFormItem.vue.js +2 -2
  36. package/dist/components/HysFormItem/HysFormItem2.vue.js +171 -164
  37. package/dist/components/HysGantt/HysGantt.vue.js +1 -1
  38. package/dist/components/HysGantt/HysGantt2.vue.js +810 -795
  39. package/dist/components/HysMention/HysMention.vue.js +1 -1
  40. package/dist/components/HysMention/HysMention2.vue.js +112 -100
  41. package/dist/components/HysModal/HysModal.vue.js +2 -2
  42. package/dist/components/HysModal/HysModal2.vue.js +490 -85
  43. package/dist/components/HysPopover/HysPopover.vue.js +5 -91
  44. package/dist/components/HysPopover/HysPopover2.vue.js +120 -2
  45. package/dist/components/HysProgress/HysProgress.vue.js +2 -2
  46. package/dist/components/HysProgress/HysProgress2.vue.js +319 -52
  47. package/dist/components/HysSelect/HysSelect.vue.js +2 -2
  48. package/dist/components/HysSelect/HysSelect2.vue.js +730 -594
  49. package/dist/components/HysSlider/HysSlider.vue.js +2 -2
  50. package/dist/components/HysSlider/HysSlider2.vue.js +192 -188
  51. package/dist/components/HysSlider/SliderTooltip.vue.js +2 -2
  52. package/dist/components/HysSlider/SliderTooltip2.vue.js +103 -89
  53. package/dist/components/HysTable/HysTable.vue.js +2 -2
  54. package/dist/components/HysTable/HysTable2.vue.js +389 -368
  55. package/dist/components/HysTagInput/HysTagInput.vue.js +5 -82
  56. package/dist/components/HysTagInput/HysTagInput2.vue.js +396 -2
  57. package/dist/components/HysTimeline/HysTimeline.vue.js +2 -2
  58. package/dist/components/HysTimeline/HysTimeline2.vue.js +243 -24
  59. package/dist/components/HysTooltip/HysTooltip.vue.js +5 -64
  60. package/dist/components/HysTooltip/HysTooltip2.vue.js +110 -2
  61. package/dist/components/HysTour/HysTour.vue.js +46 -42
  62. package/dist/components/HysTransfer/HysTransfer.vue.js +2 -2
  63. package/dist/components/HysTransfer/HysTransfer2.vue.js +237 -207
  64. package/dist/components/HysTransfer/HysTransferPanel.vue.js +1 -1
  65. package/dist/components/HysTransfer/HysTransferPanel2.vue.js +320 -271
  66. package/dist/components/HysTree/HysTree.vue.js +2 -2
  67. package/dist/components/HysTree/HysTree2.vue.js +195 -184
  68. package/dist/components/HysTreeSelect/HysTreeSelect.vue.js +4 -4
  69. package/dist/components/HysTreeSelect/HysTreeSelect2.vue.js +389 -377
  70. package/dist/components/HysUpload/HysUpload.vue.js +2 -2
  71. package/dist/components/HysUpload/HysUpload2.vue.js +459 -125
  72. package/dist/components/HysVirtualTable/HysVirtualTable.vue.js +5 -94
  73. package/dist/components/HysVirtualTable/HysVirtualTable2.vue.js +656 -2
  74. package/dist/composables/color.js +97 -0
  75. package/dist/composables/dataGrid.js +68 -0
  76. package/dist/composables/drawer.js +17 -0
  77. package/dist/composables/feedback.js +14 -0
  78. package/dist/composables/menu.js +96 -0
  79. package/dist/composables/modal.js +14 -0
  80. package/dist/composables/overlayManager.js +48 -18
  81. package/dist/composables/progress.js +94 -0
  82. package/dist/composables/tagInput.js +16 -0
  83. package/dist/composables/timeline.js +19 -0
  84. package/dist/composables/transfer.js +19 -17
  85. package/dist/composables/upload.js +55 -0
  86. package/dist/composables/uploadRequest.js +58 -0
  87. package/dist/composables/useAlert.js +124 -0
  88. package/dist/composables/useColorPicker.js +402 -0
  89. package/dist/composables/useContextMenu.js +514 -0
  90. package/dist/composables/useDataGridRemote.js +67 -0
  91. package/dist/composables/useDialog.js +86 -43
  92. package/dist/composables/useDrawerPush.js +33 -0
  93. package/dist/composables/useDrawerResize.js +221 -0
  94. package/dist/composables/useFloating.js +110 -76
  95. package/dist/composables/useHysModal.js +185 -0
  96. package/dist/composables/useModal.js +295 -0
  97. package/dist/composables/useModalInteraction.js +394 -0
  98. package/dist/composables/usePopupSurface.js +458 -0
  99. package/dist/composables/useTagInput.js +313 -0
  100. package/dist/composables/useTransferMotion.js +185 -0
  101. package/dist/composables/useUpload.js +472 -0
  102. package/dist/composables/useUploadModel.js +65 -0
  103. package/dist/composables/useUploadRequests.js +266 -0
  104. package/dist/composables/useVirtualTableLayout.js +277 -0
  105. package/dist/composables/virtualTable.js +43 -0
  106. package/dist/index.js +27 -24
  107. package/dist/internal/PopupReference.js +39 -0
  108. package/dist/internal/PopupSurfacePanel.vue.js +7 -0
  109. package/dist/internal/PopupSurfacePanel2.vue.js +92 -0
  110. package/dist/motion/PopupMotion.js +105 -0
  111. package/dist/motion/popup.js +10 -0
  112. package/dist/style.css +1 -1
  113. package/dist/types/components/HysAlert/HysAlert.vue.d.ts +32 -22
  114. package/dist/types/components/HysAutocomplete/HysAutocomplete.vue.d.ts +7 -7
  115. package/dist/types/components/HysAvatarGroup/HysAvatarGroup.vue.d.ts +6 -1
  116. package/dist/types/components/HysBadge/HysBadge.vue.d.ts +3 -3
  117. package/dist/types/components/HysBreadcrumb/HysBreadcrumb.vue.d.ts +54 -31
  118. package/dist/types/components/HysCalendar/HysCalendar.vue.d.ts +3 -2
  119. package/dist/types/components/HysCascader/HysCascader.vue.d.ts +7 -7
  120. package/dist/types/components/HysCascader/HysCascaderColumn.vue.d.ts +2 -2
  121. package/dist/types/components/HysColorPicker/HysColorPanel.vue.d.ts +58 -0
  122. package/dist/types/components/HysColorPicker/HysColorPicker.vue.d.ts +63 -10
  123. package/dist/types/components/HysCommandPalette/HysCommandPalette.vue.d.ts +2 -1
  124. package/dist/types/components/HysContextMenu/HysContextMenu.vue.d.ts +50 -34
  125. package/dist/types/components/HysContextMenu/HysMenuPanel.vue.d.ts +79 -0
  126. package/dist/types/components/HysContextMenu/HysMenuSlot.d.ts +8 -0
  127. package/dist/types/components/HysDataGrid/HysDataGrid.vue.d.ts +65 -118
  128. package/dist/types/components/HysDatePicker/HysDatePickerControl.vue.d.ts +1 -1
  129. package/dist/types/components/HysDrawer/HysDrawer.vue.d.ts +92 -35
  130. package/dist/types/components/HysEmpty/HysEmpty.vue.d.ts +24 -20
  131. package/dist/types/components/HysFileManager/HysFileManager.vue.d.ts +2 -2
  132. package/dist/types/components/HysGantt/HysGantt.vue.d.ts +2 -1
  133. package/dist/types/components/HysMention/HysMention.vue.d.ts +2 -1
  134. package/dist/types/components/HysModal/HysModal.vue.d.ts +111 -34
  135. package/dist/types/components/HysPopover/HysPopover.vue.d.ts +41 -29
  136. package/dist/types/components/HysProgress/HysProgress.vue.d.ts +18 -24
  137. package/dist/types/components/HysResizablePanel/HysResizablePanel.vue.d.ts +2 -2
  138. package/dist/types/components/HysSelect/HysSelect.vue.d.ts +13 -4
  139. package/dist/types/components/HysSlider/HysSlider.vue.d.ts +5 -4
  140. package/dist/types/components/HysSlider/SliderTooltip.vue.d.ts +3 -1
  141. package/dist/types/components/HysSplitPane/HysSplitPane.vue.d.ts +2 -2
  142. package/dist/types/components/HysTable/HysTable.vue.d.ts +4 -4
  143. package/dist/types/components/HysTabs/HysTabs.vue.d.ts +2 -2
  144. package/dist/types/components/HysTagInput/HysTagInput.vue.d.ts +47 -25
  145. package/dist/types/components/HysTimeline/HysTimeline.vue.d.ts +19 -32
  146. package/dist/types/components/HysTooltip/HysTooltip.vue.d.ts +39 -19
  147. package/dist/types/components/HysTour/HysTour.vue.d.ts +2 -1
  148. package/dist/types/components/HysTransfer/HysTransfer.vue.d.ts +2 -2
  149. package/dist/types/components/HysTransfer/HysTransferPanel.vue.d.ts +5 -3
  150. package/dist/types/components/HysTree/HysTree.vue.d.ts +2 -2
  151. package/dist/types/components/HysUpload/HysUpload.vue.d.ts +55 -67
  152. package/dist/types/components/HysVirtualTable/HysVirtualTable.vue.d.ts +71 -40
  153. package/dist/types/composables/autocomplete.d.ts +3 -0
  154. package/dist/types/composables/avatar.d.ts +3 -0
  155. package/dist/types/composables/cascader.d.ts +3 -0
  156. package/dist/types/composables/color.d.ts +97 -0
  157. package/dist/types/composables/dataGrid.d.ts +100 -0
  158. package/dist/types/composables/datePicker.d.ts +3 -0
  159. package/dist/types/composables/drawer.d.ts +102 -0
  160. package/dist/types/composables/feedback.d.ts +98 -0
  161. package/dist/types/composables/formContext.d.ts +2 -0
  162. package/dist/types/composables/menu.d.ts +183 -0
  163. package/dist/types/composables/modal.d.ts +183 -0
  164. package/dist/types/composables/overlayManager.d.ts +7 -3
  165. package/dist/types/composables/popupSurface.d.ts +83 -0
  166. package/dist/types/composables/progress.d.ts +92 -0
  167. package/dist/types/composables/selectOptions.d.ts +2 -0
  168. package/dist/types/composables/table.d.ts +3 -0
  169. package/dist/types/composables/tagInput.d.ts +96 -0
  170. package/dist/types/composables/timeline.d.ts +82 -0
  171. package/dist/types/composables/transfer.d.ts +7 -0
  172. package/dist/types/composables/tree.d.ts +3 -0
  173. package/dist/types/composables/treeSelect.d.ts +3 -0
  174. package/dist/types/composables/upload.d.ts +202 -0
  175. package/dist/types/composables/uploadRequest.d.ts +3 -0
  176. package/dist/types/composables/useAlert.d.ts +21 -0
  177. package/dist/types/composables/useCascader.d.ts +1 -1
  178. package/dist/types/composables/useColorPicker.d.ts +101 -0
  179. package/dist/types/composables/useContextMenu.d.ts +81 -0
  180. package/dist/types/composables/useDataGridRemote.d.ts +15 -0
  181. package/dist/types/composables/useDialog.d.ts +16 -3
  182. package/dist/types/composables/useDrawerPush.d.ts +6 -0
  183. package/dist/types/composables/useDrawerResize.d.ts +27 -0
  184. package/dist/types/composables/useFloating.d.ts +21 -2
  185. package/dist/types/composables/useHysModal.d.ts +44 -0
  186. package/dist/types/composables/useModal.d.ts +62 -0
  187. package/dist/types/composables/useModalInteraction.d.ts +27 -0
  188. package/dist/types/composables/usePopupSurface.d.ts +3341 -0
  189. package/dist/types/composables/useTagInput.d.ts +66 -0
  190. package/dist/types/composables/useTransferMotion.d.ts +36 -0
  191. package/dist/types/composables/useUpload.d.ts +94 -0
  192. package/dist/types/composables/useUploadModel.d.ts +14 -0
  193. package/dist/types/composables/useUploadRequests.d.ts +38 -0
  194. package/dist/types/composables/useVirtualTableLayout.d.ts +51 -0
  195. package/dist/types/composables/virtualTable.d.ts +126 -0
  196. package/dist/types/index.d.ts +17 -2
  197. package/dist/types/internal/PopupReference.d.ts +18 -0
  198. package/dist/types/internal/PopupSurfacePanel.vue.d.ts +37 -0
  199. package/dist/types/motion/PopupMotion.d.ts +59 -0
  200. package/dist/types/motion/popup.d.ts +12 -0
  201. package/package.json +1 -1
@@ -0,0 +1,266 @@
1
+ import { shallowRef as C, computed as p, watch as E } from "vue";
2
+ import { uploadStatus as b, uploadFailure as N } from "./upload.js";
3
+ import { uploadRequest as D } from "./uploadRequest.js";
4
+ function J(t) {
5
+ const { props: c } = t, s = C([]), l = C(/* @__PURE__ */ new Map()), y = p(() => !!(c.action || c.customRequest)), S = p(
6
+ () => Number.isFinite(c.concurrency) ? Math.max(1, Math.min(20, Math.floor(c.concurrency))) : 2
7
+ ), v = p(
8
+ () => new Map(t.files.value.map((e) => [e.uid, e]))
9
+ );
10
+ let g = 0, q = !1;
11
+ const h = /* @__PURE__ */ new Map();
12
+ function f(e) {
13
+ var r;
14
+ return t.live() && t.available.value && !e.controller.signal.aborted && l.value.get(e.uid) === e && ((r = v.value.get(e.uid)) == null ? void 0 : r.raw) === e.raw;
15
+ }
16
+ function P(e) {
17
+ h.delete(e), !h.size && g && (cancelAnimationFrame(g), g = 0);
18
+ }
19
+ function O(e, r) {
20
+ if (!f(e) || e.phase !== "running" || !Number.isFinite(r))
21
+ return;
22
+ const n = Math.max(e.percentage, Math.min(100, Math.max(0, r)));
23
+ n !== e.percentage && (e.percentage = n, h.set(e.uid, Math.round(n * 10) / 10), !g && (g = requestAnimationFrame(() => {
24
+ g = 0;
25
+ const a = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map();
26
+ for (const [i, d] of h) {
27
+ const o = l.value.get(i);
28
+ o && f(o) && o.phase === "running" && (a.set(i, { percentage: d }), u.set(i, o));
29
+ }
30
+ h.clear(), a.size && t.patch(
31
+ a,
32
+ "progress",
33
+ (i) => i ? !!u.get(i) && f(u.get(i)) && u.get(i).phase === "running" : [...u.values()].some(
34
+ (d) => f(d) && d.phase === "running"
35
+ )
36
+ ).then(() => {
37
+ for (const [i, d] of u)
38
+ if (f(d) && d.phase === "running") {
39
+ const o = v.value.get(i);
40
+ o && t.emit("progress", a.get(i).percentage, {
41
+ ...o,
42
+ ...a.get(i)
43
+ });
44
+ }
45
+ });
46
+ })));
47
+ }
48
+ function x(e) {
49
+ if (l.value.get(e.uid) !== e) return;
50
+ const r = new Map(l.value);
51
+ r.delete(e.uid), l.value = r, M();
52
+ }
53
+ function m(e, r, n) {
54
+ !f(e) || e.phase === "finishing" || (e.phase = "finishing", P(e.uid), (async () => {
55
+ const a = r === void 0 ? void 0 : N(r), u = a ? { status: "error", error: a } : { status: "success", percentage: 100, response: n, error: void 0 };
56
+ if (await t.patch(
57
+ /* @__PURE__ */ new Map([[e.uid, u]]),
58
+ a ? "error" : "success",
59
+ () => f(e)
60
+ ), !f(e)) return;
61
+ const i = { ...v.value.get(e.uid), ...u };
62
+ a ? (t.emit("uploadError", a, i), t.emit("error", a.message)) : t.emit("success", n, i), x(e);
63
+ })().catch((a) => {
64
+ f(e) && (t.emit("error", N(a).message), x(e));
65
+ }));
66
+ }
67
+ function j(e, r) {
68
+ var n, a;
69
+ if (typeof r == "function") e.stop = r;
70
+ else if (r && typeof r.then == "function")
71
+ Promise.resolve(r).then(
72
+ (u) => m(e, void 0, u),
73
+ (u) => m(e, u)
74
+ );
75
+ else if (r) {
76
+ const u = r;
77
+ e.stop = (n = u.abort) == null ? void 0 : n.bind(u), u.promise && u.promise.then(
78
+ (i) => m(e, void 0, i),
79
+ (i) => m(e, i)
80
+ );
81
+ }
82
+ e.controller.signal.aborted && ((a = e.stop) == null || a.call(e));
83
+ }
84
+ async function K(e) {
85
+ try {
86
+ let r = v.value.get(e.uid);
87
+ if (!r || !f(e)) return;
88
+ const n = await t.prepare(r, e.controller.signal);
89
+ if (!f(e)) return;
90
+ if (!n) {
91
+ x(e);
92
+ return;
93
+ }
94
+ const a = await t.patch(
95
+ /* @__PURE__ */ new Map([
96
+ [
97
+ e.uid,
98
+ {
99
+ status: "uploading",
100
+ percentage: 0,
101
+ error: void 0,
102
+ response: void 0
103
+ }
104
+ ]
105
+ ]),
106
+ "start",
107
+ () => f(e)
108
+ );
109
+ if (!f(e)) return;
110
+ if (!a) {
111
+ F(e.uid, "rejected", !1);
112
+ return;
113
+ }
114
+ if (r = v.value.get(e.uid), e.phase = "running", t.emit("start", r), !f(e)) return;
115
+ const u = {
116
+ signal: e.controller.signal,
117
+ files: t.files.value
118
+ }, [i, d, o] = await Promise.all([
119
+ typeof c.action == "function" ? c.action(r, u) : c.action ?? "",
120
+ typeof c.data == "function" ? c.data(r, u) : c.data ?? {},
121
+ typeof c.headers == "function" ? c.headers(r, u) : c.headers ?? {}
122
+ ]);
123
+ if (!f(e)) return;
124
+ const A = {
125
+ ...u,
126
+ file: v.value.get(e.uid),
127
+ body: n,
128
+ action: i,
129
+ method: c.method ?? "POST",
130
+ name: c.name ?? "file",
131
+ headers: o,
132
+ data: d,
133
+ withCredentials: !!c.withCredentials,
134
+ timeout: Number.isFinite(c.timeout) ? Math.max(0, c.timeout) : 0,
135
+ onProgress: (w) => O(e, w),
136
+ onSuccess: (w) => m(e, void 0, w),
137
+ onError: (w) => m(e, w)
138
+ };
139
+ if (!c.customRequest && !i)
140
+ throw Object.assign(new Error("请配置有效的上传地址"), {
141
+ kind: "configuration"
142
+ });
143
+ j(
144
+ e,
145
+ c.customRequest ? c.customRequest(A) : D(A)
146
+ );
147
+ } catch (r) {
148
+ m(e, r);
149
+ }
150
+ }
151
+ function M() {
152
+ q || (q = !0, queueMicrotask(() => {
153
+ if (q = !1, !(!t.live() || !t.available.value || !y.value))
154
+ for (; l.value.size < S.value && s.value.length; ) {
155
+ const e = s.value[0];
156
+ s.value = s.value.slice(1);
157
+ const r = v.value.get(e);
158
+ if (!(r != null && r.raw) || l.value.has(e)) continue;
159
+ const n = {
160
+ uid: e,
161
+ raw: r.raw,
162
+ controller: new AbortController(),
163
+ phase: "preparing",
164
+ percentage: 0
165
+ };
166
+ l.value = new Map(l.value).set(e, n), K(n);
167
+ }
168
+ }));
169
+ }
170
+ async function z(e) {
171
+ if (!t.live() || !t.available.value || !y.value)
172
+ return 0;
173
+ const r = t.files.value.filter(
174
+ (n) => (e === void 0 || n.uid === e) && n.raw && ["ready", "error"].includes(b(n)) && !l.value.has(n.uid) && !s.value.includes(n.uid)
175
+ );
176
+ for (const n of r)
177
+ b(n) === "error" && t.forget(n.uid);
178
+ return s.value = [...s.value, ...r.map((n) => n.uid)], M(), r.length;
179
+ }
180
+ function F(e, r, n = !0) {
181
+ var d;
182
+ const a = l.value.get(e), u = s.value.includes(e);
183
+ if (!a && !u) return !1;
184
+ if (s.value = s.value.filter((o) => o !== e), P(e), a) {
185
+ const o = new Map(l.value);
186
+ o.delete(e), l.value = o, a.controller.abort();
187
+ try {
188
+ (d = a.stop) == null || d.call(a);
189
+ } catch {
190
+ }
191
+ }
192
+ const i = v.value.get(e);
193
+ return n && i && (t.patch(
194
+ /* @__PURE__ */ new Map([
195
+ [
196
+ e,
197
+ { status: "ready", percentage: 0, error: void 0 }
198
+ ]
199
+ ]),
200
+ "abort",
201
+ () => {
202
+ var o;
203
+ return t.live() && ((o = v.value.get(e)) == null ? void 0 : o.raw) === i.raw;
204
+ }
205
+ ), t.emit("abort", i, r)), M(), !0;
206
+ }
207
+ function R(e, r = "user", n = !0) {
208
+ const a = e === void 0 ? /* @__PURE__ */ new Set([...s.value, ...l.value.keys()]) : /* @__PURE__ */ new Set([e]);
209
+ let u = 0;
210
+ for (const i of a) F(i, r, n) && u++;
211
+ return u;
212
+ }
213
+ async function T(e) {
214
+ const r = v.value.get(e);
215
+ return !(r != null && r.raw) || !t.available.value || !t.live() || (R(e, "retry", !1), t.forget(e), !(b(r) === "ready" && !r.percentage && !r.error && r.response === void 0 || await t.patch(
216
+ /* @__PURE__ */ new Map([
217
+ [
218
+ e,
219
+ {
220
+ status: "ready",
221
+ percentage: 0,
222
+ error: void 0,
223
+ response: void 0
224
+ }
225
+ ]
226
+ ]),
227
+ "retry"
228
+ ))) ? !1 : await z(e) > 0;
229
+ }
230
+ function U() {
231
+ for (const [e, r] of l.value) {
232
+ const n = v.value.get(e);
233
+ (!n || n.raw !== r.raw || r.phase === "running" && ["success", "error"].includes(b(n))) && F(e, "model", !1);
234
+ }
235
+ s.value = s.value.filter((e) => {
236
+ var r;
237
+ return !!((r = v.value.get(e)) != null && r.raw);
238
+ });
239
+ }
240
+ E(
241
+ () => t.files.value.map((e) => [e.uid, e.raw, e.status]),
242
+ U,
243
+ { flush: "sync" }
244
+ ), E([t.available, S, y], () => {
245
+ t.available.value && M();
246
+ });
247
+ function B() {
248
+ R(void 0, "cleanup", !1), g && cancelAnimationFrame(g), g = 0, h.clear();
249
+ }
250
+ return {
251
+ configured: y,
252
+ queue: s,
253
+ tasks: l,
254
+ uploading: p(() => l.value.size),
255
+ queued: p(() => s.value.length),
256
+ activeKeys: p(() => new Set(l.value.keys())),
257
+ queuedKeys: p(() => new Set(s.value)),
258
+ submit: z,
259
+ retry: T,
260
+ abort: R,
261
+ cleanup: B
262
+ };
263
+ }
264
+ export {
265
+ J as useUploadRequests
266
+ };
@@ -0,0 +1,277 @@
1
+ import { ref as E, computed as s, onMounted as ge, onActivated as we, nextTick as xe, onDeactivated as ye, onBeforeUnmount as Me, watch as X } from "vue";
2
+ import { virtualFinite as f, virtualAligned as ue } from "./virtualTable.js";
3
+ const fe = (l, y) => ({ token: l, width: y, index: -1, offset: 0, gap: !0 });
4
+ function Le(l, y, se, U) {
5
+ const M = E(), c = E(!0), b = s(
6
+ () => f(l.rowHeight, 42, 1, 1e4)
7
+ ), Y = s(
8
+ () => l.showHeader ? f(l.headerHeight, 42, 24, 200) : 0
9
+ ), F = s(
10
+ () => {
11
+ var e;
12
+ return Y.value + (((e = l.fixedRows) == null ? void 0 : e.length) ?? 0) * b.value;
13
+ }
14
+ ), Z = E(0), V = E(0), v = E(0), x = E(0), q = s(
15
+ () => Math.max(
16
+ 1,
17
+ V.value ? V.value - F.value : f(l.height, 280, 1)
18
+ )
19
+ ), S = s(
20
+ () => Z.value || f(l.width, 600, 1)
21
+ ), ce = s(() => ({
22
+ height: typeof l.height == "string" ? "calc(" + l.height + " + " + F.value + "px)" : f(l.height, 280, 1) + F.value + "px"
23
+ })), he = s(() => ({
24
+ width: typeof l.width == "number" ? f(l.width, 600, 1) + "px" : l.width
25
+ })), L = s(() => {
26
+ const e = /* @__PURE__ */ new Set(), a = [], n = [], i = [], h = l.columns.filter(
27
+ (t) => !t.hidden && typeof t.key == "string" && !e.has(t.key) && !!e.add(t.key)
28
+ ), m = [
29
+ ...h.filter((t) => t.fixed === !0 || t.fixed === "left"),
30
+ ...h.filter((t) => !t.fixed),
31
+ ...h.filter((t) => t.fixed === "right")
32
+ ], w = m.map((t) => {
33
+ const o = f(t.minWidth, 1, 1, 1e4);
34
+ return { min: o, max: f(t.maxWidth, 1e4, o, 1e4) };
35
+ }), d = m.map(
36
+ (t, o) => f(t.width, 160, w[o].min, w[o].max)
37
+ ), r = l.selectable ? f(l.selectionWidth, 44, 32, 150) : 0;
38
+ let T = l.fit ? S.value - d.reduce((t, o) => t + o, r) : 0;
39
+ if (T > 0) {
40
+ const t = m.flatMap(
41
+ (o, u) => o.fixed ? [] : [{ index: u, capacity: w[u].max - d[u] }]
42
+ ).sort((o, u) => o.capacity - u.capacity);
43
+ t.forEach(({ index: o, capacity: u }, g) => {
44
+ const C = Math.min(
45
+ u,
46
+ T / (t.length - g)
47
+ );
48
+ d[o] += C, T -= C;
49
+ });
50
+ }
51
+ let k = r;
52
+ r && a.push({
53
+ token: "selection",
54
+ index: -1,
55
+ width: r,
56
+ offset: 0,
57
+ left: 0,
58
+ selection: !0
59
+ }), m.forEach((t, o) => {
60
+ const u = d[o], g = {
61
+ token: "column:" + t.key,
62
+ column: t,
63
+ index: o,
64
+ width: u,
65
+ offset: k
66
+ };
67
+ t.fixed === "right" ? i.push(g) : t.fixed ? (g.left = k, a.push(g)) : n.push(g), k += u;
68
+ });
69
+ let H = 0;
70
+ for (let t = i.length - 1; t >= 0; t--)
71
+ i[t].right = H, H += i[t].width;
72
+ return {
73
+ left: a,
74
+ center: n,
75
+ right: i,
76
+ total: k,
77
+ leftWidth: a.reduce((t, o) => t + o.width, 0),
78
+ rightWidth: H
79
+ };
80
+ }), _ = s(() => [
81
+ ...L.value.left,
82
+ ...L.value.center,
83
+ ...L.value.right
84
+ ]), $ = s(
85
+ () => new Map(
86
+ _.value.flatMap(
87
+ (e) => e.column ? [[e.column.key, e]] : []
88
+ )
89
+ )
90
+ ), ee = s(
91
+ () => Math.max(L.value.total, S.value)
92
+ ), te = s((e) => {
93
+ var o;
94
+ const { left: a, center: n, right: i, total: h, leftWidth: m, rightWidth: w } = L.value;
95
+ let d = 0, r = n.length;
96
+ if (l.virtualColumns) {
97
+ const u = x.value + m, g = x.value + S.value - w, C = Math.floor(f(l.columnOverscan, 1, 0, 20));
98
+ let O = 0, Q = n.length;
99
+ for (; O < Q; ) {
100
+ const N = O + Q >>> 1;
101
+ n[N].offset + n[N].width <= u ? O = N + 1 : Q = N;
102
+ }
103
+ for (d = Math.max(0, O - C), r = O; r < n.length && n[r].offset < g; ) r++;
104
+ r = Math.min(n.length, r + C);
105
+ }
106
+ const T = d ? (((o = n[d]) == null ? void 0 : o.offset) ?? h - w) - m : 0, k = r < n.length ? h - w - n[r].offset : 0, H = ee.value - h, t = [
107
+ ...a,
108
+ ...T > 0 ? [fe("gap:before", T)] : [],
109
+ ...n.slice(d, r),
110
+ ...k + H > 0 ? [fe("gap:after", k + H)] : [],
111
+ ...i
112
+ ];
113
+ return (e == null ? void 0 : e.length) === t.length && t.every(
114
+ (u, g) => u === e[g] || u.gap && e[g].token === u.token && e[g].width === u.width
115
+ ) ? e : t;
116
+ }), le = s((e) => {
117
+ const a = y(), n = Math.floor(f(l.overscan, 5, 0, 100)), i = Math.min(
118
+ Math.max(0, a - 1),
119
+ Math.floor(v.value / b.value)
120
+ ), h = Math.min(
121
+ a - 1,
122
+ Math.ceil((v.value + q.value) / b.value) - 1
123
+ ), m = Math.max(0, i - n), w = Math.min(a - 1, h + n), d = te.value.flatMap(
124
+ (r) => r.column ? [r.column.key] : []
125
+ );
126
+ return e && m === e.start && w === e.end && i === e.visibleStart && h === e.visibleEnd && d.length === e.columnKeys.length && d.every((r, T) => r === e.columnKeys[T]) ? e : { start: m, end: w, visibleStart: i, visibleEnd: h, columnKeys: d };
127
+ }), A = s(
128
+ () => Math.max(0, y() * b.value - q.value)
129
+ ), j = s(() => Math.max(0, L.value.total - S.value));
130
+ let R = 0, z = 0, W, G = !1, p = 0, B = 0, ne = 0, ae = 0, I = "";
131
+ function ie() {
132
+ if (!c.value) return;
133
+ const e = v.value, a = x.value;
134
+ v.value = f(p, 0, 0, A.value), x.value = f(B, 0, 0, j.value), (e !== v.value || a !== x.value) && U.scroll({
135
+ scrollTop: v.value,
136
+ scrollLeft: x.value,
137
+ direction: e !== v.value ? v.value > e ? "down" : "up" : x.value > a ? "right" : "left"
138
+ });
139
+ }
140
+ function de() {
141
+ const e = M.value;
142
+ !c.value || !e || (p = e.scrollTop, B = e.scrollLeft, R || (R = requestAnimationFrame(() => {
143
+ R = 0, ie();
144
+ })));
145
+ }
146
+ function K(e) {
147
+ const a = M.value;
148
+ if (!c.value || !a) return;
149
+ const n = f(e.top, a.scrollTop, 0, A.value), i = f(e.left, a.scrollLeft, 0, j.value);
150
+ if (e.behavior === "smooth" && a.scrollTo) {
151
+ a.scrollTo({ top: n, left: i, behavior: "smooth" });
152
+ return;
153
+ }
154
+ a.scrollTop !== n && (a.scrollTop = n), a.scrollLeft !== i && (a.scrollLeft = i), p = n, B = i, ie();
155
+ }
156
+ function ve(e, a = "nearest") {
157
+ var i;
158
+ if (!y() || !Number.isFinite(e)) return;
159
+ const n = Math.min(y() - 1, Math.max(0, Math.floor(e))) * b.value;
160
+ K({
161
+ top: ue(
162
+ n,
163
+ b.value,
164
+ ((i = M.value) == null ? void 0 : i.scrollTop) ?? v.value,
165
+ q.value,
166
+ a
167
+ )
168
+ });
169
+ }
170
+ function me(e, a = "nearest") {
171
+ var i;
172
+ if (!c.value) return !1;
173
+ const n = $.value.get(e);
174
+ if (!n) return !1;
175
+ if (n.left === void 0 && n.right === void 0) {
176
+ const { leftWidth: h, rightWidth: m } = L.value;
177
+ K({
178
+ left: ue(
179
+ n.offset - h,
180
+ n.width,
181
+ ((i = M.value) == null ? void 0 : i.scrollLeft) ?? x.value,
182
+ Math.max(1, S.value - h - m),
183
+ a
184
+ )
185
+ });
186
+ }
187
+ return !0;
188
+ }
189
+ function J() {
190
+ const e = M.value;
191
+ !c.value || !e || (e.clientWidth && (Z.value = e.clientWidth), e.clientHeight && (V.value = e.clientHeight), K({ top: e.scrollTop, left: e.scrollLeft }));
192
+ }
193
+ function D() {
194
+ c.value && !z && (z = requestAnimationFrame(() => {
195
+ z = 0, J();
196
+ }));
197
+ }
198
+ function oe() {
199
+ G || !c.value || !M.value || (G = !0, typeof ResizeObserver < "u" ? (W = new ResizeObserver(D), W.observe(M.value)) : window.addEventListener("resize", D), J());
200
+ }
201
+ function re() {
202
+ W == null || W.disconnect(), W = void 0, G = !1, window.removeEventListener("resize", D), cancelAnimationFrame(R), cancelAnimationFrame(z), R = z = 0;
203
+ }
204
+ function P() {
205
+ const e = y();
206
+ if (!c.value || !e || l.loading) return;
207
+ const a = Math.max(0, A.value - v.value);
208
+ if (a > f(l.endReachedThreshold, 42, 0, 1e4)) {
209
+ I = "";
210
+ return;
211
+ }
212
+ const n = e + ":" + se();
213
+ n !== I && (I = n, U.end({ distance: a, total: e }));
214
+ }
215
+ return ge(() => {
216
+ oe(), P();
217
+ }), we(() => {
218
+ const e = !c.value;
219
+ c.value = !0, oe(), e && xe(() => {
220
+ K({ top: ne, left: ae }), P();
221
+ });
222
+ }), ye(() => {
223
+ ne = p, ae = B, c.value = !1, re();
224
+ }), Me(() => {
225
+ c.value = !1, re();
226
+ }), X([A, j, F, () => l.height], D, {
227
+ flush: "post"
228
+ }), X(
229
+ le,
230
+ (e) => {
231
+ c.value && U.range({ ...e, columnKeys: [...e.columnKeys] });
232
+ },
233
+ { flush: "post", immediate: !0 }
234
+ ), X(
235
+ [
236
+ v,
237
+ A,
238
+ y,
239
+ () => l.loading,
240
+ () => l.endReachedThreshold
241
+ ],
242
+ P,
243
+ { flush: "post" }
244
+ ), {
245
+ viewport: M,
246
+ live: c,
247
+ rowHeight: b,
248
+ headerHeight: Y,
249
+ topHeight: F,
250
+ bodyHeight: q,
251
+ rootStyle: he,
252
+ viewportStyle: ce,
253
+ columns: _,
254
+ columnMap: $,
255
+ renderColumns: te,
256
+ contentWidth: ee,
257
+ scrollTop: v,
258
+ scrollLeft: x,
259
+ range: le,
260
+ scrollTo: K,
261
+ scrollToRow: ve,
262
+ scrollToColumn: me,
263
+ onScroll: de,
264
+ remeasure: J
265
+ };
266
+ }
267
+ function ke(l) {
268
+ return {
269
+ width: l.width + "px",
270
+ flex: "0 0 " + l.width + "px",
271
+ ...l.left !== void 0 ? { position: "sticky", left: l.left + "px" } : l.right !== void 0 ? { position: "sticky", right: l.right + "px" } : {}
272
+ };
273
+ }
274
+ export {
275
+ Le as useVirtualTableLayout,
276
+ ke as virtualColumnStyle
277
+ };
@@ -0,0 +1,43 @@
1
+ const y = (t, e, r = 0, n = 1e7) => Math.max(
2
+ r,
3
+ Math.min(
4
+ n,
5
+ typeof t == "number" && Number.isFinite(t) ? t : e
6
+ )
7
+ ), o = (t) => typeof t == "string" || typeof t == "number" && Number.isFinite(t), c = (t) => typeof t + ":" + String(t);
8
+ function a(t, e, r) {
9
+ if (e.valueGetter) return e.valueGetter(t, r);
10
+ const n = e.dataIndex ?? e.key;
11
+ return typeof n == "string" && Object.prototype.hasOwnProperty.call(t, n) ? t[n] : (typeof n == "string" ? n.split(".") : n).reduce(
12
+ (i, u) => i !== null && typeof i == "object" ? i[u] : void 0,
13
+ t
14
+ );
15
+ }
16
+ function b(t, e) {
17
+ const r = t.map(
18
+ (i, u) => typeof e == "function" ? e(i, u) : i[e || "id"]
19
+ ), n = /* @__PURE__ */ new Map();
20
+ for (const i of r)
21
+ o(i) && n.set(i, (n.get(i) ?? 0) + 1);
22
+ return t.map((i, u) => {
23
+ const f = r[u], p = o(f) && n.get(f) === 1;
24
+ return {
25
+ row: i,
26
+ key: p ? f : u,
27
+ token: p ? c(f) : "fallback:" + u,
28
+ sourceIndex: u,
29
+ valid: p
30
+ };
31
+ });
32
+ }
33
+ function d(t, e, r, n, i) {
34
+ return i === "center" ? t - (n - e) / 2 : i === "end" ? t + e - n : i === "nearest" ? e > n && t <= r && t + e >= r + n ? r : t < r ? t : t + e > r + n ? e > n ? t : t + e - n : r : t;
35
+ }
36
+ export {
37
+ d as virtualAligned,
38
+ b as virtualEntries,
39
+ y as virtualFinite,
40
+ o as virtualKey,
41
+ c as virtualToken,
42
+ a as virtualValue
43
+ };
package/dist/index.js CHANGED
@@ -11,10 +11,10 @@ import { default as C } from "./components/HysButton/HysButton.vue.js";
11
11
  import { default as g } from "./components/HysCalendar/HysCalendar.vue.js";
12
12
  import { default as P } from "./components/HysCalendarNavigation/HysCalendarNavigation.vue.js";
13
13
  import { default as k } from "./components/HysCard/HysCard.vue.js";
14
- import { default as A } from "./components/HysCascader/HysCascader.vue.js";
15
- import { default as E } from "./components/HysChart/HysChart.vue.js";
16
- import { default as G } from "./components/HysCheckbox/HysCheckbox.vue.js";
17
- import { default as M } from "./components/HysCheckboxGroup/HysCheckboxGroup.vue.js";
14
+ import { default as v } from "./components/HysCascader/HysCascader.vue.js";
15
+ import { default as D } from "./components/HysChart/HysChart.vue.js";
16
+ import { default as R } from "./components/HysCheckbox/HysCheckbox.vue.js";
17
+ import { default as I } from "./components/HysCheckboxGroup/HysCheckboxGroup.vue.js";
18
18
  import { default as N } from "./components/HysColorPicker/HysColorPicker.vue.js";
19
19
  import { default as B } from "./components/HysColorTokenEditor/HysColorTokenEditor.vue.js";
20
20
  import { default as z } from "./components/HysCommandPalette/HysCommandPalette.vue.js";
@@ -38,10 +38,10 @@ import { default as Ce } from "./components/HysKanban/HysKanban.vue.js";
38
38
  import { default as ge } from "./components/HysMention/HysMention.vue.js";
39
39
  import { default as Pe } from "./components/HysModal/HysModal.vue.js";
40
40
  import { default as ke } from "./components/HysNotificationCenter/HysNotificationCenter.vue.js";
41
- import { default as Ae } from "./components/HysNumberInput/HysNumberInput.vue.js";
42
- import { default as Ee } from "./components/HysOrgTree/HysOrgTree.vue.js";
43
- import { default as Ge } from "./components/HysPagination/HysPagination.vue.js";
44
- import { default as Me } from "./components/HysPermissionMatrix/HysPermissionMatrix.vue.js";
41
+ import { default as ve } from "./components/HysNumberInput/HysNumberInput.vue.js";
42
+ import { default as De } from "./components/HysOrgTree/HysOrgTree.vue.js";
43
+ import { default as Re } from "./components/HysPagination/HysPagination.vue.js";
44
+ import { default as Ie } from "./components/HysPermissionMatrix/HysPermissionMatrix.vue.js";
45
45
  import { default as Ne } from "./components/HysPopover/HysPopover.vue.js";
46
46
  import { default as Be } from "./components/HysProgress/HysProgress.vue.js";
47
47
  import { default as ze } from "./components/HysRadio/HysRadio.vue.js";
@@ -65,16 +65,17 @@ import { default as Cr } from "./components/HysTagInput/HysTagInput.vue.js";
65
65
  import { default as gr } from "./components/HysTextarea/HysTextarea.vue.js";
66
66
  import { default as Pr } from "./components/HysTimeline/HysTimeline.vue.js";
67
67
  import { default as kr } from "./components/HysToast/HysToast.vue.js";
68
- import { default as Ar } from "./components/HysTooltip/HysTooltip.vue.js";
69
- import { default as Er } from "./components/HysTour/HysTour.vue.js";
70
- import { default as Gr } from "./components/HysTransfer/HysTransfer.vue.js";
71
- import { default as Mr } from "./components/HysTree/HysTree.vue.js";
68
+ import { default as vr } from "./components/HysTooltip/HysTooltip.vue.js";
69
+ import { default as Dr } from "./components/HysTour/HysTour.vue.js";
70
+ import { default as Rr } from "./components/HysTransfer/HysTransfer.vue.js";
71
+ import { default as Ir } from "./components/HysTree/HysTree.vue.js";
72
72
  import { default as Nr } from "./components/HysTreeSelect/HysTreeSelect.vue.js";
73
73
  import { default as Br } from "./components/HysUpload/HysUpload.vue.js";
74
74
  import { default as zr } from "./components/HysVirtualTable/HysVirtualTable.vue.js";
75
75
  import { provideHysConfig as Kr } from "./config.js";
76
76
  import { useHysFormItemContext as Or } from "./composables/formContext.js";
77
77
  import { createHysToast as jr, useHysToast as qr } from "./composables/useHysToast.js";
78
+ import { createHysModal as Wr, useHysModal as Xr } from "./composables/useHysModal.js";
78
79
  export {
79
80
  o as HysAccordion,
80
81
  s as HysAlert,
@@ -88,10 +89,10 @@ export {
88
89
  g as HysCalendar,
89
90
  P as HysCalendarNavigation,
90
91
  k as HysCard,
91
- A as HysCascader,
92
- E as HysChart,
93
- G as HysCheckbox,
94
- M as HysCheckboxGroup,
92
+ v as HysCascader,
93
+ D as HysChart,
94
+ R as HysCheckbox,
95
+ I as HysCheckboxGroup,
95
96
  N as HysColorPicker,
96
97
  B as HysColorTokenEditor,
97
98
  z as HysCommandPalette,
@@ -115,10 +116,10 @@ export {
115
116
  ge as HysMention,
116
117
  Pe as HysModal,
117
118
  ke as HysNotificationCenter,
118
- Ae as HysNumberInput,
119
- Ee as HysOrgTree,
120
- Ge as HysPagination,
121
- Me as HysPermissionMatrix,
119
+ ve as HysNumberInput,
120
+ De as HysOrgTree,
121
+ Re as HysPagination,
122
+ Ie as HysPermissionMatrix,
122
123
  Ne as HysPopover,
123
124
  Be as HysProgress,
124
125
  ze as HysRadio,
@@ -142,15 +143,17 @@ export {
142
143
  gr as HysTextarea,
143
144
  Pr as HysTimeline,
144
145
  kr as HysToast,
145
- Ar as HysTooltip,
146
- Er as HysTour,
147
- Gr as HysTransfer,
148
- Mr as HysTree,
146
+ vr as HysTooltip,
147
+ Dr as HysTour,
148
+ Rr as HysTransfer,
149
+ Ir as HysTree,
149
150
  Nr as HysTreeSelect,
150
151
  Br as HysUpload,
151
152
  zr as HysVirtualTable,
153
+ Wr as createHysModal,
152
154
  jr as createHysToast,
153
155
  Kr as provideHysConfig,
154
156
  Or as useHysFormItemContext,
157
+ Xr as useHysModal,
155
158
  qr as useHysToast
156
159
  };