lkt-item-crud 2.0.11 → 2.0.12
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 +5 -5
- package/dist/build.js +336 -330
- package/dist/lib-components/LktItemCrud.vue.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/ButtonNav.vue +13 -18
- package/src/lib-components/LktItemCrud.vue +10 -4
package/dist/build.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
declare function
|
|
2
|
-
declare namespace
|
|
3
|
-
function install(C: any,
|
|
1
|
+
declare function ot(C?: boolean): void;
|
|
2
|
+
declare namespace ut {
|
|
3
|
+
function install(C: any, ee?: {}): void;
|
|
4
4
|
}
|
|
5
|
+
declare function dt(C: any): void;
|
|
5
6
|
declare function nt(C: any): void;
|
|
6
|
-
|
|
7
|
-
export { at as debugLktItemCrud, ot as default, nt as setItemCrudDefaultDropIcon, ut as setItemCrudDefaultSaveIcon };
|
|
7
|
+
export { ot as debugLktItemCrud, ut as default, dt as setItemCrudDefaultDropIcon, nt as setItemCrudDefaultSaveIcon };
|
package/dist/build.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { httpCall as
|
|
1
|
+
import { defineComponent as Be, ref as p, watch as h, useSlots as ke, computed as k, resolveComponent as se, createElementBlock as E, createCommentVNode as l, openBlock as m, createBlock as A, mergeProps as N, withCtx as M, renderSlot as g, withDirectives as V, unref as n, createVNode as K, vShow as O, Fragment as Ue, mergeDefaults as Se, nextTick as Ie, onMounted as we, resolveDynamicComponent as Me, normalizeProps as Re, guardReactiveProps as Te, createElementVNode as Ee, toDisplayString as $e, createSlots as ce } from "vue";
|
|
2
|
+
import { httpCall as Le } from "lkt-http-client";
|
|
3
3
|
import { DataState as fe } from "lkt-data-state";
|
|
4
|
-
import { ensureButtonConfig as j, LktSettings as
|
|
5
|
-
import { closeModal as
|
|
6
|
-
import { __ as
|
|
7
|
-
import { openToast as
|
|
8
|
-
const
|
|
4
|
+
import { ensureButtonConfig as j, LktSettings as d, ItemCrudMode as w, ItemCrudButtonNavVisibility as me, TablePermission as ie, ItemCrudView as be, ItemCrudButtonNavPosition as ge, NotificationType as X, getDefaultValues as Ne, ItemCrud as Ve, ToastPositionX as W } from "lkt-vue-kernel";
|
|
5
|
+
import { closeModal as Oe } from "lkt-modal";
|
|
6
|
+
import { __ as je } from "lkt-i18n";
|
|
7
|
+
import { openToast as J } from "lkt-toast";
|
|
8
|
+
const x = class x {
|
|
9
9
|
};
|
|
10
|
-
|
|
11
|
-
let
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
},
|
|
15
|
-
|
|
16
|
-
}, je = {
|
|
17
|
-
key: 0,
|
|
18
|
-
class: "lkt-item-crud-buttons"
|
|
10
|
+
x.debugEnabled = !1, x.defaultSaveIcon = "", x.defaultDropIcon = "";
|
|
11
|
+
let Q = x;
|
|
12
|
+
const B = (...C) => {
|
|
13
|
+
Q.debugEnabled && console.info("[LktItemCrud] ", ...C);
|
|
14
|
+
}, ot = (C = !0) => {
|
|
15
|
+
Q.debugEnabled = C;
|
|
19
16
|
}, Ae = {
|
|
20
17
|
key: 0,
|
|
21
18
|
class: "lkt-item-crud-buttons"
|
|
22
19
|
}, Pe = {
|
|
23
|
-
key:
|
|
20
|
+
key: 0,
|
|
24
21
|
class: "lkt-item-crud-buttons"
|
|
25
22
|
}, Xe = {
|
|
26
|
-
key:
|
|
23
|
+
key: 1,
|
|
24
|
+
class: "lkt-item-crud-buttons"
|
|
25
|
+
}, Fe = {
|
|
26
|
+
key: 2,
|
|
27
27
|
class: "lkt-item-crud-buttons"
|
|
28
|
-
},
|
|
28
|
+
}, ye = /* @__PURE__ */ Be({
|
|
29
29
|
__name: "ButtonNav",
|
|
30
30
|
props: {
|
|
31
31
|
item: { default: () => ({}) },
|
|
@@ -53,266 +53,270 @@ const y = (...C) => {
|
|
|
53
53
|
"save",
|
|
54
54
|
"drop"
|
|
55
55
|
],
|
|
56
|
-
setup(C, { expose:
|
|
57
|
-
const o =
|
|
56
|
+
setup(C, { expose: ee, emit: ue }) {
|
|
57
|
+
const o = ue, a = C, b = p(j(a.createButton, d.defaultCreateButton)), i = p(j(a.updateButton, d.defaultUpdateButton)), r = p(j(a.dropButton, d.defaultDropButton)), y = p(j(a.editModeButton, d.defaultEditModeButton)), R = p(j(a.groupButton, d.defaultGroupButton));
|
|
58
58
|
h(() => a.createButton, (e) => {
|
|
59
|
-
b.value = j(e,
|
|
59
|
+
b.value = j(e, d.defaultCreateButton);
|
|
60
60
|
}, { deep: !0 }), h(() => a.updateButton, (e) => {
|
|
61
|
-
|
|
61
|
+
i.value = j(e, d.defaultUpdateButton);
|
|
62
62
|
}, { deep: !0 }), h(() => a.dropButton, (e) => {
|
|
63
|
-
|
|
63
|
+
r.value = j(e, d.defaultDropButton);
|
|
64
64
|
}, { deep: !0 }), h(() => a.editModeButton, (e) => {
|
|
65
|
-
|
|
65
|
+
y.value = j(e, d.defaultEditModeButton);
|
|
66
66
|
}, { deep: !0 });
|
|
67
|
-
const
|
|
68
|
-
h(() => a.loading, (e) =>
|
|
69
|
-
const
|
|
70
|
-
h(() => a.editing, (e) =>
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
},
|
|
74
|
-
|
|
75
|
-
}, G = (e,
|
|
76
|
-
typeof e > "u" || o("create", e,
|
|
77
|
-
},
|
|
78
|
-
typeof e > "u" || o("save", e,
|
|
79
|
-
}, L = (e,
|
|
80
|
-
typeof e > "u" || o("drop", e,
|
|
67
|
+
const v = ke(), S = p(null), D = p(null), s = p(a.loading);
|
|
68
|
+
h(() => a.loading, (e) => s.value = e), h(s, (e) => o("update:loading", e));
|
|
69
|
+
const c = p(a.editing);
|
|
70
|
+
h(() => a.editing, (e) => c.value = e), h(c, (e) => o("update:editing", e));
|
|
71
|
+
const $ = () => {
|
|
72
|
+
s.value = !0;
|
|
73
|
+
}, U = () => {
|
|
74
|
+
s.value = !1;
|
|
75
|
+
}, G = (e, f) => {
|
|
76
|
+
typeof e > "u" || o("create", e, f);
|
|
77
|
+
}, Y = (e, f) => {
|
|
78
|
+
typeof e > "u" || o("save", e, f);
|
|
79
|
+
}, L = (e, f) => {
|
|
80
|
+
typeof e > "u" || o("drop", e, f);
|
|
81
81
|
};
|
|
82
|
-
|
|
82
|
+
ee({
|
|
83
83
|
doSave: () => {
|
|
84
|
-
|
|
84
|
+
S.value && typeof S.value.click == "function" && S.value.click();
|
|
85
85
|
},
|
|
86
86
|
doDrop: () => {
|
|
87
|
-
|
|
87
|
+
D.value && typeof D.value.click == "function" && D.value.click();
|
|
88
88
|
}
|
|
89
89
|
});
|
|
90
|
-
const
|
|
91
|
-
var e,
|
|
92
|
-
return a.mode !== w.Update || !a.canUpdate || !a.dataChanged ? !1 : typeof ((e =
|
|
93
|
-
}), V = k(() => {
|
|
94
|
-
var e, m;
|
|
95
|
-
return a.mode !== w.Create || !a.dataChanged ? !1 : typeof ((e = b.value) == null ? void 0 : e.disabled) == "function" ? !b.value.disabled(a.item) : typeof ((m = b.value) == null ? void 0 : m.disabled) == "boolean" ? !b.value.disabled : !0;
|
|
90
|
+
const Z = k(() => {
|
|
91
|
+
var e, f;
|
|
92
|
+
return a.mode !== w.Update || !a.canUpdate || !a.dataChanged ? !1 : typeof ((e = i.value) == null ? void 0 : e.disabled) == "function" ? !i.value.disabled(a.item) : typeof ((f = i.value) == null ? void 0 : f.disabled) == "boolean" ? !i.value.disabled : !0;
|
|
96
93
|
}), F = k(() => {
|
|
97
|
-
var e,
|
|
98
|
-
return a.
|
|
99
|
-
}), q = k(() =>
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
94
|
+
var e, f;
|
|
95
|
+
return a.mode !== w.Create || !a.dataChanged ? !1 : typeof ((e = b.value) == null ? void 0 : e.disabled) == "function" ? !b.value.disabled(a.item) : typeof ((f = b.value) == null ? void 0 : f.disabled) == "boolean" ? !b.value.disabled : !0;
|
|
96
|
+
}), q = k(() => {
|
|
97
|
+
var e, f;
|
|
98
|
+
return a.canDrop ? typeof ((e = r.value) == null ? void 0 : e.disabled) == "function" ? !r.value.disabled(a.item) : typeof ((f = r.value) == null ? void 0 : f.disabled) == "boolean" ? !r.value.disabled : !0 : !1;
|
|
99
|
+
}), z = k(() => !a.canDrop || a.dropButton === !1 ? !1 : !a.canUpdate && a.canDrop ? !0 : !s.value && a.editing && a.httpSuccessRead), P = k(() => a.mode === w.Create && a.createButton === !1 || a.mode === w.Update && a.updateButton === !1 || s.value ? !1 : a.editing && a.httpSuccessRead), H = k(() => a.editModeButton === !1 || !a.canSwitchEditMode || !a.canUpdate && !a.canDrop || !a.canUpdate && a.canDrop ? !1 : !s.value && a.mode !== w.Create && a.httpSuccessRead), oe = k(() => a.buttonNavVisibility === me.Always || v["prev-buttons-ever"] ? !0 : a.buttonNavVisibility === me.Never ? !1 : P.value || z.value || H.value);
|
|
100
|
+
return (e, f) => {
|
|
101
|
+
const T = se("lkt-button");
|
|
102
|
+
return oe.value ? (m(), E("div", Ae, [
|
|
103
|
+
e.groupButton !== !1 ? (m(), A(T, N({
|
|
104
104
|
key: 0,
|
|
105
105
|
ref: "groupButton"
|
|
106
|
-
},
|
|
107
|
-
split:
|
|
108
|
-
|
|
109
|
-
checked:
|
|
110
|
-
"onUpdate:checked":
|
|
106
|
+
}, R.value, { class: "lkt-item-crud-group-button" }), {
|
|
107
|
+
split: M(() => [
|
|
108
|
+
H.value ? (m(), A(T, N({ key: 0 }, y.value, {
|
|
109
|
+
checked: c.value,
|
|
110
|
+
"onUpdate:checked": f[0] || (f[0] = (_) => c.value = _),
|
|
111
111
|
class: "lkt-item-crud--switch-mode-button"
|
|
112
|
-
}), null, 16, ["checked"])) :
|
|
113
|
-
|
|
112
|
+
}), null, 16, ["checked"])) : l("", !0),
|
|
113
|
+
n(v)["prev-buttons-ever"] ? g(e.$slots, "prev-buttons-ever", {
|
|
114
114
|
key: 1,
|
|
115
115
|
canUpdate: e.canUpdate,
|
|
116
116
|
canDrop: e.canDrop,
|
|
117
117
|
perms: e.perms
|
|
118
|
-
}) :
|
|
119
|
-
|
|
118
|
+
}) : l("", !0),
|
|
119
|
+
n(v)["prev-buttons"] ? g(e.$slots, "prev-buttons", {
|
|
120
120
|
key: 2,
|
|
121
121
|
canUpdate: e.canUpdate,
|
|
122
122
|
canDrop: e.canDrop,
|
|
123
123
|
perms: e.perms
|
|
124
|
-
}) :
|
|
125
|
-
|
|
126
|
-
key: 3,
|
|
124
|
+
}) : l("", !0),
|
|
125
|
+
V(K(T, N({
|
|
127
126
|
ref_key: "saveButtonRef",
|
|
128
|
-
ref:
|
|
129
|
-
},
|
|
130
|
-
disabled: !
|
|
131
|
-
onLoading:
|
|
132
|
-
onLoaded:
|
|
133
|
-
onClick:
|
|
127
|
+
ref: S
|
|
128
|
+
}, i.value, {
|
|
129
|
+
disabled: !Z.value,
|
|
130
|
+
onLoading: $,
|
|
131
|
+
onLoaded: U,
|
|
132
|
+
onClick: Y
|
|
134
133
|
}), {
|
|
135
|
-
default:
|
|
136
|
-
|
|
134
|
+
default: M(() => [
|
|
135
|
+
n(v)["button-save"] ? g(e.$slots, "button-save", {
|
|
137
136
|
key: 0,
|
|
138
137
|
item: e.item,
|
|
139
|
-
editMode:
|
|
138
|
+
editMode: c.value,
|
|
140
139
|
isCreate: !1,
|
|
141
140
|
canUpdate: e.canUpdate,
|
|
142
141
|
canDrop: e.canDrop
|
|
143
|
-
}) :
|
|
142
|
+
}) : l("", !0)
|
|
144
143
|
]),
|
|
145
144
|
_: 3
|
|
146
|
-
}, 16, ["disabled"])
|
|
147
|
-
|
|
145
|
+
}, 16, ["disabled"]), [
|
|
146
|
+
[O, e.mode === n(w).Update && P.value]
|
|
147
|
+
]),
|
|
148
|
+
V(K(T, N({
|
|
148
149
|
ref_key: "saveButtonRef",
|
|
149
|
-
ref:
|
|
150
|
+
ref: S
|
|
150
151
|
}, b.value, {
|
|
151
|
-
disabled: !
|
|
152
|
-
onLoading:
|
|
153
|
-
onLoaded:
|
|
152
|
+
disabled: !F.value,
|
|
153
|
+
onLoading: $,
|
|
154
|
+
onLoaded: U,
|
|
154
155
|
onClick: G
|
|
155
156
|
}), {
|
|
156
|
-
default:
|
|
157
|
-
|
|
157
|
+
default: M(() => [
|
|
158
|
+
n(v)["button-save"] ? g(e.$slots, "button-save", {
|
|
158
159
|
key: 0,
|
|
159
160
|
item: e.item,
|
|
160
|
-
editMode:
|
|
161
|
+
editMode: c.value,
|
|
161
162
|
isCreate: !0,
|
|
162
163
|
canUpdate: e.canUpdate,
|
|
163
164
|
canDrop: e.canDrop
|
|
164
|
-
}) :
|
|
165
|
+
}) : l("", !0)
|
|
165
166
|
]),
|
|
166
167
|
_: 3
|
|
167
|
-
}, 16, ["disabled"])
|
|
168
|
-
|
|
169
|
-
|
|
168
|
+
}, 16, ["disabled"]), [
|
|
169
|
+
[O, e.mode === n(w).Create && P.value]
|
|
170
|
+
]),
|
|
171
|
+
V(K(T, N({
|
|
170
172
|
ref_key: "dropButtonRef",
|
|
171
|
-
ref:
|
|
172
|
-
},
|
|
173
|
-
disabled: !
|
|
174
|
-
onLoading:
|
|
175
|
-
onLoaded:
|
|
173
|
+
ref: D
|
|
174
|
+
}, r.value, {
|
|
175
|
+
disabled: !q.value,
|
|
176
|
+
onLoading: $,
|
|
177
|
+
onLoaded: U,
|
|
176
178
|
onClick: L
|
|
177
179
|
}), {
|
|
178
|
-
default:
|
|
179
|
-
|
|
180
|
+
default: M(() => [
|
|
181
|
+
n(v)["button-drop"] ? g(e.$slots, "button-drop", {
|
|
180
182
|
key: 0,
|
|
181
183
|
item: e.item,
|
|
182
|
-
editMode:
|
|
184
|
+
editMode: c.value,
|
|
183
185
|
isCreate: !1,
|
|
184
186
|
canUpdate: e.canUpdate,
|
|
185
187
|
canDrop: e.canDrop
|
|
186
|
-
}) :
|
|
188
|
+
}) : l("", !0)
|
|
187
189
|
]),
|
|
188
190
|
_: 3
|
|
189
|
-
}, 16, ["disabled"])
|
|
190
|
-
[
|
|
191
|
-
])
|
|
192
|
-
|
|
191
|
+
}, 16, ["disabled"]), [
|
|
192
|
+
[O, z.value && e.mode !== n(w).Create]
|
|
193
|
+
]),
|
|
194
|
+
n(v).buttons ? g(e.$slots, "buttons", { key: 3 }) : l("", !0)
|
|
193
195
|
]),
|
|
194
196
|
_: 3
|
|
195
|
-
}, 16)) : (
|
|
196
|
-
|
|
197
|
+
}, 16)) : (m(), E(Ue, { key: 1 }, [
|
|
198
|
+
n(v)["prev-buttons-ever"] ? V((m(), E("div", Pe, [
|
|
197
199
|
g(e.$slots, "prev-buttons-ever", {
|
|
198
200
|
canUpdate: e.canUpdate,
|
|
199
201
|
canDrop: e.canDrop,
|
|
200
202
|
perms: e.perms
|
|
201
203
|
})
|
|
202
204
|
], 512)), [
|
|
203
|
-
[
|
|
204
|
-
]) :
|
|
205
|
-
|
|
205
|
+
[O, !s.value]
|
|
206
|
+
]) : l("", !0),
|
|
207
|
+
n(v)["prev-buttons"] ? V((m(), E("div", Xe, [
|
|
206
208
|
g(e.$slots, "prev-buttons", {
|
|
207
209
|
canUpdate: e.canUpdate,
|
|
208
210
|
canDrop: e.canDrop,
|
|
209
211
|
perms: e.perms
|
|
210
212
|
})
|
|
211
213
|
], 512)), [
|
|
212
|
-
[
|
|
213
|
-
]) :
|
|
214
|
-
|
|
215
|
-
key: 2,
|
|
214
|
+
[O, c.value && !s.value]
|
|
215
|
+
]) : l("", !0),
|
|
216
|
+
V(K(T, N({
|
|
216
217
|
ref_key: "saveButtonRef",
|
|
217
|
-
ref:
|
|
218
|
-
},
|
|
219
|
-
disabled: !
|
|
220
|
-
onLoading:
|
|
221
|
-
onLoaded:
|
|
222
|
-
onClick:
|
|
218
|
+
ref: S
|
|
219
|
+
}, i.value, {
|
|
220
|
+
disabled: !Z.value,
|
|
221
|
+
onLoading: $,
|
|
222
|
+
onLoaded: U,
|
|
223
|
+
onClick: Y
|
|
223
224
|
}), {
|
|
224
|
-
default:
|
|
225
|
-
|
|
225
|
+
default: M(() => [
|
|
226
|
+
n(v)["button-save"] ? g(e.$slots, "button-save", {
|
|
226
227
|
key: 0,
|
|
227
228
|
item: e.item,
|
|
228
|
-
editMode:
|
|
229
|
+
editMode: c.value,
|
|
229
230
|
isCreate: !1,
|
|
230
231
|
canUpdate: e.canUpdate,
|
|
231
232
|
canDrop: e.canDrop
|
|
232
|
-
}) :
|
|
233
|
+
}) : l("", !0)
|
|
233
234
|
]),
|
|
234
235
|
_: 3
|
|
235
|
-
}, 16, ["disabled"])
|
|
236
|
-
|
|
236
|
+
}, 16, ["disabled"]), [
|
|
237
|
+
[O, e.mode === n(w).Update && P.value]
|
|
238
|
+
]),
|
|
239
|
+
V(K(T, N({
|
|
237
240
|
ref_key: "saveButtonRef",
|
|
238
|
-
ref:
|
|
241
|
+
ref: S
|
|
239
242
|
}, b.value, {
|
|
240
|
-
disabled: !
|
|
241
|
-
onLoading:
|
|
242
|
-
onLoaded:
|
|
243
|
+
disabled: !F.value,
|
|
244
|
+
onLoading: $,
|
|
245
|
+
onLoaded: U,
|
|
243
246
|
onClick: G
|
|
244
247
|
}), {
|
|
245
|
-
default:
|
|
246
|
-
|
|
248
|
+
default: M(() => [
|
|
249
|
+
n(v)["button-save"] ? g(e.$slots, "button-save", {
|
|
247
250
|
key: 0,
|
|
248
251
|
item: e.item,
|
|
249
|
-
editMode:
|
|
252
|
+
editMode: c.value,
|
|
250
253
|
isCreate: !0,
|
|
251
254
|
canUpdate: e.canUpdate,
|
|
252
255
|
canDrop: e.canDrop
|
|
253
|
-
}) :
|
|
256
|
+
}) : l("", !0)
|
|
254
257
|
]),
|
|
255
258
|
_: 3
|
|
256
|
-
}, 16, ["disabled"])
|
|
257
|
-
|
|
258
|
-
|
|
259
|
+
}, 16, ["disabled"]), [
|
|
260
|
+
[O, e.mode === n(w).Create && P.value]
|
|
261
|
+
]),
|
|
262
|
+
V(K(T, N({
|
|
259
263
|
ref_key: "dropButtonRef",
|
|
260
|
-
ref:
|
|
261
|
-
},
|
|
262
|
-
disabled: !
|
|
263
|
-
onLoading:
|
|
264
|
-
onLoaded:
|
|
264
|
+
ref: D
|
|
265
|
+
}, r.value, {
|
|
266
|
+
disabled: !q.value,
|
|
267
|
+
onLoading: $,
|
|
268
|
+
onLoaded: U,
|
|
265
269
|
onClick: L
|
|
266
270
|
}), {
|
|
267
|
-
default:
|
|
268
|
-
|
|
271
|
+
default: M(() => [
|
|
272
|
+
n(v)["button-drop"] ? g(e.$slots, "button-drop", {
|
|
269
273
|
key: 0,
|
|
270
274
|
item: e.item,
|
|
271
|
-
editMode:
|
|
275
|
+
editMode: c.value,
|
|
272
276
|
isCreate: !1,
|
|
273
277
|
canUpdate: e.canUpdate,
|
|
274
278
|
canDrop: e.canDrop
|
|
275
|
-
}) :
|
|
279
|
+
}) : l("", !0)
|
|
276
280
|
]),
|
|
277
281
|
_: 3
|
|
278
|
-
}, 16, ["disabled"])
|
|
279
|
-
[
|
|
280
|
-
])
|
|
281
|
-
|
|
282
|
+
}, 16, ["disabled"]), [
|
|
283
|
+
[O, z.value && e.mode !== n(w).Create]
|
|
284
|
+
]),
|
|
285
|
+
n(v).buttons ? V((m(), E("div", Fe, [
|
|
282
286
|
g(e.$slots, "buttons")
|
|
283
287
|
], 512)), [
|
|
284
|
-
[
|
|
285
|
-
]) :
|
|
286
|
-
|
|
287
|
-
checked:
|
|
288
|
-
"onUpdate:checked":
|
|
288
|
+
[O, c.value && !s.value]
|
|
289
|
+
]) : l("", !0),
|
|
290
|
+
H.value ? (m(), A(T, N({ key: 3 }, y.value, {
|
|
291
|
+
checked: c.value,
|
|
292
|
+
"onUpdate:checked": f[1] || (f[1] = (_) => c.value = _),
|
|
289
293
|
class: "lkt-item-crud--switch-mode-button"
|
|
290
|
-
}), null, 16, ["checked"])) :
|
|
294
|
+
}), null, 16, ["checked"])) : l("", !0)
|
|
291
295
|
], 64))
|
|
292
|
-
])) :
|
|
296
|
+
])) : l("", !0);
|
|
293
297
|
};
|
|
294
298
|
}
|
|
295
|
-
}),
|
|
299
|
+
}), Ge = { class: "lkt-item-crud" }, qe = {
|
|
296
300
|
key: 0,
|
|
297
301
|
class: "lkt-item-crud_header"
|
|
298
|
-
},
|
|
302
|
+
}, ze = {
|
|
299
303
|
key: 0,
|
|
300
304
|
class: "lkt-item-crud_header-slot"
|
|
301
|
-
},
|
|
305
|
+
}, He = {
|
|
302
306
|
key: 1,
|
|
303
307
|
class: "lkt-item-crud_header-title"
|
|
304
|
-
},
|
|
308
|
+
}, Ke = {
|
|
305
309
|
key: 2,
|
|
306
310
|
class: "lkt-item-crud_header-slot"
|
|
307
|
-
},
|
|
311
|
+
}, We = {
|
|
308
312
|
key: 2,
|
|
309
313
|
class: "lkt-item-crud_content"
|
|
310
|
-
},
|
|
314
|
+
}, Je = {
|
|
311
315
|
key: 0,
|
|
312
316
|
class: "lkt-grid-1"
|
|
313
|
-
},
|
|
317
|
+
}, Qe = /* @__PURE__ */ Be({
|
|
314
318
|
__name: "LktItemCrud",
|
|
315
|
-
props: /* @__PURE__ */
|
|
319
|
+
props: /* @__PURE__ */ Se({
|
|
316
320
|
modelValue: {},
|
|
317
321
|
editing: { type: Boolean },
|
|
318
322
|
perms: {},
|
|
@@ -333,7 +337,7 @@ const y = (...C) => {
|
|
|
333
337
|
title: {},
|
|
334
338
|
beforeEmitUpdate: { type: Function },
|
|
335
339
|
notificationType: {}
|
|
336
|
-
}, Ne(
|
|
340
|
+
}, Ne(Ve)),
|
|
337
341
|
emits: [
|
|
338
342
|
"update:modelValue",
|
|
339
343
|
"update:editing",
|
|
@@ -346,155 +350,155 @@ const y = (...C) => {
|
|
|
346
350
|
"error",
|
|
347
351
|
"modified-data"
|
|
348
352
|
],
|
|
349
|
-
setup(C, { expose:
|
|
350
|
-
const o = C, a = ke(), b =
|
|
351
|
-
|
|
353
|
+
setup(C, { expose: ee, emit: ue }) {
|
|
354
|
+
const o = C, a = ke(), b = ue, i = p(!0), r = p(o.modelValue), y = p(o.perms), R = p(o.editing), v = p(!1), S = p(!1), D = p(200), s = p(new fe(r.value, o.dataStateConfig)), c = p(!1), $ = p(new fe(o.readData)), U = p(o.mode === w.Create), G = p(!1), Y = p(!1), L = p(null), te = k(() => !U.value && Array.isArray(y.value) && y.value.includes(ie.Update)), ae = k(() => !U.value && Array.isArray(y.value) && y.value.includes(ie.Drop)), Z = k(() => !U.value && Array.isArray(y.value) && y.value.includes(ie.SwitchEditMode)), F = async () => {
|
|
355
|
+
B("fetchItem"), i.value = !0, D.value = -1, S.value = !1;
|
|
352
356
|
try {
|
|
353
|
-
const t = await
|
|
354
|
-
if (
|
|
355
|
-
|
|
357
|
+
const t = await Le(o.readResource, o.readData);
|
|
358
|
+
if (B("fetchItem -> response", t), i.value = !1, D.value = t.httpStatus, !t.success) {
|
|
359
|
+
v.value = !1, D.value = t.httpStatus, b("error", t.httpStatus);
|
|
356
360
|
return;
|
|
357
361
|
}
|
|
358
|
-
|
|
362
|
+
v.value = !0, r.value = t.data, y.value = t.perms, s.value.increment(r.value).turnStoredIntoOriginal(), c.value = s.value.changed(), $.value.turnStoredIntoOriginal(), b("read", t);
|
|
359
363
|
} catch {
|
|
360
|
-
|
|
364
|
+
i.value = !1, v.value = !1, D.value = 404, b("error", 404);
|
|
361
365
|
return;
|
|
362
366
|
}
|
|
363
367
|
};
|
|
364
368
|
h(() => o.modelValue, (t) => {
|
|
365
|
-
|
|
366
|
-
}, { deep: !0 }), h(
|
|
367
|
-
if (G.value = !0,
|
|
368
|
-
|
|
369
|
-
let u = o.beforeEmitUpdate(
|
|
370
|
-
|
|
369
|
+
r.value = t, s.value.increment(t);
|
|
370
|
+
}, { deep: !0 }), h(r, (t) => {
|
|
371
|
+
if (G.value = !0, B("item updated ->", r.value), typeof o.beforeEmitUpdate == "function") {
|
|
372
|
+
B("item updated -> has beforeEmitUpdate");
|
|
373
|
+
let u = o.beforeEmitUpdate(r.value);
|
|
374
|
+
B("item updated -> override with: ", u), typeof u == "object" && (r.value = u);
|
|
371
375
|
}
|
|
372
|
-
b("update:modelValue",
|
|
373
|
-
}, { deep: !0 }), h(
|
|
376
|
+
b("update:modelValue", r.value), B("item updated -> update dataState"), s.value.increment(t), c.value = s.value.changed(), Ie(() => G.value = !1);
|
|
377
|
+
}, { deep: !0 }), h(y, () => b("perms", y.value)), h(c, (t) => {
|
|
374
378
|
b("modified-data", t);
|
|
375
379
|
}), h(() => o.readData, (t) => {
|
|
376
|
-
|
|
380
|
+
$.value.increment(t), $.value.changed() && F();
|
|
377
381
|
}), h(() => o.editing, (t) => {
|
|
378
|
-
|
|
379
|
-
}), h(
|
|
380
|
-
|
|
381
|
-
}),
|
|
382
|
-
o.readResource && !
|
|
382
|
+
B("editing updated -> updating editMode", t), R.value = t;
|
|
383
|
+
}), h(R, (t) => {
|
|
384
|
+
B("editMode updated -> emit update", t), b("update:editing", t);
|
|
385
|
+
}), we(() => {
|
|
386
|
+
o.readResource && !U.value ? F() : (U.value, v.value = !0, R.value = !0, i.value = !1, s.value.increment(r.value).turnStoredIntoOriginal(), c.value = s.value.changed());
|
|
383
387
|
});
|
|
384
|
-
const
|
|
388
|
+
const q = (t, u) => {
|
|
385
389
|
if (u) {
|
|
386
|
-
if (
|
|
387
|
-
return
|
|
388
|
-
|
|
390
|
+
if (i.value = !1, typeof t < "u" && (D.value = t.httpStatus, !t.success))
|
|
391
|
+
return S.value = !0, b("error", t.httpStatus), !1;
|
|
392
|
+
S.value = !0;
|
|
389
393
|
}
|
|
390
394
|
return !0;
|
|
391
|
-
},
|
|
392
|
-
!
|
|
393
|
-
},
|
|
394
|
-
if (
|
|
395
|
-
o.notificationType ===
|
|
396
|
-
text:
|
|
397
|
-
details:
|
|
398
|
-
icon:
|
|
399
|
-
positionX:
|
|
395
|
+
}, z = (t) => {
|
|
396
|
+
!de.value && typeof t < "u" && t.autoReloadId && (B("doAutoReloadId -> autoReloadId detected: ", t.autoReloadId), o.readData.id = t.autoReloadId, B("doAutoReloadId -> turning off create mode"), U.value = !1, F());
|
|
397
|
+
}, P = (t, u) => {
|
|
398
|
+
if (B("onCreate"), !q(u, o.createButton.resource)) {
|
|
399
|
+
o.notificationType === X.Toast && J({
|
|
400
|
+
text: d.defaultCreateErrorText,
|
|
401
|
+
details: d.defaultCreateErrorDetails,
|
|
402
|
+
icon: d.defaultCreateErrorIcon,
|
|
403
|
+
positionX: W.Right
|
|
400
404
|
});
|
|
401
405
|
return;
|
|
402
406
|
}
|
|
403
|
-
|
|
404
|
-
text:
|
|
405
|
-
details:
|
|
406
|
-
icon:
|
|
407
|
-
positionX:
|
|
408
|
-
}),
|
|
409
|
-
},
|
|
410
|
-
if (
|
|
411
|
-
o.notificationType ===
|
|
412
|
-
text:
|
|
413
|
-
details:
|
|
414
|
-
icon:
|
|
415
|
-
positionX:
|
|
407
|
+
Y.value = !0, B("onCreate -> turn stored data into original"), s.value.increment(r.value).turnStoredIntoOriginal(), o.notificationType === X.Toast && J({
|
|
408
|
+
text: d.defaultCreateSuccessText,
|
|
409
|
+
details: d.defaultCreateSuccessDetails,
|
|
410
|
+
icon: d.defaultCreateSuccessIcon,
|
|
411
|
+
positionX: W.Right
|
|
412
|
+
}), z(u), b("create", u);
|
|
413
|
+
}, H = (t, u) => {
|
|
414
|
+
if (B("onUpdate"), !q(u, o.updateButton.resource)) {
|
|
415
|
+
o.notificationType === X.Toast && J({
|
|
416
|
+
text: d.defaultUpdateErrorText,
|
|
417
|
+
details: d.defaultUpdateErrorDetails,
|
|
418
|
+
icon: d.defaultUpdateErrorIcon,
|
|
419
|
+
positionX: W.Right
|
|
416
420
|
});
|
|
417
421
|
return;
|
|
418
422
|
}
|
|
419
|
-
|
|
420
|
-
text:
|
|
421
|
-
details:
|
|
422
|
-
icon:
|
|
423
|
-
positionX:
|
|
424
|
-
}),
|
|
425
|
-
},
|
|
426
|
-
if (
|
|
427
|
-
o.notificationType ===
|
|
428
|
-
text:
|
|
429
|
-
details:
|
|
430
|
-
icon:
|
|
431
|
-
positionX:
|
|
423
|
+
B("onUpdate -> turn stored data into original"), s.value.turnStoredIntoOriginal(), o.notificationType === X.Toast && J({
|
|
424
|
+
text: d.defaultUpdateSuccessText,
|
|
425
|
+
details: d.defaultUpdateSuccessDetails,
|
|
426
|
+
icon: d.defaultUpdateSuccessIcon,
|
|
427
|
+
positionX: W.Right
|
|
428
|
+
}), z(u), b("update", u);
|
|
429
|
+
}, oe = (t, u) => {
|
|
430
|
+
if (B("onDrop"), !q(u, o.dropButton.resource)) {
|
|
431
|
+
o.notificationType === X.Toast && J({
|
|
432
|
+
text: d.defaultDropErrorText,
|
|
433
|
+
details: d.defaultDropErrorDetails,
|
|
434
|
+
icon: d.defaultDropErrorIcon,
|
|
435
|
+
positionX: W.Right
|
|
432
436
|
});
|
|
433
437
|
return;
|
|
434
438
|
}
|
|
435
|
-
o.notificationType ===
|
|
436
|
-
text:
|
|
437
|
-
details:
|
|
438
|
-
icon:
|
|
439
|
-
positionX:
|
|
440
|
-
}), b("drop", u), o.view ===
|
|
439
|
+
o.notificationType === X.Toast && J({
|
|
440
|
+
text: d.defaultDropSuccessText,
|
|
441
|
+
details: d.defaultDropSuccessDetails,
|
|
442
|
+
icon: d.defaultDropSuccessIcon,
|
|
443
|
+
positionX: W.Right
|
|
444
|
+
}), b("drop", u), o.view === be.Modal && (B("onDrop -> close modal"), Oe(o.modalConfig.modalName, o.modalConfig.modalKey));
|
|
441
445
|
};
|
|
442
|
-
|
|
446
|
+
ee({
|
|
443
447
|
doDrop: () => {
|
|
444
448
|
L.value && L.value.doDrop();
|
|
445
449
|
},
|
|
446
|
-
doRefresh:
|
|
450
|
+
doRefresh: F,
|
|
447
451
|
doSave: () => {
|
|
448
452
|
L.value && L.value.doSave();
|
|
449
453
|
},
|
|
450
|
-
hasModifiedData: () =>
|
|
454
|
+
hasModifiedData: () => s.value.changed()
|
|
451
455
|
});
|
|
452
|
-
const
|
|
456
|
+
const T = k(() => {
|
|
453
457
|
var t;
|
|
454
|
-
return
|
|
455
|
-
}),
|
|
458
|
+
return s.value.changed() ? (t = o.modalConfig) == null ? void 0 : t.closeConfirm : "";
|
|
459
|
+
}), _ = (t) => {
|
|
456
460
|
var u;
|
|
457
461
|
if (typeof ((u = o.modalConfig) == null ? void 0 : u.beforeClose) == "function")
|
|
458
462
|
return o.modalConfig.beforeClose({
|
|
459
463
|
...t,
|
|
460
|
-
itemCreated:
|
|
464
|
+
itemCreated: Y.value
|
|
461
465
|
});
|
|
462
|
-
},
|
|
466
|
+
}, ne = k(() => o.title.startsWith("__:") ? String(je(o.title.substring(3))) : o.title), he = k(() => i.value ? !1 : ne.value.length > 0 || !!a["post-title"]), de = k(() => o.view === be.Modal), pe = k(() => de.value ? "lkt-modal" : "section"), Ce = k(() => pe.value === "lkt-modal" ? {
|
|
463
467
|
title: o.title,
|
|
464
|
-
item:
|
|
468
|
+
item: r.value,
|
|
465
469
|
...o.modalConfig,
|
|
466
|
-
beforeClose:
|
|
467
|
-
closeConfirm:
|
|
470
|
+
beforeClose: _,
|
|
471
|
+
closeConfirm: T.value
|
|
468
472
|
} : {});
|
|
469
473
|
return (t, u) => {
|
|
470
|
-
const ve = se("lkt-http-info"),
|
|
471
|
-
return
|
|
472
|
-
default:
|
|
473
|
-
|
|
474
|
-
!
|
|
475
|
-
|
|
474
|
+
const ve = se("lkt-http-info"), De = se("lkt-loader");
|
|
475
|
+
return m(), A(Me(pe.value), Re(Te(Ce.value)), {
|
|
476
|
+
default: M(() => [
|
|
477
|
+
Ee("article", Ge, [
|
|
478
|
+
!de.value && he.value ? (m(), E("header", qe, [
|
|
479
|
+
n(a)["pre-title"] ? (m(), E("div", ze, [
|
|
476
480
|
g(t.$slots, "pre-title", {
|
|
477
|
-
item:
|
|
478
|
-
loading:
|
|
481
|
+
item: r.value,
|
|
482
|
+
loading: i.value
|
|
479
483
|
})
|
|
480
|
-
])) :
|
|
481
|
-
|
|
482
|
-
|
|
484
|
+
])) : l("", !0),
|
|
485
|
+
ne.value.length > 0 ? (m(), E("h1", He, $e(ne.value), 1)) : l("", !0),
|
|
486
|
+
n(a)["post-title"] ? (m(), E("div", Ke, [
|
|
483
487
|
g(t.$slots, "post-title", {
|
|
484
|
-
item:
|
|
485
|
-
loading:
|
|
488
|
+
item: r.value,
|
|
489
|
+
loading: i.value
|
|
486
490
|
})
|
|
487
|
-
])) :
|
|
488
|
-
])) :
|
|
489
|
-
t.buttonNavPosition ===
|
|
491
|
+
])) : l("", !0)
|
|
492
|
+
])) : l("", !0),
|
|
493
|
+
t.buttonNavPosition === n(ge).Top ? (m(), A(ye, {
|
|
490
494
|
key: 1,
|
|
491
495
|
ref_key: "buttonNav",
|
|
492
496
|
ref: L,
|
|
493
|
-
loading:
|
|
494
|
-
"onUpdate:loading": u[0] || (u[0] = (
|
|
495
|
-
editing:
|
|
496
|
-
"onUpdate:editing": u[1] || (u[1] = (
|
|
497
|
-
item:
|
|
497
|
+
loading: i.value,
|
|
498
|
+
"onUpdate:loading": u[0] || (u[0] = (I) => i.value = I),
|
|
499
|
+
editing: R.value,
|
|
500
|
+
"onUpdate:editing": u[1] || (u[1] = (I) => R.value = I),
|
|
501
|
+
item: r.value,
|
|
498
502
|
mode: t.mode,
|
|
499
503
|
view: t.view,
|
|
500
504
|
"button-nav-visibility": t.buttonNavVisibility,
|
|
@@ -503,73 +507,74 @@ const y = (...C) => {
|
|
|
503
507
|
"drop-button": t.dropButton,
|
|
504
508
|
"edit-mode-button": t.editModeButton,
|
|
505
509
|
"group-button": t.groupButton,
|
|
506
|
-
"data-changed":
|
|
507
|
-
"http-success-read":
|
|
508
|
-
"can-update":
|
|
509
|
-
"can-drop":
|
|
510
|
-
"can-switch-edit-mode":
|
|
511
|
-
perms:
|
|
512
|
-
onCreate:
|
|
513
|
-
onSave:
|
|
514
|
-
onDrop:
|
|
510
|
+
"data-changed": c.value,
|
|
511
|
+
"http-success-read": v.value,
|
|
512
|
+
"can-update": te.value,
|
|
513
|
+
"can-drop": ae.value,
|
|
514
|
+
"can-switch-edit-mode": Z.value,
|
|
515
|
+
perms: y.value,
|
|
516
|
+
onCreate: P,
|
|
517
|
+
onSave: H,
|
|
518
|
+
onDrop: oe
|
|
515
519
|
}, ce({ _: 2 }, [
|
|
516
|
-
|
|
520
|
+
n(a)["prev-buttons-ever"] ? {
|
|
517
521
|
name: "prev-buttons-ever",
|
|
518
|
-
fn:
|
|
522
|
+
fn: M(({ canUpdate: I, canDrop: re, perms: le }) => [
|
|
519
523
|
g(t.$slots, "prev-buttons-ever", {
|
|
520
|
-
canUpdate:
|
|
521
|
-
canDrop:
|
|
522
|
-
perms:
|
|
524
|
+
canUpdate: I,
|
|
525
|
+
canDrop: re,
|
|
526
|
+
perms: le
|
|
523
527
|
})
|
|
524
528
|
]),
|
|
525
529
|
key: "0"
|
|
526
530
|
} : void 0,
|
|
527
|
-
|
|
531
|
+
n(a)["prev-buttons"] ? {
|
|
528
532
|
name: "prev-buttons",
|
|
529
|
-
fn:
|
|
533
|
+
fn: M(({ canUpdate: I, canDrop: re, perms: le }) => [
|
|
530
534
|
g(t.$slots, "prev-buttons", {
|
|
531
|
-
canUpdate:
|
|
532
|
-
canDrop:
|
|
533
|
-
perms:
|
|
535
|
+
canUpdate: I,
|
|
536
|
+
canDrop: re,
|
|
537
|
+
perms: le
|
|
534
538
|
})
|
|
535
539
|
]),
|
|
536
540
|
key: "1"
|
|
537
541
|
} : void 0
|
|
538
|
-
]), 1032, ["loading", "editing", "item", "mode", "view", "button-nav-visibility", "create-button", "update-button", "drop-button", "edit-mode-button", "group-button", "data-changed", "http-success-read", "can-update", "can-drop", "can-switch-edit-mode", "perms"])) :
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
+
]), 1032, ["loading", "editing", "item", "mode", "view", "button-nav-visibility", "create-button", "update-button", "drop-button", "edit-mode-button", "group-button", "data-changed", "http-success-read", "can-update", "can-drop", "can-switch-edit-mode", "perms"])) : l("", !0),
|
|
543
|
+
i.value ? l("", !0) : (m(), E("div", We, [
|
|
544
|
+
v.value ? (m(), E("div", Je, [
|
|
545
|
+
S.value && t.notificationType === n(X).Inline ? (m(), A(ve, {
|
|
542
546
|
key: 0,
|
|
543
|
-
code:
|
|
544
|
-
palette:
|
|
547
|
+
code: D.value,
|
|
548
|
+
palette: D.value === 200 ? "success" : "danger",
|
|
545
549
|
quick: "",
|
|
546
550
|
"can-close": "",
|
|
547
|
-
onClose: u[2] || (u[2] = (
|
|
548
|
-
}, null, 8, ["code", "palette"])) :
|
|
551
|
+
onClose: u[2] || (u[2] = (I) => S.value = !1)
|
|
552
|
+
}, null, 8, ["code", "palette"])) : l("", !0),
|
|
549
553
|
g(t.$slots, "item", {
|
|
550
|
-
item:
|
|
551
|
-
loading:
|
|
552
|
-
editMode:
|
|
553
|
-
isCreate:
|
|
554
|
-
canUpdate:
|
|
555
|
-
canDrop:
|
|
556
|
-
itemBeingEdited: G.value
|
|
554
|
+
item: r.value,
|
|
555
|
+
loading: i.value,
|
|
556
|
+
editMode: R.value,
|
|
557
|
+
isCreate: U.value,
|
|
558
|
+
canUpdate: te.value,
|
|
559
|
+
canDrop: ae.value,
|
|
560
|
+
itemBeingEdited: G.value,
|
|
561
|
+
perms: y.value
|
|
557
562
|
})
|
|
558
|
-
])) : t.notificationType ===
|
|
563
|
+
])) : t.notificationType === n(X).Inline ? (m(), A(ve, {
|
|
559
564
|
key: 1,
|
|
560
|
-
code:
|
|
561
|
-
}, null, 8, ["code"])) :
|
|
565
|
+
code: D.value
|
|
566
|
+
}, null, 8, ["code"])) : l("", !0)
|
|
562
567
|
])),
|
|
563
|
-
|
|
564
|
-
t.buttonNavPosition ===
|
|
568
|
+
i.value ? (m(), A(De, { key: 3 })) : l("", !0),
|
|
569
|
+
t.buttonNavPosition === n(ge).Bottom ? (m(), A(ye, {
|
|
565
570
|
key: 4,
|
|
566
571
|
ref_key: "buttonNav",
|
|
567
572
|
ref: L,
|
|
568
|
-
loading:
|
|
569
|
-
"onUpdate:loading": u[3] || (u[3] = (
|
|
570
|
-
editing:
|
|
571
|
-
"onUpdate:editing": u[4] || (u[4] = (
|
|
572
|
-
item:
|
|
573
|
+
loading: i.value,
|
|
574
|
+
"onUpdate:loading": u[3] || (u[3] = (I) => i.value = I),
|
|
575
|
+
editing: R.value,
|
|
576
|
+
"onUpdate:editing": u[4] || (u[4] = (I) => R.value = I),
|
|
577
|
+
item: r.value,
|
|
573
578
|
mode: t.mode,
|
|
574
579
|
view: t.view,
|
|
575
580
|
"button-nav-visibility": t.buttonNavVisibility,
|
|
@@ -578,48 +583,49 @@ const y = (...C) => {
|
|
|
578
583
|
"drop-button": t.dropButton,
|
|
579
584
|
"edit-mode-button": t.editModeButton,
|
|
580
585
|
"group-button": t.groupButton,
|
|
581
|
-
"data-changed":
|
|
582
|
-
"http-success-read":
|
|
583
|
-
"can-update":
|
|
584
|
-
"can-drop":
|
|
585
|
-
"can-switch-edit-mode":
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
586
|
+
"data-changed": c.value,
|
|
587
|
+
"http-success-read": v.value,
|
|
588
|
+
"can-update": te.value,
|
|
589
|
+
"can-drop": ae.value,
|
|
590
|
+
"can-switch-edit-mode": Z.value,
|
|
591
|
+
perms: y.value,
|
|
592
|
+
onCreate: P,
|
|
593
|
+
onSave: H,
|
|
594
|
+
onDrop: oe
|
|
589
595
|
}, ce({ _: 2 }, [
|
|
590
|
-
|
|
596
|
+
n(a)["prev-buttons-ever"] ? {
|
|
591
597
|
name: "prev-buttons-ever",
|
|
592
|
-
fn:
|
|
598
|
+
fn: M(() => [
|
|
593
599
|
g(t.$slots, "prev-buttons-ever")
|
|
594
600
|
]),
|
|
595
601
|
key: "0"
|
|
596
602
|
} : void 0,
|
|
597
|
-
|
|
603
|
+
n(a)["prev-buttons"] ? {
|
|
598
604
|
name: "prev-buttons-ever",
|
|
599
|
-
fn:
|
|
605
|
+
fn: M(() => [
|
|
600
606
|
g(t.$slots, "prev-buttons")
|
|
601
607
|
]),
|
|
602
608
|
key: "1"
|
|
603
609
|
} : void 0
|
|
604
|
-
]), 1032, ["loading", "editing", "item", "mode", "view", "button-nav-visibility", "create-button", "update-button", "drop-button", "edit-mode-button", "group-button", "data-changed", "http-success-read", "can-update", "can-drop", "can-switch-edit-mode"])) :
|
|
610
|
+
]), 1032, ["loading", "editing", "item", "mode", "view", "button-nav-visibility", "create-button", "update-button", "drop-button", "edit-mode-button", "group-button", "data-changed", "http-success-read", "can-update", "can-drop", "can-switch-edit-mode", "perms"])) : l("", !0)
|
|
605
611
|
])
|
|
606
612
|
]),
|
|
607
613
|
_: 3
|
|
608
614
|
}, 16);
|
|
609
615
|
};
|
|
610
616
|
}
|
|
611
|
-
}),
|
|
612
|
-
install: (C,
|
|
613
|
-
C.component("lkt-item-crud") === void 0 && C.component("lkt-item-crud",
|
|
617
|
+
}), ut = {
|
|
618
|
+
install: (C, ee = {}) => {
|
|
619
|
+
C.component("lkt-item-crud") === void 0 && C.component("lkt-item-crud", Qe);
|
|
614
620
|
}
|
|
615
|
-
}, ut = (C) => {
|
|
616
|
-
W.defaultSaveIcon = C;
|
|
617
621
|
}, nt = (C) => {
|
|
618
|
-
|
|
622
|
+
Q.defaultSaveIcon = C;
|
|
623
|
+
}, dt = (C) => {
|
|
624
|
+
Q.defaultDropIcon = C;
|
|
619
625
|
};
|
|
620
626
|
export {
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
627
|
+
ot as debugLktItemCrud,
|
|
628
|
+
ut as default,
|
|
629
|
+
dt as setItemCrudDefaultDropIcon,
|
|
630
|
+
nt as setItemCrudDefaultSaveIcon
|
|
625
631
|
};
|
|
@@ -29,6 +29,7 @@ declare var __VLS_6: {
|
|
|
29
29
|
canUpdate: boolean;
|
|
30
30
|
canDrop: boolean;
|
|
31
31
|
itemBeingEdited: boolean;
|
|
32
|
+
perms: string[];
|
|
32
33
|
}, __VLS_54: {}, __VLS_56: {};
|
|
33
34
|
type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
|
|
34
35
|
'pre-title'?: (props: typeof __VLS_6) => any;
|
package/package.json
CHANGED
|
@@ -154,18 +154,15 @@
|
|
|
154
154
|
showSaveButton = computed(() => {
|
|
155
155
|
if (props.mode === ItemCrudMode.Create && props.createButton === false) return false;
|
|
156
156
|
if (props.mode === ItemCrudMode.Update && props.updateButton === false) return false;
|
|
157
|
-
if (props.dataChanged) {
|
|
158
|
-
return ableToUpdate.value || ableToCreate.value;
|
|
159
|
-
}
|
|
160
157
|
if (isLoading.value) return false;
|
|
161
158
|
|
|
162
|
-
if (props.
|
|
163
|
-
|
|
164
|
-
}
|
|
159
|
+
// if (props.dataChanged) {
|
|
160
|
+
// return ableToUpdate.value || ableToCreate.value;
|
|
161
|
+
// }
|
|
165
162
|
|
|
166
|
-
if (props.buttonNavVisibility === ItemCrudButtonNavVisibility.Never) {
|
|
167
|
-
|
|
168
|
-
}
|
|
163
|
+
// if (props.buttonNavVisibility === ItemCrudButtonNavVisibility.Never) {
|
|
164
|
+
// return false;
|
|
165
|
+
// }
|
|
169
166
|
|
|
170
167
|
return props.editing
|
|
171
168
|
&& props.httpSuccessRead;
|
|
@@ -181,7 +178,7 @@
|
|
|
181
178
|
&& props.httpSuccessRead;
|
|
182
179
|
}),
|
|
183
180
|
showButtons = computed(() => {
|
|
184
|
-
if (props.buttonNavVisibility === ItemCrudButtonNavVisibility.Always
|
|
181
|
+
if (props.buttonNavVisibility === ItemCrudButtonNavVisibility.Always) return true;
|
|
185
182
|
if (slots['prev-buttons-ever']) return true;
|
|
186
183
|
if (props.buttonNavVisibility === ItemCrudButtonNavVisibility.Never) return false;
|
|
187
184
|
return showSaveButton.value || showDropButton.value || showSwitchButton.value;
|
|
@@ -224,7 +221,7 @@
|
|
|
224
221
|
|
|
225
222
|
<lkt-button
|
|
226
223
|
ref="saveButtonRef"
|
|
227
|
-
v-
|
|
224
|
+
v-show="mode === ItemCrudMode.Update && showSaveButton"
|
|
228
225
|
v-bind="safeUpdateButton"
|
|
229
226
|
:disabled="!ableToUpdate"
|
|
230
227
|
@loading="onButtonLoading"
|
|
@@ -239,7 +236,7 @@
|
|
|
239
236
|
|
|
240
237
|
<lkt-button
|
|
241
238
|
ref="saveButtonRef"
|
|
242
|
-
v-
|
|
239
|
+
v-show="mode === ItemCrudMode.Create && showSaveButton"
|
|
243
240
|
v-bind="safeCreateButton"
|
|
244
241
|
:disabled="!ableToCreate"
|
|
245
242
|
@loading="onButtonLoading"
|
|
@@ -254,8 +251,7 @@
|
|
|
254
251
|
|
|
255
252
|
<lkt-button
|
|
256
253
|
ref="dropButtonRef"
|
|
257
|
-
v-show="showDropButton"
|
|
258
|
-
v-if="mode !== ItemCrudMode.Create"
|
|
254
|
+
v-show="showDropButton && mode !== ItemCrudMode.Create"
|
|
259
255
|
v-bind="safeDropButton"
|
|
260
256
|
:disabled="!ableToDrop"
|
|
261
257
|
@loading="onButtonLoading"
|
|
@@ -295,7 +291,7 @@
|
|
|
295
291
|
|
|
296
292
|
<lkt-button
|
|
297
293
|
ref="saveButtonRef"
|
|
298
|
-
v-
|
|
294
|
+
v-show="mode === ItemCrudMode.Update && showSaveButton"
|
|
299
295
|
v-bind="safeUpdateButton"
|
|
300
296
|
:disabled="!ableToUpdate"
|
|
301
297
|
@loading="onButtonLoading"
|
|
@@ -310,7 +306,7 @@
|
|
|
310
306
|
|
|
311
307
|
<lkt-button
|
|
312
308
|
ref="saveButtonRef"
|
|
313
|
-
v-
|
|
309
|
+
v-show="mode === ItemCrudMode.Create && showSaveButton"
|
|
314
310
|
v-bind="safeCreateButton"
|
|
315
311
|
:disabled="!ableToCreate"
|
|
316
312
|
@loading="onButtonLoading"
|
|
@@ -325,8 +321,7 @@
|
|
|
325
321
|
|
|
326
322
|
<lkt-button
|
|
327
323
|
ref="dropButtonRef"
|
|
328
|
-
v-show="showDropButton"
|
|
329
|
-
v-if="mode !== ItemCrudMode.Create"
|
|
324
|
+
v-show="showDropButton && mode !== ItemCrudMode.Create"
|
|
330
325
|
v-bind="safeDropButton"
|
|
331
326
|
:disabled="!ableToDrop"
|
|
332
327
|
@loading="onButtonLoading"
|
|
@@ -171,8 +171,8 @@
|
|
|
171
171
|
}
|
|
172
172
|
return true;
|
|
173
173
|
},
|
|
174
|
-
doAutoReloadId = (r
|
|
175
|
-
if (!computedInsideModal.value && r.autoReloadId) {
|
|
174
|
+
doAutoReloadId = (r?: HTTPResponse) => {
|
|
175
|
+
if (!computedInsideModal.value && typeof r !== 'undefined' && r.autoReloadId) {
|
|
176
176
|
debug('doAutoReloadId -> autoReloadId detected: ', r.autoReloadId);
|
|
177
177
|
props.readData['id'] = r.autoReloadId;
|
|
178
178
|
debug('doAutoReloadId -> turning off create mode');
|
|
@@ -393,11 +393,16 @@
|
|
|
393
393
|
quick
|
|
394
394
|
can-close
|
|
395
395
|
v-on:close="showStoreMessage = false" />
|
|
396
|
-
<slot name="item"
|
|
396
|
+
<slot name="item"
|
|
397
|
+
:item="item"
|
|
398
|
+
:loading="isLoading"
|
|
399
|
+
:edit-mode="editMode"
|
|
397
400
|
:is-create="createMode"
|
|
398
401
|
:can-update="canUpdate"
|
|
399
402
|
:can-drop="canDrop"
|
|
400
|
-
:item-being-edited="itemBeingEdited"
|
|
403
|
+
:item-being-edited="itemBeingEdited"
|
|
404
|
+
:perms="perms"
|
|
405
|
+
/>
|
|
401
406
|
</div>
|
|
402
407
|
<lkt-http-info :code="httpStatus" v-else-if="notificationType === NotificationType.Inline" />
|
|
403
408
|
</div>
|
|
@@ -422,6 +427,7 @@
|
|
|
422
427
|
:can-update="canUpdate"
|
|
423
428
|
:can-drop="canDrop"
|
|
424
429
|
:can-switch-edit-mode="canSwitchEditMode"
|
|
430
|
+
:perms="perms"
|
|
425
431
|
@create="onCreate"
|
|
426
432
|
@save="onUpdate"
|
|
427
433
|
@drop="onDrop"
|