@limetech/lime-elements 39.19.0 → 39.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/cjs/lime-elements.cjs.js +1 -1
- package/dist/cjs/limel-table.cjs.entry.js +209 -11
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/table/row-drag-manager.js +136 -0
- package/dist/collection/components/table/table-selection.js +8 -3
- package/dist/collection/components/table/table.css +65 -11
- package/dist/collection/components/table/table.js +106 -7
- package/dist/esm/lime-elements.js +1 -1
- package/dist/esm/limel-table.entry.js +209 -11
- package/dist/esm/loader.js +1 -1
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/{p-cab66fcc.entry.js → p-4ca67b17.entry.js} +1 -1
- package/dist/types/components/table/row-drag-manager.d.ts +58 -0
- package/dist/types/components/table/table.d.ts +23 -1
- package/dist/types/components/table/table.types.d.ts +20 -0
- package/dist/types/components.d.ts +20 -2
- package/package.json +1 -1
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { EventEmitter } from '../../stencil-public-runtime';
|
|
2
|
+
import { ColumnDefinition as TabulatorColumnDefinition, RowComponent as TabulatorRowComponent } from 'tabulator-tables';
|
|
3
|
+
import { ElementPool } from './element-pool';
|
|
4
|
+
import { RowReorderEvent } from './table.types';
|
|
5
|
+
import { Languages } from '../date-picker/date.types';
|
|
6
|
+
/**
|
|
7
|
+
* Provides row drag-and-drop reordering configuration for Tabulator
|
|
8
|
+
* using native movableRows with a custom drag handle
|
|
9
|
+
*/
|
|
10
|
+
export declare class RowDragManager {
|
|
11
|
+
private readonly pool;
|
|
12
|
+
private readonly reorderEvent;
|
|
13
|
+
private readonly getLanguage;
|
|
14
|
+
private mutationObserver;
|
|
15
|
+
constructor(pool: ElementPool, reorderEvent: EventEmitter<RowReorderEvent<unknown>>, getLanguage: () => Languages);
|
|
16
|
+
/**
|
|
17
|
+
* Start releasing drag-handle elements back to the pool when Tabulator
|
|
18
|
+
* virtualizes rows out of view. Safe to call multiple times — a previous
|
|
19
|
+
* observer is disconnected first.
|
|
20
|
+
*
|
|
21
|
+
* @param container - The element that hosts the Tabulator table.
|
|
22
|
+
*/
|
|
23
|
+
observe(container: HTMLElement): void;
|
|
24
|
+
/**
|
|
25
|
+
* Disconnects the mutation observer. Call when the manager is no longer
|
|
26
|
+
* needed (e.g. on `disconnectedCallback` or when `movableRows` is toggled).
|
|
27
|
+
*/
|
|
28
|
+
destroy(): void;
|
|
29
|
+
/**
|
|
30
|
+
* Returns the Tabulator rowHeader config that renders
|
|
31
|
+
* a limel-drag-handle and restricts dragging to that cell
|
|
32
|
+
*/
|
|
33
|
+
getRowHeaderDefinition(): Partial<TabulatorColumnDefinition>;
|
|
34
|
+
/**
|
|
35
|
+
* Tabulator rowMoved event handler.
|
|
36
|
+
* Attach this to the tabulator instance via `tabulator.on('rowMoved', ...)`
|
|
37
|
+
* @param row
|
|
38
|
+
*/
|
|
39
|
+
handleRowMoved(row: TabulatorRowComponent): void;
|
|
40
|
+
/**
|
|
41
|
+
* Tabulator fires `rowMoved` / `rowMoveCancelled` from its `mouseup`
|
|
42
|
+
* handler. The browser may then dispatch a synthetic `click` on the drop
|
|
43
|
+
* target which would bubble to Tabulator's row-click handling and trigger
|
|
44
|
+
* a spurious row activation. Call this from both events: it installs a
|
|
45
|
+
* one-shot capture-phase click listener that swallows that single click
|
|
46
|
+
* before Tabulator can see it. If no click arrives (rare, but possible),
|
|
47
|
+
* the listener is removed on the next macrotask so it can never swallow a
|
|
48
|
+
* later, intentional click.
|
|
49
|
+
*
|
|
50
|
+
* @param target - Element that should swallow the post-drop click
|
|
51
|
+
* (typically the table host).
|
|
52
|
+
*/
|
|
53
|
+
readonly armPostDropClickGuard: (target: EventTarget) => void;
|
|
54
|
+
private readonly handleCellClick;
|
|
55
|
+
private readonly releaseDetachedHandles;
|
|
56
|
+
private getDragHandleFormatter;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=row-drag-manager.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EventEmitter } from '../../stencil-public-runtime';
|
|
2
|
-
import { Column, TableParams, ColumnSorter, ColumnAggregate, RowData } from './table.types';
|
|
2
|
+
import { Column, TableParams, ColumnSorter, ColumnAggregate, RowData, RowReorderEvent } from './table.types';
|
|
3
3
|
import { Layout } from './layout';
|
|
4
4
|
import { Languages } from '../date-picker/date.types';
|
|
5
5
|
/**
|
|
@@ -7,6 +7,7 @@ import { Languages } from '../date-picker/date.types';
|
|
|
7
7
|
* @exampleComponent limel-example-table-custom-components
|
|
8
8
|
* @exampleComponent limel-example-table-header-menu
|
|
9
9
|
* @exampleComponent limel-example-table-movable-columns
|
|
10
|
+
* @exampleComponent limel-example-table-movable-rows
|
|
10
11
|
* @exampleComponent limel-example-table-sorting-disabled
|
|
11
12
|
* @exampleComponent limel-example-table-pagination
|
|
12
13
|
* @exampleComponent limel-example-table-local
|
|
@@ -66,6 +67,13 @@ export declare class Table {
|
|
|
66
67
|
* Set to `true` to enable reordering of the columns by dragging them
|
|
67
68
|
*/
|
|
68
69
|
movableColumns: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Set to `true` to enable reordering of the rows by dragging them.
|
|
72
|
+
* A drag handle will be rendered at the start of each row.
|
|
73
|
+
* Listen for the `reorder` event and update the `data` prop accordingly —
|
|
74
|
+
* the table will not persist the new order on its own.
|
|
75
|
+
*/
|
|
76
|
+
movableRows: boolean;
|
|
69
77
|
/**
|
|
70
78
|
* Set to `false` to disable column sorting through header interactions.
|
|
71
79
|
* Programmatic sorting through the `sorting` prop and `sort` event remains available.
|
|
@@ -126,6 +134,14 @@ export declare class Table {
|
|
|
126
134
|
* Emitted when the columns have been changed
|
|
127
135
|
*/
|
|
128
136
|
changeColumns: EventEmitter<Column[]>;
|
|
137
|
+
/**
|
|
138
|
+
* Emitted when a row has been reordered via drag-and-drop.
|
|
139
|
+
* The event detail describes which row was moved and where it was placed.
|
|
140
|
+
* The consumer is responsible for updating the `data` prop to reflect the
|
|
141
|
+
* new order; otherwise the next render will revert the row to its original
|
|
142
|
+
* position.
|
|
143
|
+
*/
|
|
144
|
+
reorder: EventEmitter<RowReorderEvent<unknown>>;
|
|
129
145
|
/**
|
|
130
146
|
* Emitted when the row selection has been changed
|
|
131
147
|
*/
|
|
@@ -143,8 +159,10 @@ export declare class Table {
|
|
|
143
159
|
private destroyed;
|
|
144
160
|
private resizeObserver;
|
|
145
161
|
private currentSorting;
|
|
162
|
+
private rowDragManager;
|
|
146
163
|
private tableSelection;
|
|
147
164
|
private shouldSort;
|
|
165
|
+
private hasWarnedOnConflictingMovableAndSortable;
|
|
148
166
|
constructor();
|
|
149
167
|
componentWillLoad(): void;
|
|
150
168
|
componentDidLoad(): void;
|
|
@@ -158,7 +176,9 @@ export declare class Table {
|
|
|
158
176
|
protected updateAggregates(newAggregates: ColumnAggregate[], oldAggregates: ColumnAggregate[]): void;
|
|
159
177
|
protected updateSelection(newSelection: any[]): void;
|
|
160
178
|
protected updateSelectable(): void;
|
|
179
|
+
protected updateMovableRows(): void;
|
|
161
180
|
protected updateSortableColumns(): void;
|
|
181
|
+
private warnOnConflictingMovableAndSortable;
|
|
162
182
|
protected updateSorting(newValue: ColumnSorter[], oldValue: ColumnSorter[]): void;
|
|
163
183
|
private reformatChangedRows;
|
|
164
184
|
private fillMissingFields;
|
|
@@ -170,6 +190,7 @@ export declare class Table {
|
|
|
170
190
|
private init;
|
|
171
191
|
private initTabulatorComponent;
|
|
172
192
|
private createTabulator;
|
|
193
|
+
private initRowDragManager;
|
|
173
194
|
private initTableSelection;
|
|
174
195
|
private setSelection;
|
|
175
196
|
private updateMaxPage;
|
|
@@ -196,6 +217,7 @@ export declare class Table {
|
|
|
196
217
|
private calculatePageCount;
|
|
197
218
|
private hasAggregation;
|
|
198
219
|
private readonly getColumnOptions;
|
|
220
|
+
private readonly getRowDragOptions;
|
|
199
221
|
private readonly handleMoveColumn;
|
|
200
222
|
private readonly findColumn;
|
|
201
223
|
render(): any;
|
|
@@ -187,4 +187,24 @@ export interface ColumnAggregate {
|
|
|
187
187
|
export type RowData = {
|
|
188
188
|
id?: string | number;
|
|
189
189
|
};
|
|
190
|
+
/**
|
|
191
|
+
* Describes a row reorder operation.
|
|
192
|
+
* Emitted when a row is moved via drag-and-drop.
|
|
193
|
+
* @public
|
|
194
|
+
*/
|
|
195
|
+
export interface RowReorderEvent<T> {
|
|
196
|
+
/**
|
|
197
|
+
* The data of the row that was moved
|
|
198
|
+
*/
|
|
199
|
+
fromRow: T;
|
|
200
|
+
/**
|
|
201
|
+
* The data of the row that was used as the drop target
|
|
202
|
+
*/
|
|
203
|
+
toRow: T;
|
|
204
|
+
/**
|
|
205
|
+
* If `true`, the row was placed above the target row.
|
|
206
|
+
* If `false`, it was placed below.
|
|
207
|
+
*/
|
|
208
|
+
above: boolean;
|
|
209
|
+
}
|
|
190
210
|
//# sourceMappingURL=table.types.d.ts.map
|
|
@@ -46,7 +46,7 @@ import { EditorUiType } from "./components/text-editor/types";
|
|
|
46
46
|
import { Option } from "./components/select/option.types";
|
|
47
47
|
import { SpinnerSize } from "./components/spinner/spinner.types";
|
|
48
48
|
import { Tab } from "./components/tab-bar/tab.types";
|
|
49
|
-
import { Column, ColumnAggregate, ColumnSorter, RowData, TableParams } from "./components/table/table.types";
|
|
49
|
+
import { Column, ColumnAggregate, ColumnSorter, RowData, RowReorderEvent, TableParams } from "./components/table/table.types";
|
|
50
50
|
import { Layout } from "./components/table/layout";
|
|
51
51
|
import { EditorTextLink } from "./components/text-editor/prosemirror-adapter/menu/types";
|
|
52
52
|
export { ActionBarItem } from "./components/action-bar/action-bar.types";
|
|
@@ -90,7 +90,7 @@ export { EditorUiType } from "./components/text-editor/types";
|
|
|
90
90
|
export { Option } from "./components/select/option.types";
|
|
91
91
|
export { SpinnerSize } from "./components/spinner/spinner.types";
|
|
92
92
|
export { Tab } from "./components/tab-bar/tab.types";
|
|
93
|
-
export { Column, ColumnAggregate, ColumnSorter, RowData, TableParams } from "./components/table/table.types";
|
|
93
|
+
export { Column, ColumnAggregate, ColumnSorter, RowData, RowReorderEvent, TableParams } from "./components/table/table.types";
|
|
94
94
|
export { Layout } from "./components/table/layout";
|
|
95
95
|
export { EditorTextLink } from "./components/text-editor/prosemirror-adapter/menu/types";
|
|
96
96
|
export namespace Components {
|
|
@@ -3615,6 +3615,7 @@ export namespace Components {
|
|
|
3615
3615
|
* @exampleComponent limel-example-table-custom-components
|
|
3616
3616
|
* @exampleComponent limel-example-table-header-menu
|
|
3617
3617
|
* @exampleComponent limel-example-table-movable-columns
|
|
3618
|
+
* @exampleComponent limel-example-table-movable-rows
|
|
3618
3619
|
* @exampleComponent limel-example-table-sorting-disabled
|
|
3619
3620
|
* @exampleComponent limel-example-table-pagination
|
|
3620
3621
|
* @exampleComponent limel-example-table-local
|
|
@@ -3674,6 +3675,10 @@ export namespace Components {
|
|
|
3674
3675
|
* Set to `true` to enable reordering of the columns by dragging them
|
|
3675
3676
|
*/
|
|
3676
3677
|
"movableColumns": boolean;
|
|
3678
|
+
/**
|
|
3679
|
+
* Set to `true` to enable reordering of the rows by dragging them. A drag handle will be rendered at the start of each row. Listen for the `reorder` event and update the `data` prop accordingly — the table will not persist the new order on its own.
|
|
3680
|
+
*/
|
|
3681
|
+
"movableRows": boolean;
|
|
3677
3682
|
/**
|
|
3678
3683
|
* The page to show
|
|
3679
3684
|
* @default FIRST_PAGE
|
|
@@ -6247,6 +6252,7 @@ declare global {
|
|
|
6247
6252
|
"load": TableParams;
|
|
6248
6253
|
"activate": object;
|
|
6249
6254
|
"changeColumns": Column[];
|
|
6255
|
+
"reorder": RowReorderEvent<unknown>;
|
|
6250
6256
|
"select": object[];
|
|
6251
6257
|
"selectAll": boolean;
|
|
6252
6258
|
}
|
|
@@ -6255,6 +6261,7 @@ declare global {
|
|
|
6255
6261
|
* @exampleComponent limel-example-table-custom-components
|
|
6256
6262
|
* @exampleComponent limel-example-table-header-menu
|
|
6257
6263
|
* @exampleComponent limel-example-table-movable-columns
|
|
6264
|
+
* @exampleComponent limel-example-table-movable-rows
|
|
6258
6265
|
* @exampleComponent limel-example-table-sorting-disabled
|
|
6259
6266
|
* @exampleComponent limel-example-table-pagination
|
|
6260
6267
|
* @exampleComponent limel-example-table-local
|
|
@@ -10255,6 +10262,7 @@ declare namespace LocalJSX {
|
|
|
10255
10262
|
* @exampleComponent limel-example-table-custom-components
|
|
10256
10263
|
* @exampleComponent limel-example-table-header-menu
|
|
10257
10264
|
* @exampleComponent limel-example-table-movable-columns
|
|
10265
|
+
* @exampleComponent limel-example-table-movable-rows
|
|
10258
10266
|
* @exampleComponent limel-example-table-sorting-disabled
|
|
10259
10267
|
* @exampleComponent limel-example-table-pagination
|
|
10260
10268
|
* @exampleComponent limel-example-table-local
|
|
@@ -10314,6 +10322,10 @@ declare namespace LocalJSX {
|
|
|
10314
10322
|
* Set to `true` to enable reordering of the columns by dragging them
|
|
10315
10323
|
*/
|
|
10316
10324
|
"movableColumns"?: boolean;
|
|
10325
|
+
/**
|
|
10326
|
+
* Set to `true` to enable reordering of the rows by dragging them. A drag handle will be rendered at the start of each row. Listen for the `reorder` event and update the `data` prop accordingly — the table will not persist the new order on its own.
|
|
10327
|
+
*/
|
|
10328
|
+
"movableRows"?: boolean;
|
|
10317
10329
|
/**
|
|
10318
10330
|
* Emitted when a row is activated
|
|
10319
10331
|
*/
|
|
@@ -10330,6 +10342,10 @@ declare namespace LocalJSX {
|
|
|
10330
10342
|
* Emitted when `mode` is `remote` and the table is loading new data. The consumer is responsible for giving the table new data
|
|
10331
10343
|
*/
|
|
10332
10344
|
"onLoad"?: (event: LimelTableCustomEvent<TableParams>) => void;
|
|
10345
|
+
/**
|
|
10346
|
+
* Emitted when a row has been reordered via drag-and-drop. The event detail describes which row was moved and where it was placed. The consumer is responsible for updating the `data` prop to reflect the new order; otherwise the next render will revert the row to its original position.
|
|
10347
|
+
*/
|
|
10348
|
+
"onReorder"?: (event: LimelTableCustomEvent<RowReorderEvent<unknown>>) => void;
|
|
10333
10349
|
/**
|
|
10334
10350
|
* Emitted when the row selection has been changed
|
|
10335
10351
|
*/
|
|
@@ -11177,6 +11193,7 @@ declare namespace LocalJSX {
|
|
|
11177
11193
|
"pageSize": number;
|
|
11178
11194
|
"totalRows": number;
|
|
11179
11195
|
"movableColumns": boolean;
|
|
11196
|
+
"movableRows": boolean;
|
|
11180
11197
|
"sortableColumns": boolean;
|
|
11181
11198
|
"loading": boolean;
|
|
11182
11199
|
"page": number;
|
|
@@ -12561,6 +12578,7 @@ declare module "@stencil/core" {
|
|
|
12561
12578
|
* @exampleComponent limel-example-table-custom-components
|
|
12562
12579
|
* @exampleComponent limel-example-table-header-menu
|
|
12563
12580
|
* @exampleComponent limel-example-table-movable-columns
|
|
12581
|
+
* @exampleComponent limel-example-table-movable-rows
|
|
12564
12582
|
* @exampleComponent limel-example-table-sorting-disabled
|
|
12565
12583
|
* @exampleComponent limel-example-table-pagination
|
|
12566
12584
|
* @exampleComponent limel-example-table-local
|