@nice2dev/ui 1.4.12 → 1.4.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +42 -0
- package/dist/NiceSavedQueryPanel-C1nxEmMu.cjs +587 -0
- package/dist/data/NiceTreeGrid.mjs +619 -545
- package/dist/data/NiceTreeView.mjs +222 -180
- package/dist/data/treeRowDrop.mjs +130 -0
- package/dist/data.cjs +1 -1
- package/dist/data.d.ts +26 -4
- package/dist/index.cjs +21 -21
- package/dist/index.d.ts +96 -4
- package/dist/index.mjs +935 -929
- package/dist/style.css +1 -1
- package/package.json +4 -4
- package/dist/NiceSavedQueryPanel-BSZhE-_l.cjs +0 -587
package/dist/index.d.ts
CHANGED
|
@@ -81,6 +81,7 @@ import { deserializeTheme } from '@nice2dev/ui-core';
|
|
|
81
81
|
import { detectGamepadFamily } from '@nice2dev/ui-core';
|
|
82
82
|
import { Dispatch } from 'react';
|
|
83
83
|
import { DisplayPreferences } from '@nice2dev/ui-core';
|
|
84
|
+
import { DragEvent as DragEvent_2 } from 'react';
|
|
84
85
|
import { endMark } from '@nice2dev/ui-core';
|
|
85
86
|
import { evaluateValidation } from '@nice2dev/ui-core';
|
|
86
87
|
import { evaluateValidationRule } from '@nice2dev/ui-core';
|
|
@@ -7540,6 +7541,9 @@ export declare const NICE_THEME_PICKER_PRESETS: NiceThemeDescriptor[];
|
|
|
7540
7541
|
|
|
7541
7542
|
export { NICE_THEME_PRESETS }
|
|
7542
7543
|
|
|
7544
|
+
/** The type the dragged row's key travels under (plus `text/plain`, which Firefox needs to start). */
|
|
7545
|
+
export declare const NICE_TREE_ROW_MIME = "application/x-nice-tree-row";
|
|
7546
|
+
|
|
7543
7547
|
export { NiceA11yConfig }
|
|
7544
7548
|
|
|
7545
7549
|
export { NiceA11yProvider }
|
|
@@ -24906,7 +24910,16 @@ export declare interface NiceTreeContextMenuItem {
|
|
|
24906
24910
|
disabled?: boolean;
|
|
24907
24911
|
}
|
|
24908
24912
|
|
|
24909
|
-
|
|
24913
|
+
/** Where a dropped row goes relative to the row it is dropped on. */
|
|
24914
|
+
export declare type NiceTreeDropPosition = 'before' | 'inside' | 'after';
|
|
24915
|
+
|
|
24916
|
+
/** The row a drag is over and where it would land. */
|
|
24917
|
+
export declare interface NiceTreeDropTarget {
|
|
24918
|
+
key: string;
|
|
24919
|
+
position: NiceTreeDropPosition;
|
|
24920
|
+
}
|
|
24921
|
+
|
|
24922
|
+
export declare function NiceTreeGrid<T extends NiceTreeGridNode>({ columns, data, keyField, parentKeyField, nested, childrenField, expandedKeys: controlledExpanded, defaultExpandedKeys, onExpandedChange, hasChildren, loadChildren, rowActions, defaultExpandAll, sortable, sortField: controlledSortField, sortDirection: controlledSortDir, onSort, selectable, selectedKeys: controlledSelected, onSelectionChange, checkable, checkedKeys, defaultCheckedKeys, onCheckedChange, checkStrategy, isRowCheckable, isRowDisabled, checkboxPlacement, checkOnRowClick, showCheckedCount, checkedSummary, showSelectAll, showOnlyChecked: controlledOnlyChecked, defaultShowOnlyChecked, onShowOnlyCheckedChange, toolbarActions, searchable, searchPlaceholder, searchText, defaultSearchText, onSearchChange, searchFields, searchFilter, searchKeepDescendants, searchAutoExpand, highlightMatches, rowClassName, getRowLabel, virtualScroll, rowHeight, height, striped, compact, size, loading, disabled, readOnly, error, emptyText, toolbar, onRowClick, contextMenuItems, rowDraggable, canDrop, onRowDrop, className, style, id, testId, 'data-testid': dataTestId, accessMode, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, }: NiceTreeGridProps<T>): default_2.JSX.Element | null;
|
|
24910
24923
|
|
|
24911
24924
|
/** What a `checkedSummary` function of {@link NiceTreeGrid} gets. */
|
|
24912
24925
|
export declare interface NiceTreeGridCheckedSummaryInfo<T = NiceTreeGridNode> {
|
|
@@ -25121,6 +25134,19 @@ export declare interface NiceTreeGridProps<T extends NiceTreeGridNode = NiceTree
|
|
|
25121
25134
|
* no menu.
|
|
25122
25135
|
*/
|
|
25123
25136
|
contextMenuItems?: (row: T) => NiceTreeGridMenuItem[] | undefined;
|
|
25137
|
+
/**
|
|
25138
|
+
* Rows can be dragged onto other rows (1.4.14): `true`, or per row. The pointer picks the spot —
|
|
25139
|
+
* the top quarter of a row drops before it, the bottom quarter after it, the middle inside it —
|
|
25140
|
+
* and Ctrl+Shift+↑ / ↓ / → / ← move the focused row from the keyboard. Needs `onRowDrop`.
|
|
25141
|
+
*/
|
|
25142
|
+
rowDraggable?: boolean | ((row: T) => boolean);
|
|
25143
|
+
/** Whether a dragged row may land `position` `target` (a row never drops into its own branch). */
|
|
25144
|
+
canDrop?: (dragged: T, target: T, position: NiceTreeDropPosition) => boolean;
|
|
25145
|
+
/**
|
|
25146
|
+
* A row dropped on another, by the pointer or the keyboard. The grid does not move it: update
|
|
25147
|
+
* `data`.
|
|
25148
|
+
*/
|
|
25149
|
+
onRowDrop?: (dragKey: string, dropKey: string, position: NiceTreeDropPosition) => void;
|
|
25124
25150
|
}
|
|
25125
25151
|
|
|
25126
25152
|
/** A built-in button in the rows of {@link NiceTreeGrid}. */
|
|
@@ -25129,6 +25155,9 @@ export declare type NiceTreeGridRowAction = 'expandSubtree';
|
|
|
25129
25155
|
/** A built-in toolbar button of {@link NiceTreeGrid}. */
|
|
25130
25156
|
export declare type NiceTreeGridToolbarAction = 'expandAll' | 'collapseAll' | 'onlyChecked' | 'clearChecked';
|
|
25131
25157
|
|
|
25158
|
+
/** A keyboard move of a row: Ctrl+Shift+↑ / ↓ past a sibling, → into the one above, ← out a level. */
|
|
25159
|
+
export declare type NiceTreeKeyboardMove = 'up' | 'down' | 'in' | 'out';
|
|
25160
|
+
|
|
25132
25161
|
export declare function NiceTreeList<T extends NiceTreeListNode>({ columns, data, keyField, parentKeyField, expandedKeys: controlledExpanded, onExpandedChange, selectedKeys, onSelectionChange, selectable, sortable, loading, emptyText, className, style, accessMode, id, 'data-testid': dataTestId, }: NiceTreeListProps<T>): default_2.JSX.Element | null;
|
|
25133
25162
|
|
|
25134
25163
|
/** A tree-list node for the {@link NiceTreeList} component. */
|
|
@@ -25331,10 +25360,16 @@ export declare interface NiceTreeViewProps extends NiceBaseProps {
|
|
|
25331
25360
|
showLines?: boolean;
|
|
25332
25361
|
/** Show a loading skeleton. */
|
|
25333
25362
|
loading?: boolean;
|
|
25334
|
-
/**
|
|
25363
|
+
/**
|
|
25364
|
+
* Drag-and-drop reordering. Where a node lands follows the pointer (1.4.14): the top quarter of a
|
|
25365
|
+
* row drops before it, the bottom quarter after it, the middle inside it; Ctrl+Shift+↑ / ↓ / → / ←
|
|
25366
|
+
* move the focused node from the keyboard.
|
|
25367
|
+
*/
|
|
25335
25368
|
draggable?: boolean;
|
|
25336
|
-
/** Called after a node is dropped. */
|
|
25337
|
-
onNodeDrop?: (dragKey: string, dropKey: string, position:
|
|
25369
|
+
/** Called after a node is dropped. The tree does not move it: update `nodes`. */
|
|
25370
|
+
onNodeDrop?: (dragKey: string, dropKey: string, position: NiceTreeDropPosition) => void;
|
|
25371
|
+
/** Whether a dragged node may land `position` the target node (never inside its own branch). */
|
|
25372
|
+
canDrop?: (dragKey: string, dropKey: string, position: NiceTreeDropPosition) => boolean;
|
|
25338
25373
|
/** Lazy loading: called when expanding a node with no children and leaf !== true. */
|
|
25339
25374
|
onLoadChildren?: (node: NiceTreeNode) => Promise<NiceTreeNode[]>;
|
|
25340
25375
|
/** Context menu items shown on right-click. */
|
|
@@ -31083,6 +31118,15 @@ declare type TransformType = 'direct' | 'format' | 'convert' | 'concat' | 'split
|
|
|
31083
31118
|
|
|
31084
31119
|
export declare type TransitionType = 'fade' | 'dissolve' | 'wipe' | 'slide' | 'zoom' | 'none';
|
|
31085
31120
|
|
|
31121
|
+
/**
|
|
31122
|
+
* Which part of a row a pointer at `clientY` is over: the top quarter is `before`, the bottom
|
|
31123
|
+
* quarter `after`, the middle `inside` — or the top and bottom halves when `nest` is false.
|
|
31124
|
+
*/
|
|
31125
|
+
export declare function treeDropPosition(clientY: number, rect: {
|
|
31126
|
+
top: number;
|
|
31127
|
+
height: number;
|
|
31128
|
+
}, nest?: boolean): NiceTreeDropPosition;
|
|
31129
|
+
|
|
31086
31130
|
/** A place in a tree: a parent (`null` for the roots) and a position among its children. */
|
|
31087
31131
|
export declare interface TreeDropTarget {
|
|
31088
31132
|
parentId: string | null;
|
|
@@ -31108,6 +31152,16 @@ export declare interface TreeEditOptions {
|
|
|
31108
31152
|
childrenField?: string;
|
|
31109
31153
|
}
|
|
31110
31154
|
|
|
31155
|
+
/** The move a key press asks for (Ctrl / ⌘ + Shift + an arrow; ← and → swap right-to-left). */
|
|
31156
|
+
export declare function treeKeyboardMove(e: Pick<KeyboardEvent, 'key' | 'ctrlKey' | 'metaKey' | 'shiftKey' | 'altKey'>, rtl?: boolean): NiceTreeKeyboardMove | null;
|
|
31157
|
+
|
|
31158
|
+
/**
|
|
31159
|
+
* Where a keyboard move of `key` lands, from where the row sits: its parent and its siblings in
|
|
31160
|
+
* order. `up` goes before the sibling above, `down` after the one below, `in` inside the sibling
|
|
31161
|
+
* above, `out` after its parent. `null` when there is nowhere to go.
|
|
31162
|
+
*/
|
|
31163
|
+
export declare function treeKeyboardTarget(move: NiceTreeKeyboardMove, key: string, parentKey: string | null, siblings: readonly string[]): NiceTreeDropTarget | null;
|
|
31164
|
+
|
|
31111
31165
|
export declare interface TreeMapNode {
|
|
31112
31166
|
id: string;
|
|
31113
31167
|
name: string;
|
|
@@ -32121,6 +32175,44 @@ export { useTreeFocus }
|
|
|
32121
32175
|
|
|
32122
32176
|
export { UseTreeFocusOptions }
|
|
32123
32177
|
|
|
32178
|
+
/** Row drag and drop for a tree: the dragged row, the spot it would land on, the handlers. */
|
|
32179
|
+
export declare function useTreeRowDrop(options: UseTreeRowDropOptions): UseTreeRowDropResult;
|
|
32180
|
+
|
|
32181
|
+
export declare interface UseTreeRowDropOptions {
|
|
32182
|
+
/** Rows can be dragged. */
|
|
32183
|
+
enabled: boolean;
|
|
32184
|
+
/** Matches a row element (it carries `data-key`); the innermost match under the pointer counts. */
|
|
32185
|
+
rowSelector: string;
|
|
32186
|
+
/** The part of a row whose box the pointer is measured against (default: the row). */
|
|
32187
|
+
rectOf?: (row: HTMLElement) => Element;
|
|
32188
|
+
/** Whether a row can be picked up (default: all). */
|
|
32189
|
+
canDrag?: (key: string) => boolean;
|
|
32190
|
+
/** Whether a row takes rows inside it — its middle is a drop zone (default: all). */
|
|
32191
|
+
canNest?: (key: string) => boolean;
|
|
32192
|
+
/** Whether `key` is `ancestor` or lies below it: no row drops into its own branch. */
|
|
32193
|
+
isWithin: (key: string, ancestor: string) => boolean;
|
|
32194
|
+
/** Whether the drop is allowed (default: all that `isWithin` leaves). */
|
|
32195
|
+
canDrop?: (dragKey: string, targetKey: string, position: NiceTreeDropPosition) => boolean;
|
|
32196
|
+
onDrop?: (dragKey: string, targetKey: string, position: NiceTreeDropPosition) => void;
|
|
32197
|
+
/** A row held under a drag for a while (to open it if it is closed). */
|
|
32198
|
+
onHoverOpen?: (key: string) => void;
|
|
32199
|
+
}
|
|
32200
|
+
|
|
32201
|
+
export declare interface UseTreeRowDropResult {
|
|
32202
|
+
/** The row being dragged. */
|
|
32203
|
+
dragKey: string | null;
|
|
32204
|
+
/** Where it would land now — only an allowed spot. */
|
|
32205
|
+
target: NiceTreeDropTarget | null;
|
|
32206
|
+
/** Spread on the element that holds the rows. */
|
|
32207
|
+
handlers: {
|
|
32208
|
+
onDragStart: (e: DragEvent_2<HTMLElement>) => void;
|
|
32209
|
+
onDragOver: (e: DragEvent_2<HTMLElement>) => void;
|
|
32210
|
+
onDragLeave: (e: DragEvent_2<HTMLElement>) => void;
|
|
32211
|
+
onDrop: (e: DragEvent_2<HTMLElement>) => void;
|
|
32212
|
+
onDragEnd: () => void;
|
|
32213
|
+
};
|
|
32214
|
+
}
|
|
32215
|
+
|
|
32124
32216
|
export declare function useUndoKeyboard<T = unknown>(manager: NiceUndoManager<T>): void;
|
|
32125
32217
|
|
|
32126
32218
|
export declare function useUndoManager<T = unknown>(): UndoContextValue<T>;
|