lkt-vue-kernel 1.0.5 → 1.0.7

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 CHANGED
@@ -1,5 +1,5 @@
1
- import { RouteLocationRaw } from 'vue-router';
2
1
  import { VueElement } from 'vue';
2
+ import { RouteLocationRaw } from 'vue-router';
3
3
 
4
4
  interface LktObject {
5
5
  [key: string | number]: any;
@@ -158,68 +158,63 @@ interface FieldConfig {
158
158
  modal?: string | Function;
159
159
  modalKey?: string | number | Function;
160
160
  modalData?: LktObject;
161
- prop?: LktObject;
162
161
  itemType?: string;
163
162
  optionValueType?: string;
163
+ prop?: LktObject;
164
+ }
165
+
166
+ declare enum ModalCallbackAction {
167
+ Refresh = "refresh",
168
+ Close = "close",
169
+ ReOpen = "reOpen",
170
+ Exec = "exec",
171
+ Open = "open"
164
172
  }
165
173
 
166
174
  type EmptyModalKey = '_';
167
175
 
168
176
  type ValidModalKey = string | Function | EmptyModalKey;
169
177
 
170
- interface ModalConfig extends LktObject {
171
- size?: string;
172
- preTitle?: string;
173
- preTitleIcon?: string;
174
- title?: string;
175
- closeIcon?: string;
176
- closeConfirm?: ValidModalName;
177
- closeConfirmKey?: ValidModalKey;
178
- showClose?: boolean;
179
- disabledClose?: boolean;
180
- disabledVeilClick?: boolean;
181
- hiddenFooter?: boolean;
182
- modalName?: ValidModalName;
178
+ interface ModalCallbackConfig {
179
+ modalName: ValidModalName;
183
180
  modalKey?: ValidModalKey;
184
- zIndex?: number;
185
- beforeClose?: Function | undefined;
186
- item?: LktObject;
181
+ action: ModalCallbackAction;
182
+ method?: string;
183
+ args?: LktObject;
187
184
  }
188
185
 
189
- declare enum TooltipLocationY {
190
- Top = "top",
191
- Bottom = "bottom",
192
- Center = "center",
193
- ReferrerCenter = "referrer-center"
194
- }
186
+ type BeforeCloseModalData = {
187
+ modalName: ValidModalKey;
188
+ modalKey: ValidModalKey;
189
+ item?: LktObject;
190
+ };
195
191
 
196
- declare enum TooltipLocationX {
197
- Left = "left",
198
- Right = "right",
199
- Center = "center",
200
- LeftCorner = "left-corner",
201
- RightCorner = "right-corner"
192
+ type ValidBeforeCloseModal = Function | undefined | ((data: BeforeCloseModalData) => void);
193
+
194
+ declare enum ModalType {
195
+ Modal = "modal",
196
+ Confirm = "confirm"
202
197
  }
203
198
 
204
- declare enum TooltipPositionEngine {
205
- Fixed = "fixed",
206
- Absolute = "absolute"
199
+ declare const enum ButtonType {
200
+ Button = "button",// Default
201
+ Submit = "submit",// Form submit
202
+ Reset = "reset",
203
+ Anchor = "anchor",// Turns on anchor mode
204
+ Content = "content",// No click event
205
+ Switch = "switch",// Has a visible boolean state
206
+ HiddenSwitch = "hidden-switch",// Has a hidden boolean state
207
+ Split = "split",// Split button, content always generated
208
+ SplitLazy = "split-lazy",// Split button, contents generated after first open
209
+ SplitEver = "split-ever",// Split button, contents generated each time it's clicked
210
+ Tooltip = "tooltip",// Tooltip button, content always generated
211
+ TooltipLazy = "tooltip-lazy",// Tooltip button, contents generated after first open
212
+ TooltipEver = "tooltip-ever"
207
213
  }
208
214
 
209
- interface TooltipConfig {
210
- modelValue?: boolean;
211
- alwaysOpen?: boolean;
212
- class?: string;
213
- text?: string;
214
- icon?: string;
215
- iconAtEnd?: boolean;
216
- engine?: TooltipPositionEngine;
217
- referrerMargin?: number | string;
218
- windowMargin?: number | string;
219
- referrerWidth?: boolean;
220
- referrer?: HTMLElement | undefined;
221
- locationY?: TooltipLocationY;
222
- locationX?: TooltipLocationX;
215
+ declare enum ToggleMode {
216
+ Lazy = "lazy",
217
+ Ever = "ever"
223
218
  }
224
219
 
225
220
  declare enum AnchorType {
@@ -249,36 +244,6 @@ interface AnchorConfig {
249
244
  external?: boolean;
250
245
  }
251
246
 
252
- type ValidDrag = boolean | ((item: LktObject) => boolean);
253
-
254
- interface DragConfig {
255
- isDraggable?: ValidDrag;
256
- isValid?: ValidDrag;
257
- canRender?: boolean | Function;
258
- dragKey?: string;
259
- }
260
-
261
- declare const enum ButtonType {
262
- Button = "button",// Default
263
- Submit = "submit",// Form submit
264
- Reset = "reset",
265
- Anchor = "anchor",// Turns on anchor mode
266
- Content = "content",// No click event
267
- Switch = "switch",// Has a visible boolean state
268
- HiddenSwitch = "hidden-switch",// Has a hidden boolean state
269
- Split = "split",// Split button, content always generated
270
- SplitLazy = "split-lazy",// Split button, contents generated after first open
271
- SplitEver = "split-ever",// Split button, contents generated each time it's clicked
272
- Tooltip = "tooltip",// Tooltip button, content always generated
273
- TooltipLazy = "tooltip-lazy",// Tooltip button, contents generated after first open
274
- TooltipEver = "tooltip-ever"
275
- }
276
-
277
- declare enum ToggleMode {
278
- Lazy = "lazy",
279
- Ever = "ever"
280
- }
281
-
282
247
  declare class Anchor extends LktItem implements AnchorConfig {
283
248
  static lktAllowUndefinedProps: string[];
284
249
  static lktDefaultValues: (keyof AnchorConfig)[];
@@ -298,6 +263,11 @@ declare class Anchor extends LktItem implements AnchorConfig {
298
263
  constructor(data?: Partial<AnchorConfig>);
299
264
  }
300
265
 
266
+ declare enum TooltipPositionEngine {
267
+ Fixed = "fixed",
268
+ Absolute = "absolute"
269
+ }
270
+
301
271
  interface ButtonConfig {
302
272
  type?: ButtonType;
303
273
  checked?: boolean;
@@ -317,10 +287,10 @@ interface ButtonConfig {
317
287
  resourceData?: LktObject;
318
288
  modal?: ValidModalName;
319
289
  modalKey?: ValidModalKey;
320
- modalData?: ModalConfig;
290
+ modalData?: Partial<ModalConfig>;
321
291
  confirmModal?: ValidModalName;
322
292
  confirmModalKey?: ValidModalKey;
323
- confirmData?: ModalConfig;
293
+ confirmData?: Partial<ModalConfig>;
324
294
  iconDot?: boolean | string | number;
325
295
  iconEnd?: string;
326
296
  img?: string;
@@ -339,6 +309,70 @@ interface ButtonConfig {
339
309
  splitClass?: string;
340
310
  clickRef?: Element | VueElement;
341
311
  tabindex?: ValidTabIndex;
312
+ prop?: LktObject;
313
+ onClick?: Function | undefined;
314
+ }
315
+
316
+ interface ModalConfig extends LktObject {
317
+ type?: ModalType;
318
+ size?: string;
319
+ preTitle?: string;
320
+ preTitleIcon?: string;
321
+ title?: string;
322
+ closeIcon?: string;
323
+ closeConfirm?: ValidModalName;
324
+ closeConfirmKey?: ValidModalKey;
325
+ showClose?: boolean;
326
+ disabledClose?: boolean;
327
+ disabledVeilClick?: boolean;
328
+ hiddenFooter?: boolean;
329
+ modalName?: ValidModalName;
330
+ modalKey?: ValidModalKey;
331
+ zIndex?: number;
332
+ beforeClose?: ValidBeforeCloseModal;
333
+ item?: LktObject;
334
+ confirmButton?: Partial<ButtonConfig>;
335
+ cancelButton?: Partial<ButtonConfig>;
336
+ }
337
+
338
+ declare enum TooltipLocationY {
339
+ Top = "top",
340
+ Bottom = "bottom",
341
+ Center = "center",
342
+ ReferrerCenter = "referrer-center"
343
+ }
344
+
345
+ declare enum TooltipLocationX {
346
+ Left = "left",
347
+ Right = "right",
348
+ Center = "center",
349
+ LeftCorner = "left-corner",
350
+ RightCorner = "right-corner"
351
+ }
352
+
353
+ interface TooltipConfig {
354
+ modelValue?: boolean;
355
+ alwaysOpen?: boolean;
356
+ class?: string;
357
+ text?: string;
358
+ icon?: string;
359
+ iconAtEnd?: boolean;
360
+ engine?: TooltipPositionEngine;
361
+ referrerMargin?: number | string;
362
+ windowMargin?: number | string;
363
+ referrerWidth?: boolean;
364
+ referrer?: HTMLElement | undefined;
365
+ locationY?: TooltipLocationY;
366
+ locationX?: TooltipLocationX;
367
+ }
368
+
369
+ type ValidDrag = boolean | ((item: LktObject) => boolean);
370
+
371
+ interface DragConfig {
372
+ isDraggable?: ValidDrag;
373
+ isValid?: ValidDrag;
374
+ canRender?: boolean | Function;
375
+ dragKey?: string;
342
376
  }
343
377
 
344
378
  declare enum ColumnType {
@@ -467,10 +501,10 @@ declare class Button extends LktItem implements ButtonConfig {
467
501
  resourceData: LktObject;
468
502
  modal: ValidModalName;
469
503
  modalKey: ValidModalKey;
470
- modalData: ModalConfig;
504
+ modalData: Partial<ModalConfig>;
471
505
  confirmModal: ValidModalName;
472
506
  confirmModalKey: ValidModalKey;
473
- confirmData: ModalConfig;
507
+ confirmData: Partial<ModalConfig>;
474
508
  text: string;
475
509
  icon: string;
476
510
  iconDot: boolean;
@@ -492,6 +526,8 @@ declare class Button extends LktItem implements ButtonConfig {
492
526
  hideTooltipOnLeave?: boolean;
493
527
  tooltipClass?: string;
494
528
  splitClass?: string;
529
+ prop?: LktObject;
530
+ onClick?: Function | undefined;
495
531
  constructor(data?: Partial<ButtonConfig>);
496
532
  }
497
533
 
@@ -571,6 +607,15 @@ interface HeaderConfig {
571
607
  icon?: string;
572
608
  }
573
609
 
610
+ declare enum TableRowType {
611
+ Auto = 0,
612
+ PreferItem = 1,
613
+ PreferCustomItem = 2,
614
+ PreferColumns = 3
615
+ }
616
+
617
+ type ValidTableRowTypeValue = TableRowType | ((...args: any[]) => TableRowType) | undefined;
618
+
574
619
  interface TableConfig {
575
620
  modelValue: LktObject[];
576
621
  type?: TableType;
@@ -580,6 +625,7 @@ interface TableConfig {
580
625
  filters?: LktObject[];
581
626
  hideEmptyColumns?: boolean;
582
627
  itemDisplayChecker?: Function;
628
+ rowDisplayType?: ValidTableRowTypeValue;
583
629
  loading?: boolean;
584
630
  page?: number;
585
631
  perms?: ValidTablePermission[];
@@ -676,8 +722,10 @@ declare class Modal extends LktItem implements ModalConfig {
676
722
  modalName: ValidModalName;
677
723
  modalKey: ValidModalKey;
678
724
  zIndex: number;
679
- beforeClose: Function | undefined;
725
+ beforeClose: ValidBeforeCloseModal;
680
726
  item: LktObject;
727
+ confirmButton?: Partial<ButtonConfig>;
728
+ cancelButton?: Partial<ButtonConfig>;
681
729
  constructor(data?: Partial<ModalConfig>);
682
730
  }
683
731
 
@@ -691,6 +739,7 @@ declare class Table extends LktItem implements TableConfig {
691
739
  filters?: LktObject[];
692
740
  hideEmptyColumns?: boolean;
693
741
  itemDisplayChecker?: Function;
742
+ rowDisplayType?: ValidTableRowTypeValue;
694
743
  loading?: boolean;
695
744
  page?: number;
696
745
  perms?: ValidTablePermission[];
@@ -749,16 +798,17 @@ declare class Table extends LktItem implements TableConfig {
749
798
  constructor(data?: Partial<TableConfig>);
750
799
  }
751
800
 
752
- declare enum ModalType {
753
- Modal = "modal",
754
- Confirm = "confirm"
755
- }
756
-
757
801
  declare enum SortDirection {
758
802
  Asc = "asc",
759
803
  Desc = "desc"
760
804
  }
761
805
 
806
+ type ScanPropTarget = string | number | undefined | Function;
807
+
808
+ type ValidScanPropTarget = ScanPropTarget | ((...args: any[]) => ScanPropTarget);
809
+
810
+ declare const extractPropValue: (needle: ValidScanPropTarget, haystack: LktObject) => ValidScanPropTarget;
811
+
762
812
  /**
763
813
  * Export common interfaces
764
814
  */
@@ -768,4 +818,4 @@ declare function getDefaultValues<T>(cls: {
768
818
  lktDefaultValues: (keyof T)[];
769
819
  }): Partial<T>;
770
820
 
771
- export { Anchor, type AnchorConfig, AnchorType, Button, type ButtonConfig, ButtonType, Column, type ColumnConfig, ColumnType, type DragConfig, type EmptyModalKey, Field, FieldAutoValidationTrigger, type FieldConfig, FieldType, LktItem, type LktObject, LktStrictItem, Modal, type ModalConfig, ModalType, MultipleOptionsDisplay, Option, type OptionConfig, SafeString, SortDirection, Table, type TableConfig, TablePermission, TableType, ToggleMode, Tooltip, type TooltipConfig, TooltipLocationX, TooltipLocationY, TooltipPositionEngine, type ValidColSpan, type ValidFieldMinMax, type ValidFieldValue, type ValidModalKey, type ValidModalName, type ValidOptionValue, type ValidSafeStringValue, type ValidTabIndex, getDefaultValues };
821
+ export { Anchor, type AnchorConfig, AnchorType, type BeforeCloseModalData, Button, type ButtonConfig, ButtonType, Column, type ColumnConfig, ColumnType, type DragConfig, type EmptyModalKey, Field, FieldAutoValidationTrigger, type FieldConfig, FieldType, LktItem, type LktObject, LktStrictItem, Modal, ModalCallbackAction, type ModalCallbackConfig, type ModalConfig, ModalType, MultipleOptionsDisplay, Option, type OptionConfig, SafeString, type ScanPropTarget, SortDirection, Table, type TableConfig, TablePermission, TableRowType, TableType, ToggleMode, Tooltip, type TooltipConfig, TooltipLocationX, TooltipLocationY, TooltipPositionEngine, type ValidBeforeCloseModal, type ValidColSpan, type ValidFieldMinMax, type ValidFieldValue, type ValidModalKey, type ValidModalName, type ValidOptionValue, type ValidSafeStringValue, type ValidScanPropTarget, type ValidTabIndex, type ValidTablePermission, type ValidTableRowTypeValue, extractPropValue, getDefaultValues };
package/dist/index.js CHANGED
@@ -358,7 +358,9 @@ var Button = class extends LktItem {
358
358
  "showTooltipOnHover",
359
359
  "hideTooltipOnLeave",
360
360
  "tooltipClass",
361
- "splitClass"
361
+ "splitClass",
362
+ "prop",
363
+ "onClick"
362
364
  ];
363
365
  type = "button" /* Button */;
364
366
  name = generateRandomString2(10);
@@ -400,6 +402,9 @@ var Button = class extends LktItem {
400
402
  hideTooltipOnLeave = void 0;
401
403
  tooltipClass = "";
402
404
  splitClass = "";
405
+ prop = {};
406
+ // Event management
407
+ onClick = void 0;
403
408
  constructor(data = {}) {
404
409
  super();
405
410
  this.feed(data);
@@ -577,6 +582,8 @@ var Modal = class extends LktItem {
577
582
  zIndex = 500;
578
583
  beforeClose = void 0;
579
584
  item = {};
585
+ confirmButton = {};
586
+ cancelButton = {};
580
587
  constructor(data = {}) {
581
588
  super();
582
589
  this.feed(data);
@@ -592,6 +599,15 @@ var TableType = /* @__PURE__ */ ((TableType2) => {
592
599
  return TableType2;
593
600
  })(TableType || {});
594
601
 
602
+ // src/enums/TableRowType.ts
603
+ var TableRowType = /* @__PURE__ */ ((TableRowType2) => {
604
+ TableRowType2[TableRowType2["Auto"] = 0] = "Auto";
605
+ TableRowType2[TableRowType2["PreferItem"] = 1] = "PreferItem";
606
+ TableRowType2[TableRowType2["PreferCustomItem"] = 2] = "PreferCustomItem";
607
+ TableRowType2[TableRowType2["PreferColumns"] = 3] = "PreferColumns";
608
+ return TableRowType2;
609
+ })(TableRowType || {});
610
+
595
611
  // src/instances/Table.ts
596
612
  var Table = class extends LktItem {
597
613
  static lktDefaultValues = [
@@ -669,6 +685,7 @@ var Table = class extends LktItem {
669
685
  // Data visualization
670
686
  hideEmptyColumns = false;
671
687
  itemDisplayChecker = void 0;
688
+ rowDisplayType = 0 /* Auto */;
672
689
  // State
673
690
  loading = false;
674
691
  page = 1;
@@ -736,6 +753,16 @@ var Table = class extends LktItem {
736
753
  }
737
754
  };
738
755
 
756
+ // src/enums/ModalCallbackAction.ts
757
+ var ModalCallbackAction = /* @__PURE__ */ ((ModalCallbackAction2) => {
758
+ ModalCallbackAction2["Refresh"] = "refresh";
759
+ ModalCallbackAction2["Close"] = "close";
760
+ ModalCallbackAction2["ReOpen"] = "reOpen";
761
+ ModalCallbackAction2["Exec"] = "exec";
762
+ ModalCallbackAction2["Open"] = "open";
763
+ return ModalCallbackAction2;
764
+ })(ModalCallbackAction || {});
765
+
739
766
  // src/enums/ModalType.ts
740
767
  var ModalType = /* @__PURE__ */ ((ModalType2) => {
741
768
  ModalType2["Modal"] = "modal";
@@ -771,6 +798,14 @@ var ToggleMode = /* @__PURE__ */ ((ToggleMode2) => {
771
798
  return ToggleMode2;
772
799
  })(ToggleMode || {});
773
800
 
801
+ // src/functions/extract-data-functions.ts
802
+ var extractPropValue = (needle, haystack) => {
803
+ if (typeof needle === "string" && needle.startsWith("prop:")) {
804
+ return haystack[needle.substring(5)];
805
+ }
806
+ return needle;
807
+ };
808
+
774
809
  // src/index.ts
775
810
  function getDefaultValues(cls) {
776
811
  const instance = new cls();
@@ -798,6 +833,7 @@ export {
798
833
  LktItem,
799
834
  LktStrictItem,
800
835
  Modal,
836
+ ModalCallbackAction,
801
837
  ModalType,
802
838
  MultipleOptionsDisplay,
803
839
  Option,
@@ -805,11 +841,13 @@ export {
805
841
  SortDirection,
806
842
  Table,
807
843
  TablePermission,
844
+ TableRowType,
808
845
  TableType,
809
846
  ToggleMode,
810
847
  Tooltip,
811
848
  TooltipLocationX,
812
849
  TooltipLocationY,
813
850
  TooltipPositionEngine,
851
+ extractPropValue,
814
852
  getDefaultValues
815
853
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lkt-vue-kernel",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "LKT Vue Kernel",
5
5
  "keywords": [
6
6
  "lkt",