udp-stencil-component-library 26.9.0-beta.21 → 26.9.0-beta.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.
Files changed (43) hide show
  1. package/dist/cjs/{extraFields-CNvT2Qyf.js → extraFields-COLtRvA3.js} +5 -0
  2. package/dist/cjs/{extraFieldsHelper-Clk9u_FW.js → extraFieldsHelper-D6T1dyWx.js} +11 -4
  3. package/dist/cjs/index.cjs.js +2 -1
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/search-method-grid.cjs.entry.js +22 -10
  6. package/dist/cjs/server-side-grid.cjs.entry.js +32 -11
  7. package/dist/cjs/stencil-library.cjs.js +1 -1
  8. package/dist/cjs/udp-advanced-search-builder.cjs.entry.js +15 -6
  9. package/dist/collection/components/advanced-search-builder/udp-advanced-search-builder.js +16 -7
  10. package/dist/collection/components/grid/new-grid/helperFunctions/extraFieldsHelper.js +11 -4
  11. package/dist/collection/components/grid/new-grid/search-method-grid.js +21 -9
  12. package/dist/collection/components/grid/new-grid/server-side-grid.js +26 -8
  13. package/dist/collection/udp-utilities/extra-fields/extraFields.js +4 -0
  14. package/dist/components/extraFields.js +1 -1
  15. package/dist/components/index.js +1 -1
  16. package/dist/components/search-method-grid2.js +1 -1
  17. package/dist/components/server-side-grid2.js +1 -1
  18. package/dist/components/udp-advanced-search-builder.js +1 -1
  19. package/dist/docs.json +3 -3
  20. package/dist/esm/{extraFields-Cnpy_Bm7.js → extraFields-C20hA6Tp.js} +5 -1
  21. package/dist/esm/{extraFieldsHelper-CaBMA4HJ.js → extraFieldsHelper-BdFC1YD4.js} +11 -4
  22. package/dist/esm/index.js +1 -1
  23. package/dist/esm/loader.js +1 -1
  24. package/dist/esm/search-method-grid.entry.js +22 -10
  25. package/dist/esm/server-side-grid.entry.js +28 -11
  26. package/dist/esm/stencil-library.js +1 -1
  27. package/dist/esm/udp-advanced-search-builder.entry.js +15 -6
  28. package/dist/stencil-library/extraFields-C20hA6Tp.js +1 -0
  29. package/dist/stencil-library/extraFieldsHelper-BdFC1YD4.js +1 -0
  30. package/dist/stencil-library/index.esm.js +1 -1
  31. package/dist/stencil-library/search-method-grid.entry.js +1 -1
  32. package/dist/stencil-library/server-side-grid.entry.js +1 -1
  33. package/dist/stencil-library/stencil-library.esm.js +1 -1
  34. package/dist/stencil-library/udp-advanced-search-builder.entry.js +1 -1
  35. package/dist/types/components/advanced-search-builder/udp-advanced-search-builder.d.ts +4 -3
  36. package/dist/types/components/grid/new-grid/helperFunctions/extraFieldsHelper.d.ts +3 -1
  37. package/dist/types/components/grid/new-grid/search-method-grid.d.ts +12 -4
  38. package/dist/types/components/grid/new-grid/server-side-grid.d.ts +6 -0
  39. package/dist/types/components.d.ts +4 -4
  40. package/dist/types/udp-utilities/extra-fields/extraFields.d.ts +10 -0
  41. package/package.json +1 -1
  42. package/dist/stencil-library/extraFields-Cnpy_Bm7.js +0 -1
  43. package/dist/stencil-library/extraFieldsHelper-CaBMA4HJ.js +0 -1
@@ -4,9 +4,9 @@ var index = require('./index-CZB9dMeB.js');
4
4
  var apiUtils = require('./apiUtils-tzjwn5aw.js');
5
5
  var lookupHelper = require('./lookupHelper-DACjrAcP.js');
6
6
  var makeApiCall = require('./makeApiCall-CFfg9gI0.js');
