hys-ui 0.2.0 → 0.4.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.
- package/CHANGELOG.md +59 -0
- package/README.md +68 -59
- package/dist/components/HysAlert/HysAlert.vue.js +5 -54
- package/dist/components/HysAlert/HysAlert2.vue.js +159 -2
- package/dist/components/HysAnimatedNumber/HysAnimatedNumber.vue.js +5 -41
- package/dist/components/HysAnimatedNumber/HysAnimatedNumber2.vue.js +146 -2
- package/dist/components/HysAutocomplete/HysAutocomplete.vue.js +2 -2
- package/dist/components/HysAutocomplete/HysAutocomplete2.vue.js +285 -273
- package/dist/components/HysAvatarGroup/HysAvatarGroup.vue.js +1 -1
- package/dist/components/HysAvatarGroup/HysAvatarGroup2.vue.js +102 -98
- package/dist/components/HysBreadcrumb/HysBreadcrumb.vue.js +1 -1
- package/dist/components/HysBreadcrumb/HysBreadcrumb2.vue.js +273 -59
- package/dist/components/HysButton/HysButton.vue.js +2 -2
- package/dist/components/HysButton/HysButton2.vue.js +227 -60
- package/dist/components/HysButtonGroup/HysButtonGroup.vue.js +7 -0
- package/dist/components/HysButtonGroup/HysButtonGroup2.vue.js +51 -0
- package/dist/components/HysCalendar/HysCalendar.vue.js +3 -3
- package/dist/components/HysCalendar/HysCalendar2.vue.js +237 -225
- package/dist/components/HysCascader/HysCascader.vue.js +2 -2
- package/dist/components/HysCascader/HysCascader2.vue.js +337 -324
- package/dist/components/HysColorPicker/HysColorPanel.vue.js +7 -0
- package/dist/components/HysColorPicker/HysColorPanel2.vue.js +238 -0
- package/dist/components/HysColorPicker/HysColorPicker.vue.js +2 -2
- package/dist/components/HysColorPicker/HysColorPicker2.vue.js +239 -217
- package/dist/components/HysCommandPalette/HysCommandPalette.vue.js +90 -76
- package/dist/components/HysContextMenu/HysContextMenu.vue.js +5 -89
- package/dist/components/HysContextMenu/HysContextMenu2.vue.js +247 -2
- package/dist/components/HysContextMenu/HysMenuPanel.vue.js +7 -0
- package/dist/components/HysContextMenu/HysMenuPanel2.vue.js +208 -0
- package/dist/components/HysContextMenu/HysMenuSlot.js +10 -0
- package/dist/components/HysDataGrid/HysDataGrid.vue.js +1 -1
- package/dist/components/HysDataGrid/HysDataGrid2.vue.js +1008 -559
- package/dist/components/HysDatePicker/HysDatePicker.vue.js +2 -0
- package/dist/components/HysDatePicker/HysDatePickerControl.vue.js +2 -2
- package/dist/components/HysDatePicker/HysDatePickerControl2.vue.js +539 -526
- package/dist/components/HysDateRangePicker/HysDateRangePicker.vue.js +5 -3
- package/dist/components/HysDrawer/HysDrawer.vue.js +1 -1
- package/dist/components/HysDrawer/HysDrawer2.vue.js +434 -84
- package/dist/components/HysEmpty/HysEmpty.vue.js +5 -41
- package/dist/components/HysEmpty/HysEmpty2.vue.js +181 -2
- package/dist/components/HysFormItem/HysFormItem.vue.js +2 -2
- package/dist/components/HysFormItem/HysFormItem2.vue.js +171 -164
- package/dist/components/HysGantt/HysGantt.vue.js +1 -1
- package/dist/components/HysGantt/HysGantt2.vue.js +810 -795
- package/dist/components/HysMention/HysMention.vue.js +1 -1
- package/dist/components/HysMention/HysMention2.vue.js +1092 -142
- package/dist/components/HysModal/HysModal.vue.js +2 -2
- package/dist/components/HysModal/HysModal2.vue.js +491 -85
- package/dist/components/HysPagination/HysPagination.vue.js +2 -2
- package/dist/components/HysPagination/HysPagination2.vue.js +243 -180
- package/dist/components/HysPopover/HysPopover.vue.js +5 -91
- package/dist/components/HysPopover/HysPopover2.vue.js +120 -2
- package/dist/components/HysProgress/HysProgress.vue.js +2 -2
- package/dist/components/HysProgress/HysProgress2.vue.js +319 -52
- package/dist/components/HysSearch/HysSearch.vue.js +5 -82
- package/dist/components/HysSearch/HysSearch2.vue.js +176 -2
- package/dist/components/HysSelect/HysSelect.vue.js +2 -2
- package/dist/components/HysSelect/HysSelect2.vue.js +755 -590
- package/dist/components/HysSlider/HysSlider.vue.js +2 -2
- package/dist/components/HysSlider/HysSlider2.vue.js +192 -188
- package/dist/components/HysSlider/SliderTooltip.vue.js +2 -2
- package/dist/components/HysSlider/SliderTooltip2.vue.js +103 -89
- package/dist/components/HysSplitPane/HysSplitPane.vue.js +315 -58
- package/dist/components/HysSplitPane/HysSplitPane3.vue.js +5 -0
- package/dist/components/HysTable/HysTable.vue.js +2 -2
- package/dist/components/HysTable/HysTable2.vue.js +1416 -1127
- package/dist/components/HysTagInput/HysTagInput.vue.js +5 -82
- package/dist/components/HysTagInput/HysTagInput2.vue.js +396 -2
- package/dist/components/HysTimeline/HysTimeline.vue.js +2 -2
- package/dist/components/HysTimeline/HysTimeline2.vue.js +243 -24
- package/dist/components/HysTooltip/HysTooltip.vue.js +5 -64
- package/dist/components/HysTooltip/HysTooltip2.vue.js +110 -2
- package/dist/components/HysTour/HysTour.vue.js +291 -63
- package/dist/components/HysTour/HysTour3.vue.js +5 -0
- package/dist/components/HysTransfer/HysTransfer.vue.js +2 -2
- package/dist/components/HysTransfer/HysTransfer2.vue.js +237 -207
- package/dist/components/HysTransfer/HysTransferPanel.vue.js +1 -1
- package/dist/components/HysTransfer/HysTransferPanel2.vue.js +320 -271
- package/dist/components/HysTree/HysTree.vue.js +2 -2
- package/dist/components/HysTree/HysTree2.vue.js +195 -184
- package/dist/components/HysTreeSelect/HysTreeSelect.vue.js +4 -4
- package/dist/components/HysTreeSelect/HysTreeSelect2.vue.js +389 -377
- package/dist/components/HysUpload/HysUpload.vue.js +2 -2
- package/dist/components/HysUpload/HysUpload2.vue.js +459 -125
- package/dist/components/HysVirtualTable/HysVirtualTable.vue.js +5 -94
- package/dist/components/HysVirtualTable/HysVirtualTable2.vue.js +656 -2
- package/dist/composables/buttonGroup.js +12 -0
- package/dist/composables/color.js +97 -0
- package/dist/composables/dataGrid.js +68 -0
- package/dist/composables/drawer.js +17 -0
- package/dist/composables/feedback.js +14 -0
- package/dist/composables/floatingPosition.js +18 -0
- package/dist/composables/mentionDocument.js +79 -0
- package/dist/composables/mentionEditor.js +58 -0
- package/dist/composables/menu.js +96 -0
- package/dist/composables/modal.js +14 -0
- package/dist/composables/overlayManager.js +48 -18
- package/dist/composables/progress.js +94 -0
- package/dist/composables/selectOptions.js +44 -38
- package/dist/composables/splitPaneSizes.js +58 -0
- package/dist/composables/table.js +128 -105
- package/dist/composables/tagInput.js +16 -0
- package/dist/composables/timeline.js +19 -0
- package/dist/composables/transfer.js +19 -17
- package/dist/composables/upload.js +55 -0
- package/dist/composables/uploadRequest.js +58 -0
- package/dist/composables/useAlert.js +124 -0
- package/dist/composables/useColorPicker.js +402 -0
- package/dist/composables/useContextMenu.js +514 -0
- package/dist/composables/useDataGridRemote.js +67 -0
- package/dist/composables/useDialog.js +86 -43
- package/dist/composables/useDrawerPush.js +33 -0
- package/dist/composables/useDrawerResize.js +221 -0
- package/dist/composables/useFloating.js +118 -80
- package/dist/composables/useHysModal.js +185 -0
- package/dist/composables/useMentionCaret.js +81 -0
- package/dist/composables/useMentionList.js +81 -0
- package/dist/composables/useMentionModel.js +90 -0
- package/dist/composables/useMentionOptions.js +421 -0
- package/dist/composables/useModal.js +295 -0
- package/dist/composables/useModalInteraction.js +394 -0
- package/dist/composables/usePopupSurface.js +458 -0
- package/dist/composables/useSplitPaneDrag.js +52 -0
- package/dist/composables/useSplitPaneStorage.js +38 -0
- package/dist/composables/useTable.js +344 -312
- package/dist/composables/useTableSticky.js +79 -0
- package/dist/composables/useTagInput.js +313 -0
- package/dist/composables/useTourLayout.js +129 -0
- package/dist/composables/useTransferMotion.js +185 -0
- package/dist/composables/useUpload.js +472 -0
- package/dist/composables/useUploadModel.js +65 -0
- package/dist/composables/useUploadRequests.js +266 -0
- package/dist/composables/useVirtualTableLayout.js +277 -0
- package/dist/composables/virtualTable.js +43 -0
- package/dist/config.js +11 -11
- package/dist/index.js +175 -153
- package/dist/internal/MultiSplitPane.vue.js +305 -0
- package/dist/internal/MultiSplitPane2.vue.js +4 -0
- package/dist/internal/PopupReference.js +39 -0
- package/dist/internal/PopupSurfacePanel.vue.js +7 -0
- package/dist/internal/PopupSurfacePanel2.vue.js +92 -0
- package/dist/motion/PopupMotion.js +105 -0
- package/dist/motion/popup.js +10 -0
- package/dist/style.css +1 -1
- package/dist/types/components/HysAlert/HysAlert.vue.d.ts +32 -22
- package/dist/types/components/HysAnimatedNumber/HysAnimatedNumber.vue.d.ts +61 -7
- package/dist/types/components/HysAutocomplete/HysAutocomplete.vue.d.ts +7 -7
- package/dist/types/components/HysAvatarGroup/HysAvatarGroup.vue.d.ts +6 -1
- package/dist/types/components/HysBadge/HysBadge.vue.d.ts +3 -3
- package/dist/types/components/HysBreadcrumb/HysBreadcrumb.vue.d.ts +54 -31
- package/dist/types/components/HysButton/HysButton.vue.d.ts +82 -22
- package/dist/types/components/HysButtonGroup/HysButtonGroup.vue.d.ts +30 -0
- package/dist/types/components/HysCalendar/HysCalendar.vue.d.ts +3 -2
- package/dist/types/components/HysCascader/HysCascader.vue.d.ts +7 -7
- package/dist/types/components/HysCascader/HysCascaderColumn.vue.d.ts +2 -2
- package/dist/types/components/HysColorPicker/HysColorPanel.vue.d.ts +58 -0
- package/dist/types/components/HysColorPicker/HysColorPicker.vue.d.ts +63 -10
- package/dist/types/components/HysCommandPalette/HysCommandPalette.vue.d.ts +2 -1
- package/dist/types/components/HysContextMenu/HysContextMenu.vue.d.ts +50 -34
- package/dist/types/components/HysContextMenu/HysMenuPanel.vue.d.ts +79 -0
- package/dist/types/components/HysContextMenu/HysMenuSlot.d.ts +8 -0
- package/dist/types/components/HysDataGrid/HysDataGrid.vue.d.ts +65 -118
- package/dist/types/components/HysDatePicker/HysDatePickerControl.vue.d.ts +3 -3
- package/dist/types/components/HysDrawer/HysDrawer.vue.d.ts +92 -35
- package/dist/types/components/HysEmpty/HysEmpty.vue.d.ts +24 -20
- package/dist/types/components/HysFileManager/HysFileManager.vue.d.ts +2 -2
- package/dist/types/components/HysGantt/HysGantt.vue.d.ts +2 -1
- package/dist/types/components/HysMention/HysMention.vue.d.ts +91 -39
- package/dist/types/components/HysModal/HysModal.vue.d.ts +111 -34
- package/dist/types/components/HysNumberInput/HysNumberInput.vue.d.ts +2 -2
- package/dist/types/components/HysPagination/HysPagination.vue.d.ts +55 -4
- package/dist/types/components/HysPopover/HysPopover.vue.d.ts +41 -29
- package/dist/types/components/HysProgress/HysProgress.vue.d.ts +18 -24
- package/dist/types/components/HysRating/HysRating.vue.d.ts +1 -1
- package/dist/types/components/HysResizablePanel/HysResizablePanel.vue.d.ts +2 -2
- package/dist/types/components/HysSearch/HysSearch.vue.d.ts +45 -7
- package/dist/types/components/HysSelect/HysSelect.vue.d.ts +19 -5
- package/dist/types/components/HysSlider/HysSlider.vue.d.ts +5 -4
- package/dist/types/components/HysSlider/SliderTooltip.vue.d.ts +3 -1
- package/dist/types/components/HysSplitPane/HysSplitPane.vue.d.ts +125 -14
- package/dist/types/components/HysSteps/HysSteps.vue.d.ts +1 -1
- package/dist/types/components/HysTable/HysTable.vue.d.ts +1742 -5
- package/dist/types/components/HysTabs/HysTabs.vue.d.ts +2 -2
- package/dist/types/components/HysTagInput/HysTagInput.vue.d.ts +47 -25
- package/dist/types/components/HysTimeline/HysTimeline.vue.d.ts +19 -32
- package/dist/types/components/HysTooltip/HysTooltip.vue.d.ts +39 -19
- package/dist/types/components/HysTour/HysTour.vue.d.ts +46 -8
- package/dist/types/components/HysTransfer/HysTransfer.vue.d.ts +2 -2
- package/dist/types/components/HysTransfer/HysTransferPanel.vue.d.ts +5 -3
- package/dist/types/components/HysTree/HysTree.vue.d.ts +2 -2
- package/dist/types/components/HysUpload/HysUpload.vue.d.ts +55 -67
- package/dist/types/components/HysVirtualTable/HysVirtualTable.vue.d.ts +71 -40
- package/dist/types/composables/autocomplete.d.ts +3 -0
- package/dist/types/composables/avatar.d.ts +3 -0
- package/dist/types/composables/buttonGroup.d.ts +9 -0
- package/dist/types/composables/cascader.d.ts +3 -0
- package/dist/types/composables/color.d.ts +97 -0
- package/dist/types/composables/dataGrid.d.ts +100 -0
- package/dist/types/composables/datePicker.d.ts +3 -0
- package/dist/types/composables/drawer.d.ts +102 -0
- package/dist/types/composables/feedback.d.ts +98 -0
- package/dist/types/composables/floatingPosition.d.ts +14 -0
- package/dist/types/composables/formContext.d.ts +2 -0
- package/dist/types/composables/mention.d.ts +284 -0
- package/dist/types/composables/mentionDocument.d.ts +15 -0
- package/dist/types/composables/mentionEditor.d.ts +7 -0
- package/dist/types/composables/menu.d.ts +183 -0
- package/dist/types/composables/modal.d.ts +185 -0
- package/dist/types/composables/overlayManager.d.ts +7 -3
- package/dist/types/composables/popupSurface.d.ts +83 -0
- package/dist/types/composables/progress.d.ts +92 -0
- package/dist/types/composables/selectOptions.d.ts +7 -0
- package/dist/types/composables/splitPaneSizes.d.ts +11 -0
- package/dist/types/composables/table.d.ts +119 -6
- package/dist/types/composables/tagInput.d.ts +96 -0
- package/dist/types/composables/timeline.d.ts +82 -0
- package/dist/types/composables/tour.d.ts +68 -0
- package/dist/types/composables/transfer.d.ts +7 -0
- package/dist/types/composables/tree.d.ts +3 -0
- package/dist/types/composables/treeSelect.d.ts +3 -0
- package/dist/types/composables/upload.d.ts +202 -0
- package/dist/types/composables/uploadRequest.d.ts +3 -0
- package/dist/types/composables/useAlert.d.ts +21 -0
- package/dist/types/composables/useCascader.d.ts +1 -1
- package/dist/types/composables/useColorPicker.d.ts +101 -0
- package/dist/types/composables/useContextMenu.d.ts +81 -0
- package/dist/types/composables/useDataGridRemote.d.ts +15 -0
- package/dist/types/composables/useDialog.d.ts +16 -3
- package/dist/types/composables/useDrawerPush.d.ts +6 -0
- package/dist/types/composables/useDrawerResize.d.ts +27 -0
- package/dist/types/composables/useFloating.d.ts +22 -3
- package/dist/types/composables/useHysModal.d.ts +44 -0
- package/dist/types/composables/useMentionCaret.d.ts +6 -0
- package/dist/types/composables/useMentionList.d.ts +23 -0
- package/dist/types/composables/useMentionModel.d.ts +14 -0
- package/dist/types/composables/useMentionOptions.d.ts +26 -0
- package/dist/types/composables/useModal.d.ts +62 -0
- package/dist/types/composables/useModalInteraction.d.ts +27 -0
- package/dist/types/composables/usePopupSurface.d.ts +3341 -0
- package/dist/types/composables/useSplitPaneDrag.d.ts +14 -0
- package/dist/types/composables/useSplitPaneStorage.d.ts +4 -0
- package/dist/types/composables/useTable.d.ts +7 -3
- package/dist/types/composables/useTableSticky.d.ts +22 -0
- package/dist/types/composables/useTagInput.d.ts +66 -0
- package/dist/types/composables/useTourLayout.d.ts +33 -0
- package/dist/types/composables/useTransferMotion.d.ts +36 -0
- package/dist/types/composables/useUpload.d.ts +94 -0
- package/dist/types/composables/useUploadModel.d.ts +14 -0
- package/dist/types/composables/useUploadRequests.d.ts +38 -0
- package/dist/types/composables/useVirtualTableLayout.d.ts +51 -0
- package/dist/types/composables/virtualTable.d.ts +126 -0
- package/dist/types/config.d.ts +1 -0
- package/dist/types/index.d.ts +53 -3
- package/dist/types/internal/MultiSplitPane.vue.d.ts +54 -0
- package/dist/types/internal/PopupReference.d.ts +18 -0
- package/dist/types/internal/PopupSurfacePanel.vue.d.ts +37 -0
- package/dist/types/motion/PopupMotion.d.ts +59 -0
- package/dist/types/motion/popup.d.ts +12 -0
- package/package.json +3 -2
- package/dist/components/HysSplitPane/HysSplitPane2.vue.js +0 -4
- package/dist/components/HysTour/HysTour2.vue.js +0 -4
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { createApp as q, defineComponent as E, getCurrentInstance as T, shallowReactive as y, h as C, Fragment as D, onDeactivated as F, onActivated as Q, onScopeDispose as j, nextTick as v, render as M } from "vue";
|
|
2
|
+
import I from "../components/HysModal/HysModal.vue.js";
|
|
3
|
+
import { provideHysConfig as N } from "../config.js";
|
|
4
|
+
let P = 0;
|
|
5
|
+
function R(l = {}) {
|
|
6
|
+
const a = T();
|
|
7
|
+
if (!a)
|
|
8
|
+
throw new Error("useHysModal must be called during component setup");
|
|
9
|
+
const i = y([]);
|
|
10
|
+
let t, d = !0, b = !1;
|
|
11
|
+
function O(e) {
|
|
12
|
+
try {
|
|
13
|
+
e == null || e();
|
|
14
|
+
} catch (o) {
|
|
15
|
+
try {
|
|
16
|
+
a.appContext.config.errorHandler ? a.appContext.config.errorHandler(
|
|
17
|
+
o,
|
|
18
|
+
a.proxy,
|
|
19
|
+
"HysModal callback"
|
|
20
|
+
) : console.error(o);
|
|
21
|
+
} catch (c) {
|
|
22
|
+
console.error(c);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function u(e, o = e.result ?? { action: "cancel", reason: "api" }) {
|
|
27
|
+
if (e.finished) return;
|
|
28
|
+
e.finished = !0;
|
|
29
|
+
const c = i.indexOf(e);
|
|
30
|
+
c >= 0 && i.splice(c, 1), v(async () => {
|
|
31
|
+
await v(), e.resolve(o), O(() => {
|
|
32
|
+
var n, f;
|
|
33
|
+
return (f = (n = e.options).onAfterClose) == null ? void 0 : f.call(n, o);
|
|
34
|
+
}), t && !i.length && (M(null, t), t.remove(), t = void 0);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
const x = E({
|
|
38
|
+
name: "HysModalQueue",
|
|
39
|
+
setup() {
|
|
40
|
+
return () => C(
|
|
41
|
+
D,
|
|
42
|
+
i.map((e) => {
|
|
43
|
+
const { content: o, onOk: c, onCancel: n, onAfterClose: f, ...r } = e.options;
|
|
44
|
+
return C(
|
|
45
|
+
I,
|
|
46
|
+
{
|
|
47
|
+
...r,
|
|
48
|
+
key: e.id,
|
|
49
|
+
open: e.open,
|
|
50
|
+
appendTo: l.appendTo ?? "body",
|
|
51
|
+
ref: (s) => {
|
|
52
|
+
e.instance = s;
|
|
53
|
+
},
|
|
54
|
+
beforeConfirm: e.beforeConfirm,
|
|
55
|
+
beforeClose: e.beforeClose,
|
|
56
|
+
"onUpdate:open": (s) => {
|
|
57
|
+
e.open = s;
|
|
58
|
+
},
|
|
59
|
+
onOk: () => {
|
|
60
|
+
e.result = { action: "confirm", reason: "confirm" };
|
|
61
|
+
},
|
|
62
|
+
onCancel: (s) => {
|
|
63
|
+
e.result = { action: "cancel", reason: s.reason };
|
|
64
|
+
},
|
|
65
|
+
onClosed: () => u(e)
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
default: (s) => typeof o == "function" ? o(s) : o
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
})
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
function A() {
|
|
76
|
+
if (t) return;
|
|
77
|
+
t = document.createElement("div"), t.className = "hys-ui-modal-service", document.body.append(t);
|
|
78
|
+
const e = C(x);
|
|
79
|
+
e.appContext = {
|
|
80
|
+
...a.appContext,
|
|
81
|
+
provides: a.provides
|
|
82
|
+
}, M(e, t);
|
|
83
|
+
}
|
|
84
|
+
function g(e) {
|
|
85
|
+
if (b || !d) throw new Error("HysModal owner is inactive");
|
|
86
|
+
if (typeof document > "u")
|
|
87
|
+
throw new Error("HysModal requires a browser document");
|
|
88
|
+
let o;
|
|
89
|
+
const c = new Promise((r) => o = r), n = y({
|
|
90
|
+
id: "hys-modal-" + ++P,
|
|
91
|
+
open: !0,
|
|
92
|
+
finished: !1,
|
|
93
|
+
options: y({
|
|
94
|
+
footer: !0,
|
|
95
|
+
closeOnMask: !1,
|
|
96
|
+
initialFocus: "confirm",
|
|
97
|
+
...l.defaults,
|
|
98
|
+
...e
|
|
99
|
+
}),
|
|
100
|
+
resolve: o,
|
|
101
|
+
async beforeConfirm(r) {
|
|
102
|
+
var s, m, w, h;
|
|
103
|
+
return await ((m = (s = n.options).beforeConfirm) == null ? void 0 : m.call(s, r)) === !1 || r.signal.aborted ? !1 : (h = (w = n.options).onOk) == null ? void 0 : h.call(w, r);
|
|
104
|
+
},
|
|
105
|
+
async beforeClose(r, s) {
|
|
106
|
+
var m, w, h, H;
|
|
107
|
+
if (await ((w = (m = n.options).beforeClose) == null ? void 0 : w.call(m, r, s)) === !1 || s.signal.aborted)
|
|
108
|
+
return !1;
|
|
109
|
+
if (r !== "confirm") return (H = (h = n.options).onCancel) == null ? void 0 : H.call(h, s);
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
i.push(n), A();
|
|
113
|
+
async function f(r) {
|
|
114
|
+
return await v(), !n.finished && n.instance ? n.instance[r]() : !1;
|
|
115
|
+
}
|
|
116
|
+
return {
|
|
117
|
+
id: n.id,
|
|
118
|
+
closed: c,
|
|
119
|
+
update(r) {
|
|
120
|
+
n.finished || Object.assign(n.options, r);
|
|
121
|
+
},
|
|
122
|
+
confirm: () => f("confirm"),
|
|
123
|
+
cancel: () => f("cancel"),
|
|
124
|
+
close: () => f("close"),
|
|
125
|
+
destroy: () => u(n, { action: "destroy", reason: "destroy" })
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
const p = (e, o) => g({
|
|
129
|
+
title: {
|
|
130
|
+
confirm: "操作确认",
|
|
131
|
+
info: "提示",
|
|
132
|
+
success: "操作成功",
|
|
133
|
+
warning: "注意",
|
|
134
|
+
error: "操作失败",
|
|
135
|
+
default: "提示"
|
|
136
|
+
}[e],
|
|
137
|
+
showCancel: e === "confirm",
|
|
138
|
+
...typeof o == "string" ? { content: o } : o,
|
|
139
|
+
type: e
|
|
140
|
+
}), k = () => {
|
|
141
|
+
for (const e of [...i])
|
|
142
|
+
u(e, { action: "destroy", reason: "destroy" });
|
|
143
|
+
};
|
|
144
|
+
return F(() => {
|
|
145
|
+
d = !1;
|
|
146
|
+
for (const e of [...i])
|
|
147
|
+
u(e, { action: "owner-dispose", reason: "owner-dispose" });
|
|
148
|
+
}), Q(() => {
|
|
149
|
+
d = !0;
|
|
150
|
+
}), j(() => {
|
|
151
|
+
b = !0, d = !1;
|
|
152
|
+
for (const e of [...i])
|
|
153
|
+
u(e, { action: "owner-dispose", reason: "owner-dispose" });
|
|
154
|
+
}), {
|
|
155
|
+
show: g,
|
|
156
|
+
confirm: (e) => p("confirm", e),
|
|
157
|
+
info: (e) => p("info", e),
|
|
158
|
+
success: (e) => p("success", e),
|
|
159
|
+
warning: (e) => p("warning", e),
|
|
160
|
+
error: (e) => p("error", e),
|
|
161
|
+
destroyAll: k
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
function B(l = {}) {
|
|
165
|
+
if (typeof document > "u")
|
|
166
|
+
throw new Error("HysModal requires a browser document");
|
|
167
|
+
let a, i = !1;
|
|
168
|
+
const t = q(
|
|
169
|
+
E({
|
|
170
|
+
setup() {
|
|
171
|
+
return N(l), a = R(l), () => null;
|
|
172
|
+
}
|
|
173
|
+
})
|
|
174
|
+
), d = document.createElement("div");
|
|
175
|
+
return t.mount(d), {
|
|
176
|
+
...a,
|
|
177
|
+
dispose() {
|
|
178
|
+
i || (i = !0, t.unmount());
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
export {
|
|
183
|
+
B as createHysModal,
|
|
184
|
+
R as useHysModal
|
|
185
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { computed as x, onBeforeUnmount as y, onDeactivated as C } from "vue";
|
|
2
|
+
function L(r, a, p) {
|
|
3
|
+
let e;
|
|
4
|
+
function d() {
|
|
5
|
+
e == null || e.remove(), e = void 0;
|
|
6
|
+
}
|
|
7
|
+
function f() {
|
|
8
|
+
const t = r.value, o = t.getBoundingClientRect();
|
|
9
|
+
if (!o.width && !o.height) return o;
|
|
10
|
+
const n = getComputedStyle(t);
|
|
11
|
+
e || (e = document.createElement("div"), e.setAttribute("aria-hidden", "true"), document.body.append(e));
|
|
12
|
+
for (const l of [
|
|
13
|
+
"direction",
|
|
14
|
+
"font",
|
|
15
|
+
"font-family",
|
|
16
|
+
"font-size",
|
|
17
|
+
"font-weight",
|
|
18
|
+
"font-style",
|
|
19
|
+
"font-variant",
|
|
20
|
+
"letter-spacing",
|
|
21
|
+
"word-spacing",
|
|
22
|
+
"text-transform",
|
|
23
|
+
"text-indent",
|
|
24
|
+
"text-align",
|
|
25
|
+
"line-height",
|
|
26
|
+
"padding-top",
|
|
27
|
+
"padding-right",
|
|
28
|
+
"padding-bottom",
|
|
29
|
+
"padding-left",
|
|
30
|
+
"border-top-width",
|
|
31
|
+
"border-right-width",
|
|
32
|
+
"border-bottom-width",
|
|
33
|
+
"border-left-width",
|
|
34
|
+
"border-style",
|
|
35
|
+
"box-sizing",
|
|
36
|
+
"tab-size"
|
|
37
|
+
])
|
|
38
|
+
e.style.setProperty(l, n.getPropertyValue(l));
|
|
39
|
+
const s = parseFloat(n.borderLeftWidth) || 0, g = parseFloat(n.borderRightWidth) || 0, u = parseFloat(n.borderTopWidth) || 0, b = t instanceof HTMLInputElement || t instanceof HTMLTextAreaElement && t.wrap === "off";
|
|
40
|
+
Object.assign(e.style, {
|
|
41
|
+
position: "fixed",
|
|
42
|
+
top: "0px",
|
|
43
|
+
left: "-10000px",
|
|
44
|
+
visibility: "hidden",
|
|
45
|
+
pointerEvents: "none",
|
|
46
|
+
height: "auto",
|
|
47
|
+
overflow: "hidden",
|
|
48
|
+
whiteSpace: b ? "pre" : "pre-wrap",
|
|
49
|
+
overflowWrap: "break-word",
|
|
50
|
+
wordBreak: n.wordBreak,
|
|
51
|
+
width: (t.clientWidth ? t.clientWidth + s + g : o.width) + "px"
|
|
52
|
+
});
|
|
53
|
+
const c = p();
|
|
54
|
+
e.textContent = a.value.slice(0, c);
|
|
55
|
+
const i = document.createElement("span");
|
|
56
|
+
i.textContent = a.value.slice(c) || "", e.append(i);
|
|
57
|
+
const w = parseFloat(n.lineHeight) || (parseFloat(n.fontSize) || 14) * 1.6, m = o.left + i.offsetLeft + s - t.scrollLeft, v = o.top + i.offsetTop + u - t.scrollTop;
|
|
58
|
+
return new window.DOMRect(m, v, 1, w);
|
|
59
|
+
}
|
|
60
|
+
const h = x(
|
|
61
|
+
() => r.value ? {
|
|
62
|
+
getBoundingClientRect: f,
|
|
63
|
+
contains: (t) => {
|
|
64
|
+
var o;
|
|
65
|
+
return !!((o = r.value) != null && o.contains(t));
|
|
66
|
+
},
|
|
67
|
+
focus: () => {
|
|
68
|
+
var t;
|
|
69
|
+
return (t = r.value) == null ? void 0 : t.focus();
|
|
70
|
+
},
|
|
71
|
+
get isConnected() {
|
|
72
|
+
var t;
|
|
73
|
+
return !!((t = r.value) != null && t.isConnected);
|
|
74
|
+
}
|
|
75
|
+
} : void 0
|
|
76
|
+
);
|
|
77
|
+
return y(d), C(d), { anchor: h, removeMirror: d };
|
|
78
|
+
}
|
|
79
|
+
export {
|
|
80
|
+
L as useMentionCaret
|
|
81
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { computed as u, ref as m, watch as R } from "vue";
|
|
2
|
+
function F(o, H, s, M) {
|
|
3
|
+
const c = u(() => {
|
|
4
|
+
const e = /* @__PURE__ */ new Map();
|
|
5
|
+
for (const l of H.value) {
|
|
6
|
+
const i = l.option.group ?? "", t = e.get(i);
|
|
7
|
+
t ? t.push(l) : e.set(i, [l]);
|
|
8
|
+
}
|
|
9
|
+
let a = 0;
|
|
10
|
+
return [...e].flatMap(([l, i]) => [
|
|
11
|
+
...l ? [{ key: "group:" + l, group: l }] : [],
|
|
12
|
+
...i.map((t) => ({ key: t.key, entry: t, index: a++ }))
|
|
13
|
+
]);
|
|
14
|
+
}), x = u(
|
|
15
|
+
() => c.value.flatMap(
|
|
16
|
+
(e) => "entry" in e && !e.entry.user.disabled ? [e.entry] : []
|
|
17
|
+
)
|
|
18
|
+
), r = m(0), v = m(240), n = u(
|
|
19
|
+
() => o.itemHeight && Number.isFinite(o.itemHeight) ? Math.max(20, o.itemHeight) : 44
|
|
20
|
+
), f = u(
|
|
21
|
+
() => o.overscan !== void 0 && Number.isFinite(o.overscan) ? Math.max(0, Math.floor(o.overscan)) : 4
|
|
22
|
+
), h = u(
|
|
23
|
+
() => o.virtual ? Math.max(
|
|
24
|
+
0,
|
|
25
|
+
Math.floor(r.value / n.value) - f.value
|
|
26
|
+
) : 0
|
|
27
|
+
), d = u(
|
|
28
|
+
() => o.virtual ? Math.ceil((r.value + v.value) / n.value) + f.value : c.value.length
|
|
29
|
+
), y = u(() => c.value.slice(h.value, d.value)), T = u(
|
|
30
|
+
() => o.virtual ? h.value * n.value : 0
|
|
31
|
+
), b = u(
|
|
32
|
+
() => o.virtual ? Math.max(0, c.value.length - d.value) * n.value : 0
|
|
33
|
+
);
|
|
34
|
+
function p() {
|
|
35
|
+
const e = s.value;
|
|
36
|
+
e && (r.value = e.scrollTop, e.scrollHeight > e.clientHeight && e.scrollHeight - e.scrollTop - e.clientHeight <= n.value && M());
|
|
37
|
+
}
|
|
38
|
+
function w() {
|
|
39
|
+
r.value = 0, s.value && (s.value.scrollTop = 0);
|
|
40
|
+
}
|
|
41
|
+
R(
|
|
42
|
+
s,
|
|
43
|
+
(e, a, l) => {
|
|
44
|
+
if (!e) return;
|
|
45
|
+
const i = () => {
|
|
46
|
+
v.value = e.clientHeight || 240;
|
|
47
|
+
};
|
|
48
|
+
i();
|
|
49
|
+
const t = typeof ResizeObserver > "u" ? void 0 : new ResizeObserver(i);
|
|
50
|
+
t == null || t.observe(e), l(() => t == null ? void 0 : t.disconnect());
|
|
51
|
+
},
|
|
52
|
+
{ flush: "post" }
|
|
53
|
+
);
|
|
54
|
+
function k(e) {
|
|
55
|
+
var g;
|
|
56
|
+
const a = s.value;
|
|
57
|
+
if (!a) return;
|
|
58
|
+
if (!o.virtual) {
|
|
59
|
+
(g = a.querySelector('[data-active="true"]')) == null || g.scrollIntoView({ block: "nearest" });
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const l = c.value.findIndex((S) => S.key === e);
|
|
63
|
+
if (l < 0) return;
|
|
64
|
+
const i = l * n.value, t = a.clientHeight || v.value;
|
|
65
|
+
i < a.scrollTop ? a.scrollTop = i : i + n.value > a.scrollTop + t && (a.scrollTop = i + n.value - t), r.value = a.scrollTop;
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
rows: c,
|
|
69
|
+
enabled: x,
|
|
70
|
+
visibleRows: y,
|
|
71
|
+
topSpacer: T,
|
|
72
|
+
bottomSpacer: b,
|
|
73
|
+
rowHeight: n,
|
|
74
|
+
onScroll: p,
|
|
75
|
+
reset: w,
|
|
76
|
+
ensureVisible: k
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
export {
|
|
80
|
+
F as useMentionList
|
|
81
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { ref as j, computed as R, shallowRef as A, watch as B, nextTick as C } from "vue";
|
|
2
|
+
import { normalizeMentionEntities as M, rebaseMentionEntities as K } from "./mentionDocument.js";
|
|
3
|
+
function b(e) {
|
|
4
|
+
return JSON.stringify([
|
|
5
|
+
typeof e.id,
|
|
6
|
+
e.id,
|
|
7
|
+
e.type,
|
|
8
|
+
e.prefix,
|
|
9
|
+
e.text
|
|
10
|
+
]);
|
|
11
|
+
}
|
|
12
|
+
function D(e, n) {
|
|
13
|
+
function i(a, u) {
|
|
14
|
+
const d = /* @__PURE__ */ new Map();
|
|
15
|
+
for (const l of u) {
|
|
16
|
+
const r = b(l);
|
|
17
|
+
d.set(r, (d.get(r) ?? 0) + 1);
|
|
18
|
+
}
|
|
19
|
+
return a.filter((l) => {
|
|
20
|
+
const r = b(l), v = d.get(r) ?? 0;
|
|
21
|
+
return v ? (d.set(r, v - 1), !1) : !0;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
added: i(n, e),
|
|
26
|
+
removed: i(e, n)
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function T(e, n) {
|
|
30
|
+
return e.length === n.length && e.every(
|
|
31
|
+
(i, a) => i.start === n[a].start && i.end === n[a].end && b(i) === b(n[a]) && i.label === n[a].label && i.value === n[a].value && i.payload === n[a].payload
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
function H(e, n, i) {
|
|
35
|
+
var z;
|
|
36
|
+
const a = j(e.defaultValue ?? ""), u = R(() => e.modelValue ?? a.value), d = e.defaultEntities ?? ((z = e.parseEntities) == null ? void 0 : z.call(e, u.value)) ?? [], l = A({
|
|
37
|
+
text: u.value,
|
|
38
|
+
entities: M(u.value, d)
|
|
39
|
+
}), r = R(() => {
|
|
40
|
+
const t = u.value, o = e.entities ?? (l.value.text === t ? l.value.entities : K(l.value, t)), f = M(t, o);
|
|
41
|
+
return e.invalidEntity === "text" && e.validateEntity ? f.filter(e.validateEntity) : f;
|
|
42
|
+
}), v = R(() => ({
|
|
43
|
+
text: u.value,
|
|
44
|
+
entities: r.value
|
|
45
|
+
}));
|
|
46
|
+
let s, V = 0;
|
|
47
|
+
const m = [], w = [];
|
|
48
|
+
B(
|
|
49
|
+
u,
|
|
50
|
+
(t) => {
|
|
51
|
+
var o;
|
|
52
|
+
e.entities !== void 0 || (s == null ? void 0 : s.text) === t || (l.value = {
|
|
53
|
+
text: t,
|
|
54
|
+
entities: M(t, [
|
|
55
|
+
...K(l.value, t),
|
|
56
|
+
...((o = e.parseEntities) == null ? void 0 : o.call(e, t)) ?? []
|
|
57
|
+
])
|
|
58
|
+
});
|
|
59
|
+
},
|
|
60
|
+
{ flush: "sync" }
|
|
61
|
+
);
|
|
62
|
+
async function q(t, o, f, y = !0, E = !1) {
|
|
63
|
+
const c = v.value, h = M(t.text, t.entities), x = t.text !== c.text;
|
|
64
|
+
if (!x && T(c.entities, h) || !E && e.beforeRemove && D(c.entities, h).removed.some(
|
|
65
|
+
(S) => {
|
|
66
|
+
var J;
|
|
67
|
+
return ((J = e.beforeRemove) == null ? void 0 : J.call(e, S)) === !1;
|
|
68
|
+
}
|
|
69
|
+
) || (s == null ? void 0 : s.text) === t.text && T(s.entities, h))
|
|
70
|
+
return !1;
|
|
71
|
+
const k = { text: t.text, entities: h }, O = ++V;
|
|
72
|
+
if (s = k, x && e.modelValue === void 0 && (a.value = t.text), f == null || f(), n(k, c, x), await C(), O !== V || (s = void 0, u.value !== t.text)) return !1;
|
|
73
|
+
e.entities === void 0 && (l.value = k);
|
|
74
|
+
const g = v.value;
|
|
75
|
+
return !x && T(g.entities, c.entities) ? !1 : (y && (m.push({ ...c, selection: o }), m.length > 100 && m.shift(), w.length = 0), i(g, c), !0);
|
|
76
|
+
}
|
|
77
|
+
async function N(t, o) {
|
|
78
|
+
const f = t === "undo" ? m : w, y = t === "undo" ? w : m, E = f.at(-1);
|
|
79
|
+
if (!E) return;
|
|
80
|
+
const c = v.value;
|
|
81
|
+
if (await q(E, o, void 0, !1))
|
|
82
|
+
return f.pop(), y.push({ ...c, selection: o }), E.selection;
|
|
83
|
+
}
|
|
84
|
+
return { value: u, entities: r, document: v, commit: q, history: N };
|
|
85
|
+
}
|
|
86
|
+
export {
|
|
87
|
+
D as diffMentionEntities,
|
|
88
|
+
b as mentionEntityKey,
|
|
89
|
+
H as useMentionModel
|
|
90
|
+
};
|