lkt-vue-kernel 1.0.22 → 1.0.24

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.js CHANGED
@@ -1,1306 +1 @@
1
- // src/enums/ButtonType.ts
2
- var ButtonType = /* @__PURE__ */ ((ButtonType2) => {
3
- ButtonType2["Button"] = "button";
4
- ButtonType2["Submit"] = "submit";
5
- ButtonType2["Reset"] = "reset";
6
- ButtonType2["Anchor"] = "anchor";
7
- ButtonType2["Content"] = "content";
8
- ButtonType2["Switch"] = "switch";
9
- ButtonType2["HiddenSwitch"] = "hidden-switch";
10
- ButtonType2["Split"] = "split";
11
- ButtonType2["SplitLazy"] = "split-lazy";
12
- ButtonType2["SplitEver"] = "split-ever";
13
- ButtonType2["Tooltip"] = "tooltip";
14
- ButtonType2["TooltipLazy"] = "tooltip-lazy";
15
- ButtonType2["TooltipEver"] = "tooltip-ever";
16
- return ButtonType2;
17
- })(ButtonType || {});
18
-
19
- // src/functions/ensure-data-functions.ts
20
- var ensureButtonConfig = (buttonConfig, settingsConfig) => {
21
- if (typeof buttonConfig === "undefined") return settingsConfig;
22
- return {
23
- ...settingsConfig,
24
- ...buttonConfig
25
- };
26
- };
27
-
28
- // src/settings/LktSettings.ts
29
- var LktSettings = class _LktSettings {
30
- static debugEnabled = false;
31
- static debugMode(enabled = true) {
32
- _LktSettings.debugEnabled = enabled;
33
- return _LktSettings;
34
- }
35
- static defaultSaveButton = {
36
- text: "Save"
37
- };
38
- static setDefaultSaveButton(button, override = true) {
39
- if (override) {
40
- _LktSettings.defaultSaveButton = button;
41
- } else {
42
- _LktSettings.defaultSaveButton = ensureButtonConfig(button, _LktSettings.defaultSaveButton);
43
- }
44
- return _LktSettings;
45
- }
46
- static defaultConfirmButton = {
47
- text: "Confirm"
48
- };
49
- static setDefaultConfirmButton(button, override = true) {
50
- if (override) {
51
- _LktSettings.defaultConfirmButton = button;
52
- } else {
53
- _LktSettings.defaultConfirmButton = ensureButtonConfig(button, _LktSettings.defaultConfirmButton);
54
- }
55
- return _LktSettings;
56
- }
57
- static defaultCancelButton = {
58
- text: "Cancel"
59
- };
60
- static setDefaultCancelButton(button, override = true) {
61
- if (override) {
62
- _LktSettings.defaultCancelButton = button;
63
- } else {
64
- _LktSettings.defaultCancelButton = ensureButtonConfig(button, _LktSettings.defaultCancelButton);
65
- }
66
- return _LktSettings;
67
- }
68
- static defaultCreateButton = {
69
- text: "Create"
70
- };
71
- static setDefaultCreateButton(button, override = true) {
72
- if (override) {
73
- _LktSettings.defaultCreateButton = button;
74
- } else {
75
- _LktSettings.defaultCreateButton = ensureButtonConfig(button, _LktSettings.defaultCreateButton);
76
- }
77
- return _LktSettings;
78
- }
79
- static defaultUpdateButton = {
80
- text: "Update"
81
- };
82
- static setDefaultUpdateButton(button, override = true) {
83
- if (override) {
84
- _LktSettings.defaultUpdateButton = button;
85
- } else {
86
- _LktSettings.defaultUpdateButton = ensureButtonConfig(button, _LktSettings.defaultUpdateButton);
87
- }
88
- return _LktSettings;
89
- }
90
- static defaultDropButton = {
91
- text: "Drop"
92
- };
93
- static setDefaultDropButton(button, override = true) {
94
- if (override) {
95
- _LktSettings.defaultDropButton = button;
96
- } else {
97
- _LktSettings.defaultDropButton = ensureButtonConfig(button, _LktSettings.defaultDropButton);
98
- }
99
- return _LktSettings;
100
- }
101
- static defaultEditModeButton = {
102
- text: "Edit mode",
103
- type: "switch" /* Switch */
104
- };
105
- static setDefaultEditModeButton(button, override = true) {
106
- if (override) {
107
- _LktSettings.defaultEditModeButton = button;
108
- } else {
109
- _LktSettings.defaultEditModeButton = ensureButtonConfig(button, _LktSettings.defaultEditModeButton);
110
- }
111
- return _LktSettings;
112
- }
113
- static defaultToggleButton = {
114
- text: "Toggle",
115
- textOn: "Close",
116
- textOff: "Show more",
117
- type: "hidden-switch" /* HiddenSwitch */
118
- };
119
- static setDefaultToggleButton(button, override = true) {
120
- if (override) {
121
- _LktSettings.defaultToggleButton = button;
122
- } else {
123
- _LktSettings.defaultToggleButton = ensureButtonConfig(button, _LktSettings.defaultToggleButton);
124
- }
125
- return _LktSettings;
126
- }
127
- };
128
-
129
- // src/enums/FieldType.ts
130
- var FieldType = /* @__PURE__ */ ((FieldType2) => {
131
- FieldType2["Text"] = "text";
132
- FieldType2["Email"] = "email";
133
- FieldType2["Tel"] = "tel";
134
- FieldType2["Password"] = "password";
135
- FieldType2["Search"] = "search";
136
- FieldType2["Number"] = "number";
137
- FieldType2["Color"] = "color";
138
- FieldType2["Range"] = "range";
139
- FieldType2["Textarea"] = "textarea";
140
- FieldType2["Html"] = "html";
141
- FieldType2["Date"] = "date";
142
- FieldType2["File"] = "file";
143
- FieldType2["Image"] = "image";
144
- FieldType2["Select"] = "select";
145
- FieldType2["Check"] = "check";
146
- FieldType2["Switch"] = "switch";
147
- FieldType2["Calc"] = "calc";
148
- FieldType2["Card"] = "card";
149
- FieldType2["Elements"] = "elements";
150
- return FieldType2;
151
- })(FieldType || {});
152
-
153
- // src/constants/field-constants.ts
154
- var fieldTypesWithOptions = [
155
- "text" /* Text */,
156
- "search" /* Search */,
157
- "select" /* Select */
158
- ];
159
- var fieldTypesWithoutClear = [
160
- "switch" /* Switch */,
161
- "check" /* Check */
162
- ];
163
- var fieldTypesWithoutUndo = [
164
- "switch" /* Switch */,
165
- "check" /* Check */
166
- ];
167
- var textFieldTypesWithOptions = [
168
- "text" /* Text */,
169
- "search" /* Search */
170
- ];
171
- var booleanFieldTypes = [
172
- "switch" /* Switch */,
173
- "check" /* Check */
174
- ];
175
- var fieldsWithMultipleMode = [
176
- "select" /* Select */,
177
- "color" /* Color */,
178
- "card" /* Card */
179
- ];
180
- var textFieldTypes = [
181
- "text" /* Text */,
182
- "email" /* Email */,
183
- "password" /* Password */
184
- ];
185
-
186
- // src/instances/LktItem.ts
187
- var skipDataProps = [
188
- "lktDateProps",
189
- "lktStrictItem",
190
- "lktExcludedProps"
191
- ];
192
- var LktItem = class _LktItem {
193
- static lktAllowUndefinedProps = [];
194
- static lktExcludedProps = [];
195
- static lktDateProps = [];
196
- static lktStrictItem = false;
197
- static lktDefaultValues = [];
198
- constructor(data) {
199
- }
200
- feed(data = {}, target = this) {
201
- if (typeof data !== "object") return;
202
- for (const [key, value] of Object.entries(data)) target.assignProp(key, value);
203
- }
204
- assignProp(key, value) {
205
- if (skipDataProps.includes(key) || _LktItem.lktExcludedProps.includes(key)) return;
206
- if (_LktItem.lktStrictItem && !this.hasOwnProperty(key)) return;
207
- if (_LktItem.lktDateProps.includes(key)) {
208
- this[key] = new Date(value);
209
- return;
210
- }
211
- this[key] = value;
212
- }
213
- };
214
-
215
- // src/instances/LktStrictItem.ts
216
- var LktStrictItem = class extends LktItem {
217
- lktStrictItem = true;
218
- };
219
-
220
- // src/instances/Option.ts
221
- var Option = class extends LktItem {
222
- value = void 0;
223
- label = "";
224
- data = {};
225
- disabled = false;
226
- group = "";
227
- icon = "";
228
- modal = "";
229
- constructor(data = {}) {
230
- super();
231
- this.feed(data);
232
- }
233
- };
234
-
235
- // src/instances/Field.ts
236
- import { generateRandomString } from "lkt-string-tools";
237
-
238
- // src/enums/MultipleOptionsDisplay.ts
239
- var MultipleOptionsDisplay = /* @__PURE__ */ ((MultipleOptionsDisplay2) => {
240
- MultipleOptionsDisplay2["List"] = "list";
241
- MultipleOptionsDisplay2["Inline"] = "inline";
242
- MultipleOptionsDisplay2["Count"] = "count";
243
- return MultipleOptionsDisplay2;
244
- })(MultipleOptionsDisplay || {});
245
-
246
- // src/enums/FieldAutoValidationTrigger.ts
247
- var FieldAutoValidationTrigger = /* @__PURE__ */ ((FieldAutoValidationTrigger2) => {
248
- FieldAutoValidationTrigger2["None"] = "";
249
- FieldAutoValidationTrigger2["Focus"] = "focus";
250
- FieldAutoValidationTrigger2["Blur"] = "blur";
251
- FieldAutoValidationTrigger2["Always"] = "always";
252
- return FieldAutoValidationTrigger2;
253
- })(FieldAutoValidationTrigger || {});
254
-
255
- // src/instances/Field.ts
256
- var Field = class extends LktItem {
257
- modelValue = "";
258
- type = "text" /* Text */;
259
- valid = void 0;
260
- placeholder = "";
261
- searchPlaceholder = "";
262
- label = "";
263
- labelIcon = "";
264
- labelIconAtEnd = false;
265
- name = generateRandomString(16);
266
- autocomplete = false;
267
- disabled = false;
268
- readonly = false;
269
- readMode = false;
270
- allowReadModeSwitch = false;
271
- tabindex = void 0;
272
- mandatory = false;
273
- showPassword = false;
274
- canClear = false;
275
- canUndo = false;
276
- canI18n = false;
277
- canStep = true;
278
- canTag = true;
279
- mandatoryMessage = "";
280
- infoMessage = "";
281
- errorMessage = "";
282
- min = void 0;
283
- max = void 0;
284
- step = 1;
285
- enableAutoNumberFix = true;
286
- emptyValueSlot = "";
287
- optionSlot = void 0;
288
- valueSlot = void 0;
289
- editSlot = void 0;
290
- slotData = {};
291
- resource = "";
292
- resourceData = {};
293
- validationResource = "";
294
- validationResourceData = {};
295
- autoValidation = false;
296
- autoValidationType = "blur" /* Blur */;
297
- validationStack = "default";
298
- minNumbers = void 0;
299
- maxNumbers = void 0;
300
- minChars = void 0;
301
- maxChars = void 0;
302
- minUpperChars = void 0;
303
- maxUpperChars = void 0;
304
- minLowerChars = void 0;
305
- maxLowerChars = void 0;
306
- minSpecialChars = void 0;
307
- maxSpecialChars = void 0;
308
- checkEqualTo = void 0;
309
- featuredButton = "";
310
- infoButtonEllipsis = false;
311
- fileName = "";
312
- customButtonText = "";
313
- customButtonClass = "";
314
- options = [];
315
- multiple = false;
316
- multipleDisplay = "list" /* List */;
317
- multipleDisplayEdition = "inline" /* Inline */;
318
- searchable = false;
319
- autoloadOptionsResource = false;
320
- optionsDownload = "";
321
- optionsModal = "";
322
- optionsModalData = {};
323
- optionsText = "";
324
- optionsIcon = "";
325
- optionsClass = "";
326
- optionsLabelFormatter = void 0;
327
- optionsResource = "";
328
- optionsResourceData = {};
329
- icon = "";
330
- download = "";
331
- modal = "";
332
- modalKey = "";
333
- modalData = {};
334
- data = {};
335
- validation = {};
336
- constructor(data = {}) {
337
- super();
338
- this.feed(data);
339
- }
340
- };
341
-
342
- // src/enums/ValidationCode.ts
343
- var ValidationCode = /* @__PURE__ */ ((ValidationCode2) => {
344
- ValidationCode2["MinStringLength"] = "min-str";
345
- ValidationCode2["MinNumber"] = "min-num";
346
- ValidationCode2["MaxStringLength"] = "max-str";
347
- ValidationCode2["MaxNumber"] = "max-num";
348
- ValidationCode2["Email"] = "email";
349
- ValidationCode2["Empty"] = "empty";
350
- ValidationCode2["EqualTo"] = "equal-to";
351
- ValidationCode2["MinNumbers"] = "min-numbers";
352
- ValidationCode2["MaxNumbers"] = "max-numbers";
353
- ValidationCode2["MinChars"] = "min-chars";
354
- ValidationCode2["MaxChars"] = "max-chars";
355
- ValidationCode2["MinUpperChars"] = "min-upper-chars";
356
- ValidationCode2["MaxUpperChars"] = "max-upper-chars";
357
- ValidationCode2["MinLowerChars"] = "min-lower-chars";
358
- ValidationCode2["MaxLowerChars"] = "max-lower-chars";
359
- ValidationCode2["MinSpecialChars"] = "min-special-chars";
360
- ValidationCode2["MaxSpecialChars"] = "max-special-chars";
361
- return ValidationCode2;
362
- })(ValidationCode || {});
363
-
364
- // src/enums/ValidationStatus.ts
365
- var ValidationStatus = /* @__PURE__ */ ((ValidationStatus2) => {
366
- ValidationStatus2["Ok"] = "ok";
367
- ValidationStatus2["Ko"] = "ko";
368
- ValidationStatus2["Info"] = "info";
369
- return ValidationStatus2;
370
- })(ValidationStatus || {});
371
-
372
- // src/instances/FieldValidation.ts
373
- var FieldValidation = class _FieldValidation {
374
- code = void 0;
375
- status = "info" /* Info */;
376
- min = 0;
377
- max = 0;
378
- equalToValue = void 0;
379
- constructor(code, status) {
380
- this.code = code;
381
- this.status = status;
382
- }
383
- setMin(n) {
384
- this.min = n;
385
- return this;
386
- }
387
- setMax(n) {
388
- this.max = n;
389
- return this;
390
- }
391
- setEqualToValue(val) {
392
- this.equalToValue = val;
393
- return this;
394
- }
395
- static createEmpty(status = "ko" /* Ko */) {
396
- return new _FieldValidation("empty" /* Empty */, status);
397
- }
398
- static createEmail(status = "ko" /* Ko */) {
399
- return new _FieldValidation("email" /* Email */, status);
400
- }
401
- static createMinStr(min, status = "ko" /* Ko */) {
402
- return new _FieldValidation("min-str" /* MinStringLength */, status).setMin(min);
403
- }
404
- static createMaxStr(max, status = "ko" /* Ko */) {
405
- return new _FieldValidation("max-str" /* MaxStringLength */, status).setMax(max);
406
- }
407
- static createMinNum(min, status = "ko" /* Ko */) {
408
- return new _FieldValidation("min-num" /* MinNumber */, status).setMin(min);
409
- }
410
- static createMaxNum(max, status = "ko" /* Ko */) {
411
- return new _FieldValidation("max-num" /* MaxNumber */, status).setMax(max);
412
- }
413
- static createNumBetween(min, max, status = "ko" /* Ko */) {
414
- return new _FieldValidation("max-num" /* MaxNumber */, status).setMin(min).setMax(max);
415
- }
416
- static createMinNumbers(min, status = "ko" /* Ko */) {
417
- return new _FieldValidation("min-numbers" /* MinNumbers */, status).setMin(min);
418
- }
419
- static createMaxNumbers(max, status = "ko" /* Ko */) {
420
- return new _FieldValidation("max-numbers" /* MaxNumbers */, status).setMax(max);
421
- }
422
- static createMinUpperChars(min, status = "ko" /* Ko */) {
423
- return new _FieldValidation("min-upper-chars" /* MinUpperChars */, status).setMin(min);
424
- }
425
- static createMaxUpperChars(max, status = "ko" /* Ko */) {
426
- return new _FieldValidation("max-upper-chars" /* MaxUpperChars */, status).setMax(max);
427
- }
428
- static createMinLowerChars(min, status = "ko" /* Ko */) {
429
- return new _FieldValidation("min-lower-chars" /* MinLowerChars */, status).setMin(min);
430
- }
431
- static createMaxLowerChars(max, status = "ko" /* Ko */) {
432
- return new _FieldValidation("max-lower-chars" /* MaxLowerChars */, status).setMax(max);
433
- }
434
- static createMinSpecialChars(min, status = "ko" /* Ko */) {
435
- return new _FieldValidation("min-special-chars" /* MinSpecialChars */, status).setMin(min);
436
- }
437
- static createMaxSpecialChars(max, status = "ko" /* Ko */) {
438
- return new _FieldValidation("max-special-chars" /* MaxSpecialChars */, status).setMax(max);
439
- }
440
- static createMinChars(min, status = "ko" /* Ko */) {
441
- return new _FieldValidation("min-chars" /* MinChars */, status).setMin(min);
442
- }
443
- static createMaxChars(max, status = "ko" /* Ko */) {
444
- return new _FieldValidation("max-chars" /* MaxChars */, status).setMax(max);
445
- }
446
- static createEqualTo(value, status = "ko" /* Ko */) {
447
- return new _FieldValidation("equal-to" /* EqualTo */, status).setEqualToValue(value);
448
- }
449
- };
450
-
451
- // src/enums/ColumnType.ts
452
- var ColumnType = /* @__PURE__ */ ((ColumnType2) => {
453
- ColumnType2["None"] = "";
454
- ColumnType2["Field"] = "field";
455
- ColumnType2["Button"] = "button";
456
- ColumnType2["Anchor"] = "anchor";
457
- return ColumnType2;
458
- })(ColumnType || {});
459
-
460
- // src/value-objects/SafeString.ts
461
- var SafeString = class _SafeString {
462
- value;
463
- constructor(input) {
464
- this.value = input;
465
- }
466
- getValue(...args) {
467
- if (typeof this.value === "function") {
468
- return this.value(...args);
469
- } else if (typeof this.value === "object" && typeof this.value === typeof _SafeString) {
470
- return this.value.getValue(...args);
471
- } else if (typeof this.value === "string") {
472
- return this.value;
473
- }
474
- return "";
475
- }
476
- };
477
-
478
- // src/enums/AnchorType.ts
479
- var AnchorType = /* @__PURE__ */ ((AnchorType2) => {
480
- AnchorType2["Href"] = "href";
481
- AnchorType2["RouterLink"] = "router-link";
482
- AnchorType2["RouterLinkBack"] = "router-link-back";
483
- AnchorType2["Mail"] = "mail";
484
- AnchorType2["Tel"] = "tel";
485
- AnchorType2["Tab"] = "tab";
486
- AnchorType2["Download"] = "download";
487
- AnchorType2["Action"] = "action";
488
- AnchorType2["Legacy"] = "";
489
- return AnchorType2;
490
- })(AnchorType || {});
491
-
492
- // src/instances/Anchor.ts
493
- var Anchor = class extends LktItem {
494
- static lktAllowUndefinedProps = [
495
- "onClick"
496
- ];
497
- static lktDefaultValues = [
498
- "type",
499
- "to",
500
- "class",
501
- "isActive",
502
- "downloadFileName",
503
- "disabled",
504
- "onClick",
505
- "confirmModal",
506
- "confirmModalKey",
507
- "confirmData",
508
- "imposter",
509
- "external"
510
- ];
511
- type = "router-link" /* RouterLink */;
512
- to = "";
513
- class = "";
514
- isActive = false;
515
- downloadFileName = "";
516
- disabled = false;
517
- onClick = void 0;
518
- confirmModal = "";
519
- confirmModalKey = "_";
520
- confirmData = {};
521
- imposter = false;
522
- external = false;
523
- getHref() {
524
- let href = "";
525
- if (typeof this.to === "string") href = this.to;
526
- if ("mail" /* Mail */ === this.type) return `mailto:${href}`;
527
- if ("tel" /* Tel */ === this.type) return `tel:${href}`;
528
- if ([
529
- "href" /* Href */,
530
- "mail" /* Mail */,
531
- "tel" /* Tel */,
532
- "tab" /* Tab */,
533
- "download" /* Download */
534
- ].includes(this.type)) {
535
- return href;
536
- }
537
- if (typeof this.to === "string" && this.to !== "") return this.to;
538
- return "";
539
- }
540
- constructor(data = {}) {
541
- super();
542
- this.feed(data);
543
- }
544
- };
545
-
546
- // src/instances/Button.ts
547
- import { generateRandomString as generateRandomString2 } from "lkt-string-tools";
548
- var Button = class extends LktItem {
549
- lktAllowUndefinedProps = [
550
- "clickRef",
551
- "tabindex",
552
- "anchor",
553
- "showTooltipOnHover",
554
- "hideTooltipOnLeave"
555
- ];
556
- static lktDefaultValues = [
557
- "type",
558
- "name",
559
- "class",
560
- "containerClass",
561
- "value",
562
- "disabled",
563
- "loading",
564
- "wrapContent",
565
- "splitIcon",
566
- "resource",
567
- "resourceData",
568
- "modal",
569
- "modalKey",
570
- "modalData",
571
- "confirmModal",
572
- "confirmModalKey",
573
- "confirmData",
574
- "modalCallbacks",
575
- "text",
576
- "textOn",
577
- "textOff",
578
- "icon",
579
- "iconOn",
580
- "iconOff",
581
- "iconEndOn",
582
- "iconEndOff",
583
- "dot",
584
- "iconEnd",
585
- "img",
586
- "showTooltipOnHoverDelay",
587
- "tooltip",
588
- "checked",
589
- "clickRef",
590
- "openTooltip",
591
- "tabindex",
592
- "anchor",
593
- "showTooltipOnHover",
594
- "hideTooltipOnLeave",
595
- "splitClass",
596
- "prop",
597
- "onClick"
598
- ];
599
- type = "button" /* Button */;
600
- name = generateRandomString2(10);
601
- palette = "";
602
- class = "";
603
- containerClass = "";
604
- value = "";
605
- disabled = false;
606
- loading = false;
607
- wrapContent = false;
608
- splitIcon = "";
609
- resource = "";
610
- resourceData = {};
611
- modal = "";
612
- modalKey = "_";
613
- modalData = {};
614
- confirmModal = "";
615
- confirmModalKey = "_";
616
- confirmData = {};
617
- modalCallbacks = [];
618
- text = "";
619
- textOn = void 0;
620
- textOff = void 0;
621
- iconOn = void 0;
622
- iconOff = void 0;
623
- iconEndOn = void 0;
624
- iconEndOff = void 0;
625
- icon = "";
626
- dot = false;
627
- iconEnd = "";
628
- img = "";
629
- showTooltipOnHoverDelay = 0;
630
- checked = false;
631
- clickRef = void 0;
632
- openTooltip = false;
633
- tabindex = void 0;
634
- anchor = void 0;
635
- showTooltipOnHover = void 0;
636
- hideTooltipOnLeave = void 0;
637
- splitClass = "";
638
- tooltip = {};
639
- prop = {};
640
- // Event management
641
- onClick = void 0;
642
- constructor(data = {}) {
643
- super();
644
- this.feed(data);
645
- this.anchor = new Anchor(data.anchor);
646
- }
647
- isDisabled() {
648
- if (typeof this.disabled === "function") return this.disabled();
649
- return this.disabled;
650
- }
651
- };
652
-
653
- // src/instances/Column.ts
654
- var Column = class extends LktItem {
655
- lktExcludedProps = ["link", "field", "anchor", "button"];
656
- lktAllowUndefinedProps = [
657
- "formatter",
658
- "checkEmpty",
659
- "colspan",
660
- "field",
661
- "anchor",
662
- "button",
663
- "link",
664
- "action"
665
- ];
666
- static lktDefaultValues = [
667
- "type",
668
- "key",
669
- "label",
670
- "sortable",
671
- "hidden",
672
- "editable",
673
- "formatter",
674
- "checkEmpty",
675
- "colspan",
676
- "preferSlot",
677
- "isForRowKey",
678
- "extractTitleFromColumn",
679
- "slotData",
680
- "field",
681
- "anchor",
682
- "button",
683
- "link",
684
- "action"
685
- ];
686
- type = "" /* None */;
687
- key = "";
688
- label = "";
689
- sortable = true;
690
- hidden = false;
691
- editable = false;
692
- formatter = void 0;
693
- checkEmpty = void 0;
694
- colspan = void 0;
695
- preferSlot = true;
696
- isForRowKey = false;
697
- extractTitleFromColumn = "";
698
- slotData = {};
699
- field = void 0;
700
- anchor = void 0;
701
- button = void 0;
702
- link = void 0;
703
- action = void 0;
704
- constructor(data = {}) {
705
- super();
706
- this.feed(data);
707
- switch (this.type) {
708
- case "field" /* Field */:
709
- this.field = new Field(data.field);
710
- break;
711
- case "anchor" /* Anchor */:
712
- this.anchor = new Anchor(data.anchor);
713
- break;
714
- case "button" /* Button */:
715
- this.button = new Button(data.button);
716
- break;
717
- }
718
- this.link = new SafeString(data.link);
719
- }
720
- getHref(item) {
721
- if (typeof this.link !== "object") return "";
722
- return this.link.getValue(item);
723
- }
724
- doAction(item) {
725
- if (typeof this.action === "function") {
726
- return this.action(item);
727
- }
728
- console.warn("No action defined");
729
- }
730
- };
731
-
732
- // src/enums/AccordionType.ts
733
- var AccordionType = /* @__PURE__ */ ((AccordionType2) => {
734
- AccordionType2["Auto"] = "auto";
735
- AccordionType2["Always"] = "always";
736
- AccordionType2["Lazy"] = "lazy";
737
- AccordionType2["Ever"] = "ever";
738
- return AccordionType2;
739
- })(AccordionType || {});
740
-
741
- // src/enums/AccordionToggleMode.ts
742
- var AccordionToggleMode = /* @__PURE__ */ ((AccordionToggleMode2) => {
743
- AccordionToggleMode2["Transform"] = "transform";
744
- AccordionToggleMode2["Height"] = "height";
745
- AccordionToggleMode2["Display"] = "display";
746
- return AccordionToggleMode2;
747
- })(AccordionToggleMode || {});
748
-
749
- // src/instances/Accordion.ts
750
- var Accordion = class extends LktItem {
751
- static lktAllowUndefinedProps = [
752
- "onClick"
753
- ];
754
- static lktDefaultValues = [
755
- "modelValue",
756
- "type",
757
- "toggleMode",
758
- "actionButton",
759
- "toggleButton",
760
- "toggleOnClickIntro",
761
- "toggleTimeout",
762
- "title",
763
- "icon",
764
- "class",
765
- "contentClass",
766
- "iconRotation",
767
- "minHeight",
768
- "iconAtEnd"
769
- ];
770
- // Main config
771
- modelValue = false;
772
- type = "auto" /* Auto */;
773
- toggleMode = "height" /* Height */;
774
- // Buttons config
775
- actionButton = {};
776
- toggleButton = {};
777
- // Toggle config
778
- toggleOnClickIntro = false;
779
- toggleTimeout = 0;
780
- // Visuals
781
- title = "";
782
- icon = "";
783
- class = "";
784
- contentClass = "";
785
- iconRotation = "90";
786
- minHeight = void 0;
787
- iconAtEnd = false;
788
- constructor(data = {}) {
789
- super();
790
- this.feed(data);
791
- }
792
- };
793
-
794
- // src/enums/TooltipPositionEngine.ts
795
- var TooltipPositionEngine = /* @__PURE__ */ ((TooltipPositionEngine2) => {
796
- TooltipPositionEngine2["Fixed"] = "fixed";
797
- TooltipPositionEngine2["Absolute"] = "absolute";
798
- return TooltipPositionEngine2;
799
- })(TooltipPositionEngine || {});
800
-
801
- // src/enums/TooltipLocationY.ts
802
- var TooltipLocationY = /* @__PURE__ */ ((TooltipLocationY2) => {
803
- TooltipLocationY2["Top"] = "top";
804
- TooltipLocationY2["Bottom"] = "bottom";
805
- TooltipLocationY2["Center"] = "center";
806
- TooltipLocationY2["ReferrerCenter"] = "referrer-center";
807
- return TooltipLocationY2;
808
- })(TooltipLocationY || {});
809
-
810
- // src/enums/TooltipLocationX.ts
811
- var TooltipLocationX = /* @__PURE__ */ ((TooltipLocationX2) => {
812
- TooltipLocationX2["Left"] = "left";
813
- TooltipLocationX2["Right"] = "right";
814
- TooltipLocationX2["Center"] = "center";
815
- TooltipLocationX2["LeftCorner"] = "left-corner";
816
- TooltipLocationX2["RightCorner"] = "right-corner";
817
- return TooltipLocationX2;
818
- })(TooltipLocationX || {});
819
-
820
- // src/instances/Tooltip.ts
821
- var Tooltip = class extends LktItem {
822
- static lktDefaultValues = [
823
- "modelValue",
824
- "alwaysOpen",
825
- "class",
826
- "text",
827
- "icon",
828
- "iconAtEnd",
829
- "engine",
830
- "referrerWidth",
831
- "referrerMargin",
832
- "windowMargin",
833
- "referrer",
834
- "locationY",
835
- "locationX"
836
- ];
837
- modelValue = false;
838
- alwaysOpen = false;
839
- class = "";
840
- text = "";
841
- icon = "";
842
- iconAtEnd = false;
843
- engine = "fixed" /* Fixed */;
844
- referrerWidth = false;
845
- referrerMargin = 0;
846
- windowMargin = 0;
847
- referrer = void 0;
848
- locationY = "bottom" /* Bottom */;
849
- locationX = "left-corner" /* LeftCorner */;
850
- constructor(data = {}) {
851
- super();
852
- this.feed(data);
853
- }
854
- };
855
-
856
- // src/enums/ItemCrudMode.ts
857
- var ItemCrudMode = /* @__PURE__ */ ((ItemCrudMode2) => {
858
- ItemCrudMode2["Create"] = "create";
859
- ItemCrudMode2["Update"] = "update";
860
- ItemCrudMode2["Read"] = "read";
861
- return ItemCrudMode2;
862
- })(ItemCrudMode || {});
863
-
864
- // src/enums/ItemCrudView.ts
865
- var ItemCrudView = /* @__PURE__ */ ((ItemCrudView2) => {
866
- ItemCrudView2["Inline"] = "inline";
867
- ItemCrudView2["Modal"] = "modal";
868
- return ItemCrudView2;
869
- })(ItemCrudView || {});
870
-
871
- // src/enums/ItemCrudButtonNavPosition.ts
872
- var ItemCrudButtonNavPosition = /* @__PURE__ */ ((ItemCrudButtonNavPosition2) => {
873
- ItemCrudButtonNavPosition2["Top"] = "top";
874
- ItemCrudButtonNavPosition2["Bottom"] = "bottom";
875
- return ItemCrudButtonNavPosition2;
876
- })(ItemCrudButtonNavPosition || {});
877
-
878
- // src/enums/ItemCrudButtonNavVisibility.ts
879
- var ItemCrudButtonNavVisibility = /* @__PURE__ */ ((ItemCrudButtonNavVisibility2) => {
880
- ItemCrudButtonNavVisibility2["Changed"] = "changed";
881
- ItemCrudButtonNavVisibility2["Always"] = "always";
882
- ItemCrudButtonNavVisibility2["Never"] = "never";
883
- return ItemCrudButtonNavVisibility2;
884
- })(ItemCrudButtonNavVisibility || {});
885
-
886
- // src/enums/SaveType.ts
887
- var SaveType = /* @__PURE__ */ ((SaveType2) => {
888
- SaveType2["Manual"] = "manual";
889
- SaveType2["Auto"] = "auto";
890
- SaveType2["Delay"] = "delay";
891
- return SaveType2;
892
- })(SaveType || {});
893
-
894
- // src/instances/ItemCrud.ts
895
- var ItemCrud = class extends LktItem {
896
- // static lktAllowUndefinedProps: string[] = [
897
- // ];
898
- //
899
- static lktDefaultValues = [
900
- "modelValue",
901
- "editing",
902
- "mode",
903
- "view",
904
- "editModeButton",
905
- "dropButton",
906
- "createButton",
907
- "updateButton",
908
- "modalConfig",
909
- "saveConfig",
910
- "title",
911
- "readResource",
912
- "readData",
913
- "beforeEmitUpdate",
914
- "dataStateConfig",
915
- "buttonNavPosition",
916
- "buttonNavVisibility"
917
- ];
918
- modelValue = {};
919
- editing = false;
920
- // Global config
921
- mode = "read" /* Read */;
922
- view = "inline" /* Inline */;
923
- // Buttons
924
- editModeButton = {};
925
- // Not sure, should test
926
- dropButton = {};
927
- createButton = {};
928
- updateButton = {};
929
- // Config if type === modal
930
- modalConfig = {};
931
- // Save config
932
- saveConfig = {
933
- type: "manual" /* Manual */
934
- };
935
- title = "";
936
- readResource = "";
937
- readData = {};
938
- beforeEmitUpdate = void 0;
939
- dataStateConfig = {};
940
- buttonNavPosition = "top" /* Top */;
941
- buttonNavVisibility = "always" /* Always */;
942
- constructor(data = {}) {
943
- super();
944
- this.feed(data);
945
- }
946
- };
947
-
948
- // src/instances/Modal.ts
949
- var Modal = class extends LktItem {
950
- static lktDefaultValues = [
951
- "size",
952
- "preTitle",
953
- "preTitleIcon",
954
- "title",
955
- "closeIcon",
956
- "closeConfirm",
957
- "closeConfirmKey",
958
- "showClose",
959
- "disabledClose",
960
- "disabledVeilClick",
961
- "hiddenFooter",
962
- "modalName",
963
- "modalKey",
964
- "zIndex",
965
- "beforeClose",
966
- "item"
967
- ];
968
- size = "";
969
- preTitle = "";
970
- preTitleIcon = "";
971
- title = "";
972
- closeIcon = "";
973
- closeConfirm = "";
974
- closeConfirmKey = "_";
975
- showClose = true;
976
- disabledClose = false;
977
- disabledVeilClick = false;
978
- hiddenFooter = false;
979
- modalName = "";
980
- modalKey = "_";
981
- zIndex = 500;
982
- beforeClose = void 0;
983
- item = {};
984
- confirmButton = {};
985
- cancelButton = {};
986
- constructor(data = {}) {
987
- super();
988
- this.feed(data);
989
- }
990
- };
991
-
992
- // src/enums/PaginatorType.ts
993
- var PaginatorType = /* @__PURE__ */ ((PaginatorType2) => {
994
- PaginatorType2["Pages"] = "pages";
995
- PaginatorType2["PrevNext"] = "prev-next";
996
- PaginatorType2["PagesPrevNext"] = "pages-prev-next";
997
- PaginatorType2["PagesPrevNextFirstLast"] = "pages-prev-next-first-last";
998
- PaginatorType2["LoadMore"] = "load-more";
999
- PaginatorType2["Infinite"] = "infinite";
1000
- return PaginatorType2;
1001
- })(PaginatorType || {});
1002
-
1003
- // src/instances/Paginator.ts
1004
- var Paginator = class extends LktItem {
1005
- static lktAllowUndefinedProps = [];
1006
- static lktDefaultValues = [
1007
- "type",
1008
- "modelValue",
1009
- "class",
1010
- "resource",
1011
- "readOnly",
1012
- "loading",
1013
- "filters"
1014
- ];
1015
- type = "pages-prev-next" /* PagesPrevNext */;
1016
- modelValue = 1;
1017
- class = "";
1018
- resource = "";
1019
- readOnly = false;
1020
- loading = false;
1021
- filters = {};
1022
- constructor(data = {}) {
1023
- super();
1024
- this.feed(data);
1025
- }
1026
- };
1027
-
1028
- // src/enums/TableType.ts
1029
- var TableType = /* @__PURE__ */ ((TableType2) => {
1030
- TableType2["Table"] = "table";
1031
- TableType2["Item"] = "item";
1032
- TableType2["Ul"] = "ul";
1033
- TableType2["Ol"] = "ol";
1034
- return TableType2;
1035
- })(TableType || {});
1036
-
1037
- // src/enums/TableRowType.ts
1038
- var TableRowType = /* @__PURE__ */ ((TableRowType2) => {
1039
- TableRowType2[TableRowType2["Auto"] = 0] = "Auto";
1040
- TableRowType2[TableRowType2["PreferItem"] = 1] = "PreferItem";
1041
- TableRowType2[TableRowType2["PreferCustomItem"] = 2] = "PreferCustomItem";
1042
- TableRowType2[TableRowType2["PreferColumns"] = 3] = "PreferColumns";
1043
- return TableRowType2;
1044
- })(TableRowType || {});
1045
-
1046
- // src/instances/Table.ts
1047
- var Table = class extends LktItem {
1048
- static lktDefaultValues = [
1049
- "modelValue",
1050
- "type",
1051
- "columns",
1052
- "resource",
1053
- "noResultsText",
1054
- "filters",
1055
- "hideEmptyColumns",
1056
- "itemDisplayChecker",
1057
- "loading",
1058
- "page",
1059
- "perms",
1060
- "editMode",
1061
- "dataStateConfig",
1062
- "sortable",
1063
- "sorter",
1064
- "initialSorting",
1065
- "drag",
1066
- "paginator",
1067
- "header",
1068
- "title",
1069
- "titleTag",
1070
- "titleIcon",
1071
- "headerClass",
1072
- "saveButton",
1073
- "createButton",
1074
- "dropButton",
1075
- "wrapContentTag",
1076
- "wrapContentClass",
1077
- "itemsContainerClass",
1078
- "hiddenSave",
1079
- "createText",
1080
- "createIcon",
1081
- "createRoute",
1082
- "dropText",
1083
- "dropIcon",
1084
- "editText",
1085
- "editIcon",
1086
- "editLink",
1087
- "editModeText",
1088
- "switchEditionEnabled",
1089
- "createDisabled",
1090
- "dropConfirm",
1091
- "dropResource",
1092
- "addNavigation",
1093
- "createEnabledValidator",
1094
- "newValueGenerator",
1095
- "requiredItemsForTopCreate",
1096
- "requiredItemsForBottomCreate",
1097
- "slotItemVar"
1098
- ];
1099
- // Data
1100
- modelValue = [];
1101
- type = "table" /* Table */;
1102
- columns = [];
1103
- resource = "";
1104
- noResultsText = "";
1105
- filters = [];
1106
- // Data visualization
1107
- hideEmptyColumns = false;
1108
- itemDisplayChecker = void 0;
1109
- rowDisplayType = 0 /* Auto */;
1110
- // State
1111
- loading = false;
1112
- page = 1;
1113
- perms = [];
1114
- editMode = false;
1115
- dataStateConfig = {};
1116
- // Sort
1117
- sortable = false;
1118
- sorter = void 0;
1119
- initialSorting = false;
1120
- // Drag
1121
- drag = void 0;
1122
- // Pagination
1123
- paginator = void 0;
1124
- // New proposed prop: header
1125
- header;
1126
- // Replaces:
1127
- title = "";
1128
- titleTag = "h2";
1129
- titleIcon = "";
1130
- headerClass = "";
1131
- // Buttons
1132
- saveButton = {};
1133
- createButton = {};
1134
- dropButton = {};
1135
- hiddenSave = false;
1136
- wrapContentTag = "div";
1137
- wrapContentClass = "";
1138
- itemsContainerClass = "";
1139
- createText = "";
1140
- createIcon = "";
1141
- createRoute = "";
1142
- dropText = "";
1143
- dropIcon = "";
1144
- editText = "";
1145
- editIcon = "";
1146
- editLink = "";
1147
- editModeText = "";
1148
- switchEditionEnabled = false;
1149
- createDisabled = false;
1150
- dropConfirm = "";
1151
- dropResource = "";
1152
- addNavigation = false;
1153
- createEnabledValidator = void 0;
1154
- newValueGenerator = void 0;
1155
- requiredItemsForTopCreate = 0;
1156
- requiredItemsForBottomCreate = 0;
1157
- slotItemVar = "item";
1158
- constructor(data = {}) {
1159
- super();
1160
- this.feed(data);
1161
- }
1162
- };
1163
-
1164
- // src/enums/ModalCallbackAction.ts
1165
- var ModalCallbackAction = /* @__PURE__ */ ((ModalCallbackAction2) => {
1166
- ModalCallbackAction2["Refresh"] = "refresh";
1167
- ModalCallbackAction2["Close"] = "close";
1168
- ModalCallbackAction2["ReOpen"] = "reOpen";
1169
- ModalCallbackAction2["Exec"] = "exec";
1170
- ModalCallbackAction2["Open"] = "open";
1171
- return ModalCallbackAction2;
1172
- })(ModalCallbackAction || {});
1173
-
1174
- // src/enums/ModalType.ts
1175
- var ModalType = /* @__PURE__ */ ((ModalType2) => {
1176
- ModalType2["Modal"] = "modal";
1177
- ModalType2["Confirm"] = "confirm";
1178
- return ModalType2;
1179
- })(ModalType || {});
1180
-
1181
- // src/enums/SortDirection.ts
1182
- var SortDirection = /* @__PURE__ */ ((SortDirection2) => {
1183
- SortDirection2["Asc"] = "asc";
1184
- SortDirection2["Desc"] = "desc";
1185
- return SortDirection2;
1186
- })(SortDirection || {});
1187
-
1188
- // src/enums/TablePermission.ts
1189
- var TablePermission = /* @__PURE__ */ ((TablePermission2) => {
1190
- TablePermission2["Create"] = "create";
1191
- TablePermission2["Update"] = "update";
1192
- TablePermission2["Edit"] = "edit";
1193
- TablePermission2["Drop"] = "drop";
1194
- TablePermission2["Sort"] = "sort";
1195
- TablePermission2["SwitchEditMode"] = "switch-edit-mode";
1196
- TablePermission2["InlineEdit"] = "inline-edit";
1197
- TablePermission2["InlineCreate"] = "inline-create";
1198
- TablePermission2["ModalCreate"] = "modal-create";
1199
- TablePermission2["InlineCreateEver"] = "inline-create-ever";
1200
- return TablePermission2;
1201
- })(TablePermission || {});
1202
-
1203
- // src/enums/ToggleMode.ts
1204
- var ToggleMode = /* @__PURE__ */ ((ToggleMode2) => {
1205
- ToggleMode2["Lazy"] = "lazy";
1206
- ToggleMode2["Ever"] = "ever";
1207
- return ToggleMode2;
1208
- })(ToggleMode || {});
1209
-
1210
- // src/functions/extract-data-functions.ts
1211
- import { __ } from "lkt-i18n";
1212
- var extractPropValue = (needle, haystack) => {
1213
- if (typeof needle === "string" && needle.startsWith("prop:")) {
1214
- return haystack[needle.substring(5)];
1215
- }
1216
- return needle;
1217
- };
1218
- var extractI18nValue = (needle) => {
1219
- let txt = String(needle);
1220
- if (txt.startsWith("__:")) {
1221
- return __(txt.substring(3));
1222
- }
1223
- return txt;
1224
- };
1225
-
1226
- // src/functions/debug-functions.ts
1227
- var lktDebug = (component, ...args) => {
1228
- if (LktSettings.debugEnabled) console.info("::lkt::", `[${component}] `, ...args);
1229
- };
1230
-
1231
- // src/functions/table-functions.ts
1232
- var createColumn = (data) => {
1233
- return new Column(data);
1234
- };
1235
-
1236
- // src/index.ts
1237
- function getDefaultValues(cls) {
1238
- const instance = new cls();
1239
- const result = {};
1240
- if (!Array.isArray(cls.lktDefaultValues)) {
1241
- throw new Error("lktDefaultValues must be a keys array.");
1242
- }
1243
- for (const key of cls.lktDefaultValues) {
1244
- if (key in instance) {
1245
- result[key] = instance[key];
1246
- }
1247
- }
1248
- return result;
1249
- }
1250
- export {
1251
- Accordion,
1252
- AccordionToggleMode,
1253
- AccordionType,
1254
- Anchor,
1255
- AnchorType,
1256
- Button,
1257
- ButtonType,
1258
- Column,
1259
- ColumnType,
1260
- Field,
1261
- FieldAutoValidationTrigger,
1262
- FieldType,
1263
- FieldValidation,
1264
- ItemCrud,
1265
- ItemCrudButtonNavPosition,
1266
- ItemCrudButtonNavVisibility,
1267
- ItemCrudMode,
1268
- ItemCrudView,
1269
- LktItem,
1270
- LktSettings,
1271
- LktStrictItem,
1272
- Modal,
1273
- ModalCallbackAction,
1274
- ModalType,
1275
- MultipleOptionsDisplay,
1276
- Option,
1277
- Paginator,
1278
- PaginatorType,
1279
- SafeString,
1280
- SaveType,
1281
- SortDirection,
1282
- Table,
1283
- TablePermission,
1284
- TableRowType,
1285
- TableType,
1286
- ToggleMode,
1287
- Tooltip,
1288
- TooltipLocationX,
1289
- TooltipLocationY,
1290
- TooltipPositionEngine,
1291
- ValidationCode,
1292
- ValidationStatus,
1293
- booleanFieldTypes,
1294
- createColumn,
1295
- ensureButtonConfig,
1296
- extractI18nValue,
1297
- extractPropValue,
1298
- fieldTypesWithOptions,
1299
- fieldTypesWithoutClear,
1300
- fieldTypesWithoutUndo,
1301
- fieldsWithMultipleMode,
1302
- getDefaultValues,
1303
- lktDebug,
1304
- textFieldTypes,
1305
- textFieldTypesWithOptions
1306
- };
1
+ var L=(s=>(s.Button="button",s.Submit="submit",s.Reset="reset",s.Anchor="anchor",s.Content="content",s.Switch="switch",s.HiddenSwitch="hidden-switch",s.Split="split",s.SplitLazy="split-lazy",s.SplitEver="split-ever",s.Tooltip="tooltip",s.TooltipLazy="tooltip-lazy",s.TooltipEver="tooltip-ever",s))(L||{});var u=(e,t)=>typeof e>"u"?t:{...t,...e};var g=class e{static debugEnabled=!1;static debugMode(t=!0){return e.debugEnabled=t,e}static defaultSaveButton={text:"Save"};static setDefaultSaveButton(t,o=!0){return o?e.defaultSaveButton=t:e.defaultSaveButton=u(t,e.defaultSaveButton),e}static defaultConfirmButton={text:"Confirm"};static setDefaultConfirmButton(t,o=!0){return o?e.defaultConfirmButton=t:e.defaultConfirmButton=u(t,e.defaultConfirmButton),e}static defaultCancelButton={text:"Cancel"};static setDefaultCancelButton(t,o=!0){return o?e.defaultCancelButton=t:e.defaultCancelButton=u(t,e.defaultCancelButton),e}static defaultCreateButton={text:"Create"};static setDefaultCreateButton(t,o=!0){return o?e.defaultCreateButton=t:e.defaultCreateButton=u(t,e.defaultCreateButton),e}static defaultUpdateButton={text:"Update"};static setDefaultUpdateButton(t,o=!0){return o?e.defaultUpdateButton=t:e.defaultUpdateButton=u(t,e.defaultUpdateButton),e}static defaultDropButton={text:"Drop"};static setDefaultDropButton(t,o=!0){return o?e.defaultDropButton=t:e.defaultDropButton=u(t,e.defaultDropButton),e}static defaultEditModeButton={text:"Edit mode",type:"switch"};static setDefaultEditModeButton(t,o=!0){return o?e.defaultEditModeButton=t:e.defaultEditModeButton=u(t,e.defaultEditModeButton),e}static defaultToggleButton={text:"Toggle",textOn:"Close",textOff:"Show more",type:"hidden-switch"};static setDefaultToggleButton(t,o=!0){return o?e.defaultToggleButton=t:e.defaultToggleButton=u(t,e.defaultToggleButton),e}};var I=(a=>(a.Text="text",a.Email="email",a.Tel="tel",a.Password="password",a.Search="search",a.Number="number",a.Color="color",a.Range="range",a.Textarea="textarea",a.Html="html",a.Date="date",a.File="file",a.Image="image",a.Select="select",a.Check="check",a.Switch="switch",a.Calc="calc",a.Card="card",a.Elements="elements",a))(I||{});var rt=["text","search","select"],nt=["switch","check"],it=["switch","check"],at=["text","search"],lt=["switch","check"],st=["select","color","card"],ft=["text","email","password"];var dt=["lktDateProps","lktStrictItem","lktExcludedProps"],i=class e{static lktAllowUndefinedProps=[];static lktExcludedProps=[];static lktDateProps=[];static lktStrictItem=!1;static lktDefaultValues=[];constructor(t){}feed(t={},o=this){if(typeof t=="object")for(let[r,n]of Object.entries(t))o.assignProp(r,n)}assignProp(t,o){if(!(dt.includes(t)||e.lktExcludedProps.includes(t))&&!(e.lktStrictItem&&!this.hasOwnProperty(t))){if(e.lktDateProps.includes(t)){this[t]=new Date(o);return}this[t]=o}}};var M=class extends i{lktStrictItem=!0};var V=class extends i{value=void 0;label="";data={};disabled=!1;group="";icon="";modal="";constructor(t={}){super(),this.feed(t)}};import{generateRandomString as ut}from"lkt-string-tools";var P=(r=>(r.List="list",r.Inline="inline",r.Count="count",r))(P||{});var v=(n=>(n.None="",n.Focus="focus",n.Blur="blur",n.Always="always",n))(v||{});var x=class extends i{modelValue="";type="text";valid=void 0;placeholder="";searchPlaceholder="";label="";labelIcon="";labelIconAtEnd=!1;name=ut(16);autocomplete=!1;disabled=!1;readonly=!1;readMode=!1;allowReadModeSwitch=!1;tabindex=void 0;mandatory=!1;showPassword=!1;canClear=!1;canUndo=!1;canI18n=!1;canStep=!0;canTag=!0;mandatoryMessage="";infoMessage="";errorMessage="";min=void 0;max=void 0;step=1;enableAutoNumberFix=!0;emptyValueSlot="";optionSlot=void 0;valueSlot=void 0;editSlot=void 0;slotData={};resource="";resourceData={};validationResource="";validationResourceData={};autoValidation=!1;autoValidationType="blur";validationStack="default";minNumbers=void 0;maxNumbers=void 0;minChars=void 0;maxChars=void 0;minUpperChars=void 0;maxUpperChars=void 0;minLowerChars=void 0;maxLowerChars=void 0;minSpecialChars=void 0;maxSpecialChars=void 0;checkEqualTo=void 0;featuredButton="";infoButtonEllipsis=!1;fileName="";customButtonText="";customButtonClass="";options=[];multiple=!1;multipleDisplay="list";multipleDisplayEdition="inline";searchable=!1;autoloadOptionsResource=!1;optionsDownload="";optionsModal="";optionsModalData={};optionsText="";optionsIcon="";optionsClass="";optionsLabelFormatter=void 0;optionsResource="";optionsResourceData={};icon="";download="";modal="";modalKey="";modalData={};data={};validation={};constructor(t={}){super(),this.feed(t)}};var E=(l=>(l.MinStringLength="min-str",l.MinNumber="min-num",l.MaxStringLength="max-str",l.MaxNumber="max-num",l.Email="email",l.Empty="empty",l.EqualTo="equal-to",l.MinNumbers="min-numbers",l.MaxNumbers="max-numbers",l.MinChars="min-chars",l.MaxChars="max-chars",l.MinUpperChars="min-upper-chars",l.MaxUpperChars="max-upper-chars",l.MinLowerChars="min-lower-chars",l.MaxLowerChars="max-lower-chars",l.MinSpecialChars="min-special-chars",l.MaxSpecialChars="max-special-chars",l))(E||{});var F=(r=>(r.Ok="ok",r.Ko="ko",r.Info="info",r))(F||{});var k=class e{code=void 0;status="info";min=0;max=0;equalToValue=void 0;constructor(t,o){this.code=t,this.status=o}setMin(t){return this.min=t,this}setMax(t){return this.max=t,this}setEqualToValue(t){return this.equalToValue=t,this}static createEmpty(t="ko"){return new e("empty",t)}static createEmail(t="ko"){return new e("email",t)}static createMinStr(t,o="ko"){return new e("min-str",o).setMin(t)}static createMaxStr(t,o="ko"){return new e("max-str",o).setMax(t)}static createMinNum(t,o="ko"){return new e("min-num",o).setMin(t)}static createMaxNum(t,o="ko"){return new e("max-num",o).setMax(t)}static createNumBetween(t,o,r="ko"){return new e("max-num",r).setMin(t).setMax(o)}static createMinNumbers(t,o="ko"){return new e("min-numbers",o).setMin(t)}static createMaxNumbers(t,o="ko"){return new e("max-numbers",o).setMax(t)}static createMinUpperChars(t,o="ko"){return new e("min-upper-chars",o).setMin(t)}static createMaxUpperChars(t,o="ko"){return new e("max-upper-chars",o).setMax(t)}static createMinLowerChars(t,o="ko"){return new e("min-lower-chars",o).setMin(t)}static createMaxLowerChars(t,o="ko"){return new e("max-lower-chars",o).setMax(t)}static createMinSpecialChars(t,o="ko"){return new e("min-special-chars",o).setMin(t)}static createMaxSpecialChars(t,o="ko"){return new e("max-special-chars",o).setMax(t)}static createMinChars(t,o="ko"){return new e("min-chars",o).setMin(t)}static createMaxChars(t,o="ko"){return new e("max-chars",o).setMax(t)}static createEqualTo(t,o="ko"){return new e("equal-to",o).setEqualToValue(t)}};var T=(n=>(n.None="",n.Field="field",n.Button="button",n.Anchor="anchor",n))(T||{});var C=class e{value;constructor(t){this.value=t}getValue(...t){return typeof this.value=="function"?this.value(...t):typeof this.value=="object"&&typeof this.value==typeof e?this.value.getValue(...t):typeof this.value=="string"?this.value:""}};var N=(m=>(m.Href="href",m.RouterLink="router-link",m.RouterLinkBack="router-link-back",m.Mail="mail",m.Tel="tel",m.Tab="tab",m.Download="download",m.Action="action",m.Legacy="",m))(N||{});var p=class extends i{static lktAllowUndefinedProps=["onClick"];static lktDefaultValues=["type","to","class","isActive","downloadFileName","disabled","onClick","confirmModal","confirmModalKey","confirmData","imposter","external"];type="router-link";to="";class="";isActive=!1;downloadFileName="";disabled=!1;onClick=void 0;confirmModal="";confirmModalKey="_";confirmData={};imposter=!1;external=!1;getHref(){let t="";return typeof this.to=="string"&&(t=this.to),"mail"===this.type?`mailto:${t}`:"tel"===this.type?`tel:${t}`:["href","mail","tel","tab","download"].includes(this.type)?t:typeof this.to=="string"&&this.to!==""?this.to:""}constructor(t={}){super(),this.feed(t)}};import{generateRandomString as mt}from"lkt-string-tools";var b=class extends i{lktAllowUndefinedProps=["clickRef","tabindex","anchor","showTooltipOnHover","hideTooltipOnLeave"];static lktDefaultValues=["type","name","class","containerClass","value","disabled","loading","wrapContent","splitIcon","resource","resourceData","modal","modalKey","modalData","confirmModal","confirmModalKey","confirmData","modalCallbacks","text","textOn","textOff","icon","iconOn","iconOff","iconEndOn","iconEndOff","dot","iconEnd","img","showTooltipOnHoverDelay","tooltip","checked","clickRef","openTooltip","tabindex","anchor","showTooltipOnHover","hideTooltipOnLeave","splitClass","prop","onClick"];type="button";name=mt(10);palette="";class="";containerClass="";value="";disabled=!1;loading=!1;wrapContent=!1;splitIcon="";resource="";resourceData={};modal="";modalKey="_";modalData={};confirmModal="";confirmModalKey="_";confirmData={};modalCallbacks=[];text="";textOn=void 0;textOff=void 0;iconOn=void 0;iconOff=void 0;iconEndOn=void 0;iconEndOff=void 0;icon="";dot=!1;iconEnd="";img="";showTooltipOnHoverDelay=0;checked=!1;clickRef=void 0;openTooltip=!1;tabindex=void 0;anchor=void 0;showTooltipOnHover=void 0;hideTooltipOnLeave=void 0;splitClass="";tooltip={};prop={};onClick=void 0;constructor(t={}){super(),this.feed(t),this.anchor=new p(t.anchor)}isDisabled(){return typeof this.disabled=="function"?this.disabled():this.disabled}};var h=class extends i{lktExcludedProps=["link","field","anchor","button"];lktAllowUndefinedProps=["formatter","checkEmpty","colspan","field","anchor","button","link","action"];static lktDefaultValues=["type","key","label","sortable","hidden","editable","formatter","checkEmpty","colspan","preferSlot","isForRowKey","extractTitleFromColumn","slotData","field","anchor","button","link","action"];type="";key="";label="";sortable=!0;hidden=!1;editable=!1;formatter=void 0;checkEmpty=void 0;colspan=void 0;preferSlot=!0;isForRowKey=!1;extractTitleFromColumn="";slotData={};field=void 0;anchor=void 0;button=void 0;link=void 0;action=void 0;constructor(t={}){switch(super(),this.feed(t),this.type){case"field":this.field=new x(t.field);break;case"anchor":this.anchor=new p(t.anchor);break;case"button":this.button=new b(t.button);break}this.link=new C(t.link)}getHref(t){return typeof this.link!="object"?"":this.link.getValue(t)}doAction(t){if(typeof this.action=="function")return this.action(t);console.warn("No action defined")}};var A=(n=>(n.Auto="auto",n.Always="always",n.Lazy="lazy",n.Ever="ever",n))(A||{});var j=(r=>(r.Transform="transform",r.Height="height",r.Display="display",r))(j||{});var B=class extends i{static lktAllowUndefinedProps=["onClick"];static lktDefaultValues=["modelValue","type","toggleMode","actionButton","toggleButton","toggleOnClickIntro","toggleTimeout","title","icon","class","contentClass","iconRotation","minHeight","iconAtEnd","toggleIconAtEnd"];modelValue=!1;type="auto";toggleMode="height";actionButton={};toggleButton={};toggleOnClickIntro=!1;toggleTimeout=0;title="";icon="";class="";contentClass="";iconRotation="90";minHeight=void 0;iconAtEnd=!1;toggleIconAtEnd=!1;constructor(t={}){super(),this.feed(t)}};var K=(o=>(o.Fixed="fixed",o.Absolute="absolute",o))(K||{});var R=(n=>(n.Top="top",n.Bottom="bottom",n.Center="center",n.ReferrerCenter="referrer-center",n))(R||{});var U=(f=>(f.Left="left",f.Right="right",f.Center="center",f.LeftCorner="left-corner",f.RightCorner="right-corner",f))(U||{});var S=class extends i{static lktDefaultValues=["modelValue","alwaysOpen","class","text","icon","iconAtEnd","engine","referrerWidth","referrerMargin","windowMargin","referrer","locationY","locationX"];modelValue=!1;alwaysOpen=!1;class="";text="";icon="";iconAtEnd=!1;engine="fixed";referrerWidth=!1;referrerMargin=0;windowMargin=0;referrer=void 0;locationY="bottom";locationX="left-corner";constructor(t={}){super(),this.feed(t)}};var H=(r=>(r.Create="create",r.Update="update",r.Read="read",r))(H||{});var W=(o=>(o.Inline="inline",o.Modal="modal",o))(W||{});var q=(o=>(o.Top="top",o.Bottom="bottom",o))(q||{});var z=(r=>(r.Changed="changed",r.Always="always",r.Never="never",r))(z||{});var $=(r=>(r.Manual="manual",r.Auto="auto",r.Delay="delay",r))($||{});var w=class extends i{static lktDefaultValues=["modelValue","editing","mode","view","editModeButton","dropButton","createButton","updateButton","modalConfig","saveConfig","title","readResource","readData","beforeEmitUpdate","dataStateConfig","buttonNavPosition","buttonNavVisibility"];modelValue={};editing=!1;mode="read";view="inline";editModeButton={};dropButton={};createButton={};updateButton={};modalConfig={};saveConfig={type:"manual"};title="";readResource="";readData={};beforeEmitUpdate=void 0;dataStateConfig={};buttonNavPosition="top";buttonNavVisibility="always";constructor(t={}){super(),this.feed(t)}};var y=class extends i{static lktDefaultValues=["size","preTitle","preTitleIcon","title","closeIcon","closeConfirm","closeConfirmKey","showClose","disabledClose","disabledVeilClick","hiddenFooter","modalName","modalKey","zIndex","beforeClose","item"];size="";preTitle="";preTitleIcon="";title="";closeIcon="";closeConfirm="";closeConfirmKey="_";showClose=!0;disabledClose=!1;disabledVeilClick=!1;hiddenFooter=!1;modalName="";modalKey="_";zIndex=500;beforeClose=void 0;item={};confirmButton={};cancelButton={};constructor(t={}){super(),this.feed(t)}};var G=(c=>(c.Pages="pages",c.PrevNext="prev-next",c.PagesPrevNext="pages-prev-next",c.PagesPrevNextFirstLast="pages-prev-next-first-last",c.LoadMore="load-more",c.Infinite="infinite",c))(G||{});var O=class extends i{static lktAllowUndefinedProps=[];static lktDefaultValues=["type","modelValue","class","resource","readOnly","loading","filters"];type="pages-prev-next";modelValue=1;class="";resource="";readOnly=!1;loading=!1;filters={};constructor(t={}){super(),this.feed(t)}};var Y=(n=>(n.Table="table",n.Item="item",n.Ul="ul",n.Ol="ol",n))(Y||{});var J=(n=>(n[n.Auto=0]="Auto",n[n.PreferItem=1]="PreferItem",n[n.PreferCustomItem=2]="PreferCustomItem",n[n.PreferColumns=3]="PreferColumns",n))(J||{});var D=class extends i{static lktDefaultValues=["modelValue","type","columns","resource","noResultsText","filters","hideEmptyColumns","itemDisplayChecker","loading","page","perms","editMode","dataStateConfig","sortable","sorter","initialSorting","drag","paginator","header","title","titleTag","titleIcon","headerClass","saveButton","createButton","dropButton","wrapContentTag","wrapContentClass","itemsContainerClass","hiddenSave","createText","createIcon","createRoute","dropText","dropIcon","editText","editIcon","editLink","editModeText","switchEditionEnabled","createDisabled","dropConfirm","dropResource","addNavigation","createEnabledValidator","newValueGenerator","requiredItemsForTopCreate","requiredItemsForBottomCreate","slotItemVar"];modelValue=[];type="table";columns=[];resource="";noResultsText="";filters=[];hideEmptyColumns=!1;itemDisplayChecker=void 0;rowDisplayType=0;loading=!1;page=1;perms=[];editMode=!1;dataStateConfig={};sortable=!1;sorter=void 0;initialSorting=!1;drag=void 0;paginator=void 0;header;title="";titleTag="h2";titleIcon="";headerClass="";saveButton={};createButton={};dropButton={};hiddenSave=!1;wrapContentTag="div";wrapContentClass="";itemsContainerClass="";createText="";createIcon="";createRoute="";dropText="";dropIcon="";editText="";editIcon="";editLink="";editModeText="";switchEditionEnabled=!1;createDisabled=!1;dropConfirm="";dropResource="";addNavigation=!1;createEnabledValidator=void 0;newValueGenerator=void 0;requiredItemsForTopCreate=0;requiredItemsForBottomCreate=0;slotItemVar="item";constructor(t={}){super(),this.feed(t)}};var Q=(f=>(f.Refresh="refresh",f.Close="close",f.ReOpen="reOpen",f.Exec="exec",f.Open="open",f))(Q||{});var Z=(o=>(o.Modal="modal",o.Confirm="confirm",o))(Z||{});var X=(o=>(o.Asc="asc",o.Desc="desc",o))(X||{});var _=(d=>(d.Create="create",d.Update="update",d.Edit="edit",d.Drop="drop",d.Sort="sort",d.SwitchEditMode="switch-edit-mode",d.InlineEdit="inline-edit",d.InlineCreate="inline-create",d.ModalCreate="modal-create",d.InlineCreateEver="inline-create-ever",d))(_||{});var tt=(r=>(r.Left="left",r.Center="center",r.Right="right",r))(tt||{});var et=(o=>(o.Message="message",o.Button="button",o))(et||{});var ot=(o=>(o.Lazy="lazy",o.Ever="ever",o))(ot||{});import{__ as pt}from"lkt-i18n";var ct=(e,t)=>typeof e=="string"&&e.startsWith("prop:")?t[e.substring(5)]:e,gt=e=>{let t=String(e);return t.startsWith("__:")?pt(t.substring(3)):t};var xt=(e,...t)=>{g.debugEnabled&&console.info("::lkt::",`[${e}] `,...t)};var Ct=e=>new h(e);function Ne(e){let t=new e,o={};if(!Array.isArray(e.lktDefaultValues))throw new Error("lktDefaultValues must be a keys array.");for(let r of e.lktDefaultValues)r in t&&(o[r]=t[r]);return o}export{B as Accordion,j as AccordionToggleMode,A as AccordionType,p as Anchor,N as AnchorType,b as Button,L as ButtonType,h as Column,T as ColumnType,x as Field,v as FieldAutoValidationTrigger,I as FieldType,k as FieldValidation,w as ItemCrud,q as ItemCrudButtonNavPosition,z as ItemCrudButtonNavVisibility,H as ItemCrudMode,W as ItemCrudView,i as LktItem,g as LktSettings,M as LktStrictItem,y as Modal,Q as ModalCallbackAction,Z as ModalType,P as MultipleOptionsDisplay,V as Option,O as Paginator,G as PaginatorType,C as SafeString,$ as SaveType,X as SortDirection,D as Table,_ as TablePermission,J as TableRowType,Y as TableType,tt as ToastPositionX,et as ToastType,ot as ToggleMode,S as Tooltip,U as TooltipLocationX,R as TooltipLocationY,K as TooltipPositionEngine,E as ValidationCode,F as ValidationStatus,lt as booleanFieldTypes,Ct as createColumn,u as ensureButtonConfig,gt as extractI18nValue,ct as extractPropValue,rt as fieldTypesWithOptions,nt as fieldTypesWithoutClear,it as fieldTypesWithoutUndo,st as fieldsWithMultipleMode,Ne as getDefaultValues,xt as lktDebug,ft as textFieldTypes,at as textFieldTypesWithOptions};