@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/cjs/index.js CHANGED
@@ -18805,12 +18805,20 @@ var exactlyTheSame = (a, b) => {
18805
18805
  return false;
18806
18806
  }
18807
18807
  };
18808
+ var equivalentFilter = ({ filter: f1 }, { filter: f2 }) => f1 === void 0 && (f2 == null ? void 0 : f2.filter) === "" || f2 === void 0 && (f1 == null ? void 0 : f1.filter) === "";
18808
18809
  var filterChanged = (c1, c2) => {
18809
18810
  var _a2, _b;
18810
- return ((_a2 = c1.filter) == null ? void 0 : _a2.filter) !== ((_b = c2.filter) == null ? void 0 : _b.filter);
18811
+ if (equivalentFilter(c1, c2)) {
18812
+ return false;
18813
+ } else {
18814
+ return ((_a2 = c1.filter) == null ? void 0 : _a2.filter) !== ((_b = c2.filter) == null ? void 0 : _b.filter);
18815
+ }
18811
18816
  };
18812
- var sortChanged = ({ sort: s1 }, { sort: s2 }) => {
18813
- if (exactlyTheSame(s1, s2)) {
18817
+ 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;
18818
+ var sortChanged = (config, newConfig) => {
18819
+ const { sort: s1 } = config;
18820
+ const { sort: s2 } = newConfig;
18821
+ if (exactlyTheSame(s1, s2) || equivalentSort(config, newConfig)) {
18814
18822
  return false;
18815
18823
  } else if (s1 === void 0 || s2 === void 0) {
18816
18824
  return true;
@@ -18821,8 +18829,11 @@ var sortChanged = ({ sort: s1 }, { sort: s2 }) => {
18821
18829
  ({ column, sortType }, i) => column !== s2.sortDefs[i].column || sortType !== s2.sortDefs[i].sortType
18822
18830
  );
18823
18831
  };
18824
- var groupByChanged = ({ groupBy: g1 }, { groupBy: g2 }) => {
18825
- if (exactlyTheSame(g1, g2)) {
18832
+ 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;
18833
+ var groupByChanged = (config, newConfig) => {
18834
+ const { groupBy: g1 } = config;
18835
+ const { groupBy: g2 } = newConfig;
18836
+ if (exactlyTheSame(g1, g2) || equivalentGroupBy(config, newConfig)) {
18826
18837
  return false;
18827
18838
  } else if (g1 === void 0 || g2 === void 0) {
18828
18839
  return true;
@@ -18831,8 +18842,11 @@ var groupByChanged = ({ groupBy: g1 }, { groupBy: g2 }) => {
18831
18842
  }
18832
18843
  return g1.some((column, i) => column !== (g2 == null ? void 0 : g2[i]));
18833
18844
  };
18834
- var columnsChanged = ({ columns: cols1 }, { columns: cols2 }) => {
18835
- if (exactlyTheSame(cols1, cols2)) {
18845
+ 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;
18846
+ var columnsChanged = (config, newConfig) => {
18847
+ const { columns: cols1 } = config;
18848
+ const { columns: cols2 } = newConfig;
18849
+ if (exactlyTheSame(cols1, cols2) || equivalentColumns(config, newConfig)) {
18836
18850
  return false;
18837
18851
  } else if (cols1 === void 0 || cols2 === void 0) {
18838
18852
  return true;
@@ -18841,8 +18855,11 @@ var columnsChanged = ({ columns: cols1 }, { columns: cols2 }) => {
18841
18855
  }
18842
18856
  return cols1.some((column, i) => column !== (cols2 == null ? void 0 : cols2[i]));
18843
18857
  };
18844
- var aggregationsChanged = ({ aggregations: agg1 }, { aggregations: agg2 }) => {
18845
- if (exactlyTheSame(agg1, agg2)) {
18858
+ 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;
18859
+ var aggregationsChanged = (config, newConfig) => {
18860
+ const { aggregations: agg1 } = config;
18861
+ const { aggregations: agg2 } = newConfig;
18862
+ if (exactlyTheSame(agg1, agg2) || equivalentAggregations(config, newConfig)) {
18846
18863
  return false;
18847
18864
  } else if (agg1 === void 0 || agg2 === void 0) {
18848
18865
  return true;
@@ -18889,6 +18906,28 @@ var shouldMessageBeRoutedToDataSource = (message) => {
18889
18906
  var isDataSourceConfigMessage = (message) => ["config", "aggregate", "columns", "filter", "groupBy", "sort"].includes(
18890
18907
  message.type
18891
18908
  );
18909
+ var withConfigDefaults = (config) => {
18910
+ if (config.aggregations && config.columns && config.filter && config.groupBy && config.sort) {
18911
+ return config;
18912
+ } else {
18913
+ const {
18914
+ aggregations = [],
18915
+ columns = [],
18916
+ filter = { filter: "" },
18917
+ groupBy = [],
18918
+ sort = { sortDefs: [] },
18919
+ visualLink
18920
+ } = config;
18921
+ return {
18922
+ aggregations,
18923
+ columns,
18924
+ filter,
18925
+ groupBy,
18926
+ sort,
18927
+ visualLink
18928
+ };
18929
+ }
18930
+ };
18892
18931
 
18893
18932
  // ../vuu-data/src/server-proxy/messages.ts
18894
18933
  var GET_TABLE_LIST = "GET_TABLE_LIST";
@@ -22165,27 +22204,26 @@ var RemoteDataSource = class extends import_vuu_utils13.EventEmitter {
22165
22204
  set config(config) {
22166
22205
  var _a2;
22167
22206
  if (configChanged2(__privateGet(this, _config), config)) {
22168
- if ((config == null ? void 0 : config.filter) && (config == null ? void 0 : config.filter.filterStruct) === void 0) {
22169
- __privateSet(this, _config, {
22207
+ if (config) {
22208
+ const newConfig = (config == null ? void 0 : config.filter) && (config == null ? void 0 : config.filter.filterStruct) === void 0 ? {
22170
22209
  ...config,
22171
22210
  filter: {
22172
22211
  filter: config.filter.filter,
22173
22212
  filterStruct: parseFilter(config.filter.filter)
22174
22213
  }
22175
- });
22176
- } else {
22177
- __privateSet(this, _config, config);
22178
- }
22179
- if (__privateGet(this, _config) && this.viewport && this.server) {
22180
- if (config) {
22181
- (_a2 = this.server) == null ? void 0 : _a2.send({
22182
- viewport: this.viewport,
22183
- type: "config",
22184
- config: __privateGet(this, _config)
22185
- });
22214
+ } : config;
22215
+ __privateSet(this, _config, withConfigDefaults(newConfig));
22216
+ if (__privateGet(this, _config) && this.viewport && this.server) {
22217
+ if (config) {
22218
+ (_a2 = this.server) == null ? void 0 : _a2.send({
22219
+ viewport: this.viewport,
22220
+ type: "config",
22221
+ config: __privateGet(this, _config)
22222
+ });
22223
+ }
22186
22224
  }
22225
+ this.emit("config", __privateGet(this, _config));
22187
22226
  }
22188
- this.emit("config", __privateGet(this, _config));
22189
22227
  }
22190
22228
  }
22191
22229
  get optimize() {