7
- var extraFieldsHelper = require('./extraFieldsHelper-Clk9u_FW.js');
7
+ var extraFieldsHelper = require('./extraFieldsHelper-D6T1dyWx.js');
8
8
  var configService = require('./configService-DbfLqId2.js');
9
- var extraFields = require('./extraFields-CNvT2Qyf.js');
9
+ var extraFields = require('./extraFields-COLtRvA3.js');
10
10
  var isEqual = require('lodash-es/isEqual');
11
11
  require('./tenantUtils-BCKSE0vq.js');
12
12
  require('./getCurrentApiCatalogId-D7xHCEzs.js');
@@ -142,11 +142,16 @@ const SearchMethodGrid = class {
142
142
  */
143
143
  this.extraFieldColumnDefs = [];
144
144
  /**
145
- * False while the definitions are in flight. Columns and the datasource are
146
- * withheld until then, so saved views baseline on (and restore) the full
147
- * column set rather than the base columns alone.
145
+ * False while the definitions are in flight. On the first load, columns and
146
+ * the datasource are withheld until then, so saved views baseline on (and
147
+ * restore) the full column set rather than the base columns alone. On a
148
+ * reload (a `context` or domain change) the current columns stay in place
149
+ * until the new set lands, so AG Grid keeps the state (widths, order, sort,
150
+ * filters) of every column that survives.
148
151
  */
149
152
  this.extraFieldsReady = true;
153
+ /** True once a definitions response has been applied (or the opt-in is absent): reloads keep the columns. */
154
+ this.extraFieldsLoaded = false;
150
155
  /** Invalidated on every `extraFields`/`entityName` change so a stale definitions response is dropped. */
151
156
  this.extraFieldsRequestId = 0;
152
157
  }
@@ -197,22 +202,27 @@ const SearchMethodGrid = class {
197
202
  if (!this.extraFields) {
198
203
  this.extraFieldColumnDefs = [];
199
204
  this.extraFieldsReady = true;
205
+ this.extraFieldsLoaded = true;
200
206
  return;
201
207
  }
208
+ const firstLoad = !this.extraFieldsLoaded;
202
209
  this.extraFieldsReady = false;
203
210
  const columnDefs = await extraFieldsHelper.loadExtraFieldColumnDefs(this.extraFields, this.entityName);
204
211
  if (requestId !== this.extraFieldsRequestId)
205
212
  return;
206
213
  this.extraFieldColumnDefs = columnDefs;
207
214
  this.extraFieldsReady = true;
208
- // The datasource was withheld while loading; attach it, and apply the
209
- // initial column state, once the merged columns are installed in the grid.
215
+ this.extraFieldsLoaded = true;
216
+ // The datasource was withheld while loading; attach it once the merged
217
+ // columns are installed in the grid. The initial column state is applied
218
+ // on the first load only: a reload keeps the state the user has.
210
219
  if (this.gridApi) {
211
220
  extraFieldsHelper.whenColumnsInstalled(this.gridApi, this.mergedColumnDefs().length, () => {
212
221
  if (requestId !== this.extraFieldsRequestId)
213
222
  return;
214
223
  this.setDatasource();
215
- this.setGridModel();
224
+ if (firstLoad)
225
+ this.setGridModel();
216
226
  });
217
227
  }
218
228
  }
