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