@genesislcap/grid-tabulator 15.94.0 → 15.94.1-alpha-6f4e61418f.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.
@@ -1128,6 +1128,7 @@ export declare enum GridTabulatorCellRendererTypes {
1128
1128
  * @fires gridTabulator:error - Fired when a datasource error occurs. detail: `GridTabulatorErrorEventDetail`
1129
1129
  * @fires dataInit - Fired when tabulator data is initialized
1130
1130
  * @fires sizeChanged - Fired when layout size changes. detail: `GridTabulatorSizeChangedEventDetail`
1131
+ * @fires more-rows-changed - Fired when the server-reported `MORE_ROWS` or `ROWS_COUNT` changes, including when they are reset, and after every reply to `loadMore()`. detail: `GridTabulatorMoreRowsEventDetail`
1131
1132
  */
1132
1133
  export declare class GridTabulatorClientSideDatasource extends GridTabulatorClientSideDatasource_base {
1133
1134
  auth: Auth;
@@ -1164,9 +1165,36 @@ export declare class GridTabulatorClientSideDatasource extends GridTabulatorClie
1164
1165
  */
1165
1166
  keepColDefsOnClearRowData: boolean;
1166
1167
  /**
1167
- * Allows grid data updates to be processed via and external function before applying in grid
1168
+ * Allows grid data updates to be processed via and external function before applying in grid.
1169
+ *
1170
+ * @remarks
1171
+ * The mapper is called with all rows (one argument) when the grid data is set. For stream transactions it is
1172
+ * called with the changed rows, the datasource's current rows keyed by row id, and the operation
1173
+ * (`'add'`, `'update'` or `'remove'`). Rows that arrive in reply to `loadMore()` are passed as `'page'`
1174
+ * instead of `'add'`, as they are existing rows rather than new ones.
1168
1175
  */
1169
1176
  rowDataMapper: Function;
1177
+ /**
1178
+ * Total rows the resource holds on the server (`ROWS_COUNT` of the first stream message), or `undefined` when
1179
+ * unknown. It ignores criteria, and is not adjusted for live inserts and deletes.
1180
+ */
1181
+ serverRowsCount: number | undefined;
1182
+ /**
1183
+ * Whether the server holds more rows than were sent (`MORE_ROWS` of the first stream message), or `undefined`
1184
+ * when unknown. It is true when `max-rows` capped the initial load.
1185
+ */
1186
+ moreRows: boolean | undefined;
1187
+ /** MORE_ROWS requests sent by `loadMore()` that have not been answered yet. */
1188
+ private pendingPages;
1189
+ /** Further pages a `loadMore()` call still has to request, one after each reply. */
1190
+ private remainingPages;
1191
+ /** Set while the rows of a `loadMore()` reply are being applied. */
1192
+ private applyingPage;
1193
+ /**
1194
+ * Set when a `loadMore()` reply had no rows while the server still reported more. Some GSF versions answer
1195
+ * every later request the same way, so paging stops.
1196
+ */
1197
+ private pagingStalled;
1170
1198
  private dataSub;
1171
1199
  private updateSub;
1172
1200
  private connectionSub;
@@ -1255,6 +1283,29 @@ export declare class GridTabulatorClientSideDatasource extends GridTabulatorClie
1255
1283
  * @internal
1256
1284
  */
1257
1285
  loadResourceData(withFullInit?: boolean): Promise<void>;
1286
+ /**
1287
+ * Requests the next `pages` pages of rows from a data server subscription (`MORE_ROWS`), one after another.
1288
+ * Each page holds up to `max-rows` rows; the server fixes that size when the subscription opens. The rows
1289
+ * arrive on the stream and reach the row mapper as a `'page'` operation, and `more-rows-changed` is emitted
1290
+ * after each reply. Requesting stops early when the server reports no more rows.
1291
+ *
1292
+ * @returns Whether a request was sent. Nothing is sent for a request server, while a load is in progress,
1293
+ * when the server reported no more rows, or after paging stalled.
1294
+ */
1295
+ loadMore(pages?: number): Promise<boolean>;
1296
+ /** Whether a `loadMore()` call is still waiting for pages. */
1297
+ get isLoadingMore(): boolean;
1298
+ private requestPage;
1299
+ /** Whether a raw stream message answers a `loadMore()` request. Live updates never carry `MORE_ROWS`. */
1300
+ private isPageReply;
1301
+ /**
1302
+ * Keeps `ROWS_COUNT` and `MORE_ROWS` from a raw stream message. The result filter drops them; the first
1303
+ * message after the logon and every reply to `loadMore()` carry them.
1304
+ */
1305
+ private captureServerPaging;
1306
+ /** Whether `loadMore()` can fetch another page now. */
1307
+ get canLoadMore(): boolean;
1308
+ private setServerPaging;
1258
1309
  private handleSnapshot;
1259
1310
  private datasourceOptions;
1260
1311
  private handleStreamResult;
@@ -1322,12 +1373,7 @@ declare const GridTabulatorClientSideDatasource_base: (new (...args: any[]) => {
1322
1373
  addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
1323
1374
  addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
1324
1375
  removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
1325
- removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options
1326
- /**
1327
- * Returns whether the `row-id` attribute is the default one, depending on the resource type.
1328
- * @internal
1329
- */
1330
- ?: boolean | EventListenerOptions): void;
1376
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
1331
1377
  readonly attributes: NamedNodeMap;
1332
1378
  get classList(): DOMTokenList;
1333
1379
  set classList(value: string): any;
@@ -2413,6 +2459,23 @@ export declare const gridTabulatorEventNames: {
2413
2459
  datasourceErrorClose: string;
2414
2460
  };
2415
2461
 
2462
+ /**
2463
+ * Detail payload for the `more-rows-changed` event.
2464
+ * @alpha
2465
+ */
2466
+ export declare interface GridTabulatorMoreRowsEventDetail {
2467
+ /** Whether the server holds more rows than were sent (`MORE_ROWS`). */
2468
+ moreRows: boolean | undefined;
2469
+ /** Total rows the resource holds on the server, ignoring criteria (`ROWS_COUNT`). */
2470
+ rowsCount: number | undefined;
2471
+ }
2472
+
2473
+ /**
2474
+ * Kind of change a row data mapper is called with for a stream transaction.
2475
+ * @alpha
2476
+ */
2477
+ export declare type GridTabulatorRowDataMapperOperation = 'add' | 'update' | 'remove' | 'page';
2478
+
2416
2479
  /**
2417
2480
  * The grid-tabulator component registration.
2418
2481
  * @public
package/dist/react.cjs CHANGED
@@ -48,7 +48,7 @@ const GridTabulatorColumn = React.forwardRef(function GridTabulatorColumn(props,
48
48
  });
49
49
 
50
50
  const GridTabulatorClientSideDatasource = React.forwardRef(function GridTabulatorClientSideDatasource(props, ref) {
51
- const { onGridTabulatorError, onDataInit, onSizeChanged, children, ...rest } = props;
51
+ const { onGridTabulatorError, onDataInit, onSizeChanged, onMoreRowsChanged, children, ...rest } = props;
52
52
  const _innerRef = React.useRef(null);
53
53
  const _onGridTabulatorErrorRef = React.useRef(onGridTabulatorError);
54
54
  _onGridTabulatorErrorRef.current = onGridTabulatorError;
@@ -56,6 +56,8 @@ const GridTabulatorClientSideDatasource = React.forwardRef(function GridTabulato
56
56
  _onDataInitRef.current = onDataInit;
57
57
  const _onSizeChangedRef = React.useRef(onSizeChanged);
58
58
  _onSizeChangedRef.current = onSizeChanged;
59
+ const _onMoreRowsChangedRef = React.useRef(onMoreRowsChanged);
60
+ _onMoreRowsChangedRef.current = onMoreRowsChanged;
59
61
  React.useLayoutEffect(() => {
60
62
  const el = _innerRef.current;
61
63
  if (!el) return;
@@ -65,10 +67,13 @@ const GridTabulatorClientSideDatasource = React.forwardRef(function GridTabulato
65
67
  el.addEventListener('dataInit', _onDataInitFn);
66
68
  const _onSizeChangedFn = (e) => _onSizeChangedRef.current?.(e);
67
69
  el.addEventListener('sizeChanged', _onSizeChangedFn);
70
+ const _onMoreRowsChangedFn = (e) => _onMoreRowsChangedRef.current?.(e);
71
+ el.addEventListener('more-rows-changed', _onMoreRowsChangedFn);
68
72
  return () => {
69
73
  el.removeEventListener('gridTabulator:error', _onGridTabulatorErrorFn);
70
74
  el.removeEventListener('dataInit', _onDataInitFn);
71
75
  el.removeEventListener('sizeChanged', _onSizeChangedFn);
76
+ el.removeEventListener('more-rows-changed', _onMoreRowsChangedFn);
72
77
  };
73
78
  }, []);
74
79
  return React.createElement(customElements.getName(GridTabulatorClientSideDatasourceWC) ?? 'grid-tabulator-client-side-datasource', { ...rest, ref: _mergeRefs(_innerRef, ref) }, children);
package/dist/react.mjs CHANGED
@@ -46,7 +46,7 @@ export const GridTabulatorColumn = React.forwardRef(function GridTabulatorColumn
46
46
  });
47
47
 
48
48
  export const GridTabulatorClientSideDatasource = React.forwardRef(function GridTabulatorClientSideDatasource(props, ref) {
49
- const { onGridTabulatorError, onDataInit, onSizeChanged, children, ...rest } = props;
49
+ const { onGridTabulatorError, onDataInit, onSizeChanged, onMoreRowsChanged, children, ...rest } = props;
50
50
  const _innerRef = React.useRef(null);
51
51
  const _onGridTabulatorErrorRef = React.useRef(onGridTabulatorError);
52
52
  _onGridTabulatorErrorRef.current = onGridTabulatorError;
@@ -54,6 +54,8 @@ export const GridTabulatorClientSideDatasource = React.forwardRef(function GridT
54
54
  _onDataInitRef.current = onDataInit;
55
55
  const _onSizeChangedRef = React.useRef(onSizeChanged);
56
56
  _onSizeChangedRef.current = onSizeChanged;
57
+ const _onMoreRowsChangedRef = React.useRef(onMoreRowsChanged);
58
+ _onMoreRowsChangedRef.current = onMoreRowsChanged;
57
59
  React.useLayoutEffect(() => {
58
60
  const el = _innerRef.current;
59
61
  if (!el) return;
@@ -63,10 +65,13 @@ export const GridTabulatorClientSideDatasource = React.forwardRef(function GridT
63
65
  el.addEventListener('dataInit', _onDataInitFn);
64
66
  const _onSizeChangedFn = (e) => _onSizeChangedRef.current?.(e);
65
67
  el.addEventListener('sizeChanged', _onSizeChangedFn);
68
+ const _onMoreRowsChangedFn = (e) => _onMoreRowsChangedRef.current?.(e);
69
+ el.addEventListener('more-rows-changed', _onMoreRowsChangedFn);
66
70
  return () => {
67
71
  el.removeEventListener('gridTabulator:error', _onGridTabulatorErrorFn);
68
72
  el.removeEventListener('dataInit', _onDataInitFn);
69
73
  el.removeEventListener('sizeChanged', _onSizeChangedFn);
74
+ el.removeEventListener('more-rows-changed', _onMoreRowsChangedFn);
70
75
  };
71
76
  }, []);
72
77
  return React.createElement(customElements.getName(GridTabulatorClientSideDatasourceWC) ?? 'grid-tabulator-client-side-datasource', { ...rest, ref: _mergeRefs(_innerRef, ref) }, children);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/grid-tabulator",
3
3
  "description": "Genesis Foundation Grid Tabulator",
4
- "version": "15.94.0",
4
+ "version": "15.94.1-alpha-6f4e61418f.0",
5
5
  "sideEffects": false,
6
6
  "license": "SEE LICENSE IN license.txt",
7
7
  "main": "dist/esm/index.js",
@@ -39,19 +39,19 @@
39
39
  }
40
40
  },
41
41
  "devDependencies": {
42
- "@genesislcap/foundation-testing": "15.94.0",
43
- "@genesislcap/genx": "15.94.0",
44
- "@genesislcap/ts-builder": "15.94.0",
45
- "@genesislcap/uvu-playwright-builder": "15.94.0",
46
- "@genesislcap/vite-builder": "15.94.0",
47
- "@genesislcap/webpack-builder": "15.94.0",
42
+ "@genesislcap/foundation-testing": "15.94.1-alpha-6f4e61418f.0",
43
+ "@genesislcap/genx": "15.94.1-alpha-6f4e61418f.0",
44
+ "@genesislcap/ts-builder": "15.94.1-alpha-6f4e61418f.0",
45
+ "@genesislcap/uvu-playwright-builder": "15.94.1-alpha-6f4e61418f.0",
46
+ "@genesislcap/vite-builder": "15.94.1-alpha-6f4e61418f.0",
47
+ "@genesislcap/webpack-builder": "15.94.1-alpha-6f4e61418f.0",
48
48
  "@types/tabulator-tables": "6.2.6"
49
49
  },
50
50
  "dependencies": {
51
- "@genesislcap/foundation-comms": "15.94.0",
52
- "@genesislcap/foundation-logger": "15.94.0",
53
- "@genesislcap/foundation-ui": "15.94.0",
54
- "@genesislcap/foundation-utils": "15.94.0",
51
+ "@genesislcap/foundation-comms": "15.94.1-alpha-6f4e61418f.0",
52
+ "@genesislcap/foundation-logger": "15.94.1-alpha-6f4e61418f.0",
53
+ "@genesislcap/foundation-ui": "15.94.1-alpha-6f4e61418f.0",
54
+ "@genesislcap/foundation-utils": "15.94.1-alpha-6f4e61418f.0",
55
55
  "@microsoft/fast-colors": "5.3.1",
56
56
  "@microsoft/fast-components": "2.30.6",
57
57
  "@microsoft/fast-element": "1.14.0",