@@ -220,10 +230,12 @@ const SearchMethodGrid = class {
220
230
  * The base columns with the extra-field columns inserted. Extra columns join
221
231
  * existing ones: while the base columns are still empty (a host still
222
232
  * loading its catalog) none are shown, so they never appear on their own.
233
+ * Nothing is shown while the first definitions load; a reload keeps the
234
+ * current extra-field columns until the new set replaces them.
223
235
  */
224
236
  mergedColumnDefs() {
225
237
  var _a, _b, _c;
226
- if (!this.extraFieldsReady)
238
+ if (!this.extraFieldsReady && !this.extraFieldsLoaded)
227
239
  return [];
228
240
  if (!((_a = this.columnDefs) === null || _a === void 0 ? void 0 : _a.length))
229
241
  return (_b = this.columnDefs) !== null && _b !== void 0 ? _b : [];
@@ -280,7 +292,7 @@ const SearchMethodGrid = class {
280
292
  }
281
293
  }
282
294
  render() {
283
- return (index.h("server-side-grid", { key: '7ebf7ba23217830a5e42766c94481fa2a9645cae', onGridReady: e => this.handleGridReady(e), dataSource: this.dataSource, gridFunctions: this.gridFunctions, columnDefs: this.mergedColumnDefs(), gridOptions: this.gridOptions, gridHeaderConfig: this.gridHeaderConfig, gridId: this.gridId, entityName: this.entityName, gridHeight: this.gridHeight, gridApiCallback: this.gridApiCallback }));
295
+ return (index.h("server-side-grid", { key: '002235b9c81a4673281f45c7ea22bbe588b0d287', onGridReady: e => this.handleGridReady(e), dataSource: this.dataSource, gridFunctions: this.gridFunctions, columnDefs: this.mergedColumnDefs(), gridOptions: this.gridOptions, gridHeaderConfig: this.gridHeaderConfig, gridId: this.gridId, entityName: this.entityName, gridHeight: this.gridHeight, gridApiCallback: this.gridApiCallback }));
284
296
  }
285
297
  static get watchers() { return {
286
298
  "searchMethodConfig": [{
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-CZB9dMeB.js');
4
- var extraFieldsHelper = require('./extraFieldsHelper-Clk9u_FW.js');
4
+ var extraFieldsHelper = require('./extraFieldsHelper-D6T1dyWx.js');
5
5
  var lookupHelper = require('./lookupHelper-DACjrAcP.js');
6
- var extraFields = require('./extraFields-CNvT2Qyf.js');
6
+ var isEqual = require('lodash-es/isEqual');
7
+ var extraFields = require('./extraFields-COLtRvA3.js');
7
8
  require('./apiUtils-tzjwn5aw.js');
8
- require('lodash-es/isEqual');
9
9
  require('./makeApiCall-CFfg9gI0.js');
10
10
  require('axios');
11
11
  require('./configService-DbfLqId2.js');
@@ -13,6 +13,10 @@ require('./tenantUtils-BCKSE0vq.js');
13
13
  require('./getCurrentApiCatalogId-D7xHCEzs.js');
14
14
  require('./searchObject-mbqgqdRh.js');
15
15
 
16
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
17
+
18
+ var isEqual__default = /*#__PURE__*/_interopDefault(isEqual);
19
+
16
20
  const ServerSideGrid = class {
17
21
  constructor(hostRef) {
18
22
  index.registerInstance(this, hostRef);
@@ -27,6 +31,8 @@ const ServerSideGrid = class {
27
31
  this.gridOptions = {};
28
32
  this.extraFieldColumnDefs = [];
29
33
  this.extraFieldsReady = true;
34
+ /** True once a definitions response has been applied (or the opt-in is absent): reloads keep the columns. */
35
+ this.extraFieldsLoaded = false;
30
36
  /** Invalidated on every `extraFields`/`entityName` change so a stale definitions response is dropped. */
31
37
  this.extraFieldsRequestId = 0;
32
38
  /** True while this grid's own opt-in is in grid context (never touches a parent grid's). */
@@ -72,24 +78,39 @@ const ServerSideGrid = class {
72
78
  void this.loadExtraFieldColumns();
73
79
  this.serverSideConfig = Object.assign(Object.assign({ paginationAutoPageSize: true, suppressSetFilterByDefault: true }, this.gridOptions), { rowModelType: 'serverSide' });
74
80
  }
81
+ /** A new object with the same contents is not a change: an unmemoized prop must not reload the columns on every render. */
82
+ handleExtraFieldsUpdate(newVal, prevVal) {
83
+ if (isEqual__default.default(newVal, prevVal))
84
+ return;
85
+ void this.loadExtraFieldColumns();
86
+ }
87
+ /** The domain defaults to `entityName`, so a grid with the opt-in follows it; one without is unaffected. */
88
+ handleEntityNameUpdate(newVal, prevVal) {
89
+ if (!this.extraFields || newVal === prevVal)
90
+ return;
91
+ void this.loadExtraFieldColumns();
92
+ }
75
93
  async loadExtraFieldColumns() {
76
94
  const requestId = ++this.extraFieldsRequestId;
77
95
  this.writeExtraFieldsContext();
78
96
  if (!this.extraFields) {
79
97
  this.extraFieldColumnDefs = [];
80
98
  this.extraFieldsReady = true;
99
+ this.extraFieldsLoaded = true;
81
100
  // Opt-out: reinstall the caller's datasource without the values wrapper.
82
101
  this.updateDataSource();
83
102
  return;
84
103
  }
85
- // Columns and the datasource wait for the definitions, so saved views
86
- // baseline on the full column set (see search-method-grid).
104
+ // On the first load, columns and the datasource wait for the definitions,
105
+ // so saved views baseline on the full column set; a reload keeps the
106
+ // current columns in place until the new set lands (see search-method-grid).
87
107
  this.extraFieldsReady = false;
88
108
  const columnDefs = await extraFieldsHelper.loadExtraFieldColumnDefs(this.extraFields, this.entityName);
89
109
  if (requestId !== this.extraFieldsRequestId)
90
110
  return;
91
111
  this.extraFieldColumnDefs = columnDefs;
92
112
  this.extraFieldsReady = true;
113
+ this.extraFieldsLoaded = true;
93
114
  if (this.gridApi) {
94
115
  extraFieldsHelper.whenColumnsInstalled(this.gridApi, this.mergedColumnDefs().length, () => {
95
116
  if (requestId === this.extraFieldsRequestId)
@@ -99,22 +120,22 @@ const ServerSideGrid = class {
99
120
  }
100
121
  mergedColumnDefs() {
101
122
  var _a;
102
- return this.extraFieldsReady
103
- ? extraFieldsHelper.insertExtraFieldColumns(this.columnDefs, this.extraFieldColumnDefs, (_a = this.extraFields) === null || _a === void 0 ? void 0 : _a.position)
104
- : [];
123
+ if (!this.extraFieldsReady && !this.extraFieldsLoaded)
124
+ return [];
125
+ return extraFieldsHelper.insertExtraFieldColumns(this.columnDefs, this.extraFieldColumnDefs, (_a = this.extraFields) === null || _a === void 0 ? void 0 : _a.position);
105
126
  }
106
127
  render() {
107
- return (index.h("ag-grid-base", { key: 'cbcd476ed56cf02572e12af7749adbb6d10512a3', columnDefs: this.mergedColumnDefs(), gridOptions: this.serverSideConfig, headerConfig: this.gridHeaderConfig, onGridReady: e => this.handleGridReady(e), gridFunctions: this.gridFunctions, gridId: this.gridId, entityName: this.entityName, gridHeight: this.gridHeight, gridApiCallback: this.gridApiCallback }));
128
+ return (index.h("ag-grid-base", { key: '7c2af20214253fa8f571c72fbf060e379d2bbc0a', columnDefs: this.mergedColumnDefs(), gridOptions: this.serverSideConfig, headerConfig: this.gridHeaderConfig, onGridReady: e => this.handleGridReady(e), gridFunctions: this.gridFunctions, gridId: this.gridId, entityName: this.entityName, gridHeight: this.gridHeight, gridApiCallback: this.gridApiCallback }));
108
129
  }
109
130
  static get watchers() { return {
110
131
  "dataSource": [{
111
132
  "updateDataSource": 0
112
133
  }],
113
134
  "extraFields": [{
114
- "loadExtraFieldColumns": 0
135
+ "handleExtraFieldsUpdate": 0
115
136
  }],
116
137
  "entityName": [{
117
- "loadExtraFieldColumns": 0
138
+ "handleEntityNameUpdate": 0
118
139
  }]
119
140
  }; }
120
141
  };