1 |
|
2 |
|
3 | declare module "tripetto" {
|
4 | import * as Tripetto from "tripetto/module";
|
5 | export * from "tripetto/module";
|
6 | export { Tripetto };
|
7 | export default Tripetto;
|
8 | }
|
9 |
|
10 | declare module "tripetto/module" {
|
11 |
|
12 | export * from "tripetto/module/functional";
|
13 |
|
14 | export * as AES from "tripetto/module/aes";
|
15 | export * as Collection from "tripetto/helpers/collection";
|
16 | export * as Components from "tripetto/components";
|
17 | export * as Contracts from "tripetto/module/contracts";
|
18 | export * as DOM from "tripetto/module/dom";
|
19 | export * as Drawings from "tripetto/drawings";
|
20 | export * as Forms from "tripetto/forms";
|
21 | export * as Layers from "tripetto/module/ui-layers";
|
22 | export * as Layouts from "tripetto/layouts";
|
23 | export * as SHA2 from "tripetto/module/sha2";
|
24 | export * as Slots from "tripetto/module/slots";
|
25 | export * as Touch from "tripetto/touch";
|
26 | export * as Markdown from "tripetto/module/markdown";
|
27 |
|
28 | export { Application } from "tripetto/module/dom";
|
29 | export { Await, Callback } from "tripetto/module/callback";
|
30 | export { Rectangles, Coordinate, Dimensions, Spacing } from "tripetto/module/metrics";
|
31 | export {
|
32 | Namespaces,
|
33 | Branch,
|
34 | Branches,
|
35 | Cluster,
|
36 | Clusters,
|
37 | Condition,
|
38 | Conditions,
|
39 | IConditionBlock,
|
40 | IDefinition,
|
41 | INamespace,
|
42 | INodeBlock,
|
43 | IVariable,
|
44 | Node,
|
45 | detectChange,
|
46 | mountNamespace,
|
47 | unmountNamespace,
|
48 | lookupVariable,
|
49 | } from "tripetto/module/map";
|
50 | export { L10n, pgettext, npgettext, _, _n } from "tripetto/l10n";
|
51 | export { TGridRectangles } from "tripetto/module/grid";
|
52 | export { Renderer as LayerRenderer, Layout as LayerLayout } from "tripetto/module/ui-grid2layer";
|
53 | export { MoveableLayout } from "tripetto/helpers/layout";
|
54 | export { ConditionBlock, NodeBlock } from "tripetto/helpers/blocks";
|
55 | export { ISlotIdentifier, populateSlots } from "tripetto/helpers/slots/populate";
|
56 | export { insertVariable, slotInsertAction, getSlotIcon } from "tripetto/helpers/variables/insert";
|
57 | export { populateVariables } from "tripetto/helpers/variables/populate";
|
58 | export { isVariable } from "tripetto/helpers/variables/verify";
|
59 | export { getMetadata } from "tripetto/helpers/decorators/metadata";
|
60 | export { markdownifyToString, makeMarkdownSafe } from "tripetto/helpers/markdown";
|
61 | export { Fonts } from "tripetto/helpers/fonts";
|
62 | export { linearicon, linearicons, style as lineariconStyle } from "tripetto/styles/linearicons";
|
63 | export { SVGImage } from "tripetto/helpers/svg";
|
64 | export { REGEX_IS_URL } from "tripetto/helpers/regex/url";
|
65 | export { getHelpTopic } from "tripetto/help";
|
66 |
|
67 | export { EditorOrchestrator as EditorOrchestratorNodeBlock } from "tripetto/templates";
|
68 | export { EditorOrchestrator } from "tripetto/components/controller/editor/orchestrator";
|
69 | export { Slots as SlotsOrchestrator } from "tripetto/module/slots";
|
70 | export { ConditionsOrchestrator } from "tripetto/helpers/conditions/orchestrator";
|
71 |
|
72 | export { affects } from "tripetto/helpers/decorators/affects";
|
73 | export { assigned, definition, destroyed, detached, slots, unassigned, upgraded } from "tripetto/module/map";
|
74 | export { conditions } from "tripetto/helpers/blocks/conditions/decorator";
|
75 | export { created } from "tripetto/helpers/decorators/created";
|
76 | export { collection } from "tripetto/helpers/decorators/collection";
|
77 | export { deleted } from "tripetto/helpers/collection/decorators/deleted";
|
78 | export { editor } from "tripetto/helpers/decorators/editor";
|
79 | export { supplies } from "tripetto/helpers/decorators/supplies";
|
80 | export { metadata } from "tripetto/helpers/decorators/metadata";
|
81 | export { name } from "tripetto/helpers/collection/decorators/name";
|
82 | export { icon } from "tripetto/helpers/collection/decorators/icon";
|
83 | export { alias } from "tripetto/helpers/collection/decorators/alias";
|
84 | export { score } from "tripetto/helpers/collection/decorators/score";
|
85 | export { title } from "tripetto/helpers/collection/decorators/title";
|
86 | export { menu } from "tripetto/helpers/collection/decorators/menu";
|
87 | export { width } from "tripetto/helpers/collection/decorators/width";
|
88 | export { refreshed } from "tripetto/helpers/collection/decorators/refreshed";
|
89 | export { renamed } from "tripetto/helpers/decorators/renamed";
|
90 | export { reordered } from "tripetto/helpers/collection/decorators/reordered";
|
91 | export { tripetto } from "tripetto/helpers/blocks";
|
92 |
|
93 | export * from "tripetto/builder";
|
94 | export {
|
95 | IBuilderChangeEvent,
|
96 | IBuilderCloseEvent,
|
97 | IBuilderEditEvent,
|
98 | IBuilderErrorEvent,
|
99 | IBuilderLoadEvent,
|
100 | IBuilderOpenEvent,
|
101 | IBuilderPreviewEvent,
|
102 | IBuilderReadyEvent,
|
103 | IBuilderRenameEvent,
|
104 | IBuilderSaveEvent,
|
105 | TBuilderEditData,
|
106 | TBuilderEditEpilogue,
|
107 | TBuilderEditTypes,
|
108 | } from "tripetto/events";
|
109 | export { IBuilderProperties } from "tripetto/properties";
|
110 | export { IBuilderStyle } from "tripetto/styles/builder";
|
111 | export { ITier as IBuilderTier } from "tripetto/tier";
|
112 | export { DEFAULT } from "tripetto/skins/default";
|
113 |
|
114 | }
|
115 |
|
116 | declare module "tripetto/helpers/collection" {
|
117 |
|
118 | import { Collection } from "tripetto/helpers/collection/collection";
|
119 | import { CollectionItem, ICollectionItemConstructor } from "tripetto/helpers/collection/item";
|
120 | import { ConditionBlock, NodeBlock } from "tripetto/helpers/blocks";
|
121 | import { Slot } from "tripetto/module/slots";
|
122 | import { IVariable } from "tripetto/module/map";
|
123 | import { ISlotIdentifier } from "tripetto/helpers/slots/populate";
|
124 |
|
125 | export { Collection as Provider } from "tripetto/helpers/collection/collection";
|
126 | export { CollectionItem as Item, ICollectionItem as IItem } from "tripetto/helpers/collection/item";
|
127 | export {
|
128 | IItemAddEvent,
|
129 | IItemDeleteEvent,
|
130 | IItemIndexEvent,
|
131 | IItemRenameEvent,
|
132 | IItemCloseEvent,
|
133 | IItemIconEvent,
|
134 | IItemOpenEvent,
|
135 | } from "tripetto/helpers/collection/events";
|
136 | export { ICollectionProperties as IProperties } from "tripetto/components/controller/collection/properties";
|
137 | export { CollectionCard as Card } from "tripetto/components/controller/collection/card";
|
138 | export interface ICollectionSupply<T extends NodeBlock, C extends Collection<CollectionItem, {}>> {
|
139 |
|
140 | readonly name: keyof T;
|
141 |
|
142 | readonly collection: C;
|
143 | |
144 |
|
145 |
|
146 |
|
147 | readonly origin: boolean;
|
148 | |
149 |
|
150 |
|
151 |
|
152 |
|
153 |
|
154 |
|
155 |
|
156 |
|
157 | readonly sole: boolean;
|
158 | }
|
159 | |
160 |
|
161 |
|
162 |
|
163 |
|
164 |
|
165 | export function of<T extends CollectionItem<Reference>, Reference>(
|
166 | pConstructor: ICollectionItemConstructor<T, Reference>,
|
167 | pReference:
|
168 | | (Reference & {
|
169 | readonly block?: NodeBlock | ConditionBlock;
|
170 | })
|
171 | | {
|
172 | readonly ref: Reference;
|
173 | },
|
174 | bRoot?: boolean
|
175 | ): Collection<T, Reference>;
|
176 | |
177 |
|
178 |
|
179 |
|
180 |
|
181 | export function get<T extends NodeBlock, C extends Collection<CollectionItem, {}>>(pBlock: T, sCollection: string): C | undefined;
|
182 | |
183 |
|
184 |
|
185 |
|
186 | export function find<T extends NodeBlock, C extends Collection<CollectionItem, {}>>(
|
187 | pSlot: ISlotIdentifier
|
188 | ): ICollectionSupply<T, C> | undefined;
|
189 | |
190 |
|
191 |
|
192 |
|
193 |
|
194 | export function find<T extends NodeBlock, C extends Collection<CollectionItem, {}>>(
|
195 | pSlot: Slot,
|
196 | pBlock: T
|
197 | ): ICollectionSupply<T, C> | undefined;
|
198 | |
199 |
|
200 |
|
201 |
|
202 | export function find<T extends NodeBlock, C extends Collection<CollectionItem, {}>>(
|
203 | pVariable: IVariable
|
204 | ): ICollectionSupply<T, C> | undefined;
|
205 | }
|
206 |
|
207 | declare module "tripetto/components" {
|
208 | export * from "tripetto/module/ui-cards";
|
209 | export * from "tripetto/components/controller/controller";
|
210 | export * from "tripetto/components/l10n";
|
211 | export * from "tripetto/module/ui-list";
|
212 | export * from "tripetto/components/loader";
|
213 | export * from "tripetto/helpers/menu";
|
214 | export * from "tripetto/module/ui-scrollbars";
|
215 | export * from "tripetto/components/styles";
|
216 | export * from "tripetto/module/ui-toolbar";
|
217 | export * from "tripetto/components/tutorial";
|
218 | export * from "tripetto/module/ui-workspace";
|
219 | }
|
220 |
|
221 | declare module "tripetto/drawings" {
|
222 | export { INodeDrawing, IConditionDrawing } from "tripetto/components/map";
|
223 | }
|
224 |
|
225 | declare module "tripetto/forms" {
|
226 | export * from "tripetto/module/ui-form";
|
227 | export * from "tripetto/module/ui-form-button";
|
228 | export * from "tripetto/module/ui-form-checkbox";
|
229 | export * from "tripetto/module/ui-form-date";
|
230 | export * from "tripetto/module/ui-form-dropdown";
|
231 | export * from "tripetto/module/ui-form-email";
|
232 | export * from "tripetto/module/ui-form-html";
|
233 | export * from "tripetto/module/ui-form-notification";
|
234 | export * from "tripetto/module/ui-form-numeric";
|
235 | export * from "tripetto/module/ui-form-radiobutton";
|
236 | export * from "tripetto/module/ui-form-spacer";
|
237 | export * from "tripetto/module/ui-form-static";
|
238 | export * from "tripetto/module/ui-form-text";
|
239 | }
|
240 |
|
241 | declare module "tripetto/layouts" {
|
242 | export {
|
243 | MapLayout as Map,
|
244 | ClusterLayout as Cluster,
|
245 | NodeLayout as Node,
|
246 | BranchLayout as Branch,
|
247 | ConditionLayout as Condition,
|
248 | } from "tripetto/components/map";
|
249 | }
|
250 |
|
251 | declare module "tripetto/touch" {
|
252 | export * from "tripetto/module/touch-tap";
|
253 | export * from "tripetto/module/touch-hover";
|
254 | export * from "tripetto/module/touch-keyboard";
|
255 | }
|
256 |
|
257 | declare module "tripetto/l10n" {
|
258 | import { Namespace } from "tripetto/module/l10n";
|
259 | export const L10n: Namespace;
|
260 | export const npgettext: (sContext: string, sId: string, sPluralId: string, nCount: number, ...pArguments: string[]) => string,
|
261 | pgettext: (sContext: string, sId: string, ...pArguments: string[]) => string,
|
262 | _: (sId: string, ...pArguments: string[]) => string,
|
263 | _n: (sId: string, sPluralId: string, nCount: number, ...pArguments: string[]) => string;
|
264 | export { ILocale, TTranslation } from "tripetto/module/l10n";
|
265 | }
|
266 |
|
267 | declare module "tripetto/helpers/layout" {
|
268 |
|
269 | import { IBuilderStyle } from "tripetto/styles/builder";
|
270 | import { Layout } from "tripetto/module/ui-grid2layer";
|
271 | import { TGrid, TGridResource } from "tripetto/module/grid";
|
272 | export abstract class MoveableLayout<Grid extends TGrid, T extends TGridResource, Style extends IBuilderStyle> extends Layout<
|
273 | Grid,
|
274 | T,
|
275 | Style
|
276 | > {
|
277 | |
278 |
|
279 |
|
280 |
|
281 |
|
282 | moving(bMoving: boolean): boolean;
|
283 | |
284 |
|
285 |
|
286 |
|
287 |
|
288 | following(bFollowing: boolean): boolean;
|
289 | |
290 |
|
291 |
|
292 |
|
293 |
|
294 | ensuing(bEnsuing: boolean): boolean;
|
295 | |
296 |
|
297 |
|
298 |
|
299 | animate<Return>(fnOperation: () => Return): Return;
|
300 | /** Scrolls the element into view. */
|
301 | scrollIntoView(): void;
|
302 | }
|
303 | }
|
304 |
|
305 | declare module "tripetto/helpers/blocks" {
|
306 | /** Exports */
|
307 | export { Blocks } from "tripetto/helpers/blocks/blocks";
|
308 | export { ConditionBlockEx as ConditionBlock } from "tripetto/helpers/blocks/conditions/block";
|
309 | export { conditionTemplatesToMenu } from "tripetto/helpers/blocks/conditions/menu";
|
310 | export { IConditionBlockDecoratorEx as IConditionBlockDecorator } from "tripetto/helpers/blocks/conditions/decorator";
|
311 | export { IConditionBlockType } from "tripetto/helpers/blocks/conditions/type";
|
312 | export { INodeBlockDecoratorEx as INodeBlockDecorator } from "tripetto/helpers/blocks/nodes/decorator";
|
313 | export { INodeBlockType } from "tripetto/helpers/blocks/nodes/type";
|
314 | export { NodeBlockEx as NodeBlock } from "tripetto/helpers/blocks/nodes/block";
|
315 | export { tripetto } from "tripetto/helpers/blocks/decorator";
|
316 | }
|
317 |
|
318 | declare module "tripetto/helpers/slots/populate" {
|
319 | import { Condition, Map, Node } from "tripetto/module/map";
|
320 | import { Slot } from "tripetto/module/slots";
|
321 | import { ConditionBlock, INodeBlockType, NodeBlock } from "tripetto/helpers/blocks";
|
322 | import { SVGImage } from "tripetto/helpers/svg";
|
323 | export interface ISlotIdentifier {
|
324 | /** Type of the identifier. */
|
325 | readonly type: "slot" | "pipe" | "group";
|
326 | /** Reference to the parent block that holds the slot. */
|
327 | readonly block: NodeBlock;
|
328 | /** Label for the slot. */
|
329 | readonly label: string;
|
330 | /** Icon for the slot. */
|
331 | readonly icon?: SVGImage | string;
|
332 | /** Identifier of the slot. */
|
333 | readonly id?: string;
|
334 | /** Reference of the slot. */
|
335 | readonly reference?: string;
|
336 | /** Reference to the slot instance. */
|
337 | readonly slot?: Slot;
|
338 | /**
|
339 | * Collection of slot identifiers used to when a slot identifier denotes
|
340 | * a group of slots (`type` is set to `group`).
|
341 | */
|
342 | readonly slots?: ISlotIdentifier[];
|
343 | }
|
344 | /**
|
345 | * Populates a collection of slots in the map.
|
346 | * @param pSource Reference to the source.
|
347 | * @param pFilter Specifies filters for the function. The following filters
|
348 | * are available:
|
349 | * - `mode`: Supply `all` to use all slots in the map, `validated` to return
|
350 | * only the slots that could be available for the target node (basically these
|
351 | * are all the slots prepending the supplied node), `self` to return all validated
|
352 | * slots and the slots of the supplied node or `exclude` to return all
|
353 | * slots excluding the slots of the supplied node (defaults to `all`);
|
354 | * - `pipes`: Specifies if pipes need to be populated. Can be `include` to
|
355 | * include pipes (this will exclude all the slots that are consumed by the pipe),
|
356 | * `include-consumed-slots` will include pipes and all the slots that are consumed
|
357 | * by the pipe, `exclude` will ignore pipes, `exclude-consumed-slots` will ignore
|
358 | * pipes and the slots that are consumed by the pipe and `only` will only
|
359 | * include pipes and no other slots (defaults to `include`);
|
360 | * - `blocks`: Specifies block identifiers or types to filter on;
|
361 | * - `references`: Specifies slot references to filter on;
|
362 | * - `include`: Specifies slot identifiers to include;
|
363 | * - `exclude`: Specifies slot identifiers to exclude.
|
364 | * @return Returns an array with slots or `undefined` if there are none.
|
365 | */
|
366 | export function populateSlots(
|
367 | pSource: Node | NodeBlock | Condition | ConditionBlock | Map,
|
368 | pFilter?: {
|
369 | readonly mode?: "all" | "validated" | "self" | "exclude";
|
370 | readonly pipes?: "include" | "include-consumed-slots" | "exclude" | "exclude-consumed-slots" | "only";
|
371 | readonly blocks?: (string | INodeBlockType)[];
|
372 | readonly references?: string[];
|
373 | readonly include?: string[];
|
374 | readonly exclude?: string[];
|
375 | }
|
376 | ): ISlotIdentifier[] | undefined;
|
377 | }
|
378 |
|
379 | declare module "tripetto/helpers/variables/insert" {
|
380 | /** Dependencies */
|
381 | import { Element } from "tripetto/module/dom";
|
382 | import * as Slots from "tripetto/module/slots";
|
383 | import { MenuOption } from "tripetto/module/ui-menu";
|
384 | import { Condition, Map, Node } from "tripetto/module/map";
|
385 | import { ConditionBlock, NodeBlock } from "tripetto/helpers/blocks";
|
386 | import { CollectionItem } from "tripetto/helpers/collection/item";
|
387 | export function getSlotIcon(pSlot: Slots.Slot): number;
|
388 | /**
|
389 | * Variable insert action function. Can be used to enable the variable insert
|
390 | * action on text input controls.
|
391 | * @param pParent Specifies the parent node, condition or map.
|
392 | * @param sMode Supply `all` to use all slots in the map, `validated` to return
|
393 | * only the slots that could be available for the target node (basically these
|
394 | * are all the slots prepending the supplied node) or `exclude` to return all
|
395 | * slots excluding the slots of the supplied node.
|
396 | * @param fnModifier Function to modify the menu options generated by the action.
|
397 | * @return Returns the action function.
|
398 | */
|
399 | export const insertVariable: (
|
400 | pParent: Node | NodeBlock | Condition | ConditionBlock | Map | CollectionItem,
|
401 | sMode?: "all" | "validated" | "exclude" | undefined,
|
402 | fnModifier?: ((options: MenuOption[], fnDone: (sText?: string | undefined) => void) => MenuOption[]) | undefined
|
403 | ) => (
|
404 | fnDone: (sText?: string | undefined) => void,
|
405 | pElement: Element
|
406 | ) => ((sKey: string) => "cancel" | "capture" | "continue") | undefined;
|
407 | /** Legacy export. */
|
408 | export const slotInsertAction: (
|
409 | pParent: Node | NodeBlock | Condition | ConditionBlock | Map | CollectionItem,
|
410 | sMode?: "all" | "validated" | "exclude" | undefined,
|
411 | fnModifier?: ((options: MenuOption[], fnDone: (sText?: string | undefined) => void) => MenuOption[]) | undefined
|
412 | ) => (
|
413 | fnDone: (sText?: string | undefined) => void,
|
414 | pElement: Element
|
415 | ) => ((sKey: string) => "cancel" | "capture" | "continue") | undefined;
|
416 | }
|
417 |
|
418 | declare module "tripetto/helpers/variables/populate" {
|
419 | import { IDropdownOption } from "tripetto/module/ui-form-dropdown";
|
420 | import { Condition, Node } from "tripetto/module/map";
|
421 | import { Slot } from "tripetto/module/slots";
|
422 | import { ConditionBlock, NodeBlock } from "tripetto/helpers/blocks";
|
423 | /**
|
424 | * Populates a list of variables for use in dropdown controls.
|
425 | * @param pSource Reference to the source.
|
426 | * @param fnFilter Optional filter function that is invoked for each slot found.
|
427 | * @param sValue Specifies an optional value of the control that will use the
|
428 | * variables list. This will assure that the referenced variable in that value
|
429 | * will be included in the list.
|
430 | * @param bIncludeSelf Specifies if slots of the source should be included or not.
|
431 | * @param pExcludes Specifies the slot identifiers of slots that should be ignored.
|
432 | * @return Returns an array with dropdown options.
|
433 | */
|
434 | export function populateVariables(
|
435 | pSource: Node | NodeBlock | Condition | ConditionBlock,
|
436 | fnFilter?: (slot: Slot, pipe: boolean) => boolean,
|
437 | sValue?: string,
|
438 | bIncludeSelf?: boolean,
|
439 | ...pExcludes: (string | undefined)[]
|
440 | ): IDropdownOption<string>[];
|
441 | }
|
442 |
|
443 | declare module "tripetto/helpers/variables/verify" {
|
444 | /**
|
445 | * Verifies if the supplied input is a possible variable.
|
446 | * @param sInput Specifies the input to verify.
|
447 | * @return Returns `true` if the input could be a variable.
|
448 | */
|
449 | export function isVariable(sInput: string | undefined): sInput is string;
|
450 | }
|
451 |
|
452 | declare module "tripetto/helpers/decorators/metadata" {
|
453 | /** Dependencies */
|
454 | import { NodeBlock } from "tripetto/helpers/blocks";
|
455 | /**
|
456 | * Marks a property as metadata supply for the specified reference.
|
457 | * @param sReference Specifies the metadata reference.
|
458 | */
|
459 | export function metadata<T extends NodeBlock>(sReference: string): (pTarget: T, sProperty: string) => void;
|
460 | |
461 |
|
462 |
|
463 |
|
464 |
|
465 | export function getMetadata<D extends {}>(pBlock: NodeBlock, sReference: string): D | undefined;
|
466 | }
|
467 |
|
468 | declare module "tripetto/helpers/markdown" {
|
469 |
|
470 | import { MarkdownFeatures } from "tripetto/module/markdown";
|
471 | |
472 |
|
473 |
|
474 |
|
475 |
|
476 |
|
477 |
|
478 | export function markdownifyToString(sMarkdown: string, nFeatures?: MarkdownFeatures, sPlaceholder?: string): string;
|
479 | |
480 |
|
481 |
|
482 |
|
483 |
|
484 |
|
485 | export function makeMarkdownSafe(sInput: string, nFeatures?: MarkdownFeatures): string;
|
486 | }
|
487 |
|
488 | declare module "tripetto/helpers/fonts" {
|
489 | export class Fonts {
|
490 |
|
491 | static get isReady(): boolean;
|
492 |
|
493 | static get isError(): boolean;
|
494 | |
495 |
|
496 |
|
497 |
|
498 |
|
499 |
|
500 | static load(sFamilies: string[], fnDone: (bSucceeded: boolean) => void): true;
|
501 | }
|
502 | }
|
503 |
|
504 | declare module "tripetto/styles/linearicons" {
|
505 |
|
506 | import { Element, IStyles, Stylesheet } from "tripetto/module/dom";
|
507 |
|
508 | export const STYLE: IStyles;
|
509 | |
510 |
|
511 |
|
512 |
|
513 |
|
514 |
|
515 | export function linearicons(sURI: string, pStylesheet?: Stylesheet): string;
|
516 | |
517 |
|
518 |
|
519 |
|
520 |
|
521 |
|
522 |
|
523 | export function linearicon(nCode: number, pElement?: Element, bAsText?: boolean): string;
|
524 | |
525 |
|
526 |
|
527 |
|
528 |
|
529 |
|
530 | export function style(nCode: number, pStyle?: IStyles): IStyles;
|
531 | }
|
532 |
|
533 | declare module "tripetto/helpers/svg" {
|
534 |
|
535 | import SVG from "*.svg";
|
536 |
|
537 | export type SVGImage = typeof SVG;
|
538 |
|
539 | export { SVGLine } from "tripetto/helpers/svg/line";
|
540 | export { SVGColorizePath } from "tripetto/helpers/svg/colorize";
|
541 | }
|
542 |
|
543 | declare module "tripetto/helpers/regex/url" {
|
544 | export const REGEX_IS_URL: RegExp;
|
545 | }
|
546 |
|
547 | declare module "tripetto/help" {
|
548 | export interface IHelpTopics {
|
549 | [topic: string]: string | undefined;
|
550 | }
|
551 | |
552 |
|
553 |
|
554 |
|
555 |
|
556 | export function setHelpTopics(ref: IHelpTopics): IHelpTopics;
|
557 | |
558 |
|
559 |
|
560 |
|
561 |
|
562 | export function getHelpTopic(topic: string): string | undefined;
|
563 | }
|
564 |
|
565 | declare module "tripetto/templates" {
|
566 |
|
567 | import { EditorOrchestrator as EditorOrchestratorBase } from "tripetto/components/controller/editor/orchestrator";
|
568 | import { Feature } from "tripetto/module/ui-cards";
|
569 | import { Control, Group } from "tripetto/module/ui-form";
|
570 | import { IScoresFeature } from "tripetto/templates/scores/scores";
|
571 | import { INumericFeature } from "tripetto/templates/numeric/numeric";
|
572 | import { Transformations } from "tripetto/module/slots";
|
573 | export type CallableRef<T> = T | (() => T);
|
574 | export class EditorOrchestrator<Reference> extends EditorOrchestratorBase<Reference> {
|
575 | /** Retrieves the group templates. */
|
576 | readonly groups: {
|
577 | /** Group for general features. */
|
578 | general: () => Feature<import("tripetto/module/ui-cards").Card<import("tripetto/module/hookup").THooks>>;
|
579 |
|
580 | settings: () => Feature<import("tripetto/module/ui-cards").Card<import("tripetto/module/hookup").THooks>>;
|
581 |
|
582 | options: () => Feature<import("tripetto/module/ui-cards").Card<import("tripetto/module/hookup").THooks>>;
|
583 | };
|
584 | |
585 |
|
586 |
|
587 |
|
588 |
|
589 | alias(
|
590 | pAlias: CallableRef<{
|
591 | alias?: string;
|
592 | }>
|
593 | ): Feature;
|
594 | |
595 |
|
596 |
|
597 |
|
598 |
|
599 |
|
600 |
|
601 |
|
602 |
|
603 |
|
604 | description(bLocked?: boolean, sLabel?: string, bSupportVariables?: boolean | "validated" | "exclude"): Feature;
|
605 |
|
606 | explanation(): Feature;
|
607 | |
608 |
|
609 |
|
610 |
|
611 |
|
612 |
|
613 |
|
614 |
|
615 |
|
616 |
|
617 |
|
618 | name(bToggle?: boolean, bMultiline?: boolean, sLabel?: string, bSupportVariables?: boolean | "validated" | "exclude"): Feature;
|
619 | |
620 |
|
621 |
|
622 |
|
623 | placeholder(...pCustomPlaceholders: (Control | Group)[]): Feature;
|
624 | |
625 |
|
626 |
|
627 |
|
628 |
|
629 |
|
630 | required(
|
631 | pRequired: CallableRef<{
|
632 | required?: boolean;
|
633 | }>,
|
634 | sLabel?: string,
|
635 | onChange?: (bRequired: boolean) => void
|
636 | ): Feature;
|
637 | |
638 |
|
639 |
|
640 |
|
641 |
|
642 |
|
643 | exportable<T extends {}>(
|
644 | pExportable:
|
645 | | CallableRef<{
|
646 | exportable?: boolean;
|
647 | }>
|
648 | | {
|
649 | ref: T;
|
650 | props: {
|
651 | name: keyof T;
|
652 | label: string;
|
653 | }[];
|
654 | },
|
655 | bIncludedByDefault?: boolean,
|
656 | sLabel?: string
|
657 | ): Feature;
|
658 | |
659 |
|
660 |
|
661 |
|
662 | transformations(
|
663 | pTransformation: CallableRef<{
|
664 | transformation?: Transformations;
|
665 | }>
|
666 | ): Feature;
|
667 |
|
668 | visibility(): Feature;
|
669 |
|
670 | scores(pProperties: IScoresFeature): Feature;
|
671 |
|
672 | numeric(pProperties: INumericFeature): Feature;
|
673 | }
|
674 | }
|
675 |
|
676 | declare module "tripetto/components/controller/editor/orchestrator" {
|
677 |
|
678 | import { Cards, Feature, Features } from "tripetto/module/ui-cards";
|
679 | import { CollectionCard } from "tripetto/components/controller/collection/card";
|
680 | import { CollectionItem } from "tripetto/helpers/collection/item";
|
681 | import { Form, IFormProperties } from "tripetto/module/ui-form";
|
682 | import { ICollectionProperties } from "tripetto/components/controller/collection/properties";
|
683 | export class EditorOrchestrator<Reference> {
|
684 |
|
685 | readonly reference: Reference;
|
686 | constructor(pCards: Cards, pReference: Reference, fnClose: () => void);
|
687 | /** Retrieves a reference to the features. */
|
688 | get features(): Features;
|
689 | /** Retrieves the close handler which closes the panel. */
|
690 | get close(): () => boolean;
|
691 | /**
|
692 | * Adds a form.
|
693 | * @param pProperties Specifies the form properties.
|
694 | * @return Returns a reference to the form.
|
695 | */
|
696 | form(pProperties: IFormProperties): Form;
|
697 | /**
|
698 | * Adds a collection.
|
699 | * @param pProperties Specifies the collection properties.
|
700 | * @return Returns a reference to the collection.
|
701 | */
|
702 | collection<T extends CollectionItem<R>, R>(pProperties: ICollectionProperties<T, R>): CollectionCard<T, R>;
|
703 | /**
|
704 | * Adds an option feature with a form or card.
|
705 | * @param pProperties Specifies the option properties.
|
706 | * @return Returns a reference to the feature.
|
707 | */
|
708 | option<T extends CollectionItem<R>, R>(
|
709 | pProperties: {
|
710 |
|
711 | name: string;
|
712 |
|
713 | activated?: boolean;
|
714 |
|
715 | visible?: boolean;
|
716 |
|
717 | disabled?: boolean;
|
718 |
|
719 | locked?: boolean;
|
720 | } & (
|
721 | | {
|
722 | /** Form properties. */
|
723 | form?: IFormProperties;
|
724 | /** Specifies a function that is invoked when the option is toggled. */
|
725 | on?: (feature: Feature<Form>) => void;
|
726 | /** Specifies a function that is invoked when the option is shown or hidden. */
|
727 | onVisible?: (feature: Feature<Form>) => void;
|
728 | /** Specifies a function that is invoked when the option is disabled or enabled. */
|
729 | onDisable?: (feature: Feature<Form>) => void;
|
730 | /** Specifies a function that is invoked when the option is locked or unlocked. */
|
731 | onLock?: (feature: Feature<Form>) => void;
|
732 | }
|
733 | | {
|
734 | /** Collection properties. */
|
735 | collection?: ICollectionProperties<T, R>;
|
736 | /** Specifies a function that is invoked when the option is toggled. */
|
737 | on?: (feature: Feature) => void;
|
738 | /** Specifies a function that is invoked when the option is shown or hidden. */
|
739 | onVisible?: (feature: Feature) => void;
|
740 | /** Specifies a function that is invoked when the option is disabled or enabled. */
|
741 | onDisable?: (feature: Feature) => void;
|
742 | /** Specifies a function that is invoked when the option is locked or unlocked. */
|
743 | onLock?: (feature: Feature) => void;
|
744 | }
|
745 | )
|
746 | ): Feature;
|
747 | /**
|
748 | * Adds a group label.
|
749 | * @param sLabel Specifies the label.
|
750 | */
|
751 | group(sLabel: string): Feature;
|
752 | }
|
753 | }
|
754 |
|
755 | declare module "tripetto/helpers/conditions/orchestrator" {
|
756 |
|
757 | import { Condition, ConditionBlock, Node } from "tripetto/module/map";
|
758 | import { IConditionGroup, IConditionTemplate } from "tripetto/helpers/conditions/interface";
|
759 | import { ITemplateProperties } from "tripetto/helpers/conditions/properties";
|
760 | export class ConditionsOrchestrator {
|
761 | |
762 |
|
763 |
|
764 |
|
765 | static create(pNode: Node): ConditionsOrchestrator;
|
766 |
|
767 | get templates(): (IConditionTemplate | IConditionGroup)[];
|
768 | |
769 |
|
770 |
|
771 |
|
772 |
|
773 | template<T extends ConditionBlock>(pProperties: ITemplateProperties<T>): this;
|
774 | |
775 |
|
776 |
|
777 |
|
778 |
|
779 |
|
780 |
|
781 |
|
782 | custom(sLabel: string, fnCommand: (pCondition: Condition) => void, sIcon?: string, bMarkdown?: boolean): this;
|
783 | |
784 |
|
785 |
|
786 |
|
787 |
|
788 |
|
789 |
|
790 |
|
791 | group(sLabel: string, sIcon?: string, bMarkdown?: boolean, bSeparator?: boolean): ConditionsOrchestrator;
|
792 | }
|
793 | }
|
794 |
|
795 | declare module "tripetto/helpers/decorators/affects" {
|
796 | import { ConditionBlock, NodeBlock } from "tripetto/helpers/blocks";
|
797 | import { CollectionItem } from "tripetto/helpers/collection/item";
|
798 |
|
799 | export function affects<T extends NodeBlock | ConditionBlock | CollectionItem>(
|
800 | sTarget: "#name" | "#icon"
|
801 | ): (pTarget: T, sProperty: string, pDescriptor?: PropertyDescriptor) => void;
|
802 |
|
803 | export function affects<T extends NodeBlock | ConditionBlock>(
|
804 | sTarget: "#label"
|
805 | ): (pTarget: T, sProperty: string, pDescriptor?: PropertyDescriptor) => void;
|
806 |
|
807 | export function affects<T extends ConditionBlock>(
|
808 | sTarget: "#condition"
|
809 | ): (pTarget: T, sProperty: string, pDescriptor?: PropertyDescriptor) => void;
|
810 |
|
811 | export function affects<T extends NodeBlock>(
|
812 | sTarget: "#slots" | "#required"
|
813 | ): (pTarget: T, sProperty: string, pDescriptor?: PropertyDescriptor) => void;
|
814 | |
815 |
|
816 |
|
817 | export function affects<T>(
|
818 | sTarget: "#collection",
|
819 | sCollection: keyof T
|
820 | ): (pTarget: T, sProperty: string, pDescriptor?: PropertyDescriptor) => void;
|
821 |
|
822 | export function affects<T extends CollectionItem<Reference>, Reference>(
|
823 | sTarget: "#refresh"
|
824 | ): (pTarget: T, sProperty: string, pDescriptor?: PropertyDescriptor) => void;
|
825 | }
|
826 |
|
827 | declare module "tripetto/helpers/blocks/conditions/decorator" {
|
828 | import { IConditionBlockDecorator } from "tripetto/module/map";
|
829 | import { NodeBlock } from "tripetto/helpers/blocks";
|
830 | import { SVGImage } from "tripetto/helpers/svg";
|
831 | export interface IConditionBlockDecoratorEx extends IConditionBlockDecorator {
|
832 |
|
833 | readonly icon: SVGImage | string;
|
834 |
|
835 | readonly autoOpen?: boolean;
|
836 | }
|
837 | |
838 |
|
839 |
|
840 |
|
841 |
|
842 |
|
843 |
|
844 | export function conditions<T extends NodeBlock>(pTarget: T, sMethod: keyof T, pDescriptor?: PropertyDescriptor): void;
|
845 | }
|
846 |
|
847 | declare module "tripetto/helpers/decorators/created" {
|
848 |
|
849 | import { ConditionBlock } from "tripetto/helpers/blocks";
|
850 | import { CollectionItem } from "tripetto/helpers/collection/item";
|
851 | import { NodeBlock } from "tripetto/helpers/blocks";
|
852 | |
853 |
|
854 |
|
855 |
|
856 |
|
857 | export function created<T extends NodeBlock | ConditionBlock | CollectionItem>(
|
858 | pTarget: T,
|
859 | sFunction: keyof T,
|
860 | pDescriptor?: PropertyDescriptor
|
861 | ): void;
|
862 | }
|
863 |
|
864 | declare module "tripetto/helpers/decorators/collection" {
|
865 | import { ConditionBlock } from "tripetto/helpers/blocks";
|
866 | |
867 |
|
868 |
|
869 |
|
870 |
|
871 |
|
872 |
|
873 |
|
874 |
|
875 |
|
876 | export function collection<T extends ConditionBlock>(
|
877 | sCollection: string,
|
878 | sMode?: "r" | "w" | "rw"
|
879 | ): (pTarget: T, sProperty: string) => void;
|
880 | }
|
881 |
|
882 | declare module "tripetto/helpers/collection/decorators/deleted" {
|
883 | import { CollectionItem } from "tripetto/helpers/collection/item";
|
884 | |
885 |
|
886 |
|
887 |
|
888 | export function deleted<T extends CollectionItem<Reference>, Reference>(
|
889 | pTarget: T,
|
890 | sMethod: keyof T,
|
891 | pDescriptor?: PropertyDescriptor
|
892 | ): void;
|
893 | }
|
894 |
|
895 | declare module "tripetto/helpers/decorators/editor" {
|
896 |
|
897 | import { ConditionBlock, NodeBlock } from "tripetto/helpers/blocks";
|
898 | import { CollectionItem } from "tripetto/helpers/collection/item";
|
899 | |
900 |
|
901 |
|
902 |
|
903 |
|
904 |
|
905 | export function editor<T extends NodeBlock | ConditionBlock | CollectionItem>(
|
906 | pTarget: T,
|
907 | sFunction: keyof T,
|
908 | pDescriptor?: PropertyDescriptor
|
909 | ): void;
|
910 | }
|
911 |
|
912 | declare module "tripetto/helpers/decorators/supplies" {
|
913 |
|
914 | import { NodeBlock } from "tripetto/helpers/blocks";
|
915 | export interface ISupply<T extends NodeBlock> {
|
916 | readonly collection: keyof T;
|
917 | readonly type: "slot" | "collection";
|
918 | readonly reference: string;
|
919 | readonly isSole: (pRef: T) => boolean;
|
920 | readonly isAvailable: (pRef: T) => boolean;
|
921 | }
|
922 | |
923 |
|
924 |
|
925 |
|
926 |
|
927 |
|
928 |
|
929 |
|
930 |
|
931 |
|
932 |
|
933 |
|
934 |
|
935 |
|
936 | export function supplies<T extends NodeBlock>(
|
937 | sType: "#slot",
|
938 | sReference: string,
|
939 | bSole?: boolean | keyof T,
|
940 | sCondition?: keyof T
|
941 | ): (pTarget: T, sProperty: keyof T) => void;
|
942 | |
943 |
|
944 |
|
945 |
|
946 |
|
947 |
|
948 |
|
949 |
|
950 |
|
951 |
|
952 |
|
953 |
|
954 |
|
955 |
|
956 | export function supplies<T extends NodeBlock>(
|
957 | sType: "#collection",
|
958 | sCollection: keyof T,
|
959 | bSole?: boolean | keyof T,
|
960 | sCondition?: keyof T
|
961 | ): (pTarget: T, sProperty: keyof T) => void;
|
962 | |
963 |
|
964 |
|
965 |
|
966 |
|
967 |
|
968 | export function findSupply<T extends NodeBlock>(pBlock: T, sType: "slot" | "collection", sReference: string): ISupply<T> | undefined;
|
969 | }
|
970 |
|
971 | declare module "tripetto/helpers/collection/decorators/name" {
|
972 |
|
973 | import { CollectionItem } from "tripetto/helpers/collection/item";
|
974 | |
975 |
|
976 |
|
977 |
|
978 |
|
979 |
|
980 | export function name<T extends CollectionItem<Reference>, Reference>(
|
981 | pTarget: T,
|
982 | sProperty: keyof T,
|
983 | pDescriptor?: PropertyDescriptor
|
984 | ): void;
|
985 | }
|
986 |
|
987 | declare module "tripetto/helpers/collection/decorators/icon" {
|
988 |
|
989 | import { CollectionItem } from "tripetto/helpers/collection/item";
|
990 | |
991 |
|
992 |
|
993 |
|
994 |
|
995 |
|
996 | export function icon<T extends CollectionItem<Reference>, Reference>(
|
997 | pTarget: T,
|
998 | sProperty: keyof T,
|
999 | pDescriptor?: PropertyDescriptor
|
1000 | ): void;
|
1001 | }
|
1002 |
|
1003 | declare module "tripetto/helpers/collection/decorators/alias" {
|
1004 |
|
1005 | import { CollectionItem } from "tripetto/helpers/collection/item";
|
1006 | |
1007 |
|
1008 |
|
1009 |
|
1010 |
|
1011 |
|
1012 | export function alias<T extends CollectionItem<Reference>, Reference>(
|
1013 | pTarget: T,
|
1014 | sProperty: keyof T,
|
1015 | pDescriptor?: PropertyDescriptor
|
1016 | ): void;
|
1017 | }
|
1018 |
|
1019 | declare module "tripetto/helpers/collection/decorators/score" {
|
1020 |
|
1021 | import { CollectionItem } from "tripetto/helpers/collection/item";
|
1022 | |
1023 |
|
1024 |
|
1025 |
|
1026 |
|
1027 |
|
1028 | export function score<T extends CollectionItem<Reference>, Reference>(
|
1029 | pTarget: T,
|
1030 | sProperty: keyof T,
|
1031 | pDescriptor?: PropertyDescriptor
|
1032 | ): void;
|
1033 | }
|
1034 |
|
1035 | declare module "tripetto/helpers/collection/decorators/title" {
|
1036 |
|
1037 | import { CollectionItem } from "tripetto/helpers/collection/item";
|
1038 | |
1039 |
|
1040 |
|
1041 |
|
1042 |
|
1043 |
|
1044 | export function title<T extends CollectionItem<Reference>, Reference>(pTarget: T, sProperty: keyof T): void;
|
1045 | }
|
1046 |
|
1047 | declare module "tripetto/helpers/collection/decorators/menu" {
|
1048 |
|
1049 | import { CollectionItem } from "tripetto/helpers/collection/item";
|
1050 | |
1051 |
|
1052 |
|
1053 |
|
1054 |
|
1055 |
|
1056 | export function menu<T extends CollectionItem<Reference>, Reference>(pTarget: T, sProperty: keyof T): void;
|
1057 | }
|
1058 |
|
1059 | declare module "tripetto/helpers/collection/decorators/width" {
|
1060 |
|
1061 | import { CollectionItem } from "tripetto/helpers/collection/item";
|
1062 | |
1063 |
|
1064 |
|
1065 |
|
1066 |
|
1067 |
|
1068 | export function width<T extends CollectionItem<Reference>, Reference>(pTarget: T, sProperty: keyof T): void;
|
1069 | }
|
1070 |
|
1071 | declare module "tripetto/helpers/collection/decorators/refreshed" {
|
1072 | import { CollectionItem } from "tripetto/helpers/collection/item";
|
1073 | |
1074 |
|
1075 |
|
1076 | export function refreshed<T extends CollectionItem<Reference>, Reference>(
|
1077 | pTarget: T,
|
1078 | sMethod: keyof T,
|
1079 | pDescriptor?: PropertyDescriptor
|
1080 | ): void;
|
1081 | }
|
1082 |
|
1083 | declare module "tripetto/helpers/decorators/renamed" {
|
1084 |
|
1085 | import { ConditionBlock, NodeBlock } from "tripetto/helpers/blocks";
|
1086 | import { CollectionItem } from "tripetto/helpers/collection/item";
|
1087 | |
1088 |
|
1089 |
|
1090 |
|
1091 | export function renamed<T extends NodeBlock | ConditionBlock | CollectionItem>(
|
1092 | pTarget: T,
|
1093 | sFunction: keyof T,
|
1094 | pDescriptor?: PropertyDescriptor
|
1095 | ): void;
|
1096 | }
|
1097 |
|
1098 | declare module "tripetto/helpers/collection/decorators/reordered" {
|
1099 | import { CollectionItem } from "tripetto/helpers/collection/item";
|
1100 | |
1101 |
|
1102 |
|
1103 |
|
1104 | export function reordered<T extends CollectionItem<Reference>, Reference>(
|
1105 | pTarget: T,
|
1106 | sMethod: keyof T,
|
1107 | pDescriptor?: PropertyDescriptor
|
1108 | ): void;
|
1109 | }
|
1110 |
|
1111 | declare module "tripetto/builder" {
|
1112 | import { Hooks } from "tripetto/module/hookup";
|
1113 | import { Layer } from "tripetto/module/ui-layers";
|
1114 | import { TTranslation } from "tripetto/module/l10n";
|
1115 | import { TBuilderEvents } from "tripetto/events";
|
1116 | import { IDefinition } from "tripetto/module/map";
|
1117 | import { StylesEditor } from "tripetto/components/styles";
|
1118 | import { L10nEditor } from "tripetto/components/l10n";
|
1119 | import { IBuilderProperties } from "tripetto/properties";
|
1120 | import { IBuilderStyle } from "tripetto/styles/builder";
|
1121 | import { TL10n, TL10nContract, TStyleTiers, TStyles, TStylesContract } from "tripetto/module/contracts";
|
1122 |
|
1123 | export const NAME: string;
|
1124 |
|
1125 | export const VERSION: string;
|
1126 |
|
1127 | export const WEBSITE = "https://tripetto.com";
|
1128 |
|
1129 | export const DOCS = "https://docs.tripetto.com";
|
1130 | export class Builder extends Hooks<TBuilderEvents> {
|
1131 | |
1132 |
|
1133 |
|
1134 |
|
1135 | onLoad?: (pBuilder: Builder) => void;
|
1136 | |
1137 |
|
1138 |
|
1139 |
|
1140 | onError?: (nErroneousBlocks: number, pMissingBlockTypes: string[], pBuilder: Builder) => void;
|
1141 | |
1142 |
|
1143 |
|
1144 |
|
1145 | onReady?: (pBuilder: Builder) => void;
|
1146 | |
1147 |
|
1148 |
|
1149 |
|
1150 | onOpen?: (pBuilder: Builder) => void;
|
1151 | |
1152 |
|
1153 |
|
1154 |
|
1155 | onSave?: (pDefinition: IDefinition, pBuilder: Builder) => void;
|
1156 | |
1157 |
|
1158 |
|
1159 |
|
1160 | onChange?: (pDefinition: IDefinition, pBuilder: Builder) => void;
|
1161 | |
1162 |
|
1163 |
|
1164 |
|
1165 | onClose?: (pBuilder: Builder) => void;
|
1166 | |
1167 |
|
1168 |
|
1169 |
|
1170 |
|
1171 | static open(pDefinition?: IDefinition, pProperties?: IBuilderProperties): Builder;
|
1172 | |
1173 |
|
1174 |
|
1175 |
|
1176 | constructor(pProperties?: IBuilderProperties);
|
1177 | /** Retrieves a reference to the builder layer. */
|
1178 | get layer(): Layer | undefined;
|
1179 | /** Retrieves the form definition. */
|
1180 | get definition(): IDefinition | undefined;
|
1181 | /** Sets the form definition. */
|
1182 | set definition(pDefinition: IDefinition | undefined);
|
1183 | /** Retrieves the name of the definition. */
|
1184 | get name(): string;
|
1185 | /** Sets the name of the definition. */
|
1186 | set name(sName: string);
|
1187 | /** Retrieves the language of the definition. */
|
1188 | get language(): string | undefined;
|
1189 | /** Sets the language of the definition. */
|
1190 | set language(sLanguage: string | undefined);
|
1191 | /**
|
1192 | * Opens the builder.
|
1193 | * @param pDefinition Optionally specifies the form definition to load.
|
1194 | */
|
1195 | open(pDefinition?: IDefinition): this;
|
1196 | /** Notify the builder about a parent element resize. */
|
1197 | resize(): this;
|
1198 | /**
|
1199 | * Loads a form definition.
|
1200 | * @param pDefinition Specifies the form definition.
|
1201 | */
|
1202 | load(pDefinition: IDefinition): this;
|
1203 | /** Reloads the definition. */
|
1204 | reload(): this;
|
1205 | /** Restores the last loaded or saved definition. */
|
1206 | restore(): this;
|
1207 | /** Saves the form definition. */
|
1208 | save(): IDefinition | undefined;
|
1209 | /**
|
1210 | * Opens the editor panel for the specified element.
|
1211 | * @param sType Specifies the edit type. Can be one of the following values;
|
1212 | * - `properties`: Opens the map properties editor;
|
1213 | * - `prologue`: Opens the prologue properties editor;
|
1214 | * - `branch`: Opens the branch properties for the specified branch id;
|
1215 | * - `cluster`: Opens the cluster properties for the specified cluster id;
|
1216 | * - `node`: Opens the node properties for the specified node id;
|
1217 | * - `condition`: Opens the condition properties for the specified condition id;
|
1218 | * - `epilogue`: Opens the epilogue properties for the specified branch id.
|
1219 | * @param sId Specifies the id of the element that should be edited.
|
1220 | */
|
1221 | edit(sType: "branch" | "cluster" | "node" | "condition", sId: string): this;
|
1222 | edit(sType: "epilogue", sId?: string): this;
|
1223 | edit(sType?: "properties" | "prologue"): this;
|
1224 | /** Clears the form (creates a new empty one). */
|
1225 | clear(): this;
|
1226 | /** Closes the builder. */
|
1227 | close(): this;
|
1228 | /**
|
1229 | * Uses the namespace for the specified identifier (or optionally load it if it is not available).
|
1230 | * @param sIdentifier Specifies the namespace identifier.
|
1231 | */
|
1232 | useNamespace(sIdentifier: string): Promise<void>;
|
1233 | /**
|
1234 | * Uses the namespace for the specified identifier.
|
1235 | * @param sIdentifier Specifies the namespace identifier.
|
1236 | * @param sSrc Specifies the UMD code or URL to load.
|
1237 | * @param sType Specifies what to load (UMD code or an URL).
|
1238 | * @param bAlwaysLoad Specifies if the bundle should always load, even when there is already a
|
1239 | * namespace available with the specified identifier (default is `true`).
|
1240 | * @param bUnloadFirst Specifies if the namespace should unload if it is already available (default is `false`).
|
1241 | */
|
1242 | useNamespace(sIdentifier: string, sSrc: string, sType: "umd" | "url", bAlwaysLoad?: boolean, bUnloadFirst?: boolean): Promise<void>;
|
1243 | /** Shows the tutorial dialog. */
|
1244 | tutorial(): this;
|
1245 | /**
|
1246 | * Creates a new panel.
|
1247 | * @param fnLayer Reference to the layer construction function.
|
1248 | * @param size Specifies the panel size (`normal`, `small`, `compact` or custom width in pixels).
|
1249 | */
|
1250 | createPanel<T>(
|
1251 | fnLayer: (layer: Layer, builder: Builder, style: IBuilderStyle) => T,
|
1252 | size?: "normal" | "small" | "compact" | number
|
1253 | ): T;
|
1254 | /**
|
1255 | * Invokes the styles editor for the supplied contract.
|
1256 | * @param contract Specifies the styles contract.
|
1257 | * @param styles Reference to the styles object to edit (if omitted a new object is created).
|
1258 | * @param tier Specifies the features tier.
|
1259 | * @param onChange Specifies a function that is invoked on each style change.
|
1260 | * @param hideInaccessibleOptions Specifies if options that aren't available should be invisible
|
1261 | * instead of disabled.
|
1262 | * @param allowReset Allows a reset button to reset all styles.
|
1263 | * @param onReset Specifies a function that is invoked when the styles are about to reset.
|
1264 | */
|
1265 | stylesEditor(
|
1266 | contract: TStylesContract,
|
1267 | styles?: TStyles,
|
1268 | tier?: TStyleTiers,
|
1269 | onChange?: (styles: TStyles) => void,
|
1270 | hideInaccessibleOptions?: boolean,
|
1271 | allowReset?: boolean,
|
1272 | onReset?: (fnDone: (bReset: boolean) => void) => void
|
1273 | ): StylesEditor;
|
1274 | /**
|
1275 | * Invokes the l10n editor for the supplied contract.
|
1276 | * @param contract Specifies the l10n contract.
|
1277 | * @param l10n Reference to the l10n object to edit (if omitted a new object is created).
|
1278 | * @param onChange Specifies a function that is invoked on each change. It receives two arguments:
|
1279 | * - `l10n`: Reference to the l10n object;
|
1280 | * - `currentL10n`: Copy of the l10n object where the current edit language is set as the default language.
|
1281 | * @param onTranslation Specifies a function that should deliver translations for the given language.
|
1282 | */
|
1283 | l10nEditor(
|
1284 | contract: TL10nContract,
|
1285 | l10n?: TL10n,
|
1286 | onChange?: (l10n: TL10n, currentL10n: TL10n) => void,
|
1287 | onTranslation?: (
|
1288 | language: string
|
1289 | ) => TTranslation | TTranslation[] | Promise<TTranslation | TTranslation[] | undefined> | undefined
|
1290 | ): L10nEditor;
|
1291 | }
|
1292 | }
|
1293 |
|
1294 | declare module "tripetto/events" {
|
1295 |
|
1296 | import { Builder } from "tripetto/builder";
|
1297 | import { IDefinition } from "tripetto/module/map";
|
1298 | import { IHookPayload, THooks } from "tripetto/module/hookup";
|
1299 | import { Branch, Cluster, Condition, IEpilogue, IPrologue, Map, Node } from "tripetto/module/map";
|
1300 | export type TBuilderEvents =
|
1301 | | "OnLoad"
|
1302 | | "OnError"
|
1303 | | "OnReady"
|
1304 | | "OnOpen"
|
1305 | | "OnSave"
|
1306 | | "OnChange"
|
1307 | | "OnPreview"
|
1308 | | "OnRename"
|
1309 | | "OnEdit"
|
1310 | | "OnClose";
|
1311 | interface IBuilderEvent<Hook extends THooks> extends IHookPayload<Hook> {
|
1312 |
|
1313 | readonly builder: Builder;
|
1314 | }
|
1315 | interface IBuilderDefinitionEvent<Hook extends THooks> extends IBuilderEvent<Hook> {
|
1316 |
|
1317 | readonly definition: IDefinition;
|
1318 | }
|
1319 | export interface IBuilderLoadEvent extends IBuilderEvent<"OnLoad"> {}
|
1320 | export interface IBuilderErrorEvent extends IBuilderEvent<"OnError"> {
|
1321 |
|
1322 | readonly erroneousBlocks: number;
|
1323 |
|
1324 | readonly missingBlockTypes: string[];
|
1325 | }
|
1326 | export interface IBuilderOpenEvent extends IBuilderEvent<"OnOpen"> {}
|
1327 | export interface IBuilderCloseEvent extends IBuilderEvent<"OnClose"> {}
|
1328 | export interface IBuilderReadyEvent extends IBuilderDefinitionEvent<"OnReady"> {}
|
1329 | export interface IBuilderSaveEvent extends IBuilderDefinitionEvent<"OnSave"> {}
|
1330 | export interface IBuilderChangeEvent extends IBuilderDefinitionEvent<"OnChange"> {}
|
1331 | export interface IBuilderPreviewEvent extends IBuilderDefinitionEvent<"OnPreview"> {}
|
1332 | export interface IBuilderRenameEvent extends IBuilderDefinitionEvent<"OnRename"> {
|
1333 |
|
1334 | readonly name: string;
|
1335 | }
|
1336 | export type TBuilderEditTypes = "properties" | "prologue" | "branch" | "cluster" | "node" | "condition" | "epilogue";
|
1337 | export type TBuilderEditEpilogue = IEpilogue & {
|
1338 | readonly branch?: string;
|
1339 | };
|
1340 | interface IBuilderEditData<Type extends TBuilderEditTypes, Ref> {
|
1341 | readonly action: "start" | "end";
|
1342 | readonly type: Type;
|
1343 | readonly ref: Ref;
|
1344 | readonly subscribe?: (onChange: (ref: Ref) => void) => void;
|
1345 | }
|
1346 | export type TBuilderEditData =
|
1347 | | IBuilderEditData<"properties", Map>
|
1348 | | IBuilderEditData<"prologue", IPrologue | undefined>
|
1349 | | IBuilderEditData<"branch", Branch>
|
1350 | | IBuilderEditData<"cluster", Cluster>
|
1351 | | IBuilderEditData<"node", Node>
|
1352 | | IBuilderEditData<"condition", Condition>
|
1353 | | IBuilderEditData<"epilogue", TBuilderEditEpilogue | undefined>;
|
1354 | export interface IBuilderEditEvent extends IBuilderEvent<"OnEdit"> {
|
1355 | readonly data: TBuilderEditData;
|
1356 | }
|
1357 | export {};
|
1358 | }
|
1359 |
|
1360 | declare module "tripetto/properties" {
|
1361 |
|
1362 | import { Builder } from "tripetto/builder";
|
1363 | import { IDefinition } from "tripetto/module/map";
|
1364 | import { TBuilderEditData } from "tripetto/events";
|
1365 | import { IBuilderStyle } from "tripetto/styles/builder";
|
1366 | import { ILocale, TTranslation } from "tripetto/module/l10n";
|
1367 | import { Layer, LayerConfiguration } from "tripetto/module/ui-layers";
|
1368 | import { ITier } from "tripetto/tier";
|
1369 | import { IHelpTopics } from "tripetto/help";
|
1370 | import { INamespace } from "tripetto/module/map";
|
1371 | export interface IBuilderProperties {
|
1372 |
|
1373 | readonly element?: Element | null;
|
1374 |
|
1375 | readonly layer?: Layer;
|
1376 |
|
1377 | readonly layerConfiguration?: LayerConfiguration;
|
1378 | |
1379 |
|
1380 |
|
1381 |
|
1382 | readonly fonts?: string | "inherit";
|
1383 |
|
1384 | readonly style?: IBuilderStyle;
|
1385 |
|
1386 | readonly locale?: ILocale;
|
1387 |
|
1388 | readonly translations?: TTranslation | TTranslation[];
|
1389 |
|
1390 | readonly namespace?: {
|
1391 |
|
1392 | readonly identifier: string;
|
1393 |
|
1394 | readonly umd?: string;
|
1395 |
|
1396 | readonly url?: string;
|
1397 |
|
1398 | readonly onLoad?: (namespace: INamespace) => void;
|
1399 | };
|
1400 |
|
1401 | readonly tier?: ITier;
|
1402 |
|
1403 | readonly zoom?: "1:1" | "fit" | "fit-horizontal" | "fit-vertical";
|
1404 |
|
1405 | readonly centering?: boolean;
|
1406 |
|
1407 | readonly controls?: "left" | "right";
|
1408 |
|
1409 | readonly disablePrologue?: boolean;
|
1410 |
|
1411 | readonly disableEpilogue?: boolean;
|
1412 |
|
1413 | readonly disableZoombar?: boolean;
|
1414 |
|
1415 | readonly disableLogo?: boolean;
|
1416 |
|
1417 | readonly disableSaveButton?: boolean;
|
1418 |
|
1419 | readonly disableRestoreButton?: boolean;
|
1420 |
|
1421 | readonly disableClearButton?: boolean;
|
1422 |
|
1423 | readonly disableEditButton?: boolean;
|
1424 |
|
1425 | readonly disableCloseButton?: boolean;
|
1426 |
|
1427 | readonly disableTutorialButton?: boolean;
|
1428 |
|
1429 | readonly disableOpenCloseAnimation?: boolean;
|
1430 |
|
1431 | readonly showTutorial?: boolean;
|
1432 |
|
1433 | readonly previewURL?: string;
|
1434 |
|
1435 | readonly supportURL?: string | false;
|
1436 |
|
1437 | readonly helpTopics?: IHelpTopics & {
|
1438 |
|
1439 | readonly prologue?: string;
|
1440 |
|
1441 | readonly epilogue?: string;
|
1442 |
|
1443 | readonly branches?: string;
|
1444 |
|
1445 | readonly conditions?: string;
|
1446 |
|
1447 | readonly culling?: string;
|
1448 |
|
1449 | readonly terminators?: string;
|
1450 | };
|
1451 |
|
1452 | readonly onLoad?: (builder: Builder) => void;
|
1453 |
|
1454 | readonly onError?: (erroneousBlocks: number, missingBlockTypes: string[], builder: Builder) => void;
|
1455 |
|
1456 | readonly onReady?: (builder: Builder) => void;
|
1457 |
|
1458 | readonly onOpen?: (builder: Builder) => void;
|
1459 |
|
1460 | readonly onSave?: (definition: IDefinition, builder: Builder) => void;
|
1461 |
|
1462 | readonly onChange?: (definition: IDefinition, builder: Builder) => void;
|
1463 |
|
1464 | readonly onPreview?: (definition: IDefinition, builder: Builder) => void;
|
1465 |
|
1466 | readonly onEdit?: (data: TBuilderEditData) => void;
|
1467 |
|
1468 | readonly onClose?: (builder: Builder) => void;
|
1469 | }
|
1470 | }
|
1471 |
|
1472 | declare module "tripetto/styles/builder" {
|
1473 |
|
1474 | import { IFormsStyle } from "tripetto/styles/forms";
|
1475 | import { IMapStyle } from "tripetto/components/map/map/style";
|
1476 | import { IMenuStyle } from "tripetto/module/ui-menu";
|
1477 | import { INavigatorStyle } from "tripetto/styles/navigator";
|
1478 | import { ITutorialStyle } from "tripetto/components/tutorial/style";
|
1479 | import { IZoombarStyle } from "tripetto/module/ui-zoombar";
|
1480 | export interface IBuilderStyle {
|
1481 |
|
1482 | background: string;
|
1483 |
|
1484 | loader: {
|
1485 | color: string;
|
1486 | size: number;
|
1487 | };
|
1488 |
|
1489 | menu: IMenuStyle;
|
1490 |
|
1491 | zoombar: IZoombarStyle;
|
1492 |
|
1493 | forms: IFormsStyle;
|
1494 |
|
1495 | navigator: INavigatorStyle;
|
1496 |
|
1497 | map: IMapStyle;
|
1498 |
|
1499 | tutorial: ITutorialStyle;
|
1500 |
|
1501 | fonts?: (sURI: string) => string[];
|
1502 | }
|
1503 | }
|
1504 |
|
1505 | declare module "tripetto/tier" {
|
1506 | import { EditorOrchestrator } from "tripetto/templates";
|
1507 | import { Node } from "tripetto/module/map";
|
1508 | export interface ITier {
|
1509 |
|
1510 | readonly name: string;
|
1511 |
|
1512 | readonly blocks: string[];
|
1513 | |
1514 |
|
1515 |
|
1516 |
|
1517 |
|
1518 |
|
1519 | readonly mode?: "enabled" | "disabled" | "hidden";
|
1520 |
|
1521 | readonly message?: (pOrchestrator: EditorOrchestrator<Node>) => void;
|
1522 | }
|
1523 | }
|
1524 |
|
1525 | declare module "tripetto/skins/default" {
|
1526 |
|
1527 | import { IBuilderStyle } from "tripetto/styles/builder";
|
1528 | export const DEFAULT: IBuilderStyle;
|
1529 | }
|
1530 |
|
1531 | declare module "tripetto/helpers/collection/collection" {
|
1532 |
|
1533 | import { CollectionItem, ICollectionItem, ICollectionItemConstructor } from "tripetto/helpers/collection/item";
|
1534 | import { ConditionBlock, NodeBlock } from "tripetto/helpers/blocks";
|
1535 | import { Stack } from "tripetto/module/functional";
|
1536 | import { IDimensionChangeEvent, Matrix } from "tripetto/module/matrix";
|
1537 | export class Collection<T extends CollectionItem<Reference>, Reference> extends Matrix<T, void> {
|
1538 | |
1539 |
|
1540 |
|
1541 |
|
1542 |
|
1543 | constructor(pConstructor: ICollectionItemConstructor<T, Reference>, pReference: () => Reference);
|
1544 | /** Retrieves the reference. */
|
1545 | get ref(): Reference & {
|
1546 | readonly block?: NodeBlock | ConditionBlock;
|
1547 | };
|
1548 |
|
1549 | get block(): NodeBlock | ConditionBlock | undefined;
|
1550 | |
1551 |
|
1552 |
|
1553 |
|
1554 |
|
1555 | protected onDimensionChange(pEvent: IDimensionChangeEvent<this>): void;
|
1556 |
|
1557 | setBlock(pBlock: NodeBlock | ConditionBlock): void;
|
1558 | |
1559 |
|
1560 |
|
1561 |
|
1562 |
|
1563 |
|
1564 |
|
1565 | insert(nIndex?: number, fnInit?: (pItem: T) => void): T;
|
1566 | |
1567 |
|
1568 |
|
1569 |
|
1570 |
|
1571 |
|
1572 | append(fnInit?: (pItem: T) => void): T;
|
1573 | |
1574 |
|
1575 |
|
1576 |
|
1577 |
|
1578 |
|
1579 |
|
1580 | duplicate(pSrc: CollectionItem): {
|
1581 | readonly item: T;
|
1582 | readonly done: () => void;
|
1583 | };
|
1584 | |
1585 |
|
1586 |
|
1587 |
|
1588 |
|
1589 | itemByIdentifier(sId: string): T | undefined;
|
1590 |
|
1591 | refresh(): void;
|
1592 | |
1593 |
|
1594 |
|
1595 |
|
1596 | serialize(): ICollectionItem[] | undefined;
|
1597 | |
1598 |
|
1599 |
|
1600 |
|
1601 |
|
1602 |
|
1603 |
|
1604 | deserialize(pItems: ICollectionItem[] | undefined, pAfterwards: Stack): this;
|
1605 | }
|
1606 | }
|
1607 |
|
1608 | declare module "tripetto/helpers/collection/item" {
|
1609 |
|
1610 | import { Collection } from "tripetto/helpers/collection/collection";
|
1611 | import { EditorOrchestrator } from "tripetto/components/controller/editor/orchestrator";
|
1612 | import { TItemEvents } from "tripetto/helpers/collection/events";
|
1613 | import { Item } from "tripetto/module/matrix";
|
1614 | import { ISerialize } from "tripetto/module/serializer";
|
1615 | import { Stack } from "tripetto/module/functional";
|
1616 | import { MenuOption } from "tripetto/module/ui-menu";
|
1617 | export interface ICollectionItem extends ISerialize {
|
1618 | readonly id: string;
|
1619 | }
|
1620 | export interface ICollectionItemConstructor<T extends CollectionItem<Reference>, Reference> {
|
1621 | new (): T;
|
1622 | }
|
1623 | export abstract class CollectionItem<Reference = {}> extends Item<TItemEvents> {
|
1624 |
|
1625 | readonly orchestratorForEditor?: EditorOrchestrator<this>;
|
1626 |
|
1627 | constructor();
|
1628 | /** Retrieves the editor orchestrator. */
|
1629 | protected get editor(): EditorOrchestrator<this>;
|
1630 | /** Retrieves a reference to the parent collection. */
|
1631 | get collection(): Collection<CollectionItem<Reference>, Reference>;
|
1632 | /** Retrieves the identifier of the item. */
|
1633 | get id(): string;
|
1634 | /** Retrieves the reference. */
|
1635 | get ref(): Reference;
|
1636 | /** Retrieves if the block is initialized. */
|
1637 | get isInitialized(): boolean;
|
1638 | /** Retrieves if the item is deleted. */
|
1639 | get isDeleted(): boolean;
|
1640 | /** Retrieves the label for the item (this is the name of the item without any markdown). */
|
1641 | get labelWithoutMarkdown(): string;
|
1642 | /** Retrieves the icon of an item. */
|
1643 | getIconOfItem(): string | undefined;
|
1644 | /** Retrieves the name of an item. */
|
1645 | getNameOfItem(): string;
|
1646 | /** Sets the name of an item. */
|
1647 | setNameOfItem(sName: string): void;
|
1648 | /** Retrieves the alias of an item. */
|
1649 | getAliasOfItem(): string;
|
1650 | /** Sets the alias of an item. */
|
1651 | setAliasOfItem(sAlias: string): void;
|
1652 | /** Retrieves the score of an item. */
|
1653 | getScoreOfItem(): number | undefined;
|
1654 | /** Sets the score of an item. */
|
1655 | setScoreOfItem(nScore: number | undefined): void;
|
1656 | /** Retrieves the title for the item. */
|
1657 | getTitleOfItem(): string;
|
1658 | /** Retrieves the option menu for the item. */
|
1659 | getMenuOfItem(): MenuOption[];
|
1660 | /** Retrieves the width of the item panel. */
|
1661 | getWidthOfItem(): number;
|
1662 | /**
|
1663 | * Serializes an item.
|
1664 | * @return Returns the serialized item.
|
1665 | */
|
1666 | serialize(): ICollectionItem;
|
1667 | /**
|
1668 | * Deserializes an item.
|
1669 | * @param pItem Reference to the serialized item.
|
1670 | * @param pAfterwards Stack with calls which are invoked after the
|
1671 | * structural deserialization is done.
|
1672 | * @return Returns a reference to the item instance.
|
1673 | */
|
1674 | deserialize(pItem: ICollectionItem, pAfterwards: Stack): this;
|
1675 | /** Opens the item panel. */
|
1676 | open(): this;
|
1677 | /** Closes the item panel. */
|
1678 | close(): this;
|
1679 | /** Refreshes the collection item. */
|
1680 | refresh(type?: "icon" | "name"): void;
|
1681 | /** Deletes an item. */
|
1682 | delete(): this;
|
1683 | }
|
1684 | }
|
1685 |
|
1686 | declare module "tripetto/helpers/collection/events" {
|
1687 |
|
1688 | import { CollectionItem } from "tripetto/helpers/collection/item";
|
1689 | import { IHookPayload, THooks } from "tripetto/module/hookup";
|
1690 | export type TItemEvents = "OnAdd" | "OnRename" | "OnIndex" | "OnIcon" | "OnDelete" | "OnOpen" | "OnClose";
|
1691 | export interface IItemEvent<H extends THooks, T extends CollectionItem<Reference>, Reference> extends IHookPayload<H> {
|
1692 |
|
1693 | readonly item: T;
|
1694 | }
|
1695 | export interface IItemAddEvent<T extends CollectionItem<Reference>, Reference> extends IItemEvent<"OnAdd", T, Reference> {}
|
1696 | export interface IItemRenameEvent<T extends CollectionItem<Reference>, Reference> extends IItemEvent<"OnRename", T, Reference> {}
|
1697 | export interface IItemIndexEvent<T extends CollectionItem<Reference>, Reference> extends IItemEvent<"OnIndex", T, Reference> {}
|
1698 | export interface IItemIconEvent<T extends CollectionItem<Reference>, Reference> extends IItemEvent<"OnIcon", T, Reference> {}
|
1699 | export interface IItemDeleteEvent<T extends CollectionItem<Reference>, Reference> extends IItemEvent<"OnDelete", T, Reference> {}
|
1700 | export interface IItemOpenEvent<T extends CollectionItem<Reference>, Reference> extends IItemEvent<"OnOpen", T, Reference> {}
|
1701 | export interface IItemCloseEvent<T extends CollectionItem<Reference>, Reference> extends IItemEvent<"OnClose", T, Reference> {}
|
1702 | }
|
1703 |
|
1704 | declare module "tripetto/components/controller/collection/properties" {
|
1705 |
|
1706 | import { Collection } from "tripetto/helpers/collection/collection";
|
1707 | import { CollectionItem } from "tripetto/helpers/collection/item";
|
1708 | import { MenuOption } from "tripetto/module/ui-menu";
|
1709 | import { MarkdownFeatures } from "tripetto/module/markdown";
|
1710 | export interface ICollectionProperties<T extends CollectionItem<Reference>, Reference> {
|
1711 |
|
1712 | readonly collection: Collection<T, Reference>;
|
1713 |
|
1714 | readonly title: string;
|
1715 |
|
1716 | readonly banner?: string;
|
1717 |
|
1718 | readonly sorting?: "ascending" | "descending" | "manual";
|
1719 |
|
1720 | readonly placeholder?: string;
|
1721 |
|
1722 | readonly emptyMessage?:
|
1723 | | string
|
1724 | | {
|
1725 | readonly message: string;
|
1726 | readonly height: number;
|
1727 | };
|
1728 |
|
1729 | readonly icon?: boolean | string;
|
1730 |
|
1731 | readonly editable?: boolean;
|
1732 |
|
1733 | readonly autoOpen?: boolean;
|
1734 |
|
1735 | readonly allowAutoSorting?: boolean;
|
1736 | |
1737 |
|
1738 |
|
1739 |
|
1740 |
|
1741 | readonly allowCleanup?: boolean | string;
|
1742 |
|
1743 | readonly allowVariables?: boolean;
|
1744 |
|
1745 | readonly allowFormatting?: boolean;
|
1746 |
|
1747 | readonly allowImport?: boolean;
|
1748 |
|
1749 | readonly allowExport?: boolean;
|
1750 |
|
1751 | readonly allowDedupe?: boolean;
|
1752 |
|
1753 | readonly showAliases?: boolean | ((pItem: T) => string | undefined);
|
1754 | /** Specifies to show scores. */
|
1755 | readonly showScores?: boolean | ((pItem: T) => number | string | undefined);
|
1756 | /** Specifies the markdown features that are enabled. */
|
1757 | readonly markdown?: MarkdownFeatures;
|
1758 | /** Specifies a menu that is shown when the user wants to add something to the collection. */
|
1759 | readonly menu?: MenuOption[] | (() => MenuOption[]);
|
1760 | /** Specifies the width if the item panel. */
|
1761 | readonly width?: number;
|
1762 | /** Specifies an indicator. */
|
1763 | readonly indicator?: (pItem: T) => string | undefined;
|
1764 |
|
1765 | readonly onAdd?: (pItem: T) => void;
|
1766 |
|
1767 | readonly onRename?: (pItem: T) => void;
|
1768 |
|
1769 | readonly onReposition?: (pItem: T) => void;
|
1770 |
|
1771 | readonly onResize?: (collection: Collection<T, Reference>) => void;
|
1772 |
|
1773 | readonly onDelete?: (pItem: T) => void;
|
1774 |
|
1775 | readonly onOpen?: (pItem: T) => void;
|
1776 |
|
1777 | readonly onClose?: (pItem: T) => void;
|
1778 | }
|
1779 | }
|
1780 |
|
1781 | declare module "tripetto/components/controller/collection/card" {
|
1782 |
|
1783 | import { Card } from "tripetto/module/ui-cards";
|
1784 | import { CollectionItem } from "tripetto/helpers/collection/item";
|
1785 | import { Element } from "tripetto/module/dom";
|
1786 | import { ICollectionProperties } from "tripetto/components/controller/collection/properties";
|
1787 | export class CollectionCard<T extends CollectionItem<Reference>, Reference> extends Card {
|
1788 | |
1789 |
|
1790 |
|
1791 |
|
1792 | constructor(pProperties: ICollectionProperties<T, Reference>);
|
1793 | /** Retrieves the default icon for collection items. */
|
1794 | get icon(): string | undefined;
|
1795 | /** Sets the default icon for collection items. */
|
1796 | set icon(sIcon: string | undefined);
|
1797 | /** Retrieves the item placeholder. */
|
1798 | get placeholder(): string;
|
1799 | /** Retrieves the width of the item panel. */
|
1800 | get width(): number;
|
1801 | /** Retrieves the current banner. */
|
1802 | get banner(): string;
|
1803 | /** Sets the current banner. */
|
1804 | set banner(sBanner: string);
|
1805 | /**
|
1806 | * Draws the form.
|
1807 | * @param pCard Reference to the card element.
|
1808 | * @event
|
1809 | */
|
1810 | protected onDraw(pCard: Element): void;
|
1811 | /**
|
1812 | * Invoked when the card layer is resized.
|
1813 | * @event
|
1814 | */
|
1815 | protected onResize(): void;
|
1816 | /**
|
1817 | * Invoked when the card is destroyed.
|
1818 | * @event
|
1819 | */
|
1820 | protected onDestroy(): void;
|
1821 | /**
|
1822 | * Initializes the card.
|
1823 | * @event
|
1824 | */
|
1825 | onInit(): boolean;
|
1826 | /**
|
1827 | * Invoked when the name of an item is changed.
|
1828 | * @param pItem Reference to the item which name is changed.
|
1829 | * @event
|
1830 | */
|
1831 | onRename(pItem: T): void;
|
1832 | /**
|
1833 | * Invoked when the item is opened.
|
1834 | * @param pItem Reference to the item which is opened.
|
1835 | * @event
|
1836 | */
|
1837 | onOpen(pItem: T): void;
|
1838 | /**
|
1839 | * Invoked when the item is closed.
|
1840 | * @param pItem Reference to the item which is closed.
|
1841 | * @event
|
1842 | */
|
1843 | onClose(pItem: T): void;
|
1844 | /**
|
1845 | * Measures the size of the card.
|
1846 | * @return Returns `true` if the size is changed.
|
1847 | */
|
1848 | measure(): boolean;
|
1849 | /**
|
1850 | * Sorts the list with items.
|
1851 | * @param sDirection Specifies the sort direction.
|
1852 | */
|
1853 | sort(sDirection: "ascending" | "descending"): void;
|
1854 | /** Deletes all unnamed items from the collection. */
|
1855 | deleteUnnamed(): void;
|
1856 | /** Deletes all items from the collection. */
|
1857 | deleteAll(): void;
|
1858 | /** Refreshes all data in the collection. */
|
1859 | refresh(): void;
|
1860 | /** Shows the item import panel. */
|
1861 | import(): void;
|
1862 | /** Shows the item export panel. */
|
1863 | export(): void;
|
1864 | /** Removes items with duplicate names from the collection. */
|
1865 | deduplicate(): void;
|
1866 | /** Changes the aliases setting. */
|
1867 | aliases(pAliases: boolean | ((pItem: T) => string | undefined) | undefined): this;
|
1868 | /** Changes the scores setting. */
|
1869 | scores(pScores: boolean | ((pItem: T) => number | string | undefined) | undefined): this;
|
1870 | /** Changes the indicators function. */
|
1871 | indicators(pIndicators: ((pItem: T) => string | undefined) | undefined): this;
|
1872 | }
|
1873 | }
|
1874 |
|
1875 | declare module "tripetto/components/controller/controller" {
|
1876 |
|
1877 | import { Cards } from "tripetto/module/ui-cards";
|
1878 | import { IBuilderStyle } from "tripetto/styles/builder";
|
1879 | import { Layer } from "tripetto/module/ui-layers";
|
1880 | import { ToolbarButton, ToolbarItem, ToolbarStatic } from "tripetto/module/ui-toolbar";
|
1881 | export abstract class Controller<Reference, Views = void> {
|
1882 |
|
1883 | static style: IBuilderStyle;
|
1884 |
|
1885 | readonly closeButton: ToolbarButton<Views> | undefined;
|
1886 | |
1887 |
|
1888 |
|
1889 |
|
1890 |
|
1891 |
|
1892 |
|
1893 |
|
1894 |
|
1895 |
|
1896 |
|
1897 |
|
1898 | protected constructor(
|
1899 | pLayer: Layer,
|
1900 | pReference: Reference,
|
1901 | sTitle?: string,
|
1902 | sMode?: "normal" | "compact",
|
1903 | pStyle?: IBuilderStyle,
|
1904 | sLocation?: "left" | "right",
|
1905 | sCloseButtonMode?: "always-on" | "on-when-validated" | "disabled",
|
1906 | sCloseButtonLabel?: string,
|
1907 | pToolbarItems?: ToolbarItem<Views>[]
|
1908 | );
|
1909 | /** Retrieves a reference to the style. */
|
1910 | protected get style(): IBuilderStyle;
|
1911 | /** Retrieves a reference to the layer. */
|
1912 | protected get layer(): Layer;
|
1913 | /** Retrieves the cards instance. */
|
1914 | protected get cards(): Cards | undefined;
|
1915 | /** Sets the cards instance. */
|
1916 | protected set cards(pCards: Cards | undefined);
|
1917 | /** Retrieves a reference to the data. */
|
1918 | protected get ref(): Reference;
|
1919 | /** Retrieves a reference to the title. */
|
1920 | protected get title(): ToolbarStatic<Views> | undefined;
|
1921 | /**
|
1922 | * Invoked when the header is constructed.
|
1923 | * @param sTitle Specifies the title.
|
1924 | * @return Should return an array with toolbar items.
|
1925 | * @event
|
1926 | */
|
1927 | protected onHeader(sTitle: string): ToolbarItem<Views>[];
|
1928 | /**
|
1929 | * Invoked when the properties controller should be constructed.
|
1930 | * @param sMode Specifies the mode.
|
1931 | * @event
|
1932 | */
|
1933 | protected onLayer(sMode: "normal" | "compact"): void;
|
1934 | /**
|
1935 | * Invoked when the layer is updated.
|
1936 | * @event
|
1937 | */
|
1938 | protected onLayerUpdate(): void;
|
1939 | /**
|
1940 | * Implements the cards.
|
1941 | * @param pCards Reference to the cards instance.
|
1942 | * @event
|
1943 | */
|
1944 | protected abstract onCards(pCards: Cards): void;
|
1945 | /**
|
1946 | * Invoked when the controller is destroyed.
|
1947 | * @event
|
1948 | */
|
1949 | protected onDestroy(): void;
|
1950 | /** Closes the controller. */
|
1951 | close(): void;
|
1952 | /** Scrolls the cards layer to the top or bottom. */
|
1953 | scrollToTopOrBottom(): void;
|
1954 | }
|
1955 | }
|
1956 |
|
1957 | declare module "tripetto/components/l10n" {
|
1958 | import { Controller } from "tripetto/components/controller/controller";
|
1959 | import { Cards } from "tripetto/module/ui-cards";
|
1960 | import { Layer } from "tripetto/module/ui-layers";
|
1961 | import { IBuilderStyle } from "tripetto/styles/builder";
|
1962 | import { ToolbarItem } from "tripetto/module/ui-toolbar";
|
1963 | import { TTranslation } from "tripetto/module/l10n";
|
1964 | import { TL10n, TL10nContract } from "tripetto/module/contracts";
|
1965 | import { Builder } from "tripetto/builder";
|
1966 | export class L10nEditor<Views = void> extends Controller<
|
1967 | {
|
1968 | readonly contract: TL10nContract;
|
1969 | readonly l10n: TL10n;
|
1970 | builder?: Builder;
|
1971 | },
|
1972 | Views
|
1973 | > {
|
1974 | whenClosed?: () => void;
|
1975 | constructor(
|
1976 | layer: Layer,
|
1977 | contract: TL10nContract,
|
1978 | builder?: Builder,
|
1979 | l10n?: TL10n,
|
1980 | onChange?: (l10n: TL10n, currentL10n: TL10n) => void,
|
1981 | onTranslation?: (
|
1982 | language: string
|
1983 | ) => TTranslation | TTranslation[] | Promise<TTranslation | TTranslation[] | undefined> | undefined,
|
1984 | title?: string,
|
1985 | style?: IBuilderStyle,
|
1986 | location?: "left" | "right",
|
1987 | toolbarItems?: ToolbarItem<Views>[]
|
1988 | );
|
1989 | onCards(cards: Cards): void;
|
1990 | }
|
1991 | }
|
1992 |
|
1993 | declare module "tripetto/components/loader" {
|
1994 |
|
1995 | import { Element } from "tripetto/module/dom";
|
1996 | export class Loader {
|
1997 | static create(sColor: string, nSize: number, pParent?: Element): Loader;
|
1998 | destroy(): void;
|
1999 | }
|
2000 | }
|
2001 |
|
2002 | declare module "tripetto/helpers/menu" {
|
2003 |
|
2004 | export * from "tripetto/module/ui-menu";
|
2005 | export { Item as MenuItemWithIcon } from "tripetto/helpers/menu/item";
|
2006 | export { Link as MenuLinkWithIcon } from "tripetto/helpers/menu/link";
|
2007 | export { Submenu as MenuSubmenuWithIcon } from "tripetto/helpers/menu/submenu";
|
2008 | }
|
2009 |
|
2010 | declare module "tripetto/components/styles" {
|
2011 | import { TStyleTiers, TStyles, TStylesContract } from "tripetto/module/contracts";
|
2012 | import { Controller } from "tripetto/components/controller/controller";
|
2013 | import { Cards } from "tripetto/module/ui-cards";
|
2014 | import { Layer } from "tripetto/module/ui-layers";
|
2015 | import { IBuilderStyle } from "tripetto/styles/builder";
|
2016 | import { ToolbarItem } from "tripetto/module/ui-toolbar";
|
2017 | export class StylesEditor<Views = void> extends Controller<
|
2018 | {
|
2019 | readonly contract: TStylesContract;
|
2020 | readonly styles: TStyles;
|
2021 | readonly tier: TStyleTiers | undefined;
|
2022 | readonly hideInaccessibleOptions: boolean;
|
2023 | readonly allowReset: boolean;
|
2024 | readonly onReset?: (fnDone: (bReset: boolean) => void) => void;
|
2025 | },
|
2026 | Views
|
2027 | > {
|
2028 | whenClosed?: () => void;
|
2029 | constructor(
|
2030 | layer: Layer,
|
2031 | contract: TStylesContract,
|
2032 | styles?: TStyles,
|
2033 | tier?: TStyleTiers,
|
2034 | onChange?: (styles: TStyles) => void,
|
2035 | hideInaccessibleOptions?: boolean,
|
2036 | allowReset?: boolean,
|
2037 | onReset?: (fnDone: (bReset: boolean) => void) => void,
|
2038 | title?: string,
|
2039 | style?: IBuilderStyle,
|
2040 | location?: "left" | "right",
|
2041 | toolbarItems?: ToolbarItem<Views>[]
|
2042 | );
|
2043 | onCards(cards: Cards): void;
|
2044 | }
|
2045 | }
|
2046 |
|
2047 | declare module "tripetto/components/tutorial" {
|
2048 | import { ITutorialStyle } from "tripetto/components/tutorial/style";
|
2049 | import { Layer, LayerComponent } from "tripetto/module/ui-layers";
|
2050 | export class Tutorial extends LayerComponent {
|
2051 |
|
2052 | static open(pLayer: Layer, pStyle: ITutorialStyle): Tutorial;
|
2053 |
|
2054 | protected onRender(): void;
|
2055 | }
|
2056 | }
|
2057 |
|
2058 | declare module "tripetto/components/map" {
|
2059 | import { Layer } from "tripetto/module/ui-layers";
|
2060 | import { Renderer } from "tripetto/module/ui-grid2layer";
|
2061 | import { Branch, Cluster, Condition, IPrologue, Map, Node } from "tripetto/module/map";
|
2062 | import { IBuilderStyle } from "tripetto/styles/builder";
|
2063 | import { TBuilderEditEpilogue, TBuilderEditTypes } from "tripetto/events";
|
2064 | import { ITier } from "tripetto/tier";
|
2065 |
|
2066 | export { MapLayout } from "tripetto/components/map/map/layout";
|
2067 | export { ClusterLayout } from "tripetto/components/map/cluster/layout";
|
2068 | export { NodeLayout } from "tripetto/components/map/node/layout";
|
2069 | export { INodeDrawing } from "tripetto/components/map/node/drawing";
|
2070 | export { BranchLayout } from "tripetto/components/map/branch/layout";
|
2071 | export { ConditionLayout } from "tripetto/components/map/condition/layout";
|
2072 | export { IConditionDrawing } from "tripetto/components/map/condition/drawing";
|
2073 | export interface IPane {
|
2074 | isVisible: boolean;
|
2075 | }
|
2076 |
|
2077 | export class Map2Layer extends Renderer<Map, Map | Branch | Cluster | Node | Condition, IBuilderStyle> {
|
2078 |
|
2079 | readonly supportsPrologue: boolean;
|
2080 |
|
2081 | readonly supportsEpilogue: boolean;
|
2082 | |
2083 |
|
2084 |
|
2085 |
|
2086 |
|
2087 |
|
2088 |
|
2089 |
|
2090 |
|
2091 |
|
2092 | constructor(
|
2093 | pLayer: Layer,
|
2094 | pStyle: IBuilderStyle,
|
2095 | pTier: ITier | undefined,
|
2096 | bPrologue: boolean,
|
2097 | bEpilogue: boolean,
|
2098 | fnOnEdit:
|
2099 | | ((
|
2100 | sAction: "start" | "end",
|
2101 | sType: TBuilderEditTypes,
|
2102 | pRef: Map | IPrologue | Branch | Cluster | Node | Condition | TBuilderEditEpilogue | undefined,
|
2103 | fnSubscribe?: (
|
2104 | on: (pRef: Map | IPrologue | Branch | Cluster | Node | Condition | TBuilderEditEpilogue | undefined) => void
|
2105 | ) => void
|
2106 | ) => void)
|
2107 | | undefined,
|
2108 | ...pPanes: (IPane | undefined)[]
|
2109 | );
|
2110 | /** Retrieves the map. */
|
2111 | get map(): Map | undefined;
|
2112 | /** Retrieves the tier. */
|
2113 | get tier(): ITier | undefined;
|
2114 | /** Renders the map. */
|
2115 | protected render(): void;
|
2116 | /**
|
2117 | * Fired when a move starts.
|
2118 | * @event
|
2119 | */
|
2120 | onMoveStart(): void;
|
2121 | /**
|
2122 | * Fired when the moving ends.
|
2123 | * @event
|
2124 | */
|
2125 | onMoveEnd(): void;
|
2126 | onEdit(sAction: "start" | "end", sType: "properties", pRef: Map): void;
|
2127 | onEdit(
|
2128 | sAction: "start",
|
2129 | sType: "prologue",
|
2130 | pRef: IPrologue | undefined,
|
2131 | fnSubscribe?: (on: (pRef: IPrologue | undefined) => void) => void
|
2132 | ): void;
|
2133 | onEdit(sAction: "end", sType: "prologue", pRef: IPrologue | undefined): void;
|
2134 | onEdit(
|
2135 | sAction: "start",
|
2136 | sType: "epilogue",
|
2137 | pRef: TBuilderEditEpilogue | undefined,
|
2138 | fnSubscribe?: (on: (pRef: TBuilderEditEpilogue | undefined) => void) => void
|
2139 | ): void;
|
2140 | onEdit(sAction: "end", sType: "epilogue", pRef: TBuilderEditEpilogue | undefined): void;
|
2141 | onEdit(sAction: "start" | "end", sType: "branch", pRef: Branch): void;
|
2142 | onEdit(sAction: "start" | "end", sType: "cluster", pRef: Cluster): void;
|
2143 | onEdit(sAction: "start" | "end", sType: "node", pRef: Node): void;
|
2144 | onEdit(sAction: "start" | "end", sType: "condition", pRef: Condition): void;
|
2145 | }
|
2146 | }
|
2147 |
|
2148 | declare module "tripetto/helpers/blocks/blocks" {
|
2149 | export class Blocks {
|
2150 |
|
2151 | static get isLoaded(): boolean;
|
2152 |
|
2153 | static load(fnDone: (bSucceeded: boolean, sLog: string) => void): void;
|
2154 | }
|
2155 | }
|
2156 |
|
2157 | declare module "tripetto/helpers/blocks/conditions/block" {
|
2158 | import { ConditionBlock, IConditionBlock } from "tripetto/module/map";
|
2159 | import { EditorOrchestrator } from "tripetto/components/controller/editor/orchestrator";
|
2160 | import { Element } from "tripetto/module/dom";
|
2161 | import { IConditionBlockType } from "tripetto/helpers/blocks/conditions/type";
|
2162 | import { IConditionDrawing } from "tripetto/components/map/condition/drawing";
|
2163 | import { ISerialize } from "tripetto/module/serializer";
|
2164 | import { Layer } from "tripetto/module/ui-layers";
|
2165 | import { Stack } from "tripetto/module/functional";
|
2166 | import { SVGImage } from "tripetto/helpers/svg";
|
2167 | export abstract class ConditionBlockEx extends ConditionBlock {
|
2168 |
|
2169 | static readonly icon: SVGImage | string;
|
2170 |
|
2171 | readonly type: IConditionBlockType<this>;
|
2172 |
|
2173 | readonly orchestratorForEditor?: EditorOrchestrator<this>;
|
2174 |
|
2175 | protected get editor(): EditorOrchestrator<this>;
|
2176 |
|
2177 | get icon(): SVGImage | string;
|
2178 |
|
2179 | get title(): string | undefined;
|
2180 | |
2181 |
|
2182 |
|
2183 |
|
2184 |
|
2185 | assignedToCondition(pPrevious?: ConditionBlock): () => void;
|
2186 | |
2187 |
|
2188 |
|
2189 |
|
2190 |
|
2191 |
|
2192 |
|
2193 |
|
2194 |
|
2195 |
|
2196 |
|
2197 |
|
2198 | draw(pElement: Element, nWidth: number, nHeight: number, bRedraw: boolean): IConditionDrawing | undefined;
|
2199 | |
2200 |
|
2201 |
|
2202 |
|
2203 |
|
2204 | rerender(bShouldRerender?: boolean): void;
|
2205 | |
2206 |
|
2207 |
|
2208 |
|
2209 |
|
2210 |
|
2211 |
|
2212 | open(pLayer: Layer): boolean;
|
2213 | |
2214 |
|
2215 |
|
2216 |
|
2217 | serialize(pProperties?: ISerialize): IConditionBlock;
|
2218 | |
2219 |
|
2220 |
|
2221 |
|
2222 |
|
2223 |
|
2224 |
|
2225 | deserialize(pBlock: IConditionBlock, pAfterwards: Stack): this;
|
2226 | }
|
2227 | }
|
2228 |
|
2229 | declare module "tripetto/helpers/blocks/conditions/menu" {
|
2230 |
|
2231 | import { Condition } from "tripetto/module/map";
|
2232 | import { IConditionGroup, IConditionTemplate, IConditionTemplateCommand } from "tripetto/helpers/conditions/interface";
|
2233 | import { MenuOption } from "tripetto/module/ui-menu";
|
2234 | |
2235 |
|
2236 |
|
2237 |
|
2238 |
|
2239 |
|
2240 |
|
2241 |
|
2242 |
|
2243 | export function conditionTemplatesToMenu(
|
2244 | pConditions: (IConditionTemplate | IConditionGroup)[],
|
2245 | fnCreateCondition: () => Condition,
|
2246 | pOptions?: MenuOption[],
|
2247 | pCommands?: IConditionTemplateCommand[]
|
2248 | ): MenuOption[];
|
2249 | }
|
2250 |
|
2251 | declare module "tripetto/helpers/blocks/conditions/type" {
|
2252 |
|
2253 | import { ConditionBlock, TConditionBlock } from "tripetto/module/map";
|
2254 | import { SVGImage } from "tripetto/helpers/svg";
|
2255 | export interface IConditionBlockType<T extends ConditionBlock = ConditionBlock> extends TConditionBlock<T> {
|
2256 |
|
2257 | readonly icon: SVGImage | string;
|
2258 |
|
2259 | readonly autoOpen?: boolean;
|
2260 | }
|
2261 | }
|
2262 |
|
2263 | declare module "tripetto/helpers/blocks/nodes/decorator" {
|
2264 |
|
2265 | import { INodeBlockDecorator } from "tripetto/module/map";
|
2266 | import { SVGImage } from "tripetto/helpers/svg";
|
2267 | export interface INodeBlockDecoratorEx extends INodeBlockDecorator {
|
2268 |
|
2269 | readonly icon: SVGImage | string;
|
2270 | }
|
2271 | }
|
2272 |
|
2273 | declare module "tripetto/helpers/blocks/nodes/type" {
|
2274 |
|
2275 | import { NodeBlock, TNodeBlock } from "tripetto/module/map";
|
2276 | import { SVGImage } from "tripetto/helpers/svg";
|
2277 | export interface INodeBlockType<T extends NodeBlock = NodeBlock> extends TNodeBlock<T> {
|
2278 |
|
2279 | readonly icon: SVGImage | string;
|
2280 | }
|
2281 | }
|
2282 |
|
2283 | declare module "tripetto/helpers/blocks/nodes/block" {
|
2284 |
|
2285 | import { ConditionsOrchestrator } from "tripetto/helpers/conditions/orchestrator";
|
2286 | import { EditorOrchestrator } from "tripetto/templates";
|
2287 | import { Element } from "tripetto/module/dom";
|
2288 | import { INodeBlockType } from "tripetto/helpers/blocks/nodes/type";
|
2289 | import { INodeDrawing } from "tripetto/components/map/node/drawing";
|
2290 | import { Layer } from "tripetto/module/ui-layers";
|
2291 | import { NodeBlock } from "tripetto/module/map";
|
2292 | import { SVGImage } from "tripetto/helpers/svg";
|
2293 |
|
2294 | export abstract class NodeBlockEx extends NodeBlock {
|
2295 |
|
2296 | static readonly icon: SVGImage | string;
|
2297 |
|
2298 | readonly type: INodeBlockType<this>;
|
2299 |
|
2300 | readonly orchestratorForEditor?: EditorOrchestrator<this>;
|
2301 |
|
2302 | readonly orchestratorForConditions?: ConditionsOrchestrator;
|
2303 |
|
2304 | protected get editor(): EditorOrchestrator<this>;
|
2305 |
|
2306 | protected get conditions(): ConditionsOrchestrator;
|
2307 |
|
2308 | get icon(): SVGImage | string;
|
2309 |
|
2310 | get isRequired(): boolean;
|
2311 | |
2312 |
|
2313 |
|
2314 |
|
2315 |
|
2316 | assignedToNode(pPrevious?: NodeBlock): () => void;
|
2317 | |
2318 |
|
2319 |
|
2320 |
|
2321 |
|
2322 |
|
2323 |
|
2324 |
|
2325 |
|
2326 |
|
2327 |
|
2328 |
|
2329 |
|
2330 |
|
2331 |
|
2332 |
|
2333 | draw(
|
2334 | pElement: Element,
|
2335 | nWidth: number,
|
2336 | nHeight: number,
|
2337 | bRedraw: boolean,
|
2338 | bDisabled: boolean,
|
2339 | bRequired: boolean,
|
2340 | bNamed: boolean
|
2341 | ): INodeDrawing | undefined;
|
2342 | |
2343 |
|
2344 |
|
2345 |
|
2346 |
|
2347 | rerender(bShouldRerender?: boolean): void;
|
2348 | |
2349 |
|
2350 |
|
2351 |
|
2352 |
|
2353 |
|
2354 |
|
2355 | open(pLayer: Layer): boolean;
|
2356 | }
|
2357 | }
|
2358 |
|
2359 | declare module "tripetto/helpers/blocks/decorator" {
|
2360 | import { IConditionBlockDecorator, IConditionBlockType, INodeBlockDecorator, INodeBlockType } from "tripetto/helpers/blocks";
|
2361 | |
2362 |
|
2363 |
|
2364 |
|
2365 | export function tripetto(pProperties: INodeBlockDecorator): (pBlock: INodeBlockType) => void;
|
2366 | |
2367 |
|
2368 |
|
2369 |
|
2370 | export function tripetto(pProperties: IConditionBlockDecorator): (pBlock: IConditionBlockType) => void;
|
2371 | }
|
2372 |
|
2373 | declare module "tripetto/helpers/svg/line" {
|
2374 |
|
2375 | import { Spacing } from "tripetto/module/metrics";
|
2376 | |
2377 |
|
2378 |
|
2379 |
|
2380 |
|
2381 | export function SVGLine(pProperties: {
|
2382 | orientation: "horizontal" | "vertical";
|
2383 | alignment: "left" | "top" | "right" | "bottom" | "center";
|
2384 | width: number;
|
2385 | height: number;
|
2386 | thickness: number;
|
2387 | color: string;
|
2388 | dotted?: "no" | "begin-with-dot" | "begin-with-gap";
|
2389 | arrows?: "no" | "begin" | "end";
|
2390 | spacing?: Spacing;
|
2391 | break?: {
|
2392 | from: number;
|
2393 | size: number;
|
2394 | };
|
2395 | }): string;
|
2396 | }
|
2397 |
|
2398 | declare module "tripetto/helpers/svg/colorize" {
|
2399 |
|
2400 | import { SVGImage } from "tripetto/helpers/svg";
|
2401 | export function SVGColorizePath(sBase64Image: SVGImage | string, sColor: string): string;
|
2402 | }
|
2403 |
|
2404 | declare module "tripetto/templates/scores/scores" {
|
2405 |
|
2406 | import { Numeric } from "tripetto/module/ui-form-numeric";
|
2407 | import { EditorOrchestrator } from "tripetto/components/controller/editor/orchestrator";
|
2408 | import { Feature } from "tripetto/module/ui-cards";
|
2409 | import { Slots } from "tripetto/module/slots";
|
2410 | import { CollectionCard } from "tripetto/components/controller/collection/card";
|
2411 | import { CollectionItem } from "tripetto/helpers/collection/item";
|
2412 | export interface IScoresFeature {
|
2413 |
|
2414 | readonly target: {
|
2415 | readonly slots: Slots;
|
2416 | };
|
2417 |
|
2418 | readonly description?: string;
|
2419 |
|
2420 | readonly exportable?: boolean;
|
2421 |
|
2422 | readonly scores?: Numeric[];
|
2423 |
|
2424 | readonly collection?: CollectionCard<CollectionItem<{}>, {}> | Feature;
|
2425 | }
|
2426 | |
2427 |
|
2428 |
|
2429 |
|
2430 |
|
2431 |
|
2432 | export function scores<Reference>(pOrchestrator: EditorOrchestrator<Reference>, pProperties: IScoresFeature): Feature;
|
2433 | }
|
2434 |
|
2435 | declare module "tripetto/templates/numeric/numeric" {
|
2436 | import { Numeric } from "tripetto/module/ui-form-numeric";
|
2437 | import { EditorOrchestrator } from "tripetto/components/controller/editor/orchestrator";
|
2438 | import { Card, Feature } from "tripetto/module/ui-cards";
|
2439 | import { Slots } from "tripetto/module/slots";
|
2440 | import { CollectionCard } from "tripetto/components/controller/collection/card";
|
2441 | import { CollectionItem } from "tripetto/helpers/collection/item";
|
2442 | export interface INumericFeature {
|
2443 |
|
2444 | readonly target: {
|
2445 | readonly slots: Slots;
|
2446 | };
|
2447 |
|
2448 | readonly reference: string;
|
2449 |
|
2450 | readonly label: string;
|
2451 |
|
2452 | readonly name: string;
|
2453 |
|
2454 | readonly title?: string;
|
2455 |
|
2456 | readonly description?: string;
|
2457 |
|
2458 | readonly pair?: Feature | Card | (() => Feature | Card);
|
2459 | /** Specifies if the slot is exportable or not (default is `false`). */
|
2460 | readonly exportable?: boolean;
|
2461 | /** Specifies scores to display inside the feature. */
|
2462 | readonly scores?: Numeric[];
|
2463 | /** Specifies a collection that holds the scores. */
|
2464 | readonly collection?: CollectionCard<CollectionItem<{}>, {}>;
|
2465 | }
|
2466 | /**
|
2467 | * Adds the numeric feature.
|
2468 | * @param pOrchestrator Reference to the editor orchestrator.
|
2469 | * @param pProperties Specifies the numeric feature properties.
|
2470 | * @return Returns a reference to the numeric feature.
|
2471 | */
|
2472 | export function numeric<Reference>(pOrchestrator: EditorOrchestrator<Reference>, pProperties: INumericFeature): Feature;
|
2473 | }
|
2474 |
|
2475 | declare module "tripetto/helpers/conditions/interface" {
|
2476 | /** Dependencies */
|
2477 | import { Condition } from "tripetto/module/map";
|
2478 | import { SVGImage } from "tripetto/helpers/svg";
|
2479 | interface IConditionBase {
|
2480 | /** Label for the template. */
|
2481 | readonly label: string;
|
2482 | /** Specifies if the label has possible markdown in it. */
|
2483 | readonly markdown: boolean;
|
2484 | /** Icon for the template. */
|
2485 | readonly icon?: SVGImage | string;
|
2486 | }
|
2487 | export interface IConditionTemplate extends IConditionBase {
|
2488 | /** Specifies if the template should be preceded by a separator. */
|
2489 | readonly separator?: boolean;
|
2490 | /** Contains if the condition allows burst creation. */
|
2491 | readonly burst?: "branches" | "branch" | "pipe";
|
2492 | /** Command which creates the condition block. */
|
2493 | readonly command: (pCondition: Condition, bBurst: boolean) => void;
|
2494 | }
|
2495 | export interface IConditionGroup extends IConditionBase {
|
2496 |
|
2497 | readonly templates: IConditionTemplate[];
|
2498 | }
|
2499 | export interface IConditionTemplateCommand {
|
2500 | readonly label: string;
|
2501 | readonly burst: "branches" | "branch" | "pipe";
|
2502 | readonly execute: (pCondition: Condition, bBurst: boolean) => void;
|
2503 | }
|
2504 | export {};
|
2505 | }
|
2506 |
|
2507 | declare module "tripetto/helpers/conditions/properties" {
|
2508 |
|
2509 | import { ConditionBlock } from "tripetto/module/map";
|
2510 | import { IConditionBlockType } from "tripetto/helpers/blocks/conditions/type";
|
2511 | import { SVGImage } from "tripetto/helpers/svg";
|
2512 | export interface ITemplateProperties<T extends ConditionBlock> {
|
2513 |
|
2514 | readonly condition: IConditionBlockType<T>;
|
2515 |
|
2516 | readonly label?: string;
|
2517 |
|
2518 | readonly markdown?: string;
|
2519 |
|
2520 | readonly icon?: SVGImage | string;
|
2521 |
|
2522 | readonly props?: Partial<Readonly<T>>;
|
2523 |
|
2524 | readonly burst?: boolean | "branch";
|
2525 |
|
2526 | readonly autoOpen?: boolean;
|
2527 |
|
2528 | readonly separator?: boolean;
|
2529 | }
|
2530 | }
|
2531 |
|
2532 | declare module "tripetto/styles/forms" {
|
2533 |
|
2534 | import { ICardsStyle } from "tripetto/module/ui-cards";
|
2535 | import { ICollectionStyle } from "tripetto/components/controller/collection/style";
|
2536 | import { IFormStyle } from "tripetto/module/ui-form";
|
2537 | import { IToolbarItemStyle, IToolbarMenuStyle, IToolbarStyle } from "tripetto/module/ui-toolbar";
|
2538 | export interface IFormHeaderStyle {
|
2539 |
|
2540 | height: number;
|
2541 |
|
2542 | style: IToolbarStyle;
|
2543 |
|
2544 | title: {
|
2545 |
|
2546 | color: string;
|
2547 |
|
2548 | withIcon: IToolbarItemStyle;
|
2549 |
|
2550 | withoutIcon: IToolbarItemStyle;
|
2551 | };
|
2552 |
|
2553 | buttons: {
|
2554 |
|
2555 | type: IToolbarMenuStyle;
|
2556 |
|
2557 | close: IToolbarItemStyle;
|
2558 | };
|
2559 | }
|
2560 | export interface IFormsStyle {
|
2561 |
|
2562 | background: string;
|
2563 |
|
2564 | border: string;
|
2565 |
|
2566 | header: IFormHeaderStyle;
|
2567 |
|
2568 | cards: ICardsStyle;
|
2569 |
|
2570 | form: IFormStyle;
|
2571 |
|
2572 | collection: ICollectionStyle;
|
2573 |
|
2574 | width: {
|
2575 |
|
2576 | normal: number;
|
2577 |
|
2578 | small: number;
|
2579 |
|
2580 | compact: number;
|
2581 | };
|
2582 | }
|
2583 | }
|
2584 |
|
2585 | declare module "tripetto/components/map/map/style" {
|
2586 |
|
2587 | import { IStyles } from "tripetto/module/dom";
|
2588 | import { Spacing } from "tripetto/module/metrics";
|
2589 | import { IScrollbarsStyle } from "tripetto/module/ui-scrollbars";
|
2590 | import { SVGImage } from "tripetto/helpers/svg";
|
2591 | import { IBranchStyle } from "tripetto/components/map/branch/style";
|
2592 | import { IClusterStyle } from "tripetto/components/map/cluster/style";
|
2593 | import { INodeStyle } from "tripetto/components/map/node/style";
|
2594 | import { IConditionStyle } from "tripetto/components/map/condition/style";
|
2595 | export interface IMapStyle {
|
2596 |
|
2597 | clusters: IClusterStyle;
|
2598 |
|
2599 | nodes: INodeStyle;
|
2600 |
|
2601 | branches: IBranchStyle;
|
2602 |
|
2603 | conditions: IConditionStyle;
|
2604 |
|
2605 | connectors: {
|
2606 |
|
2607 | thickness: number;
|
2608 |
|
2609 | spacing: number;
|
2610 |
|
2611 | padding: number;
|
2612 |
|
2613 | radius: number;
|
2614 |
|
2615 | branch: string;
|
2616 |
|
2617 | cluster: string;
|
2618 |
|
2619 | guides: string;
|
2620 | };
|
2621 |
|
2622 | start: {
|
2623 |
|
2624 | width: number;
|
2625 |
|
2626 | height: number;
|
2627 |
|
2628 | image: SVGImage;
|
2629 |
|
2630 | prologue: SVGImage;
|
2631 |
|
2632 | hover?: SVGImage;
|
2633 |
|
2634 | tap?: SVGImage;
|
2635 | };
|
2636 |
|
2637 | end: {
|
2638 |
|
2639 | width: number;
|
2640 |
|
2641 | height: number;
|
2642 |
|
2643 | image: SVGImage;
|
2644 |
|
2645 | epilogue: SVGImage;
|
2646 |
|
2647 | hover?: SVGImage;
|
2648 |
|
2649 | tap?: SVGImage;
|
2650 | };
|
2651 |
|
2652 | blocks: {
|
2653 |
|
2654 | undefined: SVGImage;
|
2655 |
|
2656 | error: SVGImage;
|
2657 |
|
2658 | static: SVGImage;
|
2659 |
|
2660 | note: SVGImage;
|
2661 |
|
2662 | branch: SVGImage;
|
2663 | };
|
2664 |
|
2665 | ensuing?: IStyles;
|
2666 |
|
2667 | rulers: boolean;
|
2668 |
|
2669 | spacing?: Spacing;
|
2670 |
|
2671 | scrollbars?: IScrollbarsStyle;
|
2672 |
|
2673 | animateDuration?: number;
|
2674 | }
|
2675 | }
|
2676 |
|
2677 | declare module "tripetto/styles/navigator" {
|
2678 |
|
2679 | import { IToolbarItemStyle, IToolbarStyle } from "tripetto/module/ui-toolbar";
|
2680 | export interface INavigatorStyle {
|
2681 |
|
2682 | height: number;
|
2683 |
|
2684 | spacing: number;
|
2685 |
|
2686 | style: IToolbarStyle;
|
2687 |
|
2688 | button: IToolbarItemStyle;
|
2689 |
|
2690 | separator: IToolbarItemStyle;
|
2691 | }
|
2692 | }
|
2693 |
|
2694 | declare module "tripetto/components/tutorial/style" {
|
2695 | import { IStyles } from "tripetto/module/dom";
|
2696 | import { IScrollbarsStyle } from "tripetto/module/ui-scrollbars";
|
2697 | export interface ITutorialStyle {
|
2698 | width: number;
|
2699 | height: number;
|
2700 | margin: number;
|
2701 | spacing: number;
|
2702 | appearance: IStyles;
|
2703 | overlay: IStyles;
|
2704 | scrollbars: IScrollbarsStyle;
|
2705 | title: IStyles;
|
2706 | help: IStyles;
|
2707 | blocks: {
|
2708 | row: IStyles;
|
2709 | appearance: IStyles;
|
2710 | title: IStyles;
|
2711 | subtitle: IStyles;
|
2712 | text: IStyles;
|
2713 | };
|
2714 | close: {
|
2715 | appearance: IStyles;
|
2716 | hover?: IStyles;
|
2717 | tap?: IStyles;
|
2718 | };
|
2719 | }
|
2720 | }
|
2721 |
|
2722 | declare module "tripetto/helpers/menu/item" {
|
2723 |
|
2724 | import { Element } from "tripetto/module/dom";
|
2725 | import { Menu, MenuItem } from "tripetto/module/ui-menu";
|
2726 | export class Item extends MenuItem {
|
2727 | constructor(nIcon: number, sLabel: string, fnCommand?: () => void, bDisabled?: boolean);
|
2728 | draw(pMenu: Menu, pElement: Element): void;
|
2729 | }
|
2730 | }
|
2731 |
|
2732 | declare module "tripetto/helpers/menu/link" {
|
2733 |
|
2734 | import { Element } from "tripetto/module/dom";
|
2735 | import { Menu, MenuLink } from "tripetto/module/ui-menu";
|
2736 | export class Link extends MenuLink {
|
2737 | constructor(nIcon: number, sLabel: string, sURL: string, sTarget?: "self" | "blank");
|
2738 | draw(pMenu: Menu, pElement: Element): void;
|
2739 | }
|
2740 | }
|
2741 |
|
2742 | declare module "tripetto/helpers/menu/submenu" {
|
2743 |
|
2744 | import { Element } from "tripetto/module/dom";
|
2745 | import { Menu, MenuOption, MenuSubmenu } from "tripetto/module/ui-menu";
|
2746 | export class Submenu extends MenuSubmenu {
|
2747 | constructor(nIcon: number, sLabel: string, pOptions: MenuOption[] | (() => MenuOption[]), bDisabled?: boolean, bCollapse?: boolean);
|
2748 | draw(pMenu: Menu, pElement: Element): void;
|
2749 | }
|
2750 | }
|
2751 |
|
2752 | declare module "tripetto/components/map/map/layout" {
|
2753 |
|
2754 | import { Branch, Cluster, Map } from "tripetto/module/map";
|
2755 | import { Coordinate } from "tripetto/module/metrics";
|
2756 | import { IBuilderStyle } from "tripetto/styles/builder";
|
2757 | import { Layer } from "tripetto/module/ui-layers";
|
2758 | import { Map2Layer } from "tripetto/components/map";
|
2759 | import { MoveableLayout } from "tripetto/helpers/layout";
|
2760 | import { TGridRectangles } from "tripetto/module/grid";
|
2761 |
|
2762 | export class MapLayout extends MoveableLayout<Map, Map, IBuilderStyle> {
|
2763 | |
2764 |
|
2765 |
|
2766 |
|
2767 |
|
2768 |
|
2769 | constructor(pRenderer: Map2Layer, pMap: Map, pLayer: Layer);
|
2770 | /** Returns the map layout configuration. */
|
2771 | get configuration(): TGridRectangles;
|
2772 | /** Retrieves a reference to the map. */
|
2773 | get map(): Map;
|
2774 | /**
|
2775 | * Draws the map.
|
2776 | * @param nLeft Specifies the horizontal position.
|
2777 | * @param nTop Specifies the vertical position.
|
2778 | * @param nWidth Specifies the width.
|
2779 | * @param nHeight Specifies the height.
|
2780 | * @param nZoom Contains the zoom factor.
|
2781 | * @param nZ Specifies the z-index.
|
2782 | * @param bRedraw Specifies if the element is redrawn.
|
2783 | */
|
2784 | protected draw(nLeft: number, nTop: number, nWidth: number, nHeight: number, nZoom: number, nZ: number, bRedraw: boolean): void;
|
2785 | /**
|
2786 | * Specifies the expansion coordinates for the move detection. These
|
2787 | * coordinates are applied to the rectangle detection. Use it to
|
2788 | * expand or contract the rectangle.
|
2789 | * @param nX Specifies the horizontal mouse coordinate.
|
2790 | * @param nY Specifies the vertical mouse coordinate.
|
2791 | * @param pTarget Specifies the target resource.
|
2792 | * @return Returns the expansion coordinates.
|
2793 | * @event
|
2794 | */
|
2795 | onMoveExpansion(nX: number, nY: number, pTarget: Branch): Coordinate;
|
2796 | /**
|
2797 | * Fired when the initiator wants to know if the supplied mouse coordinates
|
2798 | * are within the map.
|
2799 | * @param nX Specifies the horizontal mouse coordinate.
|
2800 | * @param nY Specifies the vertical mouse coordinate.
|
2801 | * @param pTarget Specifies the target resource.
|
2802 | * @return Returns `true` if the mouse is within the branch.
|
2803 | */
|
2804 | onIsMoveIn(nX: number, nY: number, pTarget: Cluster): boolean;
|
2805 | /** Opens the prologue editor. */
|
2806 | prologue(): void;
|
2807 | /** Opens the epilogue editor. */
|
2808 | epilogue(): void;
|
2809 | }
|
2810 | }
|
2811 |
|
2812 | declare module "tripetto/components/map/cluster/layout" {
|
2813 | import { Branch, Cluster, Clusters, Map } from "tripetto/module/map";
|
2814 | import { Coordinate } from "tripetto/module/metrics";
|
2815 | import { IBuilderStyle } from "tripetto/styles/builder";
|
2816 | import { Layer } from "tripetto/module/ui-layers";
|
2817 | import { Map2Layer } from "tripetto/components/map";
|
2818 | import { MoveableLayout } from "tripetto/helpers/layout";
|
2819 | import { TGridRectangles } from "tripetto/module/grid";
|
2820 |
|
2821 | export class ClusterLayout extends MoveableLayout<Map, Cluster, IBuilderStyle> {
|
2822 | |
2823 |
|
2824 |
|
2825 |
|
2826 |
|
2827 |
|
2828 | constructor(pRenderer: Map2Layer, pCluster: Cluster, pLayer: Layer);
|
2829 | /** Returns the cluster layout configuration. */
|
2830 | get configuration(): TGridRectangles;
|
2831 | /** Retrieves a reference to the cluster. */
|
2832 | get cluster(): Cluster;
|
2833 | /** Retrieves a reference to the clusters. */
|
2834 | get clusters(): Clusters | undefined;
|
2835 | /**
|
2836 | * Retrieves the area in which a move can be initiated. In this case the
|
2837 | * cluster header is the only valid area to initiate a cluster move.
|
2838 | */
|
2839 | get moveArea(): Coordinate;
|
2840 | /**
|
2841 | * Draws the cluster.
|
2842 | * @param nLeft Specifies the horizontal position.
|
2843 | * @param nTop Specifies the vertical position.
|
2844 | * @param nWidth Specifies the width.
|
2845 | * @param nHeight Specifies the height.
|
2846 | * @param nZoom Contains the zoom factor.
|
2847 | * @param nZ Specifies the z-index.
|
2848 | * @param bRedraw Specifies if the element is redrawn.
|
2849 | */
|
2850 | protected draw(nLeft: number, nTop: number, nWidth: number, nHeight: number, nZoom: number, nZ: number, bRedraw: boolean): void;
|
2851 | /**
|
2852 | * Fired when the cluster is about to resize.
|
2853 | * @param pRectangles Reference to the cluster rectangles.
|
2854 | */
|
2855 | beforeResize(pRectangles: TGridRectangles): void;
|
2856 | /**
|
2857 | * Sets the dimensions of the layout element.
|
2858 | * @param nWidth Specifies the width.
|
2859 | * @param nHeight Specifies the height.
|
2860 | * @param nZoom Contains the zoom factor.
|
2861 | * @param sWhat Indicates what is changed.
|
2862 | */
|
2863 | resize(nWidth: number, nHeight: number, nZoom: number, sReason: "redraw" | "width" | "height" | "zoom"): void;
|
2864 | /** Draws the connectors. */
|
2865 | connectors(): void;
|
2866 | /**
|
2867 | * Creates cluster guides.
|
2868 | * @event
|
2869 | */
|
2870 | onGuides(): void;
|
2871 | /**
|
2872 | * Invoked when the guides of a rendering are changed.
|
2873 | * @param bVisible Indicates if the guides should be visible.
|
2874 | * @param nLeft Specifies the left coordinate of the guides.
|
2875 | * @param nTop Specifies the top coordinate of the guides.
|
2876 | * @param nWidth Specifies the width of the guides.
|
2877 | * @param nHeight Specifies the height of the guides.
|
2878 | * @param nZoom Specifies the zoom factor of the guides.
|
2879 | * @event
|
2880 | */
|
2881 | onGuidesChange(bVisible: boolean, nLeft: number, nTop: number, nWidth: number, nHeight: number, nZoom: number): void;
|
2882 | /**
|
2883 | * Specifies the expansion coordinates for the move detection. These
|
2884 | * coordinates are applied to the rectangle detection. Use it to
|
2885 | * expand or contract the rectangle.
|
2886 | * @param nX Specifies the horizontal mouse coordinate.
|
2887 | * @param nY Specifies the vertical mouse coordinate.
|
2888 | * @param pTarget Specifies the target resource.
|
2889 | * @return Returns the expansion coordinates.
|
2890 | * @event
|
2891 | */
|
2892 | onMoveExpansion(nX: number, nY: number, pTarget: Branch): Coordinate;
|
2893 | /**
|
2894 | * Fired when the initiator wants to know if the supplied mouse coordinates
|
2895 | * are within the cluster.
|
2896 | * @param nX Specifies the horizontal mouse coordinate.
|
2897 | * @param nY Specifies the vertical mouse coordinate.
|
2898 | * @return Returns `true` if the mouse is within the cluster.
|
2899 | */
|
2900 | onIsMoveIn(nX: number, nY: number, pTarget: Branch): boolean;
|
2901 | /**
|
2902 | * Sets the moving state of a layout.
|
2903 | * @param bMoving Specifies if the layout is moving.
|
2904 | * @return Returns `true` if the state is changed.
|
2905 | */
|
2906 | moving(bMoving: boolean): boolean;
|
2907 | /**
|
2908 | * Sets the following state of a layout.
|
2909 | * @param bFollowing Specifies if the layout is following.
|
2910 | * @return Returns `true` if the state is changed.
|
2911 | */
|
2912 | following(bFollowing: boolean): boolean;
|
2913 | /** Opens the cluster editor. */
|
2914 | edit(): void;
|
2915 | /** Shows the cluster context menu. */
|
2916 | contextMenu(): void;
|
2917 | /** Destroys the layout. */
|
2918 | destroy(): void;
|
2919 | }
|
2920 | }
|
2921 |
|
2922 | declare module "tripetto/components/map/node/layout" {
|
2923 | import { IBuilderStyle } from "tripetto/styles/builder";
|
2924 | import { Layer } from "tripetto/module/ui-layers";
|
2925 | import { Map2Layer } from "tripetto/components/map";
|
2926 | import { MoveableLayout } from "tripetto/helpers/layout";
|
2927 | import { Map, Node, Nodes } from "tripetto/module/map";
|
2928 | import { TGridRectangles } from "tripetto/module/grid";
|
2929 |
|
2930 | export class NodeLayout extends MoveableLayout<Map, Node, IBuilderStyle> {
|
2931 | |
2932 |
|
2933 |
|
2934 |
|
2935 |
|
2936 |
|
2937 | constructor(pRenderer: Map2Layer, pNode: Node, pLayer: Layer);
|
2938 | /** Returns the node layout configuration. */
|
2939 | get configuration(): TGridRectangles;
|
2940 | /** Retrieves a reference to the node. */
|
2941 | get node(): Node;
|
2942 | /** Retrieves a reference to the nodes. */
|
2943 | get nodes(): Nodes | undefined;
|
2944 | /**
|
2945 | * Draws the node.
|
2946 | * @param nLeft Specifies the horizontal position.
|
2947 | * @param nTop Specifies the vertical position.
|
2948 | * @param nWidth Specifies the width.
|
2949 | * @param nHeight Specifies the height.
|
2950 | * @param nZoom Contains the zoom factor.
|
2951 | * @param nZ Specifies the z-index.
|
2952 | * @param bRedraw Specifies if the element is redrawn.
|
2953 | */
|
2954 | protected draw(nLeft: number, nTop: number, nWidth: number, nHeight: number, nZoom: number, nZ: number, bRedraw: boolean): void;
|
2955 | /**
|
2956 | * Fired when the node becomes part of a dispatcher.
|
2957 | * @event
|
2958 | */
|
2959 | onPush(): void;
|
2960 | /**
|
2961 | * Fired when the node becomes the last item.
|
2962 | * @event
|
2963 | */
|
2964 | onLast(): void;
|
2965 | /**
|
2966 | * Creates node guides.
|
2967 | * @event
|
2968 | */
|
2969 | onGuides(): void;
|
2970 | /**
|
2971 | * Invoked when the guides of a rendering are changed.
|
2972 | * @param bVisible Indicates if the guides should be visible.
|
2973 | * @param nLeft Specifies the left coordinate of the guides.
|
2974 | * @param nTop Specifies the top coordinate of the guides.
|
2975 | * @param nWidth Specifies the width of the guides.
|
2976 | * @param nHeight Specifies the height of the guides.
|
2977 | * @param nZoom Specifies the zoom factor of the guides.
|
2978 | * @event
|
2979 | */
|
2980 | onGuidesChange(bVisible: boolean, nLeft: number, nTop: number, nWidth: number, nHeight: number, nZoom: number): void;
|
2981 | /** Opens the node editor. */
|
2982 | edit(): void;
|
2983 | /** Shows the node context menu. */
|
2984 | contextMenu(): void;
|
2985 | /** Destroys the layout. */
|
2986 | destroy(): void;
|
2987 | }
|
2988 | }
|
2989 |
|
2990 | declare module "tripetto/components/map/node/drawing" {
|
2991 |
|
2992 | import { Element } from "tripetto/module/dom";
|
2993 | export interface INodeDrawing {
|
2994 |
|
2995 | icon?: Element;
|
2996 |
|
2997 | label?: Element;
|
2998 |
|
2999 | type?: Element;
|
3000 |
|
3001 | button?: Element;
|
3002 | }
|
3003 | }
|
3004 |
|
3005 | declare module "tripetto/components/map/branch/layout" {
|
3006 |
|
3007 | import { Branch, Branches, Cluster, Condition, Map } from "tripetto/module/map";
|
3008 | import { Coordinate } from "tripetto/module/metrics";
|
3009 | import { IBuilderStyle } from "tripetto/styles/builder";
|
3010 | import { Layer } from "tripetto/module/ui-layers";
|
3011 | import { Map2Layer } from "tripetto/components/map";
|
3012 | import { MoveableLayout } from "tripetto/helpers/layout";
|
3013 | import { TGridRectangles } from "tripetto/module/grid";
|
3014 |
|
3015 | export class BranchLayout extends MoveableLayout<Map, Branch, IBuilderStyle> {
|
3016 | |
3017 |
|
3018 |
|
3019 |
|
3020 |
|
3021 |
|
3022 | constructor(pRenderer: Map2Layer, pBranch: Branch, pLayer: Layer);
|
3023 | /** Returns the branch layout configuration. */
|
3024 | get configuration(): TGridRectangles;
|
3025 | /** Retrieves a reference to the branch. */
|
3026 | get branch(): Branch;
|
3027 | /** Retrieves a reference to the branches. */
|
3028 | get branches(): Branches | undefined;
|
3029 | get x(): number;
|
3030 | get y(): number;
|
3031 | /**
|
3032 | * Specifies the area in which a move can be initiated. In this case the
|
3033 | * branch and condition header is the only valid area to initiate a
|
3034 | * branch move.
|
3035 | */
|
3036 | get moveArea(): Coordinate;
|
3037 | /**
|
3038 | * Draws the branch.
|
3039 | * @param nLeft Specifies the horizontal position.
|
3040 | * @param nTop Specifies the vertical position.
|
3041 | * @param nWidth Specifies the width.
|
3042 | * @param nHeight Specifies the height.
|
3043 | * @param nZoom Contains the zoom factor.
|
3044 | * @param nZ Specifies the z-index.
|
3045 | * @param bRedraw Specifies if the element is redrawn.
|
3046 | */
|
3047 | protected draw(nLeft: number, nTop: number, nWidth: number, nHeight: number, nZoom: number, nZ: number, bRedraw: boolean): void;
|
3048 | /**
|
3049 | * Sets the dimensions of the branch.
|
3050 | * @param nWidth Specifies the width.
|
3051 | * @param nHeight Specifies the height.
|
3052 | * @param nZoom Contains the zoom factor.
|
3053 | * @param sReason Reason for the change.
|
3054 | */
|
3055 | resize(nWidth: number, nHeight: number, nZoom: number, sReason: "redraw" | "width" | "height" | "zoom"): void;
|
3056 | /**
|
3057 | * Fired when the branch becomes the first item.
|
3058 | * @event
|
3059 | */
|
3060 | onFirst(): void;
|
3061 | /**
|
3062 | * Creates the branch guides.
|
3063 | * @event
|
3064 | */
|
3065 | onGuides(): void;
|
3066 | /**
|
3067 | * Invoked when the guides of a rendering is changed.
|
3068 | * @param bVisible Indicates if the guides should be visible.
|
3069 | * @param nLeft Specifies the left coordinate of the guides.
|
3070 | * @param nTop Specifies the top coordinate of the guides.
|
3071 | * @param nWidth Specifies the width of the guides.
|
3072 | * @param nHeight Specifies the height of the guides.
|
3073 | * @param nZoom Specifies the zoom factor of the guides.
|
3074 | * @event
|
3075 | */
|
3076 | onGuidesChange(bVisible: boolean, nLeft: number, nTop: number, nWidth: number, nHeight: number, nZoom: number): void;
|
3077 | /**
|
3078 | * Specifies the expansion coordinates for the move detection. These
|
3079 | * coordinates are applied to the rectangle detection. Use it to
|
3080 | * expand or contract the rectangle.
|
3081 | * @param nX Specifies the horizontal mouse coordinate.
|
3082 | * @param nY Specifies the vertical mouse coordinate.
|
3083 | * @param pTarget Specifies the target resource.
|
3084 | * @return Returns the expansion coordinates.
|
3085 | * @event
|
3086 | */
|
3087 | onMoveExpansion(nX: number, nY: number, pTarget: Branch): Coordinate;
|
3088 | /**
|
3089 | * Fired when the initiator wants to know if the supplied mouse coordinates
|
3090 | * are within the branch.
|
3091 | * @param nX Specifies the horizontal mouse coordinate.
|
3092 | * @param nY Specifies the vertical mouse coordinate.
|
3093 | * @param pTarget Specifies the target resource.
|
3094 | * @return Returns `true` if the mouse is within the branch.
|
3095 | */
|
3096 | onIsMoveIn(nX: number, nY: number, pTarget: Cluster | Condition): boolean;
|
3097 | /**
|
3098 | * Sets the moving state of a branch layout.
|
3099 | * @param bMoving Specifies if the layout is moving.
|
3100 | * @return Returns `true` if the state is changed.
|
3101 | */
|
3102 | moving(bMoving: boolean): boolean;
|
3103 | /** Opens the branch edtior. */
|
3104 | edit(): void;
|
3105 | /** Shows the branch context menu. */
|
3106 | contextMenu(): void;
|
3107 | /** Shows the culling context menu. */
|
3108 | cullingMenu(): void;
|
3109 | /** Shows the terminator context menu. */
|
3110 | terminatorMenu(): void;
|
3111 | /** Opens the epilogue editor. */
|
3112 | epilogue(): void;
|
3113 | /** Destroys the layout. */
|
3114 | destroy(): void;
|
3115 | }
|
3116 | }
|
3117 |
|
3118 | declare module "tripetto/components/map/condition/layout" {
|
3119 |
|
3120 | import { Condition, Conditions, Map } from "tripetto/module/map";
|
3121 | import { IBuilderStyle } from "tripetto/styles/builder";
|
3122 | import { Layer } from "tripetto/module/ui-layers";
|
3123 | import { Map2Layer } from "tripetto/components/map";
|
3124 | import { MoveableLayout } from "tripetto/helpers/layout";
|
3125 | import { TGridRectangles } from "tripetto/module/grid";
|
3126 |
|
3127 | export class ConditionLayout extends MoveableLayout<Map, Condition, IBuilderStyle> {
|
3128 | |
3129 |
|
3130 |
|
3131 |
|
3132 |
|
3133 |
|
3134 | constructor(pRenderer: Map2Layer, pCondition: Condition, pLayer: Layer);
|
3135 | /** Returns the condition layout configuration. */
|
3136 | get configuration(): TGridRectangles;
|
3137 | /** Retrieves a reference to the condition. */
|
3138 | get condition(): Condition;
|
3139 | /** Retrieves a reference to the conditions. */
|
3140 | get conditions(): Conditions | undefined;
|
3141 | get x(): number;
|
3142 | get y(): number;
|
3143 | /**
|
3144 | * Draws the condition.
|
3145 | * @param nLeft Specifies the horizontal position.
|
3146 | * @param nTop Specifies the vertical position.
|
3147 | * @param nWidth Specifies the width.
|
3148 | * @param nHeight Specifies the height.
|
3149 | * @param nZoom Contains the zoom factor.
|
3150 | * @param nZ Specifies the z-index.
|
3151 | * @param bRedraw Specifies if the element is redrawn.
|
3152 | */
|
3153 | protected draw(nLeft: number, nTop: number, nWidth: number, nHeight: number, nZoom: number, nZ: number, bRedraw: boolean): void;
|
3154 | /**
|
3155 | * Fired when the condition becomes part of a dispatcher.
|
3156 | * @event
|
3157 | */
|
3158 | onPush(): void;
|
3159 | /**
|
3160 | * Fired when the condition becomes the last item.
|
3161 | * @event
|
3162 | */
|
3163 | onLast(): void;
|
3164 | /**
|
3165 | * Creates condition guides.
|
3166 | * @event
|
3167 | */
|
3168 | onGuides(): void;
|
3169 | /**
|
3170 | * Invoked when the guides of a rendering are changed.
|
3171 | * @param bVisible Indicates if the guides should be visible.
|
3172 | * @param nLeft Specifies the left coordinate of the guides.
|
3173 | * @param nTop Specifies the top coordinate of the guides.
|
3174 | * @param nWidth Specifies the width of the guides.
|
3175 | * @param nHeight Specifies the height of the guides.
|
3176 | * @param nZoom Specifies the zoom factor of the guides.
|
3177 | * @event
|
3178 | */
|
3179 | onGuidesChange(bVisible: boolean, nLeft: number, nTop: number, nWidth: number, nHeight: number, nZoom: number): void;
|
3180 | /** Opens the condition editor. */
|
3181 | edit(): void;
|
3182 | /** Shows the node context menu. */
|
3183 | contextMenu(): void;
|
3184 | /** Destroys the layout. */
|
3185 | destroy(): void;
|
3186 | }
|
3187 | }
|
3188 |
|
3189 | declare module "tripetto/components/map/condition/drawing" {
|
3190 |
|
3191 | import { Element } from "tripetto/module/dom";
|
3192 | export interface IConditionDrawing {
|
3193 |
|
3194 | icon?: Element;
|
3195 |
|
3196 | text?: Element;
|
3197 |
|
3198 | name?: Element;
|
3199 |
|
3200 | label?: Element;
|
3201 |
|
3202 | button?: Element;
|
3203 | }
|
3204 | }
|
3205 |
|
3206 | declare module "tripetto/components/controller/collection/style" {
|
3207 |
|
3208 | import { IStyles } from "tripetto/module/dom";
|
3209 | import { IToolbarItemStyle, IToolbarMenuStyle, IToolbarStyle } from "tripetto/module/ui-toolbar";
|
3210 | import { IListStyle } from "tripetto/module/ui-list";
|
3211 | export interface ICollectionStyle {
|
3212 | appearance?: IStyles;
|
3213 | header: {
|
3214 | height: number;
|
3215 | style: IToolbarStyle;
|
3216 | title: IToolbarItemStyle;
|
3217 | menu: IToolbarMenuStyle;
|
3218 | import: IToolbarItemStyle;
|
3219 | splitter: IToolbarItemStyle;
|
3220 | };
|
3221 | list: IListStyle;
|
3222 | footer: {
|
3223 | height: number;
|
3224 | style: IToolbarStyle;
|
3225 | add: IToolbarItemStyle;
|
3226 | };
|
3227 | assets: {
|
3228 | menu: string;
|
3229 | };
|
3230 | unnamedIcon: string;
|
3231 | }
|
3232 | }
|
3233 |
|
3234 | declare module "tripetto/components/map/branch/style" {
|
3235 |
|
3236 | import { SVGImage } from "tripetto/helpers/svg";
|
3237 | import { IStyles } from "tripetto/module/dom";
|
3238 | export interface IBranchStyle {
|
3239 |
|
3240 | width: number;
|
3241 |
|
3242 | left: number;
|
3243 |
|
3244 | top: number;
|
3245 |
|
3246 | appearance: IStyles;
|
3247 |
|
3248 | moving?: IStyles;
|
3249 |
|
3250 | following?: IStyles;
|
3251 |
|
3252 | ensuing?: IStyles;
|
3253 |
|
3254 | culling: {
|
3255 |
|
3256 | width: number;
|
3257 |
|
3258 | height: number;
|
3259 |
|
3260 | first: {
|
3261 |
|
3262 | icon: SVGImage;
|
3263 |
|
3264 | image: SVGImage;
|
3265 |
|
3266 | hover?: SVGImage;
|
3267 |
|
3268 | tap?: SVGImage;
|
3269 |
|
3270 | selected?: SVGImage;
|
3271 |
|
3272 | guide?: SVGImage;
|
3273 | };
|
3274 |
|
3275 | each: {
|
3276 |
|
3277 | icon: SVGImage;
|
3278 |
|
3279 | image: SVGImage;
|
3280 |
|
3281 | hover?: SVGImage;
|
3282 |
|
3283 | tap?: SVGImage;
|
3284 |
|
3285 | selected?: SVGImage;
|
3286 |
|
3287 | guide?: SVGImage;
|
3288 | };
|
3289 |
|
3290 | all: {
|
3291 |
|
3292 | icon: SVGImage;
|
3293 |
|
3294 | image: SVGImage;
|
3295 |
|
3296 | hover?: SVGImage;
|
3297 |
|
3298 | tap?: SVGImage;
|
3299 |
|
3300 | selected?: SVGImage;
|
3301 |
|
3302 | guide?: SVGImage;
|
3303 | };
|
3304 |
|
3305 | none: {
|
3306 |
|
3307 | icon: SVGImage;
|
3308 |
|
3309 | image: SVGImage;
|
3310 |
|
3311 | hover?: SVGImage;
|
3312 |
|
3313 | tap?: SVGImage;
|
3314 |
|
3315 | selected?: SVGImage;
|
3316 |
|
3317 | guide?: SVGImage;
|
3318 | };
|
3319 | };
|
3320 |
|
3321 | junction: {
|
3322 |
|
3323 | width: number;
|
3324 |
|
3325 | height: number;
|
3326 |
|
3327 | size: number;
|
3328 |
|
3329 | image: SVGImage;
|
3330 |
|
3331 | hover?: SVGImage;
|
3332 |
|
3333 | tap?: SVGImage;
|
3334 |
|
3335 | selected?: SVGImage;
|
3336 |
|
3337 | guide?: SVGImage;
|
3338 | };
|
3339 |
|
3340 | header: {
|
3341 |
|
3342 | height: number;
|
3343 |
|
3344 | appearance: IStyles;
|
3345 |
|
3346 | label: {
|
3347 |
|
3348 | appearance: IStyles;
|
3349 |
|
3350 | named: IStyles;
|
3351 | };
|
3352 |
|
3353 | button: {
|
3354 |
|
3355 | appearance: IStyles;
|
3356 |
|
3357 | hover: IStyles;
|
3358 |
|
3359 | tap: IStyles;
|
3360 |
|
3361 | selected: IStyles;
|
3362 | };
|
3363 | };
|
3364 |
|
3365 | footer: {
|
3366 |
|
3367 | height: number;
|
3368 |
|
3369 | appearance: IStyles;
|
3370 |
|
3371 | hover: IStyles;
|
3372 |
|
3373 | tap: IStyles;
|
3374 |
|
3375 | selected: IStyles;
|
3376 | };
|
3377 |
|
3378 | terminators: {
|
3379 |
|
3380 | width: number;
|
3381 |
|
3382 | height: number;
|
3383 |
|
3384 | continuous: {
|
3385 |
|
3386 | image: SVGImage;
|
3387 |
|
3388 | hover?: SVGImage;
|
3389 |
|
3390 | tap?: SVGImage;
|
3391 |
|
3392 | selected?: SVGImage;
|
3393 |
|
3394 | guide?: SVGImage;
|
3395 | };
|
3396 |
|
3397 | jump: {
|
3398 |
|
3399 | image: SVGImage;
|
3400 |
|
3401 | hover?: SVGImage;
|
3402 |
|
3403 | tap?: SVGImage;
|
3404 |
|
3405 | selected?: SVGImage;
|
3406 |
|
3407 | guide?: SVGImage;
|
3408 | };
|
3409 |
|
3410 | abort: {
|
3411 |
|
3412 | image: SVGImage;
|
3413 |
|
3414 | hover?: SVGImage;
|
3415 |
|
3416 | tap?: SVGImage;
|
3417 |
|
3418 | selected?: SVGImage;
|
3419 |
|
3420 | guide?: SVGImage;
|
3421 | };
|
3422 |
|
3423 | epilogue: {
|
3424 |
|
3425 | image: SVGImage;
|
3426 |
|
3427 | hover?: SVGImage;
|
3428 |
|
3429 | tap?: SVGImage;
|
3430 |
|
3431 | selected?: SVGImage;
|
3432 |
|
3433 | guide?: SVGImage;
|
3434 | };
|
3435 | };
|
3436 |
|
3437 | guides?: {
|
3438 |
|
3439 | appearance: IStyles;
|
3440 |
|
3441 | visible: IStyles;
|
3442 |
|
3443 | invisible: IStyles;
|
3444 | };
|
3445 | }
|
3446 | }
|
3447 |
|
3448 | declare module "tripetto/components/map/cluster/style" {
|
3449 |
|
3450 | import { SVGImage } from "tripetto/helpers/svg";
|
3451 | import { IStyles } from "tripetto/module/dom";
|
3452 | export interface IClusterStyle {
|
3453 |
|
3454 | width: number;
|
3455 |
|
3456 | borderSize: number;
|
3457 |
|
3458 | junction: {
|
3459 |
|
3460 | width: number;
|
3461 |
|
3462 | height: number;
|
3463 |
|
3464 | left: number;
|
3465 |
|
3466 | top: number;
|
3467 |
|
3468 | size: number;
|
3469 |
|
3470 | image: SVGImage;
|
3471 |
|
3472 | hover?: SVGImage;
|
3473 |
|
3474 | tap?: SVGImage;
|
3475 |
|
3476 | selected?: SVGImage;
|
3477 |
|
3478 | guide?: SVGImage;
|
3479 | };
|
3480 |
|
3481 | appearance: IStyles;
|
3482 |
|
3483 | moving?: IStyles;
|
3484 |
|
3485 | following?: IStyles;
|
3486 |
|
3487 | ensuing?: IStyles;
|
3488 |
|
3489 | header: {
|
3490 |
|
3491 | height: number;
|
3492 |
|
3493 | appearance: IStyles;
|
3494 |
|
3495 | label: {
|
3496 |
|
3497 | appearance: IStyles;
|
3498 |
|
3499 | named: IStyles;
|
3500 | };
|
3501 |
|
3502 | button: {
|
3503 |
|
3504 | appearance: IStyles;
|
3505 |
|
3506 | hover: IStyles;
|
3507 |
|
3508 | tap: IStyles;
|
3509 |
|
3510 | selected: IStyles;
|
3511 | };
|
3512 | };
|
3513 |
|
3514 | footer: {
|
3515 |
|
3516 | height: number;
|
3517 |
|
3518 | appearance: IStyles;
|
3519 |
|
3520 | hover: IStyles;
|
3521 |
|
3522 | tap: IStyles;
|
3523 | };
|
3524 |
|
3525 | branch:
|
3526 | | {
|
3527 | enabled: true;
|
3528 |
|
3529 | width: number;
|
3530 |
|
3531 | height: number;
|
3532 |
|
3533 | size: number;
|
3534 |
|
3535 | image: SVGImage;
|
3536 |
|
3537 | hover?: SVGImage;
|
3538 |
|
3539 | tap?: SVGImage;
|
3540 |
|
3541 | selected?: SVGImage;
|
3542 | }
|
3543 | | {
|
3544 | enabled: false;
|
3545 | };
|
3546 |
|
3547 | guides?: {
|
3548 |
|
3549 | appearance: IStyles;
|
3550 |
|
3551 | visible: IStyles;
|
3552 |
|
3553 | invisible: IStyles;
|
3554 | };
|
3555 | }
|
3556 | }
|
3557 |
|
3558 | declare module "tripetto/components/map/node/style" {
|
3559 |
|
3560 | import { IStyles } from "tripetto/module/dom";
|
3561 | export interface INodeStyle {
|
3562 |
|
3563 | width: number;
|
3564 |
|
3565 | height: number;
|
3566 |
|
3567 | appearance: IStyles;
|
3568 |
|
3569 | named?: IStyles;
|
3570 |
|
3571 | required?: IStyles;
|
3572 |
|
3573 | moving?: IStyles;
|
3574 |
|
3575 | following?: IStyles;
|
3576 |
|
3577 | ensuing?: IStyles;
|
3578 |
|
3579 | disabled: IStyles;
|
3580 |
|
3581 | icon: {
|
3582 | color: string;
|
3583 | appearance: IStyles;
|
3584 | required?: IStyles;
|
3585 | };
|
3586 |
|
3587 | label: {
|
3588 | appearance: IStyles;
|
3589 | variable?: IStyles;
|
3590 | named?: IStyles;
|
3591 | required?: IStyles;
|
3592 | };
|
3593 |
|
3594 | type: IStyles;
|
3595 |
|
3596 | button: {
|
3597 | appearance: IStyles;
|
3598 | hover?: IStyles;
|
3599 | tap?: IStyles;
|
3600 | selected?: IStyles;
|
3601 | };
|
3602 |
|
3603 | separator: {
|
3604 | between: string;
|
3605 | last: string;
|
3606 | };
|
3607 |
|
3608 | guides?: {
|
3609 |
|
3610 | appearance: IStyles;
|
3611 |
|
3612 | visible: IStyles;
|
3613 |
|
3614 | invisible: IStyles;
|
3615 | };
|
3616 | }
|
3617 | }
|
3618 |
|
3619 | declare module "tripetto/components/map/condition/style" {
|
3620 |
|
3621 | import { IStyles } from "tripetto/module/dom";
|
3622 | export interface IConditionStyle {
|
3623 |
|
3624 | width: number;
|
3625 |
|
3626 | height: number;
|
3627 |
|
3628 | appearance: IStyles;
|
3629 |
|
3630 | moving?: IStyles;
|
3631 |
|
3632 | following?: IStyles;
|
3633 |
|
3634 | ensuing?: IStyles;
|
3635 |
|
3636 | disabled: IStyles;
|
3637 |
|
3638 | named?: IStyles;
|
3639 |
|
3640 | icon: {
|
3641 | color: string;
|
3642 | appearance: IStyles;
|
3643 | };
|
3644 |
|
3645 | text: {
|
3646 | appearance: IStyles;
|
3647 | named?: IStyles;
|
3648 | name?: IStyles;
|
3649 | label?: IStyles;
|
3650 | variable?: IStyles;
|
3651 | };
|
3652 |
|
3653 | button: {
|
3654 | appearance: IStyles;
|
3655 | hover?: IStyles;
|
3656 | tap?: IStyles;
|
3657 | selected?: IStyles;
|
3658 | };
|
3659 |
|
3660 | separator: {
|
3661 | between: string;
|
3662 | last: string;
|
3663 | };
|
3664 |
|
3665 | guides?: {
|
3666 |
|
3667 | appearance: IStyles;
|
3668 |
|
3669 | visible: IStyles;
|
3670 |
|
3671 | invisible: IStyles;
|
3672 | };
|
3673 | }
|
3674 | }
|
3675 |
|
3676 | declare module "tripetto/module/aes" {
|
3677 | |
3678 |
|
3679 |
|
3680 |
|
3681 |
|
3682 |
|
3683 |
|
3684 |
|
3685 |
|
3686 | export function encrypt(data: string, password: string, bits: 128 | 192 | 256, btoa: (input: string) => string): string;
|
3687 | |
3688 |
|
3689 |
|
3690 |
|
3691 |
|
3692 |
|
3693 |
|
3694 |
|
3695 | export function decrypt(data: string, password: string, bits: 128 | 192 | 256, atob: (input: string) => string): string;
|
3696 | }
|
3697 |
|
3698 | declare module "tripetto/module/callback" {
|
3699 | |
3700 |
|
3701 |
|
3702 |
|
3703 | export type TCallbackAwait<T> = (pCallback: Callback<T>) => T | Callback<T>;
|
3704 | |
3705 |
|
3706 |
|
3707 |
|
3708 | export type TPromise<T> = ((pPromise: ICallbackPromise<T>) => void) | undefined;
|
3709 | /** Defines the promise interface. */
|
3710 | export interface ICallbackPromise<T> {
|
3711 | /** Specifies if the await was asynchronous. */
|
3712 | readonly isAsynchronous: boolean;
|
3713 | /** Specifies if the await was canceled. */
|
3714 | readonly isCanceled: boolean;
|
3715 | /** Specifies the payload which is returned. */
|
3716 | readonly payload: T | undefined;
|
3717 | }
|
3718 | /** Defines the callback properties interface. */
|
3719 | export interface ICallbackProperties<T> {
|
3720 | /** Specifies the await function. */
|
3721 | readonly await: TCallbackAwait<T>;
|
3722 | /** Specifies the promise function. */
|
3723 | readonly promise: TPromise<T>;
|
3724 | /**
|
3725 | * Specifies if the callback is conditional. In this case the callback
|
3726 | * condition must be set to true before a callback is accepted. The callback
|
3727 | * condition can only be used for asynchronous callbacks.
|
3728 | */
|
3729 | readonly conditional?: boolean;
|
3730 | /**
|
3731 | * Specifies if the callback should be continuous. The callback property
|
3732 | * `Payload` or function `done()` can be called multiple times.
|
3733 | */
|
3734 | readonly continuous?: boolean;
|
3735 | }
|
3736 | export class Callback<T> {
|
3737 | /**
|
3738 | * Callback template of specified type.
|
3739 | * @param pProperties Specifies the callback properties.
|
3740 | * @return Returns a reference to the callback.
|
3741 | */
|
3742 | static of<Type>(pProperties: ICallbackProperties<Type>): Callback<Type>;
|
3743 | /**
|
3744 | * Creates a new callback.
|
3745 | * @param pProperties Specifies the callback properties.
|
3746 | */
|
3747 | constructor(pProperties: ICallbackProperties<T>);
|
3748 | /** Retrieves the callback condition state. */
|
3749 | get condition(): boolean;
|
3750 | /** Sets the callback condition state. */
|
3751 | set condition(bCondition: boolean);
|
3752 | /** Verifies if the callback pointer is alive and still usable. */
|
3753 | get isAlive(): boolean;
|
3754 | /** Retrieves the promise invoke count. */
|
3755 | get promiseCount(): number;
|
3756 | /**
|
3757 | * Terminates the callback.
|
3758 | * @return Returns `true` if the callback loop is terminated.
|
3759 | */
|
3760 | protected terminate(): boolean;
|
3761 | /**
|
3762 | * Cancels the callback loop.
|
3763 | * @return Returns `true` if the callback loop is terminated.
|
3764 | */
|
3765 | cancel(): boolean;
|
3766 | /** Sets the return payload of the callback function. */
|
3767 | return(pPayload: T | undefined): T | undefined;
|
3768 | }
|
3769 | /**
|
3770 | * Type alias for the await function.
|
3771 | * @param TAwait.pAwait Reference to the await.
|
3772 | */
|
3773 | export type TAwait = (pAwait: Await) => void | Await;
|
3774 |
|
3775 | export interface IAwaitPromise extends ICallbackPromise<void> {}
|
3776 |
|
3777 | export interface IAwaitProperties {
|
3778 |
|
3779 | readonly await: TAwait;
|
3780 |
|
3781 | readonly promise: TPromise<void>;
|
3782 | |
3783 |
|
3784 |
|
3785 |
|
3786 |
|
3787 | readonly conditional?: boolean;
|
3788 | |
3789 |
|
3790 |
|
3791 |
|
3792 | readonly continuous?: boolean;
|
3793 | }
|
3794 | export class Await extends Callback<void> {
|
3795 | |
3796 |
|
3797 |
|
3798 |
|
3799 |
|
3800 | static for(pProperties: IAwaitProperties): Await;
|
3801 | |
3802 |
|
3803 |
|
3804 |
|
3805 | constructor(pProperties: IAwaitProperties);
|
3806 | /**
|
3807 | * Terminates the await.
|
3808 | * @return Returns `true` if the await loop is terminated.
|
3809 | */
|
3810 | done(): boolean;
|
3811 | }
|
3812 | }
|
3813 |
|
3814 | declare module "tripetto/module/dom" {
|
3815 | import { IObject, TLimiterType } from "tripetto/module/functional";
|
3816 | import { MarkdownFeatures, MarkdownParser, MarkdownTypes } from "tripetto/module/markdown";
|
3817 | import { Coordinate, IPoint, Rectangle as Rect } from "tripetto/module/metrics";
|
3818 |
|
3819 | export type TDOMElement = HTMLElement | Element | Document | DocumentFragment | Window | string | undefined | null;
|
3820 | export class DOMElement {
|
3821 | |
3822 |
|
3823 |
|
3824 |
|
3825 |
|
3826 |
|
3827 |
|
3828 |
|
3829 | static data(pAsset: HTMLElement | undefined, sName: string, sValue?: string): string;
|
3830 | |
3831 |
|
3832 |
|
3833 |
|
3834 |
|
3835 |
|
3836 | static destroyData(pAsset: HTMLElement | undefined, sName: string): void;
|
3837 | |
3838 |
|
3839 |
|
3840 |
|
3841 |
|
3842 |
|
3843 |
|
3844 |
|
3845 |
|
3846 |
|
3847 |
|
3848 | static attribute(pAsset: HTMLElement | undefined, sName: string, sValue?: string): string;
|
3849 | |
3850 |
|
3851 |
|
3852 |
|
3853 |
|
3854 |
|
3855 |
|
3856 |
|
3857 | static destroyAttribute(pAsset: HTMLElement | undefined, sName: string): void;
|
3858 | |
3859 |
|
3860 |
|
3861 |
|
3862 |
|
3863 | static isInDOM(pAsset: HTMLElement | undefined | null): boolean;
|
3864 | |
3865 |
|
3866 |
|
3867 |
|
3868 |
|
3869 |
|
3870 | static isEqual(pAssetA: DOMElement | HTMLElement | null, pAssetB: DOMElement | HTMLElement | null): boolean;
|
3871 | |
3872 |
|
3873 |
|
3874 |
|
3875 |
|
3876 |
|
3877 | static $(pAsset: DOMElement | TDOMElement): HTMLElement | undefined;
|
3878 | |
3879 |
|
3880 |
|
3881 |
|
3882 |
|
3883 | static $ignature(pAsset: DOMElement | TDOMElement): string;
|
3884 | |
3885 |
|
3886 |
|
3887 |
|
3888 |
|
3889 |
|
3890 | static removeChildren(pAsset: HTMLElement | undefined): void;
|
3891 | |
3892 |
|
3893 |
|
3894 |
|
3895 |
|
3896 |
|
3897 | static destroyChildren(pAsset: HTMLElement | undefined): void;
|
3898 | |
3899 |
|
3900 |
|
3901 |
|
3902 |
|
3903 |
|
3904 |
|
3905 |
|
3906 | static destroy(pAsset: HTMLElement | undefined, bTidy?: boolean, fnDone?: () => void): void;
|
3907 | |
3908 |
|
3909 |
|
3910 |
|
3911 | protected constructor(pAsset: DOMElement | TDOMElement);
|
3912 | /** Returns the unique identifier for the asset. */
|
3913 | get id(): number;
|
3914 | /**
|
3915 | * Returns a unique hash for the asset. When you invoke this property the
|
3916 | * returned hash string is set as element id so you can use it to reference
|
3917 | * the element.
|
3918 | */
|
3919 | get hash(): string;
|
3920 | /** Returns the DOM HTML element. */
|
3921 | get HTMLElement(): HTMLElement | undefined;
|
3922 | /** Retrieves if the asset exists. */
|
3923 | get exists(): boolean;
|
3924 | /** Retrieves if the asset is part of the DOM. */
|
3925 | get isInDOM(): boolean;
|
3926 | /** Retrieves the parent asset. */
|
3927 | get parent(): DOMElement | undefined;
|
3928 | /** Retrieves the first child of the asset. */
|
3929 | get firstChild(): DOMElement | undefined;
|
3930 | /** Retrieves the number of child assets. */
|
3931 | get childCount(): number;
|
3932 | /** Retrieves the element depth in the DOM. Returns `-1` if the element is not in the DOM. */
|
3933 | get depth(): number;
|
3934 | /** Retrieves the tag name of the asset. */
|
3935 | get tagName(): string;
|
3936 | /** Retrieves a drawing context on the canvas of the asset. */
|
3937 | get canvas(): CanvasRenderingContext2D | undefined;
|
3938 | /**
|
3939 | * Sets or retrieves the specified data attribute.
|
3940 | * @param sName Specifies the data name.
|
3941 | * @param sValue Optional data.
|
3942 | * @return Returns the data value.
|
3943 | * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dataset
|
3944 | */
|
3945 | data(sName: string, sValue?: string): string;
|
3946 | /**
|
3947 | * Destroys the specified data attribute.
|
3948 | * @param sName Specifies the data name.
|
3949 | * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dataset
|
3950 | */
|
3951 | destroyData(sName: string): void;
|
3952 | /**
|
3953 | * Sets or retrieves the specified attribute.
|
3954 | * @param sName Specifies the attribute name.
|
3955 | * @param sValue Optional value for the attribute.
|
3956 | * @return Returns the attribute value.
|
3957 | * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getAttribute
|
3958 | * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.setAttribute
|
3959 | */
|
3960 | attribute(sName: string, sValue?: string): string;
|
3961 | /**
|
3962 | * Destroys the specified attribute.
|
3963 | * @param sName Specifies the attribute name.
|
3964 | * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.removeAttribute
|
3965 | */
|
3966 | destroyAttribute(sName: string): void;
|
3967 | /**
|
3968 | * Verifies if the supplied asset is equal to the asset.
|
3969 | * @param pAsset Specifies the asset to compare.
|
3970 | * @return Returns `true` if the assets are equal.
|
3971 | */
|
3972 | isEqual(pAsset: DOMElement | HTMLElement | null): boolean;
|
3973 | /**
|
3974 | * Verifies if the supplied asset is the parent of the current asset.
|
3975 | * @param pAsset Specifies the child asset.
|
3976 | * @return Returns `true` if the asset is the parent of the supplied asset.
|
3977 | */
|
3978 | isParentOf(pAsset: DOMElement | HTMLElement): boolean;
|
3979 | /**
|
3980 | * Verifies if the supplied asset is a child of the current asset.
|
3981 | * @param pAsset Specifies the parent asset.
|
3982 | * @return Returns `true` if the asset us a child of the supplied asset.
|
3983 | */
|
3984 | isChildOf(pAsset: DOMElement | HTMLElement): boolean;
|
3985 | /**
|
3986 | * Retrieves the HTML element and cast to a certain type.
|
3987 | * @return Returns the HTML element as type `T`.
|
3988 | */
|
3989 | HTMLElementOfType<T extends HTMLElement>(): T | undefined;
|
3990 | /**
|
3991 | * Destroys the instance.
|
3992 | * @return Returns a reference to the asset in the DOM.
|
3993 | */
|
3994 | destroy(): HTMLElement | undefined;
|
3995 | }
|
3996 | export interface IEventProperties {
|
3997 |
|
3998 | readonly capture?: boolean;
|
3999 | |
4000 |
|
4001 |
|
4002 |
|
4003 |
|
4004 | readonly passive?: boolean;
|
4005 |
|
4006 | readonly stopPropagation?: boolean;
|
4007 | |
4008 |
|
4009 |
|
4010 |
|
4011 | readonly sequencer?: "read" | "write" | "write-after-read" | "write-thorough";
|
4012 |
|
4013 | readonly limiter?: TLimiterType;
|
4014 |
|
4015 | readonly timeout?: number;
|
4016 |
|
4017 | readonly overwrite?: boolean;
|
4018 |
|
4019 | readonly noOverwrite?: boolean;
|
4020 | }
|
4021 | export type TEventListener<T extends Event> = (pEvent: T) => void;
|
4022 | export class EventListeners extends DOMElement {
|
4023 |
|
4024 | static get isPassiveSupported(): boolean;
|
4025 |
|
4026 | |
4027 |
|
4028 |
|
4029 |
|
4030 |
|
4031 |
|
4032 |
|
4033 |
|
4034 |
|
4035 | static attachListener<T extends Event>(
|
4036 | pAsset: TDOMElement | DOMElement,
|
4037 | pEvents: string | string[],
|
4038 | fnCallee: TEventListener<T>,
|
4039 | pProperties?: IEventProperties,
|
4040 | pThis?: IObject
|
4041 | ): boolean;
|
4042 | |
4043 |
|
4044 |
|
4045 |
|
4046 |
|
4047 |
|
4048 |
|
4049 |
|
4050 | static detachListener(pAsset: TDOMElement | DOMElement, pEvents: string | string[], pThis?: IObject): boolean;
|
4051 | |
4052 |
|
4053 |
|
4054 |
|
4055 | static stopPropagation(pEvent: Event): void;
|
4056 | |
4057 |
|
4058 |
|
4059 |
|
4060 | protected constructor(pAsset: EventListeners | TDOMElement);
|
4061 | /**
|
4062 | * Attaches one or more event handlers to the asset.
|
4063 | *
|
4064 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout.</i></span>
|
4065 | * @param pEvents Specifies the event or an array with events to attach to.
|
4066 | * @param fnCallee Specifies the event handler function.
|
4067 | * @param pProperties Specifies event properties.
|
4068 | * @return Returns true if the function succeeded.
|
4069 | */
|
4070 | on<T extends Event>(pEvents: string | string[], fnCallee: TEventListener<T>, pProperties?: IEventProperties): boolean;
|
4071 | /**
|
4072 | * Detaches one or more event handlers from the asset.
|
4073 | * @param pEvents Specifies the event or an array with events to detach from.
|
4074 | */
|
4075 | off(pEvents: string | string[]): void;
|
4076 | /**
|
4077 | * Verifies if the supplied event is attached.
|
4078 | * @param sEvent Specifies the event to verify.
|
4079 | * @return Returns `true` if the event is attached.
|
4080 | */
|
4081 | listensTo(sEvent: string): boolean;
|
4082 | /**
|
4083 | * Destroys the instance.
|
4084 | * @return Returns a reference to the asset in the DOM.
|
4085 | */
|
4086 | destroy(): HTMLElement | undefined;
|
4087 | }
|
4088 | /** Declares the style property value type. */
|
4089 | export type TStyleProperty = string | string[] | number | number[];
|
4090 | /** Declares the styles array type. */
|
4091 | export type TStylesArray = (IStyleProperties | IStyles | undefined)[];
|
4092 | /** Declares the style properties array type. */
|
4093 | export type TStylePropertiesArray = (IStyleProperties | undefined)[];
|
4094 | /** Describes the styles interface. */
|
4095 | export interface IStyles extends IStyleProperties {
|
4096 | [selector: string]: IStyles | TStyleProperty | undefined;
|
4097 | }
|
4098 |
|
4099 | export interface IStyleProperties {
|
4100 | alignContent?:
|
4101 | | "stretch"
|
4102 | | "center"
|
4103 | | "flex-start"
|
4104 | | "flex-end"
|
4105 | | "space-between"
|
4106 | | "space-around"
|
4107 | | "inherit"
|
4108 | | "initial"
|
4109 | | "unset";
|
4110 | alignItems?: "stretch" | "center" | "flex-start" | "flex-end" | "baseline" | "inherit" | "initial" | "unset";
|
4111 | alignSelf?: "auto" | "stretch" | "center" | "flex-start" | "flex-end" | "baseline" | "inherit" | "initial" | "unset";
|
4112 | alignmentBaseline?:
|
4113 | | "auto"
|
4114 | | "baseline"
|
4115 | | "before-edge"
|
4116 | | "text-before-edge"
|
4117 | | "middle"
|
4118 | | "central"
|
4119 | | "after-edge"
|
4120 | | "text-after-edge"
|
4121 | | "ideographic"
|
4122 | | "alphabetic"
|
4123 | | "hanging"
|
4124 | | "mathematical"
|
4125 | | "inherit";
|
4126 | animation?: string | string[];
|
4127 | animationDelay?: string;
|
4128 | animationDirection?: "normal" | "reverse" | "alternate" | "alternate-reverse" | "inherit" | "initial" | "unset";
|
4129 | animationDuration?: string;
|
4130 | animationFillMode?: "none" | "forwards" | "backwards" | "both" | "inherit" | "initial" | "unset";
|
4131 | animationIterationCount?: string;
|
4132 | animationName?: string;
|
4133 | animationPlayState?: "paused" | "running" | "inherit" | "initial" | "unset";
|
4134 | animationTimingFunction?:
|
4135 | | "linear"
|
4136 | | "ease"
|
4137 | | "ease-in"
|
4138 | | "ease-out"
|
4139 | | "ease-in-out"
|
4140 | | "step-start"
|
4141 | | "step-end"
|
4142 | | string
|
4143 | | "inherit"
|
4144 | | "initial"
|
4145 | | "unset";
|
4146 | backdropFilter?: string | "none" | "inherit" | "initial" | "unset";
|
4147 | backfaceVisibility?: "visible" | "hidden" | "inherit" | "initial" | "unset";
|
4148 | background?: string | string[];
|
4149 | backgroundAttachment?: "scroll" | "fixed" | "local" | "inherit" | string[];
|
4150 | backgroundClip?: "border-box" | "padding-box" | "content-box" | "inherit" | "initial" | "unset";
|
4151 | backgroundColor?: string;
|
4152 | backgroundImage?: string | string[];
|
4153 | backgroundOrigin?: "border-box" | "padding-box" | "content-box" | "inherit" | "initial" | "unset" | string[];
|
4154 | backgroundPosition?: string | string[];
|
4155 | backgroundPositionX?: string | string[];
|
4156 | backgroundPositionY?: string | string[];
|
4157 | backgroundRepeat?: "repeat" | "repeat-x" | "repeat-y" | "no-repeat" | "inherit" | "initial" | "unset" | string[];
|
4158 | backgroundSize?: string | string[];
|
4159 | baselineShift?: "auto" | "baseline" | "super" | "sub" | string | "inherit";
|
4160 | border?: string;
|
4161 | borderBottom?: string;
|
4162 | borderBottomColor?: string;
|
4163 | borderBottomLeftRadius?: string | number;
|
4164 | borderBottomRightRadius?: string | number;
|
4165 | borderBottomStyle?:
|
4166 | | "none"
|
4167 | | "hidden"
|
4168 | | "dotted"
|
4169 | | "dashed"
|
4170 | | "solid"
|
4171 | | "double"
|
4172 | | "groove"
|
4173 | | "ridge"
|
4174 | | "inset"
|
4175 | | "outset"
|
4176 | | "inherit"
|
4177 | | "initial"
|
4178 | | "unset";
|
4179 | borderBottomWidth?: string | number;
|
4180 | borderCollapse?: "collapse" | "separate" | "inherit";
|
4181 | borderColor?: string;
|
4182 | borderImage?: string;
|
4183 | borderImageOutset?: string;
|
4184 | borderImageRepeat?: string;
|
4185 | borderImageSlice?: string;
|
4186 | borderImageSource?: string;
|
4187 | borderImageWidth?: string | number;
|
4188 | borderLeft?: string;
|
4189 | borderLeftColor?: string;
|
4190 | borderLeftStyle?:
|
4191 | | "none"
|
4192 | | "hidden"
|
4193 | | "dotted"
|
4194 | | "dashed"
|
4195 | | "solid"
|
4196 | | "double"
|
4197 | | "groove"
|
4198 | | "ridge"
|
4199 | | "inset"
|
4200 | | "outset"
|
4201 | | "inherit"
|
4202 | | "initial"
|
4203 | | "unset";
|
4204 | borderLeftWidth?: string | number;
|
4205 | borderRadius?: string | number;
|
4206 | borderRight?: string;
|
4207 | borderRightColor?: string;
|
4208 | borderRightStyle?:
|
4209 | | "none"
|
4210 | | "hidden"
|
4211 | | "dotted"
|
4212 | | "dashed"
|
4213 | | "solid"
|
4214 | | "double"
|
4215 | | "groove"
|
4216 | | "ridge"
|
4217 | | "inset"
|
4218 | | "outset"
|
4219 | | "inherit"
|
4220 | | "initial"
|
4221 | | "unset";
|
4222 | borderRightWidth?: string | number;
|
4223 | borderSpacing?: string;
|
4224 | borderStyle?:
|
4225 | | "none"
|
4226 | | "hidden"
|
4227 | | "dotted"
|
4228 | | "dashed"
|
4229 | | "solid"
|
4230 | | "double"
|
4231 | | "groove"
|
4232 | | "ridge"
|
4233 | | "inset"
|
4234 | | "outset"
|
4235 | | "inherit"
|
4236 | | "initial"
|
4237 | | "unset";
|
4238 | borderTop?: string;
|
4239 | borderTopColor?: string;
|
4240 | borderTopLeftRadius?: string | number;
|
4241 | borderTopRightRadius?: string | number;
|
4242 | borderTopStyle?:
|
4243 | | "none"
|
4244 | | "hidden"
|
4245 | | "dotted"
|
4246 | | "dashed"
|
4247 | | "solid"
|
4248 | | "double"
|
4249 | | "groove"
|
4250 | | "ridge"
|
4251 | | "inset"
|
4252 | | "outset"
|
4253 | | "inherit"
|
4254 | | "initial"
|
4255 | | "unset";
|
4256 | borderTopWidth?: string | number;
|
4257 | borderWidth?: string | number;
|
4258 | bottom?: "auto" | string | number | "inherit" | "initial" | "unset";
|
4259 | boxFlex?: string | number;
|
4260 | boxFlexGroup?: string | number;
|
4261 | boxShadow?: string;
|
4262 | boxSizing?: "content-box" | "border-box" | "inherit" | "initial" | "unset";
|
4263 | breakAfter?:
|
4264 | | "auto"
|
4265 | | "avoid"
|
4266 | | "avoid-page"
|
4267 | | "page"
|
4268 | | "left"
|
4269 | | "right"
|
4270 | | "recto"
|
4271 | | "verso"
|
4272 | | "avoid-column"
|
4273 | | "column"
|
4274 | | "avoid-region"
|
4275 | | "region";
|
4276 | breakBefore?:
|
4277 | | "auto"
|
4278 | | "avoid"
|
4279 | | "avoid-page"
|
4280 | | "page"
|
4281 | | "left"
|
4282 | | "right"
|
4283 | | "recto"
|
4284 | | "verso"
|
4285 | | "avoid-column"
|
4286 | | "column"
|
4287 | | "avoid-region"
|
4288 | | "region";
|
4289 | breakInside?: "auto" | "avoid" | "avoid-page" | "avoid-column" | "avoid-region";
|
4290 | captionSide?: "top" | "bottom" | "block-start" | "block-end" | "inline-start" | "inline-end" | "inherit" | "initial" | "unset";
|
4291 | clear?: "none" | "left" | "right" | "both" | "inherit" | "initial" | "unset";
|
4292 | clip?: "auto" | string | "inherit" | "initial" | "unset";
|
4293 | clipPath?: string;
|
4294 | clipRule?: "nonzero" | "evenodd" | "inherit";
|
4295 | color?: string;
|
4296 | colorInterpolationFilters?: "auto" | "sRGB" | "linearRGB" | "inherit";
|
4297 | columnCount?: string | number;
|
4298 | columnFill?: string;
|
4299 | columnGap?: string | number;
|
4300 | columnRule?: string;
|
4301 | columnRuleColor?: string;
|
4302 | columnRuleStyle?: string;
|
4303 | columnRuleWidth?: string | number;
|
4304 | columnSpan?: string;
|
4305 | columnWidth?: string | number;
|
4306 | columns?: string;
|
4307 | content?: string;
|
4308 | counterIncrement?: string;
|
4309 | counterReset?: string;
|
4310 | cursor?:
|
4311 | | "auto"
|
4312 | | "default"
|
4313 | | "none"
|
4314 | | "context-menu"
|
4315 | | "help"
|
4316 | | "pointer"
|
4317 | | "progress"
|
4318 | | "wait"
|
4319 | | "cell"
|
4320 | | "crosshair"
|
4321 | | "text"
|
4322 | | "vertical-text"
|
4323 | | "alias"
|
4324 | | "copy"
|
4325 | | "move"
|
4326 | | "no-drop"
|
4327 | | "not-allowed"
|
4328 | | "e-resize"
|
4329 | | "n-resize"
|
4330 | | "ne-resize"
|
4331 | | "nw-resize"
|
4332 | | "s-resize"
|
4333 | | "se-resize"
|
4334 | | "sw-resize"
|
4335 | | "w-resize"
|
4336 | | "ew-resize"
|
4337 | | "ns-resize"
|
4338 | | "nesw-resize"
|
4339 | | "nwse-resize"
|
4340 | | "col-resize"
|
4341 | | "row-resize"
|
4342 | | "all-scroll"
|
4343 | | "zoom-in"
|
4344 | | "zoom-out"
|
4345 | | "grab"
|
4346 | | "grabbing"
|
4347 | | string
|
4348 | | "inherit"
|
4349 | | "initial"
|
4350 | | "unset";
|
4351 | direction?: "ltr" | "rtl" | "inherit" | "initial" | "unset";
|
4352 | display?:
|
4353 | | "none"
|
4354 | | "inline"
|
4355 | | "block"
|
4356 | | "inline-block"
|
4357 | | "contents"
|
4358 | | "list-item"
|
4359 | | "inline-list-item"
|
4360 | | "table"
|
4361 | | "inline-table"
|
4362 | | "table-cell"
|
4363 | | "table-column"
|
4364 | | "table-column-group"
|
4365 | | "table-footer-group"
|
4366 | | "table-header-group"
|
4367 | | "table-row"
|
4368 | | "table-row-group"
|
4369 | | "table-caption"
|
4370 | | "flex"
|
4371 | | "inline-flex"
|
4372 | | "grid"
|
4373 | | "inline-grid"
|
4374 | | "ruby"
|
4375 | | "ruby-base"
|
4376 | | "ruby-text"
|
4377 | | "ruby-base-container"
|
4378 | | "ruby-text-container"
|
4379 | | "run-in"
|
4380 | | "inherit"
|
4381 | | "initial"
|
4382 | | "unset";
|
4383 | dominantBaseline?: string;
|
4384 | emptyCells?: string;
|
4385 | enableBackground?: string;
|
4386 | fill?: string;
|
4387 | fillOpacity?: string;
|
4388 | fillRule?: string;
|
4389 | filter?: string;
|
4390 | flex?: string | number;
|
4391 | flexBasis?: string;
|
4392 | flexDirection?: string;
|
4393 | flexFlow?: string;
|
4394 | flexGrow?: string | number;
|
4395 | flexPositive?: string | number;
|
4396 | flexShrink?: string | number;
|
4397 | flexNegative?: string | number;
|
4398 | flexWrap?: string;
|
4399 | floodColor?: string;
|
4400 | floodOpacity?: string;
|
4401 | font?: string;
|
4402 | fontFamily?: string | string[];
|
4403 | fontFeatureSettings?: "normal" | string | "inherit" | "initial" | "unset";
|
4404 | fontSize?:
|
4405 | | "xx-small"
|
4406 | | "x-small"
|
4407 | | "small"
|
4408 | | "medium"
|
4409 | | "large"
|
4410 | | "x-large"
|
4411 | | "xx-large"
|
4412 | | "larger"
|
4413 | | "smaller"
|
4414 | | string
|
4415 | | number
|
4416 | | "inherit"
|
4417 | | "initial"
|
4418 | | "unset";
|
4419 | fontSizeAdjust?: "none" | number | "inherit" | "initial" | "unset";
|
4420 | fontStretch?:
|
4421 | | "normal"
|
4422 | | "ultra-condensed"
|
4423 | | "extra-condensed"
|
4424 | | "condensed"
|
4425 | | "semi-condensed"
|
4426 | | "semi-expanded"
|
4427 | | "expanded"
|
4428 | | "extra-expanded"
|
4429 | | "ultra-expanded"
|
4430 | | "inherit"
|
4431 | | "initial"
|
4432 | | "unset";
|
4433 | fontStyle?: "normal" | "italic" | "oblique" | "inherit" | "initial" | "unset";
|
4434 | fontVariant?: "normal" | "small-caps" | "inherit" | "initial" | "unset";
|
4435 | fontWeight?: "normal" | "bold" | "bolder" | "lighter" | number | "inherit" | "initial" | "unset";
|
4436 | glyphOrientationHorizontal?: string;
|
4437 | glyphOrientationVertical?: string;
|
4438 | height?: "auto" | string | number | "inherit" | "initial" | "unset";
|
4439 | imeMode?: string;
|
4440 | justifyContent?: string;
|
4441 | kerning?: string;
|
4442 | left?: "auto" | string | number | "inherit" | "initial" | "unset";
|
4443 | letterSpacing?: string;
|
4444 | lightingColor?: string;
|
4445 | lineClamp?: string | number;
|
4446 | lineHeight?: string | number;
|
4447 | listStyle?: string;
|
4448 | listStyleImage?: string;
|
4449 | listStylePosition?: string;
|
4450 | listStyleType?: string;
|
4451 | margin?: "auto" | string | number | number[] | "inherit" | "initial" | "unset";
|
4452 | marginBottom?: "auto" | string | number | "inherit" | "initial" | "unset";
|
4453 | marginLeft?: "auto" | string | number | "inherit" | "initial" | "unset";
|
4454 | marginRight?: "auto" | string | number | "inherit" | "initial" | "unset";
|
4455 | marginTop?: "auto" | string | number | "inherit" | "initial" | "unset";
|
4456 | marker?: string;
|
4457 | markerEnd?: string;
|
4458 | markerMid?: string;
|
4459 | markerStart?: string;
|
4460 | mask?: string;
|
4461 | maxHeight?: string | number;
|
4462 | maxWidth?: string | number;
|
4463 | minHeight?: string | number;
|
4464 | minWidth?: string | number;
|
4465 | msContentZoomChaining?: string;
|
4466 | msContentZoomLimit?: string;
|
4467 | msContentZoomLimitMax?: string;
|
4468 | msContentZoomLimitMin?: string;
|
4469 | msContentZoomSnap?: string;
|
4470 | msContentZoomSnapPoints?: string;
|
4471 | msContentZoomSnapType?: string;
|
4472 | msContentZooming?: string;
|
4473 | msFlowFrom?: string;
|
4474 | msFlowInto?: string;
|
4475 | msFontFeatureSettings?: string;
|
4476 | msGridColumn?: string;
|
4477 | msGridColumnAlign?: string;
|
4478 | msGridColumnSpan?: string;
|
4479 | msGrdColumns?: string;
|
4480 | msGridRow?: string;
|
4481 | msGridRowAlign?: string;
|
4482 | msGridRowSpan?: string;
|
4483 | msGridRows?: string;
|
4484 | msHighContrastAdjust?: string;
|
4485 | msHyphenateLimitChars?: string;
|
4486 | msHyphenateLimitLines?: string;
|
4487 | msHyphenateLimitZone?: string;
|
4488 | msHyphens?: string;
|
4489 | msImeAlign?: string;
|
4490 | msOverflowStyle?: string;
|
4491 | msScrollChaining?: string;
|
4492 | msScrollLimit?: string;
|
4493 | msScrollLimitXMax?: string;
|
4494 | msScrollLimitXMin?: string;
|
4495 | msScrollLimitYMax?: string;
|
4496 | msScrollLimitYMin?: string;
|
4497 | msScrollRails?: string;
|
4498 | msScrollSnapPointsX?: string;
|
4499 | msScrollSnapPointsY?: string;
|
4500 | msScrollSnapType?: string;
|
4501 | msScrollSnapX?: string;
|
4502 | msScrollSnapY?: string;
|
4503 | msScrollTranslation?: string;
|
4504 | msTextCombineHorizontal?: string;
|
4505 | msTextSizeAdjust?: string;
|
4506 | msTouchAction?: string;
|
4507 | msTouchSelect?: string;
|
4508 | msUserSelect?: string;
|
4509 | msWrapFlow?: string;
|
4510 | msWrapMargin?: string;
|
4511 | msWrapThrough?: string;
|
4512 | opacity?: number | "inherit" | "initial" | "unset";
|
4513 | order?: number | "inherit" | "initial" | "unset";
|
4514 | orphans?: string | number;
|
4515 | outline?: string | "inherit" | "initial" | "unset";
|
4516 | outlineColor?: string;
|
4517 | outlineStyle?:
|
4518 | | "auto"
|
4519 | | "none"
|
4520 | | "dotted"
|
4521 | | "dashed"
|
4522 | | "solid"
|
4523 | | "double"
|
4524 | | "groove"
|
4525 | | "ridge"
|
4526 | | "inset"
|
4527 | | "outset"
|
4528 | | "inherit"
|
4529 | | "initial"
|
4530 | | "unset";
|
4531 | outlineWidth?: string | number;
|
4532 | overflow?: "visible" | "hidden" | "scroll" | "auto" | "inherit" | "initial" | "unset";
|
4533 | overflowX?: "visible" | "hidden" | "scroll" | "auto" | "inherit" | "initial" | "unset";
|
4534 | overflowY?: "visible" | "hidden" | "scroll" | "auto" | "inherit" | "initial" | "unset";
|
4535 | padding?: string | number | number[] | "inherit" | "initial" | "unset";
|
4536 | paddingBottom?: string | number | "inherit" | "initial" | "unset";
|
4537 | paddingLeft?: string | number | "inherit" | "initial" | "unset";
|
4538 | paddingRight?: string | number | "inherit" | "initial" | "unset";
|
4539 | paddingTop?: string | number | "inherit" | "initial" | "unset";
|
4540 | pageBreakAfter?: string;
|
4541 | pageBreakBefore?: string;
|
4542 | pageBreakInside?: string;
|
4543 | perspective?: "none" | string | "inherit" | "initial" | "unset";
|
4544 | perspectiveOrigin?: string | "inherit" | "initial" | "unset";
|
4545 | pointerEvents?:
|
4546 | | "auto"
|
4547 | | "none"
|
4548 | | "visiblePainted"
|
4549 | | "visibleFill"
|
4550 | | "visibleStroke"
|
4551 | | "visible"
|
4552 | | "painted"
|
4553 | | "fill"
|
4554 | | "stroke"
|
4555 | | "all"
|
4556 | | "inherit"
|
4557 | | "initial"
|
4558 | | "unset";
|
4559 | position?: "static" | "relative" | "absolute" | "sticky" | "fixed" | "inherit" | "initial" | "unset";
|
4560 | quotes?: string;
|
4561 | right?: "auto" | string | number | "inherit" | "initial" | "unset";
|
4562 | rubyAlign?: string;
|
4563 | rubyOverhang?: string;
|
4564 | rubyPosition?: string;
|
4565 | stopColor?: string;
|
4566 | stopOpacity?: string;
|
4567 | stroke?: string;
|
4568 | strokeDasharray?: string;
|
4569 | strokeDashoffset?: string;
|
4570 | strokeLinecap?: string;
|
4571 | strokeLinejoin?: string;
|
4572 | strokeMiterlimit?: string;
|
4573 | strokeOpacity?: string;
|
4574 | strokeWidth?: string | number;
|
4575 | src?: string | string[];
|
4576 | tableLayout?: string;
|
4577 | tabSize?: string | number;
|
4578 | textAlign?: "start" | "end" | "left" | "right" | "center" | "justify" | "match-parent" | "inherit" | "initial" | "unset";
|
4579 | textAlignLast?: string;
|
4580 | textAnchor?: string;
|
4581 | textDecoration?: string | "inherit" | "initial" | "unset";
|
4582 | textIndent?: string;
|
4583 | textJustify?: string;
|
4584 | textKashida?: string;
|
4585 | textKashidaSpace?: string;
|
4586 | textOverflow?: "clip" | "ellipsis" | string | "inherit" | "initial" | "unset";
|
4587 | textRendering?: "auto" | "optimizeSpeed" | "optimizeLegibility" | "geometricPrecision";
|
4588 | textShadow?: string;
|
4589 | textTransform?: "none" | "capitalize" | "uppercase" | "lowercase" | "full-width" | "inherit" | "initial" | "unset";
|
4590 | textUnderlinePosition?: string;
|
4591 | top?: "auto" | string | number | "inherit" | "initial" | "unset";
|
4592 | touchAction?:
|
4593 | | "auto"
|
4594 | | "none"
|
4595 | | "pan-x"
|
4596 | | "pan-left"
|
4597 | | "pan-right"
|
4598 | | "pan-y"
|
4599 | | "pan-up"
|
4600 | | "pan-down"
|
4601 | | "manipulation"
|
4602 | | "inherit"
|
4603 | | "initial"
|
4604 | | "unset";
|
4605 | transform?: "none" | string | string[] | "inherit" | "initial" | "unset";
|
4606 | transformOrigin?: string | "inherit" | "initial" | "unset";
|
4607 | transformStyle?: "flat" | "preserve-3d" | "inherit" | "initial" | "unset";
|
4608 | transition?: string | string[] | "inherit" | "initial" | "unset";
|
4609 | transitionDelay?: string;
|
4610 | transitionDuration?: string;
|
4611 | transitionProperty?: "none" | "all" | string | "inherit" | "initial" | "unset";
|
4612 | transitionTimingFunction?:
|
4613 | | "ease"
|
4614 | | "linear"
|
4615 | | "ease-in"
|
4616 | | "ease-out"
|
4617 | | "ease-in-out"
|
4618 | | "step-start"
|
4619 | | "step-end"
|
4620 | | string
|
4621 | | "inherit"
|
4622 | | "initial"
|
4623 | | "unset";
|
4624 | unicodeBidi?: string;
|
4625 | userSelect?: "auto" | "text" | "none" | "contain" | "all";
|
4626 | verticalAlign?:
|
4627 | | "baseline"
|
4628 | | "sub"
|
4629 | | "super"
|
4630 | | "text-top"
|
4631 | | "text-bottom"
|
4632 | | "middle"
|
4633 | | "top"
|
4634 | | "bottom"
|
4635 | | string
|
4636 | | "inherit"
|
4637 | | "initial"
|
4638 | | "unset";
|
4639 | visibility?: "visible" | "hidden" | "collapse" | "inherit" | "initial" | "unset";
|
4640 | webkitAlignContent?: string;
|
4641 | webkitAlignItems?: string;
|
4642 | webkitAlignSelf?: string;
|
4643 | webkitAnimation?: string;
|
4644 | webkitAnimationDelay?: string;
|
4645 | webkitAnimationDirection?: string;
|
4646 | webkitAnimationDuration?: string;
|
4647 | webkitAnimationFillMode?: string;
|
4648 | webkitAnimationIterationCount?: string;
|
4649 | webkitAnimationName?: string;
|
4650 | webkitAnimationPlayState?: string;
|
4651 | webkitAnimationTimingFunction?: string;
|
4652 | webkitAppearance?: string;
|
4653 | webkitBackdropFilter?: string | "none" | "inherit" | "initial" | "unset";
|
4654 | webkitBackfaceVisibility?: string;
|
4655 | webkitBackgroundClip?: string;
|
4656 | webkitBackgroundOrigin?: string;
|
4657 | webkitBackgroundSize?: string;
|
4658 | webkitBorderBottomLeftRadius?: string;
|
4659 | webkitBorderBottomRightRadius?: string;
|
4660 | webkitBorderImage?: string;
|
4661 | webkitBorderRadius?: string;
|
4662 | webkitBorderTopLeftRadius?: string;
|
4663 | webkitBorderTopRightRadius?: string;
|
4664 | webkitBoxAlign?: string;
|
4665 | webkitBoxDirection?: string;
|
4666 | webkitBoxFlex?: string | number;
|
4667 | webkitBoxOrdinalGroup?: string;
|
4668 | webkitBoxOrient?: string;
|
4669 | webkitBoxPack?: string;
|
4670 | webkitBoxSizing?: string;
|
4671 | webkitColumnBreakAfter?: string;
|
4672 | webkitColumnBreakBefore?: string;
|
4673 | webkitColumnBreakInside?: string;
|
4674 | webkitColumnCount?: string;
|
4675 | webkitColumnGap?: string;
|
4676 | webkitColumnRule?: string;
|
4677 | webkitColumnRuleColor?: string;
|
4678 | webkitColumnRuleStyle?: string;
|
4679 | webkitColumnRuleWidth?: string;
|
4680 | webkitColumnSpan?: string;
|
4681 | webkitColumnWidth?: string;
|
4682 | webkitColumns?: string;
|
4683 | webkitFilter?: string;
|
4684 | webkitFlex?: string;
|
4685 | webkitFlexBasis?: string;
|
4686 | webkitFlexDirection?: string;
|
4687 | webkitFlexFlow?: string;
|
4688 | webkitFlexGrow?: string;
|
4689 | webkitFlexShrink?: string;
|
4690 | webkitFlexWrap?: string;
|
4691 | webkitJustifyContent?: string;
|
4692 | webkitOrder?: string;
|
4693 | webkitPerspective?: string;
|
4694 | webkitPerspectiveOrigin?: string;
|
4695 | webkitTapHighlightColor?: string;
|
4696 | webkitTextFillColor?: string;
|
4697 | webkitTextSizeAdjust?: string;
|
4698 | webkitTransform?: string;
|
4699 | webkitTransformOrigin?: string;
|
4700 | webkitTransformStyle?: string;
|
4701 | webkitTransition?: string;
|
4702 | webkitTransitionDelay?: string;
|
4703 | webkitTransitionDuration?: string;
|
4704 | webkitTransitionProperty?: string;
|
4705 | webkitTransitionTimingFunction?: string;
|
4706 | webkitUserModify?: string;
|
4707 | webkitUserSelect?: string;
|
4708 | webkitWritingMode?: string;
|
4709 | whiteSpace?: "normal" | "nowrap" | "pre" | "pre-line" | "pre-wrap" | "inherit" | "initial" | "unset";
|
4710 | widows?: string | number;
|
4711 | width?: "auto" | string | number | "inherit" | "initial" | "unset";
|
4712 | wordBreak?: "normal" | "break-all" | "keep-all" | "inherit" | "initial" | "unset";
|
4713 | wordSpacing?: "normal" | string | "inherit" | "initial" | "unset";
|
4714 | wordWrap?: "normal" | "break-word" | "inherit" | "initial" | "unset";
|
4715 | writingMode?: "horizontal-tb" | "vertical-rl" | "vertical-lr" | "sideways-rl" | "sideways-lr" | "inherit" | "initial" | "unset";
|
4716 | zIndex?: "auto" | string | number | "inherit" | "initial" | "unset";
|
4717 | zoom?: "auto" | string | number;
|
4718 | }
|
4719 | export type TStyle = (pStyle: Style) => void;
|
4720 |
|
4721 | export interface IProperty {
|
4722 | readonly name: string;
|
4723 | readonly value: string;
|
4724 | }
|
4725 |
|
4726 | export interface IStyleRule {
|
4727 | readonly properties: IProperty[];
|
4728 | selector: string;
|
4729 | atRule: string;
|
4730 | }
|
4731 |
|
4732 | export interface IStyleRuleCollection {
|
4733 | readonly rules: IStyleRule[];
|
4734 | readonly hash: string;
|
4735 | readonly isEmpty: boolean;
|
4736 | }
|
4737 |
|
4738 | export interface IStyleParsers {
|
4739 | readonly [selector: string]: (pStyles: IStyles) => IProperty[];
|
4740 | }
|
4741 | export class Style extends EventListeners {
|
4742 |
|
4743 | static get MAX_OPACITY(): number;
|
4744 |
|
4745 | static get ZINDEX_LAYERS(): number;
|
4746 |
|
4747 | static get ZINDEX_FLOATING(): number;
|
4748 |
|
4749 | static get ZINDEX_ELEVATED(): number;
|
4750 |
|
4751 | static get ZINDEX_MODAL(): number;
|
4752 |
|
4753 | static get ZINDEX_SCROLLBARS(): number;
|
4754 |
|
4755 | static get ZINDEX_MENU(): number;
|
4756 |
|
4757 | |
4758 |
|
4759 |
|
4760 |
|
4761 |
|
4762 | static of(pAsset: Style | TDOMElement): Style;
|
4763 | |
4764 |
|
4765 |
|
4766 |
|
4767 |
|
4768 |
|
4769 |
|
4770 |
|
4771 | static apply(pAsset: Style | TDOMElement, fnStyle: TStyle): Style;
|
4772 | |
4773 |
|
4774 |
|
4775 |
|
4776 |
|
4777 |
|
4778 |
|
4779 |
|
4780 |
|
4781 |
|
4782 |
|
4783 |
|
4784 | static set(
|
4785 | pAsset: HTMLElement | CSSStyleRule | undefined,
|
4786 | sName: string,
|
4787 | pValue: TStyleProperty,
|
4788 | bPrefix?: boolean,
|
4789 | bImportant?: boolean
|
4790 | ): void;
|
4791 | |
4792 |
|
4793 |
|
4794 |
|
4795 |
|
4796 |
|
4797 |
|
4798 |
|
4799 |
|
4800 |
|
4801 |
|
4802 |
|
4803 |
|
4804 | static get(pAsset: HTMLElement | CSSStyleRule | undefined, sName: string, bComputed?: boolean, sPseudo?: string): string;
|
4805 | |
4806 |
|
4807 |
|
4808 |
|
4809 |
|
4810 | static styles(pAsset: HTMLElement | CSSStyleRule | undefined, pProperties: IStyleProperties): void;
|
4811 | |
4812 |
|
4813 |
|
4814 |
|
4815 |
|
4816 |
|
4817 |
|
4818 |
|
4819 |
|
4820 |
|
4821 | static stylesToRules(
|
4822 | sSelector: string,
|
4823 | pStyles: IStyleProperties | IStyles | TStylesArray,
|
4824 | bNestedStyles: boolean,
|
4825 | bKeyframes: boolean,
|
4826 | pParsers?: IStyleParsers
|
4827 | ): IStyleRuleCollection;
|
4828 | |
4829 |
|
4830 |
|
4831 |
|
4832 |
|
4833 | static stylesToString(pStyles: IStyleProperties | IStyles | TStylesArray): string;
|
4834 | |
4835 |
|
4836 |
|
4837 |
|
4838 |
|
4839 |
|
4840 |
|
4841 | static pointerEvents(pAsset: HTMLElement | undefined, bEnabled?: boolean): boolean;
|
4842 | |
4843 |
|
4844 |
|
4845 |
|
4846 |
|
4847 |
|
4848 |
|
4849 |
|
4850 |
|
4851 | static zIndex(pAsset: HTMLElement | undefined, nZ?: number | "auto" | "inherit"): number | "auto";
|
4852 | |
4853 |
|
4854 |
|
4855 |
|
4856 |
|
4857 |
|
4858 |
|
4859 |
|
4860 |
|
4861 | static opacity(pAsset: HTMLElement | undefined, nOpacity?: number | "inherit"): number;
|
4862 | |
4863 |
|
4864 |
|
4865 |
|
4866 |
|
4867 |
|
4868 |
|
4869 |
|
4870 |
|
4871 |
|
4872 | static transition(pAsset: HTMLElement | undefined, sTransition?: string | "inherit"): string;
|
4873 | |
4874 |
|
4875 |
|
4876 |
|
4877 |
|
4878 |
|
4879 |
|
4880 |
|
4881 |
|
4882 |
|
4883 |
|
4884 | static transformation(pAsset: HTMLElement | undefined, sTransform?: string): string;
|
4885 | |
4886 |
|
4887 |
|
4888 |
|
4889 |
|
4890 |
|
4891 |
|
4892 |
|
4893 | static class(pAsset: HTMLElement | undefined, sClass?: string): string;
|
4894 | |
4895 |
|
4896 |
|
4897 |
|
4898 |
|
4899 |
|
4900 |
|
4901 |
|
4902 |
|
4903 |
|
4904 | static addClass(pAsset: HTMLElement | undefined, sClass: string): string;
|
4905 | |
4906 |
|
4907 |
|
4908 |
|
4909 |
|
4910 |
|
4911 |
|
4912 |
|
4913 |
|
4914 |
|
4915 | static removeClass(pAsset: HTMLElement | undefined, sClass: string): string;
|
4916 | |
4917 |
|
4918 |
|
4919 |
|
4920 |
|
4921 |
|
4922 |
|
4923 |
|
4924 |
|
4925 |
|
4926 | static toggleClass(pAsset: HTMLElement | undefined, sClass: string): string;
|
4927 | |
4928 |
|
4929 |
|
4930 |
|
4931 |
|
4932 |
|
4933 |
|
4934 |
|
4935 |
|
4936 |
|
4937 |
|
4938 | static setClass(pAsset: HTMLElement | undefined, sClass: string, bEnabled: boolean): string;
|
4939 | |
4940 |
|
4941 |
|
4942 |
|
4943 |
|
4944 |
|
4945 |
|
4946 | static hasClass(pAsset: HTMLElement | undefined, sClass: string): boolean;
|
4947 | |
4948 |
|
4949 |
|
4950 |
|
4951 |
|
4952 |
|
4953 |
|
4954 | protected constructor(pAsset: Style | TDOMElement, fnConstruct?: TStyle);
|
4955 | /**
|
4956 | * Retrieves the class string.
|
4957 | * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.className
|
4958 | */
|
4959 | get class(): string;
|
4960 | /**
|
4961 | * Sets the class string.
|
4962 | *
|
4963 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
4964 | * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.className
|
4965 | */
|
4966 | set class(sClass: string);
|
4967 | /** Retrieves the styles object. */
|
4968 | get styles(): IStyleProperties;
|
4969 | /** Sets the styles of the rules. */
|
4970 | set styles(pStyles: IStyleProperties);
|
4971 | /**
|
4972 | * Retrieves if pointer events are enabled.
|
4973 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events
|
4974 | */
|
4975 | get pointerEvents(): boolean;
|
4976 | /**
|
4977 | * Enables or disables pointer events.
|
4978 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events
|
4979 | */
|
4980 | set pointerEvents(bEnabled: boolean);
|
4981 | /**
|
4982 | * Retrieves the z-index.
|
4983 | *
|
4984 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
4985 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/z-index
|
4986 | * @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Understanding_z_index
|
4987 | */
|
4988 | get zIndex(): number | "auto" | "inherit";
|
4989 | /**
|
4990 | * Sets the z-index as a positive or negative number (can be a number, `auto` or `inherit`).
|
4991 | *
|
4992 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
4993 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/z-index
|
4994 | * @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Understanding_z_index
|
4995 | */
|
4996 | set zIndex(nZ: number | "auto" | "inherit");
|
4997 | /**
|
4998 | * Elevates the asset (supply `0` to reset the elevation).
|
4999 | *
|
5000 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5001 | */
|
5002 | set elevate(nElevate: number);
|
5003 | /** Retrieves if the asset is elevated. */
|
5004 | get elevated(): boolean;
|
5005 | /**
|
5006 | * Elevates the asset and disables transitions. Use this property for elevating assets which will be dragged.
|
5007 | *
|
5008 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5009 | */
|
5010 | set elevated(bElevated: boolean);
|
5011 | /**
|
5012 | * Retrieves the computed opacity (0...MAX_OPACITY).
|
5013 | *
|
5014 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5015 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/opacity
|
5016 | */
|
5017 | get opacity(): number | "inherit";
|
5018 | /**
|
5019 | * Sets the opacity (0...MAX_OPACITY).
|
5020 | *
|
5021 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5022 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/opacity
|
5023 | */
|
5024 | set opacity(nOpacity: number | "inherit");
|
5025 | /**
|
5026 | * Retrieves the transition.
|
5027 | *
|
5028 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5029 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/transition
|
5030 | * @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Using_CSS_transitions
|
5031 | */
|
5032 | get transition(): string;
|
5033 | /**
|
5034 | * Sets the transition.
|
5035 | *
|
5036 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5037 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/transition
|
5038 | * @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Using_CSS_transitions
|
5039 | */
|
5040 | set transition(sTransition: string);
|
5041 | /** Retrieves the `OnTransitionEnd` event. */
|
5042 | get onTransitionEnd(): ((sProperty: string, nElapsedTime: number) => void) | undefined;
|
5043 | /**
|
5044 | * Sets a callback which is invoked when a CSS transition ends.
|
5045 | * @param fnTransitionEnd Specifies the function which is invoked when the transition ends.
|
5046 | * @param fnTransitionEnd.sProperty Specifies the property which is animated.
|
5047 | * @param fnTransitionEnd.nElapsedTime Specifies the elapsed animation time.
|
5048 | * @event
|
5049 | */
|
5050 | set onTransitionEnd(fnTransitionEnd: ((sProperty: string, nElapsedTime: number) => void) | undefined);
|
5051 | /**
|
5052 | * Retrieves if transitions are enabled.
|
5053 | */
|
5054 | get transitions(): boolean;
|
5055 | /**
|
5056 | * Enables or disables transitions.
|
5057 | *
|
5058 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5059 | */
|
5060 | set transitions(bTransitions: boolean);
|
5061 | /**
|
5062 | * Activates transitions with a one time callback function which is invoked
|
5063 | * when there is no transition set, the transition ends or when a timeout occurs.
|
5064 | *
|
5065 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5066 | * @param fnTransitionEnd Specifies the function which is executed.
|
5067 | * @param nTimeout Specifies the timeout for the transition.
|
5068 | */
|
5069 | transitionActivate(fnTransitionEnd: () => void, nTimeout?: number): void;
|
5070 | /** Retrieves the `OnAnimationStart` event. */
|
5071 | get onAnimationStart(): ((sName: string) => void) | undefined;
|
5072 | /**
|
5073 | * Sets a callback which is invoked when a CSS animation starts.
|
5074 | * @param fnAnimationStart Specifies the callback function.
|
5075 | * @param fnAnimationStart.sName Contains the name of the animation.
|
5076 | * @event
|
5077 | */
|
5078 | set onAnimationStart(fnAnimationStart: ((sName: string) => void) | undefined);
|
5079 | /** Retrieves the `OnAnimationEnd` event. */
|
5080 | get onAnimationEnd(): ((sName: string, nElapsedTime: number) => void) | undefined;
|
5081 | /**
|
5082 | * Sets a callback which is invoked when a CSS animation ends.
|
5083 | * @param fnAnimationEnd Specifies the callback function.
|
5084 | * @param fnAnimationEnd.sName Contains the name of the animation.
|
5085 | * @param fnAnimationEnd.nElapsedTime Contains the elapsed animation time.
|
5086 | * @event
|
5087 | */
|
5088 | set onAnimationEnd(fnAnimationEnd: ((sName: string, nElapsedTime: number) => void) | undefined);
|
5089 | /**
|
5090 | * Retrieves the transformation string.
|
5091 | *
|
5092 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5093 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/transform
|
5094 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function
|
5095 | * @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Using_CSS_transforms
|
5096 | */
|
5097 | get transformation(): string;
|
5098 | /**
|
5099 | * Sets the transformation.
|
5100 | *
|
5101 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5102 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/transform
|
5103 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function
|
5104 | * @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Using_CSS_transforms
|
5105 | */
|
5106 | set transformation(sTransform: string);
|
5107 | /**
|
5108 | * Sets the transformation prefix for the asset.
|
5109 | *
|
5110 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5111 | */
|
5112 | set transformationPrefix(sPrefix: string);
|
5113 | /**
|
5114 | * Applies styles and returns a reference to the instance.
|
5115 | *
|
5116 | * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
|
5117 | * @param fnStyle Specifies the style function which applies the styles.
|
5118 | * @param bSequencer Specifies if the write sequencer must be used.
|
5119 | * @return Returns a style instance.
|
5120 | */
|
5121 | apply(fnStyle: TStyle, bSequencer?: boolean): this;
|
5122 | /**
|
5123 | * Sets a style property.
|
5124 | *
|
5125 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5126 | * @param sName Specifies the name of the property to set.
|
5127 | * @param pValue Specifies the value for the property.
|
5128 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/Reference
|
5129 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Properties_Reference
|
5130 | */
|
5131 | set(sName: string, pValue: TStyleProperty): void;
|
5132 | /**
|
5133 | * Retrieves a style property.
|
5134 | *
|
5135 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5136 | * @param sName Specifies the name of the property to retrieve.
|
5137 | * @param bComputed Specifies if the computed or style value should be retrieved (enabled by default).
|
5138 | * @param sPseudo A string specifying the pseudo-element to match.
|
5139 | * @return Returns the style value string.
|
5140 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/Reference
|
5141 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Properties_Reference
|
5142 | */
|
5143 | get(sName: string, bComputed?: boolean, sPseudo?: string): string;
|
5144 | /**
|
5145 | * Adds the supplied class and invokes the supplied function when the animation ends. If no animation is triggered the function is
|
5146 | * invoked as soons as possible.
|
5147 | *
|
5148 | * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
|
5149 | * @param sClass Specifies the class name.
|
5150 | * @param fnAnimationEnd Specifies the callback function which is invoked when the animation ends.
|
5151 | * @param fnAnimationEnd.sName Contains the name of the animation.
|
5152 | * @param fnAnimationEnd.nElapsedTime Contains the elapsed animation time.
|
5153 | * @param bRemove Specifies if the class name needs to be removed from the element after the animation.
|
5154 | * @param sMode Specifies the sequencer mode.
|
5155 | */
|
5156 | animate(
|
5157 | sClass: string,
|
5158 | fnAnimationEnd?: (sName?: string, nElapsedTime?: number) => void,
|
5159 | bRemove?: boolean,
|
5160 | sMode?: "safe" | "synchronous" | "frame"
|
5161 | ): void;
|
5162 | /**
|
5163 | * Sets the translate and scale transformation.
|
5164 | *
|
5165 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5166 | * @param nX Specifies the horizontal translate.
|
5167 | * @param nY Specifies the vertical translate.
|
5168 | * @param nZ Specifies the zoom factor.
|
5169 | * @param b3D Specifies if 3D acceleration should be used.
|
5170 | */
|
5171 | transcale(nX?: number, nY?: number, nZ?: number, b3D?: boolean): void;
|
5172 | /**
|
5173 | * Adds a class.
|
5174 | *
|
5175 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5176 | * @param sClass Specifies the class to add.
|
5177 | * @return Returns the current class string.
|
5178 | * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.className
|
5179 | * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.classList
|
5180 | */
|
5181 | addClass(sClass: string): string;
|
5182 | /**
|
5183 | * Adds a class (forced layout safe).
|
5184 | *
|
5185 | * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
|
5186 | * @param sClass Specifies the class to add.
|
5187 | * @param bWaitOneFrame Specifies to wait one animation frame.
|
5188 | * @return Returns the current class string.
|
5189 | * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.className
|
5190 | * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.classList
|
5191 | */
|
5192 | addClassSafe(sClass: string, bWaitOneFrame?: boolean): void;
|
5193 | /**
|
5194 | * Removes a class.
|
5195 | *
|
5196 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5197 | * @param sClass Specifies the class to remove.
|
5198 | * @return Returns the current class string.
|
5199 | * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.className
|
5200 | * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.classList
|
5201 | */
|
5202 | removeClass(sClass: string): string;
|
5203 | /**
|
5204 | * Removes a class (forced layout safe).
|
5205 | *
|
5206 | * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
|
5207 | * @param sClass Specifies the class to remove.
|
5208 | * @param bWaitOneFrame Specifies to wait one animation frame.
|
5209 | * @return Returns the current class string.
|
5210 | * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.className
|
5211 | * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.classList
|
5212 | */
|
5213 | removeClassSafe(sClass: string, bWaitOneFrame?: boolean): void;
|
5214 | /**
|
5215 | * Toggles a class.
|
5216 | *
|
5217 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5218 | * @param sClass Specifies the class to toggle.
|
5219 | * @return Returns the current class string.
|
5220 | * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.className
|
5221 | * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.classList
|
5222 | */
|
5223 | toggleClass(sClass: string): string;
|
5224 | /**
|
5225 | * Toggles a class (forced layout safe).
|
5226 | *
|
5227 | * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
|
5228 | * @param sClass Specifies the class to toggle.
|
5229 | * @param bWaitOneFrame Specifies to wait one animation frame.
|
5230 | * @return Returns the current class string.
|
5231 | * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.className
|
5232 | * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.classList
|
5233 | */
|
5234 | toggleClassSafe(sClass: string, bWaitOneFrame?: boolean): void;
|
5235 | /**
|
5236 | * Enables or disables a class.
|
5237 | *
|
5238 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5239 | * @param sClass Specifies the class to enable or disable.
|
5240 | * @param bEnabled Specifies if the class should be enabled or disabled.
|
5241 | * @return Returns the current class string.
|
5242 | * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.className
|
5243 | * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.classList
|
5244 | */
|
5245 | setClass(sClass: string, bEnabled: boolean): string;
|
5246 | /**
|
5247 | * Enables or disables a class (forced layout safe).
|
5248 | *
|
5249 | * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
|
5250 | * @param sClass Specifies the class to enable or disable.
|
5251 | * @param bEnabled Specifies if the class should be enabled or disabled.
|
5252 | * @param bWaitOneFrame Specifies to wait one animation frame.
|
5253 | * @return Returns the current class string.
|
5254 | * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.className
|
5255 | * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.classList
|
5256 | */
|
5257 | setClassSafe(sClass: string, bEnabled: boolean, bWaitOneFrame?: boolean): void;
|
5258 | /**
|
5259 | * Checks if the supplied class is attached.
|
5260 | * @param sClass Specifies the class to check.
|
5261 | * @return Returns `true` if the class is attached.
|
5262 | * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.classList
|
5263 | */
|
5264 | hasClass(sClass: string): boolean;
|
5265 | /**
|
5266 | * Enables or disables a selector.
|
5267 | *
|
5268 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5269 | * @param sSelector Specifies the selector to enable or disable.
|
5270 | * @param bEnabled Specifies if the selector should be enabled or disabled.
|
5271 | * @return Returns the current class string.
|
5272 | */
|
5273 | selector(sSelector: string, bEnabled: boolean): string;
|
5274 | /**
|
5275 | * Enables or disables a selector (forced layout safe).
|
5276 | *
|
5277 | * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
|
5278 | * @param sSelector Specifies the selector to enable or disable.
|
5279 | * @param bEnabled Specifies if the selector should be enabled or disabled.
|
5280 | * @param bWaitOneFrame Specifies to wait one animation frame.
|
5281 | * @return Returns the current class string.
|
5282 | */
|
5283 | selectorSafe(sSelector: string, bEnabled: boolean, bWaitOneFrame?: boolean): void;
|
5284 | /**
|
5285 | * Adds a selector.
|
5286 | *
|
5287 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5288 | * @param sSelector Specifies the selector to add.
|
5289 | * @return Returns the current class string.
|
5290 | */
|
5291 | addSelector(sSelector: string): string;
|
5292 | /**
|
5293 | * Adds a selector (forced layout safe).
|
5294 | *
|
5295 | * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
|
5296 | * @param sSelector Specifies the selector to add.
|
5297 | * @param bWaitOneFrame Specifies to wait one animation frame.
|
5298 | * @return Returns the current class string.
|
5299 | */
|
5300 | addSelectorSafe(sSelector: string, bWaitOneFrame?: boolean): void;
|
5301 | /**
|
5302 | * Removes a selector.
|
5303 | *
|
5304 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5305 | * @param sSelector Specifies the selector to remove.
|
5306 | * @return Returns the current class string.
|
5307 | */
|
5308 | removeSelector(sSelector: string): string;
|
5309 | /**
|
5310 | * Removes a selector (forced layout safe).
|
5311 | *
|
5312 | * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
|
5313 | * @param sSelector Specifies the selector to remove.
|
5314 | * @param bWaitOneFrame Specifies to wait one animation frame.
|
5315 | * @return Returns the current class string.
|
5316 | */
|
5317 | removeSelectorSafe(sSelector: string, bWaitOneFrame?: boolean): void;
|
5318 | /**
|
5319 | * Toggles a selector.
|
5320 | *
|
5321 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5322 | * @param sSelector Specifies the selector to toggle.
|
5323 | * @return Returns the current class string.
|
5324 | */
|
5325 | toggleSelector(sSelector: string): string;
|
5326 | /**
|
5327 | * Toggles a selector (forced layout safe).
|
5328 | *
|
5329 | * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
|
5330 | * @param sSelector Specifies the selector to toggle.
|
5331 | * @param bWaitOneFrame Specifies to wait one animation frame.
|
5332 | * @return Returns the current class string.
|
5333 | */
|
5334 | toggleSelectorSafe(sSelector: string, bWaitOneFrame?: boolean): void;
|
5335 | /**
|
5336 | * Checks if the supplied selector is attached.
|
5337 | * @param sSelector Specifies the selector to check.
|
5338 | * @return Returns `true` if the selector is attached.
|
5339 | */
|
5340 | hasSelector(sSelector: string): boolean;
|
5341 | /**
|
5342 | * Adds the supplied selector and invokes the supplied function when the animation ends. If no animation is triggered the function is
|
5343 | * invoked as soons as possible.
|
5344 | *
|
5345 | * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
|
5346 | * @param sSelector Specifies the selector.
|
5347 | * @param fnAnimationEnd Specifies the callback function which is invoked when the animation ends.
|
5348 | * @param fnAnimationEnd.sName Contains the name of the animation.
|
5349 | * @param fnAnimationEnd.nElapsedTime Contains the elapsed animation time.
|
5350 | * @param bRemove Specifies if the selector needs to be removed from the element after the animation.
|
5351 | * @param sMode Specifies the sequencer mode.
|
5352 | */
|
5353 | animateSelector(
|
5354 | sSelector: string,
|
5355 | fnAnimationEnd?: (sName?: string, nElapsedTime?: number) => void,
|
5356 | bRemove?: boolean,
|
5357 | sMode?: "safe" | "synchronous" | "frame"
|
5358 | ): void;
|
5359 | /**
|
5360 | * Destroys the instance.
|
5361 | * @return Returns a reference to the asset in the DOM.
|
5362 | */
|
5363 | destroy(): HTMLElement | undefined;
|
5364 | }
|
5365 | export class Rule {
|
5366 | |
5367 |
|
5368 |
|
5369 |
|
5370 |
|
5371 |
|
5372 |
|
5373 |
|
5374 |
|
5375 |
|
5376 | constructor(
|
5377 | pStylesheet: Stylesheet,
|
5378 | sSelector: string,
|
5379 | pStyles?: IStyleProperties | TStylePropertiesArray,
|
5380 | nIndex?: number,
|
5381 | sClass?: string
|
5382 | );
|
5383 |
|
5384 | /** Retrieves the selector of the rule. */
|
5385 | get selector(): string;
|
5386 | /** Retrieves the class name for the rule (if set). */
|
5387 | get class(): string;
|
5388 | /** Retrieves the index of the rule. */
|
5389 | get index(): number;
|
5390 | /** Retrieves the CSS text. */
|
5391 | get CSS(): string;
|
5392 | /** Retrieves the styles object. */
|
5393 | get styles(): IStyleProperties;
|
5394 | /** Sets the styles of the rules. */
|
5395 | set styles(pStyles: IStyleProperties);
|
5396 | /**
|
5397 | * Sets a style property of the rule.
|
5398 | * @param sName Specifies the name of the property to set.
|
5399 | * @param pValue Specifies the value for the property.
|
5400 | * @param bImportant Specifies if the `!important` attribute needs to be appended.
|
5401 | */
|
5402 | set(sName: string, pValue: TStyleProperty, bImportant?: boolean): void;
|
5403 | /**
|
5404 | * Retrieves a style property of the rule.
|
5405 | * @param sName Specifies the name of the property to retrieve.
|
5406 | * @return Returns the style value as a string.
|
5407 | */
|
5408 | get(sName: string): string;
|
5409 | /**
|
5410 | * Deletes the rule from the stylesheet.
|
5411 | * @return Returns `true` if the rule is deleted.
|
5412 | */
|
5413 | delete(): boolean;
|
5414 | }
|
5415 | export class Stylesheet {
|
5416 |
|
5417 | static get app(): Stylesheet;
|
5418 |
|
5419 | static get screen(): Stylesheet;
|
5420 |
|
5421 | static get print(): Stylesheet;
|
5422 |
|
5423 | static get prefix(): string;
|
5424 |
|
5425 | static set prefix(sPrefix: string);
|
5426 | |
5427 |
|
5428 |
|
5429 |
|
5430 |
|
5431 |
|
5432 | static hash(sValue: string, sPrefix: string): string;
|
5433 | |
5434 |
|
5435 |
|
5436 |
|
5437 |
|
5438 | static count(pSheet: CSSStyleSheet): number;
|
5439 | |
5440 |
|
5441 |
|
5442 |
|
5443 |
|
5444 |
|
5445 |
|
5446 |
|
5447 |
|
5448 | static create(bAutoReflection?: boolean, sMedia?: string, pTarget?: Asset | TDOMElement): Stylesheet;
|
5449 | |
5450 |
|
5451 |
|
5452 |
|
5453 |
|
5454 | static selectorHash(sSelector: string): string;
|
5455 | |
5456 |
|
5457 |
|
5458 |
|
5459 |
|
5460 |
|
5461 | static selector(sSelector: string, sPrefix?: string): string;
|
5462 | |
5463 |
|
5464 |
|
5465 |
|
5466 |
|
5467 | static selectors(...pSelectors: string[]): string;
|
5468 | |
5469 |
|
5470 |
|
5471 |
|
5472 |
|
5473 |
|
5474 |
|
5475 |
|
5476 | constructor(bAutoReflection?: boolean, sMedia?: string, pTarget?: Asset | TDOMElement);
|
5477 |
|
5478 | /** Retrieves a reference to the stylesheets. */
|
5479 | get sheets(): CSSStyleSheet[];
|
5480 | /** Retrieves a reference to the stylesheet. */
|
5481 | get sheet(): CSSStyleSheet | undefined;
|
5482 | /** Retrieves the number of rules managed by the stylesheet. */
|
5483 | get count(): number;
|
5484 | /** Retrieves the CSS style rules. */
|
5485 | get CSSStyleRules(): CSSStyleRule[];
|
5486 | /** Retrieves the CSS text for the all the static rules. */
|
5487 | get CSSText(): string;
|
5488 | /** Retrieves an array with rules. */
|
5489 | get rules(): Rule[];
|
5490 |
|
5491 | /**
|
5492 | * Creates a static rule.
|
5493 | * @param sSelector Specifies the selector.
|
5494 | * @param pStyles Specifies the styles. Nested styles are allowed. You
|
5495 | * can supply an array of styles which will be merged. When there are
|
5496 | * identical styles, the right-most style property takes precedence.
|
5497 | * @param sClass Specifies the optional class name.
|
5498 | * @return Returns the class name for the static rule.
|
5499 | */
|
5500 | static(sSelector: string, pStyles: IStyles | TStylesArray): void;
|
5501 | /**
|
5502 | * Creates a static style and returns the class name for the style.
|
5503 | * @param pStyles Specifies the styles. Nested styles are allowed. You
|
5504 | * can supply an array of styles which will be merged. When there are
|
5505 | * identical styles, the right-most style property takes precedence.
|
5506 | * @return Returns the class name for the static rule.
|
5507 | */
|
5508 | style(pStyles: IStyles | TStylesArray): string;
|
5509 | /**
|
5510 | * Styles an asset.
|
5511 | * @param pAsset Reference to the asset.
|
5512 | * @param pStyles Specifies the styles. Nested styles are allowed. You
|
5513 | * can supply an array of styles which will be merged. When there are
|
5514 | * identical styles, the right-most style property takes precedence.
|
5515 | */
|
5516 | styleAsset(pAsset: Asset, pStyles: IStyles | TStylesArray): void;
|
5517 | /**
|
5518 | * Styles an asset (layout safe).
|
5519 | *
|
5520 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5521 | * @param pAsset Reference to the asset.
|
5522 | * @param pStyles Specifies the styles. Nested styles are allowed. You
|
5523 | * can supply an array of styles which will be merged. When there are
|
5524 | * identical styles, the right-most style property takes precedence.
|
5525 | */
|
5526 | styleAssetSafe(pAsset: Asset, pStyles: IStyles | TStylesArray): void;
|
5527 | /**
|
5528 | * Creates an animation with the supplied keyframes.
|
5529 | * @param pKeyframes Specifies the keyframes. You can supply an array of
|
5530 | * styles which will be merged. When there are identical styles, the
|
5531 | * right-most style property takes precedence.
|
5532 | * @param sName Specifies an optional name for the animation.
|
5533 | * @return Returns the animation name.
|
5534 | */
|
5535 | animation(pKeyframes: IStyles | TStylesArray, sName?: string): string;
|
5536 | /**
|
5537 | * Creates a new managed rule.
|
5538 | * @param pStyles Specifies the styles. Nested styles are not allowed. You
|
5539 | * can supply an array of styles which will be merged. When there are
|
5540 | * identical styles, the right-most style property takes precedence.
|
5541 | * @return Returns a reference to the rule.
|
5542 | */
|
5543 | rule(pStyles?: IStyleProperties | TStylePropertiesArray): Rule;
|
5544 | /**
|
5545 | * Adds a rule to the beginning of the stylesheet.
|
5546 | * @param sSelector Specifies the selector.
|
5547 | * @param pStyles Specifies the styles. Nested styles are not allowed. You
|
5548 | * can supply an array of styles which will be merged. When there are
|
5549 | * identical styles, the right-most style property takes precedence.
|
5550 | * @param sClass Specifies the class name.
|
5551 | * @return Returns a reference to the rule.
|
5552 | */
|
5553 | insertRule(sSelector: string, pStyles?: IStyleProperties | TStylePropertiesArray, sClass?: string): Rule;
|
5554 | /**
|
5555 | * Adds a rule at the specified position in the the stylesheet.
|
5556 | * @param nIndex Specifies the zero-based index.
|
5557 | * @param sSelector Specifies the selector.
|
5558 | * @param pStyles Specifies the styles. Nested styles are not allowed. You
|
5559 | * can supply an array of styles which will be merged. When there are
|
5560 | * identical styles, the right-most style property takes precedence.
|
5561 | * @param sClass Specifies the class name.
|
5562 | * @return Returns a reference to the rule.
|
5563 | */
|
5564 | insertRuleAt(nIndex: number, sSelector: string, pStyles?: IStyleProperties | TStylePropertiesArray, sClass?: string): Rule;
|
5565 | /**
|
5566 | * Adds a rule to the end of the stylesheet.
|
5567 | * @param sSelector Specifies the selector.
|
5568 | * @param pStyles Specifies the styles. Nested styles are not allowed. You
|
5569 | * can supply an array of styles which will be merged. When there are
|
5570 | * identical styles, the right-most style property takes precedence.
|
5571 | * @param sClass Specifies the class name.
|
5572 | * @return Returns a reference to the rule.
|
5573 | */
|
5574 | addRule(sSelector: string, pStyles?: IStyleProperties | TStylePropertiesArray, sClass?: string): Rule;
|
5575 | /**
|
5576 | * Retrieves a rule from the stylesheet.
|
5577 | * @param sSelector Specifies the selector.
|
5578 | * @return Returns a reference to the rule.
|
5579 | */
|
5580 | getRule(sSelector: string): Rule;
|
5581 | /**
|
5582 | * Deletes a rule from the stylesheet.
|
5583 | * @param sSelector Specifies the selector.
|
5584 | * @return Returns a reference to the rule.
|
5585 | */
|
5586 | deleteRule(sSelector: string): boolean;
|
5587 | /** Flushes the stylesheet to the browser. */
|
5588 | flush(): void;
|
5589 | /** Destroys the stylesheet. */
|
5590 | destroy(): void;
|
5591 | }
|
5592 | /**
|
5593 | * Type alias for the asset function.
|
5594 | * @param TAsset.pAsset Reference to the asset instance.
|
5595 | */
|
5596 | export type TAsset = (pAsset: Asset) => void;
|
5597 | /**
|
5598 | * Describes the available positioning types.
|
5599 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/position
|
5600 | */
|
5601 | export type TPositioning = "static" | "relative" | "absolute" | "fixed";
|
5602 | /**
|
5603 | * Describes the available overflow types.
|
5604 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/overflow
|
5605 | */
|
5606 | export type TOverflow = "visible" | "hidden" | "scroll" | "auto";
|
5607 | /**
|
5608 | * Describes the available box sizing models.
|
5609 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing
|
5610 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/box_model
|
5611 | */
|
5612 | export type TModel = "content" | "border" | "padding";
|
5613 | /**
|
5614 | * Describes the available display rendering options.
|
5615 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/display
|
5616 | */
|
5617 | export type TRendering = "none" | "inline" | "block";
|
5618 | /**
|
5619 | * Sets or retrieves the positioning type of the asset.
|
5620 | *
|
5621 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5622 | * @param pAsset Reference to the asset.
|
5623 | * @param sPositioning Specifies the desired positioning type.
|
5624 | * @return Returns the positioning type.
|
5625 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/position
|
5626 | */
|
5627 | export function positioning(pAsset: HTMLElement | undefined, sPositioning?: TPositioning): TPositioning;
|
5628 | /**
|
5629 | * Sets or retrieves the box sizing model for the asset.
|
5630 | *
|
5631 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5632 | * @param pAsset Reference to the asset.
|
5633 | * @param sBoxModel Specifies the desired box sizing model.
|
5634 | * @return Returns the box sizing model.
|
5635 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing
|
5636 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/box_model
|
5637 | */
|
5638 | export function boxModel(pAsset: HTMLElement | undefined, sBoxModel?: TModel): TModel;
|
5639 | /**
|
5640 | * Sets or retrieves the rendering (display) method for the asset.
|
5641 | *
|
5642 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5643 | * @param pAsset Reference to the asset.
|
5644 | * @param sRendering Specifies the desired rendering option.
|
5645 | * @return Returns the rendering method.
|
5646 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/display
|
5647 | */
|
5648 | export function rendering(pAsset: HTMLElement | undefined, sRendering?: TRendering): TRendering;
|
5649 | /**
|
5650 | * Sets or retrieves the visibility of the asset.
|
5651 | *
|
5652 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5653 | * @param pAsset Reference to the asset.
|
5654 | * @param bVisible Specifies if the asset should be visible or hidden.
|
5655 | * @param bRemove Specifies if visibility property should be removed instead of setting it to `visible`.
|
5656 | * @return Returns `true` if the asset is visible.
|
5657 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/visibility
|
5658 | */
|
5659 | export function visible(pAsset: HTMLElement | undefined, bVisible?: boolean, bRemove?: boolean): boolean;
|
5660 | /**
|
5661 | * Sets or retrieves the overflow type of the asset.
|
5662 | *
|
5663 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5664 | * @param pAsset Reference to the asset.
|
5665 | * @param sOverflow Specifies the overflow type.
|
5666 | * @return Returns the overflow type.
|
5667 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/overflow
|
5668 | */
|
5669 | export function overflow(pAsset: HTMLElement | undefined, sOverflow?: TOverflow): TOverflow;
|
5670 | /**
|
5671 | * Sets or retrieves the horizontal overflow type of the asset.
|
5672 | *
|
5673 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5674 | * @param pAsset Reference to the asset.
|
5675 | * @param sOverflowHorizontal Specifies the horizontal overflow type.
|
5676 | * @return Returns the horizontal overflow type.
|
5677 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-x
|
5678 | */
|
5679 | export function overflowHorizontal(pAsset: HTMLElement | undefined, sOverflowHorizontal?: TOverflow): TOverflow;
|
5680 | /**
|
5681 | * Sets or retrieves the vertical overflow type of the asset.
|
5682 | *
|
5683 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5684 | * @param pAsset Reference to the asset.
|
5685 | * @param sOverflowVertical Specifies the vertical overflow type.
|
5686 | * @return Returns the vertical overflow type.
|
5687 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-y
|
5688 | */
|
5689 | export function overflowVertical(pAsset: HTMLElement | undefined, sOverflowVertical?: TOverflow): TOverflow;
|
5690 | /**
|
5691 | * Returns the boundaries of the asset relative to the viewport. The amount of scrolling that has been applied to the viewport area (or
|
5692 | * any other scrollable asset) is taken into account when computing the bounding rectangle. This means that the `top` and `left`
|
5693 | * property change their values as soon as the scrolling position changes (so their values are relative to the viewport and not absolute).
|
5694 | *
|
5695 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5696 | * @param pAsset Reference to the asset.
|
5697 | * @param bClient Specifies if the client area needs to be calculated.
|
5698 | * @param pOffset Optional offset coordinates for the rectangle.
|
5699 | * @return Returns a rectangle with the boundaries.
|
5700 | * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect
|
5701 | */
|
5702 | export function rectangle(pAsset: HTMLElement | undefined, bClient?: boolean, pOffset?: Coordinate): Rect;
|
5703 | /**
|
5704 | * Returns the left boundary of the asset relative to the viewport.
|
5705 | *
|
5706 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5707 | * @param pAsset Reference to the asset.
|
5708 | * @return Returns the left boundary in pixels.
|
5709 | * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect
|
5710 | */
|
5711 | export function rectangleLeft(pAsset: HTMLElement | undefined): number;
|
5712 | /**
|
5713 | * Returns the top boundary of the asset relative to the viewport.
|
5714 | *
|
5715 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5716 | * @param pAsset Reference to the asset.
|
5717 | * @return Returns the top boundary in pixels.
|
5718 | * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect
|
5719 | */
|
5720 | export function rectangleTop(pAsset: HTMLElement | undefined): number;
|
5721 | /**
|
5722 | * Returns the right boundary of the asset relative to the viewport.
|
5723 | *
|
5724 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5725 | * @param pAsset Reference to the asset.
|
5726 | * @return Returns the right boundary in pixels.
|
5727 | * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect
|
5728 | */
|
5729 | export function rectangleRight(pAsset: HTMLElement | undefined): number;
|
5730 | /**
|
5731 | * Returns the bottom boundary of the asset relative to the viewport.
|
5732 | *
|
5733 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5734 | * @param pAsset Reference to the asset.
|
5735 | * @return Returns the bottom boundary in pixels.
|
5736 | * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect
|
5737 | */
|
5738 | export function rectangleBottom(pAsset: HTMLElement | undefined): number;
|
5739 | /**
|
5740 | * Returns the true pixel width of the asset.
|
5741 | *
|
5742 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5743 | * @param pAsset Reference to the asset.
|
5744 | * @return Returns the width in pixels.
|
5745 | * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect
|
5746 | */
|
5747 | export function rectangleWidth(pAsset: HTMLElement | undefined): number;
|
5748 | /**
|
5749 | * Returns the true pixel height of the asset.
|
5750 | *
|
5751 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5752 | * @param pAsset Reference to the asset.
|
5753 | * @return Returns the height in pixels.
|
5754 | * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect
|
5755 | */
|
5756 | export function rectangleHeight(pAsset: HTMLElement | undefined): number;
|
5757 | /**
|
5758 | * Sets or retrieves the left pixel value of the asset.
|
5759 | *
|
5760 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5761 | * @param pAsset Reference to the asset.
|
5762 | * @param nLeft Specifies the left value (can be a number, `auto` or `inherit`).
|
5763 | * @return Returns the left value.
|
5764 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/left
|
5765 | */
|
5766 | export function left(pAsset: HTMLElement | undefined, nLeft?: number | "auto" | "inherit"): number | "auto";
|
5767 | /**
|
5768 | * Sets or retrieves the top pixel value of the asset.
|
5769 | *
|
5770 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5771 | * @param pAsset Reference to the asset.
|
5772 | * @param nTop Specifies the top value (can be a number, `auto` or `inherit`).
|
5773 | * @return Returns the top value.
|
5774 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/top
|
5775 | */
|
5776 | export function top(pAsset: HTMLElement | undefined, nTop?: number | "auto" | "inherit"): number | "auto";
|
5777 | /**
|
5778 | * Sets or retrieves the right pixel value of the asset.
|
5779 | *
|
5780 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5781 | * @param pAsset Reference to the asset.
|
5782 | * @param nRight Specifies the right value (can be a number, `auto` or `inherit`).
|
5783 | * @return Returns the right value.
|
5784 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/right
|
5785 | */
|
5786 | export function right(pAsset: HTMLElement | undefined, nRight?: number | "auto" | "inherit"): number | "auto";
|
5787 | /**
|
5788 | * Sets or retrieves the bottom pixel value of the asset.
|
5789 | *
|
5790 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5791 | * @param pAsset Reference to the asset.
|
5792 | * @param nBottom Specifies the bottom value (can be a number, `auto` or `inherit`).
|
5793 | * @return Returns the bottom value.
|
5794 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/bottom
|
5795 | */
|
5796 | export function bottom(pAsset: HTMLElement | undefined, nBottom?: number | "auto" | "inherit"): number | "auto";
|
5797 | /**
|
5798 | * Sets or retrieves the width of the asset in pixels.
|
5799 | *
|
5800 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5801 | * @param pAsset Reference to the asset.
|
5802 | * @param nWidth Specifies the width in pixels (can be a number, `auto` or `inherit`).
|
5803 | * @param bAttribute Specifies if the width attribute or style needs to be set or retrieves.
|
5804 | * @return Returns the width in pixels.
|
5805 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/width
|
5806 | */
|
5807 | export function width(pAsset: HTMLElement | undefined, nWidth?: number | "auto" | "inherit", bAttribute?: boolean): number | "auto";
|
5808 | /**
|
5809 | * Sets or retrieves the height of the asset in pixels.
|
5810 | *
|
5811 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5812 | * @param pAsset Reference to the asset.
|
5813 | * @param nHeight Specifies the height in pixels (can be a number, `auto` or `inherit`).
|
5814 | * @param bAttribute Specifies if the width attribute or style needs to be set or retrieves.
|
5815 | * @return Returns the height in pixels.
|
5816 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/height
|
5817 | */
|
5818 | export function height(pAsset: HTMLElement | undefined, nHeight?: number | "auto" | "inherit", bAttribute?: boolean): number | "auto";
|
5819 | /**
|
5820 | * Sets or retrieves the background size of the asset in pixels.
|
5821 | *
|
5822 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5823 | * @param pAsset Reference to the asset.
|
5824 | * @param pSize Specifies the background size.
|
5825 | * @return Returns the background size string.
|
5826 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/background-size
|
5827 | */
|
5828 | export function backgroundSize(
|
5829 | pAsset: HTMLElement | undefined,
|
5830 | pSize?: {
|
5831 |
|
5832 | width: number | "auto";
|
5833 |
|
5834 | height: number | "auto";
|
5835 | }
|
5836 | ): string;
|
5837 | /**
|
5838 | * Sets or retrieves a 2D translation.
|
5839 | *
|
5840 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5841 | * @param pAsset Reference to the asset.
|
5842 | * @param pTranslate Specifies the translation properties.
|
5843 | * @return Returns the horizontal and vertical translation as a point.
|
5844 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/transform#translate
|
5845 | */
|
5846 | export function translate(
|
5847 | pAsset: HTMLElement | undefined,
|
5848 | pTranslate: {
|
5849 |
|
5850 | x?: number;
|
5851 |
|
5852 | y?: number;
|
5853 |
|
5854 | translate3D?: boolean;
|
5855 |
|
5856 | ignoreTransformations?: boolean;
|
5857 | }
|
5858 | ): IPoint;
|
5859 | /**
|
5860 | * Sets the position of the asset.
|
5861 | *
|
5862 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5863 | * @param pAsset Reference to the asset.
|
5864 | * @param pPosition Specifies the position properties.
|
5865 | */
|
5866 | export function position(
|
5867 | pAsset: HTMLElement | undefined,
|
5868 | pPosition: {
|
5869 |
|
5870 | x: number;
|
5871 |
|
5872 | y: number;
|
5873 | |
5874 |
|
5875 |
|
5876 |
|
5877 | translate?: "no" | "yes" | "accelerated";
|
5878 | |
5879 |
|
5880 |
|
5881 |
|
5882 | resetCSSPosition?: boolean;
|
5883 | }
|
5884 | ): void;
|
5885 | /**
|
5886 | * Sets or retrieves the left scroll position.
|
5887 | *
|
5888 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5889 | * @param pAsset Reference to the asset.
|
5890 | * @param nScrollLeft Specifies the left scroll position.
|
5891 | * @return Returns the left scroll position.
|
5892 | * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.scrollLeft
|
5893 | */
|
5894 | export function scrollLeft(pAsset: HTMLElement | undefined, nScrollLeft?: number): number;
|
5895 | /**
|
5896 | * Sets or retrieves the top scroll position.
|
5897 | *
|
5898 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5899 | * @param pAsset Reference to the asset.
|
5900 | * @param nScrollLeft Specifies the top scroll position.
|
5901 | * @return Returns the top scroll position.
|
5902 | * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.scrollTop
|
5903 | */
|
5904 | export function scrollTop(pAsset: HTMLElement | undefined, nScrollTop?: number): number;
|
5905 | /**
|
5906 | * Retrieves the scroll width.
|
5907 | *
|
5908 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5909 | * @param pAsset Reference to the asset.
|
5910 | * @return Returns the scroll width.
|
5911 | * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.scrollWidth
|
5912 | */
|
5913 | export function scrollWidth(pAsset: HTMLElement | undefined): number;
|
5914 | /**
|
5915 | * Retrieves the scroll height.
|
5916 | *
|
5917 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5918 | * @param pAsset Reference to the asset.
|
5919 | * @return Returns the scroll height.
|
5920 | * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.scrollHeight
|
5921 | */
|
5922 | export function scrollHeight(pAsset: HTMLElement | undefined): number;
|
5923 | /**
|
5924 | * Sets or retrieves the specified property.
|
5925 | *
|
5926 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5927 | * @param pAsset Reference to the asset.
|
5928 | * @param sProperty Specifies the property to get or set.
|
5929 | * @param sValue Specifies the value to set.
|
5930 | * @return Returns the property value.
|
5931 | */
|
5932 | export function property<T>(pAsset: HTMLElement | undefined, sProperty: string, pValue?: T): T | undefined;
|
5933 | /**
|
5934 | * Sets or retrieves the tab index.
|
5935 | *
|
5936 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5937 | * @param pAsset Reference to the asset.
|
5938 | * @param nTabIndex Specifies the tab index. Can be one of the following values:
|
5939 | * - `-1`: The tab index is disabled;
|
5940 | * - `0`: The browser determines the actual tab index;
|
5941 | * - A positive value specifies a fixed index.
|
5942 | * @return Returns the tab index.
|
5943 | * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.tabIndex
|
5944 | */
|
5945 | export function tabIndex(pAsset: HTMLElement | undefined, nTabIndex?: number): number;
|
5946 | /**
|
5947 | * Applies a skew effect.
|
5948 | *
|
5949 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
5950 | * @param pAsset Reference to the asset.
|
5951 | * @param pProperties Specifies the skew properties.
|
5952 | */
|
5953 | export function skew(
|
5954 | pAsset: HTMLElement | undefined,
|
5955 | pProperties: {
|
5956 |
|
5957 | leftTopX?: number;
|
5958 |
|
5959 | leftTopY?: number;
|
5960 |
|
5961 | rightTopX?: number;
|
5962 |
|
5963 | rightTopY?: number;
|
5964 |
|
5965 | leftBottomX?: number;
|
5966 |
|
5967 | leftBottomY?: number;
|
5968 |
|
5969 | rightBottomX?: number;
|
5970 |
|
5971 | rightBottomY?: number;
|
5972 |
|
5973 | width?: number;
|
5974 |
|
5975 | height?: number;
|
5976 | }
|
5977 | ): void;
|
5978 | /**
|
5979 | * Gives focus to the asset.
|
5980 | *
|
5981 | * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
|
5982 | * @param pAsset Reference to the asset.
|
5983 | * @param bGuarantee Guarantees the focus is set.
|
5984 | * @return Returns `true` if the focus is set.
|
5985 | */
|
5986 | export function focus(pAsset: HTMLElement | undefined, bGuarantee: boolean): boolean;
|
5987 | /**
|
5988 | * Blurs the asset focus.
|
5989 | *
|
5990 | * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
|
5991 | * @param pAsset Reference to the asset.
|
5992 | * @return Returns `true` if the focus is blurred.
|
5993 | */
|
5994 | export function blur(pAsset: HTMLElement | undefined): boolean;
|
5995 | export class Asset extends Style {
|
5996 |
|
5997 | static get isFocused(): Asset | undefined;
|
5998 |
|
5999 | static get isFocusedOnInput(): boolean;
|
6000 | |
6001 |
|
6002 |
|
6003 |
|
6004 |
|
6005 | static of(pAsset: Asset | TDOMElement): Asset;
|
6006 | |
6007 |
|
6008 |
|
6009 |
|
6010 | static assert(pAsset: Asset | undefined): Asset;
|
6011 | |
6012 |
|
6013 |
|
6014 |
|
6015 |
|
6016 |
|
6017 |
|
6018 |
|
6019 | static apply(pAsset: Asset | TDOMElement, fnAsset?: TAsset): Asset;
|
6020 | |
6021 |
|
6022 |
|
6023 |
|
6024 |
|
6025 |
|
6026 |
|
6027 |
|
6028 | static style(pAsset: Asset | TDOMElement, pStyles: IStyles | TStylesArray, pStylesheet?: Stylesheet): void;
|
6029 | |
6030 |
|
6031 |
|
6032 |
|
6033 |
|
6034 |
|
6035 |
|
6036 |
|
6037 |
|
6038 |
|
6039 | static styleSafe(pAsset: Asset | TDOMElement, pStyles: IStyles | TStylesArray, pStylesheet?: Stylesheet): void;
|
6040 | |
6041 |
|
6042 |
|
6043 |
|
6044 |
|
6045 |
|
6046 |
|
6047 |
|
6048 |
|
6049 |
|
6050 |
|
6051 | static create(
|
6052 | sType: string,
|
6053 | fnConstruct?: TAsset,
|
6054 | pParent?: Asset | TDOMElement,
|
6055 | pInsertBefore?: Asset | TDOMElement
|
6056 | ): Asset | undefined;
|
6057 | |
6058 |
|
6059 |
|
6060 |
|
6061 |
|
6062 |
|
6063 |
|
6064 | protected constructor(pAsset: Asset | TDOMElement, fnConstruct?: TAsset);
|
6065 | /** Retrieves the parent asset. */
|
6066 | get parent(): Asset | undefined;
|
6067 | /** Retrieves the first child of the asset. */
|
6068 | get firstChild(): Asset | undefined;
|
6069 | /** Retrieves the last child of the asset. */
|
6070 | get lastChild(): Asset | undefined;
|
6071 | /** Retrieves the (managed) left position of the asset. */
|
6072 | get x(): number;
|
6073 | /**
|
6074 | * Sets the left position of the asset.
|
6075 | *
|
6076 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6077 | */
|
6078 | set x(nX: number);
|
6079 | /** Retrieves the (managed) top position of the asset. */
|
6080 | get y(): number;
|
6081 | /**
|
6082 | * Sets the top position of the asset.
|
6083 | *
|
6084 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6085 | */
|
6086 | set y(nY: number);
|
6087 | /** Retrieves the (managed) zoom factor of the asset. */
|
6088 | get z(): number;
|
6089 | /**
|
6090 | * Sets the top position of the asset.
|
6091 | *
|
6092 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6093 | */
|
6094 | set z(nZ: number);
|
6095 | /** Retrieves if the asset position is set using a translate transformation. */
|
6096 | get positionByTranslate(): boolean;
|
6097 | /**
|
6098 | * Enables or disables if the asset position is set using a translate transformation.
|
6099 | *
|
6100 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6101 | */
|
6102 | set positionByTranslate(bTranslate: boolean);
|
6103 | /** Retrieves if the asset position is set using a translate3d transformation. */
|
6104 | get positionByTranslate3D(): boolean;
|
6105 | /**
|
6106 | * Enables or disables if the asset position is set using a translate3d transformation.
|
6107 | *
|
6108 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6109 | */
|
6110 | set positionByTranslate3D(bTranslate3d: boolean);
|
6111 | /**
|
6112 | * Retrieves the positioning type of the asset.
|
6113 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/position
|
6114 | */
|
6115 | get positioning(): TPositioning;
|
6116 | /**
|
6117 | * Sets the positioning type of the asset.
|
6118 | *
|
6119 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6120 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/position
|
6121 | */
|
6122 | set positioning(sPositioning: TPositioning);
|
6123 | /**
|
6124 | * Retrieves the box sizing model of the asset.
|
6125 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing
|
6126 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/box_model
|
6127 | */
|
6128 | get boxModel(): TModel;
|
6129 | /**
|
6130 | * Sets the box sizing model of the asset.
|
6131 | *
|
6132 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6133 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing
|
6134 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/box_model
|
6135 | */
|
6136 | set boxModel(sBoxModel: TModel);
|
6137 | /**
|
6138 | * Retrieves the rendering (display) method of the asset.
|
6139 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/display
|
6140 | */
|
6141 | get rendering(): TRendering;
|
6142 | /**
|
6143 | * Sets the rendering (display) method of the asset.
|
6144 | *
|
6145 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6146 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/display
|
6147 | */
|
6148 | set rendering(sRendering: TRendering);
|
6149 | /**
|
6150 | * Retrieves if the asset is visible.
|
6151 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/visibility
|
6152 | */
|
6153 | get visible(): boolean;
|
6154 | /**
|
6155 | * Sets the visibility of the asset (and removes the visibility property
|
6156 | * if the asset should be visible).
|
6157 | *
|
6158 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6159 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/visibility
|
6160 | */
|
6161 | set visible(bVisible: boolean);
|
6162 | /**
|
6163 | * Sets the visibility of the asset explicitly (using `visible` for visible assets).
|
6164 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/visibility
|
6165 | */
|
6166 | set visibleExplicit(bVisible: boolean);
|
6167 | /**
|
6168 | * Retrieves the overflow type of the asset.
|
6169 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/overflow
|
6170 | */
|
6171 | get overflow(): TOverflow;
|
6172 | /**
|
6173 | * Sets the overflow type of the asset.
|
6174 | *
|
6175 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6176 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/overflow
|
6177 | */
|
6178 | set overflow(sOverflow: TOverflow);
|
6179 | /**
|
6180 | * Retrieves the horizontal overflow type of the asset.
|
6181 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-x
|
6182 | */
|
6183 | get overflowHorizontal(): TOverflow;
|
6184 | /**
|
6185 | * Sets the horizontal overflow type of the asset.
|
6186 | *
|
6187 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6188 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-x
|
6189 | */
|
6190 | set overflowHorizontal(sOverflowHorizontal: TOverflow);
|
6191 | /**
|
6192 | * Retrieves the vertical overflow type of the asset.
|
6193 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-y
|
6194 | */
|
6195 | get overflowVertical(): TOverflow;
|
6196 | /**
|
6197 | * Sets the vertical overflow type of the asset.
|
6198 | *
|
6199 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6200 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-y
|
6201 | */
|
6202 | set overflowVertical(sOverflowVertical: TOverflow);
|
6203 | /**
|
6204 | * Retrieves the boundaries of the asset relative to the viewport. The amount of scrolling that has been applied to the viewport area
|
6205 | * (or any other scrollable asset) is taken into account when computing the bounding rectangle. This means that the `top` and `left`
|
6206 | * property change their values as soon as the scrolling position changes (so their values are relative to the viewport and not
|
6207 | * absolute).
|
6208 | *
|
6209 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6210 | * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect
|
6211 | */
|
6212 | get rectangle(): Rect;
|
6213 | /**
|
6214 | * Retrieves the boundaries of the client are of the asset relative to the viewport. The amount of scrolling that has been applied to
|
6215 | * the viewport area (or any other scrollable asset) is taken into account when computing the bounding rectangle. This means that
|
6216 | * the `top` and `left` property change their values as soon as the scrolling position changes (so their values are relative to the
|
6217 | * viewport and not absolute).
|
6218 | *
|
6219 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6220 | * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect
|
6221 | */
|
6222 | get rectangleClient(): Rect;
|
6223 | /**
|
6224 | * Retrieves the left boundary of the asset relative to the viewport.
|
6225 | *
|
6226 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6227 | * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect
|
6228 | */
|
6229 | get rectangleLeft(): number;
|
6230 | /**
|
6231 | * Retrieves the top boundary of the asset relative to the viewport.
|
6232 | *
|
6233 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6234 | * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect
|
6235 | */
|
6236 | get rectangleTop(): number;
|
6237 | /**
|
6238 | * Retrieves the right boundary of the asset relative to the viewport.
|
6239 | *
|
6240 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6241 | * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect
|
6242 | */
|
6243 | get rectangleRight(): number;
|
6244 | /**
|
6245 | * Retrieves the bottom boundary of the asset relative to the viewport.
|
6246 | *
|
6247 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6248 | * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect
|
6249 | */
|
6250 | get rectangleBottom(): number;
|
6251 | /**
|
6252 | * Retrieves the true pixel width of the asset.
|
6253 | *
|
6254 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6255 | * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect
|
6256 | */
|
6257 | get rectangleWidth(): number;
|
6258 | /**
|
6259 | * Retrieves the true pixel height of the asset.
|
6260 | *
|
6261 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6262 | * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect
|
6263 | */
|
6264 | get rectangleHeight(): number;
|
6265 | /** Retrieves the zoom factor of the asset. */
|
6266 | get zoom(): number;
|
6267 | /**
|
6268 | * Sets the zoom factor of the asset.
|
6269 | *
|
6270 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6271 | */
|
6272 | set zoom(nZoom: number);
|
6273 | /**
|
6274 | * Retrieves the left pixel value of the asset.
|
6275 | *
|
6276 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6277 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/left
|
6278 | */
|
6279 | get left(): number | "auto" | "inherit";
|
6280 | /**
|
6281 | * Sets the left pixel value of the asset (can be a number, `auto` or `inherit`).
|
6282 | *
|
6283 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6284 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/left
|
6285 | */
|
6286 | set left(nLeft: number | "auto" | "inherit");
|
6287 | /**
|
6288 | * Retrieves the top pixel value of the asset.
|
6289 | *
|
6290 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6291 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/top
|
6292 | */
|
6293 | get top(): number | "auto" | "inherit";
|
6294 | /**
|
6295 | * Sets the top pixel value of the asset (can be a number, `auto` or `inherit`).
|
6296 | *
|
6297 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6298 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/top
|
6299 | */
|
6300 | set top(nTop: number | "auto" | "inherit");
|
6301 | /**
|
6302 | * Retrieves the right pixel value of the asset.
|
6303 | *
|
6304 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6305 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/right
|
6306 | */
|
6307 | get right(): number | "auto" | "inherit";
|
6308 | /**
|
6309 | * Sets the right pixel value of the asset (can be a number, `auto` or `inherit`).
|
6310 | *
|
6311 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6312 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/right
|
6313 | */
|
6314 | set right(nRight: number | "auto" | "inherit");
|
6315 | /**
|
6316 | * Retrieves the bottom pixel value of the asset.
|
6317 | *
|
6318 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6319 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/bottom
|
6320 | */
|
6321 | get bottom(): number | "auto" | "inherit";
|
6322 | /**
|
6323 | * Sets the bottom pixel value of the asset (can be a number, `auto` or `inherit`).
|
6324 | *
|
6325 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6326 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/bottom
|
6327 | */
|
6328 | set bottom(nBottom: number | "auto" | "inherit");
|
6329 | /**
|
6330 | * Retrieves the width of the asset in pixels.
|
6331 | *
|
6332 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6333 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/width
|
6334 | */
|
6335 | get width(): number | "auto" | "inherit";
|
6336 | /**
|
6337 | * Sets the width of the asset (or supply `AUTO` to set the property to `auto`).
|
6338 | *
|
6339 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6340 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/width
|
6341 | */
|
6342 | set width(nWidth: number | "auto" | "inherit");
|
6343 | /**
|
6344 | * Retrieves the height of the asset in pixels.
|
6345 | *
|
6346 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6347 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/height
|
6348 | */
|
6349 | get height(): number | "auto" | "inherit";
|
6350 | /**
|
6351 | * Sets the height of the asset (or supply `AUTO` to set the property to `auto`).
|
6352 | *
|
6353 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6354 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/height
|
6355 | */
|
6356 | set height(nHeight: number | "auto" | "inherit");
|
6357 | /**
|
6358 | * Retrieves the width attribute of the asset.
|
6359 | *
|
6360 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6361 | */
|
6362 | get elementWidth(): number | "auto" | "inherit";
|
6363 | /**
|
6364 | * Sets the width attribute of the asset.
|
6365 | *
|
6366 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6367 | */
|
6368 | set elementWidth(nWidth: number | "auto" | "inherit");
|
6369 | /**
|
6370 | * Retrieves the height attribute of the asset.
|
6371 | *
|
6372 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6373 | */
|
6374 | get elementHeight(): number | "auto" | "inherit";
|
6375 | /**
|
6376 | * Sets the height attribute of the asset.
|
6377 | *
|
6378 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6379 | */
|
6380 | set elementHeight(nHeight: number | "auto" | "inherit");
|
6381 | /**
|
6382 | * Retrieves the left scroll position.
|
6383 | *
|
6384 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6385 | */
|
6386 | get scrollLeft(): number;
|
6387 | /**
|
6388 | * Sets the left scroll position.
|
6389 | *
|
6390 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6391 | */
|
6392 | set scrollLeft(nScrollLeft: number);
|
6393 | /**
|
6394 | * Retrieves the top scroll position.
|
6395 | *
|
6396 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6397 | */
|
6398 | get scrollTop(): number;
|
6399 | /**
|
6400 | * Sets the top scroll position.
|
6401 | *
|
6402 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6403 | */
|
6404 | set scrollTop(nScrollTop: number);
|
6405 | /**
|
6406 | * Retrieves the scroll width.
|
6407 | *
|
6408 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6409 | */
|
6410 | get scrollWidth(): number;
|
6411 | /**
|
6412 | * Retrieves the scroll height.
|
6413 | *
|
6414 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6415 | */
|
6416 | get scrollHeight(): number;
|
6417 | /**
|
6418 | * Retrieves the tab index. Can be one of the following values:
|
6419 | * - `-1`: The tab index is disabled;
|
6420 | * - `0`: The browser determines the actual tab index;
|
6421 | * - A positive value specifies a fixed index.
|
6422 | *
|
6423 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6424 | */
|
6425 | get tabIndex(): number;
|
6426 | /**
|
6427 | * Sets the tab index. Can be one of the following values:
|
6428 | * - `-1`: The tab index is disabled;
|
6429 | * - `0`: The browser determines the actual tab index;
|
6430 | * - A positive value specifies a fixed index.
|
6431 | *
|
6432 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6433 | */
|
6434 | set tabIndex(nTab: number);
|
6435 | /**
|
6436 | * Sets or retrieves the specified property.
|
6437 | * @param sProperty Specifies the property name.
|
6438 | * @param pValue Optional value for the property.
|
6439 | * @return Returns the property value.
|
6440 | */
|
6441 | property<T>(sProperty: string, pValue?: T): T | undefined;
|
6442 | /**
|
6443 | * Applies asset operations and returns a reference.
|
6444 | *
|
6445 | * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
|
6446 | * @param fnAsset Specifies the function which applies the operations.
|
6447 | * @param bInstantly Executes the write operation instantly.
|
6448 | * @return Returns a reference to the asset instance.
|
6449 | */
|
6450 | apply(fnAsset: TAsset, bInstantly?: boolean): this;
|
6451 | /**
|
6452 | * Styles an asset.
|
6453 | * @param pStyles Specifies the styles. Nested styles are allowed. You
|
6454 | * can supply an array of styles which will be merged. When there are
|
6455 | * identical styles, the right-most style property takes precedence.
|
6456 | * @param pStylesheet Reference to the stylesheet (if ommitted the default application stylesheet will be used).
|
6457 | */
|
6458 | style(pStyles: IStyles | TStylesArray, pStylesheet?: Stylesheet): void;
|
6459 | /**
|
6460 | * Styles an asset (layout safe).
|
6461 | *
|
6462 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6463 | * @param pStyles Specifies the styles. Nested styles are allowed. You
|
6464 | * can supply an array of styles which will be merged. When there are
|
6465 | * identical styles, the right-most style property takes precedence.
|
6466 | * @param pStylesheet Reference to the stylesheet (if ommitted the default application stylesheet will be used).
|
6467 | */
|
6468 | styleSafe(pStyles: IStyles | TStylesArray, pStylesheet?: Stylesheet): void;
|
6469 | /**
|
6470 | * Returns a child asset.
|
6471 | * @param nIndex Specifies the asset index.
|
6472 | * @return Returns a new asset instance or `undefined` if no child is found.
|
6473 | */
|
6474 | child(nIndex?: number): Asset | undefined;
|
6475 | /**
|
6476 | * Iterates through all child assets.
|
6477 | * @param fnChild Function which is invoked for each child asset.
|
6478 | * @param fnChild.pChild Reference to the child asset.
|
6479 | */
|
6480 | forEachChild(fnChild: (pChild: Asset) => void): void;
|
6481 | /**
|
6482 | * Sets the position of the asset.
|
6483 | *
|
6484 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6485 | * @param pPosition Specifies the position properties.
|
6486 | */
|
6487 | position(pPosition: {
|
6488 |
|
6489 | x?: number;
|
6490 |
|
6491 | y?: number;
|
6492 |
|
6493 | z?: number;
|
6494 |
|
6495 | translate?: "no" | "yes" | "accelerated";
|
6496 | }): void;
|
6497 | /**
|
6498 | * Shifts the position of the asset.
|
6499 | *
|
6500 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6501 | * @param pShift Specifies the shift properties.
|
6502 | */
|
6503 | shift(pShift: {
|
6504 |
|
6505 | horizontal?: number;
|
6506 |
|
6507 | vertical?: number;
|
6508 |
|
6509 | translate?: "no" | "yes" | "accelerated";
|
6510 | }): void;
|
6511 | /**
|
6512 | * Retrieves the boundaries of the asset with the applied offset relative to the viewport.
|
6513 | *
|
6514 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6515 | * @param pOffset Specifies offset coordinates for the rectangle.
|
6516 | * @return Returns the boundaries.
|
6517 | */
|
6518 | rectangleOffset(pOffset: Coordinate): Rect;
|
6519 | /**
|
6520 | * Sets or retrieves the background size of the asset in pixels.
|
6521 | *
|
6522 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6523 | * @param pSize Specifies the background size.
|
6524 | * @return Returns the background size string.
|
6525 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/background-size
|
6526 | */
|
6527 | backgroundSize(pSize?: {
|
6528 |
|
6529 | width: number | "auto";
|
6530 |
|
6531 | height: number | "auto";
|
6532 | }): string;
|
6533 | /**
|
6534 | * Sets or retrieves a 2D translation.
|
6535 | *
|
6536 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6537 | * @param pTranslate Specifies the translation properties.
|
6538 | * @return Returns the horizontal and vertical translation as a point.
|
6539 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/transform#translate
|
6540 | */
|
6541 | translate(pTranslate: {
|
6542 |
|
6543 | x?: number;
|
6544 |
|
6545 | y?: number;
|
6546 |
|
6547 | translate3D?: boolean;
|
6548 |
|
6549 | ignoreTransformations?: boolean;
|
6550 | }): IPoint;
|
6551 | /**
|
6552 | * Sets or retrieves a horizontal 2D translation.
|
6553 | *
|
6554 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6555 | * @param pTranslate Specifies the translation properties.
|
6556 | * @return Returns the horizontal translation.
|
6557 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/transform#translate
|
6558 | */
|
6559 | translateX(pTranslate: {
|
6560 |
|
6561 | x?: number;
|
6562 |
|
6563 | translate3D?: boolean;
|
6564 |
|
6565 | ignoreTransformations?: boolean;
|
6566 | }): number;
|
6567 | /**
|
6568 | * Sets or retrieves a vertical 2D translation.
|
6569 | *
|
6570 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6571 | * @param pTranslate Specifies the translation properties.
|
6572 | * @return Returns the vertical translation.
|
6573 | * @see https://developer.mozilla.org/en-US/docs/Web/CSS/transform#translate
|
6574 | */
|
6575 | translateY(pTranslate: {
|
6576 |
|
6577 | y?: number;
|
6578 |
|
6579 | translate3D?: boolean;
|
6580 |
|
6581 | ignoreTransformations?: boolean;
|
6582 | }): number;
|
6583 | /**
|
6584 | * Applies a skew effect.
|
6585 | *
|
6586 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6587 | * @param pProperties Specifies the skew properties.
|
6588 | */
|
6589 | skew(pProperties: {
|
6590 |
|
6591 | leftTopX?: number;
|
6592 |
|
6593 | leftTopY?: number;
|
6594 |
|
6595 | rightTopX?: number;
|
6596 |
|
6597 | rightTopY?: number;
|
6598 |
|
6599 | leftBottomX?: number;
|
6600 |
|
6601 | leftBottomY?: number;
|
6602 |
|
6603 | rightBottomX?: number;
|
6604 |
|
6605 | rightBottomY?: number;
|
6606 |
|
6607 | width?: number;
|
6608 |
|
6609 | height?: number;
|
6610 | }): void;
|
6611 | /**
|
6612 | * Applies an offset skew effect.
|
6613 | *
|
6614 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6615 | * @param pProperties Specifies the skew properties.
|
6616 | */
|
6617 | skewOffset(pProperties: {
|
6618 |
|
6619 | leftTopX?: number;
|
6620 |
|
6621 | leftTopY?: number;
|
6622 |
|
6623 | rightTopX?: number;
|
6624 |
|
6625 | rightTopY?: number;
|
6626 |
|
6627 | leftBottomX?: number;
|
6628 |
|
6629 | leftBottomY?: number;
|
6630 |
|
6631 | rightBottomX?: number;
|
6632 |
|
6633 | rightBottomY?: number;
|
6634 |
|
6635 | width?: number;
|
6636 |
|
6637 | height?: number;
|
6638 | }): void;
|
6639 | /**
|
6640 | * Removes an active skew.
|
6641 | *
|
6642 | * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
|
6643 | */
|
6644 | unskew(): void;
|
6645 | /**
|
6646 | * Gives focus to the asset.
|
6647 | *
|
6648 | * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
|
6649 | * @param bGuarantee Gurantees the focus is set (default is `true`).
|
6650 | * @return Returns `true` if the focus is set.
|
6651 | */
|
6652 | focus(bGuarantee?: boolean): boolean;
|
6653 | /**
|
6654 | * Blurs the asset focus.
|
6655 | *
|
6656 | * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
|
6657 | * @return Returns `true` if the focus is blurred.
|
6658 | */
|
6659 | blur(): boolean;
|
6660 | /**
|
6661 | * Removes the children from the asset.
|
6662 | *
|
6663 | * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
|
6664 | */
|
6665 | destroyChildren(): void;
|
6666 | /**
|
6667 | * Destroys the asset.
|
6668 | *
|
6669 | * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
|
6670 | * @param bRemoveFromDOM Specifies that the asset should be removed from the DOM.
|
6671 | * @param bTidy Specifies if child assets should be removed piece by piece from the DOM.
|
6672 | * @return Returns a reference to the asset in the DOM.
|
6673 | */
|
6674 | destroy(bRemoveFromDOM?: boolean, bTidy?: boolean): HTMLElement | undefined;
|
6675 | }
|
6676 | /** Describes the available gradient directions. */
|
6677 | export const enum Directions {
|
6678 | Vertical = 0,
|
6679 | Horizontal = 1,
|
6680 | Diagonal = 2,
|
6681 | }
|
6682 |
|
6683 | export const enum HorizontalAlignment {
|
6684 | Left = 0,
|
6685 | Center = 1,
|
6686 | Right = 2,
|
6687 | }
|
6688 |
|
6689 | export const enum VerticalAlignment {
|
6690 | Top = 0,
|
6691 | Middle = 1,
|
6692 | Bottom = 2,
|
6693 | }
|
6694 | |
6695 |
|
6696 |
|
6697 |
|
6698 |
|
6699 |
|
6700 |
|
6701 | export type TRender = (pContext: CanvasRenderingContext2D, nWidth?: number, nHeight?: number, nRatio?: number) => void;
|
6702 | |
6703 |
|
6704 |
|
6705 |
|
6706 | export function pixelRatio(): number;
|
6707 | |
6708 |
|
6709 |
|
6710 |
|
6711 | export function canvas(): HTMLCanvasElement;
|
6712 | |
6713 |
|
6714 |
|
6715 |
|
6716 |
|
6717 |
|
6718 |
|
6719 | export function context2D(pCanvas?: HTMLCanvasElement, nWidth?: number, nHeight?: number): CanvasRenderingContext2D;
|
6720 | |
6721 |
|
6722 |
|
6723 |
|
6724 |
|
6725 |
|
6726 |
|
6727 |
|
6728 | export function contextWebGL(pCanvas?: HTMLCanvasElement, pOptions?: Object, nWidth?: number, nHeight?: number): WebGLRenderingContext;
|
6729 | |
6730 |
|
6731 |
|
6732 |
|
6733 |
|
6734 |
|
6735 |
|
6736 |
|
6737 | export function render2D(
|
6738 | pAsset: DOMElement | HTMLCanvasElement | undefined,
|
6739 | fnRender: TRender,
|
6740 | nWidth?: number,
|
6741 | nHeight?: number
|
6742 | ): CanvasRenderingContext2D;
|
6743 | |
6744 |
|
6745 |
|
6746 |
|
6747 |
|
6748 |
|
6749 |
|
6750 |
|
6751 | export function renderBackground(pAsset: Asset, fnRender: TRender, nWidth: number, nHeight: number, sRepeat?: string): void;
|
6752 | |
6753 |
|
6754 |
|
6755 |
|
6756 |
|
6757 |
|
6758 |
|
6759 |
|
6760 | export function applyShader2D(pAsset: DOMElement | HTMLCanvasElement, fnRender: TRender, nWidth?: number, nHeight?: number): Shader2D;
|
6761 |
|
6762 | export class Shader2D {
|
6763 | |
6764 |
|
6765 |
|
6766 |
|
6767 |
|
6768 |
|
6769 |
|
6770 | constructor(pElement: DOMElement | HTMLCanvasElement, fnRender: TRender, nWidth?: number, nHeight?: number);
|
6771 | /** Retrieves a reference to the drawing context. */
|
6772 | get context(): CanvasRenderingContext2D;
|
6773 | /** Retrieves the width of the canvas. */
|
6774 | get width(): number;
|
6775 | /** Retrieves the height of the canvas. */
|
6776 | get height(): number;
|
6777 | /**
|
6778 | * Clears the canvas.
|
6779 | * @param bFromBuffer Specifies if the image in the buffer needs to be restored on the canvas.
|
6780 | */
|
6781 | clear(bFromBuffer?: boolean): void;
|
6782 | /**
|
6783 | * Creates a buffer of the current canvas.
|
6784 | * @param bForce Specifies if the buffer always needs to be created.
|
6785 | * @return Returns the drawing context of the buffer.
|
6786 | */
|
6787 | buffer(bForce?: boolean): CanvasRenderingContext2D | undefined;
|
6788 | /** Resets the canvas. This will restore the image from the buffer (if present) or from a new rendering. */
|
6789 | reset(): void;
|
6790 | /**
|
6791 | * Renders the canvas with the specified width and height.
|
6792 | * @param nWidth Specifies the width of the canvas.
|
6793 | * @param nHeight Specifies the height of the canvas.
|
6794 | */
|
6795 | render(nWidth?: number, nHeight?: number): void;
|
6796 | /**
|
6797 | * Applies a darken effect on the canvas.
|
6798 | * @param nBegin Specifies the begin darkness (0..100).
|
6799 | * @param nEnd Specifies the end darkness (0..100).
|
6800 | * @param nDirection Specifies the direction of the darken effect.
|
6801 | */
|
6802 | darken(nBegin: number, nEnd: number, nDirection?: Directions): void;
|
6803 | /**
|
6804 | * Applies a lighten effect on the canvas.
|
6805 | * @param nBegin Specifies the begin lightness (0..100).
|
6806 | * @param nEnd Specifies the end lightness (0..100).
|
6807 | * @param nDirection Specifies the direction of the lighten effect.
|
6808 | */
|
6809 | lighten(nBegin: number, nEnd: number, nDirection?: Directions): void;
|
6810 | /**
|
6811 | * Applies a grayscale effect to the canvas.
|
6812 | * @param bOptimized Specifies if optimized grayscaling should be used.
|
6813 | * @param bWhitening Specifies if a whitening effect should be applied.
|
6814 | * @param nOpacity Specifies the opacity.
|
6815 | */
|
6816 | grayscale(bOptimized?: boolean, bWhitening?: boolean, nOpacity?: number): void;
|
6817 | }
|
6818 | /** Text wrapper for a 2D canvas. */
|
6819 | export class TextWrapper {
|
6820 | |
6821 |
|
6822 |
|
6823 |
|
6824 |
|
6825 |
|
6826 | static correction(sFont: string, sAlignment: CanvasTextBaseline): number;
|
6827 | |
6828 |
|
6829 |
|
6830 |
|
6831 |
|
6832 | constructor(
|
6833 | pContext: CanvasRenderingContext2D,
|
6834 | pProperties?: {
|
6835 |
|
6836 | font?: string;
|
6837 |
|
6838 | size?: number;
|
6839 |
|
6840 | fillStyle?: string;
|
6841 |
|
6842 | lineHeight?: number;
|
6843 |
|
6844 | stroke?: boolean;
|
6845 |
|
6846 | strokeStyle?: string;
|
6847 | }
|
6848 | );
|
6849 | /** Retrieves a reference to the drawing context. */
|
6850 | get context(): CanvasRenderingContext2D;
|
6851 | /** Retrieves the font. */
|
6852 | get font(): string;
|
6853 | /** Sets the font. */
|
6854 | set font(sFont: string);
|
6855 | /** Retrieves the font size. */
|
6856 | get size(): number;
|
6857 | /** Sets the font size. */
|
6858 | set size(nSize: number);
|
6859 | /** Retrieves the line height. */
|
6860 | get lineHeight(): number;
|
6861 | /** Sets the line height. */
|
6862 | set lineHeight(nLineHeight: number);
|
6863 | /** Retrieves the fill style. */
|
6864 | get fillStyle(): string;
|
6865 | /** Sets the fill style. */
|
6866 | set fillStyle(sFillStyle: string);
|
6867 | /** Retrieves the stroke mode. */
|
6868 | get stroke(): boolean;
|
6869 | /** Enables or disables stroke mode. */
|
6870 | set stroke(bStroke: boolean);
|
6871 | /** Retrieves the stroke style. */
|
6872 | get strokeStyle(): string;
|
6873 | /** Sets the stroke style. */
|
6874 | set strokeStyle(sStrokeStyle: string);
|
6875 |
|
6876 | /**
|
6877 | * Measures the width of the supplied text.
|
6878 | * @param sText Specifies the text to measure.
|
6879 | * @return Returns the width in pixels.
|
6880 | */
|
6881 | measure(sText: string): number;
|
6882 | /**
|
6883 | * The master draw text function.
|
6884 | * @param sText Specifies the string to plot.
|
6885 | * @param pProperties Specifies the text properties.
|
6886 | */
|
6887 | draw(
|
6888 | sText: string,
|
6889 | pProperties: {
|
6890 |
|
6891 | x: number;
|
6892 |
|
6893 | y: number;
|
6894 |
|
6895 | width: number;
|
6896 |
|
6897 | font?: string;
|
6898 |
|
6899 | size?: number;
|
6900 |
|
6901 | fillStyle?: string;
|
6902 |
|
6903 | lineHeight?: number;
|
6904 |
|
6905 | stroke?: boolean;
|
6906 |
|
6907 | strokeStyle?: string;
|
6908 |
|
6909 | horizontal?: HorizontalAlignment;
|
6910 |
|
6911 | vertical?: VerticalAlignment;
|
6912 |
|
6913 | lines?: number;
|
6914 |
|
6915 | suffix?: string;
|
6916 | }
|
6917 | ): void;
|
6918 | /**
|
6919 | * Draws a single line of text.
|
6920 | * @param sText Specifies the string to plot.
|
6921 | * @param nX Specifies the horizontal position.
|
6922 | * @param nY Specifies the vertical position.
|
6923 | * @param nWidth Specifies the maximum string width in pixels.
|
6924 | * @param nAlignment Specifies the horizontal alignment.
|
6925 | * @param sSuffix Specifies the suffix to add in case of cropped text.
|
6926 | */
|
6927 | single(sText: string, nX: number, nY: number, nWidth?: number, nAlignment?: HorizontalAlignment, sSuffix?: string): void;
|
6928 | /**
|
6929 | * Draws multiple lines of text.
|
6930 | * @param sText Specifies the string to plot.
|
6931 | * @param nX Specifies the horizontal position.
|
6932 | * @param nY Specifies the vertical position.
|
6933 | * @param nWidth Specifies the maximum string width in pixels.
|
6934 | * @param nLines Specifies the maximum lines.
|
6935 | * @param nHorizontal Specifies the horizontal alignment.
|
6936 | * @param nVertical Specifies the vertical alignment.
|
6937 | * @param sSuffix Specifies the suffix to add in case of cropped text.
|
6938 | */
|
6939 | Mmultiple(
|
6940 | sText: string,
|
6941 | nX: number,
|
6942 | nY: number,
|
6943 | nWidth?: number,
|
6944 | nLines?: number,
|
6945 | nHorizontal?: HorizontalAlignment,
|
6946 | nVertical?: VerticalAlignment,
|
6947 | sSuffix?: string
|
6948 | ): void;
|
6949 | }
|
6950 | export interface IStyleRules {
|
6951 | [selector: string]: IStyles;
|
6952 | }
|
6953 | |
6954 |
|
6955 |
|
6956 |
|
6957 |
|
6958 | export function styleRules(pRules: IStyleRules, pStylesheet?: Stylesheet): void;
|
6959 | export interface IApplication<T> {
|
6960 | |
6961 |
|
6962 |
|
6963 |
|
6964 | do?: (pPayload: T) => void;
|
6965 | |
6966 |
|
6967 |
|
6968 |
|
6969 | when?: (pPayload: T) => boolean;
|
6970 | |
6971 |
|
6972 |
|
6973 |
|
6974 |
|
6975 |
|
6976 |
|
6977 |
|
6978 | first?: (pPayload: T) => boolean;
|
6979 | |
6980 |
|
6981 |
|
6982 |
|
6983 | waitForComplete?: boolean;
|
6984 | |
6985 |
|
6986 |
|
6987 |
|
6988 | readonly onShow?: (pPayload: T) => void;
|
6989 | |
6990 |
|
6991 |
|
6992 |
|
6993 | readonly onHide?: (pPayload: T) => void;
|
6994 | |
6995 |
|
6996 |
|
6997 |
|
6998 | readonly onActivate?: (pPayload: T) => void;
|
6999 | |
7000 |
|
7001 |
|
7002 |
|
7003 | readonly onDeactivate?: (pPayload: T) => void;
|
7004 | |
7005 |
|
7006 |
|
7007 |
|
7008 | onUnload?: (pPayload: T) => void;
|
7009 |
|
7010 | readonly payload?: T;
|
7011 |
|
7012 | readonly styleRules?: IStyleRules;
|
7013 |
|
7014 | readonly desktopClass?: boolean;
|
7015 | }
|
7016 | export class Application {
|
7017 | |
7018 |
|
7019 |
|
7020 |
|
7021 |
|
7022 | static get isInteractive(): boolean;
|
7023 | |
7024 |
|
7025 |
|
7026 |
|
7027 | static get isComplete(): boolean;
|
7028 |
|
7029 | static get isUnloading(): boolean;
|
7030 |
|
7031 | static get isVisible(): boolean;
|
7032 |
|
7033 | static get isActive(): boolean;
|
7034 |
|
7035 |
|
7036 | static observe(): void;
|
7037 | |
7038 |
|
7039 |
|
7040 |
|
7041 | static run<T>(pApplication: IApplication<T>): void;
|
7042 | }
|
7043 |
|
7044 | export type TElement = (pElement: Element) => void;
|
7045 |
|
7046 | export type TElementDestroy = (pElement: Element, bIsChild: boolean) => void;
|
7047 | export class Element extends Asset {
|
7048 | |
7049 |
|
7050 |
|
7051 |
|
7052 | onDestroy: TElementDestroy | undefined;
|
7053 |
|
7054 | static get head(): Element;
|
7055 |
|
7056 | static get body(): Element;
|
7057 |
|
7058 | static setTrustedTypesPolicy(sPolicyName: string): void;
|
7059 | |
7060 |
|
7061 |
|
7062 |
|
7063 | static whenDestroyed(fnDestroy: TElementDestroy): void;
|
7064 | |
7065 |
|
7066 |
|
7067 |
|
7068 |
|
7069 |
|
7070 |
|
7071 |
|
7072 |
|
7073 |
|
7074 |
|
7075 |
|
7076 |
|
7077 |
|
7078 | static create(
|
7079 | sType: string,
|
7080 | fnElement?: TElement,
|
7081 | pParent?: Element | Asset | TDOMElement,
|
7082 | pInsertBefore?: Element | Asset | TDOMElement,
|
7083 | pStyles?: IStyles | TStylesArray,
|
7084 | pStylesheet?: Stylesheet
|
7085 | ): Element;
|
7086 | |
7087 |
|
7088 |
|
7089 |
|
7090 | static assert(pElement: Element | undefined): Element;
|
7091 | |
7092 |
|
7093 |
|
7094 |
|
7095 |
|
7096 |
|
7097 | static sanitize<T extends string | TrustedHTML = string | TrustedHTML>(sHTML: string): T;
|
7098 | |
7099 |
|
7100 |
|
7101 |
|
7102 |
|
7103 |
|
7104 |
|
7105 |
|
7106 |
|
7107 | static HTML(pElement: HTMLElement | undefined, sHTML?: string): string;
|
7108 | |
7109 |
|
7110 |
|
7111 |
|
7112 |
|
7113 |
|
7114 |
|
7115 |
|
7116 |
|
7117 |
|
7118 |
|
7119 |
|
7120 |
|
7121 | static text(pElement: HTMLElement | undefined, sText?: string, bAppend?: boolean, bInsert?: boolean): string;
|
7122 | |
7123 |
|
7124 |
|
7125 |
|
7126 |
|
7127 |
|
7128 |
|
7129 | static zoom(pElements: Element[], nZoom: number): void;
|
7130 |
|
7131 |
|
7132 | get parent(): Element | Asset | undefined;
|
7133 |
|
7134 | get index(): number;
|
7135 | |
7136 |
|
7137 |
|
7138 |
|
7139 |
|
7140 |
|
7141 | get HTML(): string;
|
7142 | |
7143 |
|
7144 |
|
7145 |
|
7146 |
|
7147 |
|
7148 | set HTML(sHTML: string);
|
7149 | |
7150 |
|
7151 |
|
7152 |
|
7153 | get text(): string;
|
7154 | |
7155 |
|
7156 |
|
7157 |
|
7158 |
|
7159 |
|
7160 | set text(sText: string);
|
7161 |
|
7162 | get isDestroyed(): boolean;
|
7163 |
|
7164 | |
7165 |
|
7166 |
|
7167 |
|
7168 | chain(pElement: Element): void;
|
7169 | |
7170 |
|
7171 |
|
7172 |
|
7173 |
|
7174 |
|
7175 |
|
7176 |
|
7177 |
|
7178 |
|
7179 |
|
7180 |
|
7181 | create(sType: string, fnElement?: TElement, pStyles?: IStyles | TStylesArray, pStylesheet?: Stylesheet): Element;
|
7182 | |
7183 |
|
7184 |
|
7185 |
|
7186 |
|
7187 |
|
7188 |
|
7189 |
|
7190 |
|
7191 |
|
7192 |
|
7193 |
|
7194 | append(sType: string, fnElement?: TElement, pStyles?: IStyles | TStylesArray, pStylesheet?: Stylesheet): Element;
|
7195 | |
7196 |
|
7197 |
|
7198 |
|
7199 |
|
7200 |
|
7201 |
|
7202 |
|
7203 |
|
7204 |
|
7205 |
|
7206 |
|
7207 |
|
7208 | insert(sType: string, fnElement?: TElement, pStyles?: IStyles | TStylesArray, pStylesheet?: Stylesheet, nIndex?: number): Element;
|
7209 | |
7210 |
|
7211 |
|
7212 |
|
7213 |
|
7214 |
|
7215 | textAppend(sText: string): void;
|
7216 | |
7217 |
|
7218 |
|
7219 |
|
7220 |
|
7221 |
|
7222 | textInsert(sText: string): void;
|
7223 | |
7224 |
|
7225 |
|
7226 |
|
7227 |
|
7228 |
|
7229 |
|
7230 |
|
7231 | markdown<T = undefined>(
|
7232 | pMarkdownParser: MarkdownParser<T>,
|
7233 | pOptions?: {
|
7234 |
|
7235 | features?: MarkdownFeatures;
|
7236 |
|
7237 | mentions?: (pParent: Element, pMention: T | undefined, sContent: string) => Element | undefined;
|
7238 |
|
7239 | references?: (pParent: Element, pReference: T | undefined, sContent: string) => Element | undefined;
|
7240 |
|
7241 | target?: "self" | "blank";
|
7242 | },
|
7243 | fnElement?: (pElement: Element, sType: MarkdownTypes) => void
|
7244 | ): void;
|
7245 | |
7246 |
|
7247 |
|
7248 |
|
7249 |
|
7250 | destroyChildren(): void;
|
7251 | |
7252 |
|
7253 |
|
7254 |
|
7255 |
|
7256 |
|
7257 |
|
7258 | destroy(bTidy?: boolean): HTMLElement | undefined;
|
7259 | }
|
7260 | |
7261 |
|
7262 |
|
7263 |
|
7264 | export type TFragment = (pFragment: Fragment) => void;
|
7265 | export class Fragment {
|
7266 | |
7267 |
|
7268 |
|
7269 |
|
7270 |
|
7271 |
|
7272 |
|
7273 |
|
7274 |
|
7275 |
|
7276 | static create(
|
7277 | fnFragment?: TFragment,
|
7278 | pParent?: Element | Asset | TDOMElement,
|
7279 | pInsertBefore?: Element | Asset | TDOMElement
|
7280 | ): Fragment;
|
7281 | |
7282 |
|
7283 |
|
7284 |
|
7285 |
|
7286 |
|
7287 | constructor(fnFragment?: TFragment);
|
7288 | /**
|
7289 | * Creates a new child element at the end of the fragment (or the parent element if the fragment is inserted).
|
7290 | *
|
7291 | * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
|
7292 | * @param sType Specifies the type of element to be created.
|
7293 | * @param fnElement Specifies a constructor function for the element. This function is invoked before the element is inserted into
|
7294 | * the DOM. Use it to construct the new element.
|
7295 | * @return Returns a reference to the new element.
|
7296 | */
|
7297 | create(sType: string, fnElement?: TElement): Element | undefined;
|
7298 | /**
|
7299 | * Appends a new child element to the end of the fragment (or the parent element if the fragment is inserted).
|
7300 | *
|
7301 | * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
|
7302 | * @param sType Specifies the type of element to be created.
|
7303 | * @param fnElement Specifies a constructor function for the element. This function is invoked before the element is inserted into
|
7304 | * the DOM. Use it to construct the new element.
|
7305 | * @return Returns a reference to the new element.
|
7306 | */
|
7307 | append(sType: string, fnElement?: TElement): Element | undefined;
|
7308 | /**
|
7309 | * Inserts a new child element into the fragment (or the parent element if the fragment is inserted).
|
7310 | *
|
7311 | * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
|
7312 | * @param sType Specifies the type of element to be created.
|
7313 | * @param pInsertBefore Specifies the before element.
|
7314 | * @param fnElement Specifies a constructor function for the element. This function is invoked before the element is inserted into
|
7315 | * the DOM. Use it to construct the new element.
|
7316 | * @return Returns a reference to the new element.
|
7317 | */
|
7318 | insertBefore(sType: string, pInsertBefore: Element | Asset | TDOMElement, fnElement?: TElement): Element | undefined;
|
7319 | /**
|
7320 | * Relfects the fragment to the DOM.
|
7321 | *
|
7322 | * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
|
7323 | * @param pParent Specifies an optional parent element. If omitted the fragment will be inserted into the document body.
|
7324 | * @param pInsertBefore Specifies the element before the fragment is inserted.
|
7325 | */
|
7326 | reflect(pParent?: Element | Asset | TDOMElement, pInsertBefore?: Element | Asset | TDOMElement): void;
|
7327 | }
|
7328 | /**
|
7329 | * # Perspective
|
7330 | *
|
7331 | * Perform perspective skew or warp on HTML elements using 3D transformation.
|
7332 | */
|
7333 | /**
|
7334 | * Calculates the skew 3D matrix transformation string.
|
7335 | * @param pProperties Specifies the transformation properties.
|
7336 | * @return Returns the transformation string.
|
7337 | */
|
7338 | export function perspective(pProperties: {
|
7339 |
|
7340 | leftTopX: number;
|
7341 |
|
7342 | leftTopY: number;
|
7343 |
|
7344 | rightTopX: number;
|
7345 |
|
7346 | rightTopY: number;
|
7347 |
|
7348 | leftBottomX: number;
|
7349 |
|
7350 | leftBottomY: number;
|
7351 |
|
7352 | rightBottomX: number;
|
7353 |
|
7354 | rightBottomY: number;
|
7355 |
|
7356 | width: number;
|
7357 |
|
7358 | height: number;
|
7359 | }): string;
|
7360 | /** Retrieves style rules for desktop class applications. */
|
7361 | export const desktopStyles: () => IStyleRules;
|
7362 | /**
|
7363 | * Apply style rules for desktop class applications.
|
7364 | * @param pStylesheet Reference to the stylesheet.
|
7365 | */
|
7366 | export function desktopStylesheet(pStylesheet?: Stylesheet): void;
|
7367 | export namespace SVG {
|
7368 | /**
|
7369 | * Creates a SVG drawing from a string.
|
7370 | * @param nWidth Width of the image.
|
7371 | * @param nHeight Height of the image.
|
7372 | * @param sSVG Contains the drawing string.
|
7373 | * @return Returns the SVG string.
|
7374 | */
|
7375 | function create(nWidth: number, nHeight: number, sSVG: string): string;
|
7376 | /**
|
7377 | * Creates a bas64 encoded SVG drawing from a string.
|
7378 | * @param nWidth Width of the image.
|
7379 | * @param nHeight Height of the image.
|
7380 | * @param sSVG Contains the drawing string.
|
7381 | * @return Returns the base64 encoded SVG string.
|
7382 | */
|
7383 | function createBase64(nWidth: number, nHeight: number, sSVG: string): string;
|
7384 | /**
|
7385 | * Renders a SVG drawing from a string to an image asset.
|
7386 | *
|
7387 | * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
|
7388 | * @param pAsset Reference to the asset which receives the SVG drawing.
|
7389 | * @param nWidth Width of the image.
|
7390 | * @param nHeight Height of the image.
|
7391 | * @param sSVG Contains the drawing string.
|
7392 | * @param bResize Specifies if the asset needs to be resized (enabled by default).
|
7393 | */
|
7394 | function apply(pAsset: Asset, nWidth: number, nHeight: number, sSVG: string, bResize?: boolean): void;
|
7395 | /**
|
7396 | * Renders a SVG drawing from a string to the background of an asset.
|
7397 | *
|
7398 | * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
|
7399 | * @param pAsset Reference to the asset which receives the SVG drawing as a background.
|
7400 | * @param nWidth Width of the image.
|
7401 | * @param nHeight Height of the image.
|
7402 | * @param sSVG Contains the drawing string.
|
7403 | * @param bBackgroundResize Specifies if the background of the asset needs to be resized (enabled by default). The `background-size`
|
7404 | * property is set and the `background-repeat` property is set to `no-repeat`.
|
7405 | * @param bElementResize Specifies if the asset needs to be resized (enabled by default).
|
7406 | */
|
7407 | function background(
|
7408 | pAsset: Asset,
|
7409 | nWidth: number,
|
7410 | nHeight: number,
|
7411 | sSVG: string,
|
7412 | bBackgroundResize?: boolean,
|
7413 | bElementResize?: boolean
|
7414 | ): void;
|
7415 | }
|
7416 | }
|
7417 |
|
7418 | declare module "tripetto/module/functional" {
|
7419 | export type TAny = any;
|
7420 | export type TArguments = TAny[];
|
7421 | /** Describes an object. */
|
7422 | export interface IObject {
|
7423 | [name: string]: TAny;
|
7424 | }
|
7425 | /** Describes a collection. */
|
7426 | export interface ICollection<T> {
|
7427 |
|
7428 | length: number;
|
7429 |
|
7430 | item(nIndex: number): T;
|
7431 | }
|
7432 |
|
7433 | export interface IEnumerable<T> {
|
7434 | [name: string]: T;
|
7435 | }
|
7436 |
|
7437 | export type TList<T> = T[] | ICollection<T> | IEnumerable<T>;
|
7438 |
|
7439 | export function noop(): void;
|
7440 | |
7441 |
|
7442 |
|
7443 |
|
7444 |
|
7445 |
|
7446 |
|
7447 |
|
7448 |
|
7449 |
|
7450 |
|
7451 |
|
7452 | export function isUndefined(pVariable: TAny): pVariable is undefined;
|
7453 | |
7454 |
|
7455 |
|
7456 |
|
7457 |
|
7458 |
|
7459 |
|
7460 |
|
7461 |
|
7462 |
|
7463 |
|
7464 |
|
7465 | export function isDefined(pVariable: TAny): boolean;
|
7466 | |
7467 |
|
7468 |
|
7469 |
|
7470 |
|
7471 |
|
7472 |
|
7473 |
|
7474 |
|
7475 |
|
7476 |
|
7477 |
|
7478 |
|
7479 |
|
7480 |
|
7481 |
|
7482 |
|
7483 |
|
7484 |
|
7485 |
|
7486 |
|
7487 | export function isNull(pVariable: TAny): pVariable is null;
|
7488 | |
7489 |
|
7490 |
|
7491 |
|
7492 |
|
7493 |
|
7494 |
|
7495 |
|
7496 |
|
7497 |
|
7498 |
|
7499 |
|
7500 |
|
7501 |
|
7502 |
|
7503 | export function isObject(pObject: TAny): pObject is {
|
7504 | [property: string]: TAny;
|
7505 | };
|
7506 | |
7507 |
|
7508 |
|
7509 |
|
7510 |
|
7511 |
|
7512 |
|
7513 |
|
7514 |
|
7515 |
|
7516 |
|
7517 | export function isFunction(pFunction: TAny): pFunction is (...pArguments: TAny[]) => void | TAny;
|
7518 | |
7519 |
|
7520 |
|
7521 |
|
7522 |
|
7523 |
|
7524 |
|
7525 |
|
7526 |
|
7527 |
|
7528 |
|
7529 |
|
7530 | export function isString(pString: TAny): pString is string;
|
7531 | |
7532 |
|
7533 |
|
7534 |
|
7535 |
|
7536 |
|
7537 |
|
7538 |
|
7539 |
|
7540 |
|
7541 |
|
7542 |
|
7543 | export function stringLength(pString: TAny): number;
|
7544 | |
7545 |
|
7546 |
|
7547 |
|
7548 |
|
7549 |
|
7550 |
|
7551 |
|
7552 |
|
7553 |
|
7554 |
|
7555 |
|
7556 |
|
7557 | export function isFilledString(pString: TAny): pString is string;
|
7558 | |
7559 |
|
7560 |
|
7561 |
|
7562 |
|
7563 |
|
7564 |
|
7565 |
|
7566 |
|
7567 |
|
7568 |
|
7569 |
|
7570 |
|
7571 |
|
7572 |
|
7573 | export function isNumber(pNumber: TAny): pNumber is number;
|
7574 | |
7575 |
|
7576 |
|
7577 |
|
7578 |
|
7579 |
|
7580 |
|
7581 |
|
7582 |
|
7583 |
|
7584 |
|
7585 |
|
7586 |
|
7587 |
|
7588 |
|
7589 |
|
7590 | export function isNumberFinite(pNumber: TAny, nRangeLower?: number, nRangeUpper?: number): pNumber is number;
|
7591 | |
7592 |
|
7593 |
|
7594 |
|
7595 |
|
7596 |
|
7597 |
|
7598 |
|
7599 |
|
7600 |
|
7601 |
|
7602 |
|
7603 |
|
7604 |
|
7605 |
|
7606 |
|
7607 |
|
7608 | export function isFloat(pFloat: TAny, fRangeLower?: number, fRangeUpper?: number): pFloat is number;
|
7609 | |
7610 |
|
7611 |
|
7612 |
|
7613 |
|
7614 |
|
7615 |
|
7616 |
|
7617 |
|
7618 |
|
7619 |
|
7620 |
|
7621 | export function isBoolean(pBool: TAny): pBool is boolean;
|
7622 | |
7623 |
|
7624 |
|
7625 |
|
7626 |
|
7627 |
|
7628 |
|
7629 |
|
7630 |
|
7631 |
|
7632 |
|
7633 |
|
7634 |
|
7635 |
|
7636 | export function isArray<T>(pArray: TAny): pArray is T[];
|
7637 | |
7638 |
|
7639 |
|
7640 |
|
7641 |
|
7642 |
|
7643 | export function isCollection(pCollection: TAny): boolean;
|
7644 | |
7645 |
|
7646 |
|
7647 |
|
7648 |
|
7649 | export function isArrayOrCollection(pArray: TAny): boolean;
|
7650 | |
7651 |
|
7652 |
|
7653 |
|
7654 |
|
7655 |
|
7656 |
|
7657 |
|
7658 |
|
7659 |
|
7660 |
|
7661 |
|
7662 | export function arraySize(pArray: TAny): number;
|
7663 | |
7664 |
|
7665 |
|
7666 |
|
7667 |
|
7668 |
|
7669 |
|
7670 |
|
7671 |
|
7672 |
|
7673 |
|
7674 |
|
7675 |
|
7676 |
|
7677 |
|
7678 |
|
7679 |
|
7680 |
|
7681 | export function arrayItem<T>(pArray: TList<T> | undefined, nIndex: number, pDefault?: T): T | undefined;
|
7682 | |
7683 |
|
7684 |
|
7685 |
|
7686 |
|
7687 |
|
7688 |
|
7689 |
|
7690 |
|
7691 |
|
7692 |
|
7693 |
|
7694 |
|
7695 |
|
7696 | export function firstArrayItem<T>(pArray: TList<T> | undefined, pDefault?: T): T | undefined;
|
7697 | |
7698 |
|
7699 |
|
7700 |
|
7701 |
|
7702 |
|
7703 |
|
7704 |
|
7705 |
|
7706 |
|
7707 |
|
7708 |
|
7709 |
|
7710 |
|
7711 | export function lastArrayItem<T>(pArray: TList<T> | undefined, pDefault?: T): T | undefined;
|
7712 | |
7713 |
|
7714 |
|
7715 |
|
7716 |
|
7717 |
|
7718 |
|
7719 |
|
7720 |
|
7721 |
|
7722 |
|
7723 | export function isDate(pDate: TAny): pDate is Date;
|
7724 | |
7725 |
|
7726 |
|
7727 |
|
7728 |
|
7729 |
|
7730 |
|
7731 |
|
7732 |
|
7733 |
|
7734 |
|
7735 | export function isRegEx(pRegEx: TAny): boolean;
|
7736 | |
7737 |
|
7738 |
|
7739 |
|
7740 |
|
7741 |
|
7742 |
|
7743 |
|
7744 |
|
7745 |
|
7746 |
|
7747 | export function isError(pError: TAny): boolean;
|
7748 | |
7749 |
|
7750 |
|
7751 |
|
7752 |
|
7753 |
|
7754 | export function assert<T>(pAssert: T | undefined, sError?: string): T;
|
7755 | |
7756 |
|
7757 |
|
7758 |
|
7759 |
|
7760 | export function cast<To>(pSource: TAny): To;
|
7761 | |
7762 |
|
7763 |
|
7764 |
|
7765 |
|
7766 |
|
7767 |
|
7768 |
|
7769 |
|
7770 |
|
7771 |
|
7772 |
|
7773 |
|
7774 |
|
7775 | export function castToString(pValue: TAny, sDefault?: string): string;
|
7776 | |
7777 |
|
7778 |
|
7779 |
|
7780 |
|
7781 |
|
7782 |
|
7783 |
|
7784 |
|
7785 |
|
7786 |
|
7787 |
|
7788 |
|
7789 |
|
7790 | export function castToNumber(pValue: TAny, nDefault?: number): number;
|
7791 | |
7792 |
|
7793 |
|
7794 |
|
7795 |
|
7796 |
|
7797 |
|
7798 |
|
7799 |
|
7800 |
|
7801 |
|
7802 |
|
7803 |
|
7804 |
|
7805 | export function castToFloat(pValue: TAny, fDefault?: number): number;
|
7806 | |
7807 |
|
7808 |
|
7809 |
|
7810 |
|
7811 |
|
7812 |
|
7813 |
|
7814 |
|
7815 |
|
7816 |
|
7817 |
|
7818 |
|
7819 |
|
7820 | export function castToBoolean(pValue: TAny, bDefault?: boolean): boolean;
|
7821 | |
7822 |
|
7823 |
|
7824 |
|
7825 |
|
7826 |
|
7827 |
|
7828 |
|
7829 |
|
7830 |
|
7831 |
|
7832 |
|
7833 | export function clone<T extends IObject>(pObject: T): T;
|
7834 | |
7835 |
|
7836 |
|
7837 |
|
7838 |
|
7839 |
|
7840 |
|
7841 |
|
7842 |
|
7843 |
|
7844 |
|
7845 |
|
7846 |
|
7847 |
|
7848 |
|
7849 | export function extend<T extends IObject>(pObject: Partial<T>, ...pObjects: (Partial<T> | undefined)[]): T;
|
7850 | |
7851 |
|
7852 |
|
7853 |
|
7854 |
|
7855 |
|
7856 |
|
7857 |
|
7858 |
|
7859 |
|
7860 |
|
7861 |
|
7862 |
|
7863 |
|
7864 | export function extendImmutable<T extends IObject>(...pObjects: (Partial<T> | undefined)[]): T;
|
7865 | |
7866 |
|
7867 |
|
7868 |
|
7869 |
|
7870 |
|
7871 |
|
7872 |
|
7873 |
|
7874 |
|
7875 |
|
7876 |
|
7877 |
|
7878 |
|
7879 |
|
7880 |
|
7881 | export function compare(pA: TAny, pB: TAny, bCompareValues: boolean): boolean;
|
7882 | |
7883 |
|
7884 |
|
7885 |
|
7886 |
|
7887 |
|
7888 |
|
7889 |
|
7890 |
|
7891 |
|
7892 |
|
7893 |
|
7894 |
|
7895 |
|
7896 |
|
7897 |
|
7898 |
|
7899 |
|
7900 |
|
7901 |
|
7902 |
|
7903 |
|
7904 |
|
7905 |
|
7906 | export function each<T>(
|
7907 | pList: TList<T> | undefined,
|
7908 | fnCallee: (pItem: T, ...pArguments: TArguments) => T | void,
|
7909 | pOptions?: {
|
7910 | |
7911 |
|
7912 |
|
7913 |
|
7914 | replace?: boolean;
|
7915 | |
7916 |
|
7917 |
|
7918 |
|
7919 | keys?: boolean;
|
7920 | |
7921 |
|
7922 |
|
7923 | arguments?: TArguments;
|
7924 | }
|
7925 | ): TList<T> | undefined;
|
7926 | |
7927 |
|
7928 |
|
7929 |
|
7930 |
|
7931 |
|
7932 |
|
7933 |
|
7934 |
|
7935 |
|
7936 |
|
7937 |
|
7938 |
|
7939 |
|
7940 |
|
7941 |
|
7942 |
|
7943 |
|
7944 |
|
7945 |
|
7946 |
|
7947 |
|
7948 |
|
7949 |
|
7950 | export function eachReverse<T>(
|
7951 | pList: TList<T> | undefined,
|
7952 | fnCallee: (pItem: T, ...pArguments: TArguments) => T | void,
|
7953 | pOptions?: {
|
7954 | |
7955 |
|
7956 |
|
7957 |
|
7958 | replace?: boolean;
|
7959 | |
7960 |
|
7961 |
|
7962 |
|
7963 | keys?: boolean;
|
7964 | |
7965 |
|
7966 |
|
7967 | arguments?: TArguments;
|
7968 | }
|
7969 | ): TList<T> | undefined;
|
7970 | |
7971 |
|
7972 |
|
7973 |
|
7974 |
|
7975 |
|
7976 |
|
7977 |
|
7978 |
|
7979 |
|
7980 |
|
7981 |
|
7982 |
|
7983 |
|
7984 |
|
7985 |
|
7986 |
|
7987 |
|
7988 |
|
7989 |
|
7990 |
|
7991 |
|
7992 |
|
7993 |
|
7994 |
|
7995 | export function map<T, R>(
|
7996 | pList: TList<T> | undefined,
|
7997 | fnTransformation: (pItem: T, ...pArguments: TArguments) => R,
|
7998 | ...pArguments: TArguments
|
7999 | ): R[];
|
8000 | |
8001 |
|
8002 |
|
8003 |
|
8004 |
|
8005 |
|
8006 |
|
8007 |
|
8008 |
|
8009 |
|
8010 |
|
8011 |
|
8012 |
|
8013 |
|
8014 |
|
8015 |
|
8016 |
|
8017 |
|
8018 |
|
8019 |
|
8020 |
|
8021 |
|
8022 |
|
8023 |
|
8024 |
|
8025 |
|
8026 |
|
8027 | export function reduce<T, R>(
|
8028 | pList: TList<T> | undefined,
|
8029 | fnReduce: (pValue: R, pItem: T, ...pArguments: TArguments) => R,
|
8030 | pInitial?: R,
|
8031 | ...pArguments: TArguments
|
8032 | ): R | undefined;
|
8033 | |
8034 |
|
8035 |
|
8036 |
|
8037 |
|
8038 |
|
8039 |
|
8040 |
|
8041 |
|
8042 |
|
8043 |
|
8044 |
|
8045 |
|
8046 |
|
8047 |
|
8048 |
|
8049 |
|
8050 |
|
8051 |
|
8052 |
|
8053 |
|
8054 |
|
8055 |
|
8056 | export function has<T>(pList: TList<T> | undefined, fnTruth: (pItem: T) => boolean, bOneOrMore?: boolean): boolean;
|
8057 | |
8058 |
|
8059 |
|
8060 |
|
8061 |
|
8062 |
|
8063 |
|
8064 |
|
8065 |
|
8066 |
|
8067 |
|
8068 |
|
8069 |
|
8070 |
|
8071 |
|
8072 |
|
8073 |
|
8074 |
|
8075 |
|
8076 | export function hasOnly<T>(pList: TList<T> | undefined, fnTruth: (pItem: T) => boolean): boolean;
|
8077 | |
8078 |
|
8079 |
|
8080 |
|
8081 |
|
8082 |
|
8083 |
|
8084 |
|
8085 |
|
8086 |
|
8087 |
|
8088 |
|
8089 |
|
8090 |
|
8091 |
|
8092 |
|
8093 |
|
8094 |
|
8095 |
|
8096 | export function hasOneOrMore<T>(pList: TList<T> | undefined, fnTruth: (pItem: T) => boolean): boolean;
|
8097 | |
8098 |
|
8099 |
|
8100 |
|
8101 |
|
8102 |
|
8103 |
|
8104 |
|
8105 |
|
8106 |
|
8107 |
|
8108 |
|
8109 |
|
8110 |
|
8111 |
|
8112 |
|
8113 |
|
8114 |
|
8115 |
|
8116 | export function count<T>(pList: TList<T> | undefined, fnTruth?: (pItem: T) => boolean): number;
|
8117 | |
8118 |
|
8119 |
|
8120 |
|
8121 |
|
8122 |
|
8123 |
|
8124 |
|
8125 |
|
8126 |
|
8127 |
|
8128 |
|
8129 |
|
8130 |
|
8131 |
|
8132 |
|
8133 |
|
8134 |
|
8135 |
|
8136 |
|
8137 |
|
8138 |
|
8139 |
|
8140 |
|
8141 | export function forEach<T>(
|
8142 | pList: TList<T> | undefined,
|
8143 | fnTruth: (pItem: T) => boolean,
|
8144 | pOptions?: {
|
8145 | |
8146 |
|
8147 |
|
8148 |
|
8149 |
|
8150 |
|
8151 |
|
8152 |
|
8153 |
|
8154 | do?: (pItem: T, ...pArguments: TArguments) => T | void;
|
8155 | |
8156 |
|
8157 |
|
8158 |
|
8159 | replace?: boolean;
|
8160 | |
8161 |
|
8162 |
|
8163 |
|
8164 | return?: "none" | "matches" | "first" | "last";
|
8165 |
|
8166 | arguments?: TArguments;
|
8167 | }
|
8168 | ): T[] | T | undefined;
|
8169 | |
8170 |
|
8171 |
|
8172 |
|
8173 |
|
8174 |
|
8175 |
|
8176 |
|
8177 |
|
8178 |
|
8179 |
|
8180 |
|
8181 |
|
8182 |
|
8183 |
|
8184 |
|
8185 |
|
8186 |
|
8187 | export function filter<T>(pList: TList<T> | undefined, fnTruth: (pItem: T) => boolean): T[];
|
8188 | |
8189 |
|
8190 |
|
8191 |
|
8192 |
|
8193 |
|
8194 |
|
8195 |
|
8196 |
|
8197 |
|
8198 |
|
8199 |
|
8200 |
|
8201 |
|
8202 |
|
8203 |
|
8204 |
|
8205 |
|
8206 | export function findFirst<T>(pList: TList<T> | undefined, fnTruth: (pItem: T) => boolean): T | undefined;
|
8207 | |
8208 |
|
8209 |
|
8210 |
|
8211 |
|
8212 |
|
8213 |
|
8214 |
|
8215 |
|
8216 |
|
8217 |
|
8218 |
|
8219 |
|
8220 |
|
8221 |
|
8222 |
|
8223 |
|
8224 |
|
8225 | export function findLast<T>(pList: TList<T> | undefined, fnTruth: (pItem: T) => boolean): T | undefined;
|
8226 | |
8227 |
|
8228 |
|
8229 |
|
8230 |
|
8231 |
|
8232 |
|
8233 |
|
8234 |
|
8235 |
|
8236 |
|
8237 |
|
8238 |
|
8239 |
|
8240 |
|
8241 |
|
8242 |
|
8243 |
|
8244 |
|
8245 | export function find<T>(pList: TList<T> | undefined, fnTruth: (pItem: T) => boolean): string | number | undefined;
|
8246 | |
8247 |
|
8248 |
|
8249 |
|
8250 |
|
8251 |
|
8252 |
|
8253 | export function call<T>(fnCallee: ((...pArguments: TArguments) => T | void) | undefined, ...pArguments: TArguments): T | undefined;
|
8254 | |
8255 |
|
8256 |
|
8257 |
|
8258 |
|
8259 |
|
8260 | export function callAsync(fnCallee: ((...pArguments: TArguments) => void) | undefined, ...pArguments: TArguments): void;
|
8261 | |
8262 |
|
8263 |
|
8264 |
|
8265 |
|
8266 |
|
8267 | export function callPromise(fnCallee: ((...pArguments: TArguments) => void) | undefined, ...pArguments: TArguments): void;
|
8268 | |
8269 |
|
8270 |
|
8271 |
|
8272 |
|
8273 |
|
8274 |
|
8275 | export function callEx(
|
8276 | fnCallee: ((...pArguments: TArguments) => void) | undefined,
|
8277 | bSynchronous: boolean,
|
8278 | ...pArguments: TArguments
|
8279 | ): void;
|
8280 | |
8281 |
|
8282 |
|
8283 |
|
8284 |
|
8285 |
|
8286 |
|
8287 |
|
8288 | export function callBind<T>(
|
8289 | fnCallee: ((...pArguments: TArguments) => T | void) | undefined,
|
8290 | pContext: {},
|
8291 | ...pArguments: TArguments
|
8292 | ): T | undefined;
|
8293 | |
8294 |
|
8295 |
|
8296 |
|
8297 |
|
8298 |
|
8299 | export function callFunction(fnCallee: TAny, ...pArguments: TArguments): TAny;
|
8300 | |
8301 |
|
8302 |
|
8303 |
|
8304 |
|
8305 |
|
8306 | export function scheduleTick(fnCallee: ((...pArguments: TArguments) => void) | undefined, ...pArguments: TArguments): number;
|
8307 | |
8308 |
|
8309 |
|
8310 |
|
8311 |
|
8312 |
|
8313 |
|
8314 | export function scheduleAndCancelTick(
|
8315 | fnCallee: ((...pArguments: TArguments) => void) | undefined,
|
8316 | nHandle: number,
|
8317 | ...pArguments: TArguments
|
8318 | ): number;
|
8319 | |
8320 |
|
8321 |
|
8322 |
|
8323 |
|
8324 | export function cancelTick(nHandle: number): number;
|
8325 | |
8326 |
|
8327 |
|
8328 |
|
8329 |
|
8330 |
|
8331 | export function schedulePromise(fnCallee: ((...pArguments: TArguments) => void) | undefined, ...pArguments: TArguments): number;
|
8332 | |
8333 |
|
8334 |
|
8335 |
|
8336 |
|
8337 |
|
8338 |
|
8339 | export function scheduleAndCancelPromise(
|
8340 | fnCallee: ((...pArguments: TArguments) => void) | undefined,
|
8341 | nHandle: number,
|
8342 | ...pArguments: TArguments
|
8343 | ): number;
|
8344 | |
8345 |
|
8346 |
|
8347 |
|
8348 |
|
8349 | export function cancelPromise(nHandle: number): number;
|
8350 | |
8351 |
|
8352 |
|
8353 |
|
8354 |
|
8355 |
|
8356 | export function scheduleFrame(fnCallee: ((...pArguments: TArguments) => void) | undefined, ...pArguments: TArguments): number;
|
8357 | |
8358 |
|
8359 |
|
8360 |
|
8361 |
|
8362 |
|
8363 |
|
8364 | export function scheduleAndCancelFrame(
|
8365 | fnCallee: ((...pArguments: TArguments) => void) | undefined,
|
8366 | nHandle: number,
|
8367 | ...pArguments: TArguments
|
8368 | ): number;
|
8369 | |
8370 |
|
8371 |
|
8372 |
|
8373 |
|
8374 | export function cancelFrame(nHandle: number): number;
|
8375 | |
8376 |
|
8377 |
|
8378 |
|
8379 |
|
8380 |
|
8381 |
|
8382 | export function scheduleTimeout(fnCallee: (...pArguments: TArguments) => void, nTimeout: number, ...pArguments: TArguments): number;
|
8383 | |
8384 |
|
8385 |
|
8386 |
|
8387 |
|
8388 | export function cancelTimeout(nHandle: number): number;
|
8389 | |
8390 |
|
8391 |
|
8392 |
|
8393 |
|
8394 |
|
8395 |
|
8396 |
|
8397 |
|
8398 | export function scheduleUITimeout(fnCallee: (...pArguments: TArguments) => void, nTimeout: number, ...pArguments: TArguments): number;
|
8399 | |
8400 |
|
8401 |
|
8402 |
|
8403 |
|
8404 | export function cancelUITimeout(nHandle: number): number;
|
8405 | |
8406 |
|
8407 |
|
8408 |
|
8409 |
|
8410 |
|
8411 |
|
8412 | export function scheduleInterval(fnCallee: (...pArguments: TArguments) => void, nInterval: number, ...pArguments: TArguments): number;
|
8413 | |
8414 |
|
8415 |
|
8416 |
|
8417 |
|
8418 | export function cancelInterval(nHandle: number): number;
|
8419 | |
8420 |
|
8421 |
|
8422 |
|
8423 |
|
8424 |
|
8425 |
|
8426 |
|
8427 |
|
8428 | export function scheduleUIInterval(fnCallee: (...pArguments: TArguments) => void, nInterval: number, ...pArguments: TArguments): number;
|
8429 | |
8430 |
|
8431 |
|
8432 |
|
8433 |
|
8434 | export function cancelUIInterval(nHandle: number): number;
|
8435 | |
8436 |
|
8437 |
|
8438 |
|
8439 |
|
8440 |
|
8441 |
|
8442 | export function scheduleNumberOfFrames(
|
8443 | fnAnimation: ((...pArguments: TArguments) => void) | undefined,
|
8444 | nFrames: number,
|
8445 | ...pArguments: TArguments
|
8446 | ): void;
|
8447 | |
8448 |
|
8449 |
|
8450 |
|
8451 |
|
8452 |
|
8453 |
|
8454 | export function scheduleAnimation(fnAnimation: ((...pArguments: TArguments) => void) | undefined, ...pArguments: TArguments): void;
|
8455 | |
8456 |
|
8457 |
|
8458 |
|
8459 |
|
8460 |
|
8461 | export function scheduleEvent(fnEvent: ((...pArguments: TArguments) => void) | undefined, ...pArguments: TArguments): void;
|
8462 | |
8463 |
|
8464 |
|
8465 |
|
8466 |
|
8467 |
|
8468 | export function scheduleAction(fnAction: ((...pArguments: TArguments) => void) | undefined, ...pArguments: TArguments): void;
|
8469 | |
8470 |
|
8471 |
|
8472 |
|
8473 |
|
8474 |
|
8475 |
|
8476 | export function set<T, K extends keyof T>(pObject: T, sName: K, pValue: T[K]): T[K];
|
8477 | |
8478 |
|
8479 |
|
8480 |
|
8481 |
|
8482 |
|
8483 |
|
8484 |
|
8485 | export function setAny<T>(pObject: TAny, sName: string, pValue: T): T;
|
8486 | |
8487 |
|
8488 |
|
8489 |
|
8490 |
|
8491 |
|
8492 | export function get<T, K extends keyof T>(pObject: T, sName: K): T[K];
|
8493 | |
8494 |
|
8495 |
|
8496 |
|
8497 |
|
8498 |
|
8499 |
|
8500 | export function getAny<T>(pObject: IObject | undefined, sName: string): T | undefined;
|
8501 | |
8502 |
|
8503 |
|
8504 |
|
8505 |
|
8506 |
|
8507 |
|
8508 | export function getBoolean(pObject: IObject | undefined, sName: string, bDefault?: boolean): boolean;
|
8509 | |
8510 |
|
8511 |
|
8512 |
|
8513 |
|
8514 |
|
8515 |
|
8516 | export function getString(pObject: IObject | undefined, sName: string, sDefault?: string): string;
|
8517 | |
8518 |
|
8519 |
|
8520 |
|
8521 |
|
8522 |
|
8523 |
|
8524 | export function getNumber(pObject: IObject | undefined, sName: string, nDefault?: number): number;
|
8525 | |
8526 |
|
8527 |
|
8528 |
|
8529 |
|
8530 |
|
8531 |
|
8532 | export function getFloat(pObject: IObject | undefined, sName: string, fDefault?: number): number;
|
8533 | |
8534 |
|
8535 |
|
8536 |
|
8537 |
|
8538 |
|
8539 | export function destroy(pObject: IObject | undefined, sName: string): boolean;
|
8540 | |
8541 |
|
8542 |
|
8543 |
|
8544 |
|
8545 |
|
8546 |
|
8547 |
|
8548 |
|
8549 |
|
8550 |
|
8551 |
|
8552 |
|
8553 |
|
8554 |
|
8555 |
|
8556 |
|
8557 |
|
8558 | export function createInstanceOf<T>(
|
8559 | pConstructor: {
|
8560 | new (...pArguments: TArguments): T;
|
8561 | },
|
8562 | ...pArguments: TArguments
|
8563 | ): T;
|
8564 | export namespace Console {
|
8565 | |
8566 |
|
8567 |
|
8568 |
|
8569 | function time(): string;
|
8570 | |
8571 |
|
8572 |
|
8573 |
|
8574 |
|
8575 | function module(sName: string): string;
|
8576 | |
8577 |
|
8578 |
|
8579 |
|
8580 |
|
8581 |
|
8582 | function log(sName: string, sMessage: string): string;
|
8583 | }
|
8584 | export namespace Environment {
|
8585 |
|
8586 | const isBrowser: boolean;
|
8587 |
|
8588 | const isNode: boolean;
|
8589 |
|
8590 | const isWebWorker: boolean;
|
8591 | }
|
8592 | export namespace Num {
|
8593 | |
8594 |
|
8595 |
|
8596 |
|
8597 |
|
8598 |
|
8599 |
|
8600 |
|
8601 |
|
8602 |
|
8603 |
|
8604 |
|
8605 | function round(fValue: number): number;
|
8606 | |
8607 |
|
8608 |
|
8609 |
|
8610 |
|
8611 |
|
8612 |
|
8613 |
|
8614 |
|
8615 |
|
8616 |
|
8617 | function floor(fValue: number): number;
|
8618 | |
8619 |
|
8620 |
|
8621 |
|
8622 |
|
8623 |
|
8624 |
|
8625 |
|
8626 |
|
8627 |
|
8628 |
|
8629 | function ceil(fValue: number): number;
|
8630 | |
8631 |
|
8632 |
|
8633 |
|
8634 |
|
8635 |
|
8636 |
|
8637 |
|
8638 |
|
8639 |
|
8640 |
|
8641 |
|
8642 |
|
8643 | function conform(fValue: number, nPrecision: number): number;
|
8644 | |
8645 |
|
8646 |
|
8647 |
|
8648 |
|
8649 |
|
8650 |
|
8651 |
|
8652 |
|
8653 |
|
8654 |
|
8655 |
|
8656 | function positive(nValue: number): number;
|
8657 | |
8658 |
|
8659 |
|
8660 |
|
8661 |
|
8662 |
|
8663 |
|
8664 |
|
8665 |
|
8666 |
|
8667 |
|
8668 |
|
8669 | function negative(nValue: number): number;
|
8670 | |
8671 |
|
8672 |
|
8673 |
|
8674 |
|
8675 |
|
8676 |
|
8677 |
|
8678 |
|
8679 |
|
8680 |
|
8681 |
|
8682 | function max(nA: number, nB: number): number;
|
8683 | |
8684 |
|
8685 |
|
8686 |
|
8687 |
|
8688 |
|
8689 |
|
8690 |
|
8691 |
|
8692 |
|
8693 |
|
8694 | function maxL(...pArguments: number[]): number;
|
8695 | |
8696 |
|
8697 |
|
8698 |
|
8699 |
|
8700 |
|
8701 |
|
8702 |
|
8703 |
|
8704 |
|
8705 |
|
8706 |
|
8707 | function min(nA: number, nB: number): number;
|
8708 | |
8709 |
|
8710 |
|
8711 |
|
8712 |
|
8713 |
|
8714 |
|
8715 |
|
8716 |
|
8717 |
|
8718 |
|
8719 | function minL(...pArguments: number[]): number;
|
8720 | |
8721 |
|
8722 |
|
8723 |
|
8724 |
|
8725 |
|
8726 |
|
8727 |
|
8728 |
|
8729 |
|
8730 |
|
8731 |
|
8732 |
|
8733 |
|
8734 | function range(nValue: number, nMin: number, nMax?: number): number;
|
8735 | |
8736 |
|
8737 |
|
8738 |
|
8739 |
|
8740 |
|
8741 |
|
8742 |
|
8743 |
|
8744 |
|
8745 |
|
8746 |
|
8747 |
|
8748 |
|
8749 |
|
8750 |
|
8751 | function inRange(nValue: number, nMin: number, nMax: number, bEdgeMin?: boolean, bEdgeMax?: boolean): boolean;
|
8752 | |
8753 |
|
8754 |
|
8755 |
|
8756 |
|
8757 |
|
8758 |
|
8759 |
|
8760 |
|
8761 |
|
8762 |
|
8763 |
|
8764 |
|
8765 |
|
8766 |
|
8767 |
|
8768 | function format(
|
8769 | nValue: number | string,
|
8770 | nPrecision?: number | "auto",
|
8771 | sSeparator?: string,
|
8772 | sDecimal?: string,
|
8773 | sMinus?: string
|
8774 | ): string;
|
8775 | }
|
8776 | export namespace Str {
|
8777 | |
8778 |
|
8779 |
|
8780 |
|
8781 |
|
8782 |
|
8783 |
|
8784 |
|
8785 |
|
8786 |
|
8787 |
|
8788 | function lowercase(sValue: string): string;
|
8789 | |
8790 |
|
8791 |
|
8792 |
|
8793 |
|
8794 |
|
8795 |
|
8796 |
|
8797 |
|
8798 |
|
8799 |
|
8800 | function uppercase(sValue: string): string;
|
8801 | |
8802 |
|
8803 |
|
8804 |
|
8805 |
|
8806 |
|
8807 |
|
8808 |
|
8809 |
|
8810 |
|
8811 |
|
8812 |
|
8813 |
|
8814 |
|
8815 |
|
8816 | function capitalize(sValue: string, sMode?: "first-character" | "each-word" | "each-sentence", bLowercase?: boolean): string;
|
8817 | |
8818 |
|
8819 |
|
8820 |
|
8821 |
|
8822 |
|
8823 |
|
8824 |
|
8825 |
|
8826 |
|
8827 |
|
8828 | function trim(sValue: string): string;
|
8829 | |
8830 |
|
8831 |
|
8832 |
|
8833 |
|
8834 |
|
8835 |
|
8836 |
|
8837 |
|
8838 |
|
8839 |
|
8840 | function trimLeft(sValue: string): string;
|
8841 | |
8842 |
|
8843 |
|
8844 |
|
8845 |
|
8846 |
|
8847 |
|
8848 |
|
8849 |
|
8850 |
|
8851 |
|
8852 | function trimRight(sValue: string): string;
|
8853 | |
8854 |
|
8855 |
|
8856 |
|
8857 |
|
8858 |
|
8859 |
|
8860 |
|
8861 |
|
8862 |
|
8863 |
|
8864 | function trimMultiple(sValue: string): string;
|
8865 | |
8866 |
|
8867 |
|
8868 |
|
8869 |
|
8870 |
|
8871 |
|
8872 |
|
8873 |
|
8874 |
|
8875 |
|
8876 | function sanitize(sValue: string): string;
|
8877 | |
8878 |
|
8879 |
|
8880 |
|
8881 |
|
8882 |
|
8883 |
|
8884 |
|
8885 |
|
8886 |
|
8887 |
|
8888 | function removeWhitespaces(sValue: string): string;
|
8889 | |
8890 |
|
8891 |
|
8892 |
|
8893 |
|
8894 |
|
8895 |
|
8896 |
|
8897 |
|
8898 |
|
8899 |
|
8900 |
|
8901 |
|
8902 |
|
8903 |
|
8904 |
|
8905 | function limit(sValue: string, nMax: number, sAppend?: string): string;
|
8906 | |
8907 |
|
8908 |
|
8909 |
|
8910 |
|
8911 |
|
8912 |
|
8913 |
|
8914 |
|
8915 |
|
8916 |
|
8917 |
|
8918 |
|
8919 |
|
8920 | function replace(sValue: string, sWhat: string, sWith?: string, bIgnoreCase?: boolean): string;
|
8921 | |
8922 |
|
8923 |
|
8924 |
|
8925 |
|
8926 |
|
8927 |
|
8928 |
|
8929 |
|
8930 |
|
8931 |
|
8932 |
|
8933 |
|
8934 |
|
8935 | function replaceMultiple(sValue: string, pWhat: string[], sWith?: string, bIgnoreCase?: boolean): string;
|
8936 | |
8937 |
|
8938 |
|
8939 |
|
8940 |
|
8941 |
|
8942 |
|
8943 |
|
8944 |
|
8945 |
|
8946 |
|
8947 |
|
8948 | function makeHTMLSafe(sValue: string): string;
|
8949 | |
8950 |
|
8951 |
|
8952 |
|
8953 |
|
8954 |
|
8955 |
|
8956 |
|
8957 |
|
8958 |
|
8959 |
|
8960 | function CRLFToHTML(sValue: string): string;
|
8961 | |
8962 |
|
8963 |
|
8964 |
|
8965 |
|
8966 |
|
8967 |
|
8968 |
|
8969 |
|
8970 |
|
8971 |
|
8972 |
|
8973 |
|
8974 |
|
8975 |
|
8976 |
|
8977 |
|
8978 |
|
8979 |
|
8980 |
|
8981 |
|
8982 |
|
8983 |
|
8984 | function iterateToString<T>(
|
8985 | pList: TList<T>,
|
8986 | sSeparator?: string,
|
8987 | fnCast?: (pItem: T, ...pArguments: TArguments) => string,
|
8988 | ...pArguments: TArguments
|
8989 | ): string;
|
8990 | |
8991 |
|
8992 |
|
8993 |
|
8994 |
|
8995 |
|
8996 |
|
8997 |
|
8998 |
|
8999 |
|
9000 |
|
9001 |
|
9002 |
|
9003 | function extract(
|
9004 | sValue: string,
|
9005 | pOptions: {
|
9006 |
|
9007 | left: string;
|
9008 |
|
9009 | right?: string;
|
9010 | |
9011 |
|
9012 |
|
9013 |
|
9014 |
|
9015 | fromEnd?: boolean;
|
9016 |
|
9017 | ignoreCase?: boolean;
|
9018 | }
|
9019 | ): string;
|
9020 | |
9021 |
|
9022 |
|
9023 |
|
9024 |
|
9025 |
|
9026 |
|
9027 |
|
9028 |
|
9029 |
|
9030 |
|
9031 |
|
9032 | function fill(sFill: string, nCount: number): string;
|
9033 | |
9034 |
|
9035 |
|
9036 |
|
9037 |
|
9038 |
|
9039 |
|
9040 |
|
9041 |
|
9042 |
|
9043 |
|
9044 |
|
9045 |
|
9046 |
|
9047 |
|
9048 |
|
9049 | function padLeft(pValue: string | number, sFill: string, nLength: number, bCrop?: boolean, bTreatAsNumber?: boolean): string;
|
9050 | |
9051 |
|
9052 |
|
9053 |
|
9054 |
|
9055 |
|
9056 |
|
9057 |
|
9058 |
|
9059 |
|
9060 |
|
9061 |
|
9062 |
|
9063 |
|
9064 |
|
9065 | function padRight(pValue: string | number, sFill: string, nLength: number, bCrop?: boolean): string;
|
9066 | |
9067 |
|
9068 |
|
9069 |
|
9070 |
|
9071 |
|
9072 |
|
9073 |
|
9074 |
|
9075 |
|
9076 |
|
9077 |
|
9078 |
|
9079 |
|
9080 |
|
9081 |
|
9082 |
|
9083 | function djb2Hash(sValue: string, sPrefix?: string): string;
|
9084 | }
|
9085 | export class DateTime {
|
9086 |
|
9087 | static get now(): number;
|
9088 |
|
9089 | static get precise(): number;
|
9090 |
|
9091 | static get UTC(): number;
|
9092 |
|
9093 | static get today(): number;
|
9094 |
|
9095 | static get UTCToday(): number;
|
9096 | |
9097 |
|
9098 |
|
9099 |
|
9100 |
|
9101 | static isFuture(nTime: number): boolean;
|
9102 | |
9103 |
|
9104 |
|
9105 |
|
9106 |
|
9107 | static isPast(nTime: number): boolean;
|
9108 | |
9109 |
|
9110 |
|
9111 |
|
9112 |
|
9113 |
|
9114 | static elapsed(nTime: number, bPrecise?: boolean): number;
|
9115 | |
9116 |
|
9117 |
|
9118 |
|
9119 | static timerReset(): number;
|
9120 |
|
9121 | static get timerElapsed(): number;
|
9122 |
|
9123 | static get timerStamp(): string;
|
9124 | |
9125 |
|
9126 |
|
9127 |
|
9128 |
|
9129 |
|
9130 |
|
9131 |
|
9132 |
|
9133 |
|
9134 |
|
9135 |
|
9136 |
|
9137 |
|
9138 |
|
9139 |
|
9140 |
|
9141 |
|
9142 |
|
9143 |
|
9144 |
|
9145 |
|
9146 |
|
9147 |
|
9148 |
|
9149 |
|
9150 |
|
9151 |
|
9152 |
|
9153 |
|
9154 |
|
9155 |
|
9156 |
|
9157 |
|
9158 |
|
9159 |
|
9160 |
|
9161 |
|
9162 |
|
9163 |
|
9164 |
|
9165 |
|
9166 |
|
9167 |
|
9168 |
|
9169 |
|
9170 |
|
9171 |
|
9172 |
|
9173 |
|
9174 |
|
9175 |
|
9176 |
|
9177 |
|
9178 |
|
9179 | static format(
|
9180 | sFormat?: string,
|
9181 | nTime?: number,
|
9182 | bUTC?: boolean,
|
9183 | pLocales?: {
|
9184 |
|
9185 | monthsFormattedAbbreviated?: string[];
|
9186 |
|
9187 | monthsFormattedNarrow?: string[];
|
9188 |
|
9189 | monthsFormattedWide?: string[];
|
9190 |
|
9191 | monthsNominativeAbbreviated?: string[];
|
9192 |
|
9193 | monthsNominativeNarrow?: string[];
|
9194 |
|
9195 | monthsNominativeWide?: string[];
|
9196 |
|
9197 | weekdaysFormattedAbbreviated?: string[];
|
9198 |
|
9199 | weekdaysFormattedNarrow?: string[];
|
9200 |
|
9201 | weekdaysFormattedShort?: string[];
|
9202 |
|
9203 | weekdaysFormattedWide?: string[];
|
9204 |
|
9205 | weekdaysNominativeAbbreviated?: string[];
|
9206 |
|
9207 | weekdaysNominativeNarrow?: string[];
|
9208 |
|
9209 | weekdaysNominativeShort?: string[];
|
9210 |
|
9211 | weekdaysNominativeWide?: string[];
|
9212 |
|
9213 | AM?: string;
|
9214 |
|
9215 | PM?: string;
|
9216 | }
|
9217 | ): string;
|
9218 | |
9219 |
|
9220 |
|
9221 |
|
9222 |
|
9223 |
|
9224 |
|
9225 |
|
9226 |
|
9227 |
|
9228 |
|
9229 |
|
9230 |
|
9231 |
|
9232 |
|
9233 |
|
9234 |
|
9235 |
|
9236 |
|
9237 | static formatElapsed(sFormat?: string, nElapsed?: number, sAM?: string, sPM?: string): string;
|
9238 |
|
9239 | static get log(): string;
|
9240 |
|
9241 | static get logTime(): string;
|
9242 | |
9243 |
|
9244 |
|
9245 |
|
9246 | constructor(pDate?: DateTime | Date | number);
|
9247 | /** Retrieves the date object. */
|
9248 | get date(): Date;
|
9249 | /** Retrieves the unix time stamp. */
|
9250 | get time(): number;
|
9251 | /** Sets the unix time stamp. */
|
9252 | set time(nTime: number);
|
9253 | }
|
9254 | export class Flags {
|
9255 |
|
9256 | get flag(): number;
|
9257 | |
9258 |
|
9259 |
|
9260 |
|
9261 |
|
9262 | static convert(...pFlags: boolean[]): number;
|
9263 | |
9264 |
|
9265 |
|
9266 |
|
9267 |
|
9268 |
|
9269 | static has(nFlags: number, nIndex: number): boolean;
|
9270 | }
|
9271 | export class Enumerator {
|
9272 |
|
9273 | static get n(): number;
|
9274 |
|
9275 | get n(): number;
|
9276 |
|
9277 | set n(nEnumerator: number);
|
9278 |
|
9279 | static recycle(): void;
|
9280 |
|
9281 | recycle(): void;
|
9282 | }
|
9283 | type TType = "throttle" | "throttle-delay" | "debounce";
|
9284 | export type TCallback = (...pArguments: TArguments) => void;
|
9285 | export class Limiter {
|
9286 | |
9287 |
|
9288 |
|
9289 |
|
9290 |
|
9291 |
|
9292 |
|
9293 |
|
9294 |
|
9295 |
|
9296 |
|
9297 |
|
9298 | constructor(sType: TType, fnCallback: TCallback, nTimeout: number | "tick" | "promise" | "frame" | "double-frame");
|
9299 |
|
9300 | /**
|
9301 | * Invokes the callback with the supplied arguments.
|
9302 | * @param pArguments Specifies the arguments to pass to the callback.
|
9303 | */
|
9304 | invoke(...pArguments: TArguments): void;
|
9305 | /** Cancels any pending callbacks. */
|
9306 | cancel(): void;
|
9307 | /** Flushes any pending callbacks by executing them immediately (even when a callback is hold). */
|
9308 | flush(): void;
|
9309 | /** Hold any pending callbacks. */
|
9310 | hold(): void;
|
9311 | /**
|
9312 | * Release any pending callbacks.
|
9313 | * @param bImmediately Specifies if the release should be instantly.
|
9314 | */
|
9315 | release(bImmediately?: boolean): void;
|
9316 | }
|
9317 | export class Throttle extends Limiter {
|
9318 | |
9319 |
|
9320 |
|
9321 |
|
9322 |
|
9323 |
|
9324 |
|
9325 |
|
9326 |
|
9327 |
|
9328 |
|
9329 |
|
9330 |
|
9331 | constructor(fnCallback: TCallback, nTimeout?: number | "tick" | "promise" | "frame" | "double-frame", bDelay?: boolean);
|
9332 | }
|
9333 | export class Debounce extends Limiter {
|
9334 | |
9335 |
|
9336 |
|
9337 |
|
9338 |
|
9339 |
|
9340 |
|
9341 |
|
9342 |
|
9343 |
|
9344 | constructor(fnCallback: TCallback, nTimeout?: number | "tick" | "promise" | "frame" | "double-frame");
|
9345 | }
|
9346 | export class Stack {
|
9347 |
|
9348 | add(fnCall: () => void): void;
|
9349 |
|
9350 | flush(): void;
|
9351 |
|
9352 | clear(): void;
|
9353 |
|
9354 | flushAndClear(): void;
|
9355 | }
|
9356 |
|
9357 | export let DEBUG: boolean;
|
9358 |
|
9359 | export function enableDebugging(): void;
|
9360 |
|
9361 | export function disableDebugging(): void;
|
9362 |
|
9363 | export { TType as TLimiterType };
|
9364 | }
|
9365 |
|
9366 | declare module "tripetto/module/grid" {
|
9367 | import { Stack, TAny } from "tripetto/module/functional";
|
9368 | import { IHookPayload, THooks } from "tripetto/module/hookup";
|
9369 | import {
|
9370 | ICountChangeEvent,
|
9371 | IDimensionChangeEvent,
|
9372 | IItemChangeEvent,
|
9373 | IItemPopEvent,
|
9374 | IItemPushEvent,
|
9375 | Item,
|
9376 | Matrix,
|
9377 | Orientations,
|
9378 | Types,
|
9379 | } from "tripetto/module/matrix";
|
9380 | import { Coordinate, IPoint, Rectangle, Rectangles } from "tripetto/module/metrics";
|
9381 | import { ISerialize } from "tripetto/module/serializer";
|
9382 |
|
9383 | export interface IGridResource extends ISerialize {
|
9384 |
|
9385 | readonly id: string;
|
9386 | }
|
9387 |
|
9388 | export type TGridRectangles = Rectangles<"self" | "children">;
|
9389 | export type TGridStructure = Structure<Item<THooks>, TDispatcherFactory, TDispatcherFactory, THooks>;
|
9390 | abstract class Structure<
|
9391 | Ancestor extends Item<THooks>,
|
9392 | Dispatcher extends TDispatcherFactory,
|
9393 | Children extends TDispatcherFactory,
|
9394 | Hooks extends THooks
|
9395 | > extends Item<Hooks> {
|
9396 | |
9397 |
|
9398 |
|
9399 |
|
9400 |
|
9401 |
|
9402 |
|
9403 | constructor(
|
9404 | pDispatcher: Dispatcher | undefined,
|
9405 | fnChildren: ((pParent: Structure<Ancestor, Dispatcher, Children, Hooks>) => Children) | undefined,
|
9406 | pRenderer: GridRenderer<TGrid> | undefined
|
9407 | );
|
9408 | /** Retrieves the parent dispatcher. */
|
9409 | get parent(): Dispatcher | undefined;
|
9410 | /** Retrieves the ancestor. */
|
9411 | get ancestor(): Ancestor | undefined;
|
9412 | /** Retrieves the children of the structure. */
|
9413 | get children(): Children | undefined;
|
9414 | /** Retrieves the zoom factor. */
|
9415 | get zoom(): number;
|
9416 | /** Sets the zoom factor. */
|
9417 | set zoom(nZoom: number);
|
9418 | /** Retrieves the layout. */
|
9419 | get layout(): GridLayout<TGrid, Structure<Ancestor, Dispatcher, Children, Hooks>> | undefined;
|
9420 | /** Retrieves the renderer. */
|
9421 | get renderer(): GridRenderer<TGrid> | undefined;
|
9422 | /** Sets the renderer. */
|
9423 | set renderer(pRenderer: GridRenderer<TGrid> | undefined);
|
9424 | /** Specifies if the structure is rendered. */
|
9425 | get isRendered(): boolean;
|
9426 | /** Retrieves the rectangles of the structure. */
|
9427 | get rectangles(): TGridRectangles;
|
9428 | /** Retrieves the rectangle of the structure. */
|
9429 | get rectangle(): Rectangle;
|
9430 | /** Retrieves the left position of the structure. */
|
9431 | get left(): number;
|
9432 | /** Retrieves the top position of the structure. */
|
9433 | get top(): number;
|
9434 | /** Retrieves the right position of the structure. */
|
9435 | get right(): number;
|
9436 | /** Retrieves the bottom position of the structure. */
|
9437 | get bottom(): number;
|
9438 | /** Retrieves the width of the structure. */
|
9439 | get width(): number;
|
9440 | /** Retrieves the height of the structure. */
|
9441 | get height(): number;
|
9442 | /** Retrieves the horizontal mean of the structure. */
|
9443 | get meanHorizontal(): number;
|
9444 | /** Retrieves the vertical mean of the structure. */
|
9445 | get meanVertical(): number;
|
9446 | /** Invalidates the rendering. */
|
9447 | protected renderInvalidate(): void;
|
9448 | /**
|
9449 | * Applies the position.
|
9450 | * @param sType Specifies the change type.
|
9451 | * @return Returns `true` if the structure position is changed.
|
9452 | */
|
9453 | protected applyPosition(sType?: "redraw" | "zoom"): boolean;
|
9454 | /**
|
9455 | * Applies a resize.
|
9456 | * @param sType Specifies the resize type.
|
9457 | * @return Returns `true` if the structure is resized.
|
9458 | */
|
9459 | applyResize(sType?: "redraw" | "zoom"): boolean;
|
9460 | /**
|
9461 | * Changes the dimensions of the structure.
|
9462 | * @param nWidth Specifies the width of the structure.
|
9463 | * @param nHeight Specifies the height of the structure.
|
9464 | * @return Returns `true` if the structure is resized.
|
9465 | */
|
9466 | resize(nWidth?: number, nHeight?: number): boolean;
|
9467 | /**
|
9468 | * Iterate through each descendant of the structure.
|
9469 | * @param fnStructure Specifies the structure function.
|
9470 | * @param fnStructure.pStructure Contains a reference to the structure.
|
9471 | * @return Returns `true` if the iteration is stopped (break).
|
9472 | */
|
9473 | abstract forEachDescendant(fnStructure: (pStructure: TGridStructure) => boolean | void): boolean;
|
9474 | /**
|
9475 | * Iterate recursively through each descendant of the structure. For each
|
9476 | * structure (including the structure from which the iteration originates)
|
9477 | * a function will be invoked. This function should return `true` if the
|
9478 | * structure needs to be iterated or `false` if the iteration should
|
9479 | * continue with the next sibling structure.
|
9480 | * @param fnStructure Specifies the structure function.
|
9481 | * @param fnStructure.pStructure Contains a reference to the structure.
|
9482 | * @return Returns the result of the structure function.
|
9483 | */
|
9484 | abstract forEachDescendantRecursive(fnStructure: (pStructure: TGridStructure) => boolean | void): boolean;
|
9485 | /**
|
9486 | * Renders the structure.
|
9487 | * @param bRecursive Specifies if the underlying structures needs to be
|
9488 | * rendered.
|
9489 | */
|
9490 | render(bRecursive: boolean): void;
|
9491 | /**
|
9492 | * Invokes the layout renderer.
|
9493 | * @param sType Specifies the rerender type. Can be one of the following values:
|
9494 | * - `refresh`: Refresh the rendering;
|
9495 | * - `update`: Update the rendering.
|
9496 | */
|
9497 | rerender(sType: "refresh" | "update"): void;
|
9498 | /**
|
9499 | * Invoked when the structure is rendered. Can be used to bind events.
|
9500 | * @event
|
9501 | */
|
9502 | onRender(): void;
|
9503 | /** Resets a structure. */
|
9504 | reset(): void;
|
9505 | /** Destroys a structure. */
|
9506 | destroy(): void;
|
9507 | }
|
9508 | export interface ILayout<Grid extends TGrid, Parent extends TGridStructure> {
|
9509 | |
9510 |
|
9511 |
|
9512 |
|
9513 |
|
9514 | new (pRenderer: GridRenderer<Grid>, pParent: Parent, ...pArguments: TAny[]): GridLayout<Grid, Parent>;
|
9515 | }
|
9516 | export abstract class GridLayout<Grid extends TGrid, Parent extends TGridStructure> {
|
9517 | |
9518 |
|
9519 |
|
9520 |
|
9521 |
|
9522 | constructor(pRenderer: GridRenderer<Grid>, pParent: Parent);
|
9523 | /** Returns the layout configuration. */
|
9524 | abstract get configuration(): TGridRectangles;
|
9525 | /** Retrieves a reference to the renderer. */
|
9526 | get renderer(): GridRenderer<Grid>;
|
9527 | /** Retrieves a reference to the layout parent. */
|
9528 | get parent(): Parent;
|
9529 | /** Retrieves the horizontal offset for the layout. */
|
9530 | get x(): number;
|
9531 | /** Retrieves the vertical offset for the layout. */
|
9532 | get y(): number;
|
9533 | /**
|
9534 | * Invooked when the layout is about to resize.
|
9535 | * @param pRectangles Contains the layout rectangles.
|
9536 | */
|
9537 | beforeResize(pRectangles: TGridRectangles): void;
|
9538 | /**
|
9539 | * Fired when the z-index is changed.
|
9540 | * @param nZ Specifies the z-index.
|
9541 | * @event
|
9542 | */
|
9543 | zIndex(nZ: number): void;
|
9544 | /**
|
9545 | * Fired when the layout should be elevated.
|
9546 | * @param bElevate Specifies if the layout is elevated.
|
9547 | * @event
|
9548 | */
|
9549 | onElevate(bElevate: boolean): void;
|
9550 | /**
|
9551 | * Fired when an item becomes part of a dispatcher.
|
9552 | * @event
|
9553 | */
|
9554 | onPush(): void;
|
9555 | /**
|
9556 | * Fired when an item becomes the first item.
|
9557 | * @event
|
9558 | */
|
9559 | onFirst(): void;
|
9560 | /**
|
9561 | * Fired when an item becomes the last item.
|
9562 | * @event
|
9563 | */
|
9564 | onLast(): void;
|
9565 | /**
|
9566 | * Specifies the expansion coordinates for the move detection. These
|
9567 | * coordinates are applied to the rectangle detection. Use it to
|
9568 | * expand or contract the rectangle.
|
9569 | * @param nX Specifies the horizontal mouse coordinate.
|
9570 | * @param nY Specifies the vertical mouse coordinate.
|
9571 | * @param pTarget Specifies the target resource.
|
9572 | * @return Returns the expansion coordinates.
|
9573 | * @event
|
9574 | */
|
9575 | onMoveExpansion(nX: number, nY: number, pTarget: TGridResource): Coordinate;
|
9576 | /**
|
9577 | * Fired when the system wants to know if the supplied mouse coordinates
|
9578 | * are within the resource.
|
9579 | * @param nX Specifies the horizontal mouse coordinate.
|
9580 | * @param nY Specifies the vertical mouse coordinate.
|
9581 | * @param pTarget Specifies the target resource.
|
9582 | * @return Returns `true` if the mouse is within the resource.
|
9583 | * @event
|
9584 | */
|
9585 | onIsMoveIn(nX: number, nY: number, pTarget: TGridResource): boolean;
|
9586 | /**
|
9587 | * Specifies the function which is invoked when the move is initialized.
|
9588 | * @param nDelay Specifies the delay in milliseconds before the movement starts.
|
9589 | * @param pOffset Contains the touch/click offset relative to the resource.
|
9590 | * @return Return `true` if the move should be continued.
|
9591 | * @event
|
9592 | */
|
9593 | onMoveInit(nDelay: number, pOffset: IPoint): boolean;
|
9594 | /**
|
9595 | * Specifies the function which is invoked when the move starts.
|
9596 | * @param pOffset Contains the touch/click offset relative to the resource.
|
9597 | * @return Return `true` if the move should be continued.
|
9598 | * @event
|
9599 | */
|
9600 | onMoveStart(pOffset: IPoint): boolean;
|
9601 | /**
|
9602 | * Specifies the function which is invoked when a movement occurs.
|
9603 | * @param nMouseX Specifies the horizontal mouse coordinate.
|
9604 | * @param nMouseY Specifies the vertical mouse coordinate.
|
9605 | * @param bPopped Specifies if the resource is popped. In that case the
|
9606 | * resource is not inside a parent which can host the resource.
|
9607 | * @param pOffset Contains the touch/click offset relative to the resource.
|
9608 | * @return Return `true` if the movement is valid. If you return `false`
|
9609 | * the item will be popped.
|
9610 | * @event
|
9611 | */
|
9612 | onMove(nMouseX: number, nMouseY: number, bPopped: boolean, pOffset: IPoint): boolean;
|
9613 | /**
|
9614 | * Specifies the function which is invoked when the move ends.
|
9615 | * @param bDragging Specifies if the `MoveStart` event is fired and the
|
9616 | * resource was in dragging mode.
|
9617 | * @event
|
9618 | */
|
9619 | onMoveEnd(bDragging: boolean): void;
|
9620 | /**
|
9621 | * Invoked when the guides of a rendering are changed.
|
9622 | * @param bVisible Indicates if the guides should be visible.
|
9623 | * @param nLeft Specifies the left coordinate of the guides.
|
9624 | * @param nTop Specifies the top coordinate of the guides.
|
9625 | * @param nWidth Specifies the width of the guides.
|
9626 | * @param nHeight Specifies the height of the guides.
|
9627 | * @param nZoom Specifies the zoom factor of the guides.
|
9628 | * @event
|
9629 | */
|
9630 | onGuidesChange(bVisible: boolean, nLeft: number, nTop: number, nWidth: number, nHeight: number, nZoom: number): void;
|
9631 | /**
|
9632 | * Renders the layout.
|
9633 | * @param sType Specifies the render type. Can be one of the following values:
|
9634 | * - `render`: Do a complete render;
|
9635 | * - `refresh`: Refresh the rendering;
|
9636 | * - `update`: Update the rendering.
|
9637 | */
|
9638 | abstract render(sType: "render" | "refresh" | "update"): void;
|
9639 | /**
|
9640 | * Sets the position of the layout element.
|
9641 | * @param nLeft Specifies the horizontal position.
|
9642 | * @param nTop Specifies the vertical position.
|
9643 | * @param nZoom Contains the zoom factor.
|
9644 | * @param sReason Specifies the reason for the position change.
|
9645 | */
|
9646 | abstract position(nLeft: number, nTop: number, nZoom: number, sReason: "redraw" | "zoom"): void;
|
9647 | /**
|
9648 | * Sets the dimensions of the layout element.
|
9649 | * @param nWidth Specifies the width.
|
9650 | * @param nHeight Specifies the height.
|
9651 | * @param nZoom Contains the zoom factor.
|
9652 | * @param sReason Specifies the reason for the resize.
|
9653 | */
|
9654 | abstract resize(nWidth: number, nHeight: number, nZoom: number, sReason: "redraw" | "width" | "height" | "zoom"): void;
|
9655 | /** Destroys the layout. */
|
9656 | abstract destroy(): void;
|
9657 | }
|
9658 | export interface IType<T extends TGridStructure> {
|
9659 | |
9660 |
|
9661 |
|
9662 |
|
9663 | new (...pArguments: TAny[]): T;
|
9664 | }
|
9665 | export interface IGridLayout<Grid extends TGrid, Type extends TGridStructure> {
|
9666 |
|
9667 | type: IType<Type>;
|
9668 |
|
9669 | layout: ILayout<Grid, Type>;
|
9670 | }
|
9671 | export abstract class GridRenderer<Grid extends TGrid, Types extends TGridStructure = TGridStructure> {
|
9672 | |
9673 |
|
9674 |
|
9675 |
|
9676 | constructor(...pLayouts: IGridLayout<Grid, Types>[]);
|
9677 | /** Retrieves the grid of the rendering. */
|
9678 | get grid(): Grid | undefined;
|
9679 | /** Sets the rendering grid. */
|
9680 | set grid(pGrid: Grid | undefined);
|
9681 | /**
|
9682 | * Provides the layout constructor for the specified parent type.
|
9683 | * @param pType Reference to the parent type.
|
9684 | * @return Returns the layout provider.
|
9685 | */
|
9686 | protected provider<Type extends TGridStructure>(pType: Type): IGridLayout<Grid, Type>;
|
9687 | /**
|
9688 | * Retrieves a new layout instance for the specified type.
|
9689 | * @param pType Reference to the parent type.
|
9690 | * @return Returns the layout instance.
|
9691 | */
|
9692 | abstract layout(pType: Types): GridLayout<Grid, Types>;
|
9693 | /**
|
9694 | * Fired when the renderer is initialized.
|
9695 | * @event
|
9696 | */
|
9697 | onInit(): void;
|
9698 | /**
|
9699 | * Fired when the dimensions of the rendering are changed.
|
9700 | * @param nWidth Specifies the width.
|
9701 | * @param nHeight Specifies the height.
|
9702 | * @param nZoom Contains the zoom factor.
|
9703 | * @param sReason Specifies the reason for the resize.
|
9704 | * @event
|
9705 | */
|
9706 | onResize(nWidth: number, nHeight: number, nZoom: number, sReason: "redraw" | "width" | "height" | "zoom"): void;
|
9707 | /**
|
9708 | * Fired when a move starts.
|
9709 | * @event
|
9710 | */
|
9711 | onMoveStart(): void;
|
9712 | /**
|
9713 | * Fired when something is moving.
|
9714 | * @event
|
9715 | */
|
9716 | onMove(): void;
|
9717 | /**
|
9718 | * Fired when the moving ends.
|
9719 | * @event
|
9720 | */
|
9721 | onMoveEnd(): void;
|
9722 | }
|
9723 | export type TGridResource = Resource<TGridStructure, TDispatcherFactory, TDispatcherFactory, THooks>;
|
9724 | abstract class Resource<
|
9725 | Ancestor extends TGridStructure,
|
9726 | Dispatcher extends TDispatcherFactory,
|
9727 | Children extends TDispatcherFactory,
|
9728 | Hooks extends THooks
|
9729 | > extends Structure<Ancestor, Dispatcher, Children, Hooks> {
|
9730 | /**
|
9731 | * Constructs a new resource instance.
|
9732 | * @param pDispatcher Reference to the dispatcher.
|
9733 | * @param fnChildren Creates and returns the child resource.
|
9734 | * @param pRenderer Reference to the renderer.
|
9735 | */
|
9736 | constructor(
|
9737 | pDispatcher: Dispatcher | undefined,
|
9738 | fnChildren?: (pParent: Resource<Ancestor, Dispatcher, Children, Hooks>) => Children,
|
9739 | pRenderer?: GridRenderer<TGrid>
|
9740 | );
|
9741 | /** Retrieves if this is the grid. */
|
9742 | protected get isGrid(): boolean;
|
9743 | /** Retrieves the grid. */
|
9744 | get grid(): TGrid | undefined;
|
9745 | /** Returns the z-index. */
|
9746 | get z(): number;
|
9747 | /** Contains if the resource is being moved. */
|
9748 | get isMoving(): boolean;
|
9749 |
|
9750 | /**
|
9751 | * Fired when a new resource is pushed to the dispatcher. This new resource
|
9752 | * should be positioned, sized and drawn on the screen.
|
9753 | * @param pEvent Specifies the event payload.
|
9754 | * @event
|
9755 | */
|
9756 | protected onPush(pEvent: IItemPushEvent<this>): void;
|
9757 | /**
|
9758 | * Fired when a resource is changed.
|
9759 | * @param pEvent Specifies the event payload.
|
9760 | * @event
|
9761 | */
|
9762 | protected onChange(pEvent: IItemChangeEvent<this>): void;
|
9763 | /**
|
9764 | * Fired when a resource is popped.
|
9765 | * @param pEvent Specifies the event payload.
|
9766 | * @event
|
9767 | */
|
9768 | protected onPop(pEvent: IItemPopEvent<this>): void;
|
9769 | /** Validates the resource. */
|
9770 | protected onValidate(): void;
|
9771 | /**
|
9772 | * Iterate through each descendant of the resource.
|
9773 | * @param fnResource Specifies the resource function.
|
9774 | * @param fnResource.pResource Contains a reference to the resource.
|
9775 | * @return Returns `true` if the iteration is stopped (break).
|
9776 | */
|
9777 | forEachDescendant(fnResource: (pResource: TGridResource) => boolean | void): boolean;
|
9778 | /**
|
9779 | * Iterate recursively through each descendant of the resource. For each
|
9780 | * resource (including the resource from which the iteration originates)
|
9781 | * a function will be invoked. This function should return `true` if the
|
9782 | * resource needs to be iterated or `false` if the iteration should
|
9783 | * continue with the next sibling resource.
|
9784 | * @param fnResource Specifies the resource function.
|
9785 | * @param fnResource.pResource Contains a reference to the resource.
|
9786 | * @return Returns the result of the resource function.
|
9787 | */
|
9788 | forEachDescendantRecursive(fnResource: (pResource: TGridResource) => boolean | void): boolean;
|
9789 | /**
|
9790 | * Calculates the z-index of the resource.
|
9791 | * @param nZ Specifies the minimum z-index.
|
9792 | * @return Returns `true` if the z-index is changed.
|
9793 | */
|
9794 | zIndex(nZ?: number): boolean;
|
9795 | /**
|
9796 | * Calculates the position of the resource.
|
9797 | * @param nLeft Specifies the left coordinate.
|
9798 | * @param nTop Specifies the top coordinate.
|
9799 | * @return Returns `true` if the position is changed.
|
9800 | */
|
9801 | position(nLeft?: number, nTop?: number): boolean;
|
9802 | /**
|
9803 | * Shifts the position of the resource.
|
9804 | * @param nHorizontal Specifies the horizontal shift.
|
9805 | * @param nVertical Specifies the vertical shift.
|
9806 | */
|
9807 | shift(nHorizontal: number, nVertical: number): void;
|
9808 | /**
|
9809 | * Calculates the dimensions of the resource.
|
9810 | * @param nWidth Specifies the width of the resource.
|
9811 | * @param nHeight Specifies the height of the resource.
|
9812 | * @return Returns `true` if the resource is resized.
|
9813 | */
|
9814 | resize(nWidth?: number, nHeight?: number): boolean;
|
9815 | /**
|
9816 | * Moves the resource and returns the coordinates with the supplied offset
|
9817 | * applied.
|
9818 | * @param nLeft Specifies the left movement.
|
9819 | * @param nTop Specifies the top movement.
|
9820 | * @param pOffset Specifies the offset of the touch point in the element.
|
9821 | * @return Returns the coordinates with the supplied offset.
|
9822 | */
|
9823 | move(nLeft?: number, nTop?: number, pOffset?: IPoint): IPoint;
|
9824 | /** Requests a guides update and invokes the guides layout. */
|
9825 | guides(): void;
|
9826 | /** Fired when there is a child pushed or popped. */
|
9827 | onPushOrPop(): void;
|
9828 | /**
|
9829 | * Fired when a resource move is initialized.
|
9830 | * @param nDelay Specifies the delay before the move occurs.
|
9831 | * @param pOffset Specifies the offset of the touch point.
|
9832 | * @return Returns `true` if the move operation is initialized.
|
9833 | * @event
|
9834 | */
|
9835 | onMoveInit(nDelay: number, pOffset: IPoint): boolean;
|
9836 | /**
|
9837 | * Fired when a resource move starts.
|
9838 | * @param pOffset Specifies the offset of the touch point.
|
9839 | * @return Returns `true` if the move operation is started.
|
9840 | * @event
|
9841 | */
|
9842 | onMoveStart(pOffset: IPoint): boolean;
|
9843 | /**
|
9844 | * Fired when a resource move occurs.
|
9845 | * @param nMoveX Specifies the horizontal movement.
|
9846 | * @param nMoveY Specifies the vertical movement.
|
9847 | * @param pOffset Specifies the offset of the touch point.
|
9848 | * @param sDispatcher Specifies the name of the child dispatcher.
|
9849 | * @event
|
9850 | */
|
9851 | onMove(nMoveX: number, nMoveY: number, pOffset: IPoint, sDispatcher?: string): void;
|
9852 | /**
|
9853 | * Specifies the function which is invoked when a movement is validated.
|
9854 | * @param pDispatcher Reference to the dispatcher.
|
9855 | * @param nIndex Specifies the desired index for the resource.
|
9856 | * @param bIsChild Specifies if the resource is already a child of the dispatcher.
|
9857 | * @return Return `true` if the movement is validated.
|
9858 | * @event
|
9859 | */
|
9860 | onMoveValidate(pDispatcher: TDispatcher, nIndex: number, bIsChild: boolean): boolean;
|
9861 | /**
|
9862 | * Fired when a resource move ends.
|
9863 | * @param bDragging Specifies if the `onMoveStart` event is fired.
|
9864 | * @event
|
9865 | */
|
9866 | onMoveEnd(bDragging: boolean): void;
|
9867 | /**
|
9868 | * Generates a serialized representation of a resource.
|
9869 | * @param sChildren Specified the data name for the child array.
|
9870 | * @return Returns a reference to the serialized resource.
|
9871 | */
|
9872 | serialize(sChildren?: string): IGridResource;
|
9873 | /**
|
9874 | * Deserializes to a resource.
|
9875 | * @param pResource Contains the serialized resource.
|
9876 | * @param pAfterwards Stack with calls which are invoked after the
|
9877 | * structural deserialization is done.
|
9878 | * @param sChildren Specified the data name for the child array.
|
9879 | * @return Returns a reference to the instance.
|
9880 | */
|
9881 | deserialize(pResource: IGridResource, pAfterwards: Stack, sChildren?: string): this;
|
9882 | /** Resets the resource. */
|
9883 | reset(): void;
|
9884 | /** Destroys the resource and all of its children. */
|
9885 | destroy(): void;
|
9886 | }
|
9887 | export type TDispatcher = Dispatcher<TGridResource, TGridResource, THooks>;
|
9888 | export type TDispatcherFactory = Dispatcher<TAny, TAny, THooks>;
|
9889 | export type TDispatcherEvents<Hooks extends THooks> = Hooks | "OnResize";
|
9890 | /** Dispatcher constructor template. */
|
9891 | export interface IDispatcherConstructor<Parent extends TGridResource, T extends TGridResource, Hooks extends THooks> {
|
9892 | new (pDispatcher: Dispatcher<Parent, T, Hooks>, ...pArguments: TAny[]): T;
|
9893 | }
|
9894 | abstract class Dispatcher<Parent extends TGridResource, T extends TGridResource, Hooks extends THooks> extends Matrix<
|
9895 | T,
|
9896 | TDispatcherEvents<Hooks>
|
9897 | > {
|
9898 | /**
|
9899 | * Constructs a new dispatcher.
|
9900 | * @param pType Reference to the dispatcher type.
|
9901 | * @param pParent Reference to the parent (this is the ancestor of an item).
|
9902 | * @param nType Specifies the direction.
|
9903 | * @param nOrientation Specifies the orientation.
|
9904 | * @param nSize Specifies the size.
|
9905 | */
|
9906 | constructor(
|
9907 | pType: IDispatcherConstructor<Parent, T, Hooks>,
|
9908 | pParent: Parent,
|
9909 | nType: Types,
|
9910 | nOrientation: Orientations,
|
9911 | nSize: number
|
9912 | );
|
9913 | /** Retrieves the grid. */
|
9914 | get grid(): TGrid | undefined;
|
9915 | /** Retrieves the dispatcher type. */
|
9916 | get dispatcher(): IDispatcherConstructor<Parent, T, Hooks>;
|
9917 | /** Returns a reference to the parent. */
|
9918 | get parent(): Parent;
|
9919 | /**
|
9920 | * Appends an item to the end.
|
9921 | * @param pItem Reference to the item.
|
9922 | * @return Returns a reference to the item.
|
9923 | */
|
9924 | protected appendItem(pItem: T): T;
|
9925 | /**
|
9926 | * Inserts an item at the begin.
|
9927 | * @param pItem Reference to the item.
|
9928 | * @return Returns a reference to the item.
|
9929 | */
|
9930 | protected insertItem(pItem: T): T;
|
9931 | /**
|
9932 | * Inserts an item at the specified index.
|
9933 | * @param pItem Reference to the item.
|
9934 | * @param nIndex Specifies the index position.
|
9935 | * @return Returns a reference to the item.
|
9936 | */
|
9937 | protected insertItemAtIndex(pItem: T, nIndex: number): T;
|
9938 | /**
|
9939 | * Fired when the dimensions of the dispatcher are changed.
|
9940 | * @param pEvent Specifies the event payload.
|
9941 | * @event
|
9942 | */
|
9943 | protected onDimensionChange(pEvent: IDimensionChangeEvent<this>): void;
|
9944 | protected onCountChange(pEvent: ICountChangeEvent<this>): void;
|
9945 | /**
|
9946 | * Invoked when the dispatcher dimensions are changed.
|
9947 | * @event
|
9948 | */
|
9949 | onDimensions(): void;
|
9950 | /**
|
9951 | * Deserializes the supplied resources to the dispatcher.
|
9952 | * @param pAfterwards Stack with calls which are invoked after the
|
9953 | * structural deserialization is done.
|
9954 | * @param pResources Reference to the resources.
|
9955 | */
|
9956 | deserialize(pAfterwards: Stack, ...pResources: IGridResource[]): void;
|
9957 | /** Resets a dispatcher. */
|
9958 | reset(): void;
|
9959 | /** Destroys a dispatcher. */
|
9960 | destroy(): void;
|
9961 | }
|
9962 | /** Nodes constructor template. */
|
9963 | export interface INodesConstructor<T extends TGridNode> {
|
9964 | new (
|
9965 | pNodeConstructor: INodeConstructor<T>,
|
9966 | pParent: TGridBranch<T> | TGridCluster<T>,
|
9967 | nDimensions?: number,
|
9968 | sOrientation?: "vertical" | "horizontal"
|
9969 | ): GridNodes<T, THooks>;
|
9970 | }
|
9971 | export abstract class GridNodes<T extends TGridNode, Hooks extends THooks = void> extends Dispatcher<
|
9972 | TGridBranch<TGridNode> | TGridCluster<TGridNode>,
|
9973 | T,
|
9974 | Hooks
|
9975 | > {
|
9976 | /**
|
9977 | * Constructs a new `Node` dispatcher.
|
9978 | * @param pNodeConstructor Reference to the `Node` constructor.
|
9979 | * @param pParent Specifies the parent `Branch` or `Cluster`.
|
9980 | * @param nDimensions Specifies the number of columns for vertical grids
|
9981 | * or the number of rows for horizontal grids.
|
9982 | * @param sOrientation Specifies the orientation of the grid.
|
9983 | */
|
9984 | constructor(
|
9985 | pNodeConstructor: INodeConstructor<T>,
|
9986 | pParent: TGridBranch<TGridNode> | TGridCluster<TGridNode>,
|
9987 | nDimensions?: number,
|
9988 | sOrientation?: "vertical" | "horizontal"
|
9989 | );
|
9990 | }
|
9991 | /** Node template. */
|
9992 | export type TGridNode = GridNode<THooks>;
|
9993 | /** Node constructor template. */
|
9994 | export interface INodeConstructor<T extends TGridNode> {
|
9995 | new (pNodes: GridNodes<T, THooks>): T;
|
9996 | }
|
9997 | export abstract class GridNode<Hooks extends THooks = void> extends Resource<
|
9998 | TGridCluster<GridNode<Hooks>> | TGridBranch<GridNode<Hooks>>,
|
9999 | GridNodes<GridNode<Hooks>, THooks>,
|
10000 | TDispatcher,
|
10001 | Hooks
|
10002 | > {
|
10003 | /**
|
10004 | * Constructs a new `Node` instance.
|
10005 | * @param pNodes Reference to the parent `Nodes`.
|
10006 | */
|
10007 | constructor(pNodes: GridNodes<GridNode<Hooks>, THooks>);
|
10008 | }
|
10009 | /** Clusters template. */
|
10010 | export type TClusters<T extends TGridNode> = GridClusters<TGridCluster<T>, T, THooks>;
|
10011 | /** Clusters constructor template. */
|
10012 | export interface IClustersConstructor<T extends TGridNode> {
|
10013 | new (
|
10014 | pClusterConstructor: IClusterConstructor<T, TGridCluster<T>>,
|
10015 | pBranch: TGridBranch<T>,
|
10016 | sOrientation?: "vertical" | "horizontal"
|
10017 | ): TClusters<T>;
|
10018 | }
|
10019 | export abstract class GridClusters<
|
10020 | Children extends TGridCluster<T>,
|
10021 | T extends TGridNode,
|
10022 | Hooks extends THooks = void
|
10023 | > extends Dispatcher<GridBranch<TClusters<T>, T, THooks>, Children, Hooks> {
|
10024 | /**
|
10025 | * Constructs a new `Cluster` dispatcher.
|
10026 | * @param pClusterConstructor Reference to the `Cluster` constructor.
|
10027 | * @param pBranch Specifies the parent `Branch`.
|
10028 | * @param sOrientation Specifies the orientation of the grid.
|
10029 | */
|
10030 | constructor(
|
10031 | pClusterConstructor: IClusterConstructor<T, Children>,
|
10032 | pBranch: GridBranch<TClusters<T>, T, THooks>,
|
10033 | sOrientation?: "vertical" | "horizontal"
|
10034 | );
|
10035 | }
|
10036 | /** Cluster template. */
|
10037 | export type TGridCluster<T extends TGridNode> = GridCluster<GridNodes<T, THooks>, T, THooks>;
|
10038 | /** Cluster constructor template. */
|
10039 | export interface IClusterConstructor<T extends TGridNode, C extends TGridCluster<T>> {
|
10040 | new (pClusters: TClusters<T>, pNodesConstructor: INodesConstructor<T>, pNodeConstructor: INodeConstructor<T>): C;
|
10041 | }
|
10042 | export abstract class GridCluster<
|
10043 | Children extends GridNodes<T, THooks>,
|
10044 | T extends TGridNode,
|
10045 | Hooks extends THooks = void
|
10046 | > extends Resource<GridBranch<TClusters<T>, T, THooks>, TClusters<T>, Children, Hooks> {
|
10047 | /**
|
10048 | * Constructs a new `Cluster` instance.
|
10049 | * @param pClusters Reference to the parent `Clusters`.
|
10050 | * @param pNodesConstructor Reference to the `Nodes` constructor.
|
10051 | * @param pNodeConstructor Reference to the `Node` constructor.
|
10052 | */
|
10053 | constructor(pClusters: TClusters<T>, pNodesConstructor: INodesConstructor<T>, pNodeConstructor: INodeConstructor<T>);
|
10054 | }
|
10055 | /** Branches template. */
|
10056 | export type TBranches<T extends TGridNode> = GridBranches<TGridBranch<T>, T, THooks>;
|
10057 | export abstract class GridBranches<
|
10058 | Children extends TGridBranch<T>,
|
10059 | T extends TGridNode,
|
10060 | Hooks extends THooks = void
|
10061 | > extends Dispatcher<TGridCluster<T>, Children, Hooks> {
|
10062 | /**
|
10063 | * Constructs a new `Branch` dispatcher.
|
10064 | * @param pBranchConstructor Reference to the `Branch` constructor.
|
10065 | * @param pCluster Specifies the parent `Cluster`.
|
10066 | */
|
10067 | constructor(pBranchConstructor: IBranchConstructor<T, Children>, pCluster: TGridCluster<T>);
|
10068 | }
|
10069 | /** Branch template. */
|
10070 | export type TGridBranch<T extends TGridNode> = GridBranch<TClusters<T>, T, THooks>;
|
10071 | /** Branch constructor template. */
|
10072 | export interface IBranchConstructor<T extends TGridNode, B extends TGridBranch<T>> {
|
10073 | new (
|
10074 | pBranches: TBranches<T>,
|
10075 | pClustersConstructor: IClustersConstructor<T>,
|
10076 | pClusterConstructor: IClusterConstructor<T, TGridCluster<T>>,
|
10077 | pRenderer?: GridRenderer<TGrid>
|
10078 | ): B;
|
10079 | }
|
10080 | export abstract class GridBranch<Children extends TClusters<T>, T extends TGridNode, Hooks extends THooks = void> extends Resource<
|
10081 | TGridCluster<T>,
|
10082 | TBranches<T>,
|
10083 | Children,
|
10084 | Hooks
|
10085 | > {
|
10086 | /**
|
10087 | * Constructs a new `Branch` instance.
|
10088 | * @param pBranches Reference to the parent `Branches`.
|
10089 | * @param pClustersConstructor Reference to the `Clusters` constructor.
|
10090 | * @param pClusterConstructor Reference to the `Cluster` constructor.
|
10091 | * @param pRenderer Reference to a renderer.
|
10092 | */
|
10093 | constructor(
|
10094 | pBranches: TBranches<T> | undefined,
|
10095 | pClustersConstructor: IClustersConstructor<T>,
|
10096 | pClusterConstructor: IClusterConstructor<T, TGridCluster<T>>,
|
10097 | pRenderer?: GridRenderer<TGrid>
|
10098 | );
|
10099 | }
|
10100 | export type TGrid = Grid<TClusters<TGridNode>, TGridNode, THooks>;
|
10101 | export abstract class Grid<Children extends TClusters<T>, T extends TGridNode, Hooks extends THooks = void> extends GridBranch<
|
10102 | Children,
|
10103 | T,
|
10104 | Hooks
|
10105 | > {
|
10106 | /**
|
10107 | * Constructs a new `Grid` instance.
|
10108 | * @param pClustersConstructor Reference to the `Clusters` constructor.
|
10109 | * @param pClusterConstructor Reference to the `Cluster` constructor.
|
10110 | * @param pRenderer Reference to a renderer.
|
10111 | */
|
10112 | constructor(
|
10113 | pClustersConstructor: IClustersConstructor<T>,
|
10114 | pClusterConstructor: IClusterConstructor<T, TGridCluster<T>>,
|
10115 | pRenderer?: GridRenderer<TGrid>
|
10116 | );
|
10117 | /** Retrieves the overflow threshold for the grid. */
|
10118 | get threshold(): number;
|
10119 | /** Sets the overflow threshold for the grid. */
|
10120 | set threshold(nThreshold: number);
|
10121 | /**
|
10122 | * Deserializes to a grid.
|
10123 | * @param pGrid Contains the serialized grid.
|
10124 | * @param pAfterwards Stack with calls which are invoked after the
|
10125 | * structural deserialization is done.
|
10126 | * @param sChildren Specified the data name for the child array.
|
10127 | * @return Returns a reference to the instance.
|
10128 | */
|
10129 | deserialize(pGrid: IGridResource, pAfterwards: Stack, sChildren: string): this;
|
10130 | }
|
10131 | export interface IGridResizeEvent extends IHookPayload<"OnResize"> {
|
10132 | /** Reference to the dispatcher. */
|
10133 | readonly dispatcher: TDispatcher;
|
10134 | }
|
10135 | }
|
10136 |
|
10137 | declare module "tripetto/module/hookup" {
|
10138 | import { TAny } from "tripetto/module/functional";
|
10139 |
|
10140 | export interface IHookPayload<Name extends THooks> {
|
10141 | hook: {
|
10142 | name: Name;
|
10143 | type: TType;
|
10144 | };
|
10145 | }
|
10146 | export type THooks = string | void;
|
10147 | export type HookProps<T extends IHookPayload<THooks>> = Pick<T, Exclude<keyof T, "hook">>;
|
10148 | export type THookContext = Function | {};
|
10149 | export type TType = "synchronous" | "asynchronous" | "framed";
|
10150 | export type TFunc<Names extends THooks, Hook extends Names, Payload extends IHookPayload<Hook> = IHookPayload<Hook>> = (
|
10151 | pPayload: Payload
|
10152 | ) => void;
|
10153 | /**
|
10154 | * Implements the hooks class.
|
10155 | * @param Names Specifies the available hooks (specify using string literals).
|
10156 | */
|
10157 | export class Hooks<Names extends THooks> {
|
10158 | /** Retrieves if the hooks buffer is enabled. */
|
10159 | get isHookBufferEnabled(): boolean;
|
10160 |
|
10161 | /**
|
10162 | * Register a hook.
|
10163 | * @param sHook Specifies the hook name.
|
10164 | * @param sType Specifies the hook type.
|
10165 | * @param fnHook Specifies the hook function.
|
10166 | * @param pContext Specifies the hook context.
|
10167 | * @return Returns `this` to allow chaining.
|
10168 | */
|
10169 | hook<Hook extends Names, Payload extends IHookPayload<Hook>>(
|
10170 | sHook: Hook,
|
10171 | sType: TType,
|
10172 | fnHook: TFunc<Names, Hook, Payload>,
|
10173 | pContext?: THookContext
|
10174 | ): this;
|
10175 | /**
|
10176 | * Register a grouped hook.
|
10177 | * @param sHook Specifies the hook name.
|
10178 | * @param sType Specifies the hook type.
|
10179 | * @param fnHook Specifies the hook function.
|
10180 | * @param pContext Specifies the hook context.
|
10181 | * @return Returns `this` to allow chaining.
|
10182 | */
|
10183 | groupedHook<Hook extends Names, Payload extends IHookPayload<Hook>>(
|
10184 | sHook: Hook,
|
10185 | sType: TType,
|
10186 | fnHook: TFunc<Names, Hook, Payload>,
|
10187 | pContext?: THookContext
|
10188 | ): this;
|
10189 | /**
|
10190 | * Emits a hook.
|
10191 | * @param sHook Specifies the hook name.
|
10192 | * @param pPayload Specifies the payload.
|
10193 | * @param sMode Specifies the mode. Can be `fifo` or `lifo` (default is `fifo`).
|
10194 | * @return Returns `true` if the hook is emitted.
|
10195 | */
|
10196 | emitHook<Hook extends Names, Payload extends IHookPayload<Hook>>(
|
10197 | sHook: Hook,
|
10198 | pPayload: HookProps<Payload>,
|
10199 | sMode?: "fifo" | "lifo"
|
10200 | ): boolean;
|
10201 | /** Enables the hooks buffer. */
|
10202 | bufferHooks(): void;
|
10203 | /** Flushes the hooks buffer. */
|
10204 | flushHooks(): void;
|
10205 | /**
|
10206 | * Removes a hook.
|
10207 | * @param sHook Specifies the hook name.
|
10208 | * @param pContextOrFunction Specifies the hook context or function to detach.
|
10209 | * @return Returns `true` if the hook was found and removed.
|
10210 | */
|
10211 | unhook<Hook extends Names>(sHook: Hook, pContextOrFunction?: TFunc<Names, Hook> | THookContext): boolean;
|
10212 | /**
|
10213 | * Unhooks all hooks from the specifies context.
|
10214 | * @param pContext Specifies the context.
|
10215 | * @return Returns `true` if one or more hooks were found and removed for
|
10216 | * the specifies context.
|
10217 | */
|
10218 | unhookContext(pContext: THookContext): boolean;
|
10219 | /** destroys the hooks (any pending hook emits are flushed synchronous). */
|
10220 | destroy(): void;
|
10221 | }
|
10222 | export interface IHookProperty<Name extends THooks, T extends {}, K extends keyof T> extends IHookPayload<Name> {
|
10223 | /** Name of the property. */
|
10224 | property: K;
|
10225 | /** Value of the property. */
|
10226 | value: T[K];
|
10227 | }
|
10228 | /**
|
10229 | * Binds a hook to a property.
|
10230 | * @param sHook Specifies the hook to attach.
|
10231 | */
|
10232 | export function hookup<T extends Hooks<TAny>, Hook extends THooks>(
|
10233 | sHook: Hook
|
10234 | ): (pTarget: T, sProperty: string, pDescriptor?: PropertyDescriptor) => void;
|
10235 | }
|
10236 |
|
10237 | declare module "tripetto/module/l10n" {
|
10238 | export interface IDomain {
|
10239 |
|
10240 | readonly locale: string;
|
10241 |
|
10242 | readonly language: string;
|
10243 |
|
10244 | readonly native: string;
|
10245 | }
|
10246 | export type TTranslation = {
|
10247 | "": {
|
10248 | readonly language?: string;
|
10249 | readonly "plural-forms"?: string;
|
10250 | readonly "plural-family"?: string;
|
10251 | };
|
10252 | } & {
|
10253 | [id: string]: [null | string, ...string[]] | [null | string, [string]];
|
10254 | };
|
10255 | export class Translation {
|
10256 | |
10257 |
|
10258 |
|
10259 |
|
10260 | constructor(pTranslation: TTranslation);
|
10261 | /** Retrieves the number of plurals. */
|
10262 | get plurals(): number;
|
10263 | /**
|
10264 | * Enriches the domains with more translations.
|
10265 | * @param pTranslation Reference to the translation.
|
10266 | * @param bOverwrite Specifies if translations should be overwritten.
|
10267 | */
|
10268 | enrich(pTranslation: TTranslation, bOverwrite: boolean): void;
|
10269 | /**
|
10270 | * Retrieves the plural index for the supplied count.
|
10271 | * @param nCount Specifies the count.
|
10272 | * @return Returns the plural index.
|
10273 | */
|
10274 | plural(nCount: number): number;
|
10275 | /**
|
10276 | * Retrieves the translation for the specified message identifier or string.
|
10277 | * @param sId Specifies the message identifier or string to retrieve.
|
10278 | * @return Returns an array with translation strings.
|
10279 | */
|
10280 | translation(sId: string): [null | string, ...string[]] | [null | string, [string]] | undefined;
|
10281 | }
|
10282 | export const CONTEXT_SEPARATOR = "\u0004";
|
10283 | export class Translations {
|
10284 |
|
10285 | static get domains(): string[];
|
10286 |
|
10287 | static get default(): string;
|
10288 |
|
10289 | static set default(sDomain: string);
|
10290 |
|
10291 | static get current(): string;
|
10292 |
|
10293 | static set current(sDomain: string);
|
10294 | |
10295 |
|
10296 |
|
10297 |
|
10298 |
|
10299 |
|
10300 |
|
10301 | static load(
|
10302 | pTranslation: TTranslation | TTranslation[],
|
10303 | bMakeCurrent?: boolean | "only-when-no-domain",
|
10304 | sMode?: "enrich" | "overwrite" | "replace"
|
10305 | ): boolean;
|
10306 | |
10307 |
|
10308 |
|
10309 |
|
10310 | static unload(sDomain?: string): void;
|
10311 | |
10312 |
|
10313 |
|
10314 |
|
10315 | static isLoaded(sDomain: string): boolean;
|
10316 | |
10317 |
|
10318 |
|
10319 |
|
10320 | static reset(sCurrent?: string): void;
|
10321 | |
10322 |
|
10323 |
|
10324 |
|
10325 |
|
10326 |
|
10327 |
|
10328 |
|
10329 |
|
10330 |
|
10331 |
|
10332 |
|
10333 | static translate(
|
10334 | sDomain: string,
|
10335 | sContext: string,
|
10336 | sId: string,
|
10337 | bPlural?: boolean,
|
10338 | sPluralId?: string,
|
10339 | nCount?: number,
|
10340 | ...pArguments: string[]
|
10341 | ): string;
|
10342 |
|
10343 |
|
10344 | get domains(): string[];
|
10345 |
|
10346 | get default(): string;
|
10347 |
|
10348 | set default(sDomain: string);
|
10349 |
|
10350 | get current(): string;
|
10351 |
|
10352 | set current(sDomain: string);
|
10353 | |
10354 |
|
10355 |
|
10356 |
|
10357 |
|
10358 |
|
10359 |
|
10360 | load(
|
10361 | pTranslation: TTranslation | TTranslation[],
|
10362 | bMakeCurrent: boolean | "only-when-no-domain",
|
10363 | sMode: "enrich" | "overwrite" | "replace"
|
10364 | ): boolean;
|
10365 | |
10366 |
|
10367 |
|
10368 |
|
10369 | unload(sDomain?: string): void;
|
10370 | |
10371 |
|
10372 |
|
10373 |
|
10374 | isLoaded(sDomain: string): boolean;
|
10375 | |
10376 |
|
10377 |
|
10378 |
|
10379 | reset(sCurrent?: string): void;
|
10380 | |
10381 |
|
10382 |
|
10383 |
|
10384 |
|
10385 |
|
10386 |
|
10387 |
|
10388 |
|
10389 |
|
10390 |
|
10391 |
|
10392 | translate(
|
10393 | sDomain: string,
|
10394 | sContext: string,
|
10395 | sId: string,
|
10396 | bPlural: boolean,
|
10397 | sPluralId: string,
|
10398 | nCount: number,
|
10399 | ...pArguments: string[]
|
10400 | ): string;
|
10401 | }
|
10402 |
|
10403 | export interface ILocaleString {
|
10404 | readonly full: string;
|
10405 | readonly long: string;
|
10406 | readonly medium: string;
|
10407 | readonly short: string;
|
10408 | }
|
10409 | |
10410 |
|
10411 |
|
10412 |
|
10413 | export interface ILocaleFormatting<T> {
|
10414 | readonly formatted: T;
|
10415 | readonly nominative: T;
|
10416 | }
|
10417 |
|
10418 | export interface ILocaleNumber {
|
10419 | readonly decimals: string;
|
10420 | readonly grouping: string;
|
10421 | readonly minus: string;
|
10422 | }
|
10423 |
|
10424 | export interface ILocaleMonths {
|
10425 | readonly abbreviated: string[];
|
10426 | readonly narrow: string[];
|
10427 | readonly wide: string[];
|
10428 | }
|
10429 |
|
10430 | export interface ILocaleDays {
|
10431 | readonly abbreviated: string[];
|
10432 | readonly narrow: string[];
|
10433 | readonly short: string[];
|
10434 | readonly wide: string[];
|
10435 | }
|
10436 |
|
10437 | export interface ILocaleTime {
|
10438 | readonly AM: string;
|
10439 | readonly PM: string;
|
10440 | }
|
10441 |
|
10442 | export interface ILocaleTranslations {
|
10443 | readonly months: ILocaleFormatting<ILocaleMonths>;
|
10444 | readonly days: ILocaleFormatting<ILocaleDays>;
|
10445 | readonly time: ILocaleTime;
|
10446 | }
|
10447 |
|
10448 | export interface ILocaleFormats {
|
10449 | readonly date: ILocaleString;
|
10450 | readonly time: ILocaleString;
|
10451 | readonly dateTime: ILocaleString;
|
10452 | readonly numbers: ILocaleNumber;
|
10453 | }
|
10454 |
|
10455 | export interface ILocale {
|
10456 | readonly locale: string;
|
10457 | readonly domain: string;
|
10458 | readonly direction: "ltr" | "rtl";
|
10459 | readonly countryCode: string;
|
10460 | readonly country: string;
|
10461 | readonly countryNative: string;
|
10462 | readonly language: string;
|
10463 | readonly languageNative: string;
|
10464 | readonly translations: ILocaleTranslations;
|
10465 | readonly formats: ILocaleFormats;
|
10466 | }
|
10467 | const DEFAULTS: ILocale;
|
10468 | export class Locales {
|
10469 |
|
10470 | static get locale(): ILocale;
|
10471 |
|
10472 | static get identifier(): string;
|
10473 |
|
10474 | static get domain(): string;
|
10475 |
|
10476 | static get countryCode(): string;
|
10477 |
|
10478 | static get country(): string;
|
10479 |
|
10480 | static get countryNative(): string;
|
10481 |
|
10482 | static get language(): string;
|
10483 |
|
10484 | static get languageNative(): string;
|
10485 |
|
10486 | static get direction(): "ltr" | "rtl";
|
10487 |
|
10488 | static get locales(): string[];
|
10489 |
|
10490 | static get domains(): IDomain[];
|
10491 | |
10492 |
|
10493 |
|
10494 |
|
10495 |
|
10496 | static isLoaded(sLocale: string): boolean;
|
10497 | |
10498 |
|
10499 |
|
10500 |
|
10501 |
|
10502 |
|
10503 |
|
10504 | static load(pLocale: ILocale | ILocale[], bSelect?: boolean): boolean;
|
10505 | |
10506 |
|
10507 |
|
10508 |
|
10509 |
|
10510 | static get(sLocale?: string): ILocale;
|
10511 | |
10512 |
|
10513 |
|
10514 |
|
10515 |
|
10516 | static set(sLocale: string): boolean;
|
10517 | |
10518 |
|
10519 |
|
10520 |
|
10521 |
|
10522 | static findDomain(sDomain: string | undefined): string;
|
10523 | |
10524 |
|
10525 |
|
10526 |
|
10527 |
|
10528 | static getDomain(sLocale?: string): IDomain;
|
10529 | |
10530 |
|
10531 |
|
10532 |
|
10533 |
|
10534 |
|
10535 |
|
10536 |
|
10537 | static number(nValue: number | string, nPrecision?: number | "auto", bThousands?: boolean, sLocale?: string): string;
|
10538 | |
10539 |
|
10540 |
|
10541 |
|
10542 |
|
10543 |
|
10544 |
|
10545 |
|
10546 |
|
10547 |
|
10548 |
|
10549 |
|
10550 |
|
10551 |
|
10552 |
|
10553 |
|
10554 |
|
10555 |
|
10556 |
|
10557 |
|
10558 |
|
10559 |
|
10560 |
|
10561 |
|
10562 |
|
10563 |
|
10564 |
|
10565 |
|
10566 |
|
10567 |
|
10568 |
|
10569 |
|
10570 |
|
10571 |
|
10572 |
|
10573 |
|
10574 |
|
10575 |
|
10576 |
|
10577 |
|
10578 |
|
10579 | static dateTime(sFormat: string, nTime?: number, bUTC?: boolean, sLocale?: string): string;
|
10580 | |
10581 |
|
10582 |
|
10583 |
|
10584 |
|
10585 |
|
10586 |
|
10587 | static dateFull(nTime?: number, bUTC?: boolean, sLocale?: string): string;
|
10588 | |
10589 |
|
10590 |
|
10591 |
|
10592 |
|
10593 |
|
10594 |
|
10595 | static dateLong(nTime?: number, bUTC?: boolean, sLocale?: string): string;
|
10596 | |
10597 |
|
10598 |
|
10599 |
|
10600 |
|
10601 |
|
10602 |
|
10603 | static dateMedium(nTime?: number, bUTC?: boolean, sLocale?: string): string;
|
10604 | |
10605 |
|
10606 |
|
10607 |
|
10608 |
|
10609 |
|
10610 |
|
10611 | static dateShort(nTime?: number, bUTC?: boolean, sLocale?: string): string;
|
10612 | |
10613 |
|
10614 |
|
10615 |
|
10616 |
|
10617 |
|
10618 |
|
10619 | static timeFull(nTime?: number, bUTC?: boolean, sLocale?: string): string;
|
10620 | |
10621 |
|
10622 |
|
10623 |
|
10624 |
|
10625 |
|
10626 |
|
10627 | static timeLong(nTime?: number, bUTC?: boolean, sLocale?: string): string;
|
10628 | |
10629 |
|
10630 |
|
10631 |
|
10632 |
|
10633 |
|
10634 |
|
10635 | static timeMedium(nTime?: number, bUTC?: boolean, sLocale?: string): string;
|
10636 | |
10637 |
|
10638 |
|
10639 |
|
10640 |
|
10641 |
|
10642 |
|
10643 | static timeShort(nTime?: number, bUTC?: boolean, sLocale?: string): string;
|
10644 | |
10645 |
|
10646 |
|
10647 |
|
10648 |
|
10649 |
|
10650 |
|
10651 | static dateTimeFull(nTime?: number, bUTC?: boolean, sLocale?: string): string;
|
10652 | |
10653 |
|
10654 |
|
10655 |
|
10656 |
|
10657 |
|
10658 |
|
10659 | static dateTimeLong(nTime?: number, bUTC?: boolean, sLocale?: string): string;
|
10660 | |
10661 |
|
10662 |
|
10663 |
|
10664 |
|
10665 |
|
10666 |
|
10667 | static dateTimeMedium(nTime?: number, bUTC?: boolean, sLocale?: string): string;
|
10668 | |
10669 |
|
10670 |
|
10671 |
|
10672 |
|
10673 |
|
10674 |
|
10675 | static dateTimeShort(nTime?: number, bUTC?: boolean, sLocale?: string): string;
|
10676 |
|
10677 | get locale(): ILocale;
|
10678 |
|
10679 | get identifier(): string;
|
10680 |
|
10681 | get domain(): string;
|
10682 |
|
10683 | get countryCode(): string;
|
10684 |
|
10685 | get country(): string;
|
10686 |
|
10687 | get countryNative(): string;
|
10688 |
|
10689 | get language(): string;
|
10690 |
|
10691 | get languageNative(): string;
|
10692 |
|
10693 | get direction(): "ltr" | "rtl";
|
10694 | |
10695 |
|
10696 |
|
10697 |
|
10698 |
|
10699 | load(pLocale: ILocale): boolean;
|
10700 | |
10701 |
|
10702 |
|
10703 |
|
10704 |
|
10705 | set(sLocale: string): boolean;
|
10706 | |
10707 |
|
10708 |
|
10709 |
|
10710 |
|
10711 |
|
10712 |
|
10713 | number(nValue: number | string, nPrecision?: number | "auto", bThousands?: boolean): string;
|
10714 | |
10715 |
|
10716 |
|
10717 |
|
10718 |
|
10719 |
|
10720 |
|
10721 |
|
10722 |
|
10723 |
|
10724 |
|
10725 |
|
10726 |
|
10727 |
|
10728 |
|
10729 |
|
10730 |
|
10731 |
|
10732 |
|
10733 |
|
10734 |
|
10735 |
|
10736 |
|
10737 |
|
10738 |
|
10739 |
|
10740 |
|
10741 |
|
10742 |
|
10743 |
|
10744 |
|
10745 |
|
10746 |
|
10747 |
|
10748 |
|
10749 |
|
10750 |
|
10751 |
|
10752 |
|
10753 |
|
10754 | dateTime(sFormat: string, nTime?: number, bUTC?: boolean): string;
|
10755 | |
10756 |
|
10757 |
|
10758 |
|
10759 |
|
10760 |
|
10761 | dateFull(nTime?: number, bUTC?: boolean): string;
|
10762 | |
10763 |
|
10764 |
|
10765 |
|
10766 |
|
10767 |
|
10768 |
|
10769 | dateLong(nTime?: number, bUTC?: boolean): string;
|
10770 | |
10771 |
|
10772 |
|
10773 |
|
10774 |
|
10775 |
|
10776 |
|
10777 | dateMedium(nTime?: number, bUTC?: boolean): string;
|
10778 | |
10779 |
|
10780 |
|
10781 |
|
10782 |
|
10783 |
|
10784 |
|
10785 | dateShort(nTime?: number, bUTC?: boolean): string;
|
10786 | |
10787 |
|
10788 |
|
10789 |
|
10790 |
|
10791 |
|
10792 |
|
10793 | timeFull(nTime?: number, bUTC?: boolean): string;
|
10794 | |
10795 |
|
10796 |
|
10797 |
|
10798 |
|
10799 |
|
10800 |
|
10801 | timeLong(nTime?: number, bUTC?: boolean): string;
|
10802 | |
10803 |
|
10804 |
|
10805 |
|
10806 |
|
10807 |
|
10808 |
|
10809 | timeMedium(nTime?: number, bUTC?: boolean): string;
|
10810 | |
10811 |
|
10812 |
|
10813 |
|
10814 |
|
10815 |
|
10816 |
|
10817 | timeShort(nTime?: number, bUTC?: boolean): string;
|
10818 | |
10819 |
|
10820 |
|
10821 |
|
10822 |
|
10823 |
|
10824 |
|
10825 | dateTimeFull(nTime?: number, bUTC?: boolean): string;
|
10826 | |
10827 |
|
10828 |
|
10829 |
|
10830 |
|
10831 |
|
10832 |
|
10833 | dateTimeLong(nTime?: number, bUTC?: boolean): string;
|
10834 | |
10835 |
|
10836 |
|
10837 |
|
10838 |
|
10839 |
|
10840 |
|
10841 | dateTimeMedium(nTime?: number, bUTC?: boolean): string;
|
10842 | |
10843 |
|
10844 |
|
10845 |
|
10846 |
|
10847 |
|
10848 |
|
10849 | dateTimeShort(nTime?: number, bUTC?: boolean): string;
|
10850 | }
|
10851 | |
10852 |
|
10853 |
|
10854 |
|
10855 |
|
10856 |
|
10857 |
|
10858 |
|
10859 |
|
10860 |
|
10861 |
|
10862 |
|
10863 |
|
10864 |
|
10865 |
|
10866 |
|
10867 |
|
10868 |
|
10869 |
|
10870 |
|
10871 |
|
10872 |
|
10873 |
|
10874 | |
10875 |
|
10876 |
|
10877 |
|
10878 |
|
10879 |
|
10880 |
|
10881 | export function gettext(sId: string, ...pArguments: string[]): string;
|
10882 | |
10883 |
|
10884 |
|
10885 |
|
10886 |
|
10887 |
|
10888 |
|
10889 |
|
10890 | export function dgettext(sDomain: string, sId: string, ...pArguments: string[]): string;
|
10891 | |
10892 |
|
10893 |
|
10894 |
|
10895 |
|
10896 |
|
10897 |
|
10898 |
|
10899 |
|
10900 | export function ngettext(sId: string, sPluralId: string, nCount: number, ...pArguments: string[]): string;
|
10901 | |
10902 |
|
10903 |
|
10904 |
|
10905 |
|
10906 |
|
10907 |
|
10908 |
|
10909 |
|
10910 |
|
10911 | export function dngettext(sDomain: string, sId: string, sPluralId: string, nCount: number, ...pArguments: string[]): string;
|
10912 | |
10913 |
|
10914 |
|
10915 |
|
10916 |
|
10917 |
|
10918 |
|
10919 |
|
10920 | export function pgettext(sContext: string, sId: string, ...pArguments: string[]): string;
|
10921 | |
10922 |
|
10923 |
|
10924 |
|
10925 |
|
10926 |
|
10927 |
|
10928 |
|
10929 |
|
10930 | export function dpgettext(sDomain: string, sContext: string, sId: string, ...pArguments: string[]): string;
|
10931 | |
10932 |
|
10933 |
|
10934 |
|
10935 |
|
10936 |
|
10937 |
|
10938 |
|
10939 |
|
10940 |
|
10941 | export function npgettext(sContext: string, sId: string, sPluralId: string, nCount: number, ...pArguments: string[]): string;
|
10942 | |
10943 |
|
10944 |
|
10945 |
|
10946 |
|
10947 |
|
10948 |
|
10949 |
|
10950 |
|
10951 |
|
10952 |
|
10953 | export function dnpgettext(
|
10954 | sDomain: string,
|
10955 | sContext: string,
|
10956 | sId: string,
|
10957 | sPluralId: string,
|
10958 | nCount: number,
|
10959 | ...pArguments: string[]
|
10960 | ): string;
|
10961 | |
10962 |
|
10963 |
|
10964 |
|
10965 |
|
10966 |
|
10967 |
|
10968 | export function _(sId: string, ...pArguments: string[]): string;
|
10969 | |
10970 |
|
10971 |
|
10972 |
|
10973 |
|
10974 |
|
10975 |
|
10976 |
|
10977 |
|
10978 | export function _n(sId: string, sPluralId: string, nCount: number, ...pArguments: string[]): string;
|
10979 | export interface IPlural {
|
10980 | readonly rules: string[];
|
10981 | readonly expression: string;
|
10982 | readonly locales: string[];
|
10983 | readonly fn: (n: number) => number;
|
10984 | }
|
10985 | export interface IPluralRule extends IPlural {
|
10986 | readonly family: string;
|
10987 | }
|
10988 | export class Plurals {
|
10989 |
|
10990 | static get rules(): IPluralRule[];
|
10991 |
|
10992 | static get locales(): {
|
10993 | [locale: string]: IPluralRule | undefined;
|
10994 | };
|
10995 | |
10996 |
|
10997 |
|
10998 |
|
10999 |
|
11000 | static getForLocale(locale?: string): IPluralRule | undefined;
|
11001 | |
11002 |
|
11003 |
|
11004 |
|
11005 |
|
11006 | static getForFamily(family: string): IPluralRule | undefined;
|
11007 | static getForExpression(expression: string): IPluralRule | undefined;
|
11008 | }
|
11009 | export class Namespace {
|
11010 |
|
11011 | static get global(): Namespace;
|
11012 |
|
11013 | static create(identifier: string): Namespace;
|
11014 |
|
11015 | static translation(identifier: string): Namespace;
|
11016 |
|
11017 |
|
11018 | get locale(): typeof Locales | Locales;
|
11019 |
|
11020 | get default(): string;
|
11021 |
|
11022 | set default(d: string);
|
11023 |
|
11024 | get current(): string;
|
11025 |
|
11026 | set current(c: string);
|
11027 |
|
11028 | get domains(): string[];
|
11029 | |
11030 |
|
11031 |
|
11032 |
|
11033 |
|
11034 |
|
11035 |
|
11036 | get load(): (
|
11037 | pTranslation: TTranslation | TTranslation[],
|
11038 | bMakeCurrent?: boolean | "only-when-no-domain",
|
11039 | sMode?: "enrich" | "overwrite" | "replace"
|
11040 | ) => boolean;
|
11041 | |
11042 |
|
11043 |
|
11044 |
|
11045 | get unload(): (sDomain?: string) => void;
|
11046 | |
11047 |
|
11048 |
|
11049 |
|
11050 | get isLoaded(): (sDomain: string) => boolean;
|
11051 | |
11052 |
|
11053 |
|
11054 |
|
11055 | get reset(): (sCurrent?: string) => void;
|
11056 | |
11057 |
|
11058 |
|
11059 |
|
11060 |
|
11061 |
|
11062 |
|
11063 | get gettext(): (sId: string, ...pArguments: string[]) => string;
|
11064 | |
11065 |
|
11066 |
|
11067 |
|
11068 |
|
11069 |
|
11070 |
|
11071 |
|
11072 | get dgettext(): (sDomain: string, sId: string, ...pArguments: string[]) => string;
|
11073 | |
11074 |
|
11075 |
|
11076 |
|
11077 |
|
11078 |
|
11079 |
|
11080 |
|
11081 |
|
11082 | get ngettext(): (sId: string, sPluralId: string, nCount: number, ...pArguments: string[]) => string;
|
11083 | |
11084 |
|
11085 |
|
11086 |
|
11087 |
|
11088 |
|
11089 |
|
11090 |
|
11091 |
|
11092 |
|
11093 | get dngettext(): (sDomain: string, sId: string, sPluralId: string, nCount: number, ...pArguments: string[]) => string;
|
11094 | |
11095 |
|
11096 |
|
11097 |
|
11098 |
|
11099 |
|
11100 |
|
11101 |
|
11102 | get pgettext(): (sContext: string, sId: string, ...pArguments: string[]) => string;
|
11103 | |
11104 |
|
11105 |
|
11106 |
|
11107 |
|
11108 |
|
11109 |
|
11110 |
|
11111 |
|
11112 | get dpgettext(): (sDomain: string, sContext: string, sId: string, ...pArguments: string[]) => string;
|
11113 | |
11114 |
|
11115 |
|
11116 |
|
11117 |
|
11118 |
|
11119 |
|
11120 |
|
11121 |
|
11122 |
|
11123 | get npgettext(): (sContext: string, sId: string, sPluralId: string, nCount: number, ...pArguments: string[]) => string;
|
11124 | |
11125 |
|
11126 |
|
11127 |
|
11128 |
|
11129 |
|
11130 |
|
11131 |
|
11132 |
|
11133 |
|
11134 |
|
11135 | get dnpgettext(): (
|
11136 | sDomain: string,
|
11137 | sContext: string,
|
11138 | sId: string,
|
11139 | sPluralId: string,
|
11140 | nCount: number,
|
11141 | ...pArguments: string[]
|
11142 | ) => string;
|
11143 | |
11144 |
|
11145 |
|
11146 |
|
11147 |
|
11148 |
|
11149 |
|
11150 | get _(): (sId: string, ...pArguments: string[]) => string;
|
11151 | |
11152 |
|
11153 |
|
11154 |
|
11155 |
|
11156 |
|
11157 |
|
11158 |
|
11159 |
|
11160 | get _n(): (sId: string, sPluralId: string, nCount: number, ...pArguments: string[]) => string;
|
11161 | }
|
11162 |
|
11163 | export { DEFAULTS as LOCALE_DEFAULTS, Translations as Domain };
|
11164 | }
|
11165 |
|
11166 | declare module "tripetto/module/markdown" {
|
11167 | export type MarkdownTypes =
|
11168 | | "paragraph"
|
11169 | | "break"
|
11170 | | "bold"
|
11171 | | "italic"
|
11172 | | "bold+italic"
|
11173 | | "underline"
|
11174 | | "strikethrough"
|
11175 | | "code"
|
11176 | | "hyperlink"
|
11177 | | "image"
|
11178 | | "h1"
|
11179 | | "h2"
|
11180 | | "h3"
|
11181 | | "h4"
|
11182 | | "h5"
|
11183 | | "h6"
|
11184 | | "codeblock"
|
11185 | | "codeline"
|
11186 | | "quote"
|
11187 | | "mention"
|
11188 | | "reference";
|
11189 | export enum MarkdownFeatures {
|
11190 |
|
11191 | None = 0,
|
11192 |
|
11193 | Formatting = 1,
|
11194 |
|
11195 | Paragraphs = 2,
|
11196 |
|
11197 | Breaks = 4,
|
11198 |
|
11199 | Hyperlinks = 8,
|
11200 |
|
11201 | Headings = 16,
|
11202 |
|
11203 | Blockquotes = 32,
|
11204 |
|
11205 | Code = 64,
|
11206 |
|
11207 | InlineCode = 128,
|
11208 |
|
11209 | Images = 256,
|
11210 |
|
11211 | All = 511,
|
11212 | }
|
11213 | export interface IMarkdownRef<T> {
|
11214 | ref: T;
|
11215 | string: string;
|
11216 | }
|
11217 | export interface IMarkdownBufferParser<T> {
|
11218 | |
11219 |
|
11220 |
|
11221 |
|
11222 |
|
11223 |
|
11224 |
|
11225 |
|
11226 |
|
11227 |
|
11228 |
|
11229 |
|
11230 | parser: (
|
11231 | sBuffer: string,
|
11232 | nIndex: number
|
11233 | ) =>
|
11234 | | {
|
11235 | shift: number;
|
11236 | markdown?: string;
|
11237 | text?: string;
|
11238 | value?: T | IMarkdownRef<T>;
|
11239 | }
|
11240 | | undefined;
|
11241 | |
11242 |
|
11243 |
|
11244 |
|
11245 | numberOfChars?: number;
|
11246 | }
|
11247 | export interface IMarkdownOptions<T> {
|
11248 |
|
11249 | features?: MarkdownFeatures;
|
11250 |
|
11251 | mentions?: IMarkdownBufferParser<T>;
|
11252 |
|
11253 | references?: IMarkdownBufferParser<T>;
|
11254 |
|
11255 | stopWord?: string;
|
11256 | }
|
11257 | export interface IMarkdown<T> {
|
11258 | content: string | IMarkdownNode<T> | IMarkdownNode<T>[];
|
11259 | type?: MarkdownTypes;
|
11260 | value?: string | T | IMarkdownRef<T>;
|
11261 | }
|
11262 | export interface IMarkdownNode<T> extends IMarkdown<T> {
|
11263 | parent?: IMarkdownNode<T>;
|
11264 | }
|
11265 | export class MarkdownParser<T = undefined> {
|
11266 | |
11267 |
|
11268 |
|
11269 |
|
11270 |
|
11271 |
|
11272 | static parse<T = undefined>(sMarkdown: string, pOptions?: IMarkdownOptions<T>): MarkdownParser<T>;
|
11273 | |
11274 |
|
11275 |
|
11276 |
|
11277 |
|
11278 | constructor(sMarkdown: string, pOptions?: IMarkdownOptions<T>);
|
11279 | /** Contains the enabled features. */
|
11280 | get features(): MarkdownFeatures;
|
11281 | /** Retrieves a reference to the AST. */
|
11282 | get abstractSyntaxTree(): IMarkdown<T>;
|
11283 | /** Retrieves the plain text without markdown formatting. */
|
11284 | get text(): string;
|
11285 | /** Retrieves if a mention with a value is parsed. */
|
11286 | get hasMentions(): boolean;
|
11287 | /** Retrieves if a reference with a value is parsed. */
|
11288 | get hasReferences(): boolean;
|
11289 |
|
11290 | /**
|
11291 | * Maps the markdown AST to a structure.
|
11292 | * @param fnMap Specifies the map function.
|
11293 | * @return Returns the ancestor of the map structure.
|
11294 | */
|
11295 | map<R>(
|
11296 | fnMap: (
|
11297 | sType: MarkdownTypes | undefined,
|
11298 | sContent: string,
|
11299 | pValue: string | T | undefined,
|
11300 | pParent: R | undefined,
|
11301 | sKind: "root" | "text" | "node"
|
11302 | ) => R
|
11303 | ): R;
|
11304 | /**
|
11305 | * Reduces the markdown AST.
|
11306 | * @param fnReduce Specifies the reduce function.
|
11307 | * @returns Returns the reduced value.
|
11308 | */
|
11309 | reduce<R>(fnReduce: (sType: MarkdownTypes | undefined, pContent: string | R[], pValue: string | T | undefined) => R): R;
|
11310 | }
|
11311 | }
|
11312 |
|
11313 | declare module "tripetto/module/matrix" {
|
11314 | import { Enumerator } from "tripetto/module/functional";
|
11315 | import { HookProps, Hooks, IHookPayload, THooks } from "tripetto/module/hookup";
|
11316 |
|
11317 | export interface ICursor {
|
11318 |
|
11319 | column?: number;
|
11320 |
|
11321 | row?: number;
|
11322 |
|
11323 | index?: number;
|
11324 | }
|
11325 | export interface ISafeCursor {
|
11326 |
|
11327 | column: number;
|
11328 |
|
11329 | row: number;
|
11330 |
|
11331 | index: number;
|
11332 | }
|
11333 | export interface IDispatch<Hook extends THooks, T extends IHookPayload<Hook>> {
|
11334 | hook: Hook;
|
11335 | payload: HookProps<T>;
|
11336 | }
|
11337 | export const enum Reasons {
|
11338 |
|
11339 | Push = 1,
|
11340 |
|
11341 | Pop = 2,
|
11342 |
|
11343 | Move = 4,
|
11344 |
|
11345 | Swap = 8,
|
11346 |
|
11347 | Sort = 16,
|
11348 |
|
11349 | Recalculation = 32,
|
11350 |
|
11351 | Last = 64,
|
11352 |
|
11353 | First = 128,
|
11354 | }
|
11355 |
|
11356 | export type TMatrixHooks = "OnDimensionChange" | "OnCountChange" | "OnCursorChange" | "OnItemPush" | "OnItemChange" | "OnItemPop";
|
11357 |
|
11358 | export type TItemHooks = "OnItemPush" | "OnItemChange" | "OnItemPop";
|
11359 |
|
11360 | export interface IDimensionChangeEvent<T extends Matrix<Item<THooks>, THooks>> extends IHookPayload<"OnDimensionChange"> {
|
11361 |
|
11362 | readonly matrix: T;
|
11363 |
|
11364 | readonly difference: number;
|
11365 |
|
11366 | readonly columns: number;
|
11367 |
|
11368 | readonly rows: number;
|
11369 |
|
11370 | readonly reason: Reasons;
|
11371 | }
|
11372 |
|
11373 | export interface ICountChangeEvent<T extends Matrix<Item<THooks>, THooks>> extends IHookPayload<"OnCountChange"> {
|
11374 |
|
11375 | readonly matrix: T;
|
11376 |
|
11377 | readonly count: number;
|
11378 |
|
11379 | readonly difference: number;
|
11380 |
|
11381 | readonly reason: Reasons;
|
11382 | }
|
11383 |
|
11384 | export interface IItemEvent<H extends THooks, T extends Item<THooks>> extends IHookPayload<H> {
|
11385 |
|
11386 | readonly matrix: Matrix<T, THooks>;
|
11387 |
|
11388 | readonly matrixPrevious: Matrix<T, THooks> | undefined;
|
11389 |
|
11390 | readonly item: T;
|
11391 |
|
11392 | readonly reason: Reasons;
|
11393 | }
|
11394 |
|
11395 | export interface IItemPushEvent<T extends Item<THooks>> extends IItemEvent<"OnItemPush", T> {}
|
11396 |
|
11397 | export interface IItemChangeEvent<T extends Item<THooks>> extends IItemEvent<"OnItemChange", T> {}
|
11398 |
|
11399 | export interface IItemPopEvent<T extends Item<THooks>> extends IHookPayload<"OnItemPop"> {
|
11400 |
|
11401 | readonly matrix: Matrix<T, THooks>;
|
11402 |
|
11403 | readonly item: T;
|
11404 | }
|
11405 |
|
11406 | export interface ICursorChangeEvent<T extends Matrix<Item<THooks>, THooks>> extends IHookPayload<"OnCursorChange"> {
|
11407 |
|
11408 | readonly matrix: T;
|
11409 |
|
11410 | readonly cursor: ICursor;
|
11411 | }
|
11412 | class Stack {
|
11413 | |
11414 |
|
11415 |
|
11416 |
|
11417 | push(fnCall: () => void): void;
|
11418 |
|
11419 | flush(): void;
|
11420 | }
|
11421 | |
11422 |
|
11423 |
|
11424 |
|
11425 | export abstract class Item<H extends THooks = void> extends Hooks<TItemHooks | H> {
|
11426 |
|
11427 | static readonly enumerator: Enumerator;
|
11428 |
|
11429 | |
11430 |
|
11431 |
|
11432 |
|
11433 |
|
11434 |
|
11435 |
|
11436 | static pushToMatrix<T extends Item<THooks>>(pItem: T, pMatrix?: Matrix<T, THooks>): T;
|
11437 | |
11438 |
|
11439 |
|
11440 |
|
11441 | constructor(pMatrix?: Matrix<Item<H>, THooks>);
|
11442 | /** Retrieves a reference to the underlying matrix. */
|
11443 | get parent(): Matrix<Item<H>, THooks> | undefined;
|
11444 | /** Specifies the unique id of the item. The id is unique within the current session. */
|
11445 | get uniqueId(): number;
|
11446 | /** Returns a (SHA2-256) hash for the item. The hash is unique within the current session. */
|
11447 | get hash(): string;
|
11448 | /** Overrides the automatic calculated hash value for the item. */
|
11449 | set hash(sHash: string);
|
11450 | /** Retrieves the index of the item (first item is zero). */
|
11451 | get index(): number;
|
11452 | /** Sets the index of the item (first item is zero). */
|
11453 | set index(nIndex: number);
|
11454 | /** Returns the column index of the item in the matrix (first column is zero). */
|
11455 | get columnIndex(): number;
|
11456 | /** Returns the row index of the item in the matrix (first row is zero). */
|
11457 | get rowIndex(): number;
|
11458 | /** Retrieves if the item is popped (not in the matrix). */
|
11459 | get isPopped(): boolean;
|
11460 | /** Specifies if the item is the first item in the column or row. */
|
11461 | get isFirst(): boolean;
|
11462 | /** Specifies if the item is the last item in the column or row. */
|
11463 | get isLast(): boolean;
|
11464 | /** Specifies if the item is the first item in the column. */
|
11465 | get isFirstColumn(): boolean;
|
11466 | /** Specifies if the item is the last item in the column. */
|
11467 | get isLastColumn(): boolean;
|
11468 | /** Specifies if the item is the first item in the row. */
|
11469 | get isFirstRow(): boolean;
|
11470 | /** Specifies if the item is the last item in the row. */
|
11471 | get isLastRow(): boolean;
|
11472 | /** Specifies if the item is the first item in the matrix. */
|
11473 | get isFirstOfMatrix(): boolean;
|
11474 | /** Specifies if the item is the last item in the matrix. */
|
11475 | get isLastOfMatrix(): boolean;
|
11476 | /** Retrieves the previous sibling of the item. */
|
11477 | get predecessorSibling(): Item<H> | undefined;
|
11478 | /** Retrieves the next sibling of the item. */
|
11479 | get successorSibling(): Item<H> | undefined;
|
11480 | /** Retrieves the previous item in the same column. */
|
11481 | get predecessorInColumn(): Item<H> | undefined;
|
11482 | /** Retrieves the next item in the same column. */
|
11483 | get successorInColumn(): Item<H> | undefined;
|
11484 | /** Retrieves the previous item in the same row. */
|
11485 | get predecessorInRow(): Item<H> | undefined;
|
11486 | /** Retrieves the next item in the same row. */
|
11487 | get successorInRow(): Item<H> | undefined;
|
11488 | /**
|
11489 | * Retrieves a reference to the underlying matrix.
|
11490 | * @return Returns a reference to the matrix.
|
11491 | */
|
11492 | protected matrix(): Matrix<Item<H>, THooks> | undefined;
|
11493 | /**
|
11494 | * Fired when the item is pushed.
|
11495 | * @param pEvent Specifies the event payload.
|
11496 | * @event
|
11497 | */
|
11498 | protected onPush(pEvent: HookProps<IItemPushEvent<Item<H>>>): void;
|
11499 | /**
|
11500 | * Fired when the item is changed.
|
11501 | * @param pEvent Specifies the event payload.
|
11502 | * @event
|
11503 | */
|
11504 | protected onChange(pEvent: HookProps<IItemChangeEvent<Item<H>>>): void;
|
11505 | /**
|
11506 | * Fired when the item is popped.
|
11507 | * @param pEvent Specifies the event payload.
|
11508 | * @event
|
11509 | */
|
11510 | protected onPop(pEvent: HookProps<IItemPopEvent<Item<H>>>): void;
|
11511 | /**
|
11512 | * Dispatches a matrix event.
|
11513 | * @param pStack Reference to the stack.
|
11514 | * @param pEvent Specifies the event to dispatch.
|
11515 | */
|
11516 | dispatch(
|
11517 | pStack: Stack,
|
11518 | pEvent: IDispatch<"OnItemChange", IItemChangeEvent<Item<H>>> | IDispatch<"OnItemPop", IItemPopEvent<Item<H>>> | "Pop" | "Detach"
|
11519 | ): void;
|
11520 | /**
|
11521 | * Sets the index of an item.
|
11522 | * @param pStack Reference to the stack.
|
11523 | * @param pMatrix Reference to the matrix.
|
11524 | * @param nIndex Specifies the new index of the item.
|
11525 | * @param sEmit Specifies if events needs to be emitted.
|
11526 | * @param nReason Specifies the event reason.
|
11527 | * @return Returns `true` if a change occured.
|
11528 | */
|
11529 | reindex(
|
11530 | pStack: Stack,
|
11531 | pMatrix: Matrix<Item<H>, THooks>,
|
11532 | nIndex: number,
|
11533 | sEmit: "nothing" | "auto" | "change" | "push",
|
11534 | nReason: Reasons
|
11535 | ): boolean;
|
11536 | /**
|
11537 | * Moves the item to the specified cursor.
|
11538 | * @param pCursor Specifies the cursor.
|
11539 | * @return Returns `true` if the move succeeded.
|
11540 | */
|
11541 | moveTo(pCursor: ICursor): boolean;
|
11542 | /**
|
11543 | * Moves the item to the specified index.
|
11544 | * @param nIndex Specifies the index position.
|
11545 | * @return Returns `true` if the move succeeded.
|
11546 | */
|
11547 | moveToIndex(nIndex: number): boolean;
|
11548 | /**
|
11549 | * Moves the item to the specified position.
|
11550 | * @param nColumn Specifies the column.
|
11551 | * @param nRow Specifies the row.
|
11552 | * @return Returns `true` if the move succeeded.
|
11553 | */
|
11554 | moveToPosition(nColumn: number, nRow: number): boolean;
|
11555 | /**
|
11556 | * Moves the item to the specified item.
|
11557 | * @param pTo Specifies the item to move to.
|
11558 | * @param bAbove Specifies if the move position is above or below the
|
11559 | * specified item.
|
11560 | * @return Returns `true` if the move succeeded.
|
11561 | */
|
11562 | moveToItem(pTo: Item<H>, bAbove: boolean): boolean;
|
11563 | /**
|
11564 | * Moves the item up or down.
|
11565 | * @param bUp Specifies if the move direction is up (true) or down (false).
|
11566 | * @return Returns `true` if the move succeeded.
|
11567 | */
|
11568 | moveUpOrDown(bUp: boolean): boolean;
|
11569 | /**
|
11570 | * Swaps an item with another item.
|
11571 | * @param pWith Specifies the item to swap with.
|
11572 | * @return Returns `true` if the swap succeeded.
|
11573 | */
|
11574 | swap(pWith: Item<H>): boolean;
|
11575 | /**
|
11576 | * Removes the item from the matrix.
|
11577 | * @return Returns `true` if the function succeeded.
|
11578 | */
|
11579 | pop(): boolean;
|
11580 | /**
|
11581 | * Removes the item from the matrix without emitting events.
|
11582 | * @return Returns `true` if the function succeeded.
|
11583 | */
|
11584 | popSilent(): boolean;
|
11585 | /**
|
11586 | * Restores a popped item.
|
11587 | * @param pMatrix Specifies a matrix to use.
|
11588 | * @param nIndex Specifies the restore position.
|
11589 | * @return Returns a reference to the item.
|
11590 | */
|
11591 | unpop(pMatrix?: Matrix<Item<H>, THooks>, nIndex?: number): boolean;
|
11592 | /**
|
11593 | * Restores a popped item.
|
11594 | * @param pMatrix Specifies a matrix to use.
|
11595 | * @param nIndex Specifies the restore position.
|
11596 | * @return Returns a reference to the item.
|
11597 | */
|
11598 | unpopSilent(pMatrix?: Matrix<Item<H>, THooks>, nIndex?: number): boolean;
|
11599 | }
|
11600 | export const enum Orientations {
|
11601 |
|
11602 | Vertical = 0,
|
11603 |
|
11604 | Horizontal = 1,
|
11605 | }
|
11606 | export const enum Types {
|
11607 |
|
11608 | Vertical = 0,
|
11609 |
|
11610 | Horizontal = 1,
|
11611 |
|
11612 | Square = 2,
|
11613 |
|
11614 | SquareHorizontal = 3,
|
11615 |
|
11616 | SquareVertical = 4,
|
11617 | }
|
11618 | |
11619 |
|
11620 |
|
11621 |
|
11622 |
|
11623 | export abstract class Matrix<T extends Item<THooks>, H extends THooks = void> extends Hooks<TMatrixHooks | H> {
|
11624 | |
11625 |
|
11626 |
|
11627 |
|
11628 |
|
11629 |
|
11630 | constructor(nType?: Types, nOrientation?: Orientations, nDimensions?: number);
|
11631 | /** Specifies the unique id of the matrix. */
|
11632 | get uniqueId(): number;
|
11633 | /** Retrieves the current matrix type. */
|
11634 | get type(): Types;
|
11635 | /** Sets the current matrix type. */
|
11636 | set type(nType: Types);
|
11637 | /** Retrieves the current matrix orientation. */
|
11638 | get orientation(): Orientations;
|
11639 | /** Sets the current matrix orientation. */
|
11640 | set orientation(nOrientation: Orientations);
|
11641 | /** Retrieves the number of columns in the matrix. */
|
11642 | get columns(): number;
|
11643 | /** Sets the number of columns in the matrix. */
|
11644 | set columns(nColumns: number);
|
11645 | /** Retrieves the number of rows in the matrix. */
|
11646 | get rows(): number;
|
11647 | /** Sets the number of rows in the matrix. */
|
11648 | set rows(nRows: number);
|
11649 | /** Retrieves the total number of items in the matrix. */
|
11650 | get count(): number;
|
11651 | /** Retrieves all the items. */
|
11652 | get all(): T[];
|
11653 | /** Retrieves the item at the current cursor position. */
|
11654 | get currentItem(): T | undefined;
|
11655 | /** Retrieves the first item in the matrix. */
|
11656 | get firstItem(): T | undefined;
|
11657 | /** Retrieves the last item in the matrix. */
|
11658 | get lastItem(): T | undefined;
|
11659 | /** Retrieves the last item in the first row of the matrix. */
|
11660 | get lastItemInFirstRow(): T | undefined;
|
11661 | /** Retrieves the last item in the first column of the matrix. */
|
11662 | get lastItemInFirstColumn(): T | undefined;
|
11663 | /** Retrieves the current cursor. */
|
11664 | get cursor(): ICursor | ISafeCursor;
|
11665 | /** Sets the current cursor. */
|
11666 | set cursor(pCursor: ICursor | ISafeCursor);
|
11667 | /** Retrieves the current (safe) cursor. */
|
11668 | get safeCursor(): ISafeCursor;
|
11669 | /** Verifies if the cursor is at the first column. */
|
11670 | get isCursorAtFirstColumn(): boolean;
|
11671 | /** Verifies if the cursor is at the last column. */
|
11672 | get isCursorAtLastColumn(): boolean;
|
11673 | /** Verifies if the column cursor is past the last column. */
|
11674 | get isCursorAtEndColumn(): boolean;
|
11675 | /** Verifies if the row cursor is at the first row. */
|
11676 | get isCursorAtFirstRow(): boolean;
|
11677 | /** Verifies if the row cursor is at the last row. */
|
11678 | get isCursorAtLastRow(): boolean;
|
11679 | /** Verifies if the row cursor is past the last row. */
|
11680 | get isCursorAtEndRow(): boolean;
|
11681 | /** Verifies if the cursor is at the first item of the matrix. */
|
11682 | get isCursorAtFirst(): boolean;
|
11683 | /** Verifies if the cursor is at the last item of the matrix. */
|
11684 | get isCursorAtLast(): boolean;
|
11685 | /** Verifies if the cursor is past the end of the matrix. */
|
11686 | get isCursorAtEnd(): boolean;
|
11687 | /** Retrieves the silent mode. */
|
11688 | get isSilent(): boolean | (() => boolean);
|
11689 | /** Sets the silent mode. */
|
11690 | set isSilent(pSilent: boolean | (() => boolean));
|
11691 |
|
11692 | /**
|
11693 | * Retrieves a validated cursor from the supplied cursor.
|
11694 | * @param pCursor Specifies the source cursor.
|
11695 | * @return Returns the validated cursor.
|
11696 | */
|
11697 | protected getSafeCursor(pCursor: ICursor): ISafeCursor;
|
11698 | /**
|
11699 | * Fired when the dimensions of the matrix are changed.
|
11700 | * @param pEvent Specifies the event payload.
|
11701 | * @event
|
11702 | */
|
11703 | protected onDimensionChange(pEvent: HookProps<IDimensionChangeEvent<this>>): void;
|
11704 | /**
|
11705 | * Fired when the item count of the matrix is changed.
|
11706 | * @param pEvent Specifies the event payload.
|
11707 | * @event
|
11708 | */
|
11709 | protected onCountChange(pEvent: HookProps<ICountChangeEvent<this>>): void;
|
11710 | /**
|
11711 | * Fired when the cursor position of the matrix is changed.
|
11712 | * @param pEvent Specifies the event payload.
|
11713 | * @event
|
11714 | */
|
11715 | protected onCursorChange(pEvent: HookProps<ICursorChangeEvent<this>>): void;
|
11716 | /**
|
11717 | * Retrieves the index for the given column and row.
|
11718 | * @param nColumn Specifies the column.
|
11719 | * @param nRow Specifies the row.
|
11720 | * @return Returns the item index or `-1` if the index is invalid.
|
11721 | */
|
11722 | indexFromColumnRow(nColumn: number, nRow: number): number;
|
11723 | /**
|
11724 | * Retrieves a cursor for the specified index.
|
11725 | * @param nIndex Specifies the index.
|
11726 | * @return Returns a cursor.
|
11727 | */
|
11728 | cursorFromIndex(nIndex: number | undefined): ISafeCursor;
|
11729 | /**
|
11730 | * Pushes an item to the matrix.
|
11731 | * @param pItem Specifies the item to put in the matrix.
|
11732 | * @param pOptions Specifies one or more of the following options:
|
11733 | * - Index: Specifies the desired index for the item (if `undefined` the
|
11734 | * supplied index in the item will be used or the item will be pushed to the
|
11735 | * end of the matrix if the index is invalid);
|
11736 | * - Recalculate: Specifies if the matrix needs to be recalculated;
|
11737 | * - Emit: Specifies what to emit.
|
11738 | * @return Returns a reference to the item.
|
11739 | */
|
11740 | pushToMatrix(
|
11741 | pItem: T,
|
11742 | pOptions?: {
|
11743 | index: number | undefined;
|
11744 | recalculate: boolean;
|
11745 | emit: "nothing" | "push" | "change";
|
11746 | }
|
11747 | ): T;
|
11748 | /**
|
11749 | * Moves an item to the specified cursor.
|
11750 | * @param pItem Specifies the item to move.
|
11751 | * @param pCursor Specifies the cursor.
|
11752 | * @return Returns `true` if the move succeeded.
|
11753 | */
|
11754 | moveTo(pItem: T, pCursor: ICursor): boolean;
|
11755 | /**
|
11756 | * Moves an item to the specified index position.
|
11757 | * @param pItem Specifies the item to move.
|
11758 | * @param nIndex Specifies the index position.
|
11759 | * @return Returns `true` if the move succeeded.
|
11760 | */
|
11761 | moveToIndex(pItem: T, nIndex: number): boolean;
|
11762 | /**
|
11763 | * Moves an item to the specified position.
|
11764 | * @param pItem Specifies the item to move.
|
11765 | * @param nColumn Specifies the column.
|
11766 | * @param nRow Specifies the row.
|
11767 | * @return Returns `true` if the move succeeded.
|
11768 | */
|
11769 | moveToPosition(pItem: T, nColumn: number, nRow: number): boolean;
|
11770 | /**
|
11771 | * Moves an item to the specified item.
|
11772 | * @param pItem Specifies the item to swap.
|
11773 | * @param pTo Specifies the item to move to.
|
11774 | * @param bAbove Specifies if the move position is above or below the specified item.
|
11775 | * @return Returns `true` if the move succeeded.
|
11776 | */
|
11777 | moveToItem(pItem: T, pTo: T, bAbove: boolean): boolean;
|
11778 | /**
|
11779 | * Moves an item up or down.
|
11780 | * @param pItem Specifies the item to move.
|
11781 | * @param bUp Specifies if the move direction is up (true) or down (false).
|
11782 | * @return Returns `true` if the move succeeded.
|
11783 | */
|
11784 | moveUpOrDown(pItem: T, bUp: boolean): boolean;
|
11785 | /**
|
11786 | * Swaps two items.
|
11787 | * @param pA Item A.
|
11788 | * @param pB Item B.
|
11789 | * @return Returns `true` if the swap succeeded.
|
11790 | */
|
11791 | swap(pA: T, pB: T): boolean;
|
11792 | /**
|
11793 | * Removes an item from the matrix (or the last item if no item is specified).
|
11794 | * @param pItem Specifies the item to remove.
|
11795 | * @param bEmit Specifies if the events needs to be emitted.
|
11796 | * @return Returns the popped item.
|
11797 | */
|
11798 | popFromMatrix(pItem?: T, bEmit?: boolean): T | undefined;
|
11799 | /**
|
11800 | * Sorts the matrix using the supplied compare functions.
|
11801 | * @param fnCompare Specifies the compare function. The compare function should return a number according to the following rules:
|
11802 | * - A is less than B return -1;
|
11803 | * - A is greater than B return 1;
|
11804 | * - A is equal to B return 0.
|
11805 | *
|
11806 | * To compare numbers you can simply return `nA - nB`. If no compare function is specified, the items are sorted according to the
|
11807 | * original push order.
|
11808 | * @param fnCompare.pA Compare item A.
|
11809 | * @param fnCompare.pB Compare item B.
|
11810 | * @return Returns `true` if the sort invoked an item position change.
|
11811 | */
|
11812 | sort(fnCompare?: (pA: T, pB: T) => number): boolean;
|
11813 | /**
|
11814 | * Removes all matrix items.
|
11815 | * @param sMode Specifies the clear mode:
|
11816 | * - `dirty`: Just removes all the items from the matrix without emitting events;
|
11817 | * - `fast`: Removes the items and invokes the `onPop` method for each item;
|
11818 | * - `thorough`: Removes the items and invokes the `OnPop`method and hooks for each item.
|
11819 | */
|
11820 | clear(sMode?: "dirty" | "fast" | "thorough"): void;
|
11821 | /** Invalidates the matrix and forces the `DimensionChange` event. */
|
11822 | invalidateMatrix(): void;
|
11823 | /** Recalculates the matrix. */
|
11824 | recalculateMatrix(): void;
|
11825 | /**
|
11826 | * Iterates through each item.
|
11827 | * @param fnCallee Specifies the function to be invoked for each item. The item value will be exposed to the function as the first
|
11828 | * argument of the argument list. Additional arguments can be specified and will be pushed to the function. If the function returns
|
11829 | * `true` the iteration is stopped.
|
11830 | * @param nFrom Specifies the index to start the iteration from. A negative index indicates an offset from the end of the matrix.
|
11831 | * @param nTo Specifies the index to stop the iteration. A negative index indicates an offset from the end of the matrix.
|
11832 | * @return Returns `true` if the iteration is stopped (break).
|
11833 | */
|
11834 | each(fnCallee: (pItem: T) => boolean | void, nFrom?: number, nTo?: number): boolean;
|
11835 | /**
|
11836 | * Iterates through each item starting with the last item.
|
11837 | * @param fnCallee Specifies the function to be invoked for each item. The item value will be exposed to the function as the first
|
11838 | * argument of the argument list. Additional arguments can be specified and will be pushed to the function. If the function
|
11839 | * returns `true` the iteration is stopped.
|
11840 | * @param nFrom Specifies the index to start the iteration from. A negative index indicates an offset from the end of the matrix.
|
11841 | * @param nTo Specifies the index to stop the iteration. A negative index indicates an offset from the end of the matrix.
|
11842 | * @return Returns `true` if the iteration was stopped (break).
|
11843 | */
|
11844 | reverseEach(fnCallee: (pItem: T) => boolean | void, nFrom?: number, nTo?: number): boolean;
|
11845 | /**
|
11846 | * Retrieves the item at the specified index.
|
11847 | * @param nIndex Specifies the index.
|
11848 | * @return Returns the item or `undefined` if the item is not found.
|
11849 | */
|
11850 | itemAtIndex(nIndex: number): T | undefined;
|
11851 | /**
|
11852 | * Retrieves the item at the specified position.
|
11853 | * @param nColumn Specifies the column.
|
11854 | * @param nRow Specifies the row.
|
11855 | * @return Returns the item or `undefined` if the item is not found.
|
11856 | */
|
11857 | itemAtPosition(nColumn: number, nRow: number): T | undefined;
|
11858 | /**
|
11859 | * Retrieves the item at the specified cursor.
|
11860 | * @param pCursor Specifies the cursor.
|
11861 | * @return Returns the item or `undefined` if the item is not found.
|
11862 | */
|
11863 | itemAtCursor(pCursor: ICursor): T | undefined;
|
11864 | /**
|
11865 | * Retrieves the item with the specified id.
|
11866 | * @param nId Specifies the id of the item.
|
11867 | * @return Returns the item or `undefined` if the item is not found.
|
11868 | */
|
11869 | itemFromId(nId: number): T | undefined;
|
11870 | /**
|
11871 | * Retrieves the last item in the specified row of the matrix.
|
11872 | * @param nRow Specifies the row.
|
11873 | * @return Returns a reference to the last item or `undefined` if the item is not found.
|
11874 | */
|
11875 | lastItemInRow(nRow: number): T | undefined;
|
11876 | /**
|
11877 | * Retrieves the last item in the specified column of the matrix.
|
11878 | * @param nColumn Specifies the column.
|
11879 | * @return Returns a reference to the last item or `undefined` if the item is not found.
|
11880 | */
|
11881 | lastItemInColumn(nColumn: number): T | undefined;
|
11882 | /**
|
11883 | * Moves the cursor to the first column.
|
11884 | * @param bMoveToFirstRow Specifies if the cursor needs to be moved to the first row.
|
11885 | * @return Returns the new cursor position.
|
11886 | */
|
11887 | moveCursorToFirstColumn(bMoveToFirstRow?: boolean): ISafeCursor;
|
11888 | /**
|
11889 | * Moves the cursor to the next column.
|
11890 | * @param bMoveToFirstRow Specifies if the cursor needs to be moved to the first row.
|
11891 | * @return Returns the new cursor position.
|
11892 | */
|
11893 | moveCursorToSuccessorColumn(bMoveToFirstRow?: boolean): ISafeCursor;
|
11894 | /**
|
11895 | * Moves the cursor to the previous column.
|
11896 | * @param bMoveToFirstRow Specifies if the cursor needs to be moved to the first row.
|
11897 | * @return Returns the new cursor position.
|
11898 | */
|
11899 | moveCursorToPredecessorColumn(bMoveToFirstRow?: boolean): ISafeCursor;
|
11900 | /**
|
11901 | * Moves the cursor to the last column.
|
11902 | * @param bMoveToFirstRow Specifies if the cursor needs to be moved to the first row.
|
11903 | * @return Returns the new cursor position.
|
11904 | */
|
11905 | moveCursorToLastColumn(bMoveToFirstRow?: boolean): ISafeCursor;
|
11906 | /**
|
11907 | * Moves the cursor to the first row.
|
11908 | * @param bMoveToFirstColumn Specifies if the cursor needs to be moved to the first column.
|
11909 | * @return Returns the new cursor position.
|
11910 | */
|
11911 | moveCursorToFirstRow(bMoveToFirstColumn?: boolean): ISafeCursor;
|
11912 | /**
|
11913 | * Moves the cursor to the next row.
|
11914 | * @param bMoveToFirstColumn Specifies if the cursor needs to be moved to the first column.
|
11915 | * @return Returns the new cursor position.
|
11916 | */
|
11917 | moveCursorToSuccessorRow(bMoveToFirstColumn?: boolean): ISafeCursor;
|
11918 | /**
|
11919 | * Moves the cursor to the previous row.
|
11920 | * @param bMoveToFirstColumn Specifies if the cursor needs to be moved to the first column.
|
11921 | * @return Returns the new cursor position.
|
11922 | */
|
11923 | moveCursorToPredecessorRow(bMoveToFirstColumn?: boolean): ISafeCursor;
|
11924 | /**
|
11925 | * Moves the row cursor to the last row.
|
11926 | * @param bMoveToFirstColumn Specifies if column cursor needs to be moved to the first column.
|
11927 | * @return Returns the new cursor position.
|
11928 | */
|
11929 | moveCursorToLastRow(bMoveToFirstColumn?: boolean): ISafeCursor;
|
11930 | /**
|
11931 | * Moves the cursor to the first item.
|
11932 | * @return Returns the new cursor position.
|
11933 | */
|
11934 | moveCursorToFirst(): ISafeCursor;
|
11935 | /**
|
11936 | * Moves the cursor to the next item.
|
11937 | * @return Returns the new cursor position.
|
11938 | */
|
11939 | moveCursorToSuccessor(): ISafeCursor;
|
11940 | /**
|
11941 | * Moves the cursor to the previous item.
|
11942 | * @return Returns the new cursor position.
|
11943 | */
|
11944 | moveCursorToPredecessor(): ISafeCursor;
|
11945 | /**
|
11946 | * Moves the cursor to the last item.
|
11947 | * @return Returns the new cursor position.
|
11948 | */
|
11949 | moveCursorToLast(): ISafeCursor;
|
11950 | /**
|
11951 | * Moves the cursor past the last item.
|
11952 | * @return Returns the new cursor position.
|
11953 | */
|
11954 | moveCursorToEnd(): ISafeCursor;
|
11955 | }
|
11956 | /**
|
11957 | * Implements the strict matrix item. In a strict matrix an item is always
|
11958 | * bound to a parent matrix and items can be created by the matrix.
|
11959 | * @param P Specifies the matrix type.
|
11960 | * @param H Specifies custom hooks for the item (optional).
|
11961 | * @param D Specifies a data type for the item (optional).
|
11962 | */
|
11963 | export abstract class StrictItem<
|
11964 | P extends StrictMatrix<P, StrictItem<P, H, D>, THooks, D>,
|
11965 | H extends THooks = void,
|
11966 | D = undefined
|
11967 | > extends Item<H> {
|
11968 | |
11969 |
|
11970 |
|
11971 |
|
11972 | constructor(pMatrix: P);
|
11973 | /** Retrieves a reference to the parent matrix. */
|
11974 | get parent(): P;
|
11975 | /**
|
11976 | * Retrieves a reference to the underlying matrix.
|
11977 | * @return Returns a reference to the matrix.
|
11978 | */
|
11979 | protected matrix(): P;
|
11980 | /**
|
11981 | * Inserts a new item before this item.
|
11982 | * @param pData Data which is passed to the item constructor.
|
11983 | * @return Returns a reference to the item.
|
11984 | */
|
11985 | protected insertBefore(pData: D): StrictItem<P, H, D>;
|
11986 | /**
|
11987 | * Inserts a new item after this item.
|
11988 | * @param pData Data which is passed to the item constructor.
|
11989 | * @return Returns a reference to the item.
|
11990 | */
|
11991 | protected insertAfter(pData: D): StrictItem<P, H, D>;
|
11992 | /**
|
11993 | * Dispatches a matrix event.
|
11994 | * @param pStack Reference to the stack.
|
11995 | * @param pEvent Specifies the event to dispatch.
|
11996 | */
|
11997 | dispatch(
|
11998 | pStack: Stack,
|
11999 | pEvent:
|
12000 | | IDispatch<"OnItemChange", IItemChangeEvent<StrictItem<P, H, D>>>
|
12001 | | IDispatch<"OnItemPop", IItemPopEvent<StrictItem<P, H, D>>>
|
12002 | | "Pop"
|
12003 | | "Detach"
|
12004 | ): void;
|
12005 | }
|
12006 | /**
|
12007 | * Describes the item constructor.
|
12008 | * @param P Specifies the matrix type.
|
12009 | * @param T Specifies the item type.
|
12010 | * @param D Specifies a data type for the item (optional).
|
12011 | */
|
12012 | export interface IStrictItemConstructor<P extends StrictMatrix<P, T, THooks, D>, T extends StrictItem<P, THooks, D>, D> {
|
12013 | new (pMatrix: P, pData: D): T;
|
12014 | }
|
12015 | /**
|
12016 | * Implements the strict convolution matrix. In a strict matrix an item is
|
12017 | * always bound to a parent matrix and items can be created by the matrix.
|
12018 | * @param P Specifies the matrix type.
|
12019 | * @param T Specifies the item type.
|
12020 | * @param H Specifies custom hooks for the matrix (optional).
|
12021 | * @param D Specifies a data type for the item (optional).
|
12022 | */
|
12023 | export abstract class StrictMatrix<
|
12024 | P extends StrictMatrix<P, T, H, D>,
|
12025 | T extends StrictItem<P, THooks, D>,
|
12026 | H extends THooks = void,
|
12027 | D = undefined
|
12028 | > extends Matrix<T, H> {
|
12029 | /**
|
12030 | * Creates a new matrix.
|
12031 | * @param pItem Specifies the item constructor.
|
12032 | * @param nType Specifies the matrix direction.
|
12033 | * @param nOrientation Specifies the matrix orientation.
|
12034 | * @param nDimensions Specifies the number of columns for vertical matrices or the number of rows for horizontal matrices.
|
12035 | */
|
12036 | constructor(pItemConstructor: IStrictItemConstructor<P, T, D>, nType?: Types, nOrientation?: Orientations, nDimensions?: number);
|
12037 | /** Retrieves a reference to the item constructor. */
|
12038 | get itemConstructor(): IStrictItemConstructor<P, T, D>;
|
12039 | /**
|
12040 | * Appends a new item to the end of the matrix.
|
12041 | * @param pData Data which is passed to the item constructor.
|
12042 | * @return Returns a reference to the item.
|
12043 | */
|
12044 | protected appendToMatrix(pData: D): T;
|
12045 | /**
|
12046 | * Inserts a new item at the beginning of the matrix.
|
12047 | * @param pData Data which is passed to the item constructor.
|
12048 | * @return Returns a reference to the item.
|
12049 | */
|
12050 | protected insertToMatrix(pData: D): T;
|
12051 | /**
|
12052 | * Inserts a new item at the specified cursor or at the beginning of the matrix.
|
12053 | * @param pData Data which is passed to the item constructor.
|
12054 | * @param pCursor Specifies the cursor.
|
12055 | * @return Returns a reference to the item.
|
12056 | */
|
12057 | protected insertToMatrixAtCursor(pData: D, pCursor: ICursor): T;
|
12058 | /**
|
12059 | * Inserts a new item at the specified index.
|
12060 | * @param pData Data which is passed to the item constructor.
|
12061 | * @param nIndex Specifies the index position.
|
12062 | * @return Returns a reference to the item.
|
12063 | */
|
12064 | protected insertToMatrixAtIndex(pData: D, nIndex: number): T;
|
12065 | /**
|
12066 | * Inserts a new item at the specified index.
|
12067 | * @param pData Data which is passed to the item constructor.
|
12068 | * @param nColumn Specifies the column.
|
12069 | * @param nRow Specifies the row.
|
12070 | * @return Returns a reference to the item.
|
12071 | */
|
12072 | protected insertToMatrixAtPosition(pData: D, nColumn: number, nRow: number): T;
|
12073 | /**
|
12074 | * Invoked when a new item instance is requested.
|
12075 | * @param pData Specifies the data.
|
12076 | * @return Returns the new item instance.
|
12077 | * @event
|
12078 | */
|
12079 | onItemInstance(pData: D): T;
|
12080 | }
|
12081 | /** Defines the `DataChange` event. */
|
12082 | export interface IDataChangeEvent<T> extends IHookPayload<"OnDataChange"> {
|
12083 | /** Reference to the model. */
|
12084 | readonly model: Model<T>;
|
12085 | /** Reference to the item. */
|
12086 | readonly item: ModelItem<T>;
|
12087 | /** Reference to the data. */
|
12088 | readonly data: T;
|
12089 | }
|
12090 | /**
|
12091 | * Creates a new matrix model item.
|
12092 | * @param T Specifies the type for the item.
|
12093 | */
|
12094 | export class ModelItem<T> extends StrictItem<Model<T>, "OnDataChange", T> {
|
12095 | /**
|
12096 | * Creates a new item.
|
12097 | * @param pData Specifies the data for the item.
|
12098 | */
|
12099 | constructor(pMatrix: Model<T>, pData: T);
|
12100 | /** Retrieves the attached data. */
|
12101 | get data(): T;
|
12102 | /** Sets the attached data. */
|
12103 | set data(pData: T);
|
12104 | /**
|
12105 | * Inserts a new item before this item.
|
12106 | * @param pData Specifies the data for the item.
|
12107 | * @return Returns the new item.
|
12108 | */
|
12109 | insertBefore(pData: T): ModelItem<T>;
|
12110 | /**
|
12111 | * Inserts a new item after this item.
|
12112 | * @param pData Specifies the data for the item.
|
12113 | * @return Returns the new item.
|
12114 | */
|
12115 | insertAfter(pData: T): ModelItem<T>;
|
12116 | }
|
12117 | /**
|
12118 | * Creates a matrix model of the specified type.
|
12119 | * @param T Specifies the type for the model.
|
12120 | */
|
12121 | export class Model<T> extends StrictMatrix<Model<T>, ModelItem<T>, "OnDataChange", T> {
|
12122 | /**
|
12123 | * Creates a new matrix.
|
12124 | * @param nType Specifies the matrix direction.
|
12125 | * @param nOrientation Specifies the matrix orientation.
|
12126 | * @param nDimensions Specifies the number of columns for vertical matrices
|
12127 | * or the number of rows for horizontal matrices.
|
12128 | * @param pItems Specifies an array with initial data items.
|
12129 | */
|
12130 | constructor(nType?: Types, nOrientation?: Orientations, nDimensions?: number, pItems?: T[]);
|
12131 | /**
|
12132 | * Appends a new item to the end of the model.
|
12133 | * @param pData Specifies the data for the item.
|
12134 | * @return Returns the new item.
|
12135 | */
|
12136 | append(pData: T): ModelItem<T>;
|
12137 | /**
|
12138 | * Inserts a new item at the beginning of the model.
|
12139 | * @param pData Specifies the data for the item.
|
12140 | * @return Returns the new item.
|
12141 | */
|
12142 | insert(pData: T): ModelItem<T>;
|
12143 | /**
|
12144 | * Inserts a new item at the specified cursor.
|
12145 | * @param pData Specifies the data for the item.
|
12146 | * @param pCursor Specifies the cursor.
|
12147 | * @return Returns the new item.
|
12148 | */
|
12149 | insertAtCursor(pData: T, pCursor: ICursor): ModelItem<T>;
|
12150 | /**
|
12151 | * Inserts a new item at the specified index.
|
12152 | * @param pData Specifies the data for the item.
|
12153 | * @param nIndex Specifies the index position.
|
12154 | * @return Returns the new item.
|
12155 | */
|
12156 | insertAtIndex(pData: T, nIndex: number): ModelItem<T>;
|
12157 | /**
|
12158 | * Inserts a new item at the specified index.
|
12159 | * @param pData Specifies the data for the item.
|
12160 | * @param nColumn Specifies the column.
|
12161 | * @param nRow Specifies the row.
|
12162 | * @return Returns the new item.
|
12163 | */
|
12164 | insertAtPosition(pData: T, nColumn: number, nRow: number): ModelItem<T>;
|
12165 | }
|
12166 | }
|
12167 |
|
12168 | declare module "tripetto/module/metrics" {
|
12169 | export interface IPoint {
|
12170 | /** Specifies the horizontal coordinate. */
|
12171 | readonly x: number;
|
12172 | /** Specifies the vertical coordinate. */
|
12173 | readonly y: number;
|
12174 | }
|
12175 | export interface IRectangleProperties<T extends string> {
|
12176 | /** Specifies the rectangle name. */
|
12177 | name: T;
|
12178 | /** Specifies the initial width of the rectangle. */
|
12179 | readonly width?: number;
|
12180 | /** Specifies the initial height of the rectangle. */
|
12181 | readonly height?: number;
|
12182 | /** Specifies the minimal width of the rectangle. */
|
12183 | readonly minWidth?: number;
|
12184 | /** Specifies the minimal height of the rectangle. */
|
12185 | readonly minHeight?: number;
|
12186 | /** Specifies the maximal width of the rectangle. */
|
12187 | readonly maxWidth?: number;
|
12188 | /** Specifies the minimal width of the rectangle. */
|
12189 | readonly maxHeight?: number;
|
12190 | /** Specifies the left spacing of the rectangle. */
|
12191 | readonly spacingLeft?: number;
|
12192 | /** Specifies the top spacing of the rectangle. */
|
12193 | readonly spacingTop?: number;
|
12194 | /** Specifies the right spacing of the rectangle. */
|
12195 | readonly spacingRight?: number;
|
12196 | /** Specifies the bottom spacing of the rectangle. */
|
12197 | readonly spacingBottom?: number;
|
12198 | /** Specifies the left hint correction. */
|
12199 | readonly hintCorrectionLeft?: number;
|
12200 | /** Specifies the top hint correction. */
|
12201 | readonly hintCorrectionTop?: number;
|
12202 | /** Specifies the right hint correction. */
|
12203 | readonly hintCorrectionRight?: number;
|
12204 | /** Specifies the bottom hint correction. */
|
12205 | readonly hintCorrectionBottom?: number;
|
12206 | /** Specifies the horizontal mean correction. */
|
12207 | readonly meanCorrectionHorizontal?: number;
|
12208 | /** Specifies the vertical mean correction. */
|
12209 | readonly meanCorrectionVertical?: number;
|
12210 | /** Specifies the names of the rectangles which should align to this rectangle. */
|
12211 | readonly align?: T[];
|
12212 | }
|
12213 | export class Coordinate {
|
12214 | /** Specifies the left coordinate. */
|
12215 | left: number;
|
12216 | /** Specifies the top coordinate. */
|
12217 | top: number;
|
12218 | /** Specifies the right coordinate. */
|
12219 | right: number;
|
12220 | /** Specifies the bottom coordinate. */
|
12221 | bottom: number;
|
12222 | /**
|
12223 | * Constructs a new coordinate.
|
12224 | * @param nLeft Specifies the left coordinate.
|
12225 | * @param nTop Specifies the top coordinate.
|
12226 | * @param nRight Specifies the right coordinate.
|
12227 | * @param nBottom Specifies the bottom coordinate.
|
12228 | */
|
12229 | constructor(nLeft?: number, nTop?: number, nRight?: number, nBottom?: number);
|
12230 | }
|
12231 | export class Dimensions {
|
12232 | /** Retrieves the `none` constant for the width and height. */
|
12233 | static get NONE(): number;
|
12234 |
|
12235 | /**
|
12236 | * Constructs a new dimension object.
|
12237 | * @param nWidth Specifies the width.
|
12238 | * @param nHeight Specifies the height.
|
12239 | * @param nMinWidth Specifies the minimum width.
|
12240 | * @param nMinHeight Specifies the minimum height.
|
12241 | * @param nMaxWidth Specifies the maximum width.
|
12242 | * @param nMaxHeight Specifies the minimum height.
|
12243 | */
|
12244 | constructor(nWidth?: number, nHeight?: number, nMinWidth?: number, nMinHeight?: number, nMaxWidth?: number, nMaxHeight?: number);
|
12245 | /** Retrieves the minimum width. */
|
12246 | get minWidth(): number;
|
12247 | /** Sets the minimum width. */
|
12248 | set minWidth(nMinWidth: number);
|
12249 | /** Retrieves the minimum height. */
|
12250 | get minHeight(): number;
|
12251 | /** Sets the minimum height. */
|
12252 | set minHeight(nMinHeight: number);
|
12253 | /** Retrieves the maximum width. */
|
12254 | get maxWidth(): number;
|
12255 | /** Sets the maximum width. */
|
12256 | set maxWidth(nMaxWidth: number);
|
12257 | /** Retrieves the maximum height. */
|
12258 | get maxHeight(): number;
|
12259 | /** Sets the maximum height. */
|
12260 | set maxHeight(nMaxHeight: number);
|
12261 | /** Retrieves the current width. */
|
12262 | get width(): number;
|
12263 | /** Sets the current width. */
|
12264 | set width(nWidth: number);
|
12265 | /** Retrieves the current height. */
|
12266 | get height(): number;
|
12267 | /** Sets the current height. */
|
12268 | set height(nHeight: number);
|
12269 | /** Retrieves if the width is specified. */
|
12270 | get isWidthSpecified(): boolean;
|
12271 | /** Retrieves if the height is specified. */
|
12272 | get isHeightSpecified(): boolean;
|
12273 | /** Retrieves the unranged width. */
|
12274 | get w(): number;
|
12275 | /** Retrieves the unranged height. */
|
12276 | get h(): number;
|
12277 | }
|
12278 | export class Rectangle {
|
12279 | /**
|
12280 | * Constructs a new rectangle.
|
12281 | * @param pProperties Specifies the rectangle properties.
|
12282 | */
|
12283 | constructor(pProperties?: {
|
12284 |
|
12285 | left?: number;
|
12286 |
|
12287 | top?: number;
|
12288 |
|
12289 | right?: number;
|
12290 |
|
12291 | bottom?: number;
|
12292 |
|
12293 | width?: number;
|
12294 |
|
12295 | height?: number;
|
12296 |
|
12297 | minWidth?: number;
|
12298 |
|
12299 | minHeight?: number;
|
12300 |
|
12301 | maxWidth?: number;
|
12302 |
|
12303 | maxHeight?: number;
|
12304 | });
|
12305 | /** Retrieves the dimensions. */
|
12306 | get dimensions(): Dimensions;
|
12307 | /** Retrieves the coordinates. */
|
12308 | get coordinate(): Coordinate;
|
12309 | /** Retrieves the left coordinate of the rectangle. */
|
12310 | get left(): number;
|
12311 | /** Sets the left coordinate of the rectangle. */
|
12312 | set left(nLeft: number);
|
12313 | /** Retrieves the top coordinate of the rectangle. */
|
12314 | get top(): number;
|
12315 | /** Sets the top coordinate of the rectangle. */
|
12316 | set top(nTop: number);
|
12317 | /** Retrieves the right coordinate of the rectangle. */
|
12318 | get right(): number;
|
12319 | /** Sets the right coordinate of the rectangle. */
|
12320 | set right(nRight: number);
|
12321 | /** Retrieves the bottom coordinate of the rectangle. */
|
12322 | get bottom(): number;
|
12323 | /** Sets the bottom coordinate of the rectangle. */
|
12324 | set bottom(nBottom: number);
|
12325 | /** Retrieves the width of the rectangle. */
|
12326 | get width(): number;
|
12327 | /** Sets the width of the rectangle. */
|
12328 | set width(nWidth: number);
|
12329 | /** Retrieves the height of the rectangle. */
|
12330 | get height(): number;
|
12331 | /** Sets the height of the rectangle. */
|
12332 | set height(nHeight: number);
|
12333 | /** Retrieves the rounded width of the rectangle. */
|
12334 | get roundedWidth(): number;
|
12335 | /** Retrieves the rounded height of the rectangle. */
|
12336 | get roundedHeight(): number;
|
12337 | /** Retrieves the unranged width of the rectangle. */
|
12338 | get w(): number;
|
12339 | /** Retrieves the unranged height of the rectangle. */
|
12340 | get h(): number;
|
12341 | /** Retrieves an immutable copy of the rectangle. */
|
12342 | get copy(): Rectangle;
|
12343 | /**
|
12344 | * Verifies if the supplied point is within the rectangle.
|
12345 | * @param nX Specifies the horizontal position.
|
12346 | * @param nY Specifies the vertical position.
|
12347 | * @return Returns `true` if the point is within the rectangle.
|
12348 | */
|
12349 | isIn(nX?: number, nY?: number): boolean;
|
12350 | }
|
12351 | /**
|
12352 | * Implements a rectangle manager which can be used to manage rectangle relationships. The relation between those rectangles is described
|
12353 | * by specifying characteristics of the rectangles, such as padding, minimal and maximum dimensions, etc. When the dimensions of a
|
12354 | * rectangle change, the resulting dimensions of the surrounding rectangles are calculated.
|
12355 | * @param T Specifies the rectangle names.
|
12356 | */
|
12357 | export class Rectangles<T extends string> {
|
12358 | /**
|
12359 | * Constructs a new rectangle repository.
|
12360 | * @param pRectangles Specifies an array with rectangles.
|
12361 | */
|
12362 | constructor(pRectangles?: IRectangleProperties<T>[]);
|
12363 | /** Retrieves the left coordinate of the comprehensive rectangle. */
|
12364 | get left(): number;
|
12365 | /** Sets the left coordinate of the comprehensive rectangle. */
|
12366 | set left(nLeft: number);
|
12367 | /** Retrieves the top coordinate of the comprehensive rectangle. */
|
12368 | get top(): number;
|
12369 | /** Sets the top coordinate of the comprehensive rectangle. */
|
12370 | set top(nTop: number);
|
12371 | /** Retrieves the right coordinate of the comprehensive rectangle. */
|
12372 | get right(): number;
|
12373 | /** Retrieves the bottom coordinate of the comprehensive rectangle. */
|
12374 | get bottom(): number;
|
12375 | /** Retrieves the width of the comprehensive rectangle. */
|
12376 | get width(): number;
|
12377 | /** Retrieves the height of the comprehensive rectangle. */
|
12378 | get height(): number;
|
12379 | /** Returns the width and height of the comprehensive rectangle. */
|
12380 | get dimensions(): Dimensions;
|
12381 | /**
|
12382 | * Retrieves the inner left coordinate of the comprehensive rectangle. This
|
12383 | * is the rectangle which includes all rectangles without spacing.
|
12384 | */
|
12385 | get innerLeft(): number;
|
12386 | /**
|
12387 | * Retrieves the inner top coordinate of the comprehensive rectangle. This
|
12388 | * is the rectangle which includes all rectangles without spacing.
|
12389 | */
|
12390 | get innerTop(): number;
|
12391 | /**
|
12392 | * Retrieves the inner right coordinate of the comprehensive rectangle. This
|
12393 | * is the rectangle which includes all rectangles without spacing.
|
12394 | */
|
12395 | get innerRight(): number;
|
12396 | /**
|
12397 | * Retrieves the inner bottom coordinate of the comprehensive rectangle.
|
12398 | * This is the rectangle which includes all rectangles without spacing.
|
12399 | */
|
12400 | get innerBottom(): number;
|
12401 | /**
|
12402 | * Retrieves the inner width of the comprehensive rectangle. This is the
|
12403 | * rectangle which includes all rectangles without spacing.
|
12404 | */
|
12405 | get innerWidth(): number;
|
12406 | /**
|
12407 | * Retrieves the inner height of the comprehensive rectangle. This is the
|
12408 | * rectangle which includes all rectangles without spacing.
|
12409 | */
|
12410 | get innerHeight(): number;
|
12411 | /** Retrieves the shift mode. */
|
12412 | get isShifted(): boolean;
|
12413 | /** Sets the shift mode. */
|
12414 | set isShifted(bShift: boolean);
|
12415 | /** Retrieves the left position of the shifted element. */
|
12416 | get shiftLeft(): number;
|
12417 | /** Sets the left move. */
|
12418 | set shiftLeft(nLeft: number);
|
12419 | /** Retrieves the top position of the shifted element. */
|
12420 | get shiftTop(): number;
|
12421 | /** Sets the top shift. */
|
12422 | set shiftTop(nTop: number);
|
12423 | /** Retrieves the right position of the shifted element. */
|
12424 | get shiftRight(): number;
|
12425 | /** Retrieves the bottom position of the shifted element. */
|
12426 | get shiftBottom(): number;
|
12427 | /** Retrieves the last horizontal position shift. */
|
12428 | get shiftHorizontal(): number;
|
12429 | /** Retrieves the last vertical position shift. */
|
12430 | get shiftVertical(): number;
|
12431 | /** Retrieves the horizontal shift mean. */
|
12432 | get shiftMeanHorizontal(): number;
|
12433 | /** Retrieves the vertical shift mean. */
|
12434 | get shiftMeanVertical(): number;
|
12435 | /**
|
12436 | * Iterates through all rectangles.
|
12437 | * @param fnRectangle Specifies the function which is called for each rectangle.
|
12438 | * @param fnRectangle.pRectangle Reference to the rectangle metrics.
|
12439 | * @param fnRectangle.sRectangle Contains the rectangle name.
|
12440 | * @param nZoom Specifies an optional zoom factor.
|
12441 | */
|
12442 | each(fnRectangle: (pRectangle: Rectangle, sRectangle: T) => void, nZoom?: number): void;
|
12443 | /**
|
12444 | * Sets or retrieves the minimum width of the specified rectangle.
|
12445 | * @param sRectangle Specifies the name of the rectangle.
|
12446 | * @param nMinWidth Specifies the minimum width.
|
12447 | * @return Returns the minimal width.
|
12448 | */
|
12449 | minWidth(sRectangle: T, nMinWidth?: number): number;
|
12450 | /**
|
12451 | * Sets or retrieves the minimum height of the specified rectangle.
|
12452 | * @param sRectangle Specifies the name of the rectangle.
|
12453 | * @param nMinHeight Specifies the minimum height.
|
12454 | * @return Returns the minimal height.
|
12455 | */
|
12456 | minHeight(sRectangle: T, nMinHeight?: number): number;
|
12457 | /**
|
12458 | * Sets or retrieves the maximum width of the specified rectangle.
|
12459 | * @param sRectangle Specifies the name of the rectangle.
|
12460 | * @param nMaxWidth Specifies the maximum width.
|
12461 | * @return Returns the maximum width.
|
12462 | */
|
12463 | maxWidth(sRectangle: T, nMaxWidth?: number): number;
|
12464 | /**
|
12465 | * Sets or retrieves the maximum height of the specified rectangle.
|
12466 | * @param sRectangle Specifies the name of the rectangle.
|
12467 | * @param nMaxHeight Specifies the maximum height.
|
12468 | * @return Returns the maximum height.
|
12469 | */
|
12470 | maxHeight(sRectangle: T, nMaxHeight?: number): number;
|
12471 | /**
|
12472 | * Retrieves the horizontal center of the specified rectangle or the comprehensive rectangle.
|
12473 | * @param sRectangle Specifies the name of the rectangle. If omitted the mean of the comprehensive rectangle will be calculated.
|
12474 | * @return Returns the horizontal mean.
|
12475 | */
|
12476 | meanHorizontal(sRectangle?: T): number;
|
12477 | /**
|
12478 | * Retrieves the vertical center of the specified rectangle or the comprehensive rectangle.
|
12479 | * @param sRectangle Specifies the name of the rectangle. If omitted the mean of the comprehensive rectangle will be calculated.
|
12480 | * @return Returns the vertical mean.
|
12481 | */
|
12482 | meanVertical(sRectangle?: T): number;
|
12483 | /**
|
12484 | * Retrieves the rectangle for the specified rectangle or the comprehensive rectangle.
|
12485 | * @param sRectangle Specifies the name of the rectangle. If omitted the rectangle of the comprehensive rectangle will be calculated.
|
12486 | * @param nZoom Specifies an optional zoom factor.
|
12487 | * @return Returns the rectangle.
|
12488 | */
|
12489 | rectangle(sRectangle?: T, nZoom?: number): Rectangle;
|
12490 | /**
|
12491 | * Retrieves the applied rectangle for the specified rectangle. This is the rectangle which is currently stored in the buffer.
|
12492 | * @param sRectangle Specifies the name of the rectangle. If omitted the rectangle of the comprehensive rectangle will be calculated.
|
12493 | * @param nZoom Specifies an optional zoom factor.
|
12494 | * @return Returns the rectangle.
|
12495 | */
|
12496 | rectangleApplied(sRectangle?: T, nZoom?: number): Rectangle;
|
12497 | /**
|
12498 | * Sets or retrieves the width of a rectangle or retrieves the width of the comprehensive rectangle.
|
12499 | * @param sRectangle Specifies the name of the rectangle. If omitted the rectangle of the comprehensive rectangle will be calculated.
|
12500 | * @param nWidth Specifies the width.
|
12501 | * @return Returns the width.
|
12502 | */
|
12503 | rectangleWidth(sRectangle?: T, nWidth?: number): number;
|
12504 | /**
|
12505 | * Sets or retrieves the height of a rectangle or retrieves the width of the comprehensive rectangle.
|
12506 | * @param sRectangle Specifies the name of the rectangle. If omitted the rectangle of the comprehensive rectangle will be calculated.
|
12507 | * @param nWidth Specifies the width.
|
12508 | * @return Returns the width.
|
12509 | */
|
12510 | rectangleHeight(sRectangle?: T, nHeight?: number): number;
|
12511 | /**
|
12512 | * Verifies if the specified rectangle is aligned with another rectangle.
|
12513 | * @param sRectangleA Specifies the first rectangle.
|
12514 | * @param sRectangleB Specifies the second rectangle.
|
12515 | * @return Returns `true` if the rectangle is aligned.
|
12516 | */
|
12517 | isRectangleAligned(sRectangleA: T, sRectangleB: T): boolean;
|
12518 | /**
|
12519 | * Sets or retrieves the left spacing of a rectangle or retrieves the left comprehensive rectangle spacing.
|
12520 | * @param sRectangle Specifies the name of the rectangle. If omitted the rectangle of the comprehensive rectangle will be calculated.
|
12521 | * @param nSpacingLeft Specifies the left spacing.
|
12522 | * @return Returns the left spacing.
|
12523 | */
|
12524 | spacingLeft(sRectangle?: T, nSpacingLeft?: number): number;
|
12525 | /**
|
12526 | * Sets or retrieves the top spacing of a rectangle or retrieves the top comprehensive rectangle spacing.
|
12527 | * @param sRectangle Specifies the name of the rectangle. If omitted the rectangle of the comprehensive rectangle will be calculated.
|
12528 | * @param nSpacingTop Specifies the top spacing.
|
12529 | * @return Returns the top spacing.
|
12530 | */
|
12531 | spacingTop(sRectangle?: T, nSpacingTop?: number): number;
|
12532 | /**
|
12533 | * Sets or retrieves the right spacing of a rectangle or retrieves the right comprehensive rectangle spacing.
|
12534 | * @param sRectangle Specifies the name of the rectangle. If omitted the rectangle of the comprehensive rectangle will be calculated.
|
12535 | * @param nSpacingLeft Specifies the right spacing.
|
12536 | * @return Returns the right spacing.
|
12537 | */
|
12538 | spacingRight(sRectangle?: T, nSpacingRight?: number): number;
|
12539 | /**
|
12540 | * Sets or retrieves the bottom spacing of a rectangle or retrieves the bottom comprehensive rectangle spacing.
|
12541 | * @param sRectangle Specifies the name of the rectangle. If omitted the rectangle of the comprehensive rectangle will be calculated.
|
12542 | * @param nSpacingBottom Specifies the bottom spacing.
|
12543 | * @return Returns the bottom spacing.
|
12544 | */
|
12545 | spacingBottom(sRectangle?: T, nSpacingBottom?: number): number;
|
12546 | /**
|
12547 | * Retrieves the horizontal spacing of a rectangle or the comprehensive rectangle.
|
12548 | * @param sRectangle Specifies the name of the rectangle. If omitted the rectangle of the comprehensive rectangle will be calculated.
|
12549 | * @return Returns the horizontal spacing.
|
12550 | */
|
12551 | spacingHorizontal(sRectangle?: T): number;
|
12552 | /**
|
12553 | * Retrieves the vertical spacing of a rectangle or the comprehensive rectangle.
|
12554 | * @param sRectangle Specifies the name of the rectangle. If omitted the rectangle of the comprehensive rectangle will be calculated.
|
12555 | * @return Returns the vertical spacing.
|
12556 | */
|
12557 | spacingVertical(sRectangle?: T): number;
|
12558 | /**
|
12559 | * Sets or retrieves the left hint correction of a rectangle.
|
12560 | * @param sRectangle Specifies the name of the rectangle.
|
12561 | * @param nHintLeft Specifies the left hint correction.
|
12562 | * @return Returns the left hint correction.
|
12563 | */
|
12564 | hintCorrectionLeft(sRectangle: T, nHintLeft?: number): number;
|
12565 | /**
|
12566 | * Sets or retrieves the top hint correction of a rectangle.
|
12567 | * @param sRectangle Specifies the name of the rectangle.
|
12568 | * @param nHintTop Specifies the top hint correction.
|
12569 | * @return Returns the top hint correction.
|
12570 | */
|
12571 | hintCorrectionTop(sRectangle: T, nHintTop?: number): number;
|
12572 | /**
|
12573 | * Sets or retrieves the right hint correction of a rectangle.
|
12574 | * @param sRectangle Specifies the name of the rectangle.
|
12575 | * @param nHintRight Specifies the right hint correction.
|
12576 | * @return Returns the right hint correction.
|
12577 | */
|
12578 | hintCorrectionRight(sRectangle: T, nHintRight?: number): number;
|
12579 | /**
|
12580 | * Sets or retrieves the bottom hint correction of a rectangle.
|
12581 | * @param sRectangle Specifies the name of the rectangle.
|
12582 | * @param nHintBottom Specifies the bottom hint correction.
|
12583 | * @return Returns the bottom hint correction.
|
12584 | */
|
12585 | hintCorrectionBottom(sRectangle: T, nHintBottom?: number): number;
|
12586 | /**
|
12587 | * Retrieves the shifted rectangle.
|
12588 | * @param sRectangle Specifies the name of the rectangle. If omitted the rectangle of the comprehensive rectangle will be calculated.
|
12589 | * @return Returns the rectangle.
|
12590 | */
|
12591 | shiftRectangle(sRectangle?: T): Rectangle;
|
12592 | /**
|
12593 | * Positions the rectangles.
|
12594 | * @return Returns `true` if the position is changed.
|
12595 | */
|
12596 | position(): boolean;
|
12597 | /**
|
12598 | * Resizes the rectangles.
|
12599 | * @return Returns which properties are changed (`none`, `width`, `height` or `both`).
|
12600 | */
|
12601 | resize(): "none" | "width" | "height" | "both";
|
12602 | /**
|
12603 | * Verifies if the supplied coordinate is within one or more rectangles.
|
12604 | * @param nX Specifies the left position.
|
12605 | * @param nY Specifies the top position.
|
12606 | * @param bSpacing Specifies if the spacing needs to be applied.
|
12607 | * @return Returns `true` if the coordinate is within one or more rectangles.
|
12608 | */
|
12609 | isCoordinateIn(nX: number | undefined, nY: number | undefined, bSpacing?: boolean): boolean;
|
12610 | /**
|
12611 | * Verifies if the supplied coordinate is within the comprehensive rectangle.
|
12612 | * @param nX Specifies the left position.
|
12613 | * @param nY Specifies the top position.
|
12614 | * @param bInner Specifies if the inner rectangle needs to be verified.
|
12615 | * @param pCorrection Specifies correction coordinates.
|
12616 | * @return Returns `true` if the coordinate is within the comprehensive rectangle.
|
12617 | */
|
12618 | isCoordinateInRectangles(nX: number | undefined, nY: number | undefined, bInner?: boolean, pCorrection?: Coordinate): boolean;
|
12619 | /**
|
12620 | * Verifies if the supplied coordinate is within the specified rectangle.
|
12621 | * @param sRectangle Specifies the name of the rectangle.
|
12622 | * @param nX Specifies the left position.
|
12623 | * @param nY Specifies the top position.
|
12624 | * @param bSpacing Specifies if spacing needs to be included.
|
12625 | * @return Returns `true` if the coordinate is within the specified rectangle.
|
12626 | */
|
12627 | isCoordinateInRectangle(sRectangle: T, nX: number | undefined, nY: number | undefined, bSpacing?: boolean): boolean;
|
12628 | }
|
12629 | export class Spacing extends Coordinate {
|
12630 | /**
|
12631 | * Constructs a new spacing container.
|
12632 | * @param nLeft Specifies the left spacing.
|
12633 | * @param nTop Specifies the top spacing.
|
12634 | * @param nRight Specifies the right spacing.
|
12635 | * @param nBottom Specifies the bottom spacing.
|
12636 | */
|
12637 | constructor(nLeft?: number, nTop?: number, nRight?: number, nBottom?: number);
|
12638 | /** Retrieves the total horizontal spacing. */
|
12639 | get horizontal(): number;
|
12640 | /** Retrieves the total vertical spacing. */
|
12641 | get vertical(): number;
|
12642 | }
|
12643 | }
|
12644 |
|
12645 | declare module "tripetto/module/serializer" {
|
12646 | import { Stack, TAny } from "tripetto/module/functional";
|
12647 |
|
12648 | export type TSerializePrimitives = string | number | boolean | undefined | null | ISerialize;
|
12649 | export type TSerializeTypes = TSerializePrimitives | TSerializePrimitives[];
|
12650 | export interface ISerialize {
|
12651 | /** Retrieves the specified property. */
|
12652 | readonly [property: string]: TSerializeTypes;
|
12653 | }
|
12654 | /**
|
12655 | * Serializes a source.
|
12656 | * @param pSource Reference to the source.
|
12657 | * @param pData Reference to the data object which receives the serialized data.
|
12658 | */
|
12659 | export function serializeTo<T, S extends ISerialize>(pSource: T, pData: S): S;
|
12660 | /**
|
12661 | * Deserializes data to a target.
|
12662 | * @param pTarget Reference to the target.
|
12663 | * @param pData Reference to the serialized data.
|
12664 | * @param pAfterwards Optional stack with calls that are invoked after the
|
12665 | * structural deserialization is done.
|
12666 | */
|
12667 | export function deserializeFrom<T, S extends ISerialize>(pTarget: T, pData: S, pAfterwards?: Stack): T;
|
12668 | export interface IProp {
|
12669 | /** Name of the propery. */
|
12670 | readonly property: string;
|
12671 | /** Value of the property. */
|
12672 | readonly value: TAny;
|
12673 | }
|
12674 | /**
|
12675 | * Finds all the serializable props.
|
12676 | * @param pSource Reference to the source.
|
12677 | */
|
12678 | export function serializableProps<T>(pSource: T): IProp[];
|
12679 | /**
|
12680 | * Finds all the deserializable props.
|
12681 | * @param pSource Reference to the source.
|
12682 | */
|
12683 | export function deserializableProps<T>(pSource: T): IProp[];
|
12684 | /** Decorator which marks a property to be deserialized. */
|
12685 | export function deserialize<T>(pTarget: T, sProperty: string, pDescriptor?: PropertyDescriptor): void;
|
12686 | /** Decorator which marks a function as the deserializer of an object. */
|
12687 | export function deserializer<T>(pTarget: T, sProperty: string, pDescriptor?: PropertyDescriptor): void;
|
12688 | /** Decorator which marks a function as the serializer of an object. */
|
12689 | export function serializer<T>(pTarget: T, sProperty: string, pDescriptor?: PropertyDescriptor): void;
|
12690 | /** Decorator which marks a property to be serialized. */
|
12691 | export function serialize<T>(pTarget: T, sProperty: string, pDescriptor?: PropertyDescriptor): void;
|
12692 | }
|
12693 |
|
12694 | declare module "tripetto/module/sha2" {
|
12695 | /**
|
12696 | * Hashes the supplied string data using SHA2-224.
|
12697 | * @param sData Specifies the data to hash.
|
12698 | * @return Returns the hash string.
|
12699 | */
|
12700 | export function SHA2_224(sData: string): string;
|
12701 | /**
|
12702 | * Hashes the supplied string data using SHA2-256.
|
12703 | * @param sData Specifies the data to hash.
|
12704 | * @return Returns the hash string.
|
12705 | */
|
12706 | export function SHA2_256(sData: string): string;
|
12707 | /**
|
12708 | * Hashes the supplied string data using SHA2-384.
|
12709 | * @param sData Specifies the data to hash.
|
12710 | * @return Returns the hash string.
|
12711 | */
|
12712 | export function SHA2_384(sData: string): string;
|
12713 | /**
|
12714 | * Hashes the supplied string data using SHA2-512.
|
12715 | * @param sData Specifies the data to hash.
|
12716 | * @return Returns the hash string.
|
12717 | */
|
12718 | export function SHA2_512(sData: string): string;
|
12719 | /**
|
12720 | * Hashes the supplied string data using SHA2-512/224.
|
12721 | * @param sData Specifies the data to hash.
|
12722 | * @return Returns the hash string.
|
12723 | */
|
12724 | export function SHA2_512_224(sData: string): string;
|
12725 | /**
|
12726 | * Hashes the supplied string data using SHA2-512/256.
|
12727 | * @param sData Specifies the data to hash.
|
12728 | * @return Returns the hash string.
|
12729 | */
|
12730 | export function SHA2_512_256(sData: string): string;
|
12731 | /**
|
12732 | * Hashes the supplied string data using SHA2-224. This function implements a
|
12733 | * cache to optimize performance when the same data is hashed multiple times.
|
12734 | * @param sData Specifies the data to hash.
|
12735 | * @return Returns the hash string.
|
12736 | */
|
12737 | export function CSHA2_224(sData: string): string;
|
12738 | /**
|
12739 | * Hashes the supplied string data using SHA2-256. This function implements a
|
12740 | * cache to optimize performance when the same data is hashed multiple times.
|
12741 | * @param sData Specifies the data to hash.
|
12742 | * @return Returns the hash string.
|
12743 | */
|
12744 | export function CSHA2_256(sData: string): string;
|
12745 | /**
|
12746 | * Hashes the supplied string data using SHA2-384. This function implements a
|
12747 | * cache to optimize performance when the same data is hashed multiple times.
|
12748 | * @param sData Specifies the data to hash.
|
12749 | * @return Returns the hash string.
|
12750 | */
|
12751 | export function CSHA2_384(sData: string): string;
|
12752 | /**
|
12753 | * Hashes the supplied string data using SHA2-512. This function implements a
|
12754 | * cache to optimize performance when the same data is hashed multiple times.
|
12755 | * @param sData Specifies the data to hash.
|
12756 | * @return Returns the hash string.
|
12757 | */
|
12758 | export function CSHA2_512(sData: string): string;
|
12759 | /**
|
12760 | * Hashes the supplied string data using SHA2-512/224. This function implements a
|
12761 | * cache to optimize performance when the same data is hashed multiple times.
|
12762 | * @param sData Specifies the data to hash.
|
12763 | * @return Returns the hash string.
|
12764 | */
|
12765 | export function CSHA2_512_224(sData: string): string;
|
12766 | /**
|
12767 | * Hashes the supplied string data using SHA2-512/256. This function implements a
|
12768 | * cache to optimize performance when the same data is hashed multiple times.
|
12769 | * @param sData Specifies the data to hash.
|
12770 | * @return Returns the hash string.
|
12771 | */
|
12772 | export function CSHA2_512_256(sData: string): string;
|
12773 | }
|
12774 |
|
12775 | declare module "tripetto/module/touch" {
|
12776 | import { Asset, Stylesheet, TDOMElement } from "tripetto/module/dom";
|
12777 | import { TArguments } from "tripetto/module/functional";
|
12778 | import { Hooks, THooks } from "tripetto/module/hookup";
|
12779 | import { Coordinate, IPoint, Rectangle } from "tripetto/module/metrics";
|
12780 |
|
12781 |
|
12782 | export type Type = number;
|
12783 |
|
12784 | export type Types = number;
|
12785 | export const enum Events {
|
12786 | OnTouchStart = 1,
|
12787 | OnTouchMove = 2,
|
12788 | OnTouchEnd = 4,
|
12789 | OnMouseDown = 8,
|
12790 | OnMouseMove = 16,
|
12791 | OnMouseUp = 32,
|
12792 | OnMouseWheel = 64,
|
12793 | }
|
12794 | export const enum Priorities {
|
12795 | Lowest = 1,
|
12796 | Low = 2,
|
12797 | Normal = 3,
|
12798 | High = 4,
|
12799 | Highest = 5,
|
12800 | }
|
12801 | export type TAsset = Asset | TDOMElement;
|
12802 | export interface IController {
|
12803 |
|
12804 | readonly id: string;
|
12805 |
|
12806 | readonly types: Types;
|
12807 |
|
12808 | readonly processor?: (nEvent: Events) => void;
|
12809 |
|
12810 | readonly priority?: Priorities;
|
12811 |
|
12812 | readonly terminate?: (() => void) | undefined;
|
12813 | }
|
12814 | export interface IEvent<T> {
|
12815 | /** Specifies the event function. */
|
12816 | readonly event: ((pEvent: T) => boolean | void) | ((...pArguments: TArguments) => boolean | void) | undefined;
|
12817 | /** Specifies if the event is called asynchronous. */
|
12818 | readonly asynchronous?: boolean;
|
12819 | /** Specifies if the event is cancelable or should always invoked. */
|
12820 | readonly cancelable?: boolean;
|
12821 | /** Specifies if the controller should be activated or deactivated. */
|
12822 | readonly activate?: boolean;
|
12823 | /** Contains the event payload. */
|
12824 | readonly payload?: T;
|
12825 | /** Contains the event arguments. */
|
12826 | readonly arguments?: TArguments;
|
12827 | }
|
12828 | export abstract class Controller<T extends THooks> extends Hooks<T> {
|
12829 | /**
|
12830 | * Generates a new unique controller type.
|
12831 | * @return Returns the new type.
|
12832 | */
|
12833 | static createType(): Type;
|
12834 | /**
|
12835 | * Constructs a new controller.
|
12836 | * @param pController Reference to the static part of the controller.
|
12837 | * @param pAsset Specifies the asset for the controller.
|
12838 | * @param sMode Specifies the controller mode. In single mode only one
|
12839 | * controller of the same type is allowed on an asset.
|
12840 | * @param pStylesheet Reference to the stylesheet to use for styles.
|
12841 | * @param pArea Specifies an optional area for the controller.
|
12842 | * @param nType Specifies the controller type.
|
12843 | */
|
12844 | protected constructor(
|
12845 | pController: IController,
|
12846 | pAsset: TAsset,
|
12847 | sMode: "single" | "multiple",
|
12848 | pStylesheet?: Stylesheet,
|
12849 | pArea?: Coordinate | (() => Coordinate),
|
12850 | nType?: Type
|
12851 | );
|
12852 | /**
|
12853 | * Retrieves the rectangle for the specified asset or the first attached asset.
|
12854 | * @return Returns the bounding rectangle.
|
12855 | */
|
12856 | protected get rectangle(): Rectangle;
|
12857 | /** Contains the identifier of the controller. */
|
12858 | get id(): number;
|
12859 | /** Contains the controller type. */
|
12860 | get type(): Type;
|
12861 | /** Retrieves the stylesheet. */
|
12862 | get stylesheet(): Stylesheet;
|
12863 | /** Contains a reference to the first asset attached to the controller. */
|
12864 | get asset(): Asset;
|
12865 | /** Retrieves the controller area. */
|
12866 | get area(): Coordinate;
|
12867 | /** Sets the controller area. */
|
12868 | set area(pArea: Coordinate);
|
12869 | /** Retrieves if the controller is active. */
|
12870 | get isActive(): boolean;
|
12871 | /** Retrieves if the controller is disabled. */
|
12872 | get isDisabled(): boolean;
|
12873 | /** Specifies if the controller is disabled. */
|
12874 | set isDisabled(bDisabled: boolean);
|
12875 | /** Retrieves if the controller is detached. */
|
12876 | get isDetached(): boolean;
|
12877 | /** Activates the controller. */
|
12878 | protected activate(): void;
|
12879 | /** Deactivates the controller. */
|
12880 | protected deactivate(): void;
|
12881 | /**
|
12882 | * Emits a controller event.
|
12883 | * @param pEvent Specifies the event properties.
|
12884 | * @return Returns the return value of the event function which is
|
12885 | * executed (or `true` when the event did not return a value or the event
|
12886 | * is asynchronous).
|
12887 | */
|
12888 | protected emit<Event>(pEvent: IEvent<Event>): boolean;
|
12889 | /**
|
12890 | * Invoked when a controller is initialized.
|
12891 | * @event
|
12892 | */
|
12893 | onRegister(): void;
|
12894 | /**
|
12895 | * Invoked when a controller is destroyed.
|
12896 | * @return Returns `true` if the controller is detached.
|
12897 | * @event
|
12898 | */
|
12899 | onDestroy(): boolean;
|
12900 | /** Enables the controller. */
|
12901 | enable(): void;
|
12902 | /** Disables the controller. */
|
12903 | disable(): void;
|
12904 | /** Cancels the controller. */
|
12905 | cancel(): void;
|
12906 | /** Destroys the controller. */
|
12907 | destroy(): void;
|
12908 | }
|
12909 | export const enum Buttons {
|
12910 | /** No buttons are pressed. */
|
12911 | None = 0,
|
12912 | /** Left mouse button press. */
|
12913 | MouseLeft = 1,
|
12914 | /** Right mouse button press. */
|
12915 | MouseRight = 2,
|
12916 | /** Middle mouse button press. */
|
12917 | MouseMiddle = 4,
|
12918 | /** X1 (back) mouse button press. */
|
12919 | MouseBack = 8,
|
12920 | /** X2 (forward) mouse button press. */
|
12921 | MouseForward = 16,
|
12922 | /** Shift key is pressed. */
|
12923 | KeyboardShift = 32,
|
12924 | /** Ctrl key is pressed. */
|
12925 | KeyboardCtrl = 64,
|
12926 | /** Alt key is pressed. */
|
12927 | KeyboardAlt = 128,
|
12928 | /** Meta/Control key is pressed. */
|
12929 | KeyboardMeta = 256,
|
12930 | /** Pen contact. */
|
12931 | PenContact = 512,
|
12932 | /** Pen contact with barrel button pressed. */
|
12933 | PenContactWithBarrel = 1024,
|
12934 | /** Pen contact with eraser button pressed. */
|
12935 | PenEraser = 2048,
|
12936 | }
|
12937 | /**
|
12938 | * Implements the point class. Each touch or interaction point is stored as a
|
12939 | * point instance which contains the characteristics of the point.
|
12940 | */
|
12941 | export class Point {
|
12942 | /**
|
12943 | * Clones the supplied point.
|
12944 | * @param pPoint Specifies the point to clone.
|
12945 | * @return Returns a clone of the point.
|
12946 | */
|
12947 | static clone(pPoint: Point): Point;
|
12948 | /**
|
12949 | * Iterates through the controllers attached to the supplied point.
|
12950 | * @param pPoint Specifies the point.
|
12951 | * @param nType Specifies the controller type (supply `*` to select all types).
|
12952 | * @param fnController Specifies the function to call for each controller.
|
12953 | * @param fnController.pController Reference to the controller.
|
12954 | * @param fnController.pPoint Reference to the point.
|
12955 | * @param pOptions Specifies options for the iteration.
|
12956 | */
|
12957 | static each<T extends Controller<THooks>>(
|
12958 | pPoint: Point | undefined,
|
12959 | nType: Type | "*",
|
12960 | fnController: (pController: T, pPoint: Point) => boolean | void,
|
12961 | pOptions?: {
|
12962 | |
12963 |
|
12964 |
|
12965 |
|
12966 |
|
12967 |
|
12968 | Bubble?: boolean;
|
12969 |
|
12970 | Verify?: boolean;
|
12971 | }
|
12972 | ): void;
|
12973 | /**
|
12974 | * Iterates through all the controllers which are within the supplied point.
|
12975 | * @param pPoint Specifies the point.
|
12976 | * @param nType Specifies the controller type (supply `*` to select all types).
|
12977 | * @param sMode Specifies if the iteration should bubble up.
|
12978 | * @param fnController Specifies the function to call for each controller.
|
12979 | * @param fnController.pController Reference to the controller.
|
12980 | * @param fnController.pPoint Reference to the point.
|
12981 | */
|
12982 | static controllers<T extends Controller<THooks>>(
|
12983 | pPoint: Point | undefined,
|
12984 | nType: Type | "*",
|
12985 | sMode: "stop" | "bubble",
|
12986 | fnController: (pController: T, pPoint: Point) => boolean | void
|
12987 | ): void;
|
12988 | /**
|
12989 | * Retrieves the identifier of a point.
|
12990 | * @param pPoint Reference to the point.
|
12991 | * @return Returns the identifier or `undefined` if the point is invalid.
|
12992 | */
|
12993 | static id(pPoint: Point | undefined): number | undefined;
|
12994 | /**
|
12995 | * Calculates the mean point for the supplied points.
|
12996 | * @param pPoints Array of points.
|
12997 | * @return Returns the mean.
|
12998 | */
|
12999 | static mean(...pPoints: Point[]): IPoint;
|
13000 | /**
|
13001 | * Calculates the propertional mean point for the supplied points. The
|
13002 | * mean is relatively moved to the point with the largest movement.
|
13003 | * @param pPointA Specifies point A.
|
13004 | * @param pPointB Specifies point B.
|
13005 | * @return Returns the propertional mean.
|
13006 | */
|
13007 | static proportional(pPointA: Point, pPointB: Point): IPoint;
|
13008 | /**
|
13009 | * Calculates the difference between two points.
|
13010 | * @param pPointA Specifies the first point.
|
13011 | * @param pPointB Specifies the second point.
|
13012 | * @return Returns the horizontal and vertical difference.
|
13013 | */
|
13014 | static difference(pPointA: IPoint, pPointB: IPoint): IPoint;
|
13015 | /**
|
13016 | * Determines the controller types and target for the supplied asset.
|
13017 | * @param pAsset Reference to the asset.
|
13018 | * @return Returns an object with the types and target.
|
13019 | */
|
13020 | static typesAndTarget(pAsset: Asset | undefined): {
|
13021 | types: Types;
|
13022 | target: Asset | undefined;
|
13023 | };
|
13024 | /**
|
13025 | * Constructs a new point.
|
13026 | * @param nId Specifies the identifier of the point.
|
13027 | * @param pTarget Specifies the `EventTarget` of the point.
|
13028 | * @param nX Specifies the initial absolute horizontal coordinate.
|
13029 | * @param nY Specifies the initial absolute vertical coordinate.
|
13030 | * @param bTouch Specifies if the point is a touch contact.
|
13031 | * @param bPen Specifies if the point is a pen contact.
|
13032 | * @param nButtons Specifies the mouse and keyboard buttons.
|
13033 | * @param nClicks Specifies the number of clicks.
|
13034 | * @param nWheelX Specifies the horizontal mouse wheel delta.
|
13035 | * @param nWheelY Specifies the vertical mouse wheel delta.
|
13036 | * @param nPressure Specifies the pressure of the pointer contact.
|
13037 | * @param nTiltX Specifies the angle between the Y-Z plane and the plane
|
13038 | * containing the pen axis and the Y axis in the range of -90 to +90.
|
13039 | * @param nTiltY Specifies the angle between the X-Z and transducer-X planes.
|
13040 | * @param bClone Specifies if the point is a clone.
|
13041 | */
|
13042 | constructor(
|
13043 | nId: number,
|
13044 | pTarget: Asset | undefined,
|
13045 | nX: number,
|
13046 | nY: number,
|
13047 | bTouch: boolean,
|
13048 | bPen: boolean,
|
13049 | nButtons: Buttons,
|
13050 | nClicks: number,
|
13051 | nWheelX: number,
|
13052 | nWheelY: number,
|
13053 | nPressure: number,
|
13054 | nTiltX: number,
|
13055 | nTiltY: number,
|
13056 | bClone: boolean
|
13057 | );
|
13058 | /** Contains the identifier of the point. */
|
13059 | get id(): number;
|
13060 | /** Returns if the point is active. */
|
13061 | get isActive(): boolean;
|
13062 | /** Returns the target asset. */
|
13063 | get target(): Asset;
|
13064 | /** Contains the initial position of the point. */
|
13065 | get initialPosition(): IPoint;
|
13066 | /** Contains the current position of the point. */
|
13067 | get currentPosition(): IPoint;
|
13068 | /** Retrieves the movement delta since the last call of this property. */
|
13069 | get delta(): IPoint;
|
13070 | /** Returns if the point is a mouse contact. */
|
13071 | get isMouse(): boolean;
|
13072 | /** Returns if the point is a touch contact. */
|
13073 | get isTouch(): boolean;
|
13074 | /** Returns if the point is a pen contact. */
|
13075 | get isPen(): boolean;
|
13076 | /** Returns if the point is on an input element. */
|
13077 | get isInput(): boolean;
|
13078 | /** Returns if the point is on a label element. */
|
13079 | get isLabel(): boolean;
|
13080 | /** Retrieves the pointer type. */
|
13081 | get type(): "mouse" | "touch" | "pen";
|
13082 | /** Specifies the controller types that can occur for this point. */
|
13083 | get types(): Types;
|
13084 | /** Retrieves the button flags attached to the point. */
|
13085 | get buttons(): Buttons;
|
13086 | get clicks(): number;
|
13087 | /** Retrieves the mouse horizontal wheel delta (x-axis). */
|
13088 | get wheelX(): number;
|
13089 | /** Retrieves the mouse vertical wheel delta (y-axis). */
|
13090 | get wheelY(): number;
|
13091 | /** Retrieves the pressure of the pointer contact in range of 0 to 1. */
|
13092 | get pressure(): number;
|
13093 | /**
|
13094 | * Retrieves the angle between the Y-Z plane and the plane containing the pen
|
13095 | * axis and the Y axis in the range of -90 to +90. A positive X tilt is to
|
13096 | * the right.
|
13097 | */
|
13098 | get tiltX(): number;
|
13099 | /**
|
13100 | * Retrieves the angle between the X-Z and transducer-X planes. A positive Y
|
13101 | * tilt is toward the user.
|
13102 | */
|
13103 | get tiltY(): number;
|
13104 | /** Returns the horizontal difference in pixels between the initial and current position. */
|
13105 | get diffX(): number;
|
13106 | /** Returns the vertical difference in pixels between the initial and current position. */
|
13107 | get diffY(): number;
|
13108 | /** Returns the horizontal mean of the initial and current position. */
|
13109 | get meanX(): number;
|
13110 | /** Returns the vertical mean of the initial and current position. */
|
13111 | get meanY(): number;
|
13112 | /** Returns the radius in pixels between the initial and current position. */
|
13113 | get radius(): number;
|
13114 | /** Returns the angle in degrees between the initial and current position (top=90, right=0, bottom=-90, right=-180/180). */
|
13115 | get angle(): number;
|
13116 | /** Returns the start time of the point. */
|
13117 | get time(): number;
|
13118 | /** Returns the duration in milliseconds between the start and the end of the point. */
|
13119 | get duration(): number;
|
13120 | /** Returns the horizontal velocity. */
|
13121 | get velocityX(): number;
|
13122 | /** Returns the vertical velocity. */
|
13123 | get velocityY(): number;
|
13124 | /** Returns if the point is on an asset with focus. */
|
13125 | get hasVirtualFocus(): boolean;
|
13126 |
|
13127 | /**
|
13128 | * Moves the current position of the point.
|
13129 | * @param nX Specifies the horizontal coordinate.
|
13130 | * @param nY Specifies the vertical coordinate.
|
13131 | * @param bFinal Specifies if the point is final.
|
13132 | * @param nButtons Specifies the mouse and keyboard buttons.
|
13133 | * @param nPressure Specifies the pressure of the pointer contact.
|
13134 | * @return Returns `true` if there was a change.
|
13135 | */
|
13136 | move(nX: number, nY: number, bFinal: boolean, nButtons: Buttons, nPressure: number, nTiltX: number, nTiltY: number): boolean;
|
13137 | /**
|
13138 | * Reinits the initial position.
|
13139 | * @param nDiffMin Sets a minimal diff value.
|
13140 | */
|
13141 | reinit(nDiffMin?: number): void;
|
13142 | /**
|
13143 | * Returns the distance in pixels between the current position and the supplied coordinate.
|
13144 | * @param pPoint Specifies the point or the coordinate to calculate.
|
13145 | * @return Returns the distance in pixels.
|
13146 | */
|
13147 | distance(pPoint?: Point | IPoint): number;
|
13148 | /**
|
13149 | * Returns the alpha angle between the current position and the supplied coordinate.
|
13150 | * @param pPoint Specifies the point or the coordinate to calculate.
|
13151 | * @return Returns the angle in degrees (top=90, right=0, bottom=-90, right=-180/180).
|
13152 | */
|
13153 | alpha(pPoint?: Point | IPoint): number;
|
13154 | /**
|
13155 | * Returns the radial difference between the current position and the supplied coordinate.
|
13156 | * @param pPoint Specifies the point or the coordinate to calculate.
|
13157 | * @return Returns the distance in pixels.
|
13158 | */
|
13159 | radialDistance(pPoint?: Point | IPoint): number;
|
13160 | /**
|
13161 | * Iterates through the controllers.
|
13162 | * @param fnController Specifies the controller callback function. This
|
13163 | * function should return `true` if the iteration should break.
|
13164 | * @param nType Specifies an optional controller type.
|
13165 | * @return Returns `true` if the iteration is breaked.
|
13166 | */
|
13167 | forEachController<T extends Controller<THooks>>(
|
13168 | fnController: (pController: T, pPoint: Point) => boolean | void,
|
13169 | nType?: Type | "*"
|
13170 | ): boolean;
|
13171 | /**
|
13172 | * Returns the position of the point within the attached or specified asset.
|
13173 | * @param pAsset Specifies an optional asset. If omitted, the attached asset will be used.
|
13174 | * @return Returns the position.
|
13175 | */
|
13176 | translatePointToAsset(pPoint: IPoint, pAsset?: Asset): IPoint;
|
13177 | /**
|
13178 | * Returns the position of the point within the attached or specified asset.
|
13179 | * @param pAsset Specifies an optional asset. If omitted, the attached asset will be used.
|
13180 | * @return Returns the position.
|
13181 | */
|
13182 | translateToAsset(pAsset?: Asset): IPoint;
|
13183 | /**
|
13184 | * Retrieves if the current point types implement a certain gesture.
|
13185 | * @param sGesture Specifies the gesture.
|
13186 | * @return Returns `true` if the point types implement the gesture.
|
13187 | */
|
13188 | implements(sGesture: TGesture): boolean;
|
13189 | /**
|
13190 | * Checks if the point is on an asset with focus capture.
|
13191 | * @param pTarget Specifies the target asset.
|
13192 | * @param bDisable Specifies if the point needs to be disabled.
|
13193 | * @return Returns `true` if the point is on an asset with focus capture.
|
13194 | */
|
13195 | focus(pTarget: Asset | undefined, bDisable?: boolean): boolean;
|
13196 | /** Performs cleanup when the instance is destroyed. */
|
13197 | destroy(): void;
|
13198 | }
|
13199 | export interface IPoints {
|
13200 | /** Retrieves the specified point. */
|
13201 | [point: string]: Point;
|
13202 | }
|
13203 | /**
|
13204 | * Type definition for the capturing modes. Possible values:
|
13205 | * - `void`: Disable all controllers on the asset and all parent assets and block all events;
|
13206 | * - `disable`: Disable controllers on the asset but not on the parent assets;
|
13207 | * - `input`: Treat the asset as an input element and allows certain events to pass to avoid breaking normal browser behavior;
|
13208 | * - `exclusive`: Only use touch controllers and disable the default browser behavior;
|
13209 | * - `stop`: Only allow touch controllers on the asset and not on the parent assets.
|
13210 | */
|
13211 | export type TMode = "void" | "disable" | "input" | "exclusive" | "stop";
|
13212 | /** Type definition for the gestures. */
|
13213 | export type TGesture = "tap" | "doubletap" | "drag" | "scroll" | "hold" | "snap";
|
13214 | /**
|
13215 | * Defines the notification type.
|
13216 | * @param TNotification.nEvent Contains the event identifier.
|
13217 | */
|
13218 | export type TNotification = (nEvent: Events) => void | boolean;
|
13219 | class Coordinator {
|
13220 |
|
13221 | static stylesheet: Stylesheet;
|
13222 |
|
13223 |
|
13224 | static get enumerator(): number;
|
13225 |
|
13226 | static get count(): number;
|
13227 |
|
13228 | static get touches(): number;
|
13229 |
|
13230 | static get touched(): number;
|
13231 |
|
13232 | static get captured(): Type;
|
13233 |
|
13234 | static get isListening(): boolean;
|
13235 |
|
13236 | static get isDisabled(): boolean;
|
13237 |
|
13238 | static set isDisabled(bDisabled: boolean);
|
13239 |
|
13240 | static get isDragging(): boolean;
|
13241 |
|
13242 | static get isScrolling(): boolean;
|
13243 |
|
13244 | static get isTouch(): boolean;
|
13245 |
|
13246 | static get wasTouched(): boolean;
|
13247 |
|
13248 | static get isMouse(): boolean;
|
13249 |
|
13250 | static get isPen(): boolean;
|
13251 |
|
13252 | static get isInput(): boolean;
|
13253 |
|
13254 | static get supportsPointerEvents(): boolean;
|
13255 |
|
13256 | static get points(): IPoints;
|
13257 |
|
13258 | static get firstPoint(): Point | undefined;
|
13259 |
|
13260 | static get secondPoint(): Point | undefined;
|
13261 |
|
13262 | static get assetWithVirtualFocus(): Asset | undefined;
|
13263 |
|
13264 | static get assetWithPhysicalFocus(): Asset | undefined;
|
13265 |
|
13266 | static get logging(): boolean;
|
13267 |
|
13268 | static set logging(bLog: boolean);
|
13269 |
|
13270 | |
13271 |
|
13272 |
|
13273 |
|
13274 |
|
13275 |
|
13276 | static inventory(pAsset: Asset, nAdd?: number, nRemove?: number): void;
|
13277 | |
13278 |
|
13279 |
|
13280 |
|
13281 |
|
13282 | static types(pAsset: Asset): Types;
|
13283 | |
13284 |
|
13285 |
|
13286 |
|
13287 |
|
13288 | static implement(sGesture: TGesture, nTypes: Types): void;
|
13289 | |
13290 |
|
13291 |
|
13292 |
|
13293 |
|
13294 | static implements(sGesture: TGesture): Types;
|
13295 | |
13296 |
|
13297 |
|
13298 |
|
13299 |
|
13300 |
|
13301 | static register(pStatic: IController, pController: Controller<THooks>): number;
|
13302 | |
13303 |
|
13304 |
|
13305 |
|
13306 | static unregister(pController: Controller<THooks>): void;
|
13307 | |
13308 |
|
13309 |
|
13310 |
|
13311 |
|
13312 |
|
13313 |
|
13314 | static unregisterAsset(pAsset: Asset | TDOMElement, nType?: Type | "*"): boolean;
|
13315 | |
13316 |
|
13317 |
|
13318 |
|
13319 |
|
13320 |
|
13321 |
|
13322 | static registerNotification(sNotification: string, fnNotification: TNotification): void;
|
13323 | |
13324 |
|
13325 |
|
13326 |
|
13327 | static unregisterNotification(sNotification: string): void;
|
13328 | |
13329 |
|
13330 |
|
13331 |
|
13332 |
|
13333 | static controller<T extends Controller<THooks>>(pController: Controller<THooks> | number): T | undefined;
|
13334 | |
13335 |
|
13336 |
|
13337 |
|
13338 |
|
13339 |
|
13340 | static each<T extends Controller<THooks>>(pAsset: Asset | "*", nType: Type | "*", fnController: (pController: T) => void): void;
|
13341 | /**
|
13342 | * Filters the controllers on the supplied type.
|
13343 | * @param pAsset Specifies the asset (supply `*` to query all assets).
|
13344 | * @param nType Specifies the controller type (supply `*` to select all types).
|
13345 | * @return Returns an array with controllers.
|
13346 | */
|
13347 | static filter<T extends Controller<THooks>>(pAsset: Asset | "*", nType: Type | "*"): T[];
|
13348 | /**
|
13349 | * Returns all the controllers for the specified target and the underlying
|
13350 | * assets. If no type is specified all the controllers are returned.
|
13351 | * @param pTargets Specifies the target asset(s). This can be a single
|
13352 | * target or an array with targets.
|
13353 | * @param nType Specifies the controller type (supply `*` to select all types).
|
13354 | * @param bBubble Specifies if the function should return controllers on all
|
13355 | * underlying assets which have a controller (with the specified type)
|
13356 | * instead of returning only controllers on the first asset that has a
|
13357 | * controller (with the specified type).
|
13358 | * @return Returns an array with controllers.
|
13359 | */
|
13360 | static filterRecursive<T extends Controller<THooks>>(pTargets: Asset | Asset[], nType?: Type | "*", bBubble?: boolean): T[];
|
13361 | /**
|
13362 | * Retrieves the first constroller for the specified asset of the specified type.
|
13363 | * @param pAsset Specifies the asset (supply `*` to query all assets).
|
13364 | * @param nType Specifies the controller type (supply `*` to select all types).
|
13365 | * @return Returns the controller or `undefined` if no controller is found.
|
13366 | */
|
13367 | static first<T extends Controller<THooks>>(pAsset: Asset | "*", nType: Type | "*"): T | undefined;
|
13368 | /**
|
13369 | * Returns the point with the specified identifiers. The first
|
13370 | * point which matches one of the supplied identifiers is returned.
|
13371 | * @param pIds List of identifiers for the point.
|
13372 | * @return Returns the point or `undefined` if no point is found.
|
13373 | */
|
13374 | static point(...pIds: (number | undefined)[]): Point | undefined;
|
13375 | /**
|
13376 | * Returns the point at the specified index.
|
13377 | * @param nIndex Index of the point.
|
13378 | * @return Returns the point or `undefined` if no listening point is found.
|
13379 | */
|
13380 | static pointFromIndex(nIndex: number): Point | undefined;
|
13381 | /**
|
13382 | * Schedules a task.
|
13383 | * @param fnCallee Specifies the function to schedule.
|
13384 | * @param fnCallee.pArguments Optional additional arguments.
|
13385 | * @param nTimeout Specifies the scheduler timeout in milliseconds.
|
13386 | * @param pArguments Optional additional arguments which will be passed to the callee.
|
13387 | */
|
13388 | static schedule(fnCallee: (...pArguments: TArguments) => void, nTimeout?: number, ...pArguments: TArguments): void;
|
13389 | /** Invokes the current scheduled task immediately. */
|
13390 | static scheduleInvoke(): void;
|
13391 | /** Pauses the current scheduled task. */
|
13392 | static schedulePause(): void;
|
13393 | /**
|
13394 | * Continues the current scheduled task.
|
13395 | * @param nTimeout Specifies a timeout for the scheduled task.
|
13396 | */
|
13397 | static scheduleContinue(nTimeout?: number): void;
|
13398 | /** Cancels the current scheduled task. */
|
13399 | static scheduleCancel(): void;
|
13400 | /**
|
13401 | * Terminates the specified controller types.
|
13402 | * @param nType Specifies the controller type to terminate.
|
13403 | */
|
13404 | static terminate(nType: Type | "*"): void;
|
13405 | /**
|
13406 | * Claims a controller and terminates other controller types.
|
13407 | * @param nType Specifies the controller type to claim.
|
13408 | */
|
13409 | static claim(nType: Type): void;
|
13410 | /**
|
13411 | * Capture the specified controller type (other controllers will be ignored
|
13412 | * as long as the capture remains).
|
13413 | * @param nType Specifies the controller type to capture.
|
13414 | */
|
13415 | static capture(nType: Type): void;
|
13416 | /** Releases the capture. */
|
13417 | static release(): void;
|
13418 | /**
|
13419 | * Specifies the capturing mode for the asset.
|
13420 | * @param pAsset Specifies the asset.
|
13421 | * @param sMode Specifies one of the following modes:
|
13422 | * - `void`: Disable all controllers on the asset and all parent assets and block all events;
|
13423 | * - `disable`: Disable controllers on the asset but not on the parent assets;
|
13424 | * - `input`: Treat the asset as an input element and allows certain events to pass to avoid breaking normal browser behavior;
|
13425 | * - `exclusive`: Only use touch controllers and disable the default browser behavior;
|
13426 | * - `stop`: Only allow touch controllers on the asset and not on the parent assets.
|
13427 | */
|
13428 | static mode(pAsset: Asset, sMode: TMode): void;
|
13429 | /** Retrieves if the specified tag name is an input element. */
|
13430 | static isInputElement(sTagName: string): boolean;
|
13431 | /**
|
13432 | * Sets an auto-blur focus to an asset.
|
13433 | * @param pVirtual Specifies the asset which gains virtual focus.
|
13434 | * @param pPhysical Specifies the asset which gains physical focus.
|
13435 | * @param fnBlur Specifies an optional blur callback.
|
13436 | */
|
13437 | static focus(pVirtual: Asset, pPhysical?: Asset, fnBlur?: () => void): void;
|
13438 | /**
|
13439 | * Blurs the active focus.
|
13440 | * @param pVirtual Specifies the virtual asset that is blurred. If omitted
|
13441 | * the asset which currently has virtual focus is blurred.
|
13442 | */
|
13443 | static blur(pVirtual?: Asset): void;
|
13444 | /**
|
13445 | * Attaches an auto-blur focus and blur event handler.
|
13446 | * @param pVirtual Specifies the virtual asset.
|
13447 | * @param pPhysical Specifies the physical asset.
|
13448 | * @param fnFocus Specifies an optional focus callback.
|
13449 | * @param fnBlur Specifies an optional blur callback.
|
13450 | */
|
13451 | static onFocusOrBlur(pVirtual: Asset, pPhysical: Asset, fnFocus?: () => void, fnBlur?: () => void): void;
|
13452 | /** Enables the controller host. */
|
13453 | static enable(): void;
|
13454 | /** Disables the controller host. */
|
13455 | static disable(): void;
|
13456 | /** Detaches and destroys all controllers. */
|
13457 | static destroy(): void;
|
13458 | }
|
13459 | export const enum Directions {
|
13460 | Bidirectional = 1,
|
13461 | Horizontal = 2,
|
13462 | Vertical = 4,
|
13463 | }
|
13464 |
|
13465 | export { Coordinator as Touch };
|
13466 | }
|
13467 |
|
13468 | declare module "tripetto/module/touch-focus" {
|
13469 | import { Asset } from "tripetto/module/dom";
|
13470 | import { Controller, Events, Priorities, Types } from "tripetto/module/touch";
|
13471 |
|
13472 | export interface IFocusEvent {
|
13473 | /** Reference to the focus controller. */
|
13474 | readonly focus: Focus;
|
13475 | /** Reference to the asset being touched. */
|
13476 | readonly asset: Asset;
|
13477 | /** Contains if the asset has focus. */
|
13478 | readonly hasFocus: boolean;
|
13479 | }
|
13480 | /** Type alias for the `OnFocus` function. */
|
13481 | export type TFocus = (pFocusEvent: IFocusEvent) => void;
|
13482 | export class Focus extends Controller<"OnFocus"> {
|
13483 | |
13484 |
|
13485 |
|
13486 |
|
13487 | on: TFocus | undefined;
|
13488 |
|
13489 | static get id(): string;
|
13490 |
|
13491 | static get types(): Types;
|
13492 |
|
13493 | static get priority(): Priorities;
|
13494 |
|
13495 | |
13496 |
|
13497 |
|
13498 |
|
13499 |
|
13500 |
|
13501 | static processor(nEvent: Events): void;
|
13502 | |
13503 |
|
13504 |
|
13505 |
|
13506 |
|
13507 |
|
13508 |
|
13509 |
|
13510 |
|
13511 |
|
13512 |
|
13513 |
|
13514 |
|
13515 |
|
13516 | static on(
|
13517 | pVirtual: Asset,
|
13518 | pPhysical: Asset,
|
13519 | sFocus: "no-auto-focus" | "focus-on-stroke" | "focus-on-tap",
|
13520 | sBlur: "no-auto-blur" | "auto-blur",
|
13521 | fnFocus?: TFocus,
|
13522 | nTab?: number,
|
13523 | fnCondition?: (pFocus: Focus) => boolean
|
13524 | ): Focus;
|
13525 | |
13526 |
|
13527 |
|
13528 |
|
13529 |
|
13530 |
|
13531 |
|
13532 |
|
13533 |
|
13534 |
|
13535 |
|
13536 |
|
13537 |
|
13538 | protected constructor(
|
13539 | pVirtual: Asset,
|
13540 | pPhysical: Asset,
|
13541 | sFocus: "no-auto-focus" | "focus-on-stroke" | "focus-on-tap",
|
13542 | sBlur: "no-auto-blur" | "auto-blur",
|
13543 | nTab: number,
|
13544 | fnFocus?: TFocus,
|
13545 | fnCondition?: (pFocus: Focus) => boolean
|
13546 | );
|
13547 | /** Retrieves if the asset has focus. */
|
13548 | get hasFocus(): boolean;
|
13549 | /**
|
13550 | * Invokes the `OnFocus` event.
|
13551 | * @param pEvent Reference to the event.
|
13552 | * @return Returns `true` if the event is invoked.
|
13553 | * @event
|
13554 | */
|
13555 | protected onFocus(pEvent: IFocusEvent): void;
|
13556 | /** Sets the focus. */
|
13557 | focus(): boolean;
|
13558 | /** Blurs the focus. */
|
13559 | blur(): boolean;
|
13560 | /** Updates the focus controller. */
|
13561 | update(): void;
|
13562 | /**
|
13563 | * Invoked when the focus controller is destroyed.
|
13564 | * @return Returns `true` if the controller is detached.
|
13565 | * @event
|
13566 | */
|
13567 | onDestroy(): boolean;
|
13568 | }
|
13569 | }
|
13570 |
|
13571 | declare module "tripetto/module/touch-hover" {
|
13572 | import { Asset } from "tripetto/module/dom";
|
13573 | import { Controller, Events, Types } from "tripetto/module/touch";
|
13574 |
|
13575 | export type THoverEvents = "OnHover" | "OnHoverStart" | "OnHoverEnd";
|
13576 | export interface IHoverEvents {
|
13577 |
|
13578 | readonly asset: Asset;
|
13579 |
|
13580 | readonly hover: Hover;
|
13581 |
|
13582 | readonly isHovered: boolean;
|
13583 |
|
13584 | readonly isMouse: boolean;
|
13585 |
|
13586 | readonly isTouch: boolean;
|
13587 |
|
13588 | readonly isPen: boolean;
|
13589 | }
|
13590 | export interface IHoverEvent extends IHoverEvents {}
|
13591 | export interface IHoverStartEvent extends IHoverEvents {}
|
13592 | export interface IHoverEndEvent extends IHoverEvents {}
|
13593 | export const enum HoverType {
|
13594 |
|
13595 | Mouse = 1,
|
13596 |
|
13597 | Touch = 2,
|
13598 |
|
13599 | Pen = 4,
|
13600 | }
|
13601 |
|
13602 | export type THover<T> = (pHoverEvent: T) => void;
|
13603 | export class Hover extends Controller<THoverEvents> {
|
13604 | |
13605 |
|
13606 |
|
13607 |
|
13608 | on: THover<IHoverEvent> | undefined;
|
13609 | |
13610 |
|
13611 |
|
13612 |
|
13613 | onStart: THover<IHoverStartEvent> | undefined;
|
13614 | |
13615 |
|
13616 |
|
13617 |
|
13618 | onEnd: THover<IHoverEndEvent> | undefined;
|
13619 |
|
13620 | static get id(): string;
|
13621 |
|
13622 | static get types(): Types;
|
13623 |
|
13624 | |
13625 |
|
13626 |
|
13627 |
|
13628 |
|
13629 |
|
13630 | static processor(nEvent: Events): void;
|
13631 | |
13632 |
|
13633 |
|
13634 |
|
13635 |
|
13636 | static terminate(): void;
|
13637 |
|
13638 | static disable(): void;
|
13639 |
|
13640 | static enable(): void;
|
13641 |
|
13642 | static stop(): void;
|
13643 | |
13644 |
|
13645 |
|
13646 |
|
13647 |
|
13648 |
|
13649 |
|
13650 |
|
13651 |
|
13652 | static on(
|
13653 | pAsset: Asset,
|
13654 | fnHover?: THover<IHoverEvent>,
|
13655 | fnHoverStart?: THover<IHoverStartEvent>,
|
13656 | fnHoverEnd?: THover<IHoverEndEvent>,
|
13657 | nType?: HoverType
|
13658 | ): Hover;
|
13659 | |
13660 |
|
13661 |
|
13662 |
|
13663 |
|
13664 |
|
13665 |
|
13666 |
|
13667 | static mouse(
|
13668 | pAsset: Asset,
|
13669 | fnHover?: THover<IHoverEvent>,
|
13670 | fnHoverStart?: THover<IHoverStartEvent>,
|
13671 | fnHoverEnd?: THover<IHoverEndEvent>
|
13672 | ): Hover;
|
13673 | |
13674 |
|
13675 |
|
13676 |
|
13677 |
|
13678 |
|
13679 |
|
13680 |
|
13681 | static touch(
|
13682 | pAsset: Asset,
|
13683 | fnHover?: THover<IHoverEvent>,
|
13684 | fnHoverStart?: THover<IHoverStartEvent>,
|
13685 | fnHoverEnd?: THover<IHoverEndEvent>
|
13686 | ): Hover;
|
13687 | |
13688 |
|
13689 |
|
13690 |
|
13691 |
|
13692 |
|
13693 |
|
13694 |
|
13695 | static pen(
|
13696 | pAsset: Asset,
|
13697 | fnHover?: THover<IHoverEvent>,
|
13698 | fnHoverStart?: THover<IHoverStartEvent>,
|
13699 | fnHoverEnd?: THover<IHoverEndEvent>
|
13700 | ): Hover;
|
13701 | |
13702 |
|
13703 |
|
13704 |
|
13705 |
|
13706 |
|
13707 |
|
13708 |
|
13709 |
|
13710 | static pointer(
|
13711 | pAsset: Asset,
|
13712 | fnHover?: THover<IHoverEvent>,
|
13713 | fnHoverStart?: THover<IHoverStartEvent>,
|
13714 | fnHoverEnd?: THover<IHoverEndEvent>
|
13715 | ): Hover;
|
13716 | |
13717 |
|
13718 |
|
13719 |
|
13720 |
|
13721 |
|
13722 |
|
13723 |
|
13724 | protected constructor(
|
13725 | pAsset: Asset,
|
13726 | fnHover?: THover<IHoverEvent>,
|
13727 | fnHoverStart?: THover<IHoverStartEvent>,
|
13728 | fnHoverEnd?: THover<IHoverEndEvent>,
|
13729 | nType?: HoverType
|
13730 | );
|
13731 | /** Contains if the hover is active. */
|
13732 | get isHovered(): boolean;
|
13733 |
|
13734 | /**
|
13735 | * Invokes the `OnHover` event which indicates when a hover starts or ends.
|
13736 | * @param pEvent Reference to the event.
|
13737 | * @event
|
13738 | */
|
13739 | protected onHover(pEvent: IHoverEvent): void;
|
13740 | /**
|
13741 | * Invokes the `OnHoverStart` event which indicates when a hover starts.
|
13742 | * @param pEvent Reference to the event.
|
13743 | * @event
|
13744 | */
|
13745 | protected onHoverStart(pEvent: IHoverStartEvent): void;
|
13746 | /**
|
13747 | * Invokes the `OnHoverEnd` event which indicates when a hover ends.
|
13748 | * @param pEvent Reference to the event.
|
13749 | * @event
|
13750 | */
|
13751 | protected onHoverEnd(pEvent: IHoverEndEvent): void;
|
13752 | /**
|
13753 | * Invoked when the hover controller is destroyed.
|
13754 | * @return Returns `true` if the controller is detached.
|
13755 | * @event
|
13756 | */
|
13757 | onDestroy(): boolean;
|
13758 | /**
|
13759 | * Specifies that the hover should always work (even when the hovers are
|
13760 | * globally disabled).
|
13761 | * @return Returns a reference to the listener.
|
13762 | */
|
13763 | alwaysOn(): this;
|
13764 | }
|
13765 | }
|
13766 |
|
13767 | declare module "tripetto/module/touch-keyboard" {
|
13768 | import { Asset } from "tripetto/module/dom";
|
13769 | import { Buttons, Controller, Types } from "tripetto/module/touch";
|
13770 | import { Focus } from "tripetto/module/touch-focus";
|
13771 |
|
13772 | |
13773 |
|
13774 |
|
13775 |
|
13776 | export type TKey =
|
13777 |
|
13778 | | ""
|
13779 |
|
13780 | | "Alt"
|
13781 | | "AltGraph"
|
13782 | | "CapsLock"
|
13783 | | "Control"
|
13784 | | "Fn"
|
13785 | | "FnLock"
|
13786 | | "Hyper"
|
13787 | | "Meta"
|
13788 | | "NumLock"
|
13789 | | "ScrollLock"
|
13790 | | "Shift"
|
13791 | | "Super"
|
13792 | | "Symbol"
|
13793 | | "SymbolLock"
|
13794 |
|
13795 | | "Enter"
|
13796 | | "Tab"
|
13797 | | " "
|
13798 |
|
13799 | | "ArrowDown"
|
13800 | | "ArrowLeft"
|
13801 | | "ArrowRight"
|
13802 | | "ArrowUp"
|
13803 | | "End"
|
13804 | | "Home"
|
13805 | | "PageDown"
|
13806 | | "PageUp"
|
13807 |
|
13808 | | "Backspace"
|
13809 | | "Clear"
|
13810 | | "Copy"
|
13811 | | "CrSel"
|
13812 | | "Cut"
|
13813 | | "Delete"
|
13814 | | "EraseEof"
|
13815 | | "ExSel"
|
13816 | | "Insert"
|
13817 | | "Paste"
|
13818 | | "Redo"
|
13819 | | "Undo"
|
13820 |
|
13821 | | "Accept"
|
13822 | | "Again"
|
13823 | | "Attn"
|
13824 | | "Cancel"
|
13825 | | "ContextMenu"
|
13826 | | "Escape"
|
13827 | | "Execute"
|
13828 | | "Find"
|
13829 | | "Finish"
|
13830 | | "Help"
|
13831 | | "Pause"
|
13832 | | "Play"
|
13833 | | "Props"
|
13834 | | "Select"
|
13835 | | "ZoomIn"
|
13836 | | "ZoomOut"
|
13837 |
|
13838 | | "BrightnessDown"
|
13839 | | "BrightnessUp"
|
13840 | | "Eject"
|
13841 | | "LogOff"
|
13842 | | "Power"
|
13843 | | "PowerOff"
|
13844 | | "PrintScreen"
|
13845 | | "Hibernate"
|
13846 | | "Standby"
|
13847 | | "WakeUp"
|
13848 |
|
13849 | | "AllCandidates"
|
13850 | | "Alphanumeric"
|
13851 | | "CodeInput"
|
13852 | | "Compose"
|
13853 | | "Convert"
|
13854 | | "Dead"
|
13855 | | "FinalMode"
|
13856 | | "GroupFirst"
|
13857 | | "GroupLast"
|
13858 | | "GroupNext"
|
13859 | | "GroupPrevious"
|
13860 | | "ModeChange"
|
13861 | | "NextCandidate"
|
13862 | | "NonConvert"
|
13863 | | "PreviousCandidate"
|
13864 | | "Process"
|
13865 | | "SingleCandidate"
|
13866 |
|
13867 | | "F1"
|
13868 | | "F2"
|
13869 | | "F3"
|
13870 | | "F4"
|
13871 | | "F5"
|
13872 | | "F6"
|
13873 | | "F7"
|
13874 | | "F8"
|
13875 | | "F9"
|
13876 | | "F10"
|
13877 | | "F11"
|
13878 | | "F12"
|
13879 | | "F13"
|
13880 | | "F14"
|
13881 | | "F15"
|
13882 | | "F16"
|
13883 | | "F17"
|
13884 | | "F18"
|
13885 | | "F19"
|
13886 | | "F20"
|
13887 | | "Soft1"
|
13888 | | "Soft2"
|
13889 | | "Soft3"
|
13890 | | "Soft4"
|
13891 |
|
13892 | | "AppSwitch"
|
13893 | | "Call"
|
13894 | | "Camera"
|
13895 | | "CameraFocus"
|
13896 | | "EndCall"
|
13897 | | "GoBack"
|
13898 | | "GoHome"
|
13899 | | "HeadsetHook"
|
13900 | | "LastNumberRedial"
|
13901 | | "Notification"
|
13902 | | "MannerMode"
|
13903 | | "VoiceDial"
|
13904 |
|
13905 | | "ChannelDown"
|
13906 | | "ChannelUp"
|
13907 | | "MediaFastForward"
|
13908 | | "MediaPause"
|
13909 | | "MediaPlay"
|
13910 | | "MediaPlayPause"
|
13911 | | "MediaRecord"
|
13912 | | "MediaRewind"
|
13913 | | "MediaStop"
|
13914 | | "MediaTrackNext"
|
13915 | | "MediaTrackPrevious"
|
13916 |
|
13917 | | "AudioBalanceLeft"
|
13918 | | "AudioBalanceRight"
|
13919 | | "AudioBassDown"
|
13920 | | "AudioBassBoostDown"
|
13921 | | "AudioBassBoostToggle"
|
13922 | | "AudioBassBoostUp"
|
13923 | | "AudioBassUp"
|
13924 | | "AudioFaderFront"
|
13925 | | "AudioFaderRear"
|
13926 | | "AudioSurroundModeNext"
|
13927 | | "AudioTrebleDown"
|
13928 | | "AudioTrebleUp"
|
13929 | | "AudioVolumeDown"
|
13930 | | "AudioVolumeMute"
|
13931 | | "AudioVolumeUp"
|
13932 | | "MicrophoneToggle"
|
13933 | | "MicrophoneVolumeDown"
|
13934 | | "MicrophoneVolumeMute"
|
13935 | | "MicrophoneVolumeUp"
|
13936 |
|
13937 | | "TV"
|
13938 | | "TV3DMode"
|
13939 | | "TVAntennaCable"
|
13940 | | "TVAudioDescription"
|
13941 | | "TVAudioDescriptionMixDown"
|
13942 | | "TVAudioDescriptionMixUp"
|
13943 | | "TVContentsMenu"
|
13944 | | "TVDataService"
|
13945 | | "TVInput"
|
13946 | | "TVInputComponent1"
|
13947 | | "TVInputComponent1"
|
13948 | | "TVInputComposite1"
|
13949 | | "TVInputComposite2"
|
13950 | | "TVInputHDMI1"
|
13951 | | "TVInputHDMI4"
|
13952 | | "TVInputHDMI4"
|
13953 | | "TVInputHDMI4"
|
13954 | | "TVInputVGA1"
|
13955 | | "TVMediaContext"
|
13956 | | "TVNetwork"
|
13957 | | "TVNumberEntry"
|
13958 | | "TVPower"
|
13959 | | "TVRadioService"
|
13960 | | "TVSatellite"
|
13961 | | "TVSatelliteBS"
|
13962 | | "TVSatelliteCS"
|
13963 | | "TVSatelliteToggle"
|
13964 | | "TVTerrestrialAnalog"
|
13965 | | "TVTerrestrialDigital"
|
13966 | | "TVTimer"
|
13967 |
|
13968 | | "AVRInput"
|
13969 | | "AVRPower"
|
13970 | | "ColorF0Red"
|
13971 | | "ColorF1Green"
|
13972 | | "ColorF2Yellow"
|
13973 | | "ColorF3Blue"
|
13974 | | "ColorF4Grey"
|
13975 | | "ColorF5Brown"
|
13976 | | "ClosedCaptionToggle"
|
13977 | | "Dimmer"
|
13978 | | "DisplaySwap"
|
13979 | | "DVR"
|
13980 | | "Exit"
|
13981 | | "FavoriteClear0"
|
13982 | | "FavoriteClear1"
|
13983 | | "FavoriteClear2"
|
13984 | | "FavoriteClear3"
|
13985 | | "FavoriteRecall0"
|
13986 | | "FavoriteRecall1"
|
13987 | | "FavoriteRecall2"
|
13988 | | "FavoriteRecall3"
|
13989 | | "FavoriteStore0"
|
13990 | | "FavoriteStore1"
|
13991 | | "FavoriteStore2"
|
13992 | | "FavoriteStore3"
|
13993 | | "Guide"
|
13994 | | "GuideNextDay"
|
13995 | | "GuidePreviousDay"
|
13996 | | "Info"
|
13997 | | "InstantReplay"
|
13998 | | "Link"
|
13999 | | "ListProgram"
|
14000 | | "LiveContent"
|
14001 | | "Lock"
|
14002 | | "MediaApps"
|
14003 | | "MediaAudioTrack"
|
14004 | | "MediaLast"
|
14005 | | "MediaSkipBackward"
|
14006 | | "MediaSkipForward"
|
14007 | | "MediaStepBackward"
|
14008 | | "MediaStepForward"
|
14009 | | "MediaTopMenu"
|
14010 | | "NavigateIn"
|
14011 | | "NavigateNext"
|
14012 | | "NavigateOut"
|
14013 | | "NavigatePrevious"
|
14014 | | "NextFavoriteChannel"
|
14015 | | "NextUserProfile"
|
14016 | | "OnDemand"
|
14017 | | "Pairing"
|
14018 | | "PinPDown"
|
14019 | | "PinPMove"
|
14020 | | "PinPToggle"
|
14021 | | "PinPUp"
|
14022 | | "PlaySpeedDown"
|
14023 | | "PlaySpeedReset"
|
14024 | | "PlaySpeedUp"
|
14025 | | "RandomToggle"
|
14026 | | "RcLowBattery"
|
14027 | | "RecordSpeedNext"
|
14028 | | "RfBypass"
|
14029 | | "ScanChannelsToggle"
|
14030 | | "ScreenModeNext"
|
14031 | | "Settings"
|
14032 | | "SplitScreenToggle"
|
14033 | | "STBInput"
|
14034 | | "groupnext"
|
14035 | | "Subtitle"
|
14036 | | "Teletext"
|
14037 | | "VideoModeNext"
|
14038 | | "Wink"
|
14039 | | "ZoomToggle"
|
14040 |
|
14041 | | "SpeechCorrectionList"
|
14042 | | "SpeechInputToggle"
|
14043 |
|
14044 | | "Close"
|
14045 | | "New"
|
14046 | | "Open"
|
14047 | | "Print"
|
14048 | | "Save"
|
14049 | | "SpellCheck"
|
14050 | | "MailForward"
|
14051 | | "MailReply"
|
14052 | | "MailSend"
|
14053 |
|
14054 | | "LaunchCalculator"
|
14055 | | "LaunchCalendar"
|
14056 | | "LaunchContacts"
|
14057 | | "LaunchMail"
|
14058 | | "LaunchMediaPlayer"
|
14059 | | "LaunchMusicPlayer"
|
14060 | | "LaunchMyComputer"
|
14061 | | "LaunchPhone"
|
14062 | | "LaunchScreenSaver"
|
14063 | | "LaunchSpreadsheet"
|
14064 | | "LaunchWebBrowser"
|
14065 | | "LaunchWebCam"
|
14066 | | "LaunchWordProcessor"
|
14067 | | "LaunchApplication1"
|
14068 | | "LaunchApplication2"
|
14069 | | "LaunchApplication3"
|
14070 | | "LaunchApplication4"
|
14071 | | "LaunchApplication5"
|
14072 | | "LaunchApplication6"
|
14073 | | "LaunchApplication7"
|
14074 | | "LaunchApplication8"
|
14075 | | "LaunchApplication9"
|
14076 | | "LaunchApplication10"
|
14077 | | "LaunchApplication11"
|
14078 | | "LaunchApplication12"
|
14079 | | "LaunchApplication13"
|
14080 | | "LaunchApplication14"
|
14081 | | "LaunchApplication15"
|
14082 | | "LaunchApplication16"
|
14083 |
|
14084 | | "BrowserBack"
|
14085 | | "BrowserFavorites"
|
14086 | | "BrowserForward"
|
14087 | | "BrowserHome"
|
14088 | | "BrowserRefresh"
|
14089 | | "BrowserSearch"
|
14090 | | "BrowserStop"
|
14091 |
|
14092 | | "+"
|
14093 | | "-"
|
14094 | | "/"
|
14095 | | "*";
|
14096 | export interface IKeyboardEvent {
|
14097 |
|
14098 | readonly keyboard: Keyboard;
|
14099 |
|
14100 | readonly asset: Asset;
|
14101 |
|
14102 | readonly key: TKey;
|
14103 |
|
14104 | readonly value: string;
|
14105 |
|
14106 | readonly modifiers: Buttons;
|
14107 |
|
14108 | readonly hasModifiers: boolean;
|
14109 |
|
14110 | readonly isKeyDown: boolean;
|
14111 |
|
14112 | readonly isKeyUp: boolean;
|
14113 |
|
14114 | readonly isAlt: boolean;
|
14115 |
|
14116 | readonly isCtrl: boolean;
|
14117 |
|
14118 | readonly isShift: boolean;
|
14119 |
|
14120 | readonly isMeta: boolean;
|
14121 |
|
14122 | readonly isRepeat: boolean;
|
14123 |
|
14124 | readonly isInput: boolean;
|
14125 |
|
14126 | readonly isGlobal: boolean;
|
14127 | }
|
14128 |
|
14129 | export type TKeyboard = (pKeyboardEvent: IKeyboardEvent) => boolean | void;
|
14130 |
|
14131 | export type TEvents = "keyup" | "keydown" | "any";
|
14132 | export class Keyboard extends Controller<"OnKey"> {
|
14133 | |
14134 |
|
14135 |
|
14136 |
|
14137 | on: TKeyboard | undefined;
|
14138 |
|
14139 |
|
14140 | static get id(): string;
|
14141 |
|
14142 | static get types(): Types;
|
14143 |
|
14144 | static get isKeyDown(): boolean;
|
14145 |
|
14146 | |
14147 |
|
14148 |
|
14149 |
|
14150 |
|
14151 |
|
14152 |
|
14153 | static global(pAsset: Asset, fnKey: TKeyboard, sEvents?: TEvents): Keyboard;
|
14154 | |
14155 |
|
14156 |
|
14157 |
|
14158 |
|
14159 |
|
14160 |
|
14161 | static local(pAsset: Asset, fnKey: TKeyboard, sEvents?: TEvents): Keyboard;
|
14162 | |
14163 |
|
14164 |
|
14165 |
|
14166 |
|
14167 |
|
14168 |
|
14169 | protected constructor(sType: "global" | "local", sEvents: TEvents, pAsset: Asset, fnKey: TKeyboard);
|
14170 | /** Retrieves if a key is down. */
|
14171 | get isKeyDown(): boolean;
|
14172 |
|
14173 | /**
|
14174 | * Invokes the `OnKey` event which indicates when a key is pressed.
|
14175 | * @param pEvent Reference to the event.
|
14176 | * @return Returns if subsequent events needs to be invoked. When the
|
14177 | * function returns `true` the event does not bubble up and stops.
|
14178 | * @event
|
14179 | */
|
14180 | protected onKey(pEvent: IKeyboardEvent): boolean;
|
14181 | /**
|
14182 | * Sets the focus to the attached asset.
|
14183 | * @return Returns a reference to the focus controller.
|
14184 | */
|
14185 | focus(): Focus;
|
14186 | /**
|
14187 | * Invoked when the keyboard controller is destroyed.
|
14188 | * @return Returns `true` if the controller is detached.
|
14189 | * @event
|
14190 | */
|
14191 | onDestroy(): boolean;
|
14192 | }
|
14193 | }
|
14194 |
|
14195 | declare module "tripetto/module/touch-scroll" {
|
14196 | import { Asset, Stylesheet } from "tripetto/module/dom";
|
14197 | import { IHookPayload, THooks } from "tripetto/module/hookup";
|
14198 | import { Dimensions, IPoint, Rectangle, Spacing } from "tripetto/module/metrics";
|
14199 | import { Controller, Directions, Events, Priorities, Types } from "tripetto/module/touch";
|
14200 | import { Focus } from "tripetto/module/touch-focus";
|
14201 |
|
14202 |
|
14203 | export interface IScrollProperties {
|
14204 | |
14205 |
|
14206 |
|
14207 |
|
14208 | stylesheet?: Stylesheet;
|
14209 |
|
14210 | asset?: Asset;
|
14211 |
|
14212 | direction?: "horizontal" | "vertical" | "bidirectional" | Directions;
|
14213 | |
14214 |
|
14215 |
|
14216 |
|
14217 | autoInitialize?: boolean;
|
14218 | |
14219 |
|
14220 |
|
14221 |
|
14222 | hideWhileNotInitialized?: boolean;
|
14223 |
|
14224 | inertialScrolling?: boolean;
|
14225 | |
14226 |
|
14227 |
|
14228 |
|
14229 |
|
14230 |
|
14231 | bounceHorizontal?: "no" | "yes" | "always";
|
14232 | |
14233 |
|
14234 |
|
14235 |
|
14236 |
|
14237 |
|
14238 | bounceVertical?: "no" | "yes" | "always";
|
14239 | |
14240 |
|
14241 |
|
14242 |
|
14243 | pannable?: boolean;
|
14244 | |
14245 |
|
14246 |
|
14247 |
|
14248 |
|
14249 | lockDirection?: boolean;
|
14250 |
|
14251 | wheel?: boolean;
|
14252 | |
14253 |
|
14254 |
|
14255 |
|
14256 | hovering?: boolean;
|
14257 | |
14258 |
|
14259 |
|
14260 |
|
14261 |
|
14262 |
|
14263 | native?: boolean;
|
14264 | |
14265 |
|
14266 |
|
14267 |
|
14268 | focus?: boolean;
|
14269 | |
14270 |
|
14271 |
|
14272 |
|
14273 |
|
14274 | keyboard?: boolean;
|
14275 | |
14276 |
|
14277 |
|
14278 |
|
14279 | spacing?: Spacing;
|
14280 | |
14281 |
|
14282 |
|
14283 |
|
14284 | centering?: boolean;
|
14285 |
|
14286 | classScroll?: string;
|
14287 |
|
14288 | classScrollHorizontal?: string;
|
14289 |
|
14290 | classScrollVertical?: string;
|
14291 |
|
14292 | classScrollLeft?: string;
|
14293 |
|
14294 | classScrollRight?: string;
|
14295 |
|
14296 | classScrollUp?: string;
|
14297 |
|
14298 | classScrollDown?: string;
|
14299 | |
14300 |
|
14301 |
|
14302 |
|
14303 |
|
14304 | zoom?: number;
|
14305 | |
14306 |
|
14307 |
|
14308 |
|
14309 |
|
14310 |
|
14311 | zoomDimensions?: boolean;
|
14312 |
|
14313 | zoomAnimations?: boolean;
|
14314 |
|
14315 | zoomInitialize?: boolean;
|
14316 |
|
14317 | zoomToFit?: boolean | "all" | "horizontal" | "vertical";
|
14318 |
|
14319 | zoomOnPinch?: boolean;
|
14320 |
|
14321 | zoomOnWheel?: boolean;
|
14322 |
|
14323 | zoomOnDoubleTap?: boolean;
|
14324 | |
14325 |
|
14326 |
|
14327 |
|
14328 | onZoomBounderies?: TZoomBounderies;
|
14329 | |
14330 |
|
14331 |
|
14332 |
|
14333 | onZoomStart?: TZoom;
|
14334 | |
14335 |
|
14336 |
|
14337 |
|
14338 | onZoom?: TZoom;
|
14339 | |
14340 |
|
14341 |
|
14342 |
|
14343 | onZoomChange?: TZoom;
|
14344 | |
14345 |
|
14346 |
|
14347 |
|
14348 | onZoomEnd?: TZoom;
|
14349 | |
14350 |
|
14351 |
|
14352 |
|
14353 | onZoomWheel?: TZoomWheel;
|
14354 | |
14355 |
|
14356 |
|
14357 |
|
14358 |
|
14359 | onInit?: TScroll;
|
14360 | |
14361 |
|
14362 |
|
14363 |
|
14364 |
|
14365 | onDimensions?: TDimension;
|
14366 | |
14367 |
|
14368 |
|
14369 |
|
14370 |
|
14371 | onViewport?: TViewport;
|
14372 | |
14373 |
|
14374 |
|
14375 |
|
14376 |
|
14377 | onResize?: TScroll;
|
14378 | |
14379 |
|
14380 |
|
14381 |
|
14382 |
|
14383 | onDirection?: TScroll;
|
14384 | |
14385 |
|
14386 |
|
14387 |
|
14388 | onFocus?: TScroll;
|
14389 | |
14390 |
|
14391 |
|
14392 |
|
14393 |
|
14394 | onActivate?: TScroll;
|
14395 | |
14396 |
|
14397 |
|
14398 |
|
14399 |
|
14400 | onHover?: THover;
|
14401 | |
14402 |
|
14403 |
|
14404 |
|
14405 |
|
14406 | onStart?: TScroll;
|
14407 | |
14408 |
|
14409 |
|
14410 |
|
14411 |
|
14412 | onChange?: TScroll;
|
14413 | |
14414 |
|
14415 |
|
14416 |
|
14417 |
|
14418 |
|
14419 | onScroll?: TMove;
|
14420 | |
14421 |
|
14422 |
|
14423 |
|
14424 | onEnd?: TScroll;
|
14425 | }
|
14426 | export type TScrollEvents =
|
14427 | | "OnScrollInit"
|
14428 | | "OnScrollResize"
|
14429 | | "OnScrollDirection"
|
14430 | | "OnScrollFocus"
|
14431 | | "OnScrollActivate"
|
14432 | | "OnScrollHover"
|
14433 | | "OnScrollStart"
|
14434 | | "OnScrollChange"
|
14435 | | "OnScrollEnd"
|
14436 | | "OnZoomStart"
|
14437 | | "OnZoomChange"
|
14438 | | "OnZoomEnd";
|
14439 | export interface IScrollEvents<Hook extends THooks> extends IHookPayload<Hook> {
|
14440 |
|
14441 | readonly scroll: Scroll;
|
14442 | }
|
14443 | export interface IScrollInitEvent extends IScrollEvents<"OnScrollInit"> {}
|
14444 | export interface IScrollResizeEvent extends IScrollEvents<"OnScrollResize"> {}
|
14445 | export interface IScrollDirectionEvent extends IScrollEvents<"OnScrollDirection"> {}
|
14446 | export interface IScrollFocusEvent extends IScrollEvents<"OnScrollFocus"> {}
|
14447 | export interface IScrollActivateEvent extends IScrollEvents<"OnScrollActivate"> {}
|
14448 | export interface IScrollHoverEvent extends IScrollEvents<"OnScrollHover"> {}
|
14449 | export interface IScrollStartEvent extends IScrollEvents<"OnScrollStart"> {}
|
14450 | export interface IScrollChangeEvent extends IScrollEvents<"OnScrollChange"> {}
|
14451 | export interface IScrollEndEvent extends IScrollEvents<"OnScrollEnd"> {}
|
14452 | export interface IZoomStartEvent extends IScrollEvents<"OnZoomStart"> {}
|
14453 | export interface IZoomChangeEvent extends IScrollEvents<"OnZoomChange"> {
|
14454 |
|
14455 | zoom: number;
|
14456 | }
|
14457 | export interface IZoomEndEvent extends IScrollEvents<"OnZoomEnd"> {}
|
14458 | const TIMEOUT = 250;
|
14459 | const SENSITIVITY_MOUSE = 5;
|
14460 | const SENSITIVITY_TOUCH = 15;
|
14461 |
|
14462 | export const SCROLL_DURATION = 300;
|
14463 |
|
14464 | export const SCROLL_EDGE_SPEED = 20;
|
14465 | const DELAY_RESIZE = 100;
|
14466 | |
14467 |
|
14468 |
|
14469 |
|
14470 | export type TDimension = (pScroll: Scroll) => Dimensions | undefined;
|
14471 | |
14472 |
|
14473 |
|
14474 |
|
14475 | export type TViewport = (pScroll: Scroll) => Rectangle | undefined;
|
14476 | |
14477 |
|
14478 |
|
14479 |
|
14480 | export type TScroll = (pScroll: Scroll) => void;
|
14481 | |
14482 |
|
14483 |
|
14484 |
|
14485 |
|
14486 | export type THover = (bHovered: boolean, pScroll: Scroll) => void;
|
14487 | |
14488 |
|
14489 |
|
14490 |
|
14491 |
|
14492 |
|
14493 | export type TMove = (nLeft: number, nTop: number, pScroll: Scroll) => void;
|
14494 | |
14495 |
|
14496 |
|
14497 |
|
14498 |
|
14499 | export type TZoomBounderies = (nZoom: number, pScroll: Scroll) => number;
|
14500 | |
14501 |
|
14502 |
|
14503 |
|
14504 |
|
14505 | export type TZoom = (nZoom: number, pScroll: Scroll) => void;
|
14506 | |
14507 |
|
14508 |
|
14509 |
|
14510 |
|
14511 | export type TZoomWheel = (sZoom: "in" | "out", pScroll: Scroll) => number;
|
14512 | export class Scroll extends Controller<TScrollEvents> {
|
14513 | |
14514 |
|
14515 |
|
14516 |
|
14517 |
|
14518 | onInit: TScroll | undefined;
|
14519 | |
14520 |
|
14521 |
|
14522 |
|
14523 |
|
14524 | onDimensions: TDimension | undefined;
|
14525 | |
14526 |
|
14527 |
|
14528 |
|
14529 |
|
14530 | onViewport: TViewport | undefined;
|
14531 | |
14532 |
|
14533 |
|
14534 |
|
14535 |
|
14536 | onResize: TScroll | undefined;
|
14537 | |
14538 |
|
14539 |
|
14540 |
|
14541 |
|
14542 | onDirection: TScroll | undefined;
|
14543 | |
14544 |
|
14545 |
|
14546 |
|
14547 | onFocus: TScroll | undefined;
|
14548 | |
14549 |
|
14550 |
|
14551 |
|
14552 |
|
14553 | onActivate: TScroll | undefined;
|
14554 | |
14555 |
|
14556 |
|
14557 |
|
14558 |
|
14559 | onHover: THover | undefined;
|
14560 | |
14561 |
|
14562 |
|
14563 |
|
14564 |
|
14565 | onStart: TScroll | undefined;
|
14566 | |
14567 |
|
14568 |
|
14569 |
|
14570 |
|
14571 | onChange: TScroll | undefined;
|
14572 | |
14573 |
|
14574 |
|
14575 |
|
14576 |
|
14577 |
|
14578 | onScroll: TMove | undefined;
|
14579 | |
14580 |
|
14581 |
|
14582 |
|
14583 | onEnd: TScroll | undefined;
|
14584 | |
14585 |
|
14586 |
|
14587 |
|
14588 | onZoomBounderies: TZoomBounderies | undefined;
|
14589 | |
14590 |
|
14591 |
|
14592 |
|
14593 | onZoomStart: TZoom | undefined;
|
14594 | |
14595 |
|
14596 |
|
14597 |
|
14598 | onZoom: TZoom | undefined;
|
14599 | |
14600 |
|
14601 |
|
14602 |
|
14603 | onZoomChange: TZoom | undefined;
|
14604 | |
14605 |
|
14606 |
|
14607 |
|
14608 | onZoomEnd: TZoom | undefined;
|
14609 | |
14610 |
|
14611 |
|
14612 |
|
14613 | onZoomWheel: TZoomWheel | undefined;
|
14614 |
|
14615 |
|
14616 | static get id(): string;
|
14617 |
|
14618 | static get types(): Types;
|
14619 |
|
14620 | static get priority(): Priorities;
|
14621 |
|
14622 | |
14623 |
|
14624 |
|
14625 |
|
14626 |
|
14627 |
|
14628 | static processor(nEvent: Events): void;
|
14629 | |
14630 |
|
14631 |
|
14632 |
|
14633 |
|
14634 | static terminate(): void;
|
14635 | |
14636 |
|
14637 |
|
14638 |
|
14639 |
|
14640 |
|
14641 |
|
14642 |
|
14643 |
|
14644 |
|
14645 |
|
14646 |
|
14647 |
|
14648 |
|
14649 |
|
14650 |
|
14651 |
|
14652 |
|
14653 | static edgeDetection(
|
14654 | pAssets: Asset | Asset[] | undefined,
|
14655 | pHint: IPoint,
|
14656 | bHintEdges: boolean,
|
14657 | bHorizontal: boolean,
|
14658 | bVertical: boolean,
|
14659 | fnMove: (pShift: IPoint, pAsset: Asset) => void,
|
14660 | nAcceleration?: number
|
14661 | ): boolean;
|
14662 |
|
14663 | static edgeDetectionStop(): void;
|
14664 | |
14665 |
|
14666 |
|
14667 |
|
14668 |
|
14669 |
|
14670 |
|
14671 | static update(nDelay?: number, bAnimations?: boolean): void;
|
14672 | |
14673 |
|
14674 |
|
14675 |
|
14676 |
|
14677 | static on(pProperties: IScrollProperties): Scroll;
|
14678 | |
14679 |
|
14680 |
|
14681 |
|
14682 | protected constructor(pProperties: IScrollProperties);
|
14683 | /** Retrieves a reference to the focus controller. */
|
14684 | get focusController(): Focus | undefined;
|
14685 | /** Retrieves if native scrolling is enabled. */
|
14686 | get native(): boolean;
|
14687 | /** Retrieves if inertial scrolling is enabled or disabled. */
|
14688 | get inertialScrolling(): boolean;
|
14689 | /** Retrieves if the scroll area is pannable with the mouse pointer. */
|
14690 | get pannable(): boolean;
|
14691 | /** Retrieves if direction locking is enabled or disabled. */
|
14692 | get lockDirection(): boolean;
|
14693 | /** Retrieves if mouse wheel is enabled or disabled. */
|
14694 | get wheel(): boolean;
|
14695 | /** Retrieves if hovering is enabled. */
|
14696 | get hovering(): boolean;
|
14697 |
|
14698 | /** Retrieves if the scroll controller is initialized. */
|
14699 | get isInitialized(): boolean;
|
14700 | /** Retrieves if the scroll controller has focus. */
|
14701 | get hasFocus(): boolean;
|
14702 | /** Retrieved if the scroll area is hovered. */
|
14703 | get isHovered(): boolean;
|
14704 | /** Retrieved if the hover is canceled. */
|
14705 | get isHovercanceled(): boolean;
|
14706 | /** Retrieves if the controller is scrolling. */
|
14707 | get isScrolling(): boolean;
|
14708 | /** Retrieves if the scroll area is scrollable. */
|
14709 | get isScrollable(): boolean;
|
14710 | /** Retrieves if the controller is zooming. */
|
14711 | get isZooming(): boolean;
|
14712 | /** Contains the scroll direction for the current scroll action. */
|
14713 | get direction(): Directions;
|
14714 | /** Retrieves if horizontal scrolling is enabled. */
|
14715 | get horizontal(): boolean;
|
14716 | /** Retrieves if vertical scrolling is enabled. */
|
14717 | get vertical(): boolean;
|
14718 | /** Retrieves if automatic centering is enabled. */
|
14719 | get centering(): boolean;
|
14720 | /** Retrieves the current horizontal scroll position. */
|
14721 | get scrollLeft(): number;
|
14722 | /** Sets the validated current horizontal scroll position. */
|
14723 | set scrollLeft(nLeft: number);
|
14724 | /** Retrieves the validated current vertical scroll position. */
|
14725 | get scrollTop(): number;
|
14726 | /** Sets the current vertical scroll position. */
|
14727 | set scrollTop(nTop: number);
|
14728 | /** Retrieves the current horizontal scroll shift. */
|
14729 | get shiftLeft(): number;
|
14730 | /** Retrieves the current vertical scroll shift. */
|
14731 | get shiftTop(): number;
|
14732 | /**
|
14733 | * Contains the horizontal scroll range (this is the maximum value for the
|
14734 | * left scroll position).
|
14735 | */
|
14736 | get rangeHorizontal(): number;
|
14737 | /**
|
14738 | * Contains the vertical scroll range (this is the maximum value for the
|
14739 | * top scroll position).
|
14740 | */
|
14741 | get rangeVertical(): number;
|
14742 | /** Contains the width of the scrollable area. */
|
14743 | get width(): number;
|
14744 | /** Contains the height of the scrollable area. */
|
14745 | get height(): number;
|
14746 | /** Specifies if the area can be scrolled horizontally. */
|
14747 | get canScrollHorizontal(): boolean;
|
14748 | /** Specifies if the area can be scrolled vertically. */
|
14749 | get canScrollVertical(): boolean;
|
14750 | /** Specifies if the area can be scrolled up. */
|
14751 | get canScrollLeft(): boolean;
|
14752 | /** Specifies if the area can be scrolled down. */
|
14753 | get canScrollRight(): boolean;
|
14754 | /** Specifies if the area can be scrolled up. */
|
14755 | get canScrollUp(): boolean;
|
14756 | /** Specifies if the area can be scrolled down. */
|
14757 | get canScrollDown(): boolean;
|
14758 | /** Retrieves if the scroll area can be zoomed in. */
|
14759 | get canZoomIn(): boolean;
|
14760 | /** Retrieves if the scroll area can be zoomed out. */
|
14761 | get canZoomOut(): boolean;
|
14762 | /** Retrieves if the scroll area can be zoomed. */
|
14763 | get canZoom(): boolean;
|
14764 | /** Retrieves if the zoom fits horizontally. */
|
14765 | get isZoomFitHorizontal(): boolean;
|
14766 | /** Retrieves if the zoom fits vertically. */
|
14767 | get isZoomFitVertical(): boolean;
|
14768 | /**
|
14769 | * Contains the horizontal bounce size. A negative value specifies the
|
14770 | * left bounce and a positive value specifies the right bounce.
|
14771 | */
|
14772 | get bounceHorizontal(): number;
|
14773 | /**
|
14774 | * Contains the vertical bounce size. A negative value specifies the
|
14775 | * top bounce and a positive value specifies the bottom bounce.
|
14776 | */
|
14777 | get bounceVertical(): number;
|
14778 | /** Retrieves if a bounce is active. */
|
14779 | get isBouncing(): boolean;
|
14780 | /** Retrieves if horizontal bouncing is enabled. */
|
14781 | get isBounceHorizontal(): "no" | "yes" | "always";
|
14782 | /** Sets the horizontal bounce. */
|
14783 | set isBounceHorizontal(sBounce: "no" | "yes" | "always");
|
14784 | /** Retrieves if vertical bouncing is enabled. */
|
14785 | get isBounceVertical(): "no" | "yes" | "always";
|
14786 | /** Sets the vertical bounce. */
|
14787 | set isBounceVertical(sBounce: "no" | "yes" | "always");
|
14788 | /** Retrieves the current zoom factor. */
|
14789 | get zoom(): number;
|
14790 | /** Sets the current zoom factor. */
|
14791 | set zoom(nZoom: number);
|
14792 | /** Retrieves the minimal zoom. */
|
14793 | get zoomMin(): number;
|
14794 | /** Retrieves the maximum zoom. */
|
14795 | get zoomMax(): number;
|
14796 | /** Retrieves the zoom factor to fit all of the content. */
|
14797 | get zoomFit(): number;
|
14798 | /** Retrieves the zoom factor to fit the horizontal content. */
|
14799 | get zoomFitHorizontal(): number;
|
14800 | /** Retrieves the zoom factor to fit the vertical content. */
|
14801 | get zoomFitVertical(): number;
|
14802 | /** Retrieves the viewport rectangle. */
|
14803 | get viewport(): Rectangle;
|
14804 | /** Retrieves the viewport spacing. */
|
14805 | get spacing(): Spacing;
|
14806 | /** Retrieves the bounding rectangle which is the viewport including the spacing. */
|
14807 | get boundingRectangle(): Rectangle;
|
14808 | /** Retrieves the parent asset of the scroll area which can be used to draw scrollbars. */
|
14809 | get parent(): Asset | undefined;
|
14810 |
|
14811 | /** Emits the `OnScrollStart` event. */
|
14812 | protected scrollStart(): void;
|
14813 | /** Emits the `OnScrollEnd` event. */
|
14814 | protected scrollEnd(): void;
|
14815 | /**
|
14816 | * Applies a horizontal scroll.
|
14817 | * @param nLeft Specifies the left scroll position.
|
14818 | * @param bSynchronous Perform synchronous scroll or not.
|
14819 | */
|
14820 | protected scrollHorizontal(nLeft: number, bSynchronous?: boolean): void;
|
14821 | /**
|
14822 | * Applies a vertical scroll.
|
14823 | * @param bTop Specifies the top scroll position.
|
14824 | * @param bSynchronous Perform synchronous scroll or not.
|
14825 | */
|
14826 | protected scrollVertical(nTop: number, bSynchronous?: boolean): void;
|
14827 | /**
|
14828 | * Invoked when the scroll controller is initialized.
|
14829 | * @event
|
14830 | */
|
14831 | protected onScrollInit(): void;
|
14832 | /**
|
14833 | * Invoked when the scroll dimensions are requested.
|
14834 | * @return Returns the dimensions of the scroll content.
|
14835 | * @event
|
14836 | */
|
14837 | protected onScrollDimensions(): Dimensions | undefined;
|
14838 | /**
|
14839 | * Invoked when the rectangle of the scroll viewport is requested.
|
14840 | * @return Returns the rectangle.
|
14841 | * @event
|
14842 | */
|
14843 | protected onScrollViewport(): Rectangle | undefined;
|
14844 | /**
|
14845 | * Invoked when the scroll area is resized.
|
14846 | * @event
|
14847 | */
|
14848 | protected onScrollResize(): void;
|
14849 | /**
|
14850 | * Invoked when the scroll direction (lock) is changed.
|
14851 | * @event
|
14852 | */
|
14853 | protected onScrollDirection(): void;
|
14854 | /**
|
14855 | * Invoked when the focus is gained or blurred.
|
14856 | * @event
|
14857 | */
|
14858 | protected onScrollFocus(): void;
|
14859 | /**
|
14860 | * Invoked when the scrolling or zooming starts.
|
14861 | * @event
|
14862 | */
|
14863 | protected onScrollActivate(): void;
|
14864 | /**
|
14865 | * Invoked when a pointing device hovers in or out the scroll area.
|
14866 | * @event
|
14867 | */
|
14868 | protected onScrollHover(): void;
|
14869 | /**
|
14870 | * Invoked when the scrolling starts.
|
14871 | * @event
|
14872 | */
|
14873 | protected onScrollStart(): void;
|
14874 | /**
|
14875 | * Invoked when the scroll position changes.
|
14876 | * @event
|
14877 | */
|
14878 | protected onScrollChange(): void;
|
14879 | /**
|
14880 | * Invoked when the scroll position is updated.
|
14881 | * @param nLeft Specifies the left position.
|
14882 | * @param nTop Specifies the top position.
|
14883 | * @event
|
14884 | */
|
14885 | protected onScrollMove(nLeft: number, nTop: number): void;
|
14886 | /**
|
14887 | * Invoked when the scrolling ends.
|
14888 | * @event
|
14889 | */
|
14890 | protected onScrollEnd(): void;
|
14891 | /**
|
14892 | * Invoked when the zoom bounderies are requested.
|
14893 | * @param nZoom Specifies the desired zoom.
|
14894 | * @return Returns the allowed zoom.
|
14895 | */
|
14896 | protected onScrollZoomBounderies(nZoom: number): number;
|
14897 | /**
|
14898 | * Invoked when a zoom is started.
|
14899 | * @event
|
14900 | */
|
14901 | protected onScrollZoomStart(): void;
|
14902 | /**
|
14903 | * Invoked when the zoom factor needs to be applied.
|
14904 | * @param nZoom Specifies the zoom factor.
|
14905 | * @event
|
14906 | */
|
14907 | protected onScrollZoom(nZoom?: number): void;
|
14908 | /**
|
14909 | * Invoked when the zoom factor changes.
|
14910 | * @param nZoom Specifies the zoom factor.
|
14911 | * @event
|
14912 | */
|
14913 | protected onScrollZoomChange(nZoom?: number): void;
|
14914 | /**
|
14915 | * Invoked when a zoom is ended.
|
14916 | * @event
|
14917 | */
|
14918 | protected onScrollZoomEnd(): void;
|
14919 | /**
|
14920 | * Invoked when the wheel zoom is invoked.
|
14921 | * @param sZoom Specifies the zoom action.
|
14922 | * @return Returns the zoom step size.
|
14923 | */
|
14924 | protected onScrollZoomWheel(sZoom: "in" | "out"): number;
|
14925 | /**
|
14926 | * Initializes the controller. Normally the scroll controller is intialized
|
14927 | * automatically when the user starts scrolling. But in some cases you want
|
14928 | * to force the initialization of the controller. When the controller is
|
14929 | * initalized the `OnInit` event is fired.
|
14930 | */
|
14931 | init(): void;
|
14932 | /**
|
14933 | * Updates the controller.
|
14934 | * @param bAnimations Specifies if animations should be used.
|
14935 | * @param nTimeout Specifies the timeout in milliseconds.
|
14936 | */
|
14937 | update(bAnimations?: boolean, nTimeout?: number): void;
|
14938 | /** Resets the scroll controller. */
|
14939 | reset(): void;
|
14940 | /**
|
14941 | * Scrolls to the specified position.
|
14942 | * @param nLeft Specifies the left position.
|
14943 | * @param nTop Specifies the top position.
|
14944 | * @param bAnimate Specifies if a scroll animation should be used.
|
14945 | * @param bAnimateContinuous Use scroll animation for continuous scrolling.
|
14946 | * @param bSynchronous Scroll in synchronous mode (no animation).
|
14947 | * @param bBouncing Specifies if bouncing is enabled.
|
14948 | * @return Returns `true` if a scroll update occurred.
|
14949 | */
|
14950 | scrollTo(
|
14951 | nLeft: number,
|
14952 | nTop: number,
|
14953 | bAnimate?: boolean,
|
14954 | bAnimateContinuous?: boolean,
|
14955 | bSynchronous?: boolean,
|
14956 | bBouncing?: boolean
|
14957 | ): boolean;
|
14958 | /**
|
14959 | * Applies a scroll shift.
|
14960 | * @param nLeft Specifies the left shift.
|
14961 | * @param nTop Specifies the top shift.
|
14962 | * @param bAnimate Specifies if a scroll animation should be used.
|
14963 | * @param bAnimateContinuous Use scroll animation for continuous scrolling.
|
14964 | * @param bSynchronous Scroll in synchronous mode (no animation).
|
14965 | * @param bBouncing Specifies if bouncing is enabled.
|
14966 | * @return Returns `true` if a scroll update occurred.
|
14967 | */
|
14968 | scrollShift(
|
14969 | nLeft: number,
|
14970 | nTop: number,
|
14971 | bAnimate?: boolean,
|
14972 | bAnimateContinuous?: boolean,
|
14973 | bSynchronous?: boolean,
|
14974 | bBouncing?: boolean
|
14975 | ): boolean;
|
14976 | /**
|
14977 | * Scrolls to the specified asset.
|
14978 | * @param pAsset Specifies the asset to scroll to. Should be a child
|
14979 | * of the scroll area.
|
14980 | * @param bAnimate Specifies if a scroll animation should be used.
|
14981 | * @param bCenter Specifies is the center of the element is used when the
|
14982 | * element is larger than the viewport.
|
14983 | * @param nSpacingLeft Specifies an optional left border space.
|
14984 | * @param nSpacingTop Specifies an optional top border space.
|
14985 | * @param nSpacingRight Specifies an optional right border space.
|
14986 | * @param nSpacingBottom Specifies an optional bottom border space.
|
14987 | * @param bOnlyWhenInvisible Specifies that scrolling only occurs if the asset is invisible (out of picture).
|
14988 | */
|
14989 | scrollToAsset(
|
14990 | pAsset: Asset,
|
14991 | bAnimate?: boolean,
|
14992 | nSpacingLeft?: number,
|
14993 | nSpacingTop?: number,
|
14994 | nSpacingRight?: number,
|
14995 | nSpacingBottom?: number,
|
14996 | bOnlyWhenInvisible?: boolean
|
14997 | ): void;
|
14998 | /** Scrolls to the top. */
|
14999 | scrollToTop(): boolean;
|
15000 | /** Scrolls to the bottom. */
|
15001 | scrollToBottom(): boolean;
|
15002 | /**
|
15003 | * Scrolls to the top if the scroll position is not at the top or scrolls to
|
15004 | * the bottom if the list is at the top.
|
15005 | */
|
15006 | scrollToTopOrBottom(): boolean;
|
15007 | /** Scrolls to the left. */
|
15008 | scrollToLeft(): boolean;
|
15009 | /** Scrolls to the right. */
|
15010 | scrollToRight(): boolean;
|
15011 | /**
|
15012 | * Scrolls to the left if the scroll position is not at the left or scrolls
|
15013 | * to the right if the list is at the left.
|
15014 | */
|
15015 | scrollToLeftOrRight(): boolean;
|
15016 | /** Scrolls one page up. */
|
15017 | scrollPageUp(): boolean;
|
15018 | /** Scrolls one page down. */
|
15019 | scrollPageDown(): boolean;
|
15020 | /** Scrolls one page left. */
|
15021 | scrollPageLeft(): boolean;
|
15022 | /** Scrolls one page right. */
|
15023 | scrollPageRight(): boolean;
|
15024 | /** Scrolls one inch up. */
|
15025 | scrollInchUp(): boolean;
|
15026 | /** Scrolls one inch down. */
|
15027 | scrollInchDown(): boolean;
|
15028 | /** Scrolls one inch left. */
|
15029 | scrollInchLeft(): boolean;
|
15030 | /** Scrolls one inch right. */
|
15031 | scrollInchRight(): boolean;
|
15032 | /**
|
15033 | * Zooms to the specified zoom factor.
|
15034 | * @param nZoom Specifies the zoom factor.
|
15035 | * @param bAnimation Specifies if a zoom animation should be used.
|
15036 | * @param bAnimationDuration Specifies the duration of the zoom animation.
|
15037 | * @param bAnimationEase Specifies if an ease or linear animation should be used.
|
15038 | * @param pPoint Specifies the optional focal point to focus on.
|
15039 | * @return Returns `true` if the zoom factor is changed.
|
15040 | */
|
15041 | zoomTo(nZoom: number, bAnimation?: boolean, nAnimationDuration?: number, bAnimationEase?: boolean, pPoint?: IPoint): boolean;
|
15042 | /**
|
15043 | * Zooms to the specified zoom percentage.
|
15044 | * @param nPercentage Specifies the zoom percentage.
|
15045 | * @param bAnimation Specifies if a zoom animation should be used.
|
15046 | * @param bAnimationDuration Specifies the duration of the zoom animation.
|
15047 | * @param bAnimationEase Specifies if an ease or linear animation should be used.
|
15048 | * @param pPoint Specifies the optional focal point to focus on.
|
15049 | * @return Returns `true` if the zoom factor is changed.
|
15050 | */
|
15051 | zoomToPercentage(
|
15052 | nPercentage: number,
|
15053 | bAnimation?: boolean,
|
15054 | nAnimationDuration?: number,
|
15055 | bAnimationEase?: boolean,
|
15056 | pPoint?: IPoint
|
15057 | ): boolean;
|
15058 | /**
|
15059 | * Zooms to the maximum zoom.
|
15060 | * @param bAnimation Specifies if a zoom animation should be used.
|
15061 | * @param bAnimationDuration Specifies the duration of the zoom animation.
|
15062 | * @param bAnimationEase Specifies if an ease or linear animation should be used.
|
15063 | * @param pPoint Specifies the optional focal point to focus on.
|
15064 | * @return Returns `true` if the zoom factor is changed.
|
15065 | */
|
15066 | zoomToMax(bAnimation?: boolean, nAnimationDuration?: number, bAnimationEase?: boolean, pPoint?: IPoint): boolean;
|
15067 | /**
|
15068 | * Zooms to the minimal zoom.
|
15069 | * @param bAnimation Specifies if a zoom animation should be used.
|
15070 | * @param bAnimationDuration Specifies the duration of the zoom animation.
|
15071 | * @param bAnimationEase Specifies if an ease or linear animation should be used.
|
15072 | * @param pPoint Specifies the optional focal point to focus on.
|
15073 | * @return Returns `true` if the zoom factor is changed.
|
15074 | */
|
15075 | zoomToMin(bAnimation?: boolean, nAnimationDuration?: number, bAnimationEase?: boolean, pPoint?: IPoint): boolean;
|
15076 | /**
|
15077 | * Adjusts the zoom factor to fit all of the content.
|
15078 | * @param bAnimation Specifies if a zoom animation should be used.
|
15079 | * @param bAnimationDuration Specifies the duration of the zoom animation.
|
15080 | * @param bAnimationEase Specifies if an ease or linear animation should be used.
|
15081 | * @return Returns `true` if the zoom factor is changed.
|
15082 | */
|
15083 | zoomToFit(bAnimation?: boolean, nAnimationDuration?: number, bAnimationEase?: boolean): boolean;
|
15084 | /**
|
15085 | * Adjusts the zoom factor to fit the horizontal content.
|
15086 | * @param bAnimation Specifies if a zoom animation should be used.
|
15087 | * @param bAnimationDuration Specifies the duration of the zoom animation.
|
15088 | * @param bAnimationEase Specifies if an ease or linear animation should be used.
|
15089 | * @return Returns `true` if the zoom factor is changed.
|
15090 | */
|
15091 | zoomToFitHorizontal(bAnimation?: boolean, nAnimationDuration?: number, bAnimationEase?: boolean): boolean;
|
15092 | /**
|
15093 | * Adjusts the zoom factor to fit the vertical content.
|
15094 | * @param bAnimation Specifies if a zoom animation should be used.
|
15095 | * @param bAnimationDuration Specifies the duration of the zoom animation.
|
15096 | * @param bAnimationEase Specifies if an ease or linear animation should be used.
|
15097 | * @return Returns `true` if the zoom factor is changed.
|
15098 | */
|
15099 | zoomToFitVertical(bAnimation?: boolean, nAnimationDuration?: number, bAnimationEase?: boolean): boolean;
|
15100 | /**
|
15101 | * Zooms to the actual content size (zoom factor is 1).
|
15102 | * @param bAnimation Specifies if a zoom animation should be used.
|
15103 | * @param bAnimationDuration Specifies the duration of the zoom animation.
|
15104 | * @param bAnimationEase Specifies if an ease or linear animation should be used.
|
15105 | * @param pPoint Specifies the optional focal point to focus on.
|
15106 | * @return Returns `true` if the zoom factor is changed.
|
15107 | */
|
15108 | zoomToActual(bAnimation?: boolean, nAnimationDuration?: number, bAnimationEase?: boolean, pPoint?: IPoint): boolean;
|
15109 | /**
|
15110 | * Toggles the zoom between fit and actual.
|
15111 | * @param bAnimation Specifies if a zoom animation should be used.
|
15112 | * @param bAnimationDuration Specifies the duration of the zoom animation.
|
15113 | * @param bAnimationEase Specifies if an ease or linear animation should be used.
|
15114 | * @param pPoint Specifies the optional focal point to focus on.
|
15115 | * @return Returns `true` if the zoom factor is changed.
|
15116 | */
|
15117 | zoomToggle(bAnimation?: boolean, nAnimationDuration?: number, bAnimationEase?: boolean, pPoint?: IPoint): boolean;
|
15118 | /**
|
15119 | * Zoom in with one step (10%).
|
15120 | * @param bAnimation Specifies if a zoom animation should be used.
|
15121 | * @param bAnimationDuration Specifies the duration of the zoom animation.
|
15122 | * @param bAnimationEase Specifies if an ease or linear animation should be used.
|
15123 | * @param pPoint Specifies the optional focal point to focus on.
|
15124 | * @return Returns `true` if the zoom factor is changed.
|
15125 | */
|
15126 | zoomIn(bAnimation?: boolean, nAnimationDuration?: number, bAnimationEase?: boolean, pPoint?: IPoint): boolean;
|
15127 | /**
|
15128 | * Zoom out with one step (10%).
|
15129 | * @param bAnimation Specifies if a zoom animation should be used.
|
15130 | * @param bAnimationDuration Specifies the duration of the zoom animation.
|
15131 | * @param bAnimationEase Specifies if an ease or linear animation should be used.
|
15132 | * @param pPoint Specifies the optional focal point to focus on.
|
15133 | * @return Returns `true` if the zoom factor is changed.
|
15134 | */
|
15135 | zoomOut(bAnimation?: boolean, nAnimationDuration?: number, bAnimationEase?: boolean, pPoint?: IPoint): boolean;
|
15136 | /**
|
15137 | * Crawls the zoom in or out.
|
15138 | * @param sCrawl Specifies the crawl direction.
|
15139 | * @param nCrawlDuration Specifies the crawl duration in milliseconds.
|
15140 | */
|
15141 | zoomCrawl(sCrawl: "in" | "out" | "stop", nCrawlDuration: number): void;
|
15142 | /** Stops the zoom crawl. */
|
15143 | zoomCrawlStop(): void;
|
15144 | /** Cancels a hover. */
|
15145 | cancelHover(): void;
|
15146 | /** Focus the scroll area. */
|
15147 | focus(): void;
|
15148 | /** Blurs the focus. */
|
15149 | blur(): void;
|
15150 | /**
|
15151 | * Invoked when the controller is destroyed.
|
15152 | * @return Returns `true` if the controller is detached.
|
15153 | * @event
|
15154 | */
|
15155 | onDestroy(): boolean;
|
15156 | }
|
15157 |
|
15158 | export {
|
15159 | DELAY_RESIZE as SCROLL_RESIZE_DELAY,
|
15160 | SENSITIVITY_MOUSE as SCROLL_SENSITIVITY_MOUSE,
|
15161 | SENSITIVITY_TOUCH as SCROLL_SENSITIVITY_TOUCH,
|
15162 | TIMEOUT as SCROLL_TIMEOUT,
|
15163 | };
|
15164 | }
|
15165 |
|
15166 | declare module "tripetto/module/touch-tap" {
|
15167 | import { Asset, Stylesheet } from "tripetto/module/dom";
|
15168 | import { Coordinate, IPoint } from "tripetto/module/metrics";
|
15169 | import { Buttons, Controller, Events, Priorities, Types } from "tripetto/module/touch";
|
15170 |
|
15171 | export type TTapEvents = "OnTap" | "OnTapStart" | "OnTapEnd";
|
15172 | export interface ITapEvents {
|
15173 |
|
15174 | readonly tap: Tap;
|
15175 |
|
15176 | readonly asset: Asset;
|
15177 |
|
15178 | readonly offset: IPoint;
|
15179 |
|
15180 | readonly isMouse: boolean;
|
15181 |
|
15182 | readonly isTouch: boolean;
|
15183 |
|
15184 | readonly isPen: boolean;
|
15185 |
|
15186 | readonly buttons: Buttons;
|
15187 | }
|
15188 | export interface ITapEvent extends ITapEvents {}
|
15189 | export interface ITapStartEvent extends ITapEvents {}
|
15190 | export interface ITapEndEvent extends ITapEvents {}
|
15191 | const TIMEOUT_TAP = 300;
|
15192 | const TIMEOUT_GAP = 200;
|
15193 | const TIMEOUT_DOUBLETAP = 300;
|
15194 |
|
15195 | export type TTap<T> = (pTapEvent: T) => void;
|
15196 | export class Tap extends Controller<TTapEvents> {
|
15197 | |
15198 |
|
15199 |
|
15200 |
|
15201 | on: TTap<ITapEvent> | undefined;
|
15202 | |
15203 |
|
15204 |
|
15205 |
|
15206 | onStart: TTap<ITapStartEvent> | undefined;
|
15207 | |
15208 |
|
15209 |
|
15210 |
|
15211 | onEnd: TTap<ITapEndEvent> | undefined;
|
15212 |
|
15213 |
|
15214 | static get id(): string;
|
15215 |
|
15216 | static get types(): Types;
|
15217 |
|
15218 | static get priority(): Priorities;
|
15219 |
|
15220 | |
15221 |
|
15222 |
|
15223 |
|
15224 |
|
15225 |
|
15226 | static processor(nEvent: Events): void;
|
15227 | |
15228 |
|
15229 |
|
15230 |
|
15231 |
|
15232 | static terminate(): void;
|
15233 | |
15234 |
|
15235 |
|
15236 |
|
15237 |
|
15238 |
|
15239 |
|
15240 |
|
15241 |
|
15242 |
|
15243 |
|
15244 | static on(
|
15245 | pAsset: Asset,
|
15246 | fnTap?: TTap<ITapEvent>,
|
15247 | fnTapStart?: TTap<ITapStartEvent>,
|
15248 | fnTapEnd?: TTap<ITapEndEvent>,
|
15249 | bDoubleTap?: boolean,
|
15250 | pArea?: Coordinate,
|
15251 | pStylesheet?: Stylesheet
|
15252 | ): Tap;
|
15253 | |
15254 |
|
15255 |
|
15256 |
|
15257 |
|
15258 |
|
15259 |
|
15260 |
|
15261 |
|
15262 |
|
15263 | static single(
|
15264 | pAsset: Asset,
|
15265 | fnTap?: TTap<ITapEvent>,
|
15266 | fnTapStart?: TTap<ITapStartEvent>,
|
15267 | fnTapEnd?: TTap<ITapEndEvent>,
|
15268 | pArea?: Coordinate,
|
15269 | pStylesheet?: Stylesheet
|
15270 | ): Tap;
|
15271 | |
15272 |
|
15273 |
|
15274 |
|
15275 |
|
15276 |
|
15277 |
|
15278 |
|
15279 |
|
15280 |
|
15281 | static double(
|
15282 | pAsset: Asset,
|
15283 | fnTap?: TTap<ITapEvent>,
|
15284 | fnTapStart?: TTap<ITapStartEvent>,
|
15285 | fnTapEnd?: TTap<ITapEndEvent>,
|
15286 | pArea?: Coordinate,
|
15287 | pStylesheet?: Stylesheet
|
15288 | ): Tap;
|
15289 | |
15290 |
|
15291 |
|
15292 |
|
15293 |
|
15294 |
|
15295 |
|
15296 |
|
15297 |
|
15298 |
|
15299 | protected constructor(
|
15300 | pAsset: Asset,
|
15301 | fnTap?: TTap<ITapEvent>,
|
15302 | fnTapStart?: TTap<ITapStartEvent>,
|
15303 | fnTapEnd?: TTap<ITapEndEvent>,
|
15304 | bDoubleTap?: boolean,
|
15305 | pArea?: Coordinate,
|
15306 | pStylesheet?: Stylesheet
|
15307 | );
|
15308 | /** Returns `true` if the tap is allowed. */
|
15309 | get isAllowed(): boolean;
|
15310 | /** Retrieves the tap count. */
|
15311 | get count(): number;
|
15312 |
|
15313 | /**
|
15314 | * Invoked when a tap occurs.
|
15315 | * @param pEvent Reference to the event.
|
15316 | * @event
|
15317 | */
|
15318 | protected onTap(pEvent: ITapEvent): void;
|
15319 | /**
|
15320 | * Invokes the `OnTapStart` event which indicates when a tap starts.
|
15321 | * @param pEvent Reference to the event.
|
15322 | * @event
|
15323 | */
|
15324 | protected onTapStart(pEvent: ITapStartEvent): void;
|
15325 | /**
|
15326 | * Invokes the `OnTapEnd` event which indicates when a tap ends.
|
15327 | * @param pEvent Reference to the event.
|
15328 | * @event
|
15329 | */
|
15330 | protected onTapEnd(pEvent: ITapEndEvent): void;
|
15331 | }
|
15332 |
|
15333 | export { TIMEOUT_DOUBLETAP as TAP_DOUBLE_TIMEOUT, TIMEOUT_GAP as TAP_SINGLE_DOUBLE_GAP, TIMEOUT_TAP as TAP_SINGLE_TIMEOUT };
|
15334 | }
|
15335 |
|
15336 | declare module "tripetto/module/ui-cards" {
|
15337 | import { Callback } from "tripetto/module/callback";
|
15338 | import { Element, IStyles, Stylesheet } from "tripetto/module/dom";
|
15339 | import { IHookPayload, THooks } from "tripetto/module/hookup";
|
15340 | import { IItemPopEvent, Item, Matrix, StrictItem, StrictMatrix } from "tripetto/module/matrix";
|
15341 | import { Spacing } from "tripetto/module/metrics";
|
15342 | import { Layer } from "tripetto/module/ui-layers";
|
15343 | import { IScrollbarsStyle } from "tripetto/module/ui-scrollbars";
|
15344 |
|
15345 |
|
15346 | export interface IFeaturesStyle {
|
15347 |
|
15348 | width: number;
|
15349 |
|
15350 | spacing?: {
|
15351 |
|
15352 | left?: number;
|
15353 |
|
15354 | right?: number;
|
15355 |
|
15356 | top?: number;
|
15357 |
|
15358 | bottom?: number;
|
15359 | };
|
15360 |
|
15361 | appearance?: IStyles;
|
15362 |
|
15363 | toggle: {
|
15364 |
|
15365 | appearance: IStyles;
|
15366 |
|
15367 | hover?: IStyles;
|
15368 |
|
15369 | focus?: IStyles;
|
15370 |
|
15371 | activated?: {
|
15372 |
|
15373 | appearance: IStyles;
|
15374 |
|
15375 | hover?: IStyles;
|
15376 |
|
15377 | focus?: IStyles;
|
15378 | };
|
15379 |
|
15380 | option?: {
|
15381 |
|
15382 | button: {
|
15383 |
|
15384 | width: number;
|
15385 |
|
15386 | hover?: IStyles;
|
15387 | };
|
15388 |
|
15389 | appearance: IStyles;
|
15390 |
|
15391 | hover?: IStyles;
|
15392 |
|
15393 | focus?: IStyles;
|
15394 | };
|
15395 |
|
15396 | locked?: IStyles;
|
15397 |
|
15398 | passed?: IStyles;
|
15399 |
|
15400 | failed?: IStyles;
|
15401 |
|
15402 | awaiting?: IStyles;
|
15403 |
|
15404 | first?: IStyles;
|
15405 |
|
15406 | last?: IStyles;
|
15407 | };
|
15408 |
|
15409 | static?: IStyles;
|
15410 |
|
15411 | visible?: IStyles;
|
15412 |
|
15413 | disabled?: IStyles;
|
15414 |
|
15415 | scrollbars?: IScrollbarsStyle;
|
15416 |
|
15417 | bounce?: "no" | "yes" | "always";
|
15418 |
|
15419 | blink?: boolean;
|
15420 | }
|
15421 | export class Features extends StrictMatrix<Features, Feature, void, IFeature> {
|
15422 | |
15423 |
|
15424 |
|
15425 |
|
15426 | constructor(pCards: Cards<THooks>);
|
15427 | /** Retrieves a reference to the cards parent. */
|
15428 | get cards(): Cards<THooks>;
|
15429 | /** Retrieves the features visibility. */
|
15430 | get isVisible(): boolean;
|
15431 | /** Sets the features visibility. */
|
15432 | set isVisible(bVisible: boolean);
|
15433 |
|
15434 | /**
|
15435 | * Draws the features.
|
15436 | * @param pStyle Contains the features styles.
|
15437 | * @param pLayer Reference to the parent layer.
|
15438 | */
|
15439 | draw(pStyle: IFeaturesStyle, pLayer: Layer): void;
|
15440 | /**
|
15441 | * Adds a card. These cards are not visible in the feature list.
|
15442 | * @param pCard Reference to the card constructor.
|
15443 | * @param bActivated Specifies if the card is activated.
|
15444 | * @return Returns a reference to the feature.
|
15445 | */
|
15446 | card<T extends Card<THooks>>(pCard: T, bActivated?: boolean): Feature<T>;
|
15447 | /**
|
15448 | * Adds a card. These cards are not visible in the feature list.
|
15449 | * @param pProps Specifies the properties for the card.
|
15450 | * @return Returns a reference to the feature.
|
15451 | */
|
15452 | card<T extends Card<THooks>>(pProps: {
|
15453 | card: T;
|
15454 | visible?: boolean;
|
15455 | activated?: boolean;
|
15456 | disabled?: boolean;
|
15457 | locked?: boolean;
|
15458 | on?: (feature: Feature<T>) => void;
|
15459 | onVisible?: (feature: Feature<T>) => void;
|
15460 | onDisable?: (feature: Feature<T>) => void;
|
15461 | onLock?: (feature: Feature<T>) => void;
|
15462 | }): Feature<T>;
|
15463 | /**
|
15464 | * Adds a feature card switch to the list.
|
15465 | * @param sName Contains the name of the feature.
|
15466 | * @param pCard Reference to the card constructor.
|
15467 | * @param bActivated Specifies if the feature is initially activated.
|
15468 | * @return Returns a reference to the feature.
|
15469 | */
|
15470 | feature<T extends Card<THooks>>(sName: string, pCard: T, bActivated?: boolean): Feature<T>;
|
15471 | /**
|
15472 | * Adds a feature card switch to the list.
|
15473 | * @param pProps Specifies the properties for the feature.
|
15474 | * @return Returns a reference to the feature.
|
15475 | */
|
15476 | feature<T extends Card<THooks>>(pProps: {
|
15477 | name: string;
|
15478 | card: T;
|
15479 | visible?: boolean;
|
15480 | activated?: boolean;
|
15481 | disabled?: boolean;
|
15482 | locked?: boolean;
|
15483 | on?: (feature: Feature<T>) => void;
|
15484 | onVisible?: (feature: Feature<T>) => void;
|
15485 | onDisable?: (feature: Feature<T>) => void;
|
15486 | onLock?: (feature: Feature<T>) => void;
|
15487 | }): Feature<T>;
|
15488 | /**
|
15489 | * Adds a option feature card to the list.
|
15490 | * @param sName Contains the name of the feature.
|
15491 | * @param pCard Reference to the card constructor.
|
15492 | * @param bActivated Specifies if the option is initially activated.
|
15493 | * @return Returns a reference to the feature.
|
15494 | */
|
15495 | option<T extends Card<THooks>>(sName: string, pCard?: T, bActivated?: boolean): Feature<T>;
|
15496 | /**
|
15497 | * Adds a option feature card to the list.
|
15498 | * @param pProps Specifies the properties for the option.
|
15499 | * @return Returns a reference to the feature.
|
15500 | */
|
15501 | option<T extends Card<THooks>>(pProps: {
|
15502 | name: string;
|
15503 | card?: T;
|
15504 | visible?: boolean;
|
15505 | activated?: boolean;
|
15506 | disabled?: boolean;
|
15507 | locked?: boolean;
|
15508 | on?: (feature: Feature<T>) => void;
|
15509 | onVisible?: (feature: Feature<T>) => void;
|
15510 | onDisable?: (feature: Feature<T>) => void;
|
15511 | onLock?: (feature: Feature<T>) => void;
|
15512 | }): Feature<T>;
|
15513 | /**
|
15514 | * Adds a toggle to the feature list.
|
15515 | * @param sName Contains the name of the feature.
|
15516 | * @param bActivated Specifies if the toggle is initially activated.
|
15517 | * @return Returns a reference to the feature.
|
15518 | */
|
15519 | toggle(sName: string, bActivated?: boolean): Feature;
|
15520 | /**
|
15521 | * Adds a toggle to the feature list.
|
15522 | * @param pProps Specifies the properties for the toggle.
|
15523 | * @return Returns a reference to the feature.
|
15524 | */
|
15525 | toggle(pProps: {
|
15526 | name: string;
|
15527 | visible?: boolean;
|
15528 | activated?: boolean;
|
15529 | disabled?: boolean;
|
15530 | locked?: boolean;
|
15531 | on?: (feature: Feature) => void;
|
15532 | onVisible?: (feature: Feature) => void;
|
15533 | onDisable?: (feature: Feature) => void;
|
15534 | onLock?: (feature: Feature) => void;
|
15535 | }): Feature;
|
15536 | /**
|
15537 | * Adds a static feature to the feature list.
|
15538 | * @param sName Contains the name of the feature.
|
15539 | * @return Returns a reference to the feature.
|
15540 | */
|
15541 | static(sName: string): Feature;
|
15542 | /**
|
15543 | * Adds a static feature to the feature list.
|
15544 | * @param pProps Specifies the properties for the static feature.
|
15545 | * @return Returns a reference to the feature.
|
15546 | */
|
15547 | static(pProps: {
|
15548 | name: string;
|
15549 | visible?: boolean;
|
15550 | disabled?: boolean;
|
15551 | onVisible?: (feature: Feature) => void;
|
15552 | onDisable?: (feature: Feature) => void;
|
15553 | }): Feature;
|
15554 | scrollIntoView(pFeature: Feature): void;
|
15555 | /**
|
15556 | * Scrolls to the top if the scroll position is not at the top or scrolls to
|
15557 | * the bottom if the list is at the top.
|
15558 | */
|
15559 | scrollToTopOrBottom(): void;
|
15560 | /** Destroys the features. */
|
15561 | destroy(): void;
|
15562 | }
|
15563 | export type TFeatureEvents = "OnVisible" | "OnLock" | "OnDisable" | "OnToggle";
|
15564 | export interface IFeatureEvents<Hook extends THooks> extends IHookPayload<Hook> {
|
15565 | readonly feature: Feature;
|
15566 | }
|
15567 | export interface IFeatureVisibleEvent extends IFeatureEvents<"OnVisible"> {}
|
15568 | export interface IFeatureLockEvent extends IFeatureEvents<"OnLock"> {}
|
15569 | export interface IFeatureDisableEvent extends IFeatureEvents<"OnDisable"> {}
|
15570 | export interface IFeatureToggleEvent extends IFeatureEvents<"OnToggle"> {}
|
15571 | type TValidation = "unknown" | "fail" | "invalid" | "pass" | "await";
|
15572 |
|
15573 | export type TFeatureType = "card" | "toggle" | "static";
|
15574 |
|
15575 | export type TFeature<T extends Card<THooks>> = (pFeature: Feature<T>) => void;
|
15576 |
|
15577 | export interface IFeature<T extends Card<THooks> = Card<THooks>> {
|
15578 |
|
15579 | type: TFeatureType;
|
15580 |
|
15581 | option: boolean;
|
15582 |
|
15583 | name: string;
|
15584 |
|
15585 | card?: T;
|
15586 | }
|
15587 | export class Feature<T extends Card<THooks> = Card<THooks>> extends StrictItem<Features, TFeatureEvents, IFeature<T>> {
|
15588 | constructor(pList: Features, pFeature: IFeature<T>);
|
15589 | /** Retrieves a reference to the features. */
|
15590 | get features(): Features;
|
15591 | /** Retrieves the card. */
|
15592 | get card(): T | undefined;
|
15593 | /** Retrieves a reference to the feature element. */
|
15594 | get element(): Element | undefined;
|
15595 | /** Retrieves the feature type. */
|
15596 | get type(): TFeatureType;
|
15597 | /** Retrieves if the feature is visible. */
|
15598 | get isVisible(): boolean;
|
15599 | /** Specifies if the feature is visible. */
|
15600 | set isVisible(bVisible: boolean);
|
15601 | /** Retrieves if the feature is locked. */
|
15602 | get isLocked(): boolean;
|
15603 | /** Specifies if the feature is locked. */
|
15604 | set isLocked(bLocked: boolean);
|
15605 | /** Retrieves if the feature is disabled. */
|
15606 | get isDisabled(): boolean;
|
15607 | /** Specifies if the feature is disabled. */
|
15608 | set isDisabled(bDisabled: boolean);
|
15609 | /** Retrieves if the feature is activated. */
|
15610 | get isActivated(): boolean;
|
15611 | /** Specifies if the feature is activated. */
|
15612 | set isActivated(bActivated: boolean);
|
15613 | /** Retrieves the validation state of the feature. */
|
15614 | get validation(): TValidation;
|
15615 | /** Sets the validation state of the feature. */
|
15616 | set validation(sValidation: TValidation);
|
15617 | /** Retrieves if the feature validation is invalid. */
|
15618 | get isInvalid(): boolean;
|
15619 | /** Specifies if the feature validation is invalid. */
|
15620 | set isInvalid(bInvalid: boolean);
|
15621 | /** Retrieves if the feature validation has passed. */
|
15622 | get isPassed(): boolean;
|
15623 | /** Specifies if the feature validation has passed. */
|
15624 | set isPassed(bPassed: boolean);
|
15625 | /** Retrieves if the feature validation has failed. */
|
15626 | get isFailed(): boolean;
|
15627 | /** Specifies if the feature validation has failed. */
|
15628 | set isFailed(bFailed: boolean);
|
15629 | /** Retrieves if the feature validation is awaiting. */
|
15630 | get isAwaiting(): boolean;
|
15631 | /** Specifies if the feature validation is awaiting. */
|
15632 | set isAwaiting(bAwaiting: boolean);
|
15633 | /** Retrieves the feature name. */
|
15634 | get name(): string;
|
15635 | /** Sets the name of the feature. */
|
15636 | set name(sName: string);
|
15637 |
|
15638 | /**
|
15639 | * Draws a feature.
|
15640 | * @param pElement Element to draw to.
|
15641 | */
|
15642 | draw(pElement: Element | undefined): void;
|
15643 | /**
|
15644 | * Attaches an `OnVisible` function to the feature. This function is invoked
|
15645 | * when the visibility of the feature changes.
|
15646 | * @param fnVisible Specifies the callback function.
|
15647 | * @param sMode Specifies the callback mode (`synchronous` or `asynchronous`, default is `synchronous`).
|
15648 | * @return Returns a reference to the feature to allow chaining.
|
15649 | */
|
15650 | onVisible(fnVisible: TFeature<T>, sMode?: "synchronous" | "asynchronous"): this;
|
15651 | /**
|
15652 | * Attaches an `OnToggle` function to the feature. This function is invoked
|
15653 | * when the toggle state of the feature changes.
|
15654 | * @param fnState Specifies the callback function.
|
15655 | * @param sMode Specifies the callback mode (`synchronous` or `asynchronous`, default is `synchronous`).
|
15656 | * @return Returns a reference to the feature to allow chaining.
|
15657 | */
|
15658 | onToggle(fnState: TFeature<T>, sMode?: "synchronous" | "asynchronous"): this;
|
15659 | /**
|
15660 | * Attaches an `OnLock` function to the feature. This function is invoked
|
15661 | * when the lock state of the feature changes.
|
15662 | * @param fnLock Specifies the callback function.
|
15663 | * @param sMode Specifies the callback mode (`synchronous` or `asynchronous`, default is `synchronous`).
|
15664 | * @return Returns a reference to the feature to allow chaining.
|
15665 | */
|
15666 | onLock(fnLock: TFeature<T>, sMode?: "synchronous" | "asynchronous"): this;
|
15667 | /**
|
15668 | * Attaches an `OnDisable` function to the feature. This function is invoked
|
15669 | * when the disabled state of the feature changes.
|
15670 | * @param fnDisable Specifies the callback function.
|
15671 | * @param sMode Specifies the callback mode (`synchronous` or `asynchronous`, default is `synchronous`).
|
15672 | * @return Returns a reference to the feature to allow chaining.
|
15673 | */
|
15674 | onDisable(fnDisable: TFeature<T>, sMode?: "synchronous" | "asynchronous"): this;
|
15675 | /**
|
15676 | * Sets the feature visibility.
|
15677 | * @param bVisible Specifies if the feature is visible.
|
15678 | * @return Returns a reference to the feature to allow chaining.
|
15679 | */
|
15680 | visible(bVisible?: boolean): this;
|
15681 | /**
|
15682 | * Shows the feature.
|
15683 | * @return Returns a reference to the feature to allow chaining.
|
15684 | */
|
15685 | show(): this;
|
15686 | /**
|
15687 | * Hides the feature.
|
15688 | * @return Returns a reference to the feature to allow chaining.
|
15689 | */
|
15690 | hide(): this;
|
15691 | /**
|
15692 | * Sets the feature locking state.
|
15693 | * @param bLocked Specifies if the feature is locked.
|
15694 | * @return Returns a reference to the feature to allow chaining.
|
15695 | */
|
15696 | locked(bLocked?: boolean): this;
|
15697 | /**
|
15698 | * Locks the feature.
|
15699 | * @return Returns a reference to the feature to allow chaining.
|
15700 | */
|
15701 | lock(): this;
|
15702 | /**
|
15703 | * Unlocks the feature.
|
15704 | * @return Returns a reference to the feature to allow chaining.
|
15705 | */
|
15706 | unlock(): this;
|
15707 | /**
|
15708 | * Sets the feature disabled state.
|
15709 | * @param bDisabled Specifies if the feature is disabled.
|
15710 | * @return Returns a reference to the feature to allow chaining.
|
15711 | */
|
15712 | disabled(bDisabled?: boolean): this;
|
15713 | /**
|
15714 | * Disables the feature.
|
15715 | * @return Returns a reference to the feature to allow chaining.
|
15716 | */
|
15717 | disable(): this;
|
15718 | /**
|
15719 | * Enables the feature.
|
15720 | * @return Returns a reference to the feature to allow chaining.
|
15721 | */
|
15722 | enable(): this;
|
15723 | /**
|
15724 | * Sets the feature state.
|
15725 | * @param bActivated Specifies if the feature is activated.
|
15726 | * @return Returns a reference to the feature to allow chaining.
|
15727 | */
|
15728 | activated(bActivated?: boolean): this;
|
15729 | /**
|
15730 | * Activates the feature.
|
15731 | * @return Returns a reference to the feature to allow chaining.
|
15732 | */
|
15733 | activate(): this;
|
15734 | /**
|
15735 | * Deactivate the feature.
|
15736 | * @return Returns a reference to the feature to allow chaining.
|
15737 | */
|
15738 | deactivate(): this;
|
15739 | /**
|
15740 | * Applies styles to the feature.
|
15741 | * @param pStyle Specifies the styles.
|
15742 | */
|
15743 | style(pStyle: IStyles): this;
|
15744 | /**
|
15745 | * Sets focus to the feature.
|
15746 | * @return Returns `true` if the feature gained focus.
|
15747 | */
|
15748 | focus(): boolean;
|
15749 | /** Scrolls the feature into view. */
|
15750 | scrollIntoView(): void;
|
15751 | }
|
15752 | export type TCardEvents =
|
15753 | | "OnReady"
|
15754 | | "OnMode"
|
15755 | | "OnActivate"
|
15756 | | "OnDeactivate"
|
15757 | | "OnShow"
|
15758 | | "OnHide"
|
15759 | | "OnValidated"
|
15760 | | "OnResize"
|
15761 | | "OnResized"
|
15762 | | "OnDestroy";
|
15763 | export interface ICardEvents<Hook extends THooks> extends IHookPayload<Hook> {
|
15764 | readonly card: Card<THooks>;
|
15765 | }
|
15766 | export interface ICardReadyEvent extends ICardEvents<"OnReady"> {}
|
15767 | export interface ICardModeEvent extends ICardEvents<"OnMode"> {}
|
15768 | export interface ICardActivateEvent extends ICardEvents<"OnActivate"> {}
|
15769 | export interface ICardDeactivateEvent extends ICardEvents<"OnDeactivate"> {}
|
15770 | export interface ICardShowEvent extends ICardEvents<"OnShow"> {}
|
15771 | export interface ICardHideEvent extends ICardEvents<"OnHide"> {}
|
15772 | export interface ICardValidatedEvent extends ICardEvents<"OnValidated"> {}
|
15773 | export interface ICardResizeEvent extends ICardEvents<"OnResize"> {}
|
15774 | export interface ICardResizedEvent extends ICardEvents<"OnResized"> {}
|
15775 | export interface ICardDestroyEvent extends ICardEvents<"OnDestroy"> {}
|
15776 | const enum Mode {
|
15777 | Normal = 1,
|
15778 | Compact = 2,
|
15779 | Both = 3,
|
15780 | }
|
15781 | export abstract class Card<T extends THooks = void> extends Item<TCardEvents | T> {
|
15782 | |
15783 |
|
15784 |
|
15785 |
|
15786 | constructor(nModes?: Mode);
|
15787 |
|
15788 | /** Retrieves a reference to the cards. */
|
15789 | get cards(): Cards<THooks> | undefined;
|
15790 | /** Retrieves a reference to the feature. */
|
15791 | get feature(): Feature | undefined;
|
15792 | /** Sets the feature reference. */
|
15793 | set feature(pFeature: Feature | undefined);
|
15794 | /** Retrieves a reference to the stylesheet. */
|
15795 | get stylesheet(): Stylesheet;
|
15796 | /** Retrieves a reference to the card element. */
|
15797 | get element(): Element | undefined;
|
15798 | /** Retrieves a reference to the card context. */
|
15799 | get context(): Element | undefined;
|
15800 | /** Returns the position of the card. */
|
15801 | get position(): number;
|
15802 | /** Returns the tail for the card. */
|
15803 | get tail(): number;
|
15804 | /** Retrieves the supported modes for the card. */
|
15805 | get modes(): Mode;
|
15806 | /** Retrieves the mode. */
|
15807 | get mode(): Mode;
|
15808 | /** Retrieves if the normal mode is active. */
|
15809 | get isModeNormal(): boolean;
|
15810 | /** Retrieves if the compact mode is active. */
|
15811 | get isModeCompact(): boolean;
|
15812 | /** Retrieves if the card is drawn. */
|
15813 | get isDrawn(): boolean;
|
15814 | /** Retrieves if the card is initialized. */
|
15815 | get isInitialized(): boolean;
|
15816 | /** Retrieves if the card is ready. */
|
15817 | get isReady(): boolean;
|
15818 | /** Retrieves if the card is measured. */
|
15819 | get isMeasured(): boolean;
|
15820 | /** Retrieves if the card is measurable. */
|
15821 | get isMeasurable(): boolean;
|
15822 | /** Retrieves if the card is observable. */
|
15823 | get isObservable(): boolean;
|
15824 | /** Retrieves if this card is the first observable card. */
|
15825 | get isFirstObservable(): boolean;
|
15826 | /** Retrieves if this card is the first observable card. */
|
15827 | get isLastObservable(): boolean;
|
15828 | /** Retrieves if the card is activated. */
|
15829 | get isActivated(): boolean;
|
15830 | /** Retrieves if the card is visible. */
|
15831 | get isVisible(): boolean;
|
15832 | /** Specifies if the card is visible. */
|
15833 | set isVisible(bVisible: boolean);
|
15834 | /** Retrieves if the card is empty (has no visible content). */
|
15835 | get isEmpty(): boolean;
|
15836 | /** Specifies if the card is empty. */
|
15837 | set isEmpty(bEmpty: boolean);
|
15838 | /** Retrieves the validation state of the card. */
|
15839 | get validation(): TValidation;
|
15840 | /** Retrieves if the card validation has passed. */
|
15841 | get isPassed(): boolean;
|
15842 | /** Retrieves if the card validation is invalid. */
|
15843 | get isInvalid(): boolean;
|
15844 | /** Retrieves if the card validation has failed. */
|
15845 | get isFailed(): boolean;
|
15846 | /** Retrieves if the card validation is awaiting. */
|
15847 | get isAwaiting(): boolean;
|
15848 |
|
15849 | /**
|
15850 | * Draws the card.
|
15851 | * @param pContext Reference to the element to draw to.
|
15852 | * @event
|
15853 | */
|
15854 | protected abstract onDraw(pContext: Element): void;
|
15855 | /**
|
15856 | * Invoked when the card is shown.
|
15857 | * @event
|
15858 | */
|
15859 | protected onShow(): void;
|
15860 | /**
|
15861 | * Invoked when the card is hidden.
|
15862 | * @event
|
15863 | */
|
15864 | protected onHide(): void;
|
15865 | /**
|
15866 | * Invoked when the card is activated.
|
15867 | * @event
|
15868 | */
|
15869 | protected onActivate(): void;
|
15870 | /**
|
15871 | * Invoked when the card is deactivated.
|
15872 | * @event
|
15873 | */
|
15874 | protected onDeactivate(): void;
|
15875 | /**
|
15876 | * Invoked when the card is destroyed.
|
15877 | * @event
|
15878 | */
|
15879 | protected onDestroy(): void;
|
15880 | /**
|
15881 | * Invoked when the card is measured. A measure correction in pixels can
|
15882 | * be supplied in the return value.
|
15883 | * @return Returns the measure correction for the card.
|
15884 | * @event
|
15885 | */
|
15886 | protected onMeasure(): number;
|
15887 | /**
|
15888 | * Invoked when the card layer is resized.
|
15889 | * @event
|
15890 | */
|
15891 | protected onResize(): void;
|
15892 | /**
|
15893 | * Invoked when the card itself is resized.
|
15894 | * @event
|
15895 | */
|
15896 | protected onResized(): void;
|
15897 | /**
|
15898 | * Invoked when the card needs to be validated.
|
15899 | * @param pCallback Reference to the callback. Pass this object as return
|
15900 | * value to enable the asynchronous validation callback.
|
15901 | * @return Returns the validation state.
|
15902 | * @event
|
15903 | */
|
15904 | protected onValidate(pCallback: Callback<TValidation>): TValidation | Callback<TValidation>;
|
15905 | /**
|
15906 | * Invoked when the card is validated.
|
15907 | * @event
|
15908 | */
|
15909 | protected onValidated(): void;
|
15910 | /**
|
15911 | * Invoked when the card is ready.
|
15912 | * @event
|
15913 | */
|
15914 | protected onReady(): void;
|
15915 | /**
|
15916 | * Invoked when the card is initialized.
|
15917 | * @return Returns the initialization state. If `true` is returned this
|
15918 | * indicates the card is initialized. If you return `false` the system waits
|
15919 | * for a call to the `Initialized` method.
|
15920 | * @event
|
15921 | */
|
15922 | onInit(): boolean;
|
15923 | /**
|
15924 | * Invoked when the mode of the card is changed.
|
15925 | * @event
|
15926 | */
|
15927 | onMode(): void;
|
15928 | /**
|
15929 | * Invoked when the card receives a focus request.
|
15930 | * @return Returns `true` if the card accepted the focus request.
|
15931 | * @event
|
15932 | */
|
15933 | onRequestFocus(): boolean;
|
15934 | /**
|
15935 | * Invoked when the card receives an auto-focus request.
|
15936 | * @return Returns `true` if the card accepted the auto-focus request.
|
15937 | */
|
15938 | onRequestAutoFocus(): boolean;
|
15939 | /**
|
15940 | * Invoked when a card is popped.
|
15941 | * @param pEvent Contains the event information.
|
15942 | * @event
|
15943 | */
|
15944 | onPop(pEvent: IItemPopEvent<Card<T>>): void;
|
15945 | /** Marks the card as initialized. */
|
15946 | initialized(): void;
|
15947 | /**
|
15948 | * Measures the size of the card.
|
15949 | * @param nSize Specifies the size.
|
15950 | * @return Returns `true` if the size is changed.
|
15951 | */
|
15952 | measure(nSize?: number): boolean;
|
15953 | /** Card is measured. */
|
15954 | measured(): void;
|
15955 | /** Resizes the card. */
|
15956 | resize(): void;
|
15957 | /** Marks the card as ready. */
|
15958 | ready(): void;
|
15959 | /**
|
15960 | * Activates the card.
|
15961 | * @param pCards Reference to the cards stack.
|
15962 | * @param bScrollIntoView Specifies if the card should scroll into view.
|
15963 | */
|
15964 | activate(pCards: Cards<THooks>, bScrollIntoView?: boolean): this;
|
15965 | /** Deactivates the card. */
|
15966 | deactivate(): this;
|
15967 | /** Shows the card. */
|
15968 | show(): this;
|
15969 | /** Hides the card. */
|
15970 | hide(): this;
|
15971 | /** Shows or hides the card. */
|
15972 | visible(bVisible: boolean, bScrollIntoView?: boolean): this;
|
15973 | /** Validates the card. */
|
15974 | validate(): this;
|
15975 | /**
|
15976 | * Captures focus to the card.
|
15977 | * @param sTo Specifies if the focus is set to the first or last item in
|
15978 | * the card.
|
15979 | * @return Returns `true` if the focus is captured.
|
15980 | */
|
15981 | focus(sTo?: "first" | "last"): boolean;
|
15982 | /** Scrolls the card (or an specific element of the card) into view. */
|
15983 | scrollIntoView(pElement?: Element, bOnlyWhenInvisible?: boolean): this;
|
15984 | /** Destroys the card. */
|
15985 | destroy(): void;
|
15986 | }
|
15987 | /** Describes the card style. */
|
15988 | export interface ICardStyle {
|
15989 |
|
15990 | appearance?: IStyles;
|
15991 |
|
15992 | spacing?: {
|
15993 |
|
15994 | top?: number;
|
15995 |
|
15996 | between?: number;
|
15997 |
|
15998 | bottom?: number;
|
15999 |
|
16000 | left?: number;
|
16001 |
|
16002 | right?: number;
|
16003 | };
|
16004 |
|
16005 | normal?: IStyles;
|
16006 |
|
16007 | compact?: IStyles;
|
16008 |
|
16009 | passed?: IStyles;
|
16010 |
|
16011 | failed?: IStyles;
|
16012 |
|
16013 | awaiting?: IStyles;
|
16014 |
|
16015 | animations?: {
|
16016 |
|
16017 | shift?: IStyles;
|
16018 |
|
16019 | activate?: IStyles;
|
16020 |
|
16021 | activateDelay?: number;
|
16022 |
|
16023 | deactivate?: IStyles;
|
16024 |
|
16025 | deactivateDelay?: number;
|
16026 | };
|
16027 | }
|
16028 |
|
16029 | export interface ICardsStyle {
|
16030 |
|
16031 | spacing?: Spacing;
|
16032 |
|
16033 | appearance?: IStyles;
|
16034 |
|
16035 | features?: IFeaturesStyle;
|
16036 |
|
16037 | cards?: ICardStyle;
|
16038 |
|
16039 | scrollbars?: IScrollbarsStyle;
|
16040 |
|
16041 | bounce?: "no" | "yes" | "always";
|
16042 |
|
16043 | blink?: boolean;
|
16044 | }
|
16045 |
|
16046 | export interface ICardsProperties {
|
16047 | |
16048 |
|
16049 |
|
16050 |
|
16051 | stylesheet?: Stylesheet;
|
16052 |
|
16053 | style?: ICardsStyle;
|
16054 |
|
16055 | layer?: Layer;
|
16056 |
|
16057 | mode?: "normal" | "compact" | Mode;
|
16058 | }
|
16059 | export type TCardsEvents =
|
16060 | | "OnMode"
|
16061 | | "OnValidated"
|
16062 | | "OnDestroy"
|
16063 | | "OnCardActivate"
|
16064 | | "OnCardDeactivate"
|
16065 | | "OnCardShow"
|
16066 | | "OnCardHide"
|
16067 | | "OnCardDestroy";
|
16068 | export interface ICardsEvents<Hook extends THooks> extends IHookPayload<Hook> {
|
16069 | readonly cards: Cards<THooks>;
|
16070 | }
|
16071 | export interface ICardEvents<Hook extends THooks> extends ICardsEvents<Hook> {
|
16072 | readonly card: Card<THooks>;
|
16073 | }
|
16074 | export interface ICardsModeEvent extends ICardsEvents<"OnMode"> {}
|
16075 | export interface ICardsValidatedEvent extends ICardsEvents<"OnValidated"> {}
|
16076 | export interface ICardsDestroyEvent extends ICardsEvents<"OnDestroy"> {}
|
16077 | export interface ICardsActivateCardEvent extends ICardEvents<"OnCardActivate"> {}
|
16078 | export interface ICardsDeactivateCardEvent extends ICardEvents<"OnCardDeactivate"> {}
|
16079 | export interface ICardsShowCardEvent extends ICardEvents<"OnCardShow"> {}
|
16080 | export interface ICardsHideCardEvent extends ICardEvents<"OnCardHide"> {}
|
16081 | export interface ICardsDestroyCardEvent extends ICardEvents<"OnCardDestroy"> {}
|
16082 | export class Cards<T extends THooks = void> extends Matrix<Card<THooks>, TCardsEvents | T> {
|
16083 |
|
16084 | static stylesheet: Stylesheet;
|
16085 |
|
16086 | static style: ICardsStyle | undefined;
|
16087 |
|
16088 |
|
16089 | static get tab(): number;
|
16090 | |
16091 |
|
16092 |
|
16093 |
|
16094 |
|
16095 |
|
16096 | constructor(...pPropertiesList: ICardsProperties[]);
|
16097 |
|
16098 | /** Retrieves a reference to the stylesheet. */
|
16099 | get stylesheet(): Stylesheet;
|
16100 | /** Retrieves a reference to the layer. */
|
16101 | get layer(): Layer;
|
16102 | /**
|
16103 | * Retrieves a reference to the features. This will automatically activate
|
16104 | * the features list when this property is requested during construction.
|
16105 | */
|
16106 | get features(): Features;
|
16107 | /** Retrieves if the socket supports features. */
|
16108 | get isFeaturesSupported(): boolean;
|
16109 | /** Retrieves the top spacing of the first card. */
|
16110 | get spacingTop(): number;
|
16111 | /** Retrieves the spacing between cards. */
|
16112 | get spacingBetween(): number;
|
16113 | /** Retrieves the bottom spacing for the last card. */
|
16114 | get spacingBottom(): number;
|
16115 | /** Retrieves the deactivate delay. */
|
16116 | get deactivateDelay(): number;
|
16117 | /** Retrieves the next tab index. */
|
16118 | get tab(): number;
|
16119 | /** Retrieves the mode. */
|
16120 | get mode(): Mode;
|
16121 | /** Sets the mode. */
|
16122 | set mode(nMode: Mode);
|
16123 | /** Retrieves if the mode is swapped. */
|
16124 | get isModeSwapping(): boolean;
|
16125 | /** Retrieves the validation state. */
|
16126 | get validation(): TValidation;
|
16127 | /** Retrieves if the validation is invalid. */
|
16128 | get isInvalid(): boolean;
|
16129 | /** Retrieves if the validation has failed. */
|
16130 | get isFailed(): boolean;
|
16131 | /** Retrieves if the validation has passed. */
|
16132 | get isPassed(): boolean;
|
16133 | /** Retrieves if the validation is awaiting. */
|
16134 | get isAwaiting(): boolean;
|
16135 | /** Retrieves if the cards are drawn. */
|
16136 | get isDrawn(): boolean;
|
16137 | /** Retrieves if the cards are ready. */
|
16138 | get isReady(): boolean;
|
16139 |
|
16140 | /**
|
16141 | * Invoked when the mode changes.
|
16142 | * @event
|
16143 | */
|
16144 | protected onMode(): void;
|
16145 | /**
|
16146 | * Invoked when the validation state changes.
|
16147 | * @event
|
16148 | */
|
16149 | protected onValidated(): void;
|
16150 | /**
|
16151 | * Invoked when the cards are destroyed.
|
16152 | * @event
|
16153 | */
|
16154 | protected onDestroy(): void;
|
16155 | /** Verifies the initialization state of the cards. */
|
16156 | initialize(): void;
|
16157 | /**
|
16158 | * Draws a card.
|
16159 | * @param pCard Reference to the card.
|
16160 | * @param fnDraw Specifies the draw function.
|
16161 | * @return Returns a reference to the element.
|
16162 | */
|
16163 | drawCard(pCard: Card<THooks>, fnDraw: (pElement: Element) => void): Element | undefined;
|
16164 | /**
|
16165 | * Adds a card.
|
16166 | * @param pCard Reference to the card.
|
16167 | * @param nIndex Specifies the index.
|
16168 | * @return Returns a reference to the card.
|
16169 | */
|
16170 | add<C extends Card<THooks>>(pCard: C, nIndex?: number): C;
|
16171 | /** Updates the cards layer. */
|
16172 | update(): void;
|
16173 | /**
|
16174 | * Validates the cards and returns the result.
|
16175 | * @return Returns the validation state of the cards.
|
16176 | */
|
16177 | validate(): TValidation;
|
16178 | /** Switches to the compact mode. */
|
16179 | switchToCompactMode(): this;
|
16180 | /** Switches to the normal mode. */
|
16181 | switchToNormalMode(): this;
|
16182 | /**
|
16183 | * Invoked when a card is activated.
|
16184 | * @param pCard Reference to the card.
|
16185 | * @event
|
16186 | */
|
16187 | onCardActivate(pCard: Card<THooks>): void;
|
16188 | /**
|
16189 | * Invoked when a card is deactivated.
|
16190 | * @param pCard Reference to the card.
|
16191 | * @event
|
16192 | */
|
16193 | onCardDeactivate(pCard: Card<THooks>): void;
|
16194 | /**
|
16195 | * Invoked when a card is shown.
|
16196 | * @param pCard Reference to the card.
|
16197 | * @event
|
16198 | */
|
16199 | onCardShow(pCard: Card<THooks>): void;
|
16200 | /**
|
16201 | * Invoked when a card is hidden.
|
16202 | * @param pCard Reference to the card.
|
16203 | * @event
|
16204 | */
|
16205 | onCardHide(pCard: Card<THooks>): void;
|
16206 | /**
|
16207 | * Invoked when a card is destroyed.
|
16208 | * @param pCard Reference to the card.
|
16209 | * @event
|
16210 | */
|
16211 | onCardDestroy(pCard: Card<THooks>): void;
|
16212 | /** Scrolls an element into view. */
|
16213 | scrollElementIntoView(pElement: Element, nSpacingTop?: number, nSpacingBottom?: number, bOnlyWhenInvisible?: boolean): void;
|
16214 | scrollCardIntoView(pCard: Card<THooks>): void;
|
16215 | /**
|
16216 | * Scrolls to the top if the scroll position is not at the top or scrolls to
|
16217 | * the bottom if the list is at the top.
|
16218 | */
|
16219 | scrollToTopOrBottom(): void;
|
16220 | /** Destroys the cards. */
|
16221 | destroy(): void;
|
16222 | }
|
16223 |
|
16224 | export { Mode as CardMode, TValidation as TCardValidation };
|
16225 | }
|
16226 |
|
16227 | declare module "tripetto/module/ui-form-button" {
|
16228 | import { Element, IStyles } from "tripetto/module/dom";
|
16229 | import { IControlStyle, StaticControl } from "tripetto/module/ui-form";
|
16230 |
|
16231 | export interface IButtonStyle extends IControlStyle {
|
16232 |
|
16233 | appearance?: IStyles;
|
16234 |
|
16235 | fused?: IStyles;
|
16236 |
|
16237 | disabled?: IStyles;
|
16238 |
|
16239 | focus?: IStyles;
|
16240 |
|
16241 | hover?: IStyles;
|
16242 |
|
16243 | tap?: IStyles;
|
16244 |
|
16245 | normal?: {
|
16246 |
|
16247 | appearance?: IStyles;
|
16248 |
|
16249 | focus?: IStyles;
|
16250 |
|
16251 | hover?: IStyles;
|
16252 |
|
16253 | tap?: IStyles;
|
16254 | };
|
16255 |
|
16256 | accept?: {
|
16257 |
|
16258 | appearance?: IStyles;
|
16259 |
|
16260 | focus?: IStyles;
|
16261 |
|
16262 | hover?: IStyles;
|
16263 |
|
16264 | tap?: IStyles;
|
16265 | };
|
16266 |
|
16267 | warning?: {
|
16268 |
|
16269 | appearance?: IStyles;
|
16270 |
|
16271 | focus?: IStyles;
|
16272 |
|
16273 | hover?: IStyles;
|
16274 |
|
16275 | tap?: IStyles;
|
16276 | };
|
16277 |
|
16278 | cancel?: {
|
16279 |
|
16280 | appearance?: IStyles;
|
16281 |
|
16282 | focus?: IStyles;
|
16283 |
|
16284 | hover?: IStyles;
|
16285 |
|
16286 | tap?: IStyles;
|
16287 | };
|
16288 | }
|
16289 | type Types = "normal" | "accept" | "warning" | "cancel";
|
16290 | export class Button extends StaticControl<IButtonStyle> {
|
16291 |
|
16292 | static style: IButtonStyle | undefined;
|
16293 |
|
16294 | |
16295 |
|
16296 |
|
16297 |
|
16298 |
|
16299 |
|
16300 | constructor(sLabel: string, sType?: Types, pStyle?: IButtonStyle);
|
16301 | /** Retrieves the static element. */
|
16302 | protected get static(): Element | undefined;
|
16303 | /** Retrieves the type. */
|
16304 | get buttonType(): Types;
|
16305 | /** Specifies the type. */
|
16306 | set buttonType(sType: Types);
|
16307 |
|
16308 | /**
|
16309 | * Draws the control.
|
16310 | * @param pForm Reference to the parent form element.
|
16311 | * @event
|
16312 | */
|
16313 | protected onDraw(pForm: Element): Element;
|
16314 | /**
|
16315 | * Updates the control.
|
16316 | * @event
|
16317 | */
|
16318 | protected onUpdate(): void;
|
16319 | /**
|
16320 | * Invoked when the enter key is pressed.
|
16321 | * @return Returns `true` to cancel key bubbling.
|
16322 | * @event
|
16323 | */
|
16324 | protected onEnter(): boolean;
|
16325 | /**
|
16326 | * Invoked when the focus state of the control is changed.
|
16327 | * @event
|
16328 | */
|
16329 | protected onFocusOptions(): void;
|
16330 | /**
|
16331 | * Sets the focus to the control.
|
16332 | * @return Returns `true` if the focus is set.
|
16333 | */
|
16334 | focus(): boolean;
|
16335 | /** Blurs the focus of the control. */
|
16336 | blur(): void;
|
16337 | /**
|
16338 | * Sets the type.
|
16339 | * @param sType Specifies the type.
|
16340 | * @return Returns a reference to the control to allow chaining.
|
16341 | */
|
16342 | type(sType: Types): this;
|
16343 | /**
|
16344 | * Sets the width of the control.
|
16345 | * @param pWidth Specifies the control width in pixels or sets the width
|
16346 | * to `auto` or `full`.
|
16347 | * @return Returns a reference to the control to allow chaining.
|
16348 | */
|
16349 | width(pWidth: number | "auto" | "full"): this;
|
16350 | /**
|
16351 | * Specifies the tap function.
|
16352 | * @param fnTap Specifies the tap function.
|
16353 | * @return Returns a reference to the control to allow chaining.
|
16354 | */
|
16355 | on(fnTap: (pButton: Button) => void): this;
|
16356 | /**
|
16357 | * Specifies an URL for the button.
|
16358 | * @param sURL Specifies the URL.
|
16359 | * @return Returns a reference to the control to allow chaining.
|
16360 | */
|
16361 | url(sLink?: string, sTarget?: "blank" | "self"): this;
|
16362 | /**
|
16363 | * Specifies a function to execute on the click of the button.
|
16364 | * @param fnAction Specifies the action function to invoke.
|
16365 | * @return Returns a reference to the control to allow chaining.
|
16366 | */
|
16367 | onClick(fnAction: (pButton: Button) => void): this;
|
16368 | }
|
16369 |
|
16370 | export { Types as ButtonTypes };
|
16371 | }
|
16372 |
|
16373 | declare module "tripetto/module/ui-form-checkbox" {
|
16374 | import { Element, IStyles } from "tripetto/module/dom";
|
16375 | import { DataControl, IControlStyle, TBinding } from "tripetto/module/ui-form";
|
16376 |
|
16377 | export interface ICheckboxStyles {
|
16378 |
|
16379 | appearance?: IStyles;
|
16380 |
|
16381 | label?: IStyles;
|
16382 |
|
16383 | description?: IStyles;
|
16384 |
|
16385 | checked?: IStyles;
|
16386 |
|
16387 | unchecked?: IStyles;
|
16388 | }
|
16389 | export interface ICheckboxStyle extends IControlStyle, ICheckboxStyles {
|
16390 |
|
16391 | disabled?: ICheckboxStyles;
|
16392 |
|
16393 | required?: ICheckboxStyles;
|
16394 |
|
16395 | locked?: ICheckboxStyles;
|
16396 |
|
16397 | focus?: ICheckboxStyles;
|
16398 |
|
16399 | hover?: ICheckboxStyles;
|
16400 |
|
16401 | passed?: ICheckboxStyles;
|
16402 |
|
16403 | failed?: ICheckboxStyles;
|
16404 |
|
16405 | awaiting?: ICheckboxStyles;
|
16406 |
|
16407 | fused?: {
|
16408 |
|
16409 | appearance?: IStyles;
|
16410 |
|
16411 | required?: IStyles;
|
16412 |
|
16413 | focus?: ICheckboxStyles;
|
16414 |
|
16415 | hover?: ICheckboxStyles;
|
16416 | };
|
16417 | }
|
16418 | export class Checkbox extends DataControl<boolean, ICheckboxStyle> {
|
16419 |
|
16420 | static style: ICheckboxStyle | undefined;
|
16421 |
|
16422 | |
16423 |
|
16424 |
|
16425 |
|
16426 |
|
16427 |
|
16428 | constructor(sLabel: string, bChecked?: TBinding<boolean>, pStyle?: ICheckboxStyle);
|
16429 | /** Retrieves the static element. */
|
16430 | protected get static(): Element | undefined;
|
16431 | /** Retrieves if the checkbox is checked. */
|
16432 | get isChecked(): boolean;
|
16433 | /** Sets the checkbox state. */
|
16434 | set isChecked(bChecked: boolean);
|
16435 | /**
|
16436 | * Draws the control.
|
16437 | * @param pForm Reference to the parent form element.
|
16438 | * @event
|
16439 | */
|
16440 | protected onDraw(pForm: Element): Element;
|
16441 | /**
|
16442 | * Updates the control.
|
16443 | * @event
|
16444 | */
|
16445 | protected onUpdate(): void;
|
16446 | /**
|
16447 | * Invoked when the enter key is pressed.
|
16448 | * @return Returns `true` to cancel key bubbling.
|
16449 | * @event
|
16450 | */
|
16451 | protected onEnter(): boolean;
|
16452 | /**
|
16453 | * Invoked when the focus state of the control is changed.
|
16454 | * @event
|
16455 | */
|
16456 | protected onFocusOptions(): void;
|
16457 | /**
|
16458 | * Invoked when the state of the checkbox changes.
|
16459 | * @event
|
16460 | */
|
16461 | protected onData(): void;
|
16462 | /**
|
16463 | * Sets the checked state of the checkbox.
|
16464 | * @param bChecked Specifies the state.
|
16465 | */
|
16466 | checked(bChecked?: boolean): this;
|
16467 | /** Checks the checkbox. */
|
16468 | check(): this;
|
16469 | /** Unchecks the checkbox. */
|
16470 | uncheck(): this;
|
16471 | /** Toggles the checkbox. */
|
16472 | toggle(): this;
|
16473 | /**
|
16474 | * Sets the focus to the checkbox.
|
16475 | * @return Returns `true` if the focus is set.
|
16476 | */
|
16477 | focus(): boolean;
|
16478 | /** Blurs the focus of the checkbox. */
|
16479 | blur(): void;
|
16480 | /**
|
16481 | * Sets a description for a checkbox.
|
16482 | * @param sDescription Specifies the description string.
|
16483 | * @return Returns a reference to the control to allow chaining.
|
16484 | */
|
16485 | description(sDescription: string): this;
|
16486 | /**
|
16487 | * Sets the width of the control.
|
16488 | * @param Width Specifies the control width in pixels.
|
16489 | * @return Returns a reference to the control to allow chaining.
|
16490 | */
|
16491 | width(pWidth: number): this;
|
16492 | /**
|
16493 | * Specifies the function which is invoked when the checkbox is toggled.
|
16494 | * @param fnToggle Specifies the toggle function.
|
16495 | * @return Returns a reference to the control to allow chaining.
|
16496 | */
|
16497 | on(fnToggle: (pCheckbox: Checkbox) => void): this;
|
16498 | }
|
16499 | }
|
16500 |
|
16501 | declare module "tripetto/module/ui-form" {
|
16502 | import { Callback } from "tripetto/module/callback";
|
16503 | import { Element, IStyles, Stylesheet } from "tripetto/module/dom";
|
16504 | import { TAny } from "tripetto/module/functional";
|
16505 | import { Hooks, IHookPayload, THooks } from "tripetto/module/hookup";
|
16506 | import { IMarkdownOptions } from "tripetto/module/markdown";
|
16507 | import { IKeyboardEvent } from "tripetto/module/touch-keyboard";
|
16508 | import { Card, CardMode, Feature, TCardValidation } from "tripetto/module/ui-cards";
|
16509 |
|
16510 |
|
16511 | export interface IControlStyle {}
|
16512 | export interface IControlProperties<Style extends IControlStyle> {
|
16513 |
|
16514 | style?: Style;
|
16515 |
|
16516 | styleName?: string;
|
16517 |
|
16518 | styleDefault?: Style;
|
16519 |
|
16520 | label?: string;
|
16521 | }
|
16522 | export type TControlEvents =
|
16523 | | "OnExecute"
|
16524 | | "OnChange"
|
16525 | | "OnHover"
|
16526 | | "OnFocus"
|
16527 | | "OnFocusOptions"
|
16528 | | "OnAutoFocus"
|
16529 | | "OnBlur"
|
16530 | | "OnResized"
|
16531 | | "OnFormResize"
|
16532 | | "OnFormActivate"
|
16533 | | "OnFormDeactivate"
|
16534 | | "OnFormEnable"
|
16535 | | "OnFormDisable"
|
16536 | | "OnShow"
|
16537 | | "OnHide"
|
16538 | | "OnEnable"
|
16539 | | "OnDisable"
|
16540 | | "OnRequire"
|
16541 | | "OnOptional"
|
16542 | | "OnLock"
|
16543 | | "OnUnlock"
|
16544 | | "OnMode"
|
16545 | | "OnEnter"
|
16546 | | "OnEscape"
|
16547 | | "OnValidate";
|
16548 | export interface IControlEvents<Hook extends THooks, T extends Control> extends IHookPayload<Hook> {
|
16549 | readonly control: T;
|
16550 | }
|
16551 | export interface IControlExecuteEvent<T extends Control> extends IControlEvents<"OnExecute", T> {}
|
16552 | export interface IControlHoverEvent<T extends Control> extends IControlEvents<"OnHover", T> {}
|
16553 | export interface IControlFocusEvent<T extends Control> extends IControlEvents<"OnFocus", T> {}
|
16554 | export interface IControlAutoFocusEvent<T extends Control> extends IControlEvents<"OnAutoFocus", T> {}
|
16555 | export interface IControlBlurEvent<T extends Control> extends IControlEvents<"OnBlur", T> {}
|
16556 | export interface IControlResizedEvent<T extends Control> extends IControlEvents<"OnResized", T> {}
|
16557 | export interface IControlShowEvent<T extends Control> extends IControlEvents<"OnShow", T> {}
|
16558 | export interface IControlHideEvent<T extends Control> extends IControlEvents<"OnHide", T> {}
|
16559 | export interface IControlEnableEvent<T extends Control> extends IControlEvents<"OnEnable", T> {}
|
16560 | export interface IControlDisableEvent<T extends Control> extends IControlEvents<"OnDisable", T> {}
|
16561 | export interface IControlRequireEvent<T extends Control> extends IControlEvents<"OnRequire", T> {}
|
16562 | export interface IControlOptionalEvent<T extends Control> extends IControlEvents<"OnOptional", T> {}
|
16563 | export interface IControlLockEvent<T extends Control> extends IControlEvents<"OnLock", T> {}
|
16564 | export interface IControlUnlockEvent<T extends Control> extends IControlEvents<"OnUnlock", T> {}
|
16565 | export interface IControlModeEvent<T extends Control> extends IControlEvents<"OnMode", T> {}
|
16566 | export interface IControlEnterEvent<T extends Control> extends IControlEvents<"OnEnter", T> {}
|
16567 | export interface IControlEscapeEvent<T extends Control> extends IControlEvents<"OnEscape", T> {}
|
16568 | export interface IControlValidateEvent<T extends Control> extends IControlEvents<"OnValidate", T> {}
|
16569 | export type TControlChange = "visible" | "disabled" | "required" | "locked" | "focus" | "hover" | "validation";
|
16570 | export type TControlValidationType =
|
16571 | | "initial"
|
16572 | | "revalidate"
|
16573 | | "data"
|
16574 | | "visible"
|
16575 | | "disabled"
|
16576 | | "required"
|
16577 | | "locked"
|
16578 | | "focus"
|
16579 | | "blur";
|
16580 | export type TControlValidation<T extends Control = Control> = (
|
16581 | pControl: T,
|
16582 | sType: TControlValidationType,
|
16583 | pCallback: Callback<TCardValidation>
|
16584 | ) => TCardValidation | Callback<TCardValidation>;
|
16585 | export abstract class Control<Style extends IControlStyle = IControlStyle, H extends THooks = THooks> extends Hooks<
|
16586 | TControlEvents | H
|
16587 | > {
|
16588 | |
16589 |
|
16590 |
|
16591 |
|
16592 | constructor(pProperties: IControlProperties<Style>);
|
16593 | /** Retrieves a reference to the parent element. */
|
16594 | protected get parent(): Element | undefined;
|
16595 | /** Returns a reference to the control element. */
|
16596 | protected get element(): Element | undefined;
|
16597 | /** Retrieves the static element. */
|
16598 | protected get static(): Element | undefined;
|
16599 | /** Retrieves if the control is the only control in the form. */
|
16600 | protected get isSingleControlInForm(): boolean;
|
16601 | /**
|
16602 | * Retrieves if the control is fused with the form card. This is only
|
16603 | * possible with controls which have no separate label and are the one and
|
16604 | * only control inside of the form.
|
16605 | */
|
16606 | get isFused(): boolean;
|
16607 | /** Retrieves the parent form. */
|
16608 | get form(): Form | undefined;
|
16609 | /** Sets the parent form. */
|
16610 | set form(pForm: Form | undefined);
|
16611 | /** Retrieves if the form is ready. */
|
16612 | get isFormReady(): boolean;
|
16613 | /** Retrieves if the form is enabled. */
|
16614 | get isFormEnabled(): boolean;
|
16615 | /** Retrieves if the form is visible. */
|
16616 | get isFormVisible(): boolean;
|
16617 | /** Retrieves if the form group is visible. */
|
16618 | get isGroupVisible(): boolean;
|
16619 | /** Retrieves the control reference. */
|
16620 | get ref(): string | undefined;
|
16621 | /** Retrieves a reference to the feature of the form card. */
|
16622 | get feature(): Feature | undefined;
|
16623 | /** Retrieves if the control is attached to an enabled feature. */
|
16624 | get isFeatureEnabled(): boolean;
|
16625 | /** Retrieves if a label is set. */
|
16626 | get hasLabel(): boolean;
|
16627 | /** Retrieves the stylesheet for the control. */
|
16628 | get stylesheet(): Stylesheet;
|
16629 | /** Retrieves the control style. */
|
16630 | get style(): Style | undefined;
|
16631 | /** Retrieves the supported modes for the control. */
|
16632 | get modes(): CardMode;
|
16633 | /** Retrieves the tab index for the control. */
|
16634 | get tab(): number;
|
16635 | /** Retrieves if the control is visible. */
|
16636 | get isVisible(): boolean;
|
16637 | /** Sets the visibility of the control. */
|
16638 | set isVisible(bVisible: boolean);
|
16639 | /** Retrieves if the control is disabled. */
|
16640 | get isDisabled(): boolean;
|
16641 | /** Specifies if the control is disabled. */
|
16642 | set isDisabled(bDisabled: boolean);
|
16643 | /** Retrieves if the control is locked (readonly). */
|
16644 | get isLocked(): boolean;
|
16645 | /** Specifies if the control is locked (readonly). */
|
16646 | set isLocked(bLocked: boolean);
|
16647 | /** Retrieves if the control is required. */
|
16648 | get isRequired(): boolean;
|
16649 | /** Specifies if the control is required. */
|
16650 | set isRequired(bRequired: boolean);
|
16651 | /** Retrieves if the control is interactable. */
|
16652 | get isInteractable(): boolean;
|
16653 | /** Retrieves if the control is observable. */
|
16654 | get isObservable(): boolean;
|
16655 | /** Specifies it the control value is readable. */
|
16656 | get isReadable(): boolean;
|
16657 | /** Retrieves if the control is hovered. */
|
16658 | get isHovered(): boolean;
|
16659 | /** Retrieves if the control has input focus. */
|
16660 | get hasFocus(): boolean;
|
16661 | /** Retrieves the validation state of the control. */
|
16662 | get validation(): TCardValidation;
|
16663 | /** Sets the validation state of the control. */
|
16664 | set validation(sValidation: TCardValidation);
|
16665 | /** Retrieves if the control validation has passed. */
|
16666 | get isPassed(): boolean;
|
16667 | /** Specifies if the control validation has passed. */
|
16668 | set isPassed(bPassed: boolean);
|
16669 | /** Retrieves if the control validation is invalid. */
|
16670 | get isInvalid(): boolean;
|
16671 | /** Specifies if the control validation is invalid. */
|
16672 | set isInvalid(bInvalid: boolean);
|
16673 | /** Retrieves if the control validation has failed. */
|
16674 | get isFailed(): boolean;
|
16675 | /** Specifies if the control validation has failed. */
|
16676 | set isFailed(bFailed: boolean);
|
16677 | /** Retrieves if the control validation is awaiting. */
|
16678 | get isAwaiting(): boolean;
|
16679 | /** Specifies if the control validation is awaiting. */
|
16680 | set isAwaiting(bAwaiting: boolean);
|
16681 |
|
16682 | /**
|
16683 | * Updates the control state.
|
16684 | * @param sChange Specifies what is changed.
|
16685 | */
|
16686 | protected updateControl(sChange: TControlChange): void;
|
16687 | /**
|
16688 | * Updates the focus state of a control.
|
16689 | * @param bFocus Specifies if the control has captured focus.
|
16690 | * @param bAutoBlur Specifies if the auto-blur should be used.
|
16691 | * @param pVirtual Specifies the virtual focus subject.
|
16692 | * @param pPhysical Specifies the physical focus subject.
|
16693 | */
|
16694 | protected updateFocus(bFocus: boolean, bAutoBlur: boolean, pVirtual?: Element, pPhysical?: Element): void;
|
16695 | /**
|
16696 | * Sets the hover state.
|
16697 | * @param bHover Specifies if the hover is active.
|
16698 | */
|
16699 | protected hover(bHover: boolean): void;
|
16700 | /**
|
16701 | * Attach keyboard events to the control.
|
16702 | * @param pElement Reference to the element to bind the events to.
|
16703 | * @param fnEnter Specifies the function which is invoked when an enter is detected.
|
16704 | * @param bEnterOverride Overrides the default enter behavior from an element (for example the textarea).
|
16705 | * @param fnKeyPress Invoked when a key is pressed.
|
16706 | */
|
16707 | protected keyboard(
|
16708 | pElement: Element,
|
16709 | fnEnter?: () => boolean,
|
16710 | bEnterOverride?: boolean,
|
16711 | fnKeyPress?: (pKeyboardEvent: IKeyboardEvent) => boolean
|
16712 | ): void;
|
16713 | /** Marks the control as initialized. */
|
16714 | protected initialized(): void;
|
16715 | /**
|
16716 | * Invoked when the control should be drawn.
|
16717 | * @param pParent Reference to the parent form element.
|
16718 | * @return Returns a reference to the control element.
|
16719 | * @event
|
16720 | */
|
16721 | protected abstract onDraw(pParent: Element): Element;
|
16722 | /**
|
16723 | * Invoked when the control needs to be updated.
|
16724 | * @event
|
16725 | */
|
16726 | protected onUpdate(): void;
|
16727 | /**
|
16728 | * Invoked when the control is executed.
|
16729 | * @event
|
16730 | */
|
16731 | protected onExecute(): void;
|
16732 | /**
|
16733 | * Invoked when the control changed.
|
16734 | * @event
|
16735 | */
|
16736 | protected onChange(sChange: TControlChange): void;
|
16737 | /**
|
16738 | * Invoked when the control is hovered.
|
16739 | * @event
|
16740 | */
|
16741 | protected onHover(): void;
|
16742 | /**
|
16743 | * Invoked when the control captures focus.
|
16744 | * @param bAutoFocus Specifies if an auto-focus was active.
|
16745 | * @event
|
16746 | */
|
16747 | protected onFocus(bAutoFocus: boolean): void;
|
16748 | /**
|
16749 | * Invoked when the focus state of the control is changed.
|
16750 | * @event
|
16751 | */
|
16752 | protected onFocusOptions(): void;
|
16753 | /**
|
16754 | * Invoked when the control loses focus.
|
16755 | * @event
|
16756 | */
|
16757 | protected onBlur(): void;
|
16758 | /**
|
16759 | * Invoked when the enter (return) key is pressed.
|
16760 | * @param pElement Reference to the element.
|
16761 | * @return Return `true` if you want to cancel key bubbling.
|
16762 | * @event
|
16763 | */
|
16764 | protected onEnter(pElement: Element): boolean;
|
16765 | /**
|
16766 | * Invoked when the escape key is pressed.
|
16767 | * @param pElement Reference to the element.
|
16768 | * @return Return `true` if you want to cancel key bubbling.
|
16769 | * @event
|
16770 | */
|
16771 | protected onEscape(pElement: Element): boolean;
|
16772 | /**
|
16773 | * Invoked when the control is enabled.
|
16774 | * @event
|
16775 | */
|
16776 | protected onEnable(): void;
|
16777 | /**
|
16778 | * Invoked when the control is disabled.
|
16779 | * @event
|
16780 | */
|
16781 | protected onDisable(): void;
|
16782 | /**
|
16783 | * Invoked when the control is required.
|
16784 | * @event
|
16785 | */
|
16786 | protected onRequire(): void;
|
16787 | /**
|
16788 | * Invoked when the control is optional.
|
16789 | * @event
|
16790 | */
|
16791 | protected onOptional(): void;
|
16792 | /**
|
16793 | * Invoked when the control is locked.
|
16794 | * @event
|
16795 | */
|
16796 | protected onLock(): void;
|
16797 | /**
|
16798 | * Invoked when the control is unlocked.
|
16799 | * @event
|
16800 | */
|
16801 | protected onUnlock(): void;
|
16802 | /**
|
16803 | * Invoked when the control validation state is changed.
|
16804 | * @event
|
16805 | */
|
16806 | protected onValidate(): void;
|
16807 | /**
|
16808 | * Invoked when the control is initialized.
|
16809 | * @return Return `true` if the control is initialized.
|
16810 | * @event
|
16811 | */
|
16812 | onInit(): boolean;
|
16813 | /**
|
16814 | * Invoked when the control is measured. A measure correction in pixels can
|
16815 | * be supplied in the return value.
|
16816 | * @return Returns the measure correction for the control.
|
16817 | * @event
|
16818 | */
|
16819 | onMeasure(): number;
|
16820 | /**
|
16821 | * Invoked when the control is resized.
|
16822 | * @event
|
16823 | */
|
16824 | onResized(): void;
|
16825 | /**
|
16826 | * Invoked when the parent form is resized.
|
16827 | * @event
|
16828 | */
|
16829 | onFormResize(): void;
|
16830 | /**
|
16831 | * Invoked when the control form is activated.
|
16832 | * @event
|
16833 | */
|
16834 | onFormActivate(): void;
|
16835 | /**
|
16836 | * Invoked when the control form is deactivated.
|
16837 | * @event
|
16838 | */
|
16839 | onFormDeactivate(): void;
|
16840 | /**
|
16841 | * Invoked when the control form is enabled.
|
16842 | * @event
|
16843 | */
|
16844 | onFormEnable(): void;
|
16845 | /**
|
16846 | * Invoked when the control form is disabled.
|
16847 | * @event
|
16848 | */
|
16849 | onFormDisable(): void;
|
16850 | /**
|
16851 | * Invoked when the control is shown.
|
16852 | * @event
|
16853 | */
|
16854 | onShow(): void;
|
16855 | /**
|
16856 | * Invoked when the control is hidden.
|
16857 | * @event
|
16858 | */
|
16859 | onHide(): void;
|
16860 | /**
|
16861 | * Invoked when the control mode is changed.
|
16862 | * @event
|
16863 | */
|
16864 | onMode(): void;
|
16865 | /**
|
16866 | * Fired when auto-focus is requested.
|
16867 | * @return Returns `true` if the focus is set.
|
16868 | */
|
16869 | onRequestAutoFocus(): boolean;
|
16870 | /**
|
16871 | * Draws the control.
|
16872 | * @param pParent Reference to the parent form element.
|
16873 | */
|
16874 | draw(pParent: Element): void;
|
16875 | /** Redraws a control. */
|
16876 | redraw(): this;
|
16877 | /** Resizes the parent form. */
|
16878 | resize(): void;
|
16879 | /**
|
16880 | * Specifies the visibility of the control group.
|
16881 | * @param bVisible Specifies if the control group is visible.
|
16882 | * @return Returns a reference to the control to allow chaining.
|
16883 | */
|
16884 | groupVisibility(bVisible: boolean): void;
|
16885 | /**
|
16886 | * Sets the label for the control.
|
16887 | * @param sLabel Specifies the control label.
|
16888 | * @return Returns a reference to the control to allow chaining.
|
16889 | */
|
16890 | label(sLabel: string): this;
|
16891 | /**
|
16892 | * Sets the compact label for the control.
|
16893 | * @param sLabel Specifies the compact control label.
|
16894 | * @return Returns a reference to the control to allow chaining.
|
16895 | */
|
16896 | labelCompact(sLabel: string): this;
|
16897 | /**
|
16898 | * Specifies if the label should support markdown formatting.
|
16899 | * @param pOptions Specifies the markdown options.
|
16900 | */
|
16901 | markdown<T>(pOptions?: IMarkdownOptions<T>): this;
|
16902 | /**
|
16903 | * Specifies the visibility of the control.
|
16904 | * @param bVisible Specifies if the control is visible.
|
16905 | * @return Returns a reference to the control to allow chaining.
|
16906 | */
|
16907 | visible(bVisible?: boolean): this;
|
16908 | /**
|
16909 | * Shows the control.
|
16910 | * @return Returns a reference to the control to allow chaining.
|
16911 | */
|
16912 | show(): this;
|
16913 | /**
|
16914 | * Hides the control.
|
16915 | * @return Returns a reference to the control to allow chaining.
|
16916 | */
|
16917 | hide(): this;
|
16918 | /**
|
16919 | * Specifies the state of the control.
|
16920 | * @param bDisable Specifies if the control is disabled.
|
16921 | * @return Returns a reference to the control to allow chaining.
|
16922 | */
|
16923 | disabled(bDisabled?: boolean): this;
|
16924 | /**
|
16925 | * Disables the control.
|
16926 | * @return Returns a reference to the control to allow chaining.
|
16927 | */
|
16928 | disable(): this;
|
16929 | /**
|
16930 | * Enables the control.
|
16931 | * @return Returns a reference to the control to allow chaining.
|
16932 | */
|
16933 | enable(): this;
|
16934 | /**
|
16935 | * Specifies if the control is required.
|
16936 | * @param bRequired Specifies if the control is required.
|
16937 | * @return Returns a reference to the control to allow chaining.
|
16938 | */
|
16939 | required(bRequired?: boolean): this;
|
16940 | /**
|
16941 | * Makes the control required.
|
16942 | * @return Returns a reference to the control to allow chaining.
|
16943 | */
|
16944 | require(): this;
|
16945 | /**
|
16946 | * Specifies if the control is locked (readonly).
|
16947 | * @param bLocked Specifies if the control is locked (readonly).
|
16948 | * @return Returns a reference to the control to allow chaining.
|
16949 | */
|
16950 | locked(bLocked?: boolean): this;
|
16951 | /**
|
16952 | * Makes the control readonly.
|
16953 | * @return Returns a reference to the control to allow chaining.
|
16954 | */
|
16955 | readonly(): this;
|
16956 | /**
|
16957 | * Locks the control.
|
16958 | * @return Returns a reference to the control to allow chaining.
|
16959 | */
|
16960 | lock(): this;
|
16961 | /**
|
16962 | * Unlocks the control.
|
16963 | * @return Returns a reference to the control to allow chaining.
|
16964 | */
|
16965 | unlock(): this;
|
16966 | /**
|
16967 | * Sets the supported mode for the control.
|
16968 | * @param sMode Specifies the desired mode.
|
16969 | * @return Returns a reference to the control to allow chaining.
|
16970 | */
|
16971 | mode(sMode: "compact" | "normal" | "both"): this;
|
16972 | /**
|
16973 | * Sets the control mode to compact only.
|
16974 | * @return Returns a reference to the control to allow chaining.
|
16975 | */
|
16976 | compactModeOnly(): this;
|
16977 | /**
|
16978 | * Sets the control mode to normal only.
|
16979 | * @return Returns a reference to the control to allow chaining.
|
16980 | */
|
16981 | normalModeOnly(): this;
|
16982 | /**
|
16983 | * Enables control indentation. This can only be set during construction.
|
16984 | * @param nSize Specifies the indent size in pixels.
|
16985 | */
|
16986 | indent(nSize: number): this;
|
16987 | /**
|
16988 | * Sets the validation state of the control or invokes a validation cycle if
|
16989 | * automatic validation is activated.
|
16990 | * @param sValidation Specifies the validation state or the validation type.
|
16991 | * @return Returns a reference to the control to allow chaining.
|
16992 | */
|
16993 | validate(sValidation?: TCardValidation | TControlValidationType): this;
|
16994 | /**
|
16995 | * Enables automatic control validation.
|
16996 | * @param fnValidation Specifies the validator.
|
16997 | */
|
16998 | autoValidate(fnValidation: TControlValidation): this;
|
16999 | /**
|
17000 | * Sets the control validation to passed.
|
17001 | *
|
17002 | */
|
17003 | pass(): this;
|
17004 | /**
|
17005 | * Sets the control validation to invalid.
|
17006 | *
|
17007 | */
|
17008 | invalid(): this;
|
17009 | /**
|
17010 | * Sets the control validation to failed.
|
17011 | *
|
17012 | */
|
17013 | fail(): this;
|
17014 | /**
|
17015 | * Sets the control validation to waiting.
|
17016 | *
|
17017 | */
|
17018 | await(): this;
|
17019 | /**
|
17020 | * Sets a control reference.
|
17021 | * @param sReference Specifies the reference.
|
17022 | * @return Returns a reference to the control to allow chaining.
|
17023 | */
|
17024 | reference(sReference: string): this;
|
17025 | /**
|
17026 | * Specifies a function which is invoked when the control is initialized.
|
17027 | * @param fnExecute Specifies the function to execute.
|
17028 | * @return Returns a reference to the control to allow chaining.
|
17029 | */
|
17030 | execute<T extends Control>(fnExecute: (pControl: T) => void): this;
|
17031 | /**
|
17032 | * Specifies a bind function (invoked when the control is initialized).
|
17033 | * @param fnBind Specifies the function to execute.
|
17034 | * @return Returns a reference to the control to allow chaining.
|
17035 | */
|
17036 | bind<T extends Control>(fnBind: (pControl: T) => void): this;
|
17037 | /**
|
17038 | * Specifies an unbind function (invoked when the control is destroyed).
|
17039 | * @param fnUnbind Specifies the function to execute.
|
17040 | * @return Returns a reference to the control to allow chaining.
|
17041 | */
|
17042 | unbind<T extends Control>(fnUnbind: (pControl: T) => void): this;
|
17043 | /**
|
17044 | * Enables auto-focus for the control.
|
17045 | * @param bFocusAuto Specifies if auto-focus is enabled or not.
|
17046 | * @return Returns a reference to the control to allow chaining.
|
17047 | */
|
17048 | autoFocus(bFocusAuto?: boolean): this;
|
17049 | /**
|
17050 | * Sets the focus to the control.
|
17051 | * @param sTo Specifies if the focus should be set to the first or last
|
17052 | * item in the control (in case a control has multiple items).
|
17053 | * @return Returns `true` if the focus is set.
|
17054 | */
|
17055 | focus(sTo?: "first" | "last"): boolean;
|
17056 | /**
|
17057 | * Sets the focus to the previous or next item in the control. Override
|
17058 | * this function if you need to shift focus within a control.
|
17059 | * @param sTo Specifies if the focus is set to the previous or next control.
|
17060 | * @return Returns `true` if the focus is captured by the control.
|
17061 | */
|
17062 | focusTo(sTo: "previous" | "next"): boolean;
|
17063 | /** Blurs the focus of a control. */
|
17064 | blur(): void;
|
17065 | /** Destroys the control. */
|
17066 | destroy(): void;
|
17067 | }
|
17068 | export type TFormEvents = "OnEnable" | "OnDisable" | "OnFocus" | "OnBlur" | "OnData";
|
17069 | export interface IFormEvents<Hook extends THooks> extends IHookPayload<Hook> {
|
17070 | readonly form: Form;
|
17071 | }
|
17072 | export interface IFormEnableEvent extends IFormEvents<"OnEnable"> {}
|
17073 | export interface IFormDisableEvent extends IFormEvents<"OnDisable"> {}
|
17074 | export interface IFormFocusEvent extends IFormEvents<"OnFocus"> {}
|
17075 | export interface IFormBlurEvent extends IFormEvents<"OnBlur"> {}
|
17076 | export interface IFormDataEvent extends IFormEvents<"OnData"> {}
|
17077 | export type TGroupEvents = "OnShow" | "OnHide" | "OnEnable" | "OnDisable" | "OnLock" | "OnUnlock";
|
17078 | export interface IGroupEvents<Hook extends THooks> extends IHookPayload<Hook> {
|
17079 | readonly group: Group;
|
17080 | }
|
17081 | export interface IGroupShowEvent extends IGroupEvents<"OnShow"> {}
|
17082 | export interface IGroupHideEvent extends IGroupEvents<"OnHide"> {}
|
17083 | export interface IGroupEnableEvent extends IGroupEvents<"OnEnable"> {}
|
17084 | export interface IGroupDisableEvent extends IGroupEvents<"OnDisable"> {}
|
17085 | export interface IGroupLockEvent extends IGroupEvents<"OnLock"> {}
|
17086 | export interface IGroupUnlockEvent extends IGroupEvents<"OnUnlock"> {}
|
17087 | export class Group extends Hooks<TGroupEvents> {
|
17088 | |
17089 |
|
17090 |
|
17091 |
|
17092 | constructor(pControls: Control[]);
|
17093 | /** Retrieves if the group is visible. */
|
17094 | get isVisible(): boolean;
|
17095 | /** Sets the visibility of the group. */
|
17096 | set isVisible(bVisible: boolean);
|
17097 | /** Retrieves if the group is disabled. */
|
17098 | get isDisabled(): boolean;
|
17099 | /** Specifies if the group is disabled. */
|
17100 | set isDisabled(bDisabled: boolean);
|
17101 | /** Retrieves if the group is locked (readonly). */
|
17102 | get isLocked(): boolean;
|
17103 | /** Specifies if the group is locked (readonly). */
|
17104 | set isLocked(bLocked: boolean);
|
17105 | /** Retrieves the controls in the group. */
|
17106 | get controls(): Control[];
|
17107 | /**
|
17108 | * Invoked when the group is shown.
|
17109 | * @event
|
17110 | */
|
17111 | protected onShow(): void;
|
17112 | /**
|
17113 | * Invoked when the group is hidden.
|
17114 | * @event
|
17115 | */
|
17116 | protected onHide(): void;
|
17117 | /**
|
17118 | * Invoked when the group is enabled.
|
17119 | * @event
|
17120 | */
|
17121 | protected onEnable(): void;
|
17122 | /**
|
17123 | * Invoked when the group is disabled.
|
17124 | * @event
|
17125 | */
|
17126 | protected onDisable(): void;
|
17127 | /**
|
17128 | * Invoked when the group is locked.
|
17129 | * @event
|
17130 | */
|
17131 | protected onLock(): void;
|
17132 | /**
|
17133 | * Invoked when the group is unlocked.
|
17134 | * @event
|
17135 | */
|
17136 | protected onUnlock(): void;
|
17137 | /**
|
17138 | * Specifies the visibility of the group.
|
17139 | * @param bVisible Specifies if the group is visible.
|
17140 | * @return Returns a reference to the group to allow chaining.
|
17141 | */
|
17142 | visible(bVisible: boolean): this;
|
17143 | /**
|
17144 | * Shows the group.
|
17145 | * @return Returns a reference to the group to allow chaining.
|
17146 | */
|
17147 | show(): this;
|
17148 | /**
|
17149 | * Hides the group.
|
17150 | * @return Returns a reference to the group to allow chaining.
|
17151 | */
|
17152 | hide(): this;
|
17153 | /**
|
17154 | * Specifies the state of the group.
|
17155 | * @param bDisable Specifies if the group is disabled.
|
17156 | * @return Returns a reference to the group to allow chaining.
|
17157 | */
|
17158 | disabled(bDisabled: boolean): this;
|
17159 | /**
|
17160 | * Disables the group.
|
17161 | * @return Returns a reference to the group to allow chaining.
|
17162 | */
|
17163 | disable(): this;
|
17164 | /**
|
17165 | * Enables the group.
|
17166 | * @return Returns a reference to the group to allow chaining.
|
17167 | */
|
17168 | enable(): this;
|
17169 | /**
|
17170 | * Specifies if the group is locked (readonly).
|
17171 | * @param bLocked Specifies if the group is locked (readonly).
|
17172 | * @return Returns a reference to the group to allow chaining.
|
17173 | */
|
17174 | locked(bLocked?: boolean): this;
|
17175 | /**
|
17176 | * Makes the group readonly.
|
17177 | * @return Returns a reference to the group to allow chaining.
|
17178 | */
|
17179 | readonly(): this;
|
17180 | /**
|
17181 | * Locks the group.
|
17182 | * @return Returns a reference to the group to allow chaining.
|
17183 | */
|
17184 | lock(): this;
|
17185 | /**
|
17186 | * Unlocks the group.
|
17187 | * @return Returns a reference to the group to allow chaining.
|
17188 | */
|
17189 | unlock(): this;
|
17190 | }
|
17191 | /** Describes the form style. */
|
17192 | export interface IFormStyle {
|
17193 |
|
17194 | appearance?: IStyles;
|
17195 |
|
17196 | title?: IStyles;
|
17197 |
|
17198 | disabled?: IStyles;
|
17199 |
|
17200 | locked?: IStyles;
|
17201 |
|
17202 | required?: IStyles;
|
17203 |
|
17204 | focus?: IStyles;
|
17205 |
|
17206 | passed?: IStyles;
|
17207 |
|
17208 | failed?: IStyles;
|
17209 |
|
17210 | awaiting?: IStyles;
|
17211 |
|
17212 | normal?: IStyles;
|
17213 |
|
17214 | compact?: IStyles;
|
17215 |
|
17216 | indentation?: number;
|
17217 |
|
17218 | fused?: {
|
17219 |
|
17220 | appearance?: IStyles;
|
17221 |
|
17222 | title?: IStyles;
|
17223 | };
|
17224 |
|
17225 | controls?: {
|
17226 | [control: string]: IControlStyle;
|
17227 | };
|
17228 | }
|
17229 | export interface IFormProperties {
|
17230 |
|
17231 | style?: IFormStyle;
|
17232 |
|
17233 | controls: (Control | Group)[];
|
17234 |
|
17235 | title?: string;
|
17236 |
|
17237 | markdown?: boolean | IMarkdownOptions<TAny>;
|
17238 |
|
17239 | disabled?: boolean;
|
17240 |
|
17241 | mode?: "normal" | "compact" | "both";
|
17242 | }
|
17243 | export class Form extends Card<TFormEvents> {
|
17244 |
|
17245 | static style: IFormStyle | undefined;
|
17246 |
|
17247 | |
17248 |
|
17249 |
|
17250 |
|
17251 | constructor(pProperties: IFormProperties);
|
17252 | /** Retrieves the number of controls in the form. */
|
17253 | get count(): number;
|
17254 | /** Retrieves the title. */
|
17255 | get title(): string;
|
17256 | /** Sets the title. */
|
17257 | set title(sTitle: string);
|
17258 | /** Retrieves if the form is disabled. */
|
17259 | get isDisabled(): boolean;
|
17260 | /** Sets the disabled state of the form. */
|
17261 | set isDisabled(bDisabled: boolean);
|
17262 | /** Retrieves if the form has focus. */
|
17263 | get hasFocus(): boolean;
|
17264 | /**
|
17265 | * Draws the form.
|
17266 | * @param pCard Reference to the card element.
|
17267 | * @event
|
17268 | */
|
17269 | protected onDraw(pCard: Element): void;
|
17270 | /**
|
17271 | * Invoked when the form is measured. A measure correction in pixels can
|
17272 | * be supplied in the return value.
|
17273 | * @return Returns the measure correction for the form.
|
17274 | * @event
|
17275 | */
|
17276 | protected onMeasure(): number;
|
17277 | /**
|
17278 | * Invoked when the form parent layer is resized.
|
17279 | * @event
|
17280 | */
|
17281 | protected onResize(): void;
|
17282 | /**
|
17283 | * Invoked when the form is resized.
|
17284 | * @event
|
17285 | */
|
17286 | protected onResized(): void;
|
17287 | /**
|
17288 | * Invoked when the form is activated.
|
17289 | * @event
|
17290 | */
|
17291 | protected onActivate(): void;
|
17292 | /**
|
17293 | * Invoked when the form is deactivated.
|
17294 | * @event
|
17295 | */
|
17296 | protected onDeactivate(): void;
|
17297 | /**
|
17298 | * Invoked when the control form is enabled.
|
17299 | * @event
|
17300 | */
|
17301 | protected onEnable(): void;
|
17302 | /**
|
17303 | * Invoked when the control form is disabled.
|
17304 | * @event
|
17305 | */
|
17306 | protected onDisable(): void;
|
17307 | /**
|
17308 | * Invoked when the form is shown.
|
17309 | * @event
|
17310 | */
|
17311 | protected onShow(): void;
|
17312 | /**
|
17313 | * Invoked when the form is hidden.
|
17314 | * @event
|
17315 | */
|
17316 | protected onHide(): void;
|
17317 | /**
|
17318 | * Invoked when the form captures focus.
|
17319 | * @event
|
17320 | */
|
17321 | protected onFocus(): void;
|
17322 | /**
|
17323 | * Invoked when the form loses focus.
|
17324 | * @event
|
17325 | */
|
17326 | protected onBlur(): void;
|
17327 | /**
|
17328 | * Validates the controls of the form.
|
17329 | * @return Returns the validation state.
|
17330 | * @event
|
17331 | */
|
17332 | protected onValidate(): TCardValidation;
|
17333 | /**
|
17334 | * Invoked when the form is destroyed.
|
17335 | * @event
|
17336 | */
|
17337 | protected onDestroy(): void;
|
17338 | /**
|
17339 | * Invoked when the form is initialized.
|
17340 | * @return Returns the initialization state of the form.
|
17341 | * @event
|
17342 | */
|
17343 | onInit(): boolean;
|
17344 | /**
|
17345 | * Invoked when the form mode is changed.
|
17346 | * @event
|
17347 | */
|
17348 | onMode(): void;
|
17349 | /**
|
17350 | * Invoked when the form receives a focus request.
|
17351 | * @return Returns `true` if the form accepted the focus request.
|
17352 | * @event
|
17353 | */
|
17354 | onRequestFocus(): boolean;
|
17355 | /**
|
17356 | * Invoked when the form receives an auto-focus request.
|
17357 | * @return Returns `true` if the form accepted the focus request.
|
17358 | */
|
17359 | onRequestAutoFocus(): boolean;
|
17360 | /**
|
17361 | * Invoked when the data of a control is changed.
|
17362 | * @event
|
17363 | */
|
17364 | onData(): void;
|
17365 | /** Marks the form as initialized. */
|
17366 | initialized(): void;
|
17367 | /**
|
17368 | * Iterates through all controls.
|
17369 | * @param fnControl Contains the function which is invoked for each control.
|
17370 | */
|
17371 | each(fnControl: (pControl: Control) => void): void;
|
17372 | /**
|
17373 | * Retrieves the control at the specified index.
|
17374 | * @param nIndex Specifies the control index.
|
17375 | * @return Returns the control instance or `undefined` if the control is not found.
|
17376 | */
|
17377 | control<T extends Control>(nIndex: number): T | undefined;
|
17378 | /**
|
17379 | * Retrieves the control with the specified reference.
|
17380 | * @param sReference Specifies the control reference.
|
17381 | * @return Returns the control instance or `undefined` if the control is not found.
|
17382 | */
|
17383 | controlWithReference<T extends Control>(sReference: string): T | undefined;
|
17384 | /**
|
17385 | * Retrieves the control styles for the specified control.
|
17386 | * @param sControl Specifies the style index.
|
17387 | * @return Returns the styles or `undefined` if no styles are defined.
|
17388 | */
|
17389 | styles<T extends IControlStyle>(sControl: string): T | undefined;
|
17390 | /** Verifies the visibility of the form. */
|
17391 | verify(bDebounce?: boolean): void;
|
17392 | /**
|
17393 | * Sets focus to the first or last control in the form.
|
17394 | * @param sTo Specifies if the focus is set to the first or last control.
|
17395 | * @return Returns `true` if a control captured focus.
|
17396 | */
|
17397 | focus(sTo?: "first" | "last"): boolean;
|
17398 | /**
|
17399 | * Sets the focus to the previous or next control.
|
17400 | * @param sTo Specifies if the focus is set to the previous or next control.
|
17401 | * @return Returns `true` if the focus is shifted.
|
17402 | */
|
17403 | focusTo(sTo: "previous" | "next"): boolean;
|
17404 | /** Updates the form focus. */
|
17405 | focusUpdate(): void;
|
17406 | /** Blurs the form. */
|
17407 | blur(): void;
|
17408 | }
|
17409 | export type TBinding<T> = T | Binding<T | undefined>;
|
17410 | export type TBindingModifier<T> = (pValue?: T) => T;
|
17411 | export class Binding<T, Target extends {} = {}, Property extends keyof Target = TAny> {
|
17412 |
|
17413 | paused: boolean;
|
17414 | |
17415 |
|
17416 |
|
17417 |
|
17418 |
|
17419 |
|
17420 |
|
17421 |
|
17422 | constructor(
|
17423 | pTarget: Target,
|
17424 | sProperty: Property,
|
17425 | pInactive: Target[Property],
|
17426 | pDefault?: Target[Property],
|
17427 | fnModifier?: TBindingModifier<T>
|
17428 | );
|
17429 | /** Retrieves the inactive value. */
|
17430 | get inactive(): Target[Property];
|
17431 | /** Retrieves the default value. */
|
17432 | get default(): Target[Property] | undefined;
|
17433 | /** Retrieves the value. */
|
17434 | get value(): T | undefined;
|
17435 | /** Sets the value. */
|
17436 | set value(pValue: T | undefined);
|
17437 | }
|
17438 | export abstract class DataControl<T, Style extends IControlStyle> extends Control<Style, "OnData"> {
|
17439 | |
17440 |
|
17441 |
|
17442 |
|
17443 |
|
17444 |
|
17445 |
|
17446 |
|
17447 |
|
17448 |
|
17449 |
|
17450 |
|
17451 | static bind<Target extends {}, P extends keyof Target>(
|
17452 | pTarget: Target,
|
17453 | sProperty: P,
|
17454 | pValueWhenInactive: Target[P],
|
17455 | pDefaultWhenActive?: Target[P],
|
17456 | fnModifier?: TBindingModifier<Target[P]>
|
17457 | ): Binding<Target[P], Target, P>;
|
17458 | |
17459 |
|
17460 |
|
17461 |
|
17462 |
|
17463 |
|
17464 | constructor(pBinding: TBinding<T>, pDefault: T, pProperties: IControlProperties<Style>);
|
17465 |
|
17466 | /**
|
17467 | * Sets the input data for the control.
|
17468 | * @param pData Specifies the input data.
|
17469 | */
|
17470 | protected input(pData: T): T;
|
17471 | /** Retrieves the output data for the control. */
|
17472 | protected output(): T;
|
17473 | /**
|
17474 | * Invoked when data is changed.
|
17475 | * @event
|
17476 | */
|
17477 | protected onData(): void;
|
17478 | /**
|
17479 | * Invoked when the control is enabled.
|
17480 | * @event
|
17481 | */
|
17482 | protected onEnable(): void;
|
17483 | /**
|
17484 | * Invoked when the control is disabled.
|
17485 | * @event
|
17486 | */
|
17487 | protected onDisable(): void;
|
17488 | /**
|
17489 | * Invoked when the control form is activated.
|
17490 | * @event
|
17491 | */
|
17492 | onFormActivate(): void;
|
17493 | /**
|
17494 | * Invoked when the control form is deactivated.
|
17495 | * @event
|
17496 | */
|
17497 | onFormDeactivate(): void;
|
17498 | /**
|
17499 | * Invoked when the control form is enabled.
|
17500 | * @event
|
17501 | */
|
17502 | onFormEnable(): void;
|
17503 | /**
|
17504 | * Invoked when the control form is disabled.
|
17505 | * @event
|
17506 | */
|
17507 | onFormDisable(): void;
|
17508 | /**
|
17509 | * Invoked when the control is shown.
|
17510 | * @event
|
17511 | */
|
17512 | onShow(): void;
|
17513 | /**
|
17514 | * Invoked when the control is hidden.
|
17515 | * @event
|
17516 | */
|
17517 | onHide(): void;
|
17518 | /** Pauses the data binding. */
|
17519 | pauseBinding(): this;
|
17520 | /** Resumes the data binding. */
|
17521 | resumeBinding(): this;
|
17522 | /** Forces a data refresh. */
|
17523 | refresh(): this;
|
17524 | }
|
17525 | export abstract class StaticControl<Style extends IControlStyle> extends Control<Style, void> {
|
17526 | |
17527 |
|
17528 |
|
17529 |
|
17530 | constructor(pProperties: IControlProperties<Style>);
|
17531 | }
|
17532 | export interface IControlDataEvent<T extends Control, D> extends IControlEvents<"OnData", T> {
|
17533 | data: D;
|
17534 | }
|
17535 | }
|
17536 |
|
17537 | declare module "tripetto/module/ui-form-date" {
|
17538 | import { Element, IStyles } from "tripetto/module/dom";
|
17539 | import { DataControl, IControlStyle, TBinding, TControlChange } from "tripetto/module/ui-form";
|
17540 | import { IMenuStyle } from "tripetto/module/ui-menu";
|
17541 |
|
17542 | export const enum DateTimeFeatures {
|
17543 |
|
17544 | Date = 1,
|
17545 |
|
17546 | Time = 2,
|
17547 |
|
17548 | TimeHoursOnly = 4,
|
17549 |
|
17550 | TimeHoursAndMinutesOnly = 8,
|
17551 |
|
17552 | NoResetOption = 16,
|
17553 |
|
17554 | Weekday = 32,
|
17555 |
|
17556 | Default = 35,
|
17557 | }
|
17558 | export interface IDateTimeStyle extends IControlStyle {
|
17559 |
|
17560 | height: number;
|
17561 |
|
17562 | appearance?: IStyles;
|
17563 |
|
17564 | date?: IStyles;
|
17565 |
|
17566 | time?: {
|
17567 |
|
17568 | appearance?: IStyles;
|
17569 |
|
17570 | hourMinuteSeparator?: IStyles;
|
17571 |
|
17572 | minuteSecondSeparator?: IStyles;
|
17573 | };
|
17574 |
|
17575 | plane?: {
|
17576 |
|
17577 | appearance: IStyles;
|
17578 |
|
17579 | hover?: IStyles;
|
17580 |
|
17581 | selected?: IStyles;
|
17582 |
|
17583 | focus?: IStyles;
|
17584 |
|
17585 | selector?: IMenuStyle;
|
17586 | };
|
17587 |
|
17588 | spacing?: number;
|
17589 |
|
17590 | placeholder?: {
|
17591 |
|
17592 | appearance: IStyles;
|
17593 |
|
17594 | text: IStyles;
|
17595 | };
|
17596 |
|
17597 | label?: IStyles;
|
17598 |
|
17599 | disabled?: IStyles;
|
17600 |
|
17601 | required?: IStyles;
|
17602 |
|
17603 | locked?: IStyles;
|
17604 |
|
17605 | focus?: IStyles;
|
17606 |
|
17607 | hover?: IStyles;
|
17608 |
|
17609 | passed?: IStyles;
|
17610 |
|
17611 | failed?: IStyles;
|
17612 |
|
17613 | awaiting?: IStyles;
|
17614 |
|
17615 | fused?: {
|
17616 |
|
17617 | appearance?: IStyles;
|
17618 |
|
17619 | label?: IStyles;
|
17620 |
|
17621 | required?: IStyles;
|
17622 |
|
17623 | locked?: IStyles;
|
17624 |
|
17625 | focus?: IStyles;
|
17626 |
|
17627 | hover?: IStyles;
|
17628 |
|
17629 | passed?: IStyles;
|
17630 |
|
17631 | failed?: IStyles;
|
17632 |
|
17633 | awaiting?: IStyles;
|
17634 | };
|
17635 |
|
17636 | labels: {
|
17637 |
|
17638 | enable: string;
|
17639 |
|
17640 | disable: string;
|
17641 |
|
17642 | reset?: string;
|
17643 | };
|
17644 | }
|
17645 | type TDays =
|
17646 | | 1
|
17647 | | 2
|
17648 | | 3
|
17649 | | 4
|
17650 | | 5
|
17651 | | 6
|
17652 | | 7
|
17653 | | 8
|
17654 | | 9
|
17655 | | 10
|
17656 | | 11
|
17657 | | 12
|
17658 | | 13
|
17659 | | 14
|
17660 | | 15
|
17661 | | 16
|
17662 | | 17
|
17663 | | 18
|
17664 | | 19
|
17665 | | 20
|
17666 | | 21
|
17667 | | 22
|
17668 | | 23
|
17669 | | 24
|
17670 | | 25
|
17671 | | 26
|
17672 | | 27
|
17673 | | 28
|
17674 | | 29
|
17675 | | 30
|
17676 | | 31;
|
17677 | type TMonths = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11;
|
17678 | export class DateTime extends DataControl<number | undefined, IDateTimeStyle> {
|
17679 |
|
17680 | static style: IDateTimeStyle | undefined;
|
17681 |
|
17682 | |
17683 |
|
17684 |
|
17685 |
|
17686 |
|
17687 | constructor(nValue?: TBinding<number>, pStyle?: IDateTimeStyle);
|
17688 |
|
17689 | /** Retrieves the static element. */
|
17690 | protected get static(): Element | undefined;
|
17691 | /** Retrieves if the selected value. */
|
17692 | get value(): number | undefined;
|
17693 | /** Sets the selected value. */
|
17694 | set value(nValue: number | undefined);
|
17695 | /** Retrieves if the control has a value. */
|
17696 | get hasValue(): boolean;
|
17697 | /** Retrieves the day of the month. */
|
17698 | get dayOfMonth(): TDays;
|
17699 | /** Sets the day. */
|
17700 | set dayOfMonth(nDay: TDays);
|
17701 | /** Retrieves the month. */
|
17702 | get month(): TMonths;
|
17703 | /** Sets the month. */
|
17704 | set month(nMonth: TMonths);
|
17705 | /** Retrieves the year. */
|
17706 | get year(): number;
|
17707 | /** Sets the year. */
|
17708 | set year(nYear: number);
|
17709 | /** Retrieves the hour. */
|
17710 | get hour(): number;
|
17711 | /** Sets the hour. */
|
17712 | set hour(nHour: number);
|
17713 | /** Retrieves the minute. */
|
17714 | get minute(): number;
|
17715 | /** Sets the minute. */
|
17716 | set minute(nMinute: number);
|
17717 | /** Retrieves the second. */
|
17718 | get second(): number;
|
17719 | /** Sets the second. */
|
17720 | set second(nSecond: number);
|
17721 |
|
17722 | /**
|
17723 | * Sets the input data for the control.
|
17724 | * @param pData Specifies the input data.
|
17725 | */
|
17726 | protected input(nValue: number | undefined): number | undefined;
|
17727 | /**
|
17728 | * Draws the control.
|
17729 | * @param pForm Reference to the parent form element.
|
17730 | * @event
|
17731 | */
|
17732 | protected onDraw(pForm: Element): Element;
|
17733 | /**
|
17734 | * Invoked when the control changed.
|
17735 | * @event
|
17736 | */
|
17737 | protected onChange(sChange: TControlChange): void;
|
17738 | /**
|
17739 | * Updates the control.
|
17740 | * @event
|
17741 | */
|
17742 | protected onUpdate(): void;
|
17743 | /**
|
17744 | * Invoked when the control is disabled.
|
17745 | * @event
|
17746 | */
|
17747 | protected onDisable(): void;
|
17748 | /**
|
17749 | * Invoked when the control is locked.
|
17750 | * @event
|
17751 | */
|
17752 | protected onLock(): void;
|
17753 | /**
|
17754 | * Invoked when date is changed.
|
17755 | * @event
|
17756 | */
|
17757 | protected onData(): void;
|
17758 | /**
|
17759 | * Invoked when the focus state of the control is changed.
|
17760 | * @event
|
17761 | */
|
17762 | protected onFocusOptions(): void;
|
17763 | /**
|
17764 | * Sets the focus.
|
17765 | * @param sTo Set focus to the first or last option.
|
17766 | * @return Returns `true` if the focus is set.
|
17767 | */
|
17768 | focus(sTo?: "first" | "last"): boolean;
|
17769 | /**
|
17770 | * Sets the focus to the previous or next option
|
17771 | * @param sTo Specifies if the focus is set to the previous or next option.
|
17772 | * @return Returns `true` if the focus is captured by an option.
|
17773 | */
|
17774 | focusTo(sTo: "previous" | "next"): boolean;
|
17775 | /** Blurs the focus. */
|
17776 | blur(): void;
|
17777 | /**
|
17778 | * Sets the width of the control.
|
17779 | * @param pWidth Specifies the control width in pixels or sets the width
|
17780 | * to `auto` or `full`.
|
17781 | * @return Returns a reference to the control to allow chaining.
|
17782 | */
|
17783 | width(pWidth: number | "auto" | "full"): this;
|
17784 | /**
|
17785 | * Sets a placeholder for the date/time control.
|
17786 | * @param sPlaceholder Specifies the placeholder text.
|
17787 | * @return Returns a reference to the control to allow chaining.
|
17788 | */
|
17789 | placeholder(sPlaceholder: string): this;
|
17790 | /**
|
17791 | * Specifies the function which is invoked when the date is changed.
|
17792 | * @param fnChange Specifies the change function.
|
17793 | * @return Returns a reference to the control to allow chaining.
|
17794 | */
|
17795 | on(fnChange: (pDate: DateTime) => void): this;
|
17796 | /**
|
17797 | * Specifies the date zone.
|
17798 | * @param sZone Specifies the date zone (`local` or `UTC`).
|
17799 | * @return Returns a reference to the control to allow chaining.
|
17800 | */
|
17801 | zone(sZone: "local" | "UTC"): this;
|
17802 | /**
|
17803 | * Specifies the date control features which should be enabled.
|
17804 | * @param nFeatures Specifies the features which should be enabled.
|
17805 | * @return Returns a reference to the control to allow chaining.
|
17806 | */
|
17807 | features(nFeatures: DateTimeFeatures): this;
|
17808 | /**
|
17809 | * Specifies the years range.
|
17810 | * @param nFrom Specifies the from year.
|
17811 | * @param nTo Specifies the to year.
|
17812 | * @return Returns a reference to the control to allow chaining.
|
17813 | */
|
17814 | years(nFrom: number, nTo: number): this;
|
17815 | /**
|
17816 | * Specifies the minute/second interval.
|
17817 | * @param nInterval Specifies the interval.
|
17818 | * @return Returns a reference to the control to allow chaining.
|
17819 | */
|
17820 | interval(nInterval: number): this;
|
17821 | /** Shows the options menu. */
|
17822 | showOptions(): void;
|
17823 | /** Shows the weekday selector. */
|
17824 | showWeekdaySelector(): void;
|
17825 | /** Shows the day of month selector. */
|
17826 | showDayOfMonthSelector(): void;
|
17827 | /** Shows the month selector. */
|
17828 | showMonthSelector(): void;
|
17829 | /** Shows the year selector. */
|
17830 | showYearSelector(): void;
|
17831 | /** Shows the hour selector. */
|
17832 | showHourSelector(): void;
|
17833 | /** Shows the minute selector. */
|
17834 | showMinuteSelector(): void;
|
17835 | /** Shows the seconds selector. */
|
17836 | showSecondSelector(): void;
|
17837 | }
|
17838 |
|
17839 | export { TDays as TDateTimeDays, TMonths as TDateTimeMonths };
|
17840 | }
|
17841 |
|
17842 | declare module "tripetto/module/ui-form-dropdown" {
|
17843 | import { Element, IStyles } from "tripetto/module/dom";
|
17844 | import { DataControl, IControlStyle, TBinding } from "tripetto/module/ui-form";
|
17845 |
|
17846 | export interface IDropdownStyle extends IControlStyle {
|
17847 |
|
17848 | appearance?: IStyles;
|
17849 |
|
17850 | options?: IStyles;
|
17851 |
|
17852 | optGroups?: IStyles;
|
17853 |
|
17854 | placeholder?: IStyles;
|
17855 |
|
17856 | label?: IStyles;
|
17857 |
|
17858 | disabled?: IStyles;
|
17859 |
|
17860 | required?: IStyles;
|
17861 |
|
17862 | locked?: IStyles;
|
17863 |
|
17864 | focus?: IStyles;
|
17865 |
|
17866 | hover?: IStyles;
|
17867 |
|
17868 | passed?: IStyles;
|
17869 |
|
17870 | failed?: IStyles;
|
17871 |
|
17872 | awaiting?: IStyles;
|
17873 |
|
17874 | fused?: {
|
17875 |
|
17876 | appearance?: IStyles;
|
17877 |
|
17878 | label?: IStyles;
|
17879 |
|
17880 | required?: IStyles;
|
17881 |
|
17882 | locked?: IStyles;
|
17883 |
|
17884 | focus?: IStyles;
|
17885 |
|
17886 | hover?: IStyles;
|
17887 |
|
17888 | passed?: IStyles;
|
17889 |
|
17890 | failed?: IStyles;
|
17891 |
|
17892 | awaiting?: IStyles;
|
17893 | };
|
17894 | }
|
17895 | export interface IOption<T> {
|
17896 |
|
17897 | readonly label: string;
|
17898 |
|
17899 | readonly value: T;
|
17900 |
|
17901 | readonly disabled?: boolean;
|
17902 |
|
17903 | readonly indent?: number;
|
17904 | }
|
17905 | export interface IOptionGroup {
|
17906 |
|
17907 | readonly optGroup: string;
|
17908 | }
|
17909 | type TOption<T> = IOption<T> | IOptionGroup;
|
17910 | export class Dropdown<T> extends DataControl<T | undefined, IDropdownStyle> {
|
17911 |
|
17912 | static style: IDropdownStyle | undefined;
|
17913 |
|
17914 | |
17915 |
|
17916 |
|
17917 |
|
17918 |
|
17919 |
|
17920 |
|
17921 | constructor(
|
17922 | pOptions: TOption<T>[] | ((fnDone: (pOptions: TOption<T>[]) => void) => void),
|
17923 | pValue: TBinding<T>,
|
17924 | pStyle?: IDropdownStyle
|
17925 | );
|
17926 | /** Retrieves the static element. */
|
17927 | protected get static(): Element | undefined;
|
17928 | /** Retrieves the selected value. */
|
17929 | get value(): T | undefined;
|
17930 | /** Sets the selected value. */
|
17931 | set value(pValue: T | undefined);
|
17932 |
|
17933 | /**
|
17934 | * Draws the control.
|
17935 | * @param pForm Reference to the parent form element.
|
17936 | * @event
|
17937 | */
|
17938 | protected onDraw(pForm: Element): Element;
|
17939 | /**
|
17940 | * Updates the control.
|
17941 | * @event
|
17942 | */
|
17943 | protected onUpdate(): void;
|
17944 | /**
|
17945 | * Invoked when the focus state of the control is changed.
|
17946 | * @event
|
17947 | */
|
17948 | protected onFocusOptions(): void;
|
17949 | /**
|
17950 | * Invoked when the state of the dropdown changes.
|
17951 | * @event
|
17952 | */
|
17953 | protected onData(): void;
|
17954 | /**
|
17955 | * Selects the specified option.
|
17956 | * @param pValue Specifies the option value.
|
17957 | */
|
17958 | select(pValue: T): this;
|
17959 | /**
|
17960 | * Sets the focus to the dropdown.
|
17961 | * @return Returns `true` if the focus is set.
|
17962 | */
|
17963 | focus(): boolean;
|
17964 | /** Blurs the focus of the dropdown. */
|
17965 | blur(): void;
|
17966 | /**
|
17967 | * Sets the width of the control.
|
17968 | * @param pWidth Specifies the control width in pixels or sets the width
|
17969 | * to `auto` or `full`.
|
17970 | * @return Returns a reference to the control to allow chaining.
|
17971 | */
|
17972 | width(pWidth: number | "auto" | "full"): this;
|
17973 | /**
|
17974 | * Sets a placeholder for the dropdown.
|
17975 | * @param sPlaceholder Specifies the placeholder text.
|
17976 | * @return Returns a reference to the control to allow chaining.
|
17977 | */
|
17978 | placeholder(sPlaceholder: string): this;
|
17979 | /**
|
17980 | * Specifies the function which is invoked when the dropdown selection is changed.
|
17981 | * @param fnChange Specifies the change function.
|
17982 | * @return Returns a reference to the control to allow chaining.
|
17983 | */
|
17984 | on(fnChange: (pDropdown: Dropdown<T>) => void): this;
|
17985 | /**
|
17986 | * Sets or retrieves the label of the specified option or the current option
|
17987 | * if no option value is specified.
|
17988 | * @param pValue Specifies the option value.
|
17989 | * @param sLabel Specifies a new label for the option.
|
17990 | * @return Returns the label.
|
17991 | */
|
17992 | optionLabel(pValue?: T, sLabel?: string): string;
|
17993 | /**
|
17994 | * Sets or retrieves the disabled state of the specified option or the
|
17995 | * current option if no option value is specified.
|
17996 | * @param pValue Specifies the option value.
|
17997 | * @param bDisabled Specifies the disabled state.
|
17998 | */
|
17999 | optionDisabled(pValue?: T, bDisabled?: boolean): boolean;
|
18000 | /**
|
18001 | * Sets the options for the dropdown.
|
18002 | * @param pOptions Specifies an array of options.
|
18003 | */
|
18004 | options(pOptions: TOption<T>[]): this;
|
18005 | }
|
18006 |
|
18007 | export { TOption as IDropdownOption };
|
18008 | }
|
18009 |
|
18010 | declare module "tripetto/module/ui-form-email" {
|
18011 | import { Callback } from "tripetto/module/callback";
|
18012 | import { TCardValidation } from "tripetto/module/ui-cards";
|
18013 | import { TBinding, TControlValidationType } from "tripetto/module/ui-form";
|
18014 | import { ITextStyle, Text } from "tripetto/module/ui-form-text";
|
18015 |
|
18016 | export type TEmailValidation = (
|
18017 | pControl: Email,
|
18018 | sType: TControlValidationType,
|
18019 | pCallback: Callback<TCardValidation>
|
18020 | ) => TCardValidation | Callback<TCardValidation>;
|
18021 | export class Email extends Text {
|
18022 | |
18023 |
|
18024 |
|
18025 |
|
18026 |
|
18027 | constructor(sValue?: TBinding<string>, pStyle?: ITextStyle);
|
18028 | /**
|
18029 | * Enables automatic control validation.
|
18030 | * @param fnValidation Specifies the validator.
|
18031 | */
|
18032 | autoValidate(fnValidation?: TEmailValidation): this;
|
18033 | }
|
18034 | }
|
18035 |
|
18036 | declare module "tripetto/module/ui-form-html" {
|
18037 | import { Element, IStyles } from "tripetto/module/dom";
|
18038 | import { IHookPayload } from "tripetto/module/hookup";
|
18039 | import { Control, IControlStyle } from "tripetto/module/ui-form";
|
18040 |
|
18041 | export interface IHTMLStyle extends IControlStyle {
|
18042 |
|
18043 | appearance?: IStyles;
|
18044 |
|
18045 | fused?: IStyles;
|
18046 | }
|
18047 | export class HTML extends Control<IHTMLStyle, "OnUpdate"> {
|
18048 |
|
18049 | static style: IHTMLStyle | undefined;
|
18050 |
|
18051 | |
18052 |
|
18053 |
|
18054 |
|
18055 |
|
18056 |
|
18057 |
|
18058 | constructor(sHTML: string, bInteractive?: boolean, pStyle?: IHTMLStyle);
|
18059 | /** Retrieves the HTML code. */
|
18060 | get HTML(): string;
|
18061 | /** Sets the HTML code. */
|
18062 | set HTML(sHTML: string);
|
18063 | /**
|
18064 | * Draws the HTML control.
|
18065 | * @param pForm Reference to the parent form element.
|
18066 | * @event
|
18067 | */
|
18068 | protected onDraw(pForm: Element): Element;
|
18069 | /**
|
18070 | * Indicates to the control something has changed and the control needs to
|
18071 | * update its dimensions.
|
18072 | */
|
18073 | update(): void;
|
18074 | }
|
18075 | export interface IHTMLEvent extends IHookPayload<"OnUpdate"> {
|
18076 | readonly HTML: HTML;
|
18077 | }
|
18078 | }
|
18079 |
|
18080 | declare module "tripetto/module/ui-form-notification" {
|
18081 | import { Element, IStyles } from "tripetto/module/dom";
|
18082 | import { IControlStyle, StaticControl } from "tripetto/module/ui-form";
|
18083 |
|
18084 | export interface INotificationStyle extends IControlStyle {
|
18085 |
|
18086 | appearance?: IStyles;
|
18087 |
|
18088 | fused?: IStyles;
|
18089 |
|
18090 | normal?: IStyles;
|
18091 |
|
18092 | info?: IStyles;
|
18093 |
|
18094 | success?: IStyles;
|
18095 |
|
18096 | warning?: IStyles;
|
18097 |
|
18098 | error?: IStyles;
|
18099 | }
|
18100 | type Types = "normal" | "info" | "success" | "warning" | "error";
|
18101 | export class Notification extends StaticControl<INotificationStyle> {
|
18102 |
|
18103 | static style: INotificationStyle | undefined;
|
18104 |
|
18105 | |
18106 |
|
18107 |
|
18108 |
|
18109 |
|
18110 |
|
18111 | constructor(sLabel: string, sType?: Types, pStyle?: INotificationStyle);
|
18112 | /** Retrieves the static element. */
|
18113 | protected get static(): Element | undefined;
|
18114 | /** Retrieves the notification type. */
|
18115 | get notificationType(): Types;
|
18116 | /** Specifies the notification type. */
|
18117 | set notificationType(sType: Types);
|
18118 | /**
|
18119 | * Draws the control.
|
18120 | * @param pForm Reference to the parent form element.
|
18121 | * @event
|
18122 | */
|
18123 | protected onDraw(pForm: Element): Element;
|
18124 | /**
|
18125 | * Changes the notification type.
|
18126 | * @param sType Specifies the type.
|
18127 | */
|
18128 | type(sType: Types): this;
|
18129 | }
|
18130 |
|
18131 | export { Types as NotificationTypes };
|
18132 | }
|
18133 |
|
18134 | declare module "tripetto/module/ui-form-numeric" {
|
18135 | import { Element, IStyles } from "tripetto/module/dom";
|
18136 | import { DataControl, IControlStyle, TBinding } from "tripetto/module/ui-form";
|
18137 |
|
18138 | export interface INumericStyle extends IControlStyle {
|
18139 |
|
18140 | appearance?: IStyles;
|
18141 |
|
18142 | label?: IStyles;
|
18143 |
|
18144 | disabled?: IStyles;
|
18145 |
|
18146 | placeholder?: IStyles;
|
18147 |
|
18148 | selection?: IStyles;
|
18149 |
|
18150 | required?: IStyles;
|
18151 |
|
18152 | locked?: IStyles;
|
18153 |
|
18154 | focus?: IStyles;
|
18155 |
|
18156 | hover?: IStyles;
|
18157 |
|
18158 | passed?: IStyles;
|
18159 |
|
18160 | failed?: IStyles;
|
18161 |
|
18162 | awaiting?: IStyles;
|
18163 |
|
18164 | fused?: {
|
18165 |
|
18166 | appearance?: IStyles;
|
18167 |
|
18168 | label?: IStyles;
|
18169 |
|
18170 | required?: IStyles;
|
18171 |
|
18172 | locked?: IStyles;
|
18173 |
|
18174 | focus?: IStyles;
|
18175 |
|
18176 | hover?: IStyles;
|
18177 |
|
18178 | passed?: IStyles;
|
18179 |
|
18180 | failed?: IStyles;
|
18181 |
|
18182 | awaiting?: IStyles;
|
18183 | };
|
18184 | }
|
18185 | export class Numeric extends DataControl<number, INumericStyle> {
|
18186 |
|
18187 | static style: INumericStyle | undefined;
|
18188 |
|
18189 | |
18190 |
|
18191 |
|
18192 |
|
18193 |
|
18194 | constructor(nValue?: TBinding<number>, pStyle?: INumericStyle);
|
18195 |
|
18196 | /** Retrieves the static element. */
|
18197 | protected get static(): Element | undefined;
|
18198 | /** Retrieves if the input value. */
|
18199 | get value(): number;
|
18200 | /** Sets the input value. */
|
18201 | set value(nValue: number);
|
18202 | /** Retrieves the formatted value. */
|
18203 | get string(): string;
|
18204 |
|
18205 | /**
|
18206 | * Sets the input data for the control.
|
18207 | * @param nValue Specifies the input data.
|
18208 | */
|
18209 | protected input(nValue: number): number;
|
18210 | /**
|
18211 | * Draws the control.
|
18212 | * @param pForm Reference to the parent form element.
|
18213 | * @event
|
18214 | */
|
18215 | protected onDraw(pForm: Element): Element;
|
18216 | /**
|
18217 | * Updates the control.
|
18218 | * @event
|
18219 | */
|
18220 | protected onUpdate(): void;
|
18221 | /**
|
18222 | * Invoked when the input field captures focus.
|
18223 | * @event
|
18224 | */
|
18225 | protected onFocus(bAutoFocus: boolean): void;
|
18226 | /**
|
18227 | * Invoked when the focus state of the control is changed.
|
18228 | * @event
|
18229 | */
|
18230 | protected onFocusOptions(): void;
|
18231 | /**
|
18232 | * Invoked when the input field loses focus.
|
18233 | * @event
|
18234 | */
|
18235 | protected onBlur(): void;
|
18236 | /**
|
18237 | * Invoked when the enter (return) key is pressed.
|
18238 | * @param pElement Reference to the element.
|
18239 | * @return Return `true` if you want to cancel key bubbling.
|
18240 | * @event
|
18241 | */
|
18242 | protected onEnter(pElement: Element): boolean;
|
18243 | /**
|
18244 | * Invoked when the escape key is pressed.
|
18245 | * @param pElement Reference to the element.
|
18246 | * @return Return `true` if you want to cancel key bubbling.
|
18247 | * @event
|
18248 | */
|
18249 | protected onEscape(pElement: Element): boolean;
|
18250 | /**
|
18251 | * Invoked when the input value changes.
|
18252 | * @event
|
18253 | */
|
18254 | protected onData(): void;
|
18255 | /**
|
18256 | * Sets the focus to the control.
|
18257 | * @return Returns `true` if the focus is set.
|
18258 | */
|
18259 | focus(): boolean;
|
18260 | /** Blurs the focus of the control. */
|
18261 | blur(): void;
|
18262 | /**
|
18263 | * Sets a fixed width for the control.
|
18264 | * @param nWidth Specifies the control width in pixels.
|
18265 | * @return Returns a reference to the control to allow chaining.
|
18266 | */
|
18267 | width(nWidth: number): this;
|
18268 | /**
|
18269 | * Sets the alignment of the control.
|
18270 | * @param sAlign Specifies the alignment.
|
18271 | * @return Returns a reference to the control to allow chaining.
|
18272 | */
|
18273 | align(sAlign: "left" | "center" | "right"): this;
|
18274 | /**
|
18275 | * Specifies if the alignment should be set to the left on focus.
|
18276 | * @param bAlignLeftOnFocus Specifies if the alignment should be set to left on focus.
|
18277 | * @return Returns a reference to the control to allow chaining.
|
18278 | */
|
18279 | alignLeftOnFocus(bAlignLeftOnFocus: boolean): this;
|
18280 | /**
|
18281 | * Sets a minimum value.
|
18282 | * @param nMin Specifies the minimum value.
|
18283 | * @return Returns a reference to the control to allow chaining.
|
18284 | */
|
18285 | min(nMin: number | undefined): this;
|
18286 | /**
|
18287 | * Sets a maximum value.
|
18288 | * @param nMax Specifies the maximum value.
|
18289 | * @return Returns a reference to the control to allow chaining.
|
18290 | */
|
18291 | max(nMax: number | undefined): this;
|
18292 | /**
|
18293 | * Specifies the precision.
|
18294 | * @param nPrecision Specifies the number of precision digits.
|
18295 | * @return Returns a reference to the control to allow chaining.
|
18296 | */
|
18297 | precision(nPrecision: number | "auto"): this;
|
18298 | /**
|
18299 | * Sets the decimal sign.
|
18300 | * @param sDecimal Specifies the decimal sign.
|
18301 | * @return Returns a reference to the control to allow chaining.
|
18302 | */
|
18303 | decimalSign(sDecimal: string): this;
|
18304 | /**
|
18305 | * Specify the number of digits for the numer.
|
18306 | * @param nDigits Specifies the desired length.
|
18307 | * @return Returns a reference to the control to allow chaining.
|
18308 | */
|
18309 | digits(nDigits: number): this;
|
18310 | /**
|
18311 | * Specifies if the thousands separator should be shown and which sign should
|
18312 | * be used.
|
18313 | * @param bThousands Specifies if the thousands separator should be shown.
|
18314 | * @param sThousandsSign Specifies the thousands separator sign.
|
18315 | * @return Returns a reference to the control to allow chaining.
|
18316 | */
|
18317 | thousands(bThousands: boolean, sThousandsSign?: string): this;
|
18318 | /**
|
18319 | * Specifies the prefix.
|
18320 | * @param sPrefix Specifies the prefix string.
|
18321 | * @return Returns a reference to the control to allow chaining.
|
18322 | */
|
18323 | prefix(sPrefix: string): this;
|
18324 | /**
|
18325 | * Specifies the plural prefix.
|
18326 | * @param sPrefixPlural Specifies the prefix string.
|
18327 | * @return Returns a reference to the control to allow chaining.
|
18328 | */
|
18329 | prefixPlural(sPrefixPlural: string | undefined): this;
|
18330 | /**
|
18331 | * Specifies the suffix.
|
18332 | * @param sSuffix Specifies the suffix string.
|
18333 | * @return Returns a reference to the control to allow chaining.
|
18334 | */
|
18335 | suffix(sSuffix: string): this;
|
18336 | /**
|
18337 | * Specifies the plural suffix.
|
18338 | * @param sSuffixPlural Specifies the suffix string.
|
18339 | * @return Returns a reference to the control to allow chaining.
|
18340 | */
|
18341 | suffixPlural(sSuffixPlural: string | undefined): this;
|
18342 | /**
|
18343 | * Specifies if the number needs to be selected automatically.
|
18344 | * @param sSelect Specifies if the number needs to be selected.
|
18345 | * @return Returns a reference to the control to allow chaining.
|
18346 | */
|
18347 | autoSelect(sSelect?: "no" | "focus" | "auto-focus"): this;
|
18348 | /**
|
18349 | * Specifies the function which is invoked when the user presses the enter key.
|
18350 | * @param fnEnter Specifies the function to invoke. To cancel the normal
|
18351 | * behavior return `true` within the function.
|
18352 | * @return Returns a reference to the control to allow chaining.
|
18353 | */
|
18354 | enter(fnEnter: (pNumber: Numeric) => boolean): this;
|
18355 | /**
|
18356 | * Specifies the function which is invoked when the user presses the escape key.
|
18357 | * @param fnEscape Specifies the function to invoke. To cancel the normal
|
18358 | * behavior return `true` within the function.
|
18359 | * @return Returns a reference to the control to allow chaining.
|
18360 | */
|
18361 | escape(fnEscape: (pNumber: Numeric) => boolean): this;
|
18362 | /**
|
18363 | * Specifies the function which is invoked when the input value changes.
|
18364 | * @param fnChange Specifies the change function.
|
18365 | * @return Returns a reference to the control to allow chaining.
|
18366 | */
|
18367 | on(fnChange: (pNumber: Numeric) => void): this;
|
18368 | /**
|
18369 | * Selects the number.
|
18370 | * @return Returns a reference to the control to allow chaining.
|
18371 | */
|
18372 | select(): this;
|
18373 | }
|
18374 | }
|
18375 |
|
18376 | declare module "tripetto/module/ui-form-radiobutton" {
|
18377 | import { Element, IStyles } from "tripetto/module/dom";
|
18378 | import { TAny } from "tripetto/module/functional";
|
18379 | import { IMarkdownOptions } from "tripetto/module/markdown";
|
18380 | import { DataControl, IControlStyle, TBinding } from "tripetto/module/ui-form";
|
18381 |
|
18382 | interface IButton<T> {
|
18383 |
|
18384 | readonly value: T;
|
18385 |
|
18386 | readonly label: string;
|
18387 |
|
18388 | readonly disabled?: boolean;
|
18389 |
|
18390 | readonly visible?: boolean;
|
18391 |
|
18392 | readonly description?: string;
|
18393 |
|
18394 | readonly markdown?: boolean | IMarkdownOptions<TAny>;
|
18395 | }
|
18396 | export interface IRadiobuttonStyles {
|
18397 |
|
18398 | label?: IStyles;
|
18399 |
|
18400 | checked?: IStyles;
|
18401 |
|
18402 | unchecked?: IStyles;
|
18403 | }
|
18404 | export interface IRadiobuttonStyle extends IControlStyle {
|
18405 |
|
18406 | appearance?: IStyles;
|
18407 |
|
18408 | radiobutton?: {
|
18409 |
|
18410 | label?: IStyles;
|
18411 |
|
18412 | checked?: IStyles;
|
18413 |
|
18414 | unchecked?: IStyles;
|
18415 |
|
18416 | disabled?: IRadiobuttonStyles;
|
18417 |
|
18418 | focus?: IRadiobuttonStyles;
|
18419 |
|
18420 | hover?: IRadiobuttonStyles;
|
18421 |
|
18422 | description?: IStyles;
|
18423 | };
|
18424 |
|
18425 | label?: IStyles;
|
18426 |
|
18427 | disabled?: IStyles;
|
18428 |
|
18429 | required?: IStyles;
|
18430 |
|
18431 | locked?: IStyles;
|
18432 |
|
18433 | passed?: IStyles;
|
18434 |
|
18435 | failed?: IStyles;
|
18436 |
|
18437 | awaiting?: IStyles;
|
18438 |
|
18439 | fused?: {
|
18440 |
|
18441 | appearance?: IStyles;
|
18442 |
|
18443 | label?: IStyles;
|
18444 |
|
18445 | required?: IStyles;
|
18446 | };
|
18447 | }
|
18448 | export class Radiobutton<T> extends DataControl<T | undefined, IRadiobuttonStyle> {
|
18449 |
|
18450 | static style: IRadiobuttonStyle | undefined;
|
18451 |
|
18452 | |
18453 |
|
18454 |
|
18455 |
|
18456 |
|
18457 |
|
18458 | constructor(pButtons: IButton<T>[], pValue: TBinding<T>, pStyle?: IRadiobuttonStyle);
|
18459 | /** Retrieves the static element. */
|
18460 | protected get static(): Element | undefined;
|
18461 | /** Retrieves if the selected value. */
|
18462 | get value(): T | undefined;
|
18463 | /** Sets the selected value. */
|
18464 | set value(sValue: T | undefined);
|
18465 |
|
18466 | /**
|
18467 | * Draws the control.
|
18468 | * @param pForm Reference to the parent form element.
|
18469 | * @event
|
18470 | */
|
18471 | protected onDraw(pForm: Element): Element;
|
18472 | /**
|
18473 | * Updates the control.
|
18474 | * @event
|
18475 | */
|
18476 | protected onUpdate(): void;
|
18477 | /**
|
18478 | * Invoked when the focus state of the control is changed.
|
18479 | * @event
|
18480 | */
|
18481 | protected onFocusOptions(): void;
|
18482 | /**
|
18483 | * Invoked when the state of the checkbox changes.
|
18484 | * @event
|
18485 | */
|
18486 | protected onData(): void;
|
18487 | /**
|
18488 | * Invoked when the control is disabled.
|
18489 | * @event
|
18490 | */
|
18491 | protected onDisable(): void;
|
18492 | /**
|
18493 | * Invoked when the control is locked.
|
18494 | * @event
|
18495 | */
|
18496 | protected onLock(): void;
|
18497 | /**
|
18498 | * Selects the specified button.
|
18499 | * @param pValue Specifies the button value.
|
18500 | */
|
18501 | select(pValue: T): this;
|
18502 | /**
|
18503 | * Sets the focus.
|
18504 | * @param sTo Set focus to the first or last button.
|
18505 | * @return Returns `true` if the focus is set.
|
18506 | */
|
18507 | focus(sTo?: "first" | "last"): boolean;
|
18508 | /**
|
18509 | * Sets the focus to the previous or next button
|
18510 | * @param sTo Specifies if the focus is set to the previous or next button.
|
18511 | * @return Returns `true` if the focus is captured by an button.
|
18512 | */
|
18513 | focusTo(sTo: "previous" | "next"): boolean;
|
18514 | /** Blurs the focus. */
|
18515 | blur(): void;
|
18516 | /**
|
18517 | * Specifies the function which is invoked when the radiobutton selection is
|
18518 | * changed.
|
18519 | * @param fnChange Specifies the change function.
|
18520 | * @return Returns a reference to the control to allow chaining.
|
18521 | */
|
18522 | on(fnChange: (pRadiobutton: Radiobutton<T>) => void): this;
|
18523 | /**
|
18524 | * Retrieves or sets the label of the specified button or the current button if no
|
18525 | * button value is specified.
|
18526 | * @param pValue Specifies the button value.
|
18527 | * @param sLabel Specifies the new label.
|
18528 | * @return Returns the label.
|
18529 | */
|
18530 | buttonLabel(pValue?: T, sLabel?: string): string;
|
18531 | /**
|
18532 | * Retrieves or sets the description of the specified button or the current button if no
|
18533 | * button value is specified.
|
18534 | * @param pValue Specifies the button value.
|
18535 | * @param sDescription Specifies the new description.
|
18536 | * @return Returns the label.
|
18537 | */
|
18538 | buttonDescription(pValue?: T, sDescription?: string): string;
|
18539 | /**
|
18540 | * Sets or retrieves the disabled state of the specified button (or
|
18541 | * the current button if no button value is specified).
|
18542 | * @param pValue Specifies the value of the button to get or set.
|
18543 | * @param bDisabled Specifies the disabled state.
|
18544 | * @return Returns the disabled state.
|
18545 | */
|
18546 | buttonDisabled(pValue?: T, bDisabled?: boolean): boolean;
|
18547 | /**
|
18548 | * Sets or retrieves the visibility of the specified button (or the
|
18549 | * current button if no button value is specified).
|
18550 | * @param pValue Specifies the value of the button to get or set.
|
18551 | * @param bVisible Specifies the visibility.
|
18552 | * @return Returns the visibility.
|
18553 | */
|
18554 | buttonVisible(pValue?: T, bVisible?: boolean): boolean;
|
18555 | }
|
18556 |
|
18557 | export { IButton as IRadiobutton };
|
18558 | }
|
18559 |
|
18560 | declare module "tripetto/module/ui-form-spacer" {
|
18561 | import { Element } from "tripetto/module/dom";
|
18562 | import { IControlStyle, StaticControl } from "tripetto/module/ui-form";
|
18563 |
|
18564 | export interface ISpacerStyle extends IControlStyle {
|
18565 |
|
18566 | large: number;
|
18567 |
|
18568 | small: number;
|
18569 | }
|
18570 | export class Spacer extends StaticControl<ISpacerStyle> {
|
18571 |
|
18572 | static style: ISpacerStyle | undefined;
|
18573 |
|
18574 | |
18575 |
|
18576 |
|
18577 |
|
18578 | constructor(sType?: "large" | "small", pStyle?: ISpacerStyle);
|
18579 | /**
|
18580 | * Draws the control.
|
18581 | * @param pForm Reference to the parent form element.
|
18582 | * @event
|
18583 | */
|
18584 | protected onDraw(pForm: Element): Element;
|
18585 | }
|
18586 | }
|
18587 |
|
18588 | declare module "tripetto/module/ui-form-static" {
|
18589 | import { Element, IStyles } from "tripetto/module/dom";
|
18590 | import { IControlStyle, StaticControl } from "tripetto/module/ui-form";
|
18591 |
|
18592 | export interface IStaticStyle extends IControlStyle {
|
18593 |
|
18594 | appearance?: IStyles;
|
18595 |
|
18596 | fused?: IStyles;
|
18597 |
|
18598 | disabled?: IStyles;
|
18599 | }
|
18600 | export class Static extends StaticControl<IStaticStyle> {
|
18601 |
|
18602 | static style: IStaticStyle | undefined;
|
18603 | |
18604 |
|
18605 |
|
18606 |
|
18607 |
|
18608 | constructor(sLabel?: string, pStyle?: IStaticStyle);
|
18609 | /** Retrieves the static element. */
|
18610 | protected get static(): Element | undefined;
|
18611 | /**
|
18612 | * Draws the control.
|
18613 | * @param pForm Reference to the parent form element.
|
18614 | * @event
|
18615 | */
|
18616 | protected onDraw(pForm: Element): Element;
|
18617 | }
|
18618 | }
|
18619 |
|
18620 | declare module "tripetto/module/ui-form-text" {
|
18621 | import { Element, IStyles } from "tripetto/module/dom";
|
18622 | import { DataControl, IControlStyle, TBinding, TControlValidation } from "tripetto/module/ui-form";
|
18623 |
|
18624 | export interface ITextStyle extends IControlStyle {
|
18625 |
|
18626 | appearance?: IStyles;
|
18627 |
|
18628 | label?: IStyles;
|
18629 |
|
18630 | disabled?: IStyles;
|
18631 |
|
18632 | placeholder?: IStyles;
|
18633 |
|
18634 | selection?: IStyles;
|
18635 |
|
18636 | required?: IStyles;
|
18637 |
|
18638 | locked?: IStyles;
|
18639 |
|
18640 | focus?: IStyles;
|
18641 |
|
18642 | hover?: IStyles;
|
18643 |
|
18644 | passed?: IStyles;
|
18645 |
|
18646 | failed?: IStyles;
|
18647 |
|
18648 | awaiting?: IStyles;
|
18649 |
|
18650 | fused?: {
|
18651 |
|
18652 | appearance?: IStyles;
|
18653 |
|
18654 | label?: IStyles;
|
18655 |
|
18656 | required?: IStyles;
|
18657 |
|
18658 | locked?: IStyles;
|
18659 |
|
18660 | focus?: IStyles;
|
18661 |
|
18662 | hover?: IStyles;
|
18663 |
|
18664 | passed?: IStyles;
|
18665 |
|
18666 | failed?: IStyles;
|
18667 |
|
18668 | awaiting?: IStyles;
|
18669 | };
|
18670 | }
|
18671 | type Transformations = "none" | "capitalize" | "capitalize-words" | "capitalize-sentences" | "uppercase" | "lowercase";
|
18672 | type Types = "singleline" | "multiline" | "multiline-wo-crlf" | "password" | "email";
|
18673 | type InputModes = "text" | "decimal" | "numeric" | "tel" | "search" | "email" | "url";
|
18674 | export interface ITextSuggestion {
|
18675 | readonly id?: string;
|
18676 | readonly name: string;
|
18677 | }
|
18678 | export type TTextSuggestions = (ITextSuggestion | string)[];
|
18679 | export class Text extends DataControl<string, ITextStyle> {
|
18680 |
|
18681 | static style: ITextStyle | undefined;
|
18682 |
|
18683 | |
18684 |
|
18685 |
|
18686 |
|
18687 |
|
18688 |
|
18689 |
|
18690 | constructor(sType?: Types, sValue?: TBinding<string>, nLines?: number, pStyle?: ITextStyle);
|
18691 |
|
18692 | /** Retrieves the static element. */
|
18693 | protected get static(): Element | undefined;
|
18694 | /** Retrieves the input type. */
|
18695 | get type(): Types;
|
18696 | /** Retrieves if the input value. */
|
18697 | get value(): string;
|
18698 | /** Sets the input value. */
|
18699 | set value(sValue: string);
|
18700 | /** Retrieves the current selected suggestion. */
|
18701 | get suggestion(): ITextSuggestion | undefined;
|
18702 |
|
18703 | /**
|
18704 | * Sets the input value and applies data sanitization.
|
18705 | * @param sValue Specifies the new value.
|
18706 | * @return Returns the data value.
|
18707 | */
|
18708 | protected input(sValue: string): string;
|
18709 | /**
|
18710 | * Draws the control.
|
18711 | * @param pForm Reference to the parent form element.
|
18712 | * @event
|
18713 | */
|
18714 | protected onDraw(pForm: Element): Element;
|
18715 | /**
|
18716 | * Updates the control.
|
18717 | * @event
|
18718 | */
|
18719 | protected onUpdate(): void;
|
18720 | /**
|
18721 | * Invoked when the input field captures focus.
|
18722 | * @event
|
18723 | */
|
18724 | protected onFocus(bAutoFocus: boolean): void;
|
18725 | /**
|
18726 | * Invoked when the focus state of the control is changed.
|
18727 | * @event
|
18728 | */
|
18729 | protected onFocusOptions(): void;
|
18730 | /**
|
18731 | * Invoked when the input field loses focus.
|
18732 | * @event
|
18733 | */
|
18734 | protected onBlur(): void;
|
18735 | /**
|
18736 | * Invoked when the enter (return) key is pressed.
|
18737 | * @param pElement Reference to the element.
|
18738 | * @return Return `true` if you want to cancel key bubbling.
|
18739 | * @event
|
18740 | */
|
18741 | protected onEnter(pElement: Element): boolean;
|
18742 | /**
|
18743 | * Invoked when the escape key is pressed.
|
18744 | * @param pElement Reference to the element.
|
18745 | * @return Return `true` if you want to cancel key bubbling.
|
18746 | * @event
|
18747 | */
|
18748 | protected onEscape(pElement: Element): boolean;
|
18749 | /**
|
18750 | * Invoked when the input value changes.
|
18751 | * @event
|
18752 | */
|
18753 | protected onData(): void;
|
18754 | /**
|
18755 | * Invoked when the text control is first measured.
|
18756 | * @return Returns the measure correction for the text control.
|
18757 | * @event
|
18758 | */
|
18759 | onMeasure(): number;
|
18760 | /**
|
18761 | * Invoked when the control mode is changed.
|
18762 | * @event
|
18763 | */
|
18764 | onMode(): void;
|
18765 | /**
|
18766 | * Sets the focus to the control.
|
18767 | * @return Returns `true` if the focus is set.
|
18768 | */
|
18769 | focus(): boolean;
|
18770 | /** Blurs the focus of the control. */
|
18771 | blur(): void;
|
18772 | /**
|
18773 | * Sets a fixed width for the control.
|
18774 | * @param nWidth Specifies the control width in pixels.
|
18775 | * @return Returns a reference to the control to allow chaining.
|
18776 | */
|
18777 | width(nWidth: number): this;
|
18778 | /**
|
18779 | * Sets a fixed number of lines for the control (auto-sizing will be disabled).
|
18780 | * @param nLines Specifies the number of lines.
|
18781 | * @return Returns a reference to the control to allow chaining.
|
18782 | */
|
18783 | fixedLines(nLines: number): this;
|
18784 | /**
|
18785 | * Sets the alignment of the control.
|
18786 | * @param sAlign Specifies the alignment.
|
18787 | * @return Returns a reference to the control to allow chaining.
|
18788 | */
|
18789 | align(sAlign: "left" | "center" | "right"): this;
|
18790 | /**
|
18791 | * Specifies if string sanitizing should be applied.
|
18792 | * @param bSanitize Specifies if string sanitizing should be applied.
|
18793 | * @return Returns a reference to the control to allow chaining.
|
18794 | */
|
18795 | sanitize(bSanitize?: boolean): this;
|
18796 | /**
|
18797 | * Specifies if string trim should be applied.
|
18798 | * @param bTrim Specifies if string trimming should be applied.
|
18799 | * @return Returns a reference to the control to allow chaining.
|
18800 | */
|
18801 | trim(bTrim?: boolean): this;
|
18802 | /**
|
18803 | * Specifies the maximum text length.
|
18804 | * @param nMaxLength Specifies the maximum text length (supply `0` to disable the maximum length).
|
18805 | * @return Returns a reference to the control to allow chaining.
|
18806 | */
|
18807 | maxLength(nMaxLength: number): this;
|
18808 | /**
|
18809 | * Sets a name for the text control.
|
18810 | * @param sName Specifies the name.
|
18811 | * @return Returns a reference to the control to allow chaining.
|
18812 | */
|
18813 | name(sName: string): this;
|
18814 | /**
|
18815 | * Sets a placeholder for the text control.
|
18816 | * @param sPlaceholder Specifies the placeholder text.
|
18817 | * @return Returns a reference to the control to allow chaining.
|
18818 | */
|
18819 | placeholder(sPlaceholder: string): this;
|
18820 | /**
|
18821 | * Sets the input mode for the text control.
|
18822 | * @param sMode Specifies the mode.
|
18823 | * @return Returns a reference to the control to allow chaining.
|
18824 | */
|
18825 | inputMode(sMode: InputModes): this;
|
18826 | /**
|
18827 | * Specifies the text transformation.
|
18828 | * @param sTransformation Specifies the transformation type.
|
18829 | * @return Returns a reference to the control to allow chaining.
|
18830 | */
|
18831 | transformation(sTransformation: Transformations): this;
|
18832 | /**
|
18833 | * Specifies if the text needs to be selected automatically.
|
18834 | * @param sSelect Specifies if the text needs to be selected.
|
18835 | * @return Returns a reference to the control to allow chaining.
|
18836 | */
|
18837 | autoSelect(sSelect?: "no" | "focus" | "auto-focus"): this;
|
18838 | /**
|
18839 | * Enables automatic control validation.
|
18840 | * @param fnValidation Specifies the validator.
|
18841 | */
|
18842 | autoValidate(fnValidation?: TControlValidation<Text>): this;
|
18843 | /**
|
18844 | * Specifies text suggestions for the text control.
|
18845 | * @param pSuggestions Specifies the list of suggestions.
|
18846 | */
|
18847 | suggestions(pSuggestions?: TTextSuggestions): this;
|
18848 | /**
|
18849 | * Specifies the function which is invoked when the user presses the enter key.
|
18850 | * @param fnEnter Specifies the function to invoke. To cancel the normal
|
18851 | * behavior return `true` within the function.
|
18852 | * @return Returns a reference to the control to allow chaining.
|
18853 | */
|
18854 | enter<T extends Text>(fnEnter: (pText: T) => boolean): this;
|
18855 | /**
|
18856 | * Specifies the function which is invoked when the user presses the escape key.
|
18857 | * @param fnEscape Specifies the function to invoke. To cancel the normal
|
18858 | * behavior return `true` within the function.
|
18859 | * @return Returns a reference to the control to allow chaining.
|
18860 | */
|
18861 | escape<T extends Text>(fnEscape: (pText: T) => boolean): this;
|
18862 | /**
|
18863 | * Specifies the function which is invoked when the input value changes.
|
18864 | * @param fnChange Specifies the change function.
|
18865 | * @return Returns a reference to the control to allow chaining.
|
18866 | */
|
18867 | on<T extends Text>(fnChange: (pText: T) => void): this;
|
18868 | /**
|
18869 | * Selects the text.
|
18870 | * @return Returns a reference to the control to allow chaining.
|
18871 | */
|
18872 | select(): this;
|
18873 | /**
|
18874 | * Attaches an key action to the control.
|
18875 | * @param sKey Specifies the key to bind the action to.
|
18876 | * @param fnAction Specifies the action function to execute.
|
18877 | * @return Returns a reference to the control to allow chaining.
|
18878 | */
|
18879 | action(
|
18880 | sKey: string,
|
18881 | fnAction: (
|
18882 | fnDone: (sText?: string) => void,
|
18883 | pText: Element
|
18884 | ) => ((sKey: string) => "capture" | "cancel" | "continue") | undefined | void
|
18885 | ): this;
|
18886 | /** Copies the contents of the input control to the clipboard. */
|
18887 | copyToClipboard(): void;
|
18888 | /** Destroys the control. */
|
18889 | destroy(): void;
|
18890 | }
|
18891 |
|
18892 | export { InputModes as TextInputModes, Transformations as TextTransformations, Types as TextTypes };
|
18893 | }
|
18894 |
|
18895 | declare module "tripetto/module/ui-grid2layer" {
|
18896 | import { Element, Stylesheet } from "tripetto/module/dom";
|
18897 | import { GridLayout, GridRenderer, IGridLayout, TGrid, TGridResource } from "tripetto/module/grid";
|
18898 | import { Coordinate, IPoint } from "tripetto/module/metrics";
|
18899 | import { Layer } from "tripetto/module/ui-layers";
|
18900 |
|
18901 | export abstract class Renderer<Grid extends TGrid, Types extends TGridResource, Style> extends GridRenderer<Grid, Types> {
|
18902 | |
18903 |
|
18904 |
|
18905 |
|
18906 |
|
18907 | constructor(pLayouts: IGridLayout<Grid, Types>[], pLayer: Layer, pStyle: Style | undefined);
|
18908 | /** Retrieves a reference to the layer. */
|
18909 | get layer(): Layer;
|
18910 | /** Retrieves the stylesheet for the renderer. */
|
18911 | get stylesheet(): Stylesheet;
|
18912 | /** Retrieves the rendere styles. */
|
18913 | get style(): Style;
|
18914 | /** Retrieves if the rendering is zooming. */
|
18915 | get isZooming(): boolean;
|
18916 | /** Retrieves if the rendering is moving an item. */
|
18917 | get isMoving(): boolean;
|
18918 |
|
18919 | /** Renders the rendering. */
|
18920 | protected abstract render(): void;
|
18921 | /**
|
18922 | * Retrieves the layout for the specified type.
|
18923 | * @param pType Reference to the type.
|
18924 | * @return Returns the layout instance.
|
18925 | */
|
18926 | layout<Type extends Types>(pType: Type): Layout<Grid, Type, Style>;
|
18927 | /**
|
18928 | * Fired when the dimensions of the rendering are changed.
|
18929 | * @param nWidth Specifies the width.
|
18930 | * @param nHeight Specifies the height.
|
18931 | * @param nZoom Contains the zoom factor.
|
18932 | * @param sReason Specifies the reason for the resize.
|
18933 | * @event
|
18934 | */
|
18935 | onResize(nWidth: number, nHeight: number, nZoom: number, sReason: "redraw" | "width" | "height" | "zoom"): void;
|
18936 | /**
|
18937 | * Fired when the zoom animation starts.
|
18938 | * @param nZoom Specifies the zoom factor.
|
18939 | * @event
|
18940 | */
|
18941 | onZoomStart(nZoom: number): void;
|
18942 | /**
|
18943 | * Fired when the zoom factor is changed.
|
18944 | * @param nZoom Specifies the zoom factor.
|
18945 | * @event
|
18946 | */
|
18947 | onZoom(nZoom: number): void;
|
18948 | /**
|
18949 | * Fired when the zoom animation ends.
|
18950 | * @param nZoom Specifies the zoom factor.
|
18951 | * @event
|
18952 | */
|
18953 | onZoomEnd(nZoom: number): void;
|
18954 | /**
|
18955 | * Fired when a move starts.
|
18956 | * @event
|
18957 | */
|
18958 | onMoveStart(): void;
|
18959 | /**
|
18960 | * Fired when the moving ends.
|
18961 | * @event
|
18962 | */
|
18963 | onMoveEnd(): void;
|
18964 | }
|
18965 | export abstract class Layout<Grid extends TGrid, Parent extends TGridResource, Style> extends GridLayout<Grid, Parent> {
|
18966 | |
18967 |
|
18968 |
|
18969 |
|
18970 |
|
18971 |
|
18972 |
|
18973 | constructor(pRenderer: Renderer<Grid, TGridResource, Style>, pParent: Parent, pLayer: Layer, bMovable: boolean);
|
18974 | /** Retrieves a reference to the parent. */
|
18975 | protected get layer(): Layer;
|
18976 | /** Retrieves the stylesheet for the renderer. */
|
18977 | get stylesheet(): Stylesheet;
|
18978 | /** Retrieves the renderer styles. */
|
18979 | get style(): Style;
|
18980 | /** Retrieves a reference to the element. */
|
18981 | get element(): Element | undefined;
|
18982 | /** Specifies the area in which a move can be initiated. */
|
18983 | get moveArea(): Coordinate;
|
18984 | /** Retrieves a reference to the guides element. */
|
18985 | get guides(): Element | undefined;
|
18986 | /** Retrieves if the layout is moved. */
|
18987 | get isMoving(): boolean;
|
18988 | /** Retrieves if the layout is following a movement. */
|
18989 | get isFollowing(): boolean;
|
18990 | /** Retrieves if the layout is ensuing. */
|
18991 | get isEnsuing(): boolean;
|
18992 | /** Retrieves if hover events are allowed. */
|
18993 | get isHoverAllowed(): boolean;
|
18994 |
|
18995 | /**
|
18996 | * Enables the rulers for the layout.
|
18997 | * @param sColor Specifies a color for the rulers.
|
18998 | * @param bVisible Specifies if the rulers are initial visible.
|
18999 | */
|
19000 | protected enableRulers(sColor?: string, bVisible?: boolean): void;
|
19001 | /**
|
19002 | * Draws the element body for the layout. This function is invoked when the
|
19003 | * layout is rendered to the element.
|
19004 | * @param nLeft Specifies the horizontal position.
|
19005 | * @param nTop Specifies the vertical position.
|
19006 | * @param nWidth Specifies the width.
|
19007 | * @param nHeight Specifies the height.
|
19008 | * @param nZoom Contains the zoom factor.
|
19009 | * @param nZ Specifies the z-index.
|
19010 | * @param bRedraw Specifies if the element is redrawn.
|
19011 | */
|
19012 | protected abstract draw(
|
19013 | nLeft: number,
|
19014 | nTop: number,
|
19015 | nWidth: number,
|
19016 | nHeight: number,
|
19017 | nZoom: number,
|
19018 | nZ: number,
|
19019 | bRedraw: boolean
|
19020 | ): void;
|
19021 | /**
|
19022 | * Renders the layout to an element.
|
19023 | * @param sType Specifies the render type. Can be one of the following values:
|
19024 | * - `render`: Do a complete render (the layout element is always (re)created);
|
19025 | * - `refresh`: Refresh the rendering (the contents of the layout element is (re)created);
|
19026 | * - `update`: Update the rendering (quick update of the the layout contents).
|
19027 | */
|
19028 | render(sType: "render" | "refresh" | "update"): void;
|
19029 | /**
|
19030 | * Sets the position of the layout element.
|
19031 | * @param nLeft Specifies the horizontal position.
|
19032 | * @param nTop Specifies the vertical position.
|
19033 | * @param nZoom Contains the zoom factor.
|
19034 | * @param sReason Specifies the reason for the position change.
|
19035 | */
|
19036 | position(nLeft: number, nTop: number, nZoom: number, sReason: "redraw" | "zoom"): void;
|
19037 | /**
|
19038 | * Sets the dimensions of the layout element.
|
19039 | * @param nWidth Specifies the width.
|
19040 | * @param nHeight Specifies the height.
|
19041 | * @param nZoom Contains the zoom factor.
|
19042 | * @param sReason Specifies the reason for the resize.
|
19043 | */
|
19044 | resize(nWidth: number, nHeight: number, nZoom: number, sReason: "redraw" | "width" | "height" | "zoom"): void;
|
19045 | /**
|
19046 | * Fired when the z-index is changed.
|
19047 | * @param nZ Specifies the z-index.
|
19048 | */
|
19049 | zIndex(nZ: number): void;
|
19050 | /**
|
19051 | * Sets the moving state of a layout.
|
19052 | * @param bMoving Specifies if the layout is moving.
|
19053 | * @return Returns `true` if the state is changed.
|
19054 | */
|
19055 | moving(bMoving: boolean): boolean;
|
19056 | /**
|
19057 | * Sets the following state of a layout.
|
19058 | * @param bFollowing Specifies if the layout is following.
|
19059 | * @return Returns `true` if the state is changed.
|
19060 | */
|
19061 | following(bFollowing: boolean): boolean;
|
19062 | /**
|
19063 | * Sets the ensuing state of a layout.
|
19064 | * @param bEnsuing Specifies if the layout is ensuing.
|
19065 | * @return Returns `true` if the state is changed.
|
19066 | */
|
19067 | ensuing(bEnsuing: boolean): boolean;
|
19068 | /**
|
19069 | * Fired when the element should be elevated.
|
19070 | * @param bElevate Specifies if the element is elevated.
|
19071 | */
|
19072 | onElevate(bElevate: boolean): void;
|
19073 | /**
|
19074 | * Fired when the system wants to know if the supplied mouse coordinates
|
19075 | * are within the layout.
|
19076 | * @param nX Specifies the horizontal mouse coordinate.
|
19077 | * @param nY Specifies the vertical mouse coordinate.
|
19078 | * @param pTarget Specifies the target resource.
|
19079 | * @return Returns `true` if the mouse is within the layout.
|
19080 | * @event
|
19081 | */
|
19082 | onIsMoveIn(nX: number, nY: number, pTarget: TGridResource): boolean;
|
19083 | /**
|
19084 | * Specifies the function which is invoked when the move starts.
|
19085 | * @param pOffset Contains the touch/click offset relative to the layout.
|
19086 | * @return Return `true` if the move should be continued.
|
19087 | * @event
|
19088 | */
|
19089 | onMoveStart(pOffset: IPoint): boolean;
|
19090 | /**
|
19091 | * Specifies the function which is invoked when the move ends.
|
19092 | * @param bDragging Specifies if the `MoveStart` event is fired and the
|
19093 | * layout was in dragging mode.
|
19094 | * @event
|
19095 | */
|
19096 | onMoveEnd(bDragging: boolean): void;
|
19097 | /**
|
19098 | * Invoked when the guides should be created.
|
19099 | * @param pGuides Contains the guides element.
|
19100 | * @param bFront Specifies if the guide should be displayed in the front.
|
19101 | * @event
|
19102 | */
|
19103 | onGuides(pGuides?: Element | undefined, bFront?: boolean): void;
|
19104 | /**
|
19105 | * Invoked when the guides of a rendering are changed.
|
19106 | * @param bVisible Indicates if the guides should be visible.
|
19107 | * @param nLeft Specifies the left coordinate of the guides.
|
19108 | * @param nTop Specifies the top coordinate of the guides.
|
19109 | * @param nWidth Specifies the width of the guides.
|
19110 | * @param nHeight Specifies the height of the guides.
|
19111 | * @param nZoom Specifies the zoom factor of the guides.
|
19112 | * @event
|
19113 | */
|
19114 | onGuidesChange(bVisible: boolean, nLeft: number, nTop: number, nWidth: number, nHeight: number, nZoom: number): void;
|
19115 | /** Destroys the guides. */
|
19116 | guidesDestroy(): void;
|
19117 | /** Destroys the layout. */
|
19118 | destroy(): void;
|
19119 | }
|
19120 | }
|
19121 |
|
19122 | declare module "tripetto/module/ui-layers" {
|
19123 | import { Await } from "tripetto/module/callback";
|
19124 | import { Asset, Element, IStyles, Stylesheet } from "tripetto/module/dom";
|
19125 | import { IHookPayload, THooks } from "tripetto/module/hookup";
|
19126 | import { IItemChangeEvent, IItemPopEvent, IItemPushEvent, StrictItem, StrictMatrix } from "tripetto/module/matrix";
|
19127 | import { Dimensions, Rectangle } from "tripetto/module/metrics";
|
19128 | import { IScrollProperties, Scroll } from "tripetto/module/touch-scroll";
|
19129 | import { IScrollbarsProperties, IScrollbarsStyle, Scrollbars } from "tripetto/module/ui-scrollbars";
|
19130 |
|
19131 | enum Alignment {
|
19132 |
|
19133 | Fill = 0,
|
19134 |
|
19135 | Left = 1,
|
19136 |
|
19137 | Top = 2,
|
19138 |
|
19139 | Center = 3,
|
19140 |
|
19141 | Right = 4,
|
19142 |
|
19143 | Bottom = 5,
|
19144 | }
|
19145 |
|
19146 | export interface ILayerAnimation {
|
19147 |
|
19148 | layer?: {
|
19149 |
|
19150 | ready: IStyles;
|
19151 |
|
19152 | show: IStyles;
|
19153 |
|
19154 | hide: IStyles;
|
19155 |
|
19156 | close: IStyles;
|
19157 | };
|
19158 |
|
19159 | overlay?: {
|
19160 |
|
19161 | ready: IStyles;
|
19162 |
|
19163 | show: IStyles;
|
19164 |
|
19165 | hide: IStyles;
|
19166 |
|
19167 | close: IStyles;
|
19168 | };
|
19169 | }
|
19170 |
|
19171 | export interface ILayerStyle {
|
19172 |
|
19173 | layer?: {
|
19174 |
|
19175 | appearance?: IStyles;
|
19176 |
|
19177 | loading?: IStyles;
|
19178 |
|
19179 | ready?: IStyles;
|
19180 |
|
19181 | active?: IStyles;
|
19182 |
|
19183 | inactive?: IStyles;
|
19184 |
|
19185 | hover?: IStyles;
|
19186 |
|
19187 | hide?: IStyles;
|
19188 |
|
19189 | show?: IStyles;
|
19190 |
|
19191 | showing?: IStyles;
|
19192 |
|
19193 | close?: IStyles;
|
19194 |
|
19195 | type?: {
|
19196 |
|
19197 | chain?: IStyles;
|
19198 |
|
19199 | panel?: IStyles;
|
19200 |
|
19201 | floating?: IStyles;
|
19202 |
|
19203 | modal?: IStyles;
|
19204 |
|
19205 | popup?: IStyles;
|
19206 | };
|
19207 |
|
19208 | alignment?: {
|
19209 | horizontal?: {
|
19210 | fill?: IStyles;
|
19211 | left?: IStyles;
|
19212 | center?: IStyles;
|
19213 | right?: IStyles;
|
19214 | };
|
19215 | vertical?: {
|
19216 | fill?: IStyles;
|
19217 | top?: IStyles;
|
19218 | center?: IStyles;
|
19219 | bottom?: IStyles;
|
19220 | };
|
19221 | };
|
19222 |
|
19223 | layout?: {
|
19224 | HABC?: IStyles;
|
19225 | HCBA?: IStyles;
|
19226 | HBCA?: IStyles;
|
19227 | VABC?: IStyles;
|
19228 | VCBA?: IStyles;
|
19229 | VBCA?: IStyles;
|
19230 | };
|
19231 | };
|
19232 |
|
19233 | overlay?: {
|
19234 |
|
19235 | appearance?: IStyles;
|
19236 |
|
19237 | loading?: IStyles;
|
19238 |
|
19239 | ready?: IStyles;
|
19240 |
|
19241 | hide?: IStyles;
|
19242 |
|
19243 | show?: IStyles;
|
19244 |
|
19245 | showing?: IStyles;
|
19246 |
|
19247 | close?: IStyles;
|
19248 | };
|
19249 |
|
19250 | scrollbars?: IScrollbarsStyle;
|
19251 |
|
19252 | applyToChildren?: boolean;
|
19253 | }
|
19254 |
|
19255 | export interface IRectangle {
|
19256 | left: number | undefined;
|
19257 | top: number | undefined;
|
19258 | right: number;
|
19259 | bottom: number;
|
19260 | width: number | undefined;
|
19261 | height: number | undefined;
|
19262 | visible: boolean;
|
19263 | }
|
19264 | enum Layouts {
|
19265 |
|
19266 | None = 0,
|
19267 | |
19268 |
|
19269 |
|
19270 |
|
19271 | HABC = 1,
|
19272 | |
19273 |
|
19274 |
|
19275 |
|
19276 | HCBA = 2,
|
19277 | |
19278 |
|
19279 |
|
19280 |
|
19281 |
|
19282 |
|
19283 | HBCA = 3,
|
19284 | |
19285 |
|
19286 |
|
19287 |
|
19288 | VABC = 4,
|
19289 | |
19290 |
|
19291 |
|
19292 |
|
19293 | VCBA = 5,
|
19294 | |
19295 |
|
19296 |
|
19297 |
|
19298 |
|
19299 | VBCA = 6,
|
19300 | }
|
19301 | type TLayouts = Layouts | "none" | "habc" | "hcba" | "hbca" | "vabc" | "vcba" | "vbca";
|
19302 | export type TThreshold = (pConfiguration: LayerConfiguration, sEvent: "below" | "equal" | "above") => void;
|
19303 | export class LayerConfiguration {
|
19304 |
|
19305 | get layerStyle(): ILayerStyle | undefined;
|
19306 |
|
19307 | get horizontalAlignment(): Alignment;
|
19308 |
|
19309 | get verticalAlignment(): Alignment;
|
19310 |
|
19311 | get isHorizontalLayout(): boolean;
|
19312 |
|
19313 | get isVerticalLayout(): boolean;
|
19314 |
|
19315 | get panelLayout(): Layouts;
|
19316 |
|
19317 | get isGlobal(): boolean;
|
19318 |
|
19319 | get isVisible(): boolean;
|
19320 |
|
19321 | get animationStyles(): ILayerAnimation | undefined;
|
19322 |
|
19323 | get isFocusEnabled(): boolean;
|
19324 |
|
19325 | get isAutoActivate(): boolean;
|
19326 |
|
19327 | get isCapturingEnabled(): boolean;
|
19328 |
|
19329 | get isOverlayVisible(): boolean;
|
19330 |
|
19331 | get isScrollingEnabled(): boolean;
|
19332 |
|
19333 | get isScrollbarsEnabled(): boolean;
|
19334 |
|
19335 | get closeChildPanelsOnTap(): boolean;
|
19336 |
|
19337 | get closeChildPanelsOnStroke(): boolean;
|
19338 |
|
19339 | get isApplicationRole(): boolean;
|
19340 |
|
19341 | get isTouchDisabled(): boolean;
|
19342 |
|
19343 | |
19344 |
|
19345 |
|
19346 |
|
19347 |
|
19348 | style(pStyle: ILayerStyle): this;
|
19349 | |
19350 |
|
19351 |
|
19352 |
|
19353 | global(): this;
|
19354 | |
19355 |
|
19356 |
|
19357 |
|
19358 | local(): this;
|
19359 | |
19360 |
|
19361 |
|
19362 |
|
19363 | preferGlobal(): this;
|
19364 | |
19365 |
|
19366 |
|
19367 |
|
19368 | preferLocal(): this;
|
19369 | |
19370 |
|
19371 |
|
19372 |
|
19373 |
|
19374 | visible(bVisible?: boolean): this;
|
19375 | |
19376 |
|
19377 |
|
19378 |
|
19379 | show(): this;
|
19380 | |
19381 |
|
19382 |
|
19383 |
|
19384 | hide(): this;
|
19385 | |
19386 |
|
19387 |
|
19388 |
|
19389 |
|
19390 | alignHorizontal(sAlign: "fill" | "center" | "left" | "right"): this;
|
19391 | |
19392 |
|
19393 |
|
19394 |
|
19395 | alignFillHorizontal(): this;
|
19396 | |
19397 |
|
19398 |
|
19399 |
|
19400 | alignCenterHorizontal(): this;
|
19401 | |
19402 |
|
19403 |
|
19404 |
|
19405 | alignLeft(): this;
|
19406 | |
19407 |
|
19408 |
|
19409 |
|
19410 | alignRight(): this;
|
19411 | |
19412 |
|
19413 |
|
19414 |
|
19415 |
|
19416 | alignVertical(sAlign: "fill" | "center" | "top" | "bottom"): this;
|
19417 | |
19418 |
|
19419 |
|
19420 |
|
19421 | alignFillVertical(): this;
|
19422 | |
19423 |
|
19424 |
|
19425 |
|
19426 | alignCenterVertical(): this;
|
19427 | |
19428 |
|
19429 |
|
19430 |
|
19431 | alignTop(): this;
|
19432 | |
19433 |
|
19434 |
|
19435 |
|
19436 | alignBottom(): this;
|
19437 | |
19438 |
|
19439 |
|
19440 |
|
19441 |
|
19442 | left(nLeft: number): this;
|
19443 | |
19444 |
|
19445 |
|
19446 |
|
19447 |
|
19448 | top(nTop: number): this;
|
19449 | |
19450 |
|
19451 |
|
19452 |
|
19453 |
|
19454 | right(nRight: number): this;
|
19455 | |
19456 |
|
19457 |
|
19458 |
|
19459 |
|
19460 | bottom(nBottom: number): this;
|
19461 | |
19462 |
|
19463 |
|
19464 |
|
19465 |
|
19466 | width(nWidth: number): this;
|
19467 | |
19468 |
|
19469 |
|
19470 |
|
19471 |
|
19472 | minWidth(nWidth: number | undefined): this;
|
19473 | |
19474 |
|
19475 |
|
19476 |
|
19477 |
|
19478 | maxWidth(nWidth: number | undefined): this;
|
19479 | |
19480 |
|
19481 |
|
19482 |
|
19483 |
|
19484 | height(nHeight: number): this;
|
19485 | |
19486 |
|
19487 |
|
19488 |
|
19489 |
|
19490 | minHeight(nHeight: number | undefined): this;
|
19491 | |
19492 |
|
19493 |
|
19494 |
|
19495 |
|
19496 | maxHeight(nHeight: number | undefined): this;
|
19497 | |
19498 |
|
19499 |
|
19500 |
|
19501 |
|
19502 |
|
19503 | widthThreshold(nThreshold: number, fnThreshold: TThreshold): this;
|
19504 | |
19505 |
|
19506 |
|
19507 |
|
19508 |
|
19509 |
|
19510 | heightThreshold(nThreshold: number, fnThreshold: TThreshold): this;
|
19511 | |
19512 |
|
19513 |
|
19514 |
|
19515 |
|
19516 | animation(pAnimation: ILayerAnimation | undefined): this;
|
19517 | |
19518 |
|
19519 |
|
19520 |
|
19521 |
|
19522 | layout(nLayout: TLayouts): this;
|
19523 | |
19524 |
|
19525 |
|
19526 |
|
19527 |
|
19528 | focus(bFocus?: boolean): this;
|
19529 | |
19530 |
|
19531 |
|
19532 |
|
19533 | preferFocus(): this;
|
19534 | |
19535 |
|
19536 |
|
19537 |
|
19538 |
|
19539 | autoActivate(bAutoActivate?: boolean): this;
|
19540 | |
19541 |
|
19542 |
|
19543 |
|
19544 |
|
19545 | capture(bCapture?: boolean): this;
|
19546 | |
19547 |
|
19548 |
|
19549 |
|
19550 |
|
19551 | overlay(bOverlay?: boolean): this;
|
19552 | |
19553 |
|
19554 |
|
19555 |
|
19556 | preferOverlay(): this;
|
19557 | |
19558 |
|
19559 |
|
19560 |
|
19561 |
|
19562 | scrolling(pProperties?: IScrollProperties): this;
|
19563 | |
19564 |
|
19565 |
|
19566 |
|
19567 |
|
19568 | scrollingProperties(pAsset: Asset): IScrollProperties;
|
19569 | |
19570 |
|
19571 |
|
19572 |
|
19573 |
|
19574 |
|
19575 | scrollbars(pProperties?: IScrollbarsProperties): this;
|
19576 | |
19577 |
|
19578 |
|
19579 |
|
19580 |
|
19581 | scrollbarsProperties(pAsset: Asset): IScrollbarsProperties;
|
19582 | |
19583 |
|
19584 |
|
19585 |
|
19586 |
|
19587 | autoCloseChildPanels(sCloseChildPanels: "no" | "tap" | "stroke"): this;
|
19588 | |
19589 |
|
19590 |
|
19591 |
|
19592 |
|
19593 | applicationRole(bApplicationRole?: boolean): this;
|
19594 | |
19595 |
|
19596 |
|
19597 |
|
19598 |
|
19599 | disableTouch(bDisable?: boolean): this;
|
19600 | |
19601 |
|
19602 |
|
19603 |
|
19604 |
|
19605 |
|
19606 |
|
19607 | rectangle(nWidth: number, nHeight: number, nLayout?: Layouts): IRectangle;
|
19608 | |
19609 |
|
19610 |
|
19611 | attach(pLayer: Layer): this;
|
19612 | |
19613 |
|
19614 |
|
19615 |
|
19616 | detach(pLayer: Layer): void;
|
19617 | }
|
19618 | export interface IComponent {
|
19619 | render(pLayer: Layer, pAwait: Await): Await | void;
|
19620 | }
|
19621 | export abstract class LayerComponent implements IComponent {
|
19622 |
|
19623 | protected static get configuration(): LayerConfiguration;
|
19624 | |
19625 |
|
19626 |
|
19627 |
|
19628 | constructor(pConfiguration?: LayerConfiguration);
|
19629 | /** Retrieves a reference to the component layer. */
|
19630 | get layer(): Layer;
|
19631 | /** Retrieves a reference to the component configuration. */
|
19632 | get configuration(): LayerConfiguration;
|
19633 | /**
|
19634 | * Invoked when the component is rendered.
|
19635 | * @param pLayer Reference to the layer.
|
19636 | * @param pAwait Reference to the await.
|
19637 | */
|
19638 | protected abstract onRender(pLayer: Layer, pAwait: Await): Await | void;
|
19639 | /**
|
19640 | * Indicates the component should wait for the specified condition. Multiple
|
19641 | * conditions (waits) can be set.
|
19642 | * @param fnCondition Specifies a condition which should be evaluated.
|
19643 | * @return Returns `true` if the component will wait.
|
19644 | */
|
19645 | protected wait(fnCondition?: () => boolean): boolean;
|
19646 | /** Indicates the component is done (all wait conditions will be checked). */
|
19647 | protected done(): void;
|
19648 | /**
|
19649 | * Renders the component.
|
19650 | * @param pLayer Reference to the layer.
|
19651 | * @param pAwait Reference to the await.
|
19652 | */
|
19653 | render(pLayer: Layer, pAwait: Await): Await | void;
|
19654 | }
|
19655 | /** Describes the layer event types. */
|
19656 | export type TLayerEvents =
|
19657 | | "OnDraw"
|
19658 | | "OnCalculate"
|
19659 | | "OnCalculated"
|
19660 | | "OnReady"
|
19661 | | "OnResize"
|
19662 | | "OnActivate"
|
19663 | | "OnDeactivate"
|
19664 | | "OnFocus"
|
19665 | | "OnBlur"
|
19666 | | "OnHover"
|
19667 | | "OnBeforeHide"
|
19668 | | "OnHide"
|
19669 | | "OnBeforeShow"
|
19670 | | "OnShow"
|
19671 | | "OnClose"
|
19672 | | "OnBeforeShowPanel"
|
19673 | | "OnShowPanel"
|
19674 | | "OnClosePanel"
|
19675 | | "OnDestroy";
|
19676 | /** Describes the layer event. */
|
19677 | export interface ILayerEvents<Hook extends THooks> extends IHookPayload<Hook> {
|
19678 |
|
19679 | readonly layer: Layer;
|
19680 | }
|
19681 | export interface ILayerDrawEvent extends ILayerEvents<"OnDraw"> {}
|
19682 | export interface ILayerCalculateEvent extends ILayerEvents<"OnCalculate"> {}
|
19683 | export interface ILayerCalculatedEvent extends ILayerEvents<"OnCalculated"> {}
|
19684 | export interface ILayerReadyEvent extends ILayerEvents<"OnReady"> {}
|
19685 | export interface ILayerResizeEvent extends ILayerEvents<"OnResize"> {}
|
19686 | export interface ILayerActivateEvent extends ILayerEvents<"OnActivate"> {}
|
19687 | export interface ILayerDeactivateEvent extends ILayerEvents<"OnDeactivate"> {}
|
19688 | export interface ILayerFocusEvent extends ILayerEvents<"OnFocus"> {}
|
19689 | export interface ILayerBlurEvent extends ILayerEvents<"OnBlur"> {}
|
19690 | export interface ILayerHoverEvent extends ILayerEvents<"OnHover"> {}
|
19691 | export interface ILayerBeforeHideEvent extends ILayerEvents<"OnBeforeHide"> {}
|
19692 | export interface ILayerHideEvent extends ILayerEvents<"OnHide"> {}
|
19693 | export interface ILayerBeforeShowEvent extends ILayerEvents<"OnBeforeShow"> {}
|
19694 | export interface ILayerShowEvent extends ILayerEvents<"OnShow"> {}
|
19695 | export interface ILayerCloseEvent extends ILayerEvents<"OnClose"> {}
|
19696 | export interface ILayerDestroyEvent extends ILayerEvents<"OnDestroy"> {}
|
19697 | export interface ILayerBeforeShowPanelEvent extends ILayerEvents<"OnBeforeShowPanel"> {
|
19698 |
|
19699 | readonly panel: Layer;
|
19700 | }
|
19701 | export interface ILayerShowPanelEvent extends ILayerEvents<"OnShowPanel"> {
|
19702 |
|
19703 | readonly panel: Layer;
|
19704 | }
|
19705 | export interface ILayerClosePanelEvent extends ILayerEvents<"OnClosePanel"> {
|
19706 |
|
19707 | readonly panel: Layer;
|
19708 | }
|
19709 | const enum Types {
|
19710 |
|
19711 | Layer = 0,
|
19712 |
|
19713 | Child = 1,
|
19714 |
|
19715 | Chain = 2,
|
19716 |
|
19717 | Panel = 3,
|
19718 |
|
19719 | Modal = 4,
|
19720 |
|
19721 | Floating = 5,
|
19722 |
|
19723 | Popup = 6,
|
19724 | }
|
19725 | |
19726 |
|
19727 |
|
19728 |
|
19729 |
|
19730 | export type TLayerAwait = (pLayer: Layer, pAwait: Await) => void | Await;
|
19731 | |
19732 |
|
19733 |
|
19734 |
|
19735 | export type TLayer = (pLayer: Layer) => void;
|
19736 | |
19737 |
|
19738 |
|
19739 |
|
19740 |
|
19741 | export type TLayerPanel = (pLayer: Layer, pPanel: Layer) => void;
|
19742 | |
19743 |
|
19744 |
|
19745 |
|
19746 | export type TLayerShow = (pLayer: Layer) => void;
|
19747 | |
19748 |
|
19749 |
|
19750 |
|
19751 | export type TLayerClose = (pLayer: Layer) => void;
|
19752 | |
19753 |
|
19754 |
|
19755 |
|
19756 | export type TDimension = (pLayer: Layer) => Dimensions;
|
19757 |
|
19758 | export interface ILayer {
|
19759 |
|
19760 | type: Types;
|
19761 |
|
19762 | configuration: LayerConfiguration;
|
19763 |
|
19764 | layer: TLayerAwait | undefined;
|
19765 | }
|
19766 | export class Layer extends StrictItem<Stack, TLayerEvents, ILayer> {
|
19767 | |
19768 |
|
19769 |
|
19770 |
|
19771 |
|
19772 | onResize: TLayer | undefined;
|
19773 | |
19774 |
|
19775 |
|
19776 |
|
19777 |
|
19778 | onDraw: TLayer | undefined;
|
19779 | |
19780 |
|
19781 |
|
19782 |
|
19783 |
|
19784 | onDimensions: TDimension | undefined;
|
19785 | |
19786 |
|
19787 |
|
19788 |
|
19789 |
|
19790 | onActivate: TLayer | undefined;
|
19791 | |
19792 |
|
19793 |
|
19794 |
|
19795 |
|
19796 | onDeactivate: TLayer | undefined;
|
19797 | |
19798 |
|
19799 |
|
19800 |
|
19801 |
|
19802 | onFocus: TLayer | undefined;
|
19803 | |
19804 |
|
19805 |
|
19806 |
|
19807 |
|
19808 | onBlur: TLayer | undefined;
|
19809 | |
19810 |
|
19811 |
|
19812 |
|
19813 |
|
19814 | onHover: TLayer | undefined;
|
19815 | |
19816 |
|
19817 |
|
19818 |
|
19819 |
|
19820 | onBeforeHide: TLayer | undefined;
|
19821 | |
19822 |
|
19823 |
|
19824 |
|
19825 |
|
19826 | onHide: TLayer | undefined;
|
19827 | |
19828 |
|
19829 |
|
19830 |
|
19831 |
|
19832 | onBeforeShow: TLayer | undefined;
|
19833 | |
19834 |
|
19835 |
|
19836 |
|
19837 |
|
19838 | onShow: TLayer | undefined;
|
19839 | |
19840 |
|
19841 |
|
19842 |
|
19843 |
|
19844 | onClose: TLayer | undefined;
|
19845 | |
19846 |
|
19847 |
|
19848 |
|
19849 |
|
19850 | onBeforeShowPanel: TLayerPanel | undefined;
|
19851 | |
19852 |
|
19853 |
|
19854 |
|
19855 |
|
19856 | onShowPanel: TLayerPanel | undefined;
|
19857 | |
19858 |
|
19859 |
|
19860 |
|
19861 |
|
19862 | onClosePanel: TLayerPanel | undefined;
|
19863 | |
19864 |
|
19865 |
|
19866 |
|
19867 |
|
19868 | onDestroy: TLayer | undefined;
|
19869 |
|
19870 | static get app(): Layers;
|
19871 | |
19872 |
|
19873 |
|
19874 |
|
19875 |
|
19876 | static whenShown(fnOpen: TLayerShow): void;
|
19877 | |
19878 |
|
19879 |
|
19880 |
|
19881 |
|
19882 | static whenClosed(fnClose: TLayerClose): void;
|
19883 | |
19884 |
|
19885 |
|
19886 |
|
19887 | constructor(pStack: Stack, pLayer: ILayer);
|
19888 | /** Retrieves a reference to the parent stack. */
|
19889 | get parent(): Stack;
|
19890 | /** Retrieves a reference to the child layers of this layer. */
|
19891 | get layers(): Stack;
|
19892 | /** Retrieves a reference to the stylesheet. */
|
19893 | get stylesheet(): Stylesheet;
|
19894 | /** Retrieves a reference to the chain layer. */
|
19895 | get chain(): Layer | undefined;
|
19896 | /** Retrieves a configuration template for the layer configuration. */
|
19897 | static get configuration(): LayerConfiguration;
|
19898 | /** Retrieves the layer configuration. */
|
19899 | get configuration(): LayerConfiguration;
|
19900 | /** Updates the layer configuration. */
|
19901 | set configuration(pConfiguration: LayerConfiguration);
|
19902 | /** Retrieves the layer type. */
|
19903 | get type(): Types;
|
19904 | /** Retrieves a reference to the await controller. */
|
19905 | get await(): Await | undefined;
|
19906 |
|
19907 | /** Retrieves if the layer is loading. */
|
19908 | get isLoading(): boolean;
|
19909 | /** Retrieves if the layer is ready. */
|
19910 | get isReady(): boolean;
|
19911 | /** Retrieves if the layer is drawn. */
|
19912 | get isDrawn(): boolean;
|
19913 | /** Retrieves if the layer is calculated. */
|
19914 | get isCalculated(): boolean;
|
19915 | /** Retrieves if the layer is visible. */
|
19916 | get isVisible(): boolean;
|
19917 | /** Specifies if the layer is visible. */
|
19918 | set isVisible(bVisible: boolean);
|
19919 | /** Retrieves if the layer is activated. */
|
19920 | get isActivated(): boolean;
|
19921 | /** Retrieves if the layer has focus. */
|
19922 | get hasFocus(): boolean;
|
19923 | /** Retrieves if the layer is hovered. */
|
19924 | get isHovered(): boolean;
|
19925 | /** Retrieves if the layer is closing. */
|
19926 | get isClosing(): boolean;
|
19927 | /** Retrieves if the layer is destroyed. */
|
19928 | get isDestroyed(): boolean;
|
19929 | /** Retrieves a reference to the layer element. */
|
19930 | get element(): Element;
|
19931 | /** Retrieves a reference to the layer context. */
|
19932 | get context(): Element;
|
19933 | /** Retrieves a reference to the layer overlay element. */
|
19934 | get overlay(): Element | undefined;
|
19935 | /** Retrieves the layer viewport. */
|
19936 | get viewport(): Rectangle | undefined;
|
19937 | /** Retrieves the left position of the layer. */
|
19938 | get left(): number;
|
19939 | /** Retrieves the top position of the layer. */
|
19940 | get top(): number;
|
19941 | /** Retrieves the right position of the layer. */
|
19942 | get right(): number;
|
19943 | /** Retrieves the bottom position of the layer. */
|
19944 | get bottom(): number;
|
19945 | /** Retrieves the width of the layer. */
|
19946 | get width(): number;
|
19947 | /** Retrieves the height of the layer. */
|
19948 | get height(): number;
|
19949 | /** Retrieves a reference to the scroll controller. */
|
19950 | get scroll(): Scroll | undefined;
|
19951 | /** Retrieves a reference to the scrollbar controller. */
|
19952 | get scrollbars(): Scrollbars | undefined;
|
19953 | /**
|
19954 | * Retrieves the callback function which is invoked when
|
19955 | * the layer calculation starts.
|
19956 | * @event
|
19957 | */
|
19958 | get onCalculate(): TLayer;
|
19959 | /**
|
19960 | * Sets the callback function which is invoked when the
|
19961 | * layer calculation starts.
|
19962 | * @event
|
19963 | */
|
19964 | set onCalculate(fnCalculate: TLayer);
|
19965 | /**
|
19966 | * Retrieves the callback function which is invoked when
|
19967 | * the layer dimensions are calculated.
|
19968 | * @event
|
19969 | */
|
19970 | get onCalculated(): TLayer;
|
19971 | /**
|
19972 | * Sets the callback function which is invoked when the
|
19973 | * layer dimensions are calculated.
|
19974 | * @event
|
19975 | */
|
19976 | set onCalculated(fnCalculated: TLayer);
|
19977 | /**
|
19978 | * Retrieves the callback function which is invoked when the
|
19979 | * layer is ready.
|
19980 | * @event
|
19981 | */
|
19982 | get onReady(): TLayer;
|
19983 | /**
|
19984 | * Sets the callback function which is invoked when the layer
|
19985 | * is ready.
|
19986 | * @event
|
19987 | */
|
19988 | set onReady(fnReady: TLayer);
|
19989 |
|
19990 | /**
|
19991 | * Invoked when a layer is pushed to the layer stack.
|
19992 | * @param pEvent Contains the event data.
|
19993 | * @event
|
19994 | */
|
19995 | protected onPush(pEvent: IItemPushEvent<Layer>): void;
|
19996 | /**
|
19997 | * Invoked when a layer is changed within the layer stack.
|
19998 | * @param pEvent Contains the event data.
|
19999 | * @event
|
20000 | */
|
20001 | protected onChange(pEvent: IItemChangeEvent<Layer>): void;
|
20002 | /**
|
20003 | * Invoked when a layer is popped from the layer stack.
|
20004 | * @param pEvent Contains the event data.
|
20005 | * @event
|
20006 | */
|
20007 | protected onPop(pEvent: IItemPopEvent<Layer>): void;
|
20008 | /** Invoked when the layer calculation starts. */
|
20009 | protected onLayerCalculate(): void;
|
20010 | /** Invoked when the layer is calulcated. */
|
20011 | protected onLayerCalculated(): void;
|
20012 | /** Invoked when the layer is ready. */
|
20013 | protected onLayerReady(): void;
|
20014 | /** Invoked when the layer is resized. */
|
20015 | protected onLayerResize(): void;
|
20016 | /** Invoked when the layer is drawn. */
|
20017 | protected onLayerDraw(): void;
|
20018 | /** Invoked when the layer is activated. */
|
20019 | protected onLayerActivate(): void;
|
20020 | /** Invoked when the layer is deactivated. */
|
20021 | protected onLayerDeactivate(): void;
|
20022 | /** Invoked when the layer gains focus. */
|
20023 | protected onLayerFocus(): void;
|
20024 | /** Invoked when the layer is blurred. */
|
20025 | protected onLayerBlur(): void;
|
20026 | /** Invoked when when a pointing device enters or leaves the layer. */
|
20027 | protected onLayerHover(): void;
|
20028 | /** Invoked when the layer is about to hide. */
|
20029 | protected onLayerBeforeHide(): void;
|
20030 | /** Invoked when the layer is hidden. */
|
20031 | protected onLayerHide(): void;
|
20032 | /** Invoked when the layer is about to be shown. */
|
20033 | protected onLayerBeforeShow(): void;
|
20034 | /** Invoked when the layer is shown. */
|
20035 | protected onLayerShow(): void;
|
20036 | /** Invoked when the layer is closed. */
|
20037 | protected onLayerClose(): void;
|
20038 | /**
|
20039 | * Invoked when a child panel layer is about to be shown.
|
20040 | * @param pPanel Reference to the panel.
|
20041 | */
|
20042 | protected onLayerBeforeShowPanel(pPanel: Layer): void;
|
20043 | /**
|
20044 | * Invoked when a child panel layer is shown.
|
20045 | * @param pPanel Reference to the panel.
|
20046 | */
|
20047 | protected onLayerShowPanel(pPanel: Layer): void;
|
20048 | /**
|
20049 | * Invoked when a child panel layer is closed.
|
20050 | * @param pPanel Reference to the panel.
|
20051 | */
|
20052 | protected onLayerClosePanel(pPanel: Layer): void;
|
20053 | /** Invoked when the layer is destroyed. */
|
20054 | protected onLayerDestroy(): void;
|
20055 | /** Invoked when the zoom factor of the layer is changed. */
|
20056 | onLayerZoomEnd(): void;
|
20057 | /** Validates the layer ready state. */
|
20058 | validate(): void;
|
20059 | /** Applies the layer configuration. */
|
20060 | configure(): void;
|
20061 | /**
|
20062 | * Reconfigures a layer using the supplied configuration.
|
20063 | * @param pConfiguration Specifies the layer configuration.
|
20064 | */
|
20065 | reconfigure(pConfiguration: LayerConfiguration): void;
|
20066 | /** Invoked when the layer calculation starts. */
|
20067 | calculate(): void;
|
20068 | /**
|
20069 | * Invoked when the layer is calculated.
|
20070 | * @param bResize Indicates if the calculation was the result of a layer
|
20071 | * resize.
|
20072 | */
|
20073 | calculated(bResize: boolean): void;
|
20074 | /**
|
20075 | * Indicates the layer should wait for the specified condition. Multiple
|
20076 | * conditions (waits) can be set.
|
20077 | * @param fnCondition Specifies a condition which should be evaluated.
|
20078 | * @return Returns `true` if the layer will wait.
|
20079 | */
|
20080 | wait(fnCondition?: () => boolean): boolean;
|
20081 | /** Indicates to the layer a wait is done. It will check all wait conditions. */
|
20082 | done(): void;
|
20083 | /**
|
20084 | * Creates a layer.
|
20085 | * @param fnLayer Specifies the make function which is invoked when the
|
20086 | * layer is constructed.
|
20087 | * @param pConfiguration Optional layer configuration.
|
20088 | * @return Returns a reference to the new layer.
|
20089 | */
|
20090 | createLayer(fnLayer?: TLayerAwait, pConfiguration?: LayerConfiguration): Layer | undefined;
|
20091 | /**
|
20092 | * Creates a child layer.
|
20093 | * @param fnLayer Specifies the make function which is invoked when the
|
20094 | * layer is constructed.
|
20095 | * @param pConfiguration Optional layer configuration.
|
20096 | * @return Returns a reference to the new layer.
|
20097 | */
|
20098 | createChild(fnLayer?: TLayerAwait, pConfiguration?: LayerConfiguration): Layer | undefined;
|
20099 | /**
|
20100 | * Creates a layer chain. A layer chain is a stack for panel layers.
|
20101 | * @param pConfiguration Optional layer configuration.
|
20102 | * @return Returns a reference to the new layer.
|
20103 | */
|
20104 | createChain(pConfiguration?: LayerConfiguration): Layer | undefined;
|
20105 | /**
|
20106 | * Creates a new panel layer. There can only be one panel for each level in
|
20107 | * the chain. When a new panel is created, all existing panels on the same
|
20108 | * level in the chain are closed.
|
20109 | * @param fnLayer Specifies the make function which is invoked when the
|
20110 | * layer is constructed.
|
20111 | * @param pConfiguration Optional layer configuration.
|
20112 | * @return Returns a reference to the new layer.
|
20113 | */
|
20114 | createPanel(fnLayer?: TLayerAwait, pConfiguration?: LayerConfiguration): Layer | undefined;
|
20115 | /**
|
20116 | * Creates a modal layer.
|
20117 | * @param fnLayer Specifies the make function which is invoked when the
|
20118 | * layer is constructed.
|
20119 | * @param pConfiguration Optional layer configuration.
|
20120 | * @return Returns a reference to the new layer.
|
20121 | */
|
20122 | createModal(fnLayer?: TLayerAwait, pConfiguration?: LayerConfiguration): Layer | undefined;
|
20123 | /**
|
20124 | * Creates a floating layer.
|
20125 | * @param fnLayer Specifies the make function which is invoked when the
|
20126 | * layer is constructed.
|
20127 | * @param pConfiguration Optional layer configuration.
|
20128 | * @return Returns a reference to the new layer.
|
20129 | */
|
20130 | createFloating(fnLayer?: TLayerAwait, pConfiguration?: LayerConfiguration): Layer | undefined;
|
20131 | /**
|
20132 | * Creates a popup layer.
|
20133 | * @param fnLayer Specifies the make function which is invoked when the
|
20134 | * layer is constructed.
|
20135 | * @param pConfiguration Optional layer configuration.
|
20136 | * @return Returns a reference to the new layer.
|
20137 | */
|
20138 | createPopup(fnLayer?: TLayerAwait, pConfiguration?: LayerConfiguration): Layer | undefined;
|
20139 | /**
|
20140 | * Creates a component layer.
|
20141 | * @param pComponent Specifies the component instance or constructor.
|
20142 | * @param sType Specifies the optional layer type.
|
20143 | * @param sMode Specifies the optional layer mode (`global` or `local`).
|
20144 | * @return Returns a reference to the component.
|
20145 | */
|
20146 | component<T extends LayerComponent>(
|
20147 | pComponent:
|
20148 | | T
|
20149 | | {
|
20150 | new (): T;
|
20151 | },
|
20152 | sType?: "layer" | "child" | "modal" | "floating" | "panel" | "popup",
|
20153 | sMode?: "global" | "local"
|
20154 | ): T;
|
20155 | /**
|
20156 | * Activates the layer.
|
20157 | * @return Returns `true` if the layer is activated.
|
20158 | */
|
20159 | activate(): boolean;
|
20160 | /**
|
20161 | * Deactivates the layer.
|
20162 | * @return Returns `true` if the layer is deactivated.
|
20163 | */
|
20164 | deactivate(): boolean;
|
20165 | /**
|
20166 | * Focus the layer.
|
20167 | * @return Returns `true` if the layer focus is set.
|
20168 | */
|
20169 | focus(): boolean;
|
20170 | /**
|
20171 | * Blurs the layer.
|
20172 | * @return Returns `true` if the layer focus is blurred.
|
20173 | */
|
20174 | blur(): boolean;
|
20175 | /**
|
20176 | * Hides the layer (including all child layers).
|
20177 | * @param bParentIsHiding Specifies if the layer hides due to a parent
|
20178 | * layer that is hiding.
|
20179 | */
|
20180 | hide(bParentIsHiding?: boolean): void;
|
20181 | /**
|
20182 | * Shows the layer (including all child layers).
|
20183 | * @param bActivate Specifies if the layer should be activated.
|
20184 | */
|
20185 | show(bActivate?: boolean): void;
|
20186 | /**
|
20187 | * Closes the layer and destroys it (and all of its child layers).
|
20188 | * @param bParentIsClosing Specifies if the layer closes due to a parent
|
20189 | * layer that is closing.
|
20190 | */
|
20191 | close(bParentIsClosing?: boolean): void;
|
20192 | /** Closes the child panels of a layer. */
|
20193 | closeChildPanels(): void;
|
20194 | /** Destroys the layer (including all child layers). */
|
20195 | destroy(): void;
|
20196 | }
|
20197 | /** Describes the layer properties. */
|
20198 | export interface ILayerProperties {
|
20199 | /**
|
20200 | * Specifies the stylesheet to write the layer styles to. If omitted
|
20201 | * the default application global stylesheet will be used.
|
20202 | */
|
20203 | readonly stylesheet?: Stylesheet;
|
20204 | /** Specifies the layer style. */
|
20205 | readonly style?: ILayerStyle;
|
20206 | /**
|
20207 | * Specifies an optional parent asset. If omitted the root layer will be
|
20208 | * inserted into the document body.
|
20209 | */
|
20210 | readonly parent?: Asset | Layer;
|
20211 | }
|
20212 | /** Describes the stack event types. */
|
20213 | export type TStackEvents = "OnResize" | "OnClose" | "OnDestroy";
|
20214 | /** Describes the layers event. */
|
20215 | export interface ILayersEvents<Hook extends THooks> extends IHookPayload<Hook> {
|
20216 |
|
20217 | readonly layers: Stack;
|
20218 | }
|
20219 | export interface ILayersResizeEvent extends ILayersEvents<"OnResize"> {}
|
20220 | export interface ILayersCloseEvent extends ILayersEvents<"OnClose"> {}
|
20221 | export interface ILayersDestroyEvent extends ILayersEvents<"OnDestroy"> {}
|
20222 | |
20223 |
|
20224 |
|
20225 |
|
20226 | export type TStack = (pStack: Stack) => void;
|
20227 | class Stack extends StrictMatrix<Stack, Layer, TStackEvents, ILayer> {
|
20228 | |
20229 |
|
20230 |
|
20231 |
|
20232 |
|
20233 | onResize: TStack | undefined;
|
20234 | |
20235 |
|
20236 |
|
20237 |
|
20238 |
|
20239 | onClose: TStack | undefined;
|
20240 | |
20241 |
|
20242 |
|
20243 |
|
20244 |
|
20245 | onDestroy: TStack | undefined;
|
20246 | |
20247 |
|
20248 |
|
20249 |
|
20250 | constructor(pProperties?: ILayerProperties);
|
20251 | /** Retrieves the root stack. */
|
20252 | get root(): Stack;
|
20253 | /** Retrieves a reference to the stylesheet. */
|
20254 | get stylesheet(): Stylesheet;
|
20255 | /** Retrieves a reference to the style. */
|
20256 | get style(): ILayerStyle;
|
20257 | /** Retrieves if the stack is initialized. */
|
20258 | get isInitialized(): boolean;
|
20259 | /** Retrieves if the layer stack is drawn. */
|
20260 | get isDrawn(): boolean;
|
20261 | /** Retrieves if the stack is calculated. */
|
20262 | get isCalculated(): boolean;
|
20263 | /** Retrieves if the stack or one of the child layers is calculating. */
|
20264 | get isCalculating(): boolean;
|
20265 | /** Indicates if the layer is intializing. */
|
20266 | get isInitializing(): boolean;
|
20267 | /** Retrieves if the stack is destroyed. */
|
20268 | get isDestroyed(): boolean;
|
20269 | /** Retrieves a reference to the parent layer of the stack. */
|
20270 | get layer(): Layer | undefined;
|
20271 | /** Retrieves a reference to the active layer. */
|
20272 | get active(): Layer | undefined;
|
20273 | /** Retrieves a reference to the stack element. */
|
20274 | get element(): Element | undefined;
|
20275 | /** Retrieves a reference to the stack context. */
|
20276 | get context(): Element | undefined;
|
20277 | /** Retrieves a reference to the overlay element. */
|
20278 | get overlay(): Element | undefined;
|
20279 | /** Retrieves a reference to the scroll controller. */
|
20280 | get scroll(): Scroll | undefined;
|
20281 | /** Retrieves a reference to the scrollbar controller. */
|
20282 | get scrollbars(): Scrollbars | undefined;
|
20283 | /** Retrieves the stack viewport. */
|
20284 | get viewport(): Rectangle | undefined;
|
20285 | /** Retrieves the left position of the stack. */
|
20286 | get left(): number;
|
20287 | /** Retrieves the top position of the stack. */
|
20288 | get top(): number;
|
20289 | /** Retrieves the right position of the stack. */
|
20290 | get right(): number;
|
20291 | /** Retrieves the bottom position of the stack. */
|
20292 | get bottom(): number;
|
20293 | /** Retrieves the width of the stack. */
|
20294 | get width(): number;
|
20295 | /** Retrieves the height of the stack. */
|
20296 | get height(): number;
|
20297 | /** Retrieves if the stack contains a panel. */
|
20298 | get hasPanel(): boolean;
|
20299 |
|
20300 | /** Invoked when the layer stack is resized. */
|
20301 | protected onLayersResize(): void;
|
20302 | /** Invoked when the layer stack is closed. */
|
20303 | protected onLayersClose(): void;
|
20304 | /** Invoked when the layer stack is destroyed. */
|
20305 | protected onLayersDestroy(): void;
|
20306 | /** Initializes the layer stack. */
|
20307 | init(): void;
|
20308 | /** Validates the layer stack. */
|
20309 | validate(): void;
|
20310 | /**
|
20311 | * Draws a layer element to the stack element.
|
20312 | * @param fnDraw Specifies the draw function.
|
20313 | */
|
20314 | draw(fnDraw: () => void): void;
|
20315 | /**
|
20316 | * Applies the layer rectangle.
|
20317 | * @param pRectangle Specifies the rectangle.
|
20318 | */
|
20319 | rectangle(pRectangle: IRectangle): void;
|
20320 | /** Requests a layer stack update. */
|
20321 | update(): void;
|
20322 | /**
|
20323 | * Creates a layer.
|
20324 | * @param fnLayer Specifies the make function which is invoked when the
|
20325 | * layer is constructed.
|
20326 | * @param pConfiguration Optional layer configuration.
|
20327 | * @return Returns a reference to the new layer.
|
20328 | */
|
20329 | createLayer(fnLayer?: TLayerAwait, pConfiguration?: LayerConfiguration): Layer | undefined;
|
20330 | /**
|
20331 | * Creates a child layer.
|
20332 | * @param fnLayer Specifies the make function which is invoked when the
|
20333 | * layer is constructed.
|
20334 | * @param pConfiguration Optional layer configuration.
|
20335 | * @return Returns a reference to the new layer.
|
20336 | */
|
20337 | createChild(fnLayer?: TLayerAwait, pConfiguration?: LayerConfiguration): Layer | undefined;
|
20338 | /**
|
20339 | * Creates a layer chain. A layer chain is a stack for panel layers.
|
20340 | * @param pConfiguration Optional layer configuration.
|
20341 | * @return Returns a reference to the new layer.
|
20342 | */
|
20343 | createChain(pConfiguration?: LayerConfiguration): Layer | undefined;
|
20344 | /**
|
20345 | * Creates a new panel layer. There can only be one panel for each level in
|
20346 | * the chain. When a new panel is created, all existing panels on the same
|
20347 | * level in the chain are closed.
|
20348 | * @param fnLayer Specifies the make function which is invoked when the
|
20349 | * layer is constructed.
|
20350 | * @param pConfiguration Optional layer configuration.
|
20351 | * @return Returns a reference to the new layer.
|
20352 | */
|
20353 | createPanel(fnLayer?: TLayerAwait, pConfiguration?: LayerConfiguration): Layer | undefined;
|
20354 | /**
|
20355 | * Creates a modal layer.
|
20356 | * @param fnLayer Specifies the make function which is invoked when the
|
20357 | * layer is constructed.
|
20358 | * @param pConfiguration Optional layer configuration.
|
20359 | * @return Returns a reference to the new layer.
|
20360 | */
|
20361 | createModal(fnLayer?: TLayerAwait, pConfiguration?: LayerConfiguration): Layer | undefined;
|
20362 | /**
|
20363 | * Creates a floating layer.
|
20364 | * @param fnLayer Specifies the make function which is invoked when the
|
20365 | * layer is constructed.
|
20366 | * @param pConfiguration Optional layer configuration.
|
20367 | * @return Returns a reference to the new layer.
|
20368 | */
|
20369 | createFloating(fnLayer?: TLayerAwait, pConfiguration?: LayerConfiguration): Layer | undefined;
|
20370 | /**
|
20371 | * Creates a popup layer.
|
20372 | * @param fnLayer Specifies the make function which is invoked when the
|
20373 | * layer is constructed.
|
20374 | * @param pConfiguration Optional layer configuration.
|
20375 | * @return Returns a reference to the new layer.
|
20376 | */
|
20377 | createPopup(fnLayer?: TLayerAwait, pConfiguration?: LayerConfiguration): Layer | undefined;
|
20378 | /**
|
20379 | * Creates a component layer.
|
20380 | * @param pComponent Specifies the component instance or constructor.
|
20381 | * @param sType Specifies the optional layer type.
|
20382 | * @param sMode Specifies the optional layer mode (`global` or `local`).
|
20383 | * @return Returns a reference to the component.
|
20384 | */
|
20385 | component<T extends LayerComponent>(
|
20386 | pComponent:
|
20387 | | T
|
20388 | | {
|
20389 | new (): T;
|
20390 | },
|
20391 | sType?: "layer" | "child" | "modal" | "floating" | "panel" | "popup",
|
20392 | sMode?: "global" | "local"
|
20393 | ): T;
|
20394 | /** Hides all layers of the stack. */
|
20395 | hide(): void;
|
20396 | /** Shows all layers of the stack. */
|
20397 | show(): void;
|
20398 | /** Closes all layers of the stack. */
|
20399 | close(): void;
|
20400 | /** Destroys the stack and all the layers in the stack. */
|
20401 | destroy(): void;
|
20402 | }
|
20403 | export class Layers extends Stack {
|
20404 | /** Contains the default stylesheet. */
|
20405 | static stylesheet: Stylesheet;
|
20406 | /** Contains the default style. */
|
20407 | static style: ILayerStyle | undefined;
|
20408 |
|
20409 | /** Retrieves the application layer. */
|
20410 | static get app(): Layers;
|
20411 | /**
|
20412 | * Constructs a new layers instance.
|
20413 | * @param pProperties Specifies the layer properties.
|
20414 | */
|
20415 | constructor(pProperties?: ILayerProperties);
|
20416 | /** Requests a layer stack update. */
|
20417 | update(): void;
|
20418 | /** Destroys the layers instance. */
|
20419 | destroy(): void;
|
20420 | }
|
20421 | export namespace LayerAnimations {
|
20422 | /** Fade animation. */
|
20423 | const Fade: ILayerAnimation;
|
20424 | /** Zoom animation. */
|
20425 | const Zoom: ILayerAnimation;
|
20426 | /** Fall animation. */
|
20427 | const Fall: ILayerAnimation;
|
20428 | }
|
20429 | /**
|
20430 | * Implements the component event decorator (this binds a component event to a method member).
|
20431 | * @param sEvent Specifies the event.
|
20432 | * @param sType Specifies the optional hook type (default is `synchronous`).
|
20433 | * @return Returns the decorator.
|
20434 | */
|
20435 | export function component(
|
20436 | sEvent: TLayerEvents,
|
20437 | sType?: "synchronous" | "asynchronous" | "framed"
|
20438 | ): (pTarget: IComponent, sProperty: string, pDescriptor: PropertyDescriptor) => void;
|
20439 |
|
20440 | export { Alignment as LayerAlignment, Layouts as LayerLayouts, TLayouts as TLayerLayouts, Types as LayerTypes };
|
20441 | }
|
20442 |
|
20443 | declare module "tripetto/module/ui-list" {
|
20444 | import { Element, Fragment, IStyles, Stylesheet } from "tripetto/module/dom";
|
20445 | import { TAny } from "tripetto/module/functional";
|
20446 | import { Hooks, IHookPayload, THooks } from "tripetto/module/hookup";
|
20447 | import { MarkdownFeatures, MarkdownParser } from "tripetto/module/markdown";
|
20448 | import { IItemChangeEvent, IItemPopEvent, Item, Matrix, Reasons, StrictItem, StrictMatrix } from "tripetto/module/matrix";
|
20449 | import { Dimensions, IPoint, Rectangle } from "tripetto/module/metrics";
|
20450 | import { Layer, LayerComponent, LayerConfiguration } from "tripetto/module/ui-layers";
|
20451 | import { IMenuStyle, MenuOption } from "tripetto/module/ui-menu";
|
20452 | import { IScrollbarsStyle, Scrollbars } from "tripetto/module/ui-scrollbars";
|
20453 |
|
20454 | class Rows<T extends Row> extends Matrix<T, void> {
|
20455 | |
20456 |
|
20457 |
|
20458 |
|
20459 | constructor(pParent: List<T> | T);
|
20460 | /** Retrieves a reference to the list. */
|
20461 | get list(): List<T> | undefined;
|
20462 | /** Retrieves a reference to the parent row. */
|
20463 | get row(): T | undefined;
|
20464 | /** Recursively retrieve all rows in a flat array. */
|
20465 | get all(): T[];
|
20466 | /** Retrieves the rows as an array (exclusing child rows). */
|
20467 | get children(): T[];
|
20468 | /** Returns the total number of rows. */
|
20469 | get countRecursive(): number;
|
20470 | /** Returns the visible number of rows. */
|
20471 | get countVisible(): number;
|
20472 | /**
|
20473 | * Fired when the matrix dimensions are changed.
|
20474 | * @event
|
20475 | */
|
20476 | protected onRowsChange(): void;
|
20477 | /**
|
20478 | * Fired when the rows are invalidated.
|
20479 | * @event
|
20480 | */
|
20481 | protected onRowsInvalidate(): void;
|
20482 | /**
|
20483 | * Fired when a row is pushed.
|
20484 | * @param pRow Reference to the row.
|
20485 | * @event
|
20486 | */
|
20487 | protected onRowPush(pRow: T): void;
|
20488 | /**
|
20489 | * Fired when a row is changed.
|
20490 | * @param pRow Reference to the row.
|
20491 | * @param nReason Specifies the reason for the change.
|
20492 | * @param bAsynchronous Specifies if the event is invoked asynchronous.
|
20493 | * @event
|
20494 | */
|
20495 | protected onRowChange(pRow: T, nReason: Reasons, bAsynchronous: boolean): void;
|
20496 | /**
|
20497 | * Fired when a row is popped.
|
20498 | * @param pRow Reference to the row.
|
20499 | * @event
|
20500 | */
|
20501 | protected onRowPop(pRow: T): void;
|
20502 | /**
|
20503 | * Invalidates rows between the specified coordinates.
|
20504 | * @param nTop Specifies the top coordinate.
|
20505 | * @param nBottom Specifies the bottom coordinates.
|
20506 | * @param nExtend Specifies the number of extension pixels.
|
20507 | * @return Returns `true` if a row is drawn.
|
20508 | */
|
20509 | invalidate(nTop: number, nBottom: number, nExtend: number): boolean;
|
20510 | /** Invalidates the row count. */
|
20511 | recount(): void;
|
20512 | /**
|
20513 | * Iterates recursively through all rows.
|
20514 | * @param fnRow Specifies a function which is invoked for each row.
|
20515 | * @param fnRow.pRow Reference to the row.
|
20516 | * @param bReverse Reverses the iteration.
|
20517 | * @return Returns `true` if the iteration was stopped.
|
20518 | */
|
20519 | recursiveEach(fnRow: (pRow: T) => boolean | void, bReverse: boolean): boolean;
|
20520 | /**
|
20521 | * Performs a recursive sort on the rows collection.
|
20522 | * @param pColumn Specifies the column to sort on.
|
20523 | * @param bDescending Specifies if the list should be sorted descending.
|
20524 | * @return Returns `true` if the sort invoked a change in the row order.
|
20525 | */
|
20526 | recursiveSort(pColumn: Column<T>, bDescending: boolean): boolean;
|
20527 | /**
|
20528 | * Applies a filter and show only the rows which match the supplied match function.
|
20529 | * @param fnMatch Specifies a match function which is invoked for each row.
|
20530 | * This function should return `true` for each row which should be included.
|
20531 | * @param fnMatch.pRow Reference to the row.
|
20532 | * @return Returns the number of rows which match the filter.
|
20533 | */
|
20534 | recursiveFilter(fnMatch: (pRow: T) => boolean): number;
|
20535 | /**
|
20536 | * Retrieves the row at the specified index.
|
20537 | * @param nIndex Specifies the zero-based index number.
|
20538 | * @return Returns a reference to the row or `undefined` if the row is
|
20539 | * not found.
|
20540 | */
|
20541 | rowAtIndex(nIndex: number): T | undefined;
|
20542 | /**
|
20543 | * Retrieves the row at the specified point.
|
20544 | * @param pPoint Specifies the point.
|
20545 | * @return Returns a reference to the row or `undefined` if the row is
|
20546 | * not found.
|
20547 | */
|
20548 | rowFromPoint(pPoint: IPoint): T | undefined;
|
20549 | /**
|
20550 | * Adds a row to the end of the rows collection.
|
20551 | * @param pRow Specifies the row.
|
20552 | * @return Returns a reference to the row.
|
20553 | */
|
20554 | add<R extends T>(pRow: R): R;
|
20555 | /**
|
20556 | * Add an array of rows.
|
20557 | * @param pRows Array with rows.
|
20558 | * @return Returns the number of rows added to the rows collection.
|
20559 | */
|
20560 | addN(...pRows: T[]): number;
|
20561 | /**
|
20562 | * Inserts a row at the begin of the rows collection.
|
20563 | * @param pRow Specifies the row.
|
20564 | * @return Returns a reference to the row.
|
20565 | */
|
20566 | insert<R extends T>(pRow: R): R;
|
20567 | /**
|
20568 | * Inserts an array of rows.
|
20569 | * @param pRows Array with rows.
|
20570 | * @return Returns the number of rows added to the rows collection.
|
20571 | */
|
20572 | insertN(...pRows: T[]): number;
|
20573 | /** Destroys the rows collection. */
|
20574 | destroy(): void;
|
20575 | }
|
20576 | export type TListEvents =
|
20577 | | "OnInit"
|
20578 | | "OnReady"
|
20579 | | "OnAdd"
|
20580 | | "OnChange"
|
20581 | | "OnIndex"
|
20582 | | "OnDelete"
|
20583 | | "OnRefresh"
|
20584 | | "OnExpand"
|
20585 | | "OnCollapse"
|
20586 | | "OnTap"
|
20587 | | "OnDoubleTap"
|
20588 | | "OnEnter"
|
20589 | | "OnSelect"
|
20590 | | "OnDeselect"
|
20591 | | "OnSelectionChange"
|
20592 | | "OnSelectionMode"
|
20593 | | "OnMoveStart"
|
20594 | | "OnMove"
|
20595 | | "OnMoveEnd"
|
20596 | | "OnSort"
|
20597 | | "OnResize"
|
20598 | | "OnFocus"
|
20599 | | "OnBlur"
|
20600 | | "OnColumnsChange"
|
20601 | | "OnLazyLoad"
|
20602 | | "OnEditStart"
|
20603 | | "OnEditEnd";
|
20604 | export type TRowEvents =
|
20605 | | "OnAdd"
|
20606 | | "OnChange"
|
20607 | | "OnIndex"
|
20608 | | "OnDelete"
|
20609 | | "OnRefresh"
|
20610 | | "OnEnter"
|
20611 | | "OnTap"
|
20612 | | "OnDoubleTap"
|
20613 | | "OnSelect"
|
20614 | | "OnDeselect"
|
20615 | | "OnEnable"
|
20616 | | "OnDisable"
|
20617 | | "OnExpand"
|
20618 | | "OnCollapse"
|
20619 | | "OnShow"
|
20620 | | "OnHide"
|
20621 | | "OnExclude"
|
20622 | | "OnInclude"
|
20623 | | "OnMoveStart"
|
20624 | | "OnMove"
|
20625 | | "OnMoveEnd"
|
20626 | | "OnEditStart"
|
20627 | | "OnEditEnd";
|
20628 | export interface IListEvents<Hook extends THooks, T extends Row> extends IHookPayload<Hook> {
|
20629 | readonly list: List<T>;
|
20630 | }
|
20631 | export interface IListInitEvent<T extends Row = Row> extends IListEvents<"OnInit", T> {}
|
20632 | export interface IListReadyEvent<T extends Row = Row> extends IListEvents<"OnReady", T> {}
|
20633 | export interface IListResizeEvent<T extends Row = Row> extends IListEvents<"OnResize", T> {}
|
20634 | export interface IListFocusEvent<T extends Row = Row> extends IListEvents<"OnFocus", T> {}
|
20635 | export interface IListBlurEvent<T extends Row = Row> extends IListEvents<"OnBlur", T> {}
|
20636 | export interface IListColumnsChangeEvent<T extends Row = Row> extends IListEvents<"OnColumnsChange", T> {}
|
20637 | export interface IListSelectionChangeEvent<T extends Row = Row> extends IListEvents<"OnSelectionChange", T> {}
|
20638 | export interface IListSelectionModeEvent<T extends Row = Row> extends IListEvents<"OnSelectionMode", T> {}
|
20639 | export interface IListLazyLoadEvent<T extends Row = Row> extends IListEvents<"OnLazyLoad", T> {}
|
20640 | export interface IListSortEvent<T extends Row = Row> extends IHookPayload<"OnSort"> {
|
20641 | readonly column: Column<T> | undefined;
|
20642 | }
|
20643 | export interface IListRowEvents<Hook extends THooks, T extends Row> extends IHookPayload<Hook> {
|
20644 | readonly row: T;
|
20645 | }
|
20646 | export interface IListRowAddEvent<T extends Row = Row> extends IListRowEvents<"OnAdd", T> {}
|
20647 | export interface IListRowIndexEvent<T extends Row = Row> extends IListRowEvents<"OnIndex", T> {}
|
20648 | export interface IListRowDeleteEvent<T extends Row = Row> extends IListRowEvents<"OnDelete", T> {}
|
20649 | export interface IListRowSelectEvent<T extends Row = Row> extends IListRowEvents<"OnSelect", T> {}
|
20650 | export interface IListRowDeselectEvent<T extends Row = Row> extends IListRowEvents<"OnDeselect", T> {}
|
20651 | export interface IListRowEnableEvent<T extends Row = Row> extends IListRowEvents<"OnEnable", T> {}
|
20652 | export interface IListRowDisableEvent<T extends Row = Row> extends IListRowEvents<"OnDisable", T> {}
|
20653 | export interface IListRowExpandEvent<T extends Row = Row> extends IListRowEvents<"OnExpand", T> {}
|
20654 | export interface IListRowCollapseEvent<T extends Row = Row> extends IListRowEvents<"OnCollapse", T> {}
|
20655 | export interface IListRowShowEvent<T extends Row = Row> extends IListRowEvents<"OnShow", T> {}
|
20656 | export interface IListRowHideEvent<T extends Row = Row> extends IListRowEvents<"OnHide", T> {}
|
20657 | export interface IListRowExcludeEvent<T extends Row = Row> extends IListRowEvents<"OnExclude", T> {}
|
20658 | export interface IListRowIncludeEvent<T extends Row = Row> extends IListRowEvents<"OnInclude", T> {}
|
20659 | export interface IListRowDataEvents<Hook extends THooks, T extends Row> extends IListRowEvents<Hook, T> {
|
20660 | readonly property: string;
|
20661 | readonly data: TData;
|
20662 | }
|
20663 | export interface IListRowChangeEvent<T extends Row = Row> extends IListRowDataEvents<"OnChange", T> {}
|
20664 | export interface IListRowEditStartEvent<T extends Row = Row> extends IListRowDataEvents<"OnEditStart", T> {}
|
20665 | export interface IListRowEditEndEvent<T extends Row = Row> extends IListRowDataEvents<"OnEditEnd", T> {}
|
20666 | export interface IListRowTapEvent<T extends Row = Row> extends IListRowEvents<"OnTap", T> {
|
20667 | readonly column: Column<T>;
|
20668 | }
|
20669 | export interface IListRowDoubleTapEvent<T extends Row = Row> extends IListRowEvents<"OnDoubleTap", T> {
|
20670 | readonly column: Column<T>;
|
20671 | }
|
20672 | export interface IListRowMoveEvents<Hook extends THooks, T extends Row> extends IListRowEvents<Hook, T> {
|
20673 | readonly row: T;
|
20674 | readonly from: number;
|
20675 | readonly to: number;
|
20676 | }
|
20677 | export interface IListRowMoveStartEvent<T extends Row = Row> extends IListRowEvents<"OnMoveStart", T> {}
|
20678 | export interface IListRowMoveEvent<T extends Row = Row> extends IListRowMoveEvents<"OnMove", T> {}
|
20679 | export interface IListRowMoveEndEvent<T extends Row = Row> extends IListRowMoveEvents<"OnMoveEnd", T> {}
|
20680 | abstract class Row extends Item<TRowEvents> {
|
20681 |
|
20682 | static get isEditing(): boolean;
|
20683 |
|
20684 | static cancelEditor(): void;
|
20685 | |
20686 |
|
20687 |
|
20688 |
|
20689 | constructor(pIdentifier?: TIdentifier);
|
20690 | /** Retrieves a reference to the list. */
|
20691 | get list(): List<Row> | undefined;
|
20692 | /** Retrieves a reference to the child rows (if indention is supported). */
|
20693 | get rows(): Rows<Row>;
|
20694 | /** Retrieves a reference to the parent rows. */
|
20695 | get parent(): Rows<Row> | undefined;
|
20696 | /** Retrieves the parent row. */
|
20697 | get row(): Row | undefined;
|
20698 | /** Sets the parent row. */
|
20699 | set row(pRow: Row | undefined);
|
20700 | /** Retrieves all child rows in an array (including child rows). */
|
20701 | get all(): Row[];
|
20702 | /** Retrieves the child rows as an array. */
|
20703 | get children(): Row[];
|
20704 | /** Retrieves the ancestor row. */
|
20705 | get ancestor(): Row | undefined;
|
20706 | /** Retrieves the visible predecessor. */
|
20707 | get predecessorVisible(): Row | undefined;
|
20708 | /** Retrieves the visible successor. */
|
20709 | get successorVisible(): Row | undefined;
|
20710 | /** Retrieves the first row of the rows list. */
|
20711 | get first(): Row | undefined;
|
20712 | /** Retrieves the last row of the rows list. */
|
20713 | get last(): Row | undefined;
|
20714 | /** Retrieves the predecessor of the row in the complete list. */
|
20715 | get previous(): Row | undefined;
|
20716 | /** Retrieves the successor of the row in the complete list. */
|
20717 | get next(): Row | undefined;
|
20718 | /** Retrieves the identifier for the row. */
|
20719 | get identifier(): TIdentifier | undefined;
|
20720 | /** Retrieves the number of child rows in the row. */
|
20721 | get count(): number;
|
20722 | /** Retrieves the total number of rows in the row. */
|
20723 | get countRecursive(): number;
|
20724 | /** Retrieves the total number of visible rows in the row. */
|
20725 | get countVisible(): number;
|
20726 | /** Retrieves if the row is the first visible row. */
|
20727 | get isFirstVisible(): boolean;
|
20728 | /** Retrieves if the row is the last visible row. */
|
20729 | get isLastVisible(): boolean;
|
20730 | /** Retrieves if the predecessor is visible and expanded. */
|
20731 | get isPredecessorVisibleAndExpanded(): boolean;
|
20732 | /** Retrieves the position of the row in the list. */
|
20733 | get position(): number;
|
20734 | /** Retrieves if the row is drawn. */
|
20735 | get isDrawn(): boolean;
|
20736 | /** Retrieves if the row is calculated. */
|
20737 | get isCalculated(): boolean;
|
20738 | /** Retrieves the row rectangle. */
|
20739 | get rectangle(): Rectangle;
|
20740 | /** Retrieves the top position of the row. */
|
20741 | get top(): number;
|
20742 | /** Retrieves the botom position of the row. */
|
20743 | get bottom(): number;
|
20744 | /** Retrieves the total height of the row including child rows. */
|
20745 | get height(): number;
|
20746 | /** Retrieves the tail position of the row. */
|
20747 | get tail(): number;
|
20748 | /** Retrieves the mean of the row. */
|
20749 | get mean(): number;
|
20750 |
|
20751 | /** Retrieves the depth of the row. */
|
20752 | get depth(): number;
|
20753 | /** Retrieves the static label. */
|
20754 | get label(): string;
|
20755 | /** Sets the static label for static rows. */
|
20756 | set label(sLabel: string);
|
20757 | /** Retrieves if the row is a static label. */
|
20758 | get isLabel(): boolean;
|
20759 | /** Retrieves if the row is static. */
|
20760 | get isStatic(): boolean;
|
20761 | /** Specifies if the row is static. */
|
20762 | set isStatic(bStatic: boolean);
|
20763 | /** Retrieves if the row is hovered. */
|
20764 | get isHovered(): boolean;
|
20765 | /** Retrieves if the row is movable. */
|
20766 | get isMovable(): boolean;
|
20767 | /** Specifies if the row is movable. */
|
20768 | set isMovable(bMovable: boolean);
|
20769 | /** Retrieves if the row is moving. */
|
20770 | get isMoving(): boolean;
|
20771 | /** Specifies if the row is moving. */
|
20772 | set isMoving(bMoving: boolean);
|
20773 | /** Retrieves if the row is selected. */
|
20774 | get isSelected(): boolean;
|
20775 | /** Specifies the selected state of the row. */
|
20776 | set isSelected(bSelected: boolean);
|
20777 | /** Retrieves if the row is disabled. */
|
20778 | get isDisabled(): boolean;
|
20779 | /** Specifies if the row is disabled. */
|
20780 | set isDisabled(bDisable: boolean);
|
20781 | /** Retrieves if the row is visible. */
|
20782 | get isVisible(): boolean;
|
20783 | /** Specifies if the row is visible. */
|
20784 | set isVisible(bVisible: boolean);
|
20785 | /** Retrieves if the row is excluded. */
|
20786 | get isExcluded(): boolean;
|
20787 | /** Specifies if the row is excluded. */
|
20788 | set isExcluded(bExclude: boolean);
|
20789 | /** Retrieves if the row is collapsed. */
|
20790 | get isCollapsed(): boolean;
|
20791 | /** Specifies if the row is collapsed. */
|
20792 | set isCollapsed(bCollapsed: boolean);
|
20793 | /** Retrieves if the collapsed state is changed. */
|
20794 | get isCollapsedChanged(): boolean;
|
20795 | /** Retrieves if the list is expandable. */
|
20796 | get isExpandable(): boolean;
|
20797 | /** Retrieves if the row is observable. */
|
20798 | get isObservable(): boolean;
|
20799 | /** Retrieves if the row is hidden. */
|
20800 | get isHidden(): boolean;
|
20801 | /** Retrieves if the row is even. */
|
20802 | get isEven(): boolean;
|
20803 | /** Retrieves if the row is deleted. */
|
20804 | get isDeleted(): boolean;
|
20805 | /** Retrieves if the row is editable. */
|
20806 | get isEditable(): boolean;
|
20807 | /** Specifies if the row is editable. */
|
20808 | set isEditable(bIsEditable: boolean);
|
20809 |
|
20810 | /**
|
20811 | * Fired when a row is moved to another rows collection.
|
20812 | * @param pEvent Contains the event payload.
|
20813 | * @event
|
20814 | */
|
20815 | protected onChange(pEvent: IItemChangeEvent<Row>): void;
|
20816 | /**
|
20817 | * Fired when a row is destroyed.
|
20818 | * @param pEvent Contains the event payload.
|
20819 | * @event
|
20820 | */
|
20821 | protected onPop(pEvent: IItemPopEvent<Row>): void;
|
20822 | /**
|
20823 | * Fired when the data changes.
|
20824 | * @param sProperty Specifies the property that changed.
|
20825 | * @param pData Contains the data.
|
20826 | * @event
|
20827 | */
|
20828 | protected onDataChange(sProperty: string, pData: TData): void;
|
20829 | /** Draws the row. */
|
20830 | draw(): Element | undefined;
|
20831 | /**
|
20832 | * Redraws a cell.
|
20833 | * @param sProperty Specifies the column property name.
|
20834 | * @param bForceRedraw Forces a complete redraw of the cell.
|
20835 | */
|
20836 | redraw(pProperty: string | Column, bForceRedraw?: boolean): void;
|
20837 | /**
|
20838 | * Retrieves the cell element for the supplied column.
|
20839 | * @param pColumn Reference to the column.
|
20840 | * @return Returns a reference to the element.
|
20841 | */
|
20842 | cellElement(pColumn: Column): Element;
|
20843 | /**
|
20844 | * Retrieves or writes the cell data for the supplied column.
|
20845 | * @param pColumn Reference to the column.
|
20846 | * @param pData Optional new data value.
|
20847 | * @return Returns the data.
|
20848 | */
|
20849 | cell(pColumn: Column<Row>, pData?: TData): TData;
|
20850 | /**
|
20851 | * Creates a glyph for the row.
|
20852 | * @param sStyles Specifies the glyph styles.
|
20853 | * @param bIndent Specifies if the complete row needs to be indented.
|
20854 | */
|
20855 | glyphCreate(sStyles: string, nWidth: number, bIndent: boolean, bFollowing: boolean): void;
|
20856 | /**
|
20857 | * Moves the row gylph.
|
20858 | * @param nX Specifies the horizontal movement.
|
20859 | * @param nY Specifies the vertical movement.
|
20860 | */
|
20861 | glyphMove(nX: number, nY: number): void;
|
20862 | /** Destroys the gylph. */
|
20863 | glyphDestroy(): void;
|
20864 | /** Updates the indentation level. */
|
20865 | updateIndentation(): void;
|
20866 | /**
|
20867 | * Invoked when the row is initialized.
|
20868 | * @return Returns a reference to the row.
|
20869 | * @event
|
20870 | */
|
20871 | onInit(): this;
|
20872 | /**
|
20873 | * Fired when a row is changed.
|
20874 | * @param nReason Specifies the reason for the change.
|
20875 | * @event
|
20876 | */
|
20877 | onUpdate(nReason: Reasons): void;
|
20878 | /**
|
20879 | * Invoked when the row index is changed.
|
20880 | * @event
|
20881 | */
|
20882 | onIndex(): void;
|
20883 | /**
|
20884 | * Invoked when a row is refreshed.
|
20885 | * @event
|
20886 | */
|
20887 | onRefresh(): void;
|
20888 | /**
|
20889 | * Fired when the hover state of a row is changed.
|
20890 | * @param bHover Specifies if the row is hovered.
|
20891 | * @param bScrollEvent Indicates if the event is fired by a scroll event.
|
20892 | * @event
|
20893 | */
|
20894 | onHover(bHover: boolean, bScrollEvent?: boolean): void;
|
20895 | /**
|
20896 | * Sets the `OnTap` callback.
|
20897 | * @param fnTap Specifies the callback function.
|
20898 | * @param fnTap.pRow Reference to the row.
|
20899 | * @param fnTap.pColumn Reference to the column which is tapped.
|
20900 | * @return Returns a reference to the row to allow chaining.
|
20901 | * @event
|
20902 | */
|
20903 | onTap<T extends Row>(fnTap: (pRow: T, pColumn: Column) => void | boolean): this;
|
20904 | /**
|
20905 | * Sets the `OnDoubleTap` callback.
|
20906 | * @param fnDoubleTap Specifies the callback function.
|
20907 | * @param fnDoubleTap.pRow Reference to the row.
|
20908 | * @param fnDoubleTap.pColumn Reference to the column which is tapped.
|
20909 | * @return Returns a reference to the row to allow chaining.
|
20910 | * @event
|
20911 | */
|
20912 | onDoubleTap<T extends Row>(fnDoubleTap: (pRow: T, pColumn: Column) => void | boolean): this;
|
20913 | /**
|
20914 | * Sets the `OnEnter` callback.
|
20915 | * @param fnEnter Specifies the callback function.
|
20916 | * @param fnEnter.pRow Reference to the row.
|
20917 | * @return Returns a reference to the row to allow chaining.
|
20918 | * @event
|
20919 | */
|
20920 | onEnter<T extends Row>(fnEnter: (pRow: T) => void | boolean): this;
|
20921 | /**
|
20922 | * Sets the `OnSelect` callback.
|
20923 | * @param fnSelect Specifies the callback function.
|
20924 | * @param fnSelect.pRow Reference to the row.
|
20925 | * @return Returns a reference to the row to allow chaining.
|
20926 | * @event
|
20927 | */
|
20928 | onSelect<T extends Row>(fnSelect: (pRow: T) => void): this;
|
20929 | /**
|
20930 | * Sets the `OnDeselect` callback.
|
20931 | * @param fnDeselect Specifies the callback function.
|
20932 | * @param fnDeselect.pRow Reference to the row.
|
20933 | * @return Returns a reference to the row to allow chaining.
|
20934 | * @event
|
20935 | */
|
20936 | onDeselect<T extends Row>(fnDeselect: (pRow: T) => void): this;
|
20937 | /**
|
20938 | * Writes row data.
|
20939 | * @param sProperty Specifies the property that changed.
|
20940 | * @param pData Contains the data.
|
20941 | */
|
20942 | write(sProperty: string, pData: TData): void;
|
20943 | /**
|
20944 | * Fires the tap event.
|
20945 | * @param pColumn Reference to the column.
|
20946 | * @return Returns `true` if the event is fired.
|
20947 | */
|
20948 | tap(pColumn: Column): boolean;
|
20949 | /**
|
20950 | * Fires the double tap event.
|
20951 | * @param pColumn Reference to the column.
|
20952 | * @return Returns `true` if the event resulted in an action.
|
20953 | */
|
20954 | doubleTap(pColumn: Column): boolean;
|
20955 | /**
|
20956 | * Fires the enter event.
|
20957 | * @return Returns `true` if the `OnEnter` event has handled the event.
|
20958 | */
|
20959 | enter(): boolean;
|
20960 | /**
|
20961 | * Sets the static state of the row.
|
20962 | * @param sLabel Specifies the static label.
|
20963 | * @return Returns a reference to the row to allow chaining.
|
20964 | */
|
20965 | static(sLabel?: string): this;
|
20966 | /**
|
20967 | * Specifies if the row is movable.
|
20968 | * @param bMovable Specifies if the row is movable.
|
20969 | * @return Returns a reference to the row to allow chaining.
|
20970 | */
|
20971 | movable(bMovable: boolean): this;
|
20972 | /**
|
20973 | * Selects the row.
|
20974 | * @return Returns a reference to the row to allow chaining.
|
20975 | */
|
20976 | select(): this;
|
20977 | /**
|
20978 | * Deselects the row.
|
20979 | * @return Returns a reference to the row to allow chaining.
|
20980 | */
|
20981 | deselect(): this;
|
20982 | /**
|
20983 | * Enables the row.
|
20984 | * @return Returns a reference to the row to allow chaining.
|
20985 | */
|
20986 | enable(): this;
|
20987 | /**
|
20988 | * Disables the row.
|
20989 | * @return Returns a reference to the row to allow chaining.
|
20990 | */
|
20991 | disable(): this;
|
20992 | /**
|
20993 | * Shows the row.
|
20994 | * @return Returns a reference to the row to allow chaining.
|
20995 | */
|
20996 | show(): this;
|
20997 | /**
|
20998 | * Hides the row.
|
20999 | * @return Returns a reference to the row to allow chaining.
|
21000 | */
|
21001 | hide(): this;
|
21002 | /**
|
21003 | * Expands the row.
|
21004 | * @return Returns a reference to the row to allow chaining.
|
21005 | */
|
21006 | expand(): this;
|
21007 | /**
|
21008 | * Collapses the row.
|
21009 | * @return Returns a reference to the row to allow chaining.
|
21010 | */
|
21011 | collapse(): this;
|
21012 | /**
|
21013 | * Increases the row indentation.
|
21014 | * @return Returns a reference to the row to allow chaining.
|
21015 | */
|
21016 | increase(): this;
|
21017 | /**
|
21018 | * Decreases the row indentation.
|
21019 | * @return Returns a reference to the row to allow chaining.
|
21020 | */
|
21021 | decrease(): this;
|
21022 | /**
|
21023 | * Moves the row to another row.
|
21024 | * @param pRow Specifies the row to move to.
|
21025 | * @param sWhere Specifies where the row should be added.
|
21026 | * @return Returns `true` if the row is moved.
|
21027 | */
|
21028 | move(pRow: Row, sWhere: "below" | "above" | "firstchild" | "lastchild"): boolean;
|
21029 | /**
|
21030 | * Makes the row the (last) child of the supplied row.
|
21031 | * @param pRow Specifies the row which becomes the parent.
|
21032 | * @return Returns `true` if the row is moved.
|
21033 | */
|
21034 | makeLastChildOf(pRow: Row): boolean;
|
21035 | /**
|
21036 | * Makes the row the (last) child of the supplied row.
|
21037 | * @param pRow Specifies the row which becomes the parent.
|
21038 | * @return Returns `true` if the row is moved.
|
21039 | */
|
21040 | makeFirstChildOf(pRow: Row): boolean;
|
21041 | /**
|
21042 | * Verifies if the supplied row is a parent of the row.
|
21043 | * @param pRow Reference to the row.
|
21044 | * @return Returns `true` if the row is a child of the supplied row.
|
21045 | */
|
21046 | isChildOf(pRow: Row): boolean;
|
21047 | /**
|
21048 | * Retrieves if the a column is being edited.
|
21049 | * @param pColumn Specifies the column to check.
|
21050 | * @return Returns `true` if the column is being edited.
|
21051 | */
|
21052 | isEditing(pColumn: Column): boolean;
|
21053 | /**
|
21054 | * Scrolls the row into view.
|
21055 | * @return Returns a reference to the row to allow chaining.
|
21056 | */
|
21057 | scrollIntoView(): Row;
|
21058 | /**
|
21059 | * Deletes the row from the list.
|
21060 | * @param bRecursive Specifies if child rows should be deleted.
|
21061 | * @return Returns a reference to the row to allow chaining.
|
21062 | */
|
21063 | delete(bRecursive?: boolean): this;
|
21064 | /**
|
21065 | * Activates the editor for the specified column.
|
21066 | * @param pColumn Specifies the column of the row to edit.
|
21067 | * @return Returns `true` if the editing is started.
|
21068 | */
|
21069 | editor(pColumn: Column): boolean;
|
21070 | /**
|
21071 | * Activates the editor for the column with the specified name.
|
21072 | * @param sProperty Specifies the property.
|
21073 | * @return Returns `true` if the editing is started.
|
21074 | */
|
21075 | editorForColumn(sProperty: string): boolean;
|
21076 | /** Closes the edtior. */
|
21077 | closeEditor(): void;
|
21078 | /**
|
21079 | * Refreshes the data for a complete row or for one or more columns.
|
21080 | * @param pColumns Specifies the columns to refresh. If omitted all columns
|
21081 | * are refreshed.
|
21082 | */
|
21083 | refresh(...pColumns: (string | Column)[]): void;
|
21084 | /** Destroys a row. */
|
21085 | destroy(): void;
|
21086 | }
|
21087 | /** Type declaration for column types. */
|
21088 | export type TColumnType =
|
21089 | | "string"
|
21090 | | "number"
|
21091 | | "boolean"
|
21092 | | "date"
|
21093 | | "time"
|
21094 | | "datetime"
|
21095 | | "image"
|
21096 | | "icon"
|
21097 | | "checkbox"
|
21098 | | "switch"
|
21099 | | "selector"
|
21100 | | "button"
|
21101 | | "custom";
|
21102 | interface IColumnTreeImage {
|
21103 |
|
21104 | URL: string;
|
21105 |
|
21106 | URLWhileMoving?: string;
|
21107 |
|
21108 | width: number;
|
21109 |
|
21110 | height: number;
|
21111 | }
|
21112 | interface IColumnTreeImages {
|
21113 |
|
21114 | line: IColumnTreeImage;
|
21115 |
|
21116 | node: IColumnTreeImage;
|
21117 |
|
21118 | ending: IColumnTreeImage;
|
21119 |
|
21120 | expand?: IColumnTreeImage;
|
21121 |
|
21122 | collapse?: IColumnTreeImage;
|
21123 | }
|
21124 | interface IColumnProperties<T extends Row = Row> {
|
21125 |
|
21126 | property: string;
|
21127 |
|
21128 | type: TColumnType;
|
21129 |
|
21130 | name?: string;
|
21131 |
|
21132 | icon?: {
|
21133 |
|
21134 | URL: string;
|
21135 |
|
21136 | width: number;
|
21137 |
|
21138 | height: number;
|
21139 | };
|
21140 | |
21141 |
|
21142 |
|
21143 |
|
21144 |
|
21145 | width?: number | string | "auto";
|
21146 |
|
21147 | minWidth?: number;
|
21148 |
|
21149 | maxWidth?: number;
|
21150 |
|
21151 | alignment?: "left" | "center" | "right";
|
21152 |
|
21153 | visible?: boolean;
|
21154 |
|
21155 | resizable?: boolean;
|
21156 |
|
21157 | movable?: boolean;
|
21158 | |
21159 |
|
21160 |
|
21161 |
|
21162 | editable?: "no" | "yes" | "auto";
|
21163 |
|
21164 | sortable?: boolean;
|
21165 |
|
21166 | resortOnChange?: boolean;
|
21167 |
|
21168 | indentation?: number;
|
21169 | |
21170 |
|
21171 |
|
21172 |
|
21173 |
|
21174 |
|
21175 | indentAlways?: boolean;
|
21176 | |
21177 |
|
21178 |
|
21179 | indentOffset?: number;
|
21180 | |
21181 |
|
21182 |
|
21183 |
|
21184 | treeImages?: IColumnTreeImages;
|
21185 |
|
21186 | prefix?: string;
|
21187 |
|
21188 | suffix?: string;
|
21189 |
|
21190 | labelForTrue?: string;
|
21191 |
|
21192 | labelForFalse?: string;
|
21193 |
|
21194 | precision?: number;
|
21195 |
|
21196 | format?: "short" | "medium" | "long" | "full";
|
21197 |
|
21198 | size?: number;
|
21199 | |
21200 |
|
21201 |
|
21202 |
|
21203 | default?: string;
|
21204 | |
21205 |
|
21206 |
|
21207 |
|
21208 |
|
21209 |
|
21210 | decorator?: TDecorator<T>;
|
21211 | |
21212 |
|
21213 |
|
21214 |
|
21215 | modifier?: TModifier<T>;
|
21216 |
|
21217 | colorize?: TColorize<T>;
|
21218 |
|
21219 | markdown?: TMarkdown<T>;
|
21220 |
|
21221 | onTap?: (pColumn: Column<T>) => void;
|
21222 | |
21223 |
|
21224 |
|
21225 |
|
21226 | command?: TRowCallback<T>;
|
21227 | |
21228 |
|
21229 |
|
21230 |
|
21231 | menu?: (pRow: T) => MenuOption[];
|
21232 |
|
21233 | menuAlways?: boolean;
|
21234 |
|
21235 | menuStyle?: IMenuStyle;
|
21236 |
|
21237 | selectOnMenu?: boolean;
|
21238 | }
|
21239 | interface IColumnSelector {
|
21240 | type: "selector";
|
21241 | }
|
21242 | interface IColumnState {
|
21243 |
|
21244 | property: string;
|
21245 |
|
21246 | index: number;
|
21247 |
|
21248 | width: number;
|
21249 |
|
21250 | sorting: TColumnSorting;
|
21251 | }
|
21252 | interface IColumnHeaderStyle {
|
21253 |
|
21254 | width?: number;
|
21255 |
|
21256 | appearance?: IStyles;
|
21257 |
|
21258 | sortable?: {
|
21259 |
|
21260 | appearance?: IStyles;
|
21261 |
|
21262 | ascending?: IStyles;
|
21263 |
|
21264 | descending?: IStyles;
|
21265 | };
|
21266 |
|
21267 | resizable?: IStyles;
|
21268 |
|
21269 | resizing?: {
|
21270 |
|
21271 | header: IStyles;
|
21272 |
|
21273 | column?: IStyles;
|
21274 | };
|
21275 |
|
21276 | movable?: IStyles;
|
21277 |
|
21278 | moving?: {
|
21279 |
|
21280 | header: IStyles;
|
21281 |
|
21282 | column?: IStyles;
|
21283 | };
|
21284 |
|
21285 | last?: IStyles;
|
21286 |
|
21287 | splitter?: {
|
21288 |
|
21289 | width: number;
|
21290 |
|
21291 | appearance?: IStyles;
|
21292 |
|
21293 | resizable?: IStyles;
|
21294 |
|
21295 | resizing?: IStyles;
|
21296 |
|
21297 | movable?: IStyles;
|
21298 |
|
21299 | moving?: IStyles;
|
21300 |
|
21301 | last?: IStyles;
|
21302 | };
|
21303 |
|
21304 | selector?: {
|
21305 |
|
21306 | width: number;
|
21307 |
|
21308 | appearance?: IStyles;
|
21309 |
|
21310 | unchecked?: IStyles;
|
21311 |
|
21312 | checked?: IStyles;
|
21313 | };
|
21314 | }
|
21315 | interface IColumnsHeaderStyle {
|
21316 |
|
21317 | height: number;
|
21318 |
|
21319 | spacing?: number;
|
21320 |
|
21321 | appearance?: IStyles;
|
21322 |
|
21323 | column: IColumnHeaderStyle & {
|
21324 | types?: {
|
21325 | [type: string]: IColumnHeaderStyle;
|
21326 | };
|
21327 | properties?: {
|
21328 | [property: string]: IColumnHeaderStyle;
|
21329 | };
|
21330 | };
|
21331 | }
|
21332 | class Columns<T extends Row> extends StrictMatrix<Columns<T>, Column<T>, void, IColumnProperties<T>> {
|
21333 | |
21334 |
|
21335 |
|
21336 |
|
21337 |
|
21338 |
|
21339 | constructor(pList: List<T>, pColumns: (IColumnProperties<T> | IColumnSelector)[], fnResize: (nWidth?: number) => void);
|
21340 |
|
21341 | /** Retrieves a reference to the list. */
|
21342 | get list(): List<T>;
|
21343 | /** Retrieves the columns state. */
|
21344 | get state(): IColumnState[];
|
21345 | /** Restores the column state. */
|
21346 | set state(pState: IColumnState[]);
|
21347 | /** Contains if the columns are being calculated. */
|
21348 | get isCalculating(): boolean;
|
21349 | /** Retrieves the width of all columns. */
|
21350 | get columnsWidth(): number;
|
21351 | /** Retrieves the header width. */
|
21352 | get headerWidth(): number;
|
21353 | /**
|
21354 | * Retrieves the row width which is the header width or the width of all
|
21355 | * columns if their combined width if larger then the width of the header.
|
21356 | */
|
21357 | get rowWidth(): number;
|
21358 | /** Retrieves if a column is sorting. */
|
21359 | get isSorting(): boolean;
|
21360 | /** Retrieves if a column is resizing. */
|
21361 | get isResizing(): boolean;
|
21362 | /** Retrieves if a column is moving or resizing. */
|
21363 | get isMovingOrResizing(): boolean;
|
21364 | /** Retrieves if a column is editable. */
|
21365 | get isEditable(): boolean;
|
21366 | /**
|
21367 | * Retrieves the column for the specified property.
|
21368 | * @param sProperty Specifies the property.
|
21369 | * @return Returns a reference to the column or `undefined` if the column is
|
21370 | * not found.
|
21371 | */
|
21372 | column(sProperty: string): Column<T> | undefined;
|
21373 | /**
|
21374 | * Retrieves the column at the specified point.
|
21375 | * @param pPoint Specifies the point.
|
21376 | * @return Returns a reference to the column or `undefined` if the column is
|
21377 | * not found.
|
21378 | */
|
21379 | columnFromPoint(pPoint: IPoint): Column<T> | undefined;
|
21380 | /**
|
21381 | * Retrieves the minimum column width.
|
21382 | * @param sProperty Specifies the column property.
|
21383 | * @param sType Specifies the column type.
|
21384 | */
|
21385 | columnMinWidth(sType: TColumnType, sProperty: string): number;
|
21386 | /**
|
21387 | * Draws the column headers to the specified element.
|
21388 | * @param pElement Reference to the parent element.
|
21389 | * @param pStyle Specifies the column header style.
|
21390 | * @return Returns a reference to the element.
|
21391 | */
|
21392 | drawHeader(pElement: Element, pStyle: IColumnsHeaderStyle): Element | undefined;
|
21393 | /**
|
21394 | * Initializes the column header.
|
21395 | * @return Returns `true` if the header is initialized.
|
21396 | */
|
21397 | init(): boolean;
|
21398 | /**
|
21399 | * Calculates the column width.
|
21400 | * @param nWidthAvailable Specifies the available visual width.
|
21401 | */
|
21402 | calculate(nWidthAvailable?: number): void;
|
21403 | /**
|
21404 | * Resizes the column header.
|
21405 | * @param bSynchronous Specifies if the resize should be performed synchronously.
|
21406 | */
|
21407 | resize(bSynchronous?: boolean): void;
|
21408 | /**
|
21409 | * Updates the columns.
|
21410 | * @param bSynchronous Specifies if the update should be performed synchronously.
|
21411 | */
|
21412 | update(bSynchronous: boolean): void;
|
21413 | /** Invoked when the column are changed. */
|
21414 | changed(): void;
|
21415 | /** Marks the list as unsorted. */
|
21416 | unsorted(): void;
|
21417 | /** Resorts the list. */
|
21418 | resort(): void;
|
21419 | /** Markes the list as not sorted. */
|
21420 | nosort(): void;
|
21421 | /** Destroys the columns. */
|
21422 | destroy(): void;
|
21423 | }
|
21424 | /** Type definition for sorting. */
|
21425 | export type TColumnSorting = "no" | "ascending" | "descending";
|
21426 | class Column<T extends Row = TAny> extends StrictItem<Columns<T>, void, IColumnProperties<T>> {
|
21427 | |
21428 |
|
21429 |
|
21430 |
|
21431 |
|
21432 | constructor(pColumns: Columns<T>, pProperties: IColumnProperties<T>);
|
21433 | /** Retrieves the column properties. */
|
21434 | get properties(): IColumnProperties<T>;
|
21435 | /** Retrieves a reference to the list. */
|
21436 | get list(): List<T>;
|
21437 |
|
21438 | /** Retrieves if the column is sorting. */
|
21439 | get isSorting(): boolean;
|
21440 | /** Retrieves if a column is moving. */
|
21441 | get isMoving(): boolean;
|
21442 | /** Retrieves if a column is resizing. */
|
21443 | get isResizing(): boolean;
|
21444 | /** Retrieves if a column is moving or resizing. */
|
21445 | get isMovingOrResizing(): boolean;
|
21446 | /** Retrieves if the column is sorted ascending. */
|
21447 | get isSortedAscending(): boolean;
|
21448 | /** Retrieves if the column is sorted descending. */
|
21449 | get isSortedDescending(): boolean;
|
21450 | /** Retrieves if sorting is enabled for this column. */
|
21451 | get isSorted(): boolean;
|
21452 | /** Retrieves if the column is visible. */
|
21453 | get isVisible(): boolean;
|
21454 | /** Sets the column visibility. */
|
21455 | set isVisible(bVisible: boolean);
|
21456 | /** Retrieves the column indentation size. */
|
21457 | get indentation(): number;
|
21458 | /** Retrieves if indentation is always enabled. */
|
21459 | get indentAlways(): boolean;
|
21460 | /** Retrieves the indentation offset. */
|
21461 | get indentOffset(): number;
|
21462 | /** Retrieves if the column allows indentation. */
|
21463 | get allowIndentation(): boolean;
|
21464 | /** Retrieves if the column supports expanders. */
|
21465 | get allowExpander(): boolean;
|
21466 |
|
21467 | /** Retrieves the left position of the column. */
|
21468 | get left(): number;
|
21469 | /** Retrieves the right position of the column. */
|
21470 | get right(): number;
|
21471 | /** Retrieves the current column width. */
|
21472 | get width(): number;
|
21473 | /** Sets the column width. */
|
21474 | set width(nWidth: number);
|
21475 | /** Retrieves if the column has an absolute width. */
|
21476 | get hasAbsoluteWidth(): boolean;
|
21477 | /** Retrieves the column class name. */
|
21478 | get class(): string;
|
21479 | /** Retrieves the column type. */
|
21480 | get type(): TColumnType;
|
21481 | /** Retrieves the column property name. */
|
21482 | get property(): string;
|
21483 | /** Retrieves the column offset. */
|
21484 | get offset(): number;
|
21485 | /** Retrieves the column state. */
|
21486 | get state(): IColumnState;
|
21487 | /** Restores the column state. */
|
21488 | set state(pState: IColumnState);
|
21489 |
|
21490 | /** Positions the column. */
|
21491 | position(): void;
|
21492 | /**
|
21493 | * Reflects the column position to the list.
|
21494 | * @param bInstantly Writes the position change instantly.
|
21495 | */
|
21496 | reflectPosition(bInstantly?: boolean): void;
|
21497 | /** Reflects the column width to the list. */
|
21498 | reflectWidth(): void;
|
21499 | /**
|
21500 | * Draws a column glyph element.
|
21501 | * @param pParent Reference to the parent glyph element.
|
21502 | * @param nOffset Specifies the column offset.
|
21503 | */
|
21504 | drawGlyph(pParent: Element, nOffset: number): Element;
|
21505 | /**
|
21506 | * Draws the column header.
|
21507 | * @param pElementColumns Reference to the columns element.
|
21508 | * @param pResizing Specifies the column styles when resizing.
|
21509 | * @param pMoving Specifies the column styles when moving.
|
21510 | */
|
21511 | drawHeader(pElementColumns: Element, pResizing?: IStyles, pMoving?: IStyles): void;
|
21512 | /**
|
21513 | * Initializes the column.
|
21514 | * @return Returns `true` if the column is initialized.
|
21515 | */
|
21516 | init(): boolean;
|
21517 | /**
|
21518 | * Calculates the column width.
|
21519 | * @return Returns the pixel width or `0` if the width is a percentage.
|
21520 | */
|
21521 | calculate(): number;
|
21522 | /**
|
21523 | * Calculates the column width from a percentage.
|
21524 | * @param nWidthAvailable Specifies the available width.
|
21525 | * @return Returns the pixel width or `0` if the width is a absolute.
|
21526 | */
|
21527 | calculateFromPercentage(nWidthAvailable: number): number;
|
21528 | /**
|
21529 | * Calculates the optimal column width where all column content is visible.
|
21530 | * @param fnResult Callback function which is invoked when the width is calculated.
|
21531 | * @param fnResult.nWidth Contains the optimal width in pixels.
|
21532 | */
|
21533 | calculateOptimalWidth(fnResult: (nWidth: number) => void): void;
|
21534 | /**
|
21535 | * Returns the column if the supplied point is within the column.
|
21536 | * @param pPoint Specifies a point.
|
21537 | * @return Returns a reference to the column.
|
21538 | */
|
21539 | inRange(pPoint: IPoint): this | undefined;
|
21540 | /**
|
21541 | * Expands the column with the specified amount.
|
21542 | * @param nAmount Amount of expand in pixels.
|
21543 | */
|
21544 | expand(nAmount: number): void;
|
21545 | /**
|
21546 | * Shrinks the column with the specified amount.
|
21547 | * @param nAmount Amount of expand in pixels.
|
21548 | */
|
21549 | shrink(nAmount: number): void;
|
21550 | /** Expands or shrinks the column to fit the column contents. */
|
21551 | fit(): void;
|
21552 | /**
|
21553 | * Fired when the column is pushed.
|
21554 | * @event
|
21555 | */
|
21556 | onPush(): void;
|
21557 | /**
|
21558 | * Fired when the column is changed.
|
21559 | * @event
|
21560 | */
|
21561 | onChange(): void;
|
21562 | /**
|
21563 | * Marks the list as unsorted.
|
21564 | * @return Returns `true` if the column sorting is invalidated.
|
21565 | */
|
21566 | unsorted(): boolean;
|
21567 | /**
|
21568 | * Sorts the list using the column data.
|
21569 | * @param sDirection Specifies the order direction.
|
21570 | * @return Returns `true` if the sort invoked a change in the row order.
|
21571 | */
|
21572 | sort(sDirection: "ascending" | "descending"): boolean;
|
21573 | /**
|
21574 | * Resorts a column if sorting is enabled.
|
21575 | * @return Returns `true` if the resort is applied.
|
21576 | */
|
21577 | resort(): boolean;
|
21578 | /**
|
21579 | * Disables column sorting if sorting is enabled for the column.
|
21580 | * @return Returns 'true' if the column sorting is disabled.
|
21581 | */
|
21582 | nosort(): boolean;
|
21583 | /** Refreshes the data for a column for all rows. */
|
21584 | refresh(): void;
|
21585 | /** Destroys the column. */
|
21586 | destroy(): void;
|
21587 | }
|
21588 | /** Describes the list style. */
|
21589 | export interface IListStyle {
|
21590 |
|
21591 | appearance?: IStyles;
|
21592 |
|
21593 | hover?: IStyles;
|
21594 |
|
21595 | header?: IColumnsHeaderStyle;
|
21596 |
|
21597 | rows?: IStyles;
|
21598 |
|
21599 | column?: {
|
21600 |
|
21601 | appearance?: IStyles;
|
21602 |
|
21603 | odd?: IStyles;
|
21604 |
|
21605 | even?: IStyles;
|
21606 |
|
21607 | hover?: IStyles;
|
21608 |
|
21609 | selected?: IStyles;
|
21610 |
|
21611 | disabled?: IStyles;
|
21612 |
|
21613 | moving?: IStyles;
|
21614 |
|
21615 | lagging?: IStyles;
|
21616 |
|
21617 | static?: {
|
21618 |
|
21619 | appearance?: IStyles;
|
21620 |
|
21621 | moving?: IStyles;
|
21622 |
|
21623 | lagging?: IStyles;
|
21624 | };
|
21625 |
|
21626 | glyph?: {
|
21627 |
|
21628 | appearance?: IStyles;
|
21629 |
|
21630 | following?: IStyles;
|
21631 |
|
21632 | static?: IStyles;
|
21633 | };
|
21634 | };
|
21635 |
|
21636 | row?: {
|
21637 |
|
21638 | height: number;
|
21639 |
|
21640 | spacing?: number;
|
21641 |
|
21642 | spacingAfterLastRow?: boolean;
|
21643 |
|
21644 | appearance?: IStyles;
|
21645 |
|
21646 | odd?: IStyles;
|
21647 |
|
21648 | even?: IStyles;
|
21649 |
|
21650 | hover?: IStyles;
|
21651 |
|
21652 | selected?: IStyles;
|
21653 |
|
21654 | disabled?: IStyles;
|
21655 |
|
21656 | moving?: IStyles;
|
21657 |
|
21658 | lagging?: IStyles;
|
21659 |
|
21660 | hidden?: IStyles;
|
21661 |
|
21662 | static?: {
|
21663 |
|
21664 | appearance?: IStyles;
|
21665 |
|
21666 | moving?: IStyles;
|
21667 |
|
21668 | lagging?: IStyles;
|
21669 | };
|
21670 |
|
21671 | glyph?: {
|
21672 |
|
21673 | appearance?: IStyles;
|
21674 |
|
21675 | following?: IStyles;
|
21676 |
|
21677 | static?: IStyles;
|
21678 | };
|
21679 | };
|
21680 |
|
21681 | cell?: {
|
21682 |
|
21683 | appearance?: IStyles;
|
21684 |
|
21685 | odd?: IStyles;
|
21686 |
|
21687 | even?: IStyles;
|
21688 |
|
21689 | hover?: IStyles;
|
21690 |
|
21691 | selected?: IStyles;
|
21692 |
|
21693 | disabled?: IStyles;
|
21694 |
|
21695 | moving?: IStyles;
|
21696 |
|
21697 | lagging?: IStyles;
|
21698 |
|
21699 | static?: {
|
21700 |
|
21701 | appearance?: IStyles;
|
21702 |
|
21703 | moving?: IStyles;
|
21704 |
|
21705 | lagging?: IStyles;
|
21706 |
|
21707 | label?: {
|
21708 |
|
21709 | appearance?: IStyles;
|
21710 |
|
21711 | moving?: IStyles;
|
21712 |
|
21713 | lagging?: IStyles;
|
21714 | };
|
21715 | };
|
21716 |
|
21717 | glyph?: {
|
21718 |
|
21719 | appearance?: IStyles;
|
21720 |
|
21721 | following?: IStyles;
|
21722 |
|
21723 | static?: {
|
21724 |
|
21725 | appearance?: IStyles;
|
21726 |
|
21727 | label?: IStyles;
|
21728 | };
|
21729 | };
|
21730 | };
|
21731 |
|
21732 | selector?: {
|
21733 |
|
21734 | width: number;
|
21735 |
|
21736 | appearance?: IStyles;
|
21737 |
|
21738 | unchecked?: IStyles;
|
21739 |
|
21740 | checked?: IStyles;
|
21741 | };
|
21742 |
|
21743 | checkbox?: {
|
21744 |
|
21745 | width: number;
|
21746 |
|
21747 | appearance?: IStyles;
|
21748 |
|
21749 | unchecked?: IStyles;
|
21750 |
|
21751 | checked?: IStyles;
|
21752 |
|
21753 | selected?: {
|
21754 |
|
21755 | unchecked?: IStyles;
|
21756 |
|
21757 | checked?: IStyles;
|
21758 | };
|
21759 | };
|
21760 |
|
21761 | switch?: {
|
21762 |
|
21763 | width: number;
|
21764 |
|
21765 | appearance?: IStyles;
|
21766 |
|
21767 | off?: IStyles;
|
21768 |
|
21769 | on?: IStyles;
|
21770 |
|
21771 | selected?: {
|
21772 |
|
21773 | off?: IStyles;
|
21774 |
|
21775 | on?: IStyles;
|
21776 | };
|
21777 | };
|
21778 |
|
21779 | icon?: {
|
21780 |
|
21781 | class: string;
|
21782 |
|
21783 | default?: string;
|
21784 |
|
21785 | hover?: string;
|
21786 |
|
21787 | selected?: string;
|
21788 |
|
21789 | moving?: string;
|
21790 |
|
21791 | glyph?: string;
|
21792 | };
|
21793 |
|
21794 | button?: {
|
21795 |
|
21796 | class: string;
|
21797 |
|
21798 | default?: string;
|
21799 |
|
21800 | hover?: string;
|
21801 |
|
21802 | selected?: string;
|
21803 |
|
21804 | moving?: string;
|
21805 |
|
21806 | glyph?: string;
|
21807 | };
|
21808 |
|
21809 | editor?: {
|
21810 |
|
21811 | appearance: IStyles;
|
21812 |
|
21813 | selection: IStyles;
|
21814 |
|
21815 | selected?: {
|
21816 |
|
21817 | appearance: IStyles;
|
21818 |
|
21819 | selection: IStyles;
|
21820 | };
|
21821 | };
|
21822 |
|
21823 | emptyState?: {
|
21824 |
|
21825 | height?: number;
|
21826 |
|
21827 | appearance?: IStyles;
|
21828 | };
|
21829 |
|
21830 | scrollbars?: IScrollbarsStyle;
|
21831 |
|
21832 | menu?: IMenuStyle;
|
21833 | }
|
21834 |
|
21835 | export interface IListProperties<T extends Row = Row> {
|
21836 | |
21837 |
|
21838 |
|
21839 |
|
21840 | stylesheet?: Stylesheet;
|
21841 |
|
21842 | style?: IListStyle;
|
21843 |
|
21844 | parent?: Layer | Element;
|
21845 |
|
21846 | columns?: (IColumnProperties<T> | IColumnSelector)[];
|
21847 |
|
21848 | lazy?: boolean;
|
21849 | |
21850 |
|
21851 |
|
21852 |
|
21853 | scrollable?: "no" | "yes" | "horizontal";
|
21854 |
|
21855 | selectable?: boolean;
|
21856 |
|
21857 | multipleSelect?: boolean;
|
21858 |
|
21859 | multipleSelectUsingCtrl?: boolean;
|
21860 | |
21861 |
|
21862 |
|
21863 |
|
21864 | movable?: "strict" | "yes" | "no";
|
21865 | |
21866 |
|
21867 |
|
21868 |
|
21869 |
|
21870 | indentationMaxDepth?: number;
|
21871 |
|
21872 | collapsed?: boolean;
|
21873 |
|
21874 | sorting?: string;
|
21875 |
|
21876 | sortingDirection?: "ascending" | "descending";
|
21877 |
|
21878 | doubleTappable?: boolean;
|
21879 |
|
21880 | autoFocus?: boolean;
|
21881 |
|
21882 | emptyStateMessage?:
|
21883 | | string
|
21884 | | {
|
21885 | readonly message: string;
|
21886 | readonly markdown?: boolean;
|
21887 | readonly height?: number;
|
21888 | };
|
21889 | |
21890 |
|
21891 |
|
21892 |
|
21893 |
|
21894 |
|
21895 | decorator?: TDecorator<T>;
|
21896 | |
21897 |
|
21898 |
|
21899 |
|
21900 |
|
21901 |
|
21902 | onInit?: TListCallback<T> | undefined;
|
21903 | |
21904 |
|
21905 |
|
21906 |
|
21907 | onReady?: TListCallback<T> | undefined;
|
21908 | |
21909 |
|
21910 |
|
21911 |
|
21912 | onAdd?: TRowCallback<T> | undefined;
|
21913 | |
21914 |
|
21915 |
|
21916 |
|
21917 | onChange?: ((pRow: T, sProperty: string, pData: TData) => void) | undefined;
|
21918 | /**
|
21919 | * Specifies the `OnIndex` callback which is invoked when the index of a row changes.
|
21920 | * @event
|
21921 | */
|
21922 | onIndex?: TRowCallback<T> | undefined;
|
21923 | /**
|
21924 | * Specifies the `OnDelete` callback which is invoked when a row is deleted.
|
21925 | * @event
|
21926 | */
|
21927 | onDelete?: TRowCallback<T> | undefined;
|
21928 | /**
|
21929 | * Specifies the `OnRefresh` callback which is invoked when a row is refreshed.
|
21930 | * @event
|
21931 | */
|
21932 | onRefresh?: TListCallback<T> | undefined;
|
21933 | /**
|
21934 | * Specifies the `OnExpand` callback which is invoked when a row is expanded.
|
21935 | * @event
|
21936 | */
|
21937 | onExpand?: TRowCallback<T> | undefined;
|
21938 | /**
|
21939 | * Specifies the `OnCollapse` callback which is invoked when a row is collapsed.
|
21940 | * @event
|
21941 | */
|
21942 | onCollapse?: TRowCallback<T> | undefined;
|
21943 | /**
|
21944 | * Specifies the `OnTap` callback which is invoked when a single tap occurs
|
21945 | * on a row.
|
21946 | * @event
|
21947 | */
|
21948 | onTap?: TTapCallback<T> | undefined;
|
21949 | /**
|
21950 | * Specifies the `OnDoubleTap` callback which is invoked when a double tap
|
21951 | * occurs on a row.
|
21952 | * @event
|
21953 | */
|
21954 | onDoubleTap?: TTapCallback<T> | undefined;
|
21955 | /**
|
21956 | * Specifies the `OnEnter` callback which is invoked when the enter key is
|
21957 | * pressed on a row.
|
21958 | * @event
|
21959 | */
|
21960 | onEnter?: TRowCallback<T> | undefined;
|
21961 | /**
|
21962 | * Specifies the `OnSelect` callback which is invoked when a row is selected.
|
21963 | * @event
|
21964 | */
|
21965 | onSelect?: TRowCallback<T> | undefined;
|
21966 | /**
|
21967 | * Specifies the `OnDeselect` callback which is invoked when a row is
|
21968 | * deselected.
|
21969 | * @event
|
21970 | */
|
21971 | onDeselect?: TRowCallback<T> | undefined;
|
21972 | /**
|
21973 | * Specifies the `OnSelectionChange` callback which is invoked when the
|
21974 | * selected state of a row or rows changes.
|
21975 | * @event
|
21976 | */
|
21977 | onSelectionChange?: TListCallback<T> | undefined;
|
21978 | /**
|
21979 | * Specifies the `OnSelectionMode` callback which is invoked when the list
|
21980 | * control selection mode is changed from single to multiple or vice versa.
|
21981 | * @event
|
21982 | */
|
21983 | onSelectionMode?: TListCallback<T> | undefined;
|
21984 | /**
|
21985 | * Specifies the `OnMoveStart` callback which is invoked when a row in the
|
21986 | * list is moved. Should return nothing or `true` if the move is allowed.
|
21987 | * @event
|
21988 | */
|
21989 | onMoveStart?: ((pRow: T) => void | boolean) | undefined;
|
21990 | /**
|
21991 | * Specifies the `OnMove` callback which is invoked when a row in the
|
21992 | * list is moving. This event is invoked for each move. If you only need
|
21993 | * the final position, use the `OnMoved` event. Should return nothing or
|
21994 | * `true` if the move is allowed.
|
21995 | * @event
|
21996 | */
|
21997 | onMove?: ((pRow: T, pTo: T) => void | boolean) | undefined;
|
21998 | /**
|
21999 | * Specifies the `OnMoveEnd` callback which is invoked when a row in the
|
22000 | * list is done moving.
|
22001 | * @event
|
22002 | */
|
22003 | onMoveEnd?: TRowCallback<T> | undefined;
|
22004 | /**
|
22005 | * Specifies the `OnMoved` callback which is invoked when a row in the
|
22006 | * list is moved.
|
22007 | * @event
|
22008 | */
|
22009 | onMoved?: ((pRow: T, nOldIndex: number, nNewIndex: number) => void) | undefined;
|
22010 | /**
|
22011 | * Specifies the `OnSort` callback which is invoked when a list is sorted.
|
22012 | * This event is also invoked when the sorting is canceled. In that case
|
22013 | * the parameter `pColumn` will be undefined.
|
22014 | * @event
|
22015 | */
|
22016 | onSort?: ((pColumn: Column<T> | undefined) => void) | undefined;
|
22017 | /**
|
22018 | * Specifies the `OnResize` callback which is invoked when the list
|
22019 | * is resized.
|
22020 | * @event
|
22021 | */
|
22022 | onResize?: TListCallback<T> | undefined;
|
22023 | /**
|
22024 | * Specifies the `OnFocus` callback which is invoked when the list gains focus.
|
22025 | * @event
|
22026 | */
|
22027 | onFocus?: TListCallback<T> | undefined;
|
22028 | /**
|
22029 | * Specifies the `OnBlur` callback which is invoked when the list loses focus.
|
22030 | * @event
|
22031 | */
|
22032 | onBlur?: TListCallback<T> | undefined;
|
22033 | /**
|
22034 | * Specifies the `OnColumnsChange` callback which is invoked when there is a
|
22035 | * change in the width or ordering of the columns.
|
22036 | * @event
|
22037 | */
|
22038 | onColumnsChange?: TListCallback<T> | undefined;
|
22039 | /**
|
22040 | * Specifies the `OnLazyLoad` callback which is invoked when the list
|
22041 | * is scrolled to the end.
|
22042 | * @event
|
22043 | */
|
22044 | onLazyLoad?: TListCallback<T> | undefined;
|
22045 | /**
|
22046 | * Specifies the `OnEditStart` callback which is invoked when the inline
|
22047 | * editing starts.
|
22048 | * @event
|
22049 | */
|
22050 | onEditStart?: ((pRow: T, pColumn: Column<T>, pData: TData) => void) | undefined;
|
22051 | /**
|
22052 | * Specifies the `OnEditEnd` callback which is invoked when the inline
|
22053 | * editing ends.
|
22054 | * @event
|
22055 | */
|
22056 | onEditEnd?: ((pRow: T, pColumn: Column<T>, pData: TData) => void) | undefined;
|
22057 | }
|
22058 | export interface IListState {
|
22059 | /** Contains the columns state. */
|
22060 | columns: IColumnState[];
|
22061 | /** Contains the identifiers of the selected rows. */
|
22062 | selected: TIdentifier[];
|
22063 | /** Contains the rows which are collapsed. */
|
22064 | collapsed: TIdentifier[];
|
22065 | /** Contains the rows which are expanded. */
|
22066 | expanded: TIdentifier[];
|
22067 | /** Contains the scroll position. */
|
22068 | scroll: IPoint;
|
22069 | }
|
22070 | /** Type definition for row identifiers. */
|
22071 | export type TIdentifier = number | string;
|
22072 | type TData = string | number | boolean | undefined;
|
22073 | /** Type definition for the decorator function. */
|
22074 | export type TDecorator<T extends Row> = (
|
22075 | pData: TData,
|
22076 | pCell: Element,
|
22077 | pRow: T,
|
22078 | pColumn: Column<T> | undefined,
|
22079 | bIsGlyph: boolean
|
22080 | ) => void | boolean;
|
22081 |
|
22082 | export type TModifier<T extends Row> = (pData: TData, pRow: T, pColumn: Column<T>) => TData;
|
22083 |
|
22084 | export type TColorize<T extends Row> = (sURI: string, pRow: T, pColumn: Column<T>) => string | undefined;
|
22085 |
|
22086 | export type TMarkdown<T extends Row, Type = {}> = (
|
22087 | sMarkdown: string,
|
22088 | pRow: T,
|
22089 | pColumn: Column<T>
|
22090 | ) => {
|
22091 |
|
22092 | readonly parser: MarkdownParser<Type>;
|
22093 |
|
22094 | features?: MarkdownFeatures;
|
22095 |
|
22096 | readonly mentions?: (pParent: Element, pMention: Type | undefined, sContent: string) => Element | undefined;
|
22097 |
|
22098 | readonly references?: (pParent: Element, pReference: Type | undefined, sContent: string) => Element | undefined;
|
22099 |
|
22100 | readonly target?: "self" | "blank";
|
22101 | };
|
22102 |
|
22103 | export type TListCallback<T extends Row> = (pList: List<T>) => void;
|
22104 |
|
22105 | export type TRowCallback<T extends Row> = (pRow: T) => void;
|
22106 |
|
22107 | export type TTapCallback<T extends Row> = (pRow: T, pColumn: Column<T>) => void;
|
22108 | export class List<T extends Row = Row> extends Hooks<TListEvents> {
|
22109 |
|
22110 | static stylesheet: Stylesheet;
|
22111 |
|
22112 | static style: IListStyle | undefined;
|
22113 |
|
22114 | |
22115 |
|
22116 |
|
22117 |
|
22118 |
|
22119 |
|
22120 | onInit: TListCallback<T> | undefined;
|
22121 | |
22122 |
|
22123 |
|
22124 |
|
22125 | onReady: TListCallback<T> | undefined;
|
22126 | |
22127 |
|
22128 |
|
22129 |
|
22130 | onAdd: TRowCallback<T> | undefined;
|
22131 | |
22132 |
|
22133 |
|
22134 |
|
22135 | onChange: ((pRow: T, sProperty: string, pData: TData) => void) | undefined;
|
22136 | /**
|
22137 | * Contains the function which is invoked when the index of a row changes.
|
22138 | * @event
|
22139 | */
|
22140 | onIndex: TRowCallback<T> | undefined;
|
22141 | /**
|
22142 | * Contains the function which is invoked when a row is deleted.
|
22143 | * @event
|
22144 | */
|
22145 | onDelete: TRowCallback<T> | undefined;
|
22146 | /**
|
22147 | * Contains the function which is invoked when a row is refreshed.
|
22148 | * @event
|
22149 | */
|
22150 | onRefresh: TListCallback<T> | undefined;
|
22151 | /**
|
22152 | * Contains the function which is invoked when a row is expanded.
|
22153 | * @event
|
22154 | */
|
22155 | onExpand: TRowCallback<T> | undefined;
|
22156 | /**
|
22157 | * Contains the function which is invoked when a row is collapsed.
|
22158 | * @event
|
22159 | */
|
22160 | onCollapse: TRowCallback<T> | undefined;
|
22161 | /**
|
22162 | * Contains the function which is invoked when a single tap occurs
|
22163 | * on a row.
|
22164 | * @event
|
22165 | */
|
22166 | onTap: TTapCallback<T> | undefined;
|
22167 | /**
|
22168 | * Contains the function which is invoked when a double tap
|
22169 | * occurs on a row.
|
22170 | * @event
|
22171 | */
|
22172 | onDoubleTap: TTapCallback<T> | undefined;
|
22173 | /**
|
22174 | * Contains the function which is invoked when the enter key is pressed on a row.
|
22175 | * @event
|
22176 | */
|
22177 | onEnter: TRowCallback<T> | undefined;
|
22178 | /**
|
22179 | * Contains the function which is invoked when a row is selected.
|
22180 | * @event
|
22181 | */
|
22182 | onSelect: TRowCallback<T> | undefined;
|
22183 | /**
|
22184 | * Contains the function which is invoked when a row is
|
22185 | * deselected.
|
22186 | * @event
|
22187 | */
|
22188 | onDeselect: TRowCallback<T> | undefined;
|
22189 | /**
|
22190 | * Contains the function which is invoked when the
|
22191 | * selected state of a row or rows changes.
|
22192 | * @event
|
22193 | */
|
22194 | onSelectionChange: TListCallback<T> | undefined;
|
22195 | /**
|
22196 | * Contains the function which is invoked when the list
|
22197 | * control selection mode is changed from single to multiple or vice versa.
|
22198 | * @event
|
22199 | */
|
22200 | onSelectionMode: TListCallback<T> | undefined;
|
22201 | /**
|
22202 | * Contains the function which is invoked when a row in the
|
22203 | * list is moved. Should return nothing or `true` if the move is allowed.
|
22204 | * @event
|
22205 | */
|
22206 | onMoveStart: ((pRow: T) => void | boolean) | undefined;
|
22207 | /**
|
22208 | * Contains the function which is invoked when a row in the
|
22209 | * list is moving. This event is invoked for each move. If you only need
|
22210 | * the final position, use the `OnMoved` event. Should return nothing or
|
22211 | * `true` if the move is allowed.
|
22212 | * @event
|
22213 | */
|
22214 | onMove: ((pRow: T, pTo: T) => void | boolean) | undefined;
|
22215 | /**
|
22216 | * Contains the function which is invoked when a row in the
|
22217 | * list is done moving.
|
22218 | * @event
|
22219 | */
|
22220 | onMoveEnd: TRowCallback<T> | undefined;
|
22221 | /**
|
22222 | * Specifies the function which is invoked when a row in the
|
22223 | * list is moved.
|
22224 | * @event
|
22225 | */
|
22226 | onMoved: ((pRow: T, nOldIndex: number, nNewIndex: number) => void) | undefined;
|
22227 | /**
|
22228 | * Contains the function which is invoked when a list is sorted.
|
22229 | * This event is also invoked when the sorting is canceled. In that case
|
22230 | * the parameter `pColumn` will be undefined.
|
22231 | * @event
|
22232 | */
|
22233 | onSort: ((pColumn: Column<T> | undefined) => void) | undefined;
|
22234 | /**
|
22235 | * Contains the function which is invoked when the list
|
22236 | * is resized.
|
22237 | * @event
|
22238 | */
|
22239 | onResize: TListCallback<T> | undefined;
|
22240 | /**
|
22241 | * Contains the function which is invoked when the list
|
22242 | * gains focus.
|
22243 | * @event
|
22244 | */
|
22245 | onFocus: TListCallback<T> | undefined;
|
22246 | /**
|
22247 | * Contains the function which is invoked when the list
|
22248 | * loses focus.
|
22249 | * @event
|
22250 | */
|
22251 | onBlur: TListCallback<T> | undefined;
|
22252 | /**
|
22253 | * Contains the function which is invoked when there is a
|
22254 | * change in the width or ordering of the columns.
|
22255 | * @event
|
22256 | */
|
22257 | onColumnsChange: TListCallback<T> | undefined;
|
22258 | /**
|
22259 | * Contains the function which is invoked when the list is
|
22260 | * scrolled to the end.
|
22261 | * @event
|
22262 | */
|
22263 | onLazyLoad: TListCallback<T> | undefined;
|
22264 | /**
|
22265 | * Contains the function which is invoked when the inline
|
22266 | * editing starts.
|
22267 | * @event
|
22268 | */
|
22269 | onEditStart?: ((pRow: T, pColumn: Column<T>, pData: TData) => void) | undefined;
|
22270 | /**
|
22271 | * Contains the function which is invoked when the inline
|
22272 | * editing ends.
|
22273 | * @event
|
22274 | */
|
22275 | onEditEnd?: ((pRow: T, pColumn: Column<T>, pData: TData) => void) | undefined;
|
22276 | /**
|
22277 | * Constructs a new list.
|
22278 | * @param pPropertiesList Specifies the list properties. Multiple
|
22279 | * properties objects can be supplied. They will be combined to a single
|
22280 | * immutable properties object.
|
22281 | */
|
22282 | constructor(...pPropertiesList: IListProperties<T>[]);
|
22283 | /** Retrieves a reference to the stylesheet. */
|
22284 | get stylesheet(): Stylesheet;
|
22285 | /** Retrieves the list style. */
|
22286 | get style(): IListStyle;
|
22287 |
|
22288 | /** Retrieves a reference to the layer. */
|
22289 | get layer(): Layer | undefined;
|
22290 | /** Retrieves the scroll controller. */
|
22291 | get scroll(): Scrollbars | undefined;
|
22292 | /** Retrieves the list state. */
|
22293 | get state(): IListState;
|
22294 | /** Sets the list state. */
|
22295 | set state(pState: IListState);
|
22296 | /** Retrieves the dimensions of the list including the header. */
|
22297 | get dimensions(): Dimensions;
|
22298 | /** Retrieves a reference to the list element. */
|
22299 | get element(): Element | undefined;
|
22300 | /** Retrieves a reference to the rows. */
|
22301 | get rows(): Rows<T>;
|
22302 | /** Retrieves the rows element. */
|
22303 | get rowsElement(): Fragment | Element | undefined;
|
22304 |
|
22305 | /** Retrieves the row height. */
|
22306 | get rowHeight(): number;
|
22307 | /** Retrieves the row spacing. */
|
22308 | get rowSpacing(): number;
|
22309 | /** Retrieves the current hovered row. */
|
22310 | get rowHovered(): T | undefined;
|
22311 | /** Sets the current hovered row. */
|
22312 | set rowHovered(pRow: T | undefined);
|
22313 | /** Retrieves the number of columns. */
|
22314 | get columnsCount(): number;
|
22315 | /** Retrieves the columns state. */
|
22316 | get columnsState(): IColumnState[];
|
22317 | /** Sets the columns settings. */
|
22318 | set columnsState(pState: IColumnState[]);
|
22319 | /** Retrieves the decorator function. */
|
22320 | get decorator(): TDecorator<T> | undefined;
|
22321 | /** Retrieves the total number of rows in the list. */
|
22322 | get count(): number;
|
22323 | /** Retrieves all rows in an array (including child rows). */
|
22324 | get all(): T[];
|
22325 | /** Retrieves the rows as an array. */
|
22326 | get children(): T[];
|
22327 | /** Retrieves all selected rows. */
|
22328 | get selection(): T[];
|
22329 | /** Retrieves the number of selected rows. */
|
22330 | get selectionCount(): number;
|
22331 | /**
|
22332 | * Retrieves the selected row in case of a single selection. This property
|
22333 | * is `undefined` when multiple items are selected.
|
22334 | */
|
22335 | get selectedRow(): T | undefined;
|
22336 | /** Retrieves an array with the identifiers of all selected rows. */
|
22337 | get selectionOfIdentifiers(): TIdentifier[];
|
22338 | /** Sets the rows with the supplied identifiers. */
|
22339 | set selectionOfIdentifiers(pIdentifiers: TIdentifier[]);
|
22340 | /** Retrieves if multiple selections are allowed. */
|
22341 | get isMultipleSelect(): boolean;
|
22342 | /** Enables or disables multiple selection. */
|
22343 | set isMultipleSelect(bMultipleSelect: boolean);
|
22344 | /** Retrieves if all rows are selected. */
|
22345 | get isAllSelected(): boolean;
|
22346 | /** Retrieves the maximum numbe of indention levels. */
|
22347 | get maxIndentionDepth(): number;
|
22348 | /** Retrieves if the list is constructing. */
|
22349 | get isConstructing(): boolean;
|
22350 | /** Retrieves if the list is calculated. */
|
22351 | get isCalculated(): boolean;
|
22352 | /** Retrieves if the list is ready. */
|
22353 | get isReady(): boolean;
|
22354 | /** Retrieves if new rows are collapsed by default. */
|
22355 | get isCollapsed(): boolean;
|
22356 | /** Retrieves if the list has focus. */
|
22357 | get hasFocus(): boolean;
|
22358 | /** Retrieves if the list is scrolling. */
|
22359 | get isScrolling(): boolean;
|
22360 | /** Retrieves if a column is moving or resizing. */
|
22361 | get isColumnMovingOrResizing(): boolean;
|
22362 | /** Retrieves if a sorting is active. */
|
22363 | get isSorting(): boolean;
|
22364 | /** Retrieves if a row is moving. */
|
22365 | get isMoving(): boolean;
|
22366 | /** Retrieves if a filter is active. */
|
22367 | get isFiltered(): boolean;
|
22368 | /** Retrieves if the list is destroyed. */
|
22369 | get isDestroyed(): boolean;
|
22370 | /** Retrieves if hooks are allowed. */
|
22371 | get isHookAllowed(): boolean;
|
22372 |
|
22373 | /**
|
22374 | * Invalidates a row.
|
22375 | * @param pRow Reference to the row.
|
22376 | */
|
22377 | invalidateRow(pRow: T): void;
|
22378 | /** Invalidates the list control and draws the rows. */
|
22379 | invalidate(): void;
|
22380 | /**
|
22381 | * Fired when the list dimensions are changed.
|
22382 | * @event
|
22383 | */
|
22384 | dimensionsChanged(): void;
|
22385 | /**
|
22386 | * Notifies the list of a selection change.
|
22387 | * @param pChanged Reference to the row.
|
22388 | * @param bSelected State of the selection.
|
22389 | */
|
22390 | selectionChanged(pChanged: T, bSelected: boolean): void;
|
22391 | /**
|
22392 | * Initializes the list.
|
22393 | * @param nWidth Optional width. If supplied the parent width is not calculated.
|
22394 | * @param nHeight Optional height. If supplied the parent height is not calculated.
|
22395 | */
|
22396 | init(nWidth?: number, nHeight?: number): void;
|
22397 | /**
|
22398 | * Resize the list. Invoke this function when the parent element is resized.
|
22399 | * @param nWidth Optional width. If supplied the width is not calculated.
|
22400 | * @param nHeight Optional height. If supplied the parent height is not calculated.
|
22401 | */
|
22402 | resize(nWidth?: number, nHeight?: number): void;
|
22403 | /**
|
22404 | * Retrieves the column for the specified property.
|
22405 | * @param sProperty Specifies the property.
|
22406 | * @return Returns a reference to the column or `undefined` if the column is
|
22407 | * not found.
|
22408 | */
|
22409 | column(sProperty: string): Column<T> | undefined;
|
22410 | /**
|
22411 | * Iterates through each column.
|
22412 | * @param fnColumn Specifies a function which is invoked for each column.
|
22413 | * @param fnColumn.pColumn Contains a reference to the column.
|
22414 | */
|
22415 | eachColumn(fnColumn: (pColumn: Column<T>) => void): void;
|
22416 | /**
|
22417 | * Retrieves the row at the specified index. This function treats the list
|
22418 | * as a flat list.
|
22419 | * @param nIndex Specifies the zero-based index number.
|
22420 | * @return Returns a reference to the row or `undefined` if the row is
|
22421 | * not found.
|
22422 | */
|
22423 | rowAtIndex(nIndex: number): T | undefined;
|
22424 | /**
|
22425 | * Retrieves the row with the specified identifier.
|
22426 | * @param pIdentifier Specifies the row identifier.
|
22427 | * @return Returns a reference to the row or `undefined` if the row is
|
22428 | * not found.
|
22429 | */
|
22430 | rowWithIdentifier(pIdentifier: TIdentifier): T | undefined;
|
22431 | /**
|
22432 | * Adds a row to the end of the list.
|
22433 | * @param pRow Specifies the row.
|
22434 | * @return Returns a reference to the row.
|
22435 | */
|
22436 | add<R extends T>(pRow: R): R;
|
22437 | /**
|
22438 | * Adds an array of rows.
|
22439 | * @param pRows Array with rows.
|
22440 | * @return Returns the number of rows added to the list.
|
22441 | */
|
22442 | addN(...pRows: T[]): number;
|
22443 | /**
|
22444 | * Inserts a row at the begin of the list.
|
22445 | * @param pRow Specifies the row.
|
22446 | * @return Returns a reference to the row.
|
22447 | */
|
22448 | insert<R extends T>(pRow: R): R;
|
22449 | /**
|
22450 | * Inserts an array of rows.
|
22451 | * @param pRows Array with rows.
|
22452 | * @return Returns the number of rows added to the list.
|
22453 | */
|
22454 | insertN(...pRows: T[]): number;
|
22455 | /**
|
22456 | * Iterates recursively through all items in the list.
|
22457 | * @param fnRow Specifies a function which is invoked for each row.
|
22458 | * @param fnRow.pRow Reference to the row.
|
22459 | * @return Returns `true` if the iteration was stopped.
|
22460 | */
|
22461 | each(fnRow: (pRow: T) => boolean | void): boolean;
|
22462 | /**
|
22463 | * Iterates recursively through all items in the list beginning at the end.
|
22464 | * @param fnRow Specifies a function which is invoked for each row.
|
22465 | * @param fnRow.pRow Reference to the row.
|
22466 | * @return Returns `true` if the iteration was stopped.
|
22467 | */
|
22468 | eachReverse(fnRow: (pRow: T) => boolean | void): boolean;
|
22469 | /**
|
22470 | * Enables the list buffer. Use the buffer when a large number of rows is
|
22471 | * supplied at once. Invoke `Flush` when ready.
|
22472 | */
|
22473 | buffer(): void;
|
22474 | /** Flushes the list buffer. */
|
22475 | flush(): void;
|
22476 | /** Clears all items in the list. */
|
22477 | clear(): void;
|
22478 | /**
|
22479 | * Sorts on the column at the specified data-index.
|
22480 | * @param sProperty Specifies the property to sort on.
|
22481 | * @param sDirection Specifies the order direction.
|
22482 | */
|
22483 | sort(sProperty: string, sDirection?: "ascending" | "descending"): void;
|
22484 | /** Disables list sorting. */
|
22485 | nosort(): void;
|
22486 | /** Resorts the list. */
|
22487 | resort(): void;
|
22488 | /** Marks the list as unsorted. */
|
22489 | unsorted(): void;
|
22490 | /** Selects all rows. */
|
22491 | selectAll(): void;
|
22492 | /** Deselects all selected rows. */
|
22493 | deselectAll(): void;
|
22494 | /**
|
22495 | * Select matching rows.
|
22496 | * @param fnMatch Specifies a match function which is invoked for each row.
|
22497 | * This function should return `true` for each row which should be selected.
|
22498 | * @param fnMatch.pRow Reference to the row.
|
22499 | * @param bMultipleSelect Specifies if multiple selections can be made. If
|
22500 | * `false` the first match is selected.
|
22501 | * @return Returns the number of rows selected.
|
22502 | */
|
22503 | selectMatching(fnMatch: (pRow?: T) => boolean, bMultipleSelect?: boolean): number;
|
22504 | /** Expands all rows. */
|
22505 | expandAll(): void;
|
22506 | /** Collapses all rows. */
|
22507 | collapseAll(): void;
|
22508 | /**
|
22509 | * Applies a filter and show only the rows which match the supplied match function.
|
22510 | * @param fnMatch Specifies a match function which is invoked for each row.
|
22511 | * This function should return `true` for each row which should be included.
|
22512 | * @param fnMatch.pRow Reference to the row.
|
22513 | * @return Returns the number of rows which match the filter.
|
22514 | */
|
22515 | filter(fnMatch: (pRow: T) => boolean): number;
|
22516 | /** Removes an active filter. */
|
22517 | unfilter(): void;
|
22518 | /** Sets the focus to the list. */
|
22519 | focus(): void;
|
22520 | /** Blurs the list focus. */
|
22521 | blur(): void;
|
22522 | /** Scrolls to the top of the list. */
|
22523 | scrollToTop(): void;
|
22524 | /** Scrolls to the bottom of the list. */
|
22525 | scrollToBottom(): void;
|
22526 | /**
|
22527 | * Scrolls to the top if the list is scrolled or scrolls to the bottom if
|
22528 | * the list is at the top.
|
22529 | */
|
22530 | scrollToTopOrBottom(): void;
|
22531 | /**
|
22532 | * Scrolls a row into view.
|
22533 | * @param pRow Reference to the row.
|
22534 | */
|
22535 | scrollIntoView(pRow: T): void;
|
22536 | /** Refreshes all data in the list. */
|
22537 | refresh(): void;
|
22538 | /** Specifies the list is refreshed. */
|
22539 | refreshed(): void;
|
22540 | /** Destroys the list. */
|
22541 | destroy(): void;
|
22542 | }
|
22543 | export class ListComponent<T extends Row = Row> extends LayerComponent {
|
22544 | /**
|
22545 | * Constructs a new list component.
|
22546 | * @param pProperties Specifies the list properties.
|
22547 | * @param pConfiguration Specifies the layer configuration.
|
22548 | */
|
22549 | constructor(pProperties: IListProperties<T>, pConfiguration?: LayerConfiguration);
|
22550 | /** Retrieves a reference to the list. */
|
22551 | get list(): List<T>;
|
22552 | /** Renders the component. */
|
22553 | protected onRender(): void;
|
22554 | }
|
22555 | class RowTyped<T extends {}> extends Row {
|
22556 | /**
|
22557 | * Creates a new typed row instance.
|
22558 | * @param pData Contains the data.
|
22559 | * @param pIdentifier Contains the optional data identifier.
|
22560 | */
|
22561 | constructor(pData: T, pIdentifier?: TIdentifier);
|
22562 | /** Retrieves the data. */
|
22563 | get data(): T;
|
22564 | /** Sets the data. */
|
22565 | set data(pData: T);
|
22566 | /**
|
22567 | * Retrieves or writes the cell data for the supplied column.
|
22568 | * @param pColumn Reference to the column.
|
22569 | * @param pData Optional new data value.
|
22570 | * @return Returns the data.
|
22571 | */
|
22572 | cell(pColumn: Column, pData?: TData): TData;
|
22573 | /** Updates the row. */
|
22574 | update(): void;
|
22575 | }
|
22576 | class RowArray extends Row {
|
22577 | /**
|
22578 | * Creates a new data row instance.
|
22579 | * @param pIdentifier Contains the optional data identifier.
|
22580 | * @param pData Contains the data.
|
22581 | */
|
22582 | constructor(pIdentifier?: TIdentifier, ...pData: TData[]);
|
22583 | /** Retrieves the data. */
|
22584 | get data(): TData[];
|
22585 | /** Sets the data. */
|
22586 | set data(pData: TData[]);
|
22587 | /**
|
22588 | * Retrieves or writes the cell data for the supplied column.
|
22589 | * @param pColumn Reference to the column.
|
22590 | * @param pData Optional new data value.
|
22591 | * @return Returns the data.
|
22592 | */
|
22593 | cell(pColumn: Column, pData?: TData): TData;
|
22594 | /** Updates the row. */
|
22595 | update(): void;
|
22596 | }
|
22597 | class RowStatic extends Row {
|
22598 | /**
|
22599 | * Constructs a new static row.
|
22600 | * @param sLabel Specifies the static label.
|
22601 | * @param pIdentifier Optional identifier for the static row.
|
22602 | * @param pSortColumns Specifies the columns on which the static row should
|
22603 | * be included in a sort.
|
22604 | */
|
22605 | constructor(sLabel: string, pIdentifier?: TIdentifier, ...pSortColumns: string[]);
|
22606 | /**
|
22607 | * Retrieves the static label for the supplied column.
|
22608 | * @param pColumn Reference to the column.
|
22609 | * @return Returns the label.
|
22610 | */
|
22611 | cell(pColumn: Column): TData;
|
22612 | }
|
22613 | /**
|
22614 | * Implements the column decorator. Use this decorator to specify column properties in a row class.
|
22615 | * @param pTarget Reference to the row target.
|
22616 | * @param sProperty Specifies the column property.
|
22617 | * @param pDescriptor Reference to the property descriptor.
|
22618 | */
|
22619 | export function column<T extends Row>(pTarget: T, sProperty: string, pDescriptor?: PropertyDescriptor): void;
|
22620 | /**
|
22621 | * Implements the identifier decorator which is used to define the identifier field.
|
22622 | * @param pTarget Reference to the row target.
|
22623 | * @param sProperty Specifies the column property.
|
22624 | * @param pDescriptor Reference to the property descriptor.
|
22625 | */
|
22626 | export function identifier<T extends Row>(pTarget: T, sProperty: string, pDescriptor?: PropertyDescriptor): void;
|
22627 | /**
|
22628 | * Pass updates to the decorated property to one or more other properties.
|
22629 | * @param pColumns Specifies the column properties to update.
|
22630 | */
|
22631 | export function update<T extends Row>(...pColumns: string[]): (pTarget: T, sProperty: string, pDescriptor?: PropertyDescriptor) => void;
|
22632 | |
22633 |
|
22634 |
|
22635 |
|
22636 |
|
22637 |
|
22638 | export function refresh<T extends Row>(pTarget: T, sProperty: string, pDescriptor?: PropertyDescriptor): void;
|
22639 |
|
22640 | export {
|
22641 | Column as ListColumn,
|
22642 | IColumnHeaderStyle as IListColumnHeaderStyle,
|
22643 | IColumnProperties as IListColumnProperties,
|
22644 | IColumnSelector as IListColumnSelector,
|
22645 | IColumnState as IListColumnState,
|
22646 | IColumnTreeImage as IListColumnTreeImage,
|
22647 | IColumnTreeImages as IListColumnTreeImages,
|
22648 | IColumnsHeaderStyle as IListColumnsHeaderStyle,
|
22649 | Row as ListRow,
|
22650 | RowArray as ListRowArray,
|
22651 | RowStatic as ListRowStatic,
|
22652 | RowTyped as ListRowTyped,
|
22653 | TData as TListData,
|
22654 | };
|
22655 | }
|
22656 |
|
22657 | declare module "tripetto/module/ui-menu" {
|
22658 | import { Asset, Element, IStyles, Stylesheet } from "tripetto/module/dom";
|
22659 | import { Rectangle, Spacing } from "tripetto/module/metrics";
|
22660 | import { IScrollbarsStyle } from "tripetto/module/ui-scrollbars";
|
22661 |
|
22662 | export interface ILabelStyle {
|
22663 |
|
22664 | appearance: IStyles;
|
22665 |
|
22666 | disabled?: IStyles;
|
22667 |
|
22668 | hover?: IStyles;
|
22669 | }
|
22670 | export interface ISeparatorStyle {
|
22671 |
|
22672 | appearance: IStyles;
|
22673 |
|
22674 | separator: IStyles;
|
22675 |
|
22676 | disabled?: IStyles;
|
22677 |
|
22678 | hover?: IStyles;
|
22679 | }
|
22680 | export interface IItemStyle extends ILabelStyle {
|
22681 |
|
22682 | selected?: IStyles;
|
22683 |
|
22684 | tapped?: IStyles;
|
22685 |
|
22686 | badge?: IStyles;
|
22687 | }
|
22688 | export interface IImageStyle extends IItemStyle {
|
22689 |
|
22690 | image: IStyles;
|
22691 |
|
22692 | paths?: {
|
22693 |
|
22694 | class: string;
|
22695 |
|
22696 | normal: string;
|
22697 |
|
22698 | hover?: string;
|
22699 |
|
22700 | selected?: string;
|
22701 |
|
22702 | disabled?: string;
|
22703 | };
|
22704 | }
|
22705 | export interface ISubmenuStyle extends ILabelStyle {
|
22706 |
|
22707 | selected?: IStyles;
|
22708 |
|
22709 | margin?: Spacing;
|
22710 | }
|
22711 |
|
22712 | export interface IMenuStyle {
|
22713 |
|
22714 | menu?: {
|
22715 |
|
22716 | outer?: IStyles;
|
22717 |
|
22718 | inner?: IStyles;
|
22719 |
|
22720 | open?: IStyles;
|
22721 |
|
22722 | close?: IStyles;
|
22723 |
|
22724 | submenu?: IStyles;
|
22725 |
|
22726 | hover?: IStyles;
|
22727 |
|
22728 | center?: IStyles;
|
22729 |
|
22730 | context?: IStyles;
|
22731 |
|
22732 | left?: IStyles;
|
22733 |
|
22734 | top?: IStyles;
|
22735 |
|
22736 | right?: IStyles;
|
22737 |
|
22738 | bottom?: IStyles;
|
22739 | };
|
22740 |
|
22741 | options?: {
|
22742 | label?: ILabelStyle;
|
22743 | separator?: ISeparatorStyle;
|
22744 | item?: IItemStyle;
|
22745 | submenu?: ISubmenuStyle;
|
22746 | image?: IImageStyle;
|
22747 | };
|
22748 |
|
22749 | indicators?: {
|
22750 |
|
22751 | up: {
|
22752 |
|
22753 | appearance: IStyles;
|
22754 |
|
22755 | hover?: IStyles;
|
22756 |
|
22757 | crawl?: IStyles;
|
22758 | };
|
22759 |
|
22760 | down: {
|
22761 |
|
22762 | appearance: IStyles;
|
22763 |
|
22764 | hover?: IStyles;
|
22765 |
|
22766 | crawl?: IStyles;
|
22767 | };
|
22768 | };
|
22769 |
|
22770 | overlay?: {
|
22771 |
|
22772 | appearance?: IStyles;
|
22773 |
|
22774 | open?: IStyles;
|
22775 |
|
22776 | close?: IStyles;
|
22777 | };
|
22778 | |
22779 |
|
22780 |
|
22781 |
|
22782 |
|
22783 | origin?: boolean;
|
22784 |
|
22785 | scrollbars?: IScrollbarsStyle;
|
22786 |
|
22787 | scrollbarsInteractable?: boolean;
|
22788 |
|
22789 | minWidth?: number;
|
22790 |
|
22791 | maxWidth?: number;
|
22792 |
|
22793 | delegateWidths?: boolean;
|
22794 | }
|
22795 | type TPosition =
|
22796 | | "left"
|
22797 | | "left-from-center"
|
22798 | | "right"
|
22799 | | "right-from-center"
|
22800 | | "top"
|
22801 | | "top-from-center"
|
22802 | | "bottom"
|
22803 | | "bottom-from-center"
|
22804 | | "center"
|
22805 | | "context";
|
22806 |
|
22807 | export interface IMenuProperties {
|
22808 | |
22809 |
|
22810 |
|
22811 |
|
22812 | stylesheet?: Stylesheet;
|
22813 |
|
22814 | style?: IMenuStyle;
|
22815 |
|
22816 | parent?: Asset;
|
22817 |
|
22818 | overlay?: boolean;
|
22819 |
|
22820 | capture?: boolean;
|
22821 |
|
22822 | modal?: boolean;
|
22823 |
|
22824 | minWidth?: number;
|
22825 |
|
22826 | maxWidth?: number;
|
22827 |
|
22828 | delegateWidths?: boolean;
|
22829 |
|
22830 | destroyOnClose?: boolean;
|
22831 |
|
22832 | position?: TPosition;
|
22833 |
|
22834 | margin?: Spacing;
|
22835 |
|
22836 | autoFocus?: boolean;
|
22837 | |
22838 |
|
22839 |
|
22840 |
|
22841 | onOpen?: TMenu;
|
22842 | |
22843 |
|
22844 |
|
22845 |
|
22846 | onClosing?: TMenu;
|
22847 | |
22848 |
|
22849 |
|
22850 |
|
22851 | onClose?: TMenu;
|
22852 | |
22853 |
|
22854 |
|
22855 |
|
22856 | onClosed?: TMenu;
|
22857 | |
22858 |
|
22859 |
|
22860 |
|
22861 | onDestroy?: TMenu;
|
22862 | }
|
22863 |
|
22864 | export type TMenu = (pMenu: MenuFactory) => void;
|
22865 | class MenuFactory {
|
22866 | |
22867 |
|
22868 |
|
22869 |
|
22870 | onOpen: TMenu | undefined;
|
22871 | |
22872 |
|
22873 |
|
22874 |
|
22875 | onClosing: TMenu | undefined;
|
22876 | |
22877 |
|
22878 |
|
22879 |
|
22880 | onClose: TMenu | undefined;
|
22881 | |
22882 |
|
22883 |
|
22884 |
|
22885 | onClosed: TMenu | undefined;
|
22886 | |
22887 |
|
22888 |
|
22889 |
|
22890 | onDestroy: TMenu | undefined;
|
22891 |
|
22892 | protected static get root(): MenuFactory | undefined;
|
22893 |
|
22894 | protected static set root(pRoot: MenuFactory | undefined);
|
22895 |
|
22896 | |
22897 |
|
22898 |
|
22899 |
|
22900 |
|
22901 |
|
22902 | constructor(pOptions: Option[], pProperties?: IMenuProperties, pAncestor?: MenuFactory);
|
22903 |
|
22904 | /** Retrieves the menu options array. */
|
22905 | get options(): Option[];
|
22906 | /** Retrieves the stylesheet for the menu. */
|
22907 | get stylesheet(): Stylesheet;
|
22908 | /** Retrieves the menu style. */
|
22909 | get style(): IMenuStyle;
|
22910 | /** Retrieves the menu parent. */
|
22911 | get parent(): Asset | undefined;
|
22912 | /** Retrieves if the menu is drawn. */
|
22913 | get isDrawn(): boolean;
|
22914 | /** Retrieves if the menu is destroyed. */
|
22915 | get isDestroyed(): boolean;
|
22916 | /** Retrieves if the menu is opened. */
|
22917 | get isOpen(): boolean;
|
22918 | /** Retrieves if the menu is a submenu. */
|
22919 | get isSubmenu(): boolean;
|
22920 | /** Retrieves if the menu is hovered. */
|
22921 | get isHovered(): boolean;
|
22922 | /** Retrieves a reference to the opened option. */
|
22923 | get opened(): Option | undefined;
|
22924 | /** Retrieves the minimum width. */
|
22925 | get minWidth(): number;
|
22926 | /** Retrieves the maximum width. */
|
22927 | get maxWidth(): number;
|
22928 | /** Retrieves the minimum submenu width. */
|
22929 | get minSubmenuWidth(): number;
|
22930 | /** Retrieves the maximum submenu width. */
|
22931 | get maxSubmenuWidth(): number;
|
22932 | /** Retrieves the tapped option. */
|
22933 | get tappedOption(): Option | undefined;
|
22934 | /** Retrieves if an option was tapped. */
|
22935 | get isOptionTapped(): boolean;
|
22936 |
|
22937 | /**
|
22938 | * Opens the menu at the specified position in the rectangle.
|
22939 | * @param pRectangle Specifies the display rectangle.
|
22940 | * @param sPosition Specifies the preferred position relative to the display rectangle.
|
22941 | * @param pMargin Specifies an optional margin.
|
22942 | * @return Returns a reference to the menu.
|
22943 | */
|
22944 | open(pRectangle: Rectangle, sPosition?: TPosition, pMargin?: Spacing): this;
|
22945 | /**
|
22946 | * Opens a submenu.
|
22947 | * @param pParent Specifies the parent option,
|
22948 | */
|
22949 | openSubmenu(pParent: Option): void;
|
22950 | /**
|
22951 | * Opens the menu at the specified asset.
|
22952 | * @param pAsset Specifies the asset.
|
22953 | * @param sPosition Specifies the preferred menu position (default is `center`).
|
22954 | * @param pMargin Specifies an optional margin.
|
22955 | * @return Returns a reference to the menu.
|
22956 | */
|
22957 | openAtElement(pAsset: Asset, sPosition?: TPosition, pMargin?: Spacing): this;
|
22958 | /**
|
22959 | * Opens the menu at the specified position.
|
22960 | * @param nX Specifies the horizontal position.
|
22961 | * @param nY Specifies the vertical position.
|
22962 | * @param sPosition Specifies the preferred menu position (default is `context`).
|
22963 | * @return Returns a reference to the menu.
|
22964 | */
|
22965 | openAtPosition(nX: number, nY: number, sPosition?: TPosition): this;
|
22966 | /**
|
22967 | * Closes the menu.
|
22968 | * @param bAnimate Specifies if an animation should be used.
|
22969 | * @param fnCallback Optional callback function which is invoked when the
|
22970 | * menu is closed.
|
22971 | */
|
22972 | close(bAnimate?: boolean, fnCallback?: TMenu): void;
|
22973 | /**
|
22974 | * Sets the focus to the first option of the menu.
|
22975 | * @return Returns a reference to the menu instance.
|
22976 | */
|
22977 | focus(): this;
|
22978 | /** Destroys the menu. */
|
22979 | destroy(): void;
|
22980 | }
|
22981 | export type TOption = (pOption: Option) => void;
|
22982 | abstract class Option {
|
22983 | |
22984 |
|
22985 |
|
22986 |
|
22987 | onTap: TOption | undefined;
|
22988 | |
22989 |
|
22990 |
|
22991 |
|
22992 | onOpen: TOption | undefined;
|
22993 | |
22994 |
|
22995 |
|
22996 |
|
22997 | onClose: ((pOption: Option, bAnimate: boolean) => void) | undefined;
|
22998 | /**
|
22999 | * Fired when the option is removed.
|
23000 | * @event
|
23001 | */
|
23002 | onRemove: TOption | undefined;
|
23003 | /**
|
23004 | * Fired when the option is destroyed.
|
23005 | * @event
|
23006 | */
|
23007 | onDestroy: TOption | undefined;
|
23008 | /**
|
23009 | * Constructs a new option.
|
23010 | * @param bDisabled Specifies the disabled state.
|
23011 | * @param bInteractable Specifies if the option is interactable.
|
23012 | */
|
23013 | constructor(bDisabled: boolean, bInteractable: boolean);
|
23014 | /** Retrieves a reference to the menu. */
|
23015 | get menu(): MenuFactory | undefined;
|
23016 | /** Retrieves the option element. */
|
23017 | get element(): Element | undefined;
|
23018 | /** Returns the element type for the item. */
|
23019 | get elementType(): string;
|
23020 | /** Retrieves if the option is interactable. */
|
23021 | get isInteractable(): boolean;
|
23022 | /** Retrieves if the option is disabled. */
|
23023 | get isDisabled(): boolean;
|
23024 | /** Sets the state of the option. */
|
23025 | set isDisabled(bDisabled: boolean);
|
23026 | /** Retrieves if the option is hovered. */
|
23027 | get isHovered(): boolean;
|
23028 | /** Sets the hover state of the option. */
|
23029 | set isHovered(bHover: boolean);
|
23030 | /** Retrieves if the option is in the selected state. */
|
23031 | get isSelected(): boolean;
|
23032 | /** Sets the selected state of the option. */
|
23033 | set isSelected(bSelected: boolean);
|
23034 | /** Retrieves if an option is opened. */
|
23035 | get isOpen(): boolean;
|
23036 | /** Retrieves if the option can be opened. */
|
23037 | get canOpen(): boolean;
|
23038 | /** Retrieves if the menu should be closed when the option is tapped. */
|
23039 | get closeOnTap(): boolean;
|
23040 | /**
|
23041 | * Updates the option.
|
23042 | * @param bInstantly Applies the updates immediately.
|
23043 | */
|
23044 | protected update(bInstantly?: boolean): void;
|
23045 | /**
|
23046 | * Draws the option.
|
23047 | * @param pMenu Reference to the parent menu.
|
23048 | * @param pOption Reference to the option element.
|
23049 | */
|
23050 | draw(pMenu: MenuFactory, pOption: Element): void;
|
23051 | /** Invoked when an option is tapped. */
|
23052 | tap(): void;
|
23053 | /**
|
23054 | * Invoked when an option is opened.
|
23055 | * @return Returns `true` if the option is opened.
|
23056 | */
|
23057 | open(): boolean;
|
23058 | /**
|
23059 | * Invoked when an option is closed.
|
23060 | * @param Specifies if the option should close using an animation.
|
23061 | * @return Returns `true` if the option is closed.
|
23062 | */
|
23063 | close(bAnimate?: boolean): boolean;
|
23064 | /** Invoked when the option is removed. */
|
23065 | remove(): void;
|
23066 | /** Destroys the option. */
|
23067 | destroy(): void;
|
23068 | }
|
23069 | export class Menu extends MenuFactory {
|
23070 | /** Contains the default stylesheet. */
|
23071 | static stylesheet: Stylesheet;
|
23072 | /** Contains the default style. */
|
23073 | static style: IMenuStyle | undefined;
|
23074 | /** Retrieves the default parent element. */
|
23075 | static get parent(): Asset | undefined;
|
23076 | /** Sets the default parent element. */
|
23077 | static set parent(pParent: Asset | undefined);
|
23078 | /** Retrieves if there is a menu active. */
|
23079 | static get isActive(): boolean;
|
23080 | /**
|
23081 | * Creates a new menu and opens it at the specified position in the
|
23082 | * rectangle.
|
23083 | * @param pOptions Specifies the menu options.
|
23084 | * @param pRectangle Specifies the display rectangle.
|
23085 | * @param pProperties Specifies the menu properties.
|
23086 | * @return Returns a reference to the menu.
|
23087 | */
|
23088 | static open(pOptions: Option[], pRectangle: Rectangle, pProperties?: IMenuProperties): MenuFactory;
|
23089 | /**
|
23090 | * Creates a new menu and opens it at the specified asset.
|
23091 | * @param pOptions Specifies the menu options.
|
23092 | * @param pAsset Specifies the asset.
|
23093 | * @param pProperties Specifies the menu properties.
|
23094 | * @return Returns a reference to the menu.
|
23095 | */
|
23096 | static openAtElement(pOptions: Option[], pAsset: Asset, pProperties?: IMenuProperties): MenuFactory;
|
23097 | /**
|
23098 | * Creates a new menu and opens it at the specified position.
|
23099 | * @param pOptions Specifies the menu options.
|
23100 | * @param nX Specifies the horizontal position.
|
23101 | * @param nY Specifies the vertical position.
|
23102 | * @param pProperties Specifies the menu properties.
|
23103 | * @return Returns a reference to the menu.
|
23104 | */
|
23105 | static openAtPosition(pOptions: Option[], nX: number, nY: number, pProperties?: IMenuProperties): MenuFactory;
|
23106 | /**
|
23107 | * Closes the current active menu.
|
23108 | * @param bAnimate Specifies if an animation should be used.
|
23109 | * @param fnCallback Optional callback function which is invoked when the
|
23110 | * menu is closed.
|
23111 | */
|
23112 | static close(bAnimate?: boolean, fnCallback?: TMenu): void;
|
23113 | /**
|
23114 | * Constructs a new menu.
|
23115 | * @param pOptions Specifies the menu options.
|
23116 | * @param pProperties Specifies the menu properties.
|
23117 | */
|
23118 | constructor(pOptions: Option[], pProperties?: IMenuProperties);
|
23119 | }
|
23120 | class Label extends Option {
|
23121 | /**
|
23122 | * Constructs a new label.
|
23123 | * @param sLabel Specifies the option label.
|
23124 | * @param bDisabled Specifies if the label is disabled.
|
23125 | */
|
23126 | constructor(sLabel: string, bDisabled?: boolean, bInteractable?: boolean);
|
23127 | /**
|
23128 | * Draws the label.
|
23129 | * @param pMenu Reference to the parent menu.
|
23130 | * @param pElement Reference to the label element.
|
23131 | * @param pStyle Contains the label style.
|
23132 | */
|
23133 | draw(pMenu: MenuFactory, pElement: Element, pStyle?: IStyles): void;
|
23134 | }
|
23135 | class Item extends Label {
|
23136 | /**
|
23137 | * Constructs a new item.
|
23138 | * @param sLabel Specifies the option label.
|
23139 | * @param fnCommand Specifies the command which is invoked when the item
|
23140 | * is selected.
|
23141 | * @param bDisabled Specifies if the label is disabled.
|
23142 | */
|
23143 | constructor(sLabel: string, fnCommand?: () => void, bDisabled?: boolean);
|
23144 | /** Retrieves if the menu should be closed when the option is tapped. */
|
23145 | get closeOnTap(): boolean;
|
23146 | /**
|
23147 | * Draws the item.
|
23148 | * @param pMenu Reference to the parent menu.
|
23149 | * @param pItem Reference to the item element.
|
23150 | * @param pStyle Contains the label style.
|
23151 | */
|
23152 | draw(pMenu: MenuFactory, pItem: Element, pStyle?: IStyles): void;
|
23153 | /**
|
23154 | * Invoked when the item is tapped.
|
23155 | * @event
|
23156 | */
|
23157 | tap(): void;
|
23158 | /** Sets a badge for the item. */
|
23159 | badge(sBadge: string): this;
|
23160 | }
|
23161 | class ItemWithImage extends Item {
|
23162 | /**
|
23163 | * Constructs a new image item.
|
23164 | * @param sImage Specifies the image.
|
23165 | * @param sLabel Specifies the label.
|
23166 | * @param fnCommand Specifies the command which is invoked when the item
|
23167 | * is selected.
|
23168 | * @param bDisabled Specifies if the label is disabled.
|
23169 | */
|
23170 | constructor(sImage: string, sLabel: string, fnCommand?: () => void, bDisabled?: boolean);
|
23171 | /**
|
23172 | * Draws the item.
|
23173 | * @param pMenu Reference to the parent menu.
|
23174 | * @param pItem Reference to the item element.
|
23175 | * @param pStyle Contains the label style.
|
23176 | */
|
23177 | draw(pMenu: MenuFactory, pItem: Element, pStyle?: IStyles): void;
|
23178 | }
|
23179 | class Separator extends Option {
|
23180 | /** Constructs a new separator. */
|
23181 | constructor();
|
23182 | /**
|
23183 | * Draws the separator.
|
23184 | * @param pMenu Reference to the parent menu.
|
23185 | * @param pSeparator Reference to the separator element.
|
23186 | * @param pStyle Contains the label style.
|
23187 | */
|
23188 | draw(pMenu: MenuFactory, pSeparator: Element, pStyle?: IStyles): void;
|
23189 | }
|
23190 | class Submenu extends Item {
|
23191 | /**
|
23192 | * Constructs a new submenu.
|
23193 | * @param sLabel Specifies the option label.
|
23194 | * @param pOptions Specifies the submenu options.
|
23195 | * @param bDisabled Specifies if the label is disabled.
|
23196 | * @param bCollapse Specifies to collapse a single intermediate submenu.
|
23197 | */
|
23198 | constructor(sLabel: string, pOptions: Option[] | (() => Option[]), bDisabled?: boolean, bCollapse?: boolean);
|
23199 | /** Retrieves a reference to the submenu. */
|
23200 | get submenu(): MenuFactory | undefined;
|
23201 | /** Retrieves if the option has a submenu. */
|
23202 | get canOpen(): boolean;
|
23203 | /** Retrieves if the menu should be closed when the option is tapped. */
|
23204 | get closeOnTap(): boolean;
|
23205 |
|
23206 | /**
|
23207 | * Updates the option.
|
23208 | * @param bInstantly Applies the updates immediately.
|
23209 | */
|
23210 | protected update(bInstantly?: boolean): void;
|
23211 | /**
|
23212 | * Draws the option.
|
23213 | * @param pMenu Reference to the parent menu.
|
23214 | * @param pItem Reference to the item element.
|
23215 | * @param pStyle Contains the label style.
|
23216 | */
|
23217 | draw(pMenu: MenuFactory, pItem: Element, pStyle?: IStyles): void;
|
23218 | /** Invoked when the option is tapped. */
|
23219 | tap(): void;
|
23220 | /**
|
23221 | * Invoked when the submenu needs to open.
|
23222 | * @return Returns `true` if the menu is opened.
|
23223 | */
|
23224 | open(): boolean;
|
23225 | /**
|
23226 | * Invoked when the submenu needs to close.
|
23227 | * @param Specifies if the option should close using an animation.
|
23228 | * @return Returns `true` if the menu is closed.
|
23229 | */
|
23230 | close(bAnimate?: boolean): boolean;
|
23231 | /** Invoked when the option is removed. */
|
23232 | remove(): void;
|
23233 | /** Destroys the option. */
|
23234 | destroy(): void;
|
23235 | }
|
23236 | class SubmenuWithImage extends Submenu {
|
23237 | /**
|
23238 | * Constructs a new image item.
|
23239 | * @param sImage Specifies the image.
|
23240 | * @param sLabel Specifies the option label.
|
23241 | * @param pOptions Specifies the submenu options.
|
23242 | * @param bDisabled Specifies if the label is disabled.
|
23243 | * @param bCollapse Specifies to collapse a single intermediate submenu.
|
23244 | */
|
23245 | constructor(sImage: string, sLabel: string, pOptions: Option[] | (() => Option[]), bDisabled?: boolean, bCollapse?: boolean);
|
23246 | /**
|
23247 | * Draws the item.
|
23248 | * @param pMenu Reference to the parent menu.
|
23249 | * @param pItem Reference to the item element.
|
23250 | * @param pStyle Contains the label style.
|
23251 | */
|
23252 | draw(pMenu: MenuFactory, pItem: Element, pStyle?: IStyles): void;
|
23253 | }
|
23254 | class Link extends Item {
|
23255 | /**
|
23256 | * Constructs a new link item.
|
23257 | * @param sLabel Specifies the label.
|
23258 | * @param sURL Specifies the URL.
|
23259 | * @param sTarget Specifies the target of the link.
|
23260 | * @param bDisabled Specifies if the label is disabled.
|
23261 | */
|
23262 | constructor(sLabel: string, sURL: string, sTarget?: "self" | "blank");
|
23263 | /** Returns the element type for the item. */
|
23264 | get elementType(): string;
|
23265 | /** Retrieves the URL of the link. */
|
23266 | get URL(): string;
|
23267 | /** Sets the URL of the link. */
|
23268 | set URL(sURL: string);
|
23269 | /** Retrieves the target of the link. */
|
23270 | get target(): "self" | "blank";
|
23271 | /** Sets the target of the link. */
|
23272 | set target(sTarget: "self" | "blank");
|
23273 | /**
|
23274 | * Updates the option.
|
23275 | * @param bInstantly Applies the updates immediately.
|
23276 | */
|
23277 | protected update(bInstantly?: boolean): void;
|
23278 | /**
|
23279 | * Draws the item.
|
23280 | * @param pMenu Reference to the parent menu.
|
23281 | * @param pItem Reference to the item element.
|
23282 | * @param pStyle Contains the label style.
|
23283 | */
|
23284 | draw(pMenu: MenuFactory, pElement: Element, pStyle?: IStyles): void;
|
23285 | }
|
23286 | class LinkWithImage extends Link {
|
23287 | /**
|
23288 | * Constructs a new image item.
|
23289 | * @param sImage Specifies the image.
|
23290 | * @param sLabel Specifies the label.
|
23291 | * @param sURL Specifies the URL.
|
23292 | * @param sTarget Specifies the target of the link.
|
23293 | */
|
23294 | constructor(sImage: string, sLabel: string, sURL: string, sTarget?: "self" | "blank");
|
23295 | /**
|
23296 | * Draws the item.
|
23297 | * @param pMenu Reference to the parent menu.
|
23298 | * @param pItem Reference to the item element.
|
23299 | * @param pStyle Contains the label style.
|
23300 | */
|
23301 | draw(pMenu: MenuFactory, pItem: Element, pStyle?: IStyles): void;
|
23302 | }
|
23303 |
|
23304 | export {
|
23305 | Item as MenuItem,
|
23306 | ItemWithImage as MenuItemWithImage,
|
23307 | Label as MenuLabel,
|
23308 | Link as MenuLink,
|
23309 | LinkWithImage as MenuLinkWithImage,
|
23310 | Option as MenuOption,
|
23311 | Separator as MenuSeparator,
|
23312 | Submenu as MenuSubmenu,
|
23313 | SubmenuWithImage as MenuSubmenuWithImage,
|
23314 | TPosition as TMenuPosition,
|
23315 | };
|
23316 | }
|
23317 |
|
23318 | declare module "tripetto/module/ui-scrollbars" {
|
23319 | import { Asset, Element, IStyles, Stylesheet } from "tripetto/module/dom";
|
23320 | import { Spacing } from "tripetto/module/metrics";
|
23321 | import { IScrollProperties, Scroll } from "tripetto/module/touch-scroll";
|
23322 |
|
23323 | /** Describes the scrollbar style. */
|
23324 | export interface IScrollbarsStyle {
|
23325 | /** Specifies the track style. */
|
23326 | track?: {
|
23327 | /**
|
23328 | * Contains the track size in pixels. This is the width of the track for
|
23329 | * vertical scrollbars and the height of the track for horizontal scrollbars.
|
23330 | */
|
23331 | size?: number;
|
23332 | /** Specifies the spacing of the track related to the scroll viewport. */
|
23333 | spacing?: Spacing;
|
23334 | /** Specifies the track appearance. */
|
23335 | appearance?: IStyles;
|
23336 | /** The track is hovered. */
|
23337 | hover?: IStyles;
|
23338 | /** The thumb is hovered. */
|
23339 | focus?: IStyles;
|
23340 | /** The thumb is dragged. */
|
23341 | drag?: IStyles;
|
23342 | /** The track is crawling. */
|
23343 | crawl?: IStyles;
|
23344 | /** Horizontal specific track styles. */
|
23345 | horizontal?: IStyles;
|
23346 | /** Vertical specific track styles. */
|
23347 | vertical?: IStyles;
|
23348 | };
|
23349 | /** Specifies the thumb style. */
|
23350 | thumb?: {
|
23351 | /**
|
23352 | * Contains the size of the thumb in pixels. This is the width of the thumb
|
23353 | * for vertical scrollbars and the height of the thumb for horizontal
|
23354 | * scrollbars.
|
23355 | */
|
23356 | size?: number;
|
23357 | /**
|
23358 | * Specifies the minimum height of the thumb for vertical scrollbars
|
23359 | * or the minimum width for horizontal scrollbars.
|
23360 | */
|
23361 | min?: number;
|
23362 | /** Specifies the spacing of the thumb related to the track. */
|
23363 | spacing?: Spacing;
|
23364 | /** Specifies the thumb appearance. */
|
23365 | appearance?: IStyles;
|
23366 | /** The track is hovered. */
|
23367 | hover?: IStyles;
|
23368 | /** The thumb is hovered. */
|
23369 | focus?: IStyles;
|
23370 | /** The thumb is dragged. */
|
23371 | drag?: IStyles;
|
23372 | /** The track is crawling. */
|
23373 | crawl?: IStyles;
|
23374 | /** Horizontal specific thumb styles. */
|
23375 | horizontal?: IStyles;
|
23376 | /** Vertical specific thumb styles. */
|
23377 | vertical?: IStyles;
|
23378 | };
|
23379 | /** Specifies the styles for the corner. */
|
23380 | corner?: {
|
23381 | /** Specifies the corner appearance. */
|
23382 | appearance?: IStyles;
|
23383 | /** The thumb is dragged. */
|
23384 | drag?: IStyles;
|
23385 | /** The track is crawling. */
|
23386 | crawl?: IStyles;
|
23387 | };
|
23388 | /**
|
23389 | * Defines an additional offset for the scrollbar tracks. This can be used
|
23390 | * if the position of the tracks needs to be corrected.
|
23391 | */
|
23392 | offset?: Spacing;
|
23393 | }
|
23394 | /** Describes the scrollbar properties. */
|
23395 | export interface IScrollbarsProperties extends IScrollProperties {
|
23396 | /** Specifies the scrollbar style. */
|
23397 | style?: IScrollbarsStyle;
|
23398 | /** Specifies if the scrollbars needs to blink on initialization. */
|
23399 | blink?: boolean;
|
23400 | /**
|
23401 | * Specifies if the scrollbars operate in passive mode. Interaction with
|
23402 | * the scrollbars is not possible. They are just a visual indication.
|
23403 | */
|
23404 | passive?: boolean;
|
23405 | }
|
23406 | export class Scrollbars extends Scroll {
|
23407 | /** Contains the default stylesheet. */
|
23408 | static stylesheet: Stylesheet;
|
23409 | /** Contains the default style. */
|
23410 | static style: IScrollbarsStyle | undefined;
|
23411 |
|
23412 | /**
|
23413 | * Registers a new scrollbars controller.
|
23414 | * @param pProperties Specifies the scrollbar properties.
|
23415 | * @return Returns a reference to the scrollbars controller.
|
23416 | */
|
23417 | static on(pProperties: IScrollbarsProperties): Scrollbars;
|
23418 | /**
|
23419 | * Invalidates the scrollbars which are attached to the specified asset or
|
23420 | * one of the child assets.
|
23421 | * @param pAsset Specifies the asset. Supply `*` to target all scrollbars.
|
23422 | * @param fnCondition Specifies the condition.
|
23423 | * @param Specifies if the styles are updated instantly.
|
23424 | * @return Returns `true` if a scrollbar is invalidated.
|
23425 | */
|
23426 | static invalidate(pAsset: Asset | "*", fnCondition?: (pScrollbars: Scrollbars) => boolean, bInstantly?: boolean): boolean;
|
23427 | /**
|
23428 | * Constructs a new scrollbars controller.
|
23429 | * @param pProperties Specifies the scrollbar properties.
|
23430 | */
|
23431 | protected constructor(pProperties: IScrollbarsProperties);
|
23432 |
|
23433 | /** Retrieves if the scrollbars are shown. */
|
23434 | get isShown(): boolean;
|
23435 | /** Retrieves if the scrollbars are hidden. */
|
23436 | get isHidden(): boolean;
|
23437 | /** Retrieves if the scrollbars are visible. */
|
23438 | get isVisible(): boolean;
|
23439 | /** Retrieves if the horizontal scrollbar is currently visible. */
|
23440 | get isHorizontalVisible(): boolean;
|
23441 | /** Retrieves if the vertical scrollbar is currently visible. */
|
23442 | get isVerticalVisible(): boolean;
|
23443 |
|
23444 | /**
|
23445 | * Invoked when the scroll controller is initialized.
|
23446 | * @event
|
23447 | */
|
23448 | protected onScrollInit(): void;
|
23449 | /**
|
23450 | * Invoked when the scroll area is resized.
|
23451 | * @event
|
23452 | */
|
23453 | protected onScrollResize(): void;
|
23454 | /**
|
23455 | * Invoked when the scroll direction (lock) is changed.
|
23456 | * @event
|
23457 | */
|
23458 | protected onScrollDirection(): void;
|
23459 | /**
|
23460 | * Invoked when a pointing device hovers in or out the scroll area.
|
23461 | * @event
|
23462 | */
|
23463 | protected onScrollHover(): void;
|
23464 | /**
|
23465 | * Invoked when the scrolling starts.
|
23466 | * @event
|
23467 | */
|
23468 | protected onScrollStart(): void;
|
23469 | /**
|
23470 | * Invoked when the scroll position is updated.
|
23471 | * @param nLeft Specifies the left position.
|
23472 | * @param nTop Specifies the top position.
|
23473 | * @event
|
23474 | */
|
23475 | protected onScrollMove(nLeft: number, nTop: number): void;
|
23476 | /**
|
23477 | * Invoked when the scrolling ends.
|
23478 | * @event
|
23479 | */
|
23480 | protected onScrollEnd(): void;
|
23481 | /**
|
23482 | * Invoked when a zoom is started.
|
23483 | * @event
|
23484 | */
|
23485 | protected onScrollZoomStart(): void;
|
23486 | /**
|
23487 | * Invoked when a zoom is ended.
|
23488 | * @event
|
23489 | */
|
23490 | protected onScrollZoomEnd(): void;
|
23491 | /** Shows the scrollbars for a brief moment. */
|
23492 | blink(): void;
|
23493 | /**
|
23494 | * Shows the scrollbars (if scrollbars are allowed).
|
23495 | * @param bShow Specifies if the scrollbars should be showed.
|
23496 | * @return Returns `true` if the scrollbars are showed.
|
23497 | */
|
23498 | show(bShow: boolean): boolean;
|
23499 | /**
|
23500 | * Hides the scrollbars.
|
23501 | * @param bHide Specifies if the scrollbars should be hidden.
|
23502 | * @return Returns `true` if the scrollbars are hidden.
|
23503 | */
|
23504 | hide(bHide: boolean): boolean;
|
23505 | /**
|
23506 | * Invalidates the scrollbar condition.
|
23507 | * @param fnCondition Specifies the condition.
|
23508 | * @param Specifies if the styles are updated instantly.
|
23509 | */
|
23510 | invalidate(fnCondition?: (pScrollbars: Scrollbars) => boolean, bInstantly?: boolean): void;
|
23511 | /**
|
23512 | * Invoked when the scrollbars instance is destroyed.
|
23513 | * @event
|
23514 | */
|
23515 | onDestroy(): boolean;
|
23516 | }
|
23517 | /**
|
23518 | * Creates a scroll button which can crawl the scrolling in the specified direction.
|
23519 | * @param sDirection Specifies the direction.
|
23520 | * @param sType Specifies the button type.
|
23521 | * @param sHover Specifies the selector which is applied when the button is hovered.
|
23522 | * @param sCrawl Specifies the selector which is applied when the button is crawling.
|
23523 | * @param pStyles Specifies the styles to apply to the element.
|
23524 | */
|
23525 | export function scrollbarsButton(
|
23526 | pScroll: Scroll | Scrollbars,
|
23527 | sDirection: "left" | "up" | "right" | "down",
|
23528 | sType: string,
|
23529 | sHover: string,
|
23530 | sCrawl: string,
|
23531 | ...pStyles: IStyles[]
|
23532 | ): Element;
|
23533 | }
|
23534 |
|
23535 | declare module "tripetto/module/ui-toolbar" {
|
23536 | import { Element, IStyles, Stylesheet } from "tripetto/module/dom";
|
23537 | import { Hooks } from "tripetto/module/hookup";
|
23538 | import { Spacing } from "tripetto/module/metrics";
|
23539 | import { Scroll } from "tripetto/module/touch-scroll";
|
23540 | import { Tap } from "tripetto/module/touch-tap";
|
23541 | import { Layer, LayerComponent, LayerConfiguration } from "tripetto/module/ui-layers";
|
23542 | import { IMenuStyle as IMenuBaseStyle, MenuOption, TMenuPosition } from "tripetto/module/ui-menu";
|
23543 | import { IScrollbarsStyle, Scrollbars } from "tripetto/module/ui-scrollbars";
|
23544 |
|
23545 | interface IItemStyle {
|
23546 | /** Specifies the item width. */
|
23547 | width?: number | "auto" | "fill";
|
23548 | /** Specifies the item height. */
|
23549 | height?: number | "auto" | "fill";
|
23550 | /** Item appearance. */
|
23551 | appearance?: IStyles;
|
23552 | /** Item hover style. */
|
23553 | hover?: IStyles;
|
23554 | /** Item tap style. */
|
23555 | tap?: IStyles;
|
23556 | /** Item disabled style. */
|
23557 | disabled?: IStyles;
|
23558 | /** Item selected style. */
|
23559 | selected?: IStyles;
|
23560 | /** Item animations. */
|
23561 | animations?: {
|
23562 | /** Item is shown. */
|
23563 | show?: IStyles;
|
23564 | /** Item is hidden. */
|
23565 | hide?: IStyles;
|
23566 | /** Item is selected. */
|
23567 | select?: IStyles;
|
23568 | /** Item is deselected. */
|
23569 | deselect?: IStyles;
|
23570 | /** Item is disabled. */
|
23571 | disable?: IStyles;
|
23572 | /** Item is enabled. */
|
23573 | enable?: IStyles;
|
23574 | };
|
23575 | }
|
23576 | export type TItem<Views = void> = (pItem: Item<Views>) => void;
|
23577 | class Item<Views = void> {
|
23578 | |
23579 |
|
23580 |
|
23581 |
|
23582 | onShow: TItem<Views> | undefined;
|
23583 | |
23584 |
|
23585 |
|
23586 |
|
23587 | onHide: TItem<Views> | undefined;
|
23588 | |
23589 |
|
23590 |
|
23591 |
|
23592 | onEnable: TItem<Views> | undefined;
|
23593 | |
23594 |
|
23595 |
|
23596 |
|
23597 | onDisable: TItem<Views> | undefined;
|
23598 | |
23599 |
|
23600 |
|
23601 |
|
23602 | onSelect: TItem<Views> | undefined;
|
23603 | |
23604 |
|
23605 |
|
23606 |
|
23607 | onDeselect: TItem<Views> | undefined;
|
23608 | |
23609 |
|
23610 |
|
23611 |
|
23612 | onDelete: TItem<Views> | undefined;
|
23613 | |
23614 |
|
23615 |
|
23616 |
|
23617 | onDestroy: TItem<Views> | undefined;
|
23618 | |
23619 |
|
23620 |
|
23621 |
|
23622 |
|
23623 |
|
23624 | constructor(pStyle?: IItemStyle, sId?: string, bTappable?: boolean);
|
23625 | /** Retrieves the item style. */
|
23626 | get style(): IItemStyle;
|
23627 | /** Retrieves a reference to the toolbar. */
|
23628 | get toolbar(): Toolbar<Views> | undefined;
|
23629 | /** Retrieves the view of the toolbar. */
|
23630 | get view(): Views | undefined;
|
23631 | /** Retrieves a reference to the element. */
|
23632 | get element(): Element | undefined;
|
23633 | /** Returns the element type for the item. */
|
23634 | get type(): string;
|
23635 | /** Retrieves the identifier string of the item. */
|
23636 | get id(): string;
|
23637 | /** Sets the item identifier string. */
|
23638 | set id(sId: string);
|
23639 | /** Retrieves if the item is visible. */
|
23640 | get isVisible(): boolean;
|
23641 | /** Specifies if the item is visible. */
|
23642 | set isVisible(bVisible: boolean);
|
23643 | /** Retrieves if the item is disabled. */
|
23644 | get isDisabled(): boolean;
|
23645 | /** Specifies if the item is disabled. */
|
23646 | set isDisabled(bDisabled: boolean);
|
23647 | /** Retrieves if the item is selected. */
|
23648 | get isSelected(): boolean;
|
23649 | /** Specifies if the item is selected. */
|
23650 | set isSelected(bSelected: boolean);
|
23651 | /** Retrieves if the item is tappable. */
|
23652 | get isTappable(): boolean;
|
23653 | /** Retrieves the tap controller for the item. */
|
23654 | get tap(): Tap | undefined;
|
23655 | /** Retrieves if the item is excluded from the current view. */
|
23656 | get isExcluded(): boolean;
|
23657 | /**
|
23658 | * Invoked when the user moves the mouse in the item.
|
23659 | * @event
|
23660 | */
|
23661 | protected onMouseEnter(): void;
|
23662 | /**
|
23663 | * Invoked when the user moves the mouse out of the item.
|
23664 | * @event
|
23665 | */
|
23666 | protected onMouseLeave(): void;
|
23667 | /**
|
23668 | * Invoked when the user taps the item.
|
23669 | * @event
|
23670 | */
|
23671 | protected onTap(): void;
|
23672 | /**
|
23673 | * Invoked when the user starts tapping the item.
|
23674 | * @event
|
23675 | */
|
23676 | protected onTapStart(): void;
|
23677 | /**
|
23678 | * Invoked when the user ends tapping the item.
|
23679 | * @event
|
23680 | */
|
23681 | protected onTapEnd(): void;
|
23682 | /**
|
23683 | * Invoked when the visibility of an item changes.
|
23684 | * @event
|
23685 | */
|
23686 | protected onVisibilityChange(): void;
|
23687 | /**
|
23688 | * Invoked when the state of an item changes.
|
23689 | * @event
|
23690 | */
|
23691 | protected onStateChange(): void;
|
23692 | /**
|
23693 | * Invoked when the selected state of an item changes.
|
23694 | * @event
|
23695 | */
|
23696 | protected onSelectChange(): void;
|
23697 | /**
|
23698 | * Invoked when the view of an item changes.
|
23699 | * @param pView Specifies the view.
|
23700 | * @return Should return `true` if the view change requires a toolbar update.
|
23701 | * @event
|
23702 | */
|
23703 | protected onViewChange(pView: Views | undefined): boolean;
|
23704 | /** Updates the item and the parent toolbar. */
|
23705 | protected update(): void;
|
23706 | /**
|
23707 | * Chainable function which sets the visibility of the item.
|
23708 | * @param bVisible Specifies if the item is visible.
|
23709 | * @return Returns a reference to the item.
|
23710 | */
|
23711 | visible(bVisible: boolean): this;
|
23712 | /**
|
23713 | * Shows the item.
|
23714 | * @return Returns a reference to the item.
|
23715 | */
|
23716 | show(): this;
|
23717 | /**
|
23718 | * Hides the item.
|
23719 | * @return Returns a reference to the item.
|
23720 | */
|
23721 | hide(): this;
|
23722 | /**
|
23723 | * Chainable function which sets the state of the item.
|
23724 | * @param bDisabled Specifies if the item is disabled.
|
23725 | * @return Returns a reference to the item.
|
23726 | */
|
23727 | disabled(bDisabled: boolean): this;
|
23728 | /**
|
23729 | * Enables the item.
|
23730 | * @return Returns a reference to the item.
|
23731 | */
|
23732 | enable(): this;
|
23733 | /**
|
23734 | * Disables the item.
|
23735 | * @return Returns a reference to the item.
|
23736 | */
|
23737 | disable(): this;
|
23738 | /**
|
23739 | * Chainable function which sets the selected state of the item.
|
23740 | * @param bSelected Specifies if the item is selected.
|
23741 | * @return Returns a reference to the item.
|
23742 | */
|
23743 | selected(bSelected: boolean): this;
|
23744 | /**
|
23745 | * Selects the item.
|
23746 | * @return Returns a reference to the item.
|
23747 | */
|
23748 | select(): this;
|
23749 | /**
|
23750 | * Deselects the item.
|
23751 | * @return Returns a reference to the item.
|
23752 | */
|
23753 | deselect(): this;
|
23754 | /**
|
23755 | * Include an item in certain views.
|
23756 | * @param pViews Specifies the views that include this item.
|
23757 | * @return Returns a reference to the item.
|
23758 | */
|
23759 | includeInViews(...pViews: Views[]): this;
|
23760 | /**
|
23761 | * Exclude an item from certain views.
|
23762 | * @param pViews Specifies the views that exclude this item.
|
23763 | * @return Returns a reference to the item.
|
23764 | */
|
23765 | excludeInViews(...pViews: Views[]): this;
|
23766 | /**
|
23767 | * Draws the item.
|
23768 | * @param pToolbar Reference to the toolbar.
|
23769 | * @param pElement Reference to the element to draw on.
|
23770 | * @event
|
23771 | */
|
23772 | onDraw(pToolbar: Toolbar<Views>, pElement: Element): void;
|
23773 | /**
|
23774 | * Deletes an item. An animation can be used to hide the item. Use `Destroy`
|
23775 | * if you want to remove the item immediately.
|
23776 | */
|
23777 | delete(): void;
|
23778 | /** Destroys the item. */
|
23779 | destroy(): void;
|
23780 | }
|
23781 | /** Describes the toolbar style. */
|
23782 | export interface IToolbarStyle {
|
23783 |
|
23784 | appearance?: IStyles;
|
23785 |
|
23786 | orientation?: TOrientation;
|
23787 |
|
23788 | hover?: IStyles;
|
23789 |
|
23790 | spacing?: Spacing;
|
23791 |
|
23792 | scrollable?: boolean;
|
23793 |
|
23794 | blink?: boolean;
|
23795 | |
23796 |
|
23797 |
|
23798 |
|
23799 | passive?: boolean;
|
23800 |
|
23801 | scrollbars?: IScrollbarsStyle;
|
23802 |
|
23803 | indicators?: {
|
23804 |
|
23805 | begin: {
|
23806 |
|
23807 | appearance: IStyles;
|
23808 |
|
23809 | hover?: IStyles;
|
23810 |
|
23811 | crawl?: IStyles;
|
23812 | };
|
23813 |
|
23814 | end: {
|
23815 |
|
23816 | appearance: IStyles;
|
23817 |
|
23818 | hover?: IStyles;
|
23819 |
|
23820 | crawl?: IStyles;
|
23821 | };
|
23822 | };
|
23823 | }
|
23824 |
|
23825 | export interface IToolbarProperties<Views = void> {
|
23826 | |
23827 |
|
23828 |
|
23829 |
|
23830 | stylesheet?: Stylesheet;
|
23831 |
|
23832 | style?: IToolbarStyle;
|
23833 |
|
23834 | parent?: Layer | Element;
|
23835 |
|
23836 | left?: Item<Views>[];
|
23837 |
|
23838 | right?: Item<Views>[];
|
23839 |
|
23840 | top?: Item<Views>[];
|
23841 |
|
23842 | bottom?: Item<Views>[];
|
23843 |
|
23844 | view?: Views;
|
23845 | |
23846 |
|
23847 |
|
23848 |
|
23849 | onReady?: (pToolbar: Toolbar<Views>) => void;
|
23850 | |
23851 |
|
23852 |
|
23853 |
|
23854 | onResize?: (nWidth: number, nHeight: number, pToolbar: Toolbar<Views>) => void;
|
23855 | |
23856 |
|
23857 |
|
23858 |
|
23859 | onTap?: (pItem: Item<Views>) => void;
|
23860 | |
23861 |
|
23862 |
|
23863 |
|
23864 | onVisibility?: (pItem: Item<Views>) => void;
|
23865 | |
23866 |
|
23867 |
|
23868 |
|
23869 | onState?: (pItem: Item<Views>) => void;
|
23870 | |
23871 |
|
23872 |
|
23873 |
|
23874 | onSelect?: (pItem: Item<Views>) => void;
|
23875 | |
23876 |
|
23877 |
|
23878 |
|
23879 | onDestroy?: (pToolbar: Toolbar<Views>) => void;
|
23880 | }
|
23881 |
|
23882 | export type TOrientation = "horizontal" | "vertical";
|
23883 |
|
23884 | export type TRegion = "left" | "top" | "right" | "bottom";
|
23885 |
|
23886 | export class Toolbar<Views = void> {
|
23887 |
|
23888 | static stylesheet: Stylesheet;
|
23889 |
|
23890 | static style: IToolbarStyle | undefined;
|
23891 |
|
23892 |
|
23893 | readonly dispatcher: Hooks<"OnViewChange">;
|
23894 | |
23895 |
|
23896 |
|
23897 |
|
23898 | onReady: ((pToolbar: Toolbar<Views>) => void) | undefined;
|
23899 | /**
|
23900 | * Contains the function which is invoked when the toolbar is resized.
|
23901 | * @event
|
23902 | */
|
23903 | onResize: ((nWidth: number, nHeight: number, pToolbar: Toolbar<Views>) => void) | undefined;
|
23904 | /**
|
23905 | * Contains the function which is invoked when a item is tapped.
|
23906 | * @event
|
23907 | */
|
23908 | onTap: TItem<Views> | undefined;
|
23909 | /**
|
23910 | * Contains the function which is invoked when the visibility of a toolbar item
|
23911 | * is changed.
|
23912 | * @event
|
23913 | */
|
23914 | onVisibility: TItem<Views> | undefined;
|
23915 | /**
|
23916 | * Contains the function which is invoked when the state of a toolbar item is
|
23917 | * changed.
|
23918 | * @event
|
23919 | */
|
23920 | onState: TItem<Views> | undefined;
|
23921 | /**
|
23922 | * Contains the function which is invoked when the selected state of a toolbar
|
23923 | * item is changed.
|
23924 | * @event
|
23925 | */
|
23926 | onSelect: TItem<Views> | undefined;
|
23927 | /**
|
23928 | * Contains the function which is invoked when the toolbar is destroyed.
|
23929 | * @event
|
23930 | */
|
23931 | onDestroy: ((pToolbar: Toolbar<Views>) => void) | undefined;
|
23932 | /**
|
23933 | * Creates a new toolbar.
|
23934 | * @param pPropertiesList Specifies the toolbar properties. Multiple
|
23935 | * properties objects can be supplied. They will be combined to a single
|
23936 | * immutable properties object.
|
23937 | */
|
23938 | static create<Views>(...pPropertiesList: IToolbarProperties<Views>[]): Toolbar<Views>;
|
23939 | /**
|
23940 | * Constructs a new toolbar.
|
23941 | * @param pPropertiesList Specifies the toolbar properties. Multiple
|
23942 | * properties objects can be supplied. They will be combined to a single
|
23943 | * immutable properties object.
|
23944 | */
|
23945 | constructor(...pPropertiesList: IToolbarProperties<Views>[]);
|
23946 | /** Retrieves a reference to the stylesheet. */
|
23947 | get stylesheet(): Stylesheet;
|
23948 | /** Retrieves a reference to the layer. */
|
23949 | get layer(): Layer | undefined;
|
23950 | /** Retrieves the toolbar orientation. */
|
23951 | get orientation(): TOrientation;
|
23952 | /** Retrieves a reference to the scroll controller. */
|
23953 | get scroll(): Scroll | Scrollbars | undefined;
|
23954 | /** Retrieves the current view of the toolbar. */
|
23955 | get view(): Views | undefined;
|
23956 | /** Sets the current view for the toolbar. */
|
23957 | set view(pView: Views | undefined);
|
23958 |
|
23959 | /**
|
23960 | * Push an item to the hash table.
|
23961 | * @param pItem Reference to the item.
|
23962 | */
|
23963 | push<T extends Item<Views>>(pItem: T): T;
|
23964 | /**
|
23965 | * Pop an item from the hash table.
|
23966 | * @param pItem Reference to the item.
|
23967 | */
|
23968 | pop(pItem: Item<Views>): void;
|
23969 | /**
|
23970 | * Retrieves an item from the hash table.
|
23971 | * @param sId Specifies the item identifier.
|
23972 | */
|
23973 | get<T extends Item<Views>>(sId: string): T | undefined;
|
23974 | /**
|
23975 | * Invoked when an item is tapped.
|
23976 | * @param pItem Reference to the item.
|
23977 | * @event
|
23978 | */
|
23979 | onItemTap(pItem: Item<Views>): void;
|
23980 | /**
|
23981 | * Invoked when the visibility of an item changes.
|
23982 | * @param pItem Reference to the item.
|
23983 | * @event
|
23984 | */
|
23985 | onItemVisibilityChange(pItem: Item<Views>): void;
|
23986 | /**
|
23987 | * Invoked when the state of an item changes.
|
23988 | * @param pItem Reference to the item.
|
23989 | * @event
|
23990 | */
|
23991 | onItemStateChange(pItem: Item<Views>): void;
|
23992 | /**
|
23993 | * Invoked when the selected state of an item changes.
|
23994 | * @param pItem Reference to the item.
|
23995 | * @event
|
23996 | */
|
23997 | onItemSelectChange(pItem: Item<Views>): void;
|
23998 | /**
|
23999 | * Adds a new item to the end of the specified toolbar region.
|
24000 | * @param pItem Reference to the item.
|
24001 | * @param sRegion Specifies the region.
|
24002 | * @return Returns a reference to the item.
|
24003 | */
|
24004 | add<T extends Item<Views>>(pItem: T, sRegion?: TRegion): T;
|
24005 | /**
|
24006 | * Inserts a new item to beginning of the specified toolbar region.
|
24007 | * @param pItem Reference to the item.
|
24008 | * @param sRegion Specifies the region.
|
24009 | * @return Returns a reference to the item.
|
24010 | */
|
24011 | insert<T extends Item<Views>>(pItem: T, sRegion?: TRegion): T;
|
24012 | /**
|
24013 | * Inserts a new item before or after another item on the toolbar.
|
24014 | * @param pItem Reference to the item to insert.
|
24015 | * @param pExistingItem Specifies the item to use as reference point.
|
24016 | * @param sWhere Specifies if the new item is inserted before or after the
|
24017 | * other item.
|
24018 | * @return Returns a reference to the item.
|
24019 | */
|
24020 | insertAtItem<T extends Item<Views>>(pItem: T, pExistingItem: Item<Views>, sWhere?: "before" | "after"): T;
|
24021 | /**
|
24022 | * Adds a new item to the left region of a horizontal toolbar.
|
24023 | * @param pItem Reference to the item.
|
24024 | * @return Returns a reference to the item.
|
24025 | */
|
24026 | addToLeft<T extends Item<Views>>(pItem: T): T;
|
24027 | /**
|
24028 | * Adds a new item to the right region of a horizontal toolbar.
|
24029 | * @param pItem Reference to the item.
|
24030 | * @return Returns a reference to the item.
|
24031 | */
|
24032 | addToRight<T extends Item<Views>>(pItem: T): T;
|
24033 | /**
|
24034 | * Adds a new item to the top region of a vertical toolbar.
|
24035 | * @param pItem Reference to the item.
|
24036 | * @return Returns a reference to the item.
|
24037 | */
|
24038 | addToTop<T extends Item<Views>>(pItem: T): T;
|
24039 | /**
|
24040 | * Adds a new item to the bottom region of a vertical toolbar.
|
24041 | * @param pItem Reference to the item.
|
24042 | * @return Returns a reference to the item.
|
24043 | */
|
24044 | addToBottom<T extends Item<Views>>(pItem: T): T;
|
24045 | /**
|
24046 | * Deletes the supplied item from the toolbar.
|
24047 | * @param pItem Specifies the item to remove.
|
24048 | */
|
24049 | delete(pItem: Item<Views>): void;
|
24050 | /** Updates the toolbar. */
|
24051 | update(): void;
|
24052 | /**
|
24053 | * Changes the current view of the toolbar.
|
24054 | * @param pView Specifies the view.
|
24055 | */
|
24056 | changeView(pView: Views): void;
|
24057 | /** Destroys the toolbar. */
|
24058 | destroy(): void;
|
24059 | }
|
24060 | export class ToolbarComponent<Views = void> extends LayerComponent {
|
24061 | /**
|
24062 | * Constructs a new toolbar component.
|
24063 | * @param pProperties Specifies the toolbar properties.
|
24064 | * @param pConfiguration Specifies the layer configuration.
|
24065 | */
|
24066 | constructor(pProperties: IToolbarProperties<Views>, pConfiguration?: LayerConfiguration);
|
24067 | /** Retrieves a reference to the toolbar. */
|
24068 | get toolbar(): Toolbar<Views>;
|
24069 | /** Renders the component. */
|
24070 | protected onRender(): void;
|
24071 | }
|
24072 | export type TTap<Views = void> = (pStatic: Static<Views>) => void;
|
24073 | class Static<Views = void> extends Item<Views> {
|
24074 | |
24075 |
|
24076 |
|
24077 |
|
24078 |
|
24079 |
|
24080 |
|
24081 |
|
24082 | constructor(pStyle: IItemStyle, sLabel?: string, sId?: string, fnTapped?: TTap<Views> | boolean);
|
24083 | /** Retrieves the item label. */
|
24084 | get label(): string;
|
24085 | /** Sets the item label. */
|
24086 | set label(sLabel: string);
|
24087 | /**
|
24088 | * Invoked when the user taps the item.
|
24089 | * @event
|
24090 | */
|
24091 | protected onTap(): void;
|
24092 | /**
|
24093 | * Draws the item.
|
24094 | * @param pToolbar Reference to the toolbar.
|
24095 | * @param pElement Reference to the element to draw on.
|
24096 | * @param pLabel Reference to the label.
|
24097 | * @event
|
24098 | */
|
24099 | onDraw(pToolbar: Toolbar<Views>, pElement: Element, pLabel?: Element): void;
|
24100 | }
|
24101 | class Button<Views = void> extends Static<Views> {
|
24102 | |
24103 |
|
24104 |
|
24105 |
|
24106 |
|
24107 |
|
24108 |
|
24109 | constructor(pStyle: IItemStyle, sLabel?: string, sId?: string, fnTapped?: (pButton: Button<Views>) => void);
|
24110 | }
|
24111 | interface IMenuStyle extends IItemStyle {
|
24112 |
|
24113 | opened?: IStyles;
|
24114 |
|
24115 | menu?: IMenuBaseStyle;
|
24116 | }
|
24117 | class Menu<Views = void> extends Static<Views> {
|
24118 | |
24119 |
|
24120 |
|
24121 |
|
24122 |
|
24123 |
|
24124 |
|
24125 |
|
24126 | constructor(
|
24127 | pStyle: IMenuStyle,
|
24128 | sLabel: string | undefined,
|
24129 | pOptions: MenuOption[] | ((pMenu: Menu<Views>) => MenuOption[]),
|
24130 | sPosition?: TMenuPosition,
|
24131 | sId?: string
|
24132 | );
|
24133 | /**
|
24134 | * Invoked when the user taps the item.
|
24135 | * @event
|
24136 | */
|
24137 | protected onTap(): void;
|
24138 | /**
|
24139 | * Invoked when the visibility of an item changes.
|
24140 | * @event
|
24141 | */
|
24142 | protected onVisibilityChange(): void;
|
24143 | /**
|
24144 | * Invoked when the state of an item changes.
|
24145 | * @event
|
24146 | */
|
24147 | protected onStateChange(): void;
|
24148 | /**
|
24149 | * Draws the item.
|
24150 | * @param pToolbar Reference to the toolbar.
|
24151 | * @param pElement Reference to the element to draw on.
|
24152 | * @param pLabel Reference to the label.
|
24153 | * @event
|
24154 | */
|
24155 | onDraw(pToolbar: Toolbar<Views>, pElement: Element, pLabel?: Element): void;
|
24156 | /** Destroys the item. */
|
24157 | destroy(): void;
|
24158 | }
|
24159 | class Link<Views = void> extends Static<Views> {
|
24160 | |
24161 |
|
24162 |
|
24163 |
|
24164 |
|
24165 |
|
24166 |
|
24167 |
|
24168 |
|
24169 | constructor(
|
24170 | pStyle: IItemStyle,
|
24171 | sURL: string,
|
24172 | sLabel?: string,
|
24173 | sTarget?: "self" | "blank",
|
24174 | sId?: string,
|
24175 | fnTapped?: (pLink: Link<Views>) => void
|
24176 | );
|
24177 | /** Returns the element type for the item. */
|
24178 | get type(): string;
|
24179 | /** Retrieves the URL of the link. */
|
24180 | get URL(): string;
|
24181 | /** Sets the URL of the link. */
|
24182 | set URL(sURL: string);
|
24183 | /** Retrieves the target of the link. */
|
24184 | get target(): "self" | "blank";
|
24185 | /** Sets the target of the link. */
|
24186 | set target(sTarget: "self" | "blank");
|
24187 | /**
|
24188 | * Invoked when the state of a link changes.
|
24189 | * @event
|
24190 | */
|
24191 | protected onStateChange(): void;
|
24192 | /**
|
24193 | * Draws the item.
|
24194 | * @param pToolbar Reference to the toolbar.
|
24195 | * @param pElement Reference to the element to draw on.
|
24196 | * @param pLabel Reference to the label.
|
24197 | * @event
|
24198 | */
|
24199 | onDraw(pToolbar: Toolbar<Views>, pElement: Element, pLabel?: Element): void;
|
24200 | }
|
24201 |
|
24202 | export {
|
24203 | Button as ToolbarButton,
|
24204 | IItemStyle as IToolbarItemStyle,
|
24205 | IMenuStyle as IToolbarMenuStyle,
|
24206 | Item as ToolbarItem,
|
24207 | Link as ToolbarLink,
|
24208 | Menu as ToolbarMenu,
|
24209 | Static as ToolbarStatic,
|
24210 | };
|
24211 | }
|
24212 |
|
24213 | declare module "tripetto/module/ui-workspace" {
|
24214 | import { Stack } from "tripetto/module/functional";
|
24215 | import { Grid, GridCluster, GridClusters, GridNode, GridNodes, GridRenderer, IGridResource } from "tripetto/module/grid";
|
24216 | import { IHookPayload } from "tripetto/module/hookup";
|
24217 | import { ISerialize } from "tripetto/module/serializer";
|
24218 |
|
24219 | export interface ITileReference {
|
24220 | type: string;
|
24221 | data: string;
|
24222 | }
|
24223 | export interface ITile extends IGridResource {
|
24224 | readonly ref?: ITileReference & ISerialize;
|
24225 | }
|
24226 | export interface ICollection extends IGridResource {
|
24227 | readonly name: string;
|
24228 | readonly tiles: ITile[];
|
24229 | }
|
24230 | export interface ICollectionConstructor {
|
24231 | new (pCollections: Collections): Collection;
|
24232 | }
|
24233 | export interface ITileConstructor {
|
24234 | new (pTiles: Tiles): Tile;
|
24235 | }
|
24236 |
|
24237 | export class Tiles extends GridNodes<Tile> {
|
24238 | constructor(pTileConstructor: ITileConstructor, pCollection: Collection, nDimensions: number);
|
24239 |
|
24240 | /**
|
24241 | * Inserts a new tile.
|
24242 | * @return Returns the new tile.
|
24243 | */
|
24244 | append(): Tile;
|
24245 | /**
|
24246 | * Inserts a new tile.
|
24247 | * @return Returns the new tile.
|
24248 | */
|
24249 | insert(): Tile;
|
24250 | /**
|
24251 | * Inserts a new tile before the supplied tile.
|
24252 | * @param pTile Specifies the reference tile.
|
24253 | * @return Returns the new tile.
|
24254 | */
|
24255 | insertBefore(pTile: Tile): Tile;
|
24256 | /**
|
24257 | * Inserts a new tile after the supplied tile.
|
24258 | * @param pTile Specifies the reference tile.
|
24259 | * @return Returns the new tile.
|
24260 | */
|
24261 | insertAfter(pTile: Tile): Tile;
|
24262 | /**
|
24263 | * Deserializes the supplied serialized tiles to the tile dispatcher.
|
24264 | * @param pAfterwards Stack with calls which are invoked after the
|
24265 | * structural deserialization is done.
|
24266 | * @param pTiles Specifies the tiles.
|
24267 | * @return Returns a reference to the instance.
|
24268 | */
|
24269 | deserialize(pAfterwards: Stack, ...pTiles: ITile[]): this;
|
24270 | }
|
24271 | export interface IWorkspace extends IGridResource {
|
24272 |
|
24273 | readonly name: string;
|
24274 |
|
24275 | readonly collections: ICollection[];
|
24276 | }
|
24277 |
|
24278 | export class Workspace extends Grid<Collections, Tile, "OnChange" | "OnRename"> {
|
24279 | |
24280 |
|
24281 |
|
24282 |
|
24283 | onChanged?: (pWorkspace: Workspace) => void;
|
24284 | |
24285 |
|
24286 |
|
24287 |
|
24288 |
|
24289 | static create(pRenderer: GridRenderer<Workspace, Workspace | Collection | Tile>): Workspace;
|
24290 | |
24291 |
|
24292 |
|
24293 |
|
24294 |
|
24295 | constructor(pRenderer: GridRenderer<Workspace, Workspace | Collection | Tile>);
|
24296 | /** Retrieves the collections. */
|
24297 | get collections(): Collections;
|
24298 | /** Retrieves the name. */
|
24299 | get name(): string;
|
24300 | /** Sets the name. */
|
24301 | set name(sName: string);
|
24302 | /** Marks the workspace as changed. */
|
24303 | detectChange(): this;
|
24304 | /**
|
24305 | * Generates a serialized representation of a workspace.
|
24306 | * @return Returns a reference to the serialized workspace.
|
24307 | */
|
24308 | serialize(): IWorkspace;
|
24309 | /**
|
24310 | * Deserializes to a workspace.
|
24311 | * @param pWorkspace Specifies the serialized workspace.
|
24312 | * @return Returns a reference to the instance.
|
24313 | */
|
24314 | deserialize(pWorkspace: IWorkspace): this;
|
24315 | /**
|
24316 | * Loads a workspace.
|
24317 | * @param pWorkspace Specifies the workspace data to load.
|
24318 | * @return Returns a reference to the instance.
|
24319 | */
|
24320 | load(pWorkspace: IWorkspace): this;
|
24321 | /** Saves a workspace. */
|
24322 | save(): IWorkspace;
|
24323 | /** Destroys the workspace. */
|
24324 | destroy(): void;
|
24325 | }
|
24326 | export class Tile extends GridNode {
|
24327 | |
24328 |
|
24329 |
|
24330 |
|
24331 | constructor(pTiles: Tiles, pRef?: ITileReference);
|
24332 | /** Retrieves the parent tiles dispatcher. */
|
24333 | //@ts-ignore
|
24334 | get parent(): Tiles | undefined;
|
24335 | /** Retrieves the workspace. */
|
24336 | get workspace(): Workspace | undefined;
|
24337 | /** Retrieves the collection. */
|
24338 | get collection(): Collection | undefined;
|
24339 | /** Retrieves the tile reference. */
|
24340 | get ref(): ITileReference | undefined;
|
24341 | /** Sets the tile reference. */
|
24342 | set ref(pRef: ITileReference | undefined);
|
24343 | /**
|
24344 | * Generates a serialized representation of a tile.
|
24345 | * @return Returns a reference to the serialized tile.
|
24346 | */
|
24347 | serialize(): ITile;
|
24348 | /**
|
24349 | * Deserializes to a tile.
|
24350 | * @param pTile Contains the serialized tile.
|
24351 | * @param pAfterwards Stack with calls which are invoked after the
|
24352 | * structural deserialization is done.
|
24353 | * @return Returns a reference to the instance.
|
24354 | */
|
24355 | deserialize(pTile: ITile, pAfterwards: Stack): this;
|
24356 | /** Deletes this tile from the workspace. */
|
24357 | delete(): this;
|
24358 | }
|
24359 | //@ts-ignore
|
24360 | export class Collections extends GridClusters<Collection, Tile> {
|
24361 | constructor(pCollectionConstructor: ICollectionConstructor, pWorkspace: Workspace);
|
24362 | /**
|
24363 | * Appends a new collection.
|
24364 | * @return Returns the new collection.
|
24365 | */
|
24366 | append(): Collection;
|
24367 | /**
|
24368 | * Inserts a new collection.
|
24369 | * @return Returns the new collection.
|
24370 | */
|
24371 | insert(): Collection;
|
24372 | /**
|
24373 | * Inserts a new collection before the supplied collection.
|
24374 | * @param pCollection Specifies the reference collection.
|
24375 | * @return Returns the new collection.
|
24376 | */
|
24377 | insertBefore(pCollection: Collection): Collection;
|
24378 | /**
|
24379 | * Inserts a new collection after the supplied collection.
|
24380 | * @param pCollection Specifies the reference collection.
|
24381 | * @return Returns the new branch.
|
24382 | */
|
24383 | insertAfter(pCollection: Collection): Collection;
|
24384 | /**
|
24385 | * Deserializes the supplied serialized collections to the collection dispatcher.
|
24386 | * @param pAfterwards Stack with calls which are invoked after the
|
24387 | * structural deserialization is done.
|
24388 | * @param pCollections Specifies the collections.
|
24389 | * @return Returns a reference to the instance.
|
24390 | */
|
24391 | deserialize(pAfterwards: Stack, ...pCollections: ICollection[]): this;
|
24392 | }
|
24393 | //@ts-ignore
|
24394 | export class Collection extends GridCluster<Tiles, Tile> {
|
24395 | |
24396 |
|
24397 |
|
24398 |
|
24399 | constructor(pCollections: Collections);
|
24400 | /** Retrieves the parent collections dispatcher. */
|
24401 | //@ts-ignore
|
24402 | get parent(): Collections | undefined;
|
24403 | /** Retrieves the workspace. */
|
24404 | get workspace(): Workspace | undefined;
|
24405 | /** Retrieves the tiles. */
|
24406 | get tiles(): Tiles;
|
24407 | /** Retrieves the collection name. */
|
24408 | get name(): string;
|
24409 | /** Sets the collection name. */
|
24410 | set name(sName: string);
|
24411 | /**
|
24412 | * Invokes when a tile is pushed or popped.
|
24413 | * @event
|
24414 | */
|
24415 | onPushOrPop(): void;
|
24416 | /**
|
24417 | * Generates a serialized representation of a collection.
|
24418 | * @return Returns a reference to the serialized collection.
|
24419 | */
|
24420 | serialize(): ICollection;
|
24421 | /**
|
24422 | * Deserializes to a collection.
|
24423 | * @param pCollection Contains the serialized collection.
|
24424 | * @param pAfterwards Stack with calls which are invoked after the
|
24425 | * structural deserialization is done.
|
24426 | * @return Returns a reference to the instance.
|
24427 | */
|
24428 | deserialize(pCollection: ICollection, pAfterwards: Stack): this;
|
24429 | /** Deletes this collection from the workspace. */
|
24430 | delete(): this;
|
24431 | }
|
24432 | export interface IWorkspaceChangeEvent extends IHookPayload<"OnChange"> {
|
24433 | workspace: Workspace;
|
24434 | }
|
24435 | export interface IWorkspaceRenameEvent extends IHookPayload<"OnRename"> {
|
24436 | workspace: Workspace;
|
24437 | }
|
24438 | }
|
24439 |
|
24440 | declare module "tripetto/module/ui-zoombar" {
|
24441 | import { IStyles, Stylesheet } from "tripetto/module/dom";
|
24442 | import { Scroll } from "tripetto/module/touch-scroll";
|
24443 | import { Layer, LayerComponent, LayerConfiguration } from "tripetto/module/ui-layers";
|
24444 |
|
24445 |
|
24446 | export interface IZoombarStyle {
|
24447 |
|
24448 | width: number;
|
24449 |
|
24450 | height: number;
|
24451 |
|
24452 | appearance?: IStyles;
|
24453 |
|
24454 | hover?: IStyles;
|
24455 |
|
24456 | crawl?: IStyles;
|
24457 |
|
24458 | track: {
|
24459 |
|
24460 | width: number;
|
24461 |
|
24462 | height: number;
|
24463 |
|
24464 | upper?: {
|
24465 |
|
24466 | offset?: number;
|
24467 |
|
24468 | appearance: IStyles;
|
24469 |
|
24470 | crawl?: IStyles;
|
24471 | };
|
24472 |
|
24473 | lower?: {
|
24474 |
|
24475 | offset?: number;
|
24476 |
|
24477 | appearance: IStyles;
|
24478 |
|
24479 | crawl?: IStyles;
|
24480 | };
|
24481 | };
|
24482 |
|
24483 | thumb: {
|
24484 |
|
24485 | width: number;
|
24486 |
|
24487 | height: number;
|
24488 |
|
24489 | appearance: IStyles;
|
24490 |
|
24491 | hover?: IStyles;
|
24492 |
|
24493 | grab?: IStyles;
|
24494 |
|
24495 | buttons?: {
|
24496 |
|
24497 | max?: {
|
24498 |
|
24499 | appearance: IStyles;
|
24500 |
|
24501 | hover?: IStyles;
|
24502 |
|
24503 | disabled?: IStyles;
|
24504 | };
|
24505 |
|
24506 | fit?: {
|
24507 |
|
24508 | appearance: IStyles;
|
24509 |
|
24510 | hover?: IStyles;
|
24511 |
|
24512 | disabled?: IStyles;
|
24513 | };
|
24514 |
|
24515 | min?: {
|
24516 |
|
24517 | appearance: IStyles;
|
24518 |
|
24519 | hover?: IStyles;
|
24520 |
|
24521 | disabled?: IStyles;
|
24522 | };
|
24523 | };
|
24524 | };
|
24525 |
|
24526 | zoomIn?: {
|
24527 |
|
24528 | width: number;
|
24529 |
|
24530 | height: number;
|
24531 |
|
24532 | appearance: IStyles;
|
24533 |
|
24534 | hover?: IStyles;
|
24535 |
|
24536 | crawl?: IStyles;
|
24537 |
|
24538 | disabled?: IStyles;
|
24539 | };
|
24540 |
|
24541 | zoomOut?: {
|
24542 |
|
24543 | width: number;
|
24544 |
|
24545 | height: number;
|
24546 |
|
24547 | appearance: IStyles;
|
24548 |
|
24549 | hover?: IStyles;
|
24550 |
|
24551 | crawl?: IStyles;
|
24552 |
|
24553 | disabled?: IStyles;
|
24554 | };
|
24555 | }
|
24556 |
|
24557 | export interface IZoombarProperties {
|
24558 | |
24559 |
|
24560 |
|
24561 |
|
24562 | stylesheet?: Stylesheet;
|
24563 |
|
24564 | style?: IZoombarStyle;
|
24565 |
|
24566 | layer?: Layer;
|
24567 |
|
24568 | target?: Scroll | Layer;
|
24569 | }
|
24570 | export class Zoombar {
|
24571 |
|
24572 | static stylesheet: Stylesheet;
|
24573 |
|
24574 | static style: IZoombarStyle | undefined;
|
24575 |
|
24576 | |
24577 |
|
24578 |
|
24579 |
|
24580 |
|
24581 |
|
24582 | static create(...pPropertiesList: IZoombarProperties[]): Zoombar;
|
24583 | |
24584 |
|
24585 |
|
24586 |
|
24587 |
|
24588 |
|
24589 | constructor(...pPropertiesList: IZoombarProperties[]);
|
24590 |
|
24591 | /** Retrieves a reference to the stylesheet. */
|
24592 | get stylesheet(): Stylesheet;
|
24593 | /** Retrieves if the zoombar is visible. */
|
24594 | get isVisible(): boolean;
|
24595 | /** Specifies if the zoombar is visible. */
|
24596 | set isVisible(bVisible: boolean);
|
24597 | }
|
24598 | export class ZoombarComponent extends LayerComponent {
|
24599 | |
24600 |
|
24601 |
|
24602 |
|
24603 |
|
24604 | constructor(pProperties: IZoombarProperties, pConfiguration?: LayerConfiguration);
|
24605 | /** Retrieves a reference to the zoombar. */
|
24606 | get zoombar(): Zoombar;
|
24607 | /** Renders the component. */
|
24608 | protected onRender(): void;
|
24609 | }
|
24610 | }
|
24611 |
|
24612 | declare module "tripetto/module/contracts" {
|
24613 | import { TTranslation } from "tripetto/module/l10n";
|
24614 |
|
24615 | export interface IContract {
|
24616 |
|
24617 | readonly contract?: {
|
24618 |
|
24619 | readonly name: string;
|
24620 |
|
24621 | readonly version: string;
|
24622 | };
|
24623 | }
|
24624 | export interface IL10nContract {
|
24625 |
|
24626 | readonly availableTranslations?: string[];
|
24627 |
|
24628 | readonly customLocale?: boolean;
|
24629 |
|
24630 | readonly strings?: (string | [string, string])[];
|
24631 | }
|
24632 | export interface IL10n {
|
24633 |
|
24634 | readonly language?: "auto" | string;
|
24635 |
|
24636 | readonly locale?: "auto" | string;
|
24637 |
|
24638 | readonly translations?: TTranslation | TTranslation[];
|
24639 | }
|
24640 | export type TL10nContract = IContract & IL10nContract;
|
24641 | export type TL10n = IContract & IL10n;
|
24642 | export interface IStyleDependencyObserver {
|
24643 |
|
24644 | readonly property: string;
|
24645 |
|
24646 | readonly value?: string | string[] | number | number[] | boolean | boolean[];
|
24647 |
|
24648 | readonly defined?: boolean;
|
24649 | }
|
24650 | export interface IStyleDependency {
|
24651 |
|
24652 | readonly observe: IStyleDependencyObserver | IStyleDependencyObserver[];
|
24653 |
|
24654 | readonly action: "enable" | "disable" | "show" | "hide";
|
24655 | }
|
24656 | export type TStyleTiers = "standard" | "premium";
|
24657 | export interface IStyleStatic<Type extends string> {
|
24658 |
|
24659 | readonly type: Type;
|
24660 |
|
24661 | readonly dependency?: IStyleDependency;
|
24662 |
|
24663 | readonly label?: string;
|
24664 |
|
24665 | readonly description?: string;
|
24666 |
|
24667 | readonly tier?: TStyleTiers;
|
24668 | }
|
24669 | export interface IStyleElement<Type extends string, T> extends IStyleStatic<Type> {
|
24670 |
|
24671 | readonly name: string;
|
24672 |
|
24673 | readonly default?: T;
|
24674 | }
|
24675 | export type TStyleDropdownOption =
|
24676 | | {
|
24677 |
|
24678 | readonly label: string;
|
24679 |
|
24680 | readonly value: string | number;
|
24681 | }
|
24682 | | {
|
24683 |
|
24684 | readonly optGroup: string;
|
24685 | }
|
24686 | | {
|
24687 |
|
24688 | readonly custom: string;
|
24689 | };
|
24690 | export interface IStyleDropdown extends IStyleElement<"dropdown", string> {
|
24691 |
|
24692 | readonly options: TStyleDropdownOption[];
|
24693 |
|
24694 | readonly width?: number | "auto" | "full";
|
24695 | }
|
24696 | export interface IStyleRadiobutton {
|
24697 |
|
24698 | readonly label: string;
|
24699 |
|
24700 | readonly value: string | number;
|
24701 |
|
24702 | readonly description?: string;
|
24703 | }
|
24704 | export interface IStyleRadiobuttons extends IStyleElement<"radiobuttons", string> {
|
24705 |
|
24706 | readonly buttons: IStyleRadiobutton[];
|
24707 | }
|
24708 | export interface IStyleNumber extends IStyleElement<"number", number> {
|
24709 |
|
24710 | readonly prefix?: string;
|
24711 |
|
24712 | readonly suffix?: string;
|
24713 |
|
24714 | readonly min?: number;
|
24715 |
|
24716 | readonly max?: number;
|
24717 |
|
24718 | readonly width?: number;
|
24719 | }
|
24720 | export type TStyleElement =
|
24721 | | IStyleStatic<"static">
|
24722 | | IStyleElement<"label" | "color" | "image", string>
|
24723 | | IStyleElement<"checkbox", boolean>
|
24724 | | IStyleNumber
|
24725 | | IStyleDropdown
|
24726 | | IStyleRadiobuttons;
|
24727 | export interface IStyleCollectionBase {
|
24728 |
|
24729 | readonly description?: string;
|
24730 |
|
24731 | readonly name?: string;
|
24732 |
|
24733 | readonly dependency?: IStyleDependency;
|
24734 |
|
24735 | readonly tier?: TStyleTiers;
|
24736 |
|
24737 | readonly elements: TStyleElement[];
|
24738 | }
|
24739 | export interface IStyleCollection extends IStyleCollectionBase {
|
24740 |
|
24741 | readonly title?: string;
|
24742 |
|
24743 | readonly optional?: false;
|
24744 |
|
24745 | readonly additional?: boolean;
|
24746 | }
|
24747 | export interface IStyleCollectionOptional extends IStyleCollectionBase {
|
24748 |
|
24749 | readonly title: string;
|
24750 |
|
24751 | readonly optional: true;
|
24752 |
|
24753 | readonly additional?: undefined | false;
|
24754 | }
|
24755 | export interface IStylesContract {
|
24756 |
|
24757 | readonly styles: (IStyleCollection | IStyleCollectionOptional)[];
|
24758 | }
|
24759 | export interface IStylesProperties {
|
24760 | readonly [property: string]: string | number | boolean | IStylesProperties | undefined;
|
24761 | }
|
24762 | export type TStylesContract = IContract & IStylesContract;
|
24763 | export type TStyles = IContract & IStylesProperties;
|
24764 | export interface IThemeContract<T extends TStyles = TStyles> {
|
24765 |
|
24766 | readonly name: string;
|
24767 |
|
24768 | readonly description?: string;
|
24769 |
|
24770 | readonly preview?: string;
|
24771 |
|
24772 | readonly styles: T;
|
24773 | }
|
24774 | export type TThemesContract<T extends TStyles = TStyles> = IThemeContract<T>[];
|
24775 | }
|
24776 |
|
24777 | declare module "tripetto/module/map" {
|
24778 | import { Stack, TAny } from "tripetto/module/functional";
|
24779 | import {
|
24780 | Grid,
|
24781 | GridBranch,
|
24782 | GridBranches,
|
24783 | GridCluster,
|
24784 | GridClusters,
|
24785 | GridNode,
|
24786 | GridNodes,
|
24787 | GridRenderer,
|
24788 | IGridResource,
|
24789 | } from "tripetto/module/grid";
|
24790 | import { IHookPayload } from "tripetto/module/hookup";
|
24791 | import { MarkdownParser } from "tripetto/module/markdown";
|
24792 | import { IItemChangeEvent, IItemPopEvent } from "tripetto/module/matrix";
|
24793 | import { IPoint } from "tripetto/module/metrics";
|
24794 | import { ISerialize } from "tripetto/module/serializer";
|
24795 | import { ISlot, Slot, Slots } from "tripetto/module/slots";
|
24796 |
|
24797 | export interface INodeBlock extends ISerialize {
|
24798 |
|
24799 | readonly type: string;
|
24800 |
|
24801 | readonly version: string;
|
24802 | }
|
24803 | export interface INodeBlockCache {
|
24804 | readonly timestamp: number;
|
24805 | readonly block: INodeBlock;
|
24806 | readonly slots?: ISlot[];
|
24807 | }
|
24808 | export interface INode extends IGridResource {
|
24809 | readonly block?: INodeBlock;
|
24810 | readonly slots?: ISlot[];
|
24811 | readonly disabled?: boolean;
|
24812 | readonly name?: string;
|
24813 | readonly nameVisible?: boolean;
|
24814 | readonly placeholder?: string;
|
24815 | readonly description?: string;
|
24816 | readonly explanation?: string;
|
24817 | }
|
24818 | export abstract class NodeBlock {
|
24819 |
|
24820 | static readonly identifier: string;
|
24821 |
|
24822 | static readonly version: string;
|
24823 |
|
24824 | static readonly kind: "headless" | "ui";
|
24825 |
|
24826 | static readonly _: () => string;
|
24827 |
|
24828 | static readonly flag: (sFlag: string) => boolean;
|
24829 |
|
24830 | static get label(): string;
|
24831 |
|
24832 | static exchanger?: (pSrc: {}[], pDest: {}) => void;
|
24833 |
|
24834 |
|
24835 | readonly type: INodeBlockType<NodeBlock>;
|
24836 |
|
24837 | readonly allowMarkdown?: boolean;
|
24838 | |
24839 |
|
24840 |
|
24841 |
|
24842 |
|
24843 |
|
24844 |
|
24845 | static create<Block extends NodeBlock>(
|
24846 | pBlock: INodeBlockType<Block> | Block | string,
|
24847 | pNode: Node,
|
24848 | sType?: "existing" | "proxy"
|
24849 | ): Block | undefined;
|
24850 | |
24851 |
|
24852 |
|
24853 |
|
24854 | constructor(pNode: Node);
|
24855 | /** Retrieves the identifier of the node. */
|
24856 | get id(): string;
|
24857 | /** Retrieves the parent map. */
|
24858 | get map(): Map | undefined;
|
24859 | /** Retrieves a reference to the node. */
|
24860 | get node(): Node;
|
24861 | /** Retrieves a reference to the slots. */
|
24862 | get slots(): Slots;
|
24863 | /** Retrieves the label of the node block. */
|
24864 | get label(): string;
|
24865 | /** Retrieves if the block is initialized. */
|
24866 | get isInitialized(): boolean;
|
24867 |
|
24868 | /**
|
24869 | * The block is assigned to a node.
|
24870 | * @param pPrevious Reference to the previous block that was attached to the node.
|
24871 | * @return Returns an initialization function.
|
24872 | */
|
24873 | assignedToNode(pPrevious?: NodeBlock): () => void;
|
24874 | /** The block is unassigned from the node. */
|
24875 | unassignedFromNode(): INodeBlockCache;
|
24876 | /** Marks a change in the block. */
|
24877 | detectChange(): void;
|
24878 | /**
|
24879 | * Rerenders the block.
|
24880 | * @param bShouldRerender Specifies if the node should rerender.
|
24881 | * @event
|
24882 | */
|
24883 | rerender(bShouldRerender?: boolean): void;
|
24884 | /**
|
24885 | * Serializes a block.
|
24886 | * @param pProperties Specifies additional serialized properties.
|
24887 | * @return Returns a reference to the serialized block.
|
24888 | */
|
24889 | serialize(pProperties?: ISerialize): INodeBlock;
|
24890 | /**
|
24891 | * Deserializes to a block instance.
|
24892 | * @param pBlock Contains the serialized block.
|
24893 | * @param pAfterwards Stack with calls which are invoked after the
|
24894 | * structural deserialization is done.
|
24895 | * @return Returns a reference to the instance.
|
24896 | */
|
24897 | deserialize(pBlock: INodeBlock, pAfterwards?: Stack): this;
|
24898 | /** Destroys the block. */
|
24899 | destroy(): void;
|
24900 | }
|
24901 | export type TNodeEvents = "OnBlockAssign" | "OnBlockUnassign" | "OnBlockChange" | "OnTypeChange" | "OnRename" | "OnDisable";
|
24902 | export interface INodeBlockAssignEvent extends IHookPayload<"OnBlockAssign"> {
|
24903 | readonly node: Node;
|
24904 | readonly block: NodeBlock;
|
24905 | }
|
24906 | export interface INodeBlockUnassignEvent extends IHookPayload<"OnBlockUnassign"> {
|
24907 | readonly node: Node;
|
24908 | readonly block: NodeBlock;
|
24909 | }
|
24910 | export interface INodeBlockChangeEvent extends IHookPayload<"OnBlockChange"> {
|
24911 | readonly node: Node;
|
24912 | readonly block: NodeBlock | undefined;
|
24913 | }
|
24914 | export interface INodeConstructor {
|
24915 | new (pNodes: Nodes): Node;
|
24916 | }
|
24917 |
|
24918 | export class Nodes extends GridNodes<Node> {
|
24919 | constructor(pNodeConstructor: INodeConstructor, pCluster: Cluster);
|
24920 | /** Retrieves the cluster of the node dispatcher. */
|
24921 | get cluster(): Cluster;
|
24922 | /**
|
24923 | * Invoked when the nodes dimensions are changed.
|
24924 | * @event
|
24925 | */
|
24926 | onDimensions(): void;
|
24927 | /**
|
24928 | * Inserts a new node.
|
24929 | * @return Returns the new node.
|
24930 | */
|
24931 | append(): Node;
|
24932 | /**
|
24933 | * Inserts a new node.
|
24934 | * @return Returns the new node.
|
24935 | */
|
24936 | insert(): Node;
|
24937 | /**
|
24938 | * Inserts a new node before the supplied node.
|
24939 | * @param pNode Specifies the reference node.
|
24940 | * @return Returns the new node.
|
24941 | */
|
24942 | insertBefore(pNode: Node): Node;
|
24943 | /**
|
24944 | * Inserts a new node after the supplied node.
|
24945 | * @param pNode Specifies the reference node.
|
24946 | * @return Returns the new node.
|
24947 | */
|
24948 | insertAfter(pNode: Node): Node;
|
24949 | /**
|
24950 | * Deserializes the supplied serialized nodes to the node dispatcher.
|
24951 | * @param pAfterwards Stack with calls which are invoked after the
|
24952 | * structural deserialization is done.
|
24953 | * @param pNodes Specifies the nodes.
|
24954 | * @return Returns a reference to the instance.
|
24955 | */
|
24956 | deserialize(pAfterwards: Stack, ...pNodes: INode[]): this;
|
24957 | }
|
24958 | export interface IVariable {
|
24959 |
|
24960 | key: string;
|
24961 |
|
24962 | label: string;
|
24963 |
|
24964 | node: Node;
|
24965 |
|
24966 | block?: NodeBlock;
|
24967 |
|
24968 | slot?: Slot;
|
24969 |
|
24970 | pipe?: Slot;
|
24971 | }
|
24972 | |
24973 |
|
24974 |
|
24975 |
|
24976 |
|
24977 | export const lookupVariable: (pRef: Node | NodeBlock | Condition | ConditionBlock, sKey: string) => IVariable | undefined;
|
24978 | |
24979 |
|
24980 |
|
24981 |
|
24982 |
|
24983 | export const parseVariables: (pRef: Node | NodeBlock | Condition | ConditionBlock) => {
|
24984 | numberOfChars: number;
|
24985 | parser: (sKey: string) =>
|
24986 | | {
|
24987 | shift: number;
|
24988 | markdown: string;
|
24989 | value: IVariable | undefined;
|
24990 | }
|
24991 | | undefined;
|
24992 | };
|
24993 | export type TNodeType = "undefined" | "static" | "note" | "error" | TNodeBlock;
|
24994 | export class Node extends GridNode<TNodeEvents> {
|
24995 |
|
24996 | explanation?: string;
|
24997 |
|
24998 | get id(): string;
|
24999 |
|
25000 |
|
25001 | get parent(): Nodes | undefined;
|
25002 |
|
25003 | get predecessor(): Node | undefined;
|
25004 |
|
25005 | get successor(): Node | undefined;
|
25006 |
|
25007 | get map(): Map | undefined;
|
25008 |
|
25009 | get cluster(): Cluster | undefined;
|
25010 |
|
25011 | get block(): NodeBlock | undefined;
|
25012 |
|
25013 | get blockTypeIdentifier(): string;
|
25014 |
|
25015 | get hasBlock(): boolean;
|
25016 |
|
25017 | get isBlockInvalid(): boolean;
|
25018 |
|
25019 | get disabled(): boolean | undefined;
|
25020 |
|
25021 | set disabled(bDisabled: boolean | undefined);
|
25022 |
|
25023 | get type(): TNodeType;
|
25024 |
|
25025 | get name(): string | undefined;
|
25026 |
|
25027 | set name(sName: string | undefined);
|
25028 |
|
25029 | get nameVisible(): boolean | undefined;
|
25030 |
|
25031 | set nameVisible(bNameVisible: boolean | undefined);
|
25032 |
|
25033 | get placeholder(): string | undefined;
|
25034 |
|
25035 | set placeholder(sPlaceholder: string | undefined);
|
25036 |
|
25037 | get labelRaw(): string;
|
25038 |
|
25039 | get labelMarkdown(): MarkdownParser<IVariable>;
|
25040 | |
25041 |
|
25042 |
|
25043 |
|
25044 | get label(): string;
|
25045 |
|
25046 | get alias(): string | undefined;
|
25047 |
|
25048 | get description(): string | undefined;
|
25049 |
|
25050 | set description(sDescription: string | undefined);
|
25051 |
|
25052 | |
25053 |
|
25054 |
|
25055 |
|
25056 |
|
25057 | protected onChange(pEvent: IItemChangeEvent<this>): void;
|
25058 | |
25059 |
|
25060 |
|
25061 |
|
25062 |
|
25063 |
|
25064 | resize(nWidth?: number, nHeight?: number): boolean;
|
25065 | |
25066 |
|
25067 |
|
25068 |
|
25069 | zIndex(): boolean;
|
25070 | |
25071 |
|
25072 |
|
25073 |
|
25074 |
|
25075 | assignBlock<T extends NodeBlock>(pBlock: INodeBlockType<T> | T): T | undefined;
|
25076 | |
25077 |
|
25078 |
|
25079 |
|
25080 |
|
25081 | unassignBlock(): NodeBlock | undefined;
|
25082 | |
25083 |
|
25084 |
|
25085 |
|
25086 | serialize(): INode;
|
25087 | |
25088 |
|
25089 |
|
25090 |
|
25091 |
|
25092 |
|
25093 |
|
25094 | deserialize(pNode: INode, pAfterwards?: Stack): this;
|
25095 | |
25096 |
|
25097 |
|
25098 |
|
25099 |
|
25100 |
|
25101 | slot<S extends Slot>(sReference: string, pBlockTypeIdentifier?: string | TNodeBlock): S | undefined;
|
25102 |
|
25103 | refresh(): this;
|
25104 |
|
25105 | refreshed(): this;
|
25106 | |
25107 |
|
25108 |
|
25109 |
|
25110 | insertBefore(): Node;
|
25111 | |
25112 |
|
25113 |
|
25114 |
|
25115 | insertAfter(): Node;
|
25116 |
|
25117 | enable(): this;
|
25118 |
|
25119 | disable(): this;
|
25120 | |
25121 |
|
25122 |
|
25123 |
|
25124 |
|
25125 | duplicate(pDest?: Node): Node;
|
25126 |
|
25127 | delete(): this;
|
25128 |
|
25129 | destroy(): void;
|
25130 | }
|
25131 | export interface INodeBlockType<T extends NodeBlock> {
|
25132 |
|
25133 | readonly identifier: string;
|
25134 |
|
25135 | readonly label: string;
|
25136 |
|
25137 | readonly version: string;
|
25138 |
|
25139 | readonly kind: "headless" | "ui";
|
25140 |
|
25141 | readonly _: () => string;
|
25142 |
|
25143 | readonly flag: (sFlag: string) => boolean;
|
25144 | |
25145 |
|
25146 |
|
25147 |
|
25148 | new (pNode: Node): T;
|
25149 | }
|
25150 | export type TNodeBlock<T extends NodeBlock = NodeBlock> = INodeBlockType<T>;
|
25151 | export type TConditionBlockContext = "*" | "cluster" | "branch" | "node" | TNodeBlock;
|
25152 | export interface IConditionBlockType<T extends ConditionBlock> {
|
25153 |
|
25154 | readonly identifier: string;
|
25155 |
|
25156 | readonly label: string;
|
25157 |
|
25158 | readonly version: string;
|
25159 |
|
25160 | readonly context: TConditionBlockContext;
|
25161 |
|
25162 | readonly _: () => string;
|
25163 |
|
25164 | readonly flag: (sFlag: string) => boolean;
|
25165 | |
25166 |
|
25167 |
|
25168 |
|
25169 | new (pCondition: Condition): T;
|
25170 | }
|
25171 | export type TConditionBlock<T extends ConditionBlock = ConditionBlock> = IConditionBlockType<T>;
|
25172 | export interface IConditionBlock extends ISerialize {
|
25173 |
|
25174 | readonly type: string;
|
25175 |
|
25176 | readonly version: string;
|
25177 |
|
25178 | readonly branch?: string;
|
25179 |
|
25180 | readonly cluster?: string;
|
25181 |
|
25182 | readonly node?: string;
|
25183 |
|
25184 | readonly slot?: string;
|
25185 | }
|
25186 | class Labels {
|
25187 | constructor(pBlock: ConditionBlock);
|
25188 | /** Retrieves the branch label (if the branch is present). */
|
25189 | get branch(): string;
|
25190 | /** Retrieves the branch label (if the branch is present and an orphan). */
|
25191 | get branchOrphan(): string;
|
25192 | /** Retrieves the cluster label (if the cluster is present). */
|
25193 | get cluster(): string;
|
25194 | /** Retrieves the cluster label (if the cluster is present and an orphan). */
|
25195 | get clusterOrphan(): string;
|
25196 | /** Retrieves the node label (if the node is present). */
|
25197 | get node(): string;
|
25198 | /** Retrieves the node label (if the node is present and an orphan). */
|
25199 | get nodeOrphan(): string;
|
25200 | }
|
25201 | export abstract class ConditionBlock {
|
25202 |
|
25203 | static readonly identifier: string;
|
25204 |
|
25205 | static readonly version: string;
|
25206 |
|
25207 | static readonly context: TConditionBlockContext;
|
25208 |
|
25209 | static readonly _: () => string;
|
25210 |
|
25211 | static readonly flag: (sFlag: string) => boolean;
|
25212 |
|
25213 | static get label(): string;
|
25214 |
|
25215 |
|
25216 | readonly type: IConditionBlockType<ConditionBlock>;
|
25217 |
|
25218 | readonly allowMarkdown?: boolean;
|
25219 |
|
25220 | branch?: Branch;
|
25221 |
|
25222 | cluster?: Cluster;
|
25223 |
|
25224 | node?: Node;
|
25225 |
|
25226 | slot?: Slot;
|
25227 | |
25228 |
|
25229 |
|
25230 |
|
25231 |
|
25232 |
|
25233 |
|
25234 | static create<Block extends ConditionBlock>(
|
25235 | pBlock: IConditionBlockType<Block> | Block | string,
|
25236 | pCondition: Condition,
|
25237 | bInitialize: boolean
|
25238 | ): Block | undefined;
|
25239 | |
25240 |
|
25241 |
|
25242 |
|
25243 | constructor(pCondition: Condition);
|
25244 | /** Retrieves the identifier of the condition. */
|
25245 | get id(): string;
|
25246 | /** Retrieves the parent map. */
|
25247 | get map(): Map | undefined;
|
25248 | /** Retrieves a reference to the condition. */
|
25249 | get condition(): Condition;
|
25250 | /** Retrieves if the block is initialized. */
|
25251 | get isInitialized(): boolean;
|
25252 | /** Retrieves the name of the condition block. */
|
25253 | get name(): string;
|
25254 | /**
|
25255 | * Retrieves the labels collection. This is a collection of labels that give
|
25256 | * context to the condition.
|
25257 | */
|
25258 | get labels(): Labels;
|
25259 | /**
|
25260 | * Retrieves the label of the condition block. This label contains additional
|
25261 | * context for the condition. For example, if a node is attached to the
|
25262 | * condition, the label will contain the name of that node. Otherwise, the
|
25263 | * name of the parent cluster will be used or the name of the parent branch.
|
25264 | */
|
25265 | get label(): string;
|
25266 |
|
25267 | /**
|
25268 | * Block is assigned to a condition.
|
25269 | * @param pPrevious Reference to the previous block that was attaced to the condition.
|
25270 | * @return Returns an initialization function.
|
25271 | */
|
25272 | assignedToCondition(pPrevious?: ConditionBlock): () => void;
|
25273 | /** Block is unassigned from the condition. */
|
25274 | unassignedFromCondition(): IConditionBlock;
|
25275 | /**
|
25276 | * Invoked when the block of a node is unassigned. This may affect the
|
25277 | * condition. This function verifies if the condition should be deleted.
|
25278 | * @param pBlock Reference to the node block that is unassigned.
|
25279 | * @return Should return `true` if the condition should be deleted.
|
25280 | */
|
25281 | shouldBeDeleted(pBlock: NodeBlock): boolean;
|
25282 | /** Marks a change in the block. */
|
25283 | detectChange(): void;
|
25284 | /**
|
25285 | * Rerenders the block.
|
25286 | * @param bShouldRerender Specifies if the condition should rerender.
|
25287 | * @event
|
25288 | */
|
25289 | rerender(bShouldRerender?: boolean): void;
|
25290 | /**
|
25291 | * Serializes a block.
|
25292 | * @param pProperties Specifies additional serialized properties.
|
25293 | * @return Returns a reference to the serialized block.
|
25294 | */
|
25295 | serialize(pProperties?: ISerialize): IConditionBlock;
|
25296 | /**
|
25297 | * Deserializes to a block instance.
|
25298 | * @param pBlock Contains the serialized block.
|
25299 | * @param pAfterwards Stack with calls which are invoked after the
|
25300 | * structural deserialization is done.
|
25301 | * @return Returns a reference to the instance.
|
25302 | */
|
25303 | deserialize(pBlock: IConditionBlock, pAfterwards?: Stack): this;
|
25304 | /**
|
25305 | * Deletes the condition.
|
25306 | * @param sProperty Optional property causing the removal.
|
25307 | */
|
25308 | delete(sProperty?: keyof this): void;
|
25309 | /** Destroys the block. */
|
25310 | destroy(): void;
|
25311 | }
|
25312 | export interface ICondition extends IGridResource {
|
25313 | readonly block?: IConditionBlock;
|
25314 | readonly disabled?: boolean;
|
25315 | }
|
25316 | export interface IConditionConstructor {
|
25317 | new (pConditions: Conditions): Condition;
|
25318 | }
|
25319 |
|
25320 | export class Conditions extends GridNodes<Condition> {
|
25321 | constructor(pConditionConstructor: IConditionConstructor, pBranch: Branch);
|
25322 | /** Retrieves the branch of the condition dispatcher. */
|
25323 | get branch(): Branch;
|
25324 | /**
|
25325 | * Invoked when the conditions dimensions are changed.
|
25326 | * @event
|
25327 | */
|
25328 | onDimensions(): void;
|
25329 | /**
|
25330 | * Appends a new condition.
|
25331 | * @return Returns the new condition.
|
25332 | */
|
25333 | append(): Condition;
|
25334 | /**
|
25335 | * Inserts a new condition.
|
25336 | * @return Returns the new condition.
|
25337 | */
|
25338 | insert(): Condition;
|
25339 | /**
|
25340 | * Inserts a new condition before the supplied condition.
|
25341 | * @param pCondition Specifies the reference condition.
|
25342 | * @return Returns the new condition.
|
25343 | */
|
25344 | insertBefore(pCondition: Condition): Condition;
|
25345 | /**
|
25346 | * Inserts a new condition after the supplied condition.
|
25347 | * @param pCondition Specifies the reference condition.
|
25348 | * @return Returns the new condition.
|
25349 | */
|
25350 | insertAfter(pCondition: Condition): Condition;
|
25351 | /**
|
25352 | * Deserializes the supplied serialized conditions to the condition dispatcher.
|
25353 | * @param pAfterwards Stack with calls which are invoked after the
|
25354 | * structural deserialization is done.
|
25355 | * @param pConditions Specifies the conditions.
|
25356 | * @return Returns a reference to the instance.
|
25357 | */
|
25358 | deserialize(pAfterwards: Stack, ...pConditions: ICondition[]): this;
|
25359 | }
|
25360 | export type TConditionEvents = "OnBlockAssign" | "OnBlockUnassign" | "OnBlockChange" | "OnRename" | "OnDisable";
|
25361 | export interface IConditionBlockAssignEvent extends IHookPayload<"OnBlockAssign"> {
|
25362 | readonly condition: Condition;
|
25363 | readonly block: ConditionBlock;
|
25364 | }
|
25365 | export interface IConditionBlockUnassignEvent extends IHookPayload<"OnBlockUnassign"> {
|
25366 | readonly condition: Condition;
|
25367 | readonly block: ConditionBlock;
|
25368 | }
|
25369 | export interface IConditionBlockChangeEvent extends IHookPayload<"OnBlockChange"> {
|
25370 | readonly condition: Condition;
|
25371 | readonly block: ConditionBlock | undefined;
|
25372 | }
|
25373 | export class Condition extends GridNode<TConditionEvents> {
|
25374 | |
25375 |
|
25376 |
|
25377 |
|
25378 | constructor(pConditions: Conditions);
|
25379 | /** Retrieves the identifier of the condition. */
|
25380 | get id(): string;
|
25381 | /** Retrieves the parent condition dispatcher. */
|
25382 | //@ts-ignore
|
25383 | get parent(): Conditions | undefined;
|
25384 | /** Retrieves the predecessor of the condition. */
|
25385 | get predecessor(): Condition | undefined;
|
25386 | /** Retrieves the successor of the condition. */
|
25387 | get successor(): Condition | undefined;
|
25388 | /** Retrieves the parent map. */
|
25389 | get map(): Map | undefined;
|
25390 | /** Retrieves the collection. */
|
25391 | get branch(): Branch | undefined;
|
25392 | /** Retrieves the parent cluster of the condition. */
|
25393 | get cluster(): Cluster | undefined;
|
25394 | /** Retrieves the block for the condition. */
|
25395 | get block(): ConditionBlock | undefined;
|
25396 | /** Retrieves the block type identifier as a string. */
|
25397 | get blockTypeIdentifier(): string;
|
25398 | /** Retrieves if the condition has a block. */
|
25399 | get hasBlock(): boolean;
|
25400 | /** Retrieves if the block is invalid. */
|
25401 | get isBlockInvalid(): boolean;
|
25402 | /** Retrieves if the condition is disabled. */
|
25403 | get disabled(): boolean | undefined;
|
25404 | /** Specifies if the condition is disabled. */
|
25405 | set disabled(bDisabled: boolean | undefined);
|
25406 | /** Retrieves the condition type. */
|
25407 | get type(): IConditionBlockType<ConditionBlock> | undefined;
|
25408 | /** Retrieves the condition name. */
|
25409 | get name(): string;
|
25410 | /** Retrieves a markdown instance for the name. */
|
25411 | get nameMarkdown(): MarkdownParser<IVariable>;
|
25412 | /** Retrieves the condition label. */
|
25413 | get label(): string;
|
25414 |
|
25415 | /**
|
25416 | * Fired when the condition is changed.
|
25417 | * @param pEvent Specifies the event payload.
|
25418 | * @event
|
25419 | */
|
25420 | protected onChange(pEvent: IItemChangeEvent<this>): void;
|
25421 | /**
|
25422 | * Fired when a condition move occurs.
|
25423 | * @param nMoveX Specifies the horizontal movement.
|
25424 | * @param nMoveY Specifies the vertical movement.
|
25425 | * @param pOffset Specifies the offset of the touch point.
|
25426 | * @event
|
25427 | */
|
25428 | onMove(nMoveX: number, nMoveY: number, pOffset: IPoint): void;
|
25429 | /**
|
25430 | * Invokes the condition layout renderer.
|
25431 | * @param sType Specifies the rerender type. Can be one of the following values:
|
25432 | * - `refresh`: Refresh the rendering;
|
25433 | * - `update`: Update the rendering.
|
25434 | */
|
25435 | rerender(sType: "refresh" | "update"): void;
|
25436 | /**
|
25437 | * Assigns a block to the condition.
|
25438 | * @param pBlock Specifies the block type.
|
25439 | * @return Returns a reference to the block instance.
|
25440 | */
|
25441 | assignBlock<T extends ConditionBlock>(pBlock: IConditionBlockType<T> | T): T | undefined;
|
25442 | /**
|
25443 | * Unassigns a block.
|
25444 | * @return Returns the previously assigned block or `undefined` if there
|
25445 | * was none.
|
25446 | */
|
25447 | unassignBlock(): ConditionBlock | undefined;
|
25448 | /**
|
25449 | * Generates a serialized representation of a condition.
|
25450 | * @return Returns a reference to the serialized condition.
|
25451 | */
|
25452 | serialize(): ICondition;
|
25453 | /**
|
25454 | * Deserializes to a condition.
|
25455 | * @param pCondition Contains the serialized condition.
|
25456 | * @param pAfterwards Stack with calls which are invoked after the
|
25457 | * structural deserialization is done.
|
25458 | * @return Returns a reference to the instance.
|
25459 | */
|
25460 | deserialize(pCondition: ICondition, pAfterwards?: Stack): this;
|
25461 | /** Refreshes the condition (this will rerender the condition and emit an `OnRename` event). */
|
25462 | refresh(): this;
|
25463 | /** Indicate the condition is refreshed (this will emit an `OnRename` event). */
|
25464 | refreshed(): this;
|
25465 | /**
|
25466 | * Inserts a new condition before this condition.
|
25467 | * @return Returns a reference to the new condition.
|
25468 | */
|
25469 | insertBefore(): Condition;
|
25470 | /**
|
25471 | * Inserts a new condition after this condition.
|
25472 | * @return Returns a reference to the new condition.
|
25473 | */
|
25474 | insertAfter(): Condition;
|
25475 | /** Enables the condition. */
|
25476 | enable(): this;
|
25477 | /** Disables the condition. */
|
25478 | disable(): this;
|
25479 | /**
|
25480 | * Duplicates the condition.
|
25481 | * @param pDest Specifies the destination condition. If omitted a new condition is inserted after this condition.
|
25482 | * @return Returns a reference to the new condition.
|
25483 | */
|
25484 | duplicate(pDest?: Condition): Condition;
|
25485 | /** Deletes this condition from the map. */
|
25486 | delete(): this;
|
25487 | /** Destroys the condition. */
|
25488 | destroy(): void;
|
25489 | }
|
25490 | export type TBranchCulling = "first" | "each" | "all" | "none";
|
25491 | export interface IEpilogue {
|
25492 | readonly title?: string;
|
25493 | readonly description?: string;
|
25494 | readonly image?: string;
|
25495 | readonly video?: string;
|
25496 | readonly button?: {
|
25497 | readonly label: string;
|
25498 | readonly url: string;
|
25499 | readonly target: "self" | "blank";
|
25500 | };
|
25501 | readonly repeatable?: boolean;
|
25502 | readonly redirectUrl?: string;
|
25503 | }
|
25504 | export interface IBranch extends IGridResource {
|
25505 | readonly conditions?: ICondition[];
|
25506 | readonly clusters?: ICluster[];
|
25507 | readonly culling?: TBranchCulling;
|
25508 | readonly jump?: string;
|
25509 | readonly name?: string;
|
25510 | readonly epilogue?: IEpilogue & ISerialize;
|
25511 | }
|
25512 | export interface ICluster extends IGridResource {
|
25513 | readonly branches?: IBranch[];
|
25514 | readonly nodes?: INode[];
|
25515 | readonly name?: string;
|
25516 | }
|
25517 | export interface IBuilder {
|
25518 |
|
25519 | readonly name: string;
|
25520 |
|
25521 | readonly version: string;
|
25522 | }
|
25523 | export interface IPrologue {
|
25524 | readonly title?: string;
|
25525 | readonly description?: string;
|
25526 | readonly image?: string;
|
25527 | readonly video?: string;
|
25528 | readonly button?: string;
|
25529 | }
|
25530 | export interface IDefinition {
|
25531 |
|
25532 | readonly clusters: ICluster[];
|
25533 |
|
25534 | readonly builder: IBuilder;
|
25535 |
|
25536 | readonly name?: string;
|
25537 |
|
25538 | readonly description?: string;
|
25539 |
|
25540 | readonly keywords?: string[];
|
25541 |
|
25542 | readonly language?: string;
|
25543 |
|
25544 | readonly prologue?: IPrologue;
|
25545 |
|
25546 | readonly epilogue?: IEpilogue;
|
25547 | |
25548 |
|
25549 |
|
25550 |
|
25551 | readonly preface?: IPrologue;
|
25552 | }
|
25553 |
|
25554 | export class Map extends Grid<Clusters, Node, "OnRename" | "OnChange" | "OnError"> {
|
25555 |
|
25556 | name?: string;
|
25557 |
|
25558 | description?: string;
|
25559 |
|
25560 | language?: string;
|
25561 |
|
25562 | keywords?: string[];
|
25563 |
|
25564 | prologue?: IPrologue;
|
25565 |
|
25566 | epilogue?: IEpilogue;
|
25567 | |
25568 |
|
25569 |
|
25570 |
|
25571 |
|
25572 |
|
25573 | static create(pRenderer?: GridRenderer<Map>, pBuilder?: IBuilder): Map;
|
25574 | |
25575 |
|
25576 |
|
25577 |
|
25578 |
|
25579 |
|
25580 | constructor(pRenderer?: GridRenderer<Map>, pBuilder?: IBuilder);
|
25581 | /** Retrieves information about the builder application. */
|
25582 | get application(): IBuilder;
|
25583 | /** Retrieves information about the builder used to create the definition. */
|
25584 | get builder(): IBuilder;
|
25585 | /** Retrieves the clusters. */
|
25586 | get clusters(): Clusters;
|
25587 | /** Retrieves the map definition. */
|
25588 | get definition(): IDefinition;
|
25589 | /** Sets the map definition. */
|
25590 | set definition(pMap: IDefinition);
|
25591 | /** Retrieves if the map is deserializing. */
|
25592 | get isDeserializing(): boolean;
|
25593 | /**
|
25594 | * Generates a serialized representation of a map.
|
25595 | * @return Returns a reference to the serialized map.
|
25596 | */
|
25597 | serialize(): IDefinition & IGridResource;
|
25598 | /**
|
25599 | * Deserializes to a map.
|
25600 | * @param pMap Specifies the serialized map.
|
25601 | * @return Returns a reference to the instance.
|
25602 | */
|
25603 | deserialize(pMap: IDefinition & IGridResource): this;
|
25604 | /**
|
25605 | * Iterate recursively through each item in the map.
|
25606 | * @param fnEach Callback which is invoked for each item.
|
25607 | * @param sType Specifies the type of items.
|
25608 | * @param pExclude Specifies an item that needs to be excluded from the iteration.
|
25609 | * @param bFromExcluded Specifies if the iteration should start when the excluded item is found.
|
25610 | * @return Returns `true` if the iteration was interrupted.
|
25611 | */
|
25612 | forEach(
|
25613 | fnItem:
|
25614 | | ((pItem: Branch, nDepth: number) => boolean | void)
|
25615 | | ((pItem: Cluster, nDepth: number) => boolean | void)
|
25616 | | ((pItem: Node, nDepth: number) => boolean | void)
|
25617 | | ((pItem: Condition, nDepth: number) => boolean | void)
|
25618 | | ((pItem: Branch | Cluster | Node | Condition, nDepth: number) => boolean | void),
|
25619 | sType?: "branches" | "clusters" | "nodes" | "conditions" | "all",
|
25620 | pExclude?: Branch | Cluster | Node | Condition,
|
25621 | bFromExcluded?: boolean
|
25622 | ): boolean;
|
25623 | /** Complete reload of the map. */
|
25624 | reload(): void;
|
25625 | /** Resets the map. */
|
25626 | reset(): void;
|
25627 | /** Destroys the map. */
|
25628 | destroy(): void;
|
25629 | }
|
25630 | export interface IClusterConstructor {
|
25631 | new (pClusters: Clusters): Cluster;
|
25632 | }
|
25633 |
|
25634 | export class Clusters extends GridClusters<Cluster, Node> {
|
25635 | constructor(pClusterConstructor: IClusterConstructor, pBranch: Branch);
|
25636 | /** Retrieves the map of the cluster dispatcher. */
|
25637 | get map(): Map | undefined;
|
25638 | /** Retrieves the branch of the cluster dispatcher. */
|
25639 | get branch(): Branch | Map | undefined;
|
25640 | /**
|
25641 | * Invoked when the cluster dimensions are changed.
|
25642 | * @event
|
25643 | */
|
25644 | onDimensions(): void;
|
25645 | /**
|
25646 | * Appends a new cluster.
|
25647 | * @return Returns the new cluster.
|
25648 | */
|
25649 | append(): Cluster;
|
25650 | /**
|
25651 | * Inserts a new cluster.
|
25652 | * @return Returns the new cluster.
|
25653 | */
|
25654 | insert(): Cluster;
|
25655 | /**
|
25656 | * Inserts a new cluster before the supplied cluster.
|
25657 | * @param pCluster Specifies the reference cluster.
|
25658 | * @return Returns the new cluster.
|
25659 | */
|
25660 | insertBefore(pCluster: Cluster): Cluster;
|
25661 | /**
|
25662 | * Inserts a new cluster after the supplied cluster.
|
25663 | * @param pCluster Specifies the reference cluster.
|
25664 | * @return Returns the new branch.
|
25665 | */
|
25666 | insertAfter(pCluster: Cluster): Cluster;
|
25667 | /**
|
25668 | * Deserializes the supplied serialized clusters to the cluster dispatcher.
|
25669 | * @param pAfterwards Stack with calls which are invoked after the
|
25670 | * structural deserialization is done.
|
25671 | * @param pClusters Specifies the clusters.
|
25672 | * @return Returns a reference to the instance.
|
25673 | */
|
25674 | deserialize(pAfterwards: Stack, ...pClusters: ICluster[]): this;
|
25675 | }
|
25676 | export interface IBranchConstructor {
|
25677 | new (pBranches: Branches): Branch;
|
25678 | }
|
25679 |
|
25680 | export class Branches extends GridBranches<Branch, Node> {
|
25681 | constructor(pBranchConstructor: IBranchConstructor, pCluster: Cluster);
|
25682 | /** Retrieves the cluster of the branch dispatcher. */
|
25683 | get cluster(): Cluster;
|
25684 | /**
|
25685 | * Invoked when the branch dimensions are changed. This aligns the space
|
25686 | * occupied by the conditions.
|
25687 | * @event
|
25688 | */
|
25689 | onDimensions(): void;
|
25690 | /**
|
25691 | * Appends a new branch.
|
25692 | * @return Returns the new branch.
|
25693 | */
|
25694 | append(): Branch;
|
25695 | /**
|
25696 | * Inserts a new branch.
|
25697 | * @return Returns the new branch.
|
25698 | */
|
25699 | insert(): Branch;
|
25700 | /**
|
25701 | * Inserts a new branch before the supplied branch.
|
25702 | * @param pBranch Specifies the reference branch.
|
25703 | * @return Returns the new branch.
|
25704 | */
|
25705 | insertBefore(pBranch: Branch): Branch;
|
25706 | /**
|
25707 | * Inserts a new branch after the supplied branch.
|
25708 | * @param pBranch Specifies the reference branch.
|
25709 | * @return Returns the new branch.
|
25710 | */
|
25711 | insertAfter(pBranch: Branch): Branch;
|
25712 | /**
|
25713 | * Deserializes the supplied serialized branches to the branch dispatcher.
|
25714 | * @param pAfterwards Stack with calls which are invoked after the
|
25715 | * structural deserialization is done.
|
25716 | * @param pBranches Specifies the branches.
|
25717 | * @return Returns a reference to the instance.
|
25718 | */
|
25719 | deserialize(pAfterwards: Stack, ...pBranches: (IBranch & IGridResource)[]): this;
|
25720 | }
|
25721 | export type TClusterEvents = "OnRename";
|
25722 | //@ts-ignore
|
25723 | export class Cluster extends GridCluster<Nodes, Node, TClusterEvents> {
|
25724 | |
25725 |
|
25726 |
|
25727 |
|
25728 | constructor(pClusters: Clusters);
|
25729 | /** Retrieves the identifier of the cluster. */
|
25730 | get id(): string;
|
25731 | /** Retrieves the parent cluster dispatcher. */
|
25732 | //@ts-ignore
|
25733 | get parent(): Clusters | undefined;
|
25734 | /** Retrieves the predecessor of the cluster. */
|
25735 | get predecessor(): Cluster | undefined;
|
25736 | /** Retrieves the successor of the cluster. */
|
25737 | get successor(): Cluster | undefined;
|
25738 | /** Retrieves the parent map. */
|
25739 | get map(): Map | undefined;
|
25740 | /** Retrieves the parent branch. */
|
25741 | get branch(): Branch | undefined;
|
25742 | /** Retrieves the nodes. */
|
25743 | get nodes(): Nodes;
|
25744 | /** Retrieves the branches. */
|
25745 | get branches(): Branches;
|
25746 | /** Retrieves if the cluster has branches. */
|
25747 | get hasBranches(): boolean;
|
25748 | /** Retrieves the name of the cluster. */
|
25749 | get name(): string | undefined;
|
25750 | /** Sets the name of the cluster. */
|
25751 | set name(sName: string | undefined);
|
25752 | /** Retrieves a list of branches which have a jump to this cluster. */
|
25753 | get jumps(): Branch[];
|
25754 | /**
|
25755 | * Fired when a cluster is changed.
|
25756 | * @param pEvent Contains the event payload.
|
25757 | * @event
|
25758 | */
|
25759 | protected onChange(pEvent: IItemChangeEvent<this>): void;
|
25760 | /**
|
25761 | * Invoked when the cluster is popped.
|
25762 | * @param pEvent Contains the event payload.
|
25763 | * @event
|
25764 | */
|
25765 | onPop(pEvent: IItemPopEvent<this>): void;
|
25766 | /**
|
25767 | * Iterate through each node and branch of the cluster.
|
25768 | * @param fnResource Specifies the resource function.
|
25769 | * @param fnResource.pResource Contains a reference to the resource.
|
25770 | * @return Returns `true` if the iteration is stopped (break).
|
25771 | */
|
25772 | forEachDescendant(fnResource: (pResource: Node | Branch) => boolean | void): boolean;
|
25773 | /**
|
25774 | * Calculates the dimensions of the cluster (only necessary when we are not moving).
|
25775 | * @param nWidth Specifies the width of the cluster.
|
25776 | * @param nHeight Specifies the height of the cluster.
|
25777 | * @return Returns `true` if the cluster is resized.
|
25778 | */
|
25779 | resize(nWidth?: number, nHeight?: number): boolean;
|
25780 | /**
|
25781 | * Generates a serialized representation of a cluster.
|
25782 | * @return Returns a reference to the serialized cluster.
|
25783 | */
|
25784 | serialize(): ICluster;
|
25785 | /**
|
25786 | * Deserializes to a cluster.
|
25787 | * @param pCluster Contains the serialized cluster.
|
25788 | * @param pAfterwards Stack with calls which are invoked after the
|
25789 | * structural deserialization is done.
|
25790 | * @return Returns a reference to the instance.
|
25791 | */
|
25792 | deserialize(pCluster: ICluster, pAfterwards?: Stack): this;
|
25793 | /**
|
25794 | * Inserts a new cluster before this cluster.
|
25795 | * @return Returns a reference to the new cluster.
|
25796 | */
|
25797 | insertBefore(): Cluster;
|
25798 | /**
|
25799 | * Inserts a new cluster after this cluster.
|
25800 | * @return Returns a reference to the new cluster.
|
25801 | */
|
25802 | insertAfter(): Cluster;
|
25803 | /**
|
25804 | * Duplicates the cluster.
|
25805 | * @param pDest Specifies the destination cluster. If omitted a new cluster is inserted after this cluster.
|
25806 | * @return Returns a reference to the new cluster.
|
25807 | */
|
25808 | duplicate(pDest?: Cluster): Cluster;
|
25809 | /** Deletes this cluster from the map. */
|
25810 | delete(): this;
|
25811 | /** Resets the cluster. */
|
25812 | reset(): void;
|
25813 | /** Destroys a cluster. */
|
25814 | destroy(): void;
|
25815 | }
|
25816 | export type TBranchTerminator = "continuous" | "abort" | "jump" | "epilogue";
|
25817 | export type TBranchEvents = "OnCullingChange" | "OnTerminatorChange" | "OnRename";
|
25818 | export interface IBranchCullingEvent extends IHookPayload<"OnCullingChange"> {
|
25819 | readonly branch: Branch;
|
25820 | readonly culling: TBranchCulling;
|
25821 | }
|
25822 | export interface IBranchTerminatorEvent extends IHookPayload<"OnTerminatorChange"> {
|
25823 | readonly branch: Branch;
|
25824 | readonly terminator: TBranchTerminator;
|
25825 | readonly jump: Cluster | undefined;
|
25826 | readonly epilogue: IEpilogue | undefined;
|
25827 | }
|
25828 |
|
25829 | export class Branch extends GridBranch<Clusters, Node, TBranchEvents> {
|
25830 |
|
25831 | static get isValidating(): boolean;
|
25832 | |
25833 |
|
25834 |
|
25835 |
|
25836 | constructor(pBranches: Branches);
|
25837 | /** Retrieves the identifier of the branch. */
|
25838 | get id(): string;
|
25839 | /** Retrieves the parent branch dispatcher. */
|
25840 | //@ts-ignore
|
25841 | get parent(): Branches | undefined;
|
25842 | /** Retrieves the predecessor of the branch. */
|
25843 | get predecessor(): Branch | undefined;
|
25844 | /** Retrieves the successor of the branch. */
|
25845 | get successor(): Branch | undefined;
|
25846 | /** Retrieves the parent map. */
|
25847 | get map(): Map | undefined;
|
25848 | /** Retrieves the parent cluster. */
|
25849 | get cluster(): Cluster | undefined;
|
25850 | /** Retrieves the conditions. */
|
25851 | get conditions(): Conditions;
|
25852 | /** Retrieves the clusters. */
|
25853 | get clusters(): Clusters;
|
25854 | /** Retrieves the branch spacing. */
|
25855 | get spacing(): number;
|
25856 | /** Retrieves the current offset for the branch. */
|
25857 | get offset(): number;
|
25858 | /** Sets the offset for the branch. */
|
25859 | set offset(nOffset: number);
|
25860 | /** Retrieves the culling mode. */
|
25861 | get culling(): TBranchCulling;
|
25862 | /** Sets the culling mode. */
|
25863 | set culling(sCulling: TBranchCulling);
|
25864 | /** Retrieves the termination mode. */
|
25865 | get terminator(): TBranchTerminator;
|
25866 | /** Sets the termination mode for the branch. */
|
25867 | set terminator(sTerminator: TBranchTerminator);
|
25868 | /** Retrieves the jump-to-cluster. */
|
25869 | get jump(): Cluster | undefined;
|
25870 | /** Sets the jump-to-cluster. */
|
25871 | set jump(pTo: Cluster | undefined);
|
25872 | /** Retrieves the jump-to-cluster. */
|
25873 | get epilogue(): IEpilogue | undefined;
|
25874 | /** Sets the jump-to-cluster. */
|
25875 | set epilogue(pEpilogue: IEpilogue | undefined);
|
25876 | /** Retrieves the name of the branch. */
|
25877 | get name(): string | undefined;
|
25878 | /** Sets the name of the branch. */
|
25879 | set name(sName: string | undefined);
|
25880 | /**
|
25881 | * Fired when a branch is changed.
|
25882 | * @param pEvent Contains the event payload.
|
25883 | * @event
|
25884 | */
|
25885 | protected onChange(pEvent: IItemChangeEvent<this>): void;
|
25886 | /**
|
25887 | * Fired when a branch move occurs.
|
25888 | * @param nMoveX Specifies the horizontal movement.
|
25889 | * @param nMoveY Specifies the vertical movement.
|
25890 | * @param pOffset Specifies the offset of the touch point.
|
25891 | * @event
|
25892 | */
|
25893 | onMove(nMoveX: number, nMoveY: number, pOffset: IPoint): void;
|
25894 | /**
|
25895 | * Iterate through each cluster and condition of the branch.
|
25896 | * @param fnResource Specifies the resource function.
|
25897 | * @param fnResource.pResource Contains a reference to the resource.
|
25898 | * @return Returns `true` if the iteration is stopped (break).
|
25899 | */
|
25900 | forEachDescendant(fnResource: (pResource: Condition | Cluster) => boolean | void): boolean;
|
25901 | /**
|
25902 | * Applies the spacing for the conditions.
|
25903 | * @param nWidth Specifies the width of the resource.
|
25904 | * @param nHeight Specifies the height of the resource.
|
25905 | * @return Returns `true` if the resource is resized.
|
25906 | */
|
25907 | resize(nWidth?: number, nHeight?: number): boolean;
|
25908 | /**
|
25909 | * Generates a serialized representation of a branch.
|
25910 | * @return Returns a reference to the serialized branch.
|
25911 | */
|
25912 | serialize(): IBranch;
|
25913 | /**
|
25914 | * Deserializes to a branch.
|
25915 | * @param pBranch Contains the serialized data.
|
25916 | * @param pAfterwards Stack with calls which are invoked after the
|
25917 | * structural deserialization is done.
|
25918 | * @return Returns a reference to the instance.
|
25919 | */
|
25920 | deserialize(pBranch: IBranch & IGridResource, pAfterwards?: Stack): this;
|
25921 | /**
|
25922 | * Inserts a new branch before this branch.
|
25923 | * @return Returns a reference to the new branch.
|
25924 | */
|
25925 | insertBefore(): Branch;
|
25926 | /**
|
25927 | * Inserts a new branch after this branch.
|
25928 | * @return Returns a reference to the new branch.
|
25929 | */
|
25930 | insertAfter(): Branch;
|
25931 | /**
|
25932 | * Duplicates the branch.
|
25933 | * @param pDest Specifies the destination branch. If omitted a new branch is inserted after this branch.
|
25934 | * @return Returns a reference to the new branch.
|
25935 | */
|
25936 | duplicate(pDest?: Branch): Branch;
|
25937 | /** Deletes this branch from the map. */
|
25938 | delete(): this;
|
25939 | /** Resets the branch. */
|
25940 | reset(): void;
|
25941 | /** Destroys a branch. */
|
25942 | destroy(): void;
|
25943 | }
|
25944 | export interface IConditionBlockDecorator {
|
25945 |
|
25946 | readonly namespace?: string;
|
25947 |
|
25948 | readonly type: "condition";
|
25949 |
|
25950 | readonly identifier: string;
|
25951 |
|
25952 | readonly alias?: string | string[];
|
25953 |
|
25954 | readonly label: string;
|
25955 | |
25956 |
|
25957 |
|
25958 |
|
25959 |
|
25960 |
|
25961 |
|
25962 |
|
25963 |
|
25964 | readonly context: TConditionBlockContext | string;
|
25965 |
|
25966 | readonly version?: string;
|
25967 | }
|
25968 | export interface INodeBlockDecorator {
|
25969 |
|
25970 | readonly namespace?: string;
|
25971 |
|
25972 | readonly type: "node";
|
25973 |
|
25974 | readonly identifier: string;
|
25975 |
|
25976 | readonly alias?: string | string[];
|
25977 |
|
25978 | readonly label: string;
|
25979 |
|
25980 | readonly version?: string;
|
25981 | |
25982 |
|
25983 |
|
25984 |
|
25985 |
|
25986 | readonly kind?: "headless" | "ui";
|
25987 | }
|
25988 | function observe(map?: Map): void;
|
25989 | |
25990 |
|
25991 |
|
25992 |
|
25993 |
|
25994 | export function isRequired<T extends NodeBlock>(pTarget: T): boolean;
|
25995 | class NodeBlocksNamespace {
|
25996 |
|
25997 | constructor(sIdentifier: string);
|
25998 | /** Retrieves the identifier for the namespace. */
|
25999 | get identifier(): string;
|
26000 | /** Retrieves a list of registered blocks. */
|
26001 | get all(): TNodeBlock[];
|
26002 | /** Retrieves the array of missing block types. */
|
26003 | get missing(): string[];
|
26004 | /** Contains the number of missed block types */
|
26005 | get errors(): number;
|
26006 | /**
|
26007 | * Registers the supplied block.
|
26008 | * @param pBlock Specifies the block.
|
26009 | * @param sIdentifier Specifies the block type identifier.
|
26010 | * @param pAliases Specifies type aliases for the block.
|
26011 | * @param fnLabel Specifies the localized label for the block as a function.
|
26012 | * @param sVersion Specifies the version of the block in SemVer format (defaults to `0.0.0`).
|
26013 | * @param sKind Specifies the block kind. Can be one of the following values:
|
26014 | * - `headless`: Specifies the block is headless (has no user interface);
|
26015 | * - `ui`: Specifies the block implements a user interface.
|
26016 | */
|
26017 | register(
|
26018 | pBlock: TNodeBlock,
|
26019 | sIdentifier: string,
|
26020 | pAliases: string[],
|
26021 | fnLabel: () => string,
|
26022 | sVersion: string,
|
26023 | sKind: "headless" | "ui"
|
26024 | ): TNodeBlock;
|
26025 | /**
|
26026 | * Retrieves the block constructor of the specified type identifier.
|
26027 | * @param sIdentifier Specifies the block type identifier.
|
26028 | * @return Returns the block constructor or `undefined` if the block
|
26029 | * type is not available.
|
26030 | */
|
26031 | ofType<T extends TNodeBlock>(sIdentifier: string): T | undefined;
|
26032 | /** Reset missing types. */
|
26033 | resetMissing(): void;
|
26034 | }
|
26035 | class ConditionBlocksNamespace {
|
26036 | /** Creates a new namespace. */
|
26037 | constructor(sIdentifier: string);
|
26038 | /** Retrieves the identifier for the namespace. */
|
26039 | get identifier(): string;
|
26040 | /** Retrieves a list of registered blocks. */
|
26041 | get all(): TConditionBlock[];
|
26042 | /** Retrieves the array of missing block types. */
|
26043 | get missing(): string[];
|
26044 | /** Contains the number of missed block types */
|
26045 | get errors(): number;
|
26046 | /**
|
26047 | * Registers a block.
|
26048 | * @param pBlock Specifies the block.
|
26049 | * @param sIdentifier Specifies the block type identifier.
|
26050 | * @param pAliases Specifies type aliases for the block.
|
26051 | * @param fnLabel Specifies the localized label for the block as a function.
|
26052 | * @param pContext Specifies the context.
|
26053 | * @param sVersion Specifies the version of the block in SemVer format (defaults to `0.0.0`).
|
26054 | */
|
26055 | register(
|
26056 | pBlock: TConditionBlock,
|
26057 | sIdentifier: string,
|
26058 | pAliases: string[],
|
26059 | fnLabel: () => string,
|
26060 | pContext: TConditionBlockContext | string,
|
26061 | sVersion: string
|
26062 | ): TConditionBlock;
|
26063 | /**
|
26064 | * Retrieves the registered blocks for the specified context.
|
26065 | * @param pContext Specifies the context.
|
26066 | */
|
26067 | for<T extends TConditionBlock>(pContext: TConditionBlockContext | NodeBlock): T[];
|
26068 | /**
|
26069 | * Retrieves the block constructor with the specified type identifier.
|
26070 | * @param sIdentifier Specifies the block type identifier.
|
26071 | * @return Returns the block constructor or `undefined` if the block
|
26072 | * type is not available.
|
26073 | */
|
26074 | ofType<T extends TConditionBlock>(sIdentifier: string): T | undefined;
|
26075 | /** Reset missing types. */
|
26076 | resetMissing(): void;
|
26077 | }
|
26078 | export interface INamespace {
|
26079 | readonly identifier: string;
|
26080 | readonly nodeBlocks: NodeBlocksNamespace;
|
26081 | readonly conditionBlocks: ConditionBlocksNamespace;
|
26082 | }
|
26083 | export class Namespaces {
|
26084 | /** Invoked when a block is registered. */
|
26085 | static onRegister?: (identifier: string, block: TAny, type: "node" | "condition", version: string) => void;
|
26086 | /** Retrieves the active namespace. */
|
26087 | static get active(): INamespace;
|
26088 | /** Retrieves a list of missing block type identifiers. */
|
26089 | static get missingBlockTypes(): string[];
|
26090 | /** Retrieves the total number of erroneous blocks due to missing block types. */
|
26091 | static get erroneousBlocks(): number;
|
26092 | /**
|
26093 | * Retrieves the namespace for the specified identifier (or the active
|
26094 | * namespace if the identifier is undefined).
|
26095 | */
|
26096 | static get(sIdentifier?: string): INamespace;
|
26097 | /** Retrieves if the supplied namespace is available. */
|
26098 | static isAvailable(sIdentifier: string): boolean;
|
26099 | /**
|
26100 | * Load an UMD namespace for the specified identifier.
|
26101 | * @param sIdentifier Specifies the namespace identifier.
|
26102 | * @param pContext Reference to a context to use.
|
26103 | * @param sContext Specifies the UMD name of the context.
|
26104 | * @param sUMD UMD code that is executed within the context.
|
26105 | * @param bUnload Specifies if the namespace should unload if it is already available (default is `true`).
|
26106 | * @return Returns a ref to the namespace.
|
26107 | */
|
26108 | static loadUMD(sIdentifier: string, pContext: {}, sContext: string, sUMD: string, bUnload?: boolean): INamespace | undefined;
|
26109 | /**
|
26110 | * Loads a namespace from an URL for the specified identifier.
|
26111 | * @param sIdentifier Specifies the namespace identifier.
|
26112 | * @param pContext Reference to a context to use.
|
26113 | * @param sContext Specifies the UMD name of the context.
|
26114 | * @param sPolicy Specifies the Trusted Types policy to use.
|
26115 | * @param sURL Specifies the URL to load from.
|
26116 | * @param fnCallback Invoked when the loading is done.
|
26117 | * @param bUnload Specifies if the namespace should unload if it is already available (default is `true`).
|
26118 | */
|
26119 | static loadURL(
|
26120 | sIdentifier: string,
|
26121 | pContext: {},
|
26122 | sContext: string,
|
26123 | sPolicy: string,
|
26124 | sURL: string,
|
26125 | fnCallback?: (pNamespace?: INamespace) => void,
|
26126 | bUnload?: boolean
|
26127 | ): void;
|
26128 | /** Unloads the specified namespace. */
|
26129 | static unload(sIdentifier: string): boolean;
|
26130 | /**
|
26131 | * Mounts (activates) a namespace context.
|
26132 | * @param sIdentifier Specifies the namespace identifier.
|
26133 | */
|
26134 | static mount(sIdentifier: string): INamespace;
|
26135 | /** Unmounts (deactivates) the active namespace context. */
|
26136 | static unmount(): void;
|
26137 | /** Activates the namespace with the specified identifier. */
|
26138 | static activate(sIdentifier: string): INamespace;
|
26139 | /** Activates the default namespace. */
|
26140 | static activateDefault(): INamespace;
|
26141 | /**
|
26142 | * Activate a namespace for the specified identifier (or tries to load it if it is not available).
|
26143 | * @param sIdentifier Specifies the namespace identifier.
|
26144 | * @param pContext Reference to a context to use.
|
26145 | * @param sContext Specifies the UMD name of the context.
|
26146 | * @param sUMD UMD code that is executed within the context.
|
26147 | * @param bAlwaysLoad Specifies if the bundle should always load, even when there is already a
|
26148 | * namespace available with the specified identifier (default is `true`).
|
26149 | * @param bUnloadFirst Specifies if the namespace should unload if it is already available (default is `false`).
|
26150 | * @return Returns a ref to the namespace.
|
26151 | */
|
26152 | static activateOrLoadUMD(
|
26153 | sIdentifier: string,
|
26154 | pContext: {},
|
26155 | sContext: string,
|
26156 | sUMD: string,
|
26157 | bAlwaysLoad?: boolean,
|
26158 | bUnloadFirst?: boolean
|
26159 | ): INamespace | undefined;
|
26160 | /**
|
26161 | * Activate a namespace for the specified identifier (or tries to load it if it is not available).
|
26162 | * @param sIdentifier Specifies the namespace identifier.
|
26163 | * @param pContext Reference to a context to use.
|
26164 | * @param sContext Specifies the UMD name of the context.
|
26165 | * @param sPolicy Specifies the Trusted Types policy to use.
|
26166 | * @param sURL Specifies the URL to load from.
|
26167 | * @param fnCallback Invoked when the loading is done.
|
26168 | * @param bAlwaysLoad Specifies if the bundle should always load, even when there is already a
|
26169 | * namespace available with the specified identifier (default is `true`).
|
26170 | * @param bUnloadFirst Specifies if the namespace should unload if it is already available (default is `false`).
|
26171 | */
|
26172 | static activateOrLoadURL(
|
26173 | sIdentifier: string,
|
26174 | pContext: {},
|
26175 | sContext: string,
|
26176 | sPolicy: string,
|
26177 | sURL: string,
|
26178 | fnCallback?: (pNamespace?: INamespace) => void,
|
26179 | bAlwaysLoad?: boolean,
|
26180 | bUnloadFirst?: boolean
|
26181 | ): void;
|
26182 | /** Resets all missing types. */
|
26183 | static resetMissing(): void;
|
26184 | /** Specifies block types to include. */
|
26185 | static include(...sTypes: string[]): void;
|
26186 | /** Specifies block types to exclude. */
|
26187 | static exclude(...sTypes: string[]): void;
|
26188 | /**
|
26189 | * Retrieves if a block type is allowed.
|
26190 | * @param sType Specifies the block type to check.
|
26191 | * @returns Returns `true` if the block is allowed.
|
26192 | */
|
26193 | static isAllowed(sType: string): boolean;
|
26194 | /**
|
26195 | * Flags blocks.
|
26196 | * @param sFlag Specifies the flag identifier.
|
26197 | * @param sTypes Specifies the types to flag.
|
26198 | */
|
26199 | static flag(sFlag: string, ...sTypes: string[]): void;
|
26200 | /**
|
26201 | * Checks if a block has a flag.
|
26202 | * @param sFlag Specifies the flag identifier to check.
|
26203 | * @param sType Specifies the block type.
|
26204 | * @returns Returns `true` if the block was flagged.
|
26205 | */
|
26206 | static hasFlag(sFlag: string, sType: string): boolean;
|
26207 | }
|
26208 | /**
|
26209 | * Mounts (activates) a namespace context.
|
26210 | * @param sIdentifier Specifies the namespace identifier.
|
26211 | * @return Returns a ref to the namespace context.
|
26212 | */
|
26213 | export function mountNamespace(sIdentifier: string): INamespace;
|
26214 | /** Unmounts (deactivates) the active namespace context. */
|
26215 | export function unmountNamespace(): void;
|
26216 | /** Marks a property that affects the name or label of a node or condition. */
|
26217 | export function affects<T extends NodeBlock | ConditionBlock>(
|
26218 | sTarget: "#name" | "#label"
|
26219 | ): (pTarget: T, sProperty: string, pDescriptor?: PropertyDescriptor) => void;
|
26220 | /** Marks a property that affects the state of the condition. */
|
26221 | export function affects<T extends ConditionBlock>(
|
26222 | sTarget: "#condition"
|
26223 | ): (pTarget: T, sProperty: string, pDescriptor?: PropertyDescriptor) => void;
|
26224 | /** Marks a property that affects the slots or the required condition of a node. */
|
26225 | export function affects<T extends NodeBlock>(
|
26226 | sTarget: "#slots" | "#required"
|
26227 | ): (pTarget: T, sProperty: string, pDescriptor?: PropertyDescriptor) => void;
|
26228 | /**
|
26229 | * Marks the block assigned function that is invoked when the block is assigned
|
26230 | * to a node or condition. The following arguments are passed to the function:
|
26231 | * - `previous` (NodeBlock | ConditionBlock | undefined): Reference to any
|
26232 | * previous block that was attached (could be undefined when there was none).
|
26233 | */
|
26234 | export function assigned<T extends NodeBlock | ConditionBlock>(pTarget: T, sMethod: keyof T, pDescriptor?: PropertyDescriptor): void;
|
26235 | /**
|
26236 | * Defines a node block.
|
26237 | * @param pProperties Specifies the properties for the block.
|
26238 | */
|
26239 | export function block(pProperties: INodeBlockDecorator): (pBlock: TNodeBlock) => void;
|
26240 | /**
|
26241 | * Defines a condition block.
|
26242 | * @param pProperties Specifies the properties for the block.
|
26243 | */
|
26244 | export function block(pProperties: IConditionBlockDecorator): (pBlock: TConditionBlock) => void;
|
26245 | /**
|
26246 | * Marks the block created function that is invoked when the block is created
|
26247 | * (right after the instance is created and just before deserialization occurs).
|
26248 | */
|
26249 | export function created<T extends NodeBlock | ConditionBlock>(pTarget: T, sMethod: keyof T, pDescriptor?: PropertyDescriptor): void;
|
26250 | /**
|
26251 | * Include property in the definition.
|
26252 | * @param sType Specifies the type of the property (`string`, `number`, `boolean` or a unique custom identifier).
|
26253 | * @param sOptional Specifies if the property is `optional` or `required`. Optional properties can have `undefined` as value.
|
26254 | * @param sMode Specifies the mode:
|
26255 | * - `r`: Reads a property from the definition;
|
26256 | * - `w`: Writes a property to the definition;
|
26257 | * - `rw`: Reads and writes a property from/to the definition.
|
26258 | */
|
26259 | export function definition<T>(
|
26260 | sType?: "string" | "number" | "boolean" | string,
|
26261 | sOptional?: "optional" | "required",
|
26262 | sMode?: "r" | "w" | "rw"
|
26263 | ): (pTarget: T, sProperty: string, pPropertyDescriptor?: PropertyDescriptor) => void;
|
26264 | /** Include property in the definition. */
|
26265 | export function definition<T>(pTarget: T, sProperty: string, pPropertyDescriptor?: PropertyDescriptor): void;
|
26266 | /** Retrieves the type of the specified property. */
|
26267 | export function getDefinitionType<T>(
|
26268 | pTarget: T,
|
26269 | sProperty: string
|
26270 | ):
|
26271 | | {
|
26272 | readonly type: "string" | "number" | "boolean" | string;
|
26273 | readonly optional: boolean;
|
26274 | readonly isPrimitive: boolean;
|
26275 | }
|
26276 | | undefined;
|
26277 | /**
|
26278 | * Marks the block destroyed function that is invoked when the block is
|
26279 | * destroyed.
|
26280 | */
|
26281 | export function destroyed<T extends NodeBlock | ConditionBlock>(pTarget: T, sMethod: keyof T, pDescriptor?: PropertyDescriptor): void;
|
26282 | /**
|
26283 | * Marks a function that is invoked when the supplied property is detached.
|
26284 | * If your function returns a callback, the removal of the condition
|
26285 | * block is canceled and the callback is invoked after all pending a-sync
|
26286 | * operations on the map are done. Example: You have a condition block that is
|
26287 | * attached to a node using the `Node` property of the condition block. When
|
26288 | * the attached node is deleted, it is detached from the condition block and the
|
26289 | * function is invoked.
|
26290 | * @param sProperty Specifies the property to monitor.
|
26291 | */
|
26292 | export function detached<T extends ConditionBlock>(
|
26293 | sProperty: keyof T
|
26294 | ): (pTarget: T, sFunction: string, pDescriptor?: PropertyDescriptor) => void;
|
26295 | /**
|
26296 | * Marks the slot function where you define the slots for a block. The following
|
26297 | * arguments are passed to the function:
|
26298 | * - `slots` (SlotsOrchestrator): Reference to the `Slots` orchestrator.
|
26299 | */
|
26300 | export function slots<T extends NodeBlock>(pTarget: T, sMethod: keyof T, pDescriptor?: PropertyDescriptor): void;
|
26301 | /**
|
26302 | * Marks the block unassigned function that is invoked when the block is
|
26303 | * unassigned from a node.
|
26304 | */
|
26305 | export function unassigned<T extends NodeBlock | ConditionBlock>(pTarget: T, sMethod: keyof T, pDescriptor?: PropertyDescriptor): void;
|
26306 | /**
|
26307 | * Marks the upgraded function that is invoked when a block is loaded that was
|
26308 | * created using an older version of the block implementation. You can use an
|
26309 | * upgrade function to migrate older blocks to the new version of the block.
|
26310 | * The following arguments are passed to the function:
|
26311 | * - `prevVersion` (string): String that contains the previous version number of
|
26312 | * the block.
|
26313 | */
|
26314 | export function upgraded<T extends NodeBlock | ConditionBlock>(pTarget: T, sMethod: keyof T, pDescriptor?: PropertyDescriptor): void;
|
26315 | export interface IMapChangeEvent extends IHookPayload<"OnChange"> {
|
26316 | readonly map: Map;
|
26317 | }
|
26318 | export interface IMapErrorEvent extends IHookPayload<"OnError"> {
|
26319 | readonly map: Map;
|
26320 | readonly erroneousBlocks: number;
|
26321 | readonly missingBlockTypes: string[];
|
26322 | }
|
26323 |
|
26324 | export { observe as detectChange };
|
26325 | }
|
26326 |
|
26327 | declare module "tripetto/module/slots" {
|
26328 | import { TAny } from "tripetto/module/functional";
|
26329 | import { HookProps, IHookPayload, THooks } from "tripetto/module/hookup";
|
26330 | import { IDimensionChangeEvent, IItemPopEvent, Item, Matrix } from "tripetto/module/matrix";
|
26331 | import { ISerialize, TSerializeTypes } from "tripetto/module/serializer";
|
26332 |
|
26333 | export type TSlotEvents = "OnSlotRename" | "OnSlotRequired" | "OnSlotProperty";
|
26334 | export interface ISlotEvent<H extends THooks, T extends Slot> extends IHookPayload<H> {
|
26335 |
|
26336 | readonly slot: T;
|
26337 | }
|
26338 | export interface ISlotRenameEvent<T extends Slot> extends ISlotEvent<"OnSlotRename", T> {}
|
26339 | export interface ISlotRequiredEvent<T extends Slot> extends ISlotEvent<"OnSlotRequired", T> {}
|
26340 | export interface ISlotPropertyEvent<T extends Slot> extends ISlotEvent<"OnSlotProperty", T> {
|
26341 |
|
26342 | readonly property: keyof T;
|
26343 | }
|
26344 |
|
26345 | export type Kinds = "meta" | "static" | "dynamic" | "feature";
|
26346 | export type TPipeable =
|
26347 | | boolean
|
26348 | | {
|
26349 |
|
26350 | readonly pipe?: string;
|
26351 |
|
26352 | readonly label?: string;
|
26353 |
|
26354 | readonly alias?: string;
|
26355 |
|
26356 | readonly content?:
|
26357 | | "value"
|
26358 | | "label"
|
26359 | | "name"
|
26360 | | {
|
26361 |
|
26362 | readonly string: string;
|
26363 |
|
26364 | readonly text?: string;
|
26365 |
|
26366 | readonly markdown?: string;
|
26367 | };
|
26368 | |
26369 |
|
26370 |
|
26371 |
|
26372 | readonly legacy?: string;
|
26373 | };
|
26374 | export abstract class Slot<T extends TSerializeTypes = TSerializeTypes> extends Item<TSlotEvents> {
|
26375 |
|
26376 | static readonly type: string;
|
26377 |
|
26378 |
|
26379 | label?: string;
|
26380 |
|
26381 | name?: string;
|
26382 |
|
26383 | placeholder?: string;
|
26384 |
|
26385 | alias?: string;
|
26386 |
|
26387 | required?: boolean;
|
26388 |
|
26389 | pipeable?: TPipeable;
|
26390 |
|
26391 | default?: T;
|
26392 |
|
26393 | exportable?: boolean;
|
26394 |
|
26395 | actionable?: boolean;
|
26396 |
|
26397 | protected?: boolean;
|
26398 |
|
26399 | |
26400 |
|
26401 |
|
26402 |
|
26403 |
|
26404 |
|
26405 |
|
26406 |
|
26407 |
|
26408 |
|
26409 | constructor(
|
26410 | pType: ISlotType,
|
26411 | sKind: Kinds,
|
26412 | sReference: string,
|
26413 | nSequence?: number,
|
26414 | sPipe?: string,
|
26415 | pExchangables?: string[],
|
26416 | pSlotsOrId?: Slots | string
|
26417 | );
|
26418 | /** Retrieves a reference to the slots. */
|
26419 | get slots(): Slots | undefined;
|
26420 | /** Retrieves the identifier of the slot. */
|
26421 | get id(): string;
|
26422 | /** Retrieves the slot type identifier. */
|
26423 | get type(): string;
|
26424 | /** Retrieves the slot kind. */
|
26425 | get kind(): Kinds;
|
26426 | /** Retrieves the sequence number. */
|
26427 | get sequence(): number | undefined;
|
26428 | /** Sets the sequence number. */
|
26429 | set sequence(nSequence: number | undefined);
|
26430 | /** Retrieves the slot reference. */
|
26431 | get reference(): string;
|
26432 | /** Retrieves the exchangeable slot properties. */
|
26433 | get exchangeables(): {
|
26434 | property: string;
|
26435 | value: TAny;
|
26436 | }[];
|
26437 |
|
26438 | |
26439 |
|
26440 |
|
26441 |
|
26442 |
|
26443 | protected onPop(pEvent: HookProps<IItemPopEvent<this>>): void;
|
26444 | |
26445 |
|
26446 |
|
26447 |
|
26448 |
|
26449 | propertyChange(sProperty: keyof this): void;
|
26450 | |
26451 |
|
26452 |
|
26453 |
|
26454 | serialize(): ISlot<T>;
|
26455 | |
26456 |
|
26457 |
|
26458 |
|
26459 |
|
26460 | deserialize(pSlot: ISlot<T>): this;
|
26461 | |
26462 |
|
26463 |
|
26464 |
|
26465 | deprecate(): this;
|
26466 | |
26467 |
|
26468 |
|
26469 |
|
26470 | delete(): this;
|
26471 |
|
26472 | pipe(pOrigin?: { readonly id: string }): string;
|
26473 | |
26474 |
|
26475 |
|
26476 |
|
26477 | legacyPipe(pOrigin?: { readonly id: string }): string | undefined;
|
26478 | |
26479 |
|
26480 |
|
26481 |
|
26482 |
|
26483 | isPipe(sId: string | undefined): boolean;
|
26484 |
|
26485 | exchange(pExchangables: string[] | undefined): void;
|
26486 | |
26487 |
|
26488 |
|
26489 |
|
26490 |
|
26491 | abstract toValue(pData: TSerializeTypes): T;
|
26492 | |
26493 |
|
26494 |
|
26495 |
|
26496 |
|
26497 | abstract toString(pData: TSerializeTypes): string;
|
26498 | }
|
26499 | export interface ISlotType<T extends Slot = Slot> {
|
26500 |
|
26501 | readonly type: string;
|
26502 | |
26503 |
|
26504 |
|
26505 |
|
26506 |
|
26507 |
|
26508 |
|
26509 |
|
26510 |
|
26511 |
|
26512 |
|
26513 | new (
|
26514 | pType: ISlotType,
|
26515 | sKind: Kinds,
|
26516 | sReference: string,
|
26517 | nSequence?: number,
|
26518 | sPipe?: string,
|
26519 | pExchangables?: (keyof T)[],
|
26520 | pSlotsOrId?: Slots | string
|
26521 | ): T;
|
26522 | }
|
26523 | export interface ISlotBase<T extends TSerializeTypes = TSerializeTypes> {
|
26524 |
|
26525 | readonly id: string;
|
26526 |
|
26527 | readonly type: string;
|
26528 |
|
26529 | readonly kind: Kinds;
|
26530 |
|
26531 | readonly reference: string;
|
26532 |
|
26533 | readonly sequence?: number;
|
26534 |
|
26535 | readonly label?: string;
|
26536 |
|
26537 | readonly name?: string;
|
26538 |
|
26539 | readonly placeholder?: string;
|
26540 |
|
26541 | readonly alias?: string;
|
26542 |
|
26543 | readonly required?: boolean;
|
26544 |
|
26545 | readonly pipeable?: TPipeable;
|
26546 |
|
26547 | readonly default?: T;
|
26548 |
|
26549 | readonly exportable?: boolean;
|
26550 |
|
26551 | readonly actionable?: boolean;
|
26552 |
|
26553 | readonly protected?: boolean;
|
26554 | }
|
26555 | export interface ISlotProperties<T extends Slot>
|
26556 | extends Partial<Pick<T, Exclude<keyof ISlotBase, "id" | "type" | "kind" | "reference">>> {
|
26557 |
|
26558 | readonly type: ISlotType<T>;
|
26559 |
|
26560 | readonly reference: string;
|
26561 |
|
26562 | readonly label: string;
|
26563 |
|
26564 | readonly pipe?: string;
|
26565 |
|
26566 | readonly exchange?: (keyof T)[];
|
26567 | }
|
26568 | export interface ISlot<T extends TSerializeTypes = TSerializeTypes> extends ISlotBase<T>, ISerialize {}
|
26569 | export class Slots extends Matrix<Slot, TSlotEvents> {
|
26570 | |
26571 |
|
26572 |
|
26573 |
|
26574 |
|
26575 | static register<T extends Slot>(pType: ISlotType<T>, sType: string): void;
|
26576 | |
26577 |
|
26578 |
|
26579 |
|
26580 |
|
26581 |
|
26582 | static ofType<T extends Slot>(sType: string): ISlotType<T> | undefined;
|
26583 |
|
26584 | constructor(pOrigin?: { readonly id: string });
|
26585 | /** Retrieves the slots id. */
|
26586 | get id(): string | undefined;
|
26587 | /** Retrieves if the slots are being deserialized. */
|
26588 | get isDeserializing(): boolean;
|
26589 | /** Retrieves if multiple pipeable slots are present. */
|
26590 | get hasMultiplePipeable(): boolean;
|
26591 |
|
26592 | /**
|
26593 | * Fired when the amount of slots is changed.
|
26594 | * @param pEvent Specifies the event payload.
|
26595 | * @event
|
26596 | */
|
26597 | protected onDimensionChange(pEvent: IDimensionChangeEvent<this>): void;
|
26598 | /**
|
26599 | * Creates a new meta slot.
|
26600 | * @param pProperties Specifies the properties for the slot.
|
26601 | * @return Returns a reference to the slot.
|
26602 | */
|
26603 | meta<T extends Slot>(pProperties: ISlotProperties<T>): T;
|
26604 | /**
|
26605 | * Creates a new static slot.
|
26606 | * @param pProperties Specifies the properties for the slot.
|
26607 | * @return Returns a reference to the slot.
|
26608 | */
|
26609 | static<T extends Slot>(pProperties: ISlotProperties<T>): T;
|
26610 | /**
|
26611 | * Creates a new dynamic slot.
|
26612 | * @param pProperties Specifies the properties for the slot.
|
26613 | * @return Returns a reference to the slot.
|
26614 | */
|
26615 | dynamic<T extends Slot>(pProperties: ISlotProperties<T>): T;
|
26616 | /**
|
26617 | * Creates a new feature slot.
|
26618 | * @param pProperties Specifies the properties for the slot.
|
26619 | * @return Returns a reference to the slot.
|
26620 | */
|
26621 | feature<T extends Slot>(pProperties: ISlotProperties<T>): T;
|
26622 | /**
|
26623 | * Selects a slot.
|
26624 | * @param sReferenceOrId Reference or identifier of the slot.
|
26625 | * @param sKind Specifies the optional kind of the slot.
|
26626 | * @return Returns the slot or `undefined` if no slot is found.
|
26627 | */
|
26628 | select<T extends Slot>(sReferenceOrId: string, sKind?: Kinds): T | undefined;
|
26629 | /**
|
26630 | * Selects a slot by the specified identifier.
|
26631 | * @param sId Specifies the slot or pipe identifier to search for.
|
26632 | * @return Returns the slot or `undefined` if no slot was found.
|
26633 | */
|
26634 | selectByIdentifier<T extends Slot>(sId: string): T | undefined;
|
26635 | /**
|
26636 | * Deprecates a slot.
|
26637 | * @param sReferenceOrId Reference or identifier of the slot.
|
26638 | * @param sKind Specifies the optional kind of the slot.
|
26639 | * @return Returns the slot or `undefined` if no slot is found.
|
26640 | */
|
26641 | deprecate<T extends Slot>(sReferenceOrId: string, sKind?: Kinds): T | undefined;
|
26642 | /**
|
26643 | * Deletes a slot.
|
26644 | * @param sReferenceOrId Reference or identifier of the slot.
|
26645 | * @param sKind Specifies the optional kind of the slot.
|
26646 | * @return Returns the slot or `undefined` if no slot is found.
|
26647 | */
|
26648 | delete<T extends Slot>(sReferenceOrId: string, sKind?: Kinds): T | undefined;
|
26649 | /**
|
26650 | * Removes all the slots from the collection except the supplied slots.
|
26651 | * @param sKind Specifies the kind of slots to remove (or `undefined` to remove all).
|
26652 | * @param pExclude Specifies the slots to exclude. Those are kept in the slots collection.
|
26653 | */
|
26654 | clean(sKind?: Kinds, ...pExclude: (Slot | undefined)[]): void;
|
26655 | /**
|
26656 | * Sorts the slots.
|
26657 | * @return Returns `true` if the order of the slots is changed.
|
26658 | */
|
26659 | sort(): boolean;
|
26660 | /**
|
26661 | * Serializes the slots to an array.
|
26662 | * @return Returns the slots array.
|
26663 | */
|
26664 | serialize(): ISlot[];
|
26665 | /**
|
26666 | * Deserializes slots.
|
26667 | * @param pSlots Specifies the slots array.
|
26668 | * @return Returns a reference to the instance.
|
26669 | */
|
26670 | deserialize(pSlots: ISlot[]): this;
|
26671 | /** Destroys the slots instance. */
|
26672 | destroy(): void;
|
26673 | }
|
26674 | export type Transformations = "none" | "capitalize" | "capitalize-words" | "capitalize-sentences" | "uppercase" | "lowercase";
|
26675 | export type Precision = "years" | "months" | "days" | "hours" | "minutes" | "seconds" | "milliseconds";
|
26676 | /**
|
26677 | * Defines a slot type.
|
26678 | * @param sType Specifies the slot type name.
|
26679 | */
|
26680 | export function slot<T extends Slot>(sType: string): (pType: ISlotType<T>) => void;
|
26681 | /**
|
26682 | * Marks a property as a slot property.
|
26683 | * @param pTarget Reference to the slot.
|
26684 | * @param sProperty Specifies the slot property.
|
26685 | * @param pDescriptor Reference to the property descriptor.
|
26686 | */
|
26687 | export function property(pTarget: Slot, sProperty: string, pDescriptor?: PropertyDescriptor): void;
|
26688 | class BooleanSlot extends Slot<boolean> {
|
26689 |
|
26690 | labelForFalse?: string;
|
26691 |
|
26692 | labelForTrue?: string;
|
26693 | |
26694 |
|
26695 |
|
26696 |
|
26697 |
|
26698 | toValue(pData: TSerializeTypes): boolean;
|
26699 | |
26700 |
|
26701 |
|
26702 |
|
26703 |
|
26704 | toString(pData: TSerializeTypes): string;
|
26705 | }
|
26706 | class DateSlot extends Slot<number> {
|
26707 |
|
26708 | precision?: Precision;
|
26709 |
|
26710 | minimum?: Date | number | true;
|
26711 |
|
26712 | maximum?: Date | number | true;
|
26713 |
|
26714 | get supportsTime(): boolean;
|
26715 |
|
26716 | |
26717 |
|
26718 |
|
26719 |
|
26720 |
|
26721 |
|
26722 | toValue(pData: TSerializeTypes | Date, sPrecision?: Precision): number;
|
26723 | |
26724 |
|
26725 |
|
26726 |
|
26727 |
|
26728 |
|
26729 | toDate(pData: TSerializeTypes | Date, sPrecision?: Precision): Date;
|
26730 | |
26731 |
|
26732 |
|
26733 |
|
26734 |
|
26735 |
|
26736 | toString(pData: TSerializeTypes | Date, sPrecision?: Precision): string;
|
26737 | }
|
26738 | class NumberSlot extends Slot<number> {
|
26739 | |
26740 |
|
26741 |
|
26742 |
|
26743 |
|
26744 | toValue(pData: TSerializeTypes): number;
|
26745 | |
26746 |
|
26747 |
|
26748 |
|
26749 |
|
26750 |
|
26751 | toString(pData: TSerializeTypes, fnFormatter?: (nValue: number | string) => string): string;
|
26752 | }
|
26753 | export class Numeric extends Slot<number> {
|
26754 |
|
26755 | minimum?: number;
|
26756 |
|
26757 | maximum?: number;
|
26758 |
|
26759 | separator?: string;
|
26760 |
|
26761 | decimal?: string;
|
26762 |
|
26763 | minus?: string;
|
26764 |
|
26765 | prefix?: string;
|
26766 |
|
26767 | prefixPlural?: string;
|
26768 |
|
26769 | suffix?: string;
|
26770 |
|
26771 | suffixPlural?: string;
|
26772 |
|
26773 | digits?: number;
|
26774 |
|
26775 | get precision(): number | undefined;
|
26776 |
|
26777 | set precision(nPrecision: number | undefined);
|
26778 | |
26779 |
|
26780 |
|
26781 |
|
26782 |
|
26783 | toValue(pData: TSerializeTypes): number;
|
26784 | |
26785 |
|
26786 |
|
26787 |
|
26788 |
|
26789 |
|
26790 | formatString(sNumber: string, bPlural: boolean): string;
|
26791 | |
26792 |
|
26793 |
|
26794 |
|
26795 |
|
26796 |
|
26797 | toString(pData: TSerializeTypes, fnFormatter?: (nValue: number | string, nPrecision?: number | "auto") => string): string;
|
26798 | }
|
26799 | class StringSlot extends Slot<string> {
|
26800 | |
26801 |
|
26802 |
|
26803 |
|
26804 |
|
26805 | toValue(pData: TSerializeTypes): string;
|
26806 | |
26807 |
|
26808 |
|
26809 |
|
26810 |
|
26811 | toString(pData: TSerializeTypes): string;
|
26812 | }
|
26813 | export class Text extends Slot<string> {
|
26814 |
|
26815 | get maxLength(): number | undefined;
|
26816 |
|
26817 | set maxLength(nMaxLength: number | undefined);
|
26818 |
|
26819 | transformation?: Transformations;
|
26820 | |
26821 |
|
26822 |
|
26823 |
|
26824 |
|
26825 | toValue(pData: TSerializeTypes): string;
|
26826 | |
26827 |
|
26828 |
|
26829 |
|
26830 |
|
26831 | toString(pData: TSerializeTypes): string;
|
26832 | }
|
26833 |
|
26834 | export { BooleanSlot as Boolean, DateSlot as Date, NumberSlot as Number, StringSlot as String };
|
26835 | }
|
26836 |
|
26837 | declare module "*.svg" {
|
26838 | const base64: string;
|
26839 | export default base64;
|
26840 | }
|