@procore/saved-views 1.0.1-alpha.1 → 1.0.1-estimatingFork.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.
@@ -3976,7 +3976,7 @@ var require_lodash = __commonJS({
3976
3976
  if (typeof func != "function") {
3977
3977
  throw new TypeError2(FUNC_ERROR_TEXT);
3978
3978
  }
3979
- return setTimeout(function() {
3979
+ return setTimeout2(function() {
3980
3980
  func.apply(undefined2, args);
3981
3981
  }, wait);
3982
3982
  }
@@ -5807,7 +5807,7 @@ var require_lodash = __commonJS({
5807
5807
  return object2[key];
5808
5808
  }
5809
5809
  var setData = shortOut(baseSetData);
5810
- var setTimeout = ctxSetTimeout || function(func, wait) {
5810
+ var setTimeout2 = ctxSetTimeout || function(func, wait) {
5811
5811
  return root.setTimeout(func, wait);
5812
5812
  };
5813
5813
  var setToString = shortOut(baseSetToString);
@@ -6599,7 +6599,7 @@ var require_lodash = __commonJS({
6599
6599
  }
6600
6600
  function leadingEdge(time) {
6601
6601
  lastInvokeTime = time;
6602
- timerId = setTimeout(timerExpired, wait);
6602
+ timerId = setTimeout2(timerExpired, wait);
6603
6603
  return leading ? invokeFunc(time) : result2;
6604
6604
  }
6605
6605
  function remainingWait(time) {
@@ -6615,7 +6615,7 @@ var require_lodash = __commonJS({
6615
6615
  if (shouldInvoke(time)) {
6616
6616
  return trailingEdge(time);
6617
6617
  }
6618
- timerId = setTimeout(timerExpired, remainingWait(time));
6618
+ timerId = setTimeout2(timerExpired, remainingWait(time));
6619
6619
  }
6620
6620
  function trailingEdge(time) {
6621
6621
  timerId = undefined2;
@@ -6646,12 +6646,12 @@ var require_lodash = __commonJS({
6646
6646
  }
6647
6647
  if (maxing) {
6648
6648
  clearTimeout(timerId);
6649
- timerId = setTimeout(timerExpired, wait);
6649
+ timerId = setTimeout2(timerExpired, wait);
6650
6650
  return invokeFunc(lastCallTime);
6651
6651
  }
6652
6652
  }
6653
6653
  if (timerId === undefined2) {
6654
- timerId = setTimeout(timerExpired, wait);
6654
+ timerId = setTimeout2(timerExpired, wait);
6655
6655
  }
6656
6656
  return result2;
6657
6657
  }
@@ -11520,10 +11520,12 @@ var getColumnIdentifier = (col) => {
11520
11520
  };
11521
11521
  var updateTableConfig = (view, tableApi, provider) => {
11522
11522
  if (provider === "smart-grid") {
11523
- setSmartGridConfig(
11524
- tableApi,
11525
- view.table_config
11526
- );
11523
+ setTimeout(() => {
11524
+ setSmartGridConfig(
11525
+ tableApi,
11526
+ view.table_config
11527
+ );
11528
+ }, 0);
11527
11529
  } else {
11528
11530
  const dataTableApi = tableApi;
11529
11531
  const tableConfig = view.table_config;
@@ -11595,9 +11597,15 @@ var cleanObject = (table_config, provider) => {
11595
11597
  var normalizeForComparison = (config) => {
11596
11598
  if (!(config == null ? void 0 : config.columnState))
11597
11599
  return config;
11600
+ const filteredColumnState = config.columnState.filter(
11601
+ (col) => {
11602
+ const colId = getColumnIdentifier(col);
11603
+ return colId !== "drag_handle" && colId !== "ag-Grid-AutoColumn";
11604
+ }
11605
+ );
11598
11606
  return {
11599
11607
  ...import_lodash.default.omit(config, ["enableRowGrouping", "enableColumnGrouping"]),
11600
- columnState: config.columnState.map((col) => {
11608
+ columnState: filteredColumnState.map((col) => {
11601
11609
  const res = import_lodash.default.omit(col, ["aggFunc"]);
11602
11610
  if (col.flex) {
11603
11611
  return import_lodash.default.omit(res, ["width", "flex"]);
@@ -11617,7 +11625,15 @@ var isEqual = (viewTableConfig, tableConfig, defaultViewConfig, provider) => {
11617
11625
  const normalizedCurrentConfig = normalizeForComparison(tableConfig);
11618
11626
  const cleanedViewConfig = cleanObject(normalizedViewConfig, provider);
11619
11627
  const cleanedCurrentConfig = cleanObject(normalizedCurrentConfig, provider);
11620
- return import_lodash.default.isEqual(cleanedViewConfig, cleanedCurrentConfig);
11628
+ const isEqual2 = import_lodash.default.isEqual(cleanedViewConfig, cleanedCurrentConfig);
11629
+ if (!isEqual2) {
11630
+ console.log(
11631
+ "[SavedViews]: Showing update button - view config, current config",
11632
+ cleanedViewConfig,
11633
+ cleanedCurrentConfig
11634
+ );
11635
+ }
11636
+ return isEqual2;
11621
11637
  };
11622
11638
  var hasPermissionForViewLevel = (viewLevel, permissions) => {
11623
11639
  switch (viewLevel) {
@@ -15229,28 +15245,43 @@ var useSmartGridConfig = (gridApi) => {
15229
15245
  // src/components/adapters/smart-grid/SmartGridSavedViews.tsx
15230
15246
  var SmartGridSavedViews = (props) => {
15231
15247
  const { gridApi, userId, projectId, companyId } = props;
15232
- const { config: tableConfig, setConfig: setTableConfig } = useSmartGridConfig(gridApi);
15248
+ const {
15249
+ config: tableConfig,
15250
+ setConfig: setTableConfig,
15251
+ disableEventListeners,
15252
+ enableEventListeners
15253
+ } = useSmartGridConfig(gridApi);
15233
15254
  const presetViews = useNormalizedDefaultViews(props.defaultViews, gridApi);
15234
15255
  const defaultView = presetViews.find((view) => view.id === "default") ?? presetViews[0];
15235
15256
  const onSelect = (0, import_react16.useCallback)(
15236
15257
  ({ item }) => {
15258
+ var _a;
15237
15259
  if (!gridApi)
15238
15260
  return item;
15239
15261
  const isPresetView = item.view_level === "default";
15262
+ const newConfig = item.table_config;
15263
+ const transformedConfig = ((_a = props.transformSettings) == null ? void 0 : _a.call(props, newConfig)) ?? newConfig;
15264
+ disableEventListeners();
15240
15265
  if (isPresetView) {
15241
15266
  updateTableConfig(item, gridApi, "smart-grid");
15242
- setTableConfig(item.table_config);
15267
+ setTableConfig(transformedConfig);
15268
+ setTimeout(() => {
15269
+ enableEventListeners();
15270
+ }, 0);
15243
15271
  return item;
15244
15272
  }
15245
15273
  const updatedView = {
15246
15274
  ...item,
15247
15275
  table_config: customAndConfigSync(
15248
- item.table_config,
15276
+ transformedConfig,
15249
15277
  tableConfig
15250
15278
  )
15251
15279
  };
15252
15280
  updateTableConfig(updatedView, gridApi, "smart-grid");
15253
15281
  setTableConfig(updatedView.table_config);
15282
+ setTimeout(() => {
15283
+ enableEventListeners();
15284
+ }, 0);
15254
15285
  return updatedView;
15255
15286
  },
15256
15287
  [gridApi, tableConfig, setTableConfig]
@@ -3982,7 +3982,7 @@ var require_lodash = __commonJS({
3982
3982
  if (typeof func != "function") {
3983
3983
  throw new TypeError2(FUNC_ERROR_TEXT);
3984
3984
  }
3985
- return setTimeout(function() {
3985
+ return setTimeout2(function() {
3986
3986
  func.apply(undefined2, args);
3987
3987
  }, wait);
3988
3988
  }
@@ -5813,7 +5813,7 @@ var require_lodash = __commonJS({
5813
5813
  return object2[key];
5814
5814
  }
5815
5815
  var setData = shortOut(baseSetData);
5816
- var setTimeout = ctxSetTimeout || function(func, wait) {
5816
+ var setTimeout2 = ctxSetTimeout || function(func, wait) {
5817
5817
  return root.setTimeout(func, wait);
5818
5818
  };
5819
5819
  var setToString = shortOut(baseSetToString);
@@ -6605,7 +6605,7 @@ var require_lodash = __commonJS({
6605
6605
  }
6606
6606
  function leadingEdge(time) {
6607
6607
  lastInvokeTime = time;
6608
- timerId = setTimeout(timerExpired, wait);
6608
+ timerId = setTimeout2(timerExpired, wait);
6609
6609
  return leading ? invokeFunc(time) : result2;
6610
6610
  }
6611
6611
  function remainingWait(time) {
@@ -6621,7 +6621,7 @@ var require_lodash = __commonJS({
6621
6621
  if (shouldInvoke(time)) {
6622
6622
  return trailingEdge(time);
6623
6623
  }
6624
- timerId = setTimeout(timerExpired, remainingWait(time));
6624
+ timerId = setTimeout2(timerExpired, remainingWait(time));
6625
6625
  }
6626
6626
  function trailingEdge(time) {
6627
6627
  timerId = undefined2;
@@ -6652,12 +6652,12 @@ var require_lodash = __commonJS({
6652
6652
  }
6653
6653
  if (maxing) {
6654
6654
  clearTimeout(timerId);
6655
- timerId = setTimeout(timerExpired, wait);
6655
+ timerId = setTimeout2(timerExpired, wait);
6656
6656
  return invokeFunc(lastCallTime);
6657
6657
  }
6658
6658
  }
6659
6659
  if (timerId === undefined2) {
6660
- timerId = setTimeout(timerExpired, wait);
6660
+ timerId = setTimeout2(timerExpired, wait);
6661
6661
  }
6662
6662
  return result2;
6663
6663
  }
@@ -11516,10 +11516,12 @@ var getColumnIdentifier = (col) => {
11516
11516
  };
11517
11517
  var updateTableConfig = (view, tableApi, provider) => {
11518
11518
  if (provider === "smart-grid") {
11519
- setSmartGridConfig(
11520
- tableApi,
11521
- view.table_config
11522
- );
11519
+ setTimeout(() => {
11520
+ setSmartGridConfig(
11521
+ tableApi,
11522
+ view.table_config
11523
+ );
11524
+ }, 0);
11523
11525
  } else {
11524
11526
  const dataTableApi = tableApi;
11525
11527
  const tableConfig = view.table_config;
@@ -11591,9 +11593,15 @@ var cleanObject = (table_config, provider) => {
11591
11593
  var normalizeForComparison = (config) => {
11592
11594
  if (!(config == null ? void 0 : config.columnState))
11593
11595
  return config;
11596
+ const filteredColumnState = config.columnState.filter(
11597
+ (col) => {
11598
+ const colId = getColumnIdentifier(col);
11599
+ return colId !== "drag_handle" && colId !== "ag-Grid-AutoColumn";
11600
+ }
11601
+ );
11594
11602
  return {
11595
11603
  ...import_lodash.default.omit(config, ["enableRowGrouping", "enableColumnGrouping"]),
11596
- columnState: config.columnState.map((col) => {
11604
+ columnState: filteredColumnState.map((col) => {
11597
11605
  const res = import_lodash.default.omit(col, ["aggFunc"]);
11598
11606
  if (col.flex) {
11599
11607
  return import_lodash.default.omit(res, ["width", "flex"]);
@@ -11613,7 +11621,15 @@ var isEqual = (viewTableConfig, tableConfig, defaultViewConfig, provider) => {
11613
11621
  const normalizedCurrentConfig = normalizeForComparison(tableConfig);
11614
11622
  const cleanedViewConfig = cleanObject(normalizedViewConfig, provider);
11615
11623
  const cleanedCurrentConfig = cleanObject(normalizedCurrentConfig, provider);
11616
- return import_lodash.default.isEqual(cleanedViewConfig, cleanedCurrentConfig);
11624
+ const isEqual2 = import_lodash.default.isEqual(cleanedViewConfig, cleanedCurrentConfig);
11625
+ if (!isEqual2) {
11626
+ console.log(
11627
+ "[SavedViews]: Showing update button - view config, current config",
11628
+ cleanedViewConfig,
11629
+ cleanedCurrentConfig
11630
+ );
11631
+ }
11632
+ return isEqual2;
11617
11633
  };
11618
11634
  var hasPermissionForViewLevel = (viewLevel, permissions) => {
11619
11635
  switch (viewLevel) {
@@ -15273,28 +15289,43 @@ var useSmartGridConfig = (gridApi) => {
15273
15289
  // src/components/adapters/smart-grid/SmartGridSavedViews.tsx
15274
15290
  var SmartGridSavedViews = (props) => {
15275
15291
  const { gridApi, userId, projectId, companyId } = props;
15276
- const { config: tableConfig, setConfig: setTableConfig } = useSmartGridConfig(gridApi);
15292
+ const {
15293
+ config: tableConfig,
15294
+ setConfig: setTableConfig,
15295
+ disableEventListeners,
15296
+ enableEventListeners
15297
+ } = useSmartGridConfig(gridApi);
15277
15298
  const presetViews = useNormalizedDefaultViews(props.defaultViews, gridApi);
15278
15299
  const defaultView = presetViews.find((view) => view.id === "default") ?? presetViews[0];
15279
15300
  const onSelect = useCallback4(
15280
15301
  ({ item }) => {
15302
+ var _a;
15281
15303
  if (!gridApi)
15282
15304
  return item;
15283
15305
  const isPresetView = item.view_level === "default";
15306
+ const newConfig = item.table_config;
15307
+ const transformedConfig = ((_a = props.transformSettings) == null ? void 0 : _a.call(props, newConfig)) ?? newConfig;
15308
+ disableEventListeners();
15284
15309
  if (isPresetView) {
15285
15310
  updateTableConfig(item, gridApi, "smart-grid");
15286
- setTableConfig(item.table_config);
15311
+ setTableConfig(transformedConfig);
15312
+ setTimeout(() => {
15313
+ enableEventListeners();
15314
+ }, 0);
15287
15315
  return item;
15288
15316
  }
15289
15317
  const updatedView = {
15290
15318
  ...item,
15291
15319
  table_config: customAndConfigSync(
15292
- item.table_config,
15320
+ transformedConfig,
15293
15321
  tableConfig
15294
15322
  )
15295
15323
  };
15296
15324
  updateTableConfig(updatedView, gridApi, "smart-grid");
15297
15325
  setTableConfig(updatedView.table_config);
15326
+ setTimeout(() => {
15327
+ enableEventListeners();
15328
+ }, 0);
15298
15329
  return updatedView;
15299
15330
  },
15300
15331
  [gridApi, tableConfig, setTableConfig]
@@ -3976,7 +3976,7 @@ var require_lodash = __commonJS({
3976
3976
  if (typeof func != "function") {
3977
3977
  throw new TypeError2(FUNC_ERROR_TEXT);
3978
3978
  }
3979
- return setTimeout(function() {
3979
+ return setTimeout2(function() {
3980
3980
  func.apply(undefined2, args);
3981
3981
  }, wait);
3982
3982
  }
@@ -5807,7 +5807,7 @@ var require_lodash = __commonJS({
5807
5807
  return object2[key];
5808
5808
  }
5809
5809
  var setData = shortOut(baseSetData);
5810
- var setTimeout = ctxSetTimeout || function(func, wait) {
5810
+ var setTimeout2 = ctxSetTimeout || function(func, wait) {
5811
5811
  return root.setTimeout(func, wait);
5812
5812
  };
5813
5813
  var setToString = shortOut(baseSetToString);
@@ -6599,7 +6599,7 @@ var require_lodash = __commonJS({
6599
6599
  }
6600
6600
  function leadingEdge(time) {
6601
6601
  lastInvokeTime = time;
6602
- timerId = setTimeout(timerExpired, wait);
6602
+ timerId = setTimeout2(timerExpired, wait);
6603
6603
  return leading ? invokeFunc(time) : result2;
6604
6604
  }
6605
6605
  function remainingWait(time) {
@@ -6615,7 +6615,7 @@ var require_lodash = __commonJS({
6615
6615
  if (shouldInvoke(time)) {
6616
6616
  return trailingEdge(time);
6617
6617
  }
6618
- timerId = setTimeout(timerExpired, remainingWait(time));
6618
+ timerId = setTimeout2(timerExpired, remainingWait(time));
6619
6619
  }
6620
6620
  function trailingEdge(time) {
6621
6621
  timerId = undefined2;
@@ -6646,12 +6646,12 @@ var require_lodash = __commonJS({
6646
6646
  }
6647
6647
  if (maxing) {
6648
6648
  clearTimeout(timerId);
6649
- timerId = setTimeout(timerExpired, wait);
6649
+ timerId = setTimeout2(timerExpired, wait);
6650
6650
  return invokeFunc(lastCallTime);
6651
6651
  }
6652
6652
  }
6653
6653
  if (timerId === undefined2) {
6654
- timerId = setTimeout(timerExpired, wait);
6654
+ timerId = setTimeout2(timerExpired, wait);
6655
6655
  }
6656
6656
  return result2;
6657
6657
  }
@@ -11517,10 +11517,12 @@ var getColumnIdentifier = (col) => {
11517
11517
  };
11518
11518
  var updateTableConfig = (view, tableApi, provider) => {
11519
11519
  if (provider === "smart-grid") {
11520
- setSmartGridConfig(
11521
- tableApi,
11522
- view.table_config
11523
- );
11520
+ setTimeout(() => {
11521
+ setSmartGridConfig(
11522
+ tableApi,
11523
+ view.table_config
11524
+ );
11525
+ }, 0);
11524
11526
  } else {
11525
11527
  const dataTableApi = tableApi;
11526
11528
  const tableConfig = view.table_config;
@@ -11592,9 +11594,15 @@ var cleanObject = (table_config, provider) => {
11592
11594
  var normalizeForComparison = (config) => {
11593
11595
  if (!config?.columnState)
11594
11596
  return config;
11597
+ const filteredColumnState = config.columnState.filter(
11598
+ (col) => {
11599
+ const colId = getColumnIdentifier(col);
11600
+ return colId !== "drag_handle" && colId !== "ag-Grid-AutoColumn";
11601
+ }
11602
+ );
11595
11603
  return {
11596
11604
  ...import_lodash.default.omit(config, ["enableRowGrouping", "enableColumnGrouping"]),
11597
- columnState: config.columnState.map((col) => {
11605
+ columnState: filteredColumnState.map((col) => {
11598
11606
  const res = import_lodash.default.omit(col, ["aggFunc"]);
11599
11607
  if (col.flex) {
11600
11608
  return import_lodash.default.omit(res, ["width", "flex"]);
@@ -11614,7 +11622,15 @@ var isEqual = (viewTableConfig, tableConfig, defaultViewConfig, provider) => {
11614
11622
  const normalizedCurrentConfig = normalizeForComparison(tableConfig);
11615
11623
  const cleanedViewConfig = cleanObject(normalizedViewConfig, provider);
11616
11624
  const cleanedCurrentConfig = cleanObject(normalizedCurrentConfig, provider);
11617
- return import_lodash.default.isEqual(cleanedViewConfig, cleanedCurrentConfig);
11625
+ const isEqual2 = import_lodash.default.isEqual(cleanedViewConfig, cleanedCurrentConfig);
11626
+ if (!isEqual2) {
11627
+ console.log(
11628
+ "[SavedViews]: Showing update button - view config, current config",
11629
+ cleanedViewConfig,
11630
+ cleanedCurrentConfig
11631
+ );
11632
+ }
11633
+ return isEqual2;
11618
11634
  };
11619
11635
  var hasPermissionForViewLevel = (viewLevel, permissions) => {
11620
11636
  switch (viewLevel) {
@@ -15225,7 +15241,12 @@ var useSmartGridConfig = (gridApi) => {
15225
15241
  // src/components/adapters/smart-grid/SmartGridSavedViews.tsx
15226
15242
  var SmartGridSavedViews = (props) => {
15227
15243
  const { gridApi, userId, projectId, companyId } = props;
15228
- const { config: tableConfig, setConfig: setTableConfig } = useSmartGridConfig(gridApi);
15244
+ const {
15245
+ config: tableConfig,
15246
+ setConfig: setTableConfig,
15247
+ disableEventListeners,
15248
+ enableEventListeners
15249
+ } = useSmartGridConfig(gridApi);
15229
15250
  const presetViews = useNormalizedDefaultViews(props.defaultViews, gridApi);
15230
15251
  const defaultView = presetViews.find((view) => view.id === "default") ?? presetViews[0];
15231
15252
  const onSelect = (0, import_react16.useCallback)(
@@ -15233,20 +15254,29 @@ var SmartGridSavedViews = (props) => {
15233
15254
  if (!gridApi)
15234
15255
  return item;
15235
15256
  const isPresetView = item.view_level === "default";
15257
+ const newConfig = item.table_config;
15258
+ const transformedConfig = props.transformSettings?.(newConfig) ?? newConfig;
15259
+ disableEventListeners();
15236
15260
  if (isPresetView) {
15237
15261
  updateTableConfig(item, gridApi, "smart-grid");
15238
- setTableConfig(item.table_config);
15262
+ setTableConfig(transformedConfig);
15263
+ setTimeout(() => {
15264
+ enableEventListeners();
15265
+ }, 0);
15239
15266
  return item;
15240
15267
  }
15241
15268
  const updatedView = {
15242
15269
  ...item,
15243
15270
  table_config: customAndConfigSync(
15244
- item.table_config,
15271
+ transformedConfig,
15245
15272
  tableConfig
15246
15273
  )
15247
15274
  };
15248
15275
  updateTableConfig(updatedView, gridApi, "smart-grid");
15249
15276
  setTableConfig(updatedView.table_config);
15277
+ setTimeout(() => {
15278
+ enableEventListeners();
15279
+ }, 0);
15250
15280
  return updatedView;
15251
15281
  },
15252
15282
  [gridApi, tableConfig, setTableConfig]
@@ -3982,7 +3982,7 @@ var require_lodash = __commonJS({
3982
3982
  if (typeof func != "function") {
3983
3983
  throw new TypeError2(FUNC_ERROR_TEXT);
3984
3984
  }
3985
- return setTimeout(function() {
3985
+ return setTimeout2(function() {
3986
3986
  func.apply(undefined2, args);
3987
3987
  }, wait);
3988
3988
  }
@@ -5813,7 +5813,7 @@ var require_lodash = __commonJS({
5813
5813
  return object2[key];
5814
5814
  }
5815
5815
  var setData = shortOut(baseSetData);
5816
- var setTimeout = ctxSetTimeout || function(func, wait) {
5816
+ var setTimeout2 = ctxSetTimeout || function(func, wait) {
5817
5817
  return root.setTimeout(func, wait);
5818
5818
  };
5819
5819
  var setToString = shortOut(baseSetToString);
@@ -6605,7 +6605,7 @@ var require_lodash = __commonJS({
6605
6605
  }
6606
6606
  function leadingEdge(time) {
6607
6607
  lastInvokeTime = time;
6608
- timerId = setTimeout(timerExpired, wait);
6608
+ timerId = setTimeout2(timerExpired, wait);
6609
6609
  return leading ? invokeFunc(time) : result2;
6610
6610
  }
6611
6611
  function remainingWait(time) {
@@ -6621,7 +6621,7 @@ var require_lodash = __commonJS({
6621
6621
  if (shouldInvoke(time)) {
6622
6622
  return trailingEdge(time);
6623
6623
  }
6624
- timerId = setTimeout(timerExpired, remainingWait(time));
6624
+ timerId = setTimeout2(timerExpired, remainingWait(time));
6625
6625
  }
6626
6626
  function trailingEdge(time) {
6627
6627
  timerId = undefined2;
@@ -6652,12 +6652,12 @@ var require_lodash = __commonJS({
6652
6652
  }
6653
6653
  if (maxing) {
6654
6654
  clearTimeout(timerId);
6655
- timerId = setTimeout(timerExpired, wait);
6655
+ timerId = setTimeout2(timerExpired, wait);
6656
6656
  return invokeFunc(lastCallTime);
6657
6657
  }
6658
6658
  }
6659
6659
  if (timerId === undefined2) {
6660
- timerId = setTimeout(timerExpired, wait);
6660
+ timerId = setTimeout2(timerExpired, wait);
6661
6661
  }
6662
6662
  return result2;
6663
6663
  }
@@ -11513,10 +11513,12 @@ var getColumnIdentifier = (col) => {
11513
11513
  };
11514
11514
  var updateTableConfig = (view, tableApi, provider) => {
11515
11515
  if (provider === "smart-grid") {
11516
- setSmartGridConfig(
11517
- tableApi,
11518
- view.table_config
11519
- );
11516
+ setTimeout(() => {
11517
+ setSmartGridConfig(
11518
+ tableApi,
11519
+ view.table_config
11520
+ );
11521
+ }, 0);
11520
11522
  } else {
11521
11523
  const dataTableApi = tableApi;
11522
11524
  const tableConfig = view.table_config;
@@ -11588,9 +11590,15 @@ var cleanObject = (table_config, provider) => {
11588
11590
  var normalizeForComparison = (config) => {
11589
11591
  if (!config?.columnState)
11590
11592
  return config;
11593
+ const filteredColumnState = config.columnState.filter(
11594
+ (col) => {
11595
+ const colId = getColumnIdentifier(col);
11596
+ return colId !== "drag_handle" && colId !== "ag-Grid-AutoColumn";
11597
+ }
11598
+ );
11591
11599
  return {
11592
11600
  ...import_lodash.default.omit(config, ["enableRowGrouping", "enableColumnGrouping"]),
11593
- columnState: config.columnState.map((col) => {
11601
+ columnState: filteredColumnState.map((col) => {
11594
11602
  const res = import_lodash.default.omit(col, ["aggFunc"]);
11595
11603
  if (col.flex) {
11596
11604
  return import_lodash.default.omit(res, ["width", "flex"]);
@@ -11610,7 +11618,15 @@ var isEqual = (viewTableConfig, tableConfig, defaultViewConfig, provider) => {
11610
11618
  const normalizedCurrentConfig = normalizeForComparison(tableConfig);
11611
11619
  const cleanedViewConfig = cleanObject(normalizedViewConfig, provider);
11612
11620
  const cleanedCurrentConfig = cleanObject(normalizedCurrentConfig, provider);
11613
- return import_lodash.default.isEqual(cleanedViewConfig, cleanedCurrentConfig);
11621
+ const isEqual2 = import_lodash.default.isEqual(cleanedViewConfig, cleanedCurrentConfig);
11622
+ if (!isEqual2) {
11623
+ console.log(
11624
+ "[SavedViews]: Showing update button - view config, current config",
11625
+ cleanedViewConfig,
11626
+ cleanedCurrentConfig
11627
+ );
11628
+ }
11629
+ return isEqual2;
11614
11630
  };
11615
11631
  var hasPermissionForViewLevel = (viewLevel, permissions) => {
11616
11632
  switch (viewLevel) {
@@ -15269,7 +15285,12 @@ var useSmartGridConfig = (gridApi) => {
15269
15285
  // src/components/adapters/smart-grid/SmartGridSavedViews.tsx
15270
15286
  var SmartGridSavedViews = (props) => {
15271
15287
  const { gridApi, userId, projectId, companyId } = props;
15272
- const { config: tableConfig, setConfig: setTableConfig } = useSmartGridConfig(gridApi);
15288
+ const {
15289
+ config: tableConfig,
15290
+ setConfig: setTableConfig,
15291
+ disableEventListeners,
15292
+ enableEventListeners
15293
+ } = useSmartGridConfig(gridApi);
15273
15294
  const presetViews = useNormalizedDefaultViews(props.defaultViews, gridApi);
15274
15295
  const defaultView = presetViews.find((view) => view.id === "default") ?? presetViews[0];
15275
15296
  const onSelect = useCallback4(
@@ -15277,20 +15298,29 @@ var SmartGridSavedViews = (props) => {
15277
15298
  if (!gridApi)
15278
15299
  return item;
15279
15300
  const isPresetView = item.view_level === "default";
15301
+ const newConfig = item.table_config;
15302
+ const transformedConfig = props.transformSettings?.(newConfig) ?? newConfig;
15303
+ disableEventListeners();
15280
15304
  if (isPresetView) {
15281
15305
  updateTableConfig(item, gridApi, "smart-grid");
15282
- setTableConfig(item.table_config);
15306
+ setTableConfig(transformedConfig);
15307
+ setTimeout(() => {
15308
+ enableEventListeners();
15309
+ }, 0);
15283
15310
  return item;
15284
15311
  }
15285
15312
  const updatedView = {
15286
15313
  ...item,
15287
15314
  table_config: customAndConfigSync(
15288
- item.table_config,
15315
+ transformedConfig,
15289
15316
  tableConfig
15290
15317
  )
15291
15318
  };
15292
15319
  updateTableConfig(updatedView, gridApi, "smart-grid");
15293
15320
  setTableConfig(updatedView.table_config);
15321
+ setTimeout(() => {
15322
+ enableEventListeners();
15323
+ }, 0);
15294
15324
  return updatedView;
15295
15325
  },
15296
15326
  [gridApi, tableConfig, setTableConfig]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@procore/saved-views",
3
- "version": "1.0.1-alpha.1",
3
+ "version": "1.0.1-estimatingFork.3",
4
4
  "description": "Saved Views Component for Data Table",
5
5
  "author": "Procore Technologies, Inc",
6
6
  "repository": {