lkt-vue-kernel 1.0.8 → 1.0.10

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,4 +1,5 @@
1
- import { VueElement } from 'vue';
1
+ import { DataState } from 'lkt-data-state';
2
+ import { VueElement, Component } from 'vue';
2
3
  import { RouteLocationRaw } from 'vue-router';
3
4
 
4
5
  interface LktObject {
@@ -163,6 +164,11 @@ interface FieldConfig {
163
164
  prop?: LktObject;
164
165
  }
165
166
 
167
+ interface IsDisabledCheckerArgs {
168
+ value?: any;
169
+ dataState?: DataState;
170
+ }
171
+
166
172
  declare enum ModalCallbackAction {
167
173
  Refresh = "refresh",
168
174
  Close = "close",
@@ -212,11 +218,6 @@ declare const enum ButtonType {
212
218
  TooltipEver = "tooltip-ever"
213
219
  }
214
220
 
215
- declare enum ToggleMode {
216
- Lazy = "lazy",
217
- Ever = "ever"
218
- }
219
-
220
221
  declare enum AnchorType {
221
222
  Href = "href",// Vanilla JS+HTML anchor
222
223
  RouterLink = "router-link",// For vue-router integration
@@ -268,6 +269,10 @@ declare enum TooltipPositionEngine {
268
269
  Absolute = "absolute"
269
270
  }
270
271
 
272
+ type IsDisabledChecker = ((args?: IsDisabledCheckerArgs) => boolean);
273
+
274
+ type ValidIsDisabledValue = boolean | undefined | IsDisabledChecker;
275
+
271
276
  interface ButtonConfig {
272
277
  type?: ButtonType;
273
278
  checked?: boolean;
@@ -279,7 +284,7 @@ interface ButtonConfig {
279
284
  containerClass?: string;
280
285
  palette?: string;
281
286
  value?: string;
282
- disabled?: boolean;
287
+ disabled?: ValidIsDisabledValue;
283
288
  loading?: boolean;
284
289
  wrapContent?: boolean;
285
290
  anchor?: AnchorConfig | Anchor;
@@ -294,9 +299,7 @@ interface ButtonConfig {
294
299
  iconDot?: boolean | string | number;
295
300
  iconEnd?: string;
296
301
  img?: string;
297
- split?: boolean | ToggleMode;
298
302
  splitIcon?: string;
299
- tooltip?: boolean | ToggleMode;
300
303
  tooltipEngine?: TooltipPositionEngine;
301
304
  showTooltipOnHover?: boolean;
302
305
  showTooltipOnHoverDelay?: number;
@@ -311,6 +314,7 @@ interface ButtonConfig {
311
314
  tabindex?: ValidTabIndex;
312
315
  prop?: LktObject;
313
316
  onClick?: Function | undefined;
317
+ onConfirm?: Function | undefined;
314
318
  }
315
319
 
316
320
  interface ModalConfig extends LktObject {
@@ -345,12 +349,13 @@ declare enum PaginatorType {
345
349
  }
346
350
 
347
351
  interface PaginatorConfig {
348
- type: PaginatorType;
349
- modelValue: number;
350
- class: string;
351
- resource: string;
352
- readOnly: boolean;
353
- filters: LktObject;
352
+ type?: PaginatorType;
353
+ modelValue?: number;
354
+ class?: string;
355
+ resource?: string;
356
+ readOnly?: boolean;
357
+ loading?: boolean;
358
+ filters?: LktObject;
354
359
  }
355
360
 
356
361
  declare enum TooltipLocationY {
@@ -387,8 +392,10 @@ interface TooltipConfig {
387
392
  type ValidDrag = boolean | ((item: LktObject) => boolean);
388
393
 
389
394
  interface DragConfig {
395
+ enabled: boolean;
390
396
  isDraggable?: ValidDrag;
391
397
  isValid?: ValidDrag;
398
+ isDisabled?: boolean | Function;
392
399
  canRender?: boolean | Function;
393
400
  dragKey?: string;
394
401
  }
@@ -510,10 +517,9 @@ declare class Button extends LktItem implements ButtonConfig {
510
517
  class: string;
511
518
  containerClass: string;
512
519
  value: string;
513
- disabled: boolean;
520
+ disabled: ValidIsDisabledValue;
514
521
  loading: boolean;
515
522
  wrapContent: boolean;
516
- split: boolean;
517
523
  splitIcon: string;
518
524
  resource: string;
519
525
  resourceData: LktObject;
@@ -528,7 +534,6 @@ declare class Button extends LktItem implements ButtonConfig {
528
534
  iconDot: boolean;
529
535
  iconEnd: string;
530
536
  img: string;
531
- tooltip: boolean;
532
537
  showTooltipOnHoverDelay: number;
533
538
  tooltipWindowMargin: number;
534
539
  tooltipReferrerMargin: number;
@@ -546,6 +551,7 @@ declare class Button extends LktItem implements ButtonConfig {
546
551
  splitClass?: string;
547
552
  prop?: LktObject;
548
553
  onClick?: Function | undefined;
554
+ onConfirm?: Function | undefined;
549
555
  constructor(data?: Partial<ButtonConfig>);
550
556
  }
551
557
 
@@ -634,6 +640,10 @@ declare enum TableRowType {
634
640
 
635
641
  type ValidTableRowTypeValue = TableRowType | ((...args: any[]) => TableRowType) | undefined;
636
642
 
643
+ type ValidDragConfig = DragConfig | undefined;
644
+
645
+ type ValidPaginatorConfig = PaginatorConfig | undefined;
646
+
637
647
  interface TableConfig {
638
648
  modelValue: LktObject[];
639
649
  type?: TableType;
@@ -652,11 +662,8 @@ interface TableConfig {
652
662
  sortable?: boolean;
653
663
  sorter?: Function;
654
664
  initialSorting?: boolean;
655
- draggableChecker?: Function;
656
- checkValidDrag?: Function;
657
- renderDrag?: boolean | Function;
658
- disabledDrag?: boolean | Function;
659
- draggableItemKey?: string;
665
+ drag?: ValidDragConfig;
666
+ paginator?: ValidPaginatorConfig;
660
667
  header?: HeaderConfig;
661
668
  title?: string;
662
669
  titleTag?: string;
@@ -665,40 +672,29 @@ interface TableConfig {
665
672
  saveButton?: ButtonConfig;
666
673
  createButton?: ButtonConfig;
667
674
  dropButton?: ButtonConfig;
675
+ hiddenSave?: boolean;
668
676
  wrapContentTag?: string;
669
677
  wrapContentClass?: string;
670
678
  itemsContainerClass?: string;
671
- hiddenSave?: boolean;
672
- saveDisabled?: boolean;
673
- saveValidator?: Function;
674
- saveConfirm?: string;
675
- confirmData?: LktObject;
676
- saveResource?: string;
677
- saveResourceData?: LktObject;
678
- saveTooltipEngine?: string;
679
- splitSave?: boolean;
680
- saveText?: string;
681
679
  createText?: string;
682
680
  createIcon?: string;
683
681
  createRoute?: string;
682
+ createDisabled?: boolean;
683
+ createEnabledValidator?: Function;
684
684
  dropText?: string;
685
685
  dropIcon?: string;
686
+ dropConfirm?: string;
687
+ dropResource?: string;
686
688
  editText?: string;
687
689
  editIcon?: string;
688
690
  editLink?: string;
689
691
  editModeText?: string;
690
692
  switchEditionEnabled?: boolean;
691
- createDisabled?: boolean;
692
- dropConfirm?: string;
693
- dropResource?: string;
694
693
  addNavigation?: boolean;
695
- createEnabledValidator?: Function;
696
694
  newValueGenerator?: Function;
697
695
  requiredItemsForTopCreate?: number;
698
696
  requiredItemsForBottomCreate?: number;
699
697
  slotItemVar?: string;
700
- modal?: string;
701
- modalData?: LktObject;
702
698
  }
703
699
 
704
700
  declare class LktStrictItem extends LktItem {
@@ -749,12 +745,13 @@ declare class Modal extends LktItem implements ModalConfig {
749
745
  declare class Paginator extends LktItem implements PaginatorConfig {
750
746
  static lktAllowUndefinedProps: string[];
751
747
  static lktDefaultValues: (keyof PaginatorConfig)[];
752
- type: PaginatorType;
753
- modelValue: number;
754
- class: string;
755
- resource: string;
756
- readOnly: boolean;
757
- filters: LktObject;
748
+ type?: PaginatorType;
749
+ modelValue?: number;
750
+ class?: string;
751
+ resource?: string;
752
+ readOnly?: boolean;
753
+ loading?: boolean;
754
+ filters?: LktObject;
758
755
  constructor(data?: Partial<PaginatorConfig>);
759
756
  }
760
757
 
@@ -777,11 +774,8 @@ declare class Table extends LktItem implements TableConfig {
777
774
  sortable?: boolean;
778
775
  sorter?: Function;
779
776
  initialSorting?: boolean;
780
- draggableChecker?: Function;
781
- checkValidDrag?: Function;
782
- renderDrag?: boolean | Function;
783
- disabledDrag?: boolean | Function;
784
- draggableItemKey?: string;
777
+ drag?: ValidDragConfig;
778
+ paginator?: ValidPaginatorConfig;
785
779
  header?: HeaderConfig;
786
780
  title?: string;
787
781
  titleTag?: string;
@@ -790,19 +784,10 @@ declare class Table extends LktItem implements TableConfig {
790
784
  saveButton?: ButtonConfig;
791
785
  createButton?: ButtonConfig;
792
786
  dropButton?: ButtonConfig;
787
+ hiddenSave?: boolean;
793
788
  wrapContentTag?: string;
794
789
  wrapContentClass?: string;
795
790
  itemsContainerClass?: string;
796
- hiddenSave?: boolean;
797
- saveDisabled?: boolean;
798
- saveValidator?: Function;
799
- saveConfirm?: string;
800
- confirmData?: LktObject;
801
- saveResource?: string;
802
- saveResourceData?: LktObject;
803
- saveTooltipEngine?: string;
804
- splitSave?: boolean;
805
- saveText?: string;
806
791
  createText?: string;
807
792
  createIcon?: string;
808
793
  createRoute?: string;
@@ -822,8 +807,6 @@ declare class Table extends LktItem implements TableConfig {
822
807
  requiredItemsForTopCreate?: number;
823
808
  requiredItemsForBottomCreate?: number;
824
809
  slotItemVar?: string;
825
- modal?: string;
826
- modalData?: LktObject;
827
810
  constructor(data?: Partial<TableConfig>);
828
811
  }
829
812
 
@@ -832,11 +815,19 @@ declare enum SortDirection {
832
815
  Desc = "desc"
833
816
  }
834
817
 
818
+ declare enum ToggleMode {
819
+ Lazy = "lazy",
820
+ Ever = "ever"
821
+ }
822
+
835
823
  type ScanPropTarget = string | number | undefined | Function;
836
824
 
825
+ type ValidCustomSlot = string | Component | undefined;
826
+
837
827
  type ValidScanPropTarget = ScanPropTarget | ((...args: any[]) => ScanPropTarget);
838
828
 
839
829
  declare const extractPropValue: (needle: ValidScanPropTarget, haystack: LktObject) => ValidScanPropTarget;
830
+ declare const extractI18nValue: (needle: string) => any;
840
831
 
841
832
  /**
842
833
  * Export common interfaces
@@ -847,4 +838,4 @@ declare function getDefaultValues<T>(cls: {
847
838
  lktDefaultValues: (keyof T)[];
848
839
  }): Partial<T>;
849
840
 
850
- 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, Paginator, type PaginatorConfig, PaginatorType, 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 };
841
+ 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, LktItem, type LktObject, LktStrictItem, Modal, ModalCallbackAction, type ModalCallbackConfig, type ModalConfig, ModalType, MultipleOptionsDisplay, Option, type OptionConfig, Paginator, type PaginatorConfig, PaginatorType, SafeString, 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, extractI18nValue, extractPropValue, getDefaultValues };
package/dist/index.js CHANGED
@@ -328,7 +328,6 @@ var Button = class extends LktItem {
328
328
  "disabled",
329
329
  "loading",
330
330
  "wrapContent",
331
- "split",
332
331
  "splitIcon",
333
332
  "resource",
334
333
  "resourceData",
@@ -343,7 +342,6 @@ var Button = class extends LktItem {
343
342
  "iconDot",
344
343
  "iconEnd",
345
344
  "img",
346
- "tooltip",
347
345
  "showTooltipOnHoverDelay",
348
346
  "tooltipWindowMargin",
349
347
  "tooltipReferrerMargin",
@@ -360,7 +358,8 @@ var Button = class extends LktItem {
360
358
  "tooltipClass",
361
359
  "splitClass",
362
360
  "prop",
363
- "onClick"
361
+ "onClick",
362
+ "onConfirm"
364
363
  ];
365
364
  type = "button" /* Button */;
366
365
  name = generateRandomString2(10);
@@ -371,7 +370,6 @@ var Button = class extends LktItem {
371
370
  disabled = false;
372
371
  loading = false;
373
372
  wrapContent = false;
374
- split = false;
375
373
  splitIcon = "";
376
374
  resource = "";
377
375
  resourceData = {};
@@ -386,7 +384,6 @@ var Button = class extends LktItem {
386
384
  iconDot = false;
387
385
  iconEnd = "";
388
386
  img = "";
389
- tooltip = false;
390
387
  showTooltipOnHoverDelay = 0;
391
388
  tooltipWindowMargin = 0;
392
389
  tooltipReferrerMargin = 0;
@@ -405,6 +402,7 @@ var Button = class extends LktItem {
405
402
  prop = {};
406
403
  // Event management
407
404
  onClick = void 0;
405
+ onConfirm = void 0;
408
406
  constructor(data = {}) {
409
407
  super();
410
408
  this.feed(data);
@@ -610,6 +608,7 @@ var Paginator = class extends LktItem {
610
608
  "class",
611
609
  "resource",
612
610
  "readOnly",
611
+ "loading",
613
612
  "filters"
614
613
  ];
615
614
  type = "pages-prev-next" /* PagesPrevNext */;
@@ -617,6 +616,7 @@ var Paginator = class extends LktItem {
617
616
  class = "";
618
617
  resource = "";
619
618
  readOnly = false;
619
+ loading = false;
620
620
  filters = {};
621
621
  constructor(data = {}) {
622
622
  super();
@@ -661,11 +661,8 @@ var Table = class extends LktItem {
661
661
  "sortable",
662
662
  "sorter",
663
663
  "initialSorting",
664
- "draggableChecker",
665
- "checkValidDrag",
666
- "renderDrag",
667
- "disabledDrag",
668
- "draggableItemKey",
664
+ "drag",
665
+ "paginator",
669
666
  "header",
670
667
  "title",
671
668
  "titleTag",
@@ -678,15 +675,6 @@ var Table = class extends LktItem {
678
675
  "wrapContentClass",
679
676
  "itemsContainerClass",
680
677
  "hiddenSave",
681
- "saveDisabled",
682
- "saveValidator",
683
- "saveConfirm",
684
- "confirmData",
685
- "saveResource",
686
- "saveResourceData",
687
- "saveTooltipEngine",
688
- "splitSave",
689
- "saveText",
690
678
  "createText",
691
679
  "createIcon",
692
680
  "createRoute",
@@ -705,9 +693,7 @@ var Table = class extends LktItem {
705
693
  "newValueGenerator",
706
694
  "requiredItemsForTopCreate",
707
695
  "requiredItemsForBottomCreate",
708
- "slotItemVar",
709
- "modal",
710
- "modalData"
696
+ "slotItemVar"
711
697
  ];
712
698
  // Data
713
699
  modelValue = [];
@@ -730,12 +716,10 @@ var Table = class extends LktItem {
730
716
  sortable = false;
731
717
  sorter = void 0;
732
718
  initialSorting = false;
733
- // Drag (Old)
734
- draggableChecker;
735
- checkValidDrag;
736
- renderDrag;
737
- disabledDrag;
738
- draggableItemKey;
719
+ // Drag
720
+ drag = void 0;
721
+ // Pagination
722
+ paginator = void 0;
739
723
  // New proposed prop: header
740
724
  header;
741
725
  // Replaces:
@@ -743,23 +727,14 @@ var Table = class extends LktItem {
743
727
  titleTag = "h2";
744
728
  titleIcon = "";
745
729
  headerClass = "";
746
- // New proposed prop: saveButton
730
+ // Buttons
747
731
  saveButton = {};
748
732
  createButton = {};
749
733
  dropButton = {};
734
+ hiddenSave = false;
750
735
  wrapContentTag = "div";
751
736
  wrapContentClass = "";
752
737
  itemsContainerClass = "";
753
- hiddenSave = false;
754
- saveDisabled = false;
755
- saveValidator = void 0;
756
- saveConfirm = "";
757
- confirmData = {};
758
- saveResource = "";
759
- saveResourceData = {};
760
- saveTooltipEngine = "absolute" /* Absolute */;
761
- splitSave = false;
762
- saveText = "";
763
738
  createText = "";
764
739
  createIcon = "";
765
740
  createRoute = "";
@@ -779,8 +754,6 @@ var Table = class extends LktItem {
779
754
  requiredItemsForTopCreate = 0;
780
755
  requiredItemsForBottomCreate = 0;
781
756
  slotItemVar = "item";
782
- modal = "";
783
- modalData = {};
784
757
  constructor(data = {}) {
785
758
  super();
786
759
  this.feed(data);
@@ -833,12 +806,19 @@ var ToggleMode = /* @__PURE__ */ ((ToggleMode2) => {
833
806
  })(ToggleMode || {});
834
807
 
835
808
  // src/functions/extract-data-functions.ts
809
+ import { __ } from "lkt-i18n";
836
810
  var extractPropValue = (needle, haystack) => {
837
811
  if (typeof needle === "string" && needle.startsWith("prop:")) {
838
812
  return haystack[needle.substring(5)];
839
813
  }
840
814
  return needle;
841
815
  };
816
+ var extractI18nValue = (needle) => {
817
+ if (needle.startsWith("__:")) {
818
+ return __(needle.substring(3));
819
+ }
820
+ return needle;
821
+ };
842
822
 
843
823
  // src/index.ts
844
824
  function getDefaultValues(cls) {
@@ -884,6 +864,7 @@ export {
884
864
  TooltipLocationX,
885
865
  TooltipLocationY,
886
866
  TooltipPositionEngine,
867
+ extractI18nValue,
887
868
  extractPropValue,
888
869
  getDefaultValues
889
870
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lkt-vue-kernel",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "LKT Vue Kernel",
5
5
  "keywords": [
6
6
  "lkt",
@@ -35,6 +35,8 @@
35
35
  "node": ">=18"
36
36
  },
37
37
  "dependencies": {
38
+ "lkt-data-state": "^1.0.10",
39
+ "lkt-i18n": "^1.0.6",
38
40
  "lkt-string-tools": "^1.0.8",
39
41
  "vue": "^3.5.13",
40
42
  "vue-router": "^4.5.0"