@stsdti/funky-ui-kit 1.7.1 → 1.7.3
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/funky-ui-kit.es.js +123 -5
- package/dist/funky-ui-kit.es.js.map +1 -1
- package/package.json +1 -1
- package/web-types.json +1 -1
package/dist/funky-ui-kit.es.js
CHANGED
|
@@ -22579,12 +22579,12 @@ const resolveValue = async (value, ...args) => {
|
|
|
22579
22579
|
let result = value;
|
|
22580
22580
|
result = result instanceof Function ? result(...args) : result;
|
|
22581
22581
|
result = result instanceof Promise ? await result : result;
|
|
22582
|
-
return
|
|
22582
|
+
return unref(result);
|
|
22583
22583
|
};
|
|
22584
22584
|
const resolveValueSync = (value, ...args) => {
|
|
22585
22585
|
let result = value;
|
|
22586
22586
|
result = result instanceof Function ? result(...args) : result;
|
|
22587
|
-
return
|
|
22587
|
+
return unref(result);
|
|
22588
22588
|
};
|
|
22589
22589
|
function joinList(list, path, separator = ",") {
|
|
22590
22590
|
let localList = list || [];
|
|
@@ -85976,11 +85976,11 @@ const components = {
|
|
|
85976
85976
|
AppButtonGroup: _sfc_main$1K,
|
|
85977
85977
|
AppBoard: _sfc_main,
|
|
85978
85978
|
AppDate,
|
|
85979
|
-
// New simpler name
|
|
85979
|
+
// New simpler name,
|
|
85980
85980
|
AppDateRange: _sfc_main$1E,
|
|
85981
|
-
// New simpler name
|
|
85981
|
+
// New simpler name,
|
|
85982
85982
|
DayOfWeek: _sfc_main$1I,
|
|
85983
|
-
// New simpler name
|
|
85983
|
+
// New simpler name,
|
|
85984
85984
|
AppDatePicker: AppDate,
|
|
85985
85985
|
AppDatePickerRange: _sfc_main$1E,
|
|
85986
85986
|
AppDatePickerDayOfWeek: _sfc_main$1I,
|
|
@@ -86320,6 +86320,121 @@ function useFormOld(props2, emits) {
|
|
|
86320
86320
|
}
|
|
86321
86321
|
return externalContext;
|
|
86322
86322
|
}
|
|
86323
|
+
const useTableModelTopButton = {
|
|
86324
|
+
add: "action-add"
|
|
86325
|
+
};
|
|
86326
|
+
const useTableModelTableButton = {
|
|
86327
|
+
edit: "action-edit",
|
|
86328
|
+
view: "action-view",
|
|
86329
|
+
delete: "action-delete"
|
|
86330
|
+
};
|
|
86331
|
+
function useTableModel({ props: props2, emits, tableContext, formContext = null, model, topButtonExtras }) {
|
|
86332
|
+
var _a2;
|
|
86333
|
+
const topButtonsList = computed(() => {
|
|
86334
|
+
var _a3, _b2;
|
|
86335
|
+
let topButtons = ((_b2 = (_a3 = model == null ? void 0 : model.getTable) == null ? void 0 : _a3.call(model)) == null ? void 0 : _b2.topButtonList) || [];
|
|
86336
|
+
topButtons = topButtons.map((item) => {
|
|
86337
|
+
let button = { ...item };
|
|
86338
|
+
button = resolveButton(button);
|
|
86339
|
+
return button;
|
|
86340
|
+
});
|
|
86341
|
+
let topButtonsDictionary = lodashExports.keyBy(topButtons, "code");
|
|
86342
|
+
if (topButtonExtras) {
|
|
86343
|
+
let topButtonExtrasValue = resolveValueSync(topButtonExtras);
|
|
86344
|
+
for (const [key, override] of Object.entries(topButtonExtrasValue)) {
|
|
86345
|
+
topButtonsDictionary[key] ? Object.assign(topButtonsDictionary[key], override) : null;
|
|
86346
|
+
}
|
|
86347
|
+
}
|
|
86348
|
+
const parentOverrides = (tableContext == null ? void 0 : tableContext.topButtonExtras) || {};
|
|
86349
|
+
for (const [key, override] of Object.entries(parentOverrides)) {
|
|
86350
|
+
topButtonsDictionary[key] ? Object.assign(topButtonsDictionary[key], override) : null;
|
|
86351
|
+
}
|
|
86352
|
+
return Object.values(topButtonsDictionary).filter((btn) => btn.visible !== false);
|
|
86353
|
+
});
|
|
86354
|
+
const getButtons = (rowData) => {
|
|
86355
|
+
var _a3, _b2;
|
|
86356
|
+
let tableButtons = ((_b2 = (_a3 = model == null ? void 0 : model.getTable) == null ? void 0 : _a3.call(model)) == null ? void 0 : _b2.tableButtonList) || [];
|
|
86357
|
+
tableButtons = tableButtons.map((item) => {
|
|
86358
|
+
let button = { ...item };
|
|
86359
|
+
button = resolveButton(button, rowData);
|
|
86360
|
+
return button;
|
|
86361
|
+
});
|
|
86362
|
+
return tableButtons.filter((button) => button.visible !== false);
|
|
86363
|
+
};
|
|
86364
|
+
const onTopButtonClick = async (button) => {
|
|
86365
|
+
var _a3;
|
|
86366
|
+
if (button.code === useTableModelTopButton.add) {
|
|
86367
|
+
props2.useModal ? await ((_a3 = formContext == null ? void 0 : formContext.show) == null ? void 0 : _a3.call(formContext)) : null;
|
|
86368
|
+
}
|
|
86369
|
+
};
|
|
86370
|
+
const onTableButtonClick = async (button, row, rowIndex) => {
|
|
86371
|
+
var _a3;
|
|
86372
|
+
switch (button.code) {
|
|
86373
|
+
case useTableModelTableButton.edit:
|
|
86374
|
+
case useTableModelTableButton.view:
|
|
86375
|
+
if (props2.useModal) {
|
|
86376
|
+
await ((_a3 = formContext == null ? void 0 : formContext.show) == null ? void 0 : _a3.call(formContext, { id: row.id }));
|
|
86377
|
+
}
|
|
86378
|
+
break;
|
|
86379
|
+
case useTableModelTableButton.delete:
|
|
86380
|
+
await deleteRow(row.id);
|
|
86381
|
+
break;
|
|
86382
|
+
}
|
|
86383
|
+
};
|
|
86384
|
+
const resolveButton = (button, ...args) => {
|
|
86385
|
+
for (let key in button) {
|
|
86386
|
+
if (key === "click") {
|
|
86387
|
+
continue;
|
|
86388
|
+
}
|
|
86389
|
+
try {
|
|
86390
|
+
button[key] = resolveValueSync(button[key], ...args);
|
|
86391
|
+
} catch (e2) {
|
|
86392
|
+
console.error("One of your buttons sucked. Please fix it!", { button, key, e: e2 });
|
|
86393
|
+
}
|
|
86394
|
+
}
|
|
86395
|
+
if (props2.useModal) {
|
|
86396
|
+
button.route = null;
|
|
86397
|
+
}
|
|
86398
|
+
return button;
|
|
86399
|
+
};
|
|
86400
|
+
const deleteRow = async (itemId) => {
|
|
86401
|
+
const result = await UIUtils.showDeleteConfirmation("Esti sigur?", "Stergerea este ireversibila!");
|
|
86402
|
+
if (!result.value) {
|
|
86403
|
+
return;
|
|
86404
|
+
}
|
|
86405
|
+
const response = await model.getRepository().delete(itemId);
|
|
86406
|
+
if (ResponseUtils.isSuccess(response)) {
|
|
86407
|
+
ToastUtils.showSuccess("Stergerea s-a realizat cu succes!");
|
|
86408
|
+
await tableContext.fetchTable();
|
|
86409
|
+
} else {
|
|
86410
|
+
ToastUtils.showError("Stergerea a esuat!");
|
|
86411
|
+
}
|
|
86412
|
+
};
|
|
86413
|
+
if (tableContext && formContext) {
|
|
86414
|
+
watch([() => !lodashExports.isEmpty(formContext), () => !lodashExports.isEmpty(tableContext)], ([isFormReady, isTableReady]) => {
|
|
86415
|
+
if (isFormReady && isTableReady) {
|
|
86416
|
+
emits("mounted", { ...tableContext, form: formContext });
|
|
86417
|
+
}
|
|
86418
|
+
});
|
|
86419
|
+
}
|
|
86420
|
+
if (tableContext && !formContext) {
|
|
86421
|
+
watch(
|
|
86422
|
+
() => !lodashExports.isEmpty(tableContext),
|
|
86423
|
+
(isTableReady) => {
|
|
86424
|
+
if (isTableReady) {
|
|
86425
|
+
emits("mounted", tableContext);
|
|
86426
|
+
}
|
|
86427
|
+
}
|
|
86428
|
+
);
|
|
86429
|
+
}
|
|
86430
|
+
return {
|
|
86431
|
+
topButtonsList,
|
|
86432
|
+
getButtons,
|
|
86433
|
+
onTopButtonClick,
|
|
86434
|
+
onTableButtonClick,
|
|
86435
|
+
...((_a2 = model == null ? void 0 : model.getTable) == null ? void 0 : _a2.call(model)) || {}
|
|
86436
|
+
};
|
|
86437
|
+
}
|
|
86323
86438
|
const plugin = {
|
|
86324
86439
|
install(Vue, config) {
|
|
86325
86440
|
for (const prop in components) {
|
|
@@ -86468,6 +86583,9 @@ export {
|
|
|
86468
86583
|
selectOldProps as useSelectProps,
|
|
86469
86584
|
useTable,
|
|
86470
86585
|
useTableFilters,
|
|
86586
|
+
useTableModel,
|
|
86587
|
+
useTableModelTableButton,
|
|
86588
|
+
useTableModelTopButton,
|
|
86471
86589
|
veeBinds
|
|
86472
86590
|
};
|
|
86473
86591
|
//# sourceMappingURL=funky-ui-kit.es.js.map
|