@sheetxl/utils-react 0.7.20 → 0.7.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/cjs/{BL4s9szmq3x4oxSh.cjs → O75UN37bxYdOt58p.cjs} +1 -1
- package/browser/cjs/index.cjs +2 -2
- package/browser/esm/index.mjs +685 -672
- package/browser/esm/{kV2Jq18kvUd9pmz5.mjs → r7vPXPCC6zFI-B4m.mjs} +1 -1
- package/node/esm/{DIUtMpFEGWd4fFvO.mjs → CJ8rg6a2gULy0991.mjs} +1 -1
- package/node/esm/index.mjs +623 -610
- package/package.json +2 -2
- package/types/index.d.ts +259 -183
package/types/index.d.ts
CHANGED
|
@@ -23,25 +23,6 @@ declare function boundPixel(cssPoint: number, _increase?: boolean, _absOffset?:
|
|
|
23
23
|
|
|
24
24
|
export declare type CellFinder = (activeCoords: CellCoords, isContentfulCell: IsContentfulCell | undefined, hiddenAt: HiddenHeadersAt | undefined, direction: Direction, first: boolean, limit: number) => number;
|
|
25
25
|
|
|
26
|
-
export declare interface CellLayout {
|
|
27
|
-
/**
|
|
28
|
-
* Returns the offset given an index.
|
|
29
|
-
*/
|
|
30
|
-
getColOffset: ItemSizer;
|
|
31
|
-
/**
|
|
32
|
-
* Returns the index given an offset.
|
|
33
|
-
*/
|
|
34
|
-
getColIndex: ItemSizer;
|
|
35
|
-
/**
|
|
36
|
-
* Returns the offset given an index.
|
|
37
|
-
*/
|
|
38
|
-
getRowOffset: ItemSizer;
|
|
39
|
-
/**
|
|
40
|
-
* Returns the index given an offset.
|
|
41
|
-
*/
|
|
42
|
-
getRowIndex: ItemSizer;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
26
|
export declare type ClickOrFocusAwayListener = (event: globalThis.MouseEvent | globalThis.KeyboardEvent) => void;
|
|
46
27
|
|
|
47
28
|
export declare interface ClickOrFocusAwayOptions {
|
|
@@ -49,45 +30,60 @@ export declare interface ClickOrFocusAwayOptions {
|
|
|
49
30
|
focusEvents?: boolean;
|
|
50
31
|
}
|
|
51
32
|
|
|
33
|
+
/**
|
|
34
|
+
* A default implementation of ICommand
|
|
35
|
+
*/
|
|
52
36
|
export declare class Command<STATE extends any = void, CONTEXT extends any = void> implements ICommand<STATE, CONTEXT> {
|
|
53
37
|
protected _key: string;
|
|
54
|
-
protected _target:
|
|
55
|
-
protected _label: DynamicValue<string, CONTEXT>;
|
|
56
|
-
protected _scopedLabels?: Record<string, DynamicValue<string, CONTEXT>>;
|
|
57
|
-
protected _description?: DynamicValue<string, CONTEXT>;
|
|
58
|
-
protected _icon: DynamicValue<React.ReactElement | string, CONTEXT>;
|
|
59
|
-
protected _tags: DynamicValue<string[], CONTEXT>;
|
|
60
|
-
protected _shortcut: DynamicValue<IKeyStroke | IKeyStroke[] | null, CONTEXT>;
|
|
61
|
-
protected _disabled: DynamicValue<boolean, CONTEXT>;
|
|
38
|
+
protected _target: ICommand.ITarget | (() => ICommand.ITarget);
|
|
39
|
+
protected _label: ICommand.DynamicValue<string, CONTEXT>;
|
|
40
|
+
protected _scopedLabels?: Record<string, ICommand.DynamicValue<string, CONTEXT>>;
|
|
41
|
+
protected _description?: ICommand.DynamicValue<string, CONTEXT>;
|
|
42
|
+
protected _icon: ICommand.DynamicValue<React.ReactElement | string, CONTEXT>;
|
|
43
|
+
protected _tags: ICommand.DynamicValue<string[], CONTEXT>;
|
|
44
|
+
protected _shortcut: ICommand.DynamicValue<IKeyStroke | IKeyStroke[] | null, CONTEXT>;
|
|
45
|
+
protected _disabled: ICommand.DynamicValue<boolean, CONTEXT>;
|
|
62
46
|
protected _state: STATE;
|
|
63
47
|
protected _context: CONTEXT;
|
|
64
|
-
protected _callback:
|
|
65
|
-
protected _listenersProperties: Set<
|
|
66
|
-
protected _listenersExecute: Set<
|
|
67
|
-
constructor(key: string, target:
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
48
|
+
protected _callback: ICommand.Callback<STATE>;
|
|
49
|
+
protected _listenersProperties: Set<ICommand.PropertyListener<STATE, CONTEXT>>;
|
|
50
|
+
protected _listenersExecute: Set<ICommand.Hook<STATE, CONTEXT>>;
|
|
51
|
+
constructor(key: string, target: ICommand.ITarget | (() => ICommand.ITarget) | null, props?: ICommand.Properties<STATE, CONTEXT>, callback?: ICommand.Callback<STATE>);
|
|
52
|
+
/** @inheritdoc ICommand.getKey */
|
|
53
|
+
getKey(): string;
|
|
54
|
+
protected _resolve<T = any>(value: ICommand.DynamicValue<T, CONTEXT>, scopedContext?: CONTEXT | (() => CONTEXT)): T;
|
|
55
|
+
/** @inheritdoc ICommand.getTarget */
|
|
56
|
+
getTarget(): ICommand.ITarget;
|
|
57
|
+
/** @inheritdoc ICommand.getLabel */
|
|
58
|
+
getLabel(scope?: string, scopedContext?: CONTEXT): string;
|
|
59
|
+
/** @inheritdoc ICommand.getDescription */
|
|
60
|
+
getDescription(context?: ICommand.DynamicContext<CONTEXT>): string;
|
|
61
|
+
/** @inheritdoc ICommand.getTags */
|
|
62
|
+
getTags(context?: ICommand.DynamicContext<CONTEXT>): string[];
|
|
63
|
+
/** @inheritdoc ICommand.getIcon */
|
|
64
|
+
getIcon(context?: ICommand.DynamicContext<CONTEXT>): React.ReactElement | string;
|
|
65
|
+
/** @inheritdoc ICommand.getShortcut */
|
|
66
|
+
getShortcut(): IKeyStroke | readonly IKeyStroke[];
|
|
67
|
+
/** @inheritdoc ICommand.disabled */
|
|
76
68
|
disabled(): boolean;
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
69
|
+
/** @inheritdoc ICommand.getState */
|
|
70
|
+
getState(): STATE;
|
|
71
|
+
/** @inheritdoc ICommand.getContext */
|
|
72
|
+
getContext(): CONTEXT;
|
|
73
|
+
/** @inheritdoc ICommand.execute */
|
|
74
|
+
execute(args: STATE, hook?: ICommand.Hook<STATE, CONTEXT>): Promise<boolean>;
|
|
75
|
+
/** @inheritdoc ICommand.addPropertyListener */
|
|
76
|
+
addPropertyListener(listener: ICommand.PropertyListener<STATE, CONTEXT>, fireOnListen?: boolean): RemoveListener;
|
|
77
|
+
/** @inheritdoc ICommand.addExecuteListener */
|
|
78
|
+
addExecuteListener(listener: ICommand.Hook<STATE, CONTEXT>): RemoveListener;
|
|
85
79
|
protected _notifyExecute(args: STATE): void;
|
|
86
80
|
protected _notifyError(error: any, args: STATE): void;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
81
|
+
/** @inheritdoc ICommand.updateCallback */
|
|
82
|
+
updateCallback(callback: ICommand.Callback<STATE>): ICommand<STATE, CONTEXT>;
|
|
83
|
+
/** @inheritdoc ICommand.update */
|
|
84
|
+
update(props: ICommand.Properties<STATE, CONTEXT>): ICommand<STATE, CONTEXT>;
|
|
85
|
+
protected _notifyPropertyChange(props: ICommand.Properties<STATE, CONTEXT>): void;
|
|
86
|
+
protected _applyProps(props: ICommand.Properties<STATE, CONTEXT>): ICommand.Properties<STATE, CONTEXT>;
|
|
91
87
|
}
|
|
92
88
|
|
|
93
89
|
export declare interface CommandButtonOptions<STATE = any, CONTEXT = any> extends Omit<React.HTMLAttributes<HTMLElement>, "color" | "label"> {
|
|
@@ -96,7 +92,7 @@ export declare interface CommandButtonOptions<STATE = any, CONTEXT = any> extend
|
|
|
96
92
|
* Useful when knowing the specific button that executed a command is required.
|
|
97
93
|
* (For example when closing menus or restoring focus)
|
|
98
94
|
*/
|
|
99
|
-
commandHook?:
|
|
95
|
+
commandHook?: ICommand.Hook<STATE, CONTEXT>;
|
|
100
96
|
/**
|
|
101
97
|
* Optional string to enable the command label to be configured based on the scope of how it is being used.
|
|
102
98
|
*/
|
|
@@ -118,7 +114,7 @@ export declare interface CommandButtonOptions<STATE = any, CONTEXT = any> extend
|
|
|
118
114
|
* Tooltip properties. If this is specified then the tooltips are used.
|
|
119
115
|
* Do not provide a child as this component will be the child.
|
|
120
116
|
*/
|
|
121
|
-
|
|
117
|
+
propsTooltip?: any;
|
|
122
118
|
/**
|
|
123
119
|
* How the button will be styles.
|
|
124
120
|
* @defaultValue CommandButtonType.Toolbar
|
|
@@ -171,7 +167,7 @@ export declare type CommandButtonType = typeof CommandButtonType[keyof typeof Co
|
|
|
171
167
|
* Default implementation of `ICommands.IGroup`.
|
|
172
168
|
*/
|
|
173
169
|
export declare class CommandGroup implements ICommands.IGroup {
|
|
174
|
-
protected _target:
|
|
170
|
+
protected _target: ICommand.ITarget | (() => ICommand.ITarget);
|
|
175
171
|
protected _groupKey: string;
|
|
176
172
|
protected _root: CommandGroup | null;
|
|
177
173
|
protected _parent: CommandGroup | null;
|
|
@@ -184,13 +180,13 @@ export declare class CommandGroup implements ICommands.IGroup {
|
|
|
184
180
|
protected _listeners: Set<ICommands.IListener>;
|
|
185
181
|
protected _listenersByKey: Map<string, Set<ICommands.IListener> | null>;
|
|
186
182
|
protected _unListenersByCommand: Map<ICommand, RemoveListener>;
|
|
187
|
-
protected _commandsPropertyListener:
|
|
188
|
-
constructor(target:
|
|
183
|
+
protected _commandsPropertyListener: ICommand.PropertyListener<any, any>;
|
|
184
|
+
constructor(target: ICommand.ITarget | (() => ICommand.ITarget), groupKey?: string);
|
|
189
185
|
private _getCommand;
|
|
190
186
|
/** {@inheritDoc ICommands.IGroup.getCommand} */
|
|
191
187
|
getCommand(key: string, _ignoreActive?: boolean): ICommand<any, any>;
|
|
192
188
|
/** {@inheritDoc ICommands.IGroup.createChildGroup} */
|
|
193
|
-
createChildGroup(target:
|
|
189
|
+
createChildGroup(target: ICommand.ITarget | (() => ICommand.ITarget), when: string, replace?: boolean): ICommands.IGroup;
|
|
194
190
|
/** {@inheritDoc ICommands.IGroup.getKey} */
|
|
195
191
|
getKey(): string;
|
|
196
192
|
/** {@inheritDoc ICommands.IGroup.getGroup} */
|
|
@@ -291,12 +287,7 @@ export declare function createDynamicIconService(): {
|
|
|
291
287
|
*/
|
|
292
288
|
declare const createSyntheticEvent: <T extends Element, E extends Event, R extends React.SyntheticEvent<T, E>>(event: E, currentTarget?: EventTarget & T) => R;
|
|
293
289
|
|
|
294
|
-
declare const
|
|
295
|
-
|
|
296
|
-
export declare const defaultCreateScrollCorner: ({ width, height }: {
|
|
297
|
-
width: any;
|
|
298
|
-
height: any;
|
|
299
|
-
}) => JSX.Element;
|
|
290
|
+
export declare const defaultCreateScrollCorner: (size: Size) => JSX.Element;
|
|
300
291
|
|
|
301
292
|
/**
|
|
302
293
|
* TODO - implement styling support similar to other scroll buttons. Currently hardcoded
|
|
@@ -350,6 +341,8 @@ export declare class DefaultReactNotifier extends DefaultNotifier implements IRe
|
|
|
350
341
|
showInput(options: ShowInputOptions): Promise<InputResults>;
|
|
351
342
|
}
|
|
352
343
|
|
|
344
|
+
declare const defaultRenderScrollbar: (props: ScrollbarProps) => JSX.Element;
|
|
345
|
+
|
|
353
346
|
/**
|
|
354
347
|
* Re-export detectIt.
|
|
355
348
|
*
|
|
@@ -385,8 +378,6 @@ export declare interface DevicePixelRatioOptions {
|
|
|
385
378
|
maxDpr?: number;
|
|
386
379
|
}
|
|
387
380
|
|
|
388
|
-
declare type DynamicContext<CONTEXT> = CONTEXT | (() => CONTEXT);
|
|
389
|
-
|
|
390
381
|
export declare const DynamicIcon: default_2.MemoExoticComponent<(props: DynamicIconProps) => JSX.Element>;
|
|
391
382
|
|
|
392
383
|
export declare interface DynamicIconProps extends default_2.HTMLAttributes<HTMLElement> {
|
|
@@ -400,11 +391,9 @@ export declare interface DynamicIconProps extends default_2.HTMLAttributes<HTMLE
|
|
|
400
391
|
role?: 'img' | 'presentation' | string;
|
|
401
392
|
ariaHidden?: boolean;
|
|
402
393
|
/** Extra props forwarded to React glyphs (if the glyph is of type `react`) */
|
|
403
|
-
|
|
394
|
+
propsSource?: unknown;
|
|
404
395
|
}
|
|
405
396
|
|
|
406
|
-
declare type DynamicValue<T, CONTEXT> = T | ((context?: DynamicContext<CONTEXT>) => T);
|
|
407
|
-
|
|
408
397
|
export declare type EmojiGlyph = BaseGlyph & {
|
|
409
398
|
emoji: string | {
|
|
410
399
|
text: string;
|
|
@@ -528,6 +517,25 @@ export declare const HorizontalAlignment: {
|
|
|
528
517
|
|
|
529
518
|
export declare type HorizontalAlignment = typeof HorizontalAlignment[keyof typeof HorizontalAlignment];
|
|
530
519
|
|
|
520
|
+
export declare interface ICellLayout {
|
|
521
|
+
/**
|
|
522
|
+
* Returns the offset given an index.
|
|
523
|
+
*/
|
|
524
|
+
getColOffset: ItemSizer;
|
|
525
|
+
/**
|
|
526
|
+
* Returns the index given an offset.
|
|
527
|
+
*/
|
|
528
|
+
getColIndex: ItemSizer;
|
|
529
|
+
/**
|
|
530
|
+
* Returns the offset given an index.
|
|
531
|
+
*/
|
|
532
|
+
getRowOffset: ItemSizer;
|
|
533
|
+
/**
|
|
534
|
+
* Returns the index given an offset.
|
|
535
|
+
*/
|
|
536
|
+
getRowIndex: ItemSizer;
|
|
537
|
+
}
|
|
538
|
+
|
|
531
539
|
export declare interface ICommand<STATE extends any = any, CONTEXT extends any = void> {
|
|
532
540
|
/**
|
|
533
541
|
* A unique key for the command. This is how the command is identified
|
|
@@ -536,59 +544,164 @@ export declare interface ICommand<STATE extends any = any, CONTEXT extends any =
|
|
|
536
544
|
* @remarks
|
|
537
545
|
* Immutable
|
|
538
546
|
*/
|
|
539
|
-
|
|
540
|
-
|
|
547
|
+
getKey(): string;
|
|
548
|
+
/**
|
|
549
|
+
* The target that the command operates on.
|
|
550
|
+
*/
|
|
551
|
+
getTarget(): ICommand.ITarget;
|
|
552
|
+
/**
|
|
553
|
+
* Indicates if the command is disabled.
|
|
554
|
+
*/
|
|
541
555
|
disabled(): boolean;
|
|
542
|
-
execute(args?: STATE, hook?: ICommandHook<STATE, CONTEXT>): Promise<boolean>;
|
|
543
556
|
/**
|
|
544
|
-
*
|
|
557
|
+
* Called to execute the command.
|
|
558
|
+
*
|
|
559
|
+
* @param args Optional arguments for the command.
|
|
560
|
+
*/
|
|
561
|
+
execute(args?: STATE, hook?: ICommand.Hook<STATE, CONTEXT>): Promise<boolean>;
|
|
562
|
+
/**
|
|
563
|
+
* Represents the model state.
|
|
564
|
+
*/
|
|
565
|
+
getState(): STATE;
|
|
566
|
+
/**
|
|
567
|
+
* The current view context associated with the command.
|
|
545
568
|
*/
|
|
546
|
-
|
|
547
|
-
context(): CONTEXT;
|
|
569
|
+
getContext(): CONTEXT;
|
|
548
570
|
/**
|
|
549
571
|
* Additional information that may be needed to render or make decisions about setting state.
|
|
550
572
|
*/
|
|
551
|
-
update(props:
|
|
552
|
-
updateCallback(callback: ICommandCallback<STATE>): ICommand<STATE, CONTEXT>;
|
|
573
|
+
update(props: ICommand.Properties<STATE, CONTEXT>): ICommand<STATE, CONTEXT>;
|
|
553
574
|
/**
|
|
554
|
-
*
|
|
575
|
+
* Update the callback function for the command.
|
|
576
|
+
* @param callback
|
|
555
577
|
*/
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
578
|
+
updateCallback(callback: ICommand.Callback<STATE>): ICommand<STATE, CONTEXT>;
|
|
579
|
+
/**
|
|
580
|
+
* Add a listener that will be called when command properties have changed
|
|
581
|
+
*/
|
|
582
|
+
addPropertyListener(listener: ICommand.PropertyListener<STATE, CONTEXT>, fireOnListen?: boolean): RemoveListener;
|
|
583
|
+
/**
|
|
584
|
+
* Add a listener that will be called when the command is executed
|
|
585
|
+
* @param listener
|
|
586
|
+
*/
|
|
587
|
+
addExecuteListener(listener: ICommand.Hook<STATE, CONTEXT>): RemoveListener;
|
|
588
|
+
/**
|
|
589
|
+
* Get the shortcut(s) associated with the command.
|
|
590
|
+
*/
|
|
591
|
+
getShortcut(): IKeyStroke | readonly IKeyStroke[];
|
|
592
|
+
/**
|
|
593
|
+
* Get the label associated with the command.
|
|
594
|
+
*/
|
|
595
|
+
getLabel(scope?: string, context?: ICommand.DynamicContext<CONTEXT>): string;
|
|
596
|
+
/**
|
|
597
|
+
* Get the tags associated with the command.
|
|
598
|
+
*/
|
|
599
|
+
getTags(context?: ICommand.DynamicContext<CONTEXT>): string[];
|
|
600
|
+
/**
|
|
601
|
+
* Get the description associated with the command.
|
|
602
|
+
*/
|
|
603
|
+
getDescription(context?: ICommand.DynamicContext<CONTEXT>): string;
|
|
604
|
+
/**
|
|
605
|
+
* Get the icon associated with the command.
|
|
606
|
+
*/
|
|
607
|
+
getIcon(context?: ICommand.DynamicContext<CONTEXT>): React.ReactElement | string;
|
|
567
608
|
}
|
|
568
609
|
|
|
569
610
|
/**
|
|
570
|
-
*
|
|
611
|
+
* @see
|
|
612
|
+
* ### **Interface**
|
|
613
|
+
*
|
|
614
|
+
* {@link ICommand}
|
|
571
615
|
*/
|
|
572
|
-
export declare
|
|
616
|
+
export declare namespace ICommand {
|
|
617
|
+
/**
|
|
618
|
+
* Used to interactive with a dom element.
|
|
619
|
+
*
|
|
620
|
+
* @remarks
|
|
621
|
+
* * When dispatching keystrokes the target is used to determine if the keystroke
|
|
622
|
+
* can be consumed by the element.
|
|
623
|
+
* * Many commands will refocus the target after they have completed. The target focus will be called.
|
|
624
|
+
*/
|
|
625
|
+
export interface ITarget {
|
|
626
|
+
/**
|
|
627
|
+
* Used to determine if a dom element is contained with the group.
|
|
628
|
+
*
|
|
629
|
+
* @param element
|
|
630
|
+
*
|
|
631
|
+
* @remarks
|
|
632
|
+
* This is used for validating keystrokes and focus traversal.
|
|
633
|
+
*/
|
|
634
|
+
contains(element: Node | null): boolean;
|
|
635
|
+
/**
|
|
636
|
+
* Called after a command is executed.
|
|
637
|
+
*/
|
|
638
|
+
focus(): void;
|
|
639
|
+
}
|
|
573
640
|
/**
|
|
574
|
-
*
|
|
575
|
-
* this is completed.
|
|
641
|
+
* The callback function for a command.
|
|
576
642
|
*
|
|
577
|
-
* @
|
|
578
|
-
*
|
|
643
|
+
* @remarks
|
|
644
|
+
* When
|
|
579
645
|
*/
|
|
580
|
-
|
|
646
|
+
export interface Callback<STATE extends any = void> {
|
|
647
|
+
(args?: STATE, command?: ICommand<STATE, unknown>): void | boolean | Promise<boolean> | Promise<void>;
|
|
648
|
+
}
|
|
649
|
+
export type DynamicContext<CONTEXT> = CONTEXT | (() => CONTEXT);
|
|
650
|
+
export type DynamicValue<T, CONTEXT> = T | ((context?: DynamicContext<CONTEXT>) => T);
|
|
581
651
|
/**
|
|
582
|
-
*
|
|
652
|
+
* Properties that can be updated on a command.
|
|
583
653
|
*/
|
|
584
|
-
|
|
654
|
+
export interface Properties<STATE extends any = void, CONTEXT extends any = void> {
|
|
655
|
+
disabled?: boolean | (() => boolean);
|
|
656
|
+
/**
|
|
657
|
+
* Values associated with the command model.
|
|
658
|
+
*/
|
|
659
|
+
state?: STATE;
|
|
660
|
+
/**
|
|
661
|
+
* View specific context values
|
|
662
|
+
*/
|
|
663
|
+
context?: DynamicContext<CONTEXT>;
|
|
664
|
+
shortcut?: IKeyStroke | IKeyStroke[] | (() => IKeyStroke);
|
|
665
|
+
label?: DynamicValue<string, CONTEXT>;
|
|
666
|
+
tags?: DynamicValue<string[], CONTEXT>;
|
|
667
|
+
/**
|
|
668
|
+
* The ability to override labels for specific context. Useful for content menus
|
|
669
|
+
* For example 'Rename Sheet' command might only want to be displayed as 'Rename' in the content menu.
|
|
670
|
+
*/
|
|
671
|
+
scopedLabels?: Record<string, DynamicValue<string, CONTEXT>>;
|
|
672
|
+
description?: DynamicValue<string, CONTEXT>;
|
|
673
|
+
icon?: DynamicValue<React.ReactNode, CONTEXT>;
|
|
674
|
+
}
|
|
675
|
+
export interface PropertyListener<STATE extends any, CONTEXT extends any> {
|
|
676
|
+
/**
|
|
677
|
+
* Called when command properties have changed.
|
|
678
|
+
*/
|
|
679
|
+
(props: ICommand.Properties<STATE, CONTEXT>, command: ICommand<STATE, CONTEXT>): void;
|
|
680
|
+
}
|
|
585
681
|
/**
|
|
586
|
-
*
|
|
682
|
+
* A hook that can be passed to a command execute function.
|
|
587
683
|
*/
|
|
588
|
-
|
|
684
|
+
export interface Hook<STATE extends any, CONTEXT extends any = void> {
|
|
685
|
+
/**
|
|
686
|
+
* If implemented will be called when execute is called. If a promise is return if will wait until
|
|
687
|
+
* this is completed.
|
|
688
|
+
*
|
|
689
|
+
* @param command
|
|
690
|
+
* @param args
|
|
691
|
+
*/
|
|
692
|
+
beforeExecute?(command: ICommand<STATE, CONTEXT>, args: STATE): Promise<boolean | void> | boolean | void;
|
|
693
|
+
/**
|
|
694
|
+
* Called when a command has been executed successful.
|
|
695
|
+
*/
|
|
696
|
+
onExecute?(command: ICommand<STATE, CONTEXT>, args: STATE): void;
|
|
697
|
+
/**
|
|
698
|
+
* Called when a command failed to executed successfully.
|
|
699
|
+
*/
|
|
700
|
+
onError?(command: ICommand<STATE, CONTEXT>, error: any, args: STATE): void;
|
|
701
|
+
}
|
|
589
702
|
}
|
|
590
703
|
|
|
591
|
-
export declare interface ICommandListener<STATE extends any, CONTEXT extends any = void> extends
|
|
704
|
+
export declare interface ICommandListener<STATE extends any, CONTEXT extends any = void> extends ICommand.Hook<STATE, CONTEXT> {
|
|
592
705
|
onChange?(command: ICommand<STATE, CONTEXT>): void;
|
|
593
706
|
}
|
|
594
707
|
|
|
@@ -596,29 +709,6 @@ export declare interface ICommandListenerOptions {
|
|
|
596
709
|
fireOnCommandChange: boolean;
|
|
597
710
|
}
|
|
598
711
|
|
|
599
|
-
export declare interface ICommandProperties<STATE extends any = void, CONTEXT extends any = void> {
|
|
600
|
-
disabled?: boolean | (() => boolean);
|
|
601
|
-
state?: STATE;
|
|
602
|
-
context?: DynamicContext<CONTEXT>;
|
|
603
|
-
shortcut?: IKeyStroke | IKeyStroke[] | (() => IKeyStroke);
|
|
604
|
-
label?: DynamicValue<string, CONTEXT>;
|
|
605
|
-
tags?: DynamicValue<string[], CONTEXT>;
|
|
606
|
-
/**
|
|
607
|
-
* The ability to override labels for specific context. Useful for content menus
|
|
608
|
-
* For example 'Rename Sheet' command might only want to be displayed as 'Rename' in the content menu.
|
|
609
|
-
*/
|
|
610
|
-
scopedLabels?: Record<string, DynamicValue<string, CONTEXT>>;
|
|
611
|
-
description?: DynamicValue<string, CONTEXT>;
|
|
612
|
-
icon?: DynamicValue<React.ReactNode, CONTEXT>;
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
export declare interface ICommandPropertyListener<STATE extends any, CONTEXT extends any> {
|
|
616
|
-
/**
|
|
617
|
-
* Called when command properties have changed.
|
|
618
|
-
*/
|
|
619
|
-
(props: ICommandProperties<STATE, CONTEXT>, command: ICommand<STATE, CONTEXT>): void;
|
|
620
|
-
}
|
|
621
|
-
|
|
622
712
|
/**
|
|
623
713
|
* The ICommands namespace contains interfaces for managing collections of commands and
|
|
624
714
|
* dispatching keystrokes to the most specific command.
|
|
@@ -658,29 +748,6 @@ export declare namespace ICommands {
|
|
|
658
748
|
*/
|
|
659
749
|
keys?: string[];
|
|
660
750
|
}
|
|
661
|
-
/**
|
|
662
|
-
* Used to interactive with a dom element.
|
|
663
|
-
*
|
|
664
|
-
* @remarks
|
|
665
|
-
* * When dispatching keystrokes the target is used to determine if the keystroke
|
|
666
|
-
* can be consumed by the element.
|
|
667
|
-
* * Many commands will refocus the target after they have completed. The target focus will be called.
|
|
668
|
-
*/
|
|
669
|
-
export interface ITarget {
|
|
670
|
-
/**
|
|
671
|
-
* Used to determine if a dom element is contained with the group.
|
|
672
|
-
*
|
|
673
|
-
* @param element
|
|
674
|
-
*
|
|
675
|
-
* @remarks
|
|
676
|
-
* This is used for validating keystrokes and focus traversal.
|
|
677
|
-
*/
|
|
678
|
-
contains(element: Node | null): boolean;
|
|
679
|
-
/**
|
|
680
|
-
* Called after a command is executed.
|
|
681
|
-
*/
|
|
682
|
-
focus(): void;
|
|
683
|
-
}
|
|
684
751
|
/**
|
|
685
752
|
* Contains commands and child command maps.
|
|
686
753
|
*/
|
|
@@ -700,11 +767,11 @@ export declare namespace ICommands {
|
|
|
700
767
|
/**
|
|
701
768
|
* Create a new map to add Commands.
|
|
702
769
|
*
|
|
703
|
-
* @param target {@link
|
|
770
|
+
* @param target {@link ICommand.ITarget}.
|
|
704
771
|
* @param groupKey String description describing the reason for the group. This is presented to the user in the shortcut UI.
|
|
705
772
|
* @param replace If `true` replace the existing commands. If `false` ignores duplicates. If unspecified a warning will be logged for duplicates.
|
|
706
773
|
*/
|
|
707
|
-
createChildGroup(target:
|
|
774
|
+
createChildGroup(target: ICommand.ITarget | (() => ICommand.ITarget), groupKey: string, replace?: boolean): ICommands.IGroup;
|
|
708
775
|
/**
|
|
709
776
|
* Returns the keys associated with the group
|
|
710
777
|
*/
|
|
@@ -780,9 +847,10 @@ export declare namespace ICommands {
|
|
|
780
847
|
}
|
|
781
848
|
}
|
|
782
849
|
|
|
783
|
-
export declare interface ICommandsListeners<STATE extends any, CONTEXT extends any = void> extends
|
|
850
|
+
export declare interface ICommandsListeners<STATE extends any, CONTEXT extends any = void> extends ICommand.Hook<STATE, CONTEXT> {
|
|
784
851
|
/**
|
|
785
852
|
* Called when either the command group is updated or if keys are provided then the commands as well.
|
|
853
|
+
*
|
|
786
854
|
* @param commands
|
|
787
855
|
*/
|
|
788
856
|
onChange?(commands: ICommands.IGroup): void;
|
|
@@ -997,6 +1065,8 @@ export declare const KeyCodes: {
|
|
|
997
1065
|
readonly Slash: 191;
|
|
998
1066
|
readonly BracketRight: 221;
|
|
999
1067
|
readonly BracketLeft: 219;
|
|
1068
|
+
/** Android/IME composition key - used when virtual keyboards send composite input */
|
|
1069
|
+
readonly Composition: 229;
|
|
1000
1070
|
};
|
|
1001
1071
|
|
|
1002
1072
|
export declare type KeyCodes = typeof KeyCodes[keyof typeof KeyCodes];
|
|
@@ -1283,7 +1353,7 @@ export declare type ScrollableViewport = {
|
|
|
1283
1353
|
totalHeight: number;
|
|
1284
1354
|
};
|
|
1285
1355
|
|
|
1286
|
-
export declare const Scrollbar: default_2.NamedExoticComponent<ScrollbarProps & default_2.RefAttributes<IScrollbarElement>>;
|
|
1356
|
+
export declare const Scrollbar: default_2.NamedExoticComponent<Omit<ScrollbarProps, "ref"> & default_2.RefAttributes<IScrollbarElement>>;
|
|
1287
1357
|
|
|
1288
1358
|
export declare const ScrollbarOrientation: {
|
|
1289
1359
|
readonly Horizontal: "horizontal";
|
|
@@ -1329,20 +1399,24 @@ export declare interface ScrollbarProps extends default_2.HTMLAttributes<HTMLEle
|
|
|
1329
1399
|
scrollButtonIncrement?: number | ((offset: number, viewport: number, totalSize: number) => number);
|
|
1330
1400
|
scrollButtonInitialRepeatDelay?: number;
|
|
1331
1401
|
scrollButtonAdditionalRepeatDelay?: number;
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1402
|
+
renderScrollButtonStart?: (props: ScrollButtonProps) => default_2.ReactElement;
|
|
1403
|
+
renderScrollButtonEnd?: (props: ScrollButtonProps) => default_2.ReactElement;
|
|
1404
|
+
propsTouchThumb?: Partial<TouchThumbHandleProps>;
|
|
1405
|
+
propsThumb?: default_2.HTMLAttributes<HTMLElement>;
|
|
1406
|
+
/**
|
|
1407
|
+
* Reference to the underling element
|
|
1408
|
+
*/
|
|
1409
|
+
ref?: default_2.Ref<IScrollbarElement>;
|
|
1336
1410
|
}
|
|
1337
1411
|
|
|
1338
|
-
export declare interface ScrollButtonProps {
|
|
1339
|
-
style?: default_2.CSSProperties;
|
|
1412
|
+
export declare interface ScrollButtonProps extends default_2.HTMLAttributes<any> {
|
|
1340
1413
|
orientation?: ScrollbarOrientation;
|
|
1341
1414
|
disabled?: boolean;
|
|
1342
|
-
onMouseUp: (e: default_2.MouseEvent<
|
|
1343
|
-
onMouseLeave: (e: default_2.MouseEvent<
|
|
1344
|
-
onMouseDown: (e: default_2.MouseEvent<
|
|
1345
|
-
onClick?: (e: default_2.MouseEvent<
|
|
1415
|
+
onMouseUp: (e: default_2.MouseEvent<any>) => void;
|
|
1416
|
+
onMouseLeave: (e: default_2.MouseEvent<any>) => void;
|
|
1417
|
+
onMouseDown: (e: default_2.MouseEvent<any>) => void;
|
|
1418
|
+
onClick?: (e: default_2.MouseEvent<any>) => void;
|
|
1419
|
+
ref?: default_2.Ref<any>;
|
|
1346
1420
|
}
|
|
1347
1421
|
|
|
1348
1422
|
export declare const ScrollPane: default_2.NamedExoticComponent<Omit<ScrollPaneProps, "ref"> & default_2.RefAttributes<IScrollPaneElement>>;
|
|
@@ -1356,8 +1430,8 @@ export declare interface ScrollPaneProps extends React.HTMLAttributes<HTMLDivEle
|
|
|
1356
1430
|
showHorizontalScrollbar?: boolean;
|
|
1357
1431
|
showVerticalScrollbar?: boolean;
|
|
1358
1432
|
createScrollCorner?: (size: Size) => React.ReactNode;
|
|
1359
|
-
|
|
1360
|
-
|
|
1433
|
+
renderScrollbarHorizontal?: (props: ScrollbarProps) => React.ReactNode;
|
|
1434
|
+
renderScrollbarVertical?: (props: ScrollbarProps) => React.ReactNode;
|
|
1361
1435
|
/**
|
|
1362
1436
|
* By default the ScrollPane will listen for events on all of the children of the ScrollPane but this
|
|
1363
1437
|
* allows for a custom element to be specified. Useful when the ScrollPane has some elements
|
|
@@ -1383,7 +1457,7 @@ export declare interface ScrollState extends TopLeft {
|
|
|
1383
1457
|
export declare namespace ScrollUtils {
|
|
1384
1458
|
export {
|
|
1385
1459
|
getScrollTo,
|
|
1386
|
-
|
|
1460
|
+
defaultRenderScrollbar
|
|
1387
1461
|
}
|
|
1388
1462
|
}
|
|
1389
1463
|
|
|
@@ -1395,7 +1469,7 @@ export declare interface ShowInputOptions<T = string, C = any> extends ShowOptio
|
|
|
1395
1469
|
/**
|
|
1396
1470
|
* Css style for input
|
|
1397
1471
|
*/
|
|
1398
|
-
|
|
1472
|
+
propsInput?: default_2.HTMLAttributes<HTMLInputElement | HTMLTextAreaElement>;
|
|
1399
1473
|
inputLabel?: string;
|
|
1400
1474
|
inputType?: 'text' | 'password' | 'email' | 'number' | 'search' | 'tel' | 'url';
|
|
1401
1475
|
inputPlaceHolder?: string;
|
|
@@ -1496,6 +1570,9 @@ export declare interface ShowWindowOptions<T = any, C = any> {
|
|
|
1496
1570
|
disableAutoDestroy?: boolean;
|
|
1497
1571
|
}
|
|
1498
1572
|
|
|
1573
|
+
/**
|
|
1574
|
+
* A simple command that does not maintain state or context.
|
|
1575
|
+
*/
|
|
1499
1576
|
export declare class SimpleCommand extends Command<void, void> {
|
|
1500
1577
|
}
|
|
1501
1578
|
|
|
@@ -1507,9 +1584,7 @@ export declare class SimpleCommand extends Command<void, void> {
|
|
|
1507
1584
|
* Because this component measures the elements (both panes and the resizer) it is important
|
|
1508
1585
|
* that none of these have margins or paddings. If these are required then use a nested element.
|
|
1509
1586
|
*/
|
|
1510
|
-
export declare const SplitPane: default_2.
|
|
1511
|
-
ref?: default_2.Ref<ISplitPaneElement>;
|
|
1512
|
-
}>;
|
|
1587
|
+
export declare const SplitPane: default_2.NamedExoticComponent<Omit<SplitPaneProps, "ref"> & default_2.RefAttributes<ISplitPaneElement>>;
|
|
1513
1588
|
|
|
1514
1589
|
export declare interface SplitPaneAttributes {
|
|
1515
1590
|
/**
|
|
@@ -1576,28 +1651,29 @@ export declare interface SplitPaneProps extends default_2.HTMLAttributes<HTMLDiv
|
|
|
1576
1651
|
*/
|
|
1577
1652
|
splitDirection?: 'row' | 'column';
|
|
1578
1653
|
disabled?: boolean;
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1654
|
+
propsResizer?: SplitPaneResizerProps;
|
|
1655
|
+
propsPane?: default_2.HTMLAttributes<HTMLElement>;
|
|
1656
|
+
propsPaneBefore?: default_2.HTMLAttributes<HTMLElement>;
|
|
1657
|
+
propsPaneAfter?: default_2.HTMLAttributes<HTMLElement>;
|
|
1583
1658
|
onDragStart?: () => void;
|
|
1584
1659
|
onDragResize?: (position: number) => void;
|
|
1585
1660
|
onDragFinish?: (position: number) => void;
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1661
|
+
renderResizer?: (props: SplitPaneResizerProps) => default_2.ReactElement;
|
|
1662
|
+
/**
|
|
1663
|
+
* A ref that points to the HTMLDivElement.
|
|
1664
|
+
*/
|
|
1665
|
+
ref?: default_2.Ref<ISplitPaneElement>;
|
|
1589
1666
|
}
|
|
1590
1667
|
|
|
1591
|
-
export declare const SplitPaneResizer: (props: SplitPaneResizerProps
|
|
1592
|
-
ref?: default_2.Ref<HTMLDivElement>;
|
|
1593
|
-
}) => default_2.ReactElement;
|
|
1668
|
+
export declare const SplitPaneResizer: (props: SplitPaneResizerProps) => default_2.ReactElement;
|
|
1594
1669
|
|
|
1595
|
-
export declare interface SplitPaneResizerProps extends default_2.HTMLAttributes<HTMLDivElement
|
|
1670
|
+
export declare interface SplitPaneResizerProps extends default_2.HTMLAttributes<HTMLDivElement>, default_2.Attributes {
|
|
1596
1671
|
splitDirection?: 'row' | 'column';
|
|
1597
1672
|
disabled?: boolean;
|
|
1598
1673
|
paddingBefore?: number;
|
|
1599
1674
|
paddingAfter?: number;
|
|
1600
|
-
|
|
1675
|
+
propsHitArea?: default_2.HTMLAttributes<HTMLDivElement>;
|
|
1676
|
+
ref?: default_2.Ref<HTMLDivElement>;
|
|
1601
1677
|
}
|
|
1602
1678
|
|
|
1603
1679
|
export declare interface Style {
|
|
@@ -1789,7 +1865,7 @@ export declare interface UseAnimatedMeasureOptions {
|
|
|
1789
1865
|
export declare const useCallbackRef: <T extends (...args: any[]) => any>(callback: T, deps: DependencyList) => T;
|
|
1790
1866
|
|
|
1791
1867
|
/**
|
|
1792
|
-
* Useful for capture command changes. This can be used with an @see
|
|
1868
|
+
* Useful for capture command changes. This can be used with an @see ICommand.Hook or without.
|
|
1793
1869
|
* If used with then will call the function. If not then a change will force a re-render.
|
|
1794
1870
|
|
|
1795
1871
|
* @param command
|
|
@@ -1798,7 +1874,7 @@ export declare const useCallbackRef: <T extends (...args: any[]) => any>(callbac
|
|
|
1798
1874
|
export declare function useCommand<STATE = any, CONTEXT = any>(command: ICommand<STATE, CONTEXT> | ICommand<STATE, CONTEXT>[], listener?: ICommandListener<STATE, CONTEXT>): number;
|
|
1799
1875
|
|
|
1800
1876
|
/**
|
|
1801
|
-
* Useful for capture command changes. This can be used with an @see
|
|
1877
|
+
* Useful for capture command changes. This can be used with an @see ICommand.Hook or without.
|
|
1802
1878
|
* If used with then will call the function. If not then a change will force a re-render.
|
|
1803
1879
|
*
|
|
1804
1880
|
* @param commands
|
|
@@ -1905,7 +1981,7 @@ export declare const useUndoManager: ({ manager, commands: commandsParent, disab
|
|
|
1905
1981
|
* Because of the virtual nature of the scrollbar the onScroll method is disabled
|
|
1906
1982
|
* and onScrollOffset must be used.
|
|
1907
1983
|
*/
|
|
1908
|
-
export declare const VirtualScrollbar: default_2.NamedExoticComponent<VirtualScrollbarProps & default_2.RefAttributes<
|
|
1984
|
+
export declare const VirtualScrollbar: default_2.NamedExoticComponent<Omit<VirtualScrollbarProps, "ref"> & default_2.RefAttributes<IScrollbarElement>>;
|
|
1909
1985
|
|
|
1910
1986
|
export declare interface VirtualScrollbarProps extends Omit<ScrollbarProps, "onScroll"> {
|
|
1911
1987
|
/**
|
|
@@ -1939,7 +2015,7 @@ export declare interface VirtualScrollbarProps extends Omit<ScrollbarProps, "onS
|
|
|
1939
2015
|
* @defaultValue 50
|
|
1940
2016
|
*/
|
|
1941
2017
|
precisionFactor?: number;
|
|
1942
|
-
|
|
2018
|
+
renderScrollbar?: (props: ScrollbarProps) => default_2.ReactNode;
|
|
1943
2019
|
}
|
|
1944
2020
|
|
|
1945
2021
|
export declare function WalkingIcon(props: WalkingIconProps): JSX.Element;
|