lkt-vue-kernel 1.0.10 → 1.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,11 +1,194 @@
1
- import { DataState } from 'lkt-data-state';
2
1
  import { VueElement, Component } from 'vue';
3
2
  import { RouteLocationRaw } from 'vue-router';
3
+ import { DataState } from 'lkt-data-state';
4
4
 
5
5
  interface LktObject {
6
6
  [key: string | number]: any;
7
7
  }
8
8
 
9
+ declare const enum ButtonType {
10
+ Button = "button",// Default
11
+ Submit = "submit",// Form submit
12
+ Reset = "reset",
13
+ Anchor = "anchor",// Turns on anchor mode
14
+ Content = "content",// No click event
15
+ Switch = "switch",// Has a visible boolean state
16
+ HiddenSwitch = "hidden-switch",// Has a hidden boolean state
17
+ Split = "split",// Split button, content always generated
18
+ SplitLazy = "split-lazy",// Split button, contents generated after first open
19
+ SplitEver = "split-ever",// Split button, contents generated each time it's clicked
20
+ Tooltip = "tooltip",// Tooltip button, content always generated
21
+ TooltipLazy = "tooltip-lazy",// Tooltip button, contents generated after first open
22
+ TooltipEver = "tooltip-ever"
23
+ }
24
+
25
+ declare enum AnchorType {
26
+ Href = "href",// Vanilla JS+HTML anchor
27
+ RouterLink = "router-link",// For vue-router integration
28
+ RouterLinkBack = "router-link-back",// For vue-router back navigation
29
+ Mail = "mail",// Triggers OS mail integration
30
+ Tel = "tel",// Triggers OS phone integration
31
+ Tab = "tab",// New tab, similar to target="_blank"
32
+ Download = "download",// Download link
33
+ Action = "action",// Performs an action, without route changes
34
+ Legacy = ""
35
+ }
36
+
37
+ type ValidModalName = string | Function | undefined;
38
+
39
+ type EmptyModalKey = '_';
40
+
41
+ type ValidModalKey = string | Function | EmptyModalKey;
42
+
43
+ type BeforeCloseModalData = {
44
+ modalName: ValidModalKey;
45
+ modalKey: ValidModalKey;
46
+ item?: LktObject;
47
+ };
48
+
49
+ type ValidBeforeCloseModal = Function | undefined | ((data: BeforeCloseModalData) => void);
50
+
51
+ declare enum ModalType {
52
+ Modal = "modal",
53
+ Confirm = "confirm"
54
+ }
55
+
56
+ interface ModalConfig extends LktObject {
57
+ type?: ModalType;
58
+ size?: string;
59
+ preTitle?: string;
60
+ preTitleIcon?: string;
61
+ title?: string;
62
+ closeIcon?: string;
63
+ closeConfirm?: ValidModalName;
64
+ closeConfirmKey?: ValidModalKey;
65
+ showClose?: boolean;
66
+ disabledClose?: boolean;
67
+ disabledVeilClick?: boolean;
68
+ hiddenFooter?: boolean;
69
+ modalName?: ValidModalName;
70
+ modalKey?: ValidModalKey;
71
+ zIndex?: number;
72
+ beforeClose?: ValidBeforeCloseModal;
73
+ item?: LktObject;
74
+ confirmButton?: Partial<ButtonConfig>;
75
+ cancelButton?: Partial<ButtonConfig>;
76
+ }
77
+
78
+ interface AnchorConfig {
79
+ type?: AnchorType;
80
+ to?: RouteLocationRaw | string;
81
+ class?: string;
82
+ isActive?: boolean;
83
+ downloadFileName?: string;
84
+ disabled?: boolean;
85
+ onClick?: Function | undefined;
86
+ confirmModal?: ValidModalName;
87
+ confirmModalKey?: ValidModalKey;
88
+ confirmData?: ModalConfig;
89
+ imposter?: boolean;
90
+ external?: boolean;
91
+ }
92
+
93
+ type ValidTabIndex = string | number | undefined;
94
+
95
+ declare class LktItem implements LktObject {
96
+ static lktAllowUndefinedProps: string[];
97
+ static lktExcludedProps: string[];
98
+ static lktDateProps: string[];
99
+ static lktStrictItem: boolean;
100
+ static lktDefaultValues: (keyof LktObject)[];
101
+ constructor(data?: LktObject);
102
+ feed(data?: LktObject, target?: this): void;
103
+ assignProp(key: string, value: any): void;
104
+ }
105
+
106
+ declare class Anchor extends LktItem implements AnchorConfig {
107
+ static lktAllowUndefinedProps: string[];
108
+ static lktDefaultValues: (keyof AnchorConfig)[];
109
+ type: AnchorType;
110
+ to?: RouteLocationRaw | string;
111
+ class: string;
112
+ isActive: boolean;
113
+ downloadFileName: string;
114
+ disabled: boolean;
115
+ onClick: Function | undefined;
116
+ confirmModal: ValidModalName;
117
+ confirmModalKey: ValidModalKey;
118
+ confirmData: LktObject;
119
+ imposter: boolean;
120
+ external: boolean;
121
+ getHref(): string;
122
+ constructor(data?: Partial<AnchorConfig>);
123
+ }
124
+
125
+ declare enum TooltipPositionEngine {
126
+ Fixed = "fixed",
127
+ Absolute = "absolute"
128
+ }
129
+
130
+ interface IsDisabledCheckerArgs {
131
+ value?: any;
132
+ dataState?: DataState;
133
+ }
134
+
135
+ type IsDisabledChecker = ((args?: IsDisabledCheckerArgs) => boolean);
136
+
137
+ type ValidIsDisabledValue = boolean | undefined | IsDisabledChecker;
138
+
139
+ interface ButtonConfig {
140
+ type?: ButtonType;
141
+ checked?: boolean;
142
+ openTooltip?: boolean;
143
+ name?: string;
144
+ text?: string | number;
145
+ icon?: string;
146
+ class?: string;
147
+ containerClass?: string;
148
+ palette?: string;
149
+ value?: string;
150
+ disabled?: ValidIsDisabledValue;
151
+ loading?: boolean;
152
+ wrapContent?: boolean;
153
+ anchor?: AnchorConfig | Anchor;
154
+ resource?: string;
155
+ resourceData?: LktObject;
156
+ modal?: ValidModalName;
157
+ modalKey?: ValidModalKey;
158
+ modalData?: Partial<ModalConfig>;
159
+ confirmModal?: ValidModalName;
160
+ confirmModalKey?: ValidModalKey;
161
+ confirmData?: Partial<ModalConfig>;
162
+ iconDot?: boolean | string | number;
163
+ iconEnd?: string;
164
+ img?: string;
165
+ splitIcon?: string;
166
+ tooltipEngine?: TooltipPositionEngine;
167
+ showTooltipOnHover?: boolean;
168
+ showTooltipOnHoverDelay?: number;
169
+ hideTooltipOnLeave?: boolean;
170
+ tooltipWindowMargin?: number;
171
+ tooltipReferrerMargin?: number;
172
+ tooltipClass?: string;
173
+ tooltipLocationY?: string;
174
+ tooltipLocationX?: string;
175
+ splitClass?: string;
176
+ clickRef?: Element | VueElement;
177
+ tabindex?: ValidTabIndex;
178
+ prop?: LktObject;
179
+ onClick?: Function | undefined;
180
+ onConfirm?: Function | undefined;
181
+ }
182
+
183
+ declare class LktSettings {
184
+ static debug: boolean;
185
+ static version: string;
186
+ static defaultConfirmButton: Partial<ButtonConfig>;
187
+ static defaultCancelButton: Partial<ButtonConfig>;
188
+ static setDefaultConfirmButton(button: Partial<ButtonConfig>): typeof LktSettings;
189
+ static setDefaultCancelButton(button: Partial<ButtonConfig>): typeof LktSettings;
190
+ }
191
+
9
192
  declare enum FieldType {
10
193
  Text = "text",
11
194
  Email = "email",
@@ -40,19 +223,6 @@ interface OptionConfig {
40
223
  modal?: string | Function;
41
224
  }
42
225
 
43
- declare class LktItem implements LktObject {
44
- static lktAllowUndefinedProps: string[];
45
- static lktExcludedProps: string[];
46
- static lktDateProps: string[];
47
- static lktStrictItem: boolean;
48
- static lktDefaultValues: (keyof LktObject)[];
49
- constructor(data?: LktObject);
50
- feed(data?: LktObject, target?: this): void;
51
- assignProp(key: string, value: any): void;
52
- }
53
-
54
- type ValidModalName = string | Function | undefined;
55
-
56
226
  declare class Option extends LktItem implements OptionConfig {
57
227
  value: ValidOptionValue;
58
228
  label: string;
@@ -72,8 +242,6 @@ declare enum MultipleOptionsDisplay {
72
242
  Count = "count"
73
243
  }
74
244
 
75
- type ValidTabIndex = string | number | undefined;
76
-
77
245
  declare enum FieldAutoValidationTrigger {
78
246
  None = "",
79
247
  Focus = "focus",
@@ -164,11 +332,6 @@ interface FieldConfig {
164
332
  prop?: LktObject;
165
333
  }
166
334
 
167
- interface IsDisabledCheckerArgs {
168
- value?: any;
169
- dataState?: DataState;
170
- }
171
-
172
335
  declare enum ModalCallbackAction {
173
336
  Refresh = "refresh",
174
337
  Close = "close",
@@ -177,10 +340,6 @@ declare enum ModalCallbackAction {
177
340
  Open = "open"
178
341
  }
179
342
 
180
- type EmptyModalKey = '_';
181
-
182
- type ValidModalKey = string | Function | EmptyModalKey;
183
-
184
343
  interface ModalCallbackConfig {
185
344
  modalName: ValidModalName;
186
345
  modalKey?: ValidModalKey;
@@ -189,156 +348,6 @@ interface ModalCallbackConfig {
189
348
  args?: LktObject;
190
349
  }
191
350
 
192
- type BeforeCloseModalData = {
193
- modalName: ValidModalKey;
194
- modalKey: ValidModalKey;
195
- item?: LktObject;
196
- };
197
-
198
- type ValidBeforeCloseModal = Function | undefined | ((data: BeforeCloseModalData) => void);
199
-
200
- declare enum ModalType {
201
- Modal = "modal",
202
- Confirm = "confirm"
203
- }
204
-
205
- declare const enum ButtonType {
206
- Button = "button",// Default
207
- Submit = "submit",// Form submit
208
- Reset = "reset",
209
- Anchor = "anchor",// Turns on anchor mode
210
- Content = "content",// No click event
211
- Switch = "switch",// Has a visible boolean state
212
- HiddenSwitch = "hidden-switch",// Has a hidden boolean state
213
- Split = "split",// Split button, content always generated
214
- SplitLazy = "split-lazy",// Split button, contents generated after first open
215
- SplitEver = "split-ever",// Split button, contents generated each time it's clicked
216
- Tooltip = "tooltip",// Tooltip button, content always generated
217
- TooltipLazy = "tooltip-lazy",// Tooltip button, contents generated after first open
218
- TooltipEver = "tooltip-ever"
219
- }
220
-
221
- declare enum AnchorType {
222
- Href = "href",// Vanilla JS+HTML anchor
223
- RouterLink = "router-link",// For vue-router integration
224
- RouterLinkBack = "router-link-back",// For vue-router back navigation
225
- Mail = "mail",// Triggers OS mail integration
226
- Tel = "tel",// Triggers OS phone integration
227
- Tab = "tab",// New tab, similar to target="_blank"
228
- Download = "download",// Download link
229
- Action = "action",// Performs an action, without route changes
230
- Legacy = ""
231
- }
232
-
233
- interface AnchorConfig {
234
- type?: AnchorType;
235
- to?: RouteLocationRaw | string;
236
- class?: string;
237
- isActive?: boolean;
238
- downloadFileName?: string;
239
- disabled?: boolean;
240
- onClick?: Function | undefined;
241
- confirmModal?: ValidModalName;
242
- confirmModalKey?: ValidModalKey;
243
- confirmData?: ModalConfig;
244
- imposter?: boolean;
245
- external?: boolean;
246
- }
247
-
248
- declare class Anchor extends LktItem implements AnchorConfig {
249
- static lktAllowUndefinedProps: string[];
250
- static lktDefaultValues: (keyof AnchorConfig)[];
251
- type: AnchorType;
252
- to?: RouteLocationRaw | string;
253
- class: string;
254
- isActive: boolean;
255
- downloadFileName: string;
256
- disabled: boolean;
257
- onClick: Function | undefined;
258
- confirmModal: ValidModalName;
259
- confirmModalKey: ValidModalKey;
260
- confirmData: LktObject;
261
- imposter: boolean;
262
- external: boolean;
263
- getHref(): string;
264
- constructor(data?: Partial<AnchorConfig>);
265
- }
266
-
267
- declare enum TooltipPositionEngine {
268
- Fixed = "fixed",
269
- Absolute = "absolute"
270
- }
271
-
272
- type IsDisabledChecker = ((args?: IsDisabledCheckerArgs) => boolean);
273
-
274
- type ValidIsDisabledValue = boolean | undefined | IsDisabledChecker;
275
-
276
- interface ButtonConfig {
277
- type?: ButtonType;
278
- checked?: boolean;
279
- openTooltip?: boolean;
280
- name?: string;
281
- text?: string | number;
282
- icon?: string;
283
- class?: string;
284
- containerClass?: string;
285
- palette?: string;
286
- value?: string;
287
- disabled?: ValidIsDisabledValue;
288
- loading?: boolean;
289
- wrapContent?: boolean;
290
- anchor?: AnchorConfig | Anchor;
291
- resource?: string;
292
- resourceData?: LktObject;
293
- modal?: ValidModalName;
294
- modalKey?: ValidModalKey;
295
- modalData?: Partial<ModalConfig>;
296
- confirmModal?: ValidModalName;
297
- confirmModalKey?: ValidModalKey;
298
- confirmData?: Partial<ModalConfig>;
299
- iconDot?: boolean | string | number;
300
- iconEnd?: string;
301
- img?: string;
302
- splitIcon?: string;
303
- tooltipEngine?: TooltipPositionEngine;
304
- showTooltipOnHover?: boolean;
305
- showTooltipOnHoverDelay?: number;
306
- hideTooltipOnLeave?: boolean;
307
- tooltipWindowMargin?: number;
308
- tooltipReferrerMargin?: number;
309
- tooltipClass?: string;
310
- tooltipLocationY?: string;
311
- tooltipLocationX?: string;
312
- splitClass?: string;
313
- clickRef?: Element | VueElement;
314
- tabindex?: ValidTabIndex;
315
- prop?: LktObject;
316
- onClick?: Function | undefined;
317
- onConfirm?: Function | undefined;
318
- }
319
-
320
- interface ModalConfig extends LktObject {
321
- type?: ModalType;
322
- size?: string;
323
- preTitle?: string;
324
- preTitleIcon?: string;
325
- title?: string;
326
- closeIcon?: string;
327
- closeConfirm?: ValidModalName;
328
- closeConfirmKey?: ValidModalKey;
329
- showClose?: boolean;
330
- disabledClose?: boolean;
331
- disabledVeilClick?: boolean;
332
- hiddenFooter?: boolean;
333
- modalName?: ValidModalName;
334
- modalKey?: ValidModalKey;
335
- zIndex?: number;
336
- beforeClose?: ValidBeforeCloseModal;
337
- item?: LktObject;
338
- confirmButton?: Partial<ButtonConfig>;
339
- cancelButton?: Partial<ButtonConfig>;
340
- }
341
-
342
351
  declare enum PaginatorType {
343
352
  Pages = "pages",
344
353
  PrevNext = "prev-next",
@@ -827,7 +836,7 @@ type ValidCustomSlot = string | Component | undefined;
827
836
  type ValidScanPropTarget = ScanPropTarget | ((...args: any[]) => ScanPropTarget);
828
837
 
829
838
  declare const extractPropValue: (needle: ValidScanPropTarget, haystack: LktObject) => ValidScanPropTarget;
830
- declare const extractI18nValue: (needle: string) => any;
839
+ declare const extractI18nValue: (needle: string | number) => any;
831
840
 
832
841
  /**
833
842
  * Export common interfaces
@@ -838,4 +847,4 @@ declare function getDefaultValues<T>(cls: {
838
847
  lktDefaultValues: (keyof T)[];
839
848
  }): Partial<T>;
840
849
 
841
- export { Anchor, type AnchorConfig, AnchorType, type BeforeCloseModalData, Button, type ButtonConfig, ButtonType, Column, type ColumnConfig, ColumnType, type DragConfig, type EmptyModalKey, Field, FieldAutoValidationTrigger, type FieldConfig, FieldType, type IsDisabledChecker, type IsDisabledCheckerArgs, LktItem, type LktObject, LktStrictItem, Modal, ModalCallbackAction, type ModalCallbackConfig, type ModalConfig, ModalType, MultipleOptionsDisplay, Option, type OptionConfig, Paginator, type PaginatorConfig, PaginatorType, SafeString, type ScanPropTarget, SortDirection, Table, type TableConfig, TablePermission, TableRowType, TableType, ToggleMode, Tooltip, type TooltipConfig, TooltipLocationX, TooltipLocationY, TooltipPositionEngine, type ValidBeforeCloseModal, type ValidColSpan, type ValidCustomSlot, type ValidDragConfig, type ValidFieldMinMax, type ValidFieldValue, type ValidIsDisabledValue, type ValidModalKey, type ValidModalName, type ValidOptionValue, type ValidPaginatorConfig, type ValidSafeStringValue, type ValidScanPropTarget, type ValidTabIndex, type ValidTablePermission, type ValidTableRowTypeValue, extractI18nValue, extractPropValue, getDefaultValues };
850
+ export { Anchor, type AnchorConfig, AnchorType, type BeforeCloseModalData, Button, type ButtonConfig, ButtonType, Column, type ColumnConfig, ColumnType, type DragConfig, type EmptyModalKey, Field, FieldAutoValidationTrigger, type FieldConfig, FieldType, type IsDisabledChecker, type IsDisabledCheckerArgs, LktItem, type LktObject, LktSettings, LktStrictItem, Modal, ModalCallbackAction, type ModalCallbackConfig, type ModalConfig, ModalType, MultipleOptionsDisplay, Option, type OptionConfig, Paginator, type PaginatorConfig, PaginatorType, SafeString, type ScanPropTarget, SortDirection, Table, type TableConfig, TablePermission, TableRowType, TableType, ToggleMode, Tooltip, type TooltipConfig, TooltipLocationX, TooltipLocationY, TooltipPositionEngine, type ValidBeforeCloseModal, type ValidColSpan, type ValidCustomSlot, type ValidDragConfig, type ValidFieldMinMax, type ValidFieldValue, type ValidIsDisabledValue, type ValidModalKey, type ValidModalName, type ValidOptionValue, type ValidPaginatorConfig, type ValidSafeStringValue, type ValidScanPropTarget, type ValidTabIndex, type ValidTablePermission, type ValidTableRowTypeValue, extractI18nValue, extractPropValue, getDefaultValues };
package/dist/index.js CHANGED
@@ -1,3 +1,23 @@
1
+ // src/settings/LktSettings.ts
2
+ var LktSettings = class _LktSettings {
3
+ static debug = false;
4
+ static version = "0.0.1";
5
+ static defaultConfirmButton = {
6
+ text: "Confirm"
7
+ };
8
+ static defaultCancelButton = {
9
+ text: "Cancel"
10
+ };
11
+ static setDefaultConfirmButton(button) {
12
+ _LktSettings.defaultConfirmButton = button;
13
+ return _LktSettings;
14
+ }
15
+ static setDefaultCancelButton(button) {
16
+ _LktSettings.defaultCancelButton = button;
17
+ return _LktSettings;
18
+ }
19
+ };
20
+
1
21
  // src/instances/LktItem.ts
2
22
  var skipDataProps = [
3
23
  "lktDateProps",
@@ -814,10 +834,11 @@ var extractPropValue = (needle, haystack) => {
814
834
  return needle;
815
835
  };
816
836
  var extractI18nValue = (needle) => {
817
- if (needle.startsWith("__:")) {
818
- return __(needle.substring(3));
837
+ let txt = String(needle);
838
+ if (txt.startsWith("__:")) {
839
+ return __(txt.substring(3));
819
840
  }
820
- return needle;
841
+ return txt;
821
842
  };
822
843
 
823
844
  // src/index.ts
@@ -845,6 +866,7 @@ export {
845
866
  FieldAutoValidationTrigger,
846
867
  FieldType,
847
868
  LktItem,
869
+ LktSettings,
848
870
  LktStrictItem,
849
871
  Modal,
850
872
  ModalCallbackAction,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lkt-vue-kernel",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "description": "LKT Vue Kernel",
5
5
  "keywords": [
6
6
  "lkt",