lkt-vue-kernel 1.0.5 → 1.0.6
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 +123 -89
- package/dist/index.js +28 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { RouteLocationRaw } from 'vue-router';
|
|
2
1
|
import { VueElement } from 'vue';
|
|
2
|
+
import { RouteLocationRaw } from 'vue-router';
|
|
3
3
|
|
|
4
4
|
interface LktObject {
|
|
5
5
|
[key: string | number]: any;
|
|
@@ -158,68 +158,47 @@ interface FieldConfig {
|
|
|
158
158
|
modal?: string | Function;
|
|
159
159
|
modalKey?: string | number | Function;
|
|
160
160
|
modalData?: LktObject;
|
|
161
|
-
prop?: LktObject;
|
|
162
161
|
itemType?: string;
|
|
163
162
|
optionValueType?: string;
|
|
163
|
+
prop?: LktObject;
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
type EmptyModalKey = '_';
|
|
167
167
|
|
|
168
168
|
type ValidModalKey = string | Function | EmptyModalKey;
|
|
169
169
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
preTitleIcon?: string;
|
|
174
|
-
title?: string;
|
|
175
|
-
closeIcon?: string;
|
|
176
|
-
closeConfirm?: ValidModalName;
|
|
177
|
-
closeConfirmKey?: ValidModalKey;
|
|
178
|
-
showClose?: boolean;
|
|
179
|
-
disabledClose?: boolean;
|
|
180
|
-
disabledVeilClick?: boolean;
|
|
181
|
-
hiddenFooter?: boolean;
|
|
182
|
-
modalName?: ValidModalName;
|
|
183
|
-
modalKey?: ValidModalKey;
|
|
184
|
-
zIndex?: number;
|
|
185
|
-
beforeClose?: Function | undefined;
|
|
170
|
+
type BeforeCloseModalData = {
|
|
171
|
+
modalName: ValidModalKey;
|
|
172
|
+
modalKey: ValidModalKey;
|
|
186
173
|
item?: LktObject;
|
|
187
|
-
}
|
|
174
|
+
};
|
|
188
175
|
|
|
189
|
-
|
|
190
|
-
Top = "top",
|
|
191
|
-
Bottom = "bottom",
|
|
192
|
-
Center = "center",
|
|
193
|
-
ReferrerCenter = "referrer-center"
|
|
194
|
-
}
|
|
176
|
+
type ValidBeforeCloseModal = Function | undefined | ((data: BeforeCloseModalData) => void);
|
|
195
177
|
|
|
196
|
-
declare enum
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
Center = "center",
|
|
200
|
-
LeftCorner = "left-corner",
|
|
201
|
-
RightCorner = "right-corner"
|
|
178
|
+
declare enum ModalType {
|
|
179
|
+
Modal = "modal",
|
|
180
|
+
Confirm = "confirm"
|
|
202
181
|
}
|
|
203
182
|
|
|
204
|
-
declare enum
|
|
205
|
-
|
|
206
|
-
|
|
183
|
+
declare const enum ButtonType {
|
|
184
|
+
Button = "button",// Default
|
|
185
|
+
Submit = "submit",// Form submit
|
|
186
|
+
Reset = "reset",
|
|
187
|
+
Anchor = "anchor",// Turns on anchor mode
|
|
188
|
+
Content = "content",// No click event
|
|
189
|
+
Switch = "switch",// Has a visible boolean state
|
|
190
|
+
HiddenSwitch = "hidden-switch",// Has a hidden boolean state
|
|
191
|
+
Split = "split",// Split button, content always generated
|
|
192
|
+
SplitLazy = "split-lazy",// Split button, contents generated after first open
|
|
193
|
+
SplitEver = "split-ever",// Split button, contents generated each time it's clicked
|
|
194
|
+
Tooltip = "tooltip",// Tooltip button, content always generated
|
|
195
|
+
TooltipLazy = "tooltip-lazy",// Tooltip button, contents generated after first open
|
|
196
|
+
TooltipEver = "tooltip-ever"
|
|
207
197
|
}
|
|
208
198
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
class?: string;
|
|
213
|
-
text?: string;
|
|
214
|
-
icon?: string;
|
|
215
|
-
iconAtEnd?: boolean;
|
|
216
|
-
engine?: TooltipPositionEngine;
|
|
217
|
-
referrerMargin?: number | string;
|
|
218
|
-
windowMargin?: number | string;
|
|
219
|
-
referrerWidth?: boolean;
|
|
220
|
-
referrer?: HTMLElement | undefined;
|
|
221
|
-
locationY?: TooltipLocationY;
|
|
222
|
-
locationX?: TooltipLocationX;
|
|
199
|
+
declare enum ToggleMode {
|
|
200
|
+
Lazy = "lazy",
|
|
201
|
+
Ever = "ever"
|
|
223
202
|
}
|
|
224
203
|
|
|
225
204
|
declare enum AnchorType {
|
|
@@ -249,36 +228,6 @@ interface AnchorConfig {
|
|
|
249
228
|
external?: boolean;
|
|
250
229
|
}
|
|
251
230
|
|
|
252
|
-
type ValidDrag = boolean | ((item: LktObject) => boolean);
|
|
253
|
-
|
|
254
|
-
interface DragConfig {
|
|
255
|
-
isDraggable?: ValidDrag;
|
|
256
|
-
isValid?: ValidDrag;
|
|
257
|
-
canRender?: boolean | Function;
|
|
258
|
-
dragKey?: string;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
declare const enum ButtonType {
|
|
262
|
-
Button = "button",// Default
|
|
263
|
-
Submit = "submit",// Form submit
|
|
264
|
-
Reset = "reset",
|
|
265
|
-
Anchor = "anchor",// Turns on anchor mode
|
|
266
|
-
Content = "content",// No click event
|
|
267
|
-
Switch = "switch",// Has a visible boolean state
|
|
268
|
-
HiddenSwitch = "hidden-switch",// Has a hidden boolean state
|
|
269
|
-
Split = "split",// Split button, content always generated
|
|
270
|
-
SplitLazy = "split-lazy",// Split button, contents generated after first open
|
|
271
|
-
SplitEver = "split-ever",// Split button, contents generated each time it's clicked
|
|
272
|
-
Tooltip = "tooltip",// Tooltip button, content always generated
|
|
273
|
-
TooltipLazy = "tooltip-lazy",// Tooltip button, contents generated after first open
|
|
274
|
-
TooltipEver = "tooltip-ever"
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
declare enum ToggleMode {
|
|
278
|
-
Lazy = "lazy",
|
|
279
|
-
Ever = "ever"
|
|
280
|
-
}
|
|
281
|
-
|
|
282
231
|
declare class Anchor extends LktItem implements AnchorConfig {
|
|
283
232
|
static lktAllowUndefinedProps: string[];
|
|
284
233
|
static lktDefaultValues: (keyof AnchorConfig)[];
|
|
@@ -298,6 +247,11 @@ declare class Anchor extends LktItem implements AnchorConfig {
|
|
|
298
247
|
constructor(data?: Partial<AnchorConfig>);
|
|
299
248
|
}
|
|
300
249
|
|
|
250
|
+
declare enum TooltipPositionEngine {
|
|
251
|
+
Fixed = "fixed",
|
|
252
|
+
Absolute = "absolute"
|
|
253
|
+
}
|
|
254
|
+
|
|
301
255
|
interface ButtonConfig {
|
|
302
256
|
type?: ButtonType;
|
|
303
257
|
checked?: boolean;
|
|
@@ -317,10 +271,10 @@ interface ButtonConfig {
|
|
|
317
271
|
resourceData?: LktObject;
|
|
318
272
|
modal?: ValidModalName;
|
|
319
273
|
modalKey?: ValidModalKey;
|
|
320
|
-
modalData?: ModalConfig
|
|
274
|
+
modalData?: Partial<ModalConfig>;
|
|
321
275
|
confirmModal?: ValidModalName;
|
|
322
276
|
confirmModalKey?: ValidModalKey;
|
|
323
|
-
confirmData?: ModalConfig
|
|
277
|
+
confirmData?: Partial<ModalConfig>;
|
|
324
278
|
iconDot?: boolean | string | number;
|
|
325
279
|
iconEnd?: string;
|
|
326
280
|
img?: string;
|
|
@@ -339,6 +293,70 @@ interface ButtonConfig {
|
|
|
339
293
|
splitClass?: string;
|
|
340
294
|
clickRef?: Element | VueElement;
|
|
341
295
|
tabindex?: ValidTabIndex;
|
|
296
|
+
prop?: LktObject;
|
|
297
|
+
onClick?: Function | undefined;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
interface ModalConfig extends LktObject {
|
|
301
|
+
type?: ModalType;
|
|
302
|
+
size?: string;
|
|
303
|
+
preTitle?: string;
|
|
304
|
+
preTitleIcon?: string;
|
|
305
|
+
title?: string;
|
|
306
|
+
closeIcon?: string;
|
|
307
|
+
closeConfirm?: ValidModalName;
|
|
308
|
+
closeConfirmKey?: ValidModalKey;
|
|
309
|
+
showClose?: boolean;
|
|
310
|
+
disabledClose?: boolean;
|
|
311
|
+
disabledVeilClick?: boolean;
|
|
312
|
+
hiddenFooter?: boolean;
|
|
313
|
+
modalName?: ValidModalName;
|
|
314
|
+
modalKey?: ValidModalKey;
|
|
315
|
+
zIndex?: number;
|
|
316
|
+
beforeClose?: ValidBeforeCloseModal;
|
|
317
|
+
item?: LktObject;
|
|
318
|
+
confirmButton?: Partial<ButtonConfig>;
|
|
319
|
+
cancelButton?: Partial<ButtonConfig>;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
declare enum TooltipLocationY {
|
|
323
|
+
Top = "top",
|
|
324
|
+
Bottom = "bottom",
|
|
325
|
+
Center = "center",
|
|
326
|
+
ReferrerCenter = "referrer-center"
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
declare enum TooltipLocationX {
|
|
330
|
+
Left = "left",
|
|
331
|
+
Right = "right",
|
|
332
|
+
Center = "center",
|
|
333
|
+
LeftCorner = "left-corner",
|
|
334
|
+
RightCorner = "right-corner"
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
interface TooltipConfig {
|
|
338
|
+
modelValue?: boolean;
|
|
339
|
+
alwaysOpen?: boolean;
|
|
340
|
+
class?: string;
|
|
341
|
+
text?: string;
|
|
342
|
+
icon?: string;
|
|
343
|
+
iconAtEnd?: boolean;
|
|
344
|
+
engine?: TooltipPositionEngine;
|
|
345
|
+
referrerMargin?: number | string;
|
|
346
|
+
windowMargin?: number | string;
|
|
347
|
+
referrerWidth?: boolean;
|
|
348
|
+
referrer?: HTMLElement | undefined;
|
|
349
|
+
locationY?: TooltipLocationY;
|
|
350
|
+
locationX?: TooltipLocationX;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
type ValidDrag = boolean | ((item: LktObject) => boolean);
|
|
354
|
+
|
|
355
|
+
interface DragConfig {
|
|
356
|
+
isDraggable?: ValidDrag;
|
|
357
|
+
isValid?: ValidDrag;
|
|
358
|
+
canRender?: boolean | Function;
|
|
359
|
+
dragKey?: string;
|
|
342
360
|
}
|
|
343
361
|
|
|
344
362
|
declare enum ColumnType {
|
|
@@ -467,10 +485,10 @@ declare class Button extends LktItem implements ButtonConfig {
|
|
|
467
485
|
resourceData: LktObject;
|
|
468
486
|
modal: ValidModalName;
|
|
469
487
|
modalKey: ValidModalKey;
|
|
470
|
-
modalData: ModalConfig
|
|
488
|
+
modalData: Partial<ModalConfig>;
|
|
471
489
|
confirmModal: ValidModalName;
|
|
472
490
|
confirmModalKey: ValidModalKey;
|
|
473
|
-
confirmData: ModalConfig
|
|
491
|
+
confirmData: Partial<ModalConfig>;
|
|
474
492
|
text: string;
|
|
475
493
|
icon: string;
|
|
476
494
|
iconDot: boolean;
|
|
@@ -492,6 +510,8 @@ declare class Button extends LktItem implements ButtonConfig {
|
|
|
492
510
|
hideTooltipOnLeave?: boolean;
|
|
493
511
|
tooltipClass?: string;
|
|
494
512
|
splitClass?: string;
|
|
513
|
+
prop?: LktObject;
|
|
514
|
+
onClick?: Function | undefined;
|
|
495
515
|
constructor(data?: Partial<ButtonConfig>);
|
|
496
516
|
}
|
|
497
517
|
|
|
@@ -571,6 +591,15 @@ interface HeaderConfig {
|
|
|
571
591
|
icon?: string;
|
|
572
592
|
}
|
|
573
593
|
|
|
594
|
+
declare enum TableRowType {
|
|
595
|
+
Auto = 0,
|
|
596
|
+
PreferItem = 1,
|
|
597
|
+
PreferCustomItem = 2,
|
|
598
|
+
PreferColumns = 3
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
type ValidTableRowTypeValue = TableRowType | ((...args: any[]) => TableRowType) | undefined;
|
|
602
|
+
|
|
574
603
|
interface TableConfig {
|
|
575
604
|
modelValue: LktObject[];
|
|
576
605
|
type?: TableType;
|
|
@@ -580,6 +609,7 @@ interface TableConfig {
|
|
|
580
609
|
filters?: LktObject[];
|
|
581
610
|
hideEmptyColumns?: boolean;
|
|
582
611
|
itemDisplayChecker?: Function;
|
|
612
|
+
rowDisplayType?: ValidTableRowTypeValue;
|
|
583
613
|
loading?: boolean;
|
|
584
614
|
page?: number;
|
|
585
615
|
perms?: ValidTablePermission[];
|
|
@@ -676,8 +706,10 @@ declare class Modal extends LktItem implements ModalConfig {
|
|
|
676
706
|
modalName: ValidModalName;
|
|
677
707
|
modalKey: ValidModalKey;
|
|
678
708
|
zIndex: number;
|
|
679
|
-
beforeClose:
|
|
709
|
+
beforeClose: ValidBeforeCloseModal;
|
|
680
710
|
item: LktObject;
|
|
711
|
+
confirmButton?: Partial<ButtonConfig>;
|
|
712
|
+
cancelButton?: Partial<ButtonConfig>;
|
|
681
713
|
constructor(data?: Partial<ModalConfig>);
|
|
682
714
|
}
|
|
683
715
|
|
|
@@ -691,6 +723,7 @@ declare class Table extends LktItem implements TableConfig {
|
|
|
691
723
|
filters?: LktObject[];
|
|
692
724
|
hideEmptyColumns?: boolean;
|
|
693
725
|
itemDisplayChecker?: Function;
|
|
726
|
+
rowDisplayType?: ValidTableRowTypeValue;
|
|
694
727
|
loading?: boolean;
|
|
695
728
|
page?: number;
|
|
696
729
|
perms?: ValidTablePermission[];
|
|
@@ -749,16 +782,17 @@ declare class Table extends LktItem implements TableConfig {
|
|
|
749
782
|
constructor(data?: Partial<TableConfig>);
|
|
750
783
|
}
|
|
751
784
|
|
|
752
|
-
declare enum ModalType {
|
|
753
|
-
Modal = "modal",
|
|
754
|
-
Confirm = "confirm"
|
|
755
|
-
}
|
|
756
|
-
|
|
757
785
|
declare enum SortDirection {
|
|
758
786
|
Asc = "asc",
|
|
759
787
|
Desc = "desc"
|
|
760
788
|
}
|
|
761
789
|
|
|
790
|
+
type ScanPropTarget = string | number | undefined | Function;
|
|
791
|
+
|
|
792
|
+
type ValidScanPropTarget = ScanPropTarget | ((...args: any[]) => ScanPropTarget);
|
|
793
|
+
|
|
794
|
+
declare const extractPropValue: (needle: ValidScanPropTarget, haystack: LktObject) => ValidScanPropTarget;
|
|
795
|
+
|
|
762
796
|
/**
|
|
763
797
|
* Export common interfaces
|
|
764
798
|
*/
|
|
@@ -768,4 +802,4 @@ declare function getDefaultValues<T>(cls: {
|
|
|
768
802
|
lktDefaultValues: (keyof T)[];
|
|
769
803
|
}): Partial<T>;
|
|
770
804
|
|
|
771
|
-
export { Anchor, type AnchorConfig, AnchorType, Button, type ButtonConfig, ButtonType, Column, type ColumnConfig, ColumnType, type DragConfig, type EmptyModalKey, Field, FieldAutoValidationTrigger, type FieldConfig, FieldType, LktItem, type LktObject, LktStrictItem, Modal, type ModalConfig, ModalType, MultipleOptionsDisplay, Option, type OptionConfig, SafeString, SortDirection, Table, type TableConfig, TablePermission, TableType, ToggleMode, Tooltip, type TooltipConfig, TooltipLocationX, TooltipLocationY, TooltipPositionEngine, type ValidColSpan, type ValidFieldMinMax, type ValidFieldValue, type ValidModalKey, type ValidModalName, type ValidOptionValue, type ValidSafeStringValue, type ValidTabIndex, getDefaultValues };
|
|
805
|
+
export { Anchor, type AnchorConfig, AnchorType, type BeforeCloseModalData, Button, type ButtonConfig, ButtonType, Column, type ColumnConfig, ColumnType, type DragConfig, type EmptyModalKey, Field, FieldAutoValidationTrigger, type FieldConfig, FieldType, LktItem, type LktObject, LktStrictItem, Modal, type ModalConfig, ModalType, MultipleOptionsDisplay, Option, type OptionConfig, SafeString, type ScanPropTarget, SortDirection, Table, type TableConfig, TablePermission, TableRowType, TableType, ToggleMode, Tooltip, type TooltipConfig, TooltipLocationX, TooltipLocationY, TooltipPositionEngine, type ValidBeforeCloseModal, type ValidColSpan, type ValidFieldMinMax, type ValidFieldValue, type ValidModalKey, type ValidModalName, type ValidOptionValue, type ValidSafeStringValue, type ValidScanPropTarget, type ValidTabIndex, type ValidTablePermission, type ValidTableRowTypeValue, extractPropValue, getDefaultValues };
|
package/dist/index.js
CHANGED
|
@@ -358,7 +358,9 @@ var Button = class extends LktItem {
|
|
|
358
358
|
"showTooltipOnHover",
|
|
359
359
|
"hideTooltipOnLeave",
|
|
360
360
|
"tooltipClass",
|
|
361
|
-
"splitClass"
|
|
361
|
+
"splitClass",
|
|
362
|
+
"prop",
|
|
363
|
+
"onClick"
|
|
362
364
|
];
|
|
363
365
|
type = "button" /* Button */;
|
|
364
366
|
name = generateRandomString2(10);
|
|
@@ -400,6 +402,9 @@ var Button = class extends LktItem {
|
|
|
400
402
|
hideTooltipOnLeave = void 0;
|
|
401
403
|
tooltipClass = "";
|
|
402
404
|
splitClass = "";
|
|
405
|
+
prop = {};
|
|
406
|
+
// Event management
|
|
407
|
+
onClick = void 0;
|
|
403
408
|
constructor(data = {}) {
|
|
404
409
|
super();
|
|
405
410
|
this.feed(data);
|
|
@@ -577,6 +582,8 @@ var Modal = class extends LktItem {
|
|
|
577
582
|
zIndex = 500;
|
|
578
583
|
beforeClose = void 0;
|
|
579
584
|
item = {};
|
|
585
|
+
confirmButton = {};
|
|
586
|
+
cancelButton = {};
|
|
580
587
|
constructor(data = {}) {
|
|
581
588
|
super();
|
|
582
589
|
this.feed(data);
|
|
@@ -592,6 +599,15 @@ var TableType = /* @__PURE__ */ ((TableType2) => {
|
|
|
592
599
|
return TableType2;
|
|
593
600
|
})(TableType || {});
|
|
594
601
|
|
|
602
|
+
// src/enums/TableRowType.ts
|
|
603
|
+
var TableRowType = /* @__PURE__ */ ((TableRowType2) => {
|
|
604
|
+
TableRowType2[TableRowType2["Auto"] = 0] = "Auto";
|
|
605
|
+
TableRowType2[TableRowType2["PreferItem"] = 1] = "PreferItem";
|
|
606
|
+
TableRowType2[TableRowType2["PreferCustomItem"] = 2] = "PreferCustomItem";
|
|
607
|
+
TableRowType2[TableRowType2["PreferColumns"] = 3] = "PreferColumns";
|
|
608
|
+
return TableRowType2;
|
|
609
|
+
})(TableRowType || {});
|
|
610
|
+
|
|
595
611
|
// src/instances/Table.ts
|
|
596
612
|
var Table = class extends LktItem {
|
|
597
613
|
static lktDefaultValues = [
|
|
@@ -669,6 +685,7 @@ var Table = class extends LktItem {
|
|
|
669
685
|
// Data visualization
|
|
670
686
|
hideEmptyColumns = false;
|
|
671
687
|
itemDisplayChecker = void 0;
|
|
688
|
+
rowDisplayType = 0 /* Auto */;
|
|
672
689
|
// State
|
|
673
690
|
loading = false;
|
|
674
691
|
page = 1;
|
|
@@ -771,6 +788,14 @@ var ToggleMode = /* @__PURE__ */ ((ToggleMode2) => {
|
|
|
771
788
|
return ToggleMode2;
|
|
772
789
|
})(ToggleMode || {});
|
|
773
790
|
|
|
791
|
+
// src/functions/extract-data-functions.ts
|
|
792
|
+
var extractPropValue = (needle, haystack) => {
|
|
793
|
+
if (typeof needle === "string" && needle.startsWith("prop:")) {
|
|
794
|
+
return haystack[needle.substring(5)];
|
|
795
|
+
}
|
|
796
|
+
return needle;
|
|
797
|
+
};
|
|
798
|
+
|
|
774
799
|
// src/index.ts
|
|
775
800
|
function getDefaultValues(cls) {
|
|
776
801
|
const instance = new cls();
|
|
@@ -805,11 +830,13 @@ export {
|
|
|
805
830
|
SortDirection,
|
|
806
831
|
Table,
|
|
807
832
|
TablePermission,
|
|
833
|
+
TableRowType,
|
|
808
834
|
TableType,
|
|
809
835
|
ToggleMode,
|
|
810
836
|
Tooltip,
|
|
811
837
|
TooltipLocationX,
|
|
812
838
|
TooltipLocationY,
|
|
813
839
|
TooltipPositionEngine,
|
|
840
|
+
extractPropValue,
|
|
814
841
|
getDefaultValues
|
|
815
842
|
};
|