lkt-vue-kernel 1.0.12 → 1.0.14
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/index.d.ts +68 -68
- package/dist/index.js +175 -61
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { VueElement, Component } from 'vue';
|
|
2
2
|
import { RouteLocationRaw } from 'vue-router';
|
|
3
|
-
import { DataState } from 'lkt-data-state';
|
|
3
|
+
import { DataState, DataStateConfig } from 'lkt-data-state';
|
|
4
4
|
|
|
5
5
|
interface LktObject {
|
|
6
6
|
[key: string | number]: any;
|
|
@@ -44,6 +44,7 @@ type BeforeCloseModalData = {
|
|
|
44
44
|
modalName: ValidModalKey;
|
|
45
45
|
modalKey: ValidModalKey;
|
|
46
46
|
item?: LktObject;
|
|
47
|
+
itemCreated?: boolean;
|
|
47
48
|
};
|
|
48
49
|
|
|
49
50
|
type ValidBeforeCloseModal = Function | undefined | ((data: BeforeCloseModalData) => void);
|
|
@@ -136,6 +137,22 @@ type IsDisabledChecker = ((args?: IsDisabledCheckerArgs) => boolean);
|
|
|
136
137
|
|
|
137
138
|
type ValidIsDisabledValue = boolean | undefined | IsDisabledChecker;
|
|
138
139
|
|
|
140
|
+
declare enum ModalCallbackAction {
|
|
141
|
+
Refresh = "refresh",
|
|
142
|
+
Close = "close",
|
|
143
|
+
ReOpen = "reOpen",
|
|
144
|
+
Exec = "exec",
|
|
145
|
+
Open = "open"
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
interface ModalCallbackConfig {
|
|
149
|
+
modalName: ValidModalName;
|
|
150
|
+
modalKey?: ValidModalKey;
|
|
151
|
+
action: ModalCallbackAction;
|
|
152
|
+
method?: string;
|
|
153
|
+
args?: LktObject;
|
|
154
|
+
}
|
|
155
|
+
|
|
139
156
|
interface ButtonConfig {
|
|
140
157
|
type?: ButtonType;
|
|
141
158
|
checked?: boolean;
|
|
@@ -159,6 +176,7 @@ interface ButtonConfig {
|
|
|
159
176
|
confirmModal?: ValidModalName;
|
|
160
177
|
confirmModalKey?: ValidModalKey;
|
|
161
178
|
confirmData?: Partial<ModalConfig>;
|
|
179
|
+
modalCallbacks?: Array<ModalCallbackConfig>;
|
|
162
180
|
iconDot?: boolean | string | number;
|
|
163
181
|
iconEnd?: string;
|
|
164
182
|
img?: string;
|
|
@@ -181,11 +199,20 @@ interface ButtonConfig {
|
|
|
181
199
|
}
|
|
182
200
|
|
|
183
201
|
declare class LktSettings {
|
|
184
|
-
static
|
|
202
|
+
static debugEnabled: boolean;
|
|
203
|
+
static debugMode(enabled?: boolean): typeof LktSettings;
|
|
185
204
|
static defaultConfirmButton: Partial<ButtonConfig>;
|
|
186
|
-
static defaultCancelButton: Partial<ButtonConfig>;
|
|
187
205
|
static setDefaultConfirmButton(button: Partial<ButtonConfig>): typeof LktSettings;
|
|
206
|
+
static defaultCancelButton: Partial<ButtonConfig>;
|
|
188
207
|
static setDefaultCancelButton(button: Partial<ButtonConfig>): typeof LktSettings;
|
|
208
|
+
static defaultCreateButton: Partial<ButtonConfig>;
|
|
209
|
+
static setDefaultCreateButton(button: Partial<ButtonConfig>): typeof LktSettings;
|
|
210
|
+
static defaultUpdateButton: Partial<ButtonConfig>;
|
|
211
|
+
static setDefaultUpdateButton(button: Partial<ButtonConfig>): typeof LktSettings;
|
|
212
|
+
static defaultDropButton: Partial<ButtonConfig>;
|
|
213
|
+
static setDefaultDropButton(button: Partial<ButtonConfig>): typeof LktSettings;
|
|
214
|
+
static defaultEditModeButton: Partial<ButtonConfig>;
|
|
215
|
+
static setDefaultEditModeButton(button: Partial<ButtonConfig>): typeof LktSettings;
|
|
189
216
|
}
|
|
190
217
|
|
|
191
218
|
declare enum FieldType {
|
|
@@ -336,25 +363,9 @@ declare enum ItemCrudView {
|
|
|
336
363
|
Modal = "modal"
|
|
337
364
|
}
|
|
338
365
|
|
|
339
|
-
declare enum
|
|
340
|
-
Refresh = "refresh",
|
|
341
|
-
Close = "close",
|
|
342
|
-
ReOpen = "reOpen",
|
|
343
|
-
Exec = "exec",
|
|
344
|
-
Open = "open"
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
interface ModalCallbackConfig {
|
|
348
|
-
modalName: ValidModalName;
|
|
349
|
-
modalKey?: ValidModalKey;
|
|
350
|
-
action: ModalCallbackAction;
|
|
351
|
-
method?: string;
|
|
352
|
-
args?: LktObject;
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
declare enum ItemCrudType {
|
|
366
|
+
declare enum ItemCrudMode {
|
|
356
367
|
Create = "create",
|
|
357
|
-
|
|
368
|
+
Update = "update",
|
|
358
369
|
Read = "read"
|
|
359
370
|
}
|
|
360
371
|
|
|
@@ -365,7 +376,8 @@ declare enum ItemCrudButtonNavPosition {
|
|
|
365
376
|
|
|
366
377
|
declare enum ItemCrudButtonNavVisibility {
|
|
367
378
|
Changed = "changed",
|
|
368
|
-
Always = "always"
|
|
379
|
+
Always = "always",
|
|
380
|
+
Never = "never"
|
|
369
381
|
}
|
|
370
382
|
|
|
371
383
|
declare enum SaveType {
|
|
@@ -382,64 +394,22 @@ interface SaveConfig {
|
|
|
382
394
|
interface ItemCrudConfig {
|
|
383
395
|
modelValue: LktObject;
|
|
384
396
|
editing: boolean;
|
|
385
|
-
|
|
397
|
+
mode: ItemCrudMode;
|
|
386
398
|
view: ItemCrudView;
|
|
387
|
-
|
|
399
|
+
editModeButton: ButtonConfig;
|
|
388
400
|
dropButton: ButtonConfig;
|
|
389
401
|
createButton: ButtonConfig;
|
|
390
402
|
updateButton: ButtonConfig;
|
|
391
403
|
modalConfig: ModalConfig;
|
|
392
404
|
saveConfig: SaveConfig;
|
|
393
405
|
title: string;
|
|
394
|
-
hiddenSave: boolean;
|
|
395
|
-
hiddenDrop: boolean;
|
|
396
|
-
hiddenButtons: boolean;
|
|
397
|
-
hideSwitchEdition: boolean;
|
|
398
406
|
readResource: string;
|
|
399
407
|
readData: LktObject;
|
|
400
408
|
saveValidator: Function;
|
|
401
409
|
beforeEmitUpdate: Function | undefined;
|
|
402
|
-
dataStateConfig:
|
|
410
|
+
dataStateConfig: DataStateConfig;
|
|
403
411
|
buttonNavPosition?: ItemCrudButtonNavPosition;
|
|
404
412
|
buttonNavVisibility?: ItemCrudButtonNavVisibility;
|
|
405
|
-
insideModal: boolean;
|
|
406
|
-
saveText: string;
|
|
407
|
-
saveIcon: string;
|
|
408
|
-
dropText: string;
|
|
409
|
-
dropIcon: string;
|
|
410
|
-
createResource: string;
|
|
411
|
-
updateResource: string;
|
|
412
|
-
dropResource: string;
|
|
413
|
-
createConfirm: string;
|
|
414
|
-
updateConfirm: string;
|
|
415
|
-
dropConfirm: string;
|
|
416
|
-
createConfirmData: LktObject;
|
|
417
|
-
updateConfirmData: LktObject;
|
|
418
|
-
dropConfirmData: LktObject;
|
|
419
|
-
createDisabled: boolean;
|
|
420
|
-
updateDisabled: boolean;
|
|
421
|
-
dropDisabled: boolean;
|
|
422
|
-
createData: LktObject;
|
|
423
|
-
updateData: LktObject;
|
|
424
|
-
dropData: LktObject;
|
|
425
|
-
editModeText: string;
|
|
426
|
-
onCreate: Function | undefined;
|
|
427
|
-
onUpdate: Function | undefined;
|
|
428
|
-
onCreateModalCallbacks: ModalCallbackConfig[];
|
|
429
|
-
onUpdateModalCallbacks: ModalCallbackConfig[];
|
|
430
|
-
onDropModalCallbacks: ModalCallbackConfig[];
|
|
431
|
-
isCreate: boolean;
|
|
432
|
-
size: string;
|
|
433
|
-
preTitle: string;
|
|
434
|
-
showClose: boolean;
|
|
435
|
-
disabledClose: boolean;
|
|
436
|
-
disabledVeilClick: boolean;
|
|
437
|
-
modalName: string;
|
|
438
|
-
modalKey: string;
|
|
439
|
-
zIndex: number;
|
|
440
|
-
editedCloseConfirm: string;
|
|
441
|
-
editedCloseConfirmKey: string | number;
|
|
442
|
-
beforeClose: Function | undefined;
|
|
443
413
|
}
|
|
444
414
|
|
|
445
415
|
declare enum PaginatorType {
|
|
@@ -632,6 +602,7 @@ declare class Button extends LktItem implements ButtonConfig {
|
|
|
632
602
|
confirmModal: ValidModalName;
|
|
633
603
|
confirmModalKey: ValidModalKey;
|
|
634
604
|
confirmData: Partial<ModalConfig>;
|
|
605
|
+
modalCallbacks?: Array<ModalCallbackConfig>;
|
|
635
606
|
text: string;
|
|
636
607
|
icon: string;
|
|
637
608
|
iconDot: boolean;
|
|
@@ -656,6 +627,7 @@ declare class Button extends LktItem implements ButtonConfig {
|
|
|
656
627
|
onClick?: Function | undefined;
|
|
657
628
|
onConfirm?: Function | undefined;
|
|
658
629
|
constructor(data?: Partial<ButtonConfig>);
|
|
630
|
+
isDisabled(): boolean | undefined;
|
|
659
631
|
}
|
|
660
632
|
|
|
661
633
|
interface ColumnConfig {
|
|
@@ -719,6 +691,7 @@ declare enum TablePermission {
|
|
|
719
691
|
Edit = "edit",// Displays edit button
|
|
720
692
|
Drop = "drop",// Displays drop button
|
|
721
693
|
Sort = "sort",// Sort
|
|
694
|
+
SwitchEditMode = "switch-edit-mode",
|
|
722
695
|
InlineEdit = "inline-edit",// Be able to edit columns inside the table
|
|
723
696
|
InlineCreate = "inline-create",// Be able to append a new editable row (needs InlineEdit in order to be editable)
|
|
724
697
|
ModalCreate = "modal-create",// Be able to append a new row after save a modal form
|
|
@@ -822,6 +795,29 @@ declare class Tooltip extends LktItem implements TooltipConfig {
|
|
|
822
795
|
constructor(data?: Partial<TooltipConfig>);
|
|
823
796
|
}
|
|
824
797
|
|
|
798
|
+
declare class ItemCrud extends LktItem implements ItemCrudConfig {
|
|
799
|
+
static lktDefaultValues: (keyof ItemCrudConfig)[];
|
|
800
|
+
modelValue: LktObject;
|
|
801
|
+
editing: boolean;
|
|
802
|
+
mode: ItemCrudMode;
|
|
803
|
+
view: ItemCrudView;
|
|
804
|
+
editModeButton: ButtonConfig;
|
|
805
|
+
dropButton: ButtonConfig;
|
|
806
|
+
createButton: ButtonConfig;
|
|
807
|
+
updateButton: ButtonConfig;
|
|
808
|
+
modalConfig: ModalConfig;
|
|
809
|
+
saveConfig: SaveConfig;
|
|
810
|
+
title: string;
|
|
811
|
+
readResource: string;
|
|
812
|
+
readData: LktObject;
|
|
813
|
+
saveValidator: Function;
|
|
814
|
+
beforeEmitUpdate: Function | undefined;
|
|
815
|
+
dataStateConfig: DataStateConfig;
|
|
816
|
+
buttonNavPosition?: ItemCrudButtonNavPosition;
|
|
817
|
+
buttonNavVisibility?: ItemCrudButtonNavVisibility;
|
|
818
|
+
constructor(data?: Partial<ItemCrudConfig>);
|
|
819
|
+
}
|
|
820
|
+
|
|
825
821
|
declare class Modal extends LktItem implements ModalConfig {
|
|
826
822
|
static lktDefaultValues: (keyof ModalConfig)[];
|
|
827
823
|
size: string;
|
|
@@ -932,6 +928,10 @@ type ValidScanPropTarget = ScanPropTarget | ((...args: any[]) => ScanPropTarget)
|
|
|
932
928
|
declare const extractPropValue: (needle: ValidScanPropTarget, haystack: LktObject) => ValidScanPropTarget;
|
|
933
929
|
declare const extractI18nValue: (needle: string | number) => any;
|
|
934
930
|
|
|
931
|
+
declare const ensureButtonConfig: (buttonConfig: Partial<ButtonConfig> | undefined, settingsConfig: Partial<ButtonConfig>) => Partial<ButtonConfig>;
|
|
932
|
+
|
|
933
|
+
declare const lktDebug: (component: string, ...args: any[]) => void;
|
|
934
|
+
|
|
935
935
|
/**
|
|
936
936
|
* Export common interfaces
|
|
937
937
|
*/
|
|
@@ -941,4 +941,4 @@ declare function getDefaultValues<T>(cls: {
|
|
|
941
941
|
lktDefaultValues: (keyof T)[];
|
|
942
942
|
}): Partial<T>;
|
|
943
943
|
|
|
944
|
-
export { Anchor, type AnchorConfig, AnchorType, type BeforeCloseModalData, Button, type ButtonConfig, ButtonType, Column, type ColumnConfig, ColumnType, type DragConfig, type EmptyModalKey, Field, FieldAutoValidationTrigger, type FieldConfig, FieldType, type IsDisabledChecker, type IsDisabledCheckerArgs, ItemCrudButtonNavPosition, ItemCrudButtonNavVisibility, type ItemCrudConfig,
|
|
944
|
+
export { Anchor, type AnchorConfig, AnchorType, type BeforeCloseModalData, Button, type ButtonConfig, ButtonType, Column, type ColumnConfig, ColumnType, type DragConfig, type EmptyModalKey, Field, FieldAutoValidationTrigger, type FieldConfig, FieldType, type IsDisabledChecker, type IsDisabledCheckerArgs, ItemCrud, ItemCrudButtonNavPosition, ItemCrudButtonNavVisibility, type ItemCrudConfig, ItemCrudMode, ItemCrudView, LktItem, type LktObject, LktSettings, LktStrictItem, Modal, ModalCallbackAction, type ModalCallbackConfig, type ModalConfig, ModalType, MultipleOptionsDisplay, Option, type OptionConfig, Paginator, type PaginatorConfig, PaginatorType, SafeString, type SaveConfig, SaveType, type ScanPropTarget, SortDirection, Table, type TableConfig, TablePermission, TableRowType, TableType, ToggleMode, Tooltip, type TooltipConfig, TooltipLocationX, TooltipLocationY, TooltipPositionEngine, type ValidBeforeCloseModal, type ValidColSpan, type ValidCustomSlot, type ValidDragConfig, type ValidFieldMinMax, type ValidFieldValue, type ValidIsDisabledValue, type ValidModalKey, type ValidModalName, type ValidOptionValue, type ValidPaginatorConfig, type ValidSafeStringValue, type ValidScanPropTarget, type ValidTabIndex, type ValidTablePermission, type ValidTableRowTypeValue, ensureButtonConfig, extractI18nValue, extractPropValue, getDefaultValues, lktDebug };
|
package/dist/index.js
CHANGED
|
@@ -1,20 +1,71 @@
|
|
|
1
|
+
// src/enums/ButtonType.ts
|
|
2
|
+
var ButtonType = /* @__PURE__ */ ((ButtonType2) => {
|
|
3
|
+
ButtonType2["Button"] = "button";
|
|
4
|
+
ButtonType2["Submit"] = "submit";
|
|
5
|
+
ButtonType2["Reset"] = "reset";
|
|
6
|
+
ButtonType2["Anchor"] = "anchor";
|
|
7
|
+
ButtonType2["Content"] = "content";
|
|
8
|
+
ButtonType2["Switch"] = "switch";
|
|
9
|
+
ButtonType2["HiddenSwitch"] = "hidden-switch";
|
|
10
|
+
ButtonType2["Split"] = "split";
|
|
11
|
+
ButtonType2["SplitLazy"] = "split-lazy";
|
|
12
|
+
ButtonType2["SplitEver"] = "split-ever";
|
|
13
|
+
ButtonType2["Tooltip"] = "tooltip";
|
|
14
|
+
ButtonType2["TooltipLazy"] = "tooltip-lazy";
|
|
15
|
+
ButtonType2["TooltipEver"] = "tooltip-ever";
|
|
16
|
+
return ButtonType2;
|
|
17
|
+
})(ButtonType || {});
|
|
18
|
+
|
|
1
19
|
// src/settings/LktSettings.ts
|
|
2
20
|
var LktSettings = class _LktSettings {
|
|
3
|
-
static
|
|
21
|
+
static debugEnabled = false;
|
|
22
|
+
static debugMode(enabled = true) {
|
|
23
|
+
_LktSettings.debugEnabled = enabled;
|
|
24
|
+
return _LktSettings;
|
|
25
|
+
}
|
|
4
26
|
static defaultConfirmButton = {
|
|
5
27
|
text: "Confirm"
|
|
6
28
|
};
|
|
7
|
-
static defaultCancelButton = {
|
|
8
|
-
text: "Cancel"
|
|
9
|
-
};
|
|
10
29
|
static setDefaultConfirmButton(button) {
|
|
11
30
|
_LktSettings.defaultConfirmButton = button;
|
|
12
31
|
return _LktSettings;
|
|
13
32
|
}
|
|
33
|
+
static defaultCancelButton = {
|
|
34
|
+
text: "Cancel"
|
|
35
|
+
};
|
|
14
36
|
static setDefaultCancelButton(button) {
|
|
15
37
|
_LktSettings.defaultCancelButton = button;
|
|
16
38
|
return _LktSettings;
|
|
17
39
|
}
|
|
40
|
+
static defaultCreateButton = {
|
|
41
|
+
text: "Create"
|
|
42
|
+
};
|
|
43
|
+
static setDefaultCreateButton(button) {
|
|
44
|
+
_LktSettings.defaultCreateButton = button;
|
|
45
|
+
return _LktSettings;
|
|
46
|
+
}
|
|
47
|
+
static defaultUpdateButton = {
|
|
48
|
+
text: "Update"
|
|
49
|
+
};
|
|
50
|
+
static setDefaultUpdateButton(button) {
|
|
51
|
+
_LktSettings.defaultUpdateButton = button;
|
|
52
|
+
return _LktSettings;
|
|
53
|
+
}
|
|
54
|
+
static defaultDropButton = {
|
|
55
|
+
text: "Drop"
|
|
56
|
+
};
|
|
57
|
+
static setDefaultDropButton(button) {
|
|
58
|
+
_LktSettings.defaultDropButton = button;
|
|
59
|
+
return _LktSettings;
|
|
60
|
+
}
|
|
61
|
+
static defaultEditModeButton = {
|
|
62
|
+
text: "Edit mode",
|
|
63
|
+
type: "switch" /* Switch */
|
|
64
|
+
};
|
|
65
|
+
static setDefaultEditModeButton(button) {
|
|
66
|
+
_LktSettings.defaultEditModeButton = button;
|
|
67
|
+
return _LktSettings;
|
|
68
|
+
}
|
|
18
69
|
};
|
|
19
70
|
|
|
20
71
|
// src/instances/LktItem.ts
|
|
@@ -300,24 +351,6 @@ var Anchor = class extends LktItem {
|
|
|
300
351
|
}
|
|
301
352
|
};
|
|
302
353
|
|
|
303
|
-
// src/enums/ButtonType.ts
|
|
304
|
-
var ButtonType = /* @__PURE__ */ ((ButtonType2) => {
|
|
305
|
-
ButtonType2["Button"] = "button";
|
|
306
|
-
ButtonType2["Submit"] = "submit";
|
|
307
|
-
ButtonType2["Reset"] = "reset";
|
|
308
|
-
ButtonType2["Anchor"] = "anchor";
|
|
309
|
-
ButtonType2["Content"] = "content";
|
|
310
|
-
ButtonType2["Switch"] = "switch";
|
|
311
|
-
ButtonType2["HiddenSwitch"] = "hidden-switch";
|
|
312
|
-
ButtonType2["Split"] = "split";
|
|
313
|
-
ButtonType2["SplitLazy"] = "split-lazy";
|
|
314
|
-
ButtonType2["SplitEver"] = "split-ever";
|
|
315
|
-
ButtonType2["Tooltip"] = "tooltip";
|
|
316
|
-
ButtonType2["TooltipLazy"] = "tooltip-lazy";
|
|
317
|
-
ButtonType2["TooltipEver"] = "tooltip-ever";
|
|
318
|
-
return ButtonType2;
|
|
319
|
-
})(ButtonType || {});
|
|
320
|
-
|
|
321
354
|
// src/instances/Button.ts
|
|
322
355
|
import { generateRandomString as generateRandomString2 } from "lkt-string-tools";
|
|
323
356
|
|
|
@@ -356,6 +389,7 @@ var Button = class extends LktItem {
|
|
|
356
389
|
"confirmModal",
|
|
357
390
|
"confirmModalKey",
|
|
358
391
|
"confirmData",
|
|
392
|
+
"modalCallbacks",
|
|
359
393
|
"text",
|
|
360
394
|
"icon",
|
|
361
395
|
"iconDot",
|
|
@@ -398,6 +432,7 @@ var Button = class extends LktItem {
|
|
|
398
432
|
confirmModal = "";
|
|
399
433
|
confirmModalKey = "_";
|
|
400
434
|
confirmData = {};
|
|
435
|
+
modalCallbacks = [];
|
|
401
436
|
text = "";
|
|
402
437
|
icon = "";
|
|
403
438
|
iconDot = false;
|
|
@@ -427,6 +462,10 @@ var Button = class extends LktItem {
|
|
|
427
462
|
this.feed(data);
|
|
428
463
|
this.anchor = new Anchor(data.anchor);
|
|
429
464
|
}
|
|
465
|
+
isDisabled() {
|
|
466
|
+
if (typeof this.disabled === "function") return this.disabled();
|
|
467
|
+
return this.disabled;
|
|
468
|
+
}
|
|
430
469
|
};
|
|
431
470
|
|
|
432
471
|
// src/instances/Column.ts
|
|
@@ -563,6 +602,100 @@ var Tooltip = class extends LktItem {
|
|
|
563
602
|
}
|
|
564
603
|
};
|
|
565
604
|
|
|
605
|
+
// src/enums/ItemCrudMode.ts
|
|
606
|
+
var ItemCrudMode = /* @__PURE__ */ ((ItemCrudMode2) => {
|
|
607
|
+
ItemCrudMode2["Create"] = "create";
|
|
608
|
+
ItemCrudMode2["Update"] = "update";
|
|
609
|
+
ItemCrudMode2["Read"] = "read";
|
|
610
|
+
return ItemCrudMode2;
|
|
611
|
+
})(ItemCrudMode || {});
|
|
612
|
+
|
|
613
|
+
// src/enums/ItemCrudView.ts
|
|
614
|
+
var ItemCrudView = /* @__PURE__ */ ((ItemCrudView2) => {
|
|
615
|
+
ItemCrudView2["Inline"] = "inline";
|
|
616
|
+
ItemCrudView2["Modal"] = "modal";
|
|
617
|
+
return ItemCrudView2;
|
|
618
|
+
})(ItemCrudView || {});
|
|
619
|
+
|
|
620
|
+
// src/enums/ItemCrudButtonNavPosition.ts
|
|
621
|
+
var ItemCrudButtonNavPosition = /* @__PURE__ */ ((ItemCrudButtonNavPosition2) => {
|
|
622
|
+
ItemCrudButtonNavPosition2["Top"] = "top";
|
|
623
|
+
ItemCrudButtonNavPosition2["Bottom"] = "bottom";
|
|
624
|
+
return ItemCrudButtonNavPosition2;
|
|
625
|
+
})(ItemCrudButtonNavPosition || {});
|
|
626
|
+
|
|
627
|
+
// src/enums/ItemCrudButtonNavVisibility.ts
|
|
628
|
+
var ItemCrudButtonNavVisibility = /* @__PURE__ */ ((ItemCrudButtonNavVisibility2) => {
|
|
629
|
+
ItemCrudButtonNavVisibility2["Changed"] = "changed";
|
|
630
|
+
ItemCrudButtonNavVisibility2["Always"] = "always";
|
|
631
|
+
ItemCrudButtonNavVisibility2["Never"] = "never";
|
|
632
|
+
return ItemCrudButtonNavVisibility2;
|
|
633
|
+
})(ItemCrudButtonNavVisibility || {});
|
|
634
|
+
|
|
635
|
+
// src/enums/SaveType.ts
|
|
636
|
+
var SaveType = /* @__PURE__ */ ((SaveType2) => {
|
|
637
|
+
SaveType2["Manual"] = "manual";
|
|
638
|
+
SaveType2["Auto"] = "auto";
|
|
639
|
+
SaveType2["Delay"] = "delay";
|
|
640
|
+
return SaveType2;
|
|
641
|
+
})(SaveType || {});
|
|
642
|
+
|
|
643
|
+
// src/instances/ItemCrud.ts
|
|
644
|
+
var ItemCrud = class extends LktItem {
|
|
645
|
+
// static lktAllowUndefinedProps: string[] = [
|
|
646
|
+
// ];
|
|
647
|
+
//
|
|
648
|
+
static lktDefaultValues = [
|
|
649
|
+
"modelValue",
|
|
650
|
+
"editing",
|
|
651
|
+
"mode",
|
|
652
|
+
"view",
|
|
653
|
+
"editModeButton",
|
|
654
|
+
"dropButton",
|
|
655
|
+
"createButton",
|
|
656
|
+
"updateButton",
|
|
657
|
+
"modalConfig",
|
|
658
|
+
"saveConfig",
|
|
659
|
+
"title",
|
|
660
|
+
"readResource",
|
|
661
|
+
"readData",
|
|
662
|
+
"saveValidator",
|
|
663
|
+
"beforeEmitUpdate",
|
|
664
|
+
"dataStateConfig",
|
|
665
|
+
"buttonNavPosition",
|
|
666
|
+
"buttonNavVisibility"
|
|
667
|
+
];
|
|
668
|
+
modelValue = {};
|
|
669
|
+
editing = false;
|
|
670
|
+
// Global config
|
|
671
|
+
mode = "read" /* Read */;
|
|
672
|
+
view = "inline" /* Inline */;
|
|
673
|
+
// Buttons
|
|
674
|
+
editModeButton = {};
|
|
675
|
+
// Not sure, should test
|
|
676
|
+
dropButton = {};
|
|
677
|
+
createButton = {};
|
|
678
|
+
updateButton = {};
|
|
679
|
+
// Config if type === modal
|
|
680
|
+
modalConfig = {};
|
|
681
|
+
// Save config
|
|
682
|
+
saveConfig = {
|
|
683
|
+
type: "manual" /* Manual */
|
|
684
|
+
};
|
|
685
|
+
title = "";
|
|
686
|
+
readResource = "";
|
|
687
|
+
readData = {};
|
|
688
|
+
saveValidator = () => true;
|
|
689
|
+
beforeEmitUpdate = void 0;
|
|
690
|
+
dataStateConfig = {};
|
|
691
|
+
buttonNavPosition = "top" /* Top */;
|
|
692
|
+
buttonNavVisibility = "always" /* Always */;
|
|
693
|
+
constructor(data = {}) {
|
|
694
|
+
super();
|
|
695
|
+
this.feed(data);
|
|
696
|
+
}
|
|
697
|
+
};
|
|
698
|
+
|
|
566
699
|
// src/instances/Modal.ts
|
|
567
700
|
var Modal = class extends LktItem {
|
|
568
701
|
static lktDefaultValues = [
|
|
@@ -779,35 +912,6 @@ var Table = class extends LktItem {
|
|
|
779
912
|
}
|
|
780
913
|
};
|
|
781
914
|
|
|
782
|
-
// src/enums/ItemCrudButtonNavPosition.ts
|
|
783
|
-
var ItemCrudButtonNavPosition = /* @__PURE__ */ ((ItemCrudButtonNavPosition2) => {
|
|
784
|
-
ItemCrudButtonNavPosition2["Top"] = "top";
|
|
785
|
-
ItemCrudButtonNavPosition2["Bottom"] = "bottom";
|
|
786
|
-
return ItemCrudButtonNavPosition2;
|
|
787
|
-
})(ItemCrudButtonNavPosition || {});
|
|
788
|
-
|
|
789
|
-
// src/enums/ItemCrudButtonNavVisibility.ts
|
|
790
|
-
var ItemCrudButtonNavVisibility = /* @__PURE__ */ ((ItemCrudButtonNavVisibility2) => {
|
|
791
|
-
ItemCrudButtonNavVisibility2["Changed"] = "changed";
|
|
792
|
-
ItemCrudButtonNavVisibility2["Always"] = "always";
|
|
793
|
-
return ItemCrudButtonNavVisibility2;
|
|
794
|
-
})(ItemCrudButtonNavVisibility || {});
|
|
795
|
-
|
|
796
|
-
// src/enums/ItemCrudType.ts
|
|
797
|
-
var ItemCrudType = /* @__PURE__ */ ((ItemCrudType2) => {
|
|
798
|
-
ItemCrudType2["Create"] = "create";
|
|
799
|
-
ItemCrudType2["Edit"] = "edit";
|
|
800
|
-
ItemCrudType2["Read"] = "read";
|
|
801
|
-
return ItemCrudType2;
|
|
802
|
-
})(ItemCrudType || {});
|
|
803
|
-
|
|
804
|
-
// src/enums/ItemCrudView.ts
|
|
805
|
-
var ItemCrudView = /* @__PURE__ */ ((ItemCrudView2) => {
|
|
806
|
-
ItemCrudView2["Inline"] = "inline";
|
|
807
|
-
ItemCrudView2["Modal"] = "modal";
|
|
808
|
-
return ItemCrudView2;
|
|
809
|
-
})(ItemCrudView || {});
|
|
810
|
-
|
|
811
915
|
// src/enums/ModalCallbackAction.ts
|
|
812
916
|
var ModalCallbackAction = /* @__PURE__ */ ((ModalCallbackAction2) => {
|
|
813
917
|
ModalCallbackAction2["Refresh"] = "refresh";
|
|
@@ -825,14 +929,6 @@ var ModalType = /* @__PURE__ */ ((ModalType2) => {
|
|
|
825
929
|
return ModalType2;
|
|
826
930
|
})(ModalType || {});
|
|
827
931
|
|
|
828
|
-
// src/enums/SaveType.ts
|
|
829
|
-
var SaveType = /* @__PURE__ */ ((SaveType2) => {
|
|
830
|
-
SaveType2["Manual"] = "manual";
|
|
831
|
-
SaveType2["Auto"] = "auto";
|
|
832
|
-
SaveType2["Delay"] = "delay";
|
|
833
|
-
return SaveType2;
|
|
834
|
-
})(SaveType || {});
|
|
835
|
-
|
|
836
932
|
// src/enums/SortDirection.ts
|
|
837
933
|
var SortDirection = /* @__PURE__ */ ((SortDirection2) => {
|
|
838
934
|
SortDirection2["Asc"] = "asc";
|
|
@@ -847,6 +943,7 @@ var TablePermission = /* @__PURE__ */ ((TablePermission2) => {
|
|
|
847
943
|
TablePermission2["Edit"] = "edit";
|
|
848
944
|
TablePermission2["Drop"] = "drop";
|
|
849
945
|
TablePermission2["Sort"] = "sort";
|
|
946
|
+
TablePermission2["SwitchEditMode"] = "switch-edit-mode";
|
|
850
947
|
TablePermission2["InlineEdit"] = "inline-edit";
|
|
851
948
|
TablePermission2["InlineCreate"] = "inline-create";
|
|
852
949
|
TablePermission2["ModalCreate"] = "modal-create";
|
|
@@ -877,6 +974,20 @@ var extractI18nValue = (needle) => {
|
|
|
877
974
|
return txt;
|
|
878
975
|
};
|
|
879
976
|
|
|
977
|
+
// src/functions/ensure-data-functions.ts
|
|
978
|
+
var ensureButtonConfig = (buttonConfig, settingsConfig) => {
|
|
979
|
+
if (typeof buttonConfig === "undefined") return settingsConfig;
|
|
980
|
+
return {
|
|
981
|
+
...settingsConfig,
|
|
982
|
+
...buttonConfig
|
|
983
|
+
};
|
|
984
|
+
};
|
|
985
|
+
|
|
986
|
+
// src/functions/debug-functions.ts
|
|
987
|
+
var lktDebug = (component, ...args) => {
|
|
988
|
+
if (LktSettings.debugEnabled) console.info("::lkt::", `[${component}] `, ...args);
|
|
989
|
+
};
|
|
990
|
+
|
|
880
991
|
// src/index.ts
|
|
881
992
|
function getDefaultValues(cls) {
|
|
882
993
|
const instance = new cls();
|
|
@@ -901,9 +1012,10 @@ export {
|
|
|
901
1012
|
Field,
|
|
902
1013
|
FieldAutoValidationTrigger,
|
|
903
1014
|
FieldType,
|
|
1015
|
+
ItemCrud,
|
|
904
1016
|
ItemCrudButtonNavPosition,
|
|
905
1017
|
ItemCrudButtonNavVisibility,
|
|
906
|
-
|
|
1018
|
+
ItemCrudMode,
|
|
907
1019
|
ItemCrudView,
|
|
908
1020
|
LktItem,
|
|
909
1021
|
LktSettings,
|
|
@@ -927,7 +1039,9 @@ export {
|
|
|
927
1039
|
TooltipLocationX,
|
|
928
1040
|
TooltipLocationY,
|
|
929
1041
|
TooltipPositionEngine,
|
|
1042
|
+
ensureButtonConfig,
|
|
930
1043
|
extractI18nValue,
|
|
931
1044
|
extractPropValue,
|
|
932
|
-
getDefaultValues
|
|
1045
|
+
getDefaultValues,
|
|
1046
|
+
lktDebug
|
|
933
1047
|
};
|