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