@procore/saved-views 1.0.0 → 5.0.0-alpha.5

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.
@@ -63,7 +63,7 @@ var require_big = __commonJS({
63
63
  "use strict";
64
64
  (function(GLOBAL) {
65
65
  "use strict";
66
- var Big, DP = 20, RM = 1, MAX_DP = 1e6, MAX_POWER = 1e6, NE = -7, PE = 21, STRICT = false, NAME = "[big.js] ", INVALID = NAME + "Invalid ", INVALID_DP = INVALID + "decimal places", INVALID_RM = INVALID + "rounding mode", DIV_BY_ZERO = NAME + "Division by zero", P4 = {}, UNDEFINED = void 0, NUMERIC = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;
66
+ var Big, DP = 20, RM = 1, MAX_DP = 1e6, MAX_POWER = 1e6, NE = -7, PE = 21, STRICT = false, NAME = "[big.js] ", INVALID = NAME + "Invalid ", INVALID_DP = INVALID + "decimal places", INVALID_RM = INVALID + "rounding mode", DIV_BY_ZERO = NAME + "Division by zero", P3 = {}, UNDEFINED = void 0, NUMERIC = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;
67
67
  function _Big_() {
68
68
  function Big2(n2) {
69
69
  var x2 = this;
@@ -84,7 +84,7 @@ var require_big = __commonJS({
84
84
  }
85
85
  x2.constructor = Big2;
86
86
  }
87
- Big2.prototype = P4;
87
+ Big2.prototype = P3;
88
88
  Big2.DP = DP;
89
89
  Big2.RM = RM;
90
90
  Big2.NE = NE;
@@ -181,12 +181,12 @@ var require_big = __commonJS({
181
181
  }
182
182
  return x2.s < 0 && isNonzero ? "-" + s2 : s2;
183
183
  }
184
- P4.abs = function() {
184
+ P3.abs = function() {
185
185
  var x2 = new this.constructor(this);
186
186
  x2.s = 1;
187
187
  return x2;
188
188
  };
189
- P4.cmp = function(y2) {
189
+ P3.cmp = function(y2) {
190
190
  var isneg, x2 = this, xc = x2.c, yc = (y2 = new x2.constructor(y2)).c, i2 = x2.s, j2 = y2.s, k2 = x2.e, l2 = y2.e;
191
191
  if (!xc[0] || !yc[0])
192
192
  return !xc[0] ? !yc[0] ? 0 : -j2 : i2;
@@ -202,7 +202,7 @@ var require_big = __commonJS({
202
202
  }
203
203
  return k2 == l2 ? 0 : k2 > l2 ^ isneg ? 1 : -1;
204
204
  };
205
- P4.div = function(y2) {
205
+ P3.div = function(y2) {
206
206
  var x2 = this, Big2 = x2.constructor, a2 = x2.c, b2 = (y2 = new Big2(y2)).c, k2 = x2.s == y2.s ? 1 : -1, dp = Big2.DP;
207
207
  if (dp !== ~~dp || dp < 0 || dp > MAX_DP) {
208
208
  throw Error(INVALID_DP);
@@ -265,22 +265,22 @@ var require_big = __commonJS({
265
265
  round(q2, p, Big2.RM, r2[0] !== UNDEFINED);
266
266
  return q2;
267
267
  };
268
- P4.eq = function(y2) {
268
+ P3.eq = function(y2) {
269
269
  return this.cmp(y2) === 0;
270
270
  };
271
- P4.gt = function(y2) {
271
+ P3.gt = function(y2) {
272
272
  return this.cmp(y2) > 0;
273
273
  };
274
- P4.gte = function(y2) {
274
+ P3.gte = function(y2) {
275
275
  return this.cmp(y2) > -1;
276
276
  };
277
- P4.lt = function(y2) {
277
+ P3.lt = function(y2) {
278
278
  return this.cmp(y2) < 0;
279
279
  };
280
- P4.lte = function(y2) {
280
+ P3.lte = function(y2) {
281
281
  return this.cmp(y2) < 1;
282
282
  };
283
- P4.minus = P4.sub = function(y2) {
283
+ P3.minus = P3.sub = function(y2) {
284
284
  var i2, j2, t2, xlty, x2 = this, Big2 = x2.constructor, a2 = x2.s, b2 = (y2 = new Big2(y2)).s;
285
285
  if (a2 != b2) {
286
286
  y2.s = -b2;
@@ -350,7 +350,7 @@ var require_big = __commonJS({
350
350
  y2.e = ye2;
351
351
  return y2;
352
352
  };
353
- P4.mod = function(y2) {
353
+ P3.mod = function(y2) {
354
354
  var ygtx, x2 = this, Big2 = x2.constructor, a2 = x2.s, b2 = (y2 = new Big2(y2)).s;
355
355
  if (!y2.c[0]) {
356
356
  throw Error(DIV_BY_ZERO);
@@ -369,12 +369,12 @@ var require_big = __commonJS({
369
369
  Big2.RM = b2;
370
370
  return this.minus(x2.times(y2));
371
371
  };
372
- P4.neg = function() {
372
+ P3.neg = function() {
373
373
  var x2 = new this.constructor(this);
374
374
  x2.s = -x2.s;
375
375
  return x2;
376
376
  };
377
- P4.plus = P4.add = function(y2) {
377
+ P3.plus = P3.add = function(y2) {
378
378
  var e2, k2, t2, x2 = this, Big2 = x2.constructor;
379
379
  y2 = new Big2(y2);
380
380
  if (x2.s != y2.s) {
@@ -424,7 +424,7 @@ var require_big = __commonJS({
424
424
  y2.e = ye2;
425
425
  return y2;
426
426
  };
427
- P4.pow = function(n2) {
427
+ P3.pow = function(n2) {
428
428
  var x2 = this, one = new x2.constructor("1"), y2 = one, isneg = n2 < 0;
429
429
  if (n2 !== ~~n2 || n2 < -MAX_POWER || n2 > MAX_POWER) {
430
430
  throw Error(INVALID + "exponent");
@@ -441,13 +441,13 @@ var require_big = __commonJS({
441
441
  }
442
442
  return isneg ? one.div(y2) : y2;
443
443
  };
444
- P4.prec = function(sd, rm) {
444
+ P3.prec = function(sd, rm) {
445
445
  if (sd !== ~~sd || sd < 1 || sd > MAX_DP) {
446
446
  throw Error(INVALID + "precision");
447
447
  }
448
448
  return round(new this.constructor(this), sd, rm);
449
449
  };
450
- P4.round = function(dp, rm) {
450
+ P3.round = function(dp, rm) {
451
451
  if (dp === UNDEFINED)
452
452
  dp = 0;
453
453
  else if (dp !== ~~dp || dp < -MAX_DP || dp > MAX_DP) {
@@ -455,7 +455,7 @@ var require_big = __commonJS({
455
455
  }
456
456
  return round(new this.constructor(this), dp + this.e + 1, rm);
457
457
  };
458
- P4.sqrt = function() {
458
+ P3.sqrt = function() {
459
459
  var r2, c2, t2, x2 = this, Big2 = x2.constructor, s2 = x2.s, e2 = x2.e, half = new Big2("0.5");
460
460
  if (!x2.c[0])
461
461
  return new Big2(x2);
@@ -480,7 +480,7 @@ var require_big = __commonJS({
480
480
  } while (t2.c.slice(0, e2).join("") !== r2.c.slice(0, e2).join(""));
481
481
  return round(r2, (Big2.DP -= 4) + r2.e + 1, Big2.RM);
482
482
  };
483
- P4.times = P4.mul = function(y2) {
483
+ P3.times = P3.mul = function(y2) {
484
484
  var c2, x2 = this, Big2 = x2.constructor, xc = x2.c, yc = (y2 = new Big2(y2)).c, a2 = xc.length, b2 = yc.length, i2 = x2.e, j2 = y2.e;
485
485
  y2.s = x2.s == y2.s ? 1 : -1;
486
486
  if (!xc[0] || !yc[0]) {
@@ -516,7 +516,7 @@ var require_big = __commonJS({
516
516
  y2.c = c2;
517
517
  return y2;
518
518
  };
519
- P4.toExponential = function(dp, rm) {
519
+ P3.toExponential = function(dp, rm) {
520
520
  var x2 = this, n2 = x2.c[0];
521
521
  if (dp !== UNDEFINED) {
522
522
  if (dp !== ~~dp || dp < 0 || dp > MAX_DP) {
@@ -528,7 +528,7 @@ var require_big = __commonJS({
528
528
  }
529
529
  return stringify(x2, true, !!n2);
530
530
  };
531
- P4.toFixed = function(dp, rm) {
531
+ P3.toFixed = function(dp, rm) {
532
532
  var x2 = this, n2 = x2.c[0];
533
533
  if (dp !== UNDEFINED) {
534
534
  if (dp !== ~~dp || dp < 0 || dp > MAX_DP) {
@@ -540,18 +540,18 @@ var require_big = __commonJS({
540
540
  }
541
541
  return stringify(x2, false, !!n2);
542
542
  };
543
- P4.toJSON = P4.toString = function() {
543
+ P3.toJSON = P3.toString = function() {
544
544
  var x2 = this, Big2 = x2.constructor;
545
545
  return stringify(x2, x2.e <= Big2.NE || x2.e >= Big2.PE, !!x2.c[0]);
546
546
  };
547
- P4.toNumber = function() {
547
+ P3.toNumber = function() {
548
548
  var n2 = +stringify(this, true, true);
549
549
  if (this.constructor.strict === true && !this.eq(n2.toString())) {
550
550
  throw Error(NAME + "Imprecise conversion");
551
551
  }
552
552
  return n2;
553
553
  };
554
- P4.toPrecision = function(sd, rm) {
554
+ P3.toPrecision = function(sd, rm) {
555
555
  var x2 = this, Big2 = x2.constructor, n2 = x2.c[0];
556
556
  if (sd !== UNDEFINED) {
557
557
  if (sd !== ~~sd || sd < 1 || sd > MAX_DP) {
@@ -563,7 +563,7 @@ var require_big = __commonJS({
563
563
  }
564
564
  return stringify(x2, sd <= x2.e || x2.e <= Big2.NE || x2.e >= Big2.PE, !!n2);
565
565
  };
566
- P4.valueOf = function() {
566
+ P3.valueOf = function() {
567
567
  var x2 = this, Big2 = x2.constructor;
568
568
  if (Big2.strict === true) {
569
569
  throw Error(NAME + "valueOf disallowed");
@@ -1873,13 +1873,13 @@ var require_GetFallbackLocaleList = __commonJS({
1873
1873
  var require_GetTranslationsFromLocale = __commonJS({
1874
1874
  "../../node_modules/@procore/globalization-toolkit/dist/getTranslationsFromLocale/GetTranslationsFromLocale.js"(exports2) {
1875
1875
  "use strict";
1876
- var __awaiter = exports2 && exports2.__awaiter || function(thisArg, _arguments, P4, generator) {
1876
+ var __awaiter = exports2 && exports2.__awaiter || function(thisArg, _arguments, P3, generator) {
1877
1877
  function adopt(value) {
1878
- return value instanceof P4 ? value : new P4(function(resolve) {
1878
+ return value instanceof P3 ? value : new P3(function(resolve) {
1879
1879
  resolve(value);
1880
1880
  });
1881
1881
  }
1882
- return new (P4 || (P4 = Promise))(function(resolve, reject) {
1882
+ return new (P3 || (P3 = Promise))(function(resolve, reject) {
1883
1883
  function fulfilled(value) {
1884
1884
  try {
1885
1885
  step(generator.next(value));
@@ -2011,9 +2011,9 @@ var require_dist = __commonJS({
2011
2011
  }
2012
2012
  });
2013
2013
 
2014
- // ../../node_modules/styled-components/node_modules/react-is/cjs/react-is.production.min.js
2014
+ // node_modules/react-is/cjs/react-is.production.min.js
2015
2015
  var require_react_is_production_min = __commonJS({
2016
- "../../node_modules/styled-components/node_modules/react-is/cjs/react-is.production.min.js"(exports2) {
2016
+ "node_modules/react-is/cjs/react-is.production.min.js"(exports2) {
2017
2017
  "use strict";
2018
2018
  var b2 = 60103;
2019
2019
  var c2 = 60106;
@@ -2149,9 +2149,9 @@ var require_react_is_production_min = __commonJS({
2149
2149
  }
2150
2150
  });
2151
2151
 
2152
- // ../../node_modules/styled-components/node_modules/react-is/cjs/react-is.development.js
2152
+ // node_modules/react-is/cjs/react-is.development.js
2153
2153
  var require_react_is_development = __commonJS({
2154
- "../../node_modules/styled-components/node_modules/react-is/cjs/react-is.development.js"(exports2) {
2154
+ "node_modules/react-is/cjs/react-is.development.js"(exports2) {
2155
2155
  "use strict";
2156
2156
  if (process.env.NODE_ENV !== "production") {
2157
2157
  (function() {
@@ -2341,9 +2341,9 @@ var require_react_is_development = __commonJS({
2341
2341
  }
2342
2342
  });
2343
2343
 
2344
- // ../../node_modules/styled-components/node_modules/react-is/index.js
2344
+ // node_modules/react-is/index.js
2345
2345
  var require_react_is = __commonJS({
2346
- "../../node_modules/styled-components/node_modules/react-is/index.js"(exports2, module2) {
2346
+ "node_modules/react-is/index.js"(exports2, module2) {
2347
2347
  "use strict";
2348
2348
  if (process.env.NODE_ENV === "production") {
2349
2349
  module2.exports = require_react_is_production_min();
@@ -8467,18 +8467,17 @@ var src_exports = {};
8467
8467
  __export(src_exports, {
8468
8468
  DataTableSavedViews: () => DataTableSavedViews,
8469
8469
  ExpandedPanel: () => ExpandedPanel,
8470
- FormModal: () => FormModal,
8471
8470
  PanelContent: () => PanelContent,
8472
8471
  SavedViewCollectionMenuItem: () => SavedViewCollectionMenuItem,
8473
- SavedViews: () => SavedViews,
8474
8472
  SavedViewsDeleteConfirmationModalShared: () => SavedViewsDeleteConfirmationModalShared,
8473
+ SavedViewsFormModal: () => SavedViewsFormModal,
8475
8474
  SmartGridSavedViews: () => SmartGridSavedViews,
8476
8475
  getTranslations: () => getTranslations,
8477
8476
  useSavedViewsPanel: () => useSavedViewsPanel_default
8478
8477
  });
8479
8478
  module.exports = __toCommonJS(src_exports);
8480
8479
 
8481
- // src/utils/translations/translations.ts
8480
+ // src/utils/Translations/translations.ts
8482
8481
  var import_globalization_toolkit = __toESM(require_dist());
8483
8482
 
8484
8483
  // src/locales/de-DE.json
@@ -8808,12 +8807,7 @@ var en_default = {
8808
8807
  create: "Create",
8809
8808
  edit: "Edit",
8810
8809
  cancel: "Cancel",
8811
- close: "Close",
8812
- viewTemporarily: "View Temporarily",
8813
- createView: "Create View",
8814
- copyShareLink: "Copy Share Link",
8815
- linkCopied: "Share link copied to clipboard",
8816
- clearTemporary: "Remove"
8810
+ close: "Close"
8817
8811
  },
8818
8812
  modal: {
8819
8813
  edit: {
@@ -8826,9 +8820,6 @@ var en_default = {
8826
8820
  headline: "Delete Saved View",
8827
8821
  description: "This view cannot be restored once it has been deleted."
8828
8822
  },
8829
- copyConfirmation: {
8830
- description: "You pasted a link to a saved view that does not yet exist for you.\nYou can create it as a personal saved view or just view it\ntemporarily."
8831
- },
8832
8823
  fields: {
8833
8824
  name: "Name",
8834
8825
  description: "Description",
@@ -8861,25 +8852,16 @@ var en_default = {
8861
8852
  update: {
8862
8853
  success: "The saved view was successfully updated."
8863
8854
  },
8864
- create: {
8865
- success: "The saved view was successfully created."
8866
- },
8867
- copy: {
8868
- success: "The link was successfully created and copied to the clipboard."
8869
- },
8870
8855
  errors: {
8871
8856
  fetch: "Sorry, the saved views couldn't be fetched. Try again.",
8872
8857
  create: "Sorry, the saved view couldn't be created. Try again.",
8873
8858
  update: "Sorry, the saved view couldn't be updated. Try again.",
8874
- delete: "Sorry, the saved view couldn't be deleted. Try again.",
8875
- copyFailed: "Failed to copy share link to clipboard",
8876
- notFound: "Sorry, the saved view could not be found. Please try again."
8859
+ delete: "Sorry, the saved view couldn't be deleted. Try again."
8877
8860
  },
8878
8861
  defaultViewTitle: {
8879
8862
  rfi: "All RFIs",
8880
8863
  submittal_log: "All Submittals"
8881
8864
  },
8882
- temporaryViewName: "Temporary View",
8883
8865
  viewLevel: {
8884
8866
  company: "Company Views",
8885
8867
  project: "Project Views",
@@ -9278,84 +9260,6 @@ var is_IS_default = {
9278
9260
  }
9279
9261
  };
9280
9262
 
9281
- // src/locales/it-IT.json
9282
- var it_IT_default = {
9283
- savedViews: {
9284
- name: "Vista salvata",
9285
- title: "Viste salvate",
9286
- tooltip: "Creare e salvare qualsiasi layout di tabella personalizzato per tornare rapidamente alla vista preferita.",
9287
- button: {
9288
- title: "Viste"
9289
- },
9290
- actions: {
9291
- update: "Aggiorna",
9292
- delete: "Elimina",
9293
- create: "Crea",
9294
- edit: "Modifica",
9295
- cancel: "Annulla",
9296
- close: "Chiudi"
9297
- },
9298
- modal: {
9299
- edit: {
9300
- title: "Aggiorna vista salvata"
9301
- },
9302
- create: {
9303
- title: "Crea vista salvata"
9304
- },
9305
- delete: {
9306
- headline: "Elimina vista salvata",
9307
- description: "Una volta eliminata, non sar\xE0 pi\xF9 possibile ripristinare la vista."
9308
- },
9309
- fields: {
9310
- name: "Nome",
9311
- description: "Descrizione",
9312
- viewLevel: "Livello vista",
9313
- viewLevels: {
9314
- company: "Vista dell'azienda",
9315
- project: "Vista del progetto",
9316
- personal: "Vista personale"
9317
- }
9318
- },
9319
- errors: {
9320
- maxLengthName: "Non pu\xF2 contenere pi\xF9 di {{maxLength}} caratteri.",
9321
- required: "Il campo non pu\xF2 essere vuoto.",
9322
- duplicateName: "Esiste gi\xE0 una vista salvata con questo nome. Rinominarla e riprovare.",
9323
- unknown: "Si \xE8 verificato un errore. Riprovare.",
9324
- title: "Impossibile {{mode}} questa vista salvata",
9325
- description: {
9326
- create: "Correggere gli errori di seguito e provare a creare di nuovo",
9327
- update: "Correggere gli errori di seguito e provare ad aggiornare di nuovo"
9328
- }
9329
- },
9330
- info: {
9331
- required_fields: "campi obbligatori"
9332
- }
9333
- },
9334
- ariaLabels: {
9335
- menuItem: "Voce di menu Viste salvate {{name}}",
9336
- modal: "Finestra modale per creare/aggiornare viste salvate"
9337
- },
9338
- update: {
9339
- success: "Vista salvata aggiornata correttamente."
9340
- },
9341
- errors: {
9342
- fetch: "Impossibile recuperare le viste salvate. Riprovare.",
9343
- create: "Impossibile creare la vista salvata. Riprovare.",
9344
- update: "Impossibile aggiornare la vista salvata. Riprovare.",
9345
- delete: "Impossibile eliminare la vista salvata. Riprovare."
9346
- },
9347
- defaultViewTitle: {
9348
- rfi: "Tutte le RDI",
9349
- submittal_log: "Tutti gli elementi da inoltrare"
9350
- },
9351
- viewLevel: {
9352
- company: "Viste dell'azienda",
9353
- project: "Viste del progetto",
9354
- personal: "Viste personali"
9355
- }
9356
- }
9357
- };
9358
-
9359
9263
  // src/locales/ja-JP.json
9360
9264
  var ja_JP_default = {
9361
9265
  savedViews: {
@@ -9746,8 +9650,8 @@ var zh_SG_default = {
9746
9650
  }
9747
9651
  };
9748
9652
 
9749
- // src/locales/index.ts
9750
- var locales_default = {
9653
+ // src/utils/Translations/translations.ts
9654
+ var supportedLocales = {
9751
9655
  "de-DE": de_DE_default,
9752
9656
  "en-AU": en_AU_default,
9753
9657
  "en-CA": en_CA_default,
@@ -9758,18 +9662,12 @@ var locales_default = {
9758
9662
  "fr-CA": fr_CA_default,
9759
9663
  "fr-FR": fr_FR_default,
9760
9664
  "is-IS": is_IS_default,
9761
- "it-IT": it_IT_default,
9762
9665
  "ja-JP": ja_JP_default,
9763
- "pl-PL": pl_PL_default,
9764
9666
  "pt-BR": pt_BR_default,
9765
9667
  "th-TH": th_TH_default,
9766
- "zh-SG": zh_SG_default
9767
- };
9768
-
9769
- // src/utils/translations/translations.ts
9770
- var supportedLocales = {
9771
- ...locales_default,
9772
- pseudo: locales_default.en
9668
+ "zh-SG": zh_SG_default,
9669
+ "pl-PL": pl_PL_default,
9670
+ pseudo: en_default
9773
9671
  };
9774
9672
  function getTranslations(envLocale) {
9775
9673
  return Object.fromEntries(
@@ -9780,7 +9678,7 @@ function getTranslations(envLocale) {
9780
9678
  );
9781
9679
  }
9782
9680
 
9783
- // src/components/buttons/useSavedViewsPanel.tsx
9681
+ // src/SavedViews/components/Buttons/useSavedViewsPanel.tsx
9784
9682
  var import_react4 = require("react");
9785
9683
 
9786
9684
  // ../../node_modules/tslib/tslib.es6.mjs
@@ -9809,7 +9707,7 @@ function __rest(s2, e2) {
9809
9707
  return t2;
9810
9708
  }
9811
9709
 
9812
- // node_modules/@procore/core-icons/dist/Icon.js
9710
+ // ../../node_modules/@procore/core-icons/dist/Icon.js
9813
9711
  var React = __toESM(require("react"));
9814
9712
  function getSize(size) {
9815
9713
  if (size === "sm") {
@@ -9828,7 +9726,7 @@ function Icon(_a) {
9828
9726
  return React.isValidElement(children) ? React.cloneElement(children, __assign(__assign({ "aria-hidden": true, "data-qa": "ci-".concat(props.name) }, props), { width: getSize(props.size), height: getSize(props.size), focusable: false, style: __assign(__assign({}, props.style), { flex: "0 0 auto" }) })) : null;
9829
9727
  }
9830
9728
 
9831
- // node_modules/@procore/core-icons/dist/icons/Building.js
9729
+ // ../../node_modules/@procore/core-icons/dist/icons/Building.js
9832
9730
  var React2 = __toESM(require("react"));
9833
9731
  var Building = React2.forwardRef(function Building2(props, ref) {
9834
9732
  return React2.createElement(
@@ -9844,7 +9742,7 @@ var Building = React2.forwardRef(function Building2(props, ref) {
9844
9742
  Building.displayName = "Building";
9845
9743
  var Building_default = Building;
9846
9744
 
9847
- // node_modules/@procore/core-icons/dist/icons/ChevronDown.js
9745
+ // ../../node_modules/@procore/core-icons/dist/icons/ChevronDown.js
9848
9746
  var React3 = __toESM(require("react"));
9849
9747
  var ChevronDown = React3.forwardRef(function ChevronDown2(props, ref) {
9850
9748
  return React3.createElement(
@@ -9860,7 +9758,7 @@ var ChevronDown = React3.forwardRef(function ChevronDown2(props, ref) {
9860
9758
  ChevronDown.displayName = "ChevronDown";
9861
9759
  var ChevronDown_default = ChevronDown;
9862
9760
 
9863
- // node_modules/@procore/core-icons/dist/icons/ChevronRight.js
9761
+ // ../../node_modules/@procore/core-icons/dist/icons/ChevronRight.js
9864
9762
  var React4 = __toESM(require("react"));
9865
9763
  var ChevronRight = React4.forwardRef(function ChevronRight2(props, ref) {
9866
9764
  return React4.createElement(
@@ -9876,127 +9774,94 @@ var ChevronRight = React4.forwardRef(function ChevronRight2(props, ref) {
9876
9774
  ChevronRight.displayName = "ChevronRight";
9877
9775
  var ChevronRight_default = ChevronRight;
9878
9776
 
9879
- // node_modules/@procore/core-icons/dist/icons/Clear.js
9777
+ // ../../node_modules/@procore/core-icons/dist/icons/Excavator.js
9880
9778
  var React5 = __toESM(require("react"));
9881
- var Clear = React5.forwardRef(function Clear2(props, ref) {
9779
+ var Excavator = React5.forwardRef(function Excavator2(props, ref) {
9882
9780
  return React5.createElement(
9883
- Icon,
9884
- __assign({}, props, { name: "Clear" }),
9885
- React5.createElement(
9886
- "svg",
9887
- { width: "24", height: "24", viewBox: "0 0 24 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ref },
9888
- React5.createElement("path", { d: "M14.3686 12.0003L21.0003 5.36856L18.6317 3L12 9.63169L5.36856 3.00025L3 5.36881L9.63144 12.0003L3 18.6317L5.36856 21.0003L12 14.3688L18.6317 21.0005L21.0003 18.6319L14.3686 12.0003Z", fill: "currentColor" })
9889
- )
9890
- );
9891
- });
9892
- Clear.displayName = "Clear";
9893
- var Clear_default = Clear;
9894
-
9895
- // node_modules/@procore/core-icons/dist/icons/Excavator.js
9896
- var React6 = __toESM(require("react"));
9897
- var Excavator = React6.forwardRef(function Excavator2(props, ref) {
9898
- return React6.createElement(
9899
9781
  Icon,
9900
9782
  __assign({}, props, { name: "Excavator" }),
9901
- React6.createElement(
9783
+ React5.createElement(
9902
9784
  "svg",
9903
9785
  { width: "24", height: "24", viewBox: "0 0 24 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ref },
9904
- React6.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M5.54979 2H8.26065L11.4955 8H17.5V12.5L20 14.5V16H9.5V8.5L7.27126 3.72125H6.64878L3.82536 10.525H7.55556L6.32099 13.9675H2V10.525V10.5L5.54979 2ZM15.3333 10.0325H12V12.3275H15.3333V10.0325Z", fill: "currentColor" }),
9905
- React6.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M7.55556 19.705C7.55556 18.4375 8.55048 17.41 9.77778 17.41H19.7778C21.0051 17.41 22 18.4375 22 19.705C22 20.9725 21.0051 22 19.7778 22H9.77778C8.55048 22 7.55556 20.9725 7.55556 19.705ZM10.6111 20.4844C11.0713 20.4844 11.4444 20.0991 11.4444 19.6238C11.4444 19.1484 11.0713 18.7631 10.6111 18.7631C10.1509 18.7631 9.77778 19.1484 9.77778 19.6238C9.77778 20.0991 10.1509 20.4844 10.6111 20.4844ZM14.2222 19.6238C14.2222 20.0991 13.8491 20.4844 13.3889 20.4844C12.9287 20.4844 12.5556 20.0991 12.5556 19.6238C12.5556 19.1484 12.9287 18.7631 13.3889 18.7631C13.8491 18.7631 14.2222 19.1484 14.2222 19.6238ZM16.1667 20.4844C16.6269 20.4844 17 20.0991 17 19.6238C17 19.1484 16.6269 18.7631 16.1667 18.7631C15.7064 18.7631 15.3333 19.1484 15.3333 19.6238C15.3333 20.0991 15.7064 20.4844 16.1667 20.4844ZM19.7778 19.6238C19.7778 20.0991 19.4047 20.4844 18.9444 20.4844C18.4842 20.4844 18.1111 20.0991 18.1111 19.6238C18.1111 19.1484 18.4842 18.7631 18.9444 18.7631C19.4047 18.7631 19.7778 19.1484 19.7778 19.6238Z", fill: "currentColor" })
9786
+ React5.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M5.54979 2H8.26065L11.4955 8H17.5V12.5L20 14.5V16H9.5V8.5L7.27126 3.72125H6.64878L3.82536 10.525H7.55556L6.32099 13.9675H2V10.525V10.5L5.54979 2ZM15.3333 10.0325H12V12.3275H15.3333V10.0325Z", fill: "currentColor" }),
9787
+ React5.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M7.55556 19.705C7.55556 18.4375 8.55048 17.41 9.77778 17.41H19.7778C21.0051 17.41 22 18.4375 22 19.705C22 20.9725 21.0051 22 19.7778 22H9.77778C8.55048 22 7.55556 20.9725 7.55556 19.705ZM10.6111 20.4844C11.0713 20.4844 11.4444 20.0991 11.4444 19.6238C11.4444 19.1484 11.0713 18.7631 10.6111 18.7631C10.1509 18.7631 9.77778 19.1484 9.77778 19.6238C9.77778 20.0991 10.1509 20.4844 10.6111 20.4844ZM14.2222 19.6238C14.2222 20.0991 13.8491 20.4844 13.3889 20.4844C12.9287 20.4844 12.5556 20.0991 12.5556 19.6238C12.5556 19.1484 12.9287 18.7631 13.3889 18.7631C13.8491 18.7631 14.2222 19.1484 14.2222 19.6238ZM16.1667 20.4844C16.6269 20.4844 17 20.0991 17 19.6238C17 19.1484 16.6269 18.7631 16.1667 18.7631C15.7064 18.7631 15.3333 19.1484 15.3333 19.6238C15.3333 20.0991 15.7064 20.4844 16.1667 20.4844ZM19.7778 19.6238C19.7778 20.0991 19.4047 20.4844 18.9444 20.4844C18.4842 20.4844 18.1111 20.0991 18.1111 19.6238C18.1111 19.1484 18.4842 18.7631 18.9444 18.7631C19.4047 18.7631 19.7778 19.1484 19.7778 19.6238Z", fill: "currentColor" })
9906
9788
  )
9907
9789
  );
9908
9790
  });
9909
9791
  Excavator.displayName = "Excavator";
9910
9792
  var Excavator_default = Excavator;
9911
9793
 
9912
- // node_modules/@procore/core-icons/dist/icons/ExpandSidebar.js
9913
- var React7 = __toESM(require("react"));
9914
- var ExpandSidebar = React7.forwardRef(function ExpandSidebar2(props, ref) {
9915
- return React7.createElement(
9794
+ // ../../node_modules/@procore/core-icons/dist/icons/ExpandSidebar.js
9795
+ var React6 = __toESM(require("react"));
9796
+ var ExpandSidebar = React6.forwardRef(function ExpandSidebar2(props, ref) {
9797
+ return React6.createElement(
9916
9798
  Icon,
9917
9799
  __assign({}, props, { name: "ExpandSidebar" }),
9918
- React7.createElement(
9800
+ React6.createElement(
9919
9801
  "svg",
9920
9802
  { width: "24", height: "24", viewBox: "0 0 24 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ref },
9921
- React7.createElement("path", { d: "M3 6.5H11V9H3V6.5Z", fill: "currentColor" }),
9922
- React7.createElement("path", { d: "M3 15H11V17.5H3V15Z", fill: "currentColor" }),
9923
- React7.createElement("path", { d: "M16.2319 13.25H3V10.75H16.2336L12.2665 6.78227L14.0344 5.01465L21.0179 11.9993L14.034 18.9839L12.2661 17.2162L16.2319 13.25Z", fill: "currentColor" })
9803
+ React6.createElement("path", { d: "M3 6.5H11V9H3V6.5Z", fill: "currentColor" }),
9804
+ React6.createElement("path", { d: "M3 15H11V17.5H3V15Z", fill: "currentColor" }),
9805
+ React6.createElement("path", { d: "M16.2319 13.25H3V10.75H16.2336L12.2665 6.78227L14.0344 5.01465L21.0179 11.9993L14.034 18.9839L12.2661 17.2162L16.2319 13.25Z", fill: "currentColor" })
9924
9806
  )
9925
9807
  );
9926
9808
  });
9927
9809
  ExpandSidebar.displayName = "ExpandSidebar";
9928
9810
  var ExpandSidebar_default = ExpandSidebar;
9929
9811
 
9930
- // node_modules/@procore/core-icons/dist/icons/Help.js
9931
- var React8 = __toESM(require("react"));
9932
- var Help = React8.forwardRef(function Help2(props, ref) {
9933
- return React8.createElement(
9812
+ // ../../node_modules/@procore/core-icons/dist/icons/Help.js
9813
+ var React7 = __toESM(require("react"));
9814
+ var Help = React7.forwardRef(function Help2(props, ref) {
9815
+ return React7.createElement(
9934
9816
  Icon,
9935
9817
  __assign({}, props, { name: "Help" }),
9936
- React8.createElement(
9818
+ React7.createElement(
9937
9819
  "svg",
9938
9820
  { width: "24", height: "24", viewBox: "0 0 24 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ref },
9939
- React8.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M22.5 12C22.5 17.799 17.799 22.5 12 22.5C6.20101 22.5 1.5 17.799 1.5 12C1.5 6.20101 6.20101 1.5 12 1.5C17.799 1.5 22.5 6.20101 22.5 12ZM10.5263 7.95937C10.2808 8.36033 10.1916 8.91994 10.1916 9.37657H7.5C7.5 8.66165 7.62111 7.4859 8.25879 6.44439C8.95769 5.30289 10.172 4.5 11.9579 4.5C13.5589 4.5 14.7796 4.98286 15.5728 5.91817C16.3382 6.82071 16.5 7.90665 16.5 8.67364C16.5 10.8341 15.0595 12.1455 13.8423 12.7536C13.5724 12.8885 13.381 13.0989 13.2617 13.2697V14.25H10.5701V13.1798C10.5701 12.8171 10.6368 12.3478 10.903 11.8984C11.162 11.4612 11.7165 10.699 12.681 10.2171C13.3984 9.85866 13.8084 9.32492 13.8084 8.67364C13.8084 8.26908 13.7179 7.97113 13.5581 7.78266C13.426 7.62697 13.0486 7.31172 11.9579 7.31172C11.0523 7.31172 10.7105 7.65841 10.5263 7.95937ZM11.954 19.5059C12.925 19.5059 13.7121 18.7187 13.7121 17.7477C13.7121 16.7767 12.925 15.9895 11.954 15.9895C10.9829 15.9895 10.1958 16.7767 10.1958 17.7477C10.1958 18.7187 10.9829 19.5059 11.954 19.5059Z", fill: "currentColor" })
9821
+ React7.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M22.5 12C22.5 17.799 17.799 22.5 12 22.5C6.20101 22.5 1.5 17.799 1.5 12C1.5 6.20101 6.20101 1.5 12 1.5C17.799 1.5 22.5 6.20101 22.5 12ZM10.5263 7.95937C10.2808 8.36033 10.1916 8.91994 10.1916 9.37657H7.5C7.5 8.66165 7.62111 7.4859 8.25879 6.44439C8.95769 5.30289 10.172 4.5 11.9579 4.5C13.5589 4.5 14.7796 4.98286 15.5728 5.91817C16.3382 6.82071 16.5 7.90665 16.5 8.67364C16.5 10.8341 15.0595 12.1455 13.8423 12.7536C13.5724 12.8885 13.381 13.0989 13.2617 13.2697V14.25H10.5701V13.1798C10.5701 12.8171 10.6368 12.3478 10.903 11.8984C11.162 11.4612 11.7165 10.699 12.681 10.2171C13.3984 9.85866 13.8084 9.32492 13.8084 8.67364C13.8084 8.26908 13.7179 7.97113 13.5581 7.78266C13.426 7.62697 13.0486 7.31172 11.9579 7.31172C11.0523 7.31172 10.7105 7.65841 10.5263 7.95937ZM11.954 19.5059C12.925 19.5059 13.7121 18.7187 13.7121 17.7477C13.7121 16.7767 12.925 15.9895 11.954 15.9895C10.9829 15.9895 10.1958 16.7767 10.1958 17.7477C10.1958 18.7187 10.9829 19.5059 11.954 19.5059Z", fill: "currentColor" })
9940
9822
  )
9941
9823
  );
9942
9824
  });
9943
9825
  Help.displayName = "Help";
9944
9826
  var Help_default = Help;
9945
9827
 
9946
- // node_modules/@procore/core-icons/dist/icons/Link.js
9947
- var React9 = __toESM(require("react"));
9948
- var Link = React9.forwardRef(function Link2(props, ref) {
9949
- return React9.createElement(
9950
- Icon,
9951
- __assign({}, props, { name: "Link" }),
9952
- React9.createElement(
9953
- "svg",
9954
- { width: "24", height: "24", viewBox: "0 0 24 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ref },
9955
- React9.createElement("path", { d: "M6.01273 13.106C6.21565 9.97594 8.81868 7.5 12 7.5H13.5V10.5L12 10.5C10.3431 10.5 9 11.8431 9 13.5L9 16.5C9 18.1569 10.3431 19.5 12 19.5H16.5C18.1569 19.5 19.5 18.1569 19.5 16.5L19.5 8.30269C21.2934 9.34012 22.5 11.2792 22.5 13.5V16.5C22.5 19.8137 19.8137 22.5 16.5 22.5H12C8.68629 22.5 6 19.8137 6 16.5L6 13.0987L6.01273 13.106Z", fill: "currentColor" }),
9956
- React9.createElement("path", { d: "M15 10.5C15 10.501 15 10.502 15 10.503V10.5269C14.9854 12.1712 13.6478 13.5 12 13.5L10.5 13.5V16.5H12C15.1813 16.5 17.7844 14.0241 17.9873 10.894L18.0086 10.9064L18.0001 10.8343L18 7.5C18 4.18629 15.3137 1.5 12 1.5H7.5C4.18629 1.5 1.5 4.18629 1.5 7.5V10.5C1.5 12.7208 2.7066 14.6599 4.5 15.6973L4.5 7.5C4.5 5.84315 5.84315 4.5 7.5 4.5L12 4.5C13.6569 4.5 15 5.84315 15 7.5H14.9867L15 7.52707L15 10.5Z", fill: "currentColor" })
9957
- )
9958
- );
9959
- });
9960
- Link.displayName = "Link";
9961
- var Link_default = Link;
9962
-
9963
- // node_modules/@procore/core-icons/dist/icons/Person.js
9964
- var React10 = __toESM(require("react"));
9965
- var Person = React10.forwardRef(function Person2(props, ref) {
9966
- return React10.createElement(
9828
+ // ../../node_modules/@procore/core-icons/dist/icons/Person.js
9829
+ var React8 = __toESM(require("react"));
9830
+ var Person = React8.forwardRef(function Person2(props, ref) {
9831
+ return React8.createElement(
9967
9832
  Icon,
9968
9833
  __assign({}, props, { name: "Person" }),
9969
- React10.createElement(
9834
+ React8.createElement(
9970
9835
  "svg",
9971
9836
  { width: "24", height: "24", viewBox: "0 0 24 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ref },
9972
- React10.createElement("path", { d: "M12 12C14.21 12 16 10.21 16 8C16 5.79 14.21 4 12 4C9.79 4 8 5.79 8 8C8 10.21 9.79 12 12 12ZM12 14C9.33 14 4 15.34 4 18V20H20V18C20 15.34 14.67 14 12 14Z", fill: "currentColor" })
9837
+ React8.createElement("path", { d: "M12 12C14.21 12 16 10.21 16 8C16 5.79 14.21 4 12 4C9.79 4 8 5.79 8 8C8 10.21 9.79 12 12 12ZM12 14C9.33 14 4 15.34 4 18V20H20V18C20 15.34 14.67 14 12 14Z", fill: "currentColor" })
9973
9838
  )
9974
9839
  );
9975
9840
  });
9976
9841
  Person.displayName = "Person";
9977
9842
  var Person_default = Person;
9978
9843
 
9979
- // node_modules/@procore/core-icons/dist/icons/Plus.js
9980
- var React11 = __toESM(require("react"));
9981
- var Plus = React11.forwardRef(function Plus2(props, ref) {
9982
- return React11.createElement(
9844
+ // ../../node_modules/@procore/core-icons/dist/icons/Plus.js
9845
+ var React9 = __toESM(require("react"));
9846
+ var Plus = React9.forwardRef(function Plus2(props, ref) {
9847
+ return React9.createElement(
9983
9848
  Icon,
9984
9849
  __assign({}, props, { name: "Plus" }),
9985
- React11.createElement(
9850
+ React9.createElement(
9986
9851
  "svg",
9987
9852
  { width: "24", height: "24", viewBox: "0 0 24 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ref },
9988
- React11.createElement("path", { d: "M13.25 5H10.75V10.75H5V13.25H10.75V19H13.25V13.25H19V10.75H13.25V5Z", fill: "currentColor" })
9853
+ React9.createElement("path", { d: "M13.25 5H10.75V10.75H5V13.25H10.75V19H13.25V13.25H19V10.75H13.25V5Z", fill: "currentColor" })
9989
9854
  )
9990
9855
  );
9991
9856
  });
9992
9857
  Plus.displayName = "Plus";
9993
9858
  var Plus_default = Plus;
9994
9859
 
9995
- // src/components/buttons/SavedViewsButton.tsx
9860
+ // src/SavedViews/components/Buttons/SavedViewsButton.tsx
9996
9861
  var import_core_react2 = require("@procore/core-react");
9997
9862
  var import_react3 = __toESM(require("react"));
9998
9863
 
9999
- // ../../node_modules/styled-components/dist/styled-components.esm.js
9864
+ // node_modules/styled-components/dist/styled-components.esm.js
10000
9865
  var import_react_is = __toESM(require_react_is());
10001
9866
  var import_react = __toESM(require("react"));
10002
9867
  var import_shallowequal = __toESM(require_shallowequal());
@@ -10131,7 +9996,7 @@ function stylis_min(W2) {
10131
9996
  break;
10132
9997
  }
10133
9998
  default:
10134
- 58 !== f2.charCodeAt(t2 - 1) && (p += P4(f2, q2, g2, f2.charCodeAt(2)));
9999
+ 58 !== f2.charCodeAt(t2 - 1) && (p += P3(f2, q2, g2, f2.charCodeAt(2)));
10135
10000
  }
10136
10001
  I = r2 = u2 = q2 = 0;
10137
10002
  f2 = "";
@@ -10304,7 +10169,7 @@ function stylis_min(W2) {
10304
10169
  }
10305
10170
  return d + c2;
10306
10171
  }
10307
- function P4(d, c2, e2, h) {
10172
+ function P3(d, c2, e2, h) {
10308
10173
  var a2 = d + ";", m2 = 2 * c2 + 3 * e2 + 4 * h;
10309
10174
  if (944 === m2) {
10310
10175
  d = a2.indexOf(":", 9) + 1;
@@ -10411,7 +10276,7 @@ function stylis_min(W2) {
10411
10276
  case 931:
10412
10277
  case 953:
10413
10278
  if (true === la.test(d))
10414
- return 115 === (b2 = d.substring(d.indexOf(":") + 1)).charCodeAt(0) ? P4(d.replace("stretch", "fill-available"), c2, e2, h).replace(":fill-available", ":stretch") : a2.replace(b2, "-webkit-" + b2) + a2.replace(b2, "-moz-" + b2.replace("fill-", "")) + a2;
10279
+ return 115 === (b2 = d.substring(d.indexOf(":") + 1)).charCodeAt(0) ? P3(d.replace("stretch", "fill-available"), c2, e2, h).replace(":fill-available", ":stretch") : a2.replace(b2, "-webkit-" + b2) + a2.replace(b2, "-moz-" + b2.replace("fill-", "")) + a2;
10415
10280
  break;
10416
10281
  case 962:
10417
10282
  if (a2 = "-webkit-" + a2 + (102 === a2.charCodeAt(5) ? "-ms-" + a2 : "") + a2, 211 === e2 + h && 105 === a2.charCodeAt(13) && 0 < a2.indexOf("transform", 10))
@@ -10425,7 +10290,7 @@ function stylis_min(W2) {
10425
10290
  return R2(2 !== c2 ? h : h.replace(na, "$1"), e2, c2);
10426
10291
  }
10427
10292
  function ea(d, c2) {
10428
- var e2 = P4(c2, c2.charCodeAt(0), c2.charCodeAt(1), c2.charCodeAt(2));
10293
+ var e2 = P3(c2, c2.charCodeAt(0), c2.charCodeAt(1), c2.charCodeAt(2));
10429
10294
  return e2 !== c2 + ";" ? e2.replace(oa, " or ($1)").substring(4) : "(" + c2 + ")";
10430
10295
  }
10431
10296
  function H3(d, c2, e2, h, a2, m2, b2, v2, n2, q2) {
@@ -10551,7 +10416,7 @@ function memoize(fn) {
10551
10416
  };
10552
10417
  }
10553
10418
 
10554
- // ../../node_modules/styled-components/node_modules/@emotion/is-prop-valid/dist/emotion-is-prop-valid.esm.js
10419
+ // ../../node_modules/@emotion/is-prop-valid/dist/emotion-is-prop-valid.esm.js
10555
10420
  var reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/;
10556
10421
  var isPropValid = /* @__PURE__ */ memoize(
10557
10422
  function(prop) {
@@ -10560,7 +10425,7 @@ var isPropValid = /* @__PURE__ */ memoize(
10560
10425
  /* Z+1 */
10561
10426
  );
10562
10427
 
10563
- // ../../node_modules/styled-components/dist/styled-components.esm.js
10428
+ // node_modules/styled-components/dist/styled-components.esm.js
10564
10429
  var import_hoist_non_react_statics = __toESM(require_hoist_non_react_statics_cjs());
10565
10430
  function m() {
10566
10431
  return (m = Object.assign || function(e2) {
@@ -11083,7 +10948,7 @@ function Fe(e2, t2, n2) {
11083
10948
  o2 && e2.shouldForwardProp && (N = t2.shouldForwardProp ? function(n3, r2, o3) {
11084
10949
  return e2.shouldForwardProp(n3, r2, o3) && t2.shouldForwardProp(n3, r2, o3);
11085
10950
  } : e2.shouldForwardProp);
11086
- var A2, C2 = new re(n2, v2, o2 ? e2.componentStyle : void 0), I = C2.isStatic && 0 === c2.length, P4 = function(e3, t3) {
10951
+ var A2, C2 = new re(n2, v2, o2 ? e2.componentStyle : void 0), I = C2.isStatic && 0 === c2.length, P3 = function(e3, t3) {
11087
10952
  return function(e4, t4, n3, r2) {
11088
10953
  var o3 = e4.attrs, i3 = e4.componentStyle, a3 = e4.defaultProps, c3 = e4.foldedComponentIds, l3 = e4.shouldForwardProp, d2 = e4.styledComponentId, h2 = e4.target, f2 = function(e5, t5, n4) {
11089
10954
  void 0 === e5 && (e5 = S);
@@ -11102,7 +10967,7 @@ function Fe(e2, t2, n2) {
11102
10967
  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);
11103
10968
  }(A2, e3, t3, I);
11104
10969
  };
11105
- 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) {
10970
+ return P3.displayName = y2, (A2 = import_react.default.forwardRef(P3)).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) {
11106
10971
  var r2 = t2.componentId, o3 = function(e4, t3) {
11107
10972
  if (null == e4)
11108
10973
  return {};
@@ -11207,7 +11072,7 @@ var Ue = function() {
11207
11072
  "production" !== process.env.NODE_ENV && "undefined" != typeof navigator && "ReactNative" === navigator.product && console.warn("It looks like you've imported 'styled-components' on React Native.\nPerhaps you're looking to import 'styled-components/native'?\nRead more about this at https://www.styled-components.com/docs/basics#react-native"), "production" !== process.env.NODE_ENV && "test" !== process.env.NODE_ENV && "undefined" != typeof window && (window["__styled-components-init__"] = window["__styled-components-init__"] || 0, 1 === window["__styled-components-init__"] && console.warn("It looks like there are several instances of 'styled-components' initialized in this application. This may cause dynamic styles to not render properly, errors during the rehydration process, a missing theme prop, and makes your application bigger without good reason.\n\nSee https://s-c.sh/2BAXzed for more info."), window["__styled-components-init__"] += 1);
11208
11073
  var styled_components_esm_default = Ye;
11209
11074
 
11210
- // src/components/EnvironmentI18nProvider.tsx
11075
+ // src/SavedViews/components/EnvironmentI18nProvider.tsx
11211
11076
  var import_react2 = __toESM(require("react"));
11212
11077
  var import_core_react = require("@procore/core-react");
11213
11078
  var import_cdn_translations = require("@procore/cdn-translations");
@@ -11237,7 +11102,7 @@ var EnvironmentI18nProvider = ({ children }) => {
11237
11102
  return /* @__PURE__ */ import_react2.default.createElement(import_core_react.I18nContext.Provider, { value: i18n }, children);
11238
11103
  };
11239
11104
 
11240
- // src/components/buttons/SavedViewsButton.tsx
11105
+ // src/SavedViews/components/Buttons/SavedViewsButton.tsx
11241
11106
  var StyledButton = styled_components_esm_default(import_core_react2.Button)`
11242
11107
  background-color: hsl(218, 75%, 96%);
11243
11108
  color: hsl(218, 75%, 45%);
@@ -11273,7 +11138,7 @@ var SavedViewsButton = ({
11273
11138
  ));
11274
11139
  };
11275
11140
 
11276
- // src/components/buttons/useSavedViewsPanel.tsx
11141
+ // src/SavedViews/components/Buttons/useSavedViewsPanel.tsx
11277
11142
  var import_react5 = __toESM(require("react"));
11278
11143
  var useSavedViewsPanel = (domain, tableName) => {
11279
11144
  const key = (domain2, tableName2) => `savedViewsPanel-${domain2}-${tableName2}`;
@@ -11284,15 +11149,14 @@ var useSavedViewsPanel = (domain, tableName) => {
11284
11149
  setIsOpen(!isOpen);
11285
11150
  localStorage.setItem(key(domain, tableName), JSON.stringify(!isOpen));
11286
11151
  };
11287
- const Button7 = () => /* @__PURE__ */ import_react5.default.createElement(SavedViewsButton, { handleClick, isOpen });
11288
- return { isOpen, SavedViewsButton: Button7 };
11152
+ const Button6 = () => /* @__PURE__ */ import_react5.default.createElement(SavedViewsButton, { handleClick, isOpen });
11153
+ return { isOpen, SavedViewsButton: Button6 };
11289
11154
  };
11290
11155
  var useSavedViewsPanel_default = useSavedViewsPanel;
11291
11156
 
11292
- // src/components/menu-items/SavedViewsCollectionsMenuItem.tsx
11157
+ // src/SavedViews/components/MenuItems/SavedViewsCollectionsMenuItem.tsx
11293
11158
  var import_core_react3 = require("@procore/core-react");
11294
- var React15 = __toESM(require("react"));
11295
- var import_toast_alert = require("@procore/toast-alert");
11159
+ var React13 = __toESM(require("react"));
11296
11160
  var RowActionsBox = styled_components_esm_default(import_core_react3.Flex)`
11297
11161
  justify-content: center;
11298
11162
  align-items: center;
@@ -11307,13 +11171,8 @@ var Container2 = styled_components_esm_default(import_core_react3.Flex)`
11307
11171
 
11308
11172
  ${({ "aria-selected": selected }) => selected ? "color: hsl(218, 75%, 45%);" : ""}
11309
11173
  `;
11310
- var IconWrapper = styled_components_esm_default.span`
11311
- display: flex;
11312
- align-items: center;
11313
- justify-content: center;
11314
- `;
11315
11174
  var SavedViewCollectionMenuItem = (props) => {
11316
- const onClick = React15.useCallback(
11175
+ const onClick = React13.useCallback(
11317
11176
  (a2) => {
11318
11177
  var _a, _b;
11319
11178
  if (!props.item) {
@@ -11337,20 +11196,7 @@ var SavedViewCollectionMenuItem = (props) => {
11337
11196
  event.stopPropagation();
11338
11197
  (_a = props.onUpdate) == null ? void 0 : _a.call(props, props.item);
11339
11198
  };
11340
- const { showToast } = (0, import_toast_alert.useToastAlertContext)();
11341
11199
  const i18n = (0, import_core_react3.useI18nContext)();
11342
- const copyShareLink = async (event) => {
11343
- event.stopPropagation();
11344
- try {
11345
- const { origin, pathname } = window.location;
11346
- const shareUrl = new URL(`${origin}${pathname}`);
11347
- shareUrl.searchParams.set("saved-view", props.item.share_token);
11348
- await navigator.clipboard.writeText(shareUrl.toString());
11349
- showToast.success(i18n.t("savedViews.actions.linkCopied"));
11350
- } catch (error) {
11351
- showToast.error(i18n.t("savedViews.errors.copyFailed"));
11352
- }
11353
- };
11354
11200
  const flyoutMenuOptions = [
11355
11201
  {
11356
11202
  value: "editNameDesc",
@@ -11361,7 +11207,7 @@ var SavedViewCollectionMenuItem = (props) => {
11361
11207
  label: i18n.t("savedViews.actions.delete")
11362
11208
  }
11363
11209
  ];
11364
- return /* @__PURE__ */ React15.createElement(
11210
+ return /* @__PURE__ */ React13.createElement(
11365
11211
  Container2,
11366
11212
  {
11367
11213
  "aria-selected": Boolean(props.selected),
@@ -11372,7 +11218,7 @@ var SavedViewCollectionMenuItem = (props) => {
11372
11218
  }),
11373
11219
  "data-testid": "saved-view-collection-menu-item"
11374
11220
  },
11375
- /* @__PURE__ */ React15.createElement(
11221
+ /* @__PURE__ */ React13.createElement(
11376
11222
  "span",
11377
11223
  {
11378
11224
  "data-testid": "saved-view-display-name",
@@ -11380,7 +11226,7 @@ var SavedViewCollectionMenuItem = (props) => {
11380
11226
  },
11381
11227
  props.item.name
11382
11228
  ),
11383
- /* @__PURE__ */ React15.createElement(RowActionsBox, null, /* @__PURE__ */ React15.createElement(import_core_react3.Box, { justifyContent: "space-between" }, props.item.view_level !== "default" && props.canUpdate && /* @__PURE__ */ React15.createElement("div", null, /* @__PURE__ */ React15.createElement(
11229
+ /* @__PURE__ */ React13.createElement(RowActionsBox, null, /* @__PURE__ */ React13.createElement(import_core_react3.Box, { justifyContent: "space-between" }, props.item.id !== "default" && props.canUpdate && /* @__PURE__ */ React13.createElement("div", null, /* @__PURE__ */ React13.createElement(
11384
11230
  import_core_react3.Button,
11385
11231
  {
11386
11232
  onClick: updateItem,
@@ -11391,32 +11237,7 @@ var SavedViewCollectionMenuItem = (props) => {
11391
11237
  loading: props.isUpdateProcessing
11392
11238
  },
11393
11239
  i18n.t("savedViews.actions.update")
11394
- )), props.item.view_level !== "default" && props.selected && !props.canUpdate && props.item.id !== "temporary" && /* @__PURE__ */ React15.createElement("div", null, /* @__PURE__ */ React15.createElement(
11395
- import_core_react3.Button,
11396
- {
11397
- onClick: copyShareLink,
11398
- variant: "tertiary",
11399
- size: "sm",
11400
- "aria-label": i18n.t("savedViews.actions.copyShareLink"),
11401
- "data-testid": "copy-share-link-button"
11402
- },
11403
- /* @__PURE__ */ React15.createElement(IconWrapper, null, /* @__PURE__ */ React15.createElement(Link_default, { size: "sm" }))
11404
- )), props.item.id === "temporary" && /* @__PURE__ */ React15.createElement("div", null, /* @__PURE__ */ React15.createElement(
11405
- import_core_react3.Button,
11406
- {
11407
- onClick: (e2) => {
11408
- var _a;
11409
- e2.stopPropagation();
11410
- (_a = props.onClearTemporary) == null ? void 0 : _a.call(props);
11411
- },
11412
- variant: "tertiary",
11413
- size: "sm",
11414
- "aria-label": i18n.t("savedViews.actions.clearTemporary"),
11415
- title: i18n.t("savedViews.actions.clearTemporary"),
11416
- "data-testid": "clear-temporary-view-button"
11417
- },
11418
- /* @__PURE__ */ React15.createElement(IconWrapper, null, /* @__PURE__ */ React15.createElement(Clear_default, { size: "sm" }))
11419
- ))), /* @__PURE__ */ React15.createElement(import_core_react3.Box, null, props.item.view_level !== "default" && props.canEditOrDelete && /* @__PURE__ */ React15.createElement("div", { onClick: (e2) => e2.stopPropagation() }, /* @__PURE__ */ React15.createElement(
11240
+ ))), /* @__PURE__ */ React13.createElement(import_core_react3.Box, null, props.item.id !== "default" && props.canEditOrDelete && /* @__PURE__ */ React13.createElement("div", { onClick: (e2) => e2.stopPropagation() }, /* @__PURE__ */ React13.createElement(
11420
11241
  import_core_react3.DropdownFlyout,
11421
11242
  {
11422
11243
  "data-testid": "saved-view-overflow-button",
@@ -11431,7 +11252,7 @@ var SavedViewCollectionMenuItem = (props) => {
11431
11252
  );
11432
11253
  };
11433
11254
 
11434
- // src/components/panels/ExpandedPanel.tsx
11255
+ // src/SavedViews/components/Panels/ExpandedPanel.tsx
11435
11256
  var import_core_react4 = require("@procore/core-react");
11436
11257
  var ExpandedPanel = styled_components_esm_default(import_core_react4.Panel)`
11437
11258
  width: ${({ provider }) => provider === "data-table" ? "316px" : "100%"};
@@ -11439,238 +11260,76 @@ var ExpandedPanel = styled_components_esm_default(import_core_react4.Panel)`
11439
11260
  border-radius: 4px 0 0 4px;
11440
11261
  `;
11441
11262
 
11442
- // src/components/panels/PanelContent.tsx
11443
- var import_core_react8 = require("@procore/core-react");
11444
- var import_toast_alert2 = require("@procore/toast-alert");
11263
+ // src/SavedViews/components/Panels/PanelContent.tsx
11264
+ var import_core_react6 = require("@procore/core-react");
11265
+ var import_toast_alert = require("@procore/toast-alert");
11445
11266
  var import_react9 = __toESM(require("react"));
11446
11267
 
11447
- // node_modules/@procore/core-http/dist/modern/index.js
11448
- function getCSRFToken() {
11449
- const token = document.cookie.match("(^|;)\\s*csrf_token\\s*=\\s*([^;]+)");
11450
- return token ? decodeURIComponent(token.pop() || "") : "";
11451
- }
11452
- function getCSRFHeader() {
11453
- const csrfToken = getCSRFToken();
11454
- return csrfToken ? { "X-CSRF-TOKEN": csrfToken } : {};
11455
- }
11456
- function removeLeadingSlash(url) {
11457
- return url.startsWith("/") ? url.substring(1, url.length) : url;
11458
- }
11459
- function removeTrailingSlash(url) {
11460
- return url.endsWith("/") ? url.substring(0, url.length - 1) : url;
11461
- }
11462
- function applyBaseUrl(url, baseUrl) {
11463
- return `${removeTrailingSlash(baseUrl)}/${removeLeadingSlash(url)}`;
11464
- }
11465
- function getOptions({ headers, ...options }) {
11466
- const opts = {
11467
- credentials: "same-origin",
11468
- headers: {
11469
- ...getCSRFHeader(),
11470
- ...headers
11471
- },
11472
- mode: "same-origin",
11473
- ...options
11268
+ // src/utils/Constants/viewLevels.ts
11269
+ var VIEW_LEVELS = ["company", "project", "personal"];
11270
+
11271
+ // src/SavedViews/components/Panels/PanelContentUtils.ts
11272
+ var import_lodash = __toESM(require_lodash());
11273
+
11274
+ // src/SavedViews/components/SavedViews/SmartGrid/SmartGridUtils.ts
11275
+ function getSmartGridConfig(api) {
11276
+ const columnStateResult = api.getColumnState();
11277
+ const columnGroupStateResult = api.getColumnGroupState();
11278
+ const rowGroupStateResult = api.getRowGroupColumns();
11279
+ const rowHeightResult = api.getGridOption("rowHeight") || api.getSizesForCurrentTheme().rowHeight;
11280
+ const serverFiltersResult = api.getFilterModel();
11281
+ const smartGridConfig = {
11282
+ columnState: columnStateResult,
11283
+ rowHeight: rowHeightResult,
11284
+ columnGroupState: columnGroupStateResult,
11285
+ rowGroupState: rowGroupStateResult.filter((col) => typeof (col == null ? void 0 : col.getColId) === "function").map((col) => col.getColId()),
11286
+ filterState: serverFiltersResult
11474
11287
  };
11475
- return opts;
11288
+ return smartGridConfig;
11476
11289
  }
11477
- function getUrl(url, baseUrl) {
11478
- return baseUrl ? applyBaseUrl(url, baseUrl) : url;
11479
- }
11480
- function request(url, { baseUrl, ...options } = {}) {
11481
- return fetch(getUrl(url, baseUrl), getOptions(options));
11482
- }
11483
- function requestJSON(url, requestParams = {}) {
11484
- return request(url, requestParams).then(
11485
- (response) => response.json()
11486
- );
11290
+ function setSmartGridConfig(api, config) {
11291
+ api.applyColumnState({
11292
+ state: config.columnState,
11293
+ applyOrder: true
11294
+ });
11295
+ api.setColumnGroupState(config.columnGroupState);
11296
+ api.setRowGroupColumns(config.rowGroupState);
11297
+ api.setFilterModel(config.filterState);
11298
+ if (config.rowHeight) {
11299
+ api.setGridOption("rowHeight", config.rowHeight);
11300
+ }
11487
11301
  }
11488
11302
 
11489
- // src/utils/api/queries.ts
11490
- var import_react_query2 = require("@tanstack/react-query");
11491
-
11492
- // src/utils/api/queriesHandler.ts
11493
- var import_react_query = require("@tanstack/react-query");
11494
- var import_core_react5 = require("@procore/core-react");
11495
- var useApiRequest = (props, method, mutationKey) => {
11496
- const { projectId, companyId, domain, tableName } = props;
11497
- const queryClient2 = (0, import_react_query.useQueryClient)();
11498
- const { locale: locale2 } = (0, import_core_react5.useI18nContext)();
11499
- return (0, import_react_query.useMutation)({
11500
- mutationKey,
11501
- mutationFn: async (savedView) => {
11502
- let url = "";
11503
- if (method === "DELETE" || method === "PUT") {
11504
- url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views/${savedView.share_token}?permissions_domain=${domain}`;
11505
- } else {
11506
- url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views?table_name=${tableName}&permissions_domain=${domain}`;
11507
- }
11508
- const response = await requestJSON(url, {
11509
- method,
11510
- body: JSON.stringify(savedView),
11511
- headers: {
11512
- "Content-Type": "application/json",
11513
- "Accept-Language": locale2
11514
- }
11515
- });
11516
- if (response.error) {
11517
- throw response.error;
11518
- }
11519
- return response.data;
11520
- },
11521
- onSuccess: (savedView) => {
11522
- if (method === "DELETE" || method === "POST") {
11523
- queryClient2.invalidateQueries({
11524
- queryKey: ["savedViews", domain, tableName]
11525
- });
11526
- return;
11527
- } else {
11528
- const oldData = queryClient2.getQueryData([
11529
- "savedViews",
11530
- domain,
11531
- tableName
11532
- ]);
11533
- const oldView = oldData == null ? void 0 : oldData.find(
11534
- (item) => item.share_token === savedView.share_token
11535
- );
11536
- if ((oldView == null ? void 0 : oldView.name) !== savedView.name) {
11537
- queryClient2.invalidateQueries({
11538
- queryKey: ["savedViews", domain, tableName]
11539
- });
11540
- return;
11541
- }
11542
- }
11543
- queryClient2.setQueryData(
11544
- ["savedViews", domain, tableName],
11545
- (oldData) => {
11546
- if (!oldData)
11547
- return [savedView];
11548
- return oldData.map(
11549
- (item) => item.share_token === savedView.share_token ? savedView : item
11550
- );
11551
- }
11552
- );
11553
- }
11303
+ // src/SavedViews/components/SavedViews/SavedViewsUtils.ts
11304
+ var customAndConfigSync = (viewTableConfig, defaultTableConfig) => {
11305
+ if (!viewTableConfig && !defaultTableConfig)
11306
+ return void 0;
11307
+ if (!(viewTableConfig == null ? void 0 : viewTableConfig.columnState))
11308
+ return defaultTableConfig;
11309
+ if (!(defaultTableConfig == null ? void 0 : defaultTableConfig.columnState))
11310
+ return viewTableConfig;
11311
+ const viewColumns = viewTableConfig.columnState;
11312
+ const defaultViewColumns = defaultTableConfig.columnState;
11313
+ if (!Array.isArray(viewColumns) || !Array.isArray(defaultViewColumns))
11314
+ return void 0;
11315
+ const viewFields = new Set(
11316
+ viewColumns.map((col) => getColumnIdentifier(col))
11317
+ );
11318
+ const defaultViewFields = new Set(
11319
+ defaultViewColumns.map((col) => getColumnIdentifier(col))
11320
+ );
11321
+ const newColumns = defaultViewColumns.filter(
11322
+ (col) => !viewFields.has(getColumnIdentifier(col))
11323
+ );
11324
+ const updatedColumns = viewColumns.filter((col) => {
11325
+ const identifier = getColumnIdentifier(col);
11326
+ return identifier.startsWith("ag-Grid-") || defaultViewFields.has(identifier);
11554
11327
  });
11555
- };
11556
-
11557
- // src/utils/constants/viewLevels.ts
11558
- var VIEW_LEVELS = ["company", "project", "personal"];
11559
-
11560
- // src/utils/api/queries.ts
11561
- var PAGE_SIZE = 50 * VIEW_LEVELS.length;
11562
- var useSavedViewsQuery = (props) => {
11563
- const { projectId, companyId, domain, tableName } = props;
11564
- const url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views?table_name=${tableName}&permissions_domain=${domain}`;
11565
- return (0, import_react_query2.useQuery)({
11566
- queryKey: ["savedViews", domain, tableName],
11567
- queryFn: async () => {
11568
- const getUrl2 = `${url}&per_page=${PAGE_SIZE}`;
11569
- const response = await requestJSON(getUrl2);
11570
- return response.data;
11571
- }
11572
- });
11573
- };
11574
- var useSavedViewsPermissions = (props) => {
11575
- const { projectId, companyId, domain } = props;
11576
- const url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views/permissions?permissions_domain=${domain}`;
11577
- return (0, import_react_query2.useQuery)({
11578
- queryKey: ["savedViewsConfig", domain],
11579
- queryFn: async () => {
11580
- const response = await requestJSON(url);
11581
- return response.data;
11582
- }
11583
- });
11584
- };
11585
- var useCreateSavedView = (props) => useApiRequest(props, "POST", [
11586
- "createSavedView",
11587
- props.domain,
11588
- props.tableName
11589
- ]);
11590
- var useUpdateSavedView = (props) => useApiRequest(props, "PUT", [
11591
- "updateSavedView",
11592
- props.domain,
11593
- props.tableName
11594
- ]);
11595
- var useDeleteSavedView = (props) => useApiRequest(props, "DELETE", [
11596
- "deleteSavedView",
11597
- props.domain,
11598
- props.tableName
11599
- ]);
11600
- var useFetchSavedViewById = (savedViewToken, queryInput, enabled = true) => {
11601
- const { projectId, companyId } = queryInput;
11602
- return (0, import_react_query2.useQuery)({
11603
- enabled: enabled && Boolean(savedViewToken),
11604
- queryKey: ["savedView", savedViewToken],
11605
- queryFn: async () => {
11606
- const url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views/${savedViewToken}`;
11607
- const response = await requestJSON(url);
11608
- return response.data;
11609
- }
11610
- });
11611
- };
11612
-
11613
- // src/components/panels/PanelContentUtils.ts
11614
- var import_lodash = __toESM(require_lodash());
11615
-
11616
- // src/components/adapters/smart-grid/SmartGridUtils.ts
11617
- function getSmartGridConfig(api) {
11618
- const columnState = api.getColumnState();
11619
- const columnGroupState = api.getColumnGroupState();
11620
- const rowGroupState = api.getRowGroupColumns().map((col) => col.getColId());
11621
- const rowHeight = api.getGridOption("rowHeight") ?? api.getSizesForCurrentTheme().rowHeight;
11622
- const filterState = api.getFilterModel();
11623
- return {
11624
- columnState,
11625
- rowHeight,
11626
- columnGroupState,
11627
- rowGroupState,
11628
- filterState
11629
- };
11630
- }
11631
- function setSmartGridConfig(api, config) {
11632
- api.applyColumnState({
11633
- state: config.columnState,
11634
- applyOrder: true
11635
- });
11636
- api.setColumnGroupState(config.columnGroupState);
11637
- api.setRowGroupColumns(config.rowGroupState);
11638
- api.setFilterModel(config.filterState);
11639
- if (config.rowHeight) {
11640
- api.setGridOption("rowHeight", config.rowHeight);
11641
- }
11642
- }
11643
-
11644
- // src/components/saved-views/SavedViewsUtils.ts
11645
- var customAndConfigSync = (viewTableConfig, defaultTableConfig) => {
11646
- if (!viewTableConfig && !defaultTableConfig)
11647
- return void 0;
11648
- if (!(viewTableConfig == null ? void 0 : viewTableConfig.columnState))
11649
- return defaultTableConfig;
11650
- if (!(defaultTableConfig == null ? void 0 : defaultTableConfig.columnState))
11651
- return viewTableConfig;
11652
- const viewColumns = viewTableConfig.columnState;
11653
- const defaultViewColumns = defaultTableConfig.columnState;
11654
- if (!Array.isArray(viewColumns) || !Array.isArray(defaultViewColumns))
11655
- return void 0;
11656
- const viewFields = new Set(
11657
- viewColumns.map((col) => getColumnIdentifier(col))
11658
- );
11659
- const defaultViewFields = new Set(
11660
- defaultViewColumns.map((col) => getColumnIdentifier(col))
11661
- );
11662
- const newColumns = defaultViewColumns.filter(
11663
- (col) => !viewFields.has(getColumnIdentifier(col))
11664
- );
11665
- const updatedColumns = viewColumns.filter((col) => {
11666
- const identifier = getColumnIdentifier(col);
11667
- return identifier.startsWith("ag-Grid-") || defaultViewFields.has(identifier);
11668
- });
11669
- const finalColumns = [...updatedColumns, ...newColumns];
11670
- return {
11671
- ...viewTableConfig,
11672
- columnState: finalColumns
11673
- };
11328
+ const finalColumns = [...updatedColumns, ...newColumns];
11329
+ return {
11330
+ ...viewTableConfig,
11331
+ columnState: finalColumns
11332
+ };
11674
11333
  };
11675
11334
  var getColumnIdentifier = (col) => {
11676
11335
  if ("field" in col && typeof col.field === "string") {
@@ -11681,7 +11340,7 @@ var getColumnIdentifier = (col) => {
11681
11340
  }
11682
11341
  return "";
11683
11342
  };
11684
- var updateTableConfig = (view, tableApi, provider) => {
11343
+ var updateTableConfig = (view, tableApi, provider, onTableConfigChange) => {
11685
11344
  if (provider === "smart-grid") {
11686
11345
  setSmartGridConfig(
11687
11346
  tableApi,
@@ -11696,11 +11355,14 @@ var updateTableConfig = (view, tableApi, provider) => {
11696
11355
  dataTableApi == null ? void 0 : dataTableApi.setRowHeight(rowHeight);
11697
11356
  }
11698
11357
  dataTableApi == null ? void 0 : dataTableApi.setTableConfiguration(tableConfig);
11358
+ if (onTableConfigChange) {
11359
+ onTableConfigChange(tableConfig);
11360
+ }
11699
11361
  }
11700
11362
  }
11701
11363
  };
11702
11364
 
11703
- // src/components/panels/PanelContentUtils.ts
11365
+ // src/SavedViews/components/Panels/PanelContentUtils.ts
11704
11366
  var getOrderedVisibleColumns = (columns, idKey) => {
11705
11367
  if (!columns)
11706
11368
  return [];
@@ -11759,12 +11421,13 @@ var normalizeForComparison = (config) => {
11759
11421
  if (!(config == null ? void 0 : config.columnState))
11760
11422
  return config;
11761
11423
  return {
11762
- ...config,
11424
+ ...import_lodash.default.omit(config, ["enableRowGrouping", "enableColumnGrouping"]),
11763
11425
  columnState: config.columnState.map((col) => {
11426
+ const res = import_lodash.default.omit(col, ["aggFunc"]);
11764
11427
  if (col.flex) {
11765
- return import_lodash.default.omit(col, ["width", "flex"]);
11428
+ return import_lodash.default.omit(res, ["width", "flex"]);
11766
11429
  }
11767
- return col;
11430
+ return res;
11768
11431
  })
11769
11432
  };
11770
11433
  };
@@ -11777,10 +11440,14 @@ var isEqual = (viewTableConfig, tableConfig, defaultViewConfig, provider) => {
11777
11440
  );
11778
11441
  const normalizedViewConfig = normalizeForComparison(syncedViewTableConfig);
11779
11442
  const normalizedCurrentConfig = normalizeForComparison(tableConfig);
11780
- return import_lodash.default.isEqual(
11781
- cleanObject(normalizedViewConfig, provider),
11782
- cleanObject(normalizedCurrentConfig, provider)
11783
- );
11443
+ const cleanedViewConfig = cleanObject(normalizedViewConfig, provider);
11444
+ const cleanedCurrentConfig = cleanObject(normalizedCurrentConfig, provider);
11445
+ console.log("xx:Difference between view config and current config:", {
11446
+ viewConfig: cleanedViewConfig,
11447
+ currentConfig: cleanedCurrentConfig,
11448
+ areEqual: import_lodash.default.isEqual(cleanedViewConfig, cleanedCurrentConfig)
11449
+ });
11450
+ return import_lodash.default.isEqual(cleanedViewConfig, cleanedCurrentConfig);
11784
11451
  };
11785
11452
  var hasPermissionForViewLevel = (viewLevel, permissions) => {
11786
11453
  switch (viewLevel) {
@@ -11795,7 +11462,7 @@ var hasPermissionForViewLevel = (viewLevel, permissions) => {
11795
11462
  }
11796
11463
  };
11797
11464
 
11798
- // src/components/panels/useGroups.ts
11465
+ // src/SavedViews/components/Panels/useGroups.ts
11799
11466
  var import_react6 = require("react");
11800
11467
  var useGroups = () => {
11801
11468
  const [groups, setGroups] = (0, import_react6.useState)(
@@ -11807,8 +11474,8 @@ var useGroups = () => {
11807
11474
  return { groups, toggleGroup };
11808
11475
  };
11809
11476
 
11810
- // src/components/panels/ViewLevelHeader.tsx
11811
- var import_core_react6 = require("@procore/core-react");
11477
+ // src/SavedViews/components/Panels/ViewLevelHeader.tsx
11478
+ var import_core_react5 = require("@procore/core-react");
11812
11479
  var import_react7 = __toESM(require("react"));
11813
11480
  var groupIcon = (group) => {
11814
11481
  switch (group) {
@@ -11820,31 +11487,31 @@ var groupIcon = (group) => {
11820
11487
  return /* @__PURE__ */ import_react7.default.createElement(Building_default, null);
11821
11488
  }
11822
11489
  };
11823
- var Header = styled_components_esm_default(import_core_react6.Flex)`
11490
+ var Header = styled_components_esm_default(import_core_react5.Flex)`
11824
11491
  width: 100%;
11825
11492
  &:hover {
11826
- background-color: ${import_core_react6.colors.gray98};
11493
+ background-color: ${import_core_react5.colors.gray98};
11827
11494
  }
11828
11495
  `;
11829
11496
  var ViewLevelHeader = ({ expanded, toggleGroup, group }) => {
11830
- const I18n = (0, import_core_react6.useI18nContext)();
11497
+ const I18n = (0, import_core_react5.useI18nContext)();
11831
11498
  return /* @__PURE__ */ import_react7.default.createElement(
11832
11499
  Header,
11833
11500
  {
11834
11501
  alignItems: "center",
11835
- padding: `${import_core_react6.spacing.sm}px`,
11836
- gap: `${import_core_react6.spacing.sm}px`,
11502
+ padding: `${import_core_react5.spacing.sm}px`,
11503
+ gap: `${import_core_react5.spacing.sm}px`,
11837
11504
  style: { cursor: "pointer" },
11838
11505
  onClick: () => toggleGroup(group)
11839
11506
  },
11840
11507
  expanded ? /* @__PURE__ */ import_react7.default.createElement(ChevronDown_default, { size: "sm" }) : /* @__PURE__ */ import_react7.default.createElement(ChevronRight_default, { size: "sm" }),
11841
11508
  groupIcon(group),
11842
- /* @__PURE__ */ import_react7.default.createElement(import_core_react6.Typography, { weight: "semibold" }, I18n.t(`savedViews.viewLevel.${group}`))
11509
+ /* @__PURE__ */ import_react7.default.createElement(import_core_react5.Typography, { weight: "semibold" }, I18n.t(`savedViews.viewLevel.${group}`))
11843
11510
  );
11844
11511
  };
11845
11512
  var ViewLevelHeader_default = ViewLevelHeader;
11846
11513
 
11847
- // src/utils/hooks/useScrollToRef.ts
11514
+ // src/utils/Hooks/useScrollToRef.ts
11848
11515
  var import_react8 = require("react");
11849
11516
  var useScrollToRef = (dependency) => {
11850
11517
  const ref = (0, import_react8.useRef)(null);
@@ -11856,102 +11523,77 @@ var useScrollToRef = (dependency) => {
11856
11523
  return ref;
11857
11524
  };
11858
11525
 
11859
- // src/components/panels/PanelContent.styles.ts
11860
- var import_core_react7 = require("@procore/core-react");
11861
- var Row = styled_components_esm_default(import_core_react7.UNSAFE_Menu.Item)`
11526
+ // src/SavedViews/components/Panels/PanelContent.tsx
11527
+ var Row = styled_components_esm_default(import_core_react6.UNSAFE_Menu.Item)`
11862
11528
  width: 100%;
11863
11529
  padding-left: 35px;
11864
11530
  padding-right: 4px;
11865
- background-color: ${({ selected }) => selected ? import_core_react7.colors.blue96 : "transparent"};
11531
+ background-color: ${({ selected }) => selected ? import_core_react6.colors.blue96 : "transparent"};
11866
11532
 
11867
11533
  &:hover {
11868
- background-color: ${({ selected }) => selected ? import_core_react7.colors.blue96 : import_core_react7.colors.gray98};
11534
+ background-color: ${({ selected }) => selected ? import_core_react6.colors.blue96 : import_core_react6.colors.gray98};
11869
11535
  }
11870
11536
  `;
11871
- var Panel2 = styled_components_esm_default(import_core_react7.DetailPage.Card)`
11537
+ var Panel2 = styled_components_esm_default(import_core_react6.DetailPage.Card)`
11872
11538
  margin: 0;
11873
11539
  height: 100%;
11874
- padding-top: ${import_core_react7.spacing.sm}px;
11540
+ padding-top: ${import_core_react6.spacing.sm}px;
11875
11541
  box-shadow: none;
11876
11542
  `;
11877
-
11878
- // src/components/panels/PanelContent.tsx
11879
11543
  var PanelContent = (props) => {
11880
- const { queryInput, selectedSavedView, tableConfig } = props;
11881
- const { showToast } = (0, import_toast_alert2.useToastAlertContext)();
11882
- const I18n = (0, import_core_react8.useI18nContext)();
11883
- const { data: savedViewsFromQuery, error: savedViewsError } = useSavedViewsQuery(props.queryInput);
11884
- const updateMutation = useUpdateSavedView(queryInput);
11885
- const { mutate: updateSavedView } = updateMutation;
11886
- const isUpdateLoading = "isPending" in updateMutation ? updateMutation.isPending : updateMutation.isLoading ?? false;
11887
- const savedViews = props.savedViews ?? savedViewsFromQuery;
11544
+ var _a;
11545
+ const { showToast } = (0, import_toast_alert.useToastAlertContext)();
11546
+ const I18n = (0, import_core_react6.useI18nContext)();
11547
+ const { useSavedViewsQuery: useSavedViewsQuery2, useSavedViewsPermissions: useSavedViewsPermissions2, useUpdateSavedView: useUpdateSavedView2 } = props.backend;
11548
+ const { mutate: updateSavedView, isPending: isUpdateLoading } = useUpdateSavedView2(props.queryInput);
11549
+ const { data: savedViews, error: savedViewsError } = useSavedViewsQuery2(
11550
+ props.queryInput
11551
+ );
11888
11552
  const errorToastRef = import_react9.default.useRef(null);
11889
11553
  import_react9.default.useEffect(() => {
11890
11554
  if (savedViewsError && savedViewsError !== errorToastRef.current) {
11891
11555
  showToast.error(I18n.t("savedViews.errors.fetch"));
11892
11556
  errorToastRef.current = savedViewsError;
11893
11557
  }
11894
- }, [savedViewsError, showToast, I18n]);
11895
- const { data: permissions } = useSavedViewsPermissions(props.queryInput);
11558
+ }, [savedViewsError]);
11559
+ const { data: permissions } = useSavedViewsPermissions2(props.queryInput);
11896
11560
  const selectedRowRef = useScrollToRef(savedViews);
11897
- const { groups, toggleGroup } = useGroups();
11898
- const isTemporarySelected = (selectedSavedView == null ? void 0 : selectedSavedView.id) === "temporary";
11899
- const temporaryView = savedViews == null ? void 0 : savedViews.find((view) => view.id === "temporary");
11900
- const presetViews = props.presetViews || [props.defaultView];
11901
11561
  const onUpdate = (data) => {
11902
11562
  const newSavedView = {
11903
11563
  ...data,
11904
- ...selectedSavedView,
11905
- table_config: tableConfig
11564
+ ...props.selectedSavedView,
11565
+ table_config: props.tableConfig
11906
11566
  };
11907
11567
  updateSavedView(newSavedView, {
11908
11568
  onSuccess: () => {
11909
11569
  showToast.success(I18n.t("savedViews.update.success"));
11910
- props.onSelect({ item: newSavedView });
11570
+ props.updateLocalStorage(newSavedView);
11571
+ props.setSelectedSavedView(newSavedView);
11911
11572
  },
11912
11573
  onError: () => {
11913
11574
  showToast.error(I18n.t("savedViews.errors.update"));
11914
11575
  }
11915
11576
  });
11916
11577
  };
11917
- return /* @__PURE__ */ import_react9.default.createElement(Panel2, { "data-testid": "inner-panel" }, /* @__PURE__ */ import_react9.default.createElement(import_core_react8.Flex, { direction: "column", style: { height: "100%", width: "100%" } }, temporaryView && /* @__PURE__ */ import_react9.default.createElement(
11578
+ const { groups, toggleGroup } = useGroups();
11579
+ const isDefaultSelected = ((_a = props.selectedSavedView) == null ? void 0 : _a.id) === "default";
11580
+ return /* @__PURE__ */ import_react9.default.createElement(Panel2, { "data-testid": "inner-panel" }, /* @__PURE__ */ import_react9.default.createElement(import_core_react6.Flex, { direction: "column", style: { height: "100%", width: "100%" } }, /* @__PURE__ */ import_react9.default.createElement(
11918
11581
  Row,
11919
11582
  {
11920
- selected: isTemporarySelected,
11921
- onClick: () => props.onSelect({ item: temporaryView }),
11922
- ref: isTemporarySelected ? selectedRowRef : null
11583
+ selected: isDefaultSelected,
11584
+ onClick: () => props.onSelect({ item: props.defaultView }),
11585
+ ref: isDefaultSelected ? selectedRowRef : null
11923
11586
  },
11924
11587
  /* @__PURE__ */ import_react9.default.createElement(
11925
11588
  SavedViewCollectionMenuItem,
11926
11589
  {
11927
- item: temporaryView,
11928
- selected: isTemporarySelected,
11929
- onClearTemporary: props.onClearTemporary
11590
+ item: props.defaultView,
11591
+ selected: isDefaultSelected
11930
11592
  }
11931
11593
  )
11932
- ), presetViews.map((presetView) => {
11933
- const isSelected = (selectedSavedView == null ? void 0 : selectedSavedView.id) === presetView.id;
11934
- return /* @__PURE__ */ import_react9.default.createElement(
11935
- Row,
11936
- {
11937
- key: presetView.id,
11938
- selected: isSelected,
11939
- onClick: () => props.onSelect({ item: presetView }),
11940
- ref: isSelected ? selectedRowRef : null
11941
- },
11942
- /* @__PURE__ */ import_react9.default.createElement(
11943
- SavedViewCollectionMenuItem,
11944
- {
11945
- item: presetView,
11946
- selected: isSelected
11947
- }
11948
- )
11949
- );
11950
- }), VIEW_LEVELS.map((level) => {
11594
+ ), VIEW_LEVELS.map((level) => {
11951
11595
  const isExpanded = groups[level];
11952
- const views = isExpanded && savedViews ? savedViews.filter(
11953
- (view) => view.view_level === level && view.id !== "temporary"
11954
- ) : [];
11596
+ const views = isExpanded && savedViews ? savedViews.filter((view) => view.view_level === level) : [];
11955
11597
  return /* @__PURE__ */ import_react9.default.createElement(import_react9.default.Fragment, { key: level }, /* @__PURE__ */ import_react9.default.createElement(
11956
11598
  ViewLevelHeader_default,
11957
11599
  {
@@ -11960,10 +11602,11 @@ var PanelContent = (props) => {
11960
11602
  expanded: isExpanded
11961
11603
  }
11962
11604
  ), views.map((view) => {
11963
- const isSelected = (selectedSavedView == null ? void 0 : selectedSavedView.id) === view.id;
11605
+ var _a2;
11606
+ const isSelected = ((_a2 = props.selectedSavedView) == null ? void 0 : _a2.id) === view.id;
11964
11607
  const canUpdate = isSelected && hasPermissionForViewLevel(view.view_level, permissions) && !isEqual(
11965
11608
  view.table_config,
11966
- tableConfig,
11609
+ props.tableConfig,
11967
11610
  props.defaultView.table_config,
11968
11611
  props.provider
11969
11612
  );
@@ -11999,23 +11642,82 @@ var PanelContent = (props) => {
11999
11642
  })));
12000
11643
  };
12001
11644
 
12002
- // src/components/saved-views/SavedViews.tsx
12003
- var import_core_react14 = require("@procore/core-react");
11645
+ // src/SavedViews/components/SavedViews/SmartGrid/SmartGridSavedViews.tsx
11646
+ var import_react14 = __toESM(require("react"));
11647
+
11648
+ // src/SavedViews/components/SavedViews/SmartGrid/SmartGridDefaultSavedView.tsx
11649
+ var import_core_react7 = require("@procore/core-react");
11650
+ var useDefaultViewName = (domain, defaultViewName) => {
11651
+ const i18n = (0, import_core_react7.useI18nContext)();
11652
+ return defaultViewName || i18n.t(domain, {
11653
+ scope: "savedViews.defaultViewTitle",
11654
+ defaultValue: "Default View"
11655
+ });
11656
+ };
11657
+ var useDefaultView = (props) => {
11658
+ const name = useDefaultViewName(props.domain, props.defaultViewName);
11659
+ return {
11660
+ id: "default",
11661
+ view_level: "default",
11662
+ name,
11663
+ table_config: {}
11664
+ };
11665
+ };
11666
+
11667
+ // src/SavedViews/components/SavedViews/SmartGrid/useSmartGridConfig.ts
11668
+ var import_react10 = require("react");
11669
+ var GRID_STATE_EVENTS = [
11670
+ "sortChanged",
11671
+ "filterOpened",
11672
+ "filterChanged",
11673
+ "columnRowGroupChanged",
11674
+ "dragStopped",
11675
+ "columnResized",
11676
+ "columnVisible",
11677
+ "columnPinned",
11678
+ "columnMoved",
11679
+ "modelUpdated",
11680
+ "gridColumnsChanged",
11681
+ "gridReady"
11682
+ ];
11683
+ var useSmartGridConfig = (gridApi) => {
11684
+ const [config, setConfig] = (0, import_react10.useState)(
11685
+ () => getSmartGridConfig(gridApi)
11686
+ );
11687
+ (0, import_react10.useEffect)(() => {
11688
+ if (!gridApi)
11689
+ return;
11690
+ const updateConfig = () => {
11691
+ setConfig(getSmartGridConfig(gridApi));
11692
+ };
11693
+ GRID_STATE_EVENTS.forEach((event) => {
11694
+ gridApi.addEventListener(event, updateConfig);
11695
+ });
11696
+ return () => {
11697
+ GRID_STATE_EVENTS.forEach((event) => {
11698
+ gridApi.removeEventListener(event, updateConfig);
11699
+ });
11700
+ };
11701
+ }, [gridApi]);
11702
+ return { config, setConfig };
11703
+ };
11704
+
11705
+ // src/SavedViews/components/SavedViews/SavedViews.tsx
11706
+ var import_core_react12 = require("@procore/core-react");
12004
11707
  var import_react13 = __toESM(require("react"));
12005
11708
  var import_react_query3 = require("@tanstack/react-query");
12006
- var import_toast_alert3 = require("@procore/toast-alert");
12007
11709
 
12008
- // src/components/modals/DeleteConfirmationModal.tsx
12009
- var import_core_react9 = require("@procore/core-react");
12010
- var import_react10 = __toESM(require("react"));
11710
+ // src/SavedViews/components/SavedViewsModals/SavedViewsDeleteConfirmationModalShared.tsx
11711
+ var import_core_react8 = require("@procore/core-react");
11712
+ var import_react11 = __toESM(require("react"));
12011
11713
  var SavedViewsDeleteConfirmationModalShared = ({
12012
11714
  onCancel,
12013
11715
  onDelete,
12014
11716
  open
12015
11717
  }) => {
12016
- const i18n = (0, import_core_react9.useI18nContext)();
12017
- return /* @__PURE__ */ import_react10.default.createElement(
12018
- import_core_react9.ConfirmModal,
11718
+ const i18n = (0, import_core_react8.useI18nContext)();
11719
+ return /* @__PURE__ */ import_react11.default.createElement(
11720
+ import_core_react8.ConfirmModal,
12019
11721
  {
12020
11722
  "data-testid": "delete-confirmation-modal",
12021
11723
  open,
@@ -12024,17 +11726,17 @@ var SavedViewsDeleteConfirmationModalShared = ({
12024
11726
  onClose: onCancel,
12025
11727
  style: { overflowWrap: "anywhere" }
12026
11728
  },
12027
- /* @__PURE__ */ import_react10.default.createElement(import_core_react9.Modal.Body, null, /* @__PURE__ */ import_react10.default.createElement(import_core_react9.P, null, i18n.t("savedViews.modal.delete.description"))),
12028
- /* @__PURE__ */ import_react10.default.createElement(import_core_react9.Modal.Footer, null, /* @__PURE__ */ import_react10.default.createElement(import_core_react9.Modal.FooterButtons, null, /* @__PURE__ */ import_react10.default.createElement(import_core_react9.Button, { variant: "secondary", onClick: onCancel }, i18n.t("savedViews.actions.cancel")), /* @__PURE__ */ import_react10.default.createElement(import_core_react9.Button, { variant: "primary", onClick: onDelete }, i18n.t("savedViews.actions.delete"))))
11729
+ /* @__PURE__ */ import_react11.default.createElement(import_core_react8.Modal.Body, null, /* @__PURE__ */ import_react11.default.createElement(import_core_react8.P, null, i18n.t("savedViews.modal.delete.description"))),
11730
+ /* @__PURE__ */ import_react11.default.createElement(import_core_react8.Modal.Footer, null, /* @__PURE__ */ import_react11.default.createElement(import_core_react8.Modal.FooterButtons, null, /* @__PURE__ */ import_react11.default.createElement(import_core_react8.Button, { variant: "secondary", onClick: onCancel }, i18n.t("savedViews.actions.cancel")), /* @__PURE__ */ import_react11.default.createElement(import_core_react8.Button, { variant: "primary", onClick: onDelete }, i18n.t("savedViews.actions.delete"))))
12029
11731
  );
12030
11732
  };
12031
11733
 
12032
- // src/components/modals/form-modal/FormModal.tsx
12033
- var import_react11 = __toESM(require("react"));
11734
+ // src/SavedViews/components/SavedViewsModals/SavedViewsFormModal.tsx
11735
+ var import_react12 = __toESM(require("react"));
12034
11736
 
12035
- // src/components/modals/form-modal/FormModalBase.tsx
12036
- var import_core_react10 = require("@procore/core-react");
12037
- var React19 = __toESM(require("react"));
11737
+ // src/SavedViews/components/SavedViewsModals/SavedViewsCreateUpdateModalBase.tsx
11738
+ var import_core_react9 = require("@procore/core-react");
11739
+ var React17 = __toESM(require("react"));
12038
11740
 
12039
11741
  // ../../node_modules/yup/index.esm.js
12040
11742
  var import_property_expr = __toESM(require_property_expr());
@@ -14328,7 +14030,7 @@ var TupleSchema = class extends Schema {
14328
14030
  };
14329
14031
  create$1.prototype = TupleSchema.prototype;
14330
14032
 
14331
- // src/components/modals/form-modal/FormModalBaseUtils.ts
14033
+ // src/SavedViews/components/SavedViewsModals/CreateUpdateModalBaseUtils.ts
14332
14034
  var getViewLevelOptions = (permissions, i18n) => {
14333
14035
  const options = ["personal"];
14334
14036
  if (permissions == null ? void 0 : permissions.can_create_project_saved_views)
@@ -14361,11 +14063,12 @@ function extractMessage(error, I18n) {
14361
14063
  return { form: I18n.t("savedViews.modal.errors.unknown") };
14362
14064
  }
14363
14065
 
14364
- // src/components/modals/form-modal/FormModalBase.tsx
14066
+ // src/SavedViews/components/SavedViewsModals/SavedViewsCreateUpdateModalBase.tsx
14067
+ var { useEffect: useEffect3, useRef: useRef2 } = React17;
14365
14068
  var ScrollContainer = styled_components_esm_default("div")`
14366
14069
  overflow: auto;
14367
14070
  `;
14368
- var FormModalBase = ({
14071
+ var SavedViewsCreateUpdateModalBase = ({
14369
14072
  open,
14370
14073
  mode,
14371
14074
  onCancel,
@@ -14377,23 +14080,40 @@ var FormModalBase = ({
14377
14080
  tableName,
14378
14081
  defaultView,
14379
14082
  selectedSavedView,
14083
+ setSelectedSavedView,
14380
14084
  setOpenEditCreateModal,
14381
- onSelect
14085
+ onSelect,
14086
+ backend
14382
14087
  }) => {
14383
- const I18n = (0, import_core_react10.useI18nContext)();
14088
+ const I18n = (0, import_core_react9.useI18nContext)();
14384
14089
  const NAME_MAX_LENGTH = 150;
14090
+ const originalBodyWidth = useRef2("");
14091
+ useEffect3(() => {
14092
+ if (open) {
14093
+ originalBodyWidth.current = document.body.style.width || "";
14094
+ document.body.style.width = "100%";
14095
+ } else {
14096
+ document.body.style.width = originalBodyWidth.current;
14097
+ }
14098
+ return () => {
14099
+ if (originalBodyWidth.current !== void 0) {
14100
+ document.body.style.width = originalBodyWidth.current;
14101
+ }
14102
+ };
14103
+ }, [open]);
14104
+ const { useCreateSavedView: useCreateSavedView2, useUpdateSavedView: useUpdateSavedView2, useSavedViewsPermissions: useSavedViewsPermissions2 } = backend;
14385
14105
  const {
14386
14106
  mutate: createSavedView,
14387
14107
  isPending: isCreating,
14388
14108
  error: createError,
14389
14109
  reset: resetCreateMutation
14390
- } = useCreateSavedView(queryInput);
14110
+ } = useCreateSavedView2(queryInput);
14391
14111
  const {
14392
14112
  mutate: updateSavedView,
14393
14113
  isPending: isUpdating,
14394
14114
  error: updateError,
14395
14115
  reset: resetUpdateMutation
14396
- } = useUpdateSavedView(queryInput);
14116
+ } = useUpdateSavedView2(queryInput);
14397
14117
  const resetMutations = () => {
14398
14118
  resetCreateMutation();
14399
14119
  resetUpdateMutation();
@@ -14402,7 +14122,7 @@ var FormModalBase = ({
14402
14122
  resetMutations();
14403
14123
  onCancel();
14404
14124
  };
14405
- const { data: permissions } = useSavedViewsPermissions(queryInput);
14125
+ const { data: permissions } = useSavedViewsPermissions2(queryInput);
14406
14126
  const isLoading = isCreating || isUpdating;
14407
14127
  const errors = extractMessage(createError || updateError, I18n);
14408
14128
  const handleOnSubmit = (data) => {
@@ -14414,8 +14134,8 @@ var FormModalBase = ({
14414
14134
  };
14415
14135
  updateSavedView(body, {
14416
14136
  onSuccess: (updatedSavedView) => {
14417
- onSelect(updatedSavedView);
14418
14137
  setOpenEditCreateModal(false);
14138
+ setSelectedSavedView(updatedSavedView);
14419
14139
  }
14420
14140
  });
14421
14141
  } else {
@@ -14434,8 +14154,8 @@ var FormModalBase = ({
14434
14154
  }
14435
14155
  };
14436
14156
  const viewLevelOptions = getViewLevelOptions(permissions, I18n);
14437
- return /* @__PURE__ */ React19.createElement(
14438
- import_core_react10.Modal,
14157
+ return /* @__PURE__ */ React17.createElement(
14158
+ import_core_react9.Modal,
14439
14159
  {
14440
14160
  "aria-label": I18n.t("savedViews.ariaLabels.modal"),
14441
14161
  onClickOverlay: onClose,
@@ -14443,15 +14163,15 @@ var FormModalBase = ({
14443
14163
  style: { width: "540px" },
14444
14164
  "data-testid": "create-update-modal"
14445
14165
  },
14446
- /* @__PURE__ */ React19.createElement(ScrollContainer, null, /* @__PURE__ */ React19.createElement(
14447
- import_core_react10.Modal.Header,
14166
+ /* @__PURE__ */ React17.createElement(ScrollContainer, null, /* @__PURE__ */ React17.createElement(
14167
+ import_core_react9.Modal.Header,
14448
14168
  {
14449
14169
  onClose,
14450
- style: { borderBottom: `1px solid ${import_core_react10.colors.gray85}` }
14170
+ style: { borderBottom: `1px solid ${import_core_react9.colors.gray85}` }
14451
14171
  },
14452
- /* @__PURE__ */ React19.createElement(import_core_react10.H2, null, header)
14453
- ), /* @__PURE__ */ React19.createElement(
14454
- import_core_react10.Form,
14172
+ /* @__PURE__ */ React17.createElement(import_core_react9.H2, null, header)
14173
+ ), /* @__PURE__ */ React17.createElement(
14174
+ import_core_react9.Form,
14455
14175
  {
14456
14176
  initialValues: {
14457
14177
  name: initialName,
@@ -14476,14 +14196,14 @@ var FormModalBase = ({
14476
14196
  onReset: onCancel,
14477
14197
  validateOnChange: true
14478
14198
  },
14479
- /* @__PURE__ */ React19.createElement(import_core_react10.Form.Form, { name: header }, /* @__PURE__ */ React19.createElement(
14480
- import_core_react10.Modal.Body,
14199
+ /* @__PURE__ */ React17.createElement(import_core_react9.Form.Form, { name: header }, /* @__PURE__ */ React17.createElement(
14200
+ import_core_react9.Modal.Body,
14481
14201
  {
14482
- style: { paddingTop: 0, paddingBottom: 0, marginTop: import_core_react10.spacing.lg }
14202
+ style: { paddingTop: 0, paddingBottom: 0, marginTop: import_core_react9.spacing.lg }
14483
14203
  },
14484
- errors && /* @__PURE__ */ React19.createElement(import_core_react10.ErrorBanner, { style: { marginBottom: import_core_react10.spacing.xl } }, /* @__PURE__ */ React19.createElement(import_core_react10.Banner.Content, null, /* @__PURE__ */ React19.createElement(import_core_react10.Banner.Title, null, I18n.t("savedViews.modal.errors.title", { mode })), /* @__PURE__ */ React19.createElement(import_core_react10.Banner.Body, null, (errors == null ? void 0 : errors.form) || I18n.t(`savedViews.modal.errors.description.${mode}`)))),
14485
- /* @__PURE__ */ React19.createElement(import_core_react10.Form.Row, null, /* @__PURE__ */ React19.createElement(
14486
- import_core_react10.Form.Text,
14204
+ errors && /* @__PURE__ */ React17.createElement(import_core_react9.ErrorBanner, { style: { marginBottom: import_core_react9.spacing.xl } }, /* @__PURE__ */ React17.createElement(import_core_react9.Banner.Content, null, /* @__PURE__ */ React17.createElement(import_core_react9.Banner.Title, null, I18n.t("savedViews.modal.errors.title", { mode })), /* @__PURE__ */ React17.createElement(import_core_react9.Banner.Body, null, (errors == null ? void 0 : errors.form) || I18n.t(`savedViews.modal.errors.description.${mode}`)))),
14205
+ /* @__PURE__ */ React17.createElement(import_core_react9.Form.Row, null, /* @__PURE__ */ React17.createElement(
14206
+ import_core_react9.Form.Text,
14487
14207
  {
14488
14208
  name: "name",
14489
14209
  error: errors == null ? void 0 : errors.name,
@@ -14493,13 +14213,13 @@ var FormModalBase = ({
14493
14213
  onChange: () => resetMutations()
14494
14214
  }
14495
14215
  )),
14496
- /* @__PURE__ */ React19.createElement(
14497
- import_core_react10.Form.Row,
14216
+ /* @__PURE__ */ React17.createElement(
14217
+ import_core_react9.Form.Row,
14498
14218
  {
14499
- style: { marginTop: (errors == null ? void 0 : errors.name) ? import_core_react10.spacing.xl : import_core_react10.spacing.none }
14219
+ style: { marginTop: (errors == null ? void 0 : errors.name) ? import_core_react9.spacing.xl : import_core_react9.spacing.none }
14500
14220
  },
14501
- /* @__PURE__ */ React19.createElement(
14502
- import_core_react10.Form.TextArea,
14221
+ /* @__PURE__ */ React17.createElement(
14222
+ import_core_react9.Form.TextArea,
14503
14223
  {
14504
14224
  name: "description",
14505
14225
  placeholder: I18n.t("savedViews.modal.fields.description"),
@@ -14509,19 +14229,20 @@ var FormModalBase = ({
14509
14229
  }
14510
14230
  )
14511
14231
  ),
14512
- viewLevelOptions.length > 1 && mode === "create" /* CREATE */ ? /* @__PURE__ */ React19.createElement(import_core_react10.Form.Row, null, /* @__PURE__ */ React19.createElement(
14513
- import_core_react10.Form.Select,
14232
+ viewLevelOptions.length > 1 && mode === "create" /* CREATE */ ? /* @__PURE__ */ React17.createElement(import_core_react9.Form.Row, null, /* @__PURE__ */ React17.createElement(
14233
+ import_core_react9.Form.Select,
14514
14234
  {
14515
14235
  name: "view_level",
14236
+ qa: { label: "view-level" },
14516
14237
  options: viewLevelOptions,
14517
14238
  label: I18n.t("savedViews.modal.fields.viewLevel"),
14518
14239
  colWidth: 12,
14519
14240
  onSearch: false,
14520
14241
  onClear: false
14521
14242
  }
14522
- )) : /* @__PURE__ */ React19.createElement(React19.Fragment, null)
14523
- ), /* @__PURE__ */ React19.createElement(import_core_react10.Modal.Footer, { style: { borderTop: `1px solid ${import_core_react10.colors.gray85}` } }, /* @__PURE__ */ React19.createElement(import_core_react10.Flex, { grow: "1", justifyContent: "space-between", alignItems: "center" }, /* @__PURE__ */ React19.createElement(import_core_react10.Typography, { color: "gray45", italic: true }, /* @__PURE__ */ React19.createElement(import_core_react10.Typography, { color: "red45" }, "*"), " ", I18n.t("savedViews.modal.info.required_fields")), /* @__PURE__ */ React19.createElement(import_core_react10.Modal.FooterButtons, null, /* @__PURE__ */ React19.createElement(import_core_react10.Button, { type: "reset", variant: "tertiary", disabled: isLoading }, I18n.t("savedViews.actions.cancel")), /* @__PURE__ */ React19.createElement(
14524
- import_core_react10.Button,
14243
+ )) : /* @__PURE__ */ React17.createElement(React17.Fragment, null)
14244
+ ), /* @__PURE__ */ React17.createElement(import_core_react9.Modal.Footer, { style: { borderTop: `1px solid ${import_core_react9.colors.gray85}` } }, /* @__PURE__ */ React17.createElement(import_core_react9.Flex, { grow: "1", justifyContent: "space-between", alignItems: "center" }, /* @__PURE__ */ React17.createElement(import_core_react9.Typography, { color: "gray45", italic: true }, /* @__PURE__ */ React17.createElement(import_core_react9.Typography, { color: "red45" }, "*"), " ", I18n.t("savedViews.modal.info.required_fields")), /* @__PURE__ */ React17.createElement(import_core_react9.Modal.FooterButtons, null, /* @__PURE__ */ React17.createElement(import_core_react9.Button, { type: "reset", variant: "tertiary", disabled: isLoading }, I18n.t("savedViews.actions.cancel")), /* @__PURE__ */ React17.createElement(
14245
+ import_core_react9.Button,
14525
14246
  {
14526
14247
  "data-testid": "create-update-modal-button",
14527
14248
  type: "submit",
@@ -14535,9 +14256,9 @@ var FormModalBase = ({
14535
14256
  );
14536
14257
  };
14537
14258
 
14538
- // src/components/modals/form-modal/FormModal.tsx
14539
- var import_core_react11 = require("@procore/core-react");
14540
- var FormModal = ({
14259
+ // src/SavedViews/components/SavedViewsModals/SavedViewsFormModal.tsx
14260
+ var import_core_react10 = require("@procore/core-react");
14261
+ var SavedViewsFormModal = ({
14541
14262
  open,
14542
14263
  mode,
14543
14264
  onCancel,
@@ -14545,13 +14266,15 @@ var FormModal = ({
14545
14266
  tableName,
14546
14267
  queryInput,
14547
14268
  selectedSavedView,
14269
+ setSelectedSavedView,
14548
14270
  setOpenEditCreateModal,
14549
14271
  onSelect,
14550
- defaultView
14272
+ defaultView,
14273
+ backend
14551
14274
  }) => {
14552
- const i18n = (0, import_core_react11.useI18nContext)();
14553
- return /* @__PURE__ */ import_react11.default.createElement(
14554
- FormModalBase,
14275
+ const i18n = (0, import_core_react10.useI18nContext)();
14276
+ return /* @__PURE__ */ import_react12.default.createElement(
14277
+ SavedViewsCreateUpdateModalBase,
14555
14278
  {
14556
14279
  open,
14557
14280
  mode,
@@ -14563,321 +14286,174 @@ var FormModal = ({
14563
14286
  tableConfig,
14564
14287
  tableName,
14565
14288
  selectedSavedView,
14289
+ setSelectedSavedView,
14566
14290
  setOpenEditCreateModal,
14567
14291
  onSelect,
14568
- defaultView
14292
+ defaultView,
14293
+ backend
14569
14294
  }
14570
14295
  );
14571
14296
  };
14572
14297
 
14573
- // src/components/modals/form-modal/SharedViewFormModal.tsx
14574
- var import_core_react12 = require("@procore/core-react");
14575
- var React21 = __toESM(require("react"));
14576
- var SharedViewFormModal = ({
14577
- open,
14578
- fetchedView,
14579
- onClose,
14580
- onCreateTemporaryView,
14581
- onCreateView,
14582
- createError,
14583
- isCreating,
14584
- resetCreateError
14585
- }) => {
14586
- const I18n = (0, import_core_react12.useI18nContext)();
14587
- const NAME_MAX_LENGTH = 150;
14588
- const errors = extractMessage(createError, I18n);
14589
- const handleNameChange = () => {
14590
- if (resetCreateError) {
14591
- resetCreateError();
14592
- }
14593
- };
14594
- const handleOnSubmit = (data) => {
14595
- onCreateView(data.name, data.description);
14596
- };
14597
- return /* @__PURE__ */ React21.createElement(
14598
- import_core_react12.Modal,
14599
- {
14600
- "data-testid": "shared-view-form-modal",
14601
- open,
14602
- onClickOverlay: onClose,
14603
- style: { width: "540px" }
14298
+ // ../../node_modules/@procore/core-http/dist/modern/index.js
14299
+ function getCSRFToken() {
14300
+ const token = document.cookie.match("(^|;)\\s*csrf_token\\s*=\\s*([^;]+)");
14301
+ return token ? decodeURIComponent(token.pop() || "") : "";
14302
+ }
14303
+ function getCSRFHeader() {
14304
+ const csrfToken = getCSRFToken();
14305
+ return csrfToken ? { "X-CSRF-TOKEN": csrfToken } : {};
14306
+ }
14307
+ function removeLeadingSlash(url) {
14308
+ return url.startsWith("/") ? url.substring(1, url.length) : url;
14309
+ }
14310
+ function removeTrailingSlash(url) {
14311
+ return url.endsWith("/") ? url.substring(0, url.length - 1) : url;
14312
+ }
14313
+ function applyBaseUrl(url, baseUrl) {
14314
+ return `${removeTrailingSlash(baseUrl)}/${removeLeadingSlash(url)}`;
14315
+ }
14316
+ function getOptions({ headers, ...options }) {
14317
+ const opts = {
14318
+ credentials: "same-origin",
14319
+ headers: {
14320
+ ...getCSRFHeader(),
14321
+ ...headers
14604
14322
  },
14605
- /* @__PURE__ */ React21.createElement(
14606
- import_core_react12.Modal.Header,
14607
- {
14608
- onClose,
14609
- style: {
14610
- paddingTop: import_core_react12.spacing.lg,
14611
- paddingBottom: import_core_react12.spacing.xs,
14612
- paddingLeft: import_core_react12.spacing.xl,
14613
- paddingRight: import_core_react12.spacing.xl
14614
- }
14615
- },
14616
- I18n.t("savedViews.modal.create.title")
14617
- ),
14618
- /* @__PURE__ */ React21.createElement(
14619
- import_core_react12.P,
14620
- {
14621
- style: {
14622
- paddingLeft: import_core_react12.spacing.xl,
14623
- paddingRight: import_core_react12.spacing.xl,
14624
- paddingBottom: import_core_react12.spacing.lg,
14625
- paddingTop: import_core_react12.spacing.none,
14626
- margin: 0,
14627
- color: import_core_react12.colors.gray45,
14628
- whiteSpace: "pre-line"
14323
+ mode: "same-origin",
14324
+ ...options
14325
+ };
14326
+ return opts;
14327
+ }
14328
+ function getUrl(url, baseUrl) {
14329
+ return baseUrl ? applyBaseUrl(url, baseUrl) : url;
14330
+ }
14331
+ function request(url, { baseUrl, ...options } = {}) {
14332
+ return fetch(getUrl(url, baseUrl), getOptions(options));
14333
+ }
14334
+ function requestJSON(url, requestParams = {}) {
14335
+ return request(url, requestParams).then(
14336
+ (response) => response.json()
14337
+ );
14338
+ }
14339
+
14340
+ // src/utils/Api/queries.ts
14341
+ var import_react_query2 = require("@tanstack/react-query");
14342
+
14343
+ // src/utils/Api/queriesHandler.ts
14344
+ var import_react_query = require("@tanstack/react-query");
14345
+ var import_core_react11 = require("@procore/core-react");
14346
+ var useApiRequest = (props, method, mutationKey) => {
14347
+ const { projectId, companyId, domain, tableName } = props;
14348
+ const queryClient2 = (0, import_react_query.useQueryClient)();
14349
+ const { locale: locale2 } = (0, import_core_react11.useI18nContext)();
14350
+ return (0, import_react_query.useMutation)({
14351
+ mutationKey,
14352
+ mutationFn: async (savedView) => {
14353
+ let url = "";
14354
+ if (method === "DELETE" || method === "PUT") {
14355
+ url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views/${savedView.id}?permissions_domain=${domain}`;
14356
+ } else {
14357
+ url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views?table_name=${tableName}&permissions_domain=${domain}`;
14358
+ }
14359
+ const response = await requestJSON(url, {
14360
+ method,
14361
+ body: JSON.stringify(savedView),
14362
+ headers: {
14363
+ "Content-Type": "application/json",
14364
+ "Accept-Language": locale2
14629
14365
  }
14630
- },
14631
- I18n.t("savedViews.modal.copyConfirmation.description")
14632
- ),
14633
- /* @__PURE__ */ React21.createElement(
14634
- import_core_react12.Form,
14635
- {
14636
- initialValues: {
14637
- name: fetchedView.name,
14638
- description: fetchedView.description ?? ""
14639
- },
14640
- view: "create",
14641
- validationSchema: create$3().shape({
14642
- name: create$6().trim().max(
14643
- NAME_MAX_LENGTH,
14644
- I18n.t("savedViews.modal.errors.maxLengthName", {
14645
- maxLength: NAME_MAX_LENGTH
14646
- })
14647
- ).required(I18n.t("savedViews.modal.errors.required"))
14648
- }),
14649
- onSubmit: handleOnSubmit,
14650
- validateOnChange: true
14651
- },
14652
- /* @__PURE__ */ React21.createElement(import_core_react12.Form.Form, { name: "share-view-form" }, /* @__PURE__ */ React21.createElement(
14653
- import_core_react12.Modal.Body,
14654
- {
14655
- style: {
14656
- paddingTop: import_core_react12.spacing.lg,
14657
- paddingBottom: 0,
14658
- borderTop: `1px solid ${import_core_react12.colors.gray85}`
14659
- }
14660
- },
14661
- errors && /* @__PURE__ */ React21.createElement(import_core_react12.ErrorBanner, { style: { marginBottom: import_core_react12.spacing.xl } }, /* @__PURE__ */ React21.createElement(import_core_react12.Banner.Content, null, /* @__PURE__ */ React21.createElement(import_core_react12.Banner.Title, null, I18n.t("savedViews.modal.errors.title", {
14662
- mode: "create"
14663
- })), /* @__PURE__ */ React21.createElement(import_core_react12.Banner.Body, null, (errors == null ? void 0 : errors.form) || I18n.t("savedViews.modal.errors.description.create")))),
14664
- /* @__PURE__ */ React21.createElement(import_core_react12.Form.Row, null, /* @__PURE__ */ React21.createElement(
14665
- import_core_react12.Form.Text,
14666
- {
14667
- name: "name",
14668
- error: errors == null ? void 0 : errors.name,
14669
- placeholder: I18n.t("savedViews.modal.fields.name"),
14670
- label: I18n.t("savedViews.modal.fields.name"),
14671
- colWidth: 12,
14672
- onChange: handleNameChange
14673
- }
14674
- )),
14675
- /* @__PURE__ */ React21.createElement(
14676
- import_core_react12.Form.Row,
14677
- {
14678
- style: { marginTop: (errors == null ? void 0 : errors.name) ? import_core_react12.spacing.xl : import_core_react12.spacing.none }
14679
- },
14680
- /* @__PURE__ */ React21.createElement(
14681
- import_core_react12.Form.TextArea,
14682
- {
14683
- name: "description",
14684
- placeholder: I18n.t("savedViews.modal.fields.description"),
14685
- label: I18n.t("savedViews.modal.fields.description"),
14686
- colWidth: 12,
14687
- resize: "vertical"
14688
- }
14689
- )
14690
- )
14691
- ), /* @__PURE__ */ React21.createElement(import_core_react12.Modal.Footer, { style: { borderTop: `1px solid ${import_core_react12.colors.gray85}` } }, /* @__PURE__ */ React21.createElement(import_core_react12.Flex, { grow: "1", justifyContent: "space-between", alignItems: "center" }, /* @__PURE__ */ React21.createElement(import_core_react12.Typography, { color: "gray45", italic: true }, /* @__PURE__ */ React21.createElement(import_core_react12.Typography, { color: "red45" }, "*"), " ", I18n.t("savedViews.modal.info.required_fields")), /* @__PURE__ */ React21.createElement(import_core_react12.Modal.FooterButtons, null, /* @__PURE__ */ React21.createElement(
14692
- import_core_react12.Button,
14693
- {
14694
- variant: "secondary",
14695
- onClick: onCreateTemporaryView,
14696
- "data-testid": "view-temporarily-button",
14697
- disabled: isCreating
14698
- },
14699
- I18n.t("savedViews.actions.viewTemporarily")
14700
- ), /* @__PURE__ */ React21.createElement(
14701
- import_core_react12.Button,
14702
- {
14703
- type: "submit",
14704
- variant: "primary",
14705
- "data-testid": "create-view-button",
14706
- disabled: isCreating,
14707
- loading: isCreating
14708
- },
14709
- I18n.t("savedViews.actions.create")
14710
- )))))
14711
- )
14712
- );
14713
- };
14714
-
14715
- // src/utils/hooks/useViewSelection.ts
14716
- var import_react12 = require("react");
14717
- var import_react_router_dom = require("react-router-dom");
14718
- var import_core_react13 = require("@procore/core-react");
14719
-
14720
- // src/utils/viewStorage.ts
14721
- var ViewStorage = {
14722
- save(key, view) {
14723
- localStorage.setItem(key, JSON.stringify(view));
14724
- },
14725
- load(key, defaultView) {
14726
- try {
14727
- const stored = localStorage.getItem(key);
14728
- if (!stored)
14729
- return defaultView;
14730
- const parsed = JSON.parse(stored);
14731
- if (!parsed)
14732
- return defaultView;
14733
- const isTableConfigOnly = !parsed.id && !parsed.share_token;
14734
- return isTableConfigOnly ? { ...defaultView, table_config: parsed } : parsed;
14735
- } catch {
14736
- return defaultView;
14737
- }
14738
- },
14739
- remove(key) {
14740
- localStorage.removeItem(key);
14741
- }
14742
- };
14743
-
14744
- // src/utils/hooks/useViewSelection.ts
14745
- var getUpdatedSearchParams = (currentParams, view) => {
14746
- const updatedParams = new URLSearchParams(currentParams);
14747
- if (view.id === "default") {
14748
- updatedParams.set("saved-view", "default");
14749
- } else if (view.id === "temporary") {
14750
- updatedParams.set("saved-view", "temporary");
14751
- } else {
14752
- updatedParams.set("saved-view", view.share_token);
14753
- }
14754
- return updatedParams;
14755
- };
14756
- var checkIsViewSelected = (selectedView, viewId) => {
14757
- return (selectedView == null ? void 0 : selectedView.share_token) === viewId || (selectedView == null ? void 0 : selectedView.id) === viewId;
14758
- };
14759
- var findViewByToken = (views, token) => {
14760
- return views.find((view) => view.share_token === token);
14761
- };
14762
- var setViewInUrl = (view, setSearchParams) => {
14763
- setSearchParams(
14764
- (currentParams) => getUpdatedSearchParams(currentParams, view),
14765
- { replace: true }
14766
- );
14767
- };
14768
- var restoreUrlParameter = (currentParam, previousParam, setSearchParams) => {
14769
- if (previousParam && !currentParam) {
14770
- setSearchParams(
14771
- (currentParams) => {
14772
- const updatedParams = new URLSearchParams(currentParams);
14773
- updatedParams.set("saved-view", previousParam);
14774
- return updatedParams;
14775
- },
14776
- { replace: true }
14777
- );
14778
- }
14779
- };
14780
- var useViewSelection = (config, savedViews, presetViews, openSharedViewModal) => {
14781
- const I18n = (0, import_core_react13.useI18nContext)();
14782
- const storageKey = `savedView_${config.domain}_${config.tableName}_${config.companyId}_${config.projectId}_${config.userId}`;
14783
- const temporaryStorageKey = `${storageKey}-temporary`;
14784
- const [searchParams, setSearchParams] = (0, import_react_router_dom.useSearchParams)();
14785
- const previousSavedViewParamRef = (0, import_react12.useRef)(null);
14786
- const [selectedSavedView, setSelectedSavedView] = (0, import_react12.useState)(() => {
14787
- const stored = ViewStorage.load(storageKey, config.defaultView);
14788
- return stored ?? config.defaultView;
14789
- });
14790
- const [temporaryView, setTemporaryView] = (0, import_react12.useState)(() => {
14791
- const loaded = ViewStorage.load(temporaryStorageKey, config.defaultView);
14792
- return loaded && (loaded.id === "temporary" || loaded.view_level === "temporary") ? loaded : null;
14793
- });
14794
- const persistViewToStorageAndUrl = (0, import_react12.useCallback)(
14795
- (view) => {
14796
- ViewStorage.save(storageKey, view);
14797
- setViewInUrl(view, setSearchParams);
14798
- },
14799
- [storageKey, setSearchParams]
14800
- );
14801
- const baseViews = (0, import_react12.useMemo)(
14802
- () => [...savedViews ?? [], ...presetViews ?? []],
14803
- [savedViews, presetViews]
14804
- );
14805
- const allViews = (0, import_react12.useMemo)(
14806
- () => temporaryView ? [...baseViews, temporaryView] : baseViews,
14807
- [baseViews, temporaryView]
14808
- );
14809
- const selectView = (0, import_react12.useCallback)(
14810
- (view) => {
14811
- const viewToSelect = config.onSelect({ item: view });
14812
- setSelectedSavedView(viewToSelect);
14813
- persistViewToStorageAndUrl(viewToSelect);
14814
- return viewToSelect;
14815
- },
14816
- [config, persistViewToStorageAndUrl]
14817
- );
14818
- const createTemporaryView = (0, import_react12.useCallback)(
14819
- (fetchedView) => {
14820
- const tempView = {
14821
- ...fetchedView,
14822
- id: "temporary",
14823
- name: I18n.t("savedViews.temporaryViewName"),
14824
- view_level: "temporary"
14825
- };
14826
- ViewStorage.save(temporaryStorageKey, tempView);
14827
- setTemporaryView(tempView);
14828
- selectView(tempView);
14829
- return tempView;
14366
+ });
14367
+ if (response.error) {
14368
+ throw response.error;
14369
+ }
14370
+ return response.data;
14830
14371
  },
14831
- [temporaryStorageKey, selectView]
14832
- );
14833
- const clearTemporaryView = (0, import_react12.useCallback)(() => {
14834
- ViewStorage.remove(temporaryStorageKey);
14835
- setTemporaryView(null);
14836
- selectView(config.defaultView);
14837
- }, [temporaryStorageKey, config.defaultView, selectView]);
14838
- const isViewAlreadySelected = (0, import_react12.useCallback)(
14839
- (viewId) => checkIsViewSelected(selectedSavedView, viewId),
14840
- [selectedSavedView]
14841
- );
14842
- const handleSavedViewFromUrl = (0, import_react12.useCallback)(
14843
- (viewId) => {
14844
- if (isViewAlreadySelected(viewId)) {
14372
+ onSuccess: (savedView) => {
14373
+ if (method === "DELETE" || method === "POST") {
14374
+ queryClient2.invalidateQueries({
14375
+ queryKey: ["savedViews", domain, tableName]
14376
+ });
14845
14377
  return;
14846
- }
14847
- const viewInList = findViewByToken(allViews, viewId);
14848
- if (viewInList) {
14849
- selectView(viewInList);
14850
14378
  } else {
14851
- openSharedViewModal(viewId);
14379
+ const oldData = queryClient2.getQueryData([
14380
+ "savedViews",
14381
+ domain,
14382
+ tableName
14383
+ ]);
14384
+ const oldView = oldData == null ? void 0 : oldData.find((item) => item.id === savedView.id);
14385
+ if ((oldView == null ? void 0 : oldView.name) !== savedView.name) {
14386
+ queryClient2.invalidateQueries({
14387
+ queryKey: ["savedViews", domain, tableName]
14388
+ });
14389
+ return;
14390
+ }
14852
14391
  }
14853
- },
14854
- [isViewAlreadySelected, openSharedViewModal, allViews, selectView]
14855
- );
14856
- (0, import_react12.useEffect)(() => {
14857
- const savedViewId = searchParams.get("saved-view");
14858
- restoreUrlParameter(
14859
- savedViewId,
14860
- previousSavedViewParamRef.current,
14861
- setSearchParams
14862
- );
14863
- if (savedViewId) {
14864
- previousSavedViewParamRef.current = savedViewId;
14392
+ queryClient2.setQueryData(
14393
+ ["savedViews", domain, tableName],
14394
+ (oldData) => {
14395
+ if (!oldData)
14396
+ return [savedView];
14397
+ return oldData.map(
14398
+ (item) => item.id === savedView.id ? savedView : item
14399
+ );
14400
+ }
14401
+ );
14865
14402
  }
14866
- if (savedViewId && savedViews) {
14867
- handleSavedViewFromUrl(savedViewId);
14403
+ });
14404
+ };
14405
+
14406
+ // src/utils/Api/queries.ts
14407
+ var PAGE_SIZE = 50 * VIEW_LEVELS.length;
14408
+ var useSavedViewsQuery = (props) => {
14409
+ const { projectId, companyId, domain, tableName } = props;
14410
+ const url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views?table_name=${tableName}&permissions_domain=${domain}`;
14411
+ return (0, import_react_query2.useQuery)({
14412
+ enabled: props.enableSavedViews,
14413
+ queryKey: ["savedViews", domain, tableName],
14414
+ queryFn: async () => {
14415
+ const getUrl2 = `${url}&per_page=${PAGE_SIZE}`;
14416
+ const response = await requestJSON(getUrl2);
14417
+ return response.data;
14868
14418
  }
14869
- }, [searchParams, handleSavedViewFromUrl, allViews.length]);
14870
- return {
14871
- selectedView: selectedSavedView,
14872
- selectView,
14873
- temporaryView,
14874
- createTemporaryView,
14875
- clearTemporaryView,
14876
- allViews
14877
- };
14419
+ });
14878
14420
  };
14421
+ var useSavedViewsPermissions = (props) => {
14422
+ const { projectId, companyId, domain } = props;
14423
+ const url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views/permissions?permissions_domain=${domain}`;
14424
+ return (0, import_react_query2.useQuery)({
14425
+ enabled: props.enableSavedViews,
14426
+ queryKey: ["savedViewsConfig", domain],
14427
+ queryFn: async () => {
14428
+ const response = await requestJSON(url);
14429
+ return response.data;
14430
+ }
14431
+ });
14432
+ };
14433
+ var useCreateSavedView = (props) => useApiRequest(props, "POST", [
14434
+ "createSavedView",
14435
+ props.domain,
14436
+ props.tableName
14437
+ ]);
14438
+ var useUpdateSavedView = (props) => useApiRequest(props, "PUT", [
14439
+ "updateSavedView",
14440
+ props.domain,
14441
+ props.tableName
14442
+ ]);
14443
+ var useDeleteSavedView = (props) => useApiRequest(props, "DELETE", [
14444
+ "deleteSavedView",
14445
+ props.domain,
14446
+ props.tableName
14447
+ ]);
14448
+ var createQueries = (customBackend) => ({
14449
+ useSavedViewsQuery: (customBackend == null ? void 0 : customBackend.useSavedViewsQuery) ?? useSavedViewsQuery,
14450
+ useSavedViewsPermissions: (customBackend == null ? void 0 : customBackend.useSavedViewsPermissions) ?? useSavedViewsPermissions,
14451
+ useCreateSavedView: (customBackend == null ? void 0 : customBackend.useCreateSavedView) ?? useCreateSavedView,
14452
+ useUpdateSavedView: (customBackend == null ? void 0 : customBackend.useUpdateSavedView) ?? useUpdateSavedView,
14453
+ useDeleteSavedView: (customBackend == null ? void 0 : customBackend.useDeleteSavedView) ?? useDeleteSavedView
14454
+ });
14879
14455
 
14880
- // src/components/saved-views/SavedViews.tsx
14456
+ // src/SavedViews/components/SavedViews/SavedViews.tsx
14881
14457
  var StyledPanel = styled_components_esm_default.div`
14882
14458
  border: ${({ provider }) => provider === "data-table" ? "1px solid #d6dadc" : "none"};
14883
14459
  `;
@@ -14887,105 +14463,62 @@ var SavedViewsContent = (props) => {
14887
14463
  const queryInput = {
14888
14464
  domain: props.domain,
14889
14465
  tableName: props.tableName,
14466
+ enableSavedViews: props.enableSavedViews,
14890
14467
  projectId,
14891
14468
  companyId
14892
14469
  };
14893
- const { data: savedViews } = useSavedViewsQuery(queryInput);
14894
- const { mutate: deleteSavedView } = useDeleteSavedView(queryInput);
14895
- const { showToast } = (0, import_toast_alert3.useToastAlertContext)();
14896
- const i18n = (0, import_core_react14.useI18nContext)();
14897
- const [activeModal, setActiveModal] = (0, import_react13.useState)(null);
14898
- const [modalData, setModalData] = (0, import_react13.useState)(null);
14899
- const openModal = (type, data) => {
14900
- setActiveModal(type);
14901
- setModalData(data ?? null);
14902
- };
14903
- const closeModal = (0, import_react13.useCallback)(() => {
14904
- setActiveModal(null);
14905
- setModalData(null);
14906
- }, []);
14907
- const isModalOpen = (type) => activeModal === type;
14908
- const openSharedViewModal = (viewId) => {
14909
- openModal("sharedView" /* SHARED_VIEW */, { viewId });
14910
- };
14911
- const {
14912
- selectedView,
14913
- selectView,
14914
- createTemporaryView,
14915
- clearTemporaryView,
14916
- allViews
14917
- } = useViewSelection(
14918
- {
14919
- domain: props.domain,
14920
- tableName: props.tableName,
14921
- userId: props.userId,
14922
- projectId,
14923
- companyId,
14924
- defaultView: props.defaultView,
14925
- onSelect: props.onSelect
14926
- },
14927
- savedViews,
14928
- props.presetViews,
14929
- openSharedViewModal
14930
- );
14931
- const { data: fetchedView, isError: fetchError } = useFetchSavedViewById(
14932
- (modalData == null ? void 0 : modalData.viewId) ?? null,
14933
- queryInput,
14934
- Boolean(modalData == null ? void 0 : modalData.viewId)
14935
- );
14936
- const {
14937
- mutate: createSavedView,
14938
- isPending: isCreating,
14939
- error: createError,
14940
- reset: resetCreateError
14941
- } = useCreateSavedView(queryInput);
14942
- (0, import_react13.useEffect)(() => {
14943
- if (fetchError) {
14944
- showToast.error(i18n.t("savedViews.errors.notFound"));
14945
- selectView(selectedView ?? props.defaultView);
14946
- closeModal();
14947
- }
14948
- }, [fetchError, selectedView, props.defaultView, selectView, closeModal]);
14949
- const viewSharedViewTemporarily = () => {
14950
- if (fetchedView) {
14951
- createTemporaryView(fetchedView);
14952
- closeModal();
14470
+ const backend = createQueries(props.backend);
14471
+ const { mutate: deleteSavedView } = backend.useDeleteSavedView(queryInput);
14472
+ const [selectedSavedView, setSelectedSavedView] = (0, import_react13.useState)(() => {
14473
+ try {
14474
+ const savedView = JSON.parse(
14475
+ localStorage.getItem(
14476
+ `${props.domain}_${props.tableName}_${props.stickyViewsKey}_${projectId}_${props.userId}`
14477
+ )
14478
+ );
14479
+ return savedView || props.defaultView;
14480
+ } catch (e2) {
14481
+ return props.defaultView;
14953
14482
  }
14954
- };
14955
- const createPersonalCopyOfSharedView = (name, description) => {
14956
- if (fetchedView) {
14957
- const viewToCreate = {
14958
- id: "",
14959
- name,
14960
- description,
14961
- table_name: props.tableName,
14962
- table_config: fetchedView.table_config,
14963
- view_level: "personal",
14964
- share_token: ""
14965
- };
14966
- createSavedView(viewToCreate, {
14967
- onSuccess: (newView) => {
14968
- showToast.success(i18n.t("savedViews.create.success"));
14969
- selectView(newView);
14970
- closeModal();
14971
- }
14972
- });
14483
+ });
14484
+ const updateLocalStorage = (view) => {
14485
+ if (props.stickyViewsKey) {
14486
+ localStorage.setItem(
14487
+ `${props.domain}_${props.tableName}_${props.stickyViewsKey}_${projectId}_${props.userId}`,
14488
+ JSON.stringify(view)
14489
+ );
14973
14490
  }
14974
14491
  };
14975
- const selectCurrentViewAndCloseModal = () => {
14976
- selectView(selectedView ?? props.defaultView);
14977
- closeModal();
14492
+ const handleViewItemSelect = ({ item }) => {
14493
+ const viewToSetAsSelected = props.onSelect({ item });
14494
+ setSelectedSavedView(viewToSetAsSelected);
14495
+ updateLocalStorage(viewToSetAsSelected);
14978
14496
  };
14979
- const deleteSelectedView = () => {
14980
- if (selectedView) {
14981
- deleteSavedView(selectedView, {
14982
- onSuccess: () => selectView(props.defaultView)
14497
+ const onDelete = () => {
14498
+ if (selectedSavedView) {
14499
+ deleteSavedView(selectedSavedView, {
14500
+ onSuccess: () => handleViewItemSelect({ item: props.defaultView })
14983
14501
  });
14984
14502
  }
14985
14503
  };
14986
- const confirmDeleteAndCloseModal = () => {
14987
- deleteSelectedView();
14988
- closeModal();
14504
+ const i18n = (0, import_core_react12.useI18nContext)();
14505
+ const [openDeleteModal, setOpenDeleteModal] = (0, import_react13.useState)(false);
14506
+ const [openEditCreateModal, setOpenEditCreateModal] = (0, import_react13.useState)(false);
14507
+ const [editCreateModalType, setEditCreateModalType] = (0, import_react13.useState)(
14508
+ "create" /* CREATE */
14509
+ );
14510
+ const onCloseDeleteModal = () => {
14511
+ setOpenDeleteModal(false);
14512
+ };
14513
+ const onCloseEditModal = () => {
14514
+ setOpenEditCreateModal(false);
14515
+ };
14516
+ const openModal = (type) => {
14517
+ setEditCreateModalType(type);
14518
+ setOpenEditCreateModal(true);
14519
+ };
14520
+ const onOpenDeleteModal = () => {
14521
+ setOpenDeleteModal(true);
14989
14522
  };
14990
14523
  return /* @__PURE__ */ import_react13.default.createElement(StyledPanel, { provider: props.provider }, /* @__PURE__ */ import_react13.default.createElement(
14991
14524
  ExpandedPanel,
@@ -14993,14 +14526,14 @@ var SavedViewsContent = (props) => {
14993
14526
  "data-testid": "saved-view-expanded-panel",
14994
14527
  provider: props.provider
14995
14528
  },
14996
- /* @__PURE__ */ import_react13.default.createElement(import_core_react14.Panel.Header, { id: "saved-views-collections-panel-header" }, /* @__PURE__ */ import_react13.default.createElement(import_core_react14.Panel.Title, null, /* @__PURE__ */ import_react13.default.createElement(import_core_react14.Flex, { alignItems: "center" }, /* @__PURE__ */ import_react13.default.createElement(import_core_react14.Box, { paddingRight: "sm" }, i18n.t("savedViews.title")), /* @__PURE__ */ import_react13.default.createElement(import_core_react14.Tooltip, { showDelay: 200, overlay: i18n.t("savedViews.tooltip") }, /* @__PURE__ */ import_react13.default.createElement(Help_default, { size: "sm" })))), /* @__PURE__ */ import_react13.default.createElement(
14997
- import_core_react14.Tooltip,
14529
+ /* @__PURE__ */ import_react13.default.createElement(import_core_react12.Panel.Header, { id: "saved-views-collections-panel-header" }, /* @__PURE__ */ import_react13.default.createElement(import_core_react12.Panel.Title, null, /* @__PURE__ */ import_react13.default.createElement(import_core_react12.Flex, { alignItems: "center" }, /* @__PURE__ */ import_react13.default.createElement(import_core_react12.Box, { paddingRight: "sm" }, i18n.t("savedViews.title")), /* @__PURE__ */ import_react13.default.createElement(import_core_react12.Tooltip, { showDelay: 200, overlay: i18n.t("savedViews.tooltip") }, /* @__PURE__ */ import_react13.default.createElement(Help_default, { size: "sm" })))), /* @__PURE__ */ import_react13.default.createElement(
14530
+ import_core_react12.Tooltip,
14998
14531
  {
14999
14532
  overlay: i18n.t("savedViews.actions.create"),
15000
14533
  showDelay: 1e3
15001
14534
  },
15002
14535
  /* @__PURE__ */ import_react13.default.createElement("span", null, /* @__PURE__ */ import_react13.default.createElement(
15003
- import_core_react14.Button,
14536
+ import_core_react12.Button,
15004
14537
  {
15005
14538
  icon: /* @__PURE__ */ import_react13.default.createElement(Plus_default, null),
15006
14539
  variant: "secondary",
@@ -15011,216 +14544,116 @@ var SavedViewsContent = (props) => {
15011
14544
  i18n.t("savedViews.actions.create")
15012
14545
  ))
15013
14546
  )),
15014
- /* @__PURE__ */ import_react13.default.createElement(import_core_react14.Panel.Body, { style: { display: "flex", flexFlow: "column" } }, /* @__PURE__ */ import_react13.default.createElement(
14547
+ /* @__PURE__ */ import_react13.default.createElement(import_core_react12.Panel.Body, { style: { display: "flex", flexFlow: "column" } }, /* @__PURE__ */ import_react13.default.createElement(
15015
14548
  PanelContent,
15016
14549
  {
15017
- onSelect: ({ item }) => selectView(item),
14550
+ onSelect: handleViewItemSelect,
15018
14551
  openModal,
15019
- onDelete: () => openModal("delete" /* DELETE */),
14552
+ onDelete: onOpenDeleteModal,
14553
+ updateLocalStorage,
14554
+ setSelectedSavedView,
15020
14555
  queryInput,
15021
- selectedSavedView: selectedView,
14556
+ selectedSavedView,
15022
14557
  tableConfig: props.tableConfig,
15023
14558
  defaultView: props.defaultView,
15024
- presetViews: props.presetViews,
15025
- savedViews: allViews,
14559
+ stickyViewsKey: props.stickyViewsKey,
15026
14560
  provider: props.provider,
15027
14561
  userId: props.userId,
15028
- onClearTemporary: clearTemporaryView
14562
+ backend
15029
14563
  }
15030
14564
  ))
15031
- ), (isModalOpen("create" /* CREATE */) || isModalOpen("update" /* UPDATE */)) && /* @__PURE__ */ import_react13.default.createElement(
15032
- FormModal,
14565
+ ), /* @__PURE__ */ import_react13.default.createElement(
14566
+ SavedViewsFormModal,
15033
14567
  {
15034
- open: true,
15035
- mode: activeModal,
15036
- onCancel: closeModal,
14568
+ open: openEditCreateModal,
14569
+ mode: editCreateModalType,
14570
+ onCancel: onCloseEditModal,
15037
14571
  queryInput,
15038
14572
  tableConfig: props.tableConfig,
15039
14573
  tableName: props.tableName,
15040
- selectedSavedView: selectedView,
15041
- onSelect: selectView,
15042
- setOpenEditCreateModal: closeModal,
15043
- defaultView: props.defaultView
14574
+ selectedSavedView,
14575
+ setSelectedSavedView,
14576
+ onSelect: (view) => handleViewItemSelect({ item: view }),
14577
+ setOpenEditCreateModal,
14578
+ defaultView: props.defaultView,
14579
+ backend
15044
14580
  }
15045
- ), selectedView && isModalOpen("delete" /* DELETE */) && /* @__PURE__ */ import_react13.default.createElement(
14581
+ ), selectedSavedView && /* @__PURE__ */ import_react13.default.createElement(
15046
14582
  SavedViewsDeleteConfirmationModalShared,
15047
14583
  {
15048
- open: true,
15049
- onDelete: confirmDeleteAndCloseModal,
15050
- onCancel: closeModal
15051
- }
15052
- ), fetchedView && isModalOpen("sharedView" /* SHARED_VIEW */) && /* @__PURE__ */ import_react13.default.createElement(
15053
- SharedViewFormModal,
15054
- {
15055
- open: true,
15056
- fetchedView,
15057
- onClose: selectCurrentViewAndCloseModal,
15058
- onCreateTemporaryView: viewSharedViewTemporarily,
15059
- onCreateView: createPersonalCopyOfSharedView,
15060
- createError,
15061
- isCreating,
15062
- resetCreateError
14584
+ open: openDeleteModal,
14585
+ onDelete: () => {
14586
+ onDelete();
14587
+ onCloseDeleteModal();
14588
+ },
14589
+ onCancel: onCloseDeleteModal
15063
14590
  }
15064
14591
  ));
15065
14592
  };
15066
14593
  var SavedViews = (props) => {
15067
- return /* @__PURE__ */ import_react13.default.createElement(EnvironmentI18nProvider, null, /* @__PURE__ */ import_react13.default.createElement(import_react_query3.QueryClientProvider, { client: queryClient }, /* @__PURE__ */ import_react13.default.createElement(import_toast_alert3.ToastAlertProvider, null, /* @__PURE__ */ import_react13.default.createElement(SavedViewsContent, { ...props }))));
15068
- };
15069
-
15070
- // src/components/adapters/smart-grid/SmartGridSavedViews.tsx
15071
- var import_react16 = __toESM(require("react"));
15072
-
15073
- // src/components/adapters/smart-grid/SmartGridDefaultSavedView.tsx
15074
- var import_react14 = require("react");
15075
- var DEFAULT_COLUMN_STATE = {
15076
- hide: false,
15077
- pinned: null,
15078
- width: 200,
15079
- sort: null,
15080
- sortIndex: null,
15081
- pivot: false,
15082
- pivotIndex: null,
15083
- aggFunc: null,
15084
- rowGroup: false,
15085
- rowGroupIndex: null,
15086
- flex: null
15087
- };
15088
- var getColumnStateFromDefs = (columnDefs) => {
15089
- return columnDefs.map((colDef) => {
15090
- const field = colDef.field ?? colDef.colId;
15091
- if (!field)
15092
- return null;
15093
- return {
15094
- colId: field,
15095
- hide: colDef.hide ?? false,
15096
- pinned: colDef.pinned ?? null,
15097
- width: colDef.width ?? colDef.minWidth ?? DEFAULT_COLUMN_STATE.width,
15098
- sort: null,
15099
- sortIndex: null,
15100
- pivot: false,
15101
- pivotIndex: null,
15102
- aggFunc: null,
15103
- rowGroup: false,
15104
- rowGroupIndex: null,
15105
- flex: colDef.flex ?? null
15106
- };
15107
- }).filter((col) => col !== null);
15108
- };
15109
- var extractDefaultView = (gridApi, receivedConfig) => {
15110
- var _a, _b;
15111
- const columnDefs = gridApi.getColumnDefs() ?? [];
15112
- const defaultColumnState = ((_a = receivedConfig == null ? void 0 : receivedConfig.columnState) == null ? void 0 : _a.length) ? receivedConfig.columnState : getColumnStateFromDefs(columnDefs);
15113
- const result = {
15114
- columnState: defaultColumnState,
15115
- columnGroupState: (receivedConfig == null ? void 0 : receivedConfig.columnGroupState) ?? [],
15116
- rowGroupState: (receivedConfig == null ? void 0 : receivedConfig.rowGroupState) ?? [],
15117
- filterState: (receivedConfig == null ? void 0 : receivedConfig.filterState) ?? {},
15118
- rowHeight: (receivedConfig == null ? void 0 : receivedConfig.rowHeight) ?? ((_b = gridApi.getSizesForCurrentTheme()) == null ? void 0 : _b.rowHeight)
15119
- };
15120
- return result;
15121
- };
15122
- var useNormalizedDefaultViews = (defaultViews, gridApi) => {
15123
- return (0, import_react14.useMemo)(() => {
15124
- if (!gridApi)
15125
- return defaultViews.map((view) => ({ ...view, share_token: view.id }));
15126
- return defaultViews.map((view) => ({
15127
- ...view,
15128
- share_token: view.id,
15129
- table_config: extractDefaultView(gridApi, view.table_config)
15130
- }));
15131
- }, [defaultViews, gridApi]);
14594
+ return /* @__PURE__ */ import_react13.default.createElement(EnvironmentI18nProvider, null, /* @__PURE__ */ import_react13.default.createElement(import_react_query3.QueryClientProvider, { client: queryClient }, /* @__PURE__ */ import_react13.default.createElement(SavedViewsContent, { ...props })));
15132
14595
  };
15133
14596
 
15134
- // src/components/adapters/smart-grid/useSmartGridConfig.ts
15135
- var import_react15 = require("react");
15136
- var GRID_STATE_EVENTS = [
15137
- "sortChanged",
15138
- "filterOpened",
15139
- "filterChanged",
15140
- "columnRowGroupChanged",
15141
- "dragStopped",
15142
- "columnResized",
15143
- "columnVisible",
15144
- "columnPinned",
15145
- "columnMoved",
15146
- "modelUpdated",
15147
- "gridColumnsChanged",
15148
- "gridReady"
15149
- ];
15150
- var useSmartGridConfig = (gridApi) => {
15151
- const [config, setConfig] = (0, import_react15.useState)(
15152
- () => getSmartGridConfig(gridApi)
15153
- );
15154
- (0, import_react15.useEffect)(() => {
15155
- if (!gridApi)
15156
- return;
15157
- const updateConfig = () => {
15158
- setConfig(getSmartGridConfig(gridApi));
15159
- };
15160
- GRID_STATE_EVENTS.forEach((event) => {
15161
- gridApi.addEventListener(event, updateConfig);
15162
- });
15163
- return () => {
15164
- GRID_STATE_EVENTS.forEach((event) => {
15165
- gridApi.removeEventListener(event, updateConfig);
15166
- });
15167
- };
15168
- }, [gridApi]);
15169
- return { config, setConfig };
15170
- };
15171
-
15172
- // src/components/adapters/smart-grid/SmartGridSavedViews.tsx
14597
+ // src/SavedViews/components/SavedViews/SmartGrid/SmartGridSavedViews.tsx
14598
+ var import_toast_alert2 = require("@procore/toast-alert");
15173
14599
  var SmartGridSavedViews = (props) => {
15174
- const { gridApi, userId, projectId, companyId } = props;
14600
+ const { gridApi, projectId, companyId } = props;
15175
14601
  const { config: tableConfig, setConfig: setTableConfig } = useSmartGridConfig(gridApi);
15176
- const presetViews = useNormalizedDefaultViews(props.defaultViews, gridApi);
15177
- const defaultView = presetViews.find((view) => view.id === "default") ?? presetViews[0];
15178
- const onSelect = (0, import_react16.useCallback)(
15179
- ({ item }) => {
15180
- if (!gridApi)
15181
- return item;
15182
- const isPresetView = item.view_level === "default";
15183
- if (isPresetView) {
15184
- updateTableConfig(item, gridApi, "smart-grid");
15185
- setTableConfig(item.table_config);
15186
- return item;
15187
- }
15188
- const updatedView = {
15189
- ...item,
15190
- table_config: customAndConfigSync(
15191
- item.table_config,
15192
- tableConfig
15193
- )
15194
- };
15195
- updateTableConfig(updatedView, gridApi, "smart-grid");
15196
- setTableConfig(updatedView.table_config);
15197
- return updatedView;
15198
- },
15199
- [gridApi, tableConfig, setTableConfig]
15200
- );
15201
- return /* @__PURE__ */ import_react16.default.createElement(
14602
+ const defaultView = useDefaultView({
14603
+ defaultViewName: props.defaultViewName,
14604
+ domain: props.domain
14605
+ });
14606
+ const onSelect = ({ item }) => {
14607
+ var _a;
14608
+ if (!gridApi)
14609
+ return item;
14610
+ if (item.id === "default") {
14611
+ gridApi.autoSizeAllColumns();
14612
+ gridApi.resetColumnState();
14613
+ gridApi.setFilterModel(props.defaultViewFilters);
14614
+ gridApi.setGridOption("rowHeight", props.defaultRowHeight);
14615
+ gridApi.refreshCells();
14616
+ return item;
14617
+ }
14618
+ const tableConfig2 = item.table_config;
14619
+ const updatedItemConfig = ((_a = props.transformSettings) == null ? void 0 : _a.call(props, tableConfig2)) ?? tableConfig2;
14620
+ const updatedView = {
14621
+ ...item,
14622
+ table_config: customAndConfigSync(
14623
+ updatedItemConfig,
14624
+ tableConfig2
14625
+ )
14626
+ };
14627
+ updateTableConfig(updatedView, gridApi, "smart-grid");
14628
+ setTableConfig(updatedView.table_config);
14629
+ return updatedView;
14630
+ };
14631
+ return /* @__PURE__ */ import_react14.default.createElement(import_toast_alert2.ToastAlertProvider, null, /* @__PURE__ */ import_react14.default.createElement(
15202
14632
  SavedViews,
15203
14633
  {
15204
14634
  onSelect,
15205
14635
  domain: props.domain,
15206
- userId,
14636
+ userId: props.userId,
15207
14637
  projectId,
15208
14638
  companyId,
15209
14639
  provider: "smart-grid",
15210
14640
  defaultView,
15211
- presetViews,
15212
14641
  tableName: props.tableName,
15213
- tableConfig
14642
+ tableConfig,
14643
+ stickyViewsKey: props.stickyViewsKey,
14644
+ enableSavedViews: props.enableSavedViews,
14645
+ backend: props.backend
15214
14646
  }
15215
- );
14647
+ ));
15216
14648
  };
15217
14649
 
15218
- // src/components/adapters/data-table/DataTableSavedViews.tsx
15219
- var import_react18 = __toESM(require("react"));
14650
+ // src/SavedViews/components/SavedViews/DataTable/DataTableSavedViews.tsx
14651
+ var import_react16 = __toESM(require("react"));
15220
14652
 
15221
- // src/components/adapters/data-table/DataTableDefaultSavedView.tsx
15222
- var import_react17 = require("react");
15223
- var DEFAULT_COLUMN_STATE2 = {
14653
+ // src/SavedViews/components/SavedViews/DataTable/DataTableDefaultSavedView.tsx
14654
+ var import_react15 = require("react");
14655
+ var import_core_react13 = require("@procore/core-react");
14656
+ var DEFAULT_COLUMN_STATE = {
15224
14657
  hidden: false,
15225
14658
  pinned: null,
15226
14659
  width: 200,
@@ -15235,7 +14668,7 @@ var getColumnState = (columnDefinitions) => {
15235
14668
  if (column.field.includes("custom_field")) {
15236
14669
  return {
15237
14670
  field: column.field,
15238
- ...DEFAULT_COLUMN_STATE2
14671
+ ...DEFAULT_COLUMN_STATE
15239
14672
  };
15240
14673
  }
15241
14674
  return {
@@ -15246,11 +14679,11 @@ var getColumnState = (columnDefinitions) => {
15246
14679
  rowGroupIndex: null,
15247
14680
  sort: null,
15248
14681
  sortIndex: null,
15249
- width: (column.minWidth ?? DEFAULT_COLUMN_STATE2.width) > DEFAULT_COLUMN_STATE2.width ? column.minWidth ?? DEFAULT_COLUMN_STATE2.width : (column.maxWidth ?? DEFAULT_COLUMN_STATE2.width) < DEFAULT_COLUMN_STATE2.width ? column.maxWidth ?? DEFAULT_COLUMN_STATE2.width : DEFAULT_COLUMN_STATE2.width
14682
+ width: (column.minWidth ?? DEFAULT_COLUMN_STATE.width) > DEFAULT_COLUMN_STATE.width ? column.minWidth ?? DEFAULT_COLUMN_STATE.width : (column.maxWidth ?? DEFAULT_COLUMN_STATE.width) < DEFAULT_COLUMN_STATE.width ? column.maxWidth ?? DEFAULT_COLUMN_STATE.width : DEFAULT_COLUMN_STATE.width
15250
14683
  };
15251
14684
  });
15252
14685
  };
15253
- var extractDefaultView2 = (columnDefinitions, receivedConfigFromTool) => {
14686
+ var extractDefaultView = (columnDefinitions, receivedConfigFromTool) => {
15254
14687
  var _a, _b, _c;
15255
14688
  const defaultColumnState = getColumnState(columnDefinitions);
15256
14689
  const result = {
@@ -15266,78 +14699,93 @@ var extractDefaultView2 = (columnDefinitions, receivedConfigFromTool) => {
15266
14699
  };
15267
14700
  return result;
15268
14701
  };
15269
- var useNormalizedDefaultViews2 = (defaultViews, columnDefinitions) => {
15270
- return (0, import_react17.useMemo)(
15271
- () => defaultViews.map((view) => ({
15272
- ...view,
15273
- share_token: "",
15274
- table_config: extractDefaultView2(columnDefinitions, view.table_config)
15275
- })),
15276
- [defaultViews, columnDefinitions]
14702
+ var useDefaultViewName2 = (domain, defaultViewName) => {
14703
+ const i18n = (0, import_core_react13.useI18nContext)();
14704
+ return defaultViewName || i18n.t(domain, {
14705
+ scope: "savedViews.defaultViewTitle",
14706
+ defaultValue: "Default View"
14707
+ });
14708
+ };
14709
+ var useDefaultView2 = (props) => {
14710
+ const name = useDefaultViewName2(props.domain, props.defaultViewName);
14711
+ const extractedDefaultConfig = (0, import_react15.useMemo)(
14712
+ () => extractDefaultView(props.columnDefinitions, props.receivedConfigFromTool),
14713
+ [props.columnDefinitions, props.receivedConfigFromTool]
15277
14714
  );
14715
+ return {
14716
+ id: "default",
14717
+ view_level: "default",
14718
+ name,
14719
+ table_config: extractedDefaultConfig
14720
+ };
15278
14721
  };
15279
14722
 
15280
- // src/components/adapters/data-table/DataTableSavedViews.tsx
15281
- var DataTableSavedViews = (0, import_react18.forwardRef)((props, ref) => {
15282
- const { tableApi, userId, projectId, companyId } = props;
15283
- const presetViews = useNormalizedDefaultViews2(
15284
- props.defaultViews,
15285
- props.columnDefinitions
15286
- );
15287
- const defaultView = presetViews.find((view) => view.id === "default") ?? presetViews[0];
15288
- const [internalTableConfig, setInternalTableConfig] = (0, import_react18.useState)(
15289
- ViewStorage.load(props.stickyViewsKey, defaultView).table_config
14723
+ // src/SavedViews/components/SavedViews/DataTable/DataTableSavedViews.tsx
14724
+ var import_toast_alert3 = require("@procore/toast-alert");
14725
+ var DataTableSavedViews = (0, import_react16.forwardRef)((props, ref) => {
14726
+ const { tableApi, onTableConfigChange, projectId, companyId } = props;
14727
+ const [internalTableConfig, setInternalTableConfig] = (0, import_react16.useState)(
14728
+ props.defaultViewConfig
15290
14729
  );
15291
- (0, import_react18.useImperativeHandle)(ref, () => ({
14730
+ (0, import_react16.useImperativeHandle)(ref, () => ({
15292
14731
  setTableConfig: (newConfig) => {
15293
- setInternalTableConfig(newConfig);
14732
+ handleConfigChange(newConfig);
15294
14733
  }
15295
14734
  }));
15296
- const onSelect = (0, import_react18.useCallback)(
15297
- ({ item }) => {
15298
- const isPresetView = item.view_level === "default";
15299
- const updatedView = isPresetView ? item : {
15300
- ...item,
15301
- table_config: customAndConfigSync(
15302
- item.table_config,
15303
- defaultView.table_config
15304
- )
15305
- };
15306
- updateTableConfig(updatedView, tableApi, "data-table");
15307
- setInternalTableConfig(updatedView.table_config);
15308
- return updatedView;
14735
+ const handleConfigChange = (0, import_react16.useCallback)(
14736
+ (newConfig) => {
14737
+ setInternalTableConfig(newConfig);
14738
+ onTableConfigChange(newConfig);
15309
14739
  },
15310
- [defaultView, tableApi]
14740
+ [onTableConfigChange]
15311
14741
  );
14742
+ const defaultView = useDefaultView2({
14743
+ defaultViewName: props.defaultViewName,
14744
+ receivedConfigFromTool: props.defaultViewConfig,
14745
+ domain: props.domain,
14746
+ columnDefinitions: props.columnDefinitions
14747
+ });
14748
+ const onSelect = ({ item }) => {
14749
+ const isDefaultView = item.id === "default";
14750
+ const updatedView = isDefaultView ? defaultView : {
14751
+ ...item,
14752
+ table_config: customAndConfigSync(
14753
+ item.table_config,
14754
+ defaultView.table_config
14755
+ )
14756
+ };
14757
+ updateTableConfig(updatedView, tableApi, "data-table", handleConfigChange);
14758
+ return updatedView;
14759
+ };
15312
14760
  if (!internalTableConfig) {
15313
14761
  return null;
15314
14762
  }
15315
- return /* @__PURE__ */ import_react18.default.createElement(
14763
+ return /* @__PURE__ */ import_react16.default.createElement(import_toast_alert3.ToastAlertProvider, null, /* @__PURE__ */ import_react16.default.createElement(
15316
14764
  SavedViews,
15317
14765
  {
15318
14766
  onSelect,
15319
14767
  domain: props.domain,
15320
- userId,
14768
+ userId: props.userId,
15321
14769
  projectId,
15322
14770
  companyId,
15323
14771
  provider: "data-table",
15324
14772
  defaultView,
15325
- presetViews,
15326
14773
  tableName: props.tableName,
15327
- tableConfig: internalTableConfig
14774
+ tableConfig: internalTableConfig,
14775
+ stickyViewsKey: props.stickyViewsKey,
14776
+ enableSavedViews: props.enableSavedViews
15328
14777
  }
15329
- );
14778
+ ));
15330
14779
  });
15331
14780
  DataTableSavedViews.displayName = "DataTableSavedViews";
15332
14781
  // Annotate the CommonJS export names for ESM import in node:
15333
14782
  0 && (module.exports = {
15334
14783
  DataTableSavedViews,
15335
14784
  ExpandedPanel,
15336
- FormModal,
15337
14785
  PanelContent,
15338
14786
  SavedViewCollectionMenuItem,
15339
- SavedViews,
15340
14787
  SavedViewsDeleteConfirmationModalShared,
14788
+ SavedViewsFormModal,
15341
14789
  SmartGridSavedViews,
15342
14790
  getTranslations,
15343
14791
  useSavedViewsPanel