lkt-vue-kernel 1.0.3 → 1.0.4

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
@@ -40,10 +40,11 @@ interface OptionConfig {
40
40
  }
41
41
 
42
42
  declare class LktItem implements LktObject {
43
- lktAllowUndefinedProps: string[];
44
- lktExcludedProps: string[];
45
- lktDateProps: string[];
46
- lktStrictItem: boolean;
43
+ static lktAllowUndefinedProps: string[];
44
+ static lktExcludedProps: string[];
45
+ static lktDateProps: string[];
46
+ static lktStrictItem: boolean;
47
+ static lktDefaultValues: (keyof LktObject)[];
47
48
  constructor(data?: LktObject);
48
49
  feed(data?: LktObject, target?: this): void;
49
50
  assignProp(key: string, value: any): void;
@@ -172,16 +173,16 @@ interface ModalConfig extends LktObject {
172
173
  preTitleIcon?: string;
173
174
  title?: string;
174
175
  closeIcon?: string;
175
- closeConfirm?: string;
176
- closeConfirmKey?: string;
176
+ closeConfirm?: ValidModalName;
177
+ closeConfirmKey?: ValidModalKey;
177
178
  showClose?: boolean;
178
179
  disabledClose?: boolean;
179
180
  disabledVeilClick?: boolean;
180
181
  hiddenFooter?: boolean;
181
- modalName?: string;
182
+ modalName?: ValidModalName;
182
183
  modalKey?: ValidModalKey;
183
184
  zIndex?: number;
184
- beforeClose?: Function;
185
+ beforeClose?: Function | undefined;
185
186
  item?: LktObject;
186
187
  }
187
188
 
@@ -216,7 +217,7 @@ interface TooltipConfig {
216
217
  referrerMargin?: number | string;
217
218
  windowMargin?: number | string;
218
219
  referrerWidth?: boolean;
219
- referrer: HTMLElement;
220
+ referrer?: HTMLElement | undefined;
220
221
  locationY?: TooltipLocationY;
221
222
  locationX?: TooltipLocationX;
222
223
  }
@@ -276,7 +277,8 @@ declare enum ToggleMode {
276
277
  }
277
278
 
278
279
  declare class Anchor extends LktItem implements AnchorConfig {
279
- lktAllowUndefinedProps: string[];
280
+ static lktAllowUndefinedProps: string[];
281
+ static lktDefaultValues: (keyof AnchorConfig)[];
280
282
  type: AnchorType;
281
283
  to?: RouteLocationRaw | string;
282
284
  class: string;
@@ -553,6 +555,45 @@ declare class Column extends LktItem implements ColumnConfig {
553
555
  doAction(item: LktObject): any;
554
556
  }
555
557
 
558
+ declare class Tooltip extends LktItem implements TooltipConfig {
559
+ static lktDefaultValues: (keyof TooltipConfig)[];
560
+ modelValue: boolean;
561
+ alwaysOpen: boolean;
562
+ class: string;
563
+ text: string;
564
+ icon: string;
565
+ iconAtEnd: boolean;
566
+ engine: TooltipPositionEngine;
567
+ referrerWidth: boolean;
568
+ referrerMargin: number | string;
569
+ windowMargin: number | string;
570
+ referrer: HTMLElement | undefined;
571
+ locationY: TooltipLocationY;
572
+ locationX: TooltipLocationX;
573
+ constructor(data?: FieldConfig);
574
+ }
575
+
576
+ declare class Modal extends LktItem implements ModalConfig {
577
+ static lktDefaultValues: (keyof ModalConfig)[];
578
+ size: string;
579
+ preTitle: string;
580
+ preTitleIcon: string;
581
+ title: string;
582
+ closeIcon: string;
583
+ closeConfirm: ValidModalName;
584
+ closeConfirmKey: ValidModalKey;
585
+ showClose: boolean;
586
+ disabledClose: boolean;
587
+ disabledVeilClick: boolean;
588
+ hiddenFooter: boolean;
589
+ modalName: ValidModalName;
590
+ modalKey: ValidModalKey;
591
+ zIndex: number;
592
+ beforeClose: Function | undefined;
593
+ item: LktObject;
594
+ constructor(data?: FieldConfig);
595
+ }
596
+
556
597
  declare enum ModalType {
557
598
  Modal = "modal",
558
599
  Confirm = "confirm"
@@ -574,6 +615,9 @@ declare enum TableType {
574
615
  * Export common interfaces
575
616
  */
576
617
 
577
- declare function getDefaultValues<T>(cls: new () => T): T;
618
+ declare function getDefaultValues<T>(cls: {
619
+ new (): T;
620
+ lktDefaultValues: (keyof T)[];
621
+ }): Partial<T>;
578
622
 
579
- export { Anchor, type AnchorConfig, AnchorType, Button, type ButtonConfig, ButtonType, Column, ColumnType, type DragConfig, type EmptyModalKey, Field, FieldAutoValidationTrigger, type FieldConfig, FieldType, LktItem, type LktObject, LktStrictItem, type ModalConfig, ModalType, MultipleOptionsDisplay, Option, type OptionConfig, SafeString, SortDirection, TableType, ToggleMode, type TooltipConfig, TooltipLocationX, TooltipLocationY, TooltipPositionEngine, type ValidColSpan, type ValidFieldMinMax, type ValidFieldValue, type ValidModalKey, type ValidModalName, type ValidOptionValue, type ValidSafeStringValue, type ValidTabIndex, getDefaultValues };
623
+ export { Anchor, type AnchorConfig, AnchorType, Button, type ButtonConfig, ButtonType, Column, ColumnType, type DragConfig, type EmptyModalKey, Field, FieldAutoValidationTrigger, type FieldConfig, FieldType, LktItem, type LktObject, LktStrictItem, Modal, type ModalConfig, ModalType, MultipleOptionsDisplay, Option, type OptionConfig, SafeString, SortDirection, 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 };
package/dist/index.js CHANGED
@@ -4,11 +4,12 @@ var skipDataProps = [
4
4
  "lktStrictItem",
5
5
  "lktExcludedProps"
6
6
  ];
7
- var LktItem = class {
8
- lktAllowUndefinedProps = [];
9
- lktExcludedProps = [];
10
- lktDateProps = [];
11
- lktStrictItem = false;
7
+ var LktItem = class _LktItem {
8
+ static lktAllowUndefinedProps = [];
9
+ static lktExcludedProps = [];
10
+ static lktDateProps = [];
11
+ static lktStrictItem = false;
12
+ static lktDefaultValues = [];
12
13
  constructor(data) {
13
14
  }
14
15
  feed(data = {}, target = this) {
@@ -16,9 +17,9 @@ var LktItem = class {
16
17
  for (const [key, value] of Object.entries(data)) target.assignProp(key, value);
17
18
  }
18
19
  assignProp(key, value) {
19
- if (skipDataProps.includes(key) || this.lktExcludedProps.includes(key)) return;
20
- if (this.lktStrictItem && !this.hasOwnProperty(key)) return;
21
- if (this.lktDateProps.includes(key)) {
20
+ if (skipDataProps.includes(key) || _LktItem.lktExcludedProps.includes(key)) return;
21
+ if (_LktItem.lktStrictItem && !this.hasOwnProperty(key)) return;
22
+ if (_LktItem.lktDateProps.includes(key)) {
22
23
  this[key] = new Date(value);
23
24
  return;
24
25
  }
@@ -228,9 +229,22 @@ var AnchorType = /* @__PURE__ */ ((AnchorType2) => {
228
229
 
229
230
  // src/instances/Anchor.ts
230
231
  var Anchor = class extends LktItem {
231
- lktAllowUndefinedProps = [
232
+ static lktAllowUndefinedProps = [
232
233
  "onClick"
233
234
  ];
235
+ static lktDefaultValues = [
236
+ "type",
237
+ "to",
238
+ "class",
239
+ "isActive",
240
+ "downloadFileName",
241
+ "disabled",
242
+ "onClick",
243
+ "confirmModal",
244
+ "confirmModalKey",
245
+ "confirmData",
246
+ "imposter"
247
+ ];
234
248
  type = "router-link" /* RouterLink */;
235
249
  to = "";
236
250
  class = "";
@@ -414,6 +428,103 @@ var Column = class extends LktItem {
414
428
  }
415
429
  };
416
430
 
431
+ // src/enums/TooltipLocationY.ts
432
+ var TooltipLocationY = /* @__PURE__ */ ((TooltipLocationY2) => {
433
+ TooltipLocationY2["Top"] = "top";
434
+ TooltipLocationY2["Bottom"] = "bottom";
435
+ TooltipLocationY2["Center"] = "center";
436
+ TooltipLocationY2["ReferrerCenter"] = "referrer-center";
437
+ return TooltipLocationY2;
438
+ })(TooltipLocationY || {});
439
+
440
+ // src/enums/TooltipLocationX.ts
441
+ var TooltipLocationX = /* @__PURE__ */ ((TooltipLocationX2) => {
442
+ TooltipLocationX2["Left"] = "left";
443
+ TooltipLocationX2["Right"] = "right";
444
+ TooltipLocationX2["Center"] = "center";
445
+ TooltipLocationX2["LeftCorner"] = "left-corner";
446
+ TooltipLocationX2["RightCorner"] = "right-corner";
447
+ return TooltipLocationX2;
448
+ })(TooltipLocationX || {});
449
+
450
+ // src/instances/Tooltip.ts
451
+ var Tooltip = class extends LktItem {
452
+ static lktDefaultValues = [
453
+ "modelValue",
454
+ "alwaysOpen",
455
+ "class",
456
+ "text",
457
+ "icon",
458
+ "iconAtEnd",
459
+ "engine",
460
+ "referrerWidth",
461
+ "referrerMargin",
462
+ "windowMargin",
463
+ "referrer",
464
+ "locationY",
465
+ "locationX"
466
+ ];
467
+ modelValue = false;
468
+ alwaysOpen = false;
469
+ class = "";
470
+ text = "";
471
+ icon = "";
472
+ iconAtEnd = false;
473
+ engine = "fixed" /* Fixed */;
474
+ referrerWidth = false;
475
+ referrerMargin = 0;
476
+ windowMargin = 0;
477
+ referrer = void 0;
478
+ locationY = "bottom" /* Bottom */;
479
+ locationX = "left-corner" /* LeftCorner */;
480
+ constructor(data = {}) {
481
+ super();
482
+ this.feed(data);
483
+ }
484
+ };
485
+
486
+ // src/instances/Modal.ts
487
+ var Modal = class extends LktItem {
488
+ static lktDefaultValues = [
489
+ "size",
490
+ "preTitle",
491
+ "preTitleIcon",
492
+ "title",
493
+ "closeIcon",
494
+ "closeConfirm",
495
+ "closeConfirmKey",
496
+ "showClose",
497
+ "disabledClose",
498
+ "disabledVeilClick",
499
+ "hiddenFooter",
500
+ "modalName",
501
+ "modalKey",
502
+ "zIndex",
503
+ "beforeClose",
504
+ "item"
505
+ ];
506
+ size = "";
507
+ preTitle = "";
508
+ preTitleIcon = "";
509
+ title = "";
510
+ closeIcon = "";
511
+ closeConfirm = "";
512
+ closeConfirmKey = "_";
513
+ showClose = true;
514
+ disabledClose = false;
515
+ disabledVeilClick = false;
516
+ hiddenFooter = false;
517
+ modalName = "";
518
+ modalKey = "_";
519
+ zIndex = 500;
520
+ beforeClose = void 0;
521
+ item = {};
522
+ constructor(data = {}) {
523
+ super();
524
+ this.feed(data);
525
+ }
526
+ };
527
+
417
528
  // src/enums/ModalType.ts
418
529
  var ModalType = /* @__PURE__ */ ((ModalType2) => {
419
530
  ModalType2["Modal"] = "modal";
@@ -444,29 +555,19 @@ var ToggleMode = /* @__PURE__ */ ((ToggleMode2) => {
444
555
  return ToggleMode2;
445
556
  })(ToggleMode || {});
446
557
 
447
- // src/enums/TooltipLocationY.ts
448
- var TooltipLocationY = /* @__PURE__ */ ((TooltipLocationY2) => {
449
- TooltipLocationY2["Top"] = "top";
450
- TooltipLocationY2["Bottom"] = "bottom";
451
- TooltipLocationY2["Center"] = "center";
452
- TooltipLocationY2["ReferrerCenter"] = "referrer-center";
453
- return TooltipLocationY2;
454
- })(TooltipLocationY || {});
455
-
456
- // src/enums/TooltipLocationX.ts
457
- var TooltipLocationX = /* @__PURE__ */ ((TooltipLocationX2) => {
458
- TooltipLocationX2["Left"] = "left";
459
- TooltipLocationX2["Right"] = "right";
460
- TooltipLocationX2["Center"] = "center";
461
- TooltipLocationX2["LeftCorner"] = "left-corner";
462
- TooltipLocationX2["RightCorner"] = "right-corner";
463
- return TooltipLocationX2;
464
- })(TooltipLocationX || {});
465
-
466
558
  // src/index.ts
467
559
  function getDefaultValues(cls) {
468
560
  const instance = new cls();
469
- return instance;
561
+ const result = {};
562
+ if (!Array.isArray(cls.lktDefaultValues)) {
563
+ throw new Error("lktDefaultValues must be a keys array.");
564
+ }
565
+ for (const key of cls.lktDefaultValues) {
566
+ if (key in instance) {
567
+ result[key] = instance[key];
568
+ }
569
+ }
570
+ return result;
470
571
  }
471
572
  export {
472
573
  Anchor,
@@ -480,6 +581,7 @@ export {
480
581
  FieldType,
481
582
  LktItem,
482
583
  LktStrictItem,
584
+ Modal,
483
585
  ModalType,
484
586
  MultipleOptionsDisplay,
485
587
  Option,
@@ -487,6 +589,7 @@ export {
487
589
  SortDirection,
488
590
  TableType,
489
591
  ToggleMode,
592
+ Tooltip,
490
593
  TooltipLocationX,
491
594
  TooltipLocationY,
492
595
  TooltipPositionEngine,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lkt-vue-kernel",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "LKT Vue Kernel",
5
5
  "keywords": [
6
6
  "lkt",