vlite3 0.9.3 → 0.9.4
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/CommandPalette/CommandPaletteContent.vue2.js +1 -1
- package/components/CommandPalette/{CommandPaletteItem.vue.js → CommandPaletteItem.vue2.js} +1 -1
- package/components/DataTable/DataTable.vue.js +20 -20
- package/components/Dropdown/Dropdown.vue.js +37 -37
- package/components/Form/CustomFields.vue.js +1 -1
- package/components/Form/CustomFields.vue2.js +113 -107
- package/components/Form/FormField.vue.js +127 -127
- package/components/NavbarCommandPalette.vue.js +1 -1
- package/components/NumberInput.vue.js +1 -1
- package/components/NumberInput.vue2.js +45 -45
- package/components/Screen/Screen.vue.js +1 -1
- package/components/Screen/components/ScreenQuickFilters.vue.js +3 -3
- package/components/Screen/components/ScreenViewToggle.vue.js +5 -5
- package/components/Workbook/Sheet.vue.d.ts +1 -1
- package/components/Workbook/Workbook.vue.d.ts +1 -1
- package/package.json +1 -1
- package/style.css +1 -1
|
@@ -1,32 +1,33 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { VueDraggable as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
import { defineComponent as Q, computed as c, shallowRef as W, watch as X, openBlock as s, createElementBlock as n, createElementVNode as v, createBlock as B, withCtx as D, createTextVNode as Y, toDisplayString as m, createCommentVNode as u, createVNode as g, Fragment as w, renderList as x, normalizeClass as R, unref as Z, isMemoSame as I } from "vue";
|
|
2
|
+
import { VueDraggable as ee } from "vue-draggable-plus";
|
|
3
|
+
import te from "./FormField.vue.js";
|
|
4
|
+
import $ from "../Button.vue.js";
|
|
5
|
+
import ae from "../Label.vue.js";
|
|
6
|
+
import le from "../Icon.vue.js";
|
|
7
7
|
import { $t as h } from "../../utils/i18n.js";
|
|
8
|
-
|
|
8
|
+
import { evaluateConditional as k } from "./utils/form.utils.js";
|
|
9
|
+
const re = { class: "custom-fields-wrapper" }, se = { class: "flex justify-between items-center mb-2" }, oe = { class: "custom-fields-table border border-border rounded overflow-hidden bg-background" }, ne = {
|
|
9
10
|
key: 0,
|
|
10
11
|
class: "flex border-b border-border bg-muted/50 text-gray-800 text-xs font-semibold uppercase tracking-wider"
|
|
11
|
-
},
|
|
12
|
+
}, de = {
|
|
12
13
|
key: 0,
|
|
13
14
|
class: "w-10 flex-none p-3 border-r border-border"
|
|
14
|
-
},
|
|
15
|
+
}, ie = {
|
|
15
16
|
key: 1,
|
|
16
17
|
class: "w-10 flex-none p-3 text-center border-r border-border"
|
|
17
|
-
},
|
|
18
|
+
}, ue = {
|
|
18
19
|
key: 2,
|
|
19
20
|
class: "w-10 flex-none p-3"
|
|
20
|
-
},
|
|
21
|
+
}, ce = {
|
|
21
22
|
key: 1,
|
|
22
23
|
class: "w-10 flex-none flex items-center justify-center text-xs text-muted-foreground border-r border-border bg-muted/20"
|
|
23
|
-
},
|
|
24
|
+
}, me = {
|
|
24
25
|
key: 2,
|
|
25
26
|
class: "w-10 flex-none flex items-center justify-center border-l border-border bg-muted/20"
|
|
26
|
-
},
|
|
27
|
+
}, be = {
|
|
27
28
|
key: 1,
|
|
28
29
|
class: "flex flex-col items-center justify-center py-6 text-center bg-muted/5"
|
|
29
|
-
},
|
|
30
|
+
}, fe = { class: "text-sm font-medium text-foreground" }, ve = { class: "text-xs text-muted-foreground mt-1" }, Ce = /* @__PURE__ */ Q({
|
|
30
31
|
__name: "CustomFields",
|
|
31
32
|
props: {
|
|
32
33
|
modelValue: { default: () => [] },
|
|
@@ -48,160 +49,165 @@ const Z = { class: "custom-fields-wrapper" }, ee = { class: "flex justify-betwee
|
|
|
48
49
|
isUpdate: { type: Boolean, default: !1 }
|
|
49
50
|
},
|
|
50
51
|
emits: ["update:modelValue", "change"],
|
|
51
|
-
setup(
|
|
52
|
-
const
|
|
52
|
+
setup(o, { emit: j }) {
|
|
53
|
+
const a = o, _ = j, C = c(() => a.labelI18n ? h(a.labelI18n) : a.label), z = c(() => {
|
|
53
54
|
const e = h("vlite.customFields.emptyTitle");
|
|
54
55
|
return e !== "vlite.customFields.emptyTitle" ? e : "No items added";
|
|
55
|
-
}),
|
|
56
|
+
}), A = c(() => {
|
|
56
57
|
const e = h("vlite.customFields.emptyDescription");
|
|
57
58
|
return e !== "vlite.customFields.emptyDescription" ? e : "Add a new item to get started";
|
|
58
|
-
}),
|
|
59
|
-
|
|
60
|
-
() =>
|
|
59
|
+
}), r = W([]), V = () => `row_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
60
|
+
X(
|
|
61
|
+
() => a.modelValue,
|
|
61
62
|
(e) => {
|
|
62
|
-
Array.isArray(e) ?
|
|
63
|
-
const
|
|
63
|
+
Array.isArray(e) ? r.value = e.map((t, d) => {
|
|
64
|
+
const l = r.value[d];
|
|
64
65
|
return {
|
|
65
|
-
...
|
|
66
|
-
_id:
|
|
66
|
+
...t,
|
|
67
|
+
_id: l?._id || V()
|
|
67
68
|
};
|
|
68
|
-
}) :
|
|
69
|
+
}) : r.value = [];
|
|
69
70
|
},
|
|
70
71
|
{ immediate: !0, deep: !0 }
|
|
71
72
|
);
|
|
72
|
-
const
|
|
73
|
+
const E = () => {
|
|
73
74
|
const e = {};
|
|
74
|
-
for (const
|
|
75
|
-
const d = typeof
|
|
76
|
-
e[
|
|
75
|
+
for (const t of a.schema) {
|
|
76
|
+
const d = typeof t.value == "function" ? t.value() : t.value;
|
|
77
|
+
e[t.name] = d ?? null;
|
|
77
78
|
}
|
|
78
|
-
return { ...e, _id:
|
|
79
|
-
},
|
|
80
|
-
if (
|
|
81
|
-
const e = [...
|
|
82
|
-
|
|
83
|
-
},
|
|
84
|
-
if (
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
},
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
...
|
|
91
|
-
[
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
|
|
95
|
-
},
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
},
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
79
|
+
return { ...e, _id: V() };
|
|
80
|
+
}, T = () => {
|
|
81
|
+
if (a.disabled || a.maxRows && r.value.length >= a.maxRows) return;
|
|
82
|
+
const e = [...r.value, E()];
|
|
83
|
+
r.value = e, b(e);
|
|
84
|
+
}, S = (e) => {
|
|
85
|
+
if (a.disabled || r.value.length <= a.minRows) return;
|
|
86
|
+
const t = [...r.value];
|
|
87
|
+
t.splice(e, 1), r.value = t, b(t);
|
|
88
|
+
}, L = (e, t, d) => {
|
|
89
|
+
const l = [...r.value];
|
|
90
|
+
l[e] = {
|
|
91
|
+
...l[e],
|
|
92
|
+
[t]: d.value
|
|
93
|
+
}, r.value = l, b(l);
|
|
94
|
+
}, M = (e) => {
|
|
95
|
+
r.value = e, b(e);
|
|
96
|
+
}, b = (e) => {
|
|
97
|
+
const t = e.map(({ _id: d, ...l }) => l);
|
|
98
|
+
_("update:modelValue", t), _("change", t);
|
|
99
|
+
}, H = (e, t) => r.value[e]?.[t], q = c(() => !(a.disabled || a.maxRows && r.value.length >= a.maxRows)), y = c(() => a.disabled ? !1 : r.value.length > a.minRows), F = c(() => a.headers && a.headers.length > 0 ? a.headers : a.schema.map((e) => e.labelI18n ? h(e.labelI18n) : e.label || e.name)), p = (e) => ({
|
|
100
|
+
values: { ...a.values || {}, ...r.value[e] || {} },
|
|
101
|
+
isUpdate: a.isUpdate
|
|
102
|
+
}), G = (e, t) => a.disabled ? !0 : k(t.disabled, p(e)), J = (e, t) => k(t.readonly, p(e)), K = (e, t) => t.when ? k(t.when, p(e)) : !0;
|
|
103
|
+
return (e, t) => (s(), n("div", re, [
|
|
104
|
+
v("div", se, [
|
|
105
|
+
C.value ? (s(), B(ae, {
|
|
102
106
|
key: 0,
|
|
103
107
|
class: "text-sm font-medium text-foreground"
|
|
104
108
|
}, {
|
|
105
|
-
default:
|
|
106
|
-
|
|
109
|
+
default: D(() => [
|
|
110
|
+
Y(m(C.value), 1)
|
|
107
111
|
]),
|
|
108
112
|
_: 1
|
|
109
|
-
})) :
|
|
110
|
-
|
|
113
|
+
})) : u("", !0),
|
|
114
|
+
g($, {
|
|
111
115
|
type: "button",
|
|
112
116
|
variant: "outline",
|
|
113
117
|
size: "xs",
|
|
114
118
|
rounded: "full",
|
|
115
119
|
icon: "lucide:plus",
|
|
116
|
-
disabled: !
|
|
117
|
-
onClick:
|
|
120
|
+
disabled: !q.value,
|
|
121
|
+
onClick: T
|
|
118
122
|
}, null, 8, ["disabled"])
|
|
119
123
|
]),
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
(
|
|
125
|
-
key:
|
|
126
|
-
class:
|
|
124
|
+
v("div", oe, [
|
|
125
|
+
F.value.length > 0 ? (s(), n("div", ne, [
|
|
126
|
+
o.draggable ? (s(), n("div", de)) : u("", !0),
|
|
127
|
+
o.showRowNumbers ? (s(), n("div", ie, " # ")) : u("", !0),
|
|
128
|
+
(s(!0), n(w, null, x(F.value, (d, l) => (s(), n("div", {
|
|
129
|
+
key: l,
|
|
130
|
+
class: R(["flex-1 p-3 min-w-0 truncate", { "border-l border-border": l > 0 }])
|
|
127
131
|
}, m(d), 3))), 128)),
|
|
128
|
-
|
|
129
|
-
])) :
|
|
130
|
-
|
|
131
|
-
"model-value":
|
|
132
|
-
"onUpdate:modelValue":
|
|
133
|
-
disabled: !
|
|
132
|
+
y.value ? (s(), n("div", ue)) : u("", !0)
|
|
133
|
+
])) : u("", !0),
|
|
134
|
+
g(Z(ee), {
|
|
135
|
+
"model-value": r.value,
|
|
136
|
+
"onUpdate:modelValue": M,
|
|
137
|
+
disabled: !o.draggable || o.disabled,
|
|
134
138
|
animation: 150,
|
|
135
139
|
handle: ".drag-handle",
|
|
136
140
|
"ghost-class": "opacity-50",
|
|
137
141
|
class: "divide-y divide-border"
|
|
138
142
|
}, {
|
|
139
|
-
default:
|
|
140
|
-
(
|
|
141
|
-
const
|
|
142
|
-
if (
|
|
143
|
-
const
|
|
143
|
+
default: D(() => [
|
|
144
|
+
(s(!0), n(w, null, x(r.value, (d, l, ge, f) => {
|
|
145
|
+
const N = [d, o.disabled, o.isUpdate, o.showRowNumbers, y.value, o.draggable, l];
|
|
146
|
+
if (f && f.key === d._id && I(f, N)) return f;
|
|
147
|
+
const U = (s(), n("div", {
|
|
144
148
|
key: d._id,
|
|
145
149
|
class: "flex group bg-white transition-colors"
|
|
146
150
|
}, [
|
|
147
|
-
|
|
151
|
+
o.draggable ? (s(), n("div", {
|
|
148
152
|
key: 0,
|
|
149
|
-
class:
|
|
153
|
+
class: R(["w-10 flex-none flex items-center justify-center border-r border-border bg-muted/5 drag-handle transition-colors", o.disabled ? "cursor-not-allowed opacity-50" : "cursor-grab active:cursor-grabbing hover:bg-muted/10 text-muted-foreground hover:text-foreground"])
|
|
150
154
|
}, [
|
|
151
|
-
|
|
155
|
+
g(le, {
|
|
152
156
|
icon: "lucide:grip-vertical",
|
|
153
157
|
class: "w-4 h-4"
|
|
154
158
|
})
|
|
155
|
-
], 2)) :
|
|
156
|
-
|
|
157
|
-
(
|
|
158
|
-
key:
|
|
159
|
-
class:
|
|
159
|
+
], 2)) : u("", !0),
|
|
160
|
+
o.showRowNumbers ? (s(), n("div", ce, m(l + 1), 1)) : u("", !0),
|
|
161
|
+
(s(!0), n(w, null, x(o.schema, (i, O) => (s(), n("div", {
|
|
162
|
+
key: i.name,
|
|
163
|
+
class: R(["flex-1 min-w-0 relative", { "border-l border-border": O > 0 }])
|
|
160
164
|
}, [
|
|
161
|
-
|
|
165
|
+
K(l, i) ? (s(), B(te, {
|
|
166
|
+
key: 0,
|
|
162
167
|
field: {
|
|
163
|
-
...
|
|
168
|
+
...i,
|
|
164
169
|
props: {
|
|
165
|
-
...
|
|
166
|
-
...
|
|
170
|
+
...i.type === "multiSelect" ? { showControls: !1, wrap: !1 } : {},
|
|
171
|
+
...i.props || {}
|
|
167
172
|
},
|
|
168
173
|
label: void 0
|
|
169
174
|
},
|
|
170
|
-
value:
|
|
171
|
-
values:
|
|
175
|
+
value: H(l, i.name),
|
|
176
|
+
values: o.values || {},
|
|
172
177
|
variant: "transparent",
|
|
173
178
|
size: "sm",
|
|
174
179
|
rounded: "none",
|
|
175
|
-
disabled:
|
|
176
|
-
|
|
180
|
+
disabled: G(l, i),
|
|
181
|
+
readonly: J(l, i),
|
|
182
|
+
isUpdate: o.isUpdate,
|
|
177
183
|
class: "w-full h-full min-h-[40px]",
|
|
178
|
-
onChange: (
|
|
179
|
-
}, null, 8, ["field", "value", "values", "disabled", "isUpdate", "onChange"])
|
|
184
|
+
onChange: (P) => L(l, i.name, P)
|
|
185
|
+
}, null, 8, ["field", "value", "values", "disabled", "readonly", "isUpdate", "onChange"])) : u("", !0)
|
|
180
186
|
], 2))), 128)),
|
|
181
|
-
|
|
182
|
-
|
|
187
|
+
y.value ? (s(), n("div", me, [
|
|
188
|
+
g($, {
|
|
183
189
|
type: "button",
|
|
184
190
|
variant: "ghost",
|
|
185
191
|
size: "xs",
|
|
186
192
|
icon: "lucide:trash-2",
|
|
187
|
-
disabled:
|
|
188
|
-
onClick: (
|
|
193
|
+
disabled: o.disabled,
|
|
194
|
+
onClick: (i) => S(l)
|
|
189
195
|
}, null, 8, ["disabled", "onClick"])
|
|
190
|
-
])) :
|
|
196
|
+
])) : u("", !0)
|
|
191
197
|
]));
|
|
192
|
-
return
|
|
193
|
-
},
|
|
198
|
+
return U.memo = N, U;
|
|
199
|
+
}, t, 0), 128))
|
|
194
200
|
]),
|
|
195
201
|
_: 1
|
|
196
202
|
}, 8, ["model-value", "disabled"]),
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
])) :
|
|
203
|
+
r.value.length === 0 ? (s(), n("div", be, [
|
|
204
|
+
v("p", fe, m(z.value), 1),
|
|
205
|
+
v("p", ve, m(A.value), 1)
|
|
206
|
+
])) : u("", !0)
|
|
201
207
|
])
|
|
202
208
|
]));
|
|
203
209
|
}
|
|
204
210
|
});
|
|
205
211
|
export {
|
|
206
|
-
|
|
212
|
+
Ce as default
|
|
207
213
|
};
|