@dhtmlx/grid 9.3.12 → 9.4.1

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.
Files changed (38) hide show
  1. package/README.md +1 -1
  2. package/codebase/grid.min.css +1 -1
  3. package/codebase/grid.min.js +3 -3
  4. package/codebase/grid.min.js.map +1 -1
  5. package/codebase/types/ts-calendar/sources/Calendar.d.ts +6 -0
  6. package/codebase/types/ts-calendar/sources/helper.d.ts +1 -0
  7. package/codebase/types/ts-calendar/sources/types.d.ts +3 -0
  8. package/codebase/types/ts-common/date.d.ts +2 -0
  9. package/codebase/types/ts-data/sources/datacollection/group.d.ts +11 -0
  10. package/codebase/types/ts-data/sources/datacollection.d.ts +84 -3
  11. package/codebase/types/ts-data/sources/methods.d.ts +8 -3
  12. package/codebase/types/ts-data/sources/treecollection.d.ts +99 -0
  13. package/codebase/types/ts-data/sources/types.d.ts +12 -2
  14. package/codebase/types/ts-grid/sources/ExtendedGrid.d.ts +3 -1
  15. package/codebase/types/ts-grid/sources/Grid.d.ts +10 -2
  16. package/codebase/types/ts-grid/sources/helpers/data.d.ts +16 -1
  17. package/codebase/types/ts-grid/sources/helpers/default.d.ts +1 -0
  18. package/codebase/types/ts-grid/sources/helpers/dom.d.ts +3 -0
  19. package/codebase/types/ts-grid/sources/helpers/zoneFocus.d.ts +15 -4
  20. package/codebase/types/ts-grid/sources/locales/en.d.ts +0 -2
  21. package/codebase/types/ts-grid/sources/modules/History.d.ts +4 -0
  22. package/codebase/types/ts-grid/sources/modules/Selection.d.ts +3 -0
  23. package/codebase/types/ts-grid/sources/types.d.ts +36 -5
  24. package/codebase/types/ts-grid/sources/ui/cells.d.ts +3 -1
  25. package/codebase/types/ts-grid/sources/ui/content/ComboFilter.d.ts +1 -0
  26. package/codebase/types/ts-grid/sources/ui/content/SelectFilter.d.ts +1 -0
  27. package/codebase/types/ts-grid/sources/ui/content.d.ts +6 -2
  28. package/codebase/types/ts-grid/sources/ui/editors/DateEditor.d.ts +1 -0
  29. package/codebase/types/ts-grid/sources/ui/proContent.d.ts +3 -16
  30. package/codebase/types/ts-layout/sources/Cell.d.ts +10 -0
  31. package/codebase/types/ts-layout/sources/helpers/constants.d.ts +2 -0
  32. package/codebase/types/ts-layout/sources/{helpers.d.ts → helpers/helpers.d.ts} +1 -1
  33. package/codebase/types/ts-layout/sources/types.d.ts +2 -1
  34. package/codebase/types/ts-message/sources/locales/en.d.ts +1 -0
  35. package/codebase/types/ts-treegrid/sources/TreeGrid.d.ts +0 -2
  36. package/codebase/types/ts-treegrid/sources/TreeGridCollection.d.ts +2 -1
  37. package/package.json +1 -1
  38. package/whatsnew.txt +74 -0
