@procore/saved-views 1.0.1-estimatingFork.6.2 → 1.0.1-estimatingFork.6.3

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.
@@ -109,6 +109,12 @@ interface IDataTableSavedViewsExternalConsumerProps extends IBaseSavedViewsProps
109
109
  interface ISmartGridSavedViewsExternalConsumerProps extends IBaseSavedViewsProps {
110
110
  gridApi: GridApi;
111
111
  transformSettings?: (config: ISmartGridConfig) => ISmartGridConfig;
112
+ /**
113
+ * Merge live app state into the config used for Update visibility and persisting views.
114
+ * AG Grid events only report column/group/filter state — use this for flags such as
115
+ * enableRowGrouping / enableSplitAssembliesForDynamicGrouping that live outside the grid API.
116
+ */
117
+ augmentTableConfig?: (config: ISmartGridConfig) => ISmartGridConfig;
112
118
  defaultViews: ISmartGridDefaultViewConfig[];
113
119
  }
114
120
 
@@ -109,6 +109,12 @@ interface IDataTableSavedViewsExternalConsumerProps extends IBaseSavedViewsProps
109
109
  interface ISmartGridSavedViewsExternalConsumerProps extends IBaseSavedViewsProps {
110
110
  gridApi: GridApi;
111
111
  transformSettings?: (config: ISmartGridConfig) => ISmartGridConfig;
112
+ /**
113
+ * Merge live app state into the config used for Update visibility and persisting views.
114
+ * AG Grid events only report column/group/filter state — use this for flags such as
115
+ * enableRowGrouping / enableSplitAssembliesForDynamicGrouping that live outside the grid API.
116
+ */
117
+ augmentTableConfig?: (config: ISmartGridConfig) => ISmartGridConfig;
112
118
  defaultViews: ISmartGridDefaultViewConfig[];
113
119
  }
114
120
 
@@ -1469,7 +1469,7 @@ var require_lodash = __commonJS({
1469
1469
  return string3.match(reUnicodeWord) || [];
1470
1470
  }
1471
1471
  var runInContext = function runInContext2(context) {
1472
- context = context == null ? root : _3.defaults(root.Object(), context, _3.pick(root, contextProps));
1472
+ context = context == null ? root : _4.defaults(root.Object(), context, _4.pick(root, contextProps));
1473
1473
  var Array2 = context.Array, Date = context.Date, Error2 = context.Error, Function2 = context.Function, Math2 = context.Math, Object2 = context.Object, RegExp2 = context.RegExp, String2 = context.String, TypeError2 = context.TypeError;
1474
1474
  var arrayProto = Array2.prototype, funcProto = Function2.prototype, objectProto = Object2.prototype;
1475
1475
  var coreJsData = context["__core-js_shared__"];
@@ -6263,17 +6263,17 @@ var require_lodash = __commonJS({
6263
6263
  }
6264
6264
  return lodash;
6265
6265
  };
6266
- var _3 = runInContext();
6266
+ var _4 = runInContext();
6267
6267
  if (typeof define == "function" && typeof define.amd == "object" && define.amd) {
6268
- root._ = _3;
6268
+ root._ = _4;
6269
6269
  define(function() {
6270
- return _3;
6270
+ return _4;
6271
6271
  });
6272
6272
  } else if (freeModule) {
6273
- (freeModule.exports = _3)._ = _3;
6274
- freeExports._ = _3;
6273
+ (freeModule.exports = _4)._ = _4;
6274
+ freeExports._ = _4;
6275
6275
  } else {
6276
- root._ = _3;
6276
+ root._ = _4;
6277
6277
  }
6278
6278
  }).call(exports);
6279
6279
  }
@@ -9151,7 +9151,7 @@ function Fe(e2, t2, n2) {
9151
9151
  return t3 ? t3 + "-" + r2 : r2;
9152
9152
  }(t2.displayName, t2.parentComponentId) : l2, h = t2.displayName, y2 = void 0 === h ? function(e3) {
9153
9153
  return Te(e3) ? "styled." + e3 : "Styled(" + E(e3) + ")";
9154
- }(e2) : h, v2 = t2.displayName && t2.componentId ? De(t2.displayName) + "-" + t2.componentId : t2.componentId || d, _3 = o2 && e2.attrs ? Array.prototype.concat(e2.attrs, c2).filter(Boolean) : c2, N = t2.shouldForwardProp;
9154
+ }(e2) : h, v2 = t2.displayName && t2.componentId ? De(t2.displayName) + "-" + t2.componentId : t2.componentId || d, _4 = o2 && e2.attrs ? Array.prototype.concat(e2.attrs, c2).filter(Boolean) : c2, N = t2.shouldForwardProp;
9155
9155
  o2 && e2.shouldForwardProp && (N = t2.shouldForwardProp ? function(n3, r2, o3) {
9156
9156
  return e2.shouldForwardProp(n3, r2, o3) && t2.shouldForwardProp(n3, r2, o3);
9157
9157
  } : e2.shouldForwardProp);
@@ -9168,13 +9168,13 @@ function Fe(e2, t2, n2) {
9168
9168
  }(Pe(t4, (0, import_react.useContext)(Be), a3) || S, t4, o3), y3 = f2[0], v3 = f2[1], g2 = function(e5, t5, n4, r3) {
9169
9169
  var o4 = he(), s2 = pe(), i4 = t5 ? e5.generateAndInjectStyles(S, o4, s2) : e5.generateAndInjectStyles(n4, o4, s2);
9170
9170
  return "production" !== process.env.NODE_ENV && !t5 && r3 && r3(i4), i4;
9171
- }(i3, r2, y3, "production" !== process.env.NODE_ENV ? e4.warnTooManyClasses : void 0), E2 = n3, b2 = v3.$as || t4.$as || v3.as || t4.as || h2, _4 = Te(b2), N2 = v3 !== t4 ? m({}, t4, {}, v3) : t4, A3 = {};
9171
+ }(i3, r2, y3, "production" !== process.env.NODE_ENV ? e4.warnTooManyClasses : void 0), E2 = n3, b2 = v3.$as || t4.$as || v3.as || t4.as || h2, _5 = Te(b2), N2 = v3 !== t4 ? m({}, t4, {}, v3) : t4, A3 = {};
9172
9172
  for (var C3 in N2)
9173
- "$" !== C3[0] && "as" !== C3 && ("forwardedAs" === C3 ? A3.as = N2[C3] : (l3 ? l3(C3, isPropValid, b2) : !_4 || isPropValid(C3)) && (A3[C3] = N2[C3]));
9173
+ "$" !== C3[0] && "as" !== C3 && ("forwardedAs" === C3 ? A3.as = N2[C3] : (l3 ? l3(C3, isPropValid, b2) : !_5 || isPropValid(C3)) && (A3[C3] = N2[C3]));
9174
9174
  return t4.style && v3.style !== t4.style && (A3.style = m({}, t4.style, {}, v3.style)), A3.className = Array.prototype.concat(c3, d2, g2 !== d2 ? g2 : null, t4.className, v3.className).filter(Boolean).join(" "), A3.ref = E2, (0, import_react.createElement)(b2, A3);
9175
9175
  }(A2, e3, t3, I);
9176
9176
  };
