@procore/saved-views 1.0.1-alpha.2 → 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.
@@ -11625,7 +11625,15 @@ var isEqual = (viewTableConfig, tableConfig, defaultViewConfig, provider) => {
11625
11625
  const normalizedCurrentConfig = normalizeForComparison(tableConfig);
11626
11626
  const cleanedViewConfig = cleanObject(normalizedViewConfig, provider);
11627
11627
  const cleanedCurrentConfig = cleanObject(normalizedCurrentConfig, provider);
11628
- 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;
11629
11637
  };
11630
11638
  var hasPermissionForViewLevel = (viewLevel, permissions) => {
11631
11639
  switch (viewLevel) {
@@ -15237,7 +15245,12 @@ var useSmartGridConfig = (gridApi) => {
15237
15245
  // src/components/adapters/smart-grid/SmartGridSavedViews.tsx
15238
15246
  var SmartGridSavedViews = (props) => {
15239
15247
  const { gridApi, userId, projectId, companyId } = props;
15240
- const { config: tableConfig, setConfig: setTableConfig } = useSmartGridConfig(gridApi);
15248
+ const {
15249
+ config: tableConfig,
15250
+ setConfig: setTableConfig,
15251
+ disableEventListeners,
15252
+ enableEventListeners
15253
+ } = useSmartGridConfig(gridApi);
15241
15254
  const presetViews = useNormalizedDefaultViews(props.defaultViews, gridApi);
15242
15255
  const defaultView = presetViews.find((view) => view.id === "default") ?? presetViews[0];
15243
15256
  const onSelect = (0, import_react16.useCallback)(
@@ -15248,9 +15261,13 @@ var SmartGridSavedViews = (props) => {
15248
15261
  const isPresetView = item.view_level === "default";
15249
15262
  const newConfig = item.table_config;
15250
15263
  const transformedConfig = ((_a = props.transformSettings) == null ? void 0 : _a.call(props, newConfig)) ?? newConfig;
15264
+ disableEventListeners();
15251
15265
  if (isPresetView) {
15252
15266
  updateTableConfig(item, gridApi, "smart-grid");
15253
15267
  setTableConfig(transformedConfig);
15268
+ setTimeout(() => {
15269
+ enableEventListeners();
15270
+ }, 0);
15254
15271
  return item;
15255
15272
  }
15256
15273
  const updatedView = {
@@ -15262,6 +15279,9 @@ var SmartGridSavedViews = (props) => {
15262
15279
  };
15263
15280
  updateTableConfig(updatedView, gridApi, "smart-grid");
15264
15281
  setTableConfig(updatedView.table_config);
15282
+ setTimeout(() => {
15283
+ enableEventListeners();
15284
+ }, 0);
15265
15285
  return updatedView;
15266
15286
  },
15267
15287
  [gridApi, tableConfig, setTableConfig]
@@ -11621,7 +11621,15 @@ var isEqual = (viewTableConfig, tableConfig, defaultViewConfig, provider) => {
11621
11621
  const normalizedCurrentConfig = normalizeForComparison(tableConfig);
11622
11622
  const cleanedViewConfig = cleanObject(normalizedViewConfig, provider);
11623
11623
  const cleanedCurrentConfig = cleanObject(normalizedCurrentConfig, provider);
11624
- 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;
11625
11633
  };
11626
11634
  var hasPermissionForViewLevel = (viewLevel, permissions) => {
11627
11635
  switch (viewLevel) {
@@ -15281,7 +15289,12 @@ var useSmartGridConfig = (gridApi) => {
15281
15289
  // src/components/adapters/smart-grid/SmartGridSavedViews.tsx
15282
15290
  var SmartGridSavedViews = (props) => {
15283
15291
  const { gridApi, userId, projectId, companyId } = props;
15284
- const { config: tableConfig, setConfig: setTableConfig } = useSmartGridConfig(gridApi);
15292
+ const {
15293
+ config: tableConfig,
15294
+ setConfig: setTableConfig,
15295
+ disableEventListeners,
15296
+ enableEventListeners
15297
+ } = useSmartGridConfig(gridApi);
15285
15298
  const presetViews = useNormalizedDefaultViews(props.defaultViews, gridApi);
15286
15299
  const defaultView = presetViews.find((view) => view.id === "default") ?? presetViews[0];
15287
15300
  const onSelect = useCallback4(
@@ -15292,9 +15305,13 @@ var SmartGridSavedViews = (props) => {
15292
15305
  const isPresetView = item.view_level === "default";
15293
15306
  const newConfig = item.table_config;
15294
15307
  const transformedConfig = ((_a = props.transformSettings) == null ? void 0 : _a.call(props, newConfig)) ?? newConfig;
15308
+ disableEventListeners();
15295
15309
  if (isPresetView) {
15296
15310
  updateTableConfig(item, gridApi, "smart-grid");
15297
15311
  setTableConfig(transformedConfig);
15312
+ setTimeout(() => {
15313
+ enableEventListeners();
15314
+ }, 0);
15298
15315
  return item;
15299
15316
  }
15300
15317
  const updatedView = {
@@ -15306,6 +15323,9 @@ var SmartGridSavedViews = (props) => {
15306
15323
  };
15307
15324
  updateTableConfig(updatedView, gridApi, "smart-grid");
15308
15325
  setTableConfig(updatedView.table_config);
15326
+ setTimeout(() => {
15327
+ enableEventListeners();
15328
+ }, 0);
15309
15329
  return updatedView;
15310
15330
  },
15311
15331
  [gridApi, tableConfig, setTableConfig]
@@ -11622,7 +11622,15 @@ var isEqual = (viewTableConfig, tableConfig, defaultViewConfig, provider) => {
11622
11622
  const normalizedCurrentConfig = normalizeForComparison(tableConfig);
11623
11623
  const cleanedViewConfig = cleanObject(normalizedViewConfig, provider);
11624
11624
  const cleanedCurrentConfig = cleanObject(normalizedCurrentConfig, provider);
11625
- 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;
11626
11634
  };
11627
11635
  var hasPermissionForViewLevel = (viewLevel, permissions) => {
11628
11636
  switch (viewLevel) {
@@ -15233,7 +15241,12 @@ var useSmartGridConfig = (gridApi) => {
15233
15241
  // src/components/adapters/smart-grid/SmartGridSavedViews.tsx
15234
15242
  var SmartGridSavedViews = (props) => {
15235
15243
  const { gridApi, userId, projectId, companyId } = props;
15236
- const { config: tableConfig, setConfig: setTableConfig } = useSmartGridConfig(gridApi);
15244
+ const {
15245
+ config: tableConfig,
15246
+ setConfig: setTableConfig,
15247
+ disableEventListeners,
15248
+ enableEventListeners
15249
+ } = useSmartGridConfig(gridApi);
15237
15250
  const presetViews = useNormalizedDefaultViews(props.defaultViews, gridApi);
15238
15251
  const defaultView = presetViews.find((view) => view.id === "default") ?? presetViews[0];
15239
15252
  const onSelect = (0, import_react16.useCallback)(
@@ -15243,9 +15256,13 @@ var SmartGridSavedViews = (props) => {
15243
15256
  const isPresetView = item.view_level === "default";
15244
15257
  const newConfig = item.table_config;
15245
15258
  const transformedConfig = props.transformSettings?.(newConfig) ?? newConfig;
15259
+ disableEventListeners();
15246
15260
  if (isPresetView) {
15247
15261
  updateTableConfig(item, gridApi, "smart-grid");
15248
15262
  setTableConfig(transformedConfig);
15263
+ setTimeout(() => {
15264
+ enableEventListeners();
15265
+ }, 0);
15249
15266
  return item;
15250
15267
  }
15251
15268
  const updatedView = {
@@ -15257,6 +15274,9 @@ var SmartGridSavedViews = (props) => {
15257
15274
  };
15258
15275
  updateTableConfig(updatedView, gridApi, "smart-grid");
15259
15276
  setTableConfig(updatedView.table_config);
15277
+ setTimeout(() => {
15278
+ enableEventListeners();
15279
+ }, 0);
15260
15280
  return updatedView;
15261
15281
  },
15262
15282
  [gridApi, tableConfig, setTableConfig]
@@ -11618,7 +11618,15 @@ var isEqual = (viewTableConfig, tableConfig, defaultViewConfig, provider) => {
11618
11618
  const normalizedCurrentConfig = normalizeForComparison(tableConfig);
11619
11619
  const cleanedViewConfig = cleanObject(normalizedViewConfig, provider);
11620
11620
  const cleanedCurrentConfig = cleanObject(normalizedCurrentConfig, provider);
11621
- 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;
11622
11630
  };
11623
11631
  var hasPermissionForViewLevel = (viewLevel, permissions) => {
11624
11632
  switch (viewLevel) {
@@ -15277,7 +15285,12 @@ var useSmartGridConfig = (gridApi) => {
15277
15285
  // src/components/adapters/smart-grid/SmartGridSavedViews.tsx
15278
15286
  var SmartGridSavedViews = (props) => {
15279
15287
  const { gridApi, userId, projectId, companyId } = props;
15280
- const { config: tableConfig, setConfig: setTableConfig } = useSmartGridConfig(gridApi);
15288
+ const {
15289
+ config: tableConfig,
15290
+ setConfig: setTableConfig,
15291
+ disableEventListeners,
15292
+ enableEventListeners
15293
+ } = useSmartGridConfig(gridApi);
15281
15294
  const presetViews = useNormalizedDefaultViews(props.defaultViews, gridApi);
15282
15295
  const defaultView = presetViews.find((view) => view.id === "default") ?? presetViews[0];
15283
15296
  const onSelect = useCallback4(
@@ -15287,9 +15300,13 @@ var SmartGridSavedViews = (props) => {
15287
15300
  const isPresetView = item.view_level === "default";
15288
15301
  const newConfig = item.table_config;
15289
15302
  const transformedConfig = props.transformSettings?.(newConfig) ?? newConfig;
15303
+ disableEventListeners();
15290
15304
  if (isPresetView) {
15291
15305
  updateTableConfig(item, gridApi, "smart-grid");
15292
15306
  setTableConfig(transformedConfig);
15307
+ setTimeout(() => {
15308
+ enableEventListeners();
15309
+ }, 0);
15293
15310
  return item;
15294
15311
  }
15295
15312
  const updatedView = {
@@ -15301,6 +15318,9 @@ var SmartGridSavedViews = (props) => {
15301
15318
  };
15302
15319
  updateTableConfig(updatedView, gridApi, "smart-grid");
15303
15320
  setTableConfig(updatedView.table_config);
15321
+ setTimeout(() => {
15322
+ enableEventListeners();
15323
+ }, 0);
15304
15324
  return updatedView;
15305
15325
  },
15306
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.2",
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": {