@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.
@@ -69,7 +69,7 @@ var require_big = __commonJS({
69
69
  "use strict";
70
70
  (function(GLOBAL) {
71
71
  "use strict";
72
- 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;
72
+ 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;
73
73
  function _Big_() {
74
74
  function Big2(n2) {
75
75
  var x2 = this;
@@ -90,7 +90,7 @@ var require_big = __commonJS({
90
90
  }
91
91
  x2.constructor = Big2;
92
92
  }
93
- Big2.prototype = P4;
93
+ Big2.prototype = P3;
94
94
  Big2.DP = DP;
95
95
  Big2.RM = RM;
96
96
  Big2.NE = NE;
@@ -187,12 +187,12 @@ var require_big = __commonJS({
187
187
  }
188
188
  return x2.s < 0 && isNonzero ? "-" + s2 : s2;
189
189
  }
190
- P4.abs = function() {
190
+ P3.abs = function() {
191
191
  var x2 = new this.constructor(this);
192
192
  x2.s = 1;
193
193
  return x2;
194
194
  };
195
- P4.cmp = function(y2) {
195
+ P3.cmp = function(y2) {
196
196
  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;
197
197
  if (!xc[0] || !yc[0])
198
198
  return !xc[0] ? !yc[0] ? 0 : -j2 : i2;
@@ -208,7 +208,7 @@ var require_big = __commonJS({
208
208
  }
209
209
  return k2 == l2 ? 0 : k2 > l2 ^ isneg ? 1 : -1;
210
210
  };
211
- P4.div = function(y2) {
211
+ P3.div = function(y2) {
212
212
  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;
213
213
  if (dp !== ~~dp || dp < 0 || dp > MAX_DP) {
214
214
  throw Error(INVALID_DP);
@@ -271,22 +271,22 @@ var require_big = __commonJS({
271
271
  round(q2, p, Big2.RM, r2[0] !== UNDEFINED);
272
272
  return q2;
273
273
  };
274
- P4.eq = function(y2) {
274
+ P3.eq = function(y2) {
275
275
  return this.cmp(y2) === 0;
276
276
  };
277
- P4.gt = function(y2) {
277
+ P3.gt = function(y2) {
278
278
  return this.cmp(y2) > 0;
279
279
  };
280
- P4.gte = function(y2) {
280
+ P3.gte = function(y2) {
281
281
  return this.cmp(y2) > -1;
282
282
  };
283
- P4.lt = function(y2) {
283
+ P3.lt = function(y2) {
284
284
  return this.cmp(y2) < 0;
285
285
  };
286
- P4.lte = function(y2) {
286
+ P3.lte = function(y2) {
287
287
  return this.cmp(y2) < 1;
288
288
  };
289
- P4.minus = P4.sub = function(y2) {
289
+ P3.minus = P3.sub = function(y2) {
290
290
  var i2, j2, t2, xlty, x2 = this, Big2 = x2.constructor, a2 = x2.s, b2 = (y2 = new Big2(y2)).s;
291
291
  if (a2 != b2) {
292
292
  y2.s = -b2;
@@ -356,7 +356,7 @@ var require_big = __commonJS({
356
356
  y2.e = ye2;
357
357
  return y2;
358
358
  };
359
- P4.mod = function(y2) {
359
+ P3.mod = function(y2) {
360
360
  var ygtx, x2 = this, Big2 = x2.constructor, a2 = x2.s, b2 = (y2 = new Big2(y2)).s;
361
361
  if (!y2.c[0]) {
362
362
  throw Error(DIV_BY_ZERO);
@@ -375,12 +375,12 @@ var require_big = __commonJS({
375
375
  Big2.RM = b2;
376
376
  return this.minus(x2.times(y2));
377
377
  };
378
- P4.neg = function() {
378
+ P3.neg = function() {
379
379
  var x2 = new this.constructor(this);
380
380
  x2.s = -x2.s;
381
381
  return x2;
382
382
  };
383
- P4.plus = P4.add = function(y2) {
383
+ P3.plus = P3.add = function(y2) {
384
384
  var e2, k2, t2, x2 = this, Big2 = x2.constructor;
385
385
  y2 = new Big2(y2);
386
386
  if (x2.s != y2.s) {
@@ -430,7 +430,7 @@ var require_big = __commonJS({
430
430
  y2.e = ye2;
431
431
  return y2;
432
432
  };
433
- P4.pow = function(n2) {
433
+ P3.pow = function(n2) {
434
434
  var x2 = this, one = new x2.constructor("1"), y2 = one, isneg = n2 < 0;
435
435
  if (n2 !== ~~n2 || n2 < -MAX_POWER || n2 > MAX_POWER) {
436
436
  throw Error(INVALID + "exponent");
@@ -447,13 +447,13 @@ var require_big = __commonJS({
447
447
  }
448
448
  return isneg ? one.div(y2) : y2;
449
449
  };
450
- P4.prec = function(sd, rm) {
450
+ P3.prec = function(sd, rm) {
451
451
  if (sd !== ~~sd || sd < 1 || sd > MAX_DP) {
452
452
  throw Error(INVALID + "precision");
453
453
  }
454
454
  return round(new this.constructor(this), sd, rm);
455
455
  };
456
- P4.round = function(dp, rm) {
456
+ P3.round = function(dp, rm) {
457
457
  if (dp === UNDEFINED)
458
458
  dp = 0;
459
459
  else if (dp !== ~~dp || dp < -MAX_DP || dp > MAX_DP) {
@@ -461,7 +461,7 @@ var require_big = __commonJS({
461
461
  }
462
462
  return round(new this.constructor(this), dp + this.e + 1, rm);
463
463
  };
464
- P4.sqrt = function() {
464
+ P3.sqrt = function() {
465
465
  var r2, c2, t2, x2 = this, Big2 = x2.constructor, s2 = x2.s, e2 = x2.e, half = new Big2("0.5");
466
466
  if (!x2.c[0])
467
467
  return new Big2(x2);
@@ -486,7 +486,7 @@ var require_big = __commonJS({
486
486
  } while (t2.c.slice(0, e2).join("") !== r2.c.slice(0, e2).join(""));
487
487
  return round(r2, (Big2.DP -= 4) + r2.e + 1, Big2.RM);
488
488
  };
489
- P4.times = P4.mul = function(y2) {
489
+ P3.times = P3.mul = function(y2) {
490
490
  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;
491
491
  y2.s = x2.s == y2.s ? 1 : -1;
492
492
  if (!xc[0] || !yc[0]) {
@@ -522,7 +522,7 @@ var require_big = __commonJS({
522
522
  y2.c = c2;
523
523
  return y2;
524
524
  };
525
- P4.toExponential = function(dp, rm) {
525
+ P3.toExponential = function(dp, rm) {
526
526
  var x2 = this, n2 = x2.c[0];
527
527
  if (dp !== UNDEFINED) {
528
528
  if (dp !== ~~dp || dp < 0 || dp > MAX_DP) {
@@ -534,7 +534,7 @@ var require_big = __commonJS({
534
534
  }
535
535
  return stringify(x2, true, !!n2);
536
536
  };
537
- P4.toFixed = function(dp, rm) {
537
+ P3.toFixed = function(dp, rm) {
538
538
  var x2 = this, n2 = x2.c[0];
539
539
  if (dp !== UNDEFINED) {
540
540
  if (dp !== ~~dp || dp < 0 || dp > MAX_DP) {
@@ -546,18 +546,18 @@ var require_big = __commonJS({
546
546
  }
547
547
  return stringify(x2, false, !!n2);
548
548
  };
549
- P4.toJSON = P4.toString = function() {
549
+ P3.toJSON = P3.toString = function() {
550
550
  var x2 = this, Big2 = x2.constructor;
551
551
  return stringify(x2, x2.e <= Big2.NE || x2.e >= Big2.PE, !!x2.c[0]);
552
552
  };
553
- P4.toNumber = function() {
553
+ P3.toNumber = function() {
554
554
  var n2 = +stringify(this, true, true);
555
555
  if (this.constructor.strict === true && !this.eq(n2.toString())) {
556
556
  throw Error(NAME + "Imprecise conversion");
557
557
  }
558
558
  return n2;
559
559
  };
560
- P4.toPrecision = function(sd, rm) {
560
+ P3.toPrecision = function(sd, rm) {
561
561
  var x2 = this, Big2 = x2.constructor, n2 = x2.c[0];
562
562
  if (sd !== UNDEFINED) {
563
563
  if (sd !== ~~sd || sd < 1 || sd > MAX_DP) {
@@ -569,7 +569,7 @@ var require_big = __commonJS({
569
569
  }
570
570
  return stringify(x2, sd <= x2.e || x2.e <= Big2.NE || x2.e >= Big2.PE, !!n2);
571
571
  };
572
- P4.valueOf = function() {
572
+ P3.valueOf = function() {
573
573
  var x2 = this, Big2 = x2.constructor;
574
574
  if (Big2.strict === true) {
575
575
  throw Error(NAME + "valueOf disallowed");
@@ -1879,13 +1879,13 @@ var require_GetFallbackLocaleList = __commonJS({
1879
1879
  var require_GetTranslationsFromLocale = __commonJS({
1880
1880
  "../../node_modules/@procore/globalization-toolkit/dist/getTranslationsFromLocale/GetTranslationsFromLocale.js"(exports) {
1881
1881
  "use strict";
1882
- var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P4, generator) {
1882
+ var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P3, generator) {
1883
1883
  function adopt(value) {
1884
- return value instanceof P4 ? value : new P4(function(resolve) {
1884
+ return value instanceof P3 ? value : new P3(function(resolve) {
1885
1885
  resolve(value);
1886
1886
  });
1887
1887
  }
1888
- return new (P4 || (P4 = Promise))(function(resolve, reject) {
1888
+ return new (P3 || (P3 = Promise))(function(resolve, reject) {
1889
1889
  function fulfilled(value) {
1890
1890
  try {
1891
1891
  step(generator.next(value));
@@ -2017,9 +2017,9 @@ var require_dist = __commonJS({
2017
2017
  }
2018
2018
  });
2019
2019
 
2020
- // ../../node_modules/styled-components/node_modules/react-is/cjs/react-is.production.min.js
2020
+ // node_modules/react-is/cjs/react-is.production.min.js
2021
2021
  var require_react_is_production_min = __commonJS({
2022
- "../../node_modules/styled-components/node_modules/react-is/cjs/react-is.production.min.js"(exports) {
2022
+ "node_modules/react-is/cjs/react-is.production.min.js"(exports) {
2023
2023
  "use strict";
2024
2024
  var b2 = 60103;
2025
2025
  var c2 = 60106;
@@ -2155,9 +2155,9 @@ var require_react_is_production_min = __commonJS({
2155
2155
  }
2156
2156
  });
2157
2157
 
2158
- // ../../node_modules/styled-components/node_modules/react-is/cjs/react-is.development.js
2158
+ // node_modules/react-is/cjs/react-is.development.js
2159
2159
  var require_react_is_development = __commonJS({
2160
- "../../node_modules/styled-components/node_modules/react-is/cjs/react-is.development.js"(exports) {
2160
+ "node_modules/react-is/cjs/react-is.development.js"(exports) {
2161
2161
  "use strict";
2162
2162
  if (process.env.NODE_ENV !== "production") {
2163
2163
  (function() {
@@ -2347,9 +2347,9 @@ var require_react_is_development = __commonJS({
2347
2347
  }
2348
2348
  });
2349
2349
 
2350
- // ../../node_modules/styled-components/node_modules/react-is/index.js
2350
+ // node_modules/react-is/index.js
2351
2351
  var require_react_is = __commonJS({
2352
- "../../node_modules/styled-components/node_modules/react-is/index.js"(exports, module) {
2352
+ "node_modules/react-is/index.js"(exports, module) {
2353
2353
  "use strict";
2354
2354
  if (process.env.NODE_ENV === "production") {
2355
2355
  module.exports = require_react_is_production_min();
@@ -8468,7 +8468,7 @@ var require_toposort = __commonJS({
8468
8468
  }
8469
8469
  });
8470
8470
 
8471
- // src/utils/translations/translations.ts
8471
+ // src/utils/Translations/translations.ts
8472
8472
  var import_globalization_toolkit = __toESM(require_dist());
8473
8473
 
8474
8474
  // src/locales/de-DE.json
@@ -8798,12 +8798,7 @@ var en_default = {
8798
8798
  create: "Create",
8799
8799
  edit: "Edit",
8800
8800
  cancel: "Cancel",
8801
- close: "Close",
8802
- viewTemporarily: "View Temporarily",
8803
- createView: "Create View",
8804
- copyShareLink: "Copy Share Link",
8805
- linkCopied: "Share link copied to clipboard",
8806
- clearTemporary: "Remove"
8801
+ close: "Close"
8807
8802
  },
8808
8803
  modal: {
8809
8804
  edit: {
@@ -8816,9 +8811,6 @@ var en_default = {
8816
8811
  headline: "Delete Saved View",
8817
8812
  description: "This view cannot be restored once it has been deleted."
8818
8813
  },
8819
- copyConfirmation: {
8820
- 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."
8821
- },
8822
8814
  fields: {
8823
8815
  name: "Name",
8824
8816
  description: "Description",
@@ -8851,25 +8843,16 @@ var en_default = {
8851
8843
  update: {
8852
8844
  success: "The saved view was successfully updated."
8853
8845
  },
8854
- create: {
8855
- success: "The saved view was successfully created."
8856
- },
8857
- copy: {
8858
- success: "The link was successfully created and copied to the clipboard."
8859
- },
8860
8846
  errors: {
8861
8847
  fetch: "Sorry, the saved views couldn't be fetched. Try again.",
8862
8848
  create: "Sorry, the saved view couldn't be created. Try again.",
8863
8849
  update: "Sorry, the saved view couldn't be updated. Try again.",
8864
- delete: "Sorry, the saved view couldn't be deleted. Try again.",
8865
- copyFailed: "Failed to copy share link to clipboard",
8866
- notFound: "Sorry, the saved view could not be found. Please try again."
8850
+ delete: "Sorry, the saved view couldn't be deleted. Try again."
8867
8851
  },
8868
8852
  defaultViewTitle: {
8869
8853
  rfi: "All RFIs",
8870
8854
  submittal_log: "All Submittals"
8871
8855
  },
8872
- temporaryViewName: "Temporary View",
8873
8856
  viewLevel: {
8874
8857
  company: "Company Views",
8875
8858
  project: "Project Views",
@@ -9268,84 +9251,6 @@ var is_IS_default = {
9268
9251
  }
9269
9252
  };
9270
9253
 
9271
- // src/locales/it-IT.json
9272
- var it_IT_default = {
9273
- savedViews: {
9274
- name: "Vista salvata",
9275
- title: "Viste salvate",
9276
- tooltip: "Creare e salvare qualsiasi layout di tabella personalizzato per tornare rapidamente alla vista preferita.",
9277
- button: {
9278
- title: "Viste"
9279
- },
9280
- actions: {
9281
- update: "Aggiorna",
9282
- delete: "Elimina",
9283
- create: "Crea",
9284
- edit: "Modifica",
9285
- cancel: "Annulla",
9286
- close: "Chiudi"
9287
- },
9288
- modal: {
9289
- edit: {
9290
- title: "Aggiorna vista salvata"
9291
- },
9292
- create: {
9293
- title: "Crea vista salvata"
9294
- },
9295
- delete: {
9296
- headline: "Elimina vista salvata",
9297
- description: "Una volta eliminata, non sar\xE0 pi\xF9 possibile ripristinare la vista."
9298
- },
9299
- fields: {
9300
- name: "Nome",
9301
- description: "Descrizione",
9302
- viewLevel: "Livello vista",
9303
- viewLevels: {
9304
- company: "Vista dell'azienda",
9305
- project: "Vista del progetto",
9306
- personal: "Vista personale"
9307
- }
9308
- },
9309
- errors: {
9310
- maxLengthName: "Non pu\xF2 contenere pi\xF9 di {{maxLength}} caratteri.",
9311
- required: "Il campo non pu\xF2 essere vuoto.",
9312
- duplicateName: "Esiste gi\xE0 una vista salvata con questo nome. Rinominarla e riprovare.",
9313
- unknown: "Si \xE8 verificato un errore. Riprovare.",
9314
- title: "Impossibile {{mode}} questa vista salvata",
9315
- description: {
9316
- create: "Correggere gli errori di seguito e provare a creare di nuovo",
9317
- update: "Correggere gli errori di seguito e provare ad aggiornare di nuovo"
9318
- }
9319
- },
9320
- info: {
9321
- required_fields: "campi obbligatori"
9322
- }
9323
- },
9324
- ariaLabels: {
9325
- menuItem: "Voce di menu Viste salvate {{name}}",
9326
- modal: "Finestra modale per creare/aggiornare viste salvate"
9327
- },
9328
- update: {
9329
- success: "Vista salvata aggiornata correttamente."
9330
- },
9331
- errors: {
9332
- fetch: "Impossibile recuperare le viste salvate. Riprovare.",
9333
- create: "Impossibile creare la vista salvata. Riprovare.",
9334
- update: "Impossibile aggiornare la vista salvata. Riprovare.",
9335
- delete: "Impossibile eliminare la vista salvata. Riprovare."
9336
- },
9337
- defaultViewTitle: {
9338
- rfi: "Tutte le RDI",
9339
- submittal_log: "Tutti gli elementi da inoltrare"
9340
- },
9341
- viewLevel: {
9342
- company: "Viste dell'azienda",
9343
- project: "Viste del progetto",
9344
- personal: "Viste personali"
9345
- }
9346
- }
9347
- };
9348
-
9349
9254
  // src/locales/ja-JP.json
9350
9255
  var ja_JP_default = {
9351
9256
  savedViews: {
@@ -9736,8 +9641,8 @@ var zh_SG_default = {
9736
9641
  }
9737
9642
  };
9738
9643
 
9739
- // src/locales/index.ts
9740
- var locales_default = {
9644
+ // src/utils/Translations/translations.ts
9645
+ var supportedLocales = {
9741
9646
  "de-DE": de_DE_default,
9742
9647
  "en-AU": en_AU_default,
9743
9648
  "en-CA": en_CA_default,
@@ -9748,18 +9653,12 @@ var locales_default = {
9748
9653
  "fr-CA": fr_CA_default,
9749
9654
  "fr-FR": fr_FR_default,
9750
9655
  "is-IS": is_IS_default,
9751
- "it-IT": it_IT_default,
9752
9656
  "ja-JP": ja_JP_default,
9753
- "pl-PL": pl_PL_default,
9754
9657
  "pt-BR": pt_BR_default,
9755
9658
  "th-TH": th_TH_default,
9756
- "zh-SG": zh_SG_default
9757
- };
9758
-
9759
- // src/utils/translations/translations.ts
9760
- var supportedLocales = {
9761
- ...locales_default,
9762
- pseudo: locales_default.en
9659
+ "zh-SG": zh_SG_default,
9660
+ "pl-PL": pl_PL_default,
9661
+ pseudo: en_default
9763
9662
  };
9764
9663
  function getTranslations(envLocale) {
9765
9664
  return Object.fromEntries(
@@ -9770,7 +9669,7 @@ function getTranslations(envLocale) {
9770
9669
  );
9771
9670
  }
9772
9671
 
9773
- // src/components/buttons/useSavedViewsPanel.tsx
9672
+ // src/SavedViews/components/Buttons/useSavedViewsPanel.tsx
9774
9673
  import { useState } from "react";
9775
9674
 
9776
9675
  // ../../node_modules/tslib/tslib.es6.mjs
@@ -9799,7 +9698,7 @@ function __rest(s2, e2) {
9799
9698
  return t2;
9800
9699
  }
9801
9700
 
9802
- // node_modules/@procore/core-icons/dist/Icon.js
9701
+ // ../../node_modules/@procore/core-icons/dist/Icon.js
9803
9702
  import * as React from "react";
9804
9703
  function getSize(size) {
9805
9704
  if (size === "sm") {
@@ -9818,7 +9717,7 @@ function Icon(_a) {
9818
9717
  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;
9819
9718
  }
9820
9719
 
9821
- // node_modules/@procore/core-icons/dist/icons/Building.js
9720
+ // ../../node_modules/@procore/core-icons/dist/icons/Building.js
9822
9721
  import * as React2 from "react";
9823
9722
  var Building = React2.forwardRef(function Building2(props, ref) {
9824
9723
  return React2.createElement(
@@ -9834,7 +9733,7 @@ var Building = React2.forwardRef(function Building2(props, ref) {
9834
9733
  Building.displayName = "Building";
9835
9734
  var Building_default = Building;
9836
9735
 
9837
- // node_modules/@procore/core-icons/dist/icons/ChevronDown.js
9736
+ // ../../node_modules/@procore/core-icons/dist/icons/ChevronDown.js
9838
9737
  import * as React3 from "react";
9839
9738
  var ChevronDown = React3.forwardRef(function ChevronDown2(props, ref) {
9840
9739
  return React3.createElement(
@@ -9850,7 +9749,7 @@ var ChevronDown = React3.forwardRef(function ChevronDown2(props, ref) {
9850
9749
  ChevronDown.displayName = "ChevronDown";
9851
9750
  var ChevronDown_default = ChevronDown;
9852
9751
 
9853
- // node_modules/@procore/core-icons/dist/icons/ChevronRight.js
9752
+ // ../../node_modules/@procore/core-icons/dist/icons/ChevronRight.js
9854
9753
  import * as React4 from "react";
9855
9754
  var ChevronRight = React4.forwardRef(function ChevronRight2(props, ref) {
9856
9755
  return React4.createElement(
@@ -9866,127 +9765,94 @@ var ChevronRight = React4.forwardRef(function ChevronRight2(props, ref) {
9866
9765
  ChevronRight.displayName = "ChevronRight";
9867
9766
  var ChevronRight_default = ChevronRight;
9868
9767
 
9869
- // node_modules/@procore/core-icons/dist/icons/Clear.js
9768
+ // ../../node_modules/@procore/core-icons/dist/icons/Excavator.js
9870
9769
  import * as React5 from "react";
9871
- var Clear = React5.forwardRef(function Clear2(props, ref) {
9770
+ var Excavator = React5.forwardRef(function Excavator2(props, ref) {
9872
9771
  return React5.createElement(
9873
- Icon,
9874
- __assign({}, props, { name: "Clear" }),
9875
- React5.createElement(
9876
- "svg",
9877
- { width: "24", height: "24", viewBox: "0 0 24 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ref },
9878
- 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" })
9879
- )
9880
- );
9881
- });
9882
- Clear.displayName = "Clear";
9883
- var Clear_default = Clear;
9884
-
9885
- // node_modules/@procore/core-icons/dist/icons/Excavator.js
9886
- import * as React6 from "react";
9887
- var Excavator = React6.forwardRef(function Excavator2(props, ref) {
9888
- return React6.createElement(
9889
9772
  Icon,
9890
9773
  __assign({}, props, { name: "Excavator" }),
9891
- React6.createElement(
9774
+ React5.createElement(
9892
9775
  "svg",
9893
9776
  { width: "24", height: "24", viewBox: "0 0 24 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ref },
9894
- 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" }),
9895
- 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" })
9777
+ 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" }),
9778
+ 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" })
9896
9779
  )
9897
9780
  );
9898
9781
  });
9899
9782
  Excavator.displayName = "Excavator";
9900
9783
  var Excavator_default = Excavator;
9901
9784
 
9902
- // node_modules/@procore/core-icons/dist/icons/ExpandSidebar.js
9903
- import * as React7 from "react";
9904
- var ExpandSidebar = React7.forwardRef(function ExpandSidebar2(props, ref) {
9905
- return React7.createElement(
9785
+ // ../../node_modules/@procore/core-icons/dist/icons/ExpandSidebar.js
9786
+ import * as React6 from "react";
9787
+ var ExpandSidebar = React6.forwardRef(function ExpandSidebar2(props, ref) {
9788
+ return React6.createElement(
9906
9789
  Icon,
9907
9790
  __assign({}, props, { name: "ExpandSidebar" }),
9908
- React7.createElement(
9791
+ React6.createElement(
9909
9792
  "svg",
9910
9793
  { width: "24", height: "24", viewBox: "0 0 24 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ref },
9911
- React7.createElement("path", { d: "M3 6.5H11V9H3V6.5Z", fill: "currentColor" }),
9912
- React7.createElement("path", { d: "M3 15H11V17.5H3V15Z", fill: "currentColor" }),
9913
- 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" })
9794
+ React6.createElement("path", { d: "M3 6.5H11V9H3V6.5Z", fill: "currentColor" }),
9795
+ React6.createElement("path", { d: "M3 15H11V17.5H3V15Z", fill: "currentColor" }),
9796
+ 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" })
9914
9797
  )
9915
9798
  );
9916
9799
  });
9917
9800
  ExpandSidebar.displayName = "ExpandSidebar";
9918
9801
  var ExpandSidebar_default = ExpandSidebar;
9919
9802
 
9920
- // node_modules/@procore/core-icons/dist/icons/Help.js
9921
- import * as React8 from "react";
9922
- var Help = React8.forwardRef(function Help2(props, ref) {
9923
- return React8.createElement(
9803
+ // ../../node_modules/@procore/core-icons/dist/icons/Help.js
9804
+ import * as React7 from "react";
9805
+ var Help = React7.forwardRef(function Help2(props, ref) {
9806
+ return React7.createElement(
9924
9807
  Icon,
9925
9808
  __assign({}, props, { name: "Help" }),
9926
- React8.createElement(
9809
+ React7.createElement(
9927
9810
  "svg",
9928
9811
  { width: "24", height: "24", viewBox: "0 0 24 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ref },
9929
- 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" })
9812
+ 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" })
9930
9813
  )
9931
9814
  );
9932
9815
  });
9933
9816
  Help.displayName = "Help";
9934
9817
  var Help_default = Help;
9935
9818
 
9936
- // node_modules/@procore/core-icons/dist/icons/Link.js
9937
- import * as React9 from "react";
9938
- var Link = React9.forwardRef(function Link2(props, ref) {
9939
- return React9.createElement(
9940
- Icon,
9941
- __assign({}, props, { name: "Link" }),
9942
- React9.createElement(
9943
- "svg",
9944
- { width: "24", height: "24", viewBox: "0 0 24 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ref },
9945
- 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" }),
9946
- 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" })
9947
- )
9948
- );
9949
- });
9950
- Link.displayName = "Link";
9951
- var Link_default = Link;
9952
-
9953
- // node_modules/@procore/core-icons/dist/icons/Person.js
9954
- import * as React10 from "react";
9955
- var Person = React10.forwardRef(function Person2(props, ref) {
9956
- return React10.createElement(
9819
+ // ../../node_modules/@procore/core-icons/dist/icons/Person.js
9820
+ import * as React8 from "react";
9821
+ var Person = React8.forwardRef(function Person2(props, ref) {
9822
+ return React8.createElement(
9957
9823
  Icon,
9958
9824
  __assign({}, props, { name: "Person" }),
9959
- React10.createElement(
9825
+ React8.createElement(
9960
9826
  "svg",
9961
9827
  { width: "24", height: "24", viewBox: "0 0 24 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ref },
9962
- 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" })
9828
+ 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" })
9963
9829
  )
9964
9830
  );
9965
9831
  });
9966
9832
  Person.displayName = "Person";
9967
9833
  var Person_default = Person;
9968
9834
 
9969
- // node_modules/@procore/core-icons/dist/icons/Plus.js
9970
- import * as React11 from "react";
9971
- var Plus = React11.forwardRef(function Plus2(props, ref) {
9972
- return React11.createElement(
9835
+ // ../../node_modules/@procore/core-icons/dist/icons/Plus.js
9836
+ import * as React9 from "react";
9837
+ var Plus = React9.forwardRef(function Plus2(props, ref) {
9838
+ return React9.createElement(
9973
9839
  Icon,
9974
9840
  __assign({}, props, { name: "Plus" }),
9975
- React11.createElement(
9841
+ React9.createElement(
9976
9842
  "svg",
9977
9843
  { width: "24", height: "24", viewBox: "0 0 24 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ref },
9978
- React11.createElement("path", { d: "M13.25 5H10.75V10.75H5V13.25H10.75V19H13.25V13.25H19V10.75H13.25V5Z", fill: "currentColor" })
9844
+ React9.createElement("path", { d: "M13.25 5H10.75V10.75H5V13.25H10.75V19H13.25V13.25H19V10.75H13.25V5Z", fill: "currentColor" })
9979
9845
  )
9980
9846
  );
9981
9847
  });
9982
9848
  Plus.displayName = "Plus";
9983
9849
  var Plus_default = Plus;
9984
9850
 
9985
- // src/components/buttons/SavedViewsButton.tsx
9851
+ // src/SavedViews/components/Buttons/SavedViewsButton.tsx
9986
9852
  import { Button } from "@procore/core-react";
9987
- import React13 from "react";
9853
+ import React11 from "react";
9988
9854
 
9989
- // ../../node_modules/styled-components/dist/styled-components.esm.js
9855
+ // node_modules/styled-components/dist/styled-components.esm.js
9990
9856
  var import_react_is = __toESM(require_react_is());
9991
9857
  var import_shallowequal = __toESM(require_shallowequal());
9992
9858
  import r, { useState as o, useContext as s, useMemo as i, useEffect as a, useRef as c, createElement as u } from "react";
@@ -10121,7 +9987,7 @@ function stylis_min(W2) {
10121
9987
  break;
10122
9988
  }
10123
9989
  default:
10124
- 58 !== f2.charCodeAt(t2 - 1) && (p += P4(f2, q2, g2, f2.charCodeAt(2)));
9990
+ 58 !== f2.charCodeAt(t2 - 1) && (p += P3(f2, q2, g2, f2.charCodeAt(2)));
10125
9991
  }
10126
9992
  I = r2 = u2 = q2 = 0;
10127
9993
  f2 = "";
@@ -10294,7 +10160,7 @@ function stylis_min(W2) {
10294
10160
  }
10295
10161
  return d + c2;
10296
10162
  }
10297
- function P4(d, c2, e2, h) {
10163
+ function P3(d, c2, e2, h) {
10298
10164
  var a2 = d + ";", m2 = 2 * c2 + 3 * e2 + 4 * h;
10299
10165
  if (944 === m2) {
10300
10166
  d = a2.indexOf(":", 9) + 1;
@@ -10401,7 +10267,7 @@ function stylis_min(W2) {
10401
10267
  case 931:
10402
10268
  case 953:
10403
10269
  if (true === la.test(d))
10404
- 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;
10270
+ 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;
10405
10271
  break;
10406
10272
  case 962:
10407
10273
  if (a2 = "-webkit-" + a2 + (102 === a2.charCodeAt(5) ? "-ms-" + a2 : "") + a2, 211 === e2 + h && 105 === a2.charCodeAt(13) && 0 < a2.indexOf("transform", 10))
@@ -10415,7 +10281,7 @@ function stylis_min(W2) {
10415
10281
  return R2(2 !== c2 ? h : h.replace(na, "$1"), e2, c2);
10416
10282
  }
10417
10283
  function ea(d, c2) {
10418
- var e2 = P4(c2, c2.charCodeAt(0), c2.charCodeAt(1), c2.charCodeAt(2));
10284
+ var e2 = P3(c2, c2.charCodeAt(0), c2.charCodeAt(1), c2.charCodeAt(2));
10419
10285
  return e2 !== c2 + ";" ? e2.replace(oa, " or ($1)").substring(4) : "(" + c2 + ")";
10420
10286
  }
10421
10287
  function H3(d, c2, e2, h, a2, m2, b2, v2, n2, q2) {
@@ -10541,7 +10407,7 @@ function memoize(fn) {
10541
10407
  };
10542
10408
  }
10543
10409
 
10544
- // ../../node_modules/styled-components/node_modules/@emotion/is-prop-valid/dist/emotion-is-prop-valid.esm.js
10410
+ // ../../node_modules/@emotion/is-prop-valid/dist/emotion-is-prop-valid.esm.js
10545
10411
  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)-.*))$/;
10546
10412
  var isPropValid = /* @__PURE__ */ memoize(
10547
10413
  function(prop) {
@@ -10550,7 +10416,7 @@ var isPropValid = /* @__PURE__ */ memoize(
10550
10416
  /* Z+1 */
10551
10417
  );
10552
10418
 
10553
- // ../../node_modules/styled-components/dist/styled-components.esm.js
10419
+ // node_modules/styled-components/dist/styled-components.esm.js
10554
10420
  var import_hoist_non_react_statics = __toESM(require_hoist_non_react_statics_cjs());
10555
10421
  function m() {
10556
10422
  return (m = Object.assign || function(e2) {
@@ -11073,7 +10939,7 @@ function Fe(e2, t2, n2) {
11073
10939
  o2 && e2.shouldForwardProp && (N = t2.shouldForwardProp ? function(n3, r2, o3) {
11074
10940
  return e2.shouldForwardProp(n3, r2, o3) && t2.shouldForwardProp(n3, r2, o3);
11075
10941
  } : e2.shouldForwardProp);
11076
- var A2, C2 = new re(n2, v2, o2 ? e2.componentStyle : void 0), I = C2.isStatic && 0 === c2.length, P4 = function(e3, t3) {
10942
+ var A2, C2 = new re(n2, v2, o2 ? e2.componentStyle : void 0), I = C2.isStatic && 0 === c2.length, P3 = function(e3, t3) {
11077
10943
  return function(e4, t4, n3, r2) {
11078
10944
  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) {
11079
10945
  void 0 === e5 && (e5 = S);
@@ -11092,7 +10958,7 @@ function Fe(e2, t2, n2) {
11092
10958
  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, u(b2, A3);
11093
10959
  }(A2, e3, t3, I);
11094
10960
  };
11095
- return P4.displayName = y2, (A2 = r.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) {
10961
+ return P3.displayName = y2, (A2 = r.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) {
11096
10962
  var r2 = t2.componentId, o3 = function(e4, t3) {
11097
10963
  if (null == e4)
11098
10964
  return {};
@@ -11197,8 +11063,8 @@ var Ue = function() {
11197
11063
  "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);
11198
11064
  var styled_components_esm_default = Ye;
11199
11065
 
11200
- // src/components/EnvironmentI18nProvider.tsx
11201
- import React12 from "react";
11066
+ // src/SavedViews/components/EnvironmentI18nProvider.tsx
11067
+ import React10 from "react";
11202
11068
  import { I18nContext, useI18n, useI18nContext } from "@procore/core-react";
11203
11069
  import { useRequestTranslations } from "@procore/cdn-translations";
11204
11070
  var useCDNTranslations = () => {
@@ -11224,10 +11090,10 @@ var useCDNTranslations = () => {
11224
11090
  };
11225
11091
  var EnvironmentI18nProvider = ({ children }) => {
11226
11092
  const i18n = useCDNTranslations();
11227
- return /* @__PURE__ */ React12.createElement(I18nContext.Provider, { value: i18n }, children);
11093
+ return /* @__PURE__ */ React10.createElement(I18nContext.Provider, { value: i18n }, children);
11228
11094
  };
11229
11095
 
11230
- // src/components/buttons/SavedViewsButton.tsx
11096
+ // src/SavedViews/components/Buttons/SavedViewsButton.tsx
11231
11097
  var StyledButton = styled_components_esm_default(Button)`
11232
11098
  background-color: hsl(218, 75%, 96%);
11233
11099
  color: hsl(218, 75%, 45%);
@@ -11251,20 +11117,20 @@ var SavedViewsButton = ({
11251
11117
  isOpen
11252
11118
  }) => {
11253
11119
  const I18n = useCDNTranslations();
11254
- return /* @__PURE__ */ React13.createElement(Container, null, /* @__PURE__ */ React13.createElement(
11120
+ return /* @__PURE__ */ React11.createElement(Container, null, /* @__PURE__ */ React11.createElement(
11255
11121
  StyledButton,
11256
11122
  {
11257
11123
  variant: "secondary",
11258
11124
  onClick: handleClick,
11259
- icon: /* @__PURE__ */ React13.createElement(StyledIcon, { left: isOpen }),
11125
+ icon: /* @__PURE__ */ React11.createElement(StyledIcon, { left: isOpen }),
11260
11126
  "data-testid": "saved-views-button"
11261
11127
  },
11262
11128
  I18n.t("savedViews.button.title")
11263
11129
  ));
11264
11130
  };
11265
11131
 
11266
- // src/components/buttons/useSavedViewsPanel.tsx
11267
- import React14 from "react";
11132
+ // src/SavedViews/components/Buttons/useSavedViewsPanel.tsx
11133
+ import React12 from "react";
11268
11134
  var useSavedViewsPanel = (domain, tableName) => {
11269
11135
  const key = (domain2, tableName2) => `savedViewsPanel-${domain2}-${tableName2}`;
11270
11136
  const [isOpen, setIsOpen] = useState(
@@ -11274,12 +11140,12 @@ var useSavedViewsPanel = (domain, tableName) => {
11274
11140
  setIsOpen(!isOpen);
11275
11141
  localStorage.setItem(key(domain, tableName), JSON.stringify(!isOpen));
11276
11142
  };
11277
- const Button7 = () => /* @__PURE__ */ React14.createElement(SavedViewsButton, { handleClick, isOpen });
11278
- return { isOpen, SavedViewsButton: Button7 };
11143
+ const Button6 = () => /* @__PURE__ */ React12.createElement(SavedViewsButton, { handleClick, isOpen });
11144
+ return { isOpen, SavedViewsButton: Button6 };
11279
11145
  };
11280
11146
  var useSavedViewsPanel_default = useSavedViewsPanel;
11281
11147
 
11282
- // src/components/menu-items/SavedViewsCollectionsMenuItem.tsx
11148
+ // src/SavedViews/components/MenuItems/SavedViewsCollectionsMenuItem.tsx
11283
11149
  import {
11284
11150
  Box,
11285
11151
  Button as Button2,
@@ -11287,8 +11153,7 @@ import {
11287
11153
  Flex,
11288
11154
  useI18nContext as useI18nContext2
11289
11155
  } from "@procore/core-react";
11290
- import * as React15 from "react";
11291
- import { useToastAlertContext } from "@procore/toast-alert";
11156
+ import * as React13 from "react";
11292
11157
  var RowActionsBox = styled_components_esm_default(Flex)`
11293
11158
  justify-content: center;
11294
11159
  align-items: center;
@@ -11303,13 +11168,8 @@ var Container2 = styled_components_esm_default(Flex)`
11303
11168
 
11304
11169
  ${({ "aria-selected": selected }) => selected ? "color: hsl(218, 75%, 45%);" : ""}
11305
11170
  `;
11306
- var IconWrapper = styled_components_esm_default.span`
11307
- display: flex;
11308
- align-items: center;
11309
- justify-content: center;
11310
- `;
11311
11171
  var SavedViewCollectionMenuItem = (props) => {
11312
- const onClick = React15.useCallback(
11172
+ const onClick = React13.useCallback(
11313
11173
  (a2) => {
11314
11174
  if (!props.item) {
11315
11175
  return;
@@ -11331,20 +11191,7 @@ var SavedViewCollectionMenuItem = (props) => {
11331
11191
  event.stopPropagation();
11332
11192
  props.onUpdate?.(props.item);
11333
11193
  };
11334
- const { showToast } = useToastAlertContext();
11335
11194
  const i18n = useI18nContext2();
11336
- const copyShareLink = async (event) => {
11337
- event.stopPropagation();
11338
- try {
11339
- const { origin, pathname } = window.location;
11340
- const shareUrl = new URL(`${origin}${pathname}`);
11341
- shareUrl.searchParams.set("saved-view", props.item.share_token);
11342
- await navigator.clipboard.writeText(shareUrl.toString());
11343
- showToast.success(i18n.t("savedViews.actions.linkCopied"));
11344
- } catch (error) {
11345
- showToast.error(i18n.t("savedViews.errors.copyFailed"));
11346
- }
11347
- };
11348
11195
  const flyoutMenuOptions = [
11349
11196
  {
11350
11197
  value: "editNameDesc",
@@ -11355,7 +11202,7 @@ var SavedViewCollectionMenuItem = (props) => {
11355
11202
  label: i18n.t("savedViews.actions.delete")
11356
11203
  }
11357
11204
  ];
11358
- return /* @__PURE__ */ React15.createElement(
11205
+ return /* @__PURE__ */ React13.createElement(
11359
11206
  Container2,
11360
11207
  {
11361
11208
  "aria-selected": Boolean(props.selected),
@@ -11366,7 +11213,7 @@ var SavedViewCollectionMenuItem = (props) => {
11366
11213
  }),
11367
11214
  "data-testid": "saved-view-collection-menu-item"
11368
11215
  },
11369
- /* @__PURE__ */ React15.createElement(
11216
+ /* @__PURE__ */ React13.createElement(
11370
11217
  "span",
11371
11218
  {
11372
11219
  "data-testid": "saved-view-display-name",
@@ -11374,7 +11221,7 @@ var SavedViewCollectionMenuItem = (props) => {
11374
11221
  },
11375
11222
  props.item.name
11376
11223
  ),
11377
- /* @__PURE__ */ React15.createElement(RowActionsBox, null, /* @__PURE__ */ React15.createElement(Box, { justifyContent: "space-between" }, props.item.view_level !== "default" && props.canUpdate && /* @__PURE__ */ React15.createElement("div", null, /* @__PURE__ */ React15.createElement(
11224
+ /* @__PURE__ */ React13.createElement(RowActionsBox, null, /* @__PURE__ */ React13.createElement(Box, { justifyContent: "space-between" }, props.item.id !== "default" && props.canUpdate && /* @__PURE__ */ React13.createElement("div", null, /* @__PURE__ */ React13.createElement(
11378
11225
  Button2,
11379
11226
  {
11380
11227
  onClick: updateItem,
@@ -11385,31 +11232,7 @@ var SavedViewCollectionMenuItem = (props) => {
11385
11232
  loading: props.isUpdateProcessing
11386
11233
  },
11387
11234
  i18n.t("savedViews.actions.update")
11388
- )), props.item.view_level !== "default" && props.selected && !props.canUpdate && props.item.id !== "temporary" && /* @__PURE__ */ React15.createElement("div", null, /* @__PURE__ */ React15.createElement(
11389
- Button2,
11390
- {
11391
- onClick: copyShareLink,
11392
- variant: "tertiary",
11393
- size: "sm",
11394
- "aria-label": i18n.t("savedViews.actions.copyShareLink"),
11395
- "data-testid": "copy-share-link-button"
11396
- },
11397
- /* @__PURE__ */ React15.createElement(IconWrapper, null, /* @__PURE__ */ React15.createElement(Link_default, { size: "sm" }))
11398
- )), props.item.id === "temporary" && /* @__PURE__ */ React15.createElement("div", null, /* @__PURE__ */ React15.createElement(
11399
- Button2,
11400
- {
11401
- onClick: (e2) => {
11402
- e2.stopPropagation();
11403
- props.onClearTemporary?.();
11404
- },
11405
- variant: "tertiary",
11406
- size: "sm",
11407
- "aria-label": i18n.t("savedViews.actions.clearTemporary"),
11408
- title: i18n.t("savedViews.actions.clearTemporary"),
11409
- "data-testid": "clear-temporary-view-button"
11410
- },
11411
- /* @__PURE__ */ React15.createElement(IconWrapper, null, /* @__PURE__ */ React15.createElement(Clear_default, { size: "sm" }))
11412
- ))), /* @__PURE__ */ React15.createElement(Box, null, props.item.view_level !== "default" && props.canEditOrDelete && /* @__PURE__ */ React15.createElement("div", { onClick: (e2) => e2.stopPropagation() }, /* @__PURE__ */ React15.createElement(
11235
+ ))), /* @__PURE__ */ React13.createElement(Box, null, props.item.id !== "default" && props.canEditOrDelete && /* @__PURE__ */ React13.createElement("div", { onClick: (e2) => e2.stopPropagation() }, /* @__PURE__ */ React13.createElement(
11413
11236
  DropdownFlyout,
11414
11237
  {
11415
11238
  "data-testid": "saved-view-overflow-button",
@@ -11424,7 +11247,7 @@ var SavedViewCollectionMenuItem = (props) => {
11424
11247
  );
11425
11248
  };
11426
11249
 
11427
- // src/components/panels/ExpandedPanel.tsx
11250
+ // src/SavedViews/components/Panels/ExpandedPanel.tsx
11428
11251
  import { Panel } from "@procore/core-react";
11429
11252
  var ExpandedPanel = styled_components_esm_default(Panel)`
11430
11253
  width: ${({ provider }) => provider === "data-table" ? "316px" : "100%"};
@@ -11432,268 +11255,116 @@ var ExpandedPanel = styled_components_esm_default(Panel)`
11432
11255
  border-radius: 4px 0 0 4px;
11433
11256
  `;
11434
11257
 
11435
- // src/components/panels/PanelContent.tsx
11436
- import { Flex as Flex3, useI18nContext as useI18nContext5 } from "@procore/core-react";
11437
- import { useToastAlertContext as useToastAlertContext2 } from "@procore/toast-alert";
11438
- import React17 from "react";
11258
+ // src/SavedViews/components/Panels/PanelContent.tsx
11259
+ import {
11260
+ colors as colors2,
11261
+ DetailPage,
11262
+ Flex as Flex3,
11263
+ UNSAFE_Menu as MenuImperative,
11264
+ spacing as spacing2,
11265
+ useI18nContext as useI18nContext4
11266
+ } from "@procore/core-react";
11267
+ import { useToastAlertContext } from "@procore/toast-alert";
11268
+ import React15 from "react";
11439
11269
 
11440
- // node_modules/@procore/core-http/dist/modern/index.js
11441
- function getCSRFToken() {
11442
- const token = document.cookie.match("(^|;)\\s*csrf_token\\s*=\\s*([^;]+)");
11443
- return token ? decodeURIComponent(token.pop() || "") : "";
11444
- }
11445
- function getCSRFHeader() {
11446
- const csrfToken = getCSRFToken();
11447
- return csrfToken ? { "X-CSRF-TOKEN": csrfToken } : {};
11448
- }
11449
- function removeLeadingSlash(url) {
11450
- return url.startsWith("/") ? url.substring(1, url.length) : url;
11451
- }
11452
- function removeTrailingSlash(url) {
11453
- return url.endsWith("/") ? url.substring(0, url.length - 1) : url;
11454
- }
11455
- function applyBaseUrl(url, baseUrl) {
11456
- return `${removeTrailingSlash(baseUrl)}/${removeLeadingSlash(url)}`;
11457
- }
11458
- function getOptions({ headers, ...options }) {
11459
- const opts = {
11460
- credentials: "same-origin",
11461
- headers: {
11462
- ...getCSRFHeader(),
11463
- ...headers
11464
- },
11465
- mode: "same-origin",
11466
- ...options
11270
+ // src/utils/Constants/viewLevels.ts
11271
+ var VIEW_LEVELS = ["company", "project", "personal"];
11272
+
11273
+ // src/SavedViews/components/Panels/PanelContentUtils.ts
11274
+ var import_lodash = __toESM(require_lodash());
11275
+
11276
+ // src/SavedViews/components/SavedViews/SmartGrid/SmartGridUtils.ts
11277
+ function getSmartGridConfig(api) {
11278
+ const columnStateResult = api.getColumnState();
11279
+ const columnGroupStateResult = api.getColumnGroupState();
11280
+ const rowGroupStateResult = api.getRowGroupColumns();
11281
+ const rowHeightResult = api.getGridOption("rowHeight") || api.getSizesForCurrentTheme().rowHeight;
11282
+ const serverFiltersResult = api.getFilterModel();
11283
+ const smartGridConfig = {
11284
+ columnState: columnStateResult,
11285
+ rowHeight: rowHeightResult,
11286
+ columnGroupState: columnGroupStateResult,
11287
+ rowGroupState: rowGroupStateResult.filter((col) => typeof col?.getColId === "function").map((col) => col.getColId()),
11288
+ filterState: serverFiltersResult
11467
11289
  };
11468
- return opts;
11469
- }
11470
- function getUrl(url, baseUrl) {
11471
- return baseUrl ? applyBaseUrl(url, baseUrl) : url;
11472
- }
11473
- function request(url, { baseUrl, ...options } = {}) {
11474
- return fetch(getUrl(url, baseUrl), getOptions(options));
11290
+ return smartGridConfig;
11475
11291
  }
11476
- function requestJSON(url, requestParams = {}) {
11477
- return request(url, requestParams).then(
11478
- (response) => response.json()
11479
- );
11292
+ function setSmartGridConfig(api, config) {
11293
+ api.applyColumnState({
11294
+ state: config.columnState,
11295
+ applyOrder: true
11296
+ });
11297
+ api.setColumnGroupState(config.columnGroupState);
11298
+ api.setRowGroupColumns(config.rowGroupState);
11299
+ api.setFilterModel(config.filterState);
11300
+ if (config.rowHeight) {
11301
+ api.setGridOption("rowHeight", config.rowHeight);
11302
+ }
11480
11303
  }
11481
11304
 
11482
- // src/utils/api/queries.ts
11483
- import { useQuery } from "@tanstack/react-query";
11484
-
11485
- // src/utils/api/queriesHandler.ts
11486
- import { useMutation, useQueryClient } from "@tanstack/react-query";
11487
- import { useI18nContext as useI18nContext3 } from "@procore/core-react";
11488
- var useApiRequest = (props, method, mutationKey) => {
11489
- const { projectId, companyId, domain, tableName } = props;
11490
- const queryClient2 = useQueryClient();
11491
- const { locale: locale2 } = useI18nContext3();
11492
- return useMutation({
11493
- mutationKey,
11494
- mutationFn: async (savedView) => {
11495
- let url = "";
11496
- if (method === "DELETE" || method === "PUT") {
11497
- url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views/${savedView.share_token}?permissions_domain=${domain}`;
11498
- } else {
11499
- url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views?table_name=${tableName}&permissions_domain=${domain}`;
11305
+ // src/SavedViews/components/SavedViews/SavedViewsUtils.ts
11306
+ var customAndConfigSync = (viewTableConfig, defaultTableConfig) => {
11307
+ if (!viewTableConfig && !defaultTableConfig)
11308
+ return void 0;
11309
+ if (!viewTableConfig?.columnState)
11310
+ return defaultTableConfig;
11311
+ if (!defaultTableConfig?.columnState)
11312
+ return viewTableConfig;
11313
+ const viewColumns = viewTableConfig.columnState;
11314
+ const defaultViewColumns = defaultTableConfig.columnState;
11315
+ if (!Array.isArray(viewColumns) || !Array.isArray(defaultViewColumns))
11316
+ return void 0;
11317
+ const viewFields = new Set(
11318
+ viewColumns.map((col) => getColumnIdentifier(col))
11319
+ );
11320
+ const defaultViewFields = new Set(
11321
+ defaultViewColumns.map((col) => getColumnIdentifier(col))
11322
+ );
11323
+ const newColumns = defaultViewColumns.filter(
11324
+ (col) => !viewFields.has(getColumnIdentifier(col))
11325
+ );
11326
+ const updatedColumns = viewColumns.filter((col) => {
11327
+ const identifier = getColumnIdentifier(col);
11328
+ return identifier.startsWith("ag-Grid-") || defaultViewFields.has(identifier);
11329
+ });
11330
+ const finalColumns = [...updatedColumns, ...newColumns];
11331
+ return {
11332
+ ...viewTableConfig,
11333
+ columnState: finalColumns
11334
+ };
11335
+ };
11336
+ var getColumnIdentifier = (col) => {
11337
+ if ("field" in col && typeof col.field === "string") {
11338
+ return col.field;
11339
+ }
11340
+ if ("colId" in col && typeof col.colId === "string") {
11341
+ return col.colId;
11342
+ }
11343
+ return "";
11344
+ };
11345
+ var updateTableConfig = (view, tableApi, provider, onTableConfigChange) => {
11346
+ if (provider === "smart-grid") {
11347
+ setSmartGridConfig(
11348
+ tableApi,
11349
+ view.table_config
11350
+ );
11351
+ } else {
11352
+ const dataTableApi = tableApi;
11353
+ const tableConfig = view.table_config;
11354
+ if (tableConfig) {
11355
+ const rowHeight = tableConfig?.rowHeight ?? dataTableApi?.getTableConfiguration().rowHeight;
11356
+ if (rowHeight !== void 0) {
11357
+ dataTableApi?.setRowHeight(rowHeight);
11500
11358
  }
11501
- const response = await requestJSON(url, {
11502
- method,
11503
- body: JSON.stringify(savedView),
11504
- headers: {
11505
- "Content-Type": "application/json",
11506
- "Accept-Language": locale2
11507
- }
11508
- });
11509
- if (response.error) {
11510
- throw response.error;
11359
+ dataTableApi?.setTableConfiguration(tableConfig);
11360
+ if (onTableConfigChange) {
11361
+ onTableConfigChange(tableConfig);
11511
11362
  }
11512
- return response.data;
11513
- },
11514
- onSuccess: (savedView) => {
11515
- if (method === "DELETE" || method === "POST") {
11516
- queryClient2.invalidateQueries({
11517
- queryKey: ["savedViews", domain, tableName]
11518
- });
11519
- return;
11520
- } else {
11521
- const oldData = queryClient2.getQueryData([
11522
- "savedViews",
11523
- domain,
11524
- tableName
11525
- ]);
11526
- const oldView = oldData?.find(
11527
- (item) => item.share_token === savedView.share_token
11528
- );
11529
- if (oldView?.name !== savedView.name) {
11530
- queryClient2.invalidateQueries({
11531
- queryKey: ["savedViews", domain, tableName]
11532
- });
11533
- return;
11534
- }
11535
- }
11536
- queryClient2.setQueryData(
11537
- ["savedViews", domain, tableName],
11538
- (oldData) => {
11539
- if (!oldData)
11540
- return [savedView];
11541
- return oldData.map(
11542
- (item) => item.share_token === savedView.share_token ? savedView : item
11543
- );
11544
- }
11545
- );
11546
- }
11547
- });
11548
- };
11549
-
11550
- // src/utils/constants/viewLevels.ts
11551
- var VIEW_LEVELS = ["company", "project", "personal"];
11552
-
11553
- // src/utils/api/queries.ts
11554
- var PAGE_SIZE = 50 * VIEW_LEVELS.length;
11555
- var useSavedViewsQuery = (props) => {
11556
- const { projectId, companyId, domain, tableName } = props;
11557
- const url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views?table_name=${tableName}&permissions_domain=${domain}`;
11558
- return useQuery({
11559
- queryKey: ["savedViews", domain, tableName],
11560
- queryFn: async () => {
11561
- const getUrl2 = `${url}&per_page=${PAGE_SIZE}`;
11562
- const response = await requestJSON(getUrl2);
11563
- return response.data;
11564
- }
11565
- });
11566
- };
11567
- var useSavedViewsPermissions = (props) => {
11568
- const { projectId, companyId, domain } = props;
11569
- const url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views/permissions?permissions_domain=${domain}`;
11570
- return useQuery({
11571
- queryKey: ["savedViewsConfig", domain],
11572
- queryFn: async () => {
11573
- const response = await requestJSON(url);
11574
- return response.data;
11575
- }
11576
- });
11577
- };
11578
- var useCreateSavedView = (props) => useApiRequest(props, "POST", [
11579
- "createSavedView",
11580
- props.domain,
11581
- props.tableName
11582
- ]);
11583
- var useUpdateSavedView = (props) => useApiRequest(props, "PUT", [
11584
- "updateSavedView",
11585
- props.domain,
11586
- props.tableName
11587
- ]);
11588
- var useDeleteSavedView = (props) => useApiRequest(props, "DELETE", [
11589
- "deleteSavedView",
11590
- props.domain,
11591
- props.tableName
11592
- ]);
11593
- var useFetchSavedViewById = (savedViewToken, queryInput, enabled = true) => {
11594
- const { projectId, companyId } = queryInput;
11595
- return useQuery({
11596
- enabled: enabled && Boolean(savedViewToken),
11597
- queryKey: ["savedView", savedViewToken],
11598
- queryFn: async () => {
11599
- const url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views/${savedViewToken}`;
11600
- const response = await requestJSON(url);
11601
- return response.data;
11602
- }
11603
- });
11604
- };
11605
-
11606
- // src/components/panels/PanelContentUtils.ts
11607
- var import_lodash = __toESM(require_lodash());
11608
-
11609
- // src/components/adapters/smart-grid/SmartGridUtils.ts
11610
- function getSmartGridConfig(api) {
11611
- const columnState = api.getColumnState();
11612
- const columnGroupState = api.getColumnGroupState();
11613
- const rowGroupState = api.getRowGroupColumns().map((col) => col.getColId());
11614
- const rowHeight = api.getGridOption("rowHeight") ?? api.getSizesForCurrentTheme().rowHeight;
11615
- const filterState = api.getFilterModel();
11616
- return {
11617
- columnState,
11618
- rowHeight,
11619
- columnGroupState,
11620
- rowGroupState,
11621
- filterState
11622
- };
11623
- }
11624
- function setSmartGridConfig(api, config) {
11625
- api.applyColumnState({
11626
- state: config.columnState,
11627
- applyOrder: true
11628
- });
11629
- api.setColumnGroupState(config.columnGroupState);
11630
- api.setRowGroupColumns(config.rowGroupState);
11631
- api.setFilterModel(config.filterState);
11632
- if (config.rowHeight) {
11633
- api.setGridOption("rowHeight", config.rowHeight);
11634
- }
11635
- }
11636
-
11637
- // src/components/saved-views/SavedViewsUtils.ts
11638
- var customAndConfigSync = (viewTableConfig, defaultTableConfig) => {
11639
- if (!viewTableConfig && !defaultTableConfig)
11640
- return void 0;
11641
- if (!viewTableConfig?.columnState)
11642
- return defaultTableConfig;
11643
- if (!defaultTableConfig?.columnState)
11644
- return viewTableConfig;
11645
- const viewColumns = viewTableConfig.columnState;
11646
- const defaultViewColumns = defaultTableConfig.columnState;
11647
- if (!Array.isArray(viewColumns) || !Array.isArray(defaultViewColumns))
11648
- return void 0;
11649
- const viewFields = new Set(
11650
- viewColumns.map((col) => getColumnIdentifier(col))
11651
- );
11652
- const defaultViewFields = new Set(
11653
- defaultViewColumns.map((col) => getColumnIdentifier(col))
11654
- );
11655
- const newColumns = defaultViewColumns.filter(
11656
- (col) => !viewFields.has(getColumnIdentifier(col))
11657
- );
11658
- const updatedColumns = viewColumns.filter((col) => {
11659
- const identifier = getColumnIdentifier(col);
11660
- return identifier.startsWith("ag-Grid-") || defaultViewFields.has(identifier);
11661
- });
11662
- const finalColumns = [...updatedColumns, ...newColumns];
11663
- return {
11664
- ...viewTableConfig,
11665
- columnState: finalColumns
11666
- };
11667
- };
11668
- var getColumnIdentifier = (col) => {
11669
- if ("field" in col && typeof col.field === "string") {
11670
- return col.field;
11671
- }
11672
- if ("colId" in col && typeof col.colId === "string") {
11673
- return col.colId;
11674
- }
11675
- return "";
11676
- };
11677
- var updateTableConfig = (view, tableApi, provider) => {
11678
- if (provider === "smart-grid") {
11679
- setSmartGridConfig(
11680
- tableApi,
11681
- view.table_config
11682
- );
11683
- } else {
11684
- const dataTableApi = tableApi;
11685
- const tableConfig = view.table_config;
11686
- if (tableConfig) {
11687
- const rowHeight = tableConfig?.rowHeight ?? dataTableApi?.getTableConfiguration().rowHeight;
11688
- if (rowHeight !== void 0) {
11689
- dataTableApi?.setRowHeight(rowHeight);
11690
- }
11691
- dataTableApi?.setTableConfiguration(tableConfig);
11692
11363
  }
11693
11364
  }
11694
11365
  };
11695
11366
 
11696
- // src/components/panels/PanelContentUtils.ts
11367
+ // src/SavedViews/components/Panels/PanelContentUtils.ts
11697
11368
  var getOrderedVisibleColumns = (columns, idKey) => {
11698
11369
  if (!columns)
11699
11370
  return [];
@@ -11752,12 +11423,13 @@ var normalizeForComparison = (config) => {
11752
11423
  if (!config?.columnState)
11753
11424
  return config;
11754
11425
  return {
11755
- ...config,
11426
+ ...import_lodash.default.omit(config, ["enableRowGrouping", "enableColumnGrouping"]),
11756
11427
  columnState: config.columnState.map((col) => {
11428
+ const res = import_lodash.default.omit(col, ["aggFunc"]);
11757
11429
  if (col.flex) {
11758
- return import_lodash.default.omit(col, ["width", "flex"]);
11430
+ return import_lodash.default.omit(res, ["width", "flex"]);
11759
11431
  }
11760
- return col;
11432
+ return res;
11761
11433
  })
11762
11434
  };
11763
11435
  };
@@ -11770,10 +11442,14 @@ var isEqual = (viewTableConfig, tableConfig, defaultViewConfig, provider) => {
11770
11442
  );
11771
11443
  const normalizedViewConfig = normalizeForComparison(syncedViewTableConfig);
11772
11444
  const normalizedCurrentConfig = normalizeForComparison(tableConfig);
11773
- return import_lodash.default.isEqual(
11774
- cleanObject(normalizedViewConfig, provider),
11775
- cleanObject(normalizedCurrentConfig, provider)
11776
- );
11445
+ const cleanedViewConfig = cleanObject(normalizedViewConfig, provider);
11446
+ const cleanedCurrentConfig = cleanObject(normalizedCurrentConfig, provider);
11447
+ console.log("xx:Difference between view config and current config:", {
11448
+ viewConfig: cleanedViewConfig,
11449
+ currentConfig: cleanedCurrentConfig,
11450
+ areEqual: import_lodash.default.isEqual(cleanedViewConfig, cleanedCurrentConfig)
11451
+ });
11452
+ return import_lodash.default.isEqual(cleanedViewConfig, cleanedCurrentConfig);
11777
11453
  };
11778
11454
  var hasPermissionForViewLevel = (viewLevel, permissions) => {
11779
11455
  switch (viewLevel) {
@@ -11788,7 +11464,7 @@ var hasPermissionForViewLevel = (viewLevel, permissions) => {
11788
11464
  }
11789
11465
  };
11790
11466
 
11791
- // src/components/panels/useGroups.ts
11467
+ // src/SavedViews/components/Panels/useGroups.ts
11792
11468
  import { useState as useState2 } from "react";
11793
11469
  var useGroups = () => {
11794
11470
  const [groups, setGroups] = useState2(
@@ -11800,23 +11476,23 @@ var useGroups = () => {
11800
11476
  return { groups, toggleGroup };
11801
11477
  };
11802
11478
 
11803
- // src/components/panels/ViewLevelHeader.tsx
11479
+ // src/SavedViews/components/Panels/ViewLevelHeader.tsx
11804
11480
  import {
11805
11481
  colors,
11806
11482
  Flex as Flex2,
11807
11483
  spacing,
11808
11484
  Typography,
11809
- useI18nContext as useI18nContext4
11485
+ useI18nContext as useI18nContext3
11810
11486
  } from "@procore/core-react";
11811
- import React16 from "react";
11487
+ import React14 from "react";
11812
11488
  var groupIcon = (group) => {
11813
11489
  switch (group) {
11814
11490
  case "personal":
11815
- return /* @__PURE__ */ React16.createElement(Person_default, null);
11491
+ return /* @__PURE__ */ React14.createElement(Person_default, null);
11816
11492
  case "project":
11817
- return /* @__PURE__ */ React16.createElement(Excavator_default, null);
11493
+ return /* @__PURE__ */ React14.createElement(Excavator_default, null);
11818
11494
  case "company":
11819
- return /* @__PURE__ */ React16.createElement(Building_default, null);
11495
+ return /* @__PURE__ */ React14.createElement(Building_default, null);
11820
11496
  }
11821
11497
  };
11822
11498
  var Header = styled_components_esm_default(Flex2)`
@@ -11826,8 +11502,8 @@ var Header = styled_components_esm_default(Flex2)`
11826
11502
  }
11827
11503
  `;
11828
11504
  var ViewLevelHeader = ({ expanded, toggleGroup, group }) => {
11829
- const I18n = useI18nContext4();
11830
- return /* @__PURE__ */ React16.createElement(
11505
+ const I18n = useI18nContext3();
11506
+ return /* @__PURE__ */ React14.createElement(
11831
11507
  Header,
11832
11508
  {
11833
11509
  alignItems: "center",
@@ -11836,14 +11512,14 @@ var ViewLevelHeader = ({ expanded, toggleGroup, group }) => {
11836
11512
  style: { cursor: "pointer" },
11837
11513
  onClick: () => toggleGroup(group)
11838
11514
  },
11839
- expanded ? /* @__PURE__ */ React16.createElement(ChevronDown_default, { size: "sm" }) : /* @__PURE__ */ React16.createElement(ChevronRight_default, { size: "sm" }),
11515
+ expanded ? /* @__PURE__ */ React14.createElement(ChevronDown_default, { size: "sm" }) : /* @__PURE__ */ React14.createElement(ChevronRight_default, { size: "sm" }),
11840
11516
  groupIcon(group),
11841
- /* @__PURE__ */ React16.createElement(Typography, { weight: "semibold" }, I18n.t(`savedViews.viewLevel.${group}`))
11517
+ /* @__PURE__ */ React14.createElement(Typography, { weight: "semibold" }, I18n.t(`savedViews.viewLevel.${group}`))
11842
11518
  );
11843
11519
  };
11844
11520
  var ViewLevelHeader_default = ViewLevelHeader;
11845
11521
 
11846
- // src/utils/hooks/useScrollToRef.ts
11522
+ // src/utils/Hooks/useScrollToRef.ts
11847
11523
  import { useEffect, useRef } from "react";
11848
11524
  var useScrollToRef = (dependency) => {
11849
11525
  const ref = useRef(null);
@@ -11855,13 +11531,7 @@ var useScrollToRef = (dependency) => {
11855
11531
  return ref;
11856
11532
  };
11857
11533
 
11858
- // src/components/panels/PanelContent.styles.ts
11859
- import {
11860
- colors as colors2,
11861
- DetailPage,
11862
- UNSAFE_Menu as MenuImperative,
11863
- spacing as spacing2
11864
- } from "@procore/core-react";
11534
+ // src/SavedViews/components/Panels/PanelContent.tsx
11865
11535
  var Row = styled_components_esm_default(MenuImperative.Item)`
11866
11536
  width: 100%;
11867
11537
  padding-left: 35px;
@@ -11878,85 +11548,60 @@ var Panel2 = styled_components_esm_default(DetailPage.Card)`
11878
11548
  padding-top: ${spacing2.sm}px;
11879
11549
  box-shadow: none;
11880
11550
  `;
11881
-
11882
- // src/components/panels/PanelContent.tsx
11883
11551
  var PanelContent = (props) => {
11884
- const { queryInput, selectedSavedView, tableConfig } = props;
11885
- const { showToast } = useToastAlertContext2();
11886
- const I18n = useI18nContext5();
11887
- const { data: savedViewsFromQuery, error: savedViewsError } = useSavedViewsQuery(props.queryInput);
11888
- const updateMutation = useUpdateSavedView(queryInput);
11889
- const { mutate: updateSavedView } = updateMutation;
11890
- const isUpdateLoading = "isPending" in updateMutation ? updateMutation.isPending : updateMutation.isLoading ?? false;
11891
- const savedViews = props.savedViews ?? savedViewsFromQuery;
11892
- const errorToastRef = React17.useRef(null);
11893
- React17.useEffect(() => {
11552
+ const { showToast } = useToastAlertContext();
11553
+ const I18n = useI18nContext4();
11554
+ const { useSavedViewsQuery: useSavedViewsQuery2, useSavedViewsPermissions: useSavedViewsPermissions2, useUpdateSavedView: useUpdateSavedView2 } = props.backend;
11555
+ const { mutate: updateSavedView, isPending: isUpdateLoading } = useUpdateSavedView2(props.queryInput);
11556
+ const { data: savedViews, error: savedViewsError } = useSavedViewsQuery2(
11557
+ props.queryInput
11558
+ );
11559
+ const errorToastRef = React15.useRef(null);
11560
+ React15.useEffect(() => {
11894
11561
  if (savedViewsError && savedViewsError !== errorToastRef.current) {
11895
11562
  showToast.error(I18n.t("savedViews.errors.fetch"));
11896
11563
  errorToastRef.current = savedViewsError;
11897
11564
  }
11898
- }, [savedViewsError, showToast, I18n]);
11899
- const { data: permissions } = useSavedViewsPermissions(props.queryInput);
11565
+ }, [savedViewsError]);
11566
+ const { data: permissions } = useSavedViewsPermissions2(props.queryInput);
11900
11567
  const selectedRowRef = useScrollToRef(savedViews);
11901
- const { groups, toggleGroup } = useGroups();
11902
- const isTemporarySelected = selectedSavedView?.id === "temporary";
11903
- const temporaryView = savedViews?.find((view) => view.id === "temporary");
11904
- const presetViews = props.presetViews || [props.defaultView];
11905
11568
  const onUpdate = (data) => {
11906
11569
  const newSavedView = {
11907
11570
  ...data,
11908
- ...selectedSavedView,
11909
- table_config: tableConfig
11571
+ ...props.selectedSavedView,
11572
+ table_config: props.tableConfig
11910
11573
  };
11911
11574
  updateSavedView(newSavedView, {
11912
11575
  onSuccess: () => {
11913
11576
  showToast.success(I18n.t("savedViews.update.success"));
11914
- props.onSelect({ item: newSavedView });
11577
+ props.updateLocalStorage(newSavedView);
11578
+ props.setSelectedSavedView(newSavedView);
11915
11579
  },
11916
11580
  onError: () => {
11917
11581
  showToast.error(I18n.t("savedViews.errors.update"));
11918
11582
  }
11919
11583
  });
11920
11584
  };
11921
- return /* @__PURE__ */ React17.createElement(Panel2, { "data-testid": "inner-panel" }, /* @__PURE__ */ React17.createElement(Flex3, { direction: "column", style: { height: "100%", width: "100%" } }, temporaryView && /* @__PURE__ */ React17.createElement(
11585
+ const { groups, toggleGroup } = useGroups();
11586
+ const isDefaultSelected = props.selectedSavedView?.id === "default";
11587
+ return /* @__PURE__ */ React15.createElement(Panel2, { "data-testid": "inner-panel" }, /* @__PURE__ */ React15.createElement(Flex3, { direction: "column", style: { height: "100%", width: "100%" } }, /* @__PURE__ */ React15.createElement(
11922
11588
  Row,
11923
11589
  {
11924
- selected: isTemporarySelected,
11925
- onClick: () => props.onSelect({ item: temporaryView }),
11926
- ref: isTemporarySelected ? selectedRowRef : null
11590
+ selected: isDefaultSelected,
11591
+ onClick: () => props.onSelect({ item: props.defaultView }),
11592
+ ref: isDefaultSelected ? selectedRowRef : null
11927
11593
  },
11928
- /* @__PURE__ */ React17.createElement(
11594
+ /* @__PURE__ */ React15.createElement(
11929
11595
  SavedViewCollectionMenuItem,
11930
11596
  {
11931
- item: temporaryView,
11932
- selected: isTemporarySelected,
11933
- onClearTemporary: props.onClearTemporary
11597
+ item: props.defaultView,
11598
+ selected: isDefaultSelected
11934
11599
  }
11935
11600
  )
11936
- ), presetViews.map((presetView) => {
11937
- const isSelected = selectedSavedView?.id === presetView.id;
11938
- return /* @__PURE__ */ React17.createElement(
11939
- Row,
11940
- {
11941
- key: presetView.id,
11942
- selected: isSelected,
11943
- onClick: () => props.onSelect({ item: presetView }),
11944
- ref: isSelected ? selectedRowRef : null
11945
- },
11946
- /* @__PURE__ */ React17.createElement(
11947
- SavedViewCollectionMenuItem,
11948
- {
11949
- item: presetView,
11950
- selected: isSelected
11951
- }
11952
- )
11953
- );
11954
- }), VIEW_LEVELS.map((level) => {
11601
+ ), VIEW_LEVELS.map((level) => {
11955
11602
  const isExpanded = groups[level];
11956
- const views = isExpanded && savedViews ? savedViews.filter(
11957
- (view) => view.view_level === level && view.id !== "temporary"
11958
- ) : [];
11959
- return /* @__PURE__ */ React17.createElement(React17.Fragment, { key: level }, /* @__PURE__ */ React17.createElement(
11603
+ const views = isExpanded && savedViews ? savedViews.filter((view) => view.view_level === level) : [];
11604
+ return /* @__PURE__ */ React15.createElement(React15.Fragment, { key: level }, /* @__PURE__ */ React15.createElement(
11960
11605
  ViewLevelHeader_default,
11961
11606
  {
11962
11607
  group: level,
@@ -11964,15 +11609,15 @@ var PanelContent = (props) => {
11964
11609
  expanded: isExpanded
11965
11610
  }
11966
11611
  ), views.map((view) => {
11967
- const isSelected = selectedSavedView?.id === view.id;
11612
+ const isSelected = props.selectedSavedView?.id === view.id;
11968
11613
  const canUpdate = isSelected && hasPermissionForViewLevel(view.view_level, permissions) && !isEqual(
11969
11614
  view.table_config,
11970
- tableConfig,
11615
+ props.tableConfig,
11971
11616
  props.defaultView.table_config,
11972
11617
  props.provider
11973
11618
  );
11974
11619
  const canEditOrDelete = isSelected && hasPermissionForViewLevel(view.view_level, permissions);
11975
- return /* @__PURE__ */ React17.createElement(
11620
+ return /* @__PURE__ */ React15.createElement(
11976
11621
  Row,
11977
11622
  {
11978
11623
  key: view.id,
@@ -11983,7 +11628,7 @@ var PanelContent = (props) => {
11983
11628
  },
11984
11629
  ref: isSelected ? selectedRowRef : null
11985
11630
  },
11986
- /* @__PURE__ */ React17.createElement(
11631
+ /* @__PURE__ */ React15.createElement(
11987
11632
  SavedViewCollectionMenuItem,
11988
11633
  {
11989
11634
  item: view,
@@ -12003,20 +11648,79 @@ var PanelContent = (props) => {
12003
11648
  })));
12004
11649
  };
12005
11650
 
12006
- // src/components/saved-views/SavedViews.tsx
11651
+ // src/SavedViews/components/SavedViews/SmartGrid/SmartGridSavedViews.tsx
11652
+ import React20 from "react";
11653
+
11654
+ // src/SavedViews/components/SavedViews/SmartGrid/SmartGridDefaultSavedView.tsx
11655
+ import { useI18nContext as useI18nContext5 } from "@procore/core-react";
11656
+ var useDefaultViewName = (domain, defaultViewName) => {
11657
+ const i18n = useI18nContext5();
11658
+ return defaultViewName || i18n.t(domain, {
11659
+ scope: "savedViews.defaultViewTitle",
11660
+ defaultValue: "Default View"
11661
+ });
11662
+ };
11663
+ var useDefaultView = (props) => {
11664
+ const name = useDefaultViewName(props.domain, props.defaultViewName);
11665
+ return {
11666
+ id: "default",
11667
+ view_level: "default",
11668
+ name,
11669
+ table_config: {}
11670
+ };
11671
+ };
11672
+
11673
+ // src/SavedViews/components/SavedViews/SmartGrid/useSmartGridConfig.ts
11674
+ import { useState as useState3, useEffect as useEffect2 } from "react";
11675
+ var GRID_STATE_EVENTS = [
11676
+ "sortChanged",
11677
+ "filterOpened",
11678
+ "filterChanged",
11679
+ "columnRowGroupChanged",
11680
+ "dragStopped",
11681
+ "columnResized",
11682
+ "columnVisible",
11683
+ "columnPinned",
11684
+ "columnMoved",
11685
+ "modelUpdated",
11686
+ "gridColumnsChanged",
11687
+ "gridReady"
11688
+ ];
11689
+ var useSmartGridConfig = (gridApi) => {
11690
+ const [config, setConfig] = useState3(
11691
+ () => getSmartGridConfig(gridApi)
11692
+ );
11693
+ useEffect2(() => {
11694
+ if (!gridApi)
11695
+ return;
11696
+ const updateConfig = () => {
11697
+ setConfig(getSmartGridConfig(gridApi));
11698
+ };
11699
+ GRID_STATE_EVENTS.forEach((event) => {
11700
+ gridApi.addEventListener(event, updateConfig);
11701
+ });
11702
+ return () => {
11703
+ GRID_STATE_EVENTS.forEach((event) => {
11704
+ gridApi.removeEventListener(event, updateConfig);
11705
+ });
11706
+ };
11707
+ }, [gridApi]);
11708
+ return { config, setConfig };
11709
+ };
11710
+
11711
+ // src/SavedViews/components/SavedViews/SavedViews.tsx
12007
11712
  import {
12008
11713
  Box as Box2,
12009
- Button as Button6,
12010
- Flex as Flex6,
11714
+ Button as Button5,
11715
+ Flex as Flex5,
12011
11716
  Panel as Panel3,
12012
11717
  Tooltip,
12013
- useI18nContext as useI18nContext11
11718
+ useI18nContext as useI18nContext10
12014
11719
  } from "@procore/core-react";
12015
- import React22, { useState as useState4, useEffect as useEffect3, useCallback as useCallback3 } from "react";
11720
+ import React19, { useState as useState4 } from "react";
12016
11721
  import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
12017
- import { useToastAlertContext as useToastAlertContext3, ToastAlertProvider } from "@procore/toast-alert";
12018
11722
 
12019
- // src/components/modals/DeleteConfirmationModal.tsx
11723
+ // src/SavedViews/components/SavedViewsModals/SavedViewsDeleteConfirmationModalShared.tsx
12020
11724
  import {
12021
11725
  Button as Button3,
12022
11726
  ConfirmModal,
@@ -12024,14 +11728,14 @@ import {
12024
11728
  P as P2,
12025
11729
  useI18nContext as useI18nContext6
12026
11730
  } from "@procore/core-react";
12027
- import React18 from "react";
11731
+ import React16 from "react";
12028
11732
  var SavedViewsDeleteConfirmationModalShared = ({
12029
11733
  onCancel,
12030
11734
  onDelete,
12031
11735
  open
12032
11736
  }) => {
12033
11737
  const i18n = useI18nContext6();
12034
- return /* @__PURE__ */ React18.createElement(
11738
+ return /* @__PURE__ */ React16.createElement(
12035
11739
  ConfirmModal,
12036
11740
  {
12037
11741
  "data-testid": "delete-confirmation-modal",
@@ -12041,15 +11745,15 @@ var SavedViewsDeleteConfirmationModalShared = ({
12041
11745
  onClose: onCancel,
12042
11746
  style: { overflowWrap: "anywhere" }
12043
11747
  },
12044
- /* @__PURE__ */ React18.createElement(Modal.Body, null, /* @__PURE__ */ React18.createElement(P2, null, i18n.t("savedViews.modal.delete.description"))),
12045
- /* @__PURE__ */ React18.createElement(Modal.Footer, null, /* @__PURE__ */ React18.createElement(Modal.FooterButtons, null, /* @__PURE__ */ React18.createElement(Button3, { variant: "secondary", onClick: onCancel }, i18n.t("savedViews.actions.cancel")), /* @__PURE__ */ React18.createElement(Button3, { variant: "primary", onClick: onDelete }, i18n.t("savedViews.actions.delete"))))
11748
+ /* @__PURE__ */ React16.createElement(Modal.Body, null, /* @__PURE__ */ React16.createElement(P2, null, i18n.t("savedViews.modal.delete.description"))),
11749
+ /* @__PURE__ */ React16.createElement(Modal.Footer, null, /* @__PURE__ */ React16.createElement(Modal.FooterButtons, null, /* @__PURE__ */ React16.createElement(Button3, { variant: "secondary", onClick: onCancel }, i18n.t("savedViews.actions.cancel")), /* @__PURE__ */ React16.createElement(Button3, { variant: "primary", onClick: onDelete }, i18n.t("savedViews.actions.delete"))))
12046
11750
  );
12047
11751
  };
12048
11752
 
12049
- // src/components/modals/form-modal/FormModal.tsx
12050
- import React20 from "react";
11753
+ // src/SavedViews/components/SavedViewsModals/SavedViewsFormModal.tsx
11754
+ import React18 from "react";
12051
11755
 
12052
- // src/components/modals/form-modal/FormModalBase.tsx
11756
+ // src/SavedViews/components/SavedViewsModals/SavedViewsCreateUpdateModalBase.tsx
12053
11757
  import {
12054
11758
  Banner,
12055
11759
  Button as Button4,
@@ -12063,7 +11767,7 @@ import {
12063
11767
  Typography as Typography2,
12064
11768
  useI18nContext as useI18nContext7
12065
11769
  } from "@procore/core-react";
12066
- import * as React19 from "react";
11770
+ import * as React17 from "react";
12067
11771
 
12068
11772
  // ../../node_modules/yup/index.esm.js
12069
11773
  var import_property_expr = __toESM(require_property_expr());
@@ -14357,7 +14061,7 @@ var TupleSchema = class extends Schema {
14357
14061
  };
14358
14062
  create$1.prototype = TupleSchema.prototype;
14359
14063
 
14360
- // src/components/modals/form-modal/FormModalBaseUtils.ts
14064
+ // src/SavedViews/components/SavedViewsModals/CreateUpdateModalBaseUtils.ts
14361
14065
  var getViewLevelOptions = (permissions, i18n) => {
14362
14066
  const options = ["personal"];
14363
14067
  if (permissions?.can_create_project_saved_views)
@@ -14390,11 +14094,12 @@ function extractMessage(error, I18n) {
14390
14094
  return { form: I18n.t("savedViews.modal.errors.unknown") };
14391
14095
  }
14392
14096
 
14393
- // src/components/modals/form-modal/FormModalBase.tsx
14097
+ // src/SavedViews/components/SavedViewsModals/SavedViewsCreateUpdateModalBase.tsx
14098
+ var { useEffect: useEffect3, useRef: useRef2 } = React17;
14394
14099
  var ScrollContainer = styled_components_esm_default("div")`
14395
14100
  overflow: auto;
14396
14101
  `;
14397
- var FormModalBase = ({
14102
+ var SavedViewsCreateUpdateModalBase = ({
14398
14103
  open,
14399
14104
  mode,
14400
14105
  onCancel,
@@ -14406,23 +14111,40 @@ var FormModalBase = ({
14406
14111
  tableName,
14407
14112
  defaultView,
14408
14113
  selectedSavedView,
14114
+ setSelectedSavedView,
14409
14115
  setOpenEditCreateModal,
14410
- onSelect
14116
+ onSelect,
14117
+ backend
14411
14118
  }) => {
14412
14119
  const I18n = useI18nContext7();
14413
14120
  const NAME_MAX_LENGTH = 150;
14121
+ const originalBodyWidth = useRef2("");
14122
+ useEffect3(() => {
14123
+ if (open) {
14124
+ originalBodyWidth.current = document.body.style.width || "";
14125
+ document.body.style.width = "100%";
14126
+ } else {
14127
+ document.body.style.width = originalBodyWidth.current;
14128
+ }
14129
+ return () => {
14130
+ if (originalBodyWidth.current !== void 0) {
14131
+ document.body.style.width = originalBodyWidth.current;
14132
+ }
14133
+ };
14134
+ }, [open]);
14135
+ const { useCreateSavedView: useCreateSavedView2, useUpdateSavedView: useUpdateSavedView2, useSavedViewsPermissions: useSavedViewsPermissions2 } = backend;
14414
14136
  const {
14415
14137
  mutate: createSavedView,
14416
14138
  isPending: isCreating,
14417
14139
  error: createError,
14418
14140
  reset: resetCreateMutation
14419
- } = useCreateSavedView(queryInput);
14141
+ } = useCreateSavedView2(queryInput);
14420
14142
  const {
14421
14143
  mutate: updateSavedView,
14422
14144
  isPending: isUpdating,
14423
14145
  error: updateError,
14424
14146
  reset: resetUpdateMutation
14425
- } = useUpdateSavedView(queryInput);
14147
+ } = useUpdateSavedView2(queryInput);
14426
14148
  const resetMutations = () => {
14427
14149
  resetCreateMutation();
14428
14150
  resetUpdateMutation();
@@ -14431,7 +14153,7 @@ var FormModalBase = ({
14431
14153
  resetMutations();
14432
14154
  onCancel();
14433
14155
  };
14434
- const { data: permissions } = useSavedViewsPermissions(queryInput);
14156
+ const { data: permissions } = useSavedViewsPermissions2(queryInput);
14435
14157
  const isLoading = isCreating || isUpdating;
14436
14158
  const errors = extractMessage(createError || updateError, I18n);
14437
14159
  const handleOnSubmit = (data) => {
@@ -14443,8 +14165,8 @@ var FormModalBase = ({
14443
14165
  };
14444
14166
  updateSavedView(body, {
14445
14167
  onSuccess: (updatedSavedView) => {
14446
- onSelect(updatedSavedView);
14447
14168
  setOpenEditCreateModal(false);
14169
+ setSelectedSavedView(updatedSavedView);
14448
14170
  }
14449
14171
  });
14450
14172
  } else {
@@ -14463,7 +14185,7 @@ var FormModalBase = ({
14463
14185
  }
14464
14186
  };
14465
14187
  const viewLevelOptions = getViewLevelOptions(permissions, I18n);
14466
- return /* @__PURE__ */ React19.createElement(
14188
+ return /* @__PURE__ */ React17.createElement(
14467
14189
  Modal2,
14468
14190
  {
14469
14191
  "aria-label": I18n.t("savedViews.ariaLabels.modal"),
@@ -14472,14 +14194,14 @@ var FormModalBase = ({
14472
14194
  style: { width: "540px" },
14473
14195
  "data-testid": "create-update-modal"
14474
14196
  },
14475
- /* @__PURE__ */ React19.createElement(ScrollContainer, null, /* @__PURE__ */ React19.createElement(
14197
+ /* @__PURE__ */ React17.createElement(ScrollContainer, null, /* @__PURE__ */ React17.createElement(
14476
14198
  Modal2.Header,
14477
14199
  {
14478
14200
  onClose,
14479
14201
  style: { borderBottom: `1px solid ${colors3.gray85}` }
14480
14202
  },
14481
- /* @__PURE__ */ React19.createElement(H2, null, header)
14482
- ), /* @__PURE__ */ React19.createElement(
14203
+ /* @__PURE__ */ React17.createElement(H2, null, header)
14204
+ ), /* @__PURE__ */ React17.createElement(
14483
14205
  Form,
14484
14206
  {
14485
14207
  initialValues: {
@@ -14505,13 +14227,13 @@ var FormModalBase = ({
14505
14227
  onReset: onCancel,
14506
14228
  validateOnChange: true
14507
14229
  },
14508
- /* @__PURE__ */ React19.createElement(Form.Form, { name: header }, /* @__PURE__ */ React19.createElement(
14230
+ /* @__PURE__ */ React17.createElement(Form.Form, { name: header }, /* @__PURE__ */ React17.createElement(
14509
14231
  Modal2.Body,
14510
14232
  {
14511
14233
  style: { paddingTop: 0, paddingBottom: 0, marginTop: spacing3.lg }
14512
14234
  },
14513
- errors && /* @__PURE__ */ React19.createElement(ErrorBanner, { style: { marginBottom: spacing3.xl } }, /* @__PURE__ */ React19.createElement(Banner.Content, null, /* @__PURE__ */ React19.createElement(Banner.Title, null, I18n.t("savedViews.modal.errors.title", { mode })), /* @__PURE__ */ React19.createElement(Banner.Body, null, errors?.form || I18n.t(`savedViews.modal.errors.description.${mode}`)))),
14514
- /* @__PURE__ */ React19.createElement(Form.Row, null, /* @__PURE__ */ React19.createElement(
14235
+ errors && /* @__PURE__ */ React17.createElement(ErrorBanner, { style: { marginBottom: spacing3.xl } }, /* @__PURE__ */ React17.createElement(Banner.Content, null, /* @__PURE__ */ React17.createElement(Banner.Title, null, I18n.t("savedViews.modal.errors.title", { mode })), /* @__PURE__ */ React17.createElement(Banner.Body, null, errors?.form || I18n.t(`savedViews.modal.errors.description.${mode}`)))),
14236
+ /* @__PURE__ */ React17.createElement(Form.Row, null, /* @__PURE__ */ React17.createElement(
14515
14237
  Form.Text,
14516
14238
  {
14517
14239
  name: "name",
@@ -14522,12 +14244,12 @@ var FormModalBase = ({
14522
14244
  onChange: () => resetMutations()
14523
14245
  }
14524
14246
  )),
14525
- /* @__PURE__ */ React19.createElement(
14247
+ /* @__PURE__ */ React17.createElement(
14526
14248
  Form.Row,
14527
14249
  {
14528
14250
  style: { marginTop: errors?.name ? spacing3.xl : spacing3.none }
14529
14251
  },
14530
- /* @__PURE__ */ React19.createElement(
14252
+ /* @__PURE__ */ React17.createElement(
14531
14253
  Form.TextArea,
14532
14254
  {
14533
14255
  name: "description",
@@ -14538,18 +14260,19 @@ var FormModalBase = ({
14538
14260
  }
14539
14261
  )
14540
14262
  ),
14541
- viewLevelOptions.length > 1 && mode === "create" /* CREATE */ ? /* @__PURE__ */ React19.createElement(Form.Row, null, /* @__PURE__ */ React19.createElement(
14263
+ viewLevelOptions.length > 1 && mode === "create" /* CREATE */ ? /* @__PURE__ */ React17.createElement(Form.Row, null, /* @__PURE__ */ React17.createElement(
14542
14264
  Form.Select,
14543
14265
  {
14544
14266
  name: "view_level",
14267
+ qa: { label: "view-level" },
14545
14268
  options: viewLevelOptions,
14546
14269
  label: I18n.t("savedViews.modal.fields.viewLevel"),
14547
14270
  colWidth: 12,
14548
14271
  onSearch: false,
14549
14272
  onClear: false
14550
14273
  }
14551
- )) : /* @__PURE__ */ React19.createElement(React19.Fragment, null)
14552
- ), /* @__PURE__ */ React19.createElement(Modal2.Footer, { style: { borderTop: `1px solid ${colors3.gray85}` } }, /* @__PURE__ */ React19.createElement(Flex4, { grow: "1", justifyContent: "space-between", alignItems: "center" }, /* @__PURE__ */ React19.createElement(Typography2, { color: "gray45", italic: true }, /* @__PURE__ */ React19.createElement(Typography2, { color: "red45" }, "*"), " ", I18n.t("savedViews.modal.info.required_fields")), /* @__PURE__ */ React19.createElement(Modal2.FooterButtons, null, /* @__PURE__ */ React19.createElement(Button4, { type: "reset", variant: "tertiary", disabled: isLoading }, I18n.t("savedViews.actions.cancel")), /* @__PURE__ */ React19.createElement(
14274
+ )) : /* @__PURE__ */ React17.createElement(React17.Fragment, null)
14275
+ ), /* @__PURE__ */ React17.createElement(Modal2.Footer, { style: { borderTop: `1px solid ${colors3.gray85}` } }, /* @__PURE__ */ React17.createElement(Flex4, { grow: "1", justifyContent: "space-between", alignItems: "center" }, /* @__PURE__ */ React17.createElement(Typography2, { color: "gray45", italic: true }, /* @__PURE__ */ React17.createElement(Typography2, { color: "red45" }, "*"), " ", I18n.t("savedViews.modal.info.required_fields")), /* @__PURE__ */ React17.createElement(Modal2.FooterButtons, null, /* @__PURE__ */ React17.createElement(Button4, { type: "reset", variant: "tertiary", disabled: isLoading }, I18n.t("savedViews.actions.cancel")), /* @__PURE__ */ React17.createElement(
14553
14276
  Button4,
14554
14277
  {
14555
14278
  "data-testid": "create-update-modal-button",
@@ -14564,9 +14287,9 @@ var FormModalBase = ({
14564
14287
  );
14565
14288
  };
14566
14289
 
14567
- // src/components/modals/form-modal/FormModal.tsx
14290
+ // src/SavedViews/components/SavedViewsModals/SavedViewsFormModal.tsx
14568
14291
  import { useI18nContext as useI18nContext8 } from "@procore/core-react";
14569
- var FormModal = ({
14292
+ var SavedViewsFormModal = ({
14570
14293
  open,
14571
14294
  mode,
14572
14295
  onCancel,
@@ -14574,13 +14297,15 @@ var FormModal = ({
14574
14297
  tableName,
14575
14298
  queryInput,
14576
14299
  selectedSavedView,
14300
+ setSelectedSavedView,
14577
14301
  setOpenEditCreateModal,
14578
14302
  onSelect,
14579
- defaultView
14303
+ defaultView,
14304
+ backend
14580
14305
  }) => {
14581
14306
  const i18n = useI18nContext8();
14582
- return /* @__PURE__ */ React20.createElement(
14583
- FormModalBase,
14307
+ return /* @__PURE__ */ React18.createElement(
14308
+ SavedViewsCreateUpdateModalBase,
14584
14309
  {
14585
14310
  open,
14586
14311
  mode,
@@ -14592,333 +14317,174 @@ var FormModal = ({
14592
14317
  tableConfig,
14593
14318
  tableName,
14594
14319
  selectedSavedView,
14320
+ setSelectedSavedView,
14595
14321
  setOpenEditCreateModal,
14596
14322
  onSelect,
14597
- defaultView
14323
+ defaultView,
14324
+ backend
14598
14325
  }
14599
14326
  );
14600
14327
  };
14601
14328
 
14602
- // src/components/modals/form-modal/SharedViewFormModal.tsx
14603
- import {
14604
- Banner as Banner2,
14605
- Button as Button5,
14606
- colors as colors4,
14607
- ErrorBanner as ErrorBanner2,
14608
- Flex as Flex5,
14609
- Form as Form2,
14610
- Modal as Modal3,
14611
- P as P3,
14612
- spacing as spacing4,
14613
- Typography as Typography3,
14614
- useI18nContext as useI18nContext9
14615
- } from "@procore/core-react";
14616
- import * as React21 from "react";
14617
- var SharedViewFormModal = ({
14618
- open,
14619
- fetchedView,
14620
- onClose,
14621
- onCreateTemporaryView,
14622
- onCreateView,
14623
- createError,
14624
- isCreating,
14625
- resetCreateError
14626
- }) => {
14627
- const I18n = useI18nContext9();
14628
- const NAME_MAX_LENGTH = 150;
14629
- const errors = extractMessage(createError, I18n);
14630
- const handleNameChange = () => {
14631
- if (resetCreateError) {
14632
- resetCreateError();
14633
- }
14634
- };
14635
- const handleOnSubmit = (data) => {
14636
- onCreateView(data.name, data.description);
14637
- };
14638
- return /* @__PURE__ */ React21.createElement(
14639
- Modal3,
14640
- {
14641
- "data-testid": "shared-view-form-modal",
14642
- open,
14643
- onClickOverlay: onClose,
14644
- style: { width: "540px" }
14645
- },
14646
- /* @__PURE__ */ React21.createElement(
14647
- Modal3.Header,
14648
- {
14649
- onClose,
14650
- style: {
14651
- paddingTop: spacing4.lg,
14652
- paddingBottom: spacing4.xs,
14653
- paddingLeft: spacing4.xl,
14654
- paddingRight: spacing4.xl
14655
- }
14656
- },
14657
- I18n.t("savedViews.modal.create.title")
14658
- ),
14659
- /* @__PURE__ */ React21.createElement(
14660
- P3,
14661
- {
14662
- style: {
14663
- paddingLeft: spacing4.xl,
14664
- paddingRight: spacing4.xl,
14665
- paddingBottom: spacing4.lg,
14666
- paddingTop: spacing4.none,
14667
- margin: 0,
14668
- color: colors4.gray45,
14669
- whiteSpace: "pre-line"
14670
- }
14671
- },
14672
- I18n.t("savedViews.modal.copyConfirmation.description")
14673
- ),
14674
- /* @__PURE__ */ React21.createElement(
14675
- Form2,
14676
- {
14677
- initialValues: {
14678
- name: fetchedView.name,
14679
- description: fetchedView.description ?? ""
14680
- },
14681
- view: "create",
14682
- validationSchema: create$3().shape({
14683
- name: create$6().trim().max(
14684
- NAME_MAX_LENGTH,
14685
- I18n.t("savedViews.modal.errors.maxLengthName", {
14686
- maxLength: NAME_MAX_LENGTH
14687
- })
14688
- ).required(I18n.t("savedViews.modal.errors.required"))
14689
- }),
14690
- onSubmit: handleOnSubmit,
14691
- validateOnChange: true
14692
- },
14693
- /* @__PURE__ */ React21.createElement(Form2.Form, { name: "share-view-form" }, /* @__PURE__ */ React21.createElement(
14694
- Modal3.Body,
14695
- {
14696
- style: {
14697
- paddingTop: spacing4.lg,
14698
- paddingBottom: 0,
14699
- borderTop: `1px solid ${colors4.gray85}`
14700
- }
14701
- },
14702
- errors && /* @__PURE__ */ React21.createElement(ErrorBanner2, { style: { marginBottom: spacing4.xl } }, /* @__PURE__ */ React21.createElement(Banner2.Content, null, /* @__PURE__ */ React21.createElement(Banner2.Title, null, I18n.t("savedViews.modal.errors.title", {
14703
- mode: "create"
14704
- })), /* @__PURE__ */ React21.createElement(Banner2.Body, null, errors?.form || I18n.t("savedViews.modal.errors.description.create")))),
14705
- /* @__PURE__ */ React21.createElement(Form2.Row, null, /* @__PURE__ */ React21.createElement(
14706
- Form2.Text,
14707
- {
14708
- name: "name",
14709
- error: errors?.name,
14710
- placeholder: I18n.t("savedViews.modal.fields.name"),
14711
- label: I18n.t("savedViews.modal.fields.name"),
14712
- colWidth: 12,
14713
- onChange: handleNameChange
14714
- }
14715
- )),
14716
- /* @__PURE__ */ React21.createElement(
14717
- Form2.Row,
14718
- {
14719
- style: { marginTop: errors?.name ? spacing4.xl : spacing4.none }
14720
- },
14721
- /* @__PURE__ */ React21.createElement(
14722
- Form2.TextArea,
14723
- {
14724
- name: "description",
14725
- placeholder: I18n.t("savedViews.modal.fields.description"),
14726
- label: I18n.t("savedViews.modal.fields.description"),
14727
- colWidth: 12,
14728
- resize: "vertical"
14729
- }
14730
- )
14731
- )
14732
- ), /* @__PURE__ */ React21.createElement(Modal3.Footer, { style: { borderTop: `1px solid ${colors4.gray85}` } }, /* @__PURE__ */ React21.createElement(Flex5, { grow: "1", justifyContent: "space-between", alignItems: "center" }, /* @__PURE__ */ React21.createElement(Typography3, { color: "gray45", italic: true }, /* @__PURE__ */ React21.createElement(Typography3, { color: "red45" }, "*"), " ", I18n.t("savedViews.modal.info.required_fields")), /* @__PURE__ */ React21.createElement(Modal3.FooterButtons, null, /* @__PURE__ */ React21.createElement(
14733
- Button5,
14734
- {
14735
- variant: "secondary",
14736
- onClick: onCreateTemporaryView,
14737
- "data-testid": "view-temporarily-button",
14738
- disabled: isCreating
14739
- },
14740
- I18n.t("savedViews.actions.viewTemporarily")
14741
- ), /* @__PURE__ */ React21.createElement(
14742
- Button5,
14743
- {
14744
- type: "submit",
14745
- variant: "primary",
14746
- "data-testid": "create-view-button",
14747
- disabled: isCreating,
14748
- loading: isCreating
14749
- },
14750
- I18n.t("savedViews.actions.create")
14751
- )))))
14752
- )
14329
+ // ../../node_modules/@procore/core-http/dist/modern/index.js
14330
+ function getCSRFToken() {
14331
+ const token = document.cookie.match("(^|;)\\s*csrf_token\\s*=\\s*([^;]+)");
14332
+ return token ? decodeURIComponent(token.pop() || "") : "";
14333
+ }
14334
+ function getCSRFHeader() {
14335
+ const csrfToken = getCSRFToken();
14336
+ return csrfToken ? { "X-CSRF-TOKEN": csrfToken } : {};
14337
+ }
14338
+ function removeLeadingSlash(url) {
14339
+ return url.startsWith("/") ? url.substring(1, url.length) : url;
14340
+ }
14341
+ function removeTrailingSlash(url) {
14342
+ return url.endsWith("/") ? url.substring(0, url.length - 1) : url;
14343
+ }
14344
+ function applyBaseUrl(url, baseUrl) {
14345
+ return `${removeTrailingSlash(baseUrl)}/${removeLeadingSlash(url)}`;
14346
+ }
14347
+ function getOptions({ headers, ...options }) {
14348
+ const opts = {
14349
+ credentials: "same-origin",
14350
+ headers: {
14351
+ ...getCSRFHeader(),
14352
+ ...headers
14353
+ },
14354
+ mode: "same-origin",
14355
+ ...options
14356
+ };
14357
+ return opts;
14358
+ }
14359
+ function getUrl(url, baseUrl) {
14360
+ return baseUrl ? applyBaseUrl(url, baseUrl) : url;
14361
+ }
14362
+ function request(url, { baseUrl, ...options } = {}) {
14363
+ return fetch(getUrl(url, baseUrl), getOptions(options));
14364
+ }
14365
+ function requestJSON(url, requestParams = {}) {
14366
+ return request(url, requestParams).then(
14367
+ (response) => response.json()
14753
14368
  );
14754
- };
14755
-
14756
- // src/utils/hooks/useViewSelection.ts
14757
- import { useState as useState3, useCallback as useCallback2, useEffect as useEffect2, useRef as useRef2, useMemo } from "react";
14758
- import { useSearchParams } from "react-router-dom";
14759
- import { useI18nContext as useI18nContext10 } from "@procore/core-react";
14369
+ }
14760
14370
 
14761
- // src/utils/viewStorage.ts
14762
- var ViewStorage = {
14763
- save(key, view) {
14764
- localStorage.setItem(key, JSON.stringify(view));
14765
- },
14766
- load(key, defaultView) {
14767
- try {
14768
- const stored = localStorage.getItem(key);
14769
- if (!stored)
14770
- return defaultView;
14771
- const parsed = JSON.parse(stored);
14772
- if (!parsed)
14773
- return defaultView;
14774
- const isTableConfigOnly = !parsed.id && !parsed.share_token;
14775
- return isTableConfigOnly ? { ...defaultView, table_config: parsed } : parsed;
14776
- } catch {
14777
- return defaultView;
14778
- }
14779
- },
14780
- remove(key) {
14781
- localStorage.removeItem(key);
14782
- }
14783
- };
14371
+ // src/utils/Api/queries.ts
14372
+ import { useQuery } from "@tanstack/react-query";
14784
14373
 
14785
- // src/utils/hooks/useViewSelection.ts
14786
- var getUpdatedSearchParams = (currentParams, view) => {
14787
- const updatedParams = new URLSearchParams(currentParams);
14788
- if (view.id === "default") {
14789
- updatedParams.set("saved-view", "default");
14790
- } else if (view.id === "temporary") {
14791
- updatedParams.set("saved-view", "temporary");
14792
- } else {
14793
- updatedParams.set("saved-view", view.share_token);
14794
- }
14795
- return updatedParams;
14796
- };
14797
- var checkIsViewSelected = (selectedView, viewId) => {
14798
- return selectedView?.share_token === viewId || selectedView?.id === viewId;
14799
- };
14800
- var findViewByToken = (views, token) => {
14801
- return views.find((view) => view.share_token === token);
14802
- };
14803
- var setViewInUrl = (view, setSearchParams) => {
14804
- setSearchParams(
14805
- (currentParams) => getUpdatedSearchParams(currentParams, view),
14806
- { replace: true }
14807
- );
14808
- };
14809
- var restoreUrlParameter = (currentParam, previousParam, setSearchParams) => {
14810
- if (previousParam && !currentParam) {
14811
- setSearchParams(
14812
- (currentParams) => {
14813
- const updatedParams = new URLSearchParams(currentParams);
14814
- updatedParams.set("saved-view", previousParam);
14815
- return updatedParams;
14816
- },
14817
- { replace: true }
14818
- );
14819
- }
14820
- };
14821
- var useViewSelection = (config, savedViews, presetViews, openSharedViewModal) => {
14822
- const I18n = useI18nContext10();
14823
- const storageKey = `savedView_${config.domain}_${config.tableName}_${config.companyId}_${config.projectId}_${config.userId}`;
14824
- const temporaryStorageKey = `${storageKey}-temporary`;
14825
- const [searchParams, setSearchParams] = useSearchParams();
14826
- const previousSavedViewParamRef = useRef2(null);
14827
- const [selectedSavedView, setSelectedSavedView] = useState3(() => {
14828
- const stored = ViewStorage.load(storageKey, config.defaultView);
14829
- return stored ?? config.defaultView;
14830
- });
14831
- const [temporaryView, setTemporaryView] = useState3(() => {
14832
- const loaded = ViewStorage.load(temporaryStorageKey, config.defaultView);
14833
- return loaded && (loaded.id === "temporary" || loaded.view_level === "temporary") ? loaded : null;
14834
- });
14835
- const persistViewToStorageAndUrl = useCallback2(
14836
- (view) => {
14837
- ViewStorage.save(storageKey, view);
14838
- setViewInUrl(view, setSearchParams);
14839
- },
14840
- [storageKey, setSearchParams]
14841
- );
14842
- const baseViews = useMemo(
14843
- () => [...savedViews ?? [], ...presetViews ?? []],
14844
- [savedViews, presetViews]
14845
- );
14846
- const allViews = useMemo(
14847
- () => temporaryView ? [...baseViews, temporaryView] : baseViews,
14848
- [baseViews, temporaryView]
14849
- );
14850
- const selectView = useCallback2(
14851
- (view) => {
14852
- const viewToSelect = config.onSelect({ item: view });
14853
- setSelectedSavedView(viewToSelect);
14854
- persistViewToStorageAndUrl(viewToSelect);
14855
- return viewToSelect;
14856
- },
14857
- [config, persistViewToStorageAndUrl]
14858
- );
14859
- const createTemporaryView = useCallback2(
14860
- (fetchedView) => {
14861
- const tempView = {
14862
- ...fetchedView,
14863
- id: "temporary",
14864
- name: I18n.t("savedViews.temporaryViewName"),
14865
- view_level: "temporary"
14866
- };
14867
- ViewStorage.save(temporaryStorageKey, tempView);
14868
- setTemporaryView(tempView);
14869
- selectView(tempView);
14870
- return tempView;
14374
+ // src/utils/Api/queriesHandler.ts
14375
+ import { useMutation, useQueryClient } from "@tanstack/react-query";
14376
+ import { useI18nContext as useI18nContext9 } from "@procore/core-react";
14377
+ var useApiRequest = (props, method, mutationKey) => {
14378
+ const { projectId, companyId, domain, tableName } = props;
14379
+ const queryClient2 = useQueryClient();
14380
+ const { locale: locale2 } = useI18nContext9();
14381
+ return useMutation({
14382
+ mutationKey,
14383
+ mutationFn: async (savedView) => {
14384
+ let url = "";
14385
+ if (method === "DELETE" || method === "PUT") {
14386
+ url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views/${savedView.id}?permissions_domain=${domain}`;
14387
+ } else {
14388
+ url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views?table_name=${tableName}&permissions_domain=${domain}`;
14389
+ }
14390
+ const response = await requestJSON(url, {
14391
+ method,
14392
+ body: JSON.stringify(savedView),
14393
+ headers: {
14394
+ "Content-Type": "application/json",
14395
+ "Accept-Language": locale2
14396
+ }
14397
+ });
14398
+ if (response.error) {
14399
+ throw response.error;
14400
+ }
14401
+ return response.data;
14871
14402
  },
14872
- [temporaryStorageKey, selectView]
14873
- );
14874
- const clearTemporaryView = useCallback2(() => {
14875
- ViewStorage.remove(temporaryStorageKey);
14876
- setTemporaryView(null);
14877
- selectView(config.defaultView);
14878
- }, [temporaryStorageKey, config.defaultView, selectView]);
14879
- const isViewAlreadySelected = useCallback2(
14880
- (viewId) => checkIsViewSelected(selectedSavedView, viewId),
14881
- [selectedSavedView]
14882
- );
14883
- const handleSavedViewFromUrl = useCallback2(
14884
- (viewId) => {
14885
- if (isViewAlreadySelected(viewId)) {
14403
+ onSuccess: (savedView) => {
14404
+ if (method === "DELETE" || method === "POST") {
14405
+ queryClient2.invalidateQueries({
14406
+ queryKey: ["savedViews", domain, tableName]
14407
+ });
14886
14408
  return;
14887
- }
14888
- const viewInList = findViewByToken(allViews, viewId);
14889
- if (viewInList) {
14890
- selectView(viewInList);
14891
14409
  } else {
14892
- openSharedViewModal(viewId);
14410
+ const oldData = queryClient2.getQueryData([
14411
+ "savedViews",
14412
+ domain,
14413
+ tableName
14414
+ ]);
14415
+ const oldView = oldData?.find((item) => item.id === savedView.id);
14416
+ if (oldView?.name !== savedView.name) {
14417
+ queryClient2.invalidateQueries({
14418
+ queryKey: ["savedViews", domain, tableName]
14419
+ });
14420
+ return;
14421
+ }
14893
14422
  }
14894
- },
14895
- [isViewAlreadySelected, openSharedViewModal, allViews, selectView]
14896
- );
14897
- useEffect2(() => {
14898
- const savedViewId = searchParams.get("saved-view");
14899
- restoreUrlParameter(
14900
- savedViewId,
14901
- previousSavedViewParamRef.current,
14902
- setSearchParams
14903
- );
14904
- if (savedViewId) {
14905
- previousSavedViewParamRef.current = savedViewId;
14423
+ queryClient2.setQueryData(
14424
+ ["savedViews", domain, tableName],
14425
+ (oldData) => {
14426
+ if (!oldData)
14427
+ return [savedView];
14428
+ return oldData.map(
14429
+ (item) => item.id === savedView.id ? savedView : item
14430
+ );
14431
+ }
14432
+ );
14906
14433
  }
14907
- if (savedViewId && savedViews) {
14908
- handleSavedViewFromUrl(savedViewId);
14434
+ });
14435
+ };
14436
+
14437
+ // src/utils/Api/queries.ts
14438
+ var PAGE_SIZE = 50 * VIEW_LEVELS.length;
14439
+ var useSavedViewsQuery = (props) => {
14440
+ const { projectId, companyId, domain, tableName } = props;
14441
+ const url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views?table_name=${tableName}&permissions_domain=${domain}`;
14442
+ return useQuery({
14443
+ enabled: props.enableSavedViews,
14444
+ queryKey: ["savedViews", domain, tableName],
14445
+ queryFn: async () => {
14446
+ const getUrl2 = `${url}&per_page=${PAGE_SIZE}`;
14447
+ const response = await requestJSON(getUrl2);
14448
+ return response.data;
14909
14449
  }
14910
- }, [searchParams, handleSavedViewFromUrl, allViews.length]);
14911
- return {
14912
- selectedView: selectedSavedView,
14913
- selectView,
14914
- temporaryView,
14915
- createTemporaryView,
14916
- clearTemporaryView,
14917
- allViews
14918
- };
14450
+ });
14919
14451
  };
14452
+ var useSavedViewsPermissions = (props) => {
14453
+ const { projectId, companyId, domain } = props;
14454
+ const url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views/permissions?permissions_domain=${domain}`;
14455
+ return useQuery({
14456
+ enabled: props.enableSavedViews,
14457
+ queryKey: ["savedViewsConfig", domain],
14458
+ queryFn: async () => {
14459
+ const response = await requestJSON(url);
14460
+ return response.data;
14461
+ }
14462
+ });
14463
+ };
14464
+ var useCreateSavedView = (props) => useApiRequest(props, "POST", [
14465
+ "createSavedView",
14466
+ props.domain,
14467
+ props.tableName
14468
+ ]);
14469
+ var useUpdateSavedView = (props) => useApiRequest(props, "PUT", [
14470
+ "updateSavedView",
14471
+ props.domain,
14472
+ props.tableName
14473
+ ]);
14474
+ var useDeleteSavedView = (props) => useApiRequest(props, "DELETE", [
14475
+ "deleteSavedView",
14476
+ props.domain,
14477
+ props.tableName
14478
+ ]);
14479
+ var createQueries = (customBackend) => ({
14480
+ useSavedViewsQuery: customBackend?.useSavedViewsQuery ?? useSavedViewsQuery,
14481
+ useSavedViewsPermissions: customBackend?.useSavedViewsPermissions ?? useSavedViewsPermissions,
14482
+ useCreateSavedView: customBackend?.useCreateSavedView ?? useCreateSavedView,
14483
+ useUpdateSavedView: customBackend?.useUpdateSavedView ?? useUpdateSavedView,
14484
+ useDeleteSavedView: customBackend?.useDeleteSavedView ?? useDeleteSavedView
14485
+ });
14920
14486
 
14921
- // src/components/saved-views/SavedViews.tsx
14487
+ // src/SavedViews/components/SavedViews/SavedViews.tsx
14922
14488
  var StyledPanel = styled_components_esm_default.div`
14923
14489
  border: ${({ provider }) => provider === "data-table" ? "1px solid #d6dadc" : "none"};
14924
14490
  `;
@@ -14928,122 +14494,79 @@ var SavedViewsContent = (props) => {
14928
14494
  const queryInput = {
14929
14495
  domain: props.domain,
14930
14496
  tableName: props.tableName,
14497
+ enableSavedViews: props.enableSavedViews,
14931
14498
  projectId,
14932
14499
  companyId
14933
14500
  };
14934
- const { data: savedViews } = useSavedViewsQuery(queryInput);
14935
- const { mutate: deleteSavedView } = useDeleteSavedView(queryInput);
14936
- const { showToast } = useToastAlertContext3();
14937
- const i18n = useI18nContext11();
14938
- const [activeModal, setActiveModal] = useState4(null);
14939
- const [modalData, setModalData] = useState4(null);
14940
- const openModal = (type, data) => {
14941
- setActiveModal(type);
14942
- setModalData(data ?? null);
14943
- };
14944
- const closeModal = useCallback3(() => {
14945
- setActiveModal(null);
14946
- setModalData(null);
14947
- }, []);
14948
- const isModalOpen = (type) => activeModal === type;
14949
- const openSharedViewModal = (viewId) => {
14950
- openModal("sharedView" /* SHARED_VIEW */, { viewId });
14951
- };
14952
- const {
14953
- selectedView,
14954
- selectView,
14955
- createTemporaryView,
14956
- clearTemporaryView,
14957
- allViews
14958
- } = useViewSelection(
14959
- {
14960
- domain: props.domain,
14961
- tableName: props.tableName,
14962
- userId: props.userId,
14963
- projectId,
14964
- companyId,
14965
- defaultView: props.defaultView,
14966
- onSelect: props.onSelect
14967
- },
14968
- savedViews,
14969
- props.presetViews,
14970
- openSharedViewModal
14971
- );
14972
- const { data: fetchedView, isError: fetchError } = useFetchSavedViewById(
14973
- modalData?.viewId ?? null,
14974
- queryInput,
14975
- Boolean(modalData?.viewId)
14976
- );
14977
- const {
14978
- mutate: createSavedView,
14979
- isPending: isCreating,
14980
- error: createError,
14981
- reset: resetCreateError
14982
- } = useCreateSavedView(queryInput);
14983
- useEffect3(() => {
14984
- if (fetchError) {
14985
- showToast.error(i18n.t("savedViews.errors.notFound"));
14986
- selectView(selectedView ?? props.defaultView);
14987
- closeModal();
14501
+ const backend = createQueries(props.backend);
14502
+ const { mutate: deleteSavedView } = backend.useDeleteSavedView(queryInput);
14503
+ const [selectedSavedView, setSelectedSavedView] = useState4(() => {
14504
+ try {
14505
+ const savedView = JSON.parse(
14506
+ localStorage.getItem(
14507
+ `${props.domain}_${props.tableName}_${props.stickyViewsKey}_${projectId}_${props.userId}`
14508
+ )
14509
+ );
14510
+ return savedView || props.defaultView;
14511
+ } catch (e2) {
14512
+ return props.defaultView;
14988
14513
  }
14989
- }, [fetchError, selectedView, props.defaultView, selectView, closeModal]);
14990
- const viewSharedViewTemporarily = () => {
14991
- if (fetchedView) {
14992
- createTemporaryView(fetchedView);
14993
- closeModal();
14514
+ });
14515
+ const updateLocalStorage = (view) => {
14516
+ if (props.stickyViewsKey) {
14517
+ localStorage.setItem(
14518
+ `${props.domain}_${props.tableName}_${props.stickyViewsKey}_${projectId}_${props.userId}`,
14519
+ JSON.stringify(view)
14520
+ );
14994
14521
  }
14995
14522
  };
14996
- const createPersonalCopyOfSharedView = (name, description) => {
14997
- if (fetchedView) {
14998
- const viewToCreate = {
14999
- id: "",
15000
- name,
15001
- description,
15002
- table_name: props.tableName,
15003
- table_config: fetchedView.table_config,
15004
- view_level: "personal",
15005
- share_token: ""
15006
- };
15007
- createSavedView(viewToCreate, {
15008
- onSuccess: (newView) => {
15009
- showToast.success(i18n.t("savedViews.create.success"));
15010
- selectView(newView);
15011
- closeModal();
15012
- }
14523
+ const handleViewItemSelect = ({ item }) => {
14524
+ const viewToSetAsSelected = props.onSelect({ item });
14525
+ setSelectedSavedView(viewToSetAsSelected);
14526
+ updateLocalStorage(viewToSetAsSelected);
14527
+ };
14528
+ const onDelete = () => {
14529
+ if (selectedSavedView) {
14530
+ deleteSavedView(selectedSavedView, {
14531
+ onSuccess: () => handleViewItemSelect({ item: props.defaultView })
15013
14532
  });
15014
14533
  }
15015
14534
  };
15016
- const selectCurrentViewAndCloseModal = () => {
15017
- selectView(selectedView ?? props.defaultView);
15018
- closeModal();
14535
+ const i18n = useI18nContext10();
14536
+ const [openDeleteModal, setOpenDeleteModal] = useState4(false);
14537
+ const [openEditCreateModal, setOpenEditCreateModal] = useState4(false);
14538
+ const [editCreateModalType, setEditCreateModalType] = useState4(
14539
+ "create" /* CREATE */
14540
+ );
14541
+ const onCloseDeleteModal = () => {
14542
+ setOpenDeleteModal(false);
15019
14543
  };
15020
- const deleteSelectedView = () => {
15021
- if (selectedView) {
15022
- deleteSavedView(selectedView, {
15023
- onSuccess: () => selectView(props.defaultView)
15024
- });
15025
- }
14544
+ const onCloseEditModal = () => {
14545
+ setOpenEditCreateModal(false);
14546
+ };
14547
+ const openModal = (type) => {
14548
+ setEditCreateModalType(type);
14549
+ setOpenEditCreateModal(true);
15026
14550
  };
15027
- const confirmDeleteAndCloseModal = () => {
15028
- deleteSelectedView();
15029
- closeModal();
14551
+ const onOpenDeleteModal = () => {
14552
+ setOpenDeleteModal(true);
15030
14553
  };
15031
- return /* @__PURE__ */ React22.createElement(StyledPanel, { provider: props.provider }, /* @__PURE__ */ React22.createElement(
14554
+ return /* @__PURE__ */ React19.createElement(StyledPanel, { provider: props.provider }, /* @__PURE__ */ React19.createElement(
15032
14555
  ExpandedPanel,
15033
14556
  {
15034
14557
  "data-testid": "saved-view-expanded-panel",
15035
14558
  provider: props.provider
15036
14559
  },
15037
- /* @__PURE__ */ React22.createElement(Panel3.Header, { id: "saved-views-collections-panel-header" }, /* @__PURE__ */ React22.createElement(Panel3.Title, null, /* @__PURE__ */ React22.createElement(Flex6, { alignItems: "center" }, /* @__PURE__ */ React22.createElement(Box2, { paddingRight: "sm" }, i18n.t("savedViews.title")), /* @__PURE__ */ React22.createElement(Tooltip, { showDelay: 200, overlay: i18n.t("savedViews.tooltip") }, /* @__PURE__ */ React22.createElement(Help_default, { size: "sm" })))), /* @__PURE__ */ React22.createElement(
14560
+ /* @__PURE__ */ React19.createElement(Panel3.Header, { id: "saved-views-collections-panel-header" }, /* @__PURE__ */ React19.createElement(Panel3.Title, null, /* @__PURE__ */ React19.createElement(Flex5, { alignItems: "center" }, /* @__PURE__ */ React19.createElement(Box2, { paddingRight: "sm" }, i18n.t("savedViews.title")), /* @__PURE__ */ React19.createElement(Tooltip, { showDelay: 200, overlay: i18n.t("savedViews.tooltip") }, /* @__PURE__ */ React19.createElement(Help_default, { size: "sm" })))), /* @__PURE__ */ React19.createElement(
15038
14561
  Tooltip,
15039
14562
  {
15040
14563
  overlay: i18n.t("savedViews.actions.create"),
15041
14564
  showDelay: 1e3
15042
14565
  },
15043
- /* @__PURE__ */ React22.createElement("span", null, /* @__PURE__ */ React22.createElement(
15044
- Button6,
14566
+ /* @__PURE__ */ React19.createElement("span", null, /* @__PURE__ */ React19.createElement(
14567
+ Button5,
15045
14568
  {
15046
- icon: /* @__PURE__ */ React22.createElement(Plus_default, null),
14569
+ icon: /* @__PURE__ */ React19.createElement(Plus_default, null),
15047
14570
  variant: "secondary",
15048
14571
  "data-testid": "expanded-panel-create-button",
15049
14572
  onClick: () => openModal("create" /* CREATE */),
@@ -15052,220 +14575,120 @@ var SavedViewsContent = (props) => {
15052
14575
  i18n.t("savedViews.actions.create")
15053
14576
  ))
15054
14577
  )),
15055
- /* @__PURE__ */ React22.createElement(Panel3.Body, { style: { display: "flex", flexFlow: "column" } }, /* @__PURE__ */ React22.createElement(
14578
+ /* @__PURE__ */ React19.createElement(Panel3.Body, { style: { display: "flex", flexFlow: "column" } }, /* @__PURE__ */ React19.createElement(
15056
14579
  PanelContent,
15057
14580
  {
15058
- onSelect: ({ item }) => selectView(item),
14581
+ onSelect: handleViewItemSelect,
15059
14582
  openModal,
15060
- onDelete: () => openModal("delete" /* DELETE */),
14583
+ onDelete: onOpenDeleteModal,
14584
+ updateLocalStorage,
14585
+ setSelectedSavedView,
15061
14586
  queryInput,
15062
- selectedSavedView: selectedView,
14587
+ selectedSavedView,
15063
14588
  tableConfig: props.tableConfig,
15064
14589
  defaultView: props.defaultView,
15065
- presetViews: props.presetViews,
15066
- savedViews: allViews,
14590
+ stickyViewsKey: props.stickyViewsKey,
15067
14591
  provider: props.provider,
15068
14592
  userId: props.userId,
15069
- onClearTemporary: clearTemporaryView
14593
+ backend
15070
14594
  }
15071
14595
  ))
15072
- ), (isModalOpen("create" /* CREATE */) || isModalOpen("update" /* UPDATE */)) && /* @__PURE__ */ React22.createElement(
15073
- FormModal,
14596
+ ), /* @__PURE__ */ React19.createElement(
14597
+ SavedViewsFormModal,
15074
14598
  {
15075
- open: true,
15076
- mode: activeModal,
15077
- onCancel: closeModal,
14599
+ open: openEditCreateModal,
14600
+ mode: editCreateModalType,
14601
+ onCancel: onCloseEditModal,
15078
14602
  queryInput,
15079
14603
  tableConfig: props.tableConfig,
15080
14604
  tableName: props.tableName,
15081
- selectedSavedView: selectedView,
15082
- onSelect: selectView,
15083
- setOpenEditCreateModal: closeModal,
15084
- defaultView: props.defaultView
14605
+ selectedSavedView,
14606
+ setSelectedSavedView,
14607
+ onSelect: (view) => handleViewItemSelect({ item: view }),
14608
+ setOpenEditCreateModal,
14609
+ defaultView: props.defaultView,
14610
+ backend
15085
14611
  }
15086
- ), selectedView && isModalOpen("delete" /* DELETE */) && /* @__PURE__ */ React22.createElement(
14612
+ ), selectedSavedView && /* @__PURE__ */ React19.createElement(
15087
14613
  SavedViewsDeleteConfirmationModalShared,
15088
14614
  {
15089
- open: true,
15090
- onDelete: confirmDeleteAndCloseModal,
15091
- onCancel: closeModal
15092
- }
15093
- ), fetchedView && isModalOpen("sharedView" /* SHARED_VIEW */) && /* @__PURE__ */ React22.createElement(
15094
- SharedViewFormModal,
15095
- {
15096
- open: true,
15097
- fetchedView,
15098
- onClose: selectCurrentViewAndCloseModal,
15099
- onCreateTemporaryView: viewSharedViewTemporarily,
15100
- onCreateView: createPersonalCopyOfSharedView,
15101
- createError,
15102
- isCreating,
15103
- resetCreateError
14615
+ open: openDeleteModal,
14616
+ onDelete: () => {
14617
+ onDelete();
14618
+ onCloseDeleteModal();
14619
+ },
14620
+ onCancel: onCloseDeleteModal
15104
14621
  }
15105
14622
  ));
15106
14623
  };
15107
14624
  var SavedViews = (props) => {
15108
- return /* @__PURE__ */ React22.createElement(EnvironmentI18nProvider, null, /* @__PURE__ */ React22.createElement(QueryClientProvider, { client: queryClient }, /* @__PURE__ */ React22.createElement(ToastAlertProvider, null, /* @__PURE__ */ React22.createElement(SavedViewsContent, { ...props }))));
15109
- };
15110
-
15111
- // src/components/adapters/smart-grid/SmartGridSavedViews.tsx
15112
- import React23, { useCallback as useCallback4 } from "react";
15113
-
15114
- // src/components/adapters/smart-grid/SmartGridDefaultSavedView.tsx
15115
- import { useMemo as useMemo2 } from "react";
15116
- var DEFAULT_COLUMN_STATE = {
15117
- hide: false,
15118
- pinned: null,
15119
- width: 200,
15120
- sort: null,
15121
- sortIndex: null,
15122
- pivot: false,
15123
- pivotIndex: null,
15124
- aggFunc: null,
15125
- rowGroup: false,
15126
- rowGroupIndex: null,
15127
- flex: null
15128
- };
15129
- var getColumnStateFromDefs = (columnDefs) => {
15130
- return columnDefs.map((colDef) => {
15131
- const field = colDef.field ?? colDef.colId;
15132
- if (!field)
15133
- return null;
15134
- return {
15135
- colId: field,
15136
- hide: colDef.hide ?? false,
15137
- pinned: colDef.pinned ?? null,
15138
- width: colDef.width ?? colDef.minWidth ?? DEFAULT_COLUMN_STATE.width,
15139
- sort: null,
15140
- sortIndex: null,
15141
- pivot: false,
15142
- pivotIndex: null,
15143
- aggFunc: null,
15144
- rowGroup: false,
15145
- rowGroupIndex: null,
15146
- flex: colDef.flex ?? null
15147
- };
15148
- }).filter((col) => col !== null);
15149
- };
15150
- var extractDefaultView = (gridApi, receivedConfig) => {
15151
- const columnDefs = gridApi.getColumnDefs() ?? [];
15152
- const defaultColumnState = receivedConfig?.columnState?.length ? receivedConfig.columnState : getColumnStateFromDefs(columnDefs);
15153
- const result = {
15154
- columnState: defaultColumnState,
15155
- columnGroupState: receivedConfig?.columnGroupState ?? [],
15156
- rowGroupState: receivedConfig?.rowGroupState ?? [],
15157
- filterState: receivedConfig?.filterState ?? {},
15158
- rowHeight: receivedConfig?.rowHeight ?? gridApi.getSizesForCurrentTheme()?.rowHeight
15159
- };
15160
- return result;
15161
- };
15162
- var useNormalizedDefaultViews = (defaultViews, gridApi) => {
15163
- return useMemo2(() => {
15164
- if (!gridApi)
15165
- return defaultViews.map((view) => ({ ...view, share_token: view.id }));
15166
- return defaultViews.map((view) => ({
15167
- ...view,
15168
- share_token: view.id,
15169
- table_config: extractDefaultView(gridApi, view.table_config)
15170
- }));
15171
- }, [defaultViews, gridApi]);
14625
+ return /* @__PURE__ */ React19.createElement(EnvironmentI18nProvider, null, /* @__PURE__ */ React19.createElement(QueryClientProvider, { client: queryClient }, /* @__PURE__ */ React19.createElement(SavedViewsContent, { ...props })));
15172
14626
  };
15173
14627
 
15174
- // src/components/adapters/smart-grid/useSmartGridConfig.ts
15175
- import { useState as useState5, useEffect as useEffect4 } from "react";
15176
- var GRID_STATE_EVENTS = [
15177
- "sortChanged",
15178
- "filterOpened",
15179
- "filterChanged",
15180
- "columnRowGroupChanged",
15181
- "dragStopped",
15182
- "columnResized",
15183
- "columnVisible",
15184
- "columnPinned",
15185
- "columnMoved",
15186
- "modelUpdated",
15187
- "gridColumnsChanged",
15188
- "gridReady"
15189
- ];
15190
- var useSmartGridConfig = (gridApi) => {
15191
- const [config, setConfig] = useState5(
15192
- () => getSmartGridConfig(gridApi)
15193
- );
15194
- useEffect4(() => {
15195
- if (!gridApi)
15196
- return;
15197
- const updateConfig = () => {
15198
- setConfig(getSmartGridConfig(gridApi));
15199
- };
15200
- GRID_STATE_EVENTS.forEach((event) => {
15201
- gridApi.addEventListener(event, updateConfig);
15202
- });
15203
- return () => {
15204
- GRID_STATE_EVENTS.forEach((event) => {
15205
- gridApi.removeEventListener(event, updateConfig);
15206
- });
15207
- };
15208
- }, [gridApi]);
15209
- return { config, setConfig };
15210
- };
15211
-
15212
- // src/components/adapters/smart-grid/SmartGridSavedViews.tsx
14628
+ // src/SavedViews/components/SavedViews/SmartGrid/SmartGridSavedViews.tsx
14629
+ import { ToastAlertProvider } from "@procore/toast-alert";
15213
14630
  var SmartGridSavedViews = (props) => {
15214
- const { gridApi, userId, projectId, companyId } = props;
14631
+ const { gridApi, projectId, companyId } = props;
15215
14632
  const { config: tableConfig, setConfig: setTableConfig } = useSmartGridConfig(gridApi);
15216
- const presetViews = useNormalizedDefaultViews(props.defaultViews, gridApi);
15217
- const defaultView = presetViews.find((view) => view.id === "default") ?? presetViews[0];
15218
- const onSelect = useCallback4(
15219
- ({ item }) => {
15220
- if (!gridApi)
15221
- return item;
15222
- const isPresetView = item.view_level === "default";
15223
- if (isPresetView) {
15224
- updateTableConfig(item, gridApi, "smart-grid");
15225
- setTableConfig(item.table_config);
15226
- return item;
15227
- }
15228
- const updatedView = {
15229
- ...item,
15230
- table_config: customAndConfigSync(
15231
- item.table_config,
15232
- tableConfig
15233
- )
15234
- };
15235
- updateTableConfig(updatedView, gridApi, "smart-grid");
15236
- setTableConfig(updatedView.table_config);
15237
- return updatedView;
15238
- },
15239
- [gridApi, tableConfig, setTableConfig]
15240
- );
15241
- return /* @__PURE__ */ React23.createElement(
14633
+ const defaultView = useDefaultView({
14634
+ defaultViewName: props.defaultViewName,
14635
+ domain: props.domain
14636
+ });
14637
+ const onSelect = ({ item }) => {
14638
+ if (!gridApi)
14639
+ return item;
14640
+ if (item.id === "default") {
14641
+ gridApi.autoSizeAllColumns();
14642
+ gridApi.resetColumnState();
14643
+ gridApi.setFilterModel(props.defaultViewFilters);
14644
+ gridApi.setGridOption("rowHeight", props.defaultRowHeight);
14645
+ gridApi.refreshCells();
14646
+ return item;
14647
+ }
14648
+ const tableConfig2 = item.table_config;
14649
+ const updatedItemConfig = props.transformSettings?.(tableConfig2) ?? tableConfig2;
14650
+ const updatedView = {
14651
+ ...item,
14652
+ table_config: customAndConfigSync(
14653
+ updatedItemConfig,
14654
+ tableConfig2
14655
+ )
14656
+ };
14657
+ updateTableConfig(updatedView, gridApi, "smart-grid");
14658
+ setTableConfig(updatedView.table_config);
14659
+ return updatedView;
14660
+ };
14661
+ return /* @__PURE__ */ React20.createElement(ToastAlertProvider, null, /* @__PURE__ */ React20.createElement(
15242
14662
  SavedViews,
15243
14663
  {
15244
14664
  onSelect,
15245
14665
  domain: props.domain,
15246
- userId,
14666
+ userId: props.userId,
15247
14667
  projectId,
15248
14668
  companyId,
15249
14669
  provider: "smart-grid",
15250
14670
  defaultView,
15251
- presetViews,
15252
14671
  tableName: props.tableName,
15253
- tableConfig
14672
+ tableConfig,
14673
+ stickyViewsKey: props.stickyViewsKey,
14674
+ enableSavedViews: props.enableSavedViews,
14675
+ backend: props.backend
15254
14676
  }
15255
- );
14677
+ ));
15256
14678
  };
15257
14679
 
15258
- // src/components/adapters/data-table/DataTableSavedViews.tsx
15259
- import React24, {
15260
- forwardRef as forwardRef11,
14680
+ // src/SavedViews/components/SavedViews/DataTable/DataTableSavedViews.tsx
14681
+ import React21, {
14682
+ forwardRef as forwardRef9,
15261
14683
  useImperativeHandle,
15262
- useState as useState6,
15263
- useCallback as useCallback5
14684
+ useState as useState5,
14685
+ useCallback as useCallback2
15264
14686
  } from "react";
15265
14687
 
15266
- // src/components/adapters/data-table/DataTableDefaultSavedView.tsx
15267
- import { useMemo as useMemo3 } from "react";
15268
- var DEFAULT_COLUMN_STATE2 = {
14688
+ // src/SavedViews/components/SavedViews/DataTable/DataTableDefaultSavedView.tsx
14689
+ import { useMemo } from "react";
14690
+ import { useI18nContext as useI18nContext11 } from "@procore/core-react";
14691
+ var DEFAULT_COLUMN_STATE = {
15269
14692
  hidden: false,
15270
14693
  pinned: null,
15271
14694
  width: 200,
@@ -15280,7 +14703,7 @@ var getColumnState = (columnDefinitions) => {
15280
14703
  if (column.field.includes("custom_field")) {
15281
14704
  return {
15282
14705
  field: column.field,
15283
- ...DEFAULT_COLUMN_STATE2
14706
+ ...DEFAULT_COLUMN_STATE
15284
14707
  };
15285
14708
  }
15286
14709
  return {
@@ -15291,11 +14714,11 @@ var getColumnState = (columnDefinitions) => {
15291
14714
  rowGroupIndex: null,
15292
14715
  sort: null,
15293
14716
  sortIndex: null,
15294
- 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
14717
+ 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
15295
14718
  };
15296
14719
  });
15297
14720
  };
15298
- var extractDefaultView2 = (columnDefinitions, receivedConfigFromTool) => {
14721
+ var extractDefaultView = (columnDefinitions, receivedConfigFromTool) => {
15299
14722
  const defaultColumnState = getColumnState(columnDefinitions);
15300
14723
  const result = {
15301
14724
  columnState: receivedConfigFromTool?.columnState?.length ? receivedConfigFromTool.columnState : defaultColumnState,
@@ -15310,77 +14733,92 @@ var extractDefaultView2 = (columnDefinitions, receivedConfigFromTool) => {
15310
14733
  };
15311
14734
  return result;
15312
14735
  };
15313
- var useNormalizedDefaultViews2 = (defaultViews, columnDefinitions) => {
15314
- return useMemo3(
15315
- () => defaultViews.map((view) => ({
15316
- ...view,
15317
- share_token: "",
15318
- table_config: extractDefaultView2(columnDefinitions, view.table_config)
15319
- })),
15320
- [defaultViews, columnDefinitions]
14736
+ var useDefaultViewName2 = (domain, defaultViewName) => {
14737
+ const i18n = useI18nContext11();
14738
+ return defaultViewName || i18n.t(domain, {
14739
+ scope: "savedViews.defaultViewTitle",
14740
+ defaultValue: "Default View"
14741
+ });
14742
+ };
14743
+ var useDefaultView2 = (props) => {
14744
+ const name = useDefaultViewName2(props.domain, props.defaultViewName);
14745
+ const extractedDefaultConfig = useMemo(
14746
+ () => extractDefaultView(props.columnDefinitions, props.receivedConfigFromTool),
14747
+ [props.columnDefinitions, props.receivedConfigFromTool]
15321
14748
  );
14749
+ return {
14750
+ id: "default",
14751
+ view_level: "default",
14752
+ name,
14753
+ table_config: extractedDefaultConfig
14754
+ };
15322
14755
  };
15323
14756
 
15324
- // src/components/adapters/data-table/DataTableSavedViews.tsx
15325
- var DataTableSavedViews = forwardRef11((props, ref) => {
15326
- const { tableApi, userId, projectId, companyId } = props;
15327
- const presetViews = useNormalizedDefaultViews2(
15328
- props.defaultViews,
15329
- props.columnDefinitions
15330
- );
15331
- const defaultView = presetViews.find((view) => view.id === "default") ?? presetViews[0];
15332
- const [internalTableConfig, setInternalTableConfig] = useState6(
15333
- ViewStorage.load(props.stickyViewsKey, defaultView).table_config
14757
+ // src/SavedViews/components/SavedViews/DataTable/DataTableSavedViews.tsx
14758
+ import { ToastAlertProvider as ToastAlertProvider2 } from "@procore/toast-alert";
14759
+ var DataTableSavedViews = forwardRef9((props, ref) => {
14760
+ const { tableApi, onTableConfigChange, projectId, companyId } = props;
14761
+ const [internalTableConfig, setInternalTableConfig] = useState5(
14762
+ props.defaultViewConfig
15334
14763
  );
15335
14764
  useImperativeHandle(ref, () => ({
15336
14765
  setTableConfig: (newConfig) => {
15337
- setInternalTableConfig(newConfig);
14766
+ handleConfigChange(newConfig);
15338
14767
  }
15339
14768
  }));
15340
- const onSelect = useCallback5(
15341
- ({ item }) => {
15342
- const isPresetView = item.view_level === "default";
15343
- const updatedView = isPresetView ? item : {
15344
- ...item,
15345
- table_config: customAndConfigSync(
15346
- item.table_config,
15347
- defaultView.table_config
15348
- )
15349
- };
15350
- updateTableConfig(updatedView, tableApi, "data-table");
15351
- setInternalTableConfig(updatedView.table_config);
15352
- return updatedView;
14769
+ const handleConfigChange = useCallback2(
14770
+ (newConfig) => {
14771
+ setInternalTableConfig(newConfig);
14772
+ onTableConfigChange(newConfig);
15353
14773
  },
15354
- [defaultView, tableApi]
14774
+ [onTableConfigChange]
15355
14775
  );
14776
+ const defaultView = useDefaultView2({
14777
+ defaultViewName: props.defaultViewName,
14778
+ receivedConfigFromTool: props.defaultViewConfig,
14779
+ domain: props.domain,
14780
+ columnDefinitions: props.columnDefinitions
14781
+ });
14782
+ const onSelect = ({ item }) => {
14783
+ const isDefaultView = item.id === "default";
14784
+ const updatedView = isDefaultView ? defaultView : {
14785
+ ...item,
14786
+ table_config: customAndConfigSync(
14787
+ item.table_config,
14788
+ defaultView.table_config
14789
+ )
14790
+ };
14791
+ updateTableConfig(updatedView, tableApi, "data-table", handleConfigChange);
14792
+ return updatedView;
14793
+ };
15356
14794
  if (!internalTableConfig) {
15357
14795
  return null;
15358
14796
  }
15359
- return /* @__PURE__ */ React24.createElement(
14797
+ return /* @__PURE__ */ React21.createElement(ToastAlertProvider2, null, /* @__PURE__ */ React21.createElement(
15360
14798
  SavedViews,
15361
14799
  {
15362
14800
  onSelect,
15363
14801
  domain: props.domain,
15364
- userId,
14802
+ userId: props.userId,
15365
14803
  projectId,
15366
14804
  companyId,
15367
14805
  provider: "data-table",
15368
14806
  defaultView,
15369
- presetViews,
15370
14807
  tableName: props.tableName,
15371
- tableConfig: internalTableConfig
14808
+ tableConfig: internalTableConfig,
14809
+ stickyViewsKey: props.stickyViewsKey,
14810
+ enableSavedViews: props.enableSavedViews
15372
14811
  }
15373
- );
14812
+ ));
15374
14813
  });
15375
14814
  DataTableSavedViews.displayName = "DataTableSavedViews";
15376
14815
  export {
15377
14816
  DataTableSavedViews,
15378
14817
  ExpandedPanel,
15379
- FormModal,
15380
14818
  PanelContent,
15381
14819
  SavedViewCollectionMenuItem,
15382
- SavedViews,
15383
14820
  SavedViewsDeleteConfirmationModalShared,
14821
+ SavedViewsFormModal,
15384
14822
  SmartGridSavedViews,
15385
14823
  getTranslations,
15386
14824
  useSavedViewsPanel_default as useSavedViewsPanel