@procore/saved-views 1.0.1-estimatingFork.6.1 → 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.
@@ -31,6 +31,9 @@ interface ISmartGridConfig {
31
31
  rowGroupState: string[];
32
32
  rowHeight: number | undefined;
33
33
  filterState: FilterModel;
34
+ enableRowGrouping?: boolean;
35
+ enableColumnGrouping?: boolean;
36
+ enableSplitAssembliesForDynamicGrouping?: boolean;
34
37
  }
35
38
 
36
39
  declare const PROJECT_LEVEL_TOOL_VIEW_LEVELS: readonly ["company", "project", "personal"];
@@ -106,6 +109,12 @@ interface IDataTableSavedViewsExternalConsumerProps extends IBaseSavedViewsProps
106
109
  interface ISmartGridSavedViewsExternalConsumerProps extends IBaseSavedViewsProps {
107
110
  gridApi: GridApi;
108
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;
109
118
  defaultViews: ISmartGridDefaultViewConfig[];
110
119
  }
111
120
 
@@ -31,6 +31,9 @@ interface ISmartGridConfig {
31
31
  rowGroupState: string[];
32
32
  rowHeight: number | undefined;
33
33
  filterState: FilterModel;
34
+ enableRowGrouping?: boolean;
35
+ enableColumnGrouping?: boolean;
36
+ enableSplitAssembliesForDynamicGrouping?: boolean;
34
37
  }
35
38
 
36
39
  declare const PROJECT_LEVEL_TOOL_VIEW_LEVELS: readonly ["company", "project", "personal"];
@@ -106,6 +109,12 @@ interface IDataTableSavedViewsExternalConsumerProps extends IBaseSavedViewsProps
106
109
  interface ISmartGridSavedViewsExternalConsumerProps extends IBaseSavedViewsProps {
107
110
  gridApi: GridApi;
108
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;
109
118
  defaultViews: ISmartGridDefaultViewConfig[];
110
119
  }
