lkt-item-crud 2.0.10 → 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 +6 -6
- package/dist/build.js +462 -358
- package/dist/components/ButtonNav.vue.d.ts +458 -12
- package/dist/lib-components/LktItemCrud.vue.d.ts +3 -0
- package/package.json +1 -1
- package/src/components/ButtonNav.vue +166 -82
- package/src/lib-components/LktItemCrud.vue +13 -5
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
updateButton?: ButtonConfig|false
|
|
32
32
|
dropButton?: ButtonConfig|false
|
|
33
33
|
editModeButton?: ButtonConfig|false
|
|
34
|
+
groupButton?: ButtonConfig|boolean
|
|
34
35
|
|
|
35
36
|
dataChanged: boolean
|
|
36
37
|
|
|
@@ -51,7 +52,8 @@
|
|
|
51
52
|
const safeCreateButton = ref(ensureButtonConfig(props.createButton, LktSettings.defaultCreateButton)),
|
|
52
53
|
safeUpdateButton = ref(ensureButtonConfig(props.updateButton, LktSettings.defaultUpdateButton)),
|
|
53
54
|
safeDropButton = ref(ensureButtonConfig(props.dropButton, LktSettings.defaultDropButton)),
|
|
54
|
-
safeEditModeButton = ref(ensureButtonConfig(props.editModeButton, LktSettings.defaultEditModeButton))
|
|
55
|
+
safeEditModeButton = ref(ensureButtonConfig(props.editModeButton, LktSettings.defaultEditModeButton)),
|
|
56
|
+
safeGroupButton = ref(ensureButtonConfig(props.groupButton, LktSettings.defaultGroupButton));
|
|
55
57
|
|
|
56
58
|
watch(() => props.createButton, v => {
|
|
57
59
|
safeCreateButton.value = ensureButtonConfig(v, LktSettings.defaultCreateButton);
|
|
@@ -152,18 +154,15 @@
|
|
|
152
154
|
showSaveButton = computed(() => {
|
|
153
155
|
if (props.mode === ItemCrudMode.Create && props.createButton === false) return false;
|
|
154
156
|
if (props.mode === ItemCrudMode.Update && props.updateButton === false) return false;
|
|
155
|
-
if (props.dataChanged) {
|
|
156
|
-
return ableToUpdate.value || ableToCreate.value;
|
|
157
|
-
}
|
|
158
157
|
if (isLoading.value) return false;
|
|
159
158
|
|
|
160
|
-
if (props.
|
|
161
|
-
|
|
162
|
-
}
|
|
159
|
+
// if (props.dataChanged) {
|
|
160
|
+
// return ableToUpdate.value || ableToCreate.value;
|
|
161
|
+
// }
|
|
163
162
|
|
|
164
|
-
if (props.buttonNavVisibility === ItemCrudButtonNavVisibility.Never) {
|
|
165
|
-
|
|
166
|
-
}
|
|
163
|
+
// if (props.buttonNavVisibility === ItemCrudButtonNavVisibility.Never) {
|
|
164
|
+
// return false;
|
|
165
|
+
// }
|
|
167
166
|
|
|
168
167
|
return props.editing
|
|
169
168
|
&& props.httpSuccessRead;
|
|
@@ -179,7 +178,7 @@
|
|
|
179
178
|
&& props.httpSuccessRead;
|
|
180
179
|
}),
|
|
181
180
|
showButtons = computed(() => {
|
|
182
|
-
if (props.buttonNavVisibility === ItemCrudButtonNavVisibility.Always
|
|
181
|
+
if (props.buttonNavVisibility === ItemCrudButtonNavVisibility.Always) return true;
|
|
183
182
|
if (slots['prev-buttons-ever']) return true;
|
|
184
183
|
if (props.buttonNavVisibility === ItemCrudButtonNavVisibility.Never) return false;
|
|
185
184
|
return showSaveButton.value || showDropButton.value || showSwitchButton.value;
|
|
@@ -190,76 +189,161 @@
|
|
|
190
189
|
<template>
|
|
191
190
|
<div v-if="showButtons" class="lkt-item-crud-buttons">
|
|
192
191
|
|
|
193
|
-
<
|
|
194
|
-
<
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
192
|
+
<template v-if="groupButton !== false">
|
|
193
|
+
<lkt-button
|
|
194
|
+
ref="groupButton"
|
|
195
|
+
v-bind="safeGroupButton"
|
|
196
|
+
class="lkt-item-crud-group-button"
|
|
197
|
+
>
|
|
198
|
+
<template #split>
|
|
199
|
+
<lkt-button
|
|
200
|
+
v-if="showSwitchButton"
|
|
201
|
+
v-bind="safeEditModeButton"
|
|
202
|
+
v-model:checked="isEditing"
|
|
203
|
+
class="lkt-item-crud--switch-mode-button" />
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
<template v-if="slots['prev-buttons-ever']" v-show="!isLoading">
|
|
207
|
+
<slot name="prev-buttons-ever"
|
|
208
|
+
:can-update="canUpdate"
|
|
209
|
+
:can-drop="canDrop"
|
|
210
|
+
:perms="perms"
|
|
211
|
+
/>
|
|
212
|
+
</template>
|
|
213
|
+
|
|
214
|
+
<template v-if="slots['prev-buttons']" v-show="isEditing && !isLoading">
|
|
215
|
+
<slot name="prev-buttons"
|
|
216
|
+
:can-update="canUpdate"
|
|
217
|
+
:can-drop="canDrop"
|
|
218
|
+
:perms="perms"
|
|
219
|
+
/>
|
|
220
|
+
</template>
|
|
221
|
+
|
|
222
|
+
<lkt-button
|
|
223
|
+
ref="saveButtonRef"
|
|
224
|
+
v-show="mode === ItemCrudMode.Update && showSaveButton"
|
|
225
|
+
v-bind="safeUpdateButton"
|
|
226
|
+
:disabled="!ableToUpdate"
|
|
227
|
+
@loading="onButtonLoading"
|
|
228
|
+
@loaded="onButtonLoaded"
|
|
229
|
+
@click="onSave">
|
|
230
|
+
<slot v-if="!!slots['button-save']" name="button-save" :item="item"
|
|
231
|
+
:edit-mode="isEditing"
|
|
232
|
+
:is-create="false"
|
|
233
|
+
:can-update="canUpdate"
|
|
234
|
+
:can-drop="canDrop" />
|
|
235
|
+
</lkt-button>
|
|
236
|
+
|
|
237
|
+
<lkt-button
|
|
238
|
+
ref="saveButtonRef"
|
|
239
|
+
v-show="mode === ItemCrudMode.Create && showSaveButton"
|
|
240
|
+
v-bind="safeCreateButton"
|
|
241
|
+
:disabled="!ableToCreate"
|
|
242
|
+
@loading="onButtonLoading"
|
|
243
|
+
@loaded="onButtonLoaded"
|
|
244
|
+
@click="onCreate">
|
|
245
|
+
<slot v-if="!!slots['button-save']" name="button-save" :item="item"
|
|
246
|
+
:edit-mode="isEditing"
|
|
247
|
+
:is-create="true"
|
|
248
|
+
:can-update="canUpdate"
|
|
249
|
+
:can-drop="canDrop" />
|
|
250
|
+
</lkt-button>
|
|
251
|
+
|
|
252
|
+
<lkt-button
|
|
253
|
+
ref="dropButtonRef"
|
|
254
|
+
v-show="showDropButton && mode !== ItemCrudMode.Create"
|
|
255
|
+
v-bind="safeDropButton"
|
|
256
|
+
:disabled="!ableToDrop"
|
|
257
|
+
@loading="onButtonLoading"
|
|
258
|
+
@loaded="onButtonLoaded"
|
|
259
|
+
@click="onDrop">
|
|
260
|
+
<slot v-if="!!slots['button-drop']" name="button-drop" :item="item"
|
|
261
|
+
:edit-mode="isEditing"
|
|
262
|
+
:is-create="false"
|
|
263
|
+
:can-update="canUpdate"
|
|
264
|
+
:can-drop="canDrop" />
|
|
265
|
+
</lkt-button>
|
|
266
|
+
|
|
267
|
+
<template v-if="slots.buttons" v-show="isEditing && !isLoading">
|
|
268
|
+
<slot name="buttons" />
|
|
269
|
+
</template>
|
|
270
|
+
</template>
|
|
271
|
+
</lkt-button>
|
|
272
|
+
</template>
|
|
273
|
+
|
|
274
|
+
<template v-else>
|
|
275
|
+
|
|
276
|
+
<div class="lkt-item-crud-buttons" v-if="slots['prev-buttons-ever']" v-show="!isLoading">
|
|
277
|
+
<slot name="prev-buttons-ever"
|
|
278
|
+
:can-update="canUpdate"
|
|
279
|
+
:can-drop="canDrop"
|
|
280
|
+
:perms="perms"
|
|
281
|
+
/>
|
|
282
|
+
</div>
|
|
283
|
+
|
|
284
|
+
<div class="lkt-item-crud-buttons" v-if="slots['prev-buttons']" v-show="isEditing && !isLoading">
|
|
285
|
+
<slot name="prev-buttons"
|
|
286
|
+
:can-update="canUpdate"
|
|
287
|
+
:can-drop="canDrop"
|
|
288
|
+
:perms="perms"
|
|
289
|
+
/>
|
|
290
|
+
</div>
|
|
291
|
+
|
|
292
|
+
<lkt-button
|
|
293
|
+
ref="saveButtonRef"
|
|
294
|
+
v-show="mode === ItemCrudMode.Update && showSaveButton"
|
|
295
|
+
v-bind="safeUpdateButton"
|
|
296
|
+
:disabled="!ableToUpdate"
|
|
297
|
+
@loading="onButtonLoading"
|
|
298
|
+
@loaded="onButtonLoaded"
|
|
299
|
+
@click="onSave">
|
|
300
|
+
<slot v-if="!!slots['button-save']" name="button-save" :item="item"
|
|
301
|
+
:edit-mode="isEditing"
|
|
302
|
+
:is-create="false"
|
|
303
|
+
:can-update="canUpdate"
|
|
304
|
+
:can-drop="canDrop" />
|
|
305
|
+
</lkt-button>
|
|
306
|
+
|
|
307
|
+
<lkt-button
|
|
308
|
+
ref="saveButtonRef"
|
|
309
|
+
v-show="mode === ItemCrudMode.Create && showSaveButton"
|
|
310
|
+
v-bind="safeCreateButton"
|
|
311
|
+
:disabled="!ableToCreate"
|
|
312
|
+
@loading="onButtonLoading"
|
|
313
|
+
@loaded="onButtonLoaded"
|
|
314
|
+
@click="onCreate">
|
|
315
|
+
<slot v-if="!!slots['button-save']" name="button-save" :item="item"
|
|
316
|
+
:edit-mode="isEditing"
|
|
317
|
+
:is-create="true"
|
|
318
|
+
:can-update="canUpdate"
|
|
319
|
+
:can-drop="canDrop" />
|
|
320
|
+
</lkt-button>
|
|
321
|
+
|
|
322
|
+
<lkt-button
|
|
323
|
+
ref="dropButtonRef"
|
|
324
|
+
v-show="showDropButton && mode !== ItemCrudMode.Create"
|
|
325
|
+
v-bind="safeDropButton"
|
|
326
|
+
:disabled="!ableToDrop"
|
|
327
|
+
@loading="onButtonLoading"
|
|
328
|
+
@loaded="onButtonLoaded"
|
|
329
|
+
@click="onDrop">
|
|
330
|
+
<slot v-if="!!slots['button-drop']" name="button-drop" :item="item"
|
|
331
|
+
:edit-mode="isEditing"
|
|
332
|
+
:is-create="false"
|
|
333
|
+
:can-update="canUpdate"
|
|
334
|
+
:can-drop="canDrop" />
|
|
335
|
+
</lkt-button>
|
|
336
|
+
|
|
337
|
+
<div class="lkt-item-crud-buttons" v-if="slots.buttons" v-show="isEditing && !isLoading">
|
|
338
|
+
<slot name="buttons" />
|
|
339
|
+
</div>
|
|
340
|
+
|
|
341
|
+
<lkt-button
|
|
342
|
+
v-if="showSwitchButton"
|
|
343
|
+
v-bind="safeEditModeButton"
|
|
344
|
+
v-model:checked="isEditing"
|
|
345
|
+
class="lkt-item-crud--switch-mode-button" />
|
|
346
|
+
|
|
347
|
+
</template>
|
|
264
348
|
</div>
|
|
265
349
|
</template>
|
|
@@ -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');
|
|
@@ -357,6 +357,7 @@
|
|
|
357
357
|
:update-button="updateButton"
|
|
358
358
|
:drop-button="dropButton"
|
|
359
359
|
:edit-mode-button="editModeButton"
|
|
360
|
+
:group-button="groupButton"
|
|
360
361
|
:data-changed="dataChanged"
|
|
361
362
|
:http-success-read="httpSuccessRead"
|
|
362
363
|
:can-update="canUpdate"
|
|
@@ -374,7 +375,7 @@
|
|
|
374
375
|
:perms="perms"
|
|
375
376
|
/>
|
|
376
377
|
</template>
|
|
377
|
-
<template #prev-buttons
|
|
378
|
+
<template #prev-buttons="{canUpdate, canDrop, perms}" v-if="slots['prev-buttons']">
|
|
378
379
|
<slot name="prev-buttons"
|
|
379
380
|
:can-update="canUpdate"
|
|
380
381
|
:can-drop="canDrop"
|
|
@@ -392,11 +393,16 @@
|
|
|
392
393
|
quick
|
|
393
394
|
can-close
|
|
394
395
|
v-on:close="showStoreMessage = false" />
|
|
395
|
-
<slot name="item"
|
|
396
|
+
<slot name="item"
|
|
397
|
+
:item="item"
|
|
398
|
+
:loading="isLoading"
|
|
399
|
+
:edit-mode="editMode"
|
|
396
400
|
:is-create="createMode"
|
|
397
401
|
:can-update="canUpdate"
|
|
398
402
|
:can-drop="canDrop"
|
|
399
|
-
:item-being-edited="itemBeingEdited"
|
|
403
|
+
:item-being-edited="itemBeingEdited"
|
|
404
|
+
:perms="perms"
|
|
405
|
+
/>
|
|
400
406
|
</div>
|
|
401
407
|
<lkt-http-info :code="httpStatus" v-else-if="notificationType === NotificationType.Inline" />
|
|
402
408
|
</div>
|
|
@@ -415,11 +421,13 @@
|
|
|
415
421
|
:update-button="updateButton"
|
|
416
422
|
:drop-button="dropButton"
|
|
417
423
|
:edit-mode-button="editModeButton"
|
|
424
|
+
:group-button="groupButton"
|
|
418
425
|
:data-changed="dataChanged"
|
|
419
426
|
:http-success-read="httpSuccessRead"
|
|
420
427
|
:can-update="canUpdate"
|
|
421
428
|
:can-drop="canDrop"
|
|
422
429
|
:can-switch-edit-mode="canSwitchEditMode"
|
|
430
|
+
:perms="perms"
|
|
423
431
|
@create="onCreate"
|
|
424
432
|
@save="onUpdate"
|
|
425
433
|
@drop="onDrop"
|