tsgrid-ui 2.7.1 → 2.9.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 +173 -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-26XP2XU3.js +1795 -0
- package/dist/chunks/chunk-26XP2XU3.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-BIB3X2TW.js +1638 -0
- package/dist/chunks/chunk-BIB3X2TW.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-EVZMMVXO.js +1212 -0
- package/dist/chunks/chunk-EVZMMVXO.js.map +1 -0
- package/dist/chunks/chunk-GJD5NFWQ.js +2305 -0
- package/dist/chunks/chunk-GJD5NFWQ.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-OFASTA2A.js +2980 -0
- package/dist/chunks/chunk-OFASTA2A.js.map +1 -0
- package/dist/chunks/chunk-OMLGN735.js +677 -0
- package/dist/chunks/chunk-OMLGN735.js.map +1 -0
- package/dist/chunks/chunk-WKSLGUB3.js +1127 -0
- package/dist/chunks/chunk-WKSLGUB3.js.map +1 -0
- package/dist/chunks/chunk-YBY52G2U.js +849 -0
- package/dist/chunks/chunk-YBY52G2U.js.map +1 -0
- package/dist/field.d.ts +329 -0
- package/dist/field.es6.js +11 -0
- package/dist/field.es6.js.map +1 -0
- package/dist/form.d.ts +162 -0
- package/dist/form.es6.js +14 -0
- package/dist/form.es6.js.map +1 -0
- package/dist/layout.d.ts +108 -0
- package/dist/layout.es6.js +13 -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/metafile-esm.json +1 -0
- package/dist/popup.d.ts +92 -0
- package/dist/popup.es6.js +18 -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 +11 -0
- package/dist/sidebar.es6.js.map +1 -0
- package/dist/tabs.d.ts +63 -0
- package/dist/tabs.es6.js +11 -0
- package/dist/tabs.es6.js.map +1 -0
- package/dist/toolbar.d.ts +97 -0
- package/dist/toolbar.es6.js +11 -0
- package/dist/toolbar.es6.js.map +1 -0
- package/dist/tooltip.d.ts +322 -0
- package/dist/tooltip.es6.js +18 -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 +7750 -23830
- package/dist/tsgrid-ui.es6.js.map +1 -1
- package/dist/tsgrid-ui.es6.min.js +28 -28
- package/dist/tsgrid-ui.js +96 -17
- package/dist/tsgrid-ui.min.css +2 -2
- package/dist/tsgrid-ui.min.js +24 -24
- 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 +26 -5
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { TsBase } from './base.js';
|
|
2
|
+
import './query-CKGg5Ugv.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* TsUtils message cluster (message/alert/confirm/prompt/normButtons + types)
|
|
6
|
+
* — Phase 2-4 of v2.3 SDD (message-cluster-extraction).
|
|
7
|
+
*
|
|
8
|
+
* IMPORTANT: This module imports TsBase from tsbase.ts — the only carve-out
|
|
9
|
+
* to INV-4. Rationale: message() does `new TsBase()` to mix events into msgBase.
|
|
10
|
+
* This exception is documented here and whitelisted in the INV-4 grep policy.
|
|
11
|
+
*
|
|
12
|
+
* Exports (Phase 2):
|
|
13
|
+
* normButtons — standalone pure helper; no DOM, no timers
|
|
14
|
+
*
|
|
15
|
+
* Exports (Phase 3a):
|
|
16
|
+
* TsMessageProm, TsMessageWhere, TsMessageOptions (types)
|
|
17
|
+
* MessageDeps (deps interface for _message — scaffold for Phase 3b)
|
|
18
|
+
* _message (stub — body lands in Phase 3b)
|
|
19
|
+
*
|
|
20
|
+
* Exports (Phase 3b+):
|
|
21
|
+
* _message (full body), _alert, _confirm, _prompt (Phase 4)
|
|
22
|
+
*
|
|
23
|
+
* Imports: TsBase from tsbase.ts (INV-4 carve-out, see above)
|
|
24
|
+
* TsUISettings type from tsutils.ts (type-only, no runtime dep)
|
|
25
|
+
* query from query.js (DOM helper)
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/** Promise-chain handle returned by message() / confirm() / prompt() */
|
|
29
|
+
interface TsMessageProm {
|
|
30
|
+
self: TsBase;
|
|
31
|
+
action(callBack: (event: unknown) => void): TsMessageProm;
|
|
32
|
+
close(callBack: (event: unknown) => void): TsMessageProm;
|
|
33
|
+
open(callBack: (event: unknown) => void): TsMessageProm;
|
|
34
|
+
then(callBack: (event: unknown) => void): TsMessageProm;
|
|
35
|
+
change?: (callBack: (event: unknown) => void) => TsMessageProm;
|
|
36
|
+
[key: string]: unknown;
|
|
37
|
+
}
|
|
38
|
+
/** Where-descriptor for message() */
|
|
39
|
+
interface TsMessageWhere {
|
|
40
|
+
box: string | Element | null;
|
|
41
|
+
after?: string | Element | null;
|
|
42
|
+
owner?: {
|
|
43
|
+
name?: string;
|
|
44
|
+
lock?: (...args: unknown[]) => void;
|
|
45
|
+
unlock?: (...args: unknown[]) => void;
|
|
46
|
+
focus?: () => void;
|
|
47
|
+
};
|
|
48
|
+
param?: unknown;
|
|
49
|
+
}
|
|
50
|
+
/** Options for message() */
|
|
51
|
+
interface TsMessageOptions {
|
|
52
|
+
width?: number;
|
|
53
|
+
height?: number;
|
|
54
|
+
text?: string | null;
|
|
55
|
+
body?: string;
|
|
56
|
+
buttons?: string;
|
|
57
|
+
html?: string;
|
|
58
|
+
focus?: number | string | null;
|
|
59
|
+
hideOn?: string[];
|
|
60
|
+
actions?: Record<string, unknown>;
|
|
61
|
+
cancelAction?: string;
|
|
62
|
+
on?: unknown;
|
|
63
|
+
onOpen?: unknown;
|
|
64
|
+
onClose?: unknown;
|
|
65
|
+
onAction?: unknown;
|
|
66
|
+
originalWidth?: number;
|
|
67
|
+
originalHeight?: number;
|
|
68
|
+
msgIndex?: number;
|
|
69
|
+
tmp?: {
|
|
70
|
+
zIndex: string;
|
|
71
|
+
overflow: string;
|
|
72
|
+
};
|
|
73
|
+
input?: Element | null;
|
|
74
|
+
box?: Element | null;
|
|
75
|
+
trigger?: (event: string, data: Record<string, unknown>) => unknown;
|
|
76
|
+
close?: () => void;
|
|
77
|
+
setFocus?: (focus: number | string | null | undefined) => void;
|
|
78
|
+
action?: (action: string, event: unknown) => void;
|
|
79
|
+
[key: string]: unknown;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export type { TsMessageProm as T, TsMessageOptions as a, TsMessageWhere as b };
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
import { Q as Query } from './query-CKGg5Ugv.js';
|
|
2
|
+
import { b as TsMessageWhere, a as TsMessageOptions, T as TsMessageProm } from './tsutils-message-CogFtVtO.js';
|
|
3
|
+
import './base.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Part of TsUi 2.0 library — color cluster sub-module
|
|
7
|
+
* - Extracted from src/tsutils.ts by v2.1 SDD refactor (Phase 2)
|
|
8
|
+
* - No dependencies on TsBase, TsUtils, or any other sub-module (L1 DAG leaf)
|
|
9
|
+
* - All exports are plain functions — no default export
|
|
10
|
+
*
|
|
11
|
+
* 4-space indent (project convention for sub-modules).
|
|
12
|
+
*/
|
|
13
|
+
/** RGB(A) color as returned by parseColor() */
|
|
14
|
+
interface TsColorRgb {
|
|
15
|
+
r: number;
|
|
16
|
+
g: number;
|
|
17
|
+
b: number;
|
|
18
|
+
a: number;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* TsUtils v2.1 — Data / Object helpers sub-module (Phase 3+4 of v2.1 SDD)
|
|
23
|
+
*
|
|
24
|
+
* Contains: TsCloneOptions, clone, extend,
|
|
25
|
+
* naturalCompare, normMenu, getNested, encodeParams,
|
|
26
|
+
* prepareParams, parseRoute, debounce, wait
|
|
27
|
+
*
|
|
28
|
+
* Rules:
|
|
29
|
+
* - No default export
|
|
30
|
+
* - No import from tsbase.ts (INV-4)
|
|
31
|
+
* - No this.-dispatch inside function bodies (INV-8)
|
|
32
|
+
* - 4-space indent
|
|
33
|
+
*/
|
|
34
|
+
/** Options for TsUtils.clone() */
|
|
35
|
+
interface TsCloneOptions {
|
|
36
|
+
functions?: boolean;
|
|
37
|
+
elements?: boolean;
|
|
38
|
+
events?: boolean;
|
|
39
|
+
exclude?: string[] | ((key: string, ctx: {
|
|
40
|
+
obj: unknown;
|
|
41
|
+
parent: string;
|
|
42
|
+
}) => boolean);
|
|
43
|
+
parent?: string;
|
|
44
|
+
}
|
|
45
|
+
/** Options for TsUtils.normMenu() */
|
|
46
|
+
interface TsNormMenuOptions {
|
|
47
|
+
itemMap?: {
|
|
48
|
+
id: string;
|
|
49
|
+
text: string;
|
|
50
|
+
};
|
|
51
|
+
[key: string]: unknown;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* TsUi registry + checkName — Phase 0 of v2.3 SDD.
|
|
56
|
+
* DEPENDENCY-FREE: zero imports from tsutils/tsbase family.
|
|
57
|
+
*
|
|
58
|
+
* Hosts the mutable widget registry object (TsUi) and the name-validation
|
|
59
|
+
* helper (checkName) that were previously coupled to tsbase.ts via tsutils.ts,
|
|
60
|
+
* creating a tsbase ↔ tsutils import cycle. Moving them here breaks that cycle:
|
|
61
|
+
*
|
|
62
|
+
* tsbase.ts → tsutils-registry.ts → tsutils-type-guards.ts → (leaf)
|
|
63
|
+
*
|
|
64
|
+
* tsutils.ts re-exports TsUi from this module (does NOT re-declare it) to
|
|
65
|
+
* preserve the single-object identity required by INV-12 (referential equality
|
|
66
|
+
* across all import paths).
|
|
67
|
+
*
|
|
68
|
+
* Imports: only isAlphaNumeric from ./tsutils-type-guards.js
|
|
69
|
+
* Exports: TsUi, checkName
|
|
70
|
+
*/
|
|
71
|
+
/** Widget registry — widgets register here when constructed with a `name`. */
|
|
72
|
+
declare const TsUi: Record<string, unknown>;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* TsUtils DOM sub-module — Phase 5b of v2.4 SDD.
|
|
76
|
+
* DAG position: leaf module (no tsbase/tsutils imports).
|
|
77
|
+
*
|
|
78
|
+
* Imports: ./tsutils-string.js (_encodeTags), ./tsutils-type-guards.js (_isInt),
|
|
79
|
+
* ./tsutils-data.js (_extend), ./query.js (query, Query), DOM globals only.
|
|
80
|
+
* 4-space indent convention.
|
|
81
|
+
*
|
|
82
|
+
* INV-4: MUST NOT import from tsbase.ts or tsutils.ts.
|
|
83
|
+
* INV-8: No arguments.length usage.
|
|
84
|
+
* INV-9: No this.X in exported function bodies.
|
|
85
|
+
*/
|
|
86
|
+
/** Options for TsUtils.lock() — moved from tsutils.ts (Phase 5a of v2.4 SDD) */
|
|
87
|
+
interface TsLockOptions {
|
|
88
|
+
msg?: string | number;
|
|
89
|
+
spinner?: boolean;
|
|
90
|
+
opacity?: number;
|
|
91
|
+
bgColor?: string;
|
|
92
|
+
onClick?: () => void;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* TsUtils date-time sub-module — Phase 5b of v2.5 SDD.
|
|
97
|
+
* DAG position: leaf module (no tsbase/tsutils imports).
|
|
98
|
+
*
|
|
99
|
+
* Imports:
|
|
100
|
+
* ./tsutils-type-guards.js — isInt as _isInt (needed by isDate, isTime, formatDate, formatTime)
|
|
101
|
+
* ./tsutils.js — type-only import type { TsUISettings } (TS erases at emit)
|
|
102
|
+
* Precedent: tsutils-type-guards.ts:9, tsutils-message.ts:26
|
|
103
|
+
*
|
|
104
|
+
* INV-4: MUST NOT import from tsbase.ts or tsutils.ts at runtime.
|
|
105
|
+
* INV-8: No arguments.length usage.
|
|
106
|
+
* INV-9: No this.X in exported function bodies.
|
|
107
|
+
*
|
|
108
|
+
* 4-space indent convention.
|
|
109
|
+
*
|
|
110
|
+
* OQ-2 (TsTimeResult): local non-exported interface `TsTimeResult` defined inline
|
|
111
|
+
* here (structurally identical to tsutils.ts copy). Avoids back-import of a
|
|
112
|
+
* non-exported type; the class delegator in tsutils.ts casts via `as boolean | TsTimeResult`.
|
|
113
|
+
*
|
|
114
|
+
* R-DT-3 (settings reference): `settings` is passed as a reference to `this.settings`
|
|
115
|
+
* from delegators — never cloned. TsLocale mutations to fullmonths/shortmonths/dateFormat
|
|
116
|
+
* etc. flow through without restart.
|
|
117
|
+
*
|
|
118
|
+
* R-DT-2 / R-DT-8 (intra-cluster calls): _isDateTime calls _isDate + _isTime directly
|
|
119
|
+
* as module-level function refs. _formatDateTime calls _formatDate + _formatTime directly.
|
|
120
|
+
* _formatTime calls _isTime directly. Zero this.X inside any extracted body.
|
|
121
|
+
*/
|
|
122
|
+
|
|
123
|
+
/** Return value from _isTime() / TsUtils.isTime() when retTime === true — single canonical declaration (v2.6 dedup) */
|
|
124
|
+
interface TsTimeResult {
|
|
125
|
+
hours: number;
|
|
126
|
+
minutes: number;
|
|
127
|
+
seconds: number;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Part of TsUi 2.0 library
|
|
132
|
+
* - Dependencies: mQuery, TsUtils, TsBase, TsLocale
|
|
133
|
+
*
|
|
134
|
+
* T2.5: @ts-nocheck removed; file typed aggressively per typing_policy.
|
|
135
|
+
* See commit body for targeted-any inventory.
|
|
136
|
+
*
|
|
137
|
+
* == TODO ==
|
|
138
|
+
* - add TsUtils.lang wrap for all captions in all buttons.
|
|
139
|
+
* - check transition (also with layout)
|
|
140
|
+
* - deprecate TsUtils.tooltip
|
|
141
|
+
*
|
|
142
|
+
* == 2.0 changes
|
|
143
|
+
* - CSP - fixed inline events (TsUtils.tooltip still has it)
|
|
144
|
+
* - transition returns a promise
|
|
145
|
+
* - removed jQuery
|
|
146
|
+
* - refactores TsUtils.message()
|
|
147
|
+
* - added TsUtils.confirm()
|
|
148
|
+
* - added isPlainObject
|
|
149
|
+
* - added stripSpaces
|
|
150
|
+
* - implemented marker - can now take an element or just html
|
|
151
|
+
* - cssPrefix - deprecated
|
|
152
|
+
* - TsUtils.debounce
|
|
153
|
+
* - TsUtils.prepareParams
|
|
154
|
+
* - TsUtils.getStrHeight
|
|
155
|
+
* - TsUtils.getStrDimentions
|
|
156
|
+
* - TsUtils.alrert() - same as TsUtils.message()
|
|
157
|
+
* - TsUtils.prompt() - similar to TsPrompt
|
|
158
|
+
* - TsUtils.normMenu(..., options) got options parameter that can have itemMap
|
|
159
|
+
* - TsUtils.getNested()
|
|
160
|
+
* - TsUtils.wait() - async timer
|
|
161
|
+
*/
|
|
162
|
+
|
|
163
|
+
declare const query: (selector: unknown, context?: unknown) => Query;
|
|
164
|
+
/** Settings object merged from TsLocale + user locale overrides */
|
|
165
|
+
interface TsUISettings {
|
|
166
|
+
dataType: string;
|
|
167
|
+
dateFormat: string;
|
|
168
|
+
timeFormat: string;
|
|
169
|
+
datetimeFormat: string;
|
|
170
|
+
dateStartYear: number;
|
|
171
|
+
dateEndYear: number;
|
|
172
|
+
currencyPrefix: string;
|
|
173
|
+
currencySuffix: string;
|
|
174
|
+
currencyPrecision: number;
|
|
175
|
+
groupSymbol: string;
|
|
176
|
+
decimalSymbol: string;
|
|
177
|
+
shortmonths: string[];
|
|
178
|
+
fullmonths: string[];
|
|
179
|
+
shortdays: string[];
|
|
180
|
+
fulldays: string[];
|
|
181
|
+
weekStarts: string;
|
|
182
|
+
macButtonOrder: boolean;
|
|
183
|
+
warnNoPhrase: boolean;
|
|
184
|
+
phrases: Record<string, string> | null;
|
|
185
|
+
missing?: Record<string, string>;
|
|
186
|
+
locale?: string;
|
|
187
|
+
[key: string]: unknown;
|
|
188
|
+
}
|
|
189
|
+
/** Extra data passed to grid cell formatters */
|
|
190
|
+
interface TsFormatterExtra {
|
|
191
|
+
value: unknown;
|
|
192
|
+
params?: unknown;
|
|
193
|
+
record?: unknown;
|
|
194
|
+
[key: string]: unknown;
|
|
195
|
+
}
|
|
196
|
+
/** Signature of a grid-cell formatter function */
|
|
197
|
+
type TsFormatter = (record: TsFormatterExtra, extra?: TsFormatterExtra) => string;
|
|
198
|
+
|
|
199
|
+
/** A normalized menu item */
|
|
200
|
+
interface TsMenuItem {
|
|
201
|
+
id: string | number | null;
|
|
202
|
+
text: string;
|
|
203
|
+
caption?: string;
|
|
204
|
+
class?: string;
|
|
205
|
+
style?: string;
|
|
206
|
+
attrs?: string;
|
|
207
|
+
[key: string]: unknown;
|
|
208
|
+
}
|
|
209
|
+
declare class Utils {
|
|
210
|
+
version: string;
|
|
211
|
+
tmp: Record<string, unknown>;
|
|
212
|
+
settings: TsUISettings;
|
|
213
|
+
i18nCompare: (a: string, b: string) => number;
|
|
214
|
+
hasLocalStorage: boolean;
|
|
215
|
+
isMac: boolean;
|
|
216
|
+
isMobile: boolean;
|
|
217
|
+
isIOS: boolean;
|
|
218
|
+
isAndroid: boolean;
|
|
219
|
+
isSafari: boolean;
|
|
220
|
+
isFirefox: boolean;
|
|
221
|
+
formatters: Record<string, TsFormatter>;
|
|
222
|
+
constructor();
|
|
223
|
+
isBin(val: unknown): boolean;
|
|
224
|
+
isInt(val: unknown): boolean;
|
|
225
|
+
isFloat(val: unknown): boolean;
|
|
226
|
+
isMoney(val: unknown): boolean;
|
|
227
|
+
isHex(val: unknown): boolean;
|
|
228
|
+
isAlphaNumeric(val: unknown): boolean;
|
|
229
|
+
isEmail(val: unknown): boolean;
|
|
230
|
+
isIpAddress(val: unknown): boolean;
|
|
231
|
+
isDate(val: unknown, format?: string | null, retDate?: boolean): boolean | Date;
|
|
232
|
+
isTime(val: unknown, retTime?: boolean): boolean | TsTimeResult;
|
|
233
|
+
isDateTime(val: unknown, format?: string | null, retDate?: boolean): boolean | Date;
|
|
234
|
+
age(dateStr: unknown): string;
|
|
235
|
+
interval(value: number): string;
|
|
236
|
+
date(dateStr: unknown): string;
|
|
237
|
+
formatSize(sizeStr: unknown): string | number;
|
|
238
|
+
formatNumber(val: unknown, fraction?: number | string | null, useGrouping?: boolean): string;
|
|
239
|
+
formatDate(dateStr: unknown, format?: string | null): string;
|
|
240
|
+
formatTime(dateStr: unknown, format?: string | null): string;
|
|
241
|
+
formatDateTime(dateStr: unknown, format?: string | null): string;
|
|
242
|
+
stripSpaces(html: unknown): unknown;
|
|
243
|
+
stripTags(html: unknown): unknown;
|
|
244
|
+
encodeTags(html: unknown): unknown;
|
|
245
|
+
decodeTags(html: unknown): unknown;
|
|
246
|
+
escapeId(id: unknown): string;
|
|
247
|
+
unescapeId(id: string | null | undefined): string;
|
|
248
|
+
base64encode(str: string): string;
|
|
249
|
+
base64decode(encodedStr: string): string;
|
|
250
|
+
sha256(str: string): Promise<string>;
|
|
251
|
+
transition(div_old: HTMLElement, div_new: HTMLElement, type: string, callBack?: () => void): Promise<void>;
|
|
252
|
+
lock(box: unknown, options?: TsLockOptions | string, ...rest: unknown[]): void;
|
|
253
|
+
unlock(box: unknown, speed?: number): void;
|
|
254
|
+
/**
|
|
255
|
+
* Opens a context message, similar in parameters as TsPopup.open()
|
|
256
|
+
*
|
|
257
|
+
* Sample Calls
|
|
258
|
+
* TsUtils.message({ box: '#div', text: 'message' }).ok(() => {})
|
|
259
|
+
* TsUtils.message({ box: '#div', text: 'message', width: 300 }).ok(() => {})
|
|
260
|
+
* TsUtils.message({ box: '#div', text: 'message', actions: ['Save'] }).Save(() => {})
|
|
261
|
+
*
|
|
262
|
+
* Used in TsGrid, TsForm, TsLayout (should be in TsPopup too)
|
|
263
|
+
* should be called with .call(...) method
|
|
264
|
+
*
|
|
265
|
+
* @param where = {
|
|
266
|
+
* box, // where to open
|
|
267
|
+
* after, // title if any, adds title heights
|
|
268
|
+
* param // additional parameters, used in layouts for panel
|
|
269
|
+
* }
|
|
270
|
+
* @param options {
|
|
271
|
+
* width, // (int), width in px, if negative, then it is maxWidth - width
|
|
272
|
+
* height, // (int), height in px, if negative, then it is maxHeight - height
|
|
273
|
+
* text, // centered text
|
|
274
|
+
* body, // body of the message
|
|
275
|
+
* buttons, // buttons of the message
|
|
276
|
+
* html, // if body & buttons are not defined, then html is the entire message
|
|
277
|
+
* focus, // int or id with a selector, default is 0
|
|
278
|
+
* hideOn, // ['esc', 'click'], default is ['esc']
|
|
279
|
+
* actions, // array of actions (only if buttons is not defined)
|
|
280
|
+
* onOpen, // event when opened
|
|
281
|
+
* onClose, // event when closed
|
|
282
|
+
* onAction, // event on action
|
|
283
|
+
* }
|
|
284
|
+
*/
|
|
285
|
+
message(where: TsMessageWhere, options?: TsMessageOptions | string | number): TsMessageProm | undefined;
|
|
286
|
+
alert(where: TsMessageWhere, options?: TsMessageOptions | string | number): TsMessageProm | undefined;
|
|
287
|
+
/**
|
|
288
|
+
* Shows a prompt as a context message. It will use same where: { box: ... } as TsUtils.message() function
|
|
289
|
+
* but it will have options similar to TsPrompt dialog
|
|
290
|
+
*
|
|
291
|
+
* Example:
|
|
292
|
+
* - TsUtils.conrirm({
|
|
293
|
+
* box: '#custom',
|
|
294
|
+
* text: 'Some message'
|
|
295
|
+
* })
|
|
296
|
+
* .yes(event => console.log(event))
|
|
297
|
+
*/
|
|
298
|
+
confirm(where: TsMessageWhere, options?: TsMessageOptions | string | number): TsMessageProm | undefined;
|
|
299
|
+
/**
|
|
300
|
+
* Shows a prompt as a context message. It will use same where: { box: ... } as TsUtils.message() function
|
|
301
|
+
* but it will have options similar to TsPrompt dialog
|
|
302
|
+
*
|
|
303
|
+
* Example:
|
|
304
|
+
* - TsUtils.prompt({
|
|
305
|
+
* box: '#custom',
|
|
306
|
+
* label: 'Enter Name',
|
|
307
|
+
* textarea: false,
|
|
308
|
+
* attrs: 'style="border: 1px solid red"'
|
|
309
|
+
* })
|
|
310
|
+
* .ok(event => console.log(event))
|
|
311
|
+
*/
|
|
312
|
+
prompt(where: TsMessageWhere, options?: TsMessageOptions | string | number): TsMessageProm | undefined;
|
|
313
|
+
/**
|
|
314
|
+
* Normalizes yes, no buttons for confirmation dialog
|
|
315
|
+
*
|
|
316
|
+
* @param {*} options
|
|
317
|
+
* @returns options
|
|
318
|
+
*/
|
|
319
|
+
normButtons(options: Record<string, unknown>, btn: Record<string, unknown>): Record<string, unknown>;
|
|
320
|
+
/**
|
|
321
|
+
* Shows small notification message at the bottom of the page, or containter that you specify
|
|
322
|
+
* in options.where (could be element or a selector)
|
|
323
|
+
*
|
|
324
|
+
* TsUtils.notify('Document saved')
|
|
325
|
+
* TsUtils.notify('Mesage sent ${udon}', { actions: { undo: function () {...} }})
|
|
326
|
+
*
|
|
327
|
+
* @param {String/Object} options can be {
|
|
328
|
+
* text: string, // message, can be html
|
|
329
|
+
* where: el/selector, // element or selector where to show, default is document.body
|
|
330
|
+
* timeout: int, // timeout when to hide, if 0 - indefinite
|
|
331
|
+
* error: boolean, // add error clases
|
|
332
|
+
* class: string, // additional class strings
|
|
333
|
+
* actions: object // object with action functions, it should correspot to templated text: '... ${action} ...'
|
|
334
|
+
* }
|
|
335
|
+
* @returns promise
|
|
336
|
+
*/
|
|
337
|
+
notify(text: string | Record<string, unknown>, options?: Record<string, unknown>): Promise<void>;
|
|
338
|
+
getSize(el: unknown, type: string): number;
|
|
339
|
+
getStrDimentions(str: string, styles?: string, raw?: boolean): {
|
|
340
|
+
width: number;
|
|
341
|
+
height: number;
|
|
342
|
+
};
|
|
343
|
+
getStrWidth(str: string, styles?: string, raw?: boolean): number;
|
|
344
|
+
getStrHeight(str: string, styles?: string, raw?: boolean): number;
|
|
345
|
+
execTemplate(str: any, replace_obj: any): any;
|
|
346
|
+
marker(el: any, items: any, options?: any): unknown;
|
|
347
|
+
lang(phrase: string, params?: Record<string, string | number> | boolean): string;
|
|
348
|
+
locale(locale: string | string[] | Record<string, unknown>, keepPhrases?: boolean, noMerge?: boolean): Promise<{
|
|
349
|
+
file: string;
|
|
350
|
+
data: unknown;
|
|
351
|
+
} | void>;
|
|
352
|
+
scrollBarSize(): unknown;
|
|
353
|
+
checkName(name: string): boolean;
|
|
354
|
+
checkUniqueId(id: any, items: any, desc: any, obj: any): boolean;
|
|
355
|
+
/**
|
|
356
|
+
* Takes an object and encodes it into params string to be passed as a url
|
|
357
|
+
* { a: 1, b: 'str'} => "a=1&b=str"
|
|
358
|
+
* { a: 1, b: { c: 2 }} => "a=1&b[c]=2"
|
|
359
|
+
* { a: 1, b: {c: { k: 'dfdf' } } } => "a=1&b[c][k]=dfdf"
|
|
360
|
+
*/
|
|
361
|
+
encodeParams(obj: any, prefix?: string): string;
|
|
362
|
+
parseRoute(route: string): {
|
|
363
|
+
path: RegExp;
|
|
364
|
+
keys: {
|
|
365
|
+
name: string;
|
|
366
|
+
optional: boolean;
|
|
367
|
+
}[];
|
|
368
|
+
};
|
|
369
|
+
getCursorPosition(input: any): number | null;
|
|
370
|
+
setCursorPosition(input: HTMLElement | null, pos: number, posEnd?: number): void;
|
|
371
|
+
parseColor(str: string | null | undefined): TsColorRgb | null;
|
|
372
|
+
colorContrast(color1: string, color2: string): string;
|
|
373
|
+
colorContrastValue(color1: string, color2: string): number;
|
|
374
|
+
hsv2rgb(h: any, s?: any, v?: any, a?: any): {
|
|
375
|
+
r: number;
|
|
376
|
+
g: number;
|
|
377
|
+
b: number;
|
|
378
|
+
a: number;
|
|
379
|
+
};
|
|
380
|
+
rgb2hsv(r: any, g?: any, b?: any, a?: any): {
|
|
381
|
+
h: number;
|
|
382
|
+
s: number;
|
|
383
|
+
v: number;
|
|
384
|
+
a: number;
|
|
385
|
+
};
|
|
386
|
+
tooltip(html: string | Record<string, unknown>, options?: Record<string, unknown>): string;
|
|
387
|
+
isPlainObject(value: unknown): boolean;
|
|
388
|
+
/**
|
|
389
|
+
* Deep copy of an object or an array. Function, events and HTML elements will not be cloned,
|
|
390
|
+
* you can choose to include them or not, by default they are included.
|
|
391
|
+
* You can also exclude certain elements from final object if used with options: { exclude }
|
|
392
|
+
*/
|
|
393
|
+
clone(obj: unknown, options?: Partial<TsCloneOptions>): any;
|
|
394
|
+
/**
|
|
395
|
+
* Deep extend an object, if an array, it overwrrites it, cloning objects in the process
|
|
396
|
+
* target, source1, source2, ...
|
|
397
|
+
*/
|
|
398
|
+
extend(target: any, source: any, ...rest: unknown[]): any;
|
|
399
|
+
naturalCompare(a: unknown, b: unknown): number;
|
|
400
|
+
/**
|
|
401
|
+
* Takes a menu (used in drop downs, context menu, field: list/combo/enum) and normalizes it to the common structure, which
|
|
402
|
+
* is { id: ..., text: ... }. In options you can pass { itemMap: { id: 'id_field', text: 'text_field' }} that will be used
|
|
403
|
+
* to find out id and text fields.
|
|
404
|
+
*/
|
|
405
|
+
normMenu(menu: unknown, options?: TsNormMenuOptions): TsMenuItem[] | undefined;
|
|
406
|
+
/**
|
|
407
|
+
* Takes Url object and fetchOptions and changes it in place applying selected user dataType. Since
|
|
408
|
+
* dataType is in TsUtils. This method is used in grid, form and tooltip to prepare fetch parameters
|
|
409
|
+
*/
|
|
410
|
+
prepareParams(url: URL, fetchOptions: Record<string, unknown>, options?: Record<string, unknown>): Record<string, unknown>;
|
|
411
|
+
bindEvents(selector: unknown, subject: Record<string, unknown>): void;
|
|
412
|
+
debounce(func: (...args: any[]) => void, wait?: number): (...args: any[]) => void;
|
|
413
|
+
wait(time?: number): Promise<void>;
|
|
414
|
+
getNested(obj: any, prop: any): unknown;
|
|
415
|
+
}
|
|
416
|
+
declare var TsUtils: Utils;
|
|
417
|
+
|
|
418
|
+
export { type TsCloneOptions, type TsColorRgb, type TsLockOptions, type TsMenuItem, TsMessageOptions, TsMessageProm, TsMessageWhere, type TsNormMenuOptions, type TsTimeResult, type TsUISettings, TsUi, TsUtils, query };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/package.json
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tsgrid-ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.0",
|
|
4
4
|
"sideEffects": [
|
|
5
5
|
"./dist/tsgrid-ui.css",
|
|
6
|
-
"./dist/tsgrid-ui.min.css"
|
|
6
|
+
"./dist/tsgrid-ui.min.css",
|
|
7
|
+
"./dist/utils.es6.js",
|
|
8
|
+
"./dist/popup.es6.js",
|
|
9
|
+
"./dist/tooltip.es6.js",
|
|
10
|
+
"./dist/tsgrid-ui.es6.js",
|
|
11
|
+
"./dist/tsgrid-ui.es6.min.js",
|
|
12
|
+
"./dist/tsgrid-ui.js",
|
|
13
|
+
"./dist/tsgrid-ui.min.js"
|
|
7
14
|
],
|
|
8
15
|
"title": "TsGrid UI: TypeScript-native UI component library",
|
|
9
16
|
"description": "TypeScript-native UI components: data grid, forms, fields, layout, sidebar, tabs, toolbar, popup, tooltip. ESM + CJS dual bundle, .d.ts rollup, zero runtime dependencies.",
|
|
@@ -35,11 +42,23 @@
|
|
|
35
42
|
"types": "dist/tsgrid-ui.d.ts",
|
|
36
43
|
"exports": {
|
|
37
44
|
".": {
|
|
38
|
-
"types":
|
|
39
|
-
"import":
|
|
45
|
+
"types": "./dist/tsgrid-ui.d.ts",
|
|
46
|
+
"import": "./dist/tsgrid-ui.es6.js",
|
|
40
47
|
"require": "./dist/tsgrid-ui.js"
|
|
41
48
|
},
|
|
42
|
-
"./
|
|
49
|
+
"./locale": { "types": "./dist/locale.d.ts", "import": "./dist/locale.es6.js" },
|
|
50
|
+
"./base": { "types": "./dist/base.d.ts", "import": "./dist/base.es6.js" },
|
|
51
|
+
"./utils": { "types": "./dist/utils.d.ts", "import": "./dist/utils.es6.js" },
|
|
52
|
+
"./popup": { "types": "./dist/popup.d.ts", "import": "./dist/popup.es6.js" },
|
|
53
|
+
"./tooltip": { "types": "./dist/tooltip.d.ts", "import": "./dist/tooltip.es6.js" },
|
|
54
|
+
"./tabs": { "types": "./dist/tabs.d.ts", "import": "./dist/tabs.es6.js" },
|
|
55
|
+
"./toolbar": { "types": "./dist/toolbar.d.ts", "import": "./dist/toolbar.es6.js" },
|
|
56
|
+
"./sidebar": { "types": "./dist/sidebar.d.ts", "import": "./dist/sidebar.es6.js" },
|
|
57
|
+
"./field": { "types": "./dist/field.d.ts", "import": "./dist/field.es6.js" },
|
|
58
|
+
"./layout": { "types": "./dist/layout.d.ts", "import": "./dist/layout.es6.js" },
|
|
59
|
+
"./form": { "types": "./dist/form.d.ts", "import": "./dist/form.es6.js" },
|
|
60
|
+
"./css": "./dist/tsgrid-ui.css",
|
|
61
|
+
"./package.json": "./package.json"
|
|
43
62
|
},
|
|
44
63
|
"style": "dist/tsgrid-ui.css",
|
|
45
64
|
"files": [
|
|
@@ -61,6 +80,8 @@
|
|
|
61
80
|
"build:css": "gulp less && gulp icons",
|
|
62
81
|
"build:js": "tsup --config tsup.config.ts && node scripts/wrap-legacy.mjs",
|
|
63
82
|
"build": "pnpm build:css && pnpm build:js",
|
|
83
|
+
"bundle:analyze": "tsup --config tsup.config.analyze.ts && node scripts/bundle-analyze.mjs",
|
|
84
|
+
"bundle:snapshot": "tsup --config tsup.config.analyze.ts && node scripts/bundle-snapshot.mjs",
|
|
64
85
|
"smoke": "playwright test",
|
|
65
86
|
"smoke:update": "playwright test --update-snapshots",
|
|
66
87
|
"consumer-smoke": "tsc --noEmit --project test/tsconfig.json",
|