hys-ui 0.1.1 → 0.2.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 +111 -0
- package/README.md +3 -1
- package/dist/components/HysAccordion/HysAccordion.vue.js +1 -1
- package/dist/components/HysAccordion/HysAccordion2.vue.js +181 -47
- package/dist/components/HysAutocomplete/HysAutocomplete.vue.js +7 -0
- package/dist/components/HysAutocomplete/HysAutocomplete2.vue.js +627 -0
- package/dist/components/HysAvatar/HysAvatar.vue.js +5 -35
- package/dist/components/HysAvatar/HysAvatar2.vue.js +221 -2
- package/dist/components/HysAvatarGroup/HysAvatarGroup.vue.js +7 -0
- package/dist/components/HysAvatarGroup/HysAvatarGroup2.vue.js +252 -0
- package/dist/components/HysBadge/HysBadge.vue.js +2 -2
- package/dist/components/HysBadge/HysBadge2.vue.js +154 -27
- package/dist/components/HysBreadcrumb/HysBreadcrumb.vue.js +5 -38
- package/dist/components/HysBreadcrumb/HysBreadcrumb2.vue.js +74 -2
- package/dist/components/HysButton/HysButton.vue.js +2 -2
- package/dist/components/HysButton/HysButton2.vue.js +29 -28
- package/dist/components/HysCalendar/HysCalendar.vue.js +5 -92
- package/dist/components/HysCalendar/HysCalendar2.vue.js +803 -2
- package/dist/components/HysCard/HysCard.vue.js +2 -2
- package/dist/components/HysCard/HysCard2.vue.js +175 -42
- package/dist/components/HysCascader/HysCascader.vue.js +5 -194
- package/dist/components/HysCascader/HysCascader2.vue.js +760 -2
- package/dist/components/HysCascader/HysCascaderColumn.vue.js +7 -0
- package/dist/components/HysCascader/HysCascaderColumn2.vue.js +232 -0
- package/dist/components/HysCheckbox/HysCheckbox.vue.js +3 -3
- package/dist/components/HysCheckbox/HysCheckbox2.vue.js +180 -65
- package/dist/components/HysCheckboxGroup/HysCheckboxGroup.vue.js +7 -0
- package/dist/components/HysCheckboxGroup/HysCheckboxGroup2.vue.js +237 -0
- package/dist/components/HysColorPicker/HysColorPicker.vue.js +2 -2
- package/dist/components/HysColorPicker/HysColorPicker2.vue.js +107 -106
- package/dist/components/HysDataGrid/HysDataGrid.vue.js +1 -1
- package/dist/components/HysDataGrid/HysDataGrid2.vue.js +399 -392
- package/dist/components/HysDatePicker/HysDatePicker.vue.js +268 -139
- package/dist/components/HysDatePicker/HysDatePickerControl.vue.js +7 -0
- package/dist/components/HysDatePicker/HysDatePickerControl2.vue.js +807 -0
- package/dist/components/HysDatePicker/HysDatePickerPanel.vue.js +7 -0
- package/dist/components/HysDatePicker/HysDatePickerPanel2.vue.js +357 -0
- package/dist/components/HysDateRangePicker/HysDateRangePicker.vue.js +268 -158
- package/dist/components/HysDivider/HysDivider.vue.js +2 -2
- package/dist/components/HysDivider/HysDivider2.vue.js +33 -13
- package/dist/components/HysFileManager/HysFileManager.vue.js +3 -3
- package/dist/components/HysFileManager/HysFileManager2.vue.js +43 -42
- package/dist/components/HysForm/HysForm.vue.js +3 -3
- package/dist/components/HysForm/HysForm2.vue.js +578 -92
- package/dist/components/HysFormItem/HysFormItem.vue.js +5 -85
- package/dist/components/HysFormItem/HysFormItem2.vue.js +521 -2
- package/dist/components/HysGantt/HysGantt.vue.js +1 -1
- package/dist/components/HysGantt/HysGantt2.vue.js +1369 -272
- package/dist/components/HysInput/HysInput.vue.js +2 -2
- package/dist/components/HysInput/HysInput2.vue.js +467 -120
- package/dist/components/HysMention/HysMention.vue.js +2 -2
- package/dist/components/HysMention/HysMention2.vue.js +89 -88
- package/dist/components/HysNumberInput/HysNumberInput.vue.js +2 -2
- package/dist/components/HysNumberInput/HysNumberInput2.vue.js +561 -79
- package/dist/components/HysOrgTree/HysOrgTree.vue.js +29 -26
- package/dist/components/HysPagination/HysPagination.vue.js +1 -1
- package/dist/components/HysPagination/HysPagination2.vue.js +2 -0
- package/dist/components/HysPermissionMatrix/HysPermissionMatrix.vue.js +2 -2
- package/dist/components/HysPermissionMatrix/HysPermissionMatrix2.vue.js +52 -51
- package/dist/components/HysRadio/HysRadio.vue.js +7 -0
- package/dist/components/HysRadio/HysRadio2.vue.js +180 -0
- package/dist/components/HysRadioGroup/HysRadioGroup.vue.js +2 -2
- package/dist/components/HysRadioGroup/HysRadioGroup2.vue.js +190 -65
- package/dist/components/HysRating/HysRating.vue.js +1 -1
- package/dist/components/HysRating/HysRating2.vue.js +288 -68
- package/dist/components/HysRichTextEditor/HysRichTextEditor.vue.js +1 -1
- package/dist/components/HysRichTextEditor/HysRichTextEditor2.vue.js +70 -69
- package/dist/components/HysSearch/HysSearch.vue.js +37 -36
- package/dist/components/HysSegmented/HysSegmented.vue.js +5 -63
- package/dist/components/HysSegmented/HysSegmented2.vue.js +273 -2
- package/dist/components/HysSelect/HysSelect.vue.js +3 -2
- package/dist/components/HysSelect/HysSelect2.vue.js +859 -185
- package/dist/components/HysSkeleton/HysSkeleton.vue.js +2 -2
- package/dist/components/HysSkeleton/HysSkeleton2.vue.js +126 -29
- package/dist/components/HysSlider/HysSlider.vue.js +2 -2
- package/dist/components/HysSlider/HysSlider2.vue.js +532 -59
- package/dist/components/HysSlider/SliderTooltip.vue.js +7 -0
- package/dist/components/HysSlider/SliderTooltip2.vue.js +156 -0
- package/dist/components/HysSteps/HysSteps.vue.js +1 -1
- package/dist/components/HysSteps/HysSteps2.vue.js +110 -36
- package/dist/components/HysSwitch/HysSwitch.vue.js +2 -2
- package/dist/components/HysSwitch/HysSwitch2.vue.js +232 -50
- package/dist/components/HysTable/HysTable.vue.js +2 -2
- package/dist/components/HysTable/HysTable2.vue.js +1473 -88
- package/dist/components/HysTable/HysTableFilterOptions.vue.js +7 -0
- package/dist/components/HysTable/HysTableFilterOptions2.vue.js +133 -0
- package/dist/components/HysTabs/HysTabs.vue.js +2 -2
- package/dist/components/HysTabs/HysTabs2.vue.js +262 -68
- package/dist/components/HysTagInput/HysTagInput.vue.js +43 -42
- package/dist/components/HysTextarea/HysTextarea.vue.js +138 -77
- package/dist/components/HysTransfer/HysTransfer.vue.js +5 -223
- package/dist/components/HysTransfer/HysTransfer2.vue.js +416 -2
- package/dist/components/HysTransfer/HysTransferPanel.vue.js +7 -0
- package/dist/components/HysTransfer/HysTransferPanel2.vue.js +454 -0
- package/dist/components/HysTree/HysTree.vue.js +2 -3
- package/dist/components/HysTree/HysTree2.vue.js +641 -302
- package/dist/components/HysTreeSelect/HysTreeSelect.vue.js +5 -136
- package/dist/components/HysTreeSelect/HysTreeSelect2.vue.js +558 -2
- package/dist/components/HysTreeSelect/HysTreeSelectPanel.vue.js +7 -0
- package/dist/components/HysTreeSelect/HysTreeSelectPanel2.vue.js +323 -0
- package/dist/components/HysUpload/HysUpload.vue.js +2 -2
- package/dist/components/HysUpload/HysUpload2.vue.js +77 -76
- package/dist/composables/autocomplete.js +50 -0
- package/dist/composables/avatar.js +57 -0
- package/dist/composables/calendar.js +96 -0
- package/dist/composables/cascader.js +79 -0
- package/dist/composables/choice.js +38 -0
- package/dist/composables/choiceModel.js +67 -0
- package/dist/composables/datePicker.js +227 -0
- package/dist/composables/formContext.js +92 -7
- package/dist/composables/formLayout.js +57 -0
- package/dist/composables/formValidation.js +240 -0
- package/dist/composables/ganttConflicts.js +143 -0
- package/dist/composables/numberInput.js +91 -0
- package/dist/composables/rating.js +16 -0
- package/dist/composables/selectOptions.js +54 -0
- package/dist/composables/table.js +150 -0
- package/dist/composables/textInput.js +34 -0
- package/dist/composables/transfer.js +63 -0
- package/dist/composables/tree.js +118 -0
- package/dist/composables/treeSelect.js +71 -0
- package/dist/composables/useCascader.js +438 -0
- package/dist/composables/useDatePicker.js +425 -0
- package/dist/composables/useFloating.js +97 -51
- package/dist/composables/useGanttDependencies.js +306 -0
- package/dist/composables/useGanttHistory.js +157 -0
- package/dist/composables/useGanttLabelResize.js +100 -0
- package/dist/composables/useTable.js +474 -0
- package/dist/composables/useTextareaSize.js +72 -0
- package/dist/composables/useTransfer.js +257 -0
- package/dist/composables/useTree.js +439 -0
- package/dist/composables/useTreeSelect.js +361 -0
- package/dist/index.js +149 -139
- package/dist/style.css +1 -1
- package/dist/types/components/HysAccordion/HysAccordion.vue.d.ts +61 -22
- package/dist/types/components/HysAutocomplete/HysAutocomplete.vue.d.ts +201 -0
- package/dist/types/components/HysAvatar/HysAvatar.vue.d.ts +28 -15
- package/dist/types/components/HysAvatarGroup/HysAvatarGroup.vue.d.ts +99 -0
- package/dist/types/components/HysBadge/HysBadge.vue.d.ts +41 -4
- package/dist/types/components/HysBreadcrumb/HysBreadcrumb.vue.d.ts +38 -10
- package/dist/types/components/HysButton/HysButton.vue.d.ts +0 -1
- package/dist/types/components/HysCalendar/HysCalendar.vue.d.ts +119 -31
- package/dist/types/components/HysCard/HysCard.vue.d.ts +55 -7
- package/dist/types/components/HysCascader/HysCascader.vue.d.ts +129 -41
- package/dist/types/components/HysCascader/HysCascaderColumn.vue.d.ts +55 -0
- package/dist/types/components/HysCheckbox/HysCheckbox.vue.d.ts +50 -39
- package/dist/types/components/HysCheckboxGroup/HysCheckboxGroup.vue.d.ts +73 -0
- package/dist/types/components/HysDataGrid/HysDataGrid.vue.d.ts +1 -1
- package/dist/types/components/HysDatePicker/HysDatePicker.vue.d.ts +66 -14
- package/dist/types/components/HysDatePicker/HysDatePickerControl.vue.d.ts +90 -0
- package/dist/types/components/HysDatePicker/HysDatePickerPanel.vue.d.ts +93 -0
- package/dist/types/components/HysDateRangePicker/HysDateRangePicker.vue.d.ts +66 -14
- package/dist/types/components/HysDivider/HysDivider.vue.d.ts +8 -3
- package/dist/types/components/HysFileManager/HysFileManager.vue.d.ts +2 -2
- package/dist/types/components/HysForm/HysForm.vue.d.ts +110 -18
- package/dist/types/components/HysFormItem/HysFormItem.vue.d.ts +108 -2
- package/dist/types/components/HysGantt/HysGantt.vue.d.ts +82 -4
- package/dist/types/components/HysInput/HysInput.vue.d.ts +52 -29
- package/dist/types/components/HysMention/HysMention.vue.d.ts +2 -2
- package/dist/types/components/HysNumberInput/HysNumberInput.vue.d.ts +93 -35
- package/dist/types/components/HysOrgTree/HysOrgTree.vue.d.ts +1 -0
- package/dist/types/components/HysPagination/HysPagination.vue.d.ts +1 -1
- package/dist/types/components/HysPermissionMatrix/HysPermissionMatrix.vue.d.ts +2 -2
- package/dist/types/components/HysPopover/HysPopover.vue.d.ts +3 -3
- package/dist/types/components/HysProgress/HysProgress.vue.d.ts +1 -1
- package/dist/types/components/HysRadio/HysRadio.vue.d.ts +56 -0
- package/dist/types/components/HysRadioGroup/HysRadioGroup.vue.d.ts +34 -12
- package/dist/types/components/HysRating/HysRating.vue.d.ts +85 -5
- package/dist/types/components/HysRichTextEditor/HysRichTextEditor.vue.d.ts +4 -4
- package/dist/types/components/HysSearch/HysSearch.vue.d.ts +2 -2
- package/dist/types/components/HysSegmented/HysSegmented.vue.d.ts +64 -32
- package/dist/types/components/HysSelect/HysSelect.vue.d.ts +120 -20
- package/dist/types/components/HysSkeleton/HysSkeleton.vue.d.ts +30 -2
- package/dist/types/components/HysSlider/HysSlider.vue.d.ts +66 -9
- package/dist/types/components/HysSlider/SliderTooltip.vue.d.ts +22 -0
- package/dist/types/components/HysSplitPane/HysSplitPane.vue.d.ts +1 -1
- package/dist/types/components/HysSteps/HysSteps.vue.d.ts +64 -9
- package/dist/types/components/HysSwitch/HysSwitch.vue.d.ts +76 -17
- package/dist/types/components/HysTable/HysTable.vue.d.ts +206 -32
- package/dist/types/components/HysTable/HysTableFilterOptions.vue.d.ts +18 -0
- package/dist/types/components/HysTabs/HysTabs.vue.d.ts +76 -23
- package/dist/types/components/HysTagInput/HysTagInput.vue.d.ts +5 -5
- package/dist/types/components/HysTextarea/HysTextarea.vue.d.ts +44 -27
- package/dist/types/components/HysToast/HysToast.vue.d.ts +3 -3
- package/dist/types/components/HysTour/HysTour.vue.d.ts +2 -2
- package/dist/types/components/HysTransfer/HysTransfer.vue.d.ts +55 -40
- package/dist/types/components/HysTransfer/HysTransferPanel.vue.d.ts +105 -0
- package/dist/types/components/HysTree/HysTree.vue.d.ts +140 -73
- package/dist/types/components/HysTreeSelect/HysTreeSelect.vue.d.ts +102 -23
- package/dist/types/components/HysTreeSelect/HysTreeSelectPanel.vue.d.ts +56 -0
- package/dist/types/composables/autocomplete.d.ts +106 -0
- package/dist/types/composables/avatar.d.ts +70 -0
- package/dist/types/composables/calendar.d.ts +66 -0
- package/dist/types/composables/cascader.d.ts +192 -0
- package/dist/types/composables/choice.d.ts +110 -0
- package/dist/types/composables/choiceModel.d.ts +11 -0
- package/dist/types/composables/datePicker.d.ts +247 -0
- package/dist/types/composables/formContext.d.ts +133 -8
- package/dist/types/composables/formLayout.d.ts +11 -0
- package/dist/types/composables/formValidation.d.ts +13 -0
- package/dist/types/composables/gantt.d.ts +68 -0
- package/dist/types/composables/ganttConflicts.d.ts +30 -0
- package/dist/types/composables/numberInput.d.ts +45 -0
- package/dist/types/composables/rating.d.ts +18 -0
- package/dist/types/composables/segmented.d.ts +15 -0
- package/dist/types/composables/selectOptions.d.ts +44 -0
- package/dist/types/composables/slider.d.ts +21 -0
- package/dist/types/composables/table.d.ts +309 -0
- package/dist/types/composables/textInput.d.ts +76 -0
- package/dist/types/composables/transfer.d.ts +180 -0
- package/dist/types/composables/tree.d.ts +237 -0
- package/dist/types/composables/treeSelect.d.ts +167 -0
- package/dist/types/composables/useCascader.d.ts +162 -0
- package/dist/types/composables/useDatePicker.d.ts +79 -0
- package/dist/types/composables/useFloating.d.ts +8 -5
- package/dist/types/composables/useGanttDependencies.d.ts +83 -0
- package/dist/types/composables/useGanttHistory.d.ts +42 -0
- package/dist/types/composables/useGanttLabelResize.d.ts +23 -0
- package/dist/types/composables/useTable.d.ts +60 -0
- package/dist/types/composables/useTextareaSize.d.ts +3 -0
- package/dist/types/composables/useTransfer.d.ts +58 -0
- package/dist/types/composables/useTree.d.ts +77 -0
- package/dist/types/composables/useTreeSelect.d.ts +117 -0
- package/dist/types/index.d.ts +33 -7
- package/package.json +2 -1
|
@@ -0,0 +1,425 @@
|
|
|
1
|
+
import { ref as P, computed as c, shallowRef as Be, watch as Me } from "vue";
|
|
2
|
+
import { useChoiceModel as Ge } from "./choiceModel.js";
|
|
3
|
+
import { civilDay as Ie, calendarParts as Ve, calendarISO as qe } from "./calendar.js";
|
|
4
|
+
import { dateUnit as ge, dateMultiple as Oe, datePattern as be, datePickerEnglish as _e, datePickerWords as ze, dateEqual as E, dateClone as U, datePoint as N, DATE_MIN as ee, DATE_MAX as ae, dateShift as j, dateNative as A, datePeriod as B, dateWeek as re, dateFormat as Pe, dateTimeSeconds as He } from "./datePicker.js";
|
|
5
|
+
function Ke(u, f, G, o, Te) {
|
|
6
|
+
const ve = P("string"), T = c(
|
|
7
|
+
() => u.type === "datetime" || !!u.showTime && ge(u.type) === "date"
|
|
8
|
+
), s = c(() => ge(u.type)), w = c(() => !f.value && Oe(u.type)), m = c(
|
|
9
|
+
() => Number.isFinite(u.firstDayOfWeek) ? (Math.trunc(u.firstDayOfWeek) % 7 + 7) % 7 : 1
|
|
10
|
+
), g = c(
|
|
11
|
+
() => Number.isFinite(u.firstWeekContainsDate) ? Math.max(1, Math.min(7, Math.trunc(u.firstWeekContainsDate))) : 4
|
|
12
|
+
), I = c(
|
|
13
|
+
() => u.valueFormat ?? be(u.type, T.value)
|
|
14
|
+
), ue = c(
|
|
15
|
+
() => u.format ?? (s.value === "week" ? "GGGG-[W]WW" : be(u.type, T.value))
|
|
16
|
+
), le = c(() => {
|
|
17
|
+
var e;
|
|
18
|
+
return {
|
|
19
|
+
...ze,
|
|
20
|
+
...(e = u.locale) != null && e.startsWith("en") ? _e : {},
|
|
21
|
+
...u.messages
|
|
22
|
+
};
|
|
23
|
+
}), J = Ge(
|
|
24
|
+
u,
|
|
25
|
+
() => U(
|
|
26
|
+
u.defaultValue ?? (f.value ? ["", ""] : w.value ? [] : "")
|
|
27
|
+
),
|
|
28
|
+
E
|
|
29
|
+
), y = J.current, x = c(
|
|
30
|
+
() => u.valueType ?? (y.value instanceof Date || Array.isArray(y.value) && y.value.some((e) => e instanceof Date) ? "date" : typeof y.value == "number" || Array.isArray(y.value) && y.value.some((e) => typeof e == "number") ? "timestamp" : ve.value)
|
|
31
|
+
), v = Be([]), W = P("start"), K = P(), S = P(""), q = P(
|
|
32
|
+
u.defaultMode ?? (s.value === "week" ? "date" : s.value)
|
|
33
|
+
), L = P(q.value), O = P(0), Q = P(0), fe = c(() => N(/* @__PURE__ */ new Date())), de = c(() => {
|
|
34
|
+
var e;
|
|
35
|
+
return [
|
|
36
|
+
u.panelValue === void 0 ? O.value : ((e = _(u.panelValue)) == null ? void 0 : e.day) ?? O.value,
|
|
37
|
+
Q.value
|
|
38
|
+
];
|
|
39
|
+
}), te = c(() => u.mode ?? q.value), se = c(
|
|
40
|
+
() => {
|
|
41
|
+
var e;
|
|
42
|
+
return u.showConfirm ?? (T.value || w.value || f.value && !!((e = u.allowEmpty) != null && e.some(Boolean)));
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
function R(e) {
|
|
46
|
+
return N(e, I.value, m.value, g.value);
|
|
47
|
+
}
|
|
48
|
+
function _(e) {
|
|
49
|
+
return R(e) ?? N(e, "YYYY-MM-DD") ?? N(e, "YYYY-MM-DD HH:mm:ss");
|
|
50
|
+
}
|
|
51
|
+
function F(e) {
|
|
52
|
+
return {
|
|
53
|
+
day: B(e.day, s.value, m.value)[0],
|
|
54
|
+
second: T.value ? e.second : 0
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function M(e = y.value) {
|
|
58
|
+
if (e == null || e === "" || u.clearValue !== void 0 && E(e, u.clearValue))
|
|
59
|
+
return f.value ? [null, null] : [];
|
|
60
|
+
if (f.value)
|
|
61
|
+
return Array.from({ length: 2 }, (l, n) => {
|
|
62
|
+
const t = Array.isArray(e) ? R(e[n]) : void 0;
|
|
63
|
+
return t ? F(t) : null;
|
|
64
|
+
});
|
|
65
|
+
if (w.value) {
|
|
66
|
+
const l = /* @__PURE__ */ new Set();
|
|
67
|
+
return (Array.isArray(e) ? e : []).flatMap((n) => {
|
|
68
|
+
const t = R(n);
|
|
69
|
+
if (!t) return [];
|
|
70
|
+
const r = F(t);
|
|
71
|
+
return s.value === "week" && l.has(r.day) ? [] : (l.add(r.day), [r]);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
const a = R(e);
|
|
75
|
+
return a ? [F(a)] : [];
|
|
76
|
+
}
|
|
77
|
+
const z = c(() => M()), H = c(() => _(u.min)), X = c(() => _(u.max));
|
|
78
|
+
function ce(e, a) {
|
|
79
|
+
return {
|
|
80
|
+
range: a ? "end" : "start",
|
|
81
|
+
from: v.value[0] ? new Date(v.value[0].day * 864e5) : null,
|
|
82
|
+
iso: qe(e)
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function h(e) {
|
|
86
|
+
return Array.isArray(u.disabled) && !!u.disabled[e];
|
|
87
|
+
}
|
|
88
|
+
function Y(e, a = 0, l = !0) {
|
|
89
|
+
var n;
|
|
90
|
+
if (!Number.isFinite(e) || e < ee || e > ae || H.value && e < H.value.day || X.value && e > X.value.day || (n = u.disabledDate) != null && n.call(u, new Date(e * 864e5), ce(e, a)))
|
|
91
|
+
return !1;
|
|
92
|
+
if (f.value && l && a === 1 && v.value[0]) {
|
|
93
|
+
const t = s.value === "week" ? Math.abs(
|
|
94
|
+
B(e, "week", m.value)[0] - B(v.value[0].day, "week", m.value)[0]
|
|
95
|
+
) + 7 : Math.abs(e - v.value[0].day) + 1;
|
|
96
|
+
if (u.minRangeDays && t < u.minRangeDays || u.maxRangeDays && t > u.maxRangeDays)
|
|
97
|
+
return !1;
|
|
98
|
+
}
|
|
99
|
+
return !0;
|
|
100
|
+
}
|
|
101
|
+
function ne(e, a, l = W.value === "end" ? 1 : 0, n = !0) {
|
|
102
|
+
var i, d, b;
|
|
103
|
+
if (s.value === "week" && a - e <= 6) {
|
|
104
|
+
if ((i = u.disabledWeek) != null && i.call(u, re(e, m.value, g.value)))
|
|
105
|
+
return !1;
|
|
106
|
+
if (u.weekValidation === "full") {
|
|
107
|
+
if (a - e !== 6) return !1;
|
|
108
|
+
for (let V = e; V <= a; V++)
|
|
109
|
+
if (!Y(V, l, n)) return !1;
|
|
110
|
+
return !0;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
const t = Math.max(e, ((d = H.value) == null ? void 0 : d.day) ?? ee), r = Math.min(a, ((b = X.value) == null ? void 0 : b.day) ?? ae);
|
|
114
|
+
for (let V = t; V <= r; V++)
|
|
115
|
+
if (Y(V, l, n)) return !0;
|
|
116
|
+
return !1;
|
|
117
|
+
}
|
|
118
|
+
function oe(e, a) {
|
|
119
|
+
var l;
|
|
120
|
+
return ((l = u.disabledTime) == null ? void 0 : l.call(u, A(e), ce(e.day, a))) ?? {};
|
|
121
|
+
}
|
|
122
|
+
function me(e, a) {
|
|
123
|
+
var De, ke, Ae;
|
|
124
|
+
const l = oe(e, a), n = Math.floor(e.second / 3600), t = Math.floor(e.second / 60) % 60, r = e.second % 60;
|
|
125
|
+
if ((De = l.hours) != null && De.includes(n) || (ke = l.minutes) != null && ke.call(l, n).includes(t) || (Ae = l.seconds) != null && Ae.call(l, n, t).includes(r))
|
|
126
|
+
return !1;
|
|
127
|
+
const i = e.day * 86400 + e.second, d = H.value, b = X.value, V = typeof u.max == "string" && !/[T :]/.test(u.max) ? 86399 : (b == null ? void 0 : b.second) ?? 0;
|
|
128
|
+
return !(d && i < d.day * 86400 + d.second || b && i > b.day * 86400 + V);
|
|
129
|
+
}
|
|
130
|
+
function Z(e, a = !0) {
|
|
131
|
+
var l;
|
|
132
|
+
if (f.value) {
|
|
133
|
+
if (e.length !== 2 || e.some((r, i) => {
|
|
134
|
+
var d;
|
|
135
|
+
return !r && !((d = u.allowEmpty) != null && d[i]);
|
|
136
|
+
})) return !1;
|
|
137
|
+
const [n, t] = e;
|
|
138
|
+
if (n && t && n.day * 86400 + n.second > t.day * 86400 + t.second)
|
|
139
|
+
return !1;
|
|
140
|
+
if (n && t) {
|
|
141
|
+
const r = s.value === "week" ? B(t.day, "week", m.value)[1] : t.day, i = r - n.day + 1;
|
|
142
|
+
if (u.minRangeDays && i < u.minRangeDays || u.maxRangeDays && i > u.maxRangeDays)
|
|
143
|
+
return !1;
|
|
144
|
+
if (u.rangeValidation === "continuous") {
|
|
145
|
+
if (t.day > j(n.day, 1200)) return !1;
|
|
146
|
+
for (let d = n.day; d <= r; d++)
|
|
147
|
+
if (!Y(d, d === n.day ? 0 : 1, !1) || s.value === "week" && (d - n.day) % 7 === 0 && ((l = u.disabledWeek) != null && l.call(
|
|
148
|
+
u,
|
|
149
|
+
re(d, m.value, g.value)
|
|
150
|
+
)))
|
|
151
|
+
return !1;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
if (a && e.some((r, i) => h(i) && !we(r, z.value[i])))
|
|
155
|
+
return !1;
|
|
156
|
+
} else if (!e.length || !w.value && e.length !== 1 || u.maxDates && e.length > u.maxDates)
|
|
157
|
+
return !1;
|
|
158
|
+
return e.every(
|
|
159
|
+
(n, t) => !n || (s.value === "date" ? Y(n.day, f.value ? t : 0, !1) : ne(
|
|
160
|
+
...B(n.day, s.value, m.value),
|
|
161
|
+
f.value ? t : 0,
|
|
162
|
+
!1
|
|
163
|
+
)) && (!T.value || me(n, f.value ? t : 0))
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
function $(e) {
|
|
167
|
+
const a = A(e);
|
|
168
|
+
return x.value === "date" ? a : x.value === "timestamp" ? a.getTime() : I.value === "x" ? String(a.getTime()) : I.value === "X" ? String(Math.floor(a.getTime() / 1e3)) : Pe(e, I.value, m.value, g.value);
|
|
169
|
+
}
|
|
170
|
+
function D(e) {
|
|
171
|
+
return f.value || w.value ? e.map(
|
|
172
|
+
(a) => a ? $(a) : x.value === "string" ? "" : null
|
|
173
|
+
) : e[0] ? $(e[0]) : p();
|
|
174
|
+
}
|
|
175
|
+
function p() {
|
|
176
|
+
return u.clearValue !== void 0 ? U(u.clearValue) : f.value ? x.value === "string" ? ["", ""] : [null, null] : w.value ? [] : x.value === "string" ? "" : null;
|
|
177
|
+
}
|
|
178
|
+
function ye(e = z.value) {
|
|
179
|
+
return e.map(
|
|
180
|
+
(a) => a ? Pe(
|
|
181
|
+
a,
|
|
182
|
+
ue.value,
|
|
183
|
+
m.value,
|
|
184
|
+
g.value
|
|
185
|
+
) : ""
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
function k(e) {
|
|
189
|
+
return S.value = e === "limit" ? le.value.limit.replace("{count}", String(u.maxDates)) : le.value.invalid, o("invalid", {
|
|
190
|
+
reason: e,
|
|
191
|
+
dates: v.value.map((a) => a ? A(a) : null)
|
|
192
|
+
}), !1;
|
|
193
|
+
}
|
|
194
|
+
async function C(e, a, l = !1) {
|
|
195
|
+
if (G.value || !J.isLive()) return !1;
|
|
196
|
+
if (!l) {
|
|
197
|
+
if ((f.value || w.value) && (!Array.isArray(e) || f.value && e.length !== 2))
|
|
198
|
+
return k("shape");
|
|
199
|
+
if ((Array.isArray(e) ? e : [e]).some((d) => d !== null && d !== "" && !R(d)))
|
|
200
|
+
return k("format");
|
|
201
|
+
}
|
|
202
|
+
const n = M(e);
|
|
203
|
+
if (!l && !Z(n)) return k("date");
|
|
204
|
+
if (!l && x.value !== "string" && n.some((i) => i && !we(N(A(i)), i)))
|
|
205
|
+
return k("time");
|
|
206
|
+
S.value = "";
|
|
207
|
+
const t = {
|
|
208
|
+
source: a,
|
|
209
|
+
dates: n.map((i) => i ? A(i) : null),
|
|
210
|
+
formatted: ye(n),
|
|
211
|
+
...s.value === "week" ? {
|
|
212
|
+
weeks: n.map(
|
|
213
|
+
(i) => i ? re(i.day, m.value, g.value) : null
|
|
214
|
+
)
|
|
215
|
+
} : {}
|
|
216
|
+
}, r = await J.commit(
|
|
217
|
+
U(s.value === "week" && !l ? D(n) : e),
|
|
218
|
+
(i) => o("update:modelValue", i),
|
|
219
|
+
(i) => o("change", i, t),
|
|
220
|
+
!0
|
|
221
|
+
);
|
|
222
|
+
return r && (o("value-change", U(y.value), t), Te()), r;
|
|
223
|
+
}
|
|
224
|
+
function he() {
|
|
225
|
+
var a, l, n, t;
|
|
226
|
+
S.value = "", v.value = M(), f.value && v.value.length !== 2 && (v.value = [null, null]), W.value = f.value && h(0) && !h(1) ? "end" : "start", K.value = void 0;
|
|
227
|
+
let e = ((a = z.value.find(Boolean)) == null ? void 0 : a.day) ?? ((l = _(u.defaultPickerValue)) == null ? void 0 : l.day) ?? fe.value.day;
|
|
228
|
+
e = Math.max(
|
|
229
|
+
((n = H.value) == null ? void 0 : n.day) ?? ee,
|
|
230
|
+
Math.min(((t = X.value) == null ? void 0 : t.day) ?? ae, e)
|
|
231
|
+
), O.value = e, Q.value = j(e, 1), q.value = u.defaultMode ?? (s.value === "week" ? "date" : s.value), L.value = q.value;
|
|
232
|
+
}
|
|
233
|
+
function xe(e, a = 0) {
|
|
234
|
+
if (!Number.isFinite(e) || e < ee || e > ae) return !1;
|
|
235
|
+
const l = Ie(
|
|
236
|
+
Ve(e).year,
|
|
237
|
+
Ve(e).month,
|
|
238
|
+
1
|
|
239
|
+
);
|
|
240
|
+
return a === 0 ? (u.panelValue === void 0 && (O.value = l), o("update:panelValue", $({ day: l, second: 0 })), f.value && !u.unlinkPanels && (Q.value = j(l, 1))) : (Q.value = l, u.unlinkPanels || (u.panelValue === void 0 && (O.value = j(l, -1)), o(
|
|
241
|
+
"update:panelValue",
|
|
242
|
+
$({ day: j(l, -1), second: 0 })
|
|
243
|
+
))), o(
|
|
244
|
+
"panelChange",
|
|
245
|
+
A({ day: l, second: 0 }),
|
|
246
|
+
a ? L.value : te.value,
|
|
247
|
+
{ index: a }
|
|
248
|
+
), !0;
|
|
249
|
+
}
|
|
250
|
+
function We(e, a = 0) {
|
|
251
|
+
return ["date", "month", "quarter", "year"].includes(e) ? (a ? L.value = e : (u.mode === void 0 && (q.value = e), o("update:mode", e)), o(
|
|
252
|
+
"panelChange",
|
|
253
|
+
A({ day: de.value[a], second: 0 }),
|
|
254
|
+
e,
|
|
255
|
+
{ index: a }
|
|
256
|
+
), a ? !0 : te.value === e) : !1;
|
|
257
|
+
}
|
|
258
|
+
function Se(e) {
|
|
259
|
+
const a = Array.isArray(u.defaultTime) ? u.defaultTime[e] : u.defaultTime;
|
|
260
|
+
return He(a);
|
|
261
|
+
}
|
|
262
|
+
async function Ce(e) {
|
|
263
|
+
var n;
|
|
264
|
+
if (G.value) return !1;
|
|
265
|
+
const a = f.value && W.value === "end" ? 1 : 0;
|
|
266
|
+
if (h(a) || !(s.value === "date" ? Y(e, a) : ne(
|
|
267
|
+
...B(e, s.value, m.value),
|
|
268
|
+
a
|
|
269
|
+
)))
|
|
270
|
+
return !1;
|
|
271
|
+
const l = F({
|
|
272
|
+
day: e,
|
|
273
|
+
second: T.value ? ((n = v.value[a]) == null ? void 0 : n.second) ?? Se(a) : 0
|
|
274
|
+
});
|
|
275
|
+
if (w.value) {
|
|
276
|
+
const t = v.value.filter((i) => !!i), r = t.findIndex((i) => i.day === l.day);
|
|
277
|
+
if (r >= 0) t.splice(r, 1);
|
|
278
|
+
else {
|
|
279
|
+
if (u.maxDates && t.length >= u.maxDates)
|
|
280
|
+
return k("limit");
|
|
281
|
+
t.push(l);
|
|
282
|
+
}
|
|
283
|
+
v.value = t.sort((i, d) => i.day - d.day);
|
|
284
|
+
} else if (f.value) {
|
|
285
|
+
if (a === 0)
|
|
286
|
+
v.value = [l, h(1) ? z.value[1] ?? null : null], W.value = h(1) ? "start" : "end";
|
|
287
|
+
else {
|
|
288
|
+
let t = v.value[0], r = l;
|
|
289
|
+
if (t && t.day > r.day) {
|
|
290
|
+
if (h(0)) return k("order");
|
|
291
|
+
[t, r] = [r, t];
|
|
292
|
+
}
|
|
293
|
+
v.value = [t ?? null, r], W.value = h(0) ? "end" : "start";
|
|
294
|
+
}
|
|
295
|
+
K.value = void 0;
|
|
296
|
+
} else v.value = [l];
|
|
297
|
+
if (S.value = "", o("calendarChange", D(v.value), {
|
|
298
|
+
range: a ? "end" : "start",
|
|
299
|
+
dates: v.value.map((t) => t ? A(t) : null)
|
|
300
|
+
}), !se.value && (!f.value || v.value.every(Boolean))) {
|
|
301
|
+
const t = D(v.value);
|
|
302
|
+
return await C(t, "date") || E(t, y.value);
|
|
303
|
+
}
|
|
304
|
+
return !1;
|
|
305
|
+
}
|
|
306
|
+
async function ie() {
|
|
307
|
+
const e = M(), a = f.value ? e.map((t, r) => h(r) ? t : null) : [], l = f.value && a.some(Boolean) ? D(a) : p(), n = await C(l, "clear", !0);
|
|
308
|
+
return n && (v.value = M(), S.value = "", o("clear")), n;
|
|
309
|
+
}
|
|
310
|
+
async function Re() {
|
|
311
|
+
if (!Z(v.value)) return k("draft");
|
|
312
|
+
const e = D(v.value);
|
|
313
|
+
return await C(e, "confirm") || E(e, y.value) ? (o("ok", U(y.value)), !0) : !1;
|
|
314
|
+
}
|
|
315
|
+
async function Fe(e) {
|
|
316
|
+
return e == null || e === "" || Array.isArray(e) && e.every((l) => l == null || l === "") || E(e, p()) ? ie() : C(e, "api");
|
|
317
|
+
}
|
|
318
|
+
function Ye(e, a) {
|
|
319
|
+
return G.value || h(e) || !v.value[e] || !Number.isInteger(a) || a < 0 || a > 86399 ? !1 : (v.value = v.value.map(
|
|
320
|
+
(l, n) => n === e && l ? { ...l, second: a } : l
|
|
321
|
+
), S.value = "", o("calendarChange", D(v.value), {
|
|
322
|
+
range: e ? "end" : "start",
|
|
323
|
+
dates: v.value.map((l) => l ? A(l) : null)
|
|
324
|
+
}), !0);
|
|
325
|
+
}
|
|
326
|
+
async function Ee(e, a = 0) {
|
|
327
|
+
var r;
|
|
328
|
+
if (G.value || h(a)) return !1;
|
|
329
|
+
if (!e.trim()) {
|
|
330
|
+
if (f.value && ((r = u.allowEmpty) != null && r[a])) {
|
|
331
|
+
const i = M();
|
|
332
|
+
return i[a] = null, v.value = i, C(D(i), "input");
|
|
333
|
+
}
|
|
334
|
+
return ie();
|
|
335
|
+
}
|
|
336
|
+
const l = [ue.value, ...u.inputFormats ?? []], n = l.map((i) => N(e, i, m.value, g.value)).find(Boolean);
|
|
337
|
+
if (!n) return k("format");
|
|
338
|
+
const t = f.value ? M() : [];
|
|
339
|
+
if (f.value) t[a] = F(n);
|
|
340
|
+
else {
|
|
341
|
+
if (w.value) return k("multiple-input");
|
|
342
|
+
t.push(F(n));
|
|
343
|
+
}
|
|
344
|
+
return v.value = t, C(D(t), "input");
|
|
345
|
+
}
|
|
346
|
+
function Ne(e) {
|
|
347
|
+
var l;
|
|
348
|
+
if (G.value) return !1;
|
|
349
|
+
const a = (l = u.shortcuts) == null ? void 0 : l[e];
|
|
350
|
+
if (!a || a.disabled) return !1;
|
|
351
|
+
try {
|
|
352
|
+
const n = typeof a.value == "function" ? a.value() : a.value, t = M(n);
|
|
353
|
+
return Z(t) ? (v.value = t, W.value = "start", K.value = void 0, o("calendarChange", D(t), {
|
|
354
|
+
range: "start",
|
|
355
|
+
dates: t.map((r) => r ? A(r) : null)
|
|
356
|
+
}), !0) : k("shortcut");
|
|
357
|
+
} catch (n) {
|
|
358
|
+
return o("invalid", { reason: "shortcut", error: n }), !1;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
function we(e, a) {
|
|
362
|
+
return !e && !a || !!e && !!a && e.day === a.day && e.second === a.second;
|
|
363
|
+
}
|
|
364
|
+
return Me(
|
|
365
|
+
[() => u.type, () => u.showTime, () => u.valueFormat],
|
|
366
|
+
he
|
|
367
|
+
), Me(
|
|
368
|
+
y,
|
|
369
|
+
(e) => {
|
|
370
|
+
if (u.clearValue !== void 0 && E(e, u.clearValue))
|
|
371
|
+
return;
|
|
372
|
+
const a = Array.isArray(e) ? e : [e], l = a.find((n) => n != null && n !== "");
|
|
373
|
+
l !== void 0 && (ve.value = l instanceof Date ? "date" : typeof l == "number" ? "timestamp" : "string");
|
|
374
|
+
},
|
|
375
|
+
{ immediate: !0, flush: "sync" }
|
|
376
|
+
), {
|
|
377
|
+
current: y,
|
|
378
|
+
selected: z,
|
|
379
|
+
draft: v,
|
|
380
|
+
stage: W,
|
|
381
|
+
preview: K,
|
|
382
|
+
error: S,
|
|
383
|
+
view: te,
|
|
384
|
+
rightView: L,
|
|
385
|
+
panels: de,
|
|
386
|
+
first: m,
|
|
387
|
+
weekContains: g,
|
|
388
|
+
time: T,
|
|
389
|
+
unit: s,
|
|
390
|
+
multiple: w,
|
|
391
|
+
pattern: I,
|
|
392
|
+
displayPattern: ue,
|
|
393
|
+
words: le,
|
|
394
|
+
needsConfirm: se,
|
|
395
|
+
today: fe,
|
|
396
|
+
model: J,
|
|
397
|
+
outputType: x,
|
|
398
|
+
parse: R,
|
|
399
|
+
boundary: _,
|
|
400
|
+
points: M,
|
|
401
|
+
available: Y,
|
|
402
|
+
periodAvailable: ne,
|
|
403
|
+
validTime: me,
|
|
404
|
+
valid: Z,
|
|
405
|
+
timeDisabled: oe,
|
|
406
|
+
encode: D,
|
|
407
|
+
describe: ye,
|
|
408
|
+
empty: p,
|
|
409
|
+
request: C,
|
|
410
|
+
begin: he,
|
|
411
|
+
setPanel: xe,
|
|
412
|
+
setMode: We,
|
|
413
|
+
choose: Ce,
|
|
414
|
+
clear: ie,
|
|
415
|
+
confirm: Re,
|
|
416
|
+
setValue: Fe,
|
|
417
|
+
setTime: Ye,
|
|
418
|
+
input: Ee,
|
|
419
|
+
pickShortcut: Ne,
|
|
420
|
+
locked: h
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
export {
|
|
424
|
+
Ke as useDatePicker
|
|
425
|
+
};
|
|
@@ -1,82 +1,128 @@
|
|
|
1
|
-
import { ref as E, onDeactivated as
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { ref as E, watch as I, onDeactivated as S, onBeforeUnmount as K, nextTick as P } from "vue";
|
|
2
|
+
import { useHysControlState as T } from "./formContext.js";
|
|
3
|
+
import { registerOverlay as U } from "./overlayManager.js";
|
|
4
|
+
function J(m, r, i = {}) {
|
|
5
|
+
const { disabled: C } = T({}), d = E(!1), M = E(!1), L = E({
|
|
6
|
+
position: "fixed",
|
|
7
|
+
top: "0px",
|
|
8
|
+
left: "0px",
|
|
9
|
+
visibility: "hidden"
|
|
10
|
+
}), F = E(i.placement ?? "bottom-start"), v = i.gap ?? 8, o = i.padding ?? 10;
|
|
11
|
+
let $ = 0, w, h, b = 0;
|
|
12
|
+
function k() {
|
|
13
|
+
var R;
|
|
14
|
+
if (!d.value || !m.value || !r.value) return;
|
|
15
|
+
const t = m.value.getBoundingClientRect();
|
|
9
16
|
if (!t.width && !t.height) {
|
|
10
17
|
s();
|
|
11
18
|
return;
|
|
12
19
|
}
|
|
13
|
-
const e = document.documentElement.clientWidth,
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
let
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
let
|
|
20
|
-
(
|
|
20
|
+
const e = document.documentElement.clientWidth, a = document.documentElement.clientHeight, l = Math.min(t.width, Math.max(0, e - 2 * o)), u = typeof i.matchWidth == "function" ? i.matchWidth() : i.matchWidth, f = (R = i.width) == null ? void 0 : R.call(i), x = typeof f == "number" ? Math.max(0, f) + "px" : f;
|
|
21
|
+
x !== void 0 ? (r.value.style.width = x, r.value.style.minWidth = "0", r.value.style.maxWidth = `calc(100vw - ${o * 2}px)`) : u === !0 && (r.value.style.width = `${l}px`, r.value.style.minWidth = "0", r.value.style.maxWidth = `${l}px`), x === void 0 && u === "min" && (r.value.style.width = "max-content", r.value.style.minWidth = `${l}px`, r.value.style.maxWidth = `calc(100vw - ${o * 2}px)`);
|
|
22
|
+
const H = r.value.getBoundingClientRect(), g = Math.min(H.width, Math.max(0, e - 2 * o)), y = Math.min(H.height, Math.max(0, a - 2 * o));
|
|
23
|
+
let n = i.placement ?? "bottom-start";
|
|
24
|
+
const z = a - t.bottom - v, A = t.top - v;
|
|
25
|
+
n.startsWith("bottom") && z < y && A > z ? n = n.replace("bottom", "top") : n.startsWith("top") && A < y && z > A ? n = n.replace("top", "bottom") : n === "right" && e - t.right - v < g && t.left > e - t.right ? n = "left" : n === "left" && t.left - v < g && e - t.right > t.left && (n = "right");
|
|
26
|
+
let p = n.endsWith("end") ? t.right - g : t.left, W = n.startsWith("top") ? t.top - y - v : t.bottom + v;
|
|
27
|
+
(n === "right" || n === "left") && (p = n === "right" ? t.right + v : t.left - g - v, W = t.top + (t.height - y) / 2), p = Math.max(o, Math.min(p, e - g - o)), W = Math.max(o, Math.min(W, a - y - o)), F.value = n, L.value = {
|
|
28
|
+
...x !== void 0 ? { width: x, minWidth: "0" } : u === !0 ? { width: `${l}px`, minWidth: "0" } : u === "min" ? { width: "max-content", minWidth: `${l}px` } : {},
|
|
29
|
+
position: "fixed",
|
|
30
|
+
left: `${Math.round(p)}px`,
|
|
31
|
+
top: `${Math.round(W)}px`,
|
|
32
|
+
visibility: "visible",
|
|
33
|
+
zIndex: "1200",
|
|
34
|
+
maxWidth: `calc(100vw - ${o * 2}px)`,
|
|
35
|
+
maxHeight: `calc(100vh - ${o * 2}px)`,
|
|
36
|
+
overflowY: "auto",
|
|
37
|
+
overscrollBehavior: "contain"
|
|
38
|
+
};
|
|
21
39
|
}
|
|
22
|
-
function
|
|
23
|
-
cancelAnimationFrame(
|
|
40
|
+
function c() {
|
|
41
|
+
cancelAnimationFrame($), $ = requestAnimationFrame(k);
|
|
24
42
|
}
|
|
25
|
-
function
|
|
26
|
-
var e,
|
|
27
|
-
|
|
43
|
+
function q(t) {
|
|
44
|
+
var e, a;
|
|
45
|
+
h != null && h() && !((e = m.value) != null && e.contains(t.target)) && !((a = r.value) != null && a.contains(t.target)) && s();
|
|
28
46
|
}
|
|
29
47
|
function B(t) {
|
|
30
|
-
var e,
|
|
31
|
-
if (!(!
|
|
48
|
+
var e, a;
|
|
49
|
+
if (!(!d.value || !(h != null && h()))) {
|
|
32
50
|
if (t.key === "Escape")
|
|
33
51
|
t.preventDefault(), t.stopImmediatePropagation(), s(!0);
|
|
34
|
-
else if (t.key === "Tab") {
|
|
35
|
-
const
|
|
36
|
-
if ((e =
|
|
52
|
+
else if (t.key === "Tab" && i.closeOnTab !== !1) {
|
|
53
|
+
const l = document.activeElement;
|
|
54
|
+
if ((e = m.value) != null && e.contains(l)) {
|
|
37
55
|
s();
|
|
38
56
|
return;
|
|
39
57
|
}
|
|
40
|
-
if ((
|
|
41
|
-
const
|
|
42
|
-
|
|
58
|
+
if ((a = r.value) != null && a.contains(l)) {
|
|
59
|
+
const u = Array.from(
|
|
60
|
+
r.value.querySelectorAll(
|
|
61
|
+
'a[href],button:not(:disabled),input:not(:disabled),textarea:not(:disabled),select:not(:disabled),[tabindex]:not([tabindex="-1"])'
|
|
62
|
+
)
|
|
63
|
+
).filter(
|
|
64
|
+
(f) => f.getClientRects().length && !f.closest("[inert]")
|
|
65
|
+
);
|
|
66
|
+
(!u.length || l === (t.shiftKey ? u[0] : u.at(-1))) && s(!0);
|
|
43
67
|
}
|
|
44
68
|
}
|
|
45
69
|
}
|
|
46
70
|
}
|
|
47
|
-
function
|
|
71
|
+
function O() {
|
|
48
72
|
var t, e;
|
|
49
|
-
document.removeEventListener("pointerdown",
|
|
73
|
+
document.removeEventListener("pointerdown", q, !0), document.removeEventListener("keydown", B, !0), window.removeEventListener("resize", c), window.removeEventListener("scroll", c, !0), (t = window.visualViewport) == null || t.removeEventListener("resize", c), (e = window.visualViewport) == null || e.removeEventListener("scroll", c), cancelAnimationFrame($), w == null || w(), w = void 0, h = void 0;
|
|
50
74
|
}
|
|
51
|
-
function s(t = !1) {
|
|
52
|
-
var
|
|
53
|
-
if (
|
|
54
|
-
|
|
75
|
+
function s(t = !1, e = !1) {
|
|
76
|
+
var a, l;
|
|
77
|
+
if (!(!e && d.value && ((a = i.requestOpen) == null ? void 0 : a.call(i, !1, t)) === !1) && (b++, !!d.value && (d.value = !1, O(), t && ((l = m.value) != null && l.isConnected)))) {
|
|
78
|
+
M.value = !0;
|
|
55
79
|
try {
|
|
56
|
-
|
|
80
|
+
m.value.focus();
|
|
57
81
|
} finally {
|
|
58
|
-
|
|
82
|
+
M.value = !1;
|
|
59
83
|
}
|
|
60
84
|
}
|
|
61
85
|
}
|
|
62
|
-
async function V() {
|
|
63
|
-
var
|
|
64
|
-
if (
|
|
65
|
-
|
|
86
|
+
async function V(t = !1) {
|
|
87
|
+
var l, u, f;
|
|
88
|
+
if (C.value) return;
|
|
89
|
+
if (d.value) {
|
|
90
|
+
c();
|
|
66
91
|
return;
|
|
67
92
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
93
|
+
if (!t && ((l = i.requestOpen) == null ? void 0 : l.call(i, !0)) === !1) return;
|
|
94
|
+
const e = ++b;
|
|
95
|
+
if (d.value = !0, L.value = {
|
|
96
|
+
position: "fixed",
|
|
97
|
+
top: "0px",
|
|
98
|
+
left: "0px",
|
|
99
|
+
visibility: "hidden"
|
|
100
|
+
}, await P(), e !== b || !d.value) return;
|
|
101
|
+
const a = U("floating", () => s(!0));
|
|
102
|
+
w = a.unregister, h = a.isTop, k(), document.addEventListener("pointerdown", q, !0), document.addEventListener("keydown", B, !0), window.addEventListener("resize", c), window.addEventListener("scroll", c, !0), (u = window.visualViewport) == null || u.addEventListener("resize", c), (f = window.visualViewport) == null || f.addEventListener("scroll", c);
|
|
72
103
|
}
|
|
73
|
-
function
|
|
74
|
-
return
|
|
104
|
+
function D() {
|
|
105
|
+
return d.value ? s() : V();
|
|
75
106
|
}
|
|
76
|
-
return
|
|
77
|
-
|
|
78
|
-
|
|
107
|
+
return I(
|
|
108
|
+
C,
|
|
109
|
+
(t) => {
|
|
110
|
+
t && s(!1, !0);
|
|
111
|
+
},
|
|
112
|
+
{ flush: "sync" }
|
|
113
|
+
), S(() => s(!1, !0)), K(() => {
|
|
114
|
+
b++, O();
|
|
115
|
+
}), {
|
|
116
|
+
open: d,
|
|
117
|
+
style: L,
|
|
118
|
+
placement: F,
|
|
119
|
+
update: k,
|
|
120
|
+
show: V,
|
|
121
|
+
close: s,
|
|
122
|
+
toggle: D,
|
|
123
|
+
restoringFocus: M
|
|
124
|
+
};
|
|
79
125
|
}
|
|
80
126
|
export {
|
|
81
|
-
|
|
127
|
+
J as useFloating
|
|
82
128
|
};
|