111
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) {
@@ -9892,7 +9895,6 @@ var PanelContent = (props) => {
9892
9895
  updateSavedView(newSavedView, {
9893
9896
  onSuccess: () => {
9894
9897
  showToast.success(I18n.t("savedViews.update.success"));
9895
- props.onSelect({ item: newSavedView });
9896
9898
  },
9897
9899
  onError: () => {
9898
9900
  showToast.error(I18n.t("savedViews.errors.update"));
@@ -11057,7 +11059,10 @@ var extractDefaultView = (gridApi, receivedConfig) => {
11057
11059
  columnGroupState: (receivedConfig == null ? void 0 : receivedConfig.columnGroupState) ?? [],
11058
11060
  rowGroupState: (receivedConfig == null ? void 0 : receivedConfig.rowGroupState) ?? [],
11059
11061
  filterState: (receivedConfig == null ? void 0 : receivedConfig.filterState) ?? {},
11060
- rowHeight: (receivedConfig == null ? void 0 : receivedConfig.rowHeight) ?? ((_b = gridApi.getSizesForCurrentTheme()) == null ? void 0 : _b.rowHeight)
11062
+ rowHeight: (receivedConfig == null ? void 0 : receivedConfig.rowHeight) ?? ((_b = gridApi.getSizesForCurrentTheme()) == null ? void 0 : _b.rowHeight),
11063
+ enableRowGrouping: receivedConfig == null ? void 0 : receivedConfig.enableRowGrouping,
11064
+ enableColumnGrouping: receivedConfig == null ? void 0 : receivedConfig.enableColumnGrouping,
11065
+ enableSplitAssembliesForDynamicGrouping: receivedConfig == null ? void 0 : receivedConfig.enableSplitAssembliesForDynamicGrouping
11061
11066
  };
11062
11067
  return result;
11063
11068
  };
@@ -11075,6 +11080,12 @@ var useNormalizedDefaultViews = (defaultViews, gridApi) => {
11075
11080
 
11076
11081
  // src/components/adapters/smart-grid/useSmartGridConfig.ts
11077
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
+ ];
11078
11089
  var GRID_STATE_EVENTS = [
11079
11090
  "sortChanged",
11080
11091
  "filterOpened",
@@ -11101,7 +11112,10 @@ var useSmartGridConfig = (gridApi) => {
11101
11112
  if (eventListenersDisabledRef.current) {
11102
11113
  return;
11103
11114
  }
11104
- setConfig(getSmartGridConfig(gridApi));
11115
+ setConfig((prev) => ({
11116
+ ...getSmartGridConfig(gridApi),
11117
+ ...import_lodash2.default.pick(prev, ESTIMATING_GROUPING_STATE_KEYS)
11118
+ }));
11105
11119
  };
11106
11120
  GRID_STATE_EVENTS.forEach((event) => {
11107
11121
  gridApi.addEventListener(event, updateConfig);
@@ -11132,6 +11146,12 @@ var SmartGridSavedViews = (props) => {
11132
11146
  } = useSmartGridConfig(gridApi);
11133
11147
  const presetViews = useNormalizedDefaultViews(props.defaultViews, gridApi);
11134
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]);
11135
11155
  const onSelect = (0, import_react16.useCallback)(
11136
11156
  ({ item }) => {
11137
11157
  var _a;
@@ -11163,7 +11183,7 @@ var SmartGridSavedViews = (props) => {
11163
11183
  }, 0);
11164
11184
  return updatedView;
11165
11185
  },
11166
- [gridApi, tableConfig, setTableConfig]
11186
+ [gridApi, tableConfig, setTableConfig, props.transformSettings]
11167
11187
  );
11168
11188
  return /* @__PURE__ */ import_react16.default.createElement(
11169
11189
  SavedViews,
@@ -11177,7 +11197,7 @@ var SmartGridSavedViews = (props) => {
11177
11197
  defaultView,
11178
11198
  presetViews,
11179
11199
  tableName: props.tableName,
11180
- tableConfig,
11200
+ tableConfig: tableConfigForSavedViews,
11181
11201
  backend: props.backend,
11182
11202
  enableSharingViews: props.enableSharingViews
11183
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) {
@@ -9896,7 +9899,6 @@ var PanelContent = (props) => {
9896
9899
  updateSavedView(newSavedView, {
9897
9900
  onSuccess: () => {
9898
9901
  showToast.success(I18n.t("savedViews.update.success"));
9899
- props.onSelect({ item: newSavedView });
9900
9902
  },
9901
9903
  onError: () => {
9902
9904
  showToast.error(I18n.t("savedViews.errors.update"));
@@ -11039,7 +11041,7 @@ var SavedViews = (props) => {
11039
11041
  };
11040
11042
 
11041
11043
  // src/components/adapters/smart-grid/SmartGridSavedViews.tsx
11042
- import React24, { useCallback as useCallback4 } from "react";
11044
+ import React24, { useCallback as useCallback4, useMemo as useMemo3 } from "react";
11043
11045
 
11044
11046
  // src/components/adapters/smart-grid/SmartGridDefaultSavedView.tsx
11045
11047
  import { useMemo as useMemo2 } from "react";
@@ -11097,7 +11099,10 @@ var extractDefaultView = (gridApi, receivedConfig) => {
11097
11099
  columnGroupState: (receivedConfig == null ? void 0 : receivedConfig.columnGroupState) ?? [],
11098
11100
  rowGroupState: (receivedConfig == null ? void 0 : receivedConfig.rowGroupState) ?? [],
11099
11101
  filterState: (receivedConfig == null ? void 0 : receivedConfig.filterState) ?? {},
11100
- rowHeight: (receivedConfig == null ? void 0 : receivedConfig.rowHeight) ?? ((_b = gridApi.getSizesForCurrentTheme()) == null ? void 0 : _b.rowHeight)
11102
+ rowHeight: (receivedConfig == null ? void 0 : receivedConfig.rowHeight) ?? ((_b = gridApi.getSizesForCurrentTheme()) == null ? void 0 : _b.rowHeight),
11103
+ enableRowGrouping: receivedConfig == null ? void 0 : receivedConfig.enableRowGrouping,
11104
+ enableColumnGrouping: receivedConfig == null ? void 0 : receivedConfig.enableColumnGrouping,
11105
+ enableSplitAssembliesForDynamicGrouping: receivedConfig == null ? void 0 : receivedConfig.enableSplitAssembliesForDynamicGrouping
11101
11106
  };
11102
11107
  return result;
11103
11108
  };
@@ -11114,7 +11119,13 @@ var useNormalizedDefaultViews = (defaultViews, gridApi) => {
11114
11119
  };
11115
11120
 
11116
11121
  // src/components/adapters/smart-grid/useSmartGridConfig.ts
11122
+ var import_lodash2 = __toESM(require_lodash());
11117
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
+ ];
11118
11129
  var GRID_STATE_EVENTS = [
11119
11130
  "sortChanged",
11120
11131
  "filterOpened",
@@ -11141,7 +11152,10 @@ var useSmartGridConfig = (gridApi) => {
11141
11152
  if (eventListenersDisabledRef.current) {
11142
11153
  return;
11143
11154
  }
11144
- setConfig(getSmartGridConfig(gridApi));
11155
+ setConfig((prev) => ({
11156
+ ...getSmartGridConfig(gridApi),
11157
+ ...import_lodash2.default.pick(prev, ESTIMATING_GROUPING_STATE_KEYS)
11158
+ }));
11145
11159
  };
11146
11160
  GRID_STATE_EVENTS.forEach((event) => {
11147
11161
  gridApi.addEventListener(event, updateConfig);
@@ -11172,6 +11186,12 @@ var SmartGridSavedViews = (props) => {
11172
11186
  } = useSmartGridConfig(gridApi);
11173
11187
  const presetViews = useNormalizedDefaultViews(props.defaultViews, gridApi);
11174
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]);
11175
11195
  const onSelect = useCallback4(
11176
11196
  ({ item }) => {
11177
11197
  var _a;
@@ -11203,7 +11223,7 @@ var SmartGridSavedViews = (props) => {
11203
11223
  }, 0);
11204
11224
  return updatedView;
11205
11225
  },
11206
- [gridApi, tableConfig, setTableConfig]
11226
+ [gridApi, tableConfig, setTableConfig, props.transformSettings]
11207
11227
  );
11208
11228
  return /* @__PURE__ */ React24.createElement(
11209
11229
  SavedViews,
@@ -11217,7 +11237,7 @@ var SmartGridSavedViews = (props) => {
11217
11237
  defaultView,
11218
11238
  presetViews,
11219
11239
  tableName: props.tableName,
11220
- tableConfig,
11240
+ tableConfig: tableConfigForSavedViews,
11221
11241
  backend: props.backend,
11222
11242
  enableSharingViews: props.enableSharingViews
11223
11243
  }
@@ -11233,7 +11253,7 @@ import React25, {
11233
11253
  } from "react";
11234
11254
 
11235
11255
  // src/components/adapters/data-table/DataTableDefaultSavedView.tsx
11236
- import { useMemo as useMemo3 } from "react";
11256
+ import { useMemo as useMemo4 } from "react";
11237
11257
  var DEFAULT_COLUMN_STATE2 = {
11238
11258
  hidden: false,
11239
11259
  pinned: null,
@@ -11281,7 +11301,7 @@ var extractDefaultView2 = (columnDefinitions, receivedConfigFromTool) => {
11281
11301
  return result;
11282
11302
  };
11283
11303
  var useNormalizedDefaultViews2 = (defaultViews, columnDefinitions) => {
11284
- return useMemo3(
11304
+ return useMemo4(
11285
11305
  () => defaultViews.map((view) => ({
11286
11306
  ...view,
11287
11307
  share_token: "",
@@ -31,6 +31,9 @@ interface ISmartGridConfig {
31
31
  rowGroupState: string[];
32
32
  rowHeight: number | undefined;
33
33
  filterState: FilterModel;
34
+ enableRowGrouping?: boolean;
35
+ enableColumnGrouping?: boolean;
36
+ enableSplitAssembliesForDynamicGrouping?: boolean;
34
37
  }
35
38
 
36
39
  declare const PROJECT_LEVEL_TOOL_VIEW_LEVELS: readonly ["company", "project", "personal"];
@@ -106,6 +109,12 @@ interface IDataTableSavedViewsExternalConsumerProps extends IBaseSavedViewsProps
106
109
  interface ISmartGridSavedViewsExternalConsumerProps extends IBaseSavedViewsProps {
107
110
  gridApi: GridApi;
108
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;
109
118
  defaultViews: ISmartGridDefaultViewConfig[];
110
119
  }
111
120
 
@@ -31,6 +31,9 @@ interface ISmartGridConfig {
31
31
  rowGroupState: string[];
32
32
  rowHeight: number | undefined;
33
33
  filterState: FilterModel;
34
+ enableRowGrouping?: boolean;
35
+ enableColumnGrouping?: boolean;
36
+ enableSplitAssembliesForDynamicGrouping?: boolean;
34
37
  }
35
38
 
36
39
  declare const PROJECT_LEVEL_TOOL_VIEW_LEVELS: readonly ["company", "project", "personal"];
@@ -106,6 +109,12 @@ interface IDataTableSavedViewsExternalConsumerProps extends IBaseSavedViewsProps
106
109
  interface ISmartGridSavedViewsExternalConsumerProps extends IBaseSavedViewsProps {
107
110
  gridApi: GridApi;
108
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;
109
118
  defaultViews: ISmartGridDefaultViewConfig[];
110
119
  }
111
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) {
@@ -9889,7 +9892,6 @@ var PanelContent = (props) => {
9889
9892
  updateSavedView(newSavedView, {
9890
9893
  onSuccess: () => {
9891
9894
  showToast.success(I18n.t("savedViews.update.success"));
9892
- props.onSelect({ item: newSavedView });
9893
9895
  },
9894
9896
  onError: () => {
9895
9897
  showToast.error(I18n.t("savedViews.errors.update"));
@@ -11052,7 +11054,10 @@ var extractDefaultView = (gridApi, receivedConfig) => {
11052
11054
  columnGroupState: receivedConfig?.columnGroupState ?? [],
11053
11055
  rowGroupState: receivedConfig?.rowGroupState ?? [],
11054
11056
  filterState: receivedConfig?.filterState ?? {},
11055
- rowHeight: receivedConfig?.rowHeight ?? gridApi.getSizesForCurrentTheme()?.rowHeight
11057
+ rowHeight: receivedConfig?.rowHeight ?? gridApi.getSizesForCurrentTheme()?.rowHeight,
11058
+ enableRowGrouping: receivedConfig?.enableRowGrouping,
11059
+ enableColumnGrouping: receivedConfig?.enableColumnGrouping,
11060
+ enableSplitAssembliesForDynamicGrouping: receivedConfig?.enableSplitAssembliesForDynamicGrouping
11056
11061
  };
11057
11062
  return result;
11058
11063
  };
@@ -11070,6 +11075,12 @@ var useNormalizedDefaultViews = (defaultViews, gridApi) => {
11070
11075
 
11071
11076
  // src/components/adapters/smart-grid/useSmartGridConfig.ts
11072
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
+ ];
11073
11084
  var GRID_STATE_EVENTS = [
11074
11085
  "sortChanged",
11075
11086
  "filterOpened",
@@ -11096,7 +11107,10 @@ var useSmartGridConfig = (gridApi) => {
11096
11107
  if (eventListenersDisabledRef.current) {
11097
11108
  return;
11098
11109
  }
11099
- setConfig(getSmartGridConfig(gridApi));
11110
+ setConfig((prev) => ({
11111
+ ...getSmartGridConfig(gridApi),
11112
+ ...import_lodash2.default.pick(prev, ESTIMATING_GROUPING_STATE_KEYS)
11113
+ }));
11100
11114
  };
11101
11115
  GRID_STATE_EVENTS.forEach((event) => {
11102
11116
  gridApi.addEventListener(event, updateConfig);
@@ -11127,6 +11141,12 @@ var SmartGridSavedViews = (props) => {
11127
11141
  } = useSmartGridConfig(gridApi);
11128
11142
  const presetViews = useNormalizedDefaultViews(props.defaultViews, gridApi);
11129
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]);
11130
11150
  const onSelect = (0, import_react16.useCallback)(
11131
11151
  ({ item }) => {
11132
11152
  if (!gridApi)
@@ -11157,7 +11177,7 @@ var SmartGridSavedViews = (props) => {
11157
11177
  }, 0);
11158
11178
  return updatedView;
11159
11179
  },
11160
- [gridApi, tableConfig, setTableConfig]
11180
+ [gridApi, tableConfig, setTableConfig, props.transformSettings]
11161
11181
  );
11162
11182
  return /* @__PURE__ */ import_react16.default.createElement(
11163
11183
  SavedViews,
@@ -11171,7 +11191,7 @@ var SmartGridSavedViews = (props) => {
11171
11191
  defaultView,
11172
11192
  presetViews,
11173
11193
  tableName: props.tableName,
11174
- tableConfig,
11194
+ tableConfig: tableConfigForSavedViews,
11175
11195
  backend: props.backend,
11176
11196
  enableSharingViews: props.enableSharingViews
11177
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) {
@@ -9893,7 +9896,6 @@ var PanelContent = (props) => {
9893
9896
  updateSavedView(newSavedView, {
9894
9897
  onSuccess: () => {
9895
9898
  showToast.success(I18n.t("savedViews.update.success"));
9896
- props.onSelect({ item: newSavedView });
9897
9899
  },
9898
9900
  onError: () => {
9899
9901
  showToast.error(I18n.t("savedViews.errors.update"));
@@ -11035,7 +11037,7 @@ var SavedViews = (props) => {
11035
11037
  };
11036
11038
 
11037
11039
  // src/components/adapters/smart-grid/SmartGridSavedViews.tsx
11038
- import React24, { useCallback as useCallback4 } from "react";
11040
+ import React24, { useCallback as useCallback4, useMemo as useMemo3 } from "react";
11039
11041
 
11040
11042
  // src/components/adapters/smart-grid/SmartGridDefaultSavedView.tsx
11041
11043
  import { useMemo as useMemo2 } from "react";
@@ -11092,7 +11094,10 @@ var extractDefaultView = (gridApi, receivedConfig) => {
11092
11094
  columnGroupState: receivedConfig?.columnGroupState ?? [],
11093
11095
  rowGroupState: receivedConfig?.rowGroupState ?? [],
11094
11096
  filterState: receivedConfig?.filterState ?? {},
11095
- rowHeight: receivedConfig?.rowHeight ?? gridApi.getSizesForCurrentTheme()?.rowHeight
11097
+ rowHeight: receivedConfig?.rowHeight ?? gridApi.getSizesForCurrentTheme()?.rowHeight,
11098
+ enableRowGrouping: receivedConfig?.enableRowGrouping,
11099
+ enableColumnGrouping: receivedConfig?.enableColumnGrouping,
11100
+ enableSplitAssembliesForDynamicGrouping: receivedConfig?.enableSplitAssembliesForDynamicGrouping
11096
11101
  };
11097
11102
  return result;
11098
11103
  };
@@ -11109,7 +11114,13 @@ var useNormalizedDefaultViews = (defaultViews, gridApi) => {
11109
11114
  };
11110
11115
 
11111
11116
  // src/components/adapters/smart-grid/useSmartGridConfig.ts
11117
+ var import_lodash2 = __toESM(require_lodash());
11112
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
+ ];
11113
11124
  var GRID_STATE_EVENTS = [
11114
11125
  "sortChanged",
11115
11126
  "filterOpened",
@@ -11136,7 +11147,10 @@ var useSmartGridConfig = (gridApi) => {
11136
11147
  if (eventListenersDisabledRef.current) {
11137
11148
  return;
11138
11149
  }
11139
- setConfig(getSmartGridConfig(gridApi));
11150
+ setConfig((prev) => ({
11151
+ ...getSmartGridConfig(gridApi),
11152
+ ...import_lodash2.default.pick(prev, ESTIMATING_GROUPING_STATE_KEYS)
11153
+ }));
11140
11154
  };
11141
11155
  GRID_STATE_EVENTS.forEach((event) => {
11142
11156
  gridApi.addEventListener(event, updateConfig);
@@ -11167,6 +11181,12 @@ var SmartGridSavedViews = (props) => {
11167
11181
  } = useSmartGridConfig(gridApi);
11168
11182
  const presetViews = useNormalizedDefaultViews(props.defaultViews, gridApi);
11169
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]);
11170
11190
  const onSelect = useCallback4(
11171
11191
  ({ item }) => {
11172
11192
  if (!gridApi)
@@ -11197,7 +11217,7 @@ var SmartGridSavedViews = (props) => {
11197
11217
  }, 0);
11198
11218
  return updatedView;
11199
11219
  },
11200
- [gridApi, tableConfig, setTableConfig]
11220
+ [gridApi, tableConfig, setTableConfig, props.transformSettings]
11201
11221
  );
11202
11222
  return /* @__PURE__ */ React24.createElement(
11203
11223
  SavedViews,
@@ -11211,7 +11231,7 @@ var SmartGridSavedViews = (props) => {
11211
11231
  defaultView,
11212
11232
  presetViews,
11213
11233
  tableName: props.tableName,
11214
- tableConfig,
11234
+ tableConfig: tableConfigForSavedViews,
11215
11235
  backend: props.backend,
11216
11236
  enableSharingViews: props.enableSharingViews
11217
11237
  }
@@ -11227,7 +11247,7 @@ import React25, {
11227
11247
  } from "react";
11228
11248
 
11229
11249
  // src/components/adapters/data-table/DataTableDefaultSavedView.tsx
11230
- import { useMemo as useMemo3 } from "react";
11250
+ import { useMemo as useMemo4 } from "react";
11231
11251
  var DEFAULT_COLUMN_STATE2 = {
11232
11252
  hidden: false,
11233
11253
  pinned: null,
@@ -11274,7 +11294,7 @@ var extractDefaultView2 = (columnDefinitions, receivedConfigFromTool) => {
11274
11294
  return result;
11275
11295
  };
11276
11296
  var useNormalizedDefaultViews2 = (defaultViews, columnDefinitions) => {
11277
- return useMemo3(
11297
+ return useMemo4(
11278
11298
  () => defaultViews.map((view) => ({
11279
11299
  ...view,
11280
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.1",
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": {