@vuu-ui/vuu-data-remote 0.8.23-debug → 0.8.24-debug

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/cjs/index.js CHANGED
@@ -172,6 +172,7 @@ function partition(array, test, pass = [], fail = []) {
172
172
  }
173
173
 
174
174
  // ../vuu-utils/src/column-utils.ts
175
+ var KEY = 6;
175
176
  var metadataKeys = {
176
177
  IDX: 0,
177
178
  RENDER_IDX: 1,
@@ -179,7 +180,7 @@ var metadataKeys = {
179
180
  IS_EXPANDED: 3,
180
181
  DEPTH: 4,
181
182
  COUNT: 5,
182
- KEY: 6,
183
+ KEY,
183
184
  SELECTED: 7,
184
185
  count: 8,
185
186
  // TODO following only used in datamodel
@@ -753,7 +754,6 @@ var ArrayBackedMovingWindow = class {
753
754
  _range = new WeakMap();
754
755
 
755
756
  // src/server-proxy/viewport.ts
756
- var EMPTY_GROUPBY = [];
757
757
  var { debug: debug2, debugEnabled: debugEnabled2, error, info, infoEnabled, warn } = logger("viewport");
758
758
  var isLeafUpdate = ({ rowKey, updateType }) => updateType === "U" && !rowKey.startsWith("$root");
759
759
  var NO_DATA_UPDATE = [
@@ -1251,25 +1251,17 @@ var Viewport = class {
1251
1251
  debug2 == null ? void 0 : debug2(\`columnRequest: \${columns}\`);
1252
1252
  return this.createRequest({ columns });
1253
1253
  }
1254
- filterRequest(requestId, dataSourceFilter) {
1255
- this.awaitOperation(requestId, {
1256
- type: "filter",
1257
- data: dataSourceFilter
1258
- });
1259
- if (this.useBatchMode) {
1260
- this.batchMode = true;
1261
- }
1262
- const { filter } = dataSourceFilter;
1263
- info == null ? void 0 : info(\`filterRequest: \${filter}\`);
1264
- return this.createRequest({ filterSpec: { filter } });
1265
- }
1266
1254
  setConfig(requestId, config) {
1255
+ var _a;
1267
1256
  this.awaitOperation(requestId, { type: "config", data: config });
1268
1257
  const { filter, ...remainingConfig } = config;
1269
1258
  if (this.useBatchMode) {
1270
1259
  this.batchMode = true;
1271
1260
  }
1272
1261
  debugEnabled2 ? debug2 == null ? void 0 : debug2(\`setConfig \${JSON.stringify(config)}\`) : info == null ? void 0 : info(\`setConfig\`);
1262
+ if (!this.isTree && config.groupBy.length > 0) {
1263
+ (_a = this.dataWindow) == null ? void 0 : _a.clear();
1264
+ }
1273
1265
  return this.createRequest(
1274
1266
  {
1275
1267
  ...remainingConfig,
@@ -1292,17 +1284,6 @@ var Viewport = class {
1292
1284
  info == null ? void 0 : info(\`sortRequest: \${JSON.stringify(sort.sortDefs)}\`);
1293
1285
  return this.createRequest({ sort });
1294
1286
  }
1295
- groupByRequest(requestId, groupBy = EMPTY_GROUPBY) {
1296
- var _a;
1297
- this.awaitOperation(requestId, { type: "groupBy", data: groupBy });
1298
- if (this.useBatchMode) {
1299
- this.batchMode = true;
1300
- }
1301
- if (!this.isTree) {
1302
- (_a = this.dataWindow) == null ? void 0 : _a.clear();
1303
- }
1304
- return this.createRequest({ groupBy });
1305
- }
1306
1287
  selectRequest(requestId, selected) {
1307
1288
  this.selectedRows = selected;
1308
1289
  this.awaitOperation(requestId, { type: "selection", data: selected });
@@ -1716,17 +1697,6 @@ var ServerProxy = class {
1716
1697
  const request = viewport.sortRequest(requestId, message.sort);
1717
1698
  this.sendIfReady(request, requestId, viewport.status === "subscribed");
1718
1699
  }
1719
- groupBy(viewport, message) {
1720
- const requestId = nextRequestId();
1721
- const request = viewport.groupByRequest(requestId, message.groupBy);
1722
- this.sendIfReady(request, requestId, viewport.status === "subscribed");
1723
- }
1724
- filter(viewport, message) {
1725
- const requestId = nextRequestId();
1726
- const { filter } = message;
1727
- const request = viewport.filterRequest(requestId, filter);
1728
- this.sendIfReady(request, requestId, viewport.status === "subscribed");
1729
- }
1730
1700
  setColumns(viewport, message) {
1731
1701
  const requestId = nextRequestId();
1732
1702
  const { columns } = message;
@@ -1899,10 +1869,6 @@ var ServerProxy = class {
1899
1869
  return this.aggregate(viewport, message);
1900
1870
  case "sort":
1901
1871
  return this.sort(viewport, message);
1902
- case "groupBy":
1903
- return this.groupBy(viewport, message);
1904
- case "filter":
1905
- return this.filter(viewport, message);
1906
1872
  case "select":
1907
1873
  return this.select(viewport, message);
1908
1874
  case "suspend":
@@ -3255,8 +3221,9 @@ var VuuDataSource = class extends import_vuu_utils2.EventEmitter {
3255
3221
  }
3256
3222
  set config(config) {
3257
3223
  var _a;
3258
- if (this.applyConfig(config)) {
3259
- if (__privateGet(this, _config) && this.viewport && this.server) {
3224
+ const configChanges = this.applyConfig(config);
3225
+ if (configChanges) {
3226
+ if (__privateGet(this, _config) && this.viewport) {
3260
3227
  if (config) {
3261
3228
  (_a = this.server) == null ? void 0 : _a.send({
3262
3229
  viewport: this.viewport,
@@ -3265,12 +3232,16 @@ var VuuDataSource = class extends import_vuu_utils2.EventEmitter {
3265
3232
  });
3266
3233
  }
3267
3234
  }
3268
- this.emit("config", __privateGet(this, _config));
3235
+ this.emit("config", __privateGet(this, _config), void 0, configChanges);
3269
3236
  }
3270
3237
  }
3271
3238
  applyConfig(config) {
3272
3239
  var _a;
3273
- if ((0, import_vuu_utils2.configChanged)(__privateGet(this, _config), config)) {
3240
+ const { noChanges, ...otherChanges } = (0, import_vuu_utils2.isConfigChanged)(
3241
+ __privateGet(this, _config),
3242
+ config
3243
+ );
3244
+ if (noChanges !== true) {
3274
3245
  if (config) {
3275
3246
  const newConfig = ((_a = config == null ? void 0 : config.filter) == null ? void 0 : _a.filter) && (config == null ? void 0 : config.filter.filterStruct) === void 0 ? {
3276
3247
  ...config,
@@ -3280,7 +3251,7 @@ var VuuDataSource = class extends import_vuu_utils2.EventEmitter {
3280
3251
  }
3281
3252
  } : config;
3282
3253
  __privateSet(this, _config, (0, import_vuu_utils2.withConfigDefaults)(newConfig));
3283
- return true;
3254
+ return otherChanges;
3284
3255
  }
3285
3256
  }
3286
3257
  }
@@ -3327,6 +3298,7 @@ var VuuDataSource = class extends import_vuu_utils2.EventEmitter {
3327
3298
  return __privateGet(this, _config).sort;
3328
3299
  }
3329
3300
  set sort(sort) {
3301
+ var _a;
3330
3302
  __privateSet(this, _config, {
3331
3303
  ...__privateGet(this, _config),
3332
3304
  sort
@@ -3337,9 +3309,7 @@ var VuuDataSource = class extends import_vuu_utils2.EventEmitter {
3337
3309
  type: "sort",
3338
3310
  sort
3339
3311
  };
3340
- if (this.server) {
3341
- this.server.send(message);
3342
- }
3312
+ (_a = this.server) == null ? void 0 : _a.send(message);
3343
3313
  }
3344
3314
  this.emit("config", __privateGet(this, _config));
3345
3315
  }
@@ -3347,21 +3317,10 @@ var VuuDataSource = class extends import_vuu_utils2.EventEmitter {
3347
3317
  return __privateGet(this, _config).filter;
3348
3318
  }
3349
3319
  set filter(filter) {
3350
- __privateSet(this, _config, {
3320
+ this.config = {
3351
3321
  ...__privateGet(this, _config),
3352
3322
  filter
3353
- });
3354
- if (this.viewport) {
3355
- const message = {
3356
- viewport: this.viewport,
3357
- type: "filter",
3358
- filter
3359
- };
3360
- if (this.server) {
3361
- this.server.send(message);
3362
- }
3363
- }
3364
- this.emit("config", __privateGet(this, _config));
3323
+ };
3365
3324
  }
3366
3325
  get groupBy() {
3367
3326
  return __privateGet(this, _config).groupBy;
@@ -3370,20 +3329,10 @@ var VuuDataSource = class extends import_vuu_utils2.EventEmitter {
3370
3329
  var _a;
3371
3330
  if ((0, import_vuu_utils2.itemsOrOrderChanged)(this.groupBy, groupBy)) {
3372
3331
  const wasGrouped = __privateGet(this, _groupBy).length > 0;
3373
- __privateSet(this, _config, {
3332
+ this.config = {
3374
3333
  ...__privateGet(this, _config),
3375
3334
  groupBy
3376
- });
3377
- if (this.viewport) {
3378
- const message = {
3379
- viewport: this.viewport,
3380
- type: "groupBy",
3381
- groupBy: __privateGet(this, _config).groupBy
3382
- };
3383
- if (this.server) {
3384
- this.server.send(message);
3385
- }
3386
- }
3335
+ };
3387
3336
  if (!wasGrouped && groupBy.length > 0 && this.viewport) {
3388
3337
  (_a = this.clientCallback) == null ? void 0 : _a.call(this, {
3389
3338
  clientViewportId: this.viewport,
@@ -3393,7 +3342,6 @@ var VuuDataSource = class extends import_vuu_utils2.EventEmitter {
3393
3342
  rows: []
3394
3343
  });
3395
3344
  }
3396
- this.emit("config", __privateGet(this, _config));
3397
3345
  this.setConfigPending({ groupBy });
3398
3346
  }
3399
3347
  }