@@ -20,10 +20,12 @@ export declare class Calendar extends View implements ICalendar {
20
20
  showDate(date?: Date, mode?: ViewMode): void;
21
21
  destructor(): void;
22
22
  clear(): void;
23
+ private _clear;
23
24
  link(targetCalendar: Calendar): void;
24
25
  private _unlink;
25
26
  private _setSelected;
26
27
  private _getSelected;
28
+ private _normalizeControls;
27
29
  private _draw;
28
30
  private _initHandlers;
29
31
  private _getData;
@@ -31,7 +33,11 @@ export declare class Calendar extends View implements ICalendar {
31
33
  private _drawMonthSelector;
32
34
  private _drawYearSelector;
33
35
  private _drawHeader;
36
+ private _drawControls;
37
+ private _drawControlButton;
38
+ private _drawTimepickerControl;
34
39
  private _drawTimepicker;
35
40
  private _selectDate;
41
+ private _selectToday;
36
42
  private _moveBrowseFocus;
37
43
  }
@@ -1 +1,2 @@
1
1
  export declare const linkButtonClasses = ".dhx_button.dhx_button--view_link.dhx_button--icon.dhx_button--size_medium.dhx_button--color_secondary";
2
+ export declare const getControlButtonClass: (control: "clear" | "today" | "timepicker", fullWidth?: boolean) => string;
@@ -14,6 +14,7 @@ export interface ICalendarConfig {
14
14
  width?: string | number;
15
15
  range?: boolean;
16
16
  $rangeMark?: (a: Date) => string;
17
+ controls?: boolean | TCalendarControlsInput[];
17
18
  /** @deprecated See a documentation: https://docs.dhtmlx.com/ */
18
19
  block?: (a: Date) => boolean;
19
20
  /** @deprecated See a documentation: https://docs.dhtmlx.com/ */
@@ -30,6 +31,8 @@ export interface ICalendar {
30
31
  link(calendar: ICalendar): void;
31
32
  }
32
33
  export type ViewMode = "calendar" | "year" | "month" | "timepicker";
34
+ export type TCalendarControls = "clear" | "today" | "timepicker" | "spacer";
35
+ export type TCalendarControlsInput = TCalendarControls | Uppercase<TCalendarControls> | Capitalize<TCalendarControls>;
33
36
  export interface ICalendarDay {
34
37
  css: string;
35
38
  date: Date;
@@ -4,6 +4,8 @@ export declare const locale: {
4
4
  daysShort: string[];
5
5
  days: string[];
6
6
  cancel: string;
7
+ today: string;
8
+ clear: string;
7
9
  };
8
10
  export declare function getFormattedDate(format: string, date: Date): string;
9
11
  export declare function getExcelDate(date: Date): number;
@@ -1,3 +1,4 @@
1
+ import { IAnyObj, Id } from "../../../ts-common/types";
1
2
  import { IDataItem } from "../types";
2
3
  export type TGroupOrderFunc = (i: IDataItem) => string;
3
4
  export type TAggregate = "sum" | "count" | "min" | "max" | "avg" | string;
@@ -16,6 +17,11 @@ export type TDisplayMode = "original" | "column" | "row";
16
17
  export interface IGroupConfig {
17
18
  displayMode?: TDisplayMode;
18
19
  showMissed?: boolean | string;
20
+ /**
21
+ * Whether a group whose items are all filtered out stays in the data with a zero count.
22
+ * Defaults to `false`, i.e. such a group is dropped.
23
+ */
24
+ showEmptyGroups?: boolean;
19
25
  field?: string;
20
26
  }
21
27
  export interface IGroup {
@@ -24,18 +30,23 @@ export interface IGroup {
24
30
  isGrouped(): boolean;
25
31
  getGroupedFields(): string[];
26
32
  getGroupConfig(config?: IGroupConfig): IGroupConfig;
33
+ recalculate(node: IDataItem, items: IDataItem[], count?: number, total?: number): IAnyObj;
34
+ hasMap(id: Id): boolean;
27
35
  }
28
36
  export declare class Group implements IGroup {
29
37
  private _init;
30
38
  private _config;
31
39
  private _groupSet;
32
40
  private _groupOrderFields;
41
+ private _nodes;
33
42
  constructor();
34
43
  group(order: TGroupOrder[], arr: IDataItem[], config?: IGroupConfig): IDataItem[];
35
44
  ungroup(modifiedData?: IDataItem[]): IDataItem[];
36
45
  isGrouped(): boolean;
37
46
  getGroupedFields(): string[];
38
47
  getGroupConfig(config?: IGroupConfig): IGroupConfig;
48
+ recalculate(node: IDataItem, items: IDataItem[], count?: number, total?: number): IAnyObj;
49
+ hasMap(id: Id): boolean;
39
50
  private _group;
40
51
  private _addSummaryRow;
41
52
  private _toAggregate;
@@ -1,7 +1,7 @@
1
1
  import { IEventSystem } from "../../ts-common/events";
2
2
  import { Id } from "../../ts-common/types";
3
3
  import { Sort } from "./datacollection/sort";
4
- import { DataCallback, DataEvents, IDataCollection, IDataItem, IDataProxy, IFilterCallback, IFilterConfig, IFilterMode, ISortMode, ITreeCollection, IUpdateObject, ReduceCallBack, Statuses, IDataEventsHandlersMap, DataDriver, IDataConfig, ISortConfig, IDataDriver, IFilterComplexMode, IFilter, IResetFilterConfig, IGroupDataConfig, ISortingState } from "./types";
4
+ import { DataCallback, DataEvents, IDataChangeService, IDataCollection, IDataItem, IDataProxy, IFilterCallback, IFilterConfig, IFilterMode, ISortMode, ITreeCollection, IUpdateObject, ReduceCallBack, Statuses, IDataEventsHandlersMap, DataDriver, IDataConfig, ISortConfig, IDataDriver, IFilterComplexMode, IFilter, IResetFilterConfig, IGroupDataConfig, ISortingState } from "./types";
5
5
  import { TGroupOrder, IGroup } from "./datacollection/group";
6
6
  export declare class DataCollection<T extends IDataItem = IDataItem> implements IDataCollection<T> {
7
7
  loadData: Promise<any>;
@@ -41,6 +41,22 @@ export declare class DataCollection<T extends IDataItem = IDataItem> implements
41
41
  getItem(id: Id): T;
42
42
  update(id: Id, newItem: IUpdateObject, silent?: boolean): void;
43
43
  getIndex(id: Id): number;
44
+ /**
45
+ * Returns the index of an item among the visible ones, i.e. in the order the items are
46
+ * rendered in. Unlike {@link DataCollection.getIndex} the hidden items are not counted, and
47
+ * a range set by {@link DataCollection.setRange} narrows the counting down to that range.
48
+ * @param id - The id of the item.
49
+ * @returns The zero-based index of the item, or `-1` if the item doesn't exist, is hidden,
50
+ * or is out of the currently set range.
51
+ * @example
52
+ * ```ts
53
+ * collection.update("2", { hidden: true });
54
+ * collection.getIndex("3"); // 2
55
+ * collection.getVisibleIndex("3"); // 1
56
+ * collection.getVisibleIndex("2"); // -1
57
+ * ```
58
+ */
59
+ getVisibleIndex(id: Id): number;
44
60
  getId(index: number): Id;
45
61
  getLength(): number;
46
62
  isDataLoaded(from?: number, to?: number): boolean;
@@ -157,7 +173,14 @@ export declare class DataCollection<T extends IDataItem = IDataItem> implements
157
173
  */
158
174
  $parse(data: any[], resetRules?: boolean): void;
159
175
  save(url: IDataProxy | string): void;
160
- changeId(id: Id, newId?: Id, silent?: boolean): void;
176
+ /**
177
+ * Changes the id of a data item.
178
+ * @param id - The current id of the item.
179
+ * @param newId - The new id for the item. If omitted, a unique id is generated automatically.
180
+ * @param silent - If true, the change event is not fired.
181
+ * @returns The new id of the item, or the original id if the change was rejected.
182
+ */
183
+ changeId(id: Id, newId?: Id, silent?: boolean): Id;
161
184
  isSaved(): boolean;
162
185
  map(callback: DataCallback<T>): any[];
163
186
  mapRange(from: number, to: number, callback: DataCallback<T>): any[];
@@ -182,7 +205,20 @@ export declare class DataCollection<T extends IDataItem = IDataItem> implements
182
205
  protected _removeCore(id: Id): void;
183
206
  protected _parse_data(data: any[]): void;
184
207
  protected _approximate(data: any[], values: string[], maxNum: number): any[];
185
- protected _onChange(status: Statuses, id: Id, obj: any): void;
208
+ /**
209
+ * Remaps the item to the new id inside all the internal structures.
210
+ * `_order`, `_initFilterOrder` and `_initSortOrder` keep the references to the same
211
+ * objects as `_pull`, so changing `item.id` is enough for them.
212
+ * @internal
213
+ */
214
+ protected _changeIdCore(id: Id, newId: Id): void;
215
+ /**
216
+ * Retargets the pending save operations of the item to its new id,
217
+ * so that a rename between `add` and `save` doesn't produce a second request.
218
+ * @internal
219
+ */
220
+ private _remapChanges;
221
+ protected _onChange(status: Statuses, id: Id, obj: any, service?: IDataChangeService): void;
186
222
  protected _addToOrder(array: any[], obj: any, index?: number): void;
187
223
  /**
188
224
  * Reorders the data by all currently stored sorting rules.
@@ -224,6 +260,44 @@ export declare class DataCollection<T extends IDataItem = IDataItem> implements
224
260
  * @internal
225
261
  */
226
262
  protected _reapplyRules(): void;
263
+ /**
264
+ * Brings the group headers in line with the items the collection holds now: the counts and the
265
+ * aggregates next to the group names are computed while the tree is built, so every change of
266
+ * what is in the collection leaves them stale. Headers left with nothing under them are dropped
267
+ * unless `showEmptyGroups` is set — see {@link DataCollection._dropGroups} for what dropping a
268
+ * header costs it.
269
+ * @internal
270
+ */
271
+ protected _recalculateGroups(): void;
272
+ /**
273
+ * Collects a group header together with everything below it: the nested headers, their summary
274
+ * rows and the items. Removing the header alone would leave the items with a parent that is not
275
+ * there any more, and the counts of the groups above it short.
276
+ * A `TreeCollection` needs none of this, its {@link TreeCollection._removeCore} already takes
277
+ * the subtree of an item with it.
278
+ * @param id - The id of the header.
279
+ * @returns The ids to remove, the header itself last.
280
+ * @internal
281
+ */
282
+ protected _getGroupSubtree(id: Id): Id[];
283
+ /**
284
+ * Takes the group headers left with nothing in them out of the data, their summary rows and
285
+ * their nested groups included: a group is empty only when everything under it is.
286
+ * While a filter is applied the headers only leave `_order`, because `_initFilterOrder` keeps
287
+ * the whole grouped order and resetting the filter has to bring them back. Without a filter
288
+ * there is nothing to restore them from, so they leave the collection for good.
289
+ * @param ids - Ids of the headers to drop.
290
+ * @internal
291
+ */
292
+ protected _dropGroups(ids: Set<string>): void;
293
+ /**
294
+ * Counts the items every group header holds in a given order, its whole subtree and not just
295
+ * the items directly under it. Summary rows are not items.
296
+ * @param order - The order to count over.
297
+ * @returns The counts, keyed by header id.
298
+ * @internal
299
+ */
300
+ protected _countGroupItems(order: T[]): Map<Id, number>;
227
301
  /**
228
302
  * Turns a field/value rule into a predicate.
229
303
  * @param rule - The rule to convert.
@@ -261,4 +335,11 @@ export declare class DataCollection<T extends IDataItem = IDataItem> implements
261
335
  * @internal
262
336
  */
263
337
  private _parse;
338
+ /**
339
+ * Fires the change event. The service payload is appended only when it is set,
340
+ * so that the arguments of the event stay exactly the same as before for every
341
+ * operation that doesn't provide it.
342
+ * @internal
343
+ */
344
+ private _fireChange;
264
345
  }
@@ -1,11 +1,16 @@
1
1
  type Item = {
2
2
  [key: string]: any;
3
3
  };
4
+ /**
5
+ * Aggregation functions shared by the group aggregates and the widget summaries.
6
+ * `sum` and `count` return `0` for an empty set, the rest return `null`: there is no
7
+ * meaningful average, minimum or maximum of nothing.
8
+ */
4
9
  export declare const methods: {
5
10
  sum: (items: Item[], field: string) => number;
6
- avg: (items: Item[], field: string) => number;
11
+ avg: (items: Item[], field: string) => number | null;
7
12
  count: (items: Item[], field: string) => number;
8
- min: (items: Item[], field: string) => number;
9
- max: (items: Item[], field: string) => number;
13
+ min: (items: Item[], field: string) => number | null;
14
+ max: (items: Item[], field: string) => number | null;
10
15
  };
11
16
  export {};
@@ -21,6 +21,31 @@ export declare class TreeCollection<T extends IDataItem = IDataItem> extends Dat
21
21
  removeAll(id?: Id): void;
22
22
  update(id: Id, newItem: IUpdateObject, silent?: boolean): void;
23
23
  getIndex(id: Id): number;
24
+ /**
25
+ * Returns the index of an item among the visible ones, i.e. in the order the items are
26
+ * rendered in. Unlike {@link TreeCollection.getIndex} the hidden items are not counted, and an
27
+ * item that is not rendered at all gets `-1`. A range set by {@link DataCollection.setRange}
28
+ * leaves the top level items of the current page only.
29
+ * @param id - The id of the item.
30
+ * @param flat - Whether the index is counted in the flat list of all the visible items, i.e.
31
+ * the items of the expanded branches above the item are counted as well. By default the index
32
+ * is counted within the parent branch of the item only. Defaults to `false`.
33
+ * @returns The zero-based index of the item, or `-1` if the item doesn't exist, is hidden, is
34
+ * placed under a hidden or a collapsed parent, or is out of the currently set range.
35
+ * @example
36
+ * ```ts
37
+ * // "1", "2", "3" are top level items, "3" is expanded and holds "3.1" and "3.2"
38
+ * collection.update("3.1", { hidden: true });
39
+ * collection.getIndex("3.2"); // 1 - the second child of "3"
40
+ * collection.getVisibleIndex("3.2"); // 0 - the first rendered child of "3"
41
+ * collection.getVisibleIndex("3.2", true); // 3 - the fourth rendered item
42
+ *
43
+ * collection.update("3", { $opened: false });
44
+ * collection.getVisibleIndex("3.2"); // -1
45
+ * collection.getVisibleIndex("3.2", true); // -1
46
+ * ```
47
+ */
48
+ getVisibleIndex(id: Id, flat?: boolean): number;
24
49
  /**
25
50
  * Sorts the tree, reordering the items within each parent independently.
26
51
  * The rules are combined the same way as in {@link DataCollection.sort}, but unlike it this
@@ -74,6 +99,47 @@ export declare class TreeCollection<T extends IDataItem = IDataItem> extends Dat
74
99
  getId(index: number, parent?: Id): Id;
75
100
  map(callback: DataCallback<T>, parent?: Id, direct?: boolean): any[];
76
101
  getRawData(from: number, to: number, order?: T[], mode?: number, parent?: Id): T[];
102
+ /**
103
+ * Tells whether the children of an item are rendered. Both flags in use are checked:
104
+ * `$opened`, set by TreeGrid, and `opened`, set by Tree.
105
+ * @param item - The item to check.
106
+ * @returns `true` if the item is expanded.
107
+ * @internal
108
+ */
109
+ protected _isOpened(item: T): boolean;
110
+ /**
111
+ * Gives the range of the top level items to count, narrowed by {@link DataCollection.setRange}.
112
+ * @returns The index to count from and the one to stop before.
113
+ * @internal
114
+ */
115
+ private _getRootBounds;
116
+ /**
117
+ * Counts the visible items placed before an item within its parent branch.
118
+ * @param item - The item to locate.
119
+ * @param start - The index the top level items are counted from, set by a range.
120
+ * @param end - The index the top level items are counted up to, set by a range.
121
+ * @returns The index of the item within its branch, or `-1` if the branch doesn't hold it.
122
+ * @internal
123
+ */
124
+ private _getBranchVisibleIndex;
125
+ /**
126
+ * Counts the visible items placed before an item in the flat list of the visible items: at
127
+ * every level the branches of the preceding siblings are counted together with the parent
128
+ * item itself.
129
+ * @param item - The item to locate.
130
+ * @param start - The index the top level items are counted from, set by a range.
131
+ * @returns The index of the item in the flat list, or `-1` if the tree doesn't hold it.
132
+ * @internal
133
+ */
134
+ private _getFlatVisibleIndex;
135
+ /**
136
+ * Counts the rows an item takes in the flat list of the visible items: the item itself plus
137
+ * the visible items of its branch while it is expanded.
138
+ * @param item - The item to measure.
139
+ * @returns The number of the visible rows, `0` for a hidden item.
140
+ * @internal
141
+ */
142
+ private _getVisibleCount;
77
143
  protected flatten(input: T[]): T[];
78
144
  protected _add({ newItem, index, parent, order, batch, }: {
79
145
  newItem: IDataItem;
@@ -85,6 +151,15 @@ export declare class TreeCollection<T extends IDataItem = IDataItem> extends Dat
85
151
  protected _setParent(item: IDataItem, parent: Id): void;
86
152
  protected _copy(id: Id, index: number, target?: IDataCollection | ITreeCollection, targetId?: Id, key?: number): Id;
87
153
  protected _move(id: Id, index: number, target?: ITreeCollection | IDataCollection, targetId?: Id, key?: number): Id;
154
+ /**
155
+ * Changes the id of a data item. The root id can't be changed.
156
+ * @param id - The current id of the item.
157
+ * @param newId - The new id for the item. If omitted, a unique id is generated automatically.
158
+ * @param silent - If true, the change event is not fired.
159
+ * @returns The new id of the item, or the original id if the change was rejected.
160
+ */
161
+ changeId(id: Id, newId?: Id, silent?: boolean): Id;
162
+ protected _changeIdCore(id: Id, newId: Id): void;
88
163
  protected _moveItem(id: any, targetId: any, index: any): void;
89
164
  protected _reset(config: {
90
165
  id?: Id;
@@ -108,6 +183,30 @@ export declare class TreeCollection<T extends IDataItem = IDataItem> extends Dat
108
183
  * @internal
109
184
  */
110
185
  private _applyFilter;
186
+ /**
187
+ * Recomputes every group header from the items the tree holds now, and drops the groups that
188
+ * ended up with nothing in them unless `showEmptyGroups` is set. See
189
+ * {@link TreeCollection._dropGroups} for what dropping a header costs it.
190
+ * @internal
191
+ */
192
+ protected _recalculateGroups(): void;
193
+ /**
194
+ * Counts the items every group header holds in a given tree, its whole subtree and not just
195
+ * the direct children. Summary rows are not items.
196
+ * @param store - The parent to children map to count over.
197
+ * @returns The counts, keyed by header id.
198
+ * @internal
199
+ */
200
+ private _countTreeGroups;
201
+ /**
202
+ * Takes group headers out of the tree together with everything below them, their summary rows
203
+ * included. While a filter is applied the headers only leave `_children`, because `_initChildren`
204
+ * keeps the whole grouped tree and resetting the filter has to bring them back. Without a filter
205
+ * there is nothing to restore them from, so they leave the tree for good.
206
+ * @param ids - Ids of the headers to drop.
207
+ * @internal
208
+ */
209
+ protected _dropGroups(ids: Set<string>): void;
111
210
  /**
112
211
  * Unwraps the stored filters into their bare rules, keeping them keyed by filter id.
113
212
  * Unlike {@link DataCollection._normalizeFilters} it does not turn the rules into predicates:
@@ -184,6 +184,7 @@ export interface IDataCollection<T extends IDataItem = IDataItem> {
184
184
  getInitialData(): T[];
185
185
  getItem(id: Id): T;
186
186
  getIndex(id: Id): number;
187
+ getVisibleIndex(id: Id): number;
187
188
  getLength(): number;
188
189
  isDataLoaded(from?: number, to?: number): boolean;
189
190
  getId(index: number): Id;
@@ -205,7 +206,7 @@ export interface IDataCollection<T extends IDataItem = IDataItem> {
205
206
  serialize(driver?: DataDriver): T[];
206
207
  copy(id: Id | Id[], index: number, target?: IDataCollection | ITreeCollection, targetId?: Id): Id | Id[];
207
208
  move(id: Id | Id[], index: number, target?: IDataCollection | ITreeCollection, targetId?: Id): Id | Id[];
208
- changeId(id: Id, newId?: Id, silent?: boolean): void;
209
+ changeId(id: Id, newId?: Id, silent?: boolean): Id;
209
210
  forEach(callback: DataCallback<T>): void;
210
211
  save(url: IDataProxy | string): void;
211
212
  isSaved(): boolean;
@@ -215,6 +216,14 @@ export interface IDataChangeStack {
215
216
  order: IDataChange[];
216
217
  }
217
218
  export type Statuses = "add" | "update" | "remove" | string;
219
+ /**
220
+ * Service payload of the {@link DataEvents.change} event.
221
+ * @internal Not a part of the public API, may be extended or changed without notice.
222
+ */
223
+ export interface IDataChangeService {
224
+ /** the previous id of the item, set by changeId */
225
+ oldId?: Id;
226
+ }
218
227
  export interface IDataChange {
219
228
  id: Id;
220
229
  status: Statuses;
@@ -265,6 +274,7 @@ export interface ITreeCollection<T extends IDataItem = IDataItem> extends IDataC
265
274
  removeAll(id?: Id): void;
266
275
  getLength(id?: Id): number;
267
276
  getIndex(id: Id): number;
277
+ getVisibleIndex(id: Id, flat?: boolean): number;
268
278
  getItems(id: Id): T[];
269
279
  sort(rule?: ISortMode, config?: ISortConfig, ignore?: boolean): void;
270
280
  map(callback: DataCallback<T>, parent?: Id, direct?: boolean): any;
@@ -348,7 +358,7 @@ export declare enum DataEvents {
348
358
  }
349
359
  export interface IDataEventsHandlersMap {
350
360
  [key: string]: (...args: any[]) => any;
351
- [DataEvents.change]: (id?: Id, status?: Statuses, updatedItem?: IDataItem) => void;
361
+ [DataEvents.change]: (id?: Id, status?: Statuses, updatedItem?: IDataItem, service?: IDataChangeService) => void;
352
362
  [DataEvents.filter]: (filter?: IFilter) => void;
353
363
  [DataEvents.beforeAdd]: (newItem: IDataItem, batch: IDataItem[], index: number) => boolean | void;
354
364
  [DataEvents.afterAdd]: (newItem: IDataItem, batch: IDataItem[], index: number) => void;
@@ -1,4 +1,4 @@
1
- import { IGridConfig, ICol, IRow, IFooter, IHeader, IGroupOrderItem, IExtendedGrid, IExtendedGridConfig, ISubViewCell } from "./types";
1
+ import { IGridConfig, ICol, IRow, IFooter, IHeader, IGroupOrderItem, IExtendedGrid, IExtendedGridConfig, ISubViewCell, IFixedRowLevel, TFixedRowsName } from "./types";
2
2
  import { IDataCollection, IDataItem } from "../../ts-data";
3
3
  import { ScrollView } from "../../ts-common/ScrollView";
4
4
  import { Id } from "../../ts-common/types";
@@ -30,11 +30,13 @@ export declare class ExtendedGrid extends Grid implements IExtendedGrid {
30
30
  protected _setEventHandlers(): void;
31
31
  protected _afterEditEndProcess(value: any, editableRow: any, editableColumn: any): void;
32
32
  protected _setSort(): void;
33
+ protected _resolveFixedRowLevel(name: TFixedRowsName, index: number, config: IExtendedGridConfig): IFixedRowLevel;
33
34
  protected getNormalizeContentHeight(row: IFooter | IHeader, col: ICol, config: IGridConfig): number;
34
35
  protected _prepareData(data: IDataItem[] | IDataCollection): IRow[];
35
36
  protected _prepareDataFromTo(data: IDataCollection, from: number, to: number): IRow[];
36
37
  protected _dragStart(event: any): void;
37
38
  protected _group(order: IGroupOrderItem[]): void;
39
+ protected _getGroupCounter(row: IRow): string;
38
40
  protected _expand(row: IRow): boolean;
39
41
  protected _collapse(row: IRow): boolean;
40
42
  private _lazyLoad;
@@ -6,7 +6,7 @@ import { DataEvents, DragEvents, IDataCollection, IDataEventsHandlersMap, IDataI
6
6
  import { Exporter } from "./modules/Exporter";
7
7
  import { PrefixSums } from "./helpers/PrefixSums";
8
8
  import { ISelection } from "./modules/Selection";
9
- import { EditorType, GridEvents, IAdjustBy, ICellRect, ICol, ICoords, IEventHandlersMap, IGrid, IGridConfig, IRow, IScrollState, ISpan, GridSystemEvents, ISystemEventHandlersMap, IColumnsWidth, SortFunction, IAdjustColumns, IDirection, IFooter, IHeader, INormalizeColumnsParams, ISummaryList, ISortingStates } from "./types";
9
+ import { EditorType, GridEvents, IAdjustBy, ICellRect, ICol, ICoords, IEventHandlersMap, IGrid, IGridConfig, IRow, IScrollState, ISpan, GridSystemEvents, ISystemEventHandlersMap, IColumnsWidth, SortFunction, IAdjustColumns, IDirection, IFooter, IHeader, INormalizeColumnsParams, ISummaryList, ISortingStates, IFixedRowLevel, TFixedRowsName } from "./types";
10
10
  import { IContentList, IHeaderFilter } from "./ui/content";
11
11
  import { IActiveCell } from "./modules/ActiveCell";
12
12
  import { IProContentList } from "./ui/proContent";
@@ -92,10 +92,11 @@ export declare class Grid extends View implements IGrid {
92
92
  protected _dragInit(): void;
93
93
  protected _parseColumns(configChanged?: boolean): void;
94
94
  protected normalizeColumns({ config, columns, configChanged }: INormalizeColumnsParams): void;
95
+ protected _buildFixedRowsHeightMap(config: IGridConfig, columns: ICol[], name: TFixedRowsName): void;
96
+ protected _resolveFixedRowLevel(name: TFixedRowsName, index: number, config: IGridConfig): IFixedRowLevel;
95
97
  protected getNormalizeContentHeight(row: IFooter | IHeader, col: ICol, config: IGridConfig): number;
96
98
  protected _parseData(): void;
97
99
  protected _createCollection(): void;
98
- protected _getRowIndex(rowId: Id): number;
99
100
  protected _setHTMLEventHandlers(): void;
100
101
  protected _setEventHandlers(): void;
101
102
  protected _afterEditEndProcess(value: any, editableRow: any, editableColumn: any): void;
@@ -121,6 +122,13 @@ export declare class Grid extends View implements IGrid {
121
122
  protected _normalizeDataType(): void;
122
123
  protected _applyLocalFilter(beforePrepareData?: boolean): void;
123
124
  protected _normalizeSpans(): void;
125
+ /**
126
+ * Retargets the caches that store a row id by value to the new id.
127
+ * The row objects themselves are shared with the data collection, so everything that
128
+ * keeps a reference to them (the selected cells, the rendered rows) is already up to date.
129
+ * @internal
130
+ */
131
+ protected _remapRowId(oldId: Id, newId: Id): void;
124
132
  protected _hideColumn(column: ICol): void;
125
133
  protected _showColumn(column: ICol): void;
126
134
  protected _setSummary(): void;
@@ -1,10 +1,22 @@
1
1
  import { IContainerConfig } from "../../../ts-common/core";
2
- import { ICol, IColumnsWidth, IGridConfig, IRow, AdjustTargetType, TOption, IScrollState, IVisibleRange, ISizes } from "./../types";
2
+ import { ICol, IColumnsWidth, IGridConfig, IRow, AdjustTargetType, TOption, IOption, IScrollState, IVisibleRange, ISizes, TContentFilter, TFilterOptions, TFixedRowHeight } from "./../types";
3
3
  import { Id } from "../../../ts-common/types";
4
4
  export declare function getTotalRowHeight(row: IRow): number;
5
5
  export declare function rowsHeight(config: IGridConfig, rows: IRow[], from: number, to: number): number;
6
6
  export declare function colsWidth(config: IGridConfig, cols: ICol[], from: number, to: number): number;
7
7
  export declare function normalizeArray(obj: any, name: string): void;
8
+ /**
9
+ * Resolves the height of a single header/footer level from the headerRowHeight/footerRowHeight value.
10
+ * An array form describes the levels individually, a plain number applies to every level.
11
+ * @param value - the headerRowHeight/footerRowHeight config value
12
+ * @param index - the zero-based header/footer level index
13
+ * @returns the level height and its auto-height state, where `auto: null` means
14
+ * "the legacy mode, the headerAutoHeight/footerAutoHeight flag decides"
15
+ */
16
+ export declare function resolveFixedRowHeight(value: TFixedRowHeight | undefined, index: number): {
17
+ height: number;
18
+ auto: boolean | null;
19
+ };
8
20
  export declare function measureTextHeight({ text, width, lineHeight, font, htmlEnable, }: {
9
21
  text?: string;
10
22
  width?: number;
@@ -28,6 +40,9 @@ export declare const getTreeCellWidthOffset: (row: IRow, toArrow?: boolean) => n
28
40
  export declare const getMaxColsWidth: (rows: IRow[], cols: ICol[], config: IContainerConfig, target: AdjustTargetType) => IColumnsWidth;
29
41
  export declare function applyPattern(value: string | number | boolean, col: ICol): string | number | boolean;
30
42
  export declare function getEditorOptions(col: ICol, row?: IRow): TOption[];
43
+ export declare function normalizeOptions(options: any[]): IOption[];
44
+ export declare function getFilterOptions(col: ICol, content: TContentFilter): TFilterOptions;
45
+ export declare function resolveFilterOptions(col: ICol, content: TContentFilter, uniqueData?: any[]): IOption[];
31
46
  export declare function getOptionValue(value: string, column: ICol): string;
32
47
  export declare function getValueForNumberColumn(col: ICol, value: any): any;
33
48
  export declare function getComboEditorValue(value: any, col: ICol, row: IRow): any;
@@ -1,5 +1,6 @@
1
1
  import { IHistoryConfig } from "../modules/History";
2
2
  import { IDragPanelConfig, IGroup, ISubRowConfig } from "../types";
3
+ export declare const DEFAULT_ROW_HEIGHT = 40;
3
4
  export declare const getGroupDefaultConfig: (config?: IGroup | boolean) => IGroup;
4
5
  export declare const defaultSubRowConfig: Omit<ISubRowConfig, "view">;
5
6
  export declare const defaultDragPanelConfig: IDragPanelConfig;
@@ -1,3 +1,6 @@
1
1
  import { Id } from "../../../ts-common/types";
2
+ import { ISpan } from "../types";
2
3
  export declare function getRowNode(id: Id, root: HTMLElement, split?: "left" | "right"): HTMLElement;
4
+ /** Returns a data cell, or the span that covers it, from any part of the grid, frozen columns included. */
5
+ export declare function getCellNode(root: HTMLElement, rowId: Id, colId: Id, span?: ISpan): HTMLElement;
3
6
  export declare function getVisibleRowNode(row: HTMLElement, width: number, offset: number): HTMLElement;
@@ -49,8 +49,9 @@ export declare function findZoneCell(grid: any, zone: FocusZone, colId: string,
49
49
  * the scroll offset if the column is outside the visible range.
50
50
  * @param grid - the grid instance
51
51
  * @param colId - the column ID to make visible
52
+ * @returns true if the grid was scrolled
52
53
  */
53
- export declare function ensureZoneCellVisible(grid: any, colId: string): void;
54
+ export declare function ensureZoneCellVisible(grid: any, colId: string): boolean;
54
55
  /**
55
56
  * Resolves the actual owning cell for a position that may be covered by a colspan or rowspan.
56
57
  * Scans all rows (0..rowIndex) and columns (0..colIndex) to find any cell whose
@@ -93,8 +94,9 @@ export declare function moveZoneFocusVertical(grid: any, event: KeyboardEvent, z
93
94
  * Moves focus via Tab/Shift+Tab within a header/footer zone.
94
95
  * Advances column-by-column with row wrapping: when reaching the last column,
95
96
  * moves to the first column of the next row (and vice versa for backward).
96
- * Skips cells that resolve back to the current cell (due to spans) and retries
97
- * if a cell is not found in the DOM (virtualized columns).
97
+ * Skips cells that resolve back to the current cell (due to spans) and cells that are
98
+ * not in the DOM although their column is in view. A cell scrolled into view is focused
99
+ * after the redraw, not skipped (see setZoneCellFocus).
98
100
  * Does NOT call preventDefault for exit cases — the caller decides.
99
101
  * @param grid - the grid instance
100
102
  * @param event - the keyboard event (preventDefault'd only on successful move)
@@ -153,9 +155,18 @@ export declare function triggerHeaderSort(grid: any, event: KeyboardEvent, isMod
153
155
  * @param rowIndex - the row index of the cell to focus
154
156
  * @param prevCell - the previously focused cell (will get tabindex="-1")
155
157
  * @param navRowIndex - the logical navigation row to store (defaults to rowIndex)
156
- * @returns true if focus was set successfully, false if the cell was not found
158
+ * @returns true if focus was set, or will be set after the redraw; false if the cell was not found
157
159
  */
158
160
  export declare function setZoneCellFocus(grid: any, zone: FocusZone, colId: string, rowIndex: number, prevCell?: HTMLElement, navRowIndex?: number): boolean;
161
+ /**
162
+ * Checks if focus is still in the body data area, or was dropped to the page.
163
+ * Focus is dropped to the page when the focused editor is removed. Focus that has moved on,
164
+ * out of the widget or into the header or the footer, is not in the body.
165
+ * Used after an edit ends, so that focus is returned to the active cell only when nothing moved it away.
166
+ * @param grid - the grid instance
167
+ * @returns true if focus is in the body or on the page body element
168
+ */
169
+ export declare function isFocusInBody(grid: any): boolean;
159
170
  /**
160
171
  * Transitions focus from a header/footer zone to the body data area.
161
172
  * Selects the first or last row in the specified column, using either
@@ -21,8 +21,6 @@ declare const locale: {
21
21
  aria_collapseRow: string;
22
22
  aria_editContent: string;
23
23
  aria_subRow: string;
24
- aria_enterGrid: string;
25
- aria_exitGrid: string;
26
24
  aria_dragPanel: string;
27
25
  aria_panelHeader: string;
28
26
  aria_panelFooter: string;
@@ -1,5 +1,6 @@
1
1
  import { IEventSystem } from "../../../ts-common/events";
2
2
  import { IExtendedGrid, IProGrid, IRow } from "../types";
3
+ import { Id } from "../../../ts-common/types";
3
4
  export type ActionType = "add" | "remove" | "removeAll" | "change";
4
5
  export interface IAction {
5
6
  type: ActionType;
@@ -45,6 +46,8 @@ export interface IHistory {
45
46
  enable(): void;
46
47
  isDisabled(): boolean;
47
48
  destructor(): void;
49
+ /** @internal Retarget the stored actions after a row id has been changed */
50
+ remapId(oldId: Id, newId: Id): void;
48
51
  }
49
52
  export declare class History implements IHistory {
50
53
  config: IHistoryConfig;
@@ -66,6 +69,7 @@ export declare class History implements IHistory {
66
69
  enable(): void;
67
70
  isDisabled(): boolean;
68
71
  destructor(): void;
72
+ remapId(oldId: Id, newId: Id): void;
69
73
  private _initConfig;
70
74
  private _initHandlers;
71
75
  private _fireError;
@@ -15,6 +15,8 @@ export interface ISelection extends ICellSource {
15
15
  enable(): void;
16
16
  isSelectedCell(row: IRow | Id, column?: ICol | Id): boolean;
17
17
  toHTML(): VNode | VNode[];
18
+ /** @internal Rebuild the id-based cache after a row id has been changed */
19
+ remapRows(): void;
18
20
  }
19
21
  export declare enum GridSelectionEvents {
20
22
  beforeUnSelect = "beforeUnSelect",
@@ -46,6 +48,7 @@ export declare class Selection implements ISelection {
46
48
  enable(): void;
47
49
  isSelectedCell(row: IRow | Id, column?: ICol | Id): boolean;
48
50
  restoreFocus(): void;
51
+ remapRows(): void;
49
52
  toHTML(): VNode | VNode[];
50
53
  private _setCell;
51
54
  private _removeCell;