9177
- return P4.displayName = y2, (A2 = import_react.default.forwardRef(P4)).attrs = _3, A2.componentStyle = C2, A2.displayName = y2, A2.shouldForwardProp = N, A2.foldedComponentIds = o2 ? Array.prototype.concat(e2.foldedComponentIds, e2.styledComponentId) : g, A2.styledComponentId = v2, A2.target = o2 ? e2.target : e2, A2.withComponent = function(e3) {
9177
+ return P4.displayName = y2, (A2 = import_react.default.forwardRef(P4)).attrs = _4, A2.componentStyle = C2, A2.displayName = y2, A2.shouldForwardProp = N, A2.foldedComponentIds = o2 ? Array.prototype.concat(e2.foldedComponentIds, e2.styledComponentId) : g, A2.styledComponentId = v2, A2.target = o2 ? e2.target : e2, A2.withComponent = function(e3) {
9178
9178
  var r2 = t2.componentId, o3 = function(e4, t3) {
9179
9179
  if (null == e4)
9180
9180
  return {};
@@ -9183,7 +9183,7 @@ function Fe(e2, t2, n2) {
9183
9183
  n3 = s3[r3], t3.indexOf(n3) >= 0 || (o4[n3] = e4[n3]);
9184
9184
  return o4;
9185
9185
  }(t2, ["componentId"]), s2 = r2 && r2 + "-" + (Te(e3) ? e3 : De(E(e3)));
9186
- return Fe(e3, m({}, o3, { attrs: _3, componentId: s2 }), n2);
9186
+ return Fe(e3, m({}, o3, { attrs: _4, componentId: s2 }), n2);
9187
9187
  }, Object.defineProperty(A2, "defaultProps", { get: function() {
9188
9188
  return this._foldedDefaultProps;
9189
9189
  }, set: function(t3) {
@@ -9749,11 +9749,7 @@ var normalizeForComparison = (config) => {
9749
9749
  }
9750
9750
  );
9751
9751
  return {
9752
- ...import_lodash.default.omit(config, [
9753
- "enableRowGrouping",
9754
- "enableColumnGrouping",
9755
- "enableSplitAssembliesForDynamicGrouping"
9756
- ]),
9752
+ ...config,
9757
9753
  columnState: filteredColumnState.map((col) => {
9758
9754
  const res = import_lodash.default.omit(col, ["aggFunc"]);
9759
9755
  if (col.flex) {
@@ -9763,6 +9759,15 @@ var normalizeForComparison = (config) => {
9763
9759
  })
9764
9760
  };
9765
9761
  };
9762
+ var withSmartGridGroupingDefaults = (config) => {
9763
+ const c2 = config;
9764
+ return {
9765
+ ...c2,
9766
+ enableRowGrouping: c2.enableRowGrouping ?? false,
9767
+ enableColumnGrouping: c2.enableColumnGrouping ?? false,
9768
+ enableSplitAssembliesForDynamicGrouping: c2.enableSplitAssembliesForDynamicGrouping ?? false
9769
+ };
9770
+ };
9766
9771
  var isEqual = (viewTableConfig, tableConfig, defaultViewConfig, provider) => {
9767
9772
  if (!viewTableConfig || !tableConfig)
9768
9773
  return false;
@@ -9770,19 +9775,17 @@ var isEqual = (viewTableConfig, tableConfig, defaultViewConfig, provider) => {
9770
9775
  viewTableConfig,
9771
9776
  defaultViewConfig
9772
9777
  );
9773
- const normalizedViewConfig = normalizeForComparison(syncedViewTableConfig);
9774
- const normalizedCurrentConfig = normalizeForComparison(tableConfig);
9775
- const cleanedViewConfig = cleanObject(normalizedViewConfig, provider);
9776
- const cleanedCurrentConfig = cleanObject(normalizedCurrentConfig, provider);
9777
- const isEqual2 = import_lodash.default.isEqual(cleanedViewConfig, cleanedCurrentConfig);
9778
- if (!isEqual2) {
9779
- console.log(
9780
- "[SavedViews]: Showing update button - view config, current config",
9781
- cleanedViewConfig,
9782
- cleanedCurrentConfig
9778
+ let normalizedViewConfig = normalizeForComparison(syncedViewTableConfig);
9779
+ let normalizedCurrentConfig = normalizeForComparison(tableConfig);
9780
+ if (provider === "smart-grid") {
9781
+ normalizedViewConfig = withSmartGridGroupingDefaults(normalizedViewConfig);
9782
+ normalizedCurrentConfig = withSmartGridGroupingDefaults(
9783
+ normalizedCurrentConfig
9783
9784
  );
9784
9785
  }
9785
- return isEqual2;
9786
+ const cleanedViewConfig = cleanObject(normalizedViewConfig, provider);
9787
+ const cleanedCurrentConfig = cleanObject(normalizedCurrentConfig, provider);
9788
+ return import_lodash.default.isEqual(cleanedViewConfig, cleanedCurrentConfig);
9786
9789
  };
9787
9790
  var hasPermissionForViewLevel = (viewLevel, permissions) => {
9788
9791
  switch (viewLevel) {
@@ -11077,6 +11080,12 @@ var useNormalizedDefaultViews = (defaultViews, gridApi) => {
11077
11080
 
11078
11081
  // src/components/adapters/smart-grid/useSmartGridConfig.ts
11079
11082
  var import_react15 = require("react");
11083
+ var import_lodash2 = __toESM(require_lodash());
11084
+ var ESTIMATING_GROUPING_STATE_KEYS = [
11085
+ "enableRowGrouping",
11086
+ "enableColumnGrouping",
11087
+ "enableSplitAssembliesForDynamicGrouping"
11088
+ ];
11080
11089
  var GRID_STATE_EVENTS = [
11081
11090
  "sortChanged",
11082
11091
  "filterOpened",
@@ -11103,7 +11112,10 @@ var useSmartGridConfig = (gridApi) => {
11103
11112
  if (eventListenersDisabledRef.current) {
11104
11113
  return;
11105
11114
  }
11106
- setConfig(getSmartGridConfig(gridApi));
11115
+ setConfig((prev) => ({
11116
+ ...getSmartGridConfig(gridApi),
11117
+ ...import_lodash2.default.pick(prev, ESTIMATING_GROUPING_STATE_KEYS)
11118
+ }));
11107
11119
  };
11108
11120
  GRID_STATE_EVENTS.forEach((event) => {
11109
11121
  gridApi.addEventListener(event, updateConfig);
@@ -11134,6 +11146,12 @@ var SmartGridSavedViews = (props) => {
11134
11146
  } = useSmartGridConfig(gridApi);
11135
11147
  const presetViews = useNormalizedDefaultViews(props.defaultViews, gridApi);
11136
11148
  const defaultView = presetViews.find((view) => view.id === "default") ?? presetViews[0];
11149
+ const tableConfigForSavedViews = (0, import_react16.useMemo)(() => {
11150
+ if (!props.augmentTableConfig) {
11151
+ return tableConfig;
11152
+ }
11153
+ return props.augmentTableConfig(tableConfig);
11154
+ }, [props.augmentTableConfig, tableConfig]);
11137
11155
  const onSelect = (0, import_react16.useCallback)(
11138
11156
  ({ item }) => {
11139
11157
  var _a;
@@ -11165,7 +11183,7 @@ var SmartGridSavedViews = (props) => {
11165
11183
  }, 0);
11166
11184
  return updatedView;
11167
11185
  },
11168
- [gridApi, tableConfig, setTableConfig]
11186
+ [gridApi, tableConfig, setTableConfig, props.transformSettings]
11169
11187
  );
11170
11188
  return /* @__PURE__ */ import_react16.default.createElement(
11171
11189
  SavedViews,
@@ -11179,7 +11197,7 @@ var SmartGridSavedViews = (props) => {
11179
11197
  defaultView,
11180
11198
  presetViews,
11181
11199
  tableName: props.tableName,
11182
- tableConfig,
11200
+ tableConfig: tableConfigForSavedViews,
11183
11201
  backend: props.backend,
11184
11202
  enableSharingViews: props.enableSharingViews
11185
11203
  }
@@ -1470,7 +1470,7 @@ var require_lodash = __commonJS({
1470
1470
  return string3.match(reUnicodeWord) || [];
1471
1471
  }
1472
1472
  var runInContext = function runInContext2(context) {
1473
- context = context == null ? root : _3.defaults(root.Object(), context, _3.pick(root, contextProps));
1473
+ context = context == null ? root : _4.defaults(root.Object(), context, _4.pick(root, contextProps));
1474
1474
  var Array2 = context.Array, Date = context.Date, Error2 = context.Error, Function2 = context.Function, Math2 = context.Math, Object2 = context.Object, RegExp2 = context.RegExp, String2 = context.String, TypeError2 = context.TypeError;
1475
1475
  var arrayProto = Array2.prototype, funcProto = Function2.prototype, objectProto = Object2.prototype;
1476
1476
  var coreJsData = context["__core-js_shared__"];
@@ -6264,17 +6264,17 @@ var require_lodash = __commonJS({
6264
6264
  }
6265
6265
  return lodash;
6266
6266
  };
6267
- var _3 = runInContext();
6267
+ var _4 = runInContext();
6268
6268
  if (typeof define == "function" && typeof define.amd == "object" && define.amd) {
6269
- root._ = _3;
6269
+ root._ = _4;
6270
6270
  define(function() {
6271
- return _3;
6271
+ return _4;
6272
6272
  });
6273
6273
  } else if (freeModule) {
6274
- (freeModule.exports = _3)._ = _3;
6275
- freeExports._ = _3;
6274
+ (freeModule.exports = _4)._ = _4;
6275
+ freeExports._ = _4;
6276
6276
  } else {
6277
- root._ = _3;
6277
+ root._ = _4;
6278
6278
  }
6279
6279
  }).call(exports);
6280
6280
  }
@@ -9138,7 +9138,7 @@ function Fe(e2, t2, n2) {
9138
9138
  return t3 ? t3 + "-" + r2 : r2;
9139
9139
  }(t2.displayName, t2.parentComponentId) : l2, h = t2.displayName, y2 = void 0 === h ? function(e3) {
9140
9140
  return Te(e3) ? "styled." + e3 : "Styled(" + E(e3) + ")";
9141
- }(e2) : h, v2 = t2.displayName && t2.componentId ? De(t2.displayName) + "-" + t2.componentId : t2.componentId || d, _3 = o2 && e2.attrs ? Array.prototype.concat(e2.attrs, c2).filter(Boolean) : c2, N = t2.shouldForwardProp;
9141
+ }(e2) : h, v2 = t2.displayName && t2.componentId ? De(t2.displayName) + "-" + t2.componentId : t2.componentId || d, _4 = o2 && e2.attrs ? Array.prototype.concat(e2.attrs, c2).filter(Boolean) : c2, N = t2.shouldForwardProp;
9142
9142
  o2 && e2.shouldForwardProp && (N = t2.shouldForwardProp ? function(n3, r2, o3) {
9143
9143
  return e2.shouldForwardProp(n3, r2, o3) && t2.shouldForwardProp(n3, r2, o3);
9144
9144
  } : e2.shouldForwardProp);
@@ -9155,13 +9155,13 @@ function Fe(e2, t2, n2) {
9155
9155
  }(Pe(t4, s(Be), a3) || S, t4, o3), y3 = f2[0], v3 = f2[1], g2 = function(e5, t5, n4, r3) {
9156
9156
  var o4 = he(), s2 = pe(), i4 = t5 ? e5.generateAndInjectStyles(S, o4, s2) : e5.generateAndInjectStyles(n4, o4, s2);
9157
9157
  return "production" !== process.env.NODE_ENV && !t5 && r3 && r3(i4), i4;
9158
- }(i3, r2, y3, "production" !== process.env.NODE_ENV ? e4.warnTooManyClasses : void 0), E2 = n3, b2 = v3.$as || t4.$as || v3.as || t4.as || h2, _4 = Te(b2), N2 = v3 !== t4 ? m({}, t4, {}, v3) : t4, A3 = {};
9158
+ }(i3, r2, y3, "production" !== process.env.NODE_ENV ? e4.warnTooManyClasses : void 0), E2 = n3, b2 = v3.$as || t4.$as || v3.as || t4.as || h2, _5 = Te(b2), N2 = v3 !== t4 ? m({}, t4, {}, v3) : t4, A3 = {};
9159
9159
  for (var C3 in N2)
9160
- "$" !== C3[0] && "as" !== C3 && ("forwardedAs" === C3 ? A3.as = N2[C3] : (l3 ? l3(C3, isPropValid, b2) : !_4 || isPropValid(C3)) && (A3[C3] = N2[C3]));
9160
+ "$" !== C3[0] && "as" !== C3 && ("forwardedAs" === C3 ? A3.as = N2[C3] : (l3 ? l3(C3, isPropValid, b2) : !_5 || isPropValid(C3)) && (A3[C3] = N2[C3]));
9161
9161
  return t4.style && v3.style !== t4.style && (A3.style = m({}, t4.style, {}, v3.style)), A3.className = Array.prototype.concat(c3, d2, g2 !== d2 ? g2 : null, t4.className, v3.className).filter(Boolean).join(" "), A3.ref = E2, u(b2, A3);
9162
9162
  }(A2, e3, t3, I);
9163
9163
  };
9164
- return P4.displayName = y2, (A2 = r.forwardRef(P4)).attrs = _3, A2.componentStyle = C2, A2.displayName = y2, A2.shouldForwardProp = N, A2.foldedComponentIds = o2 ? Array.prototype.concat(e2.foldedComponentIds, e2.styledComponentId) : g, A2.styledComponentId = v2, A2.target = o2 ? e2.target : e2, A2.withComponent = function(e3) {
9164
+ return P4.displayName = y2, (A2 = r.forwardRef(P4)).attrs = _4, A2.componentStyle = C2, A2.displayName = y2, A2.shouldForwardProp = N, A2.foldedComponentIds = o2 ? Array.prototype.concat(e2.foldedComponentIds, e2.styledComponentId) : g, A2.styledComponentId = v2, A2.target = o2 ? e2.target : e2, A2.withComponent = function(e3) {
9165
9165
  var r2 = t2.componentId, o3 = function(e4, t3) {
9166
9166
  if (null == e4)
9167
9167
  return {};
@@ -9170,7 +9170,7 @@ function Fe(e2, t2, n2) {
9170
9170
  n3 = s3[r3], t3.indexOf(n3) >= 0 || (o4[n3] = e4[n3]);
9171
9171
  return o4;
9172
9172
  }(t2, ["componentId"]), s2 = r2 && r2 + "-" + (Te(e3) ? e3 : De(E(e3)));
9173
- return Fe(e3, m({}, o3, { attrs: _3, componentId: s2 }), n2);
9173
+ return Fe(e3, m({}, o3, { attrs: _4, componentId: s2 }), n2);
9174
9174
  }, Object.defineProperty(A2, "defaultProps", { get: function() {
9175
9175
  return this._foldedDefaultProps;
9176
9176
  }, set: function(t3) {
@@ -9747,11 +9747,7 @@ var normalizeForComparison = (config) => {
9747
9747
  }
9748
9748
  );
9749
9749
  return {
9750
- ...import_lodash.default.omit(config, [
9751
- "enableRowGrouping",
9752
- "enableColumnGrouping",
9753
- "enableSplitAssembliesForDynamicGrouping"
9754
- ]),
9750
+ ...config,
9755
9751
  columnState: filteredColumnState.map((col) => {
9756
9752
  const res = import_lodash.default.omit(col, ["aggFunc"]);
9757
9753
  if (col.flex) {
@@ -9761,6 +9757,15 @@ var normalizeForComparison = (config) => {
9761
9757
  })
9762
9758
  };
9763
9759
  };
9760
+ var withSmartGridGroupingDefaults = (config) => {
9761
+ const c2 = config;
9762
+ return {
9763
+ ...c2,
9764
+ enableRowGrouping: c2.enableRowGrouping ?? false,
9765
+ enableColumnGrouping: c2.enableColumnGrouping ?? false,
9766
+ enableSplitAssembliesForDynamicGrouping: c2.enableSplitAssembliesForDynamicGrouping ?? false
9767
+ };
9768
+ };
9764
9769
  var isEqual = (viewTableConfig, tableConfig, defaultViewConfig, provider) => {
9765
9770
  if (!viewTableConfig || !tableConfig)
9766
9771
  return false;
@@ -9768,19 +9773,17 @@ var isEqual = (viewTableConfig, tableConfig, defaultViewConfig, provider) => {
9768
9773
  viewTableConfig,
9769
9774
  defaultViewConfig
9770
9775
  );
9771
- const normalizedViewConfig = normalizeForComparison(syncedViewTableConfig);
9772
- const normalizedCurrentConfig = normalizeForComparison(tableConfig);
9773
- const cleanedViewConfig = cleanObject(normalizedViewConfig, provider);
9774
- const cleanedCurrentConfig = cleanObject(normalizedCurrentConfig, provider);
9775
- const isEqual2 = import_lodash.default.isEqual(cleanedViewConfig, cleanedCurrentConfig);
9776
- if (!isEqual2) {
9777
- console.log(
9778
- "[SavedViews]: Showing update button - view config, current config",
9779
- cleanedViewConfig,
9780
- cleanedCurrentConfig
9776
+ let normalizedViewConfig = normalizeForComparison(syncedViewTableConfig);
9777
+ let normalizedCurrentConfig = normalizeForComparison(tableConfig);
9778
+ if (provider === "smart-grid") {
9779
+ normalizedViewConfig = withSmartGridGroupingDefaults(normalizedViewConfig);
9780
+ normalizedCurrentConfig = withSmartGridGroupingDefaults(
9781
+ normalizedCurrentConfig
9781
9782
  );
9782
9783
  }
9783
- return isEqual2;
9784
+ const cleanedViewConfig = cleanObject(normalizedViewConfig, provider);
9785
+ const cleanedCurrentConfig = cleanObject(normalizedCurrentConfig, provider);
9786
+ return import_lodash.default.isEqual(cleanedViewConfig, cleanedCurrentConfig);
9784
9787
  };
9785
9788
  var hasPermissionForViewLevel = (viewLevel, permissions) => {
9786
9789
  switch (viewLevel) {
@@ -11038,7 +11041,7 @@ var SavedViews = (props) => {
11038
11041
  };
11039
11042
 
11040
11043
  // src/components/adapters/smart-grid/SmartGridSavedViews.tsx
11041
- import React24, { useCallback as useCallback4 } from "react";
11044
+ import React24, { useCallback as useCallback4, useMemo as useMemo3 } from "react";
11042
11045
 
11043
11046
  // src/components/adapters/smart-grid/SmartGridDefaultSavedView.tsx
11044
11047
  import { useMemo as useMemo2 } from "react";
@@ -11116,7 +11119,13 @@ var useNormalizedDefaultViews = (defaultViews, gridApi) => {
11116
11119
  };
11117
11120
 
11118
11121
  // src/components/adapters/smart-grid/useSmartGridConfig.ts
11122
+ var import_lodash2 = __toESM(require_lodash());
11119
11123
  import { useState as useState5, useEffect as useEffect6, useRef as useRef4 } from "react";
11124
+ var ESTIMATING_GROUPING_STATE_KEYS = [
11125
+ "enableRowGrouping",
11126
+ "enableColumnGrouping",
11127
+ "enableSplitAssembliesForDynamicGrouping"
11128
+ ];
11120
11129
  var GRID_STATE_EVENTS = [
11121
11130
  "sortChanged",
11122
11131
  "filterOpened",
@@ -11143,7 +11152,10 @@ var useSmartGridConfig = (gridApi) => {
11143
11152
  if (eventListenersDisabledRef.current) {
11144
11153
  return;
11145
11154
  }
11146
- setConfig(getSmartGridConfig(gridApi));
11155
+ setConfig((prev) => ({
11156
+ ...getSmartGridConfig(gridApi),
11157
+ ...import_lodash2.default.pick(prev, ESTIMATING_GROUPING_STATE_KEYS)
11158
+ }));
11147
11159
  };
11148
11160
  GRID_STATE_EVENTS.forEach((event) => {
11149
11161
  gridApi.addEventListener(event, updateConfig);
@@ -11174,6 +11186,12 @@ var SmartGridSavedViews = (props) => {
11174
11186
  } = useSmartGridConfig(gridApi);
11175
11187
  const presetViews = useNormalizedDefaultViews(props.defaultViews, gridApi);
11176
11188
  const defaultView = presetViews.find((view) => view.id === "default") ?? presetViews[0];
11189
+ const tableConfigForSavedViews = useMemo3(() => {
11190
+ if (!props.augmentTableConfig) {
11191
+ return tableConfig;
11192
+ }
11193
+ return props.augmentTableConfig(tableConfig);
11194
+ }, [props.augmentTableConfig, tableConfig]);
11177
11195
  const onSelect = useCallback4(
11178
11196
  ({ item }) => {
11179
11197
  var _a;
@@ -11205,7 +11223,7 @@ var SmartGridSavedViews = (props) => {
11205
11223
  }, 0);
11206
11224
  return updatedView;
11207
11225
  },
11208
- [gridApi, tableConfig, setTableConfig]
11226
+ [gridApi, tableConfig, setTableConfig, props.transformSettings]
11209
11227
  );
11210
11228
  return /* @__PURE__ */ React24.createElement(
11211
11229
  SavedViews,
@@ -11219,7 +11237,7 @@ var SmartGridSavedViews = (props) => {
11219
11237
  defaultView,
11220
11238
  presetViews,
11221
11239
  tableName: props.tableName,
11222
- tableConfig,
11240
+ tableConfig: tableConfigForSavedViews,
11223
11241
  backend: props.backend,
11224
11242
  enableSharingViews: props.enableSharingViews
11225
11243
  }
@@ -11235,7 +11253,7 @@ import React25, {
11235
11253
  } from "react";
11236
11254
 
11237
11255
  // src/components/adapters/data-table/DataTableDefaultSavedView.tsx
11238
- import { useMemo as useMemo3 } from "react";
11256
+ import { useMemo as useMemo4 } from "react";
11239
11257
  var DEFAULT_COLUMN_STATE2 = {
11240
11258
  hidden: false,
11241
11259
  pinned: null,
@@ -11283,7 +11301,7 @@ var extractDefaultView2 = (columnDefinitions, receivedConfigFromTool) => {
11283
11301
  return result;
11284
11302
  };
11285
11303
  var useNormalizedDefaultViews2 = (defaultViews, columnDefinitions) => {
11286
- return useMemo3(
11304
+ return useMemo4(
11287
11305
  () => defaultViews.map((view) => ({
11288
11306
  ...view,
11289
11307
  share_token: "",
@@ -109,6 +109,12 @@ interface IDataTableSavedViewsExternalConsumerProps extends IBaseSavedViewsProps
109
109
  interface ISmartGridSavedViewsExternalConsumerProps extends IBaseSavedViewsProps {
110
110
  gridApi: GridApi;
111
111
  transformSettings?: (config: ISmartGridConfig) => ISmartGridConfig;
112
+ /**
113
+ * Merge live app state into the config used for Update visibility and persisting views.
114
+ * AG Grid events only report column/group/filter state — use this for flags such as
115
+ * enableRowGrouping / enableSplitAssembliesForDynamicGrouping that live outside the grid API.
116
+ */
117
+ augmentTableConfig?: (config: ISmartGridConfig) => ISmartGridConfig;
112
118
  defaultViews: ISmartGridDefaultViewConfig[];
113
119
  }
114
120
 
@@ -109,6 +109,12 @@ interface IDataTableSavedViewsExternalConsumerProps extends IBaseSavedViewsProps
109
109
  interface ISmartGridSavedViewsExternalConsumerProps extends IBaseSavedViewsProps {
110
110
  gridApi: GridApi;
111
111
  transformSettings?: (config: ISmartGridConfig) => ISmartGridConfig;
112
+ /**
113
+ * Merge live app state into the config used for Update visibility and persisting views.
114
+ * AG Grid events only report column/group/filter state — use this for flags such as
115
+ * enableRowGrouping / enableSplitAssembliesForDynamicGrouping that live outside the grid API.
116
+ */
117
+ augmentTableConfig?: (config: ISmartGridConfig) => ISmartGridConfig;
112
118
  defaultViews: ISmartGridDefaultViewConfig[];
113
119
  }
114
120
 
@@ -1469,7 +1469,7 @@ var require_lodash = __commonJS({
1469
1469
  return string3.match(reUnicodeWord) || [];
1470
1470
  }
1471
1471
  var runInContext = function runInContext2(context) {
1472
- context = context == null ? root : _3.defaults(root.Object(), context, _3.pick(root, contextProps));
1472
+ context = context == null ? root : _4.defaults(root.Object(), context, _4.pick(root, contextProps));
1473
1473
  var Array2 = context.Array, Date = context.Date, Error2 = context.Error, Function2 = context.Function, Math2 = context.Math, Object2 = context.Object, RegExp2 = context.RegExp, String2 = context.String, TypeError2 = context.TypeError;
1474
1474
  var arrayProto = Array2.prototype, funcProto = Function2.prototype, objectProto = Object2.prototype;
1475
1475
  var coreJsData = context["__core-js_shared__"];
@@ -6263,17 +6263,17 @@ var require_lodash = __commonJS({
6263
6263
  }
6264
6264
  return lodash;
6265
6265
  };
6266
- var _3 = runInContext();
6266
+ var _4 = runInContext();
6267
6267
  if (typeof define == "function" && typeof define.amd == "object" && define.amd) {
6268
- root._ = _3;
6268
+ root._ = _4;
6269
6269
  define(function() {
6270
- return _3;
6270
+ return _4;
6271
6271
  });
6272
6272
  } else if (freeModule) {
6273
- (freeModule.exports = _3)._ = _3;
6274
- freeExports._ = _3;
6273
+ (freeModule.exports = _4)._ = _4;
6274
+ freeExports._ = _4;
6275
6275
  } else {
6276
- root._ = _3;
6276
+ root._ = _4;
6277
6277
  }
6278
6278
  }).call(exports);
6279
6279
  }
@@ -9151,7 +9151,7 @@ function Fe(e2, t2, n2) {
9151
9151
  return t3 ? t3 + "-" + r2 : r2;
9152
9152
  }(t2.displayName, t2.parentComponentId) : l2, h = t2.displayName, y2 = void 0 === h ? function(e3) {
9153
9153
  return Te(e3) ? "styled." + e3 : "Styled(" + E(e3) + ")";
9154
- }(e2) : h, v2 = t2.displayName && t2.componentId ? De(t2.displayName) + "-" + t2.componentId : t2.componentId || d, _3 = o2 && e2.attrs ? Array.prototype.concat(e2.attrs, c2).filter(Boolean) : c2, N = t2.shouldForwardProp;
9154
+ }(e2) : h, v2 = t2.displayName && t2.componentId ? De(t2.displayName) + "-" + t2.componentId : t2.componentId || d, _4 = o2 && e2.attrs ? Array.prototype.concat(e2.attrs, c2).filter(Boolean) : c2, N = t2.shouldForwardProp;
9155
9155
  o2 && e2.shouldForwardProp && (N = t2.shouldForwardProp ? function(n3, r2, o3) {
9156
9156
  return e2.shouldForwardProp(n3, r2, o3) && t2.shouldForwardProp(n3, r2, o3);
9157
9157
  } : e2.shouldForwardProp);
@@ -9168,13 +9168,13 @@ function Fe(e2, t2, n2) {
9168
9168
  }(Pe(t4, (0, import_react.useContext)(Be), a3) || S, t4, o3), y3 = f2[0], v3 = f2[1], g2 = function(e5, t5, n4, r3) {
9169
9169
  var o4 = he(), s2 = pe(), i4 = t5 ? e5.generateAndInjectStyles(S, o4, s2) : e5.generateAndInjectStyles(n4, o4, s2);
9170
9170
  return "production" !== process.env.NODE_ENV && !t5 && r3 && r3(i4), i4;
9171
- }(i3, r2, y3, "production" !== process.env.NODE_ENV ? e4.warnTooManyClasses : void 0), E2 = n3, b2 = v3.$as || t4.$as || v3.as || t4.as || h2, _4 = Te(b2), N2 = v3 !== t4 ? m({}, t4, {}, v3) : t4, A3 = {};
9171
+ }(i3, r2, y3, "production" !== process.env.NODE_ENV ? e4.warnTooManyClasses : void 0), E2 = n3, b2 = v3.$as || t4.$as || v3.as || t4.as || h2, _5 = Te(b2), N2 = v3 !== t4 ? m({}, t4, {}, v3) : t4, A3 = {};
9172
9172
  for (var C3 in N2)
9173
- "$" !== C3[0] && "as" !== C3 && ("forwardedAs" === C3 ? A3.as = N2[C3] : (l3 ? l3(C3, isPropValid, b2) : !_4 || isPropValid(C3)) && (A3[C3] = N2[C3]));
9173
+ "$" !== C3[0] && "as" !== C3 && ("forwardedAs" === C3 ? A3.as = N2[C3] : (l3 ? l3(C3, isPropValid, b2) : !_5 || isPropValid(C3)) && (A3[C3] = N2[C3]));
9174
9174
  return t4.style && v3.style !== t4.style && (A3.style = m({}, t4.style, {}, v3.style)), A3.className = Array.prototype.concat(c3, d2, g2 !== d2 ? g2 : null, t4.className, v3.className).filter(Boolean).join(" "), A3.ref = E2, (0, import_react.createElement)(b2, A3);
9175
9175
  }(A2, e3, t3, I);
9176
9176
  };
9177
- return P4.displayName = y2, (A2 = import_react.default.forwardRef(P4)).attrs = _3, A2.componentStyle = C2, A2.displayName = y2, A2.shouldForwardProp = N, A2.foldedComponentIds = o2 ? Array.prototype.concat(e2.foldedComponentIds, e2.styledComponentId) : g, A2.styledComponentId = v2, A2.target = o2 ? e2.target : e2, A2.withComponent = function(e3) {
9177
+ return P4.displayName = y2, (A2 = import_react.default.forwardRef(P4)).attrs = _4, A2.componentStyle = C2, A2.displayName = y2, A2.shouldForwardProp = N, A2.foldedComponentIds = o2 ? Array.prototype.concat(e2.foldedComponentIds, e2.styledComponentId) : g, A2.styledComponentId = v2, A2.target = o2 ? e2.target : e2, A2.withComponent = function(e3) {
9178
9178
  var r2 = t2.componentId, o3 = function(e4, t3) {
9179
9179
  if (null == e4)
9180
9180
  return {};
@@ -9183,7 +9183,7 @@ function Fe(e2, t2, n2) {
9183
9183
  n3 = s3[r3], t3.indexOf(n3) >= 0 || (o4[n3] = e4[n3]);
9184
9184
  return o4;
9185
9185
  }(t2, ["componentId"]), s2 = r2 && r2 + "-" + (Te(e3) ? e3 : De(E(e3)));
9186
- return Fe(e3, m({}, o3, { attrs: _3, componentId: s2 }), n2);
9186
+ return Fe(e3, m({}, o3, { attrs: _4, componentId: s2 }), n2);
9187
9187
  }, Object.defineProperty(A2, "defaultProps", { get: function() {
9188
9188
  return this._foldedDefaultProps;
9189
9189
  }, set: function(t3) {
@@ -9746,11 +9746,7 @@ var normalizeForComparison = (config) => {
9746
9746
  }
9747
9747
  );
9748
9748
  return {
9749
- ...import_lodash.default.omit(config, [
9750
- "enableRowGrouping",
9751
- "enableColumnGrouping",
9752
- "enableSplitAssembliesForDynamicGrouping"
9753
- ]),
9749
+ ...config,
9754
9750
  columnState: filteredColumnState.map((col) => {
9755
9751
  const res = import_lodash.default.omit(col, ["aggFunc"]);
9756
9752
  if (col.flex) {
@@ -9760,6 +9756,15 @@ var normalizeForComparison = (config) => {
9760
9756
  })
9761
9757
  };
9762
9758
  };
9759
+ var withSmartGridGroupingDefaults = (config) => {
9760
+ const c2 = config;
9761
+ return {
9762
+ ...c2,
9763
+ enableRowGrouping: c2.enableRowGrouping ?? false,
9764
+ enableColumnGrouping: c2.enableColumnGrouping ?? false,
9765
+ enableSplitAssembliesForDynamicGrouping: c2.enableSplitAssembliesForDynamicGrouping ?? false
9766
+ };
9767
+ };
9763
9768
  var isEqual = (viewTableConfig, tableConfig, defaultViewConfig, provider) => {
9764
9769
  if (!viewTableConfig || !tableConfig)
9765
9770
  return false;
@@ -9767,19 +9772,17 @@ var isEqual = (viewTableConfig, tableConfig, defaultViewConfig, provider) => {
9767
9772
  viewTableConfig,
9768
9773
  defaultViewConfig
9769
9774
  );
9770
- const normalizedViewConfig = normalizeForComparison(syncedViewTableConfig);
9771
- const normalizedCurrentConfig = normalizeForComparison(tableConfig);
9772
- const cleanedViewConfig = cleanObject(normalizedViewConfig, provider);
9773
- const cleanedCurrentConfig = cleanObject(normalizedCurrentConfig, provider);
9774
- const isEqual2 = import_lodash.default.isEqual(cleanedViewConfig, cleanedCurrentConfig);
9775
- if (!isEqual2) {
9776
- console.log(
9777
- "[SavedViews]: Showing update button - view config, current config",
9778
- cleanedViewConfig,
9779
- cleanedCurrentConfig
9775
+ let normalizedViewConfig = normalizeForComparison(syncedViewTableConfig);
9776
+ let normalizedCurrentConfig = normalizeForComparison(tableConfig);
9777
+ if (provider === "smart-grid") {
9778
+ normalizedViewConfig = withSmartGridGroupingDefaults(normalizedViewConfig);
9779
+ normalizedCurrentConfig = withSmartGridGroupingDefaults(
9780
+ normalizedCurrentConfig
9780
9781
  );
9781
9782
  }
9782
- return isEqual2;
9783
+ const cleanedViewConfig = cleanObject(normalizedViewConfig, provider);
9784
+ const cleanedCurrentConfig = cleanObject(normalizedCurrentConfig, provider);
9785
+ return import_lodash.default.isEqual(cleanedViewConfig, cleanedCurrentConfig);
9783
9786
  };
9784
9787
  var hasPermissionForViewLevel = (viewLevel, permissions) => {
9785
9788
  switch (viewLevel) {
@@ -11072,6 +11075,12 @@ var useNormalizedDefaultViews = (defaultViews, gridApi) => {
11072
11075
 
11073
11076
  // src/components/adapters/smart-grid/useSmartGridConfig.ts
11074
11077
  var import_react15 = require("react");
11078
+ var import_lodash2 = __toESM(require_lodash());
11079
+ var ESTIMATING_GROUPING_STATE_KEYS = [
11080
+ "enableRowGrouping",
11081
+ "enableColumnGrouping",
11082
+ "enableSplitAssembliesForDynamicGrouping"
11083
+ ];
11075
11084
  var GRID_STATE_EVENTS = [
11076
11085
  "sortChanged",
11077
11086
  "filterOpened",
@@ -11098,7 +11107,10 @@ var useSmartGridConfig = (gridApi) => {
11098
11107
  if (eventListenersDisabledRef.current) {
11099
11108
  return;
11100
11109
  }
11101
- setConfig(getSmartGridConfig(gridApi));
11110
+ setConfig((prev) => ({
11111
+ ...getSmartGridConfig(gridApi),
11112
+ ...import_lodash2.default.pick(prev, ESTIMATING_GROUPING_STATE_KEYS)
11113
+ }));
11102
11114
  };
11103
11115
  GRID_STATE_EVENTS.forEach((event) => {
11104
11116
  gridApi.addEventListener(event, updateConfig);
@@ -11129,6 +11141,12 @@ var SmartGridSavedViews = (props) => {
11129
11141
  } = useSmartGridConfig(gridApi);
11130
11142
  const presetViews = useNormalizedDefaultViews(props.defaultViews, gridApi);
11131
11143
  const defaultView = presetViews.find((view) => view.id === "default") ?? presetViews[0];
11144
+ const tableConfigForSavedViews = (0, import_react16.useMemo)(() => {
11145
+ if (!props.augmentTableConfig) {
11146
+ return tableConfig;
11147
+ }
11148
+ return props.augmentTableConfig(tableConfig);
11149
+ }, [props.augmentTableConfig, tableConfig]);
11132
11150
  const onSelect = (0, import_react16.useCallback)(
11133
11151
  ({ item }) => {
11134
11152
  if (!gridApi)
@@ -11159,7 +11177,7 @@ var SmartGridSavedViews = (props) => {
11159
11177
  }, 0);
11160
11178
  return updatedView;
11161
11179
  },
11162
- [gridApi, tableConfig, setTableConfig]
11180
+ [gridApi, tableConfig, setTableConfig, props.transformSettings]
11163
11181
  );
11164
11182
  return /* @__PURE__ */ import_react16.default.createElement(
11165
11183
  SavedViews,
@@ -11173,7 +11191,7 @@ var SmartGridSavedViews = (props) => {
11173
11191
  defaultView,
11174
11192
  presetViews,
11175
11193
  tableName: props.tableName,
11176
- tableConfig,
11194
+ tableConfig: tableConfigForSavedViews,
11177
11195
  backend: props.backend,
11178
11196
  enableSharingViews: props.enableSharingViews
11179
11197
  }
@@ -1470,7 +1470,7 @@ var require_lodash = __commonJS({
1470
1470
  return string3.match(reUnicodeWord) || [];
1471
1471
  }
1472
1472
  var runInContext = function runInContext2(context) {
1473
- context = context == null ? root : _3.defaults(root.Object(), context, _3.pick(root, contextProps));
1473
+ context = context == null ? root : _4.defaults(root.Object(), context, _4.pick(root, contextProps));
1474
1474
  var Array2 = context.Array, Date = context.Date, Error2 = context.Error, Function2 = context.Function, Math2 = context.Math, Object2 = context.Object, RegExp2 = context.RegExp, String2 = context.String, TypeError2 = context.TypeError;
1475
1475
  var arrayProto = Array2.prototype, funcProto = Function2.prototype, objectProto = Object2.prototype;
1476
1476
  var coreJsData = context["__core-js_shared__"];
@@ -6264,17 +6264,17 @@ var require_lodash = __commonJS({
6264
6264
  }
6265
6265
  return lodash;
6266
6266
  };
6267
- var _3 = runInContext();
6267
+ var _4 = runInContext();
6268
6268
  if (typeof define == "function" && typeof define.amd == "object" && define.amd) {
6269
- root._ = _3;
6269
+ root._ = _4;
6270
6270
  define(function() {
6271
- return _3;
6271
+ return _4;
6272
6272
  });
6273
6273
  } else if (freeModule) {
6274
- (freeModule.exports = _3)._ = _3;
6275
- freeExports._ = _3;
6274
+ (freeModule.exports = _4)._ = _4;
6275
+ freeExports._ = _4;
6276
6276
  } else {
6277
- root._ = _3;
6277
+ root._ = _4;
6278
6278
  }
6279
6279
  }).call(exports);
6280
6280
  }
@@ -9138,7 +9138,7 @@ function Fe(e2, t2, n2) {
9138
9138
  return t3 ? t3 + "-" + r2 : r2;
9139
9139
  }(t2.displayName, t2.parentComponentId) : l2, h = t2.displayName, y2 = void 0 === h ? function(e3) {
9140
9140
  return Te(e3) ? "styled." + e3 : "Styled(" + E(e3) + ")";
9141
- }(e2) : h, v2 = t2.displayName && t2.componentId ? De(t2.displayName) + "-" + t2.componentId : t2.componentId || d, _3 = o2 && e2.attrs ? Array.prototype.concat(e2.attrs, c2).filter(Boolean) : c2, N = t2.shouldForwardProp;
9141
+ }(e2) : h, v2 = t2.displayName && t2.componentId ? De(t2.displayName) + "-" + t2.componentId : t2.componentId || d, _4 = o2 && e2.attrs ? Array.prototype.concat(e2.attrs, c2).filter(Boolean) : c2, N = t2.shouldForwardProp;
9142
9142
  o2 && e2.shouldForwardProp && (N = t2.shouldForwardProp ? function(n3, r2, o3) {
9143
9143
  return e2.shouldForwardProp(n3, r2, o3) && t2.shouldForwardProp(n3, r2, o3);
9144
9144
  } : e2.shouldForwardProp);
@@ -9155,13 +9155,13 @@ function Fe(e2, t2, n2) {
9155
9155
  }(Pe(t4, s(Be), a3) || S, t4, o3), y3 = f2[0], v3 = f2[1], g2 = function(e5, t5, n4, r3) {
9156
9156
  var o4 = he(), s2 = pe(), i4 = t5 ? e5.generateAndInjectStyles(S, o4, s2) : e5.generateAndInjectStyles(n4, o4, s2);
9157
9157
  return "production" !== process.env.NODE_ENV && !t5 && r3 && r3(i4), i4;
9158
- }(i3, r2, y3, "production" !== process.env.NODE_ENV ? e4.warnTooManyClasses : void 0), E2 = n3, b2 = v3.$as || t4.$as || v3.as || t4.as || h2, _4 = Te(b2), N2 = v3 !== t4 ? m({}, t4, {}, v3) : t4, A3 = {};
9158
+ }(i3, r2, y3, "production" !== process.env.NODE_ENV ? e4.warnTooManyClasses : void 0), E2 = n3, b2 = v3.$as || t4.$as || v3.as || t4.as || h2, _5 = Te(b2), N2 = v3 !== t4 ? m({}, t4, {}, v3) : t4, A3 = {};
9159
9159
  for (var C3 in N2)
9160
- "$" !== C3[0] && "as" !== C3 && ("forwardedAs" === C3 ? A3.as = N2[C3] : (l3 ? l3(C3, isPropValid, b2) : !_4 || isPropValid(C3)) && (A3[C3] = N2[C3]));
9160
+ "$" !== C3[0] && "as" !== C3 && ("forwardedAs" === C3 ? A3.as = N2[C3] : (l3 ? l3(C3, isPropValid, b2) : !_5 || isPropValid(C3)) && (A3[C3] = N2[C3]));
9161
9161
  return t4.style && v3.style !== t4.style && (A3.style = m({}, t4.style, {}, v3.style)), A3.className = Array.prototype.concat(c3, d2, g2 !== d2 ? g2 : null, t4.className, v3.className).filter(Boolean).join(" "), A3.ref = E2, u(b2, A3);
9162
9162
  }(A2, e3, t3, I);
9163
9163
  };
9164
- return P4.displayName = y2, (A2 = r.forwardRef(P4)).attrs = _3, A2.componentStyle = C2, A2.displayName = y2, A2.shouldForwardProp = N, A2.foldedComponentIds = o2 ? Array.prototype.concat(e2.foldedComponentIds, e2.styledComponentId) : g, A2.styledComponentId = v2, A2.target = o2 ? e2.target : e2, A2.withComponent = function(e3) {
9164
+ return P4.displayName = y2, (A2 = r.forwardRef(P4)).attrs = _4, A2.componentStyle = C2, A2.displayName = y2, A2.shouldForwardProp = N, A2.foldedComponentIds = o2 ? Array.prototype.concat(e2.foldedComponentIds, e2.styledComponentId) : g, A2.styledComponentId = v2, A2.target = o2 ? e2.target : e2, A2.withComponent = function(e3) {
9165
9165
  var r2 = t2.componentId, o3 = function(e4, t3) {
9166
9166
  if (null == e4)
9167
9167
  return {};
@@ -9170,7 +9170,7 @@ function Fe(e2, t2, n2) {
9170
9170
  n3 = s3[r3], t3.indexOf(n3) >= 0 || (o4[n3] = e4[n3]);
9171
9171
  return o4;
9172
9172
  }(t2, ["componentId"]), s2 = r2 && r2 + "-" + (Te(e3) ? e3 : De(E(e3)));
9173
- return Fe(e3, m({}, o3, { attrs: _3, componentId: s2 }), n2);
9173
+ return Fe(e3, m({}, o3, { attrs: _4, componentId: s2 }), n2);
9174
9174
  }, Object.defineProperty(A2, "defaultProps", { get: function() {
9175
9175
  return this._foldedDefaultProps;
9176
9176
  }, set: function(t3) {
@@ -9744,11 +9744,7 @@ var normalizeForComparison = (config) => {
9744
9744
  }
9745
9745
  );
9746
9746
  return {
9747
- ...import_lodash.default.omit(config, [
9748
- "enableRowGrouping",
9749
- "enableColumnGrouping",
9750
- "enableSplitAssembliesForDynamicGrouping"
9751
- ]),
9747
+ ...config,
9752
9748
  columnState: filteredColumnState.map((col) => {
9753
9749
  const res = import_lodash.default.omit(col, ["aggFunc"]);
9754
9750
  if (col.flex) {
@@ -9758,6 +9754,15 @@ var normalizeForComparison = (config) => {
9758
9754
  })
9759
9755
  };
9760
9756
  };
9757
+ var withSmartGridGroupingDefaults = (config) => {
9758
+ const c2 = config;
9759
+ return {
9760
+ ...c2,
9761
+ enableRowGrouping: c2.enableRowGrouping ?? false,
9762
+ enableColumnGrouping: c2.enableColumnGrouping ?? false,
9763
+ enableSplitAssembliesForDynamicGrouping: c2.enableSplitAssembliesForDynamicGrouping ?? false
9764
+ };
9765
+ };
9761
9766
  var isEqual = (viewTableConfig, tableConfig, defaultViewConfig, provider) => {
9762
9767
  if (!viewTableConfig || !tableConfig)
9763
9768
  return false;
@@ -9765,19 +9770,17 @@ var isEqual = (viewTableConfig, tableConfig, defaultViewConfig, provider) => {
9765
9770
  viewTableConfig,
9766
9771
  defaultViewConfig
9767
9772
  );
9768
- const normalizedViewConfig = normalizeForComparison(syncedViewTableConfig);
9769
- const normalizedCurrentConfig = normalizeForComparison(tableConfig);
9770
- const cleanedViewConfig = cleanObject(normalizedViewConfig, provider);
9771
- const cleanedCurrentConfig = cleanObject(normalizedCurrentConfig, provider);
9772
- const isEqual2 = import_lodash.default.isEqual(cleanedViewConfig, cleanedCurrentConfig);
9773
- if (!isEqual2) {
9774
- console.log(
9775
- "[SavedViews]: Showing update button - view config, current config",
9776
- cleanedViewConfig,
9777
- cleanedCurrentConfig
9773
+ let normalizedViewConfig = normalizeForComparison(syncedViewTableConfig);
9774
+ let normalizedCurrentConfig = normalizeForComparison(tableConfig);
9775
+ if (provider === "smart-grid") {
9776
+ normalizedViewConfig = withSmartGridGroupingDefaults(normalizedViewConfig);
9777
+ normalizedCurrentConfig = withSmartGridGroupingDefaults(
9778
+ normalizedCurrentConfig
9778
9779
  );
9779
9780
  }
9780
- return isEqual2;
9781
+ const cleanedViewConfig = cleanObject(normalizedViewConfig, provider);
9782
+ const cleanedCurrentConfig = cleanObject(normalizedCurrentConfig, provider);
9783
+ return import_lodash.default.isEqual(cleanedViewConfig, cleanedCurrentConfig);
9781
9784
  };
9782
9785
  var hasPermissionForViewLevel = (viewLevel, permissions) => {
9783
9786
  switch (viewLevel) {
@@ -11034,7 +11037,7 @@ var SavedViews = (props) => {
11034
11037
  };
11035
11038
 
11036
11039
  // src/components/adapters/smart-grid/SmartGridSavedViews.tsx
11037
- import React24, { useCallback as useCallback4 } from "react";
11040
+ import React24, { useCallback as useCallback4, useMemo as useMemo3 } from "react";
11038
11041
 
11039
11042
  // src/components/adapters/smart-grid/SmartGridDefaultSavedView.tsx
11040
11043
  import { useMemo as useMemo2 } from "react";
@@ -11111,7 +11114,13 @@ var useNormalizedDefaultViews = (defaultViews, gridApi) => {
11111
11114
  };
11112
11115
 
11113
11116
  // src/components/adapters/smart-grid/useSmartGridConfig.ts
11117
+ var import_lodash2 = __toESM(require_lodash());
11114
11118
  import { useState as useState5, useEffect as useEffect6, useRef as useRef4 } from "react";
11119
+ var ESTIMATING_GROUPING_STATE_KEYS = [
11120
+ "enableRowGrouping",
11121
+ "enableColumnGrouping",
11122
+ "enableSplitAssembliesForDynamicGrouping"
11123
+ ];
11115
11124
  var GRID_STATE_EVENTS = [
11116
11125
  "sortChanged",
11117
11126
  "filterOpened",
@@ -11138,7 +11147,10 @@ var useSmartGridConfig = (gridApi) => {
11138
11147
  if (eventListenersDisabledRef.current) {
11139
11148
  return;
11140
11149
  }
11141
- setConfig(getSmartGridConfig(gridApi));
11150
+ setConfig((prev) => ({
11151
+ ...getSmartGridConfig(gridApi),
11152
+ ...import_lodash2.default.pick(prev, ESTIMATING_GROUPING_STATE_KEYS)
11153
+ }));
11142
11154
  };
11143
11155
  GRID_STATE_EVENTS.forEach((event) => {
11144
11156
  gridApi.addEventListener(event, updateConfig);
@@ -11169,6 +11181,12 @@ var SmartGridSavedViews = (props) => {
11169
11181
  } = useSmartGridConfig(gridApi);
11170
11182
  const presetViews = useNormalizedDefaultViews(props.defaultViews, gridApi);
11171
11183
  const defaultView = presetViews.find((view) => view.id === "default") ?? presetViews[0];
11184
+ const tableConfigForSavedViews = useMemo3(() => {
11185
+ if (!props.augmentTableConfig) {
11186
+ return tableConfig;
11187
+ }
11188
+ return props.augmentTableConfig(tableConfig);
11189
+ }, [props.augmentTableConfig, tableConfig]);
11172
11190
  const onSelect = useCallback4(
11173
11191
  ({ item }) => {
11174
11192
  if (!gridApi)
@@ -11199,7 +11217,7 @@ var SmartGridSavedViews = (props) => {
11199
11217
  }, 0);
11200
11218
  return updatedView;
11201
11219
  },
11202
- [gridApi, tableConfig, setTableConfig]
11220
+ [gridApi, tableConfig, setTableConfig, props.transformSettings]
11203
11221
  );
11204
11222
  return /* @__PURE__ */ React24.createElement(
11205
11223
  SavedViews,
@@ -11213,7 +11231,7 @@ var SmartGridSavedViews = (props) => {
11213
11231
  defaultView,
11214
11232
  presetViews,
11215
11233
  tableName: props.tableName,
11216
- tableConfig,
11234
+ tableConfig: tableConfigForSavedViews,
11217
11235
  backend: props.backend,
11218
11236
  enableSharingViews: props.enableSharingViews
11219
11237
  }
@@ -11229,7 +11247,7 @@ import React25, {
11229
11247
  } from "react";
11230
11248
 
11231
11249
  // src/components/adapters/data-table/DataTableDefaultSavedView.tsx
11232
- import { useMemo as useMemo3 } from "react";
11250
+ import { useMemo as useMemo4 } from "react";
11233
11251
  var DEFAULT_COLUMN_STATE2 = {
11234
11252
  hidden: false,
11235
11253
  pinned: null,
@@ -11276,7 +11294,7 @@ var extractDefaultView2 = (columnDefinitions, receivedConfigFromTool) => {
11276
11294
  return result;
11277
11295
  };
11278
11296
  var useNormalizedDefaultViews2 = (defaultViews, columnDefinitions) => {
11279
- return useMemo3(
11297
+ return useMemo4(
11280
11298
  () => defaultViews.map((view) => ({
11281
11299
  ...view,
11282
11300
  share_token: "",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@procore/saved-views",
3
- "version": "1.0.1-estimatingFork.6.2",
3
+ "version": "1.0.1-estimatingFork.6.3",
4
4
  "description": "Saved Views Component for Data Table",
5
5
  "author": "Procore Technologies, Inc",
6
6
  "repository": {