hys-ui 0.1.0 → 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 +137 -1
- package/README.md +18 -6
- package/dist/components/HysAccordion/HysAccordion.vue.js +1 -1
- package/dist/components/HysAccordion/HysAccordion2.vue.js +181 -47
- package/dist/components/HysAlert/HysAlert.vue.js +14 -14
- package/dist/components/HysAnimatedNumber/HysAnimatedNumber.vue.js +23 -20
- 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 -26
- 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 -84
- package/dist/components/HysCalendar/HysCalendar2.vue.js +803 -2
- package/dist/components/HysCard/HysCard.vue.js +1 -1
- package/dist/components/HysCard/HysCard2.vue.js +177 -44
- package/dist/components/HysCascader/HysCascader.vue.js +5 -182
- 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 +5 -39
- package/dist/components/HysCheckbox/HysCheckbox2.vue.js +200 -2
- 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/HysCommandPalette/HysCommandPalette.vue.js +52 -51
- package/dist/components/HysCommentEditor/HysCommentEditor.vue.js +17 -17
- package/dist/components/HysDataGrid/HysDataGrid.vue.js +1 -1
- package/dist/components/HysDataGrid/HysDataGrid2.vue.js +397 -390
- 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/HysDrawer/HysDrawer.vue.js +1 -1
- package/dist/components/HysDrawer/HysDrawer2.vue.js +55 -54
- package/dist/components/HysFileManager/HysFileManager.vue.js +5 -63
- package/dist/components/HysFileManager/HysFileManager2.vue.js +86 -2
- package/dist/components/HysForm/HysForm.vue.js +3 -3
- package/dist/components/HysForm/HysForm2.vue.js +580 -92
- package/dist/components/HysFormItem/HysFormItem.vue.js +5 -69
- package/dist/components/HysFormItem/HysFormItem2.vue.js +521 -2
- package/dist/components/HysGantt/HysGantt.vue.js +5 -264
- package/dist/components/HysGantt/HysGantt2.vue.js +1399 -2
- package/dist/components/HysInput/HysInput.vue.js +2 -2
- package/dist/components/HysInput/HysInput2.vue.js +468 -120
- package/dist/components/HysMention/HysMention.vue.js +2 -2
- package/dist/components/HysMention/HysMention2.vue.js +89 -88
- package/dist/components/HysModal/HysModal.vue.js +2 -2
- package/dist/components/HysModal/HysModal2.vue.js +35 -35
- package/dist/components/HysNotificationCenter/HysNotificationCenter.vue.js +37 -36
- package/dist/components/HysNumberInput/HysNumberInput.vue.js +2 -2
- package/dist/components/HysNumberInput/HysNumberInput2.vue.js +561 -70
- package/dist/components/HysOrgTree/HysOrgTree.vue.js +41 -36
- package/dist/components/HysPagination/HysPagination.vue.js +2 -2
- package/dist/components/HysPagination/HysPagination2.vue.js +93 -91
- package/dist/components/HysPermissionMatrix/HysPermissionMatrix.vue.js +5 -41
- package/dist/components/HysPermissionMatrix/HysPermissionMatrix2.vue.js +101 -2
- 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 +5 -40
- package/dist/components/HysRadioGroup/HysRadioGroup2.vue.js +205 -2
- package/dist/components/HysRating/HysRating.vue.js +1 -1
- package/dist/components/HysRating/HysRating2.vue.js +288 -68
- package/dist/components/HysResizablePanel/HysResizablePanel.vue.js +46 -28
- package/dist/components/HysRichTextEditor/HysRichTextEditor.vue.js +2 -2
- package/dist/components/HysRichTextEditor/HysRichTextEditor2.vue.js +87 -67
- package/dist/components/HysSearch/HysSearch.vue.js +50 -38
- package/dist/components/HysSegmented/HysSegmented.vue.js +5 -58
- 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 -164
- 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/HysSplitPane/HysSplitPane.vue.js +48 -42
- package/dist/components/HysSteps/HysSteps.vue.js +2 -2
- package/dist/components/HysSteps/HysSteps2.vue.js +111 -36
- package/dist/components/HysSwitch/HysSwitch.vue.js +2 -2
- package/dist/components/HysSwitch/HysSwitch2.vue.js +235 -42
- package/dist/components/HysTable/HysTable.vue.js +1 -1
- package/dist/components/HysTable/HysTable2.vue.js +1471 -82
- 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 -66
- package/dist/components/HysTagInput/HysTagInput.vue.js +43 -42
- package/dist/components/HysTextarea/HysTextarea.vue.js +137 -66
- package/dist/components/HysToast/HysToast.vue.js +2 -2
- package/dist/components/HysToast/HysToast2.vue.js +121 -38
- package/dist/components/HysTour/HysTour.vue.js +47 -42
- package/dist/components/HysTransfer/HysTransfer.vue.js +5 -207
- 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 -301
- package/dist/components/HysTreeSelect/HysTreeSelect.vue.js +5 -129
- 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 +97 -78
- 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 +94 -3
- 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/toastEscape.js +16 -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/useDialog.js +16 -16
- package/dist/composables/useFloating.js +98 -52
- package/dist/composables/useGanttDependencies.js +306 -0
- package/dist/composables/useGanttHistory.js +157 -0
- package/dist/composables/useGanttLabelResize.js +100 -0
- package/dist/composables/useHysToast.js +148 -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/config.js +18 -15
- package/dist/index.js +149 -136
- 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 -29
- package/dist/types/components/HysCard/HysCard.vue.d.ts +57 -5
- 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 +55 -27
- 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/HysDrawer/HysDrawer.vue.d.ts +1 -0
- package/dist/types/components/HysFileManager/HysFileManager.vue.d.ts +8 -4
- 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 +88 -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 -33
- package/dist/types/components/HysOrgTree/HysOrgTree.vue.d.ts +4 -1
- package/dist/types/components/HysPagination/HysPagination.vue.d.ts +1 -1
- package/dist/types/components/HysPermissionMatrix/HysPermissionMatrix.vue.d.ts +8 -1
- 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 +62 -17
- package/dist/types/components/HysRating/HysRating.vue.d.ts +85 -5
- package/dist/types/components/HysResizablePanel/HysResizablePanel.vue.d.ts +6 -0
- 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 -14
- 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 +6 -0
- package/dist/types/components/HysSteps/HysSteps.vue.d.ts +65 -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 +55 -7
- package/dist/types/components/HysTour/HysTour.vue.d.ts +5 -3
- package/dist/types/components/HysTransfer/HysTransfer.vue.d.ts +55 -30
- 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 +138 -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/toastEscape.d.ts +1 -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/useHysToast.d.ts +50 -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 +38 -7
- package/package.json +47 -11
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { defineComponent as C, ref as T, computed as c, openBlock as d, createElementBlock as n, createBlock as v, withKeys as H, withModifiers as K, createCommentVNode as x, Fragment as V, renderList as O, withCtx as w, createTextVNode as p, toDisplayString as b } from "vue";
|
|
2
|
+
import z from "../HysInput/HysInput.vue.js";
|
|
3
|
+
import F from "../HysCheckbox/HysCheckbox.vue.js";
|
|
4
|
+
import M from "../HysRadio/HysRadio.vue.js";
|
|
5
|
+
import j from "../HysTree/HysTree.vue.js";
|
|
6
|
+
import { tableFilterOptions as S } from "../../composables/table.js";
|
|
7
|
+
const q = { class: "hys-ui-table-filter-choice" }, A = {
|
|
8
|
+
key: 2,
|
|
9
|
+
class: "hys-ui-table-filter-options"
|
|
10
|
+
}, N = {
|
|
11
|
+
key: 0,
|
|
12
|
+
role: "status"
|
|
13
|
+
}, J = /* @__PURE__ */ C({
|
|
14
|
+
__name: "HysTableFilterOptions",
|
|
15
|
+
props: {
|
|
16
|
+
options: {},
|
|
17
|
+
values: {},
|
|
18
|
+
multiple: { type: Boolean },
|
|
19
|
+
mode: {},
|
|
20
|
+
search: { type: [Boolean, Function] },
|
|
21
|
+
disabled: { type: Boolean },
|
|
22
|
+
searchLabel: {},
|
|
23
|
+
emptyText: {}
|
|
24
|
+
},
|
|
25
|
+
emits: ["update:values"],
|
|
26
|
+
setup(l, { emit: B }) {
|
|
27
|
+
const s = l, f = B, u = T(""), i = (a) => typeof a + ":" + String(a), o = c(() => S(s.options)), L = c(
|
|
28
|
+
() => new Map(o.value.map((a) => [i(a.value), a]))
|
|
29
|
+
), y = (a) => !u.value.trim() || (typeof s.search == "function" ? s.search(u.value.trim(), a) : a.label.toLocaleLowerCase().includes(u.value.trim().toLocaleLowerCase())), h = c(() => o.value.filter(y)), U = c(() => {
|
|
30
|
+
var t;
|
|
31
|
+
const a = new Map(
|
|
32
|
+
o.value.map((e) => [
|
|
33
|
+
e,
|
|
34
|
+
{
|
|
35
|
+
id: i(e.value),
|
|
36
|
+
label: e.label,
|
|
37
|
+
disabled: e.disabled,
|
|
38
|
+
option: e
|
|
39
|
+
}
|
|
40
|
+
])
|
|
41
|
+
);
|
|
42
|
+
for (const e of o.value)
|
|
43
|
+
a.get(e).children = (t = e.children) == null ? void 0 : t.map((r) => a.get(r)).filter(Boolean);
|
|
44
|
+
return s.options.map((e) => a.get(e)).filter(Boolean);
|
|
45
|
+
});
|
|
46
|
+
function k(a) {
|
|
47
|
+
f(
|
|
48
|
+
"update:values",
|
|
49
|
+
a.flatMap((t) => {
|
|
50
|
+
const e = L.value.get(String(t));
|
|
51
|
+
return e ? [e.value] : [];
|
|
52
|
+
})
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
function g(a, t) {
|
|
56
|
+
s.disabled || a.disabled || f(
|
|
57
|
+
"update:values",
|
|
58
|
+
s.multiple ? t ? [
|
|
59
|
+
...s.values.filter((e) => !Object.is(e, a.value)),
|
|
60
|
+
a.value
|
|
61
|
+
] : s.values.filter((e) => !Object.is(e, a.value)) : t ? [a.value] : []
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
return (a, t) => (d(), n("div", q, [
|
|
65
|
+
l.search ? (d(), v(z, {
|
|
66
|
+
key: 0,
|
|
67
|
+
modelValue: u.value,
|
|
68
|
+
"onUpdate:modelValue": t[0] || (t[0] = (e) => u.value = e),
|
|
69
|
+
clearable: "",
|
|
70
|
+
size: "sm",
|
|
71
|
+
"aria-label": l.searchLabel,
|
|
72
|
+
placeholder: l.searchLabel,
|
|
73
|
+
disabled: l.disabled,
|
|
74
|
+
onKeydown: t[1] || (t[1] = H(K(() => {
|
|
75
|
+
}, ["prevent"]), ["enter"]))
|
|
76
|
+
}, null, 8, ["modelValue", "aria-label", "placeholder", "disabled"])) : x("", !0),
|
|
77
|
+
l.mode === "tree" ? (d(), v(j, {
|
|
78
|
+
key: 1,
|
|
79
|
+
searchable: !1,
|
|
80
|
+
nodes: U.value,
|
|
81
|
+
"checked-keys": l.values.map(i),
|
|
82
|
+
"model-value": l.multiple ? null : l.values.length ? i(l.values[0]) : null,
|
|
83
|
+
checkable: l.multiple,
|
|
84
|
+
selectable: !l.multiple,
|
|
85
|
+
"allow-deselect": !1,
|
|
86
|
+
"search-value": u.value,
|
|
87
|
+
"filter-node": (e, r) => y(r.option),
|
|
88
|
+
"check-on-click-node": l.multiple,
|
|
89
|
+
"inherit-disabled": !0,
|
|
90
|
+
disabled: l.disabled,
|
|
91
|
+
"default-expand-all": !0,
|
|
92
|
+
"empty-text": l.emptyText,
|
|
93
|
+
"validate-event": !1,
|
|
94
|
+
size: "sm",
|
|
95
|
+
"onUpdate:checkedKeys": k,
|
|
96
|
+
"onUpdate:modelValue": t[2] || (t[2] = (e) => !l.multiple && k(e === null ? [] : Array.isArray(e) ? e : [e]))
|
|
97
|
+
}, null, 8, ["nodes", "checked-keys", "model-value", "checkable", "selectable", "search-value", "filter-node", "check-on-click-node", "disabled", "empty-text"])) : (d(), n("div", A, [
|
|
98
|
+
(d(!0), n(V, null, O(h.value, (e, r) => (d(), n(V, {
|
|
99
|
+
key: i(e.value)
|
|
100
|
+
}, [
|
|
101
|
+
l.multiple ? (d(), v(F, {
|
|
102
|
+
key: 0,
|
|
103
|
+
"model-value": l.values.some((m) => Object.is(m, e.value)),
|
|
104
|
+
disabled: l.disabled || e.disabled,
|
|
105
|
+
size: "sm",
|
|
106
|
+
"onUpdate:modelValue": (m) => g(e, m === !0)
|
|
107
|
+
}, {
|
|
108
|
+
default: w(() => [
|
|
109
|
+
p(b(e.label), 1)
|
|
110
|
+
]),
|
|
111
|
+
_: 2
|
|
112
|
+
}, 1032, ["model-value", "disabled", "onUpdate:modelValue"])) : (d(), v(M, {
|
|
113
|
+
key: 1,
|
|
114
|
+
"model-value": l.values[0] ?? null,
|
|
115
|
+
value: e.value,
|
|
116
|
+
disabled: l.disabled || e.disabled,
|
|
117
|
+
size: "sm",
|
|
118
|
+
"onUpdate:modelValue": (m) => g(e, !0)
|
|
119
|
+
}, {
|
|
120
|
+
default: w(() => [
|
|
121
|
+
p(b(e.label), 1)
|
|
122
|
+
]),
|
|
123
|
+
_: 2
|
|
124
|
+
}, 1032, ["model-value", "value", "disabled", "onUpdate:modelValue"]))
|
|
125
|
+
], 64))), 128)),
|
|
126
|
+
h.value.length ? x("", !0) : (d(), n("p", N, b(l.emptyText), 1))
|
|
127
|
+
]))
|
|
128
|
+
]));
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
export {
|
|
132
|
+
J as default
|
|
133
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./HysTabs2.vue.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const
|
|
4
|
+
const c = /* @__PURE__ */ t(o, [["__scopeId", "data-v-4a2ce4c1"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
c as default
|
|
7
7
|
};
|
|
@@ -1,81 +1,277 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { X as
|
|
3
|
-
import { useHysRootAttrs as
|
|
4
|
-
|
|
1
|
+
import { defineComponent as he, useId as ke, ref as y, computed as M, watch as A, nextTick as T, onMounted as ge, onActivated as me, onDeactivated as pe, onBeforeUnmount as we, openBlock as i, createElementBlock as v, mergeProps as Ce, unref as h, createElementVNode as U, normalizeClass as R, renderSlot as B, createCommentVNode as k, createBlock as ae, resolveDynamicComponent as le, Fragment as W, renderList as te, createTextVNode as oe, toDisplayString as se, createVNode as ue, withDirectives as Be, vShow as $e } from "vue";
|
|
2
|
+
import { ChevronUp as ze, ChevronLeft as Se, X as Te, ChevronDown as Le, ChevronRight as Ve, Plus as Ae } from "lucide-vue-next";
|
|
3
|
+
import { useHysRootAttrs as Re } from "../../config.js";
|
|
4
|
+
import { useMotion as He } from "../../motion/useMotion.js";
|
|
5
|
+
const De = {
|
|
6
|
+
key: 0,
|
|
7
|
+
class: "hys-ui-tabs-extra"
|
|
8
|
+
}, Ee = ["aria-label"], xe = ["aria-label", "aria-busy", "aria-orientation"], Ie = ["id", "data-tab-key", "aria-selected", "aria-controls", "disabled", "tabindex", "onFocus", "onClick", "onMouseenter"], Me = ["aria-label", "aria-busy", "disabled", "onClick"], Ne = ["aria-label"], Oe = ["disabled"], qe = {
|
|
9
|
+
key: 4,
|
|
10
|
+
class: "hys-ui-tabs-extra"
|
|
11
|
+
}, Fe = ["id", "data-active", "aria-labelledby"], Ke = ["id", "aria-labelledby"], je = /* @__PURE__ */ he({
|
|
5
12
|
__name: "HysTabs",
|
|
6
13
|
props: {
|
|
7
14
|
modelValue: {},
|
|
15
|
+
defaultValue: {},
|
|
8
16
|
items: {},
|
|
9
17
|
disabled: { type: Boolean },
|
|
10
|
-
type: {},
|
|
18
|
+
type: { default: "line" },
|
|
11
19
|
vertical: { type: Boolean },
|
|
20
|
+
placement: {},
|
|
21
|
+
size: { default: "md" },
|
|
22
|
+
stretch: { type: Boolean },
|
|
23
|
+
centered: { type: Boolean },
|
|
12
24
|
closable: { type: Boolean },
|
|
13
|
-
|
|
25
|
+
addable: { type: Boolean },
|
|
26
|
+
editable: { type: Boolean },
|
|
27
|
+
trigger: { default: "click" },
|
|
28
|
+
activation: { default: "auto" },
|
|
29
|
+
lazy: { type: Boolean, default: !0 },
|
|
30
|
+
destroyOnHide: { type: Boolean, default: !1 },
|
|
31
|
+
animated: { type: Boolean, default: !0 },
|
|
32
|
+
showScrollButtons: { type: Boolean, default: !0 },
|
|
33
|
+
ariaLabel: {},
|
|
34
|
+
beforeLeave: {},
|
|
35
|
+
beforeClose: {}
|
|
14
36
|
},
|
|
15
|
-
emits: ["update:modelValue", "change", "close"],
|
|
16
|
-
setup(
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
t.
|
|
37
|
+
emits: ["update:modelValue", "change", "tabClick", "close", "add", "edit", "guardError"],
|
|
38
|
+
setup(s, { expose: ie, emit: ne }) {
|
|
39
|
+
const t = s, c = ne, re = Re(), { effectiveMotion: X } = He(), j = ke(), g = y(), N = y(t.defaultValue), u = M(() => {
|
|
40
|
+
var e;
|
|
41
|
+
return t.modelValue ?? (t.items.some((l) => l.value === N.value) ? N.value : ((e = t.items.find((l) => !l.disabled)) == null ? void 0 : e.value) ?? "");
|
|
42
|
+
}), H = M(() => t.placement ?? (t.vertical ? "left" : "top")), n = M(() => H.value === "left" || H.value === "right"), r = M(() => t.items.filter((e) => !t.disabled && !e.disabled)), m = y(), D = y(/* @__PURE__ */ new Set()), p = y(!1), $ = y(/* @__PURE__ */ new Set()), G = y(!1), J = y(!1);
|
|
43
|
+
let z = 0, w = 0, de = 0, b = !0, S;
|
|
44
|
+
const E = /* @__PURE__ */ new Map(), L = (e) => typeof e + ":" + e, O = (e) => j + "-tab-" + e, q = (e) => j + "-panel-" + e, F = (e) => e.closable ?? (t.closable || t.editable), Q = (e) => {
|
|
45
|
+
var l;
|
|
46
|
+
return Array.from(((l = g.value) == null ? void 0 : l.querySelectorAll('[role="tab"]')) || []).find((a) => a.dataset.tabKey === L(e));
|
|
47
|
+
}, ve = (e) => e.forceRender || !t.destroyOnHide && (!t.lazy || D.value.has(e.value)) || u.value === e.value;
|
|
48
|
+
function C() {
|
|
49
|
+
const e = g.value;
|
|
50
|
+
if (!e) return;
|
|
51
|
+
const l = n.value ? e.scrollTop : e.scrollLeft, a = n.value ? e.clientHeight : e.clientWidth, o = n.value ? e.scrollHeight : e.scrollWidth;
|
|
52
|
+
G.value = l > 1, J.value = l + a < o - 1;
|
|
20
53
|
}
|
|
21
|
-
function
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
a.
|
|
26
|
-
const e = t.value.findIndex((c) => c.value === n.modelValue), s = a.key === "Home" ? 0 : a.key === "End" ? t.value.length - 1 : (e + (a.key === r[0] ? -1 : 1) + t.value.length) % t.value.length;
|
|
27
|
-
v(t.value[s].value);
|
|
28
|
-
const o = Array.from(((y = b.value) == null ? void 0 : y.querySelectorAll('[role="tab"]')) || []).find((c) => c.dataset.tabValue === t.value[s].value);
|
|
29
|
-
o == null || o.focus();
|
|
54
|
+
function V() {
|
|
55
|
+
const e = g.value, l = Q(u.value);
|
|
56
|
+
if (!e || !l) return;
|
|
57
|
+
const a = e.getBoundingClientRect(), o = l.getBoundingClientRect();
|
|
58
|
+
n.value ? o.top < a.top ? e.scrollTop -= a.top - o.top : o.bottom > a.bottom && (e.scrollTop += o.bottom - a.bottom) : o.left < a.left ? e.scrollLeft -= a.left - o.left : o.right > a.right && (e.scrollLeft += o.right - a.right), C();
|
|
30
59
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
60
|
+
function Y(e) {
|
|
61
|
+
const l = g.value;
|
|
62
|
+
if (!l) return;
|
|
63
|
+
const a = (n.value ? l.clientHeight : l.clientWidth) * 0.8 * e;
|
|
64
|
+
l.scrollBy({ [n.value ? "top" : "left"]: a, behavior: X.value === "off" ? "auto" : "smooth" });
|
|
65
|
+
}
|
|
66
|
+
function Z(e) {
|
|
67
|
+
var l;
|
|
68
|
+
m.value = e, (l = Q(e)) == null || l.focus();
|
|
69
|
+
}
|
|
70
|
+
async function x(e) {
|
|
71
|
+
const l = ++z, a = u.value, o = w;
|
|
72
|
+
if (p.value = !1, !(!b || !r.value.some((d) => d.value === e) || e === a))
|
|
73
|
+
try {
|
|
74
|
+
if (t.beforeLeave && (p.value = !0, await t.beforeLeave(e, a) === !1) || !b || o !== w || l !== z || u.value !== a || !r.value.some((d) => d.value === e)) return;
|
|
75
|
+
p.value = !1, N.value = e, c("update:modelValue", e), c("change", e), await T(), V();
|
|
76
|
+
} catch (d) {
|
|
77
|
+
b && o === w && l === z && c("guardError", d);
|
|
78
|
+
} finally {
|
|
79
|
+
l === z && (p.value = !1);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function ce(e, l) {
|
|
83
|
+
t.disabled || e.disabled || (c("tabClick", e.value, l), x(e.value));
|
|
84
|
+
}
|
|
85
|
+
async function be(e) {
|
|
86
|
+
if (!b || t.disabled || e.disabled || !F(e) || $.value.has(e.value)) return;
|
|
87
|
+
const l = w, a = ++de;
|
|
88
|
+
E.set(e.value, a);
|
|
89
|
+
try {
|
|
90
|
+
if ($.value.add(e.value), t.beforeClose && await t.beforeClose(e.value) === !1) return;
|
|
91
|
+
const o = t.items.find((d) => d.value === e.value);
|
|
92
|
+
if (!b || l !== w || E.get(e.value) !== a || t.disabled || !o || o.disabled || !F(o)) return;
|
|
93
|
+
c("close", e.value), c("edit", e.value, "remove");
|
|
94
|
+
} catch (o) {
|
|
95
|
+
b && l === w && c("guardError", o);
|
|
96
|
+
} finally {
|
|
97
|
+
E.get(e.value) === a && $.value.delete(e.value);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
function fe() {
|
|
101
|
+
t.disabled || (c("add"), c("edit", void 0, "add"));
|
|
102
|
+
}
|
|
103
|
+
function ye(e) {
|
|
104
|
+
var ee;
|
|
105
|
+
if (e.target.closest(".hys-ui-tab-close")) return;
|
|
106
|
+
const l = n.value ? ["ArrowUp", "ArrowDown"] : ["ArrowLeft", "ArrowRight"], a = e.target.closest('[role="tab"]'), o = ((ee = r.value.find((P) => L(P.value) === (a == null ? void 0 : a.dataset.tabKey))) == null ? void 0 : ee.value) ?? m.value ?? u.value;
|
|
107
|
+
if (["Enter", " "].includes(e.key) && t.activation === "manual" && a) {
|
|
108
|
+
e.preventDefault(), x(o);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
if (![...l, "Home", "End"].includes(e.key) || !r.value.length) return;
|
|
112
|
+
e.preventDefault();
|
|
113
|
+
const d = r.value.findIndex((P) => P.value === o), f = e.key === "Home" ? 0 : e.key === "End" ? r.value.length - 1 : d < 0 ? e.key === l[0] ? r.value.length - 1 : 0 : (d + (e.key === l[0] ? -1 : 1) + r.value.length) % r.value.length;
|
|
114
|
+
Z(r.value[f].value), t.activation === "auto" && x(r.value[f].value);
|
|
115
|
+
}
|
|
116
|
+
function I() {
|
|
117
|
+
z++, p.value = !1, w++, $.value.clear(), E.clear();
|
|
118
|
+
}
|
|
119
|
+
function K() {
|
|
120
|
+
S == null || S.disconnect(), S = void 0;
|
|
121
|
+
}
|
|
122
|
+
function _() {
|
|
123
|
+
K(), typeof ResizeObserver < "u" && g.value && (S = new ResizeObserver(C), S.observe(g.value)), T().then(C);
|
|
124
|
+
}
|
|
125
|
+
return A(u, (e) => {
|
|
126
|
+
D.value.add(e), z++, p.value = !1, T().then(V);
|
|
127
|
+
}, { immediate: !0 }), A(() => t.items.map((e) => [e.value, e.disabled, e.closable]), () => {
|
|
128
|
+
I(), D.value = new Set([...D.value].filter((e) => t.items.some((l) => l.value === e))), m.value !== void 0 && !r.value.some((e) => e.value === m.value) && (m.value = void 0), T().then(C);
|
|
129
|
+
}, { deep: !0 }), A(() => t.disabled, () => I()), A(() => [t.size, t.type, t.stretch, t.centered, ...t.items.map((e) => e.label)], () => void T().then(() => {
|
|
130
|
+
C(), V();
|
|
131
|
+
})), A(H, () => void T().then(() => {
|
|
132
|
+
C(), V();
|
|
133
|
+
})), ge(_), me(() => {
|
|
134
|
+
b = !0, _();
|
|
135
|
+
}), pe(() => {
|
|
136
|
+
b = !1, I(), K();
|
|
137
|
+
}), we(() => {
|
|
138
|
+
b = !1, I(), K();
|
|
139
|
+
}), ie({ scrollToActiveTab: V, focus: (e = u.value) => Z(e) }), (e, l) => (i(), v("div", Ce(h(re), {
|
|
140
|
+
class: ["hys-ui-tabs-root", ["hys-ui-tabs-placement-" + H.value, "hys-ui-tabs-size-" + s.size, { "hys-ui-tabs-bordered": s.type === "border-card" }]]
|
|
141
|
+
}), [
|
|
142
|
+
U("div", {
|
|
143
|
+
class: R(["hys-ui-tabs-header", { "hys-ui-tabs-header-vertical": n.value }])
|
|
144
|
+
}, [
|
|
145
|
+
e.$slots.prefix ? (i(), v("div", De, [
|
|
146
|
+
B(e.$slots, "prefix", {}, void 0, !0)
|
|
147
|
+
])) : k("", !0),
|
|
148
|
+
s.showScrollButtons && G.value ? (i(), v("button", {
|
|
149
|
+
key: 1,
|
|
150
|
+
class: "hys-ui-tab-scroll",
|
|
151
|
+
type: "button",
|
|
152
|
+
"aria-label": n.value ? "向上滚动页签" : "向左滚动页签",
|
|
153
|
+
onClick: l[0] || (l[0] = (a) => Y(-1))
|
|
154
|
+
}, [
|
|
155
|
+
(i(), ae(le(n.value ? h(ze) : h(Se)), { size: 16 }))
|
|
156
|
+
], 8, Ee)) : k("", !0),
|
|
157
|
+
U("div", {
|
|
158
|
+
ref_key: "nav",
|
|
159
|
+
ref: g,
|
|
160
|
+
class: R(["hys-ui-tabs", ["hys-ui-tabs-" + s.type, { "hys-ui-tabs-vertical": n.value, "hys-ui-tabs-stretch": s.stretch, "hys-ui-tabs-centered": s.centered }]]),
|
|
161
|
+
role: "tablist",
|
|
162
|
+
"aria-label": s.ariaLabel || "页签",
|
|
163
|
+
"aria-busy": p.value || void 0,
|
|
164
|
+
"aria-orientation": n.value ? "vertical" : "horizontal",
|
|
165
|
+
onKeydown: ye,
|
|
166
|
+
onScrollPassive: C
|
|
167
|
+
}, [
|
|
168
|
+
(i(!0), v(W, null, te(s.items, (a, o) => {
|
|
169
|
+
var d;
|
|
170
|
+
return i(), v("div", {
|
|
171
|
+
key: L(a.value),
|
|
172
|
+
class: R(["hys-ui-tab-item", { "hys-ui-tab-selected": u.value === a.value }])
|
|
69
173
|
}, [
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
174
|
+
U("button", {
|
|
175
|
+
id: O(o),
|
|
176
|
+
type: "button",
|
|
177
|
+
role: "tab",
|
|
178
|
+
"data-tab-key": L(a.value),
|
|
179
|
+
"aria-selected": u.value === a.value,
|
|
180
|
+
"aria-controls": e.$slots.panel || a.content !== void 0 || e.$slots.default && u.value === a.value ? q(o) : void 0,
|
|
181
|
+
disabled: s.disabled || a.disabled,
|
|
182
|
+
tabindex: (m.value ?? (r.value.some((f) => f.value === u.value) ? u.value : (d = r.value[0]) == null ? void 0 : d.value)) === a.value ? 0 : -1,
|
|
183
|
+
class: R({ "hys-ui-active": u.value === a.value }),
|
|
184
|
+
onFocus: (f) => m.value = a.value,
|
|
185
|
+
onClick: (f) => ce(a, f),
|
|
186
|
+
onMouseenter: (f) => s.trigger === "hover" && x(a.value)
|
|
187
|
+
}, [
|
|
188
|
+
B(e.$slots, "label", {
|
|
189
|
+
item: a,
|
|
190
|
+
active: u.value === a.value
|
|
191
|
+
}, () => [
|
|
192
|
+
oe(se(a.label), 1)
|
|
193
|
+
], !0)
|
|
194
|
+
], 42, Ie),
|
|
195
|
+
F(a) ? (i(), v("button", {
|
|
196
|
+
key: 0,
|
|
197
|
+
type: "button",
|
|
198
|
+
class: "hys-ui-tab-close",
|
|
199
|
+
"aria-label": "关闭" + a.label,
|
|
200
|
+
"aria-busy": $.value.has(a.value) || void 0,
|
|
201
|
+
disabled: s.disabled || a.disabled || $.value.has(a.value),
|
|
202
|
+
onClick: (f) => be(a)
|
|
203
|
+
}, [
|
|
204
|
+
B(e.$slots, "close-icon", { item: a }, () => [
|
|
205
|
+
ue(h(Te), { size: 13 })
|
|
206
|
+
], !0)
|
|
207
|
+
], 8, Me)) : k("", !0)
|
|
208
|
+
], 2);
|
|
209
|
+
}), 128))
|
|
210
|
+
], 42, xe),
|
|
211
|
+
s.showScrollButtons && J.value ? (i(), v("button", {
|
|
212
|
+
key: 2,
|
|
213
|
+
class: "hys-ui-tab-scroll",
|
|
214
|
+
type: "button",
|
|
215
|
+
"aria-label": n.value ? "向下滚动页签" : "向右滚动页签",
|
|
216
|
+
onClick: l[1] || (l[1] = (a) => Y(1))
|
|
217
|
+
}, [
|
|
218
|
+
(i(), ae(le(n.value ? h(Le) : h(Ve)), { size: 16 }))
|
|
219
|
+
], 8, Ne)) : k("", !0),
|
|
220
|
+
s.addable || s.editable ? (i(), v("button", {
|
|
221
|
+
key: 3,
|
|
222
|
+
type: "button",
|
|
223
|
+
class: "hys-ui-tab-add",
|
|
224
|
+
"aria-label": "添加页签",
|
|
225
|
+
disabled: s.disabled,
|
|
226
|
+
onClick: fe
|
|
227
|
+
}, [
|
|
228
|
+
B(e.$slots, "add-icon", {}, () => [
|
|
229
|
+
ue(h(Ae), { size: 16 })
|
|
230
|
+
], !0)
|
|
231
|
+
], 8, Oe)) : k("", !0),
|
|
232
|
+
e.$slots.suffix ? (i(), v("div", qe, [
|
|
233
|
+
B(e.$slots, "suffix", {}, void 0, !0)
|
|
234
|
+
])) : k("", !0)
|
|
235
|
+
], 2),
|
|
236
|
+
e.$slots.panel || s.items.some((a) => a.content !== void 0) ? (i(), v("div", {
|
|
237
|
+
key: 0,
|
|
238
|
+
class: R(["hys-ui-tabs-content", { "hys-ui-tabs-animated": s.animated && h(X) !== "off" }])
|
|
239
|
+
}, [
|
|
240
|
+
(i(!0), v(W, null, te(s.items, (a, o) => (i(), v(W, {
|
|
241
|
+
key: L(a.value)
|
|
242
|
+
}, [
|
|
243
|
+
ve(a) ? Be((i(), v("div", {
|
|
244
|
+
key: 0,
|
|
245
|
+
id: q(o),
|
|
246
|
+
class: "hys-ui-tab-panel",
|
|
247
|
+
"data-active": u.value === a.value,
|
|
248
|
+
role: "tabpanel",
|
|
249
|
+
"aria-labelledby": O(o),
|
|
250
|
+
tabindex: "0"
|
|
251
|
+
}, [
|
|
252
|
+
B(e.$slots, "panel", {
|
|
253
|
+
item: a,
|
|
254
|
+
active: u.value === a.value
|
|
255
|
+
}, () => [
|
|
256
|
+
oe(se(a.content), 1)
|
|
257
|
+
], !0)
|
|
258
|
+
], 8, Fe)), [
|
|
259
|
+
[$e, u.value === a.value]
|
|
260
|
+
]) : k("", !0)
|
|
261
|
+
], 64))), 128))
|
|
262
|
+
], 2)) : e.$slots.default ? (i(), v("div", {
|
|
263
|
+
key: 1,
|
|
264
|
+
id: q(s.items.findIndex((a) => a.value === u.value)),
|
|
265
|
+
class: "hys-ui-tabs-content",
|
|
266
|
+
role: "tabpanel",
|
|
267
|
+
"aria-labelledby": s.items.some((a) => a.value === u.value) ? O(s.items.findIndex((a) => a.value === u.value)) : void 0,
|
|
268
|
+
tabindex: "0"
|
|
269
|
+
}, [
|
|
270
|
+
B(e.$slots, "default", { active: u.value }, void 0, !0)
|
|
271
|
+
], 8, Ke)) : k("", !0)
|
|
272
|
+
], 16));
|
|
77
273
|
}
|
|
78
274
|
});
|
|
79
275
|
export {
|
|
80
|
-
|
|
276
|
+
je as default
|
|
81
277
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { defineComponent as V, ref as
|
|
1
|
+
import { defineComponent as V, ref as g, openBlock as m, createElementBlock as f, mergeProps as h, unref as i, Fragment as B, renderList as x, renderSlot as k, createTextVNode as C, toDisplayString as A, createVNode as D, createCommentVNode as N, withDirectives as w, createElementVNode as E, withKeys as y, vModelText as H } from "vue";
|
|
2
|
+
import { useHysControlState as S } from "../../composables/formContext.js";
|
|
2
3
|
import { useHysRootAttrs as T } from "../../config.js";
|
|
3
4
|
import { X as j } from "lucide-vue-next";
|
|
4
|
-
const
|
|
5
|
+
const K = ["aria-disabled"], O = ["disabled", "aria-label", "onClick"], R = ["placeholder", "disabled", "readonly"], L = /* @__PURE__ */ V({
|
|
5
6
|
__name: "HysTagInput",
|
|
6
7
|
props: {
|
|
7
8
|
modelValue: {},
|
|
@@ -14,70 +15,70 @@ const H = ["aria-disabled"], K = ["disabled", "aria-label", "onClick"], O = ["pl
|
|
|
14
15
|
beforeAdd: {}
|
|
15
16
|
},
|
|
16
17
|
emits: ["update:modelValue", "change", "add", "remove", "reject"],
|
|
17
|
-
setup(
|
|
18
|
-
const v = T(),
|
|
19
|
-
function
|
|
20
|
-
if (
|
|
21
|
-
const
|
|
22
|
-
if (!
|
|
23
|
-
const
|
|
24
|
-
for (const
|
|
25
|
-
if (e.includes(
|
|
26
|
-
|
|
18
|
+
setup(a, { emit: b }) {
|
|
19
|
+
const v = T(), l = a, d = b, r = g(""), { disabled: u } = S(l);
|
|
20
|
+
function c() {
|
|
21
|
+
if (u.value || l.readonly) return;
|
|
22
|
+
const n = r.value.trim();
|
|
23
|
+
if (!n) return;
|
|
24
|
+
const t = l.separator ? n.split(l.separator) : [n], e = [...l.modelValue];
|
|
25
|
+
for (const o of t.map((s) => s.trim()).filter(Boolean)) {
|
|
26
|
+
if (e.includes(o) || e.length >= l.max || l.beforeAdd && l.beforeAdd(o) === !1) {
|
|
27
|
+
d("reject", o);
|
|
27
28
|
continue;
|
|
28
29
|
}
|
|
29
|
-
e.push(
|
|
30
|
+
e.push(o), d("add", o);
|
|
30
31
|
}
|
|
31
|
-
|
|
32
|
+
d("update:modelValue", e), d("change", e), r.value = "";
|
|
32
33
|
}
|
|
33
|
-
function
|
|
34
|
-
if (
|
|
35
|
-
const
|
|
36
|
-
|
|
34
|
+
function p(n) {
|
|
35
|
+
if (u.value || l.readonly) return;
|
|
36
|
+
const t = l.modelValue[n], e = l.modelValue.filter((o, s) => s !== n);
|
|
37
|
+
d("update:modelValue", e), d("change", e), d("remove", t);
|
|
37
38
|
}
|
|
38
|
-
return (
|
|
39
|
+
return (n, t) => (m(), f("div", h(i(v), {
|
|
39
40
|
class: "hys-ui-ex-tags",
|
|
40
|
-
"aria-disabled":
|
|
41
|
+
"aria-disabled": i(u)
|
|
41
42
|
}), [
|
|
42
|
-
(
|
|
43
|
+
(m(!0), f(B, null, x(a.modelValue, (e, o) => (m(), f("span", {
|
|
43
44
|
key: e,
|
|
44
45
|
class: "hys-ui-ex-tag"
|
|
45
46
|
}, [
|
|
46
|
-
|
|
47
|
+
k(n.$slots, "tag", {
|
|
47
48
|
value: e,
|
|
48
|
-
index:
|
|
49
|
+
index: o
|
|
49
50
|
}, () => [
|
|
50
|
-
|
|
51
|
+
C(A(e), 1)
|
|
51
52
|
]),
|
|
52
|
-
|
|
53
|
+
a.readonly ? N("", !0) : (m(), f("button", {
|
|
53
54
|
key: 0,
|
|
54
55
|
type: "button",
|
|
55
|
-
disabled:
|
|
56
|
+
disabled: i(u),
|
|
56
57
|
"aria-label": "移除 " + e,
|
|
57
|
-
onClick: (
|
|
58
|
+
onClick: (s) => p(o)
|
|
58
59
|
}, [
|
|
59
|
-
|
|
60
|
-
], 8,
|
|
60
|
+
D(i(j), { size: 14 })
|
|
61
|
+
], 8, O))
|
|
61
62
|
]))), 128)),
|
|
62
|
-
w(
|
|
63
|
-
"onUpdate:modelValue":
|
|
64
|
-
placeholder:
|
|
63
|
+
w(E("input", {
|
|
64
|
+
"onUpdate:modelValue": t[0] || (t[0] = (e) => r.value = e),
|
|
65
|
+
placeholder: a.placeholder,
|
|
65
66
|
"aria-label": "输入标签",
|
|
66
|
-
disabled:
|
|
67
|
-
readonly:
|
|
67
|
+
disabled: i(u) || a.modelValue.length >= a.max,
|
|
68
|
+
readonly: a.readonly,
|
|
68
69
|
onKeydown: [
|
|
69
|
-
|
|
70
|
-
e.isComposing || (e.preventDefault(),
|
|
70
|
+
t[1] || (t[1] = y((e) => {
|
|
71
|
+
e.isComposing || (e.preventDefault(), c());
|
|
71
72
|
}, ["enter"])),
|
|
72
|
-
|
|
73
|
+
t[2] || (t[2] = y((e) => !r.value && a.modelValue.length && !e.isComposing && p(a.modelValue.length - 1), ["backspace"]))
|
|
73
74
|
],
|
|
74
|
-
onBlur:
|
|
75
|
-
}, null, 40,
|
|
76
|
-
[
|
|
75
|
+
onBlur: t[3] || (t[3] = (e) => a.addOnBlur && c())
|
|
76
|
+
}, null, 40, R), [
|
|
77
|
+
[H, r.value]
|
|
77
78
|
])
|
|
78
|
-
], 16,
|
|
79
|
+
], 16, K));
|
|
79
80
|
}
|
|
80
81
|
});
|
|
81
82
|
export {
|
|
82
|
-
|
|
83
|
+
L as default
|
|
83
84
|
};
|