lkt-vue-kernel 1.0.9 → 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,3 +1,4 @@
1
+ import { DataState } from 'lkt-data-state';
1
2
  import { VueElement, Component } from 'vue';
2
3
  import { RouteLocationRaw } from 'vue-router';
3
4
 
@@ -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 {
@@ -388,8 +392,10 @@ interface TooltipConfig {
388
392
  type ValidDrag = boolean | ((item: LktObject) => boolean);
389
393
 
390
394
  interface DragConfig {
395
+ enabled: boolean;
391
396
  isDraggable?: ValidDrag;
392
397
  isValid?: ValidDrag;
398
+ isDisabled?: boolean | Function;
393
399
  canRender?: boolean | Function;
394
400
  dragKey?: string;
395
401
  }
@@ -511,10 +517,9 @@ declare class Button extends LktItem implements ButtonConfig {
511
517
  class: string;
512
518
  containerClass: string;
513
519
  value: string;
514
- disabled: boolean;
520
+ disabled: ValidIsDisabledValue;
515
521
  loading: boolean;
516
522
  wrapContent: boolean;
517
- split: boolean;
518
523
  splitIcon: string;
519
524
  resource: string;
520
525
  resourceData: LktObject;
@@ -529,7 +534,6 @@ declare class Button extends LktItem implements ButtonConfig {
529
534
  iconDot: boolean;
530
535
  iconEnd: string;
531
536
  img: string;
532
- tooltip: boolean;
533
537
  showTooltipOnHoverDelay: number;
534
538
  tooltipWindowMargin: number;
535
539
  tooltipReferrerMargin: number;
@@ -547,6 +551,7 @@ declare class Button extends LktItem implements ButtonConfig {
547
551
  splitClass?: string;
548
552
  prop?: LktObject;
549
553
  onClick?: Function | undefined;
554
+ onConfirm?: Function | undefined;
550
555
  constructor(data?: Partial<ButtonConfig>);
551
556
  }
552
557
 
@@ -635,6 +640,10 @@ declare enum TableRowType {
635
640
 
636
641
  type ValidTableRowTypeValue = TableRowType | ((...args: any[]) => TableRowType) | undefined;
637
642
 
643
+ type ValidDragConfig = DragConfig | undefined;
644
+
645
+ type ValidPaginatorConfig = PaginatorConfig | undefined;
646
+
638
647
  interface TableConfig {
639
648
  modelValue: LktObject[];
640
649
  type?: TableType;
@@ -653,11 +662,8 @@ interface TableConfig {
653
662
  sortable?: boolean;
654
663
  sorter?: Function;
655
664
  initialSorting?: boolean;
656
- draggableChecker?: Function;
657
- checkValidDrag?: Function;
658
- renderDrag?: boolean | Function;
659
- disabledDrag?: boolean | Function;
660
- draggableItemKey?: string;
665
+ drag?: ValidDragConfig;
666
+ paginator?: ValidPaginatorConfig;
661
667
  header?: HeaderConfig;
662
668
  title?: string;
663
669
  titleTag?: string;
@@ -666,40 +672,29 @@ interface TableConfig {
666
672
  saveButton?: ButtonConfig;
667
673
  createButton?: ButtonConfig;
668
674
  dropButton?: ButtonConfig;
675
+ hiddenSave?: boolean;
669
676
  wrapContentTag?: string;
670
677
  wrapContentClass?: string;
671
678
  itemsContainerClass?: string;
672
- hiddenSave?: boolean;
673
- saveDisabled?: boolean;
674
- saveValidator?: Function;
675
- saveConfirm?: string;
676
- confirmData?: LktObject;
677
- saveResource?: string;
678
- saveResourceData?: LktObject;
679
- saveTooltipEngine?: string;
680
- splitSave?: boolean;
681
- saveText?: string;
682
679
  createText?: string;
683
680
  createIcon?: string;
684
681
  createRoute?: string;
682
+ createDisabled?: boolean;
683
+ createEnabledValidator?: Function;
685
684
  dropText?: string;
686
685
  dropIcon?: string;
686
+ dropConfirm?: string;
687
+ dropResource?: string;
687
688
  editText?: string;
688
689
  editIcon?: string;
689
690
  editLink?: string;
690
691
  editModeText?: string;
691
692
  switchEditionEnabled?: boolean;
692
- createDisabled?: boolean;
693
- dropConfirm?: string;
694
- dropResource?: string;
695
693
  addNavigation?: boolean;
696
- createEnabledValidator?: Function;
697
694
  newValueGenerator?: Function;
698
695
  requiredItemsForTopCreate?: number;
699
696
  requiredItemsForBottomCreate?: number;
700
697
  slotItemVar?: string;
701
- modal?: string;
702
- modalData?: LktObject;
703
698
  }
704
699
 
705
700
  declare class LktStrictItem extends LktItem {
@@ -779,11 +774,8 @@ declare class Table extends LktItem implements TableConfig {
779
774
  sortable?: boolean;
780
775
  sorter?: Function;
781
776
  initialSorting?: boolean;
782
- draggableChecker?: Function;
783
- checkValidDrag?: Function;
784
- renderDrag?: boolean | Function;
785
- disabledDrag?: boolean | Function;
786
- draggableItemKey?: string;
777
+ drag?: ValidDragConfig;
778
+ paginator?: ValidPaginatorConfig;
787
779
  header?: HeaderConfig;
788
780
  title?: string;
789
781
  titleTag?: string;
@@ -792,19 +784,10 @@ declare class Table extends LktItem implements TableConfig {
792
784
  saveButton?: ButtonConfig;
793
785
  createButton?: ButtonConfig;
794
786
  dropButton?: ButtonConfig;
787
+ hiddenSave?: boolean;
795
788
  wrapContentTag?: string;
796
789
  wrapContentClass?: string;
797
790
  itemsContainerClass?: string;
798
- hiddenSave?: boolean;
799
- saveDisabled?: boolean;
800
- saveValidator?: Function;
801
- saveConfirm?: string;
802
- confirmData?: LktObject;
803
- saveResource?: string;
804
- saveResourceData?: LktObject;
805
- saveTooltipEngine?: string;
806
- splitSave?: boolean;
807
- saveText?: string;
808
791
  createText?: string;
809
792
  createIcon?: string;
810
793
  createRoute?: string;
@@ -824,8 +807,6 @@ declare class Table extends LktItem implements TableConfig {
824
807
  requiredItemsForTopCreate?: number;
825
808
  requiredItemsForBottomCreate?: number;
826
809
  slotItemVar?: string;
827
- modal?: string;
828
- modalData?: LktObject;
829
810
  constructor(data?: Partial<TableConfig>);
830
811
  }
831
812
 
@@ -834,6 +815,11 @@ declare enum SortDirection {
834
815
  Desc = "desc"
835
816
  }
836
817
 
818
+ declare enum ToggleMode {
819
+ Lazy = "lazy",
820
+ Ever = "ever"
821
+ }
822
+
837
823
  type ScanPropTarget = string | number | undefined | Function;
838
824
 
839
825
  type ValidCustomSlot = string | Component | undefined;
@@ -841,6 +827,7 @@ type ValidCustomSlot = string | Component | undefined;
841
827
  type ValidScanPropTarget = ScanPropTarget | ((...args: any[]) => ScanPropTarget);
842
828
 
843
829
  declare const extractPropValue: (needle: ValidScanPropTarget, haystack: LktObject) => ValidScanPropTarget;
830
+ declare const extractI18nValue: (needle: string) => any;
844
831
 
845
832
  /**
846
833
  * Export common interfaces
@@ -851,4 +838,4 @@ declare function getDefaultValues<T>(cls: {
851
838
  lktDefaultValues: (keyof T)[];
852
839
  }): Partial<T>;
853
840
 
854
- 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 ValidCustomSlot, 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);
@@ -663,11 +661,8 @@ var Table = class extends LktItem {
663
661
  "sortable",
664
662
  "sorter",
665
663
  "initialSorting",
666
- "draggableChecker",
667
- "checkValidDrag",
668
- "renderDrag",
669
- "disabledDrag",
670
- "draggableItemKey",
664
+ "drag",
665
+ "paginator",
671
666
  "header",
672
667
  "title",
673
668
  "titleTag",
@@ -680,15 +675,6 @@ var Table = class extends LktItem {
680
675
  "wrapContentClass",
681
676
  "itemsContainerClass",
682
677
  "hiddenSave",
683
- "saveDisabled",
684
- "saveValidator",
685
- "saveConfirm",
686
- "confirmData",
687
- "saveResource",
688
- "saveResourceData",
689
- "saveTooltipEngine",
690
- "splitSave",
691
- "saveText",
692
678
  "createText",
693
679
  "createIcon",
694
680
  "createRoute",
@@ -707,9 +693,7 @@ var Table = class extends LktItem {
707
693
  "newValueGenerator",
708
694
  "requiredItemsForTopCreate",
709
695
  "requiredItemsForBottomCreate",
710
- "slotItemVar",
711
- "modal",
712
- "modalData"
696
+ "slotItemVar"
713
697
  ];
714
698
  // Data
715
699
  modelValue = [];
@@ -732,12 +716,10 @@ var Table = class extends LktItem {
732
716
  sortable = false;
733
717
  sorter = void 0;
734
718
  initialSorting = false;
735
- // Drag (Old)
736
- draggableChecker;
737
- checkValidDrag;
738
- renderDrag;
739
- disabledDrag;
740
- draggableItemKey;
719
+ // Drag
720
+ drag = void 0;
721
+ // Pagination
722
+ paginator = void 0;
741
723
  // New proposed prop: header
742
724
  header;
743
725
  // Replaces:
@@ -745,23 +727,14 @@ var Table = class extends LktItem {
745
727
  titleTag = "h2";
746
728
  titleIcon = "";
747
729
  headerClass = "";
748
- // New proposed prop: saveButton
730
+ // Buttons
749
731
  saveButton = {};
750
732
  createButton = {};
751
733
  dropButton = {};
734
+ hiddenSave = false;
752
735
  wrapContentTag = "div";
753
736
  wrapContentClass = "";
754
737
  itemsContainerClass = "";
755
- hiddenSave = false;
756
- saveDisabled = false;
757
- saveValidator = void 0;
758
- saveConfirm = "";
759
- confirmData = {};
760
- saveResource = "";
761
- saveResourceData = {};
762
- saveTooltipEngine = "absolute" /* Absolute */;
763
- splitSave = false;
764
- saveText = "";
765
738
  createText = "";
766
739
  createIcon = "";
767
740
  createRoute = "";
@@ -781,8 +754,6 @@ var Table = class extends LktItem {
781
754
  requiredItemsForTopCreate = 0;
782
755
  requiredItemsForBottomCreate = 0;
783
756
  slotItemVar = "item";
784
- modal = "";
785
- modalData = {};
786
757
  constructor(data = {}) {
787
758
  super();
788
759
  this.feed(data);
@@ -835,12 +806,19 @@ var ToggleMode = /* @__PURE__ */ ((ToggleMode2) => {
835
806
  })(ToggleMode || {});
836
807
 
837
808
  // src/functions/extract-data-functions.ts
809
+ import { __ } from "lkt-i18n";
838
810
  var extractPropValue = (needle, haystack) => {
839
811
  if (typeof needle === "string" && needle.startsWith("prop:")) {
840
812
  return haystack[needle.substring(5)];
841
813
  }
842
814
  return needle;
843
815
  };
816
+ var extractI18nValue = (needle) => {
817
+ if (needle.startsWith("__:")) {
818
+ return __(needle.substring(3));
819
+ }
820
+ return needle;
821
+ };
844
822
 
845
823
  // src/index.ts
846
824
  function getDefaultValues(cls) {
@@ -886,6 +864,7 @@ export {
886
864
  TooltipLocationX,
887
865
  TooltipLocationY,
888
866
  TooltipPositionEngine,
867
+ extractI18nValue,
889
868
  extractPropValue,
890
869
  getDefaultValues
891
870
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lkt-vue-kernel",
3
- "version": "1.0.9",
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"