vlite3 1.3.10 → 1.4.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/components/Accordion/Accordion.vue.d.ts +2 -2
- package/components/Accordion/AccordionItem.vue.d.ts +1 -1
- package/components/Accordion/AccordionItem.vue.js +11 -7
- package/components/Accordion/AccordionTrigger.vue.d.ts +1 -1
- package/components/AsyncSelect/createAsyncSelect.d.ts +44 -3
- package/components/AsyncSelect/createAsyncSelect.js +107 -76
- package/components/CategoryManager/CategoryManager.vue2.js +35 -31
- package/components/Dropdown/DropdownBooleanItem.vue.js +6 -6
- package/components/Dropdown/DropdownItem.vue.js +17 -17
- package/components/Dropdown/DropdownMenu.vue.js +2 -2
- package/components/Dropdown/{DropdownMenu.vue3.js → DropdownMenu.vue2.js} +23 -23
- package/components/Form/Form.vue.d.ts +17 -5
- package/components/Form/Form.vue.js +1 -1
- package/components/Form/Form.vue2.js +347 -285
- package/components/Form/FormField.vue.js +108 -82
- package/components/Form/FormFields.vue.js +2 -2
- package/components/Form/FormFields.vue2.js +7 -6
- package/components/Form/composables/useForm.js +100 -95
- package/components/Form/types.d.ts +33 -5
- package/components/NavbarCommandPalette.vue.d.ts +1 -1
- package/components/NumberInput.vue.js +1 -1
- package/components/NumberInput.vue2.js +47 -45
- package/components/RichTextEditor/RichTextEditor.vue.js +43 -48
- package/components/RichTextEditor/RichTextLinkPopover.vue3.js +2 -2
- package/components/RichTextEditor/RichTextToolbar.vue.d.ts +12 -3
- package/components/RichTextEditor/{RichTextToolbar.vue.js → RichTextToolbar.vue2.js} +157 -121
- package/components/RichTextEditor/RichTextToolbar.vue3.js +2 -2
- package/components/RichTextEditor/index.d.ts +2 -0
- package/components/RichTextEditor/types.d.ts +38 -0
- package/components/RichTextEditor/types.js +52 -0
- package/components/Screen/ScreenFilter.vue.js +15 -11
- package/components/SidebarMenu/SidebarMenu.vue.d.ts +2 -2
- package/components/Tabes/Tabes.vue.js +2 -2
- package/components/Tabes/Tabes.vue2.js +73 -71
- package/components/Workbook/Sheet.vue.d.ts +1 -1
- package/index.js +298 -295
- package/package.json +1 -1
- package/style.css +37 -1
- /package/components/RichTextEditor/{RichTextLinkPopover.vue.js → RichTextLinkPopover.vue2.js} +0 -0
|
@@ -29,10 +29,10 @@ declare const __VLS_component: import('vue').DefineComponent<AccordionProps, {},
|
|
|
29
29
|
variant: import('./types').AccordionVariant;
|
|
30
30
|
size: import('./types').AccordionSize;
|
|
31
31
|
disabled: boolean;
|
|
32
|
-
attached: boolean;
|
|
33
|
-
items: import('./types').AccordionItemSchema[];
|
|
34
32
|
showIndex: boolean;
|
|
35
33
|
iconVariant: import('./types').IconVariant;
|
|
34
|
+
attached: boolean;
|
|
35
|
+
items: import('./types').AccordionItemSchema[];
|
|
36
36
|
allowMultiple: boolean;
|
|
37
37
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
|
|
38
38
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
@@ -44,8 +44,8 @@ declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {},
|
|
|
44
44
|
variant: AccordionVariant;
|
|
45
45
|
size: AccordionSize;
|
|
46
46
|
disabled: boolean;
|
|
47
|
-
attached: boolean;
|
|
48
47
|
showIndex: boolean;
|
|
48
|
+
attached: boolean;
|
|
49
49
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
50
50
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
51
51
|
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as B, computed as r, openBlock as c, createElementBlock as m, normalizeClass as u, renderSlot as f, createVNode as p, withCtx as
|
|
1
|
+
import { defineComponent as B, computed as r, openBlock as c, createElementBlock as m, normalizeClass as u, renderSlot as f, createVNode as p, withCtx as x, createElementVNode as V, toDisplayString as v, createCommentVNode as $, withDirectives as O, createBlock as T, resolveDynamicComponent as A, vShow as D } from "vue";
|
|
2
2
|
import P from "./AccordionTrigger.vue.js";
|
|
3
3
|
import N from "./AccordionContent.vue.js";
|
|
4
4
|
import { $t as h } from "../../utils/i18n.js";
|
|
@@ -38,7 +38,7 @@ const S = { class: "font-medium" }, E = {
|
|
|
38
38
|
md: "px-4 py-3 text-base",
|
|
39
39
|
lg: "px-5 py-4 text-lg"
|
|
40
40
|
}[a];
|
|
41
|
-
return t === "solid" ? `${i} ${s} bg-
|
|
41
|
+
return t === "solid" ? `${i} ${s} bg-card ${o}` : t === "ghost" ? d ? `${i} ${s} bg-muted font-medium ${o}` : `${i} ${s} hover:bg-muted/20 bg-transparent ${o}` : t === "outline" || t === "separated" ? d ? `${i} ${s} bg-muted/5 border-b border-border ${o}` : `${i} ${s} hover:bg-muted/5 bg-transparent ${o}` : !n.attached && t === "default" ? `${i} ${{
|
|
42
42
|
sm: "py-2 text-base",
|
|
43
43
|
md: "py-3 text-base",
|
|
44
44
|
lg: "py-4 text-lg"
|
|
@@ -54,7 +54,11 @@ const S = { class: "font-medium" }, E = {
|
|
|
54
54
|
md: "pb-4 pt-4 text-sm",
|
|
55
55
|
lg: "pb-5 pt-5 text-base"
|
|
56
56
|
}[a]} px-0`;
|
|
57
|
-
}), k = r(
|
|
57
|
+
}), k = r(
|
|
58
|
+
() => n.item.titleI18n ? h(n.item.titleI18n) : n.item.title
|
|
59
|
+
), b = r(
|
|
60
|
+
() => n.item.descriptionI18n ? h(n.item.descriptionI18n) : n.item.description
|
|
61
|
+
);
|
|
58
62
|
return (t, a) => (c(), m("div", {
|
|
59
63
|
class: u([I.value, n.class, n.itemClass])
|
|
60
64
|
}, [
|
|
@@ -78,9 +82,9 @@ const S = { class: "font-medium" }, E = {
|
|
|
78
82
|
class: u(g.value),
|
|
79
83
|
onClick: l
|
|
80
84
|
}, {
|
|
81
|
-
default:
|
|
82
|
-
V("span", S,
|
|
83
|
-
b.value ? (c(), m("span", E,
|
|
85
|
+
default: x(() => [
|
|
86
|
+
V("span", S, v(k.value), 1),
|
|
87
|
+
b.value ? (c(), m("span", E, v(b.value), 1)) : $("", !0)
|
|
84
88
|
]),
|
|
85
89
|
_: 1
|
|
86
90
|
}, 8, ["open", "size", "disabled", "icon", "index", "show-index", "open-icon", "close-icon", "icon-variant", "active-icon-variant", "class"])
|
|
@@ -88,7 +92,7 @@ const S = { class: "font-medium" }, E = {
|
|
|
88
92
|
O(p(N, {
|
|
89
93
|
class: u(w.value)
|
|
90
94
|
}, {
|
|
91
|
-
default:
|
|
95
|
+
default: x(() => [
|
|
92
96
|
f(t.$slots, "content", {
|
|
93
97
|
item: e.item,
|
|
94
98
|
close: l
|
|
@@ -30,9 +30,9 @@ declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {},
|
|
|
30
30
|
}>, {
|
|
31
31
|
class: string;
|
|
32
32
|
size: AccordionSize;
|
|
33
|
-
chevron: boolean;
|
|
34
33
|
showIndex: boolean;
|
|
35
34
|
iconVariant: IconVariant;
|
|
35
|
+
chevron: boolean;
|
|
36
36
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLButtonElement>;
|
|
37
37
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
38
38
|
export default _default;
|
|
@@ -14,6 +14,26 @@ export interface SelectOption<T = unknown> {
|
|
|
14
14
|
data?: T;
|
|
15
15
|
}
|
|
16
16
|
export type OptionsMapper<T> = (item: T) => SelectOption<T> | null | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* A static filter object, or a function that derives the filter from the
|
|
19
|
+
* surrounding form state. Returning `undefined` clears the filter.
|
|
20
|
+
*
|
|
21
|
+
* When a function is used, the function is only re-invoked when one of the
|
|
22
|
+
* keys it actually *reads* changes. Reading `values.quotationType` will not
|
|
23
|
+
* cause the function to re-run on changes to `values.cargoQuantityDelivered`.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* // Static
|
|
27
|
+
* filter: { status: 'ACTIVE' }
|
|
28
|
+
*
|
|
29
|
+
* // Dynamic — reactive against the parent form's values
|
|
30
|
+
* filter: ({ values }) => values.quotationType === 'WATER_DELIVERY'
|
|
31
|
+
* ? { isTanker: true }
|
|
32
|
+
* : undefined
|
|
33
|
+
*/
|
|
34
|
+
export type AsyncSelectFilter = Record<string, any> | ((ctx: {
|
|
35
|
+
values: Record<string, any>;
|
|
36
|
+
}) => Record<string, any> | undefined | void);
|
|
17
37
|
export interface CreateSelectConfig<T = any> {
|
|
18
38
|
name: string;
|
|
19
39
|
useQuery: any;
|
|
@@ -46,7 +66,17 @@ export declare const createAsyncSelect: <T extends {
|
|
|
46
66
|
default: string;
|
|
47
67
|
};
|
|
48
68
|
filter: {
|
|
49
|
-
type:
|
|
69
|
+
type: PropType<AsyncSelectFilter>;
|
|
70
|
+
default: () => {};
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* The parent form's current values. Only used when `filter` is a
|
|
74
|
+
* function — the function receives `{ values }` and returns a filter.
|
|
75
|
+
* The form (`FormField.vue`) automatically passes this prop down for
|
|
76
|
+
* custom components; for standalone use, default to `{}`.
|
|
77
|
+
*/
|
|
78
|
+
values: {
|
|
79
|
+
type: PropType<Record<string, any>>;
|
|
50
80
|
default: () => {};
|
|
51
81
|
};
|
|
52
82
|
disabled: {
|
|
@@ -75,7 +105,17 @@ export declare const createAsyncSelect: <T extends {
|
|
|
75
105
|
default: string;
|
|
76
106
|
};
|
|
77
107
|
filter: {
|
|
78
|
-
type:
|
|
108
|
+
type: PropType<AsyncSelectFilter>;
|
|
109
|
+
default: () => {};
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* The parent form's current values. Only used when `filter` is a
|
|
113
|
+
* function — the function receives `{ values }` and returns a filter.
|
|
114
|
+
* The form (`FormField.vue`) automatically passes this prop down for
|
|
115
|
+
* custom components; for standalone use, default to `{}`.
|
|
116
|
+
*/
|
|
117
|
+
values: {
|
|
118
|
+
type: PropType<Record<string, any>>;
|
|
79
119
|
default: () => {};
|
|
80
120
|
};
|
|
81
121
|
disabled: {
|
|
@@ -93,7 +133,8 @@ export declare const createAsyncSelect: <T extends {
|
|
|
93
133
|
"onUpdate:modelValue"?: (...args: any[]) => any;
|
|
94
134
|
onOnChange?: (...args: any[]) => any;
|
|
95
135
|
}>, {
|
|
96
|
-
filter:
|
|
136
|
+
filter: {};
|
|
137
|
+
values: Record<string, any>;
|
|
97
138
|
placeholder: string;
|
|
98
139
|
disabled: boolean;
|
|
99
140
|
multiple: boolean;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
1
|
+
import { defineComponent as E, ref as y, computed as i, watch as I, createVNode as d, mergeProps as _, nextTick as H, isVNode as L } from "vue";
|
|
2
|
+
import Q from "../Dropdown/Dropdown.vue.js";
|
|
3
3
|
import "@iconify/vue";
|
|
4
4
|
import "../../core/config.js";
|
|
5
5
|
/* empty css */
|
|
6
6
|
/* empty css */
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
function
|
|
11
|
-
return typeof t == "function" || Object.prototype.toString.call(t) === "[object Object]" &&
|
|
7
|
+
import R from "../Button.vue.js";
|
|
8
|
+
import T from "../MultiSelect/MultiSelect.vue.js";
|
|
9
|
+
import U from "../Modal.vue.js";
|
|
10
|
+
function j(t) {
|
|
11
|
+
return typeof t == "function" || Object.prototype.toString.call(t) === "[object Object]" && !L(t);
|
|
12
12
|
}
|
|
13
|
-
const
|
|
13
|
+
const ne = (t) => /* @__PURE__ */ E({
|
|
14
14
|
name: t.name,
|
|
15
15
|
inheritAttrs: !1,
|
|
16
16
|
props: {
|
|
@@ -29,6 +29,16 @@ const X = (t) => /* @__PURE__ */ P({
|
|
|
29
29
|
default: "Select..."
|
|
30
30
|
},
|
|
31
31
|
filter: {
|
|
32
|
+
type: [Object, Function],
|
|
33
|
+
default: () => ({})
|
|
34
|
+
},
|
|
35
|
+
/**
|
|
36
|
+
* The parent form's current values. Only used when `filter` is a
|
|
37
|
+
* function — the function receives `{ values }` and returns a filter.
|
|
38
|
+
* The form (`FormField.vue`) automatically passes this prop down for
|
|
39
|
+
* custom components; for standalone use, default to `{}`.
|
|
40
|
+
*/
|
|
41
|
+
values: {
|
|
32
42
|
type: Object,
|
|
33
43
|
default: () => ({})
|
|
34
44
|
},
|
|
@@ -45,104 +55,125 @@ const X = (t) => /* @__PURE__ */ P({
|
|
|
45
55
|
},
|
|
46
56
|
emits: ["onChange", "update:modelValue", "change"],
|
|
47
57
|
setup(l, {
|
|
48
|
-
attrs:
|
|
49
|
-
emit:
|
|
58
|
+
attrs: M,
|
|
59
|
+
emit: m
|
|
50
60
|
}) {
|
|
51
|
-
const
|
|
61
|
+
const c = y([]), s = y(1), b = y(""), B = 20, h = i(() => l.value !== void 0 ? l.value : l.modelValue), g = i(() => l.optionsMapper || t.optionsMapper), N = (e, a) => {
|
|
62
|
+
const r = l.filter;
|
|
63
|
+
if (typeof r != "function")
|
|
64
|
+
return r || {};
|
|
65
|
+
const o = a != null ? new Proxy(e || {}, {
|
|
66
|
+
get(n, u) {
|
|
67
|
+
return typeof u == "string" && !u.startsWith("__v_") && a.add(u), Reflect.get(n, u);
|
|
68
|
+
}
|
|
69
|
+
}) : e || {};
|
|
70
|
+
try {
|
|
71
|
+
return r({
|
|
72
|
+
values: o
|
|
73
|
+
}) || {};
|
|
74
|
+
} catch (n) {
|
|
75
|
+
return console.error(`[${t.name}] Error evaluating filter function:`, n), {};
|
|
76
|
+
}
|
|
77
|
+
}, w = /* @__PURE__ */ new Set(), P = N(l.values, w), f = y(P), S = Array.from(w), F = i(() => S.length > 0 ? JSON.stringify(S.map((e) => l.values?.[e])) : JSON.stringify(l.filter || {}));
|
|
78
|
+
I(F, () => {
|
|
79
|
+
const e = N(l.values), a = JSON.stringify(f.value), r = JSON.stringify(e);
|
|
80
|
+
a !== r && (f.value = e, s.value = 1);
|
|
81
|
+
});
|
|
82
|
+
const q = i(() => ({
|
|
52
83
|
pagination: {
|
|
53
|
-
page:
|
|
54
|
-
limit:
|
|
84
|
+
page: s.value,
|
|
85
|
+
limit: B
|
|
55
86
|
},
|
|
56
87
|
search: b.value || void 0,
|
|
57
88
|
filter: {
|
|
58
|
-
...
|
|
89
|
+
...f.value
|
|
59
90
|
}
|
|
60
91
|
})), {
|
|
61
|
-
result:
|
|
62
|
-
loading:
|
|
63
|
-
refetch:
|
|
64
|
-
} = t.useQuery(
|
|
92
|
+
result: K,
|
|
93
|
+
loading: A,
|
|
94
|
+
refetch: C
|
|
95
|
+
} = t.useQuery(q, {
|
|
65
96
|
notifyOnNetworkStatusChange: !0,
|
|
66
97
|
fetchPolicy: "cache-and-network"
|
|
67
|
-
}),
|
|
68
|
-
const e =
|
|
98
|
+
}), O = i(() => {
|
|
99
|
+
const e = K.value?.[t.queryName]?.pageInfo;
|
|
69
100
|
return e ? e.currentPage < e.totalPages : !1;
|
|
70
101
|
});
|
|
71
|
-
|
|
102
|
+
I(() => K.value?.[t.queryName], (e) => {
|
|
72
103
|
if (!e) return;
|
|
73
|
-
const
|
|
74
|
-
if (
|
|
75
|
-
if (
|
|
76
|
-
|
|
104
|
+
const a = Array.isArray(e) ? e : e.items;
|
|
105
|
+
if (a)
|
|
106
|
+
if (s.value === 1)
|
|
107
|
+
c.value = [...a];
|
|
77
108
|
else {
|
|
78
|
-
const r = new Set(
|
|
79
|
-
|
|
109
|
+
const r = new Set(c.value.map((n) => n.id)), o = a.filter((n) => !r.has(n.id));
|
|
110
|
+
c.value.push(...o);
|
|
80
111
|
}
|
|
81
112
|
}, {
|
|
82
113
|
immediate: !0
|
|
83
114
|
});
|
|
84
|
-
const
|
|
85
|
-
if (
|
|
86
|
-
return
|
|
87
|
-
const
|
|
115
|
+
const V = (e) => {
|
|
116
|
+
if (g.value)
|
|
117
|
+
return g.value(e);
|
|
118
|
+
const a = typeof t.labelKey == "function" ? t.labelKey(e) : e[t.labelKey || "name"], r = typeof t.subtitleKey == "function" ? t.subtitleKey(e) : e[t.subtitleKey || ""], o = typeof t.descriptionKey == "function" ? t.descriptionKey(e) : e[t.descriptionKey || ""], n = t.iconKey ? typeof t.iconKey == "function" ? t.iconKey(e) : e[t.iconKey] : void 0;
|
|
88
119
|
return {
|
|
89
|
-
label:
|
|
120
|
+
label: a,
|
|
90
121
|
subtitle: r || void 0,
|
|
91
122
|
description: o || void 0,
|
|
92
123
|
value: e[t.valueKey || "id"],
|
|
93
|
-
icon:
|
|
124
|
+
icon: n || void 0,
|
|
94
125
|
data: e
|
|
95
126
|
};
|
|
96
|
-
},
|
|
97
|
-
let r =
|
|
98
|
-
l.multiple && Array.isArray(e) && (r = e.map((
|
|
99
|
-
const u =
|
|
127
|
+
}, p = i(() => c.value.map(V).filter(Boolean)), v = (e, a) => {
|
|
128
|
+
let r = a;
|
|
129
|
+
l.multiple && Array.isArray(e) && (r = e.map((n) => {
|
|
130
|
+
const u = p.value.find((x) => x.value === n);
|
|
100
131
|
return u ? u.data : null;
|
|
101
132
|
}).filter(Boolean));
|
|
102
133
|
const o = {
|
|
103
134
|
value: e,
|
|
104
135
|
data: r
|
|
105
136
|
};
|
|
106
|
-
|
|
107
|
-
},
|
|
108
|
-
b.value = e,
|
|
109
|
-
},
|
|
110
|
-
!
|
|
111
|
-
},
|
|
112
|
-
const
|
|
113
|
-
if (
|
|
114
|
-
await
|
|
115
|
-
const r = new Set(
|
|
137
|
+
m("update:modelValue", e), m("change", o), m("onChange", o);
|
|
138
|
+
}, J = (e) => {
|
|
139
|
+
b.value = e, s.value = 1;
|
|
140
|
+
}, $ = () => {
|
|
141
|
+
!O.value || A.value || s.value++;
|
|
142
|
+
}, z = async (e) => {
|
|
143
|
+
const a = (Array.isArray(e) ? e : [e]).filter((n) => (typeof n == "string" || typeof n == "number") && n !== "");
|
|
144
|
+
if (a.length === 0) return [];
|
|
145
|
+
await H();
|
|
146
|
+
const r = new Set(p.value.map((n) => n.value)), o = a.filter((n) => !r.has(n));
|
|
116
147
|
if (o.length === 0) return [];
|
|
117
148
|
try {
|
|
118
149
|
const {
|
|
119
|
-
data:
|
|
120
|
-
} = await
|
|
150
|
+
data: n
|
|
151
|
+
} = await C({
|
|
121
152
|
pagination: {
|
|
122
153
|
page: 1,
|
|
123
154
|
limit: o.length
|
|
124
155
|
},
|
|
125
156
|
filter: {
|
|
126
|
-
...
|
|
157
|
+
...f.value,
|
|
127
158
|
ids: o
|
|
128
159
|
}
|
|
129
|
-
}), u =
|
|
130
|
-
return (Array.isArray(u) ? u : u?.items || []).map(
|
|
131
|
-
} catch (
|
|
132
|
-
return console.error(`[${t.name}] Hydration failed`,
|
|
160
|
+
}), u = n?.[t.queryName];
|
|
161
|
+
return (Array.isArray(u) ? u : u?.items || []).map(V).filter(Boolean);
|
|
162
|
+
} catch (n) {
|
|
163
|
+
return console.error(`[${t.name}] Hydration failed`, n), [];
|
|
133
164
|
}
|
|
134
|
-
},
|
|
165
|
+
}, k = () => l.addNewConfig ? d("div", {
|
|
135
166
|
class: "px-1 pb-1 pt-1 mt-1 border-t border-border bg-body sticky bottom-0 z-10"
|
|
136
|
-
}, [
|
|
167
|
+
}, [d(U, {
|
|
137
168
|
title: l.addNewConfig.label || "Add New",
|
|
138
169
|
titleI18n: l.addNewConfig.labelI18n,
|
|
139
170
|
body: l.addNewConfig.component,
|
|
140
171
|
bodyProps: l.addNewConfig.props,
|
|
141
172
|
onClose: () => {
|
|
142
|
-
|
|
173
|
+
C();
|
|
143
174
|
}
|
|
144
175
|
}, {
|
|
145
|
-
trigger: () =>
|
|
176
|
+
trigger: () => d(R, {
|
|
146
177
|
class: "w-full justify-start text-primary hover:text-primary hover:bg-primary/10",
|
|
147
178
|
variant: "ghost",
|
|
148
179
|
size: "sm",
|
|
@@ -152,35 +183,35 @@ const X = (t) => /* @__PURE__ */ P({
|
|
|
152
183
|
})]) : null;
|
|
153
184
|
return () => {
|
|
154
185
|
const e = {
|
|
155
|
-
options:
|
|
156
|
-
loading:
|
|
186
|
+
options: p.value,
|
|
187
|
+
loading: A.value,
|
|
157
188
|
searchable: t.searchable ?? !0,
|
|
158
189
|
remote: t.remote ?? !0,
|
|
159
|
-
hasMore:
|
|
190
|
+
hasMore: O.value,
|
|
160
191
|
placeholder: l.placeholder,
|
|
161
192
|
disabled: l.disabled,
|
|
162
|
-
fetchSelected:
|
|
163
|
-
onSearch:
|
|
164
|
-
onLoadMore:
|
|
165
|
-
...
|
|
166
|
-
},
|
|
167
|
-
return l.addNewConfig && (
|
|
193
|
+
fetchSelected: z,
|
|
194
|
+
onSearch: J,
|
|
195
|
+
onLoadMore: $,
|
|
196
|
+
...M
|
|
197
|
+
}, a = {};
|
|
198
|
+
return l.addNewConfig && (a.footer = () => k()), l.multiple ? d(T, _(e, {
|
|
168
199
|
modelValue: h.value,
|
|
169
|
-
"onUpdate:modelValue": (r) =>
|
|
170
|
-
onChange: (r) =>
|
|
171
|
-
}),
|
|
172
|
-
default: () => [
|
|
173
|
-
}) :
|
|
200
|
+
"onUpdate:modelValue": (r) => v(r),
|
|
201
|
+
onChange: (r) => v(r)
|
|
202
|
+
}), j(a) ? a : {
|
|
203
|
+
default: () => [a]
|
|
204
|
+
}) : d(Q, _(e, {
|
|
174
205
|
showSelectedIcon: !0,
|
|
175
206
|
emptyMessage: "Data not found",
|
|
176
207
|
modelValue: h.value,
|
|
177
|
-
onOnSelect: (r) =>
|
|
178
|
-
}),
|
|
179
|
-
default: () => [
|
|
208
|
+
onOnSelect: (r) => v(r.value, r.data)
|
|
209
|
+
}), j(a) ? a : {
|
|
210
|
+
default: () => [a]
|
|
180
211
|
});
|
|
181
212
|
};
|
|
182
213
|
}
|
|
183
214
|
});
|
|
184
215
|
export {
|
|
185
|
-
|
|
216
|
+
ne as createAsyncSelect
|
|
186
217
|
};
|
|
@@ -19,8 +19,12 @@ import "@vueuse/core";
|
|
|
19
19
|
/* empty css */
|
|
20
20
|
import Ue from "../IconPicker.vue.js";
|
|
21
21
|
/* empty css */
|
|
22
|
-
/* empty css
|
|
22
|
+
/* empty css */
|
|
23
|
+
/* empty css */
|
|
24
|
+
/* empty css */
|
|
23
25
|
import "../../core/config.js";
|
|
26
|
+
/* empty css */
|
|
27
|
+
/* empty css */
|
|
24
28
|
import { getUniqueId as _ } from "../../utils/functions.js";
|
|
25
29
|
const ze = { class: "flex items-center justify-between mb-6" }, Oe = { class: "text-lg font-bold text-foreground" }, $e = { class: "text-sm text-muted-foreground mt-0.5" }, Fe = {
|
|
26
30
|
key: 0,
|
|
@@ -38,7 +42,7 @@ const ze = { class: "flex items-center justify-between mb-6" }, Oe = { class: "t
|
|
|
38
42
|
}, Le = {
|
|
39
43
|
key: 0,
|
|
40
44
|
class: "absolute inset-0 z-10 flex items-center justify-center rounded-xl bg-background/60 backdrop-blur-[1px] transition-opacity"
|
|
41
|
-
}, We = { class: "flex items-center gap-2 text-sm text-muted-foreground" },
|
|
45
|
+
}, We = { class: "flex items-center gap-2 text-sm text-muted-foreground" }, St = /* @__PURE__ */ Ce({
|
|
42
46
|
__name: "CategoryManager",
|
|
43
47
|
props: {
|
|
44
48
|
modelValue: { default: () => [] },
|
|
@@ -87,7 +91,7 @@ const ze = { class: "flex items-center justify-between mb-6" }, Oe = { class: "t
|
|
|
87
91
|
},
|
|
88
92
|
emits: ["update:modelValue", "onAdd", "onEdit", "onDelete", "onReorder"],
|
|
89
93
|
setup(S, { expose: L, emit: W }) {
|
|
90
|
-
const e = S, f = W, d = I([]),
|
|
94
|
+
const e = S, f = W, d = I([]), p = I(/* @__PURE__ */ new Set()), v = (o) => JSON.parse(JSON.stringify(o)), T = (o, t = null) => {
|
|
91
95
|
o.forEach((a, i) => {
|
|
92
96
|
a.parentId = t, a.position = i, a.children || (a.children = []), T(a.children, a.id);
|
|
93
97
|
});
|
|
@@ -125,7 +129,7 @@ const ze = { class: "flex items-center justify-between mb-6" }, Oe = { class: "t
|
|
|
125
129
|
(o) => {
|
|
126
130
|
if (o) {
|
|
127
131
|
if (o.length === 0) {
|
|
128
|
-
d.value = [],
|
|
132
|
+
d.value = [], p.value = /* @__PURE__ */ new Set(), f("update:modelValue", []);
|
|
129
133
|
return;
|
|
130
134
|
}
|
|
131
135
|
const t = X(o);
|
|
@@ -133,9 +137,9 @@ const ze = { class: "flex items-center justify-between mb-6" }, Oe = { class: "t
|
|
|
133
137
|
const a = JSON.stringify(t), i = JSON.stringify(d.value);
|
|
134
138
|
if (a !== i) {
|
|
135
139
|
const r = z(t), n = new Set(
|
|
136
|
-
[...
|
|
140
|
+
[...p.value].filter((g) => r.has(g))
|
|
137
141
|
);
|
|
138
|
-
|
|
142
|
+
p.value = n;
|
|
139
143
|
const u = v(t);
|
|
140
144
|
d.value = u, f("update:modelValue", u);
|
|
141
145
|
}
|
|
@@ -158,8 +162,8 @@ const ze = { class: "flex items-center justify-between mb-6" }, Oe = { class: "t
|
|
|
158
162
|
const o = v(d.value);
|
|
159
163
|
f("update:modelValue", o);
|
|
160
164
|
}, Y = (o) => {
|
|
161
|
-
const t = new Set(
|
|
162
|
-
t.has(o) ? t.delete(o) : t.add(o),
|
|
165
|
+
const t = new Set(p.value);
|
|
166
|
+
t.has(o) ? t.delete(o) : t.add(o), p.value = t;
|
|
163
167
|
}, y = I({
|
|
164
168
|
mode: null,
|
|
165
169
|
targetId: null,
|
|
@@ -171,7 +175,7 @@ const ze = { class: "flex items-center justify-between mb-6" }, Oe = { class: "t
|
|
|
171
175
|
targetId: o === "add-child" && t || null,
|
|
172
176
|
title: "",
|
|
173
177
|
icon: "lucide:folder"
|
|
174
|
-
}, o === "add-child" && t &&
|
|
178
|
+
}, o === "add-child" && t && p.value.add(t);
|
|
175
179
|
}, D = () => {
|
|
176
180
|
y.value = { mode: null, targetId: null, title: "", icon: "lucide:folder" };
|
|
177
181
|
}, V = () => {
|
|
@@ -183,8 +187,8 @@ const ze = { class: "flex items-center justify-between mb-6" }, Oe = { class: "t
|
|
|
183
187
|
n = { id: _(), title: a, icon: i, children: [] }, r.push(n);
|
|
184
188
|
else if (o === "add-child") {
|
|
185
189
|
n = { id: _(), title: a, icon: i, children: [] };
|
|
186
|
-
const u = (
|
|
187
|
-
for (const c of
|
|
190
|
+
const u = (g) => {
|
|
191
|
+
for (const c of g) {
|
|
188
192
|
if (c.id === t)
|
|
189
193
|
return c.children || (c.children = []), c.children.push(n), !0;
|
|
190
194
|
if (c.children && u(c.children)) return !0;
|
|
@@ -207,21 +211,21 @@ const ze = { class: "flex items-center justify-between mb-6" }, Oe = { class: "t
|
|
|
207
211
|
const n = { id: _(), children: [], ...t };
|
|
208
212
|
a.push(n), i = n, r = "onAdd";
|
|
209
213
|
} else if (x.value === "add-child") {
|
|
210
|
-
const n = { id: _(), children: [], ...t }, u = (
|
|
211
|
-
for (const c of
|
|
214
|
+
const n = { id: _(), children: [], ...t }, u = (g) => {
|
|
215
|
+
for (const c of g) {
|
|
212
216
|
if (c.id === O.value)
|
|
213
|
-
return c.children || (c.children = []), c.children.push(n),
|
|
217
|
+
return c.children || (c.children = []), c.children.push(n), p.value.add(c.id), !0;
|
|
214
218
|
if (c.children && u(c.children)) return !0;
|
|
215
219
|
}
|
|
216
220
|
return !1;
|
|
217
221
|
};
|
|
218
222
|
u(a), i = n, r = "onAdd";
|
|
219
223
|
} else if (x.value === "edit" && q.value) {
|
|
220
|
-
const n = q.value.id, u = (
|
|
221
|
-
const c =
|
|
224
|
+
const n = q.value.id, u = (g) => {
|
|
225
|
+
const c = g.findIndex((k) => k.id === n);
|
|
222
226
|
if (c > -1)
|
|
223
|
-
return
|
|
224
|
-
for (const k of
|
|
227
|
+
return g[c] = { ...g[c], ...t }, i = g[c], !0;
|
|
228
|
+
for (const k of g)
|
|
225
229
|
if (k.children && u(k.children)) return !0;
|
|
226
230
|
return !1;
|
|
227
231
|
};
|
|
@@ -286,7 +290,7 @@ const ze = { class: "flex items-center justify-between mb-6" }, Oe = { class: "t
|
|
|
286
290
|
if (e.headerTitle) return e.headerTitle;
|
|
287
291
|
const o = l("vlite.categoryManager.headerTitle");
|
|
288
292
|
return o !== "vlite.categoryManager.headerTitle" ? o : "Categories";
|
|
289
|
-
}),
|
|
293
|
+
}), pe = s(() => {
|
|
290
294
|
if (e.headerDescriptionI18n) {
|
|
291
295
|
const t = l(e.headerDescriptionI18n);
|
|
292
296
|
if (t !== e.headerDescriptionI18n) return t;
|
|
@@ -294,7 +298,7 @@ const ze = { class: "flex items-center justify-between mb-6" }, Oe = { class: "t
|
|
|
294
298
|
if (e.headerDescription) return e.headerDescription;
|
|
295
299
|
const o = l("vlite.categoryManager.headerDescription");
|
|
296
300
|
return o !== "vlite.categoryManager.headerDescription" ? o : "Manage your hierarchical structure.";
|
|
297
|
-
}),
|
|
301
|
+
}), ge = s(() => {
|
|
298
302
|
if (e.addCategoryTextI18n) {
|
|
299
303
|
const t = l(e.addCategoryTextI18n);
|
|
300
304
|
if (t !== e.addCategoryTextI18n) return t;
|
|
@@ -344,7 +348,7 @@ const ze = { class: "flex items-center justify-between mb-6" }, Oe = { class: "t
|
|
|
344
348
|
return o !== "vlite.categoryManager.categoryTitlePlaceholder" ? o : "Category title...";
|
|
345
349
|
}), Te = s(() => e.quickAddTooltipI18n ? l(e.quickAddTooltipI18n) : e.quickAddTooltip ? e.quickAddTooltip : l("vlite.categoryManager.quickAddTooltip") !== "vlite.categoryManager.quickAddTooltip" ? l("vlite.categoryManager.quickAddTooltip") : "Quick Add Subcategory"), Ie = s(() => e.advancedDetailsTooltipI18n ? l(e.advancedDetailsTooltipI18n) : e.advancedDetailsTooltip ? e.advancedDetailsTooltip : l("vlite.categoryManager.advancedDetailsTooltip") !== "vlite.categoryManager.advancedDetailsTooltip" ? l("vlite.categoryManager.advancedDetailsTooltip") : "Advanced Details"), xe = s(() => e.deleteTooltipI18n ? l(e.deleteTooltipI18n) : e.deleteTooltip ? e.deleteTooltip : l("vlite.categoryManager.deleteTooltip") !== "vlite.categoryManager.deleteTooltip" ? l("vlite.categoryManager.deleteTooltip") : "Delete"), F = s(() => e.saveTooltipI18n ? l(e.saveTooltipI18n) : e.saveTooltip ? e.saveTooltip : l("vlite.categoryManager.saveTooltip") !== "vlite.categoryManager.saveTooltip" ? l("vlite.categoryManager.saveTooltip") : "Save"), J = s(() => e.cancelTooltipI18n ? l(e.cancelTooltipI18n) : e.cancelTooltip ? e.cancelTooltip : l("vlite.categoryManager.cancelTooltip") !== "vlite.categoryManager.cancelTooltip" ? l("vlite.categoryManager.cancelTooltip") : "Cancel");
|
|
346
350
|
De("categoryManager", {
|
|
347
|
-
expandedIds:
|
|
351
|
+
expandedIds: p,
|
|
348
352
|
inlineState: y,
|
|
349
353
|
toggleExpand: Y,
|
|
350
354
|
startInline: N,
|
|
@@ -369,20 +373,20 @@ const ze = { class: "flex items-center justify-between mb-6" }, Oe = { class: "t
|
|
|
369
373
|
}
|
|
370
374
|
}, we = () => {
|
|
371
375
|
const o = z(d.value);
|
|
372
|
-
|
|
376
|
+
p.value = o;
|
|
373
377
|
}, Me = () => {
|
|
374
|
-
|
|
378
|
+
p.value = /* @__PURE__ */ new Set();
|
|
375
379
|
}, B = (...o) => {
|
|
376
|
-
const t = new Set(
|
|
377
|
-
o.forEach((a) => t.add(a)),
|
|
380
|
+
const t = new Set(p.value);
|
|
381
|
+
o.forEach((a) => t.add(a)), p.value = t;
|
|
378
382
|
}, Se = (...o) => {
|
|
379
|
-
const t = new Set(
|
|
380
|
-
o.forEach((a) => t.delete(a)),
|
|
383
|
+
const t = new Set(p.value);
|
|
384
|
+
o.forEach((a) => t.delete(a)), p.value = t;
|
|
381
385
|
};
|
|
382
386
|
return Ae(() => {
|
|
383
387
|
e.defaultExpanded && e.defaultExpanded.length > 0 && B(...e.defaultExpanded);
|
|
384
388
|
}), L({
|
|
385
|
-
expandedIds:
|
|
389
|
+
expandedIds: p,
|
|
386
390
|
expandAll: we,
|
|
387
391
|
collapseAll: Me,
|
|
388
392
|
expand: B,
|
|
@@ -394,7 +398,7 @@ const ze = { class: "flex items-center justify-between mb-6" }, Oe = { class: "t
|
|
|
394
398
|
Pe(o.$slots, "header", {}, () => [
|
|
395
399
|
m("div", null, [
|
|
396
400
|
m("h3", Oe, w(ue.value), 1),
|
|
397
|
-
m("p", $e, w(
|
|
401
|
+
m("p", $e, w(pe.value), 1)
|
|
398
402
|
]),
|
|
399
403
|
S.readonly ? E("", !0) : (b(), G(R, {
|
|
400
404
|
key: 0,
|
|
@@ -404,7 +408,7 @@ const ze = { class: "flex items-center justify-between mb-6" }, Oe = { class: "t
|
|
|
404
408
|
onClick: t[0] || (t[0] = (a) => N("add-root"))
|
|
405
409
|
}, {
|
|
406
410
|
default: P(() => [
|
|
407
|
-
H(w(
|
|
411
|
+
H(w(ge.value), 1)
|
|
408
412
|
]),
|
|
409
413
|
_: 1
|
|
410
414
|
}))
|
|
@@ -513,5 +517,5 @@ const ze = { class: "flex items-center justify-between mb-6" }, Oe = { class: "t
|
|
|
513
517
|
}
|
|
514
518
|
});
|
|
515
519
|
export {
|
|
516
|
-
|
|
520
|
+
St as default
|
|
517
521
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as m, computed as d, openBlock as a, createElementBlock as u, withModifiers as
|
|
1
|
+
import { defineComponent as m, computed as d, openBlock as a, createElementBlock as u, withModifiers as f, normalizeClass as p, createElementVNode as l, createBlock as g, createCommentVNode as v, toDisplayString as b, createVNode as h } from "vue";
|
|
2
2
|
import x from "../Switch.vue.js";
|
|
3
3
|
import y from "../Icon.vue.js";
|
|
4
4
|
import { $t as k } from "../../utils/i18n.js";
|
|
@@ -19,11 +19,11 @@ const w = ["data-testid"], B = { class: "flex items-center gap-2 flex-1 min-w-0"
|
|
|
19
19
|
return (t, i) => (a(), u("div", {
|
|
20
20
|
tabindex: "0",
|
|
21
21
|
"data-dropdown-item": "",
|
|
22
|
-
class:
|
|
22
|
+
class: p(["relative flex cursor-pointer select-none items-center justify-between rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus-visible:bg-accent focus-visible:text-accent-foreground", [
|
|
23
23
|
e.focused ? "bg-accent text-accent-foreground" : "hover:bg-accent hover:text-accent-foreground"
|
|
24
24
|
]]),
|
|
25
25
|
"data-testid": t.$attrs["data-testid"] || `dropdown-item-bool-${e.option.key || e.option.label}`.toLowerCase().replace(/[^a-z0-9]+/g, "-"),
|
|
26
|
-
onClick: i[0] || (i[0] =
|
|
26
|
+
onClick: i[0] || (i[0] = f((j) => n(!e.value), ["stop"]))
|
|
27
27
|
}, [
|
|
28
28
|
l("div", B, [
|
|
29
29
|
e.option.icon || e.option.emoji ? (a(), g(y, {
|
|
@@ -31,10 +31,10 @@ const w = ["data-testid"], B = { class: "flex items-center gap-2 flex-1 min-w-0"
|
|
|
31
31
|
icon: e.option.icon,
|
|
32
32
|
emoji: e.option.emoji,
|
|
33
33
|
class: "h-4 w-4 shrink-0 opacity-70"
|
|
34
|
-
}, null, 8, ["icon", "emoji"])) :
|
|
35
|
-
l("span", $,
|
|
34
|
+
}, null, 8, ["icon", "emoji"])) : v("", !0),
|
|
35
|
+
l("span", $, b(r.value), 1)
|
|
36
36
|
]),
|
|
37
|
-
|
|
37
|
+
h(x, {
|
|
38
38
|
"model-value": e.value,
|
|
39
39
|
class: "ml-3 shrink-0 scale-75 origin-right",
|
|
40
40
|
"onUpdate:modelValue": n
|