tsgrid-ui 2.7.1 → 2.10.0
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/CHANGELOG.md +217 -0
- package/dist/base.d.ts +148 -0
- package/dist/base.es6.js +11 -0
- package/dist/base.es6.js.map +1 -0
- package/dist/chunks/chunk-3NYH6545.js +2423 -0
- package/dist/chunks/chunk-3NYH6545.js.map +1 -0
- package/dist/chunks/chunk-6MOFFUV2.js +2305 -0
- package/dist/chunks/chunk-6MOFFUV2.js.map +1 -0
- package/dist/chunks/chunk-6UCGFWIQ.js +865 -0
- package/dist/chunks/chunk-6UCGFWIQ.js.map +1 -0
- package/dist/chunks/chunk-DXZJHS4M.js +1283 -0
- package/dist/chunks/chunk-DXZJHS4M.js.map +1 -0
- package/dist/chunks/chunk-DZSFZLV6.js +1638 -0
- package/dist/chunks/chunk-DZSFZLV6.js.map +1 -0
- package/dist/chunks/chunk-EQK6JAHT.js +33 -0
- package/dist/chunks/chunk-EQK6JAHT.js.map +1 -0
- package/dist/chunks/chunk-FAIRNXQR.js +3020 -0
- package/dist/chunks/chunk-FAIRNXQR.js.map +1 -0
- package/dist/chunks/chunk-GZFWK4LZ.js +677 -0
- package/dist/chunks/chunk-GZFWK4LZ.js.map +1 -0
- package/dist/chunks/chunk-IYF3Q7GX.js +127 -0
- package/dist/chunks/chunk-IYF3Q7GX.js.map +1 -0
- package/dist/chunks/chunk-KLJ35UAH.js +1795 -0
- package/dist/chunks/chunk-KLJ35UAH.js.map +1 -0
- package/dist/chunks/chunk-LUSNRF73.js +1212 -0
- package/dist/chunks/chunk-LUSNRF73.js.map +1 -0
- package/dist/chunks/chunk-N3GASHTI.js +1127 -0
- package/dist/chunks/chunk-N3GASHTI.js.map +1 -0
- package/dist/field.d.ts +329 -0
- package/dist/field.es6.js +12 -0
- package/dist/field.es6.js.map +1 -0
- package/dist/form.d.ts +162 -0
- package/dist/form.es6.js +15 -0
- package/dist/form.es6.js.map +1 -0
- package/dist/layout.d.ts +108 -0
- package/dist/layout.es6.js +14 -0
- package/dist/layout.es6.js.map +1 -0
- package/dist/locale.d.ts +30 -0
- package/dist/locale.es6.js +7 -0
- package/dist/locale.es6.js.map +1 -0
- package/dist/popup.d.ts +97 -0
- package/dist/popup.es6.js +21 -0
- package/dist/popup.es6.js.map +1 -0
- package/dist/query-CKGg5Ugv.d.ts +81 -0
- package/dist/sidebar.d.ts +138 -0
- package/dist/sidebar.es6.js +12 -0
- package/dist/sidebar.es6.js.map +1 -0
- package/dist/tabs.d.ts +63 -0
- package/dist/tabs.es6.js +12 -0
- package/dist/tabs.es6.js.map +1 -0
- package/dist/toolbar.d.ts +97 -0
- package/dist/toolbar.es6.js +12 -0
- package/dist/toolbar.es6.js.map +1 -0
- package/dist/tooltip.d.ts +330 -0
- package/dist/tooltip.es6.js +21 -0
- package/dist/tooltip.es6.js.map +1 -0
- package/dist/tsgrid-ui.css +2 -2
- package/dist/tsgrid-ui.d.ts +16 -2004
- package/dist/tsgrid-ui.es6.js +7751 -23830
- package/dist/tsgrid-ui.es6.js.map +1 -1
- package/dist/tsgrid-ui.es6.min.js +37 -37
- package/dist/tsgrid-ui.js +150 -22
- package/dist/tsgrid-ui.min.css +2 -2
- package/dist/tsgrid-ui.min.js +39 -39
- package/dist/tsutils-message-CogFtVtO.d.ts +82 -0
- package/dist/utils.d.ts +418 -0
- package/dist/utils.es6.js +14 -0
- package/dist/utils.es6.js.map +1 -0
- package/package.json +25 -5
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { TsBase } from './base.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Part of TsUi 2.0 library
|
|
5
|
+
* - Dependencies: mQuery, TsUtils, TsBase, TsTooltip, TsMenu
|
|
6
|
+
*
|
|
7
|
+
* == TODO ==
|
|
8
|
+
* - dbl click should be like it is in grid (with timer not HTML dbl click event)
|
|
9
|
+
* - node.style is misleading - should be there to apply color for example
|
|
10
|
+
* - node.plus - is not working
|
|
11
|
+
*
|
|
12
|
+
* == 2.0 changes
|
|
13
|
+
* - remove jQuery dependency
|
|
14
|
+
* - deprecarted obj.img, node.img
|
|
15
|
+
* - CSP - fixed inline events
|
|
16
|
+
* - observeResize for the box
|
|
17
|
+
* - search(..., compare) - comparison function
|
|
18
|
+
* - editable = true
|
|
19
|
+
* - edit(id) - new method
|
|
20
|
+
* - onEdit, onRename - new events
|
|
21
|
+
* - reorder = true - to allow reorder
|
|
22
|
+
* - mouseDown - for reorder
|
|
23
|
+
* - onReorder, onDragStart, onDragOver - events
|
|
24
|
+
* - this.mutlti - for multi select (ctrl for one at a time and shift for range)
|
|
25
|
+
* - onSelect, onUnselect - new events
|
|
26
|
+
* - prev(), next(), getChain()
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
/** Options accepted by refresh() */
|
|
30
|
+
interface TsSidebarRefreshOptions {
|
|
31
|
+
recursive?: boolean;
|
|
32
|
+
}
|
|
33
|
+
/** Options accepted by update() — mirrors node property names that can be updated in-place */
|
|
34
|
+
interface TsSidebarUpdateOptions {
|
|
35
|
+
icon?: string | ((nd: unknown, level: number) => string) | null;
|
|
36
|
+
class?: string | null;
|
|
37
|
+
style?: string | null;
|
|
38
|
+
text?: string | ((nd: unknown, level: number) => string) | null;
|
|
39
|
+
count?: number | string | null;
|
|
40
|
+
[key: string]: unknown;
|
|
41
|
+
}
|
|
42
|
+
/** Options accepted by setCount() */
|
|
43
|
+
interface TsSidebarSetCountOptions {
|
|
44
|
+
className?: string;
|
|
45
|
+
style?: string;
|
|
46
|
+
noRepeat?: boolean;
|
|
47
|
+
}
|
|
48
|
+
/** Options for find() */
|
|
49
|
+
interface TsSidebarFindOptions {
|
|
50
|
+
returnDisabled?: boolean;
|
|
51
|
+
returnGroups?: boolean;
|
|
52
|
+
[key: string]: unknown;
|
|
53
|
+
}
|
|
54
|
+
/** Options for sort() */
|
|
55
|
+
interface TsSidebarSortOptions {
|
|
56
|
+
foldersFirst?: boolean;
|
|
57
|
+
caseSensitive?: boolean;
|
|
58
|
+
reverse?: boolean;
|
|
59
|
+
[key: string]: unknown;
|
|
60
|
+
}
|
|
61
|
+
declare class TsSidebar extends TsBase {
|
|
62
|
+
box: HTMLElement | null;
|
|
63
|
+
name: string;
|
|
64
|
+
nodes: any[];
|
|
65
|
+
selected: any;
|
|
66
|
+
img: any;
|
|
67
|
+
icon: any;
|
|
68
|
+
style: string;
|
|
69
|
+
hasFocus: boolean;
|
|
70
|
+
flat: boolean;
|
|
71
|
+
flatButton: boolean;
|
|
72
|
+
keyboard: boolean;
|
|
73
|
+
editable: boolean;
|
|
74
|
+
reorder: boolean;
|
|
75
|
+
tabIndex: number | null;
|
|
76
|
+
routeData: Record<string, unknown>;
|
|
77
|
+
multi: boolean;
|
|
78
|
+
skipRefresh: boolean;
|
|
79
|
+
last: any;
|
|
80
|
+
node_template: Record<string, unknown>;
|
|
81
|
+
[key: string]: any;
|
|
82
|
+
constructor(options: any);
|
|
83
|
+
add(parent?: any, nodes?: any): any;
|
|
84
|
+
insert(parent?: any, before?: any, nodes?: any): any;
|
|
85
|
+
remove(...args: any[]): number;
|
|
86
|
+
set(parent?: any, id?: any, node?: any): boolean | null;
|
|
87
|
+
get(parent?: any, id?: any, returnIndex?: any): any;
|
|
88
|
+
setCount(id: any, count: any, options?: TsSidebarSetCountOptions): void;
|
|
89
|
+
find(parent?: any, params?: any, results?: any): any;
|
|
90
|
+
sort(options: TsSidebarSortOptions | null | undefined, nodes?: any): void;
|
|
91
|
+
each(fn: any, nodes?: any): void;
|
|
92
|
+
search(str: any, compare?: any): number;
|
|
93
|
+
show(...args: any[]): any[];
|
|
94
|
+
hide(...args: any[]): any[];
|
|
95
|
+
enable(...args: any[]): any[];
|
|
96
|
+
disable(...args: any[]): any[];
|
|
97
|
+
select(id: any): boolean | undefined;
|
|
98
|
+
unselect(id?: any): boolean | undefined;
|
|
99
|
+
toggle(id: any): boolean | undefined;
|
|
100
|
+
collapse(id: any): boolean | undefined;
|
|
101
|
+
expand(id: any): true | undefined;
|
|
102
|
+
collapseAll(parent?: any): boolean;
|
|
103
|
+
expandAll(parent?: any): false | undefined;
|
|
104
|
+
expandParents(id: any): boolean;
|
|
105
|
+
click(id: any, event?: any): void;
|
|
106
|
+
flatMenu(el: any, items: any): void;
|
|
107
|
+
focus(event?: any): false | undefined;
|
|
108
|
+
blur(event: any): false | undefined;
|
|
109
|
+
next(node: any, noSubs?: any): any;
|
|
110
|
+
prev(node: any): any;
|
|
111
|
+
getChain(nodes?: any, options?: TsSidebarFindOptions): any[];
|
|
112
|
+
keydown(event: any): void;
|
|
113
|
+
inView(id: any): boolean;
|
|
114
|
+
scrollIntoView(id?: any, instant?: any): Promise<void>;
|
|
115
|
+
dblClick(id: any, event: any): void;
|
|
116
|
+
/**
|
|
117
|
+
* This is needed for not reorder
|
|
118
|
+
*/
|
|
119
|
+
mouseDown(id: any, event: any): void;
|
|
120
|
+
edit(id: any): Node | Node[] | null | undefined;
|
|
121
|
+
contextMenu(id: any, event: any): void;
|
|
122
|
+
menuClick(itemId: any, detail?: any): void;
|
|
123
|
+
goFlat(): void;
|
|
124
|
+
render(box?: any): number | undefined;
|
|
125
|
+
update(id: any, options?: TsSidebarUpdateOptions): TsSidebarUpdateOptions;
|
|
126
|
+
refresh(id?: any, options?: TsSidebarRefreshOptions): number | undefined;
|
|
127
|
+
mouseAction(action: any, anchor: any, nodeId: any, event: any, type: any): void;
|
|
128
|
+
tooltip(el: any, text: any): void;
|
|
129
|
+
otherTooltip(el: any, text: any): void;
|
|
130
|
+
showPlus(el: any, color: any): void;
|
|
131
|
+
resize(): number | undefined;
|
|
132
|
+
destroy(): void;
|
|
133
|
+
unmount(): void;
|
|
134
|
+
lock(msg?: any, showSpinner?: any): void;
|
|
135
|
+
unlock(speed: any): void;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export { TsSidebar, type TsSidebarFindOptions, type TsSidebarRefreshOptions, type TsSidebarSetCountOptions, type TsSidebarSortOptions, type TsSidebarUpdateOptions };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TsSidebar
|
|
3
|
+
} from "./chunks/chunk-DZSFZLV6.js";
|
|
4
|
+
import "./chunks/chunk-FAIRNXQR.js";
|
|
5
|
+
import "./chunks/chunk-EQK6JAHT.js";
|
|
6
|
+
import "./chunks/chunk-3NYH6545.js";
|
|
7
|
+
import "./chunks/chunk-IYF3Q7GX.js";
|
|
8
|
+
import "./chunks/chunk-DXZJHS4M.js";
|
|
9
|
+
export {
|
|
10
|
+
TsSidebar
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=sidebar.es6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/tabs.d.ts
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { TsBase } from './base.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Part of TsUi 2.0 library
|
|
5
|
+
* - Dependencies: mQuery, TsUtils, TsBase, TsTooltip
|
|
6
|
+
*
|
|
7
|
+
* == 2.0 changes
|
|
8
|
+
* - CSP - fixed inline events
|
|
9
|
+
* - removed jQuery dependency
|
|
10
|
+
* - observeResize for the box
|
|
11
|
+
* - refactored w2events
|
|
12
|
+
* - scrollIntoView - removed callback
|
|
13
|
+
* - scroll, scrollIntoView return promise
|
|
14
|
+
* - animateInsert, animateClose - returns a promise
|
|
15
|
+
* - add, insert return a promise
|
|
16
|
+
* - onMouseEnter, onMouseLeave, onMouseDown, onMouseUp
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
declare class TsTabs extends TsBase {
|
|
20
|
+
box: HTMLElement | null;
|
|
21
|
+
name: string;
|
|
22
|
+
active: any;
|
|
23
|
+
reorder: boolean;
|
|
24
|
+
flow: string;
|
|
25
|
+
tooltip: string;
|
|
26
|
+
tabs: any[];
|
|
27
|
+
routeData: Record<string, unknown>;
|
|
28
|
+
last: any;
|
|
29
|
+
right: string;
|
|
30
|
+
style: string;
|
|
31
|
+
tab_template: Record<string, unknown>;
|
|
32
|
+
[key: string]: any;
|
|
33
|
+
constructor(options: any);
|
|
34
|
+
add(tab: any): Promise<any>;
|
|
35
|
+
insert(id: any, tabs: any): Promise<any>;
|
|
36
|
+
remove(...ids: any[]): number;
|
|
37
|
+
select(id: any): boolean;
|
|
38
|
+
set(id: any, tab: any): boolean;
|
|
39
|
+
get(id?: any, returnIndex?: boolean): any;
|
|
40
|
+
show(...ids: any[]): any[];
|
|
41
|
+
hide(...ids: any[]): any[];
|
|
42
|
+
enable(...ids: any[]): any[];
|
|
43
|
+
disable(...ids: any[]): any[];
|
|
44
|
+
dragMove(event: MouseEvent): void;
|
|
45
|
+
mouseAction(action: string, id: any, event: MouseEvent): void;
|
|
46
|
+
tooltipShow(id: any): void;
|
|
47
|
+
tooltipHide(_id: any): void;
|
|
48
|
+
getTabHTML(id: any): string | false;
|
|
49
|
+
refresh(id?: any): number | undefined;
|
|
50
|
+
render(box?: any): number | false | undefined;
|
|
51
|
+
initReorder(id: any, event: MouseEvent): void;
|
|
52
|
+
scroll(direction?: any, instant?: any): Promise<void>;
|
|
53
|
+
scrollIntoView(id?: any, instant?: any): Promise<void>;
|
|
54
|
+
resize(): number | undefined;
|
|
55
|
+
destroy(): void;
|
|
56
|
+
unmount(): void;
|
|
57
|
+
click(id: any, event?: MouseEvent): false | void;
|
|
58
|
+
clickClose(id: any, event?: MouseEvent): false | void;
|
|
59
|
+
animateClose(id?: any): Promise<void>;
|
|
60
|
+
animateInsert(id: any, tab: any): Promise<void>;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export { TsTabs };
|
package/dist/tabs.es6.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TsTabs
|
|
3
|
+
} from "./chunks/chunk-GZFWK4LZ.js";
|
|
4
|
+
import "./chunks/chunk-FAIRNXQR.js";
|
|
5
|
+
import "./chunks/chunk-EQK6JAHT.js";
|
|
6
|
+
import "./chunks/chunk-3NYH6545.js";
|
|
7
|
+
import "./chunks/chunk-IYF3Q7GX.js";
|
|
8
|
+
import "./chunks/chunk-DXZJHS4M.js";
|
|
9
|
+
export {
|
|
10
|
+
TsTabs
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=tabs.es6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { TsBase } from './base.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Part of TsUi 2.0 library
|
|
5
|
+
* - Dependencies: mQuery, TsUtils, TsBase, TsTooltip, TsColor, TsMenu
|
|
6
|
+
*
|
|
7
|
+
* == TODO ==
|
|
8
|
+
* - tab navigation (index state)
|
|
9
|
+
* - vertical toolbar
|
|
10
|
+
* - TsMenu on second click of tb button should hide
|
|
11
|
+
* - button display groups for each show/hide, possibly add state: { single: t/f, multiple: t/f, type: 'font' }
|
|
12
|
+
* - item.count - should just support html, so a custom block can be created, such as a colored line
|
|
13
|
+
*
|
|
14
|
+
* == 2.0 changes
|
|
15
|
+
* - CSP - fixed inline events
|
|
16
|
+
* - removed jQuery dependency
|
|
17
|
+
* - item.icon - can be class or <custom-icon-component> or <svg>
|
|
18
|
+
* - new w2tooltips and TsMenu
|
|
19
|
+
* - scroll returns promise
|
|
20
|
+
* - added onMouseEntter, onMouseLeave, onMouseDown, onMouseUp events
|
|
21
|
+
* - add(..., skipRefresh), insert(..., skipRefresh)
|
|
22
|
+
* - item.items can be a function
|
|
23
|
+
* - item.icon_style - style for the icon
|
|
24
|
+
* - item.icon - can be a function
|
|
25
|
+
* - item.type = 'label', item.type = 'input'
|
|
26
|
+
* - item.placeholder
|
|
27
|
+
* - item.input: { spinner, style, min, max, step, precision, suffix }
|
|
28
|
+
* - item.backColor
|
|
29
|
+
* - onLiveUpdate - for colors
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
declare class TsToolbar extends TsBase {
|
|
33
|
+
box: HTMLElement | null;
|
|
34
|
+
name: string;
|
|
35
|
+
routeData: Record<string, unknown>;
|
|
36
|
+
items: any[];
|
|
37
|
+
right: string | string[];
|
|
38
|
+
tooltip: string;
|
|
39
|
+
item_template: Record<string, unknown>;
|
|
40
|
+
last: any;
|
|
41
|
+
_refresh: (opts: any) => void;
|
|
42
|
+
_refreshDebounced: () => void;
|
|
43
|
+
[key: string]: any;
|
|
44
|
+
constructor(options: any);
|
|
45
|
+
add(items: any, skipRefresh?: any): void;
|
|
46
|
+
insert(id: any, items: any, skipRefresh?: any): void;
|
|
47
|
+
remove(...args: any[]): number;
|
|
48
|
+
set(id: any, newOptions: any): boolean;
|
|
49
|
+
get(id?: any, returnIndex?: boolean, items?: any[]): any;
|
|
50
|
+
setCount(id: any, count: any, className?: any, style?: any): void;
|
|
51
|
+
show(...args: any[]): any[];
|
|
52
|
+
hide(...args: any[]): any[];
|
|
53
|
+
enable(...args: any[]): any[];
|
|
54
|
+
disable(...args: any[]): any[];
|
|
55
|
+
check(...args: any[]): any[];
|
|
56
|
+
uncheck(...args: any[]): any[];
|
|
57
|
+
/**
|
|
58
|
+
* Toggle the `checked` state of one or more items.
|
|
59
|
+
*
|
|
60
|
+
* State management only — does NOT fire events (no `onClick`, no `onChange`)
|
|
61
|
+
* and does NOT open drop / menu / color overlays. For full UI interaction
|
|
62
|
+
* including opening pickers, call `click(id)` instead.
|
|
63
|
+
*
|
|
64
|
+
* Per-item behaviour:
|
|
65
|
+
* - button / check / html / spacer / break: flips `it.checked`.
|
|
66
|
+
* - drop / menu / menu-radio / menu-check / color / text-color: if currently
|
|
67
|
+
* checked, closes the toolbar's `-drop` overlay via `TsTooltip.hide` before
|
|
68
|
+
* flipping. Same overlay-close path as `uncheck()`. Never opens overlays.
|
|
69
|
+
* - radio: emits `console.warn` and is skipped (would leave the group with
|
|
70
|
+
* no checked member). Use `check()` / `uncheck()` for radios.
|
|
71
|
+
* - group: recurses into `it.items` and toggles each child individually; the
|
|
72
|
+
* group container itself is never in the effected list.
|
|
73
|
+
* - sub-id with `:` notation: skipped (same guard as siblings).
|
|
74
|
+
* - missing id: silently skipped.
|
|
75
|
+
*
|
|
76
|
+
* @param args ids of items to toggle. Varargs, independent per id.
|
|
77
|
+
* @returns array of ids whose checked state actually flipped. Never `undefined`.
|
|
78
|
+
*/
|
|
79
|
+
toggle(...args: any[]): any[];
|
|
80
|
+
click(id: any, event?: any): void;
|
|
81
|
+
scroll(direction?: any, line?: any, instant?: any): Promise<void>;
|
|
82
|
+
render(box?: any): number | undefined;
|
|
83
|
+
refresh(id?: any): number | false | undefined;
|
|
84
|
+
resize(): number | undefined;
|
|
85
|
+
destroy(): void;
|
|
86
|
+
unmount(): void;
|
|
87
|
+
getItemHTML(item: any): string;
|
|
88
|
+
spinner(id: any, action: any, event?: any): void;
|
|
89
|
+
change(id?: any, value?: any, dynamic?: any): void;
|
|
90
|
+
tooltipShow(id: any): void;
|
|
91
|
+
tooltipHide(_id: any): void;
|
|
92
|
+
menuClick(event: any): void;
|
|
93
|
+
colorClick(event: any): void;
|
|
94
|
+
mouseAction(event: any, target: any, action: any, id: any): void;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export { TsToolbar };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TsToolbar
|
|
3
|
+
} from "./chunks/chunk-LUSNRF73.js";
|
|
4
|
+
import "./chunks/chunk-FAIRNXQR.js";
|
|
5
|
+
import "./chunks/chunk-EQK6JAHT.js";
|
|
6
|
+
import "./chunks/chunk-3NYH6545.js";
|
|
7
|
+
import "./chunks/chunk-IYF3Q7GX.js";
|
|
8
|
+
import "./chunks/chunk-DXZJHS4M.js";
|
|
9
|
+
export {
|
|
10
|
+
TsToolbar
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=toolbar.es6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
import { TsBase } from './base.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Part of TsUi 2.0 library
|
|
5
|
+
* - Dependencies: mQuery, TsUtils, TsBase
|
|
6
|
+
*
|
|
7
|
+
* T3.1: Ported to TypeScript with aggressive typing per typing_policy.
|
|
8
|
+
* No @ts-nocheck. Targeted `any` sites documented with // any: comments.
|
|
9
|
+
*
|
|
10
|
+
* TODO:
|
|
11
|
+
* - need help pages
|
|
12
|
+
*
|
|
13
|
+
* 2.0 Changes
|
|
14
|
+
* - multiple tooltips to the same anchor
|
|
15
|
+
* - options.contextMenu
|
|
16
|
+
* - options.prefilter - if true, it will show prefiltered items for TsMenu, otherwise all
|
|
17
|
+
* - menu.item.help, menu.item.hotkey, menu.item.extra
|
|
18
|
+
* - options.selected -> for TsMenu
|
|
19
|
+
* - options.tooltip => {}
|
|
20
|
+
* - TsMenu event onTooltip
|
|
21
|
+
* - added onMouseEnter and onMouseLeave for TsMenu
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/** Base options shared by all tooltip variants */
|
|
25
|
+
interface TooltipOptions {
|
|
26
|
+
name?: string | null;
|
|
27
|
+
html?: string;
|
|
28
|
+
style?: string;
|
|
29
|
+
class?: string;
|
|
30
|
+
position?: string | string[];
|
|
31
|
+
draggable?: boolean;
|
|
32
|
+
align?: string;
|
|
33
|
+
anchor?: HTMLElement | null;
|
|
34
|
+
contextMenu?: boolean;
|
|
35
|
+
anchorClass?: string;
|
|
36
|
+
anchorStyle?: string;
|
|
37
|
+
autoShow?: boolean;
|
|
38
|
+
autoShowOn?: string | null;
|
|
39
|
+
autoHideOn?: string | null;
|
|
40
|
+
arrowSize?: number;
|
|
41
|
+
screenMargin?: number;
|
|
42
|
+
autoResize?: boolean;
|
|
43
|
+
margin?: number;
|
|
44
|
+
offsetX?: number;
|
|
45
|
+
offsetY?: number;
|
|
46
|
+
maxWidth?: number | null;
|
|
47
|
+
maxHeight?: number | null;
|
|
48
|
+
hideOn?: string | string[] | null;
|
|
49
|
+
onThen?: ((event: unknown) => void) | null;
|
|
50
|
+
onShow?: ((event: unknown) => void) | null;
|
|
51
|
+
onHide?: ((event: unknown) => void) | null;
|
|
52
|
+
onUpdate?: ((event: unknown) => void) | null;
|
|
53
|
+
onMove?: ((event: unknown) => void) | null;
|
|
54
|
+
_keep?: boolean;
|
|
55
|
+
text?: string;
|
|
56
|
+
[key: string]: unknown;
|
|
57
|
+
}
|
|
58
|
+
/** A single menu item */
|
|
59
|
+
interface MenuItem {
|
|
60
|
+
id?: string | number | null;
|
|
61
|
+
text?: string | null | ((item: MenuItem, options: MenuOptions) => string);
|
|
62
|
+
style?: string;
|
|
63
|
+
icon?: string | null;
|
|
64
|
+
count?: string | number | null;
|
|
65
|
+
tooltip?: string | {
|
|
66
|
+
html?: string;
|
|
67
|
+
[key: string]: unknown;
|
|
68
|
+
} | null;
|
|
69
|
+
hint?: string | null;
|
|
70
|
+
hotkey?: string | null;
|
|
71
|
+
removable?: boolean | null;
|
|
72
|
+
remove?: boolean | null;
|
|
73
|
+
help?: string | null;
|
|
74
|
+
items?: MenuItem[] | ((item: MenuItem) => MenuItem[]) | null;
|
|
75
|
+
indent?: number;
|
|
76
|
+
type?: 'check' | 'radio' | 'break' | null;
|
|
77
|
+
group?: string | boolean | null;
|
|
78
|
+
expanded?: boolean;
|
|
79
|
+
hidden?: boolean;
|
|
80
|
+
checked?: boolean | null;
|
|
81
|
+
disabled?: boolean;
|
|
82
|
+
keepOpen?: boolean | null;
|
|
83
|
+
extra?: string;
|
|
84
|
+
_noSearchInside?: boolean;
|
|
85
|
+
[key: string]: unknown;
|
|
86
|
+
}
|
|
87
|
+
/** Options for TsMenu (MenuTooltip) */
|
|
88
|
+
interface MenuOptions extends TooltipOptions {
|
|
89
|
+
type?: 'normal' | 'radio' | 'check';
|
|
90
|
+
items?: MenuItem[];
|
|
91
|
+
selected?: null | string | number | MenuItem | Array<string | number | MenuItem>;
|
|
92
|
+
render?: ((item: MenuItem, options: MenuOptions) => string) | null;
|
|
93
|
+
spinner?: boolean;
|
|
94
|
+
msgNoItems?: string;
|
|
95
|
+
msgSearch?: string;
|
|
96
|
+
topHTML?: string;
|
|
97
|
+
menuStyle?: string;
|
|
98
|
+
search?: boolean;
|
|
99
|
+
filter?: boolean;
|
|
100
|
+
match?: 'contains' | 'is' | 'begins' | 'begins with' | 'ends' | 'ends with' | 'regexp';
|
|
101
|
+
markSearch?: boolean;
|
|
102
|
+
prefilter?: boolean;
|
|
103
|
+
altRows?: boolean;
|
|
104
|
+
url?: string;
|
|
105
|
+
postData?: Record<string, unknown>;
|
|
106
|
+
method?: string;
|
|
107
|
+
recId?: string | ((item: Record<string, unknown>) => unknown) | null;
|
|
108
|
+
recid?: string | null;
|
|
109
|
+
recText?: string | ((item: Record<string, unknown>) => unknown) | null;
|
|
110
|
+
cacheMax?: number;
|
|
111
|
+
minLength?: number;
|
|
112
|
+
debounce?: number;
|
|
113
|
+
hideSelected?: boolean;
|
|
114
|
+
parentOverlay?: TooltipOverlay | null;
|
|
115
|
+
parents?: number[];
|
|
116
|
+
onSelect?: ((event: unknown) => void) | null;
|
|
117
|
+
onSubMenu?: ((event: unknown) => void) | null;
|
|
118
|
+
onRemove?: ((event: unknown) => void) | null;
|
|
119
|
+
onTooltip?: ((event: unknown) => void) | null;
|
|
120
|
+
onMouseEnter?: ((event: unknown) => void) | null;
|
|
121
|
+
onMouseLeave?: ((event: unknown) => void) | null;
|
|
122
|
+
}
|
|
123
|
+
/** Options for TsColor (ColorTooltip) */
|
|
124
|
+
interface ColorOptions extends TooltipOptions {
|
|
125
|
+
advanced?: boolean;
|
|
126
|
+
transparent?: boolean;
|
|
127
|
+
color?: string;
|
|
128
|
+
updateInput?: boolean;
|
|
129
|
+
onSelect?: ((event: unknown) => void) | null;
|
|
130
|
+
onLiveUpdate?: ((event: unknown) => void) | null;
|
|
131
|
+
}
|
|
132
|
+
/** Options for TsDate (DateTooltip) */
|
|
133
|
+
interface DateOptions extends TooltipOptions {
|
|
134
|
+
type?: 'date' | 'time' | 'datetime';
|
|
135
|
+
value?: string;
|
|
136
|
+
format?: string;
|
|
137
|
+
start?: string | HTMLElement | null;
|
|
138
|
+
end?: string | HTMLElement | null;
|
|
139
|
+
btnNow?: boolean;
|
|
140
|
+
blockDates?: string[];
|
|
141
|
+
blockWeekdays?: number[];
|
|
142
|
+
colored?: Record<string, string>;
|
|
143
|
+
noMinutes?: boolean;
|
|
144
|
+
startTime?: string;
|
|
145
|
+
endTime?: string;
|
|
146
|
+
onSelect?: ((event: unknown) => void) | null;
|
|
147
|
+
}
|
|
148
|
+
/** The overlay object — a TsBase instance extended at runtime with many dynamic props */
|
|
149
|
+
type TooltipOverlay = // any: dynamic TsBase extension
|
|
150
|
+
InstanceType<typeof TsBase> & {
|
|
151
|
+
id: string;
|
|
152
|
+
name: string;
|
|
153
|
+
options: TooltipOptions & MenuOptions & ColorOptions & DateOptions;
|
|
154
|
+
anchor: HTMLElement;
|
|
155
|
+
self: Tooltip;
|
|
156
|
+
displayed: boolean;
|
|
157
|
+
box: HTMLElement & {
|
|
158
|
+
overlay?: TooltipOverlay;
|
|
159
|
+
} | null;
|
|
160
|
+
needsUpdate?: boolean;
|
|
161
|
+
prevOptions?: TooltipOptions;
|
|
162
|
+
tmp: Record<string, unknown>;
|
|
163
|
+
selected?: string | number | null;
|
|
164
|
+
newColor?: string;
|
|
165
|
+
newValue?: string;
|
|
166
|
+
newDate?: string;
|
|
167
|
+
next?: () => void;
|
|
168
|
+
prev?: () => void;
|
|
169
|
+
click?: () => void;
|
|
170
|
+
hide: () => void;
|
|
171
|
+
};
|
|
172
|
+
/** Return value of Tooltip.attach() */
|
|
173
|
+
interface AttachReturn {
|
|
174
|
+
overlay: TooltipOverlay;
|
|
175
|
+
then: (callback: (event: unknown) => void) => AttachReturn;
|
|
176
|
+
show: (callback: (event: unknown) => void) => AttachReturn;
|
|
177
|
+
hide: (callback: (event: unknown) => void) => AttachReturn;
|
|
178
|
+
update: (callback: (event: unknown) => void) => AttachReturn;
|
|
179
|
+
move: (callback: (event: unknown) => void) => AttachReturn;
|
|
180
|
+
liveUpdate?: (callback: (event: unknown) => void) => AttachReturn;
|
|
181
|
+
select?: (callback: (event: unknown) => void) => AttachReturn;
|
|
182
|
+
remove?: (callback: (event: unknown) => void) => AttachReturn;
|
|
183
|
+
subMenu?: (callback: (event: unknown) => void) => AttachReturn;
|
|
184
|
+
}
|
|
185
|
+
/** Position calculation result */
|
|
186
|
+
interface TooltipPosition {
|
|
187
|
+
left: number;
|
|
188
|
+
top: number;
|
|
189
|
+
arrow: {
|
|
190
|
+
offset: number;
|
|
191
|
+
class: string;
|
|
192
|
+
style: string;
|
|
193
|
+
};
|
|
194
|
+
adjust: {
|
|
195
|
+
left: number;
|
|
196
|
+
top: number;
|
|
197
|
+
};
|
|
198
|
+
width?: number;
|
|
199
|
+
height?: number;
|
|
200
|
+
pos: string;
|
|
201
|
+
}
|
|
202
|
+
declare class Tooltip {
|
|
203
|
+
static active: Record<string, TooltipOverlay>;
|
|
204
|
+
defaults: TooltipOptions;
|
|
205
|
+
setColor?: (color: Partial<{
|
|
206
|
+
h: number;
|
|
207
|
+
s: number;
|
|
208
|
+
v: number;
|
|
209
|
+
a: number;
|
|
210
|
+
}>, fullUpdate?: boolean, initial?: string) => void;
|
|
211
|
+
initControls(_overlay: any): void;
|
|
212
|
+
constructor();
|
|
213
|
+
static observeRemove: MutationObserver;
|
|
214
|
+
trigger(event: any, data?: any): {
|
|
215
|
+
isCancelled?: boolean;
|
|
216
|
+
finish: () => void;
|
|
217
|
+
detail?: Record<string, unknown>;
|
|
218
|
+
};
|
|
219
|
+
get(name?: string | true): string[] | Record<string, TooltipOverlay> | TooltipOverlay | undefined;
|
|
220
|
+
attach(anchorArg?: HTMLElement | TooltipOptions | null, textArg?: string | TooltipOptions): AttachReturn | undefined;
|
|
221
|
+
update(name: string, html: string): void;
|
|
222
|
+
show(name?: string | HTMLElement | TooltipOptions, extraOptions?: TooltipOptions): AttachReturn | {
|
|
223
|
+
overlay: TooltipOverlay;
|
|
224
|
+
} | undefined;
|
|
225
|
+
hide(name?: string | HTMLElement): void;
|
|
226
|
+
resize(name?: string): {
|
|
227
|
+
moved: boolean;
|
|
228
|
+
resize: boolean;
|
|
229
|
+
} | {
|
|
230
|
+
multiple: boolean;
|
|
231
|
+
} | void;
|
|
232
|
+
getPosition(name: string): TooltipPosition | undefined;
|
|
233
|
+
/**
|
|
234
|
+
* Move overlay node to the end of its parent (typically body) so it stacks above other .tsg-overlay siblings
|
|
235
|
+
* without relying on z-index. No-op if it is already the last element child.
|
|
236
|
+
*/
|
|
237
|
+
bringOverlayToFront(overlay: TooltipOverlay): void;
|
|
238
|
+
startDrag(event: MouseEvent & {
|
|
239
|
+
target: EventTarget & {
|
|
240
|
+
_lastBoundingRect?: DOMRect;
|
|
241
|
+
};
|
|
242
|
+
}): void;
|
|
243
|
+
}
|
|
244
|
+
declare class ColorTooltip extends Tooltip {
|
|
245
|
+
static custom_colors: string[];
|
|
246
|
+
palette: string[][];
|
|
247
|
+
index: [number, number];
|
|
248
|
+
constructor();
|
|
249
|
+
attach(anchor: any, text?: any): AttachReturn | undefined;
|
|
250
|
+
select(color: any, name: any): void;
|
|
251
|
+
nextColor(direction: string): string | undefined;
|
|
252
|
+
tabClick(index: any, name: any): void;
|
|
253
|
+
getColorHTML(name: any, options: any): string;
|
|
254
|
+
getCustomColorsHTML(name: string): string;
|
|
255
|
+
initControls(overlay: TooltipOverlay): void;
|
|
256
|
+
addCustomColor(color: any, _name: any): any;
|
|
257
|
+
pickAndSelect(name: string, event: any): Promise<void>;
|
|
258
|
+
pickAndUse(_name: string): Promise<void>;
|
|
259
|
+
pickColor(): Promise<string | undefined>;
|
|
260
|
+
}
|
|
261
|
+
declare class MenuTooltip extends Tooltip {
|
|
262
|
+
constructor();
|
|
263
|
+
attach(anchor: any, text?: any): AttachReturn | undefined;
|
|
264
|
+
update(name: any, items: any): void;
|
|
265
|
+
initControls(overlay: any): void;
|
|
266
|
+
getCurrent(name: string, id?: any): {
|
|
267
|
+
last: number;
|
|
268
|
+
index: any;
|
|
269
|
+
items: any;
|
|
270
|
+
item: any;
|
|
271
|
+
parents: string;
|
|
272
|
+
};
|
|
273
|
+
getMenuHTML(options: any): string;
|
|
274
|
+
openSubMenu(event: any): void;
|
|
275
|
+
closeSubMenu(event: any): void;
|
|
276
|
+
refreshIndex(name: string, instant?: boolean): void;
|
|
277
|
+
showTooltip(name: string, options?: any): void;
|
|
278
|
+
refreshSearch(name: string): void;
|
|
279
|
+
/**
|
|
280
|
+
* Loops through the items and markes item.hidden = true for those that need to be hidden, and item.hidden = false
|
|
281
|
+
* for those that are visible. Return a promise (since items can be on the server) with the number of visible items.
|
|
282
|
+
*/
|
|
283
|
+
applyFilter(name: string, items: any, search: any, debounce?: any): Promise<any>;
|
|
284
|
+
request(overlay: any, search: any, debounce: any): Promise<any>;
|
|
285
|
+
/**
|
|
286
|
+
* Builds an array of item ids that sequencial order for navigation with up/down keys. Skips hidden and disabled items
|
|
287
|
+
* and goes into nested structures. It will remember last active chain in 'overlay.tmp.activeChain'
|
|
288
|
+
*/
|
|
289
|
+
getActiveChain(name: string, items?: any, parents?: any[], res?: any[], noSave?: boolean): any[];
|
|
290
|
+
menuDown(overlay: any, event: any, index: any, parents: any): void;
|
|
291
|
+
menuClick(overlay: any, event: any, index: any, parents: any): void;
|
|
292
|
+
findChecked(items: any): any[];
|
|
293
|
+
keyUp(overlay: any, event: any): void;
|
|
294
|
+
}
|
|
295
|
+
declare class DateTooltip extends Tooltip {
|
|
296
|
+
daysCount: number[];
|
|
297
|
+
today: string;
|
|
298
|
+
constructor();
|
|
299
|
+
attach(anchor: any, text?: any): AttachReturn | undefined;
|
|
300
|
+
initControls(overlay: any): void;
|
|
301
|
+
getMonthHTML(options: any, month?: any, year?: any): {
|
|
302
|
+
html: string;
|
|
303
|
+
month: any;
|
|
304
|
+
year: any;
|
|
305
|
+
};
|
|
306
|
+
getYearHTML(): string;
|
|
307
|
+
getHourHTML(options: any): {
|
|
308
|
+
html: string;
|
|
309
|
+
};
|
|
310
|
+
getMinHTML(hour: any, options: any): {
|
|
311
|
+
html: string;
|
|
312
|
+
};
|
|
313
|
+
inRange(str: any, options: any, dateOnly?: boolean): boolean;
|
|
314
|
+
str2min(str: any): number | null;
|
|
315
|
+
min2str(time: number, format?: any): string;
|
|
316
|
+
}
|
|
317
|
+
declare const TsTooltip: Tooltip;
|
|
318
|
+
declare const TsMenu: MenuTooltip;
|
|
319
|
+
declare const TsColor: ColorTooltip;
|
|
320
|
+
declare const TsDate: DateTooltip;
|
|
321
|
+
|
|
322
|
+
declare const __test_internals: {
|
|
323
|
+
readonly tooltipCtorCount: number;
|
|
324
|
+
readonly menuCtorCount: number;
|
|
325
|
+
readonly colorCtorCount: number;
|
|
326
|
+
readonly dateCtorCount: number;
|
|
327
|
+
reset(): void;
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
export { Tooltip, TsColor, TsDate, TsMenu, TsTooltip, __test_internals };
|