vlite3 1.5.50 → 1.5.52
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/CategoryManager/CategoryManager2.vue.js +2 -2
- package/components/CommandPalette/CommandPaletteContent2.vue.js +1 -1
- package/components/CommandPalette/{CommandPaletteItem2.vue.js → CommandPaletteItem.vue.js} +1 -1
- package/components/Form/Form.vue.d.ts +3 -0
- package/components/Form/Form.vue.js +1 -1
- package/components/Form/Form2.vue.js +292 -276
- package/components/Form/composables/useCustomFieldRows.d.ts +3 -0
- package/components/Form/composables/useCustomFieldRows.js +109 -58
- package/components/Form/composables/useForm.d.ts +4 -1
- package/components/Form/composables/useForm.js +249 -187
- package/components/Form/index.vue.d.ts +2 -0
- package/components/Form/index.vue.js +2 -2
- package/components/Form/index2.vue.js +12 -8
- package/components/Form/types.d.ts +2 -0
- package/components/NavbarCommandPalette.vue.js +1 -1
- package/components/RichTextEditor/RichTextEditor.vue.d.ts +58 -0
- package/components/RichTextEditor/RichTextEditor.vue.js +309 -180
- package/components/RichTextEditor/RichTextLinkPopover.vue.d.ts +3 -8
- package/components/RichTextEditor/RichTextLinkPopover3.vue.js +2 -2
- package/components/RichTextEditor/RichTextToolbar3.vue.js +2 -2
- package/components/RichTextEditor/index.d.ts +1 -1
- package/components/RichTextEditor/types.d.ts +22 -0
- package/components/Screen/ScreenFilter.vue.js +2 -2
- package/components/Screen/components/ScreenToolbar.vue.d.ts +2 -2
- package/directives/ScrollReveal/ScrollRevealPager.js +76 -76
- package/docs/components/rich-text-editor.md +33 -2
- package/docs-manifest.json +3 -3
- package/package.json +1 -1
- package/style.css +1 -1
- /package/components/RichTextEditor/{RichTextLinkPopover2.vue.js → RichTextLinkPopover.vue.js} +0 -0
- /package/components/RichTextEditor/{RichTextToolbar2.vue.js → RichTextToolbar.vue.js} +0 -0
|
@@ -25,6 +25,9 @@ export interface UseCustomFieldRowsGetters {
|
|
|
25
25
|
readonly: () => boolean;
|
|
26
26
|
minRows: () => number;
|
|
27
27
|
maxRows: () => number;
|
|
28
|
+
/** Optional defaults for new rows, including a consumer-owned stable identity. */
|
|
29
|
+
rowDefaults?: () => Record<string, any>;
|
|
30
|
+
rowKey?: () => string | undefined;
|
|
28
31
|
}
|
|
29
32
|
export interface UseCustomFieldRowsReturn {
|
|
30
33
|
/** Rows with internal `_id` for stable v-for keys */
|
|
@@ -1,77 +1,128 @@
|
|
|
1
|
-
import { shallowRef as
|
|
2
|
-
import { setNestedValue as
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { shallowRef as G, getCurrentScope as W, onScopeDispose as H, watch as J, computed as D, toRaw as E } from "vue";
|
|
2
|
+
import { setNestedValue as L } from "../utils/form.utils.js";
|
|
3
|
+
const U = () => `row_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`, N = (s, S) => {
|
|
4
|
+
const a = G([]), C = /* @__PURE__ */ new WeakMap(), d = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map();
|
|
5
|
+
let O = 0;
|
|
6
|
+
const R = (t) => {
|
|
7
|
+
d.delete(t), h.delete(t);
|
|
8
|
+
};
|
|
9
|
+
let V = !1;
|
|
10
|
+
W() && H(() => {
|
|
11
|
+
V = !0, d.clear(), h.clear();
|
|
12
|
+
});
|
|
13
|
+
const A = () => {
|
|
14
|
+
const t = {};
|
|
15
|
+
for (const e of s.schema()) {
|
|
16
|
+
const n = typeof e.value == "function" ? e.value() : e.value;
|
|
17
|
+
let o = null;
|
|
18
|
+
(e.props?.multiple || e.type === "multiSelect" || e.type === "tags") && (o = []), t[e.name] = n ?? o;
|
|
10
19
|
}
|
|
11
|
-
return { ...
|
|
12
|
-
},
|
|
13
|
-
const
|
|
14
|
-
|
|
20
|
+
return { ...t, ...s.rowDefaults?.(), _id: U() };
|
|
21
|
+
}, g = (t, e) => Object.keys(t).length === Object.keys(e).length + 1 && Object.keys(e).every((n) => n !== "_id" && Object.prototype.hasOwnProperty.call(t, n) && Object.is(E(t[n]), E(e[n]))), $ = (t) => t.map((e) => {
|
|
22
|
+
const n = C.get(e);
|
|
23
|
+
if (n && g(e, n)) return n;
|
|
24
|
+
const { _id: o, ...u } = e;
|
|
25
|
+
return C.set(e, u), u;
|
|
26
|
+
}), w = (t) => {
|
|
27
|
+
const e = $(t);
|
|
28
|
+
S("update:modelValue", e), S("change", e);
|
|
15
29
|
};
|
|
16
|
-
|
|
17
|
-
() =>
|
|
18
|
-
(e) => {
|
|
19
|
-
Array.isArray(
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
...
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
30
|
+
J(
|
|
31
|
+
() => s.modelValue(),
|
|
32
|
+
(t, e) => {
|
|
33
|
+
if (Array.isArray(t)) {
|
|
34
|
+
const n = a.value, o = s.rowKey?.(), u = new Map(o ? n.filter((l) => l[o] != null).map((l) => [l[o], l]) : []), r = /* @__PURE__ */ new Set(), p = t.map((l, i) => {
|
|
35
|
+
const b = o && l[o] != null ? u.get(l[o]) : n[i], f = b && !r.has(b._id) ? b : void 0, y = f?._id || U();
|
|
36
|
+
return r.add(y), f && t !== e && g(f, l) ? f : (f && !g(f, l) && R(y), { ...l, _id: y });
|
|
37
|
+
});
|
|
38
|
+
for (const l of n) r.has(l._id) || R(l._id);
|
|
39
|
+
(p.length !== n.length || p.some((l, i) => l !== n[i])) && (a.value = p);
|
|
40
|
+
} else
|
|
41
|
+
d.clear(), h.clear(), a.value = [];
|
|
26
42
|
},
|
|
27
43
|
{ immediate: !0, deep: !0 }
|
|
28
44
|
);
|
|
29
|
-
const
|
|
45
|
+
const K = D(() => !(s.disabled() || s.readonly() || s.maxRows() && a.value.length >= s.maxRows())), P = D(() => s.disabled() || s.readonly() ? !1 : a.value.length > s.minRows());
|
|
30
46
|
return {
|
|
31
|
-
rows:
|
|
32
|
-
canAddRow:
|
|
33
|
-
canRemoveRow:
|
|
34
|
-
getFieldValue: (
|
|
47
|
+
rows: a,
|
|
48
|
+
canAddRow: K,
|
|
49
|
+
canRemoveRow: P,
|
|
50
|
+
getFieldValue: (t, e) => a.value[t]?.[e],
|
|
35
51
|
addRow: () => {
|
|
36
|
-
if (
|
|
37
|
-
const
|
|
38
|
-
|
|
52
|
+
if (s.disabled() || s.readonly() || s.maxRows() && a.value.length >= s.maxRows()) return;
|
|
53
|
+
const t = [...a.value, A()];
|
|
54
|
+
a.value = t, w(t);
|
|
39
55
|
},
|
|
40
|
-
removeRow: (
|
|
41
|
-
if (
|
|
42
|
-
|
|
43
|
-
|
|
56
|
+
removeRow: (t) => {
|
|
57
|
+
if (s.disabled() || s.readonly() || a.value.length <= s.minRows() || !a.value[t]) return;
|
|
58
|
+
R(a.value[t]._id);
|
|
59
|
+
const e = [...a.value];
|
|
60
|
+
e.splice(t, 1), a.value = e, w(e);
|
|
44
61
|
},
|
|
45
|
-
handleFieldChange: async (
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
62
|
+
handleFieldChange: async (t, e, n) => {
|
|
63
|
+
if (s.disabled() || s.readonly() || !a.value[t]) return;
|
|
64
|
+
const o = a.value[t]._id;
|
|
65
|
+
let u = h.get(o);
|
|
66
|
+
u || h.set(o, u = /* @__PURE__ */ new Map()), u.set(e, ++O), d.get(o)?.delete(e);
|
|
67
|
+
const r = [...a.value];
|
|
68
|
+
r[t] = {
|
|
69
|
+
...r[t],
|
|
70
|
+
[e]: n.value
|
|
50
71
|
};
|
|
51
|
-
const
|
|
52
|
-
if (
|
|
72
|
+
const p = s.schema().find((l) => l.name === e);
|
|
73
|
+
if (p && p.updateValues) {
|
|
74
|
+
let l = !1, i = d.get(o);
|
|
75
|
+
i || d.set(o, i = /* @__PURE__ */ new Map());
|
|
76
|
+
const b = /* @__PURE__ */ Symbol();
|
|
77
|
+
i.set(e, b);
|
|
78
|
+
const f = new Map(u), y = () => !V && d.get(o)?.get(e) === b;
|
|
53
79
|
try {
|
|
54
|
-
const
|
|
55
|
-
let
|
|
56
|
-
|
|
57
|
-
const
|
|
58
|
-
value:
|
|
59
|
-
values:
|
|
60
|
-
globalValues:
|
|
61
|
-
data:
|
|
62
|
-
isUpdate:
|
|
80
|
+
const m = r[t], z = s.values() || {}, F = s.name();
|
|
81
|
+
let k = { ...z };
|
|
82
|
+
F && (k = L(k, F, r));
|
|
83
|
+
const v = p.updateValues({
|
|
84
|
+
value: n.value,
|
|
85
|
+
values: m,
|
|
86
|
+
globalValues: k,
|
|
87
|
+
data: n.data,
|
|
88
|
+
isUpdate: s.isUpdate()
|
|
63
89
|
});
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
90
|
+
if (v && typeof v.then == "function") {
|
|
91
|
+
a.value = r, l = !0, w(r);
|
|
92
|
+
const _ = await v;
|
|
93
|
+
if (!y() || s.disabled() || s.readonly() || !_) return;
|
|
94
|
+
const q = a.value.findIndex((c) => c._id === m._id), j = a.value[q];
|
|
95
|
+
if (!j || !Object.is(j[e], n.value)) return;
|
|
96
|
+
const M = Object.fromEntries(Object.entries(_).filter(
|
|
97
|
+
([c]) => Object.is(j[c], m[c]) && h.get(o)?.get(c) === f.get(c)
|
|
98
|
+
));
|
|
99
|
+
if (Object.keys(M).length) {
|
|
100
|
+
for (const B of Object.keys(M)) u.set(B, ++O);
|
|
101
|
+
const c = [...a.value];
|
|
102
|
+
c[q] = { ...j, ...M }, a.value = c, w(c);
|
|
103
|
+
}
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
if (v && typeof v == "object") {
|
|
107
|
+
r[t] = { ...r[t], ...v };
|
|
108
|
+
for (const _ of Object.keys(v)) u.set(_, ++O);
|
|
109
|
+
}
|
|
110
|
+
} catch (m) {
|
|
111
|
+
if (console.error(`[CustomFields] Error in updateValues for ${e}:`, m), l || V) return;
|
|
112
|
+
} finally {
|
|
113
|
+
y() && (i.delete(e), i.size || d.delete(o));
|
|
67
114
|
}
|
|
68
|
-
|
|
115
|
+
}
|
|
116
|
+
a.value = r, w(r);
|
|
69
117
|
},
|
|
70
|
-
handleDragUpdate: (
|
|
71
|
-
|
|
118
|
+
handleDragUpdate: (t) => {
|
|
119
|
+
if (s.disabled() || s.readonly()) return;
|
|
120
|
+
const e = new Set(t.map((n) => n._id));
|
|
121
|
+
for (const n of a.value) e.has(n._id) || R(n._id);
|
|
122
|
+
a.value = t, w(t);
|
|
72
123
|
}
|
|
73
124
|
};
|
|
74
125
|
};
|
|
75
126
|
export {
|
|
76
|
-
|
|
127
|
+
N as useCustomFieldRows
|
|
77
128
|
};
|
|
@@ -7,6 +7,7 @@ export interface UseFormOptions {
|
|
|
7
7
|
folderId?: string;
|
|
8
8
|
emitFields?: string[];
|
|
9
9
|
onSubmit?: (payload: IFormSubmitPayload) => void | Promise<void>;
|
|
10
|
+
onAsyncChange?: (values: Record<string, any>) => void;
|
|
10
11
|
}
|
|
11
12
|
export interface UseFormReturn {
|
|
12
13
|
/** Current form values */
|
|
@@ -46,7 +47,9 @@ export interface UseFormReturn {
|
|
|
46
47
|
/** Flattened schema for iteration */
|
|
47
48
|
flatSchema: ComputedRef<IForm[]>;
|
|
48
49
|
/** Re-initialize form with new schema/values (useful for async data loading) */
|
|
49
|
-
reinitialize: (newSchema?: IForm[] | IForm[][], newValues?: Record<string, any
|
|
50
|
+
reinitialize: (newSchema?: IForm[] | IForm[][], newValues?: Record<string, any>, mode?: 'refresh' | 'replace' | 'schema') => Promise<void>;
|
|
51
|
+
/** Apply already-initialized values atomically, without running user change callbacks. */
|
|
52
|
+
replaceValues: (values: Record<string, any>) => void;
|
|
50
53
|
}
|
|
51
54
|
/**
|
|
52
55
|
* Main form composable for managing form state, validation, and submission
|