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
|
@@ -1,4 +1,223 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { defineComponent as ae, useAttrs as te, inject as le, ref as m, computed as n, watch as L, nextTick as M, onUpdated as re, onMounted as oe, onActivated as ie, onDeactivated as se, onBeforeUnmount as ue, openBlock as d, createElementBlock as y, mergeProps as V, unref as l, createCommentVNode as q, renderSlot as B, Fragment as ne, normalizeStyle as ce, createBlock as G, resolveDynamicComponent as ve, toRaw as de, createTextVNode as fe, toDisplayString as me } from "vue";
|
|
2
|
+
import { UserRound as ye } from "lucide-vue-next";
|
|
3
|
+
import { useHysRootAttrs as he } from "../../config.js";
|
|
4
|
+
import { avatarGroupKey as ge, useAvatarSize as pe } from "../../composables/avatar.js";
|
|
5
|
+
const be = ["aria-label", "aria-busy"], ke = {
|
|
6
|
+
key: 1,
|
|
7
|
+
class: "hys-ui-avatar-placeholder"
|
|
8
|
+
}, ze = {
|
|
9
|
+
key: 0,
|
|
10
|
+
class: "hys-ui-avatar-custom"
|
|
11
|
+
}, Ee = /* @__PURE__ */ ae({
|
|
12
|
+
inheritAttrs: !1,
|
|
13
|
+
__name: "HysAvatar",
|
|
14
|
+
props: {
|
|
15
|
+
name: { default: "" },
|
|
16
|
+
src: {},
|
|
17
|
+
srcset: {},
|
|
18
|
+
srcSet: {},
|
|
19
|
+
sizes: {},
|
|
20
|
+
size: {},
|
|
21
|
+
shape: {},
|
|
22
|
+
fit: { default: "cover" },
|
|
23
|
+
alt: {},
|
|
24
|
+
icon: {},
|
|
25
|
+
gap: { default: 4 },
|
|
26
|
+
autoFit: { type: Boolean, default: !0 },
|
|
27
|
+
color: {},
|
|
28
|
+
textColor: {},
|
|
29
|
+
bordered: { type: Boolean, default: void 0 },
|
|
30
|
+
radius: {},
|
|
31
|
+
fallbackSrc: {},
|
|
32
|
+
loadError: {},
|
|
33
|
+
draggable: { type: Boolean, default: void 0 },
|
|
34
|
+
crossOrigin: {},
|
|
35
|
+
lazy: { type: Boolean },
|
|
36
|
+
imgProps: {}
|
|
37
|
+
},
|
|
38
|
+
emits: ["error", "load"],
|
|
39
|
+
setup(r, { expose: I, emit: J }) {
|
|
40
|
+
const e = r, O = J, F = te(), Q = he(), c = le(ge, void 0), h = m(), U = m(), i = m(), v = m(!1), w = m(!1), s = m("primary"), j = m(0), P = m(), $ = n(() => {
|
|
41
|
+
var a;
|
|
42
|
+
return e.src ?? ((a = e.imgProps) == null ? void 0 : a.src) ?? "";
|
|
43
|
+
}), g = n(
|
|
44
|
+
() => {
|
|
45
|
+
var a;
|
|
46
|
+
return e.srcset ?? e.srcSet ?? ((a = e.imgProps) == null ? void 0 : a.srcset);
|
|
47
|
+
}
|
|
48
|
+
), u = pe(n(() => e.size ?? (c == null ? void 0 : c.size.value))), D = n(() => e.shape ?? (c == null ? void 0 : c.shape.value) ?? "circle"), X = n(() => e.bordered ?? (c == null ? void 0 : c.bordered.value) ?? !1), x = n(
|
|
49
|
+
() => s.value === "content" ? "" : s.value === "fallback" ? e.fallbackSrc || "" : $.value
|
|
50
|
+
), p = n(
|
|
51
|
+
() => j.value + ":" + x.value + ":" + (g.value || "")
|
|
52
|
+
), N = n(
|
|
53
|
+
() => Array.from(e.name.trim()).slice(0, 2).join("").toUpperCase()
|
|
54
|
+
), S = n(
|
|
55
|
+
() => s.value !== "content" && !!(x.value || s.value === "primary" && g.value)
|
|
56
|
+
), Y = n(() => {
|
|
57
|
+
const { onError: a, onLoad: f, ...t } = e.imgProps ?? {};
|
|
58
|
+
return {
|
|
59
|
+
...t,
|
|
60
|
+
src: x.value || void 0,
|
|
61
|
+
srcset: s.value === "fallback" ? void 0 : g.value,
|
|
62
|
+
sizes: e.sizes ?? t.sizes,
|
|
63
|
+
alt: e.alt ?? t.alt ?? e.name,
|
|
64
|
+
draggable: e.draggable ?? t.draggable ?? !1,
|
|
65
|
+
crossorigin: e.crossOrigin ?? t.crossorigin,
|
|
66
|
+
loading: e.lazy ? "lazy" : t.loading,
|
|
67
|
+
decoding: t.decoding ?? "async",
|
|
68
|
+
"data-hys-avatar-request": p.value,
|
|
69
|
+
style: [
|
|
70
|
+
t.style,
|
|
71
|
+
{ objectFit: e.fit, opacity: v.value ? 1 : 0 }
|
|
72
|
+
]
|
|
73
|
+
};
|
|
74
|
+
});
|
|
75
|
+
function Z(a) {
|
|
76
|
+
var t, A;
|
|
77
|
+
if (a.target.getAttribute("data-hys-avatar-request") !== p.value)
|
|
78
|
+
return;
|
|
79
|
+
const f = {
|
|
80
|
+
src: x.value || g.value || "",
|
|
81
|
+
fallback: s.value === "fallback"
|
|
82
|
+
};
|
|
83
|
+
v.value = !0, (A = (t = e.imgProps) == null ? void 0 : t.onLoad) == null || A.call(t, a), O("load", a, f);
|
|
84
|
+
}
|
|
85
|
+
function _(a) {
|
|
86
|
+
var E, H, K;
|
|
87
|
+
if (a.target.getAttribute("data-hys-avatar-request") !== p.value)
|
|
88
|
+
return;
|
|
89
|
+
const f = p.value, t = {
|
|
90
|
+
src: x.value || g.value || "",
|
|
91
|
+
fallback: s.value === "fallback"
|
|
92
|
+
};
|
|
93
|
+
w.value = !0, P.value = a, (H = (E = e.imgProps) == null ? void 0 : E.onError) == null || H.call(E, a), O("error", a, t);
|
|
94
|
+
let A = !1;
|
|
95
|
+
try {
|
|
96
|
+
A = ((K = e.loadError) == null ? void 0 : K.call(e, a)) === !1;
|
|
97
|
+
} catch {
|
|
98
|
+
}
|
|
99
|
+
if (p.value === f) {
|
|
100
|
+
if (A) {
|
|
101
|
+
v.value = !0;
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
v.value = !1, s.value = s.value === "primary" && e.fallbackSrc && e.fallbackSrc !== $.value ? "fallback" : "content";
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
function T() {
|
|
108
|
+
s.value = "primary", v.value = !1, w.value = !1, P.value = void 0;
|
|
109
|
+
}
|
|
110
|
+
function W() {
|
|
111
|
+
j.value++, T();
|
|
112
|
+
}
|
|
113
|
+
L(() => [$.value, g.value, e.fallbackSrc], T, {
|
|
114
|
+
flush: "sync"
|
|
115
|
+
});
|
|
116
|
+
let b = !0, k, o;
|
|
117
|
+
function ee() {
|
|
118
|
+
if (k = void 0, !b || !i.value || !h.value) return;
|
|
119
|
+
const a = Math.max(
|
|
120
|
+
1,
|
|
121
|
+
(h.value.clientWidth || u.value) - (Number.isFinite(e.gap) ? Math.max(0, e.gap) : 4) * 2
|
|
122
|
+
), f = i.value.offsetWidth || i.value.scrollWidth || i.value.getBoundingClientRect().width, t = e.autoFit && f ? Math.min(1, a / f) : 1;
|
|
123
|
+
i.value.style.transform = `scale(${t})`;
|
|
124
|
+
}
|
|
125
|
+
function z() {
|
|
126
|
+
b && i.value && k === void 0 && (k = requestAnimationFrame(ee));
|
|
127
|
+
}
|
|
128
|
+
function R() {
|
|
129
|
+
o == null || o.disconnect(), o = void 0, k !== void 0 && cancelAnimationFrame(k), k = void 0, window.removeEventListener("resize", z);
|
|
130
|
+
}
|
|
131
|
+
function C() {
|
|
132
|
+
R(), !(!b || !h.value) && (o = typeof ResizeObserver > "u" ? void 0 : new ResizeObserver(z), o == null || o.observe(h.value), i.value && (o == null || o.observe(i.value)), o || window.addEventListener("resize", z), z());
|
|
133
|
+
}
|
|
134
|
+
return L(
|
|
135
|
+
() => [u.value, e.gap, e.autoFit],
|
|
136
|
+
() => void M(z)
|
|
137
|
+
), L(i, () => void M(C), { flush: "post" }), re(z), oe(C), ie(() => {
|
|
138
|
+
b = !0, M(C);
|
|
139
|
+
}), se(() => {
|
|
140
|
+
b = !1, R();
|
|
141
|
+
}), ue(() => {
|
|
142
|
+
b = !1, R();
|
|
143
|
+
}), I({ element: h, image: U, loaded: v, failed: w, reload: W }), (a, f) => {
|
|
144
|
+
var t;
|
|
145
|
+
return d(), y("span", V({
|
|
146
|
+
ref_key: "root",
|
|
147
|
+
ref: h
|
|
148
|
+
}, { ...l(Q), ...l(F) }, {
|
|
149
|
+
class: ["hys-ui-ex-avatar", [
|
|
150
|
+
"hys-ui-avatar-" + D.value,
|
|
151
|
+
{
|
|
152
|
+
"hys-ui-avatar-bordered": X.value,
|
|
153
|
+
"hys-ui-avatar-loading": S.value && !v.value
|
|
154
|
+
}
|
|
155
|
+
]],
|
|
156
|
+
style: [
|
|
157
|
+
{
|
|
158
|
+
width: l(u) + "px",
|
|
159
|
+
height: l(u) + "px",
|
|
160
|
+
fontSize: Math.max(11, l(u) * 0.34) + "px",
|
|
161
|
+
borderRadius: D.value === "circle" ? "50%" : typeof r.radius == "number" ? r.radius + "px" : r.radius ?? Math.min(8, l(u) * 0.2) + "px",
|
|
162
|
+
background: r.color,
|
|
163
|
+
color: r.textColor
|
|
164
|
+
},
|
|
165
|
+
l(F).style
|
|
166
|
+
],
|
|
167
|
+
role: "img",
|
|
168
|
+
"aria-label": l(F)["aria-label"] || r.alt || ((t = r.imgProps) == null ? void 0 : t.alt) || r.name || "用户头像",
|
|
169
|
+
"aria-busy": S.value && !v.value || void 0
|
|
170
|
+
}), [
|
|
171
|
+
S.value ? (d(), y("img", V({
|
|
172
|
+
key: p.value,
|
|
173
|
+
ref_key: "image",
|
|
174
|
+
ref: U
|
|
175
|
+
}, Y.value, {
|
|
176
|
+
onLoad: Z,
|
|
177
|
+
onError: _
|
|
178
|
+
}), null, 16)) : q("", !0),
|
|
179
|
+
S.value && !v.value && a.$slots.placeholder ? (d(), y("span", ke, [
|
|
180
|
+
B(a.$slots, "placeholder", {}, void 0, !0)
|
|
181
|
+
])) : q("", !0),
|
|
182
|
+
S.value ? q("", !0) : (d(), y(ne, { key: 2 }, [
|
|
183
|
+
w.value && a.$slots.fallback ? (d(), y("span", ze, [
|
|
184
|
+
B(a.$slots, "fallback", {
|
|
185
|
+
error: P.value,
|
|
186
|
+
reload: W
|
|
187
|
+
}, void 0, !0)
|
|
188
|
+
])) : a.$slots.icon || r.icon ? (d(), y("span", {
|
|
189
|
+
key: 1,
|
|
190
|
+
class: "hys-ui-avatar-icon",
|
|
191
|
+
style: ce({
|
|
192
|
+
width: l(u) * 0.5 + "px",
|
|
193
|
+
height: l(u) * 0.5 + "px"
|
|
194
|
+
})
|
|
195
|
+
}, [
|
|
196
|
+
B(a.$slots, "icon", {}, () => [
|
|
197
|
+
(d(), G(ve(r.icon && de(r.icon)), {
|
|
198
|
+
size: l(u) * 0.5
|
|
199
|
+
}, null, 8, ["size"]))
|
|
200
|
+
], !0)
|
|
201
|
+
], 4)) : a.$slots.default || N.value ? (d(), y("span", {
|
|
202
|
+
key: 2,
|
|
203
|
+
ref_key: "text",
|
|
204
|
+
ref: i,
|
|
205
|
+
class: "hys-ui-avatar-text"
|
|
206
|
+
}, [
|
|
207
|
+
B(a.$slots, "default", {}, () => [
|
|
208
|
+
fe(me(N.value), 1)
|
|
209
|
+
], !0)
|
|
210
|
+
], 512)) : (d(), G(l(ye), {
|
|
211
|
+
key: 3,
|
|
212
|
+
size: l(u) * 0.5,
|
|
213
|
+
"stroke-width": 1.8,
|
|
214
|
+
"aria-hidden": "true"
|
|
215
|
+
}, null, 8, ["size"]))
|
|
216
|
+
], 64))
|
|
217
|
+
], 16, be);
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
});
|
|
2
221
|
export {
|
|
3
|
-
|
|
222
|
+
Ee as default
|
|
4
223
|
};
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { defineComponent as q, ref as y, useId as E, provide as J, computed as C, watch as b, onUpdated as L, nextTick as M, onDeactivated as Q, onBeforeUnmount as W, h as c, Teleport as X, mergeProps as Y, Fragment as G, cloneVNode as Z, Comment as ee, Text as ae } from "vue";
|
|
2
|
+
import _ from "../HysAvatar/HysAvatar.vue.js";
|
|
3
|
+
import { useHysRootAttrs as te } from "../../config.js";
|
|
4
|
+
import { avatarGroupKey as ne } from "../../composables/avatar.js";
|
|
5
|
+
import { useFloating as oe } from "../../composables/useFloating.js";
|
|
6
|
+
function j(e) {
|
|
7
|
+
return e.flatMap(
|
|
8
|
+
(u) => u.type === G ? j(u.children || []) : u.type === ee || u.type === ae && !String(u.children).trim() ? [] : [u]
|
|
9
|
+
);
|
|
10
|
+
}
|
|
11
|
+
const ve = q({
|
|
12
|
+
name: "HysAvatarGroup",
|
|
13
|
+
inheritAttrs: !1,
|
|
14
|
+
props: {
|
|
15
|
+
options: Array,
|
|
16
|
+
size: [Number, String, Object],
|
|
17
|
+
shape: String,
|
|
18
|
+
gap: { type: Number, default: -10 },
|
|
19
|
+
maxCount: Number,
|
|
20
|
+
vertical: Boolean,
|
|
21
|
+
bordered: { type: Boolean, default: !0 },
|
|
22
|
+
maxStyle: Object,
|
|
23
|
+
maxClass: String,
|
|
24
|
+
placement: { type: String, default: "top-start" },
|
|
25
|
+
trigger: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: "hover"
|
|
28
|
+
},
|
|
29
|
+
showOverflow: { type: Boolean, default: !0 },
|
|
30
|
+
expandOnHover: Boolean
|
|
31
|
+
},
|
|
32
|
+
emits: {
|
|
33
|
+
visibleChange: (e) => !0,
|
|
34
|
+
overflowClick: (e, u) => !0
|
|
35
|
+
},
|
|
36
|
+
slots: Object,
|
|
37
|
+
setup(e, { attrs: u, slots: l, emit: F, expose: D }) {
|
|
38
|
+
const w = y(), d = y(), m = y(), s = y(!1), S = te(), T = "hys-avatar-group-" + E();
|
|
39
|
+
J(ne, {
|
|
40
|
+
size: C(() => e.size),
|
|
41
|
+
shape: C(() => e.shape),
|
|
42
|
+
bordered: C(() => e.bordered)
|
|
43
|
+
});
|
|
44
|
+
const o = oe(d, m, {
|
|
45
|
+
get placement() {
|
|
46
|
+
return e.placement;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
let k;
|
|
50
|
+
function v() {
|
|
51
|
+
clearTimeout(k), k = void 0;
|
|
52
|
+
}
|
|
53
|
+
function I() {
|
|
54
|
+
v(), e.trigger === "hover" && !o.restoringFocus.value && o.show();
|
|
55
|
+
}
|
|
56
|
+
function O() {
|
|
57
|
+
v(), e.trigger === "hover" && (k = setTimeout(() => o.close(), 80));
|
|
58
|
+
}
|
|
59
|
+
function K() {
|
|
60
|
+
v(), e.trigger !== "click" && !o.restoringFocus.value && o.show();
|
|
61
|
+
}
|
|
62
|
+
function N(a) {
|
|
63
|
+
var t, r;
|
|
64
|
+
a.relatedTarget instanceof Node && ((t = w.value) != null && t.contains(a.relatedTarget) || (r = m.value) != null && r.contains(a.relatedTarget)) || (v(), o.close());
|
|
65
|
+
}
|
|
66
|
+
function p() {
|
|
67
|
+
v(), o.close(!1, !0), s.value = !1;
|
|
68
|
+
}
|
|
69
|
+
function R() {
|
|
70
|
+
var a;
|
|
71
|
+
return e.options ? e.options.map((t, r) => ({
|
|
72
|
+
key: t.key ?? r,
|
|
73
|
+
option: t,
|
|
74
|
+
node: l.avatar ? c(G, null, l.avatar({ option: t, index: r })) : c(_, t)
|
|
75
|
+
})) : j(((a = l.default) == null ? void 0 : a.call(l)) ?? []).map((t, r) => ({
|
|
76
|
+
key: typeof t.key == "string" || typeof t.key == "number" ? t.key : r,
|
|
77
|
+
node: t
|
|
78
|
+
}));
|
|
79
|
+
}
|
|
80
|
+
function A(a) {
|
|
81
|
+
const t = Number.isFinite(e.gap) ? e.gap : -10, r = e.expandOnHover && s.value ? Math.max(0, t) : t;
|
|
82
|
+
return {
|
|
83
|
+
...e.vertical ? { marginTop: a ? r + "px" : void 0 } : { marginInlineStart: a ? r + "px" : void 0 },
|
|
84
|
+
zIndex: a + 1
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
const U = (a) => {
|
|
88
|
+
var t, r, i, g;
|
|
89
|
+
return ((t = a.option) == null ? void 0 : t.name) || ((r = a.option) == null ? void 0 : r.alt) || ((i = a.node.props) == null ? void 0 : i.name) || ((g = a.node.props) == null ? void 0 : g.alt) || "成员";
|
|
90
|
+
};
|
|
91
|
+
function P(a, t, r = !1) {
|
|
92
|
+
const i = Z(a.node);
|
|
93
|
+
return r && (i.ref = null), i.key = t, i;
|
|
94
|
+
}
|
|
95
|
+
const V = Symbol("hys-avatar-overflow");
|
|
96
|
+
async function h() {
|
|
97
|
+
var a;
|
|
98
|
+
v(), (a = d.value) != null && a.isConnected && await o.show();
|
|
99
|
+
}
|
|
100
|
+
function x() {
|
|
101
|
+
v(), o.close();
|
|
102
|
+
}
|
|
103
|
+
return D({ open: h, close: x }), b(o.open, (a) => F("visibleChange", a)), b(() => [e.maxCount, e.showOverflow, e.trigger], p), b(
|
|
104
|
+
() => e.placement,
|
|
105
|
+
() => {
|
|
106
|
+
o.open.value && o.update();
|
|
107
|
+
}
|
|
108
|
+
), L(() => {
|
|
109
|
+
var a;
|
|
110
|
+
o.open.value && !((a = d.value) != null && a.isConnected) && p();
|
|
111
|
+
}), b(
|
|
112
|
+
() => [e.options, e.size, e.shape],
|
|
113
|
+
() => void M(() => {
|
|
114
|
+
o.open.value && o.update();
|
|
115
|
+
}),
|
|
116
|
+
{ deep: !0 }
|
|
117
|
+
), Q(p), W(p), {
|
|
118
|
+
open: h,
|
|
119
|
+
close: x,
|
|
120
|
+
renderGroup: () => {
|
|
121
|
+
var z, H;
|
|
122
|
+
const a = R(), t = e.maxCount === void 0 || !Number.isFinite(e.maxCount) ? a.length : Math.max(0, Math.floor(e.maxCount)), r = a.slice(0, t), i = a.slice(t), g = i.flatMap(
|
|
123
|
+
(n) => n.option ? [n.option] : []
|
|
124
|
+
), B = r.map(
|
|
125
|
+
(n, f) => c(
|
|
126
|
+
"span",
|
|
127
|
+
{
|
|
128
|
+
class: "hys-ui-avatar-group-item",
|
|
129
|
+
style: A(f),
|
|
130
|
+
key: n.key
|
|
131
|
+
},
|
|
132
|
+
[P(n, n.key)]
|
|
133
|
+
)
|
|
134
|
+
);
|
|
135
|
+
i.length && e.showOverflow && B.push(
|
|
136
|
+
c(
|
|
137
|
+
"span",
|
|
138
|
+
{
|
|
139
|
+
class: "hys-ui-avatar-group-item",
|
|
140
|
+
style: A(r.length),
|
|
141
|
+
key: V
|
|
142
|
+
},
|
|
143
|
+
[
|
|
144
|
+
c(
|
|
145
|
+
"button",
|
|
146
|
+
{
|
|
147
|
+
ref: d,
|
|
148
|
+
type: "button",
|
|
149
|
+
class: "hys-ui-avatar-group-more",
|
|
150
|
+
"aria-label": `查看其余 ${i.length} 位成员`,
|
|
151
|
+
"aria-expanded": o.open.value,
|
|
152
|
+
"aria-controls": o.open.value ? T : void 0,
|
|
153
|
+
onPointerenter: I,
|
|
154
|
+
onPointerleave: O,
|
|
155
|
+
onFocus: K,
|
|
156
|
+
onBlur: N,
|
|
157
|
+
onClick: (n) => {
|
|
158
|
+
v(), F("overflowClick", i.length, n), e.trigger === "click" ? o.toggle() : h();
|
|
159
|
+
},
|
|
160
|
+
onKeydown: async (n) => {
|
|
161
|
+
var f;
|
|
162
|
+
n.key === "ArrowDown" && (n.preventDefault(), await h(), await M(), (f = m.value) == null || f.focus());
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
[
|
|
166
|
+
c(
|
|
167
|
+
_,
|
|
168
|
+
{
|
|
169
|
+
class: e.maxClass,
|
|
170
|
+
style: e.maxStyle,
|
|
171
|
+
"aria-hidden": "true"
|
|
172
|
+
},
|
|
173
|
+
() => {
|
|
174
|
+
var n;
|
|
175
|
+
return ((n = l.overflow) == null ? void 0 : n.call(l, {
|
|
176
|
+
count: i.length,
|
|
177
|
+
options: g
|
|
178
|
+
})) ?? "+" + i.length;
|
|
179
|
+
}
|
|
180
|
+
)
|
|
181
|
+
]
|
|
182
|
+
)
|
|
183
|
+
]
|
|
184
|
+
)
|
|
185
|
+
);
|
|
186
|
+
const $ = o.open.value && i.length && e.showOverflow ? c(X, { to: "body" }, [
|
|
187
|
+
c(
|
|
188
|
+
"div",
|
|
189
|
+
{
|
|
190
|
+
...S.value,
|
|
191
|
+
id: T,
|
|
192
|
+
ref: m,
|
|
193
|
+
role: "group",
|
|
194
|
+
"aria-label": "其余成员",
|
|
195
|
+
tabindex: -1,
|
|
196
|
+
class: "hys-ui-avatar-group-popover",
|
|
197
|
+
style: o.style.value,
|
|
198
|
+
onPointerenter: v,
|
|
199
|
+
onPointerleave: O,
|
|
200
|
+
onFocusin: v,
|
|
201
|
+
onFocusout: N
|
|
202
|
+
},
|
|
203
|
+
((z = l.content) == null ? void 0 : z.call(l, {
|
|
204
|
+
options: g,
|
|
205
|
+
close: x
|
|
206
|
+
})) ?? i.map(
|
|
207
|
+
(n, f) => c(
|
|
208
|
+
"div",
|
|
209
|
+
{ class: "hys-ui-avatar-group-person", key: n.key },
|
|
210
|
+
[
|
|
211
|
+
P(n, "popup-" + f, !0),
|
|
212
|
+
c(
|
|
213
|
+
"span",
|
|
214
|
+
{ class: "hys-ui-avatar-group-name" },
|
|
215
|
+
String(U(n))
|
|
216
|
+
)
|
|
217
|
+
]
|
|
218
|
+
)
|
|
219
|
+
)
|
|
220
|
+
)
|
|
221
|
+
]) : null;
|
|
222
|
+
return c(
|
|
223
|
+
"div",
|
|
224
|
+
Y(S.value, u, {
|
|
225
|
+
ref: w,
|
|
226
|
+
role: "group",
|
|
227
|
+
"aria-label": u["aria-label"] ?? "头像组",
|
|
228
|
+
class: [
|
|
229
|
+
"hys-ui-avatar-group",
|
|
230
|
+
{ "hys-ui-avatar-group-vertical": e.vertical }
|
|
231
|
+
],
|
|
232
|
+
style: u.style,
|
|
233
|
+
onPointerenter: () => s.value = !0,
|
|
234
|
+
onPointerleave: () => s.value = !1,
|
|
235
|
+
onFocusin: () => s.value = !0,
|
|
236
|
+
onFocusout: (n) => {
|
|
237
|
+
var f;
|
|
238
|
+
n.relatedTarget instanceof Node && ((f = w.value) != null && f.contains(n.relatedTarget)) || (s.value = !1);
|
|
239
|
+
}
|
|
240
|
+
}),
|
|
241
|
+
[...B, ...a.length ? [] : ((H = l.empty) == null ? void 0 : H.call(l)) ?? [], $]
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
},
|
|
246
|
+
render() {
|
|
247
|
+
return this.renderGroup();
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
export {
|
|
251
|
+
ve as default
|
|
252
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./HysBadge2.vue.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const
|
|
4
|
+
const e = /* @__PURE__ */ t(o, [["__scopeId", "data-v-12ef89af"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
e as default
|
|
7
7
|
};
|