@vuu-ui/vuu-table 0.6.17-debug → 0.6.18-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/esm/index.js CHANGED
@@ -18797,12 +18797,20 @@ var exactlyTheSame = (a, b) => {
18797
18797
  return false;
18798
18798
  }
18799
18799
  };
18800
+ var equivalentFilter = ({ filter: f1 }, { filter: f2 }) => f1 === void 0 && (f2 == null ? void 0 : f2.filter) === "" || f2 === void 0 && (f1 == null ? void 0 : f1.filter) === "";
18800
18801
  var filterChanged = (c1, c2) => {
18801
18802
  var _a2, _b;
18802
- return ((_a2 = c1.filter) == null ? void 0 : _a2.filter) !== ((_b = c2.filter) == null ? void 0 : _b.filter);
18803
+ if (equivalentFilter(c1, c2)) {
18804
+ return false;
18805
+ } else {
18806
+ return ((_a2 = c1.filter) == null ? void 0 : _a2.filter) !== ((_b = c2.filter) == null ? void 0 : _b.filter);
18807
+ }
18803
18808
  };
18804
- var sortChanged = ({ sort: s1 }, { sort: s2 }) => {
18805
- if (exactlyTheSame(s1, s2)) {
18809
+ var equivalentSort = ({ sort: s1 }, { sort: s2 }) => s1 === void 0 && (s2 == null ? void 0 : s2.sortDefs.length) === 0 || s2 === void 0 && (s1 == null ? void 0 : s1.sortDefs.length) === 0;
18810
+ var sortChanged = (config, newConfig) => {
18811
+ const { sort: s1 } = config;
18812
+ const { sort: s2 } = newConfig;
18813
+ if (exactlyTheSame(s1, s2) || equivalentSort(config, newConfig)) {
18806
18814
  return false;
18807
18815
  } else if (s1 === void 0 || s2 === void 0) {
18808
18816
  return true;
@@ -18813,8 +18821,11 @@ var sortChanged = ({ sort: s1 }, { sort: s2 }) => {
18813
18821
  ({ column, sortType }, i) => column !== s2.sortDefs[i].column || sortType !== s2.sortDefs[i].sortType
18814
18822
  );
18815
18823
  };
18816
- var groupByChanged = ({ groupBy: g1 }, { groupBy: g2 }) => {
18817
- if (exactlyTheSame(g1, g2)) {
18824
+ var equivalentGroupBy = ({ groupBy: val1 }, { groupBy: val2 }) => val1 === void 0 && (val2 == null ? void 0 : val2.length) === 0 || val2 === void 0 && (val1 == null ? void 0 : val1.length) === 0;
18825
+ var groupByChanged = (config, newConfig) => {
18826
+ const { groupBy: g1 } = config;
18827
+ const { groupBy: g2 } = newConfig;
18828
+ if (exactlyTheSame(g1, g2) || equivalentGroupBy(config, newConfig)) {
18818
18829
  return false;
18819
18830
  } else if (g1 === void 0 || g2 === void 0) {
18820
18831
  return true;
@@ -18823,8 +18834,11 @@ var groupByChanged = ({ groupBy: g1 }, { groupBy: g2 }) => {
18823
18834
  }
18824
18835
  return g1.some((column, i) => column !== (g2 == null ? void 0 : g2[i]));
18825
18836
  };
18826
- var columnsChanged = ({ columns: cols1 }, { columns: cols2 }) => {
18827
- if (exactlyTheSame(cols1, cols2)) {
18837
+ var equivalentColumns = ({ columns: cols1 }, { columns: cols2 }) => cols1 === void 0 && (cols2 == null ? void 0 : cols2.length) === 0 || cols2 === void 0 && (cols1 == null ? void 0 : cols1.length) === 0;
18838
+ var columnsChanged = (config, newConfig) => {
18839
+ const { columns: cols1 } = config;
18840
+ const { columns: cols2 } = newConfig;
18841
+ if (exactlyTheSame(cols1, cols2) || equivalentColumns(config, newConfig)) {
18828
18842
  return false;
18829
18843
  } else if (cols1 === void 0 || cols2 === void 0) {
18830
18844
  return true;
@@ -18833,8 +18847,11 @@ var columnsChanged = ({ columns: cols1 }, { columns: cols2 }) => {
18833
18847
  }
18834
18848
  return cols1.some((column, i) => column !== (cols2 == null ? void 0 : cols2[i]));
18835
18849
  };
18836
- var aggregationsChanged = ({ aggregations: agg1 }, { aggregations: agg2 }) => {
18837
- if (exactlyTheSame(agg1, agg2)) {
18850
+ var equivalentAggregations = ({ aggregations: agg1 }, { aggregations: agg2 }) => agg1 === void 0 && (agg2 == null ? void 0 : agg2.length) === 0 || agg2 === void 0 && (agg1 == null ? void 0 : agg1.length) === 0;
18851
+ var aggregationsChanged = (config, newConfig) => {
18852
+ const { aggregations: agg1 } = config;
18853
+ const { aggregations: agg2 } = newConfig;
18854
+ if (exactlyTheSame(agg1, agg2) || equivalentAggregations(config, newConfig)) {
18838
18855
  return false;
18839
18856
  } else if (agg1 === void 0 || agg2 === void 0) {
18840
18857
  return true;
@@ -18881,6 +18898,28 @@ var shouldMessageBeRoutedToDataSource = (message) => {
18881
18898
  var isDataSourceConfigMessage = (message) => ["config", "aggregate", "columns", "filter", "groupBy", "sort"].includes(
18882
18899
  message.type
18883
18900
  );
18901
+ var withConfigDefaults = (config) => {
18902
+ if (config.aggregations && config.columns && config.filter && config.groupBy && config.sort) {
18903
+ return config;
18904
+ } else {
18905
+ const {
18906
+ aggregations = [],
18907
+ columns = [],
18908
+ filter = { filter: "" },
18909
+ groupBy = [],
18910
+ sort = { sortDefs: [] },
18911
+ visualLink
18912
+ } = config;
18913
+ return {
18914
+ aggregations,
18915
+ columns,
18916
+ filter,
18917
+ groupBy,
18918
+ sort,
18919
+ visualLink
18920
+ };
18921
+ }
18922
+ };
18884
18923
 
18885
18924
  // ../vuu-data/src/server-proxy/messages.ts
18886
18925
  var GET_TABLE_LIST = "GET_TABLE_LIST";
@@ -22170,27 +22209,26 @@ var RemoteDataSource = class extends EventEmitter4 {
22170
22209
  set config(config) {
22171
22210
  var _a2;
22172
22211
  if (configChanged2(__privateGet(this, _config), config)) {
22173
- if ((config == null ? void 0 : config.filter) && (config == null ? void 0 : config.filter.filterStruct) === void 0) {
22174
- __privateSet(this, _config, {
22212
+ if (config) {
22213
+ const newConfig = (config == null ? void 0 : config.filter) && (config == null ? void 0 : config.filter.filterStruct) === void 0 ? {
22175
22214
  ...config,
22176
22215
  filter: {
22177
22216
  filter: config.filter.filter,
22178
22217
  filterStruct: parseFilter(config.filter.filter)
22179
22218
  }
22180
- });
22181
- } else {
22182
- __privateSet(this, _config, config);
22183
- }
22184
- if (__privateGet(this, _config) && this.viewport && this.server) {
22185
- if (config) {
22186
- (_a2 = this.server) == null ? void 0 : _a2.send({
22187
- viewport: this.viewport,
22188
- type: "config",
22189
- config: __privateGet(this, _config)
22190
- });
22219
+ } : config;
22220
+ __privateSet(this, _config, withConfigDefaults(newConfig));
22221
+ if (__privateGet(this, _config) && this.viewport && this.server) {
22222
+ if (config) {
22223
+ (_a2 = this.server) == null ? void 0 : _a2.send({
22224
+ viewport: this.viewport,
22225
+ type: "config",
22226
+ config: __privateGet(this, _config)
22227
+ });
22228
+ }
22191
22229
  }
22230
+ this.emit("config", __privateGet(this, _config));
22192
22231
  }
22193
- this.emit("config", __privateGet(this, _config));
22194
22232
  }
22195
22233
  }
22196
22234
  get optimize() {