@procore/saved-views 1.0.1-alpha.2 → 1.0.1-estimatingFork.4

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.
@@ -11604,7 +11604,11 @@ var normalizeForComparison = (config) => {
11604
11604
  }
11605
11605
  );
11606
11606
  return {
11607
- ...import_lodash.default.omit(config, ["enableRowGrouping", "enableColumnGrouping"]),
11607
+ ...import_lodash.default.omit(config, [
11608
+ "enableRowGrouping",
11609
+ "enableColumnGrouping",
11610
+ "enableSplitAssembliesForDynamicGrouping"
11611
+ ]),
11608
11612
  columnState: filteredColumnState.map((col) => {
11609
11613
  const res = import_lodash.default.omit(col, ["aggFunc"]);
11610
11614
  if (col.flex) {
@@ -11625,7 +11629,15 @@ var isEqual = (viewTableConfig, tableConfig, defaultViewConfig, provider) => {
11625
11629
  const normalizedCurrentConfig = normalizeForComparison(tableConfig);
11626
11630
  const cleanedViewConfig = cleanObject(normalizedViewConfig, provider);
11627
11631
  const cleanedCurrentConfig = cleanObject(normalizedCurrentConfig, provider);
11628
- return import_lodash.default.isEqual(cleanedViewConfig, cleanedCurrentConfig);
11632
+ const isEqual2 = import_lodash.default.isEqual(cleanedViewConfig, cleanedCurrentConfig);
11633
+ if (!isEqual2) {
11634
+ console.log(
11635
+ "[SavedViews]: Showing update button - view config, current config",
11636
+ cleanedViewConfig,
11637
+ cleanedCurrentConfig
11638
+ );
11639
+ }
11640
+ return isEqual2;
11629
11641
  };
11630
11642
  var hasPermissionForViewLevel = (viewLevel, permissions) => {
11631
11643
  switch (viewLevel) {
@@ -15237,7 +15249,12 @@ var useSmartGridConfig = (gridApi) => {
15237
15249
  // src/components/adapters/smart-grid/SmartGridSavedViews.tsx
15238
15250
  var SmartGridSavedViews = (props) => {
15239
15251
  const { gridApi, userId, projectId, companyId } = props;
15240
- const { config: tableConfig, setConfig: setTableConfig } = useSmartGridConfig(gridApi);
15252
+ const {
15253
+ config: tableConfig,
15254
+ setConfig: setTableConfig,
15255
+ disableEventListeners,
15256
+ enableEventListeners
15257
+ } = useSmartGridConfig(gridApi);
15241
15258
  const presetViews = useNormalizedDefaultViews(props.defaultViews, gridApi);
15242
15259
  const defaultView = presetViews.find((view) => view.id === "default") ?? presetViews[0];
15243
15260
  const onSelect = (0, import_react16.useCallback)(
@@ -15248,9 +15265,13 @@ var SmartGridSavedViews = (props) => {
15248
15265
  const isPresetView = item.view_level === "default";
15249
15266
  const newConfig = item.table_config;
15250
15267
  const transformedConfig = ((_a = props.transformSettings) == null ? void 0 : _a.call(props, newConfig)) ?? newConfig;
15268
+ disableEventListeners();
15251
15269
  if (isPresetView) {
15252
15270
  updateTableConfig(item, gridApi, "smart-grid");
15253
15271
  setTableConfig(transformedConfig);
15272
+ setTimeout(() => {
15273
+ enableEventListeners();
15274
+ }, 0);
15254
15275
  return item;
15255
15276
  }
15256
15277
  const updatedView = {
@@ -15262,6 +15283,9 @@ var SmartGridSavedViews = (props) => {
15262
15283
  };
15263
15284
  updateTableConfig(updatedView, gridApi, "smart-grid");
15264
15285
  setTableConfig(updatedView.table_config);
15286
+ setTimeout(() => {
15287
+ enableEventListeners();
15288
+ }, 0);
15265
15289
  return updatedView;
15266
15290
  },
15267
15291
  [gridApi, tableConfig, setTableConfig]
@@ -11600,7 +11600,11 @@ var normalizeForComparison = (config) => {
11600
11600
  }
11601
11601
  );
11602
11602
  return {
11603
- ...import_lodash.default.omit(config, ["enableRowGrouping", "enableColumnGrouping"]),
11603
+ ...import_lodash.default.omit(config, [
11604
+ "enableRowGrouping",
11605
+ "enableColumnGrouping",
11606
+ "enableSplitAssembliesForDynamicGrouping"
11607
+ ]),
11604
11608
  columnState: filteredColumnState.map((col) => {
11605
11609
  const res = import_lodash.default.omit(col, ["aggFunc"]);
11606
11610
  if (col.flex) {
@@ -11621,7 +11625,15 @@ var isEqual = (viewTableConfig, tableConfig, defaultViewConfig, provider) => {
11621
11625
  const normalizedCurrentConfig = normalizeForComparison(tableConfig);
11622
11626
  const cleanedViewConfig = cleanObject(normalizedViewConfig, provider);
11623
11627
  const cleanedCurrentConfig = cleanObject(normalizedCurrentConfig, provider);
11624
- 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;
11625
11637
  };
11626
11638
  var hasPermissionForViewLevel = (viewLevel, permissions) => {
11627
11639
  switch (viewLevel) {
@@ -15281,7 +15293,12 @@ var useSmartGridConfig = (gridApi) => {
15281
15293
  // src/components/adapters/smart-grid/SmartGridSavedViews.tsx
15282
15294
  var SmartGridSavedViews = (props) => {
15283
15295
  const { gridApi, userId, projectId, companyId } = props;
15284
- const { config: tableConfig, setConfig: setTableConfig } = useSmartGridConfig(gridApi);
15296
+ const {
15297
+ config: tableConfig,
15298
+ setConfig: setTableConfig,
15299
+ disableEventListeners,
15300
+ enableEventListeners
15301
+ } = useSmartGridConfig(gridApi);
15285
15302
  const presetViews = useNormalizedDefaultViews(props.defaultViews, gridApi);
15286
15303
  const defaultView = presetViews.find((view) => view.id === "default") ?? presetViews[0];
15287
15304
  const onSelect = useCallback4(
@@ -15292,9 +15309,13 @@ var SmartGridSavedViews = (props) => {
15292
15309
  const isPresetView = item.view_level === "default";
15293
15310
  const newConfig = item.table_config;
15294
15311
  const transformedConfig = ((_a = props.transformSettings) == null ? void 0 : _a.call(props, newConfig)) ?? newConfig;
15312
+ disableEventListeners();
15295
15313
  if (isPresetView) {
15296
15314
  updateTableConfig(item, gridApi, "smart-grid");
15297
15315
  setTableConfig(transformedConfig);
15316
+ setTimeout(() => {
15317
+ enableEventListeners();
15318
+ }, 0);
15298
15319
  return item;
15299
15320
  }
15300
15321
  const updatedView = {
@@ -15306,6 +15327,9 @@ var SmartGridSavedViews = (props) => {
15306
15327
  };
15307
15328
  updateTableConfig(updatedView, gridApi, "smart-grid");
15308
15329
  setTableConfig(updatedView.table_config);
15330
+ setTimeout(() => {
15331
+ enableEventListeners();
15332
+ }, 0);
15309
15333
  return updatedView;
15310
15334
  },
15311
15335
  [gridApi, tableConfig, setTableConfig]
@@ -11601,7 +11601,11 @@ var normalizeForComparison = (config) => {
11601
11601
  }
11602
11602
  );
11603
11603
  return {
11604
- ...import_lodash.default.omit(config, ["enableRowGrouping", "enableColumnGrouping"]),
11604
+ ...import_lodash.default.omit(config, [
11605
+ "enableRowGrouping",
11606
+ "enableColumnGrouping",
11607
+ "enableSplitAssembliesForDynamicGrouping"
11608
+ ]),
11605
11609
  columnState: filteredColumnState.map((col) => {
11606
11610
  const res = import_lodash.default.omit(col, ["aggFunc"]);
11607
11611
  if (col.flex) {
@@ -11622,7 +11626,15 @@ var isEqual = (viewTableConfig, tableConfig, defaultViewConfig, provider) => {
11622
11626
  const normalizedCurrentConfig = normalizeForComparison(tableConfig);
11623
11627
  const cleanedViewConfig = cleanObject(normalizedViewConfig, provider);
11624
11628
  const cleanedCurrentConfig = cleanObject(normalizedCurrentConfig, provider);
11625
- return import_lodash.default.isEqual(cleanedViewConfig, cleanedCurrentConfig);
11629
+ const isEqual2 = import_lodash.default.isEqual(cleanedViewConfig, cleanedCurrentConfig);
11630
+ if (!isEqual2) {
11631
+ console.log(
11632
+ "[SavedViews]: Showing update button - view config, current config",
11633
+ cleanedViewConfig,
11634
+ cleanedCurrentConfig
11635
+ );
11636
+ }
11637
+ return isEqual2;
11626
11638
  };
11627
11639
  var hasPermissionForViewLevel = (viewLevel, permissions) => {
11628
11640
  switch (viewLevel) {
@@ -15233,7 +15245,12 @@ var useSmartGridConfig = (gridApi) => {
15233
15245
  // src/components/adapters/smart-grid/SmartGridSavedViews.tsx
15234
15246
  var SmartGridSavedViews = (props) => {
15235
15247
  const { gridApi, userId, projectId, companyId } = props;
15236
- const { config: tableConfig, setConfig: setTableConfig } = useSmartGridConfig(gridApi);
15248
+ const {
15249
+ config: tableConfig,
15250
+ setConfig: setTableConfig,
15251
+ disableEventListeners,
15252
+ enableEventListeners
15253
+ } = useSmartGridConfig(gridApi);
15237
15254
  const presetViews = useNormalizedDefaultViews(props.defaultViews, gridApi);
15238
15255
  const defaultView = presetViews.find((view) => view.id === "default") ?? presetViews[0];
15239
15256
  const onSelect = (0, import_react16.useCallback)(
@@ -15243,9 +15260,13 @@ var SmartGridSavedViews = (props) => {
15243
15260
  const isPresetView = item.view_level === "default";
15244
15261
  const newConfig = item.table_config;
15245
15262
  const transformedConfig = props.transformSettings?.(newConfig) ?? newConfig;
15263
+ disableEventListeners();
15246
15264
  if (isPresetView) {
15247
15265
  updateTableConfig(item, gridApi, "smart-grid");
15248
15266
  setTableConfig(transformedConfig);
15267
+ setTimeout(() => {
15268
+ enableEventListeners();
15269
+ }, 0);
15249
15270
  return item;
15250
15271
  }
15251
15272
  const updatedView = {
@@ -15257,6 +15278,9 @@ var SmartGridSavedViews = (props) => {
15257
15278
  };
15258
15279
  updateTableConfig(updatedView, gridApi, "smart-grid");
15259
15280
  setTableConfig(updatedView.table_config);
15281
+ setTimeout(() => {
15282
+ enableEventListeners();
15283
+ }, 0);
15260
15284
  return updatedView;
15261
15285
  },
15262
15286
  [gridApi, tableConfig, setTableConfig]
@@ -11597,7 +11597,11 @@ var normalizeForComparison = (config) => {
11597
11597
  }
11598
11598
  );
11599
11599
  return {
11600
- ...import_lodash.default.omit(config, ["enableRowGrouping", "enableColumnGrouping"]),
11600
+ ...import_lodash.default.omit(config, [
11601
+ "enableRowGrouping",
11602
+ "enableColumnGrouping",
11603
+ "enableSplitAssembliesForDynamicGrouping"
11604
+ ]),
11601
11605
  columnState: filteredColumnState.map((col) => {
11602
11606
  const res = import_lodash.default.omit(col, ["aggFunc"]);
11603
11607
  if (col.flex) {
@@ -11618,7 +11622,15 @@ var isEqual = (viewTableConfig, tableConfig, defaultViewConfig, provider) => {
11618
11622
  const normalizedCurrentConfig = normalizeForComparison(tableConfig);
11619
11623
  const cleanedViewConfig = cleanObject(normalizedViewConfig, provider);
11620
11624
  const cleanedCurrentConfig = cleanObject(normalizedCurrentConfig, provider);
11621
- 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;
11622
11634
  };
11623
11635
  var hasPermissionForViewLevel = (viewLevel, permissions) => {
11624
11636
  switch (viewLevel) {
@@ -15277,7 +15289,12 @@ var useSmartGridConfig = (gridApi) => {
15277
15289
  // src/components/adapters/smart-grid/SmartGridSavedViews.tsx
15278
15290
  var SmartGridSavedViews = (props) => {
15279
15291
  const { gridApi, userId, projectId, companyId } = props;
15280
- const { config: tableConfig, setConfig: setTableConfig } = useSmartGridConfig(gridApi);
15292
+ const {
15293
+ config: tableConfig,
15294
+ setConfig: setTableConfig,
15295
+ disableEventListeners,
15296
+ enableEventListeners
15297
+ } = useSmartGridConfig(gridApi);
15281
15298
  const presetViews = useNormalizedDefaultViews(props.defaultViews, gridApi);
15282
15299
  const defaultView = presetViews.find((view) => view.id === "default") ?? presetViews[0];
15283
15300
  const onSelect = useCallback4(
@@ -15287,9 +15304,13 @@ var SmartGridSavedViews = (props) => {
15287
15304
  const isPresetView = item.view_level === "default";
15288
15305
  const newConfig = item.table_config;
15289
15306
  const transformedConfig = props.transformSettings?.(newConfig) ?? newConfig;
15307
+ disableEventListeners();
15290
15308
  if (isPresetView) {
15291
15309
  updateTableConfig(item, gridApi, "smart-grid");
15292
15310
  setTableConfig(transformedConfig);
15311
+ setTimeout(() => {
15312
+ enableEventListeners();
15313
+ }, 0);
15293
15314
  return item;
15294
15315
  }
15295
15316
  const updatedView = {
@@ -15301,6 +15322,9 @@ var SmartGridSavedViews = (props) => {
15301
15322
  };
15302
15323
  updateTableConfig(updatedView, gridApi, "smart-grid");
15303
15324
  setTableConfig(updatedView.table_config);
15325
+ setTimeout(() => {
15326
+ enableEventListeners();
15327
+ }, 0);
15304
15328
  return updatedView;
15305
15329
  },
15306
15330
  [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.2",
3
+ "version": "1.0.1-estimatingFork.4",
4
4
  "description": "Saved Views Component for Data Table",
5
5
  "author": "Procore Technologies, Inc",
6
6
  "repository": {