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,323 @@
|
|
|
1
|
+
import { defineComponent as ge, ref as K, useId as xe, computed as k, watch as X, onBeforeUnmount as Ce, onDeactivated as Me, openBlock as d, createElementBlock as x, normalizeStyle as L, normalizeClass as se, unref as l, createElementVNode as Y, Fragment as Te, renderList as He, withModifiers as Z, renderSlot as A, mergeProps as O, createBlock as U, resolveDynamicComponent as Ne, createCommentVNode as V, createTextVNode as ne, toDisplayString as q, nextTick as _ } from "vue";
|
|
2
|
+
import { LoaderCircle as ze, ChevronDown as De, ChevronRight as Be, Check as Ee } from "lucide-vue-next";
|
|
3
|
+
import Ae from "../HysCheckbox/HysCheckbox.vue.js";
|
|
4
|
+
const Fe = ["id", "aria-label", "aria-multiselectable", "aria-busy"], Ie = ["id", "aria-level", "aria-posinset", "aria-setsize", "aria-expanded", "aria-selected", "aria-checked", "aria-disabled", "tabindex", "data-tree-select-key", "onClick", "onKeydown", "onFocus"], Se = ["disabled", "aria-label", "onClick"], $e = {
|
|
5
|
+
key: 1,
|
|
6
|
+
class: "hys-ui-tree-select-spacer"
|
|
7
|
+
}, Re = {
|
|
8
|
+
key: 3,
|
|
9
|
+
class: "hys-ui-tree-select-icon",
|
|
10
|
+
"aria-hidden": "true"
|
|
11
|
+
}, Ke = { class: "hys-ui-tree-select-label" }, Le = ["disabled", "onClick"], Oe = {
|
|
12
|
+
key: 0,
|
|
13
|
+
class: "hys-ui-tree-select-empty"
|
|
14
|
+
}, Pe = /* @__PURE__ */ ge({
|
|
15
|
+
__name: "HysTreeSelectPanel",
|
|
16
|
+
props: {
|
|
17
|
+
store: {},
|
|
18
|
+
size: {},
|
|
19
|
+
treeId: {},
|
|
20
|
+
checkable: { type: Boolean },
|
|
21
|
+
checkStrictly: { type: Boolean },
|
|
22
|
+
leafOnly: { type: Boolean },
|
|
23
|
+
expandOnClickNode: { type: Boolean },
|
|
24
|
+
showLine: { type: Boolean },
|
|
25
|
+
showIcon: { type: Boolean, default: !0 },
|
|
26
|
+
indent: { default: 18 },
|
|
27
|
+
listHeight: { default: 256 },
|
|
28
|
+
virtual: { type: Boolean },
|
|
29
|
+
itemHeight: { default: 36 },
|
|
30
|
+
overscan: { default: 4 }
|
|
31
|
+
},
|
|
32
|
+
emits: ["choose", "scroll"],
|
|
33
|
+
setup(o, { expose: oe, emit: ue }) {
|
|
34
|
+
const s = o, w = ue, F = s.store, { tree: h, busy: u, words: m, query: N } = F, {
|
|
35
|
+
index: P,
|
|
36
|
+
visible: y,
|
|
37
|
+
expanded: z,
|
|
38
|
+
checked: I,
|
|
39
|
+
halfChecked: j,
|
|
40
|
+
loadingKeys: G,
|
|
41
|
+
failures: ce,
|
|
42
|
+
selection: S,
|
|
43
|
+
matches: de
|
|
44
|
+
} = h, c = K(), p = K(null), C = K(0), $ = K(0), re = xe(), b = k(
|
|
45
|
+
() => Number.isFinite(s.itemHeight) ? Math.min(240, Math.max(24, s.itemHeight)) : 36
|
|
46
|
+
), D = k(
|
|
47
|
+
() => Number.isFinite(s.listHeight) ? Math.min(1200, Math.max(80, s.listHeight)) : 256
|
|
48
|
+
), ee = k(
|
|
49
|
+
() => Number.isFinite(s.overscan) ? Math.min(30, Math.max(0, Math.floor(s.overscan))) : 4
|
|
50
|
+
), he = k(
|
|
51
|
+
() => Number.isFinite(s.indent) ? Math.min(80, Math.max(0, s.indent)) : 18
|
|
52
|
+
), f = k(() => y.value.filter((e) => !e.disabled)), te = k(
|
|
53
|
+
() => s.virtual ? Math.max(0, Math.floor(C.value / b.value) - ee.value) : 0
|
|
54
|
+
), ye = k(
|
|
55
|
+
() => s.virtual ? Math.min(
|
|
56
|
+
y.value.length,
|
|
57
|
+
Math.ceil(
|
|
58
|
+
(C.value + ($.value || D.value)) / b.value
|
|
59
|
+
) + ee.value
|
|
60
|
+
) : y.value.length
|
|
61
|
+
), ve = k(() => y.value.slice(te.value, ye.value)), H = k(
|
|
62
|
+
() => {
|
|
63
|
+
var e;
|
|
64
|
+
return p.value !== null && y.value.some((a) => a.key === p.value && !a.disabled) ? p.value : (e = f.value[0]) == null ? void 0 : e.key;
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
let B = 0, g, J = 0, M = !0;
|
|
68
|
+
const R = /* @__PURE__ */ new Map();
|
|
69
|
+
function ke(e, a) {
|
|
70
|
+
a instanceof HTMLElement ? R.set(e, a) : R.delete(e);
|
|
71
|
+
}
|
|
72
|
+
const ae = (e) => re + "-" + typeof e + "-" + String(e);
|
|
73
|
+
X([c, () => s.virtual], () => {
|
|
74
|
+
g == null || g.disconnect(), c.value && s.virtual && typeof ResizeObserver < "u" && (g = new ResizeObserver(
|
|
75
|
+
(e) => {
|
|
76
|
+
var a;
|
|
77
|
+
return $.value = ((a = e[0]) == null ? void 0 : a.contentRect.height) || 0;
|
|
78
|
+
}
|
|
79
|
+
), g.observe(c.value));
|
|
80
|
+
}), X(N, () => {
|
|
81
|
+
var e;
|
|
82
|
+
C.value = 0, c.value && (c.value.scrollTop = 0), p.value = ((e = f.value[0]) == null ? void 0 : e.key) ?? null;
|
|
83
|
+
}), X(
|
|
84
|
+
() => y.value.length,
|
|
85
|
+
() => {
|
|
86
|
+
const e = Math.max(
|
|
87
|
+
0,
|
|
88
|
+
y.value.length * b.value - ($.value || D.value)
|
|
89
|
+
);
|
|
90
|
+
s.virtual && C.value > e && (C.value = e, c.value && (c.value.scrollTop = e));
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
function fe(e) {
|
|
94
|
+
!M || !c.value || (s.virtual && !B && (B = requestAnimationFrame(() => {
|
|
95
|
+
B = 0, c.value && (C.value = c.value.scrollTop);
|
|
96
|
+
})), w("scroll", e));
|
|
97
|
+
}
|
|
98
|
+
async function le(e) {
|
|
99
|
+
if (!M) return;
|
|
100
|
+
e.key !== void 0 && (await h.setExpandedKeys([
|
|
101
|
+
.../* @__PURE__ */ new Set([...h.rawExpanded.value, ...h.ancestors(e.key)])
|
|
102
|
+
]), await _());
|
|
103
|
+
const a = c.value;
|
|
104
|
+
if (!a || !M) return;
|
|
105
|
+
let t = e.top ?? a.scrollTop;
|
|
106
|
+
if (e.key !== void 0) {
|
|
107
|
+
const i = y.value.findIndex((n) => n.key === e.key);
|
|
108
|
+
if (i < 0) return;
|
|
109
|
+
if (s.virtual) {
|
|
110
|
+
const n = i * b.value, r = n + b.value, v = $.value || D.value;
|
|
111
|
+
t = e.align === "top" ? n : e.align === "bottom" ? r - v : n < a.scrollTop ? n : r > a.scrollTop + v ? r - v : a.scrollTop;
|
|
112
|
+
} else {
|
|
113
|
+
const n = R.get(e.key);
|
|
114
|
+
if (n) {
|
|
115
|
+
const r = n.getBoundingClientRect().top - a.getBoundingClientRect().top + a.scrollTop, v = r + n.offsetHeight;
|
|
116
|
+
t = e.align === "top" ? r : e.align === "bottom" ? v - a.clientHeight : r < a.scrollTop ? r : v > a.scrollTop + a.clientHeight ? v - a.clientHeight : a.scrollTop;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
t = Number.isFinite(t) ? Math.max(0, t) : 0, a.scrollTop = t, C.value = a.scrollTop, await _();
|
|
121
|
+
}
|
|
122
|
+
async function E(e) {
|
|
123
|
+
var i, n;
|
|
124
|
+
if (u.value || !M) return;
|
|
125
|
+
const a = e ?? H.value;
|
|
126
|
+
if (a === void 0 || (i = P.value.map.get(a)) != null && i.disabled) return;
|
|
127
|
+
const t = ++J;
|
|
128
|
+
p.value = a, await le({ key: a }), !(!M || u.value || t !== J) && (await _(), (n = R.get(a)) == null || n.focus({ preventScroll: !!s.virtual }));
|
|
129
|
+
}
|
|
130
|
+
function T(e) {
|
|
131
|
+
return {
|
|
132
|
+
node: F.rawNode(e.node),
|
|
133
|
+
key: e.key,
|
|
134
|
+
label: e.label,
|
|
135
|
+
depth: e.depth,
|
|
136
|
+
expanded: z.value.has(e.key) || !!N.value.trim(),
|
|
137
|
+
selected: S.value.has(e.key),
|
|
138
|
+
checked: I.value.has(e.key),
|
|
139
|
+
indeterminate: j.value.has(e.key),
|
|
140
|
+
disabled: u.value || e.disabled,
|
|
141
|
+
loading: G.value.has(e.key),
|
|
142
|
+
leaf: !e.hasChildren
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
async function Q(e, a) {
|
|
146
|
+
u.value || e.disabled || (await F.pick(e, a), M && w("choose", e.key));
|
|
147
|
+
}
|
|
148
|
+
function me(e, a) {
|
|
149
|
+
e.target instanceof Element && e.target.closest(
|
|
150
|
+
"button,input,a,textarea,select,[contenteditable=true]"
|
|
151
|
+
) || (p.value = a.key, Q(a, e), s.expandOnClickNode && a.hasChildren && !s.leafOnly && h.expandNode(a.key, !z.value.has(a.key)));
|
|
152
|
+
}
|
|
153
|
+
function pe(e, a) {
|
|
154
|
+
var r, v;
|
|
155
|
+
if (e.isComposing || e.keyCode === 229 || u.value) return;
|
|
156
|
+
const t = e.target;
|
|
157
|
+
if (t != null && t.matches("input:not([type=checkbox]),textarea,select") || t != null && t.closest("[contenteditable=true],a") || t != null && t.closest("button") && !t.closest(".hys-ui-tree-select-toggle") || t != null && t.matches("input[type=checkbox]") && ["Enter", " "].includes(e.key) || t != null && t.closest(".hys-ui-tree-select-toggle") && ["Enter", " "].includes(e.key))
|
|
158
|
+
return;
|
|
159
|
+
const i = a ?? P.value.map.get(H.value);
|
|
160
|
+
if (!i) return;
|
|
161
|
+
const n = f.value.findIndex((W) => W.key === i.key);
|
|
162
|
+
if (["ArrowDown", "ArrowUp", "Home", "End"].includes(e.key)) {
|
|
163
|
+
e.preventDefault();
|
|
164
|
+
const W = e.key === "Home" ? 0 : e.key === "End" ? f.value.length - 1 : Math.max(
|
|
165
|
+
0,
|
|
166
|
+
Math.min(
|
|
167
|
+
f.value.length - 1,
|
|
168
|
+
n + (e.key === "ArrowDown" ? 1 : -1)
|
|
169
|
+
)
|
|
170
|
+
);
|
|
171
|
+
E((r = f.value[W]) == null ? void 0 : r.key);
|
|
172
|
+
} else e.key === "ArrowRight" ? (e.preventDefault(), i.hasChildren && !z.value.has(i.key) ? h.expandNode(i.key) : i.hasChildren && E((v = f.value[n + 1]) == null ? void 0 : v.key)) : e.key === "ArrowLeft" ? (e.preventDefault(), i.hasChildren && z.value.has(i.key) ? h.expandNode(i.key, !1) : i.parent !== void 0 && E(i.parent)) : (e.key === "Enter" || e.key === " ") && (e.preventDefault(), Q(i, e));
|
|
173
|
+
}
|
|
174
|
+
async function be(e) {
|
|
175
|
+
var a, t;
|
|
176
|
+
if (!(e.isComposing || e.keyCode === 229)) {
|
|
177
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp")
|
|
178
|
+
e.preventDefault(), await E(
|
|
179
|
+
e.key === "ArrowUp" ? (a = f.value.at(-1)) == null ? void 0 : a.key : (t = f.value[0]) == null ? void 0 : t.key
|
|
180
|
+
);
|
|
181
|
+
else if (e.key === "Enter") {
|
|
182
|
+
e.preventDefault();
|
|
183
|
+
const i = P.value.map.get(H.value);
|
|
184
|
+
i && await Q(i, e);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
function ie() {
|
|
189
|
+
M = !1, J++, cancelAnimationFrame(B), B = 0, g == null || g.disconnect();
|
|
190
|
+
}
|
|
191
|
+
return Ce(ie), Me(ie), oe({
|
|
192
|
+
focus: E,
|
|
193
|
+
scrollTo: le,
|
|
194
|
+
searchKeys: be,
|
|
195
|
+
activeId: k(
|
|
196
|
+
() => H.value === void 0 ? void 0 : ae(H.value)
|
|
197
|
+
),
|
|
198
|
+
setActive: (e) => p.value = e
|
|
199
|
+
}), (e, a) => (d(), x("div", {
|
|
200
|
+
ref_key: "port",
|
|
201
|
+
ref: c,
|
|
202
|
+
id: o.treeId,
|
|
203
|
+
role: "tree",
|
|
204
|
+
"aria-label": l(m).tree,
|
|
205
|
+
"aria-multiselectable": l(F).multiple.value || void 0,
|
|
206
|
+
"aria-busy": l(u) || l(G).size > 0 || void 0,
|
|
207
|
+
class: se(["hys-ui-tree-select-list", { "hys-ui-tree-select-virtual": o.virtual }]),
|
|
208
|
+
style: L({
|
|
209
|
+
maxHeight: D.value + "px",
|
|
210
|
+
height: o.virtual ? D.value + "px" : void 0,
|
|
211
|
+
"--hys-ui-tree-select-height": b.value + "px",
|
|
212
|
+
"--hys-ui-tree-select-indent": he.value + "px"
|
|
213
|
+
}),
|
|
214
|
+
onScroll: fe
|
|
215
|
+
}, [
|
|
216
|
+
Y("div", {
|
|
217
|
+
class: "hys-ui-tree-select-space",
|
|
218
|
+
style: L(o.virtual ? { height: l(y).length * b.value + "px" } : void 0)
|
|
219
|
+
}, [
|
|
220
|
+
Y("div", {
|
|
221
|
+
class: "hys-ui-tree-select-rows",
|
|
222
|
+
style: L(
|
|
223
|
+
o.virtual ? {
|
|
224
|
+
position: "absolute",
|
|
225
|
+
top: te.value * b.value + "px",
|
|
226
|
+
insetInline: "0"
|
|
227
|
+
} : void 0
|
|
228
|
+
)
|
|
229
|
+
}, [
|
|
230
|
+
(d(!0), x(Te, null, He(ve.value, (t) => (d(), x("div", {
|
|
231
|
+
id: ae(t.key),
|
|
232
|
+
key: typeof t.key + ":" + t.key,
|
|
233
|
+
ref_for: !0,
|
|
234
|
+
ref: (i) => ke(t.key, i),
|
|
235
|
+
role: "treeitem",
|
|
236
|
+
"aria-level": t.depth + 1,
|
|
237
|
+
"aria-posinset": t.pos,
|
|
238
|
+
"aria-setsize": t.size,
|
|
239
|
+
"aria-expanded": t.hasChildren ? T(t).expanded : void 0,
|
|
240
|
+
"aria-selected": !o.checkable && t.selectable ? l(S).has(t.key) : void 0,
|
|
241
|
+
"aria-checked": o.checkable && t.checkable ? l(j).has(t.key) ? "mixed" : l(I).has(t.key) : void 0,
|
|
242
|
+
"aria-disabled": l(u) || t.disabled || void 0,
|
|
243
|
+
tabindex: !l(u) && H.value === t.key ? 0 : -1,
|
|
244
|
+
"data-tree-select-key": typeof t.key + ":" + t.key,
|
|
245
|
+
class: se(["hys-ui-tree-select-row", {
|
|
246
|
+
"hys-ui-tree-select-selected": o.checkable ? l(I).has(t.key) : l(S).has(t.key),
|
|
247
|
+
"hys-ui-tree-select-disabled": t.disabled,
|
|
248
|
+
"hys-ui-tree-select-line": o.showLine,
|
|
249
|
+
"hys-ui-tree-select-match": l(N).trim() && l(de).has(t.key)
|
|
250
|
+
}]),
|
|
251
|
+
style: L({ "--hys-ui-tree-select-depth": t.depth }),
|
|
252
|
+
onClick: (i) => me(i, t),
|
|
253
|
+
onKeydown: (i) => pe(i, t),
|
|
254
|
+
onFocus: (i) => p.value = t.key
|
|
255
|
+
}, [
|
|
256
|
+
t.hasChildren ? (d(), x("button", {
|
|
257
|
+
key: 0,
|
|
258
|
+
class: "hys-ui-tree-select-toggle",
|
|
259
|
+
type: "button",
|
|
260
|
+
tabindex: "-1",
|
|
261
|
+
disabled: l(u) || t.disabled,
|
|
262
|
+
"aria-label": (T(t).expanded ? l(m).collapse : l(m).expand) + " " + t.label,
|
|
263
|
+
onClick: Z((i) => l(h).expandNode(t.key, !l(z).has(t.key)), ["stop"])
|
|
264
|
+
}, [
|
|
265
|
+
A(e.$slots, "switcher", O({ ref_for: !0 }, T(t)), () => [
|
|
266
|
+
l(G).has(t.key) ? (d(), U(l(ze), {
|
|
267
|
+
key: 0,
|
|
268
|
+
size: 14,
|
|
269
|
+
class: "hys-ui-icon-spin"
|
|
270
|
+
})) : (d(), U(Ne(T(t).expanded ? l(De) : l(Be)), {
|
|
271
|
+
key: 1,
|
|
272
|
+
size: 14
|
|
273
|
+
}))
|
|
274
|
+
], !0)
|
|
275
|
+
], 8, Se)) : (d(), x("span", $e, [
|
|
276
|
+
A(e.$slots, "switcher", O({ ref_for: !0 }, T(t)), void 0, !0)
|
|
277
|
+
])),
|
|
278
|
+
o.checkable && t.checkable ? (d(), U(Ae, {
|
|
279
|
+
key: 2,
|
|
280
|
+
"model-value": l(I).has(t.key),
|
|
281
|
+
indeterminate: l(j).has(t.key),
|
|
282
|
+
disabled: l(u) || t.checkboxDisabled,
|
|
283
|
+
"aria-label": l(m).check + " " + t.label,
|
|
284
|
+
tabindex: -1,
|
|
285
|
+
size: o.size,
|
|
286
|
+
onClick: a[0] || (a[0] = Z(() => {
|
|
287
|
+
}, ["stop"])),
|
|
288
|
+
"onUpdate:modelValue": (i) => l(h).setChecked(t.key, i, !o.checkStrictly)
|
|
289
|
+
}, null, 8, ["model-value", "indeterminate", "disabled", "aria-label", "size", "onUpdate:modelValue"])) : V("", !0),
|
|
290
|
+
o.showIcon && e.$slots.icon ? (d(), x("span", Re, [
|
|
291
|
+
A(e.$slots, "icon", O({ ref_for: !0 }, T(t)), void 0, !0)
|
|
292
|
+
])) : V("", !0),
|
|
293
|
+
Y("span", Ke, [
|
|
294
|
+
A(e.$slots, "option", O({ ref_for: !0 }, T(t)), () => [
|
|
295
|
+
ne(q(t.label), 1)
|
|
296
|
+
], !0)
|
|
297
|
+
]),
|
|
298
|
+
l(ce).has(t.key) ? (d(), x("button", {
|
|
299
|
+
key: 4,
|
|
300
|
+
class: "hys-ui-tree-select-retry",
|
|
301
|
+
type: "button",
|
|
302
|
+
disabled: l(u),
|
|
303
|
+
onClick: Z((i) => l(h).reloadNode(t.key), ["stop"])
|
|
304
|
+
}, q(l(m).loadError) + " · " + q(l(m).retry), 9, Le)) : !o.checkable && l(S).has(t.key) ? (d(), U(l(Ee), {
|
|
305
|
+
key: 5,
|
|
306
|
+
size: 15,
|
|
307
|
+
class: "hys-ui-tree-select-check",
|
|
308
|
+
"aria-hidden": "true"
|
|
309
|
+
})) : V("", !0)
|
|
310
|
+
], 46, Ie))), 128))
|
|
311
|
+
], 4)
|
|
312
|
+
], 4),
|
|
313
|
+
!l(y).length && !l(u) ? (d(), x("div", Oe, [
|
|
314
|
+
A(e.$slots, "empty", { query: l(N) }, () => [
|
|
315
|
+
ne(q(l(N).trim() ? l(m).noMatch : l(m).empty), 1)
|
|
316
|
+
], !0)
|
|
317
|
+
])) : V("", !0)
|
|
318
|
+
], 46, Fe));
|
|
319
|
+
}
|
|
320
|
+
});
|
|
321
|
+
export {
|
|
322
|
+
Pe as default
|
|
323
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./HysUpload2.vue.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const
|
|
4
|
+
const f = /* @__PURE__ */ t(o, [["__scopeId", "data-v-41868bf4"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
f as default
|
|
7
7
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { defineComponent as L, ref as g, watch as N, onActivated as V, onDeactivated as W, onBeforeUnmount as E, openBlock as b, createElementBlock as h, normalizeProps as H, guardReactiveProps as R, unref as i, createElementVNode as c, withModifiers as k, withKeys as x, normalizeClass as T, renderSlot as U, createVNode as z, toDisplayString as $, Fragment as K, renderList as P, createTextVNode as I, createCommentVNode as M } from "vue";
|
|
2
|
+
import { useHysControlState as X } from "../../composables/formContext.js";
|
|
3
|
+
import { CloudUpload as j, FileText as q, X as G } from "lucide-vue-next";
|
|
4
|
+
import { useHysRootAttrs as J } from "../../config.js";
|
|
5
|
+
const O = ["aria-disabled", "tabindex"], Q = ["accept", "multiple", "disabled"], Y = { key: 0 }, Z = ["aria-label", "disabled", "onClick"], le = /* @__PURE__ */ L({
|
|
5
6
|
__name: "HysUpload",
|
|
6
7
|
props: {
|
|
7
8
|
accept: {},
|
|
@@ -14,115 +15,133 @@ const H = ["aria-disabled", "tabindex"], K = ["accept", "multiple", "disabled"],
|
|
|
14
15
|
beforeUpload: {}
|
|
15
16
|
},
|
|
16
17
|
emits: ["change", "remove", "exceed", "error", "select"],
|
|
17
|
-
setup(
|
|
18
|
-
const
|
|
19
|
-
function
|
|
20
|
-
return !
|
|
18
|
+
setup(m, { expose: B, emit: D }) {
|
|
19
|
+
const r = m, { disabled: n } = X(r), o = D, S = J(), u = g([]), s = g(), p = g(!1), v = g(!1);
|
|
20
|
+
function A(l) {
|
|
21
|
+
return !r.accept || r.accept.split(",").some((e) => (e = e.trim().toLowerCase(), e.startsWith(".") ? l.name.toLowerCase().endsWith(e) : e.endsWith("/*") ? l.type.startsWith(e.slice(0, -1)) : l.type === e));
|
|
21
22
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
let f = 0, d = !0;
|
|
24
|
+
function y() {
|
|
25
|
+
f++, v.value = !1, p.value = !1, s.value && (s.value.value = "");
|
|
26
|
+
}
|
|
27
|
+
N(() => n.value, y), V(() => {
|
|
28
|
+
d = !0;
|
|
29
|
+
}), W(() => {
|
|
30
|
+
d = !1, y();
|
|
31
|
+
}), E(() => {
|
|
32
|
+
d = !1, y();
|
|
33
|
+
});
|
|
34
|
+
async function w(l) {
|
|
35
|
+
if (!d || n.value || v.value) return;
|
|
36
|
+
if (r.multiple || (l = l.slice(0, 1)), r.limit && (r.multiple ? u.value.length : 0) + l.length > r.limit) {
|
|
37
|
+
o("exceed", l);
|
|
26
38
|
return;
|
|
27
39
|
}
|
|
28
|
-
|
|
29
|
-
|
|
40
|
+
const e = ++f;
|
|
41
|
+
v.value = !0;
|
|
42
|
+
const a = [];
|
|
30
43
|
try {
|
|
31
|
-
for (const t of
|
|
32
|
-
if (
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
44
|
+
for (const t of l) {
|
|
45
|
+
if (!d || e !== f || n.value) return;
|
|
46
|
+
try {
|
|
47
|
+
if (!A(t)) {
|
|
48
|
+
o("error", "文件类型不符合要求:" + t.name);
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
if (r.maxSize && t.size > r.maxSize) {
|
|
52
|
+
o("error", "文件超过大小限制:" + t.name);
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
if (r.beforeUpload && await r.beforeUpload(t) === !1) continue;
|
|
56
|
+
if (!d || e !== f || n.value) return;
|
|
57
|
+
a.push({ uid: crypto.randomUUID(), name: t.name, size: t.size, raw: t });
|
|
58
|
+
} catch (C) {
|
|
59
|
+
d && e === f && o("error", C instanceof Error ? C.message : "文件检查失败");
|
|
39
60
|
}
|
|
40
|
-
i.beforeUpload && await i.beforeUpload(t) === !1 || e.push({ uid: crypto.randomUUID(), name: t.name, size: t.size, raw: t });
|
|
41
61
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
r("error", t instanceof Error ? t.message : "文件检查失败");
|
|
62
|
+
if (!d || e !== f || n.value || !a.length) return;
|
|
63
|
+
u.value = r.multiple ? [...u.value, ...a] : a, a.length && (o("select", a.map((t) => t.raw)), o("change", [...u.value]));
|
|
45
64
|
} finally {
|
|
46
|
-
|
|
65
|
+
e === f && (v.value = !1, s.value && (s.value.value = ""));
|
|
47
66
|
}
|
|
48
67
|
}
|
|
49
|
-
function
|
|
50
|
-
|
|
68
|
+
function F(l) {
|
|
69
|
+
n.value || (u.value = u.value.filter((e) => e.uid !== l.uid), o("remove", l), o("change", [...u.value]));
|
|
51
70
|
}
|
|
52
|
-
return
|
|
53
|
-
|
|
71
|
+
return B({ clearFiles: () => {
|
|
72
|
+
y(), u.value = [], o("change", []);
|
|
54
73
|
}, open: () => {
|
|
55
|
-
var
|
|
56
|
-
|
|
57
|
-
} }), (
|
|
58
|
-
|
|
59
|
-
class:
|
|
74
|
+
var l;
|
|
75
|
+
d && !n.value && !v.value && ((l = s.value) == null || l.click());
|
|
76
|
+
} }), (l, e) => (b(), h("div", H(R(i(S))), [
|
|
77
|
+
c("div", {
|
|
78
|
+
class: T(["hys-ui-upload-zone", { "hys-ui-upload-dragging": p.value }]),
|
|
60
79
|
role: "button",
|
|
61
|
-
"aria-disabled":
|
|
62
|
-
tabindex:
|
|
80
|
+
"aria-disabled": i(n) || v.value,
|
|
81
|
+
tabindex: i(n) ? -1 : 0,
|
|
63
82
|
"aria-label": "选择上传文件",
|
|
64
|
-
onClick: e[0] || (e[0] = (
|
|
65
|
-
var
|
|
66
|
-
return !
|
|
83
|
+
onClick: e[0] || (e[0] = (a) => {
|
|
84
|
+
var t;
|
|
85
|
+
return !i(n) && ((t = s.value) == null ? void 0 : t.click());
|
|
67
86
|
}),
|
|
68
87
|
onKeydown: [
|
|
69
|
-
e[1] || (e[1] =
|
|
70
|
-
var
|
|
71
|
-
return !
|
|
88
|
+
e[1] || (e[1] = x(k((a) => {
|
|
89
|
+
var t;
|
|
90
|
+
return !i(n) && ((t = s.value) == null ? void 0 : t.click());
|
|
72
91
|
}, ["prevent"]), ["enter"])),
|
|
73
|
-
e[2] || (e[2] =
|
|
74
|
-
var
|
|
75
|
-
return !
|
|
92
|
+
e[2] || (e[2] = x(k((a) => {
|
|
93
|
+
var t;
|
|
94
|
+
return !i(n) && ((t = s.value) == null ? void 0 : t.click());
|
|
76
95
|
}, ["prevent"]), ["space"]))
|
|
77
96
|
],
|
|
78
|
-
onDragover: e[3] || (e[3] =
|
|
79
|
-
onDragleave: e[4] || (e[4] = (
|
|
80
|
-
onDrop: e[5] || (e[5] =
|
|
81
|
-
var
|
|
82
|
-
|
|
97
|
+
onDragover: e[3] || (e[3] = k((a) => m.drag && !i(n) && (p.value = !0), ["prevent"])),
|
|
98
|
+
onDragleave: e[4] || (e[4] = (a) => p.value = !1),
|
|
99
|
+
onDrop: e[5] || (e[5] = k((a) => {
|
|
100
|
+
var t;
|
|
101
|
+
p.value = !1, m.drag && w(Array.from(((t = a.dataTransfer) == null ? void 0 : t.files) || []));
|
|
83
102
|
}, ["prevent"]))
|
|
84
103
|
}, [
|
|
85
|
-
|
|
86
|
-
|
|
104
|
+
U(l.$slots, "default", {}, () => [
|
|
105
|
+
z(i(j), {
|
|
87
106
|
size: 28,
|
|
88
107
|
"aria-hidden": "true"
|
|
89
108
|
}),
|
|
90
|
-
|
|
91
|
-
e[7] || (e[7] =
|
|
109
|
+
c("strong", null, $(v.value ? "正在检查文件…" : "点击选择或拖入文件"), 1),
|
|
110
|
+
e[7] || (e[7] = c("span", null, "文件通过事件交给业务层上传", -1))
|
|
92
111
|
], !0)
|
|
93
|
-
], 42,
|
|
94
|
-
|
|
112
|
+
], 42, O),
|
|
113
|
+
c("input", {
|
|
95
114
|
ref_key: "input",
|
|
96
|
-
ref:
|
|
115
|
+
ref: s,
|
|
97
116
|
hidden: "",
|
|
98
117
|
type: "file",
|
|
99
|
-
accept:
|
|
100
|
-
multiple:
|
|
101
|
-
disabled:
|
|
102
|
-
onChange: e[6] || (e[6] = (
|
|
103
|
-
}, null, 40,
|
|
104
|
-
|
|
105
|
-
(
|
|
106
|
-
key:
|
|
118
|
+
accept: m.accept,
|
|
119
|
+
multiple: m.multiple,
|
|
120
|
+
disabled: i(n) || v.value,
|
|
121
|
+
onChange: e[6] || (e[6] = (a) => w(Array.from(a.target.files || [])))
|
|
122
|
+
}, null, 40, Q),
|
|
123
|
+
m.showFileList ? (b(), h("div", Y, [
|
|
124
|
+
(b(!0), h(K, null, P(u.value, (a) => (b(), h("div", {
|
|
125
|
+
key: a.uid,
|
|
107
126
|
class: "hys-ui-upload-file"
|
|
108
127
|
}, [
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
128
|
+
z(i(q), { size: 16 }),
|
|
129
|
+
U(l.$slots, "file", { file: a }, () => [
|
|
130
|
+
I($(a.name), 1)
|
|
112
131
|
], !0),
|
|
113
|
-
|
|
132
|
+
c("button", {
|
|
114
133
|
type: "button",
|
|
115
|
-
"aria-label": "移除" +
|
|
116
|
-
disabled:
|
|
117
|
-
onClick: (
|
|
134
|
+
"aria-label": "移除" + a.name,
|
|
135
|
+
disabled: i(n),
|
|
136
|
+
onClick: (t) => F(a)
|
|
118
137
|
}, [
|
|
119
|
-
|
|
120
|
-
], 8,
|
|
138
|
+
z(i(G), { size: 14 })
|
|
139
|
+
], 8, Z)
|
|
121
140
|
]))), 128))
|
|
122
|
-
])) :
|
|
141
|
+
])) : M("", !0)
|
|
123
142
|
], 16));
|
|
124
143
|
}
|
|
125
144
|
});
|
|
126
145
|
export {
|
|
127
|
-
|
|
146
|
+
le as default
|
|
128
147
|
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
function k(l, n = "value", e = "label") {
|
|
2
|
+
return typeof l == "string" ? l : String(l[n] ?? l.value ?? l[e] ?? l.label ?? "");
|
|
3
|
+
}
|
|
4
|
+
function S(l, n, e) {
|
|
5
|
+
const c = (t) => e.caseSensitive ? t : t.toLocaleLowerCase(), p = c(n);
|
|
6
|
+
function y(t, g = "", b = !1) {
|
|
7
|
+
return t.flatMap((o, h) => {
|
|
8
|
+
if (typeof o != "string" && (!o || typeof o != "object" || Array.isArray(o)))
|
|
9
|
+
return [];
|
|
10
|
+
const i = g + h, r = typeof o == "string" ? void 0 : o, s = r && (Array.isArray(r.options) ? r.options : Array.isArray(r.children) ? r.children : void 0);
|
|
11
|
+
if (s) {
|
|
12
|
+
const f = r, A = y(s, i + "-", b || !!f.disabled);
|
|
13
|
+
return A.length ? [
|
|
14
|
+
{
|
|
15
|
+
key: i,
|
|
16
|
+
kind: "group",
|
|
17
|
+
label: String(f.label ?? ""),
|
|
18
|
+
value: "",
|
|
19
|
+
disabled: !0,
|
|
20
|
+
item: "",
|
|
21
|
+
group: f
|
|
22
|
+
},
|
|
23
|
+
...A
|
|
24
|
+
] : [];
|
|
25
|
+
}
|
|
26
|
+
const a = o, u = k(a, e.valueKey, e.labelKey), v = typeof a == "string" ? a : String(a[e.labelKey] ?? a.label ?? u);
|
|
27
|
+
let d = !0;
|
|
28
|
+
try {
|
|
29
|
+
d = typeof e.filter == "function" ? e.filter(n, a) : !e.filter || !n || c(v).includes(p) || c(u).includes(p);
|
|
30
|
+
} catch {
|
|
31
|
+
d = !1;
|
|
32
|
+
}
|
|
33
|
+
return d ? [
|
|
34
|
+
{
|
|
35
|
+
key: i,
|
|
36
|
+
kind: "option",
|
|
37
|
+
label: v,
|
|
38
|
+
value: u,
|
|
39
|
+
disabled: b || !!(r && r.disabled),
|
|
40
|
+
item: a
|
|
41
|
+
}
|
|
42
|
+
] : [];
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
return y(l);
|
|
46
|
+
}
|
|
47
|
+
export {
|
|
48
|
+
k as autocompleteValue,
|
|
49
|
+
S as normalizeAutocomplete
|
|
50
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { ref as f, watch as d, onActivated as s, onDeactivated as c, onBeforeUnmount as p, computed as b } from "vue";
|
|
2
|
+
const h = Symbol(
|
|
3
|
+
"hys-ui-avatar-group"
|
|
4
|
+
), y = [
|
|
5
|
+
["xs", 0],
|
|
6
|
+
["sm", 576],
|
|
7
|
+
["md", 768],
|
|
8
|
+
["lg", 992],
|
|
9
|
+
["xl", 1200],
|
|
10
|
+
["xxl", 1600]
|
|
11
|
+
], l = f(0), a = /* @__PURE__ */ new Set();
|
|
12
|
+
let o;
|
|
13
|
+
function m() {
|
|
14
|
+
o = void 0, l.value = window.innerWidth;
|
|
15
|
+
}
|
|
16
|
+
function u() {
|
|
17
|
+
o === void 0 && (o = requestAnimationFrame(m));
|
|
18
|
+
}
|
|
19
|
+
function w(e, i) {
|
|
20
|
+
let t = typeof e == "object" ? void 0 : e;
|
|
21
|
+
if (e && typeof e == "object")
|
|
22
|
+
for (const [n, r] of y)
|
|
23
|
+
i >= r && e[n] !== void 0 && (t = e[n]);
|
|
24
|
+
return typeof t == "string" && (t = {
|
|
25
|
+
sm: 24,
|
|
26
|
+
small: 24,
|
|
27
|
+
md: 36,
|
|
28
|
+
medium: 36,
|
|
29
|
+
default: 36,
|
|
30
|
+
lg: 48,
|
|
31
|
+
large: 48
|
|
32
|
+
}[t]), typeof t == "number" && Number.isFinite(t) ? Math.max(1, Math.min(1024, t)) : 36;
|
|
33
|
+
}
|
|
34
|
+
function x(e) {
|
|
35
|
+
const i = f(!0), t = Symbol();
|
|
36
|
+
let n = !1;
|
|
37
|
+
function r() {
|
|
38
|
+
n && (n = !1, a.delete(t), a.size || (window.removeEventListener("resize", u), o !== void 0 && cancelAnimationFrame(o), o = void 0));
|
|
39
|
+
}
|
|
40
|
+
function v() {
|
|
41
|
+
if (!i.value || !e.value || typeof e.value != "object") {
|
|
42
|
+
r();
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
n || (n = !0, a.add(t), a.size === 1 && (m(), window.addEventListener("resize", u)));
|
|
46
|
+
}
|
|
47
|
+
return d([i, () => !!e.value && typeof e.value == "object"], v, {
|
|
48
|
+
immediate: !0
|
|
49
|
+
}), s(() => i.value = !0), c(() => {
|
|
50
|
+
i.value = !1, r();
|
|
51
|
+
}), p(r), b(() => w(e.value, l.value));
|
|
52
|
+
}
|
|
53
|
+
export {
|
|
54
|
+
h as avatarGroupKey,
|
|
55
|
+
w as resolveAvatarSize,
|
|
56
|
+
x as useAvatarSize
|
|
57
|
+
};
|