blessing-ui 0.2.0 → 0.3.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 +31 -0
- package/README.md +137 -125
- package/dist/blessing-ui.css +38 -2
- package/dist/components/BlessAnnotator.css +1 -0
- package/dist/components/BlessAnnotator.js +6 -0
- package/dist/components/BlessAnnotator.vue.d.ts +71 -0
- package/dist/components/BlessAnnotator.vue_vue_type_script_setup_true_lang.js +264 -0
- package/dist/components/BlessAttachment.vue.d.ts +4 -1
- package/dist/components/BlessAttachment.vue_vue_type_script_setup_true_lang.js +3 -2
- package/dist/components/BlessCalendar.vue.d.ts +4 -0
- package/dist/components/BlessCalendar.vue_vue_type_script_setup_true_lang.js +65 -60
- package/dist/components/BlessCarousel.vue.d.ts +3 -0
- package/dist/components/BlessCarousel.vue_vue_type_script_setup_true_lang.js +10 -9
- package/dist/components/BlessCoachmark.css +1 -0
- package/dist/components/BlessCoachmark.js +6 -0
- package/dist/components/BlessCoachmark.vue.d.ts +40 -0
- package/dist/components/BlessCoachmark.vue_vue_type_script_setup_true_lang.js +74 -0
- package/dist/components/BlessCodeBlock.vue.d.ts +10 -0
- package/dist/components/BlessCodeBlock.vue_vue_type_script_setup_true_lang.js +39 -33
- package/dist/components/BlessCombobox.vue.d.ts +2 -0
- package/dist/components/BlessCombobox.vue_vue_type_script_setup_true_lang.js +3 -2
- package/dist/components/BlessCommand.css +1 -1
- package/dist/components/BlessCommand.vue.d.ts +26 -0
- package/dist/components/BlessCommand.vue_vue_type_script_setup_true_lang.js +137 -70
- package/dist/components/BlessConfetti.css +1 -0
- package/dist/components/BlessConfetti.js +6 -0
- package/dist/components/BlessConfetti.vue.d.ts +40 -0
- package/dist/components/BlessConfetti.vue_vue_type_script_setup_true_lang.js +77 -0
- package/dist/components/BlessCropper.vue.d.ts +16 -0
- package/dist/components/BlessCropper.vue_vue_type_script_setup_true_lang.js +47 -39
- package/dist/components/BlessDataTable.vue.d.ts +6 -0
- package/dist/components/BlessDataTable.vue_vue_type_script_setup_true_lang.js +56 -42
- package/dist/components/BlessDataView.vue.d.ts +7 -0
- package/dist/components/BlessDataView.vue_vue_type_script_setup_true_lang.js +38 -31
- package/dist/components/BlessDatePicker.vue.d.ts +3 -0
- package/dist/components/BlessDatePicker.vue_vue_type_script_setup_true_lang.js +46 -45
- package/dist/components/BlessDock.css +1 -0
- package/dist/components/BlessDock.js +6 -0
- package/dist/components/BlessDock.vue.d.ts +55 -0
- package/dist/components/BlessDock.vue_vue_type_script_setup_true_lang.js +100 -0
- package/dist/components/BlessEditor.vue.d.ts +2 -0
- package/dist/components/BlessEditor.vue_vue_type_script_setup_true_lang.js +23 -22
- package/dist/components/BlessFileInput.vue.d.ts +2 -0
- package/dist/components/BlessFileInput.vue_vue_type_script_setup_true_lang.js +3 -2
- package/dist/components/BlessFormula.css +1 -0
- package/dist/components/BlessFormula.js +6 -0
- package/dist/components/BlessFormula.vue.d.ts +53 -0
- package/dist/components/BlessFormula.vue_vue_type_script_setup_true_lang.js +111 -0
- package/dist/components/BlessGantt.vue.d.ts +12 -0
- package/dist/components/BlessGantt.vue_vue_type_script_setup_true_lang.js +74 -68
- package/dist/components/BlessInfiniteCanvas.css +1 -0
- package/dist/components/BlessInfiniteCanvas.js +6 -0
- package/dist/components/BlessInfiniteCanvas.vue.d.ts +91 -0
- package/dist/components/BlessInfiniteCanvas.vue_vue_type_script_setup_true_lang.js +232 -0
- package/dist/components/BlessInputNumber.vue.d.ts +5 -0
- package/dist/components/BlessInputNumber.vue_vue_type_script_setup_true_lang.js +39 -34
- package/dist/components/BlessKanban.vue.d.ts +12 -0
- package/dist/components/BlessKanban.vue_vue_type_script_setup_true_lang.js +127 -97
- package/dist/components/BlessLoadingBar.vue.d.ts +2 -0
- package/dist/components/BlessLoadingBar.vue_vue_type_script_setup_true_lang.js +8 -3
- package/dist/components/BlessMarquee.vue.d.ts +4 -0
- package/dist/components/BlessMarquee.vue_vue_type_script_setup_true_lang.js +32 -27
- package/dist/components/BlessNodeGraph.css +1 -0
- package/dist/components/BlessNodeGraph.js +6 -0
- package/dist/components/BlessNodeGraph.vue.d.ts +110 -0
- package/dist/components/BlessNodeGraph.vue_vue_type_script_setup_true_lang.js +321 -0
- package/dist/components/BlessOnboardingChecklist.css +1 -0
- package/dist/components/BlessOnboardingChecklist.js +6 -0
- package/dist/components/BlessOnboardingChecklist.vue.d.ts +72 -0
- package/dist/components/BlessOnboardingChecklist.vue_vue_type_script_setup_true_lang.js +157 -0
- package/dist/components/BlessOrderList.vue.d.ts +5 -0
- package/dist/components/BlessOrderList.vue_vue_type_script_setup_true_lang.js +62 -56
- package/dist/components/BlessPagination.vue.d.ts +2 -0
- package/dist/components/BlessPagination.vue_vue_type_script_setup_true_lang.js +2 -1
- package/dist/components/BlessPickList.vue.d.ts +5 -0
- package/dist/components/BlessPickList.vue_vue_type_script_setup_true_lang.js +55 -49
- package/dist/components/BlessRangeCalendar.css +1 -0
- package/dist/components/BlessRangeCalendar.js +6 -0
- package/dist/components/BlessRangeCalendar.vue.d.ts +51 -0
- package/dist/components/BlessRangeCalendar.vue_vue_type_script_setup_true_lang.js +217 -0
- package/dist/components/BlessScheduler.css +1 -0
- package/dist/components/BlessScheduler.js +6 -0
- package/dist/components/BlessScheduler.vue.d.ts +95 -0
- package/dist/components/BlessScheduler.vue_vue_type_script_setup_true_lang.js +347 -0
- package/dist/components/BlessShortcutRecorder.vue.d.ts +10 -0
- package/dist/components/BlessShortcutRecorder.vue_vue_type_script_setup_true_lang.js +50 -40
- package/dist/components/BlessSignaturePad.vue.d.ts +1 -1
- package/dist/components/BlessSliderCaptcha.vue.d.ts +5 -0
- package/dist/components/BlessSliderCaptcha.vue_vue_type_script_setup_true_lang.js +89 -84
- package/dist/components/BlessSortable.css +1 -1
- package/dist/components/BlessSortable.vue.d.ts +19 -1
- package/dist/components/BlessSortable.vue_vue_type_script_setup_true_lang.js +103 -55
- package/dist/components/BlessSparkline.css +1 -0
- package/dist/components/BlessSparkline.js +6 -0
- package/dist/components/BlessSparkline.vue.d.ts +28 -0
- package/dist/components/BlessSparkline.vue_vue_type_script_setup_true_lang.js +107 -0
- package/dist/components/BlessSteps.vue.d.ts +2 -0
- package/dist/components/BlessSteps.vue_vue_type_script_setup_true_lang.js +3 -2
- package/dist/components/BlessSwipeDeck.vue.d.ts +1 -1
- package/dist/components/BlessSwipeDeck.vue_vue_type_script_setup_true_lang.js +2 -1
- package/dist/components/BlessTimer.vue.d.ts +18 -0
- package/dist/components/BlessTimer.vue_vue_type_script_setup_true_lang.js +52 -43
- package/dist/components/BlessTour.vue.d.ts +1 -0
- package/dist/components/BlessTour.vue_vue_type_script_setup_true_lang.js +48 -42
- package/dist/components/BlessTreemap.css +1 -0
- package/dist/components/BlessTreemap.js +6 -0
- package/dist/components/BlessTreemap.vue.d.ts +46 -0
- package/dist/components/BlessTreemap.vue_vue_type_script_setup_true_lang.js +137 -0
- package/dist/components/BlessUploader.vue.d.ts +11 -0
- package/dist/components/BlessUploader.vue_vue_type_script_setup_true_lang.js +80 -69
- package/dist/composables/annotate.d.ts +35 -0
- package/dist/composables/annotate.js +33 -0
- package/dist/composables/canvasView.d.ts +21 -0
- package/dist/composables/canvasView.js +23 -0
- package/dist/composables/confetti.d.ts +32 -0
- package/dist/composables/confetti.js +23 -0
- package/dist/composables/dayBlocks.d.ts +11 -0
- package/dist/composables/dayBlocks.js +26 -0
- package/dist/composables/formula.d.ts +28 -0
- package/dist/composables/formula.js +161 -0
- package/dist/composables/graph.d.ts +19 -0
- package/dist/composables/graph.js +16 -0
- package/dist/composables/schedule.d.ts +27 -0
- package/dist/composables/schedule.js +54 -0
- package/dist/composables/treemap.d.ts +23 -0
- package/dist/composables/treemap.js +77 -0
- package/dist/composables/useAutoScroll.d.ts +15 -0
- package/dist/composables/useAutoScroll.js +32 -0
- package/dist/composables/useSortable.d.ts +42 -2
- package/dist/composables/useSortable.js +87 -14
- package/dist/index.d.ts +25 -1
- package/dist/index.js +78 -63
- package/package.json +4 -2
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import e from "./BlessButton.js";
|
|
2
2
|
import { initialBox as t, moveBox as n, resizeBox as r, scaleBox as i } from "../composables/cropBox.js";
|
|
3
|
-
import { Fragment as a, computed as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createTextVNode as u, createVNode as d, defineComponent as f, mergeModels as p, nextTick as
|
|
3
|
+
import { Fragment as a, computed as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createTextVNode as u, createVNode as d, defineComponent as f, mergeModels as p, nextTick as ee, normalizeClass as m, normalizeStyle as h, onBeforeUnmount as g, openBlock as _, ref as v, renderList as te, toDisplayString as y, unref as b, useId as x, useModel as ne, watch as S, withCtx as C } from "vue";
|
|
4
4
|
//#region src/components/BlessCropper.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
-
var
|
|
5
|
+
var w = { class: "bless-cropper" }, T = {
|
|
6
6
|
key: 0,
|
|
7
7
|
class: "bless-cropper__error",
|
|
8
8
|
role: "alert"
|
|
9
|
-
},
|
|
9
|
+
}, E = ["aria-busy"], re = ["aria-label", "aria-describedby"], ie = ["onPointerdown"], D = {
|
|
10
10
|
key: 2,
|
|
11
11
|
class: "bless-cropper__foot"
|
|
12
|
-
},
|
|
12
|
+
}, ae = ["id"], O = {
|
|
13
13
|
key: 0,
|
|
14
14
|
class: "bless-cropper__controls"
|
|
15
|
-
},
|
|
15
|
+
}, oe = {
|
|
16
16
|
class: "bless-cropper__live",
|
|
17
17
|
"aria-live": "polite"
|
|
18
|
-
},
|
|
18
|
+
}, k = /*@__PURE__*/ f({
|
|
19
19
|
name: "BlessCropper",
|
|
20
20
|
__name: "BlessCropper",
|
|
21
21
|
props: /*@__PURE__*/ p({
|
|
@@ -26,14 +26,22 @@ var te = { class: "bless-cropper" }, ne = {
|
|
|
26
26
|
type: Boolean,
|
|
27
27
|
default: !0
|
|
28
28
|
},
|
|
29
|
-
label: { default: "Crop area" }
|
|
29
|
+
label: { default: "Crop area" },
|
|
30
|
+
labels: {}
|
|
30
31
|
}, {
|
|
31
32
|
modelValue: { default: null },
|
|
32
33
|
modelModifiers: {}
|
|
33
34
|
}),
|
|
34
35
|
emits: /*@__PURE__*/ p(["ready", "error"], ["update:modelValue"]),
|
|
35
|
-
setup(f, { expose: p, emit:
|
|
36
|
-
let
|
|
36
|
+
setup(f, { expose: p, emit: k }) {
|
|
37
|
+
let A = f, j = o(() => ({
|
|
38
|
+
size: (e, t, n, r) => `${e} by ${t} pixels, from ${n}, ${r}`,
|
|
39
|
+
hint: "arrows move, + − resize",
|
|
40
|
+
rotateLeft: "Rotate left",
|
|
41
|
+
rotateRight: "Rotate right",
|
|
42
|
+
loadError: "The image could not be loaded.",
|
|
43
|
+
...A.labels
|
|
44
|
+
})), M = ne(f, "modelValue"), N = k, P = x(), F = v(), I = v(), L = v(null), R = v(!1), z = v(0), B = v({
|
|
37
45
|
l: 0,
|
|
38
46
|
t: 0,
|
|
39
47
|
r: 1,
|
|
@@ -50,7 +58,7 @@ var te = { class: "bless-cropper" }, ne = {
|
|
|
50
58
|
w: 0,
|
|
51
59
|
h: 0
|
|
52
60
|
};
|
|
53
|
-
}), U = o(() =>
|
|
61
|
+
}), U = o(() => A.aspect && H.value.w ? A.aspect * H.value.h / H.value.w : 0), W = o(() => {
|
|
54
62
|
let { w: e, h: t } = H.value;
|
|
55
63
|
if (!e) return null;
|
|
56
64
|
let n = B.value;
|
|
@@ -62,19 +70,19 @@ var te = { class: "bless-cropper" }, ne = {
|
|
|
62
70
|
rotation: z.value
|
|
63
71
|
};
|
|
64
72
|
});
|
|
65
|
-
|
|
73
|
+
S(W, (e) => e && (M.value = e));
|
|
66
74
|
function G(e, t) {
|
|
67
75
|
let n = L.value, r = e.getContext("2d");
|
|
68
76
|
n && r && (e.width = Math.max(1, Math.round(H.value.w * t)), e.height = Math.max(1, Math.round(H.value.h * t)), r.translate(e.width / 2, e.height / 2), r.rotate(z.value * Math.PI / 180), r.drawImage(n, -n.naturalWidth * t / 2, -n.naturalHeight * t / 2, n.naturalWidth * t, n.naturalHeight * t));
|
|
69
77
|
}
|
|
70
78
|
let K = () => B.value = t(U.value);
|
|
71
|
-
|
|
79
|
+
S(() => [L.value, z.value], () => ee(() => I.value && G(I.value, Math.min(1, 1024 / Math.max(H.value.w, H.value.h))))), S(() => [
|
|
72
80
|
L.value,
|
|
73
81
|
z.value,
|
|
74
|
-
|
|
82
|
+
A.aspect
|
|
75
83
|
], K);
|
|
76
84
|
let q;
|
|
77
|
-
|
|
85
|
+
S(() => [A.src, A.crossorigin], ([e, t]) => {
|
|
78
86
|
L.value = null, R.value = !1;
|
|
79
87
|
let n = new Image();
|
|
80
88
|
q = n, n.crossOrigin = t, n.onload = () => {
|
|
@@ -103,7 +111,7 @@ var te = { class: "bless-cropper" }, ne = {
|
|
|
103
111
|
B.value = Y.h ? r(Y.box, Y.h, t.x, t.y, U.value) : n(Y.box, t.x - Y.x, t.y - Y.y);
|
|
104
112
|
}
|
|
105
113
|
let $ = () => Y = null;
|
|
106
|
-
function
|
|
114
|
+
function se(e) {
|
|
107
115
|
let t = e.shiftKey ? .1 : .01, r = {
|
|
108
116
|
ArrowLeft: [-t, 0],
|
|
109
117
|
ArrowRight: [t, 0],
|
|
@@ -116,9 +124,9 @@ var te = { class: "bless-cropper" }, ne = {
|
|
|
116
124
|
else return;
|
|
117
125
|
e.preventDefault();
|
|
118
126
|
let a = W.value;
|
|
119
|
-
V.value =
|
|
127
|
+
V.value = j.value.size(a.width, a.height, a.x, a.y);
|
|
120
128
|
}
|
|
121
|
-
let
|
|
129
|
+
let ce = o(() => U.value ? [
|
|
122
130
|
"nw",
|
|
123
131
|
"ne",
|
|
124
132
|
"se",
|
|
@@ -132,13 +140,13 @@ var te = { class: "bless-cropper" }, ne = {
|
|
|
132
140
|
"s",
|
|
133
141
|
"sw",
|
|
134
142
|
"w"
|
|
135
|
-
]),
|
|
143
|
+
]), le = o(() => ({
|
|
136
144
|
left: `${B.value.l * 100}%`,
|
|
137
145
|
top: `${B.value.t * 100}%`,
|
|
138
146
|
width: `${(B.value.r - B.value.l) * 100}%`,
|
|
139
147
|
height: `${(B.value.b - B.value.t) * 100}%`
|
|
140
148
|
}));
|
|
141
|
-
function
|
|
149
|
+
function ue(e = {}) {
|
|
142
150
|
let t = W.value;
|
|
143
151
|
if (!t || !L.value) return Promise.resolve(null);
|
|
144
152
|
let n = document.createElement("canvas");
|
|
@@ -147,11 +155,11 @@ var te = { class: "bless-cropper" }, ne = {
|
|
|
147
155
|
return i.width = Math.max(1, Math.round(t.width * r)), i.height = Math.max(1, Math.round(t.height * r)), i.getContext("2d")?.drawImage(n, t.x, t.y, t.width, t.height, 0, 0, i.width, i.height), new Promise((t) => i.toBlob(t, e.type ?? "image/png", e.quality));
|
|
148
156
|
}
|
|
149
157
|
return p({
|
|
150
|
-
toBlob:
|
|
158
|
+
toBlob: ue,
|
|
151
159
|
rotate: J,
|
|
152
160
|
reset: K
|
|
153
|
-
}), (t, n) => (_(), c("div",
|
|
154
|
-
R.value ? (_(), c("p",
|
|
161
|
+
}), (t, n) => (_(), c("div", w, [
|
|
162
|
+
R.value ? (_(), c("p", T, y(j.value.loadError), 1)) : (_(), c("div", {
|
|
155
163
|
key: 1,
|
|
156
164
|
ref_key: "stage",
|
|
157
165
|
ref: F,
|
|
@@ -168,45 +176,45 @@ var te = { class: "bless-cropper" }, ne = {
|
|
|
168
176
|
tabindex: "0",
|
|
169
177
|
role: "group",
|
|
170
178
|
"aria-label": f.label,
|
|
171
|
-
"aria-describedby": `${
|
|
172
|
-
style:
|
|
179
|
+
"aria-describedby": `${b(P)}-hint`,
|
|
180
|
+
style: h(le.value),
|
|
173
181
|
onPointerdown: n[0] ||= (e) => Z(null, e),
|
|
174
182
|
onPointermove: Q,
|
|
175
183
|
onPointerup: $,
|
|
176
184
|
onPointercancel: $,
|
|
177
|
-
onKeydown:
|
|
178
|
-
}, [(_(!0), c(a, null,
|
|
185
|
+
onKeydown: se
|
|
186
|
+
}, [(_(!0), c(a, null, te(ce.value, (e) => (_(), c("span", {
|
|
179
187
|
key: e,
|
|
180
|
-
class:
|
|
188
|
+
class: m(["bless-cropper__handle", `bless-cropper__handle--${e}`]),
|
|
181
189
|
"aria-hidden": "true",
|
|
182
190
|
onPointerdown: (t) => Z(e, t),
|
|
183
191
|
onPointermove: Q,
|
|
184
192
|
onPointerup: $,
|
|
185
193
|
onPointercancel: $
|
|
186
|
-
}, null, 42,
|
|
187
|
-
L.value ? (_(), c("div",
|
|
188
|
-
id: `${
|
|
194
|
+
}, null, 42, ie))), 128))], 44, re)) : s("", !0)], 8, E)),
|
|
195
|
+
L.value ? (_(), c("div", D, [l("span", {
|
|
196
|
+
id: `${b(P)}-hint`,
|
|
189
197
|
class: "bless-cropper__readout"
|
|
190
|
-
},
|
|
198
|
+
}, y(W.value?.width) + " × " + y(W.value?.height) + " px · " + y(j.value.hint), 9, ae), f.controls ? (_(), c("span", O, [d(e, {
|
|
191
199
|
size: "sm",
|
|
192
200
|
variant: "ghost",
|
|
193
|
-
"aria-label":
|
|
201
|
+
"aria-label": j.value.rotateLeft,
|
|
194
202
|
onClick: n[1] ||= (e) => J(-90)
|
|
195
203
|
}, {
|
|
196
|
-
default:
|
|
204
|
+
default: C(() => [...n[3] ||= [u("↺", -1)]]),
|
|
197
205
|
_: 1
|
|
198
|
-
}), d(e, {
|
|
206
|
+
}, 8, ["aria-label"]), d(e, {
|
|
199
207
|
size: "sm",
|
|
200
208
|
variant: "ghost",
|
|
201
|
-
"aria-label":
|
|
209
|
+
"aria-label": j.value.rotateRight,
|
|
202
210
|
onClick: n[2] ||= (e) => J(90)
|
|
203
211
|
}, {
|
|
204
|
-
default:
|
|
212
|
+
default: C(() => [...n[4] ||= [u("↻", -1)]]),
|
|
205
213
|
_: 1
|
|
206
|
-
})])) : s("", !0)])) : s("", !0),
|
|
207
|
-
l("span",
|
|
214
|
+
}, 8, ["aria-label"])])) : s("", !0)])) : s("", !0),
|
|
215
|
+
l("span", oe, y(V.value), 1)
|
|
208
216
|
]));
|
|
209
217
|
}
|
|
210
218
|
});
|
|
211
219
|
//#endregion
|
|
212
|
-
export {
|
|
220
|
+
export { k as default };
|
|
@@ -12,6 +12,12 @@ declare const __VLS_export: <T extends Record<string, unknown>>(__VLS_props: Non
|
|
|
12
12
|
searchPlaceholder?: string;
|
|
13
13
|
/** accessible name of the search box */
|
|
14
14
|
searchLabel?: string;
|
|
15
|
+
/** names of the select-page checkbox and the page-size select */
|
|
16
|
+
labels?: Partial<{
|
|
17
|
+
selectPage: string;
|
|
18
|
+
rowsPerPage: string;
|
|
19
|
+
selectRow: (name: string) => string;
|
|
20
|
+
}>;
|
|
15
21
|
emptyText?: string;
|
|
16
22
|
caption?: string;
|
|
17
23
|
/** rows are one server page; sort / query / page are yours to fetch with (see `state` event) */
|
|
@@ -5,19 +5,19 @@ import r from "./BlessSelect.js";
|
|
|
5
5
|
import i from "./BlessPagination.js";
|
|
6
6
|
import ee from "./BlessDropdownMenu.js";
|
|
7
7
|
import { useDataTable as a } from "../composables/useDataTable.js";
|
|
8
|
-
import { Fragment as o, computed as s, createBlock as c, createCommentVNode as l, createElementBlock as u, createElementVNode as d, createTextVNode as f, createVNode as p, defineComponent as m, normalizeClass as h, normalizeStyle as g, onMounted as _, openBlock as v, ref as y, renderList as b, renderSlot as x, resolveDynamicComponent as S, toDisplayString as C, toRef as w, unref as T, watch as E, withCtx as D, withModifiers as
|
|
8
|
+
import { Fragment as o, computed as s, createBlock as c, createCommentVNode as l, createElementBlock as u, createElementVNode as d, createTextVNode as f, createVNode as p, defineComponent as m, normalizeClass as h, normalizeStyle as g, onMounted as _, openBlock as v, ref as y, renderList as b, renderSlot as x, resolveDynamicComponent as S, toDisplayString as C, toRef as w, unref as T, watch as E, withCtx as D, withModifiers as te } from "vue";
|
|
9
9
|
//#region src/components/BlessDataTable.vue?vue&type=script&setup=true&lang.ts
|
|
10
|
-
var
|
|
10
|
+
var O = { class: "bless-datatable__toolbar" }, k = { class: "bless-datatable__scroll" }, A = ["aria-busy"], j = {
|
|
11
11
|
key: 0,
|
|
12
12
|
class: "bless-table__caption"
|
|
13
|
-
},
|
|
13
|
+
}, M = { class: "bless-table__head" }, N = {
|
|
14
14
|
key: 0,
|
|
15
15
|
scope: "col",
|
|
16
16
|
class: "bless-table__th bless-datatable__check"
|
|
17
|
-
},
|
|
17
|
+
}, P = ["aria-sort"], F = ["onClick"], I = {
|
|
18
18
|
class: "bless-datatable__sort-icon",
|
|
19
19
|
"aria-hidden": "true"
|
|
20
|
-
},
|
|
20
|
+
}, L = { key: 0 }, R = ["colspan"], z = ["aria-selected", "onClick"], B = { class: "bless-datatable__foot" }, V = { class: "bless-datatable__pager" }, H = /*@__PURE__*/ m({
|
|
21
21
|
name: "BlessDataTable",
|
|
22
22
|
__name: "BlessDataTable",
|
|
23
23
|
props: {
|
|
@@ -35,6 +35,7 @@ var k = { class: "bless-datatable__toolbar" }, A = { class: "bless-datatable__sc
|
|
|
35
35
|
searchKeys: {},
|
|
36
36
|
searchPlaceholder: { default: "Search…" },
|
|
37
37
|
searchLabel: { default: "Search rows" },
|
|
38
|
+
labels: {},
|
|
38
39
|
emptyText: { default: "No rows." },
|
|
39
40
|
caption: {},
|
|
40
41
|
server: { type: Boolean },
|
|
@@ -46,16 +47,21 @@ var k = { class: "bless-datatable__toolbar" }, A = { class: "bless-datatable__sc
|
|
|
46
47
|
"rowClick",
|
|
47
48
|
"state"
|
|
48
49
|
],
|
|
49
|
-
setup(m, { expose:
|
|
50
|
-
let
|
|
50
|
+
setup(m, { expose: H, emit: U }) {
|
|
51
|
+
let W = m, G = s(() => ({
|
|
52
|
+
selectPage: "Select page",
|
|
53
|
+
rowsPerPage: "Rows per page",
|
|
54
|
+
selectRow: (e) => `Select ${e}`,
|
|
55
|
+
...W.labels
|
|
56
|
+
})), K = U, q = s(() => W.rows), J = s(() => [.../* @__PURE__ */ new Set([W.pageSize, ...W.pageSizes])].sort((e, t) => e - t).map((e) => ({
|
|
51
57
|
value: e,
|
|
52
58
|
label: `${e} / page`
|
|
53
59
|
}))), Y = a(q, {
|
|
54
|
-
rowKey:
|
|
55
|
-
pageSize:
|
|
56
|
-
searchKeys:
|
|
57
|
-
server:
|
|
58
|
-
total: w(() =>
|
|
60
|
+
rowKey: W.rowKey,
|
|
61
|
+
pageSize: W.pageSize,
|
|
62
|
+
searchKeys: W.searchKeys,
|
|
63
|
+
server: W.server,
|
|
64
|
+
total: w(() => W.total ?? 0)
|
|
59
65
|
}), { state: X } = Y, Z = () => ({
|
|
60
66
|
sortKey: X.sortKey,
|
|
61
67
|
sortDir: X.sortDir,
|
|
@@ -69,26 +75,26 @@ var k = { class: "bless-datatable__toolbar" }, A = { class: "bless-datatable__sc
|
|
|
69
75
|
X.query,
|
|
70
76
|
X.page,
|
|
71
77
|
X.pageSize
|
|
72
|
-
], () =>
|
|
73
|
-
let Q = s(() =>
|
|
78
|
+
], () => W.server && K("state", Z())), _(() => W.server && K("state", Z()));
|
|
79
|
+
let Q = s(() => W.columns.filter((e) => !X.hidden.has(e.key))), ne = s(() => [{
|
|
74
80
|
type: "label",
|
|
75
81
|
label: "Columns"
|
|
76
|
-
}, ...
|
|
82
|
+
}, ...W.columns.filter((e) => e.hideable !== !1).map((e) => ({
|
|
77
83
|
type: "checkbox",
|
|
78
84
|
label: e.label,
|
|
79
85
|
value: e.key
|
|
80
|
-
}))]),
|
|
81
|
-
function
|
|
86
|
+
}))]), re = s(() => Object.fromEntries(W.columns.map((e) => [e.key, !X.hidden.has(e.key)]))), ie = y(), $ = s(() => W.columns.find((e) => e.header)?.key), ae = (e, t) => $.value ? String(e[$.value]) : `row ${(X.page - 1) * X.pageSize + t + 1}`;
|
|
87
|
+
function oe(e) {
|
|
82
88
|
Y.toggle(e), K("update:selected", Y.selectedRows.value);
|
|
83
89
|
}
|
|
84
|
-
function
|
|
90
|
+
function se() {
|
|
85
91
|
Y.togglePage(), K("update:selected", Y.selectedRows.value);
|
|
86
92
|
}
|
|
87
|
-
return
|
|
93
|
+
return H({
|
|
88
94
|
state: X,
|
|
89
95
|
selectedRows: Y.selectedRows
|
|
90
96
|
}), (a, s) => (v(), u("div", { class: h(["bless-datatable", { "bless-datatable--loading": m.loading }]) }, [
|
|
91
|
-
d("div",
|
|
97
|
+
d("div", O, [
|
|
92
98
|
m.searchable ? (v(), c(t, {
|
|
93
99
|
key: 0,
|
|
94
100
|
modelValue: T(X).query,
|
|
@@ -108,8 +114,8 @@ var k = { class: "bless-datatable__toolbar" }, A = { class: "bless-datatable__sc
|
|
|
108
114
|
selected: T(Y).selectedRows.value
|
|
109
115
|
}),
|
|
110
116
|
p(ee, {
|
|
111
|
-
items:
|
|
112
|
-
checked:
|
|
117
|
+
items: ne.value,
|
|
118
|
+
checked: re.value,
|
|
113
119
|
placement: "bottom-end",
|
|
114
120
|
class: "bless-datatable__cols",
|
|
115
121
|
onSelect: s[2] ||= (e) => e.type === "checkbox" && T(Y).toggleColumn(e.value)
|
|
@@ -121,19 +127,23 @@ var k = { class: "bless-datatable__toolbar" }, A = { class: "bless-datatable__sc
|
|
|
121
127
|
_: 1
|
|
122
128
|
}, 8, ["items", "checked"])
|
|
123
129
|
]),
|
|
124
|
-
d("div",
|
|
130
|
+
d("div", k, [d("table", {
|
|
125
131
|
class: "bless-table bless-datatable__table",
|
|
126
132
|
"aria-busy": m.loading || void 0
|
|
127
133
|
}, [
|
|
128
|
-
m.caption ? (v(), u("caption",
|
|
129
|
-
d("thead",
|
|
134
|
+
m.caption ? (v(), u("caption", j, C(m.caption), 1)) : l("", !0),
|
|
135
|
+
d("thead", M, [d("tr", null, [m.selectable ? (v(), u("th", N, [p(n, {
|
|
130
136
|
ref_key: "selectAllRef",
|
|
131
|
-
ref:
|
|
137
|
+
ref: ie,
|
|
132
138
|
"model-value": T(Y).allPageSelected.value,
|
|
133
139
|
indeterminate: !T(Y).allPageSelected.value && T(Y).somePageSelected.value,
|
|
134
|
-
"aria-label":
|
|
135
|
-
"onUpdate:modelValue":
|
|
136
|
-
}, null, 8, [
|
|
140
|
+
"aria-label": G.value.selectPage,
|
|
141
|
+
"onUpdate:modelValue": se
|
|
142
|
+
}, null, 8, [
|
|
143
|
+
"model-value",
|
|
144
|
+
"indeterminate",
|
|
145
|
+
"aria-label"
|
|
146
|
+
])])) : l("", !0), (v(!0), u(o, null, b(Q.value, (e) => (v(), u("th", {
|
|
137
147
|
key: e.key,
|
|
138
148
|
scope: "col",
|
|
139
149
|
class: h(["bless-table__th", [e.align && `bless-table__cell--${e.align}`, { "bless-datatable__th--sortable": e.sortable }]]),
|
|
@@ -144,11 +154,11 @@ var k = { class: "bless-datatable__toolbar" }, A = { class: "bless-datatable__sc
|
|
|
144
154
|
type: "button",
|
|
145
155
|
class: "bless-datatable__sort",
|
|
146
156
|
onClick: (t) => T(Y).sortBy(e.key)
|
|
147
|
-
}, [f(C(e.label) + " ", 1), d("span",
|
|
148
|
-
d("tbody", null, [T(Y).pageRows.value.length ? l("", !0) : (v(), u("tr",
|
|
157
|
+
}, [f(C(e.label) + " ", 1), d("span", I, C(T(X).sortKey === e.key ? T(X).sortDir === "asc" ? "↑" : "↓" : "↕"), 1)], 8, F)) : (v(), u(o, { key: 1 }, [f(C(e.label), 1)], 64))], 14, P))), 128))])]),
|
|
158
|
+
d("tbody", null, [T(Y).pageRows.value.length ? l("", !0) : (v(), u("tr", L, [d("td", {
|
|
149
159
|
colspan: Q.value.length + +!!m.selectable,
|
|
150
160
|
class: "bless-table__cell bless-datatable__empty"
|
|
151
|
-
}, C(m.emptyText), 9,
|
|
161
|
+
}, C(m.emptyText), 9, R)])), (v(!0), u(o, null, b(T(Y).pageRows.value, (e, t) => (v(), u("tr", {
|
|
152
162
|
key: String(T(Y).keyOf(e)),
|
|
153
163
|
class: h(["bless-table__row bless-datatable__row", { "bless-datatable__row--selected": T(X).selected.has(T(Y).keyOf(e)) }]),
|
|
154
164
|
"aria-selected": m.selectable ? T(X).selected.has(T(Y).keyOf(e)) : void 0,
|
|
@@ -156,11 +166,11 @@ var k = { class: "bless-datatable__toolbar" }, A = { class: "bless-datatable__sc
|
|
|
156
166
|
}, [m.selectable ? (v(), u("td", {
|
|
157
167
|
key: 0,
|
|
158
168
|
class: "bless-table__cell bless-datatable__check",
|
|
159
|
-
onClick: s[3] ||=
|
|
169
|
+
onClick: s[3] ||= te(() => {}, ["stop"])
|
|
160
170
|
}, [p(n, {
|
|
161
171
|
"model-value": T(X).selected.has(T(Y).keyOf(e)),
|
|
162
|
-
"aria-label":
|
|
163
|
-
"onUpdate:modelValue": (t) =>
|
|
172
|
+
"aria-label": G.value.selectRow(ae(e, t)),
|
|
173
|
+
"onUpdate:modelValue": (t) => oe(e)
|
|
164
174
|
}, null, 8, [
|
|
165
175
|
"model-value",
|
|
166
176
|
"aria-label",
|
|
@@ -181,25 +191,29 @@ var k = { class: "bless-datatable__toolbar" }, A = { class: "bless-datatable__sc
|
|
|
181
191
|
"scope",
|
|
182
192
|
"class",
|
|
183
193
|
"data-label"
|
|
184
|
-
]))), 128))], 10,
|
|
185
|
-
], 8,
|
|
186
|
-
d("div",
|
|
194
|
+
]))), 128))], 10, z))), 128))])
|
|
195
|
+
], 8, A)]),
|
|
196
|
+
d("div", B, [p(e, {
|
|
187
197
|
size: "xs",
|
|
188
198
|
muted: "",
|
|
189
199
|
role: "status"
|
|
190
200
|
}, {
|
|
191
201
|
default: D(() => [m.selectable && T(X).selected.size ? (v(), u(o, { key: 0 }, [f(C(T(X).selected.size) + " selected · ", 1)], 64)) : l("", !0), f(" " + C(T(Y).sorted.value.length) + " rows ", 1)]),
|
|
192
202
|
_: 1
|
|
193
|
-
}), d("div",
|
|
203
|
+
}), d("div", V, [p(r, {
|
|
194
204
|
"model-value": T(X).pageSize,
|
|
195
205
|
size: "sm",
|
|
196
|
-
"aria-label":
|
|
206
|
+
"aria-label": G.value.rowsPerPage,
|
|
197
207
|
options: J.value,
|
|
198
208
|
class: "bless-datatable__size",
|
|
199
209
|
"onUpdate:modelValue": s[4] ||= (e) => {
|
|
200
210
|
T(X).pageSize = Number(e), T(X).page = 1;
|
|
201
211
|
}
|
|
202
|
-
}, null, 8, [
|
|
212
|
+
}, null, 8, [
|
|
213
|
+
"model-value",
|
|
214
|
+
"aria-label",
|
|
215
|
+
"options"
|
|
216
|
+
]), p(i, {
|
|
203
217
|
modelValue: T(X).page,
|
|
204
218
|
"onUpdate:modelValue": s[5] ||= (e) => T(X).page = e,
|
|
205
219
|
total: T(Y).pageCount.value,
|
|
@@ -209,4 +223,4 @@ var k = { class: "bless-datatable__toolbar" }, A = { class: "bless-datatable__sc
|
|
|
209
223
|
}
|
|
210
224
|
});
|
|
211
225
|
//#endregion
|
|
212
|
-
export {
|
|
226
|
+
export { H as default };
|
|
@@ -8,6 +8,13 @@ declare const __VLS_export: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_se
|
|
|
8
8
|
label?: string;
|
|
9
9
|
/** hide the list/grid switch */
|
|
10
10
|
switchable?: boolean;
|
|
11
|
+
/** names of the layout switch and its two buttons */
|
|
12
|
+
labels?: Partial<{
|
|
13
|
+
layout: string;
|
|
14
|
+
list: string;
|
|
15
|
+
grid: string;
|
|
16
|
+
empty: string;
|
|
17
|
+
}>;
|
|
11
18
|
} & {
|
|
12
19
|
layout?: "list" | "grid";
|
|
13
20
|
}) & {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import e from "./BlessToggle.js";
|
|
2
2
|
import t from "./BlessToggleGroup.js";
|
|
3
3
|
import n from "./BlessPagination.js";
|
|
4
|
-
import { Fragment as r, computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createTextVNode as l, createVNode as u, defineComponent as d, mergeModels as f, normalizeClass as p, normalizeStyle as m, openBlock as h, ref as g, renderList as _, renderSlot as v,
|
|
4
|
+
import { Fragment as r, computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createTextVNode as l, createVNode as u, defineComponent as d, mergeModels as f, normalizeClass as p, normalizeStyle as m, openBlock as h, ref as g, renderList as _, renderSlot as v, toDisplayString as y, useModel as b, watch as x, withCtx as S } from "vue";
|
|
5
5
|
//#region src/components/BlessDataView.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
-
var
|
|
6
|
+
var C = {
|
|
7
7
|
key: 0,
|
|
8
8
|
class: "bless-dataview__bar"
|
|
9
|
-
},
|
|
9
|
+
}, w = { class: "bless-dataview__header" }, T = ["aria-label"], E = {
|
|
10
10
|
key: 2,
|
|
11
11
|
class: "bless-dataview__empty"
|
|
12
|
-
},
|
|
12
|
+
}, D = /*@__PURE__*/ d({
|
|
13
13
|
name: "BlessDataView",
|
|
14
14
|
__name: "BlessDataView",
|
|
15
15
|
props: /*@__PURE__*/ f({
|
|
@@ -21,66 +21,73 @@ var S = {
|
|
|
21
21
|
switchable: {
|
|
22
22
|
type: Boolean,
|
|
23
23
|
default: !0
|
|
24
|
-
}
|
|
24
|
+
},
|
|
25
|
+
labels: {}
|
|
25
26
|
}, {
|
|
26
27
|
layout: { default: "list" },
|
|
27
28
|
layoutModifiers: {}
|
|
28
29
|
}),
|
|
29
30
|
emits: ["update:layout"],
|
|
30
31
|
setup(d) {
|
|
31
|
-
let f = d,
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
let f = d, D = i(() => ({
|
|
33
|
+
layout: "Layout",
|
|
34
|
+
list: "List",
|
|
35
|
+
grid: "Grid",
|
|
36
|
+
empty: "No items",
|
|
37
|
+
...f.labels
|
|
38
|
+
})), O = b(d, "layout"), k = g(1), A = i(() => f.pageSize ? Math.max(1, Math.ceil(f.items.length / f.pageSize)) : 1);
|
|
39
|
+
x(A, (e) => k.value > e && (k.value = e));
|
|
40
|
+
let j = i(() => f.pageSize ? f.items.slice((k.value - 1) * f.pageSize, k.value * f.pageSize) : f.items);
|
|
34
41
|
return (i, f) => (h(), s("div", {
|
|
35
|
-
class: p(["bless-dataview", `bless-dataview--${
|
|
42
|
+
class: p(["bless-dataview", `bless-dataview--${O.value}`]),
|
|
36
43
|
style: m({ "--_col": d.columns })
|
|
37
44
|
}, [
|
|
38
|
-
i.$slots.header || d.switchable ? (h(), s("div",
|
|
45
|
+
i.$slots.header || d.switchable ? (h(), s("div", C, [c("div", w, [v(i.$slots, "header", { layout: O.value })]), d.switchable ? (h(), a(t, {
|
|
39
46
|
key: 0,
|
|
40
|
-
"model-value":
|
|
41
|
-
label:
|
|
42
|
-
"onUpdate:modelValue": f[0] ||= (e) =>
|
|
47
|
+
"model-value": O.value,
|
|
48
|
+
label: D.value.layout,
|
|
49
|
+
"onUpdate:modelValue": f[0] ||= (e) => O.value = e ?? "list"
|
|
43
50
|
}, {
|
|
44
|
-
default:
|
|
51
|
+
default: S(() => [u(e, {
|
|
45
52
|
value: "list",
|
|
46
53
|
size: "sm",
|
|
47
|
-
label:
|
|
54
|
+
label: D.value.list
|
|
48
55
|
}, {
|
|
49
|
-
default:
|
|
56
|
+
default: S(() => [...f[2] ||= [l("☰", -1)]]),
|
|
50
57
|
_: 1
|
|
51
|
-
}), u(e, {
|
|
58
|
+
}, 8, ["label"]), u(e, {
|
|
52
59
|
value: "grid",
|
|
53
60
|
size: "sm",
|
|
54
|
-
label:
|
|
61
|
+
label: D.value.grid
|
|
55
62
|
}, {
|
|
56
|
-
default:
|
|
63
|
+
default: S(() => [...f[3] ||= [l("▦", -1)]]),
|
|
57
64
|
_: 1
|
|
58
|
-
})]),
|
|
65
|
+
}, 8, ["label"])]),
|
|
59
66
|
_: 1
|
|
60
|
-
}, 8, ["model-value"])) : o("", !0)])) : o("", !0),
|
|
61
|
-
|
|
67
|
+
}, 8, ["model-value", "label"])) : o("", !0)])) : o("", !0),
|
|
68
|
+
j.value.length ? (h(), s("div", {
|
|
62
69
|
key: 1,
|
|
63
70
|
class: "bless-dataview__items",
|
|
64
71
|
role: "list",
|
|
65
72
|
"aria-label": d.label
|
|
66
|
-
}, [(h(!0), s(r, null, _(
|
|
73
|
+
}, [(h(!0), s(r, null, _(j.value, (e, t) => (h(), s("div", {
|
|
67
74
|
key: d.rowKey ? d.rowKey(e, t) : t,
|
|
68
75
|
class: "bless-dataview__item",
|
|
69
76
|
role: "listitem"
|
|
70
77
|
}, [v(i.$slots, "default", {
|
|
71
78
|
item: e,
|
|
72
|
-
index: (
|
|
73
|
-
layout:
|
|
74
|
-
})]))), 128))], 8,
|
|
75
|
-
|
|
79
|
+
index: (k.value - 1) * d.pageSize + t,
|
|
80
|
+
layout: O.value
|
|
81
|
+
})]))), 128))], 8, T)) : (h(), s("div", E, [v(i.$slots, "empty", {}, () => [l(y(D.value.empty), 1)])])),
|
|
82
|
+
A.value > 1 ? (h(), a(n, {
|
|
76
83
|
key: 3,
|
|
77
|
-
modelValue:
|
|
78
|
-
"onUpdate:modelValue": f[1] ||= (e) =>
|
|
79
|
-
total:
|
|
84
|
+
modelValue: k.value,
|
|
85
|
+
"onUpdate:modelValue": f[1] ||= (e) => k.value = e,
|
|
86
|
+
total: A.value,
|
|
80
87
|
class: "bless-dataview__pager"
|
|
81
88
|
}, null, 8, ["modelValue", "total"])) : o("", !0)
|
|
82
89
|
], 6));
|
|
83
90
|
}
|
|
84
91
|
});
|
|
85
92
|
//#endregion
|
|
86
|
-
export {
|
|
93
|
+
export { D as default };
|
|
@@ -10,6 +10,8 @@ type __VLS_Props = {
|
|
|
10
10
|
/** prefer native <input type=date> on coarse pointers (touch) */
|
|
11
11
|
nativeOnTouch?: boolean;
|
|
12
12
|
size?: "sm" | "md" | "lg";
|
|
13
|
+
/** accessible name of the clear button */
|
|
14
|
+
clearLabel?: string;
|
|
13
15
|
};
|
|
14
16
|
type __VLS_ModelProps = {
|
|
15
17
|
modelValue?: string | [string, string] | undefined;
|
|
@@ -24,6 +26,7 @@ declare const __VLS_export: import('vue').DefineComponent<__VLS_PublicProps, {},
|
|
|
24
26
|
placeholder: string;
|
|
25
27
|
locale: string;
|
|
26
28
|
nativeOnTouch: boolean;
|
|
29
|
+
clearLabel: string;
|
|
27
30
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
28
31
|
declare const _default: typeof __VLS_export;
|
|
29
32
|
export default _default;
|