@procore/saved-views 1.0.1-alpha.1 → 1.0.1-alpha.2

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"]);
@@ -15234,18 +15242,21 @@ var SmartGridSavedViews = (props) => {
15234
15242
  const defaultView = presetViews.find((view) => view.id === "default") ?? presetViews[0];
15235
15243
  const onSelect = (0, import_react16.useCallback)(
15236
15244
  ({ item }) => {
15245
+ var _a;
15237
15246
  if (!gridApi)
15238
15247
  return item;
15239
15248
  const isPresetView = item.view_level === "default";
15249
+ const newConfig = item.table_config;
15250
+ const transformedConfig = ((_a = props.transformSettings) == null ? void 0 : _a.call(props, newConfig)) ?? newConfig;
15240
15251
  if (isPresetView) {
15241
15252
  updateTableConfig(item, gridApi, "smart-grid");
15242
- setTableConfig(item.table_config);
15253
+ setTableConfig(transformedConfig);
15243
15254
  return item;
15244
15255
  }
15245
15256
  const updatedView = {
15246
15257
  ...item,
15247
15258
  table_config: customAndConfigSync(
15248
- item.table_config,
15259
+ transformedConfig,
15249
15260
  tableConfig
15250
15261
  )
15251
15262
  };
@@ -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"]);
@@ -15278,18 +15286,21 @@ var SmartGridSavedViews = (props) => {
15278
15286
  const defaultView = presetViews.find((view) => view.id === "default") ?? presetViews[0];
15279
15287
  const onSelect = useCallback4(
15280
15288
  ({ item }) => {
15289
+ var _a;
15281
15290
  if (!gridApi)
15282
15291
  return item;
15283
15292
  const isPresetView = item.view_level === "default";
15293
+ const newConfig = item.table_config;
15294
+ const transformedConfig = ((_a = props.transformSettings) == null ? void 0 : _a.call(props, newConfig)) ?? newConfig;
15284
15295
  if (isPresetView) {
15285
15296
  updateTableConfig(item, gridApi, "smart-grid");
15286
- setTableConfig(item.table_config);
15297
+ setTableConfig(transformedConfig);
15287
15298
  return item;
15288
15299
  }
15289
15300
  const updatedView = {
15290
15301
  ...item,
15291
15302
  table_config: customAndConfigSync(
15292
- item.table_config,
15303
+ transformedConfig,
15293
15304
  tableConfig
15294
15305
  )
15295
15306
  };
@@ -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"]);
@@ -15233,15 +15241,17 @@ var SmartGridSavedViews = (props) => {
15233
15241
  if (!gridApi)
15234
15242
  return item;
15235
15243
  const isPresetView = item.view_level === "default";
15244
+ const newConfig = item.table_config;
15245
+ const transformedConfig = props.transformSettings?.(newConfig) ?? newConfig;
15236
15246
  if (isPresetView) {
15237
15247
  updateTableConfig(item, gridApi, "smart-grid");
15238
- setTableConfig(item.table_config);
15248
+ setTableConfig(transformedConfig);
15239
15249
  return item;
15240
15250
  }
15241
15251
  const updatedView = {
15242
15252
  ...item,
15243
15253
  table_config: customAndConfigSync(
15244
- item.table_config,
15254
+ transformedConfig,
15245
15255
  tableConfig
15246
15256
  )
15247
15257
  };
@@ -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"]);
@@ -15277,15 +15285,17 @@ var SmartGridSavedViews = (props) => {
15277
15285
  if (!gridApi)
15278
15286
  return item;
15279
15287
  const isPresetView = item.view_level === "default";
15288
+ const newConfig = item.table_config;
15289
+ const transformedConfig = props.transformSettings?.(newConfig) ?? newConfig;
15280
15290
  if (isPresetView) {
15281
15291
  updateTableConfig(item, gridApi, "smart-grid");
15282
- setTableConfig(item.table_config);
15292
+ setTableConfig(transformedConfig);
15283
15293
  return item;
15284
15294
  }
15285
15295
  const updatedView = {
15286
15296
  ...item,
15287
15297
  table_config: customAndConfigSync(
15288
- item.table_config,
15298
+ transformedConfig,
15289
15299
  tableConfig
15290
15300
  )
15291
15301
  };
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-alpha.2",
4
4
  "description": "Saved Views Component for Data Table",
5
5
  "author": "Procore Technologies, Inc",
6
6
  "repository": {