lkt-vue-kernel 1.0.1 → 1.0.3

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.
Files changed (3) hide show
  1. package/dist/index.d.ts +406 -38
  2. package/dist/index.js +408 -22
  3. package/package.json +9 -2
package/dist/index.d.ts CHANGED
@@ -1,5 +1,8 @@
1
+ import { RouteLocationRaw } from 'vue-router';
2
+ import { VueElement } from 'vue';
3
+
1
4
  interface LktObject {
2
- [key: string]: any;
5
+ [key: string | number]: any;
3
6
  }
4
7
 
5
8
  declare enum FieldType {
@@ -37,28 +40,51 @@ interface OptionConfig {
37
40
  }
38
41
 
39
42
  declare class LktItem implements LktObject {
43
+ lktAllowUndefinedProps: string[];
44
+ lktExcludedProps: string[];
40
45
  lktDateProps: string[];
41
46
  lktStrictItem: boolean;
42
- feed(data?: LktObject): void;
47
+ constructor(data?: LktObject);
48
+ feed(data?: LktObject, target?: this): void;
43
49
  assignProp(key: string, value: any): void;
44
50
  }
45
51
 
52
+ type ValidModalName = string | Function | undefined;
53
+
46
54
  declare class Option extends LktItem implements OptionConfig {
47
55
  value: ValidOptionValue;
48
56
  label: string;
49
- data?: LktObject;
50
- disabled?: boolean;
51
- group?: string;
52
- icon?: string;
53
- modal?: string | Function;
57
+ data: LktObject;
58
+ disabled: boolean;
59
+ group: string;
60
+ icon: string;
61
+ modal: ValidModalName;
62
+ constructor(data?: LktObject);
54
63
  }
55
64
 
56
65
  type ValidFieldValue = string | number | boolean | LktObject | Option[];
57
66
 
67
+ declare enum MultipleOptionsDisplay {
68
+ List = "list",
69
+ Inline = "inline",
70
+ Count = "count"
71
+ }
72
+
73
+ type ValidTabIndex = string | number | undefined;
74
+
75
+ declare enum FieldAutoValidationTrigger {
76
+ None = "",
77
+ Focus = "focus",
78
+ Blur = "blur",
79
+ Always = "always"
80
+ }
81
+
82
+ type ValidFieldMinMax = number | string | undefined;
83
+
58
84
  interface FieldConfig {
59
- modelValue: ValidFieldValue;
85
+ modelValue?: ValidFieldValue;
60
86
  type?: FieldType;
61
- valid?: boolean;
87
+ valid?: boolean | undefined;
62
88
  placeholder?: string;
63
89
  searchPlaceholder?: string;
64
90
  label?: string;
@@ -70,7 +96,7 @@ interface FieldConfig {
70
96
  readonly?: boolean;
71
97
  readMode?: boolean;
72
98
  allowReadModeSwitch?: boolean;
73
- tabindex?: number;
99
+ tabindex?: ValidTabIndex;
74
100
  mandatory?: boolean;
75
101
  showPassword?: boolean;
76
102
  canClear?: boolean;
@@ -81,33 +107,33 @@ interface FieldConfig {
81
107
  mandatoryMessage?: string;
82
108
  infoMessage?: string;
83
109
  errorMessage?: string;
84
- min?: number | string | undefined;
85
- max?: number | string | undefined;
110
+ min?: ValidFieldMinMax;
111
+ max?: ValidFieldMinMax;
86
112
  step?: number | string;
87
113
  enableAutoNumberFix?: boolean;
88
114
  emptyValueSlot?: string;
89
- optionSlot?: string;
90
- valueSlot?: string;
91
- editSlot?: string;
115
+ optionSlot?: string | undefined;
116
+ valueSlot?: string | undefined;
117
+ editSlot?: string | undefined;
92
118
  slotData?: LktObject;
93
119
  resource?: string;
94
120
  resourceData?: LktObject;
95
121
  validationResource?: string;
96
122
  validationResourceData?: LktObject;
97
123
  autoValidation?: boolean;
98
- autoValidationType?: 'focus' | 'blur' | 'always';
124
+ autoValidationType?: FieldAutoValidationTrigger;
99
125
  validationStack?: string;
100
- minNumbers?: number | string | undefined;
101
- maxNumbers?: number | string | undefined;
102
- minChars?: number | string | undefined;
103
- maxChars?: number | string | undefined;
104
- minUpperChars?: number | string | undefined;
105
- maxUpperChars?: number | string | undefined;
106
- minLowerChars?: number | string | undefined;
107
- maxLowerChars?: number | string | undefined;
108
- minSpecialChars?: number | string | undefined;
109
- maxSpecialChars?: number | string | undefined;
110
- checkEqualTo?: number | string | undefined;
126
+ minNumbers?: ValidFieldMinMax;
127
+ maxNumbers?: ValidFieldMinMax;
128
+ minChars?: ValidFieldMinMax;
129
+ maxChars?: ValidFieldMinMax;
130
+ minUpperChars?: ValidFieldMinMax;
131
+ maxUpperChars?: ValidFieldMinMax;
132
+ minLowerChars?: ValidFieldMinMax;
133
+ maxLowerChars?: ValidFieldMinMax;
134
+ minSpecialChars?: ValidFieldMinMax;
135
+ maxSpecialChars?: ValidFieldMinMax;
136
+ checkEqualTo?: ValidFieldMinMax;
111
137
  featuredButton?: string;
112
138
  infoButtonEllipsis?: boolean;
113
139
  fileName?: string;
@@ -115,15 +141,15 @@ interface FieldConfig {
115
141
  customButtonClass?: string;
116
142
  options?: string | Option[];
117
143
  multiple?: boolean;
118
- multipleDisplay?: LktObject;
119
- multipleDisplayEdition?: LktObject;
144
+ multipleDisplay?: MultipleOptionsDisplay;
145
+ multipleDisplayEdition?: MultipleOptionsDisplay;
120
146
  searchable?: boolean;
121
147
  autoloadOptionsResource?: boolean | 'feed';
122
148
  optionsDownload?: string | Function;
123
149
  optionsModal?: string | Function;
124
150
  optionsModalData?: LktObject | Function;
125
151
  optionsIcon?: string | Function;
126
- optionsLabelFormatter?: Function;
152
+ optionsLabelFormatter?: Function | undefined;
127
153
  optionsResource?: string;
128
154
  optionsResourceData?: LktObject;
129
155
  icon?: string | Function;
@@ -138,9 +164,9 @@ interface FieldConfig {
138
164
 
139
165
  type EmptyModalKey = '_';
140
166
 
141
- type ValidModalKey = string | EmptyModalKey;
167
+ type ValidModalKey = string | Function | EmptyModalKey;
142
168
 
143
- interface ModalConfig {
169
+ interface ModalConfig extends LktObject {
144
170
  size?: string;
145
171
  preTitle?: string;
146
172
  preTitleIcon?: string;
@@ -195,17 +221,359 @@ interface TooltipConfig {
195
221
  locationX?: TooltipLocationX;
196
222
  }
197
223
 
224
+ declare enum AnchorType {
225
+ Href = "href",// Vanilla JS+HTML anchor
226
+ RouterLink = "router-link",// For vue-router integration
227
+ RouterLinkBack = "router-link-back",// For vue-router back navigation
228
+ Mail = "mail",// Triggers OS mail integration
229
+ Tel = "tel",// Triggers OS phone integration
230
+ Tab = "tab",// New tab, similar to target="_blank"
231
+ Download = "download",// Download link
232
+ Action = "action",// Performs an action, without route changes
233
+ Legacy = ""
234
+ }
235
+
236
+ interface AnchorConfig {
237
+ type?: AnchorType;
238
+ to?: RouteLocationRaw | string;
239
+ class?: string;
240
+ isActive?: boolean;
241
+ downloadFileName?: string;
242
+ disabled?: boolean;
243
+ onClick?: Function | undefined;
244
+ confirmModal?: ValidModalName;
245
+ confirmModalKey?: ValidModalKey;
246
+ confirmData?: ModalConfig;
247
+ imposter?: boolean;
248
+ }
249
+
250
+ interface DragConfig {
251
+ isDraggable?: boolean | Function;
252
+ isValid?: Function;
253
+ canRender?: boolean | Function;
254
+ dragKey?: string;
255
+ }
256
+
257
+ declare const enum ButtonType {
258
+ Button = "button",// Default
259
+ Submit = "submit",// Form submit
260
+ Reset = "reset",
261
+ Anchor = "anchor",// Turns on anchor mode
262
+ Content = "content",// No click event
263
+ Switch = "switch",// Has a visible boolean state
264
+ HiddenSwitch = "hidden-switch",// Has a hidden boolean state
265
+ Split = "split",// Split button, content always generated
266
+ SplitLazy = "split-lazy",// Split button, contents generated after first open
267
+ SplitEver = "split-ever",// Split button, contents generated each time it's clicked
268
+ Tooltip = "tooltip",// Tooltip button, content always generated
269
+ TooltipLazy = "tooltip-lazy",// Tooltip button, contents generated after first open
270
+ TooltipEver = "tooltip-ever"
271
+ }
272
+
273
+ declare enum ToggleMode {
274
+ Lazy = "lazy",
275
+ Ever = "ever"
276
+ }
277
+
278
+ declare class Anchor extends LktItem implements AnchorConfig {
279
+ lktAllowUndefinedProps: string[];
280
+ type: AnchorType;
281
+ to?: RouteLocationRaw | string;
282
+ class: string;
283
+ isActive: boolean;
284
+ downloadFileName: string;
285
+ disabled: boolean;
286
+ onClick: Function | undefined;
287
+ confirmModal: ValidModalName;
288
+ confirmModalKey: ValidModalKey;
289
+ confirmData: LktObject;
290
+ imposter: boolean;
291
+ constructor(data?: Partial<AnchorConfig>);
292
+ getHref(): string;
293
+ }
294
+
295
+ interface ButtonConfig {
296
+ type?: ButtonType;
297
+ checked?: boolean;
298
+ openTooltip?: boolean;
299
+ name?: string;
300
+ text?: string | number;
301
+ icon?: string;
302
+ class?: string;
303
+ containerClass?: string;
304
+ palette?: string;
305
+ value?: string;
306
+ disabled?: boolean;
307
+ loading?: boolean;
308
+ wrapContent?: boolean;
309
+ anchor?: AnchorConfig | Anchor;
310
+ resource?: string;
311
+ resourceData?: LktObject;
312
+ modal?: ValidModalName;
313
+ modalKey?: ValidModalKey;
314
+ modalData?: ModalConfig;
315
+ confirmModal?: ValidModalName;
316
+ confirmModalKey?: ValidModalKey;
317
+ confirmData?: ModalConfig;
318
+ iconDot?: boolean | string | number;
319
+ iconEnd?: string;
320
+ img?: string;
321
+ split?: boolean | ToggleMode;
322
+ splitIcon?: string;
323
+ tooltip?: boolean | ToggleMode;
324
+ tooltipEngine?: TooltipPositionEngine;
325
+ showTooltipOnHover?: boolean;
326
+ showTooltipOnHoverDelay?: number;
327
+ hideTooltipOnLeave?: boolean;
328
+ tooltipWindowMargin?: number;
329
+ tooltipReferrerMargin?: number;
330
+ tooltipClass?: string;
331
+ tooltipLocationY?: string;
332
+ tooltipLocationX?: string;
333
+ splitClass?: string;
334
+ clickRef?: Element | VueElement;
335
+ tabindex?: ValidTabIndex;
336
+ isAnchor?: boolean;
337
+ onClickTo?: string;
338
+ onClickToExternal?: boolean;
339
+ download?: boolean;
340
+ downloadFileName?: string;
341
+ newTab?: boolean;
342
+ showSwitch?: boolean;
343
+ hiddenSwitch?: boolean;
344
+ }
345
+
198
346
  declare class LktStrictItem extends LktItem {
199
347
  lktStrictItem: boolean;
200
348
  }
201
349
 
202
- declare const enum ButtonType {
350
+ declare class Field extends LktItem implements FieldConfig {
351
+ modelValue: ValidFieldValue;
352
+ type: FieldType;
353
+ valid: boolean | undefined;
354
+ placeholder: string;
355
+ searchPlaceholder: string;
356
+ label: string;
357
+ labelIcon: string;
358
+ labelIconAtEnd: boolean;
359
+ name: string;
360
+ autocomplete: boolean;
361
+ disabled: boolean;
362
+ readonly: boolean;
363
+ readMode: boolean;
364
+ allowReadModeSwitch: boolean;
365
+ tabindex: ValidTabIndex;
366
+ mandatory: boolean;
367
+ showPassword: boolean;
368
+ canClear: boolean;
369
+ canUndo: boolean;
370
+ canI18n: boolean;
371
+ canStep: boolean;
372
+ mandatoryMessage: string;
373
+ infoMessage: string;
374
+ errorMessage: string;
375
+ min: ValidFieldMinMax;
376
+ max: ValidFieldMinMax;
377
+ step: number | string;
378
+ enableAutoNumberFix: boolean;
379
+ emptyValueSlot: string;
380
+ optionSlot: undefined;
381
+ valueSlot: undefined;
382
+ editSlot: undefined;
383
+ slotData: LktObject;
384
+ resource: string;
385
+ resourceData: LktObject;
386
+ validationResource: string;
387
+ validationResourceData: LktObject;
388
+ autoValidation: boolean;
389
+ autoValidationType: FieldAutoValidationTrigger;
390
+ validationStack: string;
391
+ minNumbers: ValidFieldMinMax;
392
+ maxNumbers: ValidFieldMinMax;
393
+ minChars: ValidFieldMinMax;
394
+ maxChars: ValidFieldMinMax;
395
+ minUpperChars: ValidFieldMinMax;
396
+ maxUpperChars: ValidFieldMinMax;
397
+ minLowerChars: ValidFieldMinMax;
398
+ maxLowerChars: ValidFieldMinMax;
399
+ minSpecialChars: ValidFieldMinMax;
400
+ maxSpecialChars: ValidFieldMinMax;
401
+ checkEqualTo: ValidFieldMinMax;
402
+ featuredButton: string;
403
+ infoButtonEllipsis: boolean;
404
+ fileName: string;
405
+ customButtonText: string;
406
+ customButtonClass: string;
407
+ options: string | Option[];
408
+ multiple: boolean;
409
+ multipleDisplay: MultipleOptionsDisplay;
410
+ multipleDisplayEdition: MultipleOptionsDisplay;
411
+ searchable: boolean;
412
+ autoloadOptionsResource: boolean | 'feed';
413
+ optionsDownload: string | Function;
414
+ optionsModal: string | Function;
415
+ optionsModalData: LktObject | Function;
416
+ optionsIcon: string | Function;
417
+ optionsLabelFormatter: undefined;
418
+ optionsResource: string;
419
+ optionsResourceData: LktObject;
420
+ icon: string | Function;
421
+ download: string | Function;
422
+ modal: string | Function;
423
+ modalKey: string | number | Function;
424
+ modalData: LktObject;
425
+ data: LktObject;
426
+ constructor(data?: FieldConfig);
427
+ }
428
+
429
+ declare enum ColumnType {
430
+ None = "",
431
+ Field = "field",
203
432
  Button = "button",
204
- Submit = "submit",
205
- Reset = "reset",
206
- Content = "content",
433
+ Anchor = "anchor",
434
+ Text = "text",
435
+ Number = "number",
436
+ Check = "check",
207
437
  Switch = "switch",
208
- HiddenSwitch = "hidden-switch"
438
+ Select = "select",
439
+ Email = "email",
440
+ Tel = "tel",
441
+ File = "file",
442
+ Link = "link",
443
+ Action = "action",
444
+ Integer = "int",
445
+ Float = "float"
446
+ }
447
+
448
+ type ValidSafeStringValue = string | ((...args: any[]) => string) | undefined | SafeString;
449
+
450
+ declare class SafeString {
451
+ private readonly value;
452
+ constructor(input: ValidSafeStringValue);
453
+ getValue(...args: any[]): string;
209
454
  }
210
455
 
211
- export { ButtonType, type EmptyModalKey, type FieldConfig, FieldType, LktItem, type LktObject, LktStrictItem, type ModalConfig, Option, type OptionConfig, type TooltipConfig, TooltipLocationX, TooltipLocationY, TooltipPositionEngine, type ValidFieldValue, type ValidModalKey, type ValidOptionValue };
456
+ type ValidColSpan = Function | boolean | number | undefined;
457
+
458
+ declare class Button extends LktItem implements ButtonConfig {
459
+ lktAllowUndefinedProps: string[];
460
+ type: ButtonType;
461
+ name: string;
462
+ palette: string;
463
+ onClickTo: string;
464
+ onClickToExternal: boolean;
465
+ class: string;
466
+ containerClass: string;
467
+ value: string;
468
+ disabled: boolean;
469
+ loading: boolean;
470
+ wrapContent: boolean;
471
+ split: boolean;
472
+ splitIcon: string;
473
+ isAnchor: boolean;
474
+ resource: string;
475
+ resourceData: LktObject;
476
+ modal: ValidModalName;
477
+ modalKey: ValidModalKey;
478
+ modalData: ModalConfig;
479
+ confirmModal: ValidModalName;
480
+ confirmModalKey: ValidModalKey;
481
+ confirmData: ModalConfig;
482
+ text: string;
483
+ icon: string;
484
+ iconDot: boolean;
485
+ iconEnd: string;
486
+ img: string;
487
+ newTab: boolean;
488
+ download: boolean;
489
+ downloadFileName: string;
490
+ tooltip: boolean;
491
+ showTooltipOnHoverDelay: number;
492
+ tooltipWindowMargin: number;
493
+ tooltipReferrerMargin: number;
494
+ tooltipLocationY: string;
495
+ tooltipLocationX: string;
496
+ checked: boolean;
497
+ clickRef?: Element | VueElement;
498
+ openTooltip: boolean;
499
+ tabindex: ValidTabIndex;
500
+ anchor?: AnchorConfig | Anchor;
501
+ tooltipEngine?: TooltipPositionEngine;
502
+ showTooltipOnHover?: boolean;
503
+ hideTooltipOnLeave?: boolean;
504
+ tooltipClass?: string;
505
+ splitClass?: string;
506
+ constructor(data?: ButtonConfig);
507
+ }
508
+
509
+ interface ColumnConfig {
510
+ type: ColumnType;
511
+ key: string;
512
+ label: string;
513
+ sortable: boolean;
514
+ hidden: boolean;
515
+ editable: boolean;
516
+ formatter?: Function | undefined;
517
+ checkEmpty?: Function | undefined;
518
+ colspan?: ValidColSpan;
519
+ preferSlot?: Function | boolean;
520
+ isForRowKey?: boolean;
521
+ extractTitleFromColumn?: string;
522
+ slotData?: LktObject;
523
+ field?: Field | FieldConfig | undefined;
524
+ anchor?: Anchor | AnchorConfig | undefined;
525
+ button?: Button | ButtonConfig | undefined;
526
+ link?: ValidSafeStringValue | SafeString;
527
+ action?: Function;
528
+ }
529
+
530
+ declare class Column extends LktItem implements ColumnConfig {
531
+ lktExcludedProps: string[];
532
+ lktAllowUndefinedProps: string[];
533
+ type: ColumnType;
534
+ key: string;
535
+ label: string;
536
+ sortable: boolean;
537
+ hidden: boolean;
538
+ editable: boolean;
539
+ formatter: Function | undefined;
540
+ checkEmpty: Function | undefined;
541
+ colspan: ValidColSpan;
542
+ preferSlot: Function | boolean;
543
+ isForRowKey: boolean;
544
+ extractTitleFromColumn: string;
545
+ slotData: LktObject;
546
+ field: Field | FieldConfig | undefined;
547
+ anchor: Anchor | AnchorConfig | undefined;
548
+ button: Button | ButtonConfig | undefined;
549
+ link: ValidSafeStringValue | SafeString | undefined;
550
+ action?: Function;
551
+ constructor(data: ColumnConfig);
552
+ getHref(item: LktObject): string;
553
+ doAction(item: LktObject): any;
554
+ }
555
+
556
+ declare enum ModalType {
557
+ Modal = "modal",
558
+ Confirm = "confirm"
559
+ }
560
+
561
+ declare enum SortDirection {
562
+ Asc = "asc",
563
+ Desc = "desc"
564
+ }
565
+
566
+ declare enum TableType {
567
+ Table = "table",
568
+ Item = "item",
569
+ Ul = "ul",
570
+ Ol = "ol"
571
+ }
572
+
573
+ /**
574
+ * Export common interfaces
575
+ */
576
+
577
+ declare function getDefaultValues<T>(cls: new () => T): T;
578
+
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 };
package/dist/index.js CHANGED
@@ -1,16 +1,22 @@
1
1
  // src/instances/LktItem.ts
2
2
  var skipDataProps = [
3
3
  "lktDateProps",
4
- "lktStrictItem"
4
+ "lktStrictItem",
5
+ "lktExcludedProps"
5
6
  ];
6
7
  var LktItem = class {
8
+ lktAllowUndefinedProps = [];
9
+ lktExcludedProps = [];
7
10
  lktDateProps = [];
8
11
  lktStrictItem = false;
9
- feed(data = {}) {
10
- for (const [key, value] of Object.entries(data)) this.assignProp(key, value);
12
+ constructor(data) {
13
+ }
14
+ feed(data = {}, target = this) {
15
+ if (typeof data !== "object") return;
16
+ for (const [key, value] of Object.entries(data)) target.assignProp(key, value);
11
17
  }
12
18
  assignProp(key, value) {
13
- if (skipDataProps.includes(key)) return;
19
+ if (skipDataProps.includes(key) || this.lktExcludedProps.includes(key)) return;
14
20
  if (this.lktStrictItem && !this.hasOwnProperty(key)) return;
15
21
  if (this.lktDateProps.includes(key)) {
16
22
  this[key] = new Date(value);
@@ -34,19 +40,12 @@ var Option = class extends LktItem {
34
40
  group = "";
35
41
  icon = "";
36
42
  modal = "";
43
+ constructor(data = {}) {
44
+ super();
45
+ this.feed(data);
46
+ }
37
47
  };
38
48
 
39
- // src/enums/ButtonType.ts
40
- var ButtonType = /* @__PURE__ */ ((ButtonType2) => {
41
- ButtonType2["Button"] = "button";
42
- ButtonType2["Submit"] = "submit";
43
- ButtonType2["Reset"] = "reset";
44
- ButtonType2["Content"] = "content";
45
- ButtonType2["Switch"] = "switch";
46
- ButtonType2["HiddenSwitch"] = "hidden-switch";
47
- return ButtonType2;
48
- })(ButtonType || {});
49
-
50
49
  // src/enums/FieldType.ts
51
50
  var FieldType = /* @__PURE__ */ ((FieldType2) => {
52
51
  FieldType2["Text"] = "text";
@@ -71,6 +70,380 @@ var FieldType = /* @__PURE__ */ ((FieldType2) => {
71
70
  return FieldType2;
72
71
  })(FieldType || {});
73
72
 
73
+ // src/instances/Field.ts
74
+ import { generateRandomString } from "lkt-string-tools";
75
+
76
+ // src/enums/MultipleOptionsDisplay.ts
77
+ var MultipleOptionsDisplay = /* @__PURE__ */ ((MultipleOptionsDisplay2) => {
78
+ MultipleOptionsDisplay2["List"] = "list";
79
+ MultipleOptionsDisplay2["Inline"] = "inline";
80
+ MultipleOptionsDisplay2["Count"] = "count";
81
+ return MultipleOptionsDisplay2;
82
+ })(MultipleOptionsDisplay || {});
83
+
84
+ // src/enums/FieldAutoValidationTrigger.ts
85
+ var FieldAutoValidationTrigger = /* @__PURE__ */ ((FieldAutoValidationTrigger2) => {
86
+ FieldAutoValidationTrigger2["None"] = "";
87
+ FieldAutoValidationTrigger2["Focus"] = "focus";
88
+ FieldAutoValidationTrigger2["Blur"] = "blur";
89
+ FieldAutoValidationTrigger2["Always"] = "always";
90
+ return FieldAutoValidationTrigger2;
91
+ })(FieldAutoValidationTrigger || {});
92
+
93
+ // src/instances/Field.ts
94
+ var Field = class extends LktItem {
95
+ modelValue = "";
96
+ type = "text" /* Text */;
97
+ valid = void 0;
98
+ placeholder = "";
99
+ searchPlaceholder = "";
100
+ label = "";
101
+ labelIcon = "";
102
+ labelIconAtEnd = false;
103
+ name = generateRandomString(16);
104
+ autocomplete = false;
105
+ disabled = false;
106
+ readonly = false;
107
+ readMode = false;
108
+ allowReadModeSwitch = false;
109
+ tabindex = void 0;
110
+ mandatory = false;
111
+ showPassword = false;
112
+ canClear = false;
113
+ canUndo = false;
114
+ canI18n = false;
115
+ canStep = true;
116
+ mandatoryMessage = "";
117
+ infoMessage = "";
118
+ errorMessage = "";
119
+ min = void 0;
120
+ max = void 0;
121
+ step = 1;
122
+ enableAutoNumberFix = true;
123
+ emptyValueSlot = "";
124
+ optionSlot = void 0;
125
+ valueSlot = void 0;
126
+ editSlot = void 0;
127
+ slotData = {};
128
+ resource = "";
129
+ resourceData = {};
130
+ validationResource = "";
131
+ validationResourceData = {};
132
+ autoValidation = false;
133
+ autoValidationType = "blur" /* Blur */;
134
+ validationStack = "default";
135
+ minNumbers = void 0;
136
+ maxNumbers = void 0;
137
+ minChars = void 0;
138
+ maxChars = void 0;
139
+ minUpperChars = void 0;
140
+ maxUpperChars = void 0;
141
+ minLowerChars = void 0;
142
+ maxLowerChars = void 0;
143
+ minSpecialChars = void 0;
144
+ maxSpecialChars = void 0;
145
+ checkEqualTo = void 0;
146
+ featuredButton = "";
147
+ infoButtonEllipsis = false;
148
+ fileName = "";
149
+ customButtonText = "";
150
+ customButtonClass = "";
151
+ options = [];
152
+ multiple = false;
153
+ multipleDisplay = "list" /* List */;
154
+ multipleDisplayEdition = "inline" /* Inline */;
155
+ searchable = false;
156
+ autoloadOptionsResource = false;
157
+ optionsDownload = "";
158
+ optionsModal = "";
159
+ optionsModalData = {};
160
+ optionsIcon = "";
161
+ optionsLabelFormatter = void 0;
162
+ optionsResource = "";
163
+ optionsResourceData = {};
164
+ icon = "";
165
+ download = "";
166
+ modal = "";
167
+ modalKey = "";
168
+ modalData = {};
169
+ data = {};
170
+ constructor(data = {}) {
171
+ super();
172
+ this.feed(data);
173
+ }
174
+ };
175
+
176
+ // src/enums/ColumnType.ts
177
+ var ColumnType = /* @__PURE__ */ ((ColumnType2) => {
178
+ ColumnType2["None"] = "";
179
+ ColumnType2["Field"] = "field";
180
+ ColumnType2["Button"] = "button";
181
+ ColumnType2["Anchor"] = "anchor";
182
+ ColumnType2["Text"] = "text";
183
+ ColumnType2["Number"] = "number";
184
+ ColumnType2["Check"] = "check";
185
+ ColumnType2["Switch"] = "switch";
186
+ ColumnType2["Select"] = "select";
187
+ ColumnType2["Email"] = "email";
188
+ ColumnType2["Tel"] = "tel";
189
+ ColumnType2["File"] = "file";
190
+ ColumnType2["Link"] = "link";
191
+ ColumnType2["Action"] = "action";
192
+ ColumnType2["Integer"] = "int";
193
+ ColumnType2["Float"] = "float";
194
+ return ColumnType2;
195
+ })(ColumnType || {});
196
+
197
+ // src/value-objects/SafeString.ts
198
+ var SafeString = class _SafeString {
199
+ value;
200
+ constructor(input) {
201
+ this.value = input;
202
+ }
203
+ getValue(...args) {
204
+ if (typeof this.value === "function") {
205
+ return this.value(...args);
206
+ } else if (typeof this.value === "object" && typeof this.value === typeof _SafeString) {
207
+ return this.value.getValue(...args);
208
+ } else if (typeof this.value === "string") {
209
+ return this.value;
210
+ }
211
+ return "";
212
+ }
213
+ };
214
+
215
+ // src/enums/AnchorType.ts
216
+ var AnchorType = /* @__PURE__ */ ((AnchorType2) => {
217
+ AnchorType2["Href"] = "href";
218
+ AnchorType2["RouterLink"] = "router-link";
219
+ AnchorType2["RouterLinkBack"] = "router-link-back";
220
+ AnchorType2["Mail"] = "mail";
221
+ AnchorType2["Tel"] = "tel";
222
+ AnchorType2["Tab"] = "tab";
223
+ AnchorType2["Download"] = "download";
224
+ AnchorType2["Action"] = "action";
225
+ AnchorType2["Legacy"] = "";
226
+ return AnchorType2;
227
+ })(AnchorType || {});
228
+
229
+ // src/instances/Anchor.ts
230
+ var Anchor = class extends LktItem {
231
+ lktAllowUndefinedProps = [
232
+ "onClick"
233
+ ];
234
+ type = "router-link" /* RouterLink */;
235
+ to = "";
236
+ class = "";
237
+ isActive = false;
238
+ downloadFileName = "";
239
+ disabled = false;
240
+ onClick = void 0;
241
+ confirmModal = "";
242
+ confirmModalKey = "_";
243
+ confirmData = {};
244
+ imposter = false;
245
+ constructor(data = {}) {
246
+ super();
247
+ this.feed(data);
248
+ }
249
+ getHref() {
250
+ let href = "";
251
+ if (typeof this.to === "string") href = this.to;
252
+ if ("mail" /* Mail */ === this.type) return `mailto:${href}`;
253
+ if ("tel" /* Tel */ === this.type) return `tel:${href}`;
254
+ if ([
255
+ "href" /* Href */,
256
+ "mail" /* Mail */,
257
+ "tel" /* Tel */,
258
+ "tab" /* Tab */,
259
+ "download" /* Download */
260
+ ].includes(this.type)) {
261
+ return href;
262
+ }
263
+ if (typeof this.to === "string" && this.to !== "") return this.to;
264
+ return "";
265
+ }
266
+ };
267
+
268
+ // src/enums/ButtonType.ts
269
+ var ButtonType = /* @__PURE__ */ ((ButtonType2) => {
270
+ ButtonType2["Button"] = "button";
271
+ ButtonType2["Submit"] = "submit";
272
+ ButtonType2["Reset"] = "reset";
273
+ ButtonType2["Anchor"] = "anchor";
274
+ ButtonType2["Content"] = "content";
275
+ ButtonType2["Switch"] = "switch";
276
+ ButtonType2["HiddenSwitch"] = "hidden-switch";
277
+ ButtonType2["Split"] = "split";
278
+ ButtonType2["SplitLazy"] = "split-lazy";
279
+ ButtonType2["SplitEver"] = "split-ever";
280
+ ButtonType2["Tooltip"] = "tooltip";
281
+ ButtonType2["TooltipLazy"] = "tooltip-lazy";
282
+ ButtonType2["TooltipEver"] = "tooltip-ever";
283
+ return ButtonType2;
284
+ })(ButtonType || {});
285
+
286
+ // src/instances/Button.ts
287
+ import { generateRandomString as generateRandomString2 } from "lkt-string-tools";
288
+
289
+ // src/enums/TooltipPositionEngine.ts
290
+ var TooltipPositionEngine = /* @__PURE__ */ ((TooltipPositionEngine2) => {
291
+ TooltipPositionEngine2["Fixed"] = "fixed";
292
+ TooltipPositionEngine2["Absolute"] = "absolute";
293
+ return TooltipPositionEngine2;
294
+ })(TooltipPositionEngine || {});
295
+
296
+ // src/instances/Button.ts
297
+ var Button = class extends LktItem {
298
+ lktAllowUndefinedProps = [
299
+ "clickRef",
300
+ "tabindex",
301
+ "anchor",
302
+ "showTooltipOnHover",
303
+ "hideTooltipOnLeave"
304
+ ];
305
+ type = "button" /* Button */;
306
+ name = generateRandomString2(10);
307
+ palette = "";
308
+ onClickTo = "";
309
+ onClickToExternal = false;
310
+ class = "";
311
+ containerClass = "";
312
+ value = "";
313
+ disabled = false;
314
+ loading = false;
315
+ wrapContent = false;
316
+ split = false;
317
+ splitIcon = "";
318
+ isAnchor = false;
319
+ resource = "";
320
+ resourceData = () => ({});
321
+ modal = "";
322
+ modalKey = "_";
323
+ modalData = () => ({});
324
+ confirmModal = "";
325
+ confirmModalKey = "_";
326
+ confirmData = () => ({});
327
+ text = "";
328
+ icon = "";
329
+ iconDot = false;
330
+ iconEnd = "";
331
+ img = "";
332
+ newTab = false;
333
+ download = false;
334
+ downloadFileName = "";
335
+ tooltip = false;
336
+ showTooltipOnHoverDelay = 0;
337
+ tooltipWindowMargin = 0;
338
+ tooltipReferrerMargin = 0;
339
+ tooltipLocationY = "bottom";
340
+ tooltipLocationX = "left-corner";
341
+ checked = false;
342
+ clickRef = void 0;
343
+ openTooltip = false;
344
+ tabindex = void 0;
345
+ anchor = void 0;
346
+ tooltipEngine = "fixed" /* Fixed */;
347
+ showTooltipOnHover = void 0;
348
+ hideTooltipOnLeave = void 0;
349
+ tooltipClass = "";
350
+ splitClass = "";
351
+ constructor(data = {}) {
352
+ super();
353
+ this.feed(data);
354
+ this.anchor = new Anchor(data.anchor);
355
+ }
356
+ };
357
+
358
+ // src/instances/Column.ts
359
+ var Column = class extends LktItem {
360
+ lktExcludedProps = ["link", "field", "anchor", "button"];
361
+ lktAllowUndefinedProps = [
362
+ "formatter",
363
+ "checkEmpty",
364
+ "colspan",
365
+ "field",
366
+ "anchor",
367
+ "button",
368
+ "link",
369
+ "action"
370
+ ];
371
+ type = "" /* None */;
372
+ key = "";
373
+ label = "";
374
+ sortable = true;
375
+ hidden = false;
376
+ editable = false;
377
+ formatter = void 0;
378
+ checkEmpty = void 0;
379
+ colspan = void 0;
380
+ preferSlot = true;
381
+ isForRowKey = false;
382
+ extractTitleFromColumn = "";
383
+ slotData = {};
384
+ field = void 0;
385
+ anchor = void 0;
386
+ button = void 0;
387
+ link = void 0;
388
+ action = void 0;
389
+ constructor(data) {
390
+ super();
391
+ this.feed(data);
392
+ switch (this.type) {
393
+ case "field" /* Field */:
394
+ this.field = new Field(data.field);
395
+ break;
396
+ case "anchor" /* Anchor */:
397
+ this.anchor = new Anchor(data.anchor);
398
+ break;
399
+ case "button" /* Button */:
400
+ this.button = new Button(data.button);
401
+ break;
402
+ }
403
+ this.link = new SafeString(data.link);
404
+ }
405
+ getHref(item) {
406
+ if (typeof this.link !== "object") return "";
407
+ return this.link.getValue(item);
408
+ }
409
+ doAction(item) {
410
+ if (typeof this.action === "function") {
411
+ return this.action(item);
412
+ }
413
+ console.warn("No action defined");
414
+ }
415
+ };
416
+
417
+ // src/enums/ModalType.ts
418
+ var ModalType = /* @__PURE__ */ ((ModalType2) => {
419
+ ModalType2["Modal"] = "modal";
420
+ ModalType2["Confirm"] = "confirm";
421
+ return ModalType2;
422
+ })(ModalType || {});
423
+
424
+ // src/enums/SortDirection.ts
425
+ var SortDirection = /* @__PURE__ */ ((SortDirection2) => {
426
+ SortDirection2["Asc"] = "asc";
427
+ SortDirection2["Desc"] = "desc";
428
+ return SortDirection2;
429
+ })(SortDirection || {});
430
+
431
+ // src/enums/TableType.ts
432
+ var TableType = /* @__PURE__ */ ((TableType2) => {
433
+ TableType2["Table"] = "table";
434
+ TableType2["Item"] = "item";
435
+ TableType2["Ul"] = "ul";
436
+ TableType2["Ol"] = "ol";
437
+ return TableType2;
438
+ })(TableType || {});
439
+
440
+ // src/enums/ToggleMode.ts
441
+ var ToggleMode = /* @__PURE__ */ ((ToggleMode2) => {
442
+ ToggleMode2["Lazy"] = "lazy";
443
+ ToggleMode2["Ever"] = "ever";
444
+ return ToggleMode2;
445
+ })(ToggleMode || {});
446
+
74
447
  // src/enums/TooltipLocationY.ts
75
448
  var TooltipLocationY = /* @__PURE__ */ ((TooltipLocationY2) => {
76
449
  TooltipLocationY2["Top"] = "top";
@@ -90,19 +463,32 @@ var TooltipLocationX = /* @__PURE__ */ ((TooltipLocationX2) => {
90
463
  return TooltipLocationX2;
91
464
  })(TooltipLocationX || {});
92
465
 
93
- // src/enums/TooltipPositionEngine.ts
94
- var TooltipPositionEngine = /* @__PURE__ */ ((TooltipPositionEngine2) => {
95
- TooltipPositionEngine2["Fixed"] = "fixed";
96
- TooltipPositionEngine2["Absolute"] = "absolute";
97
- return TooltipPositionEngine2;
98
- })(TooltipPositionEngine || {});
466
+ // src/index.ts
467
+ function getDefaultValues(cls) {
468
+ const instance = new cls();
469
+ return instance;
470
+ }
99
471
  export {
472
+ Anchor,
473
+ AnchorType,
474
+ Button,
100
475
  ButtonType,
476
+ Column,
477
+ ColumnType,
478
+ Field,
479
+ FieldAutoValidationTrigger,
101
480
  FieldType,
102
481
  LktItem,
103
482
  LktStrictItem,
483
+ ModalType,
484
+ MultipleOptionsDisplay,
104
485
  Option,
486
+ SafeString,
487
+ SortDirection,
488
+ TableType,
489
+ ToggleMode,
105
490
  TooltipLocationX,
106
491
  TooltipLocationY,
107
- TooltipPositionEngine
492
+ TooltipPositionEngine,
493
+ getDefaultValues
108
494
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lkt-vue-kernel",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "LKT Vue Kernel",
5
5
  "keywords": [
6
6
  "lkt",
@@ -13,7 +13,9 @@
13
13
  "type": "module",
14
14
  "module": "./dist/index.js",
15
15
  "types": "./dist/index.d.ts",
16
- "files": ["dist"],
16
+ "files": [
17
+ "dist"
18
+ ],
17
19
  "exports": {
18
20
  ".": {
19
21
  "import": "./dist/index.js"
@@ -31,5 +33,10 @@
31
33
  },
32
34
  "engines": {
33
35
  "node": ">=18"
36
+ },
37
+ "dependencies": {
38
+ "lkt-string-tools": "^1.0.8",
39
+ "vue": "^3.5.13",
40
+ "vue-router": "^4.5.0"
34
41
  }
35
42
  }