hys-ui 0.1.0 → 0.1.1
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 +26 -1
- package/README.md +16 -6
- package/dist/components/HysAlert/HysAlert.vue.js +14 -14
- package/dist/components/HysAnimatedNumber/HysAnimatedNumber.vue.js +23 -20
- package/dist/components/HysBadge/HysBadge.vue.js +1 -1
- package/dist/components/HysBadge/HysBadge2.vue.js +20 -19
- package/dist/components/HysCalendar/HysCalendar.vue.js +48 -40
- package/dist/components/HysCard/HysCard.vue.js +2 -2
- package/dist/components/HysCard/HysCard2.vue.js +9 -9
- package/dist/components/HysCascader/HysCascader.vue.js +88 -76
- package/dist/components/HysCheckbox/HysCheckbox.vue.js +5 -39
- package/dist/components/HysCheckbox/HysCheckbox2.vue.js +85 -2
- package/dist/components/HysCommandPalette/HysCommandPalette.vue.js +52 -51
- package/dist/components/HysCommentEditor/HysCommentEditor.vue.js +17 -17
- package/dist/components/HysDataGrid/HysDataGrid2.vue.js +22 -22
- 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 +85 -2
- package/dist/components/HysForm/HysForm.vue.js +2 -2
- package/dist/components/HysForm/HysForm2.vue.js +66 -64
- package/dist/components/HysFormItem/HysFormItem.vue.js +53 -37
- package/dist/components/HysGantt/HysGantt.vue.js +5 -264
- package/dist/components/HysGantt/HysGantt2.vue.js +302 -2
- package/dist/components/HysInput/HysInput.vue.js +1 -1
- package/dist/components/HysInput/HysInput2.vue.js +42 -41
- 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 +49 -40
- package/dist/components/HysOrgTree/HysOrgTree.vue.js +34 -32
- package/dist/components/HysPagination/HysPagination.vue.js +2 -2
- package/dist/components/HysPagination/HysPagination2.vue.js +91 -91
- package/dist/components/HysPermissionMatrix/HysPermissionMatrix.vue.js +5 -41
- package/dist/components/HysPermissionMatrix/HysPermissionMatrix2.vue.js +100 -2
- package/dist/components/HysRadioGroup/HysRadioGroup.vue.js +5 -40
- package/dist/components/HysRadioGroup/HysRadioGroup2.vue.js +80 -2
- 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 +86 -67
- package/dist/components/HysSearch/HysSearch.vue.js +49 -38
- package/dist/components/HysSegmented/HysSegmented.vue.js +39 -34
- package/dist/components/HysSelect/HysSelect.vue.js +2 -2
- package/dist/components/HysSelect/HysSelect2.vue.js +130 -109
- package/dist/components/HysSlider/HysSlider.vue.js +2 -2
- package/dist/components/HysSlider/HysSlider2.vue.js +40 -40
- 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 +15 -14
- package/dist/components/HysSwitch/HysSwitch.vue.js +2 -2
- package/dist/components/HysSwitch/HysSwitch2.vue.js +38 -27
- package/dist/components/HysTable/HysTable.vue.js +2 -2
- package/dist/components/HysTable/HysTable2.vue.js +42 -38
- package/dist/components/HysTabs/HysTabs.vue.js +1 -1
- package/dist/components/HysTabs/HysTabs2.vue.js +8 -6
- package/dist/components/HysTextarea/HysTextarea.vue.js +58 -48
- 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 +159 -143
- package/dist/components/HysTree/HysTree.vue.js +2 -2
- package/dist/components/HysTree/HysTree2.vue.js +62 -61
- package/dist/components/HysTreeSelect/HysTreeSelect.vue.js +64 -57
- package/dist/components/HysUpload/HysUpload.vue.js +2 -2
- package/dist/components/HysUpload/HysUpload2.vue.js +95 -77
- package/dist/composables/formContext.js +9 -3
- package/dist/composables/toastEscape.js +16 -0
- package/dist/composables/useDialog.js +16 -16
- package/dist/composables/useFloating.js +40 -40
- package/dist/composables/useHysToast.js +148 -0
- package/dist/config.js +18 -15
- package/dist/index.js +10 -7
- package/dist/style.css +1 -1
- package/dist/types/components/HysCalendar/HysCalendar.vue.d.ts +2 -0
- package/dist/types/components/HysCard/HysCard.vue.d.ts +5 -1
- package/dist/types/components/HysCheckbox/HysCheckbox.vue.d.ts +21 -4
- package/dist/types/components/HysDrawer/HysDrawer.vue.d.ts +1 -0
- package/dist/types/components/HysFileManager/HysFileManager.vue.d.ts +6 -2
- package/dist/types/components/HysGantt/HysGantt.vue.d.ts +6 -0
- package/dist/types/components/HysNumberInput/HysNumberInput.vue.d.ts +2 -0
- package/dist/types/components/HysOrgTree/HysOrgTree.vue.d.ts +3 -1
- package/dist/types/components/HysPermissionMatrix/HysPermissionMatrix.vue.d.ts +8 -1
- package/dist/types/components/HysRadioGroup/HysRadioGroup.vue.d.ts +40 -17
- package/dist/types/components/HysResizablePanel/HysResizablePanel.vue.d.ts +6 -0
- package/dist/types/components/HysSelect/HysSelect.vue.d.ts +7 -1
- package/dist/types/components/HysSplitPane/HysSplitPane.vue.d.ts +6 -0
- package/dist/types/components/HysSteps/HysSteps.vue.d.ts +1 -0
- package/dist/types/components/HysSwitch/HysSwitch.vue.d.ts +1 -1
- package/dist/types/components/HysTextarea/HysTextarea.vue.d.ts +1 -1
- package/dist/types/components/HysToast/HysToast.vue.d.ts +55 -7
- package/dist/types/components/HysTour/HysTour.vue.d.ts +3 -1
- package/dist/types/components/HysTransfer/HysTransfer.vue.d.ts +11 -1
- package/dist/types/composables/formContext.d.ts +5 -0
- package/dist/types/composables/toastEscape.d.ts +1 -0
- package/dist/types/composables/useFloating.d.ts +1 -1
- package/dist/types/composables/useHysToast.d.ts +50 -0
- package/dist/types/index.d.ts +5 -0
- package/package.json +46 -11
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useHysRootAttrs as
|
|
3
|
-
import { ChevronsLeft as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
const
|
|
1
|
+
import { defineComponent as O, computed as s, ref as I, watch as P, openBlock as v, createElementBlock as c, mergeProps as Q, unref as C, toDisplayString as g, createCommentVNode as w, createElementVNode as B, createVNode as o, withCtx as S, Fragment as F, renderList as U, createBlock as q, normalizeClass as G, createTextVNode as V, withModifiers as K } from "vue";
|
|
2
|
+
import { useHysRootAttrs as W } from "../../config.js";
|
|
3
|
+
import { ChevronsLeft as X, ChevronLeft as Y, ChevronRight as Z, ChevronsRight as _ } from "lucide-vue-next";
|
|
4
|
+
import ee from "../HysSelect/HysSelect.vue.js";
|
|
5
|
+
import ae from "../HysNumberInput/HysNumberInput.vue.js";
|
|
6
|
+
import M from "../HysButton/HysButton.vue.js";
|
|
7
|
+
const te = ["aria-busy"], le = {
|
|
8
8
|
key: 0,
|
|
9
9
|
class: "hys-ui-pf-pagination-total",
|
|
10
10
|
"aria-live": "polite"
|
|
11
|
-
},
|
|
11
|
+
}, ie = { class: "hys-ui-pf-pagination-actions" }, ne = { class: "hys-ui-pf-pagination-controls" }, ue = {
|
|
12
12
|
key: 1,
|
|
13
13
|
class: "hys-ui-pf-pagination-gap",
|
|
14
14
|
"aria-hidden": "true"
|
|
@@ -18,10 +18,10 @@ const ae = ["aria-busy"], te = {
|
|
|
18
18
|
}, oe = {
|
|
19
19
|
key: 2,
|
|
20
20
|
class: "hys-ui-pf-pagination-mobile-indicator"
|
|
21
|
-
},
|
|
21
|
+
}, re = {
|
|
22
22
|
key: 0,
|
|
23
23
|
class: "hys-ui-pf-pagination-size"
|
|
24
|
-
},
|
|
24
|
+
}, ge = /* @__PURE__ */ O({
|
|
25
25
|
__name: "HysPagination",
|
|
26
26
|
props: {
|
|
27
27
|
page: {},
|
|
@@ -38,126 +38,125 @@ const ae = ["aria-busy"], te = {
|
|
|
38
38
|
labels: {}
|
|
39
39
|
},
|
|
40
40
|
emits: ["change", "update:page", "pageSizeChange", "update:pageSize"],
|
|
41
|
-
setup(
|
|
42
|
-
const
|
|
43
|
-
const l =
|
|
44
|
-
for (let i = Math.max(1,
|
|
45
|
-
if (
|
|
46
|
-
if (
|
|
47
|
-
const
|
|
48
|
-
return
|
|
49
|
-
|
|
50
|
-
}),
|
|
51
|
-
}), m =
|
|
52
|
-
|
|
53
|
-
m.value =
|
|
54
|
-
});
|
|
55
|
-
function
|
|
41
|
+
setup(d, { emit: H }) {
|
|
42
|
+
const $ = W(), u = d, b = H, h = s(() => Number.isFinite(u.pageSize) && u.pageSize > 0 ? Math.floor(u.pageSize) : 10), k = s(() => Number.isFinite(u.total) ? Math.max(0, Math.floor(u.total)) : 0), p = s(() => Math.max(1, Math.ceil(k.value / h.value))), a = s(() => Math.min(p.value, Math.max(1, Number.isFinite(u.page) ? Math.floor(u.page) : 1))), r = s(() => u.disabled || u.loading), E = s(() => k.value === 0 ? 0 : (a.value - 1) * h.value + 1), J = s(() => Math.min(k.value, a.value * h.value)), n = s(() => ({ total: "共 {total} 条({start}–{end})", perPage: "每页条数", jump: "跳转到", page: "页", first: "首页", previous: "上一页", next: "下一页", last: "末页", ...u.labels })), L = s(() => n.value.total.replace("{total}", String(k.value)).replace("{start}", String(E.value)).replace("{end}", String(J.value))), R = s(() => [...new Set([...u.pageSizeOptions ?? [10, 20, 50, 100], h.value].filter((l) => Number.isInteger(l) && l > 0))].sort((l, e) => l - e)), T = s(() => {
|
|
43
|
+
const l = p.value, e = Math.max(0, Math.min(5, Math.floor(u.siblingCount))), t = /* @__PURE__ */ new Set([1, l]);
|
|
44
|
+
for (let i = Math.max(1, a.value - e); i <= Math.min(l, a.value + e); i++) t.add(i);
|
|
45
|
+
if (a.value <= e + 3) for (let i = 1; i <= Math.min(l, 2 * e + 3); i++) t.add(i);
|
|
46
|
+
if (a.value >= l - e - 2) for (let i = Math.max(1, l - (2 * e + 2)); i <= l; i++) t.add(i);
|
|
47
|
+
const f = [...t].sort((i, z) => i - z), N = [];
|
|
48
|
+
return f.forEach((i, z) => {
|
|
49
|
+
z && i - f[z - 1] > 1 && (i - f[z - 1] === 2 ? N.push(i - 1) : N.push(z === 1 ? "left-gap" : "right-gap")), N.push(i);
|
|
50
|
+
}), N;
|
|
51
|
+
}), x = I(a.value), m = I(a.value), j = s(() => m.value !== null && Number.isInteger(m.value) && m.value > 0 && m.value !== a.value);
|
|
52
|
+
P(a, () => {
|
|
53
|
+
x.value = a.value, m.value = a.value;
|
|
54
|
+
}), P(x, (l) => m.value = l);
|
|
55
|
+
function y(l) {
|
|
56
56
|
if (r.value || !Number.isFinite(l)) return;
|
|
57
|
-
const e = Math.min(
|
|
58
|
-
e !==
|
|
57
|
+
const e = Math.min(p.value, Math.max(1, Math.floor(l)));
|
|
58
|
+
e !== a.value && (b("update:page", e), b("change", e));
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function A(l) {
|
|
61
61
|
if (r.value) return;
|
|
62
62
|
const e = Number(l);
|
|
63
|
-
if (!Number.isInteger(e) || e < 1 || e ===
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
t.value > a && g(a);
|
|
63
|
+
if (!Number.isInteger(e) || e < 1 || e === h.value) return;
|
|
64
|
+
const t = a.value, f = Math.max(1, Math.ceil(k.value / e));
|
|
65
|
+
b("update:pageSize", e), t > f && (b("update:page", f), b("change", f)), b("pageSizeChange", e);
|
|
67
66
|
}
|
|
68
|
-
function
|
|
67
|
+
function D() {
|
|
69
68
|
const l = Number(m.value);
|
|
70
|
-
|
|
69
|
+
j.value && Number.isInteger(l) && y(l), x.value = a.value, m.value = a.value;
|
|
71
70
|
}
|
|
72
|
-
return (l, e) => (
|
|
73
|
-
class: ["hys-ui-pf-pagination", { "pf-pagination
|
|
71
|
+
return (l, e) => (v(), c("nav", Q(C($), {
|
|
72
|
+
class: ["hys-ui-pf-pagination", { "hys-ui-pf-pagination-compact": d.compact }],
|
|
74
73
|
"aria-label": "分页导航",
|
|
75
|
-
"aria-busy":
|
|
74
|
+
"aria-busy": d.loading
|
|
76
75
|
}), [
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
d.showTotal ? (v(), c("span", le, g(L.value), 1)) : w("", !0),
|
|
77
|
+
B("div", ie, [
|
|
78
|
+
B("div", ne, [
|
|
79
|
+
o(M, {
|
|
81
80
|
variant: "secondary",
|
|
82
81
|
size: "sm",
|
|
83
82
|
type: "button",
|
|
84
|
-
disabled: r.value ||
|
|
83
|
+
disabled: r.value || a.value === 1,
|
|
85
84
|
"aria-label": n.value.first,
|
|
86
85
|
title: n.value.first,
|
|
87
|
-
onClick: e[0] || (e[0] = (
|
|
86
|
+
onClick: e[0] || (e[0] = (t) => y(1))
|
|
88
87
|
}, {
|
|
89
|
-
default:
|
|
90
|
-
|
|
88
|
+
default: S(() => [
|
|
89
|
+
o(C(X), {
|
|
91
90
|
size: 16,
|
|
92
91
|
"aria-hidden": "true"
|
|
93
92
|
})
|
|
94
93
|
]),
|
|
95
94
|
_: 1
|
|
96
95
|
}, 8, ["disabled", "aria-label", "title"]),
|
|
97
|
-
|
|
96
|
+
o(M, {
|
|
98
97
|
variant: "secondary",
|
|
99
98
|
size: "sm",
|
|
100
99
|
type: "button",
|
|
101
|
-
disabled: r.value ||
|
|
100
|
+
disabled: r.value || a.value === 1,
|
|
102
101
|
"aria-label": n.value.previous,
|
|
103
102
|
title: n.value.previous,
|
|
104
|
-
onClick: e[1] || (e[1] = (
|
|
103
|
+
onClick: e[1] || (e[1] = (t) => y(a.value - 1))
|
|
105
104
|
}, {
|
|
106
|
-
default:
|
|
107
|
-
|
|
105
|
+
default: S(() => [
|
|
106
|
+
o(C(Y), {
|
|
108
107
|
size: 16,
|
|
109
108
|
"aria-hidden": "true"
|
|
110
109
|
})
|
|
111
110
|
]),
|
|
112
111
|
_: 1
|
|
113
112
|
}, 8, ["disabled", "aria-label", "title"]),
|
|
114
|
-
|
|
115
|
-
typeof
|
|
113
|
+
d.compact ? (v(), c("span", se, g(a.value) + " / " + g(p.value), 1)) : (v(!0), c(F, { key: 0 }, U(T.value, (t) => (v(), c(F, { key: t }, [
|
|
114
|
+
typeof t == "number" ? (v(), q(M, {
|
|
116
115
|
key: 0,
|
|
117
116
|
variant: "secondary",
|
|
118
117
|
size: "sm",
|
|
119
|
-
class:
|
|
118
|
+
class: G(["hys-ui-pf-pagination-page", { "hys-ui-is-current": t === a.value }]),
|
|
120
119
|
type: "button",
|
|
121
120
|
disabled: r.value,
|
|
122
|
-
"aria-label": "第 " +
|
|
123
|
-
"aria-current":
|
|
124
|
-
onClick: (
|
|
121
|
+
"aria-label": "第 " + t + " 页",
|
|
122
|
+
"aria-current": t === a.value ? "page" : void 0,
|
|
123
|
+
onClick: (f) => y(t)
|
|
125
124
|
}, {
|
|
126
|
-
default:
|
|
127
|
-
|
|
125
|
+
default: S(() => [
|
|
126
|
+
V(g(t), 1)
|
|
128
127
|
]),
|
|
129
128
|
_: 2
|
|
130
|
-
}, 1032, ["disabled", "aria-label", "aria-current", "class", "onClick"])) : (
|
|
129
|
+
}, 1032, ["disabled", "aria-label", "aria-current", "class", "onClick"])) : (v(), c("span", ue, "…"))
|
|
131
130
|
], 64))), 128)),
|
|
132
|
-
|
|
133
|
-
|
|
131
|
+
d.compact ? w("", !0) : (v(), c("span", oe, g(a.value) + " / " + g(p.value), 1)),
|
|
132
|
+
o(M, {
|
|
134
133
|
variant: "secondary",
|
|
135
134
|
size: "sm",
|
|
136
135
|
type: "button",
|
|
137
|
-
disabled: r.value ||
|
|
136
|
+
disabled: r.value || a.value === p.value,
|
|
138
137
|
"aria-label": n.value.next,
|
|
139
138
|
title: n.value.next,
|
|
140
|
-
onClick: e[2] || (e[2] = (
|
|
139
|
+
onClick: e[2] || (e[2] = (t) => y(a.value + 1))
|
|
141
140
|
}, {
|
|
142
|
-
default:
|
|
143
|
-
|
|
141
|
+
default: S(() => [
|
|
142
|
+
o(C(Z), {
|
|
144
143
|
size: 16,
|
|
145
144
|
"aria-hidden": "true"
|
|
146
145
|
})
|
|
147
146
|
]),
|
|
148
147
|
_: 1
|
|
149
148
|
}, 8, ["disabled", "aria-label", "title"]),
|
|
150
|
-
|
|
149
|
+
o(M, {
|
|
151
150
|
variant: "secondary",
|
|
152
151
|
size: "sm",
|
|
153
152
|
type: "button",
|
|
154
|
-
disabled: r.value ||
|
|
153
|
+
disabled: r.value || a.value === p.value,
|
|
155
154
|
"aria-label": n.value.last,
|
|
156
155
|
title: n.value.last,
|
|
157
|
-
onClick: e[3] || (e[3] = (
|
|
156
|
+
onClick: e[3] || (e[3] = (t) => y(p.value))
|
|
158
157
|
}, {
|
|
159
|
-
default:
|
|
160
|
-
|
|
158
|
+
default: S(() => [
|
|
159
|
+
o(C(_), {
|
|
161
160
|
size: 16,
|
|
162
161
|
"aria-hidden": "true"
|
|
163
162
|
})
|
|
@@ -165,49 +164,50 @@ const ae = ["aria-busy"], te = {
|
|
|
165
164
|
_: 1
|
|
166
165
|
}, 8, ["disabled", "aria-label", "title"])
|
|
167
166
|
]),
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
"model-value": String(
|
|
172
|
-
options:
|
|
167
|
+
d.showSizeChanger ? (v(), c("label", re, [
|
|
168
|
+
V(g(n.value.perPage) + " ", 1),
|
|
169
|
+
o(ee, {
|
|
170
|
+
"model-value": String(h.value),
|
|
171
|
+
options: R.value.map((t) => ({ label: String(t), value: String(t) })),
|
|
173
172
|
disabled: r.value,
|
|
174
173
|
"aria-label": n.value.perPage,
|
|
175
|
-
"onUpdate:modelValue":
|
|
174
|
+
"onUpdate:modelValue": A
|
|
176
175
|
}, null, 8, ["model-value", "options", "disabled", "aria-label"])
|
|
177
|
-
])) :
|
|
178
|
-
|
|
176
|
+
])) : w("", !0),
|
|
177
|
+
d.showQuickJumper && !d.compact ? (v(), c("form", {
|
|
179
178
|
key: 1,
|
|
180
179
|
class: "hys-ui-pf-pagination-jump",
|
|
181
|
-
onSubmit:
|
|
180
|
+
onSubmit: K(D, ["prevent"])
|
|
182
181
|
}, [
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
modelValue:
|
|
186
|
-
"onUpdate:modelValue": e[4] || (e[4] = (
|
|
182
|
+
B("span", null, g(n.value.jump), 1),
|
|
183
|
+
o(ae, {
|
|
184
|
+
modelValue: x.value,
|
|
185
|
+
"onUpdate:modelValue": e[4] || (e[4] = (t) => x.value = t),
|
|
186
|
+
onInput: e[5] || (e[5] = (t) => m.value = t),
|
|
187
187
|
class: "hys-ui-pf-pagination-jump-input",
|
|
188
188
|
min: 1,
|
|
189
|
-
max:
|
|
189
|
+
max: p.value,
|
|
190
190
|
"show-controls": !1,
|
|
191
191
|
"select-on-focus": "",
|
|
192
192
|
disabled: r.value,
|
|
193
193
|
"aria-label": n.value.jump
|
|
194
194
|
}, null, 8, ["modelValue", "max", "disabled", "aria-label"]),
|
|
195
|
-
|
|
195
|
+
o(M, {
|
|
196
196
|
variant: "secondary",
|
|
197
197
|
size: "sm",
|
|
198
198
|
type: "submit",
|
|
199
|
-
disabled: r.value || !
|
|
199
|
+
disabled: r.value || !j.value
|
|
200
200
|
}, {
|
|
201
|
-
default:
|
|
202
|
-
|
|
201
|
+
default: S(() => [...e[6] || (e[6] = [
|
|
202
|
+
V("确定", -1)
|
|
203
203
|
])]),
|
|
204
204
|
_: 1
|
|
205
205
|
}, 8, ["disabled"])
|
|
206
|
-
], 32)) :
|
|
206
|
+
], 32)) : w("", !0)
|
|
207
207
|
])
|
|
208
|
-
], 16,
|
|
208
|
+
], 16, te));
|
|
209
209
|
}
|
|
210
210
|
});
|
|
211
211
|
export {
|
|
212
|
-
|
|
212
|
+
ge as default
|
|
213
213
|
};
|
|
@@ -1,43 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
props: {
|
|
6
|
-
roles: {},
|
|
7
|
-
resources: {},
|
|
8
|
-
modelValue: {}
|
|
9
|
-
},
|
|
10
|
-
emits: ["update:modelValue"],
|
|
11
|
-
setup(o, { emit: m }) {
|
|
12
|
-
const d = V(), h = o, y = m;
|
|
13
|
-
function k(c, r) {
|
|
14
|
-
y("update:modelValue", { ...h.modelValue, [c]: r.target.checked });
|
|
15
|
-
}
|
|
16
|
-
return (c, r) => (t(), l("div", f(b(d), { class: "hys-ui-ent-table-scroll" }), [
|
|
17
|
-
n("table", x, [
|
|
18
|
-
n("thead", null, [
|
|
19
|
-
n("tr", null, [
|
|
20
|
-
r[0] || (r[0] = n("th", null, "资源 / 角色", -1)),
|
|
21
|
-
(t(!0), l(s, null, a(o.roles, (e) => (t(), l("th", { key: e }, i(e), 1))), 128))
|
|
22
|
-
])
|
|
23
|
-
]),
|
|
24
|
-
n("tbody", null, [
|
|
25
|
-
(t(!0), l(s, null, a(o.resources, (e) => (t(), l("tr", { key: e }, [
|
|
26
|
-
n("th", null, i(e), 1),
|
|
27
|
-
(t(!0), l(s, null, a(o.roles, (u) => (t(), l("td", { key: u }, [
|
|
28
|
-
n("input", {
|
|
29
|
-
type: "checkbox",
|
|
30
|
-
"aria-label": e + " - " + u,
|
|
31
|
-
checked: !!o.modelValue[e + ":" + u],
|
|
32
|
-
onChange: (g) => k(e + ":" + u, g)
|
|
33
|
-
}, null, 40, C)
|
|
34
|
-
]))), 128))
|
|
35
|
-
]))), 128))
|
|
36
|
-
])
|
|
37
|
-
])
|
|
38
|
-
], 16));
|
|
39
|
-
}
|
|
40
|
-
});
|
|
1
|
+
import o from "./HysPermissionMatrix2.vue.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import r from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const m = /* @__PURE__ */ r(o, [["__scopeId", "data-v-30413028"]]);
|
|
41
5
|
export {
|
|
42
|
-
|
|
6
|
+
m as default
|
|
43
7
|
};
|
|
@@ -1,4 +1,102 @@
|
|
|
1
|
-
import f from "
|
|
1
|
+
import { defineComponent as A, openBlock as a, createElementBlock as o, mergeProps as B, unref as S, createElementVNode as r, createBlock as c, Fragment as s, createTextVNode as g, renderList as f, toDisplayString as v, createVNode as w } from "vue";
|
|
2
|
+
import b from "../HysCheckbox/HysCheckbox.vue.js";
|
|
3
|
+
import { useHysRootAttrs as H } from "../../config.js";
|
|
4
|
+
const N = { class: "hys-ui-ent-matrix" }, R = /* @__PURE__ */ A({
|
|
5
|
+
__name: "HysPermissionMatrix",
|
|
6
|
+
props: {
|
|
7
|
+
roles: {},
|
|
8
|
+
resources: {},
|
|
9
|
+
modelValue: {},
|
|
10
|
+
disabled: { type: Boolean },
|
|
11
|
+
readonly: { type: Boolean },
|
|
12
|
+
showSelectAll: { type: Boolean, default: !0 }
|
|
13
|
+
},
|
|
14
|
+
emits: ["update:modelValue", "change"],
|
|
15
|
+
setup(l, { emit: x }) {
|
|
16
|
+
const u = l, k = x, V = H();
|
|
17
|
+
function i(t, d) {
|
|
18
|
+
return (t ? [t] : u.resources).flatMap((e) => (d ? [d] : u.roles).map((n) => e + ":" + n));
|
|
19
|
+
}
|
|
20
|
+
function m(t) {
|
|
21
|
+
return t.length > 0 && t.every((d) => u.modelValue[d]);
|
|
22
|
+
}
|
|
23
|
+
function h(t) {
|
|
24
|
+
return !m(t) && t.some((d) => u.modelValue[d]);
|
|
25
|
+
}
|
|
26
|
+
function y(t, d) {
|
|
27
|
+
if (u.disabled || u.readonly) return;
|
|
28
|
+
const e = { ...u.modelValue };
|
|
29
|
+
for (const n of t) e[n] = d;
|
|
30
|
+
k("update:modelValue", e), k("change", e);
|
|
31
|
+
}
|
|
32
|
+
return (t, d) => (a(), o("div", B(S(V), { class: "hys-ui-ent-table-scroll" }), [
|
|
33
|
+
r("table", N, [
|
|
34
|
+
r("thead", null, [
|
|
35
|
+
r("tr", null, [
|
|
36
|
+
r("th", null, [
|
|
37
|
+
l.showSelectAll ? (a(), c(b, {
|
|
38
|
+
key: 0,
|
|
39
|
+
class: "hys-ui-matrix-group",
|
|
40
|
+
"model-value": m(i()),
|
|
41
|
+
indeterminate: h(i()),
|
|
42
|
+
disabled: l.disabled || !l.roles.length || !l.resources.length,
|
|
43
|
+
readonly: l.readonly,
|
|
44
|
+
"aria-label": "全选所有权限",
|
|
45
|
+
label: "资源 / 角色",
|
|
46
|
+
onChange: d[0] || (d[0] = (e) => y(i(), e))
|
|
47
|
+
}, null, 8, ["model-value", "indeterminate", "disabled", "readonly"])) : (a(), o(s, { key: 1 }, [
|
|
48
|
+
g("资源 / 角色")
|
|
49
|
+
], 64))
|
|
50
|
+
]),
|
|
51
|
+
(a(!0), o(s, null, f(l.roles, (e) => (a(), o("th", { key: e }, [
|
|
52
|
+
l.showSelectAll ? (a(), c(b, {
|
|
53
|
+
key: 0,
|
|
54
|
+
class: "hys-ui-matrix-group",
|
|
55
|
+
"model-value": m(i(void 0, e)),
|
|
56
|
+
indeterminate: h(i(void 0, e)),
|
|
57
|
+
disabled: l.disabled || !l.resources.length,
|
|
58
|
+
readonly: l.readonly,
|
|
59
|
+
"aria-label": "全选角色 " + e,
|
|
60
|
+
label: e,
|
|
61
|
+
onChange: (n) => y(i(void 0, e), n)
|
|
62
|
+
}, null, 8, ["model-value", "indeterminate", "disabled", "readonly", "aria-label", "label", "onChange"])) : (a(), o(s, { key: 1 }, [
|
|
63
|
+
g(v(e), 1)
|
|
64
|
+
], 64))
|
|
65
|
+
]))), 128))
|
|
66
|
+
])
|
|
67
|
+
]),
|
|
68
|
+
r("tbody", null, [
|
|
69
|
+
(a(!0), o(s, null, f(l.resources, (e) => (a(), o("tr", { key: e }, [
|
|
70
|
+
r("th", null, [
|
|
71
|
+
l.showSelectAll ? (a(), c(b, {
|
|
72
|
+
key: 0,
|
|
73
|
+
class: "hys-ui-matrix-group",
|
|
74
|
+
"model-value": m(i(e)),
|
|
75
|
+
indeterminate: h(i(e)),
|
|
76
|
+
disabled: l.disabled || !l.roles.length,
|
|
77
|
+
readonly: l.readonly,
|
|
78
|
+
"aria-label": "全选资源 " + e,
|
|
79
|
+
label: e,
|
|
80
|
+
onChange: (n) => y(i(e), n)
|
|
81
|
+
}, null, 8, ["model-value", "indeterminate", "disabled", "readonly", "aria-label", "label", "onChange"])) : (a(), o(s, { key: 1 }, [
|
|
82
|
+
g(v(e), 1)
|
|
83
|
+
], 64))
|
|
84
|
+
]),
|
|
85
|
+
(a(!0), o(s, null, f(l.roles, (n) => (a(), o("td", { key: n }, [
|
|
86
|
+
w(b, {
|
|
87
|
+
"aria-label": e + " - " + n,
|
|
88
|
+
"model-value": !!l.modelValue[e + ":" + n],
|
|
89
|
+
disabled: l.disabled,
|
|
90
|
+
readonly: l.readonly,
|
|
91
|
+
onChange: (C) => y([e + ":" + n], C)
|
|
92
|
+
}, null, 8, ["aria-label", "model-value", "disabled", "readonly", "onChange"])
|
|
93
|
+
]))), 128))
|
|
94
|
+
]))), 128))
|
|
95
|
+
])
|
|
96
|
+
])
|
|
97
|
+
], 16));
|
|
98
|
+
}
|
|
99
|
+
});
|
|
2
100
|
export {
|
|
3
|
-
|
|
101
|
+
R as default
|
|
4
102
|
};
|
|
@@ -1,42 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
props: {
|
|
6
|
-
modelValue: {},
|
|
7
|
-
options: {},
|
|
8
|
-
name: {},
|
|
9
|
-
disabled: { type: Boolean },
|
|
10
|
-
vertical: { type: Boolean },
|
|
11
|
-
ariaLabel: {}
|
|
12
|
-
},
|
|
13
|
-
emits: ["update:modelValue", "change"],
|
|
14
|
-
setup(a, { emit: i }) {
|
|
15
|
-
const r = y(), d = s(), n = i;
|
|
16
|
-
return (V, k) => (t(), l("div", c(o(r), {
|
|
17
|
-
class: "hys-ui-ex-radio",
|
|
18
|
-
role: "radiogroup",
|
|
19
|
-
"aria-label": a.ariaLabel || "单选组",
|
|
20
|
-
style: { flexDirection: a.vertical ? "column" : void 0 }
|
|
21
|
-
}), [
|
|
22
|
-
(t(!0), l(m, null, v(a.options, (e) => (t(), l("label", {
|
|
23
|
-
key: e.value
|
|
24
|
-
}, [
|
|
25
|
-
b("input", {
|
|
26
|
-
type: "radio",
|
|
27
|
-
name: a.name || o(d),
|
|
28
|
-
value: e.value,
|
|
29
|
-
checked: a.modelValue === e.value,
|
|
30
|
-
disabled: a.disabled || e.disabled,
|
|
31
|
-
onChange: (x) => {
|
|
32
|
-
n("update:modelValue", e.value), n("change", e.value);
|
|
33
|
-
}
|
|
34
|
-
}, null, 40, f),
|
|
35
|
-
h(" " + p(e.label), 1)
|
|
36
|
-
]))), 128))
|
|
37
|
-
], 16, g));
|
|
38
|
-
}
|
|
39
|
-
});
|
|
1
|
+
import o from "./HysRadioGroup2.vue.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import r from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const m = /* @__PURE__ */ r(o, [["__scopeId", "data-v-281378b2"]]);
|
|
40
5
|
export {
|
|
41
|
-
|
|
6
|
+
m as default
|
|
42
7
|
};
|
|
@@ -1,4 +1,82 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { defineComponent as q, useId as V, ref as A, openBlock as u, createElementBlock as t, mergeProps as B, unref as y, Fragment as w, renderList as x, normalizeClass as C, createElementVNode as s, renderSlot as D, createTextVNode as E, toDisplayString as S } from "vue";
|
|
2
|
+
import { useHysRootAttrs as L } from "../../config.js";
|
|
3
|
+
const R = ["aria-label", "aria-disabled", "aria-readonly", "aria-required"], z = ["name", "value", "checked", "disabled", "required", "onChange"], F = /* @__PURE__ */ q({
|
|
4
|
+
__name: "HysRadioGroup",
|
|
5
|
+
props: {
|
|
6
|
+
modelValue: {},
|
|
7
|
+
options: {},
|
|
8
|
+
name: {},
|
|
9
|
+
disabled: { type: Boolean },
|
|
10
|
+
readonly: { type: Boolean },
|
|
11
|
+
required: { type: Boolean },
|
|
12
|
+
vertical: { type: Boolean },
|
|
13
|
+
size: { default: "md" },
|
|
14
|
+
ariaLabel: {}
|
|
15
|
+
},
|
|
16
|
+
emits: ["update:modelValue", "change", "focus", "blur"],
|
|
17
|
+
setup(e, { expose: m, emit: b }) {
|
|
18
|
+
const i = e, o = b, f = L(), v = V(), n = A();
|
|
19
|
+
function h(r) {
|
|
20
|
+
var a;
|
|
21
|
+
if (i.disabled || i.readonly || r.disabled) {
|
|
22
|
+
(a = n.value) == null || a.querySelectorAll("input").forEach((d, k) => {
|
|
23
|
+
var c;
|
|
24
|
+
return d.checked = ((c = i.options[k]) == null ? void 0 : c.value) === i.modelValue;
|
|
25
|
+
});
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const l = r.value !== i.modelValue;
|
|
29
|
+
o("update:modelValue", r.value), l && o("change", r.value);
|
|
30
|
+
}
|
|
31
|
+
function g(r) {
|
|
32
|
+
i.readonly && [" ", "Enter", "ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown", "Home", "End"].includes(r.key) && r.preventDefault();
|
|
33
|
+
}
|
|
34
|
+
return m({ focus: () => {
|
|
35
|
+
var l, a, d;
|
|
36
|
+
(d = ((l = n.value) == null ? void 0 : l.querySelector("input:checked:not(:disabled)")) || ((a = n.value) == null ? void 0 : a.querySelector("input:not(:disabled)"))) == null || d.focus();
|
|
37
|
+
} }), (r, l) => (u(), t("div", B({
|
|
38
|
+
ref_key: "root",
|
|
39
|
+
ref: n
|
|
40
|
+
}, y(f), {
|
|
41
|
+
class: ["hys-ui-ex-radio", ["hys-ui-radio-" + e.size, { "hys-ui-radio-disabled": e.disabled, "hys-ui-radio-readonly": e.readonly }]],
|
|
42
|
+
role: "radiogroup",
|
|
43
|
+
"aria-label": e.ariaLabel || "单选组",
|
|
44
|
+
"aria-disabled": e.disabled || void 0,
|
|
45
|
+
"aria-readonly": e.readonly || void 0,
|
|
46
|
+
"aria-required": e.required || void 0,
|
|
47
|
+
style: { flexDirection: e.vertical ? "column" : void 0 },
|
|
48
|
+
onKeydown: g
|
|
49
|
+
}), [
|
|
50
|
+
(u(!0), t(w, null, x(e.options, (a) => (u(), t("label", {
|
|
51
|
+
key: a.value,
|
|
52
|
+
class: C(["hys-ui-radio-option", { "hys-ui-radio-option-disabled": !e.disabled && a.disabled }])
|
|
53
|
+
}, [
|
|
54
|
+
s("input", {
|
|
55
|
+
class: "hys-ui-radio-native",
|
|
56
|
+
type: "radio",
|
|
57
|
+
name: e.name || y(v),
|
|
58
|
+
value: a.value,
|
|
59
|
+
checked: e.modelValue === a.value,
|
|
60
|
+
disabled: e.disabled || a.disabled,
|
|
61
|
+
required: e.required,
|
|
62
|
+
onClick: l[0] || (l[0] = (d) => e.readonly && d.preventDefault()),
|
|
63
|
+
onChange: (d) => h(a),
|
|
64
|
+
onFocus: l[1] || (l[1] = (d) => o("focus", d)),
|
|
65
|
+
onBlur: l[2] || (l[2] = (d) => o("blur", d))
|
|
66
|
+
}, null, 40, z),
|
|
67
|
+
l[3] || (l[3] = s("span", {
|
|
68
|
+
class: "hys-ui-radio-box",
|
|
69
|
+
"aria-hidden": "true"
|
|
70
|
+
}, null, -1)),
|
|
71
|
+
s("span", null, [
|
|
72
|
+
D(r.$slots, "label", { option: a }, () => [
|
|
73
|
+
E(S(a.label), 1)
|
|
74
|
+
], !0)
|
|
75
|
+
])
|
|
76
|
+
], 2))), 128))
|
|
77
|
+
], 16, R));
|
|
78
|
+
}
|
|
79
|
+
});
|
|
2
80
|
export {
|
|
3
|
-
|
|
81
|
+
F as default
|
|
4
82
|
};
|