lkt-item-crud 1.1.23 → 1.1.25
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/dist/build.d.ts +4 -4
- package/dist/build.js +111 -104
- package/dist/lib-components/LktItemCrud.vue.d.ts +9 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/lib-components/LktItemCrud.vue +9 -2
package/dist/build.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
declare function
|
|
2
|
-
declare namespace
|
|
3
|
-
function install(l: any,
|
|
1
|
+
declare function Oe(l?: boolean): void;
|
|
2
|
+
declare namespace Te {
|
|
3
|
+
function install(l: any, f?: {}): void;
|
|
4
4
|
}
|
|
5
|
-
export {
|
|
5
|
+
export { Oe as debugLktItemCrud, Te as default };
|
package/dist/build.js
CHANGED
|
@@ -1,48 +1,50 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as ce, useSlots as ve, ref as i, computed as s, watch as m, nextTick as fe, resolveComponent as V, openBlock as h, createElementBlock as N, createElementVNode as x, toDisplayString as pe, renderSlot as L, createCommentVNode as y, withDirectives as O, createBlock as T, unref as _, withCtx as Y, vShow as $, createVNode as Z } from "vue";
|
|
2
2
|
import { httpCall as me } from "lkt-http-client";
|
|
3
|
-
import { DataState as
|
|
4
|
-
import { execModal as he, refreshModal as
|
|
5
|
-
const
|
|
3
|
+
import { DataState as ee } from "lkt-data-state";
|
|
4
|
+
import { execModal as he, refreshModal as be, closeModal as ke, openModal as Ce, reOpenModal as De } from "lkt-modal";
|
|
5
|
+
const q = class q {
|
|
6
6
|
};
|
|
7
|
-
|
|
8
|
-
let
|
|
7
|
+
q.debugEnabled = !1;
|
|
8
|
+
let F = q;
|
|
9
9
|
const u = (...l) => {
|
|
10
|
-
|
|
11
|
-
},
|
|
12
|
-
|
|
13
|
-
},
|
|
10
|
+
F.debugEnabled && console.info("[LktItemCrud] ", ...l);
|
|
11
|
+
}, Oe = (l = !0) => {
|
|
12
|
+
F.debugEnabled = l;
|
|
13
|
+
}, j = (l) => {
|
|
14
14
|
u("runModalCallback -> init", l);
|
|
15
|
-
let
|
|
15
|
+
let f = l.modalKey ? l.modalKey : "_", g = l.args ? l.args : {};
|
|
16
16
|
switch (l.action) {
|
|
17
17
|
case "reOpen":
|
|
18
|
-
return De(l.modalName,
|
|
18
|
+
return De(l.modalName, f, g);
|
|
19
19
|
case "open":
|
|
20
|
-
return
|
|
20
|
+
return Ce(l.modalName, f, g);
|
|
21
21
|
case "close":
|
|
22
|
-
return
|
|
22
|
+
return ke(l.modalName, f);
|
|
23
23
|
case "refresh":
|
|
24
|
-
return
|
|
24
|
+
return be(l.modalName, f, g);
|
|
25
25
|
case "exec":
|
|
26
26
|
let e = l.method;
|
|
27
|
-
return e ? he(l.modalName,
|
|
27
|
+
return e ? he(l.modalName, f, e, g) : void 0;
|
|
28
28
|
}
|
|
29
29
|
}, Se = { class: "lkt-item-crud" }, ye = {
|
|
30
30
|
key: 0,
|
|
31
31
|
class: "lkt-item-crud_header"
|
|
32
|
-
}, ge = { class: "lkt-item-crud_header-title" }, Me = { class: "lkt-item-crud_header-slot" },
|
|
32
|
+
}, ge = { class: "lkt-item-crud_header-title" }, Me = { class: "lkt-item-crud_header-slot" }, Be = { class: "lkt-item-crud-buttons" }, _e = {
|
|
33
33
|
key: 1,
|
|
34
34
|
class: "lkt-item-crud_content"
|
|
35
|
-
},
|
|
35
|
+
}, we = {
|
|
36
36
|
key: 0,
|
|
37
37
|
class: "lkt-grid-1"
|
|
38
|
-
},
|
|
38
|
+
}, Ie = /* @__PURE__ */ ce({
|
|
39
39
|
__name: "LktItemCrud",
|
|
40
40
|
props: {
|
|
41
41
|
modelValue: { default: () => ({}) },
|
|
42
42
|
title: { default: "" },
|
|
43
43
|
editModeText: { default: "Edition Mode" },
|
|
44
44
|
saveText: { default: "Save" },
|
|
45
|
+
saveIcon: {},
|
|
45
46
|
dropText: { default: "Delete" },
|
|
47
|
+
dropIcon: {},
|
|
46
48
|
hiddenSave: { type: Boolean, default: !1 },
|
|
47
49
|
hiddenDrop: { type: Boolean, default: !1 },
|
|
48
50
|
hiddenButtons: { type: Boolean, default: !1 },
|
|
@@ -69,6 +71,7 @@ const u = (...l) => {
|
|
|
69
71
|
onCreate: { type: Function, default: void 0 },
|
|
70
72
|
onUpdate: { type: Function, default: void 0 },
|
|
71
73
|
insideModal: { type: Boolean, default: !1 },
|
|
74
|
+
hideSwitchEdition: { type: Boolean, default: !1 },
|
|
72
75
|
dataStateConfig: { default: () => ({}) },
|
|
73
76
|
onCreateModalCallbacks: { default: () => [] },
|
|
74
77
|
onUpdateModalCallbacks: { default: () => [] },
|
|
@@ -76,188 +79,192 @@ const u = (...l) => {
|
|
|
76
79
|
editing: { type: Boolean, default: !1 }
|
|
77
80
|
},
|
|
78
81
|
emits: ["update:modelValue", "update:isCreate", "update:editing", "read", "create", "update", "drop", "before-save", "perms", "error", "modified-data"],
|
|
79
|
-
setup(l, { expose:
|
|
80
|
-
const e = l,
|
|
81
|
-
let
|
|
82
|
-
const d =
|
|
82
|
+
setup(l, { expose: f, emit: g }) {
|
|
83
|
+
const e = l, b = ve(), n = g;
|
|
84
|
+
let ae = [];
|
|
85
|
+
const d = i(!0), r = i(e.modelValue), w = i(ae), c = i(e.editing), p = i(!1), k = i(!1), v = i(200), E = i(null), U = i(null), M = i(new ee(r.value, e.dataStateConfig)), J = i(new ee(e.readData)), o = i(e.isCreate), K = i(!1), te = s(() => o.value ? e.createConfirm : e.updateConfirm), le = s(() => o.value ? e.createConfirmData : e.updateConfirmData), H = s(() => o.value ? e.createResource : e.updateResource), oe = s(() => o.value ? { ...e.createData, ...JSON.parse(JSON.stringify(r.value)) } : { ...e.updateData, ...JSON.parse(JSON.stringify(r.value)) }), ue = s(() => o.value ? e.createDisabled : e.updateDisabled), C = s(() => !o.value && w.value.includes("update")), D = s(() => !o.value && w.value.includes("drop")), R = async () => {
|
|
83
86
|
u("fetchItem"), d.value = !0, v.value = -1, k.value = !1;
|
|
84
87
|
try {
|
|
85
88
|
const a = await me(e.readResource, e.readData);
|
|
86
89
|
if (u("fetchItem -> response", a), d.value = !1, v.value = a.httpStatus, !a.success) {
|
|
87
|
-
|
|
90
|
+
p.value = !1, v.value = a.httpStatus, n("error", a.httpStatus);
|
|
88
91
|
return;
|
|
89
92
|
}
|
|
90
|
-
|
|
93
|
+
p.value = !0, r.value = a.data, w.value = a.perms, M.value.increment(r.value).turnStoredIntoOriginal(), J.value.turnStoredIntoOriginal(), n("read", a);
|
|
91
94
|
} catch {
|
|
92
|
-
d.value = !1,
|
|
95
|
+
d.value = !1, p.value = !1, v.value = 404, n("error", 404);
|
|
93
96
|
return;
|
|
94
97
|
}
|
|
95
|
-
},
|
|
96
|
-
|
|
97
|
-
r.value = a,
|
|
98
|
-
}, { deep: !0 }),
|
|
99
|
-
if (
|
|
98
|
+
}, de = s(() => d.value ? !1 : e.title || !!b["post-title"]);
|
|
99
|
+
m(() => e.modelValue, (a) => {
|
|
100
|
+
r.value = a, M.value.increment(a);
|
|
101
|
+
}, { deep: !0 }), m(r, (a) => {
|
|
102
|
+
if (K.value = !0, u("item updated ->", r.value), typeof e.beforeEmitUpdate == "function") {
|
|
100
103
|
u("item updated -> has beforeEmitUpdate");
|
|
101
104
|
let t = e.beforeEmitUpdate(r.value);
|
|
102
105
|
u("item updated -> override with: ", t), typeof t == "object" && (r.value = t);
|
|
103
106
|
}
|
|
104
|
-
n("update:modelValue", r.value), u("item updated -> update dataState"),
|
|
105
|
-
}, { deep: !0 }),
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}),
|
|
107
|
+
n("update:modelValue", r.value), u("item updated -> update dataState"), M.value.increment(a), fe(() => K.value = !1);
|
|
108
|
+
}, { deep: !0 }), m(w, () => n("perms", w.value));
|
|
109
|
+
const P = s(() => ue.value || !o.value && !C.value || typeof e.saveValidator == "function" && !e.saveValidator(r.value) ? !1 : M.value.changed());
|
|
110
|
+
m(P, (a) => n("modified-data", a)), m(o, (a) => n("update:isCreate", a)), m(() => e.readData, (a) => {
|
|
111
|
+
J.value.increment(a), J.value.changed() && R();
|
|
112
|
+
}), m(() => e.editing, (a) => {
|
|
110
113
|
u("editing updated -> updating editMode", a), c.value = a;
|
|
111
|
-
}),
|
|
114
|
+
}), m(c, (a) => {
|
|
112
115
|
u("editMode updated -> emit update", a), n("update:editing", a);
|
|
113
|
-
}), e.readResource && !o.value ?
|
|
114
|
-
const
|
|
116
|
+
}), e.readResource && !o.value ? R() : o.value && (p.value = !0, c.value = !0, d.value = !1);
|
|
117
|
+
const re = (a, t) => {
|
|
115
118
|
if (d.value = !1, v.value = t.httpStatus, !t.success) {
|
|
116
119
|
k.value = !0, n("error", t.httpStatus);
|
|
117
120
|
return;
|
|
118
121
|
}
|
|
119
|
-
k.value = !0, e.onDropModalCallbacks.length > 0 && (u("onDrop -> has onDropModalCallbacks"), e.onDropModalCallbacks.forEach((
|
|
120
|
-
|
|
122
|
+
k.value = !0, e.onDropModalCallbacks.length > 0 && (u("onDrop -> has onDropModalCallbacks"), e.onDropModalCallbacks.forEach((S) => {
|
|
123
|
+
j(S);
|
|
121
124
|
})), n("drop", t);
|
|
122
|
-
},
|
|
123
|
-
if (u("onSave -> received response:", t), n("before-save"),
|
|
125
|
+
}, ne = (a, t) => {
|
|
126
|
+
if (u("onSave -> received response:", t), n("before-save"), H.value) {
|
|
124
127
|
if (d.value = !1, v.value = t.httpStatus, !t.success) {
|
|
125
128
|
k.value = !0, n("error", t.httpStatus);
|
|
126
129
|
return;
|
|
127
130
|
}
|
|
128
131
|
k.value = !0;
|
|
129
132
|
}
|
|
130
|
-
let
|
|
131
|
-
o.value || (u("onSave -> turn stored data into original"),
|
|
132
|
-
|
|
133
|
-
}))) : typeof e.onUpdate == "function" && (u("onSave -> trigger onUpdate callback"), e.onUpdate(t), e.onUpdateModalCallbacks.length > 0 && (u("onSave -> has onUpdateModalCallbacks"), e.onUpdateModalCallbacks.forEach((
|
|
134
|
-
|
|
135
|
-
}))), !e.insideModal && t.autoReloadId && (u("onSave -> autoReloadId detected: ", t.autoReloadId), e.readData.id = t.autoReloadId, u("onSave -> turning off create mode"), o.value = !1,
|
|
133
|
+
let S = o.value ? "create" : "update";
|
|
134
|
+
o.value || (u("onSave -> turn stored data into original"), M.value.turnStoredIntoOriginal()), S === "create" ? typeof e.onCreate == "function" && (u("onSave -> trigger onCreate callback"), e.onCreate(t), e.onCreateModalCallbacks.length > 0 && (u("onSave -> has onCreateModalCallbacks"), e.onCreateModalCallbacks.forEach((I) => {
|
|
135
|
+
j(I);
|
|
136
|
+
}))) : typeof e.onUpdate == "function" && (u("onSave -> trigger onUpdate callback"), e.onUpdate(t), e.onUpdateModalCallbacks.length > 0 && (u("onSave -> has onUpdateModalCallbacks"), e.onUpdateModalCallbacks.forEach((I) => {
|
|
137
|
+
j(I);
|
|
138
|
+
}))), !e.insideModal && t.autoReloadId && (u("onSave -> autoReloadId detected: ", t.autoReloadId), e.readData.id = t.autoReloadId, u("onSave -> turning off create mode"), o.value = !1, R()), n(S, t);
|
|
136
139
|
}, z = () => {
|
|
137
140
|
d.value = !0, v.value = -1;
|
|
138
141
|
}, A = () => {
|
|
139
142
|
d.value = !1;
|
|
140
143
|
};
|
|
141
|
-
|
|
144
|
+
f({
|
|
142
145
|
doDrop: () => {
|
|
143
|
-
|
|
146
|
+
U.value && typeof U.value.click == "function" && U.value.click();
|
|
144
147
|
},
|
|
145
|
-
doRefresh:
|
|
148
|
+
doRefresh: R,
|
|
146
149
|
doSave: () => {
|
|
147
|
-
|
|
150
|
+
E.value && typeof E.value.click == "function" && E.value.click();
|
|
148
151
|
}
|
|
149
152
|
});
|
|
150
|
-
const G =
|
|
153
|
+
const G = s(() => !C.value && D.value ? !0 : !e.hiddenDrop && !d.value && c.value && p.value), Q = s(() => M.value.changed() ? !0 : d.value ? !1 : o.value ? !0 : !e.hiddenSave && c.value && p.value), W = s(() => e.hideSwitchEdition || !C.value && !D.value || !C.value && D.value ? !1 : !d.value && !o.value && p.value && !(e.dropDisabled && e.updateDisabled)), ie = s(() => !e.hiddenButtons && (Q.value || G.value || W.value));
|
|
151
154
|
return (a, t) => {
|
|
152
|
-
const
|
|
153
|
-
return
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
155
|
+
const S = V("lkt-button"), I = V("lkt-field-switch"), X = V("lkt-http-info"), se = V("lkt-loader");
|
|
156
|
+
return h(), N("article", Se, [
|
|
157
|
+
de.value ? (h(), N("header", ye, [
|
|
158
|
+
x("h1", ge, pe(a.title), 1),
|
|
159
|
+
x("div", Me, [
|
|
160
|
+
L(a.$slots, "post-title", {
|
|
158
161
|
item: r.value,
|
|
159
162
|
loading: d.value
|
|
160
163
|
})
|
|
161
164
|
])
|
|
162
|
-
])) :
|
|
163
|
-
|
|
164
|
-
o.value ?
|
|
165
|
+
])) : y("", !0),
|
|
166
|
+
O(x("div", Be, [
|
|
167
|
+
o.value ? y("", !0) : O((h(), T(S, {
|
|
165
168
|
key: 0,
|
|
166
|
-
ref: (
|
|
169
|
+
ref: (B) => U.value = B,
|
|
167
170
|
palette: "danger",
|
|
168
|
-
disabled: a.dropDisabled || !
|
|
171
|
+
disabled: a.dropDisabled || !D.value,
|
|
169
172
|
"confirm-modal": a.dropConfirm,
|
|
170
173
|
"confirm-data": a.dropConfirmData,
|
|
171
174
|
resource: a.dropResource,
|
|
172
175
|
"resource-data": a.dropData,
|
|
176
|
+
text: _(b)["button-drop"] ? "" : a.dropText,
|
|
177
|
+
icon: _(b)["button-drop"] ? "" : a.dropIcon,
|
|
173
178
|
onLoading: z,
|
|
174
179
|
onLoaded: A,
|
|
175
|
-
onClick:
|
|
180
|
+
onClick: re
|
|
176
181
|
}, {
|
|
177
182
|
default: Y(() => [
|
|
178
|
-
|
|
183
|
+
_(b)["button-drop"] ? L(a.$slots, "button-drop", {
|
|
179
184
|
key: 0,
|
|
180
185
|
item: r.value,
|
|
181
186
|
editMode: c.value,
|
|
182
187
|
isCreate: o.value,
|
|
183
188
|
canUpdate: C.value,
|
|
184
|
-
canDrop:
|
|
185
|
-
}) : (
|
|
189
|
+
canDrop: D.value
|
|
190
|
+
}) : y("", !0)
|
|
186
191
|
]),
|
|
187
192
|
_: 3
|
|
188
|
-
}, 8, ["disabled", "confirm-modal", "confirm-data", "resource", "resource-data"])), [
|
|
189
|
-
[
|
|
193
|
+
}, 8, ["disabled", "confirm-modal", "confirm-data", "resource", "resource-data", "text", "icon"])), [
|
|
194
|
+
[$, G.value]
|
|
190
195
|
]),
|
|
191
|
-
|
|
192
|
-
ref: (
|
|
196
|
+
O(Z(S, {
|
|
197
|
+
ref: (B) => E.value = B,
|
|
193
198
|
palette: "success",
|
|
194
|
-
disabled: !
|
|
195
|
-
"confirm-modal":
|
|
196
|
-
"confirm-data":
|
|
197
|
-
resource:
|
|
198
|
-
"resource-data":
|
|
199
|
+
disabled: !P.value,
|
|
200
|
+
"confirm-modal": te.value,
|
|
201
|
+
"confirm-data": le.value,
|
|
202
|
+
resource: H.value,
|
|
203
|
+
"resource-data": oe.value,
|
|
204
|
+
text: _(b)["button-save"] ? "" : a.saveText,
|
|
205
|
+
icon: _(b)["button-save"] ? "" : a.saveIcon,
|
|
199
206
|
onLoading: z,
|
|
200
207
|
onLoaded: A,
|
|
201
|
-
onClick:
|
|
208
|
+
onClick: ne
|
|
202
209
|
}, {
|
|
203
210
|
default: Y(() => [
|
|
204
|
-
|
|
211
|
+
_(b)["button-save"] ? L(a.$slots, "button-save", {
|
|
205
212
|
key: 0,
|
|
206
213
|
item: r.value,
|
|
207
214
|
editMode: c.value,
|
|
208
215
|
isCreate: o.value,
|
|
209
216
|
canUpdate: C.value,
|
|
210
|
-
canDrop:
|
|
211
|
-
}) : (
|
|
217
|
+
canDrop: D.value
|
|
218
|
+
}) : y("", !0)
|
|
212
219
|
]),
|
|
213
220
|
_: 3
|
|
214
|
-
}, 8, ["disabled", "confirm-modal", "confirm-data", "resource", "resource-data"]), [
|
|
215
|
-
[
|
|
221
|
+
}, 8, ["disabled", "confirm-modal", "confirm-data", "resource", "resource-data", "text", "icon"]), [
|
|
222
|
+
[$, Q.value]
|
|
216
223
|
]),
|
|
217
|
-
|
|
224
|
+
O(Z(I, {
|
|
218
225
|
modelValue: c.value,
|
|
219
|
-
"onUpdate:modelValue": t[0] || (t[0] = (
|
|
226
|
+
"onUpdate:modelValue": t[0] || (t[0] = (B) => c.value = B),
|
|
220
227
|
label: a.editModeText
|
|
221
228
|
}, null, 8, ["modelValue", "label"]), [
|
|
222
|
-
[
|
|
229
|
+
[$, W.value]
|
|
223
230
|
])
|
|
224
231
|
], 512), [
|
|
225
|
-
[
|
|
232
|
+
[$, ie.value]
|
|
226
233
|
]),
|
|
227
|
-
d.value ?
|
|
228
|
-
|
|
229
|
-
k.value ? (
|
|
234
|
+
d.value ? y("", !0) : (h(), N("div", _e, [
|
|
235
|
+
p.value ? (h(), N("div", we, [
|
|
236
|
+
k.value ? (h(), T(X, {
|
|
230
237
|
key: 0,
|
|
231
238
|
code: v.value,
|
|
232
239
|
quick: "",
|
|
233
240
|
palette: v.value === 200 ? "success" : "danger",
|
|
234
241
|
"can-close": "",
|
|
235
|
-
onClose: t[1] || (t[1] = (
|
|
236
|
-
}, null, 8, ["code", "palette"])) :
|
|
237
|
-
|
|
242
|
+
onClose: t[1] || (t[1] = (B) => k.value = !1)
|
|
243
|
+
}, null, 8, ["code", "palette"])) : y("", !0),
|
|
244
|
+
L(a.$slots, "item", {
|
|
238
245
|
item: r.value,
|
|
239
246
|
loading: d.value,
|
|
240
247
|
editMode: c.value,
|
|
241
248
|
isCreate: o.value,
|
|
242
249
|
canUpdate: C.value,
|
|
243
|
-
canDrop:
|
|
244
|
-
itemBeingEdited:
|
|
250
|
+
canDrop: D.value,
|
|
251
|
+
itemBeingEdited: K.value
|
|
245
252
|
})
|
|
246
|
-
])) : (
|
|
253
|
+
])) : (h(), T(X, {
|
|
247
254
|
key: 1,
|
|
248
255
|
code: v.value
|
|
249
256
|
}, null, 8, ["code"]))
|
|
250
257
|
])),
|
|
251
|
-
d.value ? (
|
|
258
|
+
d.value ? (h(), T(se, { key: 2 })) : y("", !0)
|
|
252
259
|
]);
|
|
253
260
|
};
|
|
254
261
|
}
|
|
255
|
-
}),
|
|
256
|
-
install: (l,
|
|
257
|
-
l.component("lkt-item-crud") === void 0 && l.component("lkt-item-crud",
|
|
262
|
+
}), Te = {
|
|
263
|
+
install: (l, f = {}) => {
|
|
264
|
+
l.component("lkt-item-crud") === void 0 && l.component("lkt-item-crud", Ie);
|
|
258
265
|
}
|
|
259
266
|
};
|
|
260
267
|
export {
|
|
261
|
-
|
|
262
|
-
|
|
268
|
+
Oe as debugLktItemCrud,
|
|
269
|
+
Te as default
|
|
263
270
|
};
|
|
@@ -5,7 +5,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
5
5
|
title: string;
|
|
6
6
|
editModeText: string;
|
|
7
7
|
saveText: string;
|
|
8
|
+
saveIcon: string;
|
|
8
9
|
dropText: string;
|
|
10
|
+
dropIcon: string;
|
|
9
11
|
hiddenSave: boolean;
|
|
10
12
|
hiddenDrop: boolean;
|
|
11
13
|
hiddenButtons: boolean;
|
|
@@ -32,6 +34,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
32
34
|
onCreate: Function | undefined;
|
|
33
35
|
onUpdate: Function | undefined;
|
|
34
36
|
insideModal: boolean;
|
|
37
|
+
hideSwitchEdition: boolean;
|
|
35
38
|
dataStateConfig: LktObject;
|
|
36
39
|
onCreateModalCallbacks: ModalCallbackConfig[];
|
|
37
40
|
onUpdateModalCallbacks: ModalCallbackConfig[];
|
|
@@ -69,6 +72,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
69
72
|
onCreate: undefined;
|
|
70
73
|
onUpdate: undefined;
|
|
71
74
|
insideModal: boolean;
|
|
75
|
+
hideSwitchEdition: boolean;
|
|
72
76
|
dataStateConfig: () => {};
|
|
73
77
|
onCreateModalCallbacks: () => never[];
|
|
74
78
|
onUpdateModalCallbacks: () => never[];
|
|
@@ -95,7 +99,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
95
99
|
title: string;
|
|
96
100
|
editModeText: string;
|
|
97
101
|
saveText: string;
|
|
102
|
+
saveIcon: string;
|
|
98
103
|
dropText: string;
|
|
104
|
+
dropIcon: string;
|
|
99
105
|
hiddenSave: boolean;
|
|
100
106
|
hiddenDrop: boolean;
|
|
101
107
|
hiddenButtons: boolean;
|
|
@@ -122,6 +128,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
122
128
|
onCreate: Function | undefined;
|
|
123
129
|
onUpdate: Function | undefined;
|
|
124
130
|
insideModal: boolean;
|
|
131
|
+
hideSwitchEdition: boolean;
|
|
125
132
|
dataStateConfig: LktObject;
|
|
126
133
|
onCreateModalCallbacks: ModalCallbackConfig[];
|
|
127
134
|
onUpdateModalCallbacks: ModalCallbackConfig[];
|
|
@@ -159,6 +166,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
159
166
|
onCreate: undefined;
|
|
160
167
|
onUpdate: undefined;
|
|
161
168
|
insideModal: boolean;
|
|
169
|
+
hideSwitchEdition: boolean;
|
|
162
170
|
dataStateConfig: () => {};
|
|
163
171
|
onCreateModalCallbacks: () => never[];
|
|
164
172
|
onUpdateModalCallbacks: () => never[];
|
|
@@ -208,6 +216,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
208
216
|
onCreate: Function | undefined;
|
|
209
217
|
onUpdate: Function | undefined;
|
|
210
218
|
insideModal: boolean;
|
|
219
|
+
hideSwitchEdition: boolean;
|
|
211
220
|
dataStateConfig: LktObject;
|
|
212
221
|
onCreateModalCallbacks: ModalCallbackConfig[];
|
|
213
222
|
onUpdateModalCallbacks: ModalCallbackConfig[];
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.lkt-item-crud{display:flex;flex-direction:column;gap:var(--gap)}.lkt-item-crud_content{display:flex;flex-direction:column;gap:15px}.lkt-item-crud-buttons{position:sticky;top:calc(-1 * var(--gap));display:flex;align-items:center;gap:var(--gap);transition:all linear .15s;background:transparent;z-index:2}.lkt-item-crud-buttons>:last-child{margin-left:auto}
|
|
1
|
+
.lkt-item-crud{display:flex;flex-direction:column;gap:var(--lkt-item-crud-gap)}.lkt-item-crud_content{display:flex;flex-direction:column;gap:15px}.lkt-item-crud-buttons{position:sticky;top:calc(-1 * var(--lkt-item-crud-gap));display:flex;align-items:center;gap:var(--lkt-item-crud-gap-buttons);transition:all linear .15s;background:transparent;z-index:2}.lkt-item-crud-buttons>:last-child{margin-left:auto}
|
package/package.json
CHANGED
|
@@ -12,7 +12,9 @@ const props = withDefaults(defineProps<{
|
|
|
12
12
|
title: string
|
|
13
13
|
editModeText: string
|
|
14
14
|
saveText: string
|
|
15
|
+
saveIcon: string
|
|
15
16
|
dropText: string
|
|
17
|
+
dropIcon: string
|
|
16
18
|
hiddenSave: boolean
|
|
17
19
|
hiddenDrop: boolean
|
|
18
20
|
hiddenButtons: boolean
|
|
@@ -39,6 +41,7 @@ const props = withDefaults(defineProps<{
|
|
|
39
41
|
onCreate: Function|undefined
|
|
40
42
|
onUpdate: Function|undefined
|
|
41
43
|
insideModal: boolean
|
|
44
|
+
hideSwitchEdition: boolean
|
|
42
45
|
dataStateConfig: LktObject
|
|
43
46
|
onCreateModalCallbacks: ModalCallbackConfig[]
|
|
44
47
|
onUpdateModalCallbacks: ModalCallbackConfig[]
|
|
@@ -76,6 +79,7 @@ const props = withDefaults(defineProps<{
|
|
|
76
79
|
onCreate: undefined,
|
|
77
80
|
onUpdate: undefined,
|
|
78
81
|
insideModal: false,
|
|
82
|
+
hideSwitchEdition: false,
|
|
79
83
|
dataStateConfig: () => ({}),
|
|
80
84
|
onCreateModalCallbacks: () => [],
|
|
81
85
|
onUpdateModalCallbacks: () => [],
|
|
@@ -335,6 +339,7 @@ const showDropButton = computed(() => {
|
|
|
335
339
|
&& httpSuccessRead.value;
|
|
336
340
|
}),
|
|
337
341
|
showSwitchButton = computed(() => {
|
|
342
|
+
if (props.hideSwitchEdition) return false;
|
|
338
343
|
if (!canUpdate.value && !canDrop.value) return false;
|
|
339
344
|
if (!canUpdate.value && canDrop.value) return false;
|
|
340
345
|
|
|
@@ -367,6 +372,8 @@ const showDropButton = computed(() => {
|
|
|
367
372
|
v-bind:confirm-data="dropConfirmData"
|
|
368
373
|
v-bind:resource="dropResource"
|
|
369
374
|
v-bind:resource-data="dropData"
|
|
375
|
+
:text="slots['button-drop'] ? '' : dropText"
|
|
376
|
+
:icon="slots['button-drop'] ? '' : dropIcon"
|
|
370
377
|
v-on:loading="onButtonLoading"
|
|
371
378
|
v-on:loaded="onButtonLoaded"
|
|
372
379
|
v-on:click="onDrop">
|
|
@@ -375,7 +382,6 @@ const showDropButton = computed(() => {
|
|
|
375
382
|
v-bind:is-create="createMode"
|
|
376
383
|
v-bind:can-update="canUpdate"
|
|
377
384
|
v-bind:can-drop="canDrop"></slot>
|
|
378
|
-
<span v-else>{{ dropText }}</span>
|
|
379
385
|
</lkt-button>
|
|
380
386
|
|
|
381
387
|
<lkt-button
|
|
@@ -387,6 +393,8 @@ const showDropButton = computed(() => {
|
|
|
387
393
|
v-bind:confirm-data="confirmData"
|
|
388
394
|
v-bind:resource="saveResource"
|
|
389
395
|
v-bind:resource-data="saveData"
|
|
396
|
+
:text="slots['button-save'] ? '' : saveText"
|
|
397
|
+
:icon="slots['button-save'] ? '' : saveIcon"
|
|
390
398
|
v-on:loading="onButtonLoading"
|
|
391
399
|
v-on:loaded="onButtonLoaded"
|
|
392
400
|
v-on:click="onSave">
|
|
@@ -395,7 +403,6 @@ const showDropButton = computed(() => {
|
|
|
395
403
|
v-bind:is-create="createMode"
|
|
396
404
|
v-bind:can-update="canUpdate"
|
|
397
405
|
v-bind:can-drop="canDrop"></slot>
|
|
398
|
-
<span v-else>{{ saveText }}</span>
|
|
399
406
|
</lkt-button>
|
|
400
407
|
|
|
401
408
|
<lkt-field-switch
|