lkt-item-crud 1.1.26 → 1.1.27
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 +3 -3
- package/dist/build.js +90 -86
- package/package.json +4 -2
- package/src/lib-components/LktItemCrud.vue +16 -9
package/dist/build.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
declare function
|
|
2
|
-
declare namespace
|
|
1
|
+
declare function Je(l?: boolean): void;
|
|
2
|
+
declare namespace Ke {
|
|
3
3
|
function install(l: any, h?: {}): void;
|
|
4
4
|
}
|
|
5
|
-
export {
|
|
5
|
+
export { Je as debugLktItemCrud, Ke as default };
|
package/dist/build.js
CHANGED
|
@@ -1,47 +1,51 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { httpCall as
|
|
1
|
+
import { defineComponent as ve, useSlots as ce, ref as s, computed as n, watch as b, nextTick as fe, resolveComponent as L, openBlock as v, createElementBlock as M, unref as C, renderSlot as U, createCommentVNode as p, toDisplayString as pe, withDirectives as O, createElementVNode as me, createBlock as T, withCtx as Y, vShow as $, createVNode as Z } from "vue";
|
|
2
|
+
import { httpCall as he } from "lkt-http-client";
|
|
3
3
|
import { DataState as ee } from "lkt-data-state";
|
|
4
|
-
import { execModal as
|
|
4
|
+
import { execModal as ke, refreshModal as be, closeModal as Ce, openModal as De, reOpenModal as Se } from "lkt-modal";
|
|
5
|
+
import { __ as ye } from "lkt-i18n";
|
|
5
6
|
const q = class q {
|
|
6
7
|
};
|
|
7
8
|
q.debugEnabled = !1;
|
|
8
9
|
let F = q;
|
|
9
10
|
const u = (...l) => {
|
|
10
11
|
F.debugEnabled && console.info("[LktItemCrud] ", ...l);
|
|
11
|
-
},
|
|
12
|
+
}, Je = (l = !0) => {
|
|
12
13
|
F.debugEnabled = l;
|
|
13
14
|
}, j = (l) => {
|
|
14
15
|
u("runModalCallback -> init", l);
|
|
15
|
-
let h = l.modalKey ? l.modalKey : "_",
|
|
16
|
+
let h = l.modalKey ? l.modalKey : "_", _ = l.args ? l.args : {};
|
|
16
17
|
switch (l.action) {
|
|
17
18
|
case "reOpen":
|
|
18
|
-
return
|
|
19
|
+
return Se(l.modalName, h, _);
|
|
19
20
|
case "open":
|
|
20
|
-
return
|
|
21
|
+
return De(l.modalName, h, _);
|
|
21
22
|
case "close":
|
|
22
|
-
return
|
|
23
|
+
return Ce(l.modalName, h);
|
|
23
24
|
case "refresh":
|
|
24
|
-
return
|
|
25
|
+
return be(l.modalName, h, _);
|
|
25
26
|
case "exec":
|
|
26
27
|
let e = l.method;
|
|
27
|
-
return e ?
|
|
28
|
+
return e ? ke(l.modalName, h, e, _) : void 0;
|
|
28
29
|
}
|
|
29
|
-
},
|
|
30
|
+
}, ge = { class: "lkt-item-crud" }, Me = {
|
|
30
31
|
key: 0,
|
|
31
32
|
class: "lkt-item-crud_header"
|
|
32
|
-
},
|
|
33
|
+
}, _e = {
|
|
33
34
|
key: 0,
|
|
34
35
|
class: "lkt-item-crud_header-slot"
|
|
35
|
-
},
|
|
36
|
+
}, Be = {
|
|
36
37
|
key: 1,
|
|
38
|
+
class: "lkt-item-crud_header-title"
|
|
39
|
+
}, we = {
|
|
40
|
+
key: 2,
|
|
37
41
|
class: "lkt-item-crud_header-slot"
|
|
38
|
-
},
|
|
42
|
+
}, Ie = { class: "lkt-item-crud-buttons" }, Ee = {
|
|
39
43
|
key: 1,
|
|
40
44
|
class: "lkt-item-crud_content"
|
|
41
|
-
},
|
|
45
|
+
}, Ue = {
|
|
42
46
|
key: 0,
|
|
43
47
|
class: "lkt-grid-1"
|
|
44
|
-
},
|
|
48
|
+
}, Re = /* @__PURE__ */ ve({
|
|
45
49
|
__name: "LktItemCrud",
|
|
46
50
|
props: {
|
|
47
51
|
modelValue: { default: () => ({}) },
|
|
@@ -85,23 +89,23 @@ const u = (...l) => {
|
|
|
85
89
|
editing: { type: Boolean, default: !1 }
|
|
86
90
|
},
|
|
87
91
|
emits: ["update:modelValue", "update:isCreate", "update:editing", "read", "create", "update", "drop", "before-save", "perms", "error", "modified-data"],
|
|
88
|
-
setup(l, { expose: h, emit:
|
|
89
|
-
const e = l,
|
|
92
|
+
setup(l, { expose: h, emit: _ }) {
|
|
93
|
+
const e = l, m = ce(), i = _;
|
|
90
94
|
let ae = [];
|
|
91
|
-
const d =
|
|
92
|
-
u("fetchItem"), d.value = !0,
|
|
95
|
+
const d = s(!0), r = s(e.modelValue), I = s(ae), c = s(e.editing), k = s(!1), D = s(!1), f = s(200), R = s(null), V = s(null), B = s(new ee(r.value, e.dataStateConfig)), J = s(new ee(e.readData)), o = s(e.isCreate), K = s(!1), te = n(() => o.value ? e.createConfirm : e.updateConfirm), le = n(() => o.value ? e.createConfirmData : e.updateConfirmData), H = n(() => o.value ? e.createResource : e.updateResource), oe = n(() => o.value ? { ...e.createData, ...JSON.parse(JSON.stringify(r.value)) } : { ...e.updateData, ...JSON.parse(JSON.stringify(r.value)) }), ue = n(() => o.value ? e.createDisabled : e.updateDisabled), S = n(() => !o.value && I.value.includes("update")), y = n(() => !o.value && I.value.includes("drop")), N = async () => {
|
|
96
|
+
u("fetchItem"), d.value = !0, f.value = -1, D.value = !1;
|
|
93
97
|
try {
|
|
94
|
-
const a = await
|
|
95
|
-
if (u("fetchItem -> response", a), d.value = !1,
|
|
96
|
-
k.value = !1,
|
|
98
|
+
const a = await he(e.readResource, e.readData);
|
|
99
|
+
if (u("fetchItem -> response", a), d.value = !1, f.value = a.httpStatus, !a.success) {
|
|
100
|
+
k.value = !1, f.value = a.httpStatus, i("error", a.httpStatus);
|
|
97
101
|
return;
|
|
98
102
|
}
|
|
99
|
-
k.value = !0, r.value = a.data, I.value = a.perms, B.value.increment(r.value).turnStoredIntoOriginal(), J.value.turnStoredIntoOriginal(),
|
|
103
|
+
k.value = !0, r.value = a.data, I.value = a.perms, B.value.increment(r.value).turnStoredIntoOriginal(), J.value.turnStoredIntoOriginal(), i("read", a);
|
|
100
104
|
} catch {
|
|
101
|
-
d.value = !1, k.value = !1,
|
|
105
|
+
d.value = !1, k.value = !1, f.value = 404, i("error", 404);
|
|
102
106
|
return;
|
|
103
107
|
}
|
|
104
|
-
}
|
|
108
|
+
};
|
|
105
109
|
b(() => e.modelValue, (a) => {
|
|
106
110
|
r.value = a, B.value.increment(a);
|
|
107
111
|
}, { deep: !0 }), b(r, (a) => {
|
|
@@ -110,28 +114,28 @@ const u = (...l) => {
|
|
|
110
114
|
let t = e.beforeEmitUpdate(r.value);
|
|
111
115
|
u("item updated -> override with: ", t), typeof t == "object" && (r.value = t);
|
|
112
116
|
}
|
|
113
|
-
|
|
114
|
-
}, { deep: !0 }), b(I, () =>
|
|
115
|
-
const
|
|
116
|
-
b(
|
|
117
|
+
i("update:modelValue", r.value), u("item updated -> update dataState"), B.value.increment(a), fe(() => K.value = !1);
|
|
118
|
+
}, { deep: !0 }), b(I, () => i("perms", I.value));
|
|
119
|
+
const P = n(() => ue.value || !o.value && !S.value || typeof e.saveValidator == "function" && !e.saveValidator(r.value) ? !1 : B.value.changed());
|
|
120
|
+
b(P, (a) => i("modified-data", a)), b(o, (a) => i("update:isCreate", a)), b(() => e.readData, (a) => {
|
|
117
121
|
J.value.increment(a), J.value.changed() && N();
|
|
118
122
|
}), b(() => e.editing, (a) => {
|
|
119
123
|
u("editing updated -> updating editMode", a), c.value = a;
|
|
120
124
|
}), b(c, (a) => {
|
|
121
|
-
u("editMode updated -> emit update", a),
|
|
125
|
+
u("editMode updated -> emit update", a), i("update:editing", a);
|
|
122
126
|
}), e.readResource && !o.value ? N() : o.value && (k.value = !0, c.value = !0, d.value = !1);
|
|
123
|
-
const
|
|
124
|
-
if (d.value = !1,
|
|
125
|
-
D.value = !0,
|
|
127
|
+
const de = (a, t) => {
|
|
128
|
+
if (d.value = !1, f.value = t.httpStatus, !t.success) {
|
|
129
|
+
D.value = !0, i("error", t.httpStatus);
|
|
126
130
|
return;
|
|
127
131
|
}
|
|
128
132
|
D.value = !0, e.onDropModalCallbacks.length > 0 && (u("onDrop -> has onDropModalCallbacks"), e.onDropModalCallbacks.forEach((g) => {
|
|
129
133
|
j(g);
|
|
130
|
-
})),
|
|
131
|
-
},
|
|
132
|
-
if (u("onSave -> received response:", t),
|
|
133
|
-
if (d.value = !1,
|
|
134
|
-
D.value = !0,
|
|
134
|
+
})), i("drop", t);
|
|
135
|
+
}, re = (a, t) => {
|
|
136
|
+
if (u("onSave -> received response:", t), i("before-save"), H.value) {
|
|
137
|
+
if (d.value = !1, f.value = t.httpStatus, !t.success) {
|
|
138
|
+
D.value = !0, i("error", t.httpStatus);
|
|
135
139
|
return;
|
|
136
140
|
}
|
|
137
141
|
D.value = !0;
|
|
@@ -141,9 +145,9 @@ const u = (...l) => {
|
|
|
141
145
|
j(E);
|
|
142
146
|
}))) : 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
147
|
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()),
|
|
145
|
-
},
|
|
146
|
-
d.value = !0,
|
|
148
|
+
}))), !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()), i(g, t);
|
|
149
|
+
}, W = () => {
|
|
150
|
+
d.value = !0, f.value = -1;
|
|
147
151
|
}, z = () => {
|
|
148
152
|
d.value = !1;
|
|
149
153
|
};
|
|
@@ -156,78 +160,78 @@ const u = (...l) => {
|
|
|
156
160
|
R.value && typeof R.value.click == "function" && R.value.click();
|
|
157
161
|
}
|
|
158
162
|
});
|
|
159
|
-
const A =
|
|
163
|
+
const A = n(() => !S.value && y.value ? !0 : !e.hiddenDrop && !d.value && c.value && k.value), G = n(() => B.value.changed() ? !0 : d.value ? !1 : o.value ? !0 : !e.hiddenSave && c.value && k.value), Q = n(() => e.hideSwitchEdition || !S.value && !y.value || !S.value && y.value ? !1 : !d.value && !o.value && k.value && !(e.dropDisabled && e.updateDisabled)), ne = n(() => !e.hiddenButtons && (G.value || A.value || Q.value)), x = n(() => e.title.startsWith("__:") ? String(ye(e.title.substring(3))) : e.title), ie = n(() => d.value ? !1 : x.value.length > 0 || !!m["post-title"]);
|
|
160
164
|
return (a, t) => {
|
|
161
|
-
const g = L("lkt-button"), E = L("lkt-field-switch"),
|
|
162
|
-
return
|
|
163
|
-
|
|
164
|
-
C(
|
|
165
|
+
const g = L("lkt-button"), E = L("lkt-field-switch"), X = L("lkt-http-info"), se = L("lkt-loader");
|
|
166
|
+
return v(), M("article", ge, [
|
|
167
|
+
ie.value ? (v(), M("header", Me, [
|
|
168
|
+
C(m)["pre-title"] ? (v(), M("div", _e, [
|
|
165
169
|
U(a.$slots, "pre-title", {
|
|
166
170
|
item: r.value,
|
|
167
171
|
loading: d.value
|
|
168
172
|
})
|
|
169
|
-
])) :
|
|
170
|
-
|
|
171
|
-
C(
|
|
173
|
+
])) : p("", !0),
|
|
174
|
+
x.value.length > 0 ? (v(), M("h1", Be, pe(x.value), 1)) : p("", !0),
|
|
175
|
+
C(m)["post-title"] ? (v(), M("div", we, [
|
|
172
176
|
U(a.$slots, "post-title", {
|
|
173
177
|
item: r.value,
|
|
174
178
|
loading: d.value
|
|
175
179
|
})
|
|
176
|
-
])) :
|
|
177
|
-
])) :
|
|
178
|
-
O(
|
|
179
|
-
o.value ?
|
|
180
|
+
])) : p("", !0)
|
|
181
|
+
])) : p("", !0),
|
|
182
|
+
O(me("div", Ie, [
|
|
183
|
+
o.value ? p("", !0) : O((v(), T(g, {
|
|
180
184
|
key: 0,
|
|
181
|
-
ref: (
|
|
185
|
+
ref: (w) => V.value = w,
|
|
182
186
|
palette: "danger",
|
|
183
187
|
disabled: a.dropDisabled || !y.value,
|
|
184
188
|
"confirm-modal": a.dropConfirm,
|
|
185
189
|
"confirm-data": a.dropConfirmData,
|
|
186
190
|
resource: a.dropResource,
|
|
187
191
|
"resource-data": a.dropData,
|
|
188
|
-
text: C(
|
|
189
|
-
icon: C(
|
|
190
|
-
onLoading:
|
|
192
|
+
text: C(m)["button-drop"] ? "" : a.dropText,
|
|
193
|
+
icon: C(m)["button-drop"] ? "" : a.dropIcon,
|
|
194
|
+
onLoading: W,
|
|
191
195
|
onLoaded: z,
|
|
192
|
-
onClick:
|
|
196
|
+
onClick: de
|
|
193
197
|
}, {
|
|
194
198
|
default: Y(() => [
|
|
195
|
-
C(
|
|
199
|
+
C(m)["button-drop"] ? U(a.$slots, "button-drop", {
|
|
196
200
|
key: 0,
|
|
197
201
|
item: r.value,
|
|
198
202
|
editMode: c.value,
|
|
199
203
|
isCreate: o.value,
|
|
200
204
|
canUpdate: S.value,
|
|
201
205
|
canDrop: y.value
|
|
202
|
-
}) :
|
|
206
|
+
}) : p("", !0)
|
|
203
207
|
]),
|
|
204
208
|
_: 3
|
|
205
209
|
}, 8, ["disabled", "confirm-modal", "confirm-data", "resource", "resource-data", "text", "icon"])), [
|
|
206
210
|
[$, A.value]
|
|
207
211
|
]),
|
|
208
212
|
O(Z(g, {
|
|
209
|
-
ref: (
|
|
213
|
+
ref: (w) => R.value = w,
|
|
210
214
|
palette: "success",
|
|
211
|
-
disabled: !
|
|
215
|
+
disabled: !P.value,
|
|
212
216
|
"confirm-modal": te.value,
|
|
213
217
|
"confirm-data": le.value,
|
|
214
|
-
resource:
|
|
218
|
+
resource: H.value,
|
|
215
219
|
"resource-data": oe.value,
|
|
216
|
-
text: C(
|
|
217
|
-
icon: C(
|
|
218
|
-
onLoading:
|
|
220
|
+
text: C(m)["button-save"] ? "" : a.saveText,
|
|
221
|
+
icon: C(m)["button-save"] ? "" : a.saveIcon,
|
|
222
|
+
onLoading: W,
|
|
219
223
|
onLoaded: z,
|
|
220
|
-
onClick:
|
|
224
|
+
onClick: re
|
|
221
225
|
}, {
|
|
222
226
|
default: Y(() => [
|
|
223
|
-
C(
|
|
227
|
+
C(m)["button-save"] ? U(a.$slots, "button-save", {
|
|
224
228
|
key: 0,
|
|
225
229
|
item: r.value,
|
|
226
230
|
editMode: c.value,
|
|
227
231
|
isCreate: o.value,
|
|
228
232
|
canUpdate: S.value,
|
|
229
233
|
canDrop: y.value
|
|
230
|
-
}) :
|
|
234
|
+
}) : p("", !0)
|
|
231
235
|
]),
|
|
232
236
|
_: 3
|
|
233
237
|
}, 8, ["disabled", "confirm-modal", "confirm-data", "resource", "resource-data", "text", "icon"]), [
|
|
@@ -235,24 +239,24 @@ const u = (...l) => {
|
|
|
235
239
|
]),
|
|
236
240
|
O(Z(E, {
|
|
237
241
|
modelValue: c.value,
|
|
238
|
-
"onUpdate:modelValue": t[0] || (t[0] = (
|
|
242
|
+
"onUpdate:modelValue": t[0] || (t[0] = (w) => c.value = w),
|
|
239
243
|
label: a.editModeText
|
|
240
244
|
}, null, 8, ["modelValue", "label"]), [
|
|
241
245
|
[$, Q.value]
|
|
242
246
|
])
|
|
243
247
|
], 512), [
|
|
244
|
-
[$,
|
|
248
|
+
[$, ne.value]
|
|
245
249
|
]),
|
|
246
|
-
d.value ?
|
|
247
|
-
k.value ? (
|
|
248
|
-
D.value ? (
|
|
250
|
+
d.value ? p("", !0) : (v(), M("div", Ee, [
|
|
251
|
+
k.value ? (v(), M("div", Ue, [
|
|
252
|
+
D.value ? (v(), T(X, {
|
|
249
253
|
key: 0,
|
|
250
|
-
code:
|
|
254
|
+
code: f.value,
|
|
251
255
|
quick: "",
|
|
252
|
-
palette:
|
|
256
|
+
palette: f.value === 200 ? "success" : "danger",
|
|
253
257
|
"can-close": "",
|
|
254
|
-
onClose: t[1] || (t[1] = (
|
|
255
|
-
}, null, 8, ["code", "palette"])) :
|
|
258
|
+
onClose: t[1] || (t[1] = (w) => D.value = !1)
|
|
259
|
+
}, null, 8, ["code", "palette"])) : p("", !0),
|
|
256
260
|
U(a.$slots, "item", {
|
|
257
261
|
item: r.value,
|
|
258
262
|
loading: d.value,
|
|
@@ -262,21 +266,21 @@ const u = (...l) => {
|
|
|
262
266
|
canDrop: y.value,
|
|
263
267
|
itemBeingEdited: K.value
|
|
264
268
|
})
|
|
265
|
-
])) : (
|
|
269
|
+
])) : (v(), T(X, {
|
|
266
270
|
key: 1,
|
|
267
|
-
code:
|
|
271
|
+
code: f.value
|
|
268
272
|
}, null, 8, ["code"]))
|
|
269
273
|
])),
|
|
270
|
-
d.value ? (
|
|
274
|
+
d.value ? (v(), T(se, { key: 2 })) : p("", !0)
|
|
271
275
|
]);
|
|
272
276
|
};
|
|
273
277
|
}
|
|
274
|
-
}),
|
|
278
|
+
}), Ke = {
|
|
275
279
|
install: (l, h = {}) => {
|
|
276
|
-
l.component("lkt-item-crud") === void 0 && l.component("lkt-item-crud",
|
|
280
|
+
l.component("lkt-item-crud") === void 0 && l.component("lkt-item-crud", Re);
|
|
277
281
|
}
|
|
278
282
|
};
|
|
279
283
|
export {
|
|
280
|
-
|
|
281
|
-
|
|
284
|
+
Je as debugLktItemCrud,
|
|
285
|
+
Ke as default
|
|
282
286
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lkt-item-crud",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.27",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./dist/build.js",
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"sideEffects": false,
|
|
20
20
|
"scripts": {
|
|
21
|
-
"build": "
|
|
21
|
+
"build": "vue-tsc --declaration --emitDeclarationOnly; vite build; tsc --project tsconfig.build.json; cp build/* dist/",
|
|
22
|
+
"rebuild": "rm -rf dist/*; vue-tsc --declaration --emitDeclarationOnly; vite build; tsc --project tsconfig.build.json; cp build/* dist/"
|
|
22
23
|
},
|
|
23
24
|
"author": "Antonio Ibáñez",
|
|
24
25
|
"devDependencies": {
|
|
@@ -42,6 +43,7 @@
|
|
|
42
43
|
"lkt-field-switch": "^1.0.0",
|
|
43
44
|
"lkt-http-client": "^1.0.12",
|
|
44
45
|
"lkt-http-info": "^1.0.2",
|
|
46
|
+
"lkt-i18n": "^1.0.4",
|
|
45
47
|
"lkt-loader": "^1.0.2",
|
|
46
48
|
"lkt-modal": "^1.1.1",
|
|
47
49
|
"lkt-string-tools": "^1.0.2",
|
|
@@ -6,6 +6,7 @@ import {debug} from "../functions/debug";
|
|
|
6
6
|
import {LktObject} from "lkt-ts-interfaces";
|
|
7
7
|
import {ModalCallbackConfig} from "../types/ModalCallbackConfig";
|
|
8
8
|
import {runModalCallback} from "../functions/modalCallbacks";
|
|
9
|
+
import {__} from "lkt-i18n";
|
|
9
10
|
|
|
10
11
|
const props = withDefaults(defineProps<{
|
|
11
12
|
modelValue: LktObject
|
|
@@ -37,9 +38,9 @@ const props = withDefaults(defineProps<{
|
|
|
37
38
|
updateDisabled: boolean
|
|
38
39
|
dropDisabled: boolean
|
|
39
40
|
saveValidator: Function
|
|
40
|
-
beforeEmitUpdate: Function|undefined
|
|
41
|
-
onCreate: Function|undefined
|
|
42
|
-
onUpdate: Function|undefined
|
|
41
|
+
beforeEmitUpdate: Function | undefined
|
|
42
|
+
onCreate: Function | undefined
|
|
43
|
+
onUpdate: Function | undefined
|
|
43
44
|
insideModal: boolean
|
|
44
45
|
hideSwitchEdition: boolean
|
|
45
46
|
dataStateConfig: LktObject
|
|
@@ -167,11 +168,6 @@ const fetchItem = async () => {
|
|
|
167
168
|
}
|
|
168
169
|
}
|
|
169
170
|
|
|
170
|
-
const displayHeader = computed(() => {
|
|
171
|
-
if (isLoading.value) return false;
|
|
172
|
-
|
|
173
|
-
return props.title || !!slots['post-title'];
|
|
174
|
-
})
|
|
175
171
|
|
|
176
172
|
watch(() => props.modelValue, v => {
|
|
177
173
|
item.value = v;
|
|
@@ -350,6 +346,17 @@ const showDropButton = computed(() => {
|
|
|
350
346
|
}),
|
|
351
347
|
showButtons = computed(() => {
|
|
352
348
|
return !props.hiddenButtons && (showSaveButton.value || showDropButton.value || showSwitchButton.value);
|
|
349
|
+
}),
|
|
350
|
+
computedTitle = computed(() => {
|
|
351
|
+
if (props.title.startsWith('__:')) {
|
|
352
|
+
return String(__(props.title.substring(3)));
|
|
353
|
+
}
|
|
354
|
+
return props.title;
|
|
355
|
+
}),
|
|
356
|
+
displayHeader = computed(() => {
|
|
357
|
+
if (isLoading.value) return false;
|
|
358
|
+
|
|
359
|
+
return computedTitle.value.length > 0 || !!slots['post-title'];
|
|
353
360
|
});
|
|
354
361
|
</script>
|
|
355
362
|
|
|
@@ -359,7 +366,7 @@ const showDropButton = computed(() => {
|
|
|
359
366
|
<div class="lkt-item-crud_header-slot" v-if="slots['pre-title']">
|
|
360
367
|
<slot name="pre-title" v-bind:item="item" v-bind:loading="isLoading"></slot>
|
|
361
368
|
</div>
|
|
362
|
-
<h1 class="lkt-item-crud_header-title">{{
|
|
369
|
+
<h1 class="lkt-item-crud_header-title" v-if="computedTitle.length > 0">{{ computedTitle }}</h1>
|
|
363
370
|
<div class="lkt-item-crud_header-slot" v-if="slots['post-title']">
|
|
364
371
|
<slot name="post-title" v-bind:item="item" v-bind:loading="isLoading"></slot>
|
|
365
372
|
</div>
|