@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.
- package/README.md +61 -679
- package/dist/legacy/index.d.mts +66 -69
- package/dist/legacy/index.d.ts +66 -69
- package/dist/legacy/index.js +693 -1245
- package/dist/legacy/index.mjs +718 -1279
- package/dist/modern/index.d.mts +66 -69
- package/dist/modern/index.d.ts +66 -69
- package/dist/modern/index.js +690 -1243
- package/dist/modern/index.mjs +715 -1277
- package/package.json +2 -4
package/dist/legacy/index.mjs
CHANGED
|
@@ -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",
|
|
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 =
|
|
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
|
-
|
|
190
|
+
P3.abs = function() {
|
|
191
191
|
var x2 = new this.constructor(this);
|
|
192
192
|
x2.s = 1;
|
|
193
193
|
return x2;
|
|
194
194
|
};
|
|
195
|
-
|
|
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
|
-
|
|
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
|
-
|
|
274
|
+
P3.eq = function(y2) {
|
|
275
275
|
return this.cmp(y2) === 0;
|
|
276
276
|
};
|
|
277
|
-
|
|
277
|
+
P3.gt = function(y2) {
|
|
278
278
|
return this.cmp(y2) > 0;
|
|
279
279
|
};
|
|
280
|
-
|
|
280
|
+
P3.gte = function(y2) {
|
|
281
281
|
return this.cmp(y2) > -1;
|
|
282
282
|
};
|
|
283
|
-
|
|
283
|
+
P3.lt = function(y2) {
|
|
284
284
|
return this.cmp(y2) < 0;
|
|
285
285
|
};
|
|
286
|
-
|
|
286
|
+
P3.lte = function(y2) {
|
|
287
287
|
return this.cmp(y2) < 1;
|
|
288
288
|
};
|
|
289
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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,
|
|
1882
|
+
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P3, generator) {
|
|
1883
1883
|
function adopt(value) {
|
|
1884
|
-
return value instanceof
|
|
1884
|
+
return value instanceof P3 ? value : new P3(function(resolve) {
|
|
1885
1885
|
resolve(value);
|
|
1886
1886
|
});
|
|
1887
1887
|
}
|
|
1888
|
-
return new (
|
|
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
|
-
//
|
|
2020
|
+
// node_modules/react-is/cjs/react-is.production.min.js
|
|
2021
2021
|
var require_react_is_production_min = __commonJS({
|
|
2022
|
-
"
|
|
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
|
-
//
|
|
2158
|
+
// node_modules/react-is/cjs/react-is.development.js
|
|
2159
2159
|
var require_react_is_development = __commonJS({
|
|
2160
|
-
"
|
|
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
|
-
//
|
|
2350
|
+
// node_modules/react-is/index.js
|
|
2351
2351
|
var require_react_is = __commonJS({
|
|
2352
|
-
"
|
|
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/
|
|
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/
|
|
9740
|
-
var
|
|
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/
|
|
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/
|
|
9768
|
+
// ../../node_modules/@procore/core-icons/dist/icons/Excavator.js
|
|
9870
9769
|
import * as React5 from "react";
|
|
9871
|
-
var
|
|
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
|
-
|
|
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
|
-
|
|
9895
|
-
|
|
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
|
|
9904
|
-
var ExpandSidebar =
|
|
9905
|
-
return
|
|
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
|
-
|
|
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
|
-
|
|
9912
|
-
|
|
9913
|
-
|
|
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
|
|
9922
|
-
var Help =
|
|
9923
|
-
return
|
|
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
|
-
|
|
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
|
-
|
|
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/
|
|
9937
|
-
import * as
|
|
9938
|
-
var
|
|
9939
|
-
return
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
9971
|
-
var Plus =
|
|
9972
|
-
return
|
|
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
|
-
|
|
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
|
-
|
|
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/
|
|
9851
|
+
// src/SavedViews/components/Buttons/SavedViewsButton.tsx
|
|
9986
9852
|
import { Button } from "@procore/core-react";
|
|
9987
|
-
import
|
|
9853
|
+
import React11 from "react";
|
|
9988
9854
|
|
|
9989
|
-
//
|
|
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 +=
|
|
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
|
|
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) ?
|
|
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 =
|
|
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
|
|
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
|
-
//
|
|
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,
|
|
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
|
|
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
|
|
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__ */
|
|
11093
|
+
return /* @__PURE__ */ React10.createElement(I18nContext.Provider, { value: i18n }, children);
|
|
11228
11094
|
};
|
|
11229
11095
|
|
|
11230
|
-
// src/components/
|
|
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__ */
|
|
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__ */
|
|
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/
|
|
11267
|
-
import
|
|
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
|
|
11278
|
-
return { isOpen, SavedViewsButton:
|
|
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/
|
|
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
|
|
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 =
|
|
11172
|
+
const onClick = React13.useCallback(
|
|
11313
11173
|
(a2) => {
|
|
11314
11174
|
var _a, _b;
|
|
11315
11175
|
if (!props.item) {
|
|
@@ -11333,20 +11193,7 @@ var SavedViewCollectionMenuItem = (props) => {
|
|
|
11333
11193
|
event.stopPropagation();
|
|
11334
11194
|
(_a = props.onUpdate) == null ? void 0 : _a.call(props, props.item);
|
|
11335
11195
|
};
|
|
11336
|
-
const { showToast } = useToastAlertContext();
|
|
11337
11196
|
const i18n = useI18nContext2();
|
|
11338
|
-
const copyShareLink = async (event) => {
|
|
11339
|
-
event.stopPropagation();
|
|
11340
|
-
try {
|
|
11341
|
-
const { origin, pathname } = window.location;
|
|
11342
|
-
const shareUrl = new URL(`${origin}${pathname}`);
|
|
11343
|
-
shareUrl.searchParams.set("saved-view", props.item.share_token);
|
|
11344
|
-
await navigator.clipboard.writeText(shareUrl.toString());
|
|
11345
|
-
showToast.success(i18n.t("savedViews.actions.linkCopied"));
|
|
11346
|
-
} catch (error) {
|
|
11347
|
-
showToast.error(i18n.t("savedViews.errors.copyFailed"));
|
|
11348
|
-
}
|
|
11349
|
-
};
|
|
11350
11197
|
const flyoutMenuOptions = [
|
|
11351
11198
|
{
|
|
11352
11199
|
value: "editNameDesc",
|
|
@@ -11357,7 +11204,7 @@ var SavedViewCollectionMenuItem = (props) => {
|
|
|
11357
11204
|
label: i18n.t("savedViews.actions.delete")
|
|
11358
11205
|
}
|
|
11359
11206
|
];
|
|
11360
|
-
return /* @__PURE__ */
|
|
11207
|
+
return /* @__PURE__ */ React13.createElement(
|
|
11361
11208
|
Container2,
|
|
11362
11209
|
{
|
|
11363
11210
|
"aria-selected": Boolean(props.selected),
|
|
@@ -11368,7 +11215,7 @@ var SavedViewCollectionMenuItem = (props) => {
|
|
|
11368
11215
|
}),
|
|
11369
11216
|
"data-testid": "saved-view-collection-menu-item"
|
|
11370
11217
|
},
|
|
11371
|
-
/* @__PURE__ */
|
|
11218
|
+
/* @__PURE__ */ React13.createElement(
|
|
11372
11219
|
"span",
|
|
11373
11220
|
{
|
|
11374
11221
|
"data-testid": "saved-view-display-name",
|
|
@@ -11376,7 +11223,7 @@ var SavedViewCollectionMenuItem = (props) => {
|
|
|
11376
11223
|
},
|
|
11377
11224
|
props.item.name
|
|
11378
11225
|
),
|
|
11379
|
-
/* @__PURE__ */
|
|
11226
|
+
/* @__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(
|
|
11380
11227
|
Button2,
|
|
11381
11228
|
{
|
|
11382
11229
|
onClick: updateItem,
|
|
@@ -11387,32 +11234,7 @@ var SavedViewCollectionMenuItem = (props) => {
|
|
|
11387
11234
|
loading: props.isUpdateProcessing
|
|
11388
11235
|
},
|
|
11389
11236
|
i18n.t("savedViews.actions.update")
|
|
11390
|
-
)),
|
|
11391
|
-
Button2,
|
|
11392
|
-
{
|
|
11393
|
-
onClick: copyShareLink,
|
|
11394
|
-
variant: "tertiary",
|
|
11395
|
-
size: "sm",
|
|
11396
|
-
"aria-label": i18n.t("savedViews.actions.copyShareLink"),
|
|
11397
|
-
"data-testid": "copy-share-link-button"
|
|
11398
|
-
},
|
|
11399
|
-
/* @__PURE__ */ React15.createElement(IconWrapper, null, /* @__PURE__ */ React15.createElement(Link_default, { size: "sm" }))
|
|
11400
|
-
)), props.item.id === "temporary" && /* @__PURE__ */ React15.createElement("div", null, /* @__PURE__ */ React15.createElement(
|
|
11401
|
-
Button2,
|
|
11402
|
-
{
|
|
11403
|
-
onClick: (e2) => {
|
|
11404
|
-
var _a;
|
|
11405
|
-
e2.stopPropagation();
|
|
11406
|
-
(_a = props.onClearTemporary) == null ? void 0 : _a.call(props);
|
|
11407
|
-
},
|
|
11408
|
-
variant: "tertiary",
|
|
11409
|
-
size: "sm",
|
|
11410
|
-
"aria-label": i18n.t("savedViews.actions.clearTemporary"),
|
|
11411
|
-
title: i18n.t("savedViews.actions.clearTemporary"),
|
|
11412
|
-
"data-testid": "clear-temporary-view-button"
|
|
11413
|
-
},
|
|
11414
|
-
/* @__PURE__ */ React15.createElement(IconWrapper, null, /* @__PURE__ */ React15.createElement(Clear_default, { size: "sm" }))
|
|
11415
|
-
))), /* @__PURE__ */ React15.createElement(Box, null, props.item.view_level !== "default" && props.canEditOrDelete && /* @__PURE__ */ React15.createElement("div", { onClick: (e2) => e2.stopPropagation() }, /* @__PURE__ */ React15.createElement(
|
|
11237
|
+
))), /* @__PURE__ */ React13.createElement(Box, null, props.item.id !== "default" && props.canEditOrDelete && /* @__PURE__ */ React13.createElement("div", { onClick: (e2) => e2.stopPropagation() }, /* @__PURE__ */ React13.createElement(
|
|
11416
11238
|
DropdownFlyout,
|
|
11417
11239
|
{
|
|
11418
11240
|
"data-testid": "saved-view-overflow-button",
|
|
@@ -11427,7 +11249,7 @@ var SavedViewCollectionMenuItem = (props) => {
|
|
|
11427
11249
|
);
|
|
11428
11250
|
};
|
|
11429
11251
|
|
|
11430
|
-
// src/components/
|
|
11252
|
+
// src/SavedViews/components/Panels/ExpandedPanel.tsx
|
|
11431
11253
|
import { Panel } from "@procore/core-react";
|
|
11432
11254
|
var ExpandedPanel = styled_components_esm_default(Panel)`
|
|
11433
11255
|
width: ${({ provider }) => provider === "data-table" ? "316px" : "100%"};
|
|
@@ -11435,268 +11257,116 @@ var ExpandedPanel = styled_components_esm_default(Panel)`
|
|
|
11435
11257
|
border-radius: 4px 0 0 4px;
|
|
11436
11258
|
`;
|
|
11437
11259
|
|
|
11438
|
-
// src/components/
|
|
11439
|
-
import {
|
|
11440
|
-
|
|
11441
|
-
|
|
11260
|
+
// src/SavedViews/components/Panels/PanelContent.tsx
|
|
11261
|
+
import {
|
|
11262
|
+
colors as colors2,
|
|
11263
|
+
DetailPage,
|
|
11264
|
+
Flex as Flex3,
|
|
11265
|
+
UNSAFE_Menu as MenuImperative,
|
|
11266
|
+
spacing as spacing2,
|
|
11267
|
+
useI18nContext as useI18nContext4
|
|
11268
|
+
} from "@procore/core-react";
|
|
11269
|
+
import { useToastAlertContext } from "@procore/toast-alert";
|
|
11270
|
+
import React15 from "react";
|
|
11442
11271
|
|
|
11443
|
-
//
|
|
11444
|
-
|
|
11445
|
-
|
|
11446
|
-
|
|
11447
|
-
|
|
11448
|
-
|
|
11449
|
-
|
|
11450
|
-
|
|
11451
|
-
|
|
11452
|
-
|
|
11453
|
-
|
|
11454
|
-
|
|
11455
|
-
|
|
11456
|
-
|
|
11457
|
-
|
|
11458
|
-
|
|
11459
|
-
|
|
11460
|
-
|
|
11461
|
-
|
|
11462
|
-
const opts = {
|
|
11463
|
-
credentials: "same-origin",
|
|
11464
|
-
headers: {
|
|
11465
|
-
...getCSRFHeader(),
|
|
11466
|
-
...headers
|
|
11467
|
-
},
|
|
11468
|
-
mode: "same-origin",
|
|
11469
|
-
...options
|
|
11272
|
+
// src/utils/Constants/viewLevels.ts
|
|
11273
|
+
var VIEW_LEVELS = ["company", "project", "personal"];
|
|
11274
|
+
|
|
11275
|
+
// src/SavedViews/components/Panels/PanelContentUtils.ts
|
|
11276
|
+
var import_lodash = __toESM(require_lodash());
|
|
11277
|
+
|
|
11278
|
+
// src/SavedViews/components/SavedViews/SmartGrid/SmartGridUtils.ts
|
|
11279
|
+
function getSmartGridConfig(api) {
|
|
11280
|
+
const columnStateResult = api.getColumnState();
|
|
11281
|
+
const columnGroupStateResult = api.getColumnGroupState();
|
|
11282
|
+
const rowGroupStateResult = api.getRowGroupColumns();
|
|
11283
|
+
const rowHeightResult = api.getGridOption("rowHeight") || api.getSizesForCurrentTheme().rowHeight;
|
|
11284
|
+
const serverFiltersResult = api.getFilterModel();
|
|
11285
|
+
const smartGridConfig = {
|
|
11286
|
+
columnState: columnStateResult,
|
|
11287
|
+
rowHeight: rowHeightResult,
|
|
11288
|
+
columnGroupState: columnGroupStateResult,
|
|
11289
|
+
rowGroupState: rowGroupStateResult.filter((col) => typeof (col == null ? void 0 : col.getColId) === "function").map((col) => col.getColId()),
|
|
11290
|
+
filterState: serverFiltersResult
|
|
11470
11291
|
};
|
|
11471
|
-
return
|
|
11472
|
-
}
|
|
11473
|
-
function getUrl(url, baseUrl) {
|
|
11474
|
-
return baseUrl ? applyBaseUrl(url, baseUrl) : url;
|
|
11475
|
-
}
|
|
11476
|
-
function request(url, { baseUrl, ...options } = {}) {
|
|
11477
|
-
return fetch(getUrl(url, baseUrl), getOptions(options));
|
|
11292
|
+
return smartGridConfig;
|
|
11478
11293
|
}
|
|
11479
|
-
function
|
|
11480
|
-
|
|
11481
|
-
|
|
11482
|
-
|
|
11294
|
+
function setSmartGridConfig(api, config) {
|
|
11295
|
+
api.applyColumnState({
|
|
11296
|
+
state: config.columnState,
|
|
11297
|
+
applyOrder: true
|
|
11298
|
+
});
|
|
11299
|
+
api.setColumnGroupState(config.columnGroupState);
|
|
11300
|
+
api.setRowGroupColumns(config.rowGroupState);
|
|
11301
|
+
api.setFilterModel(config.filterState);
|
|
11302
|
+
if (config.rowHeight) {
|
|
11303
|
+
api.setGridOption("rowHeight", config.rowHeight);
|
|
11304
|
+
}
|
|
11483
11305
|
}
|
|
11484
11306
|
|
|
11485
|
-
// src/
|
|
11486
|
-
|
|
11487
|
-
|
|
11488
|
-
|
|
11489
|
-
|
|
11490
|
-
|
|
11491
|
-
|
|
11492
|
-
|
|
11493
|
-
const
|
|
11494
|
-
const
|
|
11495
|
-
|
|
11496
|
-
|
|
11497
|
-
|
|
11498
|
-
|
|
11499
|
-
|
|
11500
|
-
|
|
11501
|
-
|
|
11502
|
-
|
|
11307
|
+
// src/SavedViews/components/SavedViews/SavedViewsUtils.ts
|
|
11308
|
+
var customAndConfigSync = (viewTableConfig, defaultTableConfig) => {
|
|
11309
|
+
if (!viewTableConfig && !defaultTableConfig)
|
|
11310
|
+
return void 0;
|
|
11311
|
+
if (!(viewTableConfig == null ? void 0 : viewTableConfig.columnState))
|
|
11312
|
+
return defaultTableConfig;
|
|
11313
|
+
if (!(defaultTableConfig == null ? void 0 : defaultTableConfig.columnState))
|
|
11314
|
+
return viewTableConfig;
|
|
11315
|
+
const viewColumns = viewTableConfig.columnState;
|
|
11316
|
+
const defaultViewColumns = defaultTableConfig.columnState;
|
|
11317
|
+
if (!Array.isArray(viewColumns) || !Array.isArray(defaultViewColumns))
|
|
11318
|
+
return void 0;
|
|
11319
|
+
const viewFields = new Set(
|
|
11320
|
+
viewColumns.map((col) => getColumnIdentifier(col))
|
|
11321
|
+
);
|
|
11322
|
+
const defaultViewFields = new Set(
|
|
11323
|
+
defaultViewColumns.map((col) => getColumnIdentifier(col))
|
|
11324
|
+
);
|
|
11325
|
+
const newColumns = defaultViewColumns.filter(
|
|
11326
|
+
(col) => !viewFields.has(getColumnIdentifier(col))
|
|
11327
|
+
);
|
|
11328
|
+
const updatedColumns = viewColumns.filter((col) => {
|
|
11329
|
+
const identifier = getColumnIdentifier(col);
|
|
11330
|
+
return identifier.startsWith("ag-Grid-") || defaultViewFields.has(identifier);
|
|
11331
|
+
});
|
|
11332
|
+
const finalColumns = [...updatedColumns, ...newColumns];
|
|
11333
|
+
return {
|
|
11334
|
+
...viewTableConfig,
|
|
11335
|
+
columnState: finalColumns
|
|
11336
|
+
};
|
|
11337
|
+
};
|
|
11338
|
+
var getColumnIdentifier = (col) => {
|
|
11339
|
+
if ("field" in col && typeof col.field === "string") {
|
|
11340
|
+
return col.field;
|
|
11341
|
+
}
|
|
11342
|
+
if ("colId" in col && typeof col.colId === "string") {
|
|
11343
|
+
return col.colId;
|
|
11344
|
+
}
|
|
11345
|
+
return "";
|
|
11346
|
+
};
|
|
11347
|
+
var updateTableConfig = (view, tableApi, provider, onTableConfigChange) => {
|
|
11348
|
+
if (provider === "smart-grid") {
|
|
11349
|
+
setSmartGridConfig(
|
|
11350
|
+
tableApi,
|
|
11351
|
+
view.table_config
|
|
11352
|
+
);
|
|
11353
|
+
} else {
|
|
11354
|
+
const dataTableApi = tableApi;
|
|
11355
|
+
const tableConfig = view.table_config;
|
|
11356
|
+
if (tableConfig) {
|
|
11357
|
+
const rowHeight = (tableConfig == null ? void 0 : tableConfig.rowHeight) ?? (dataTableApi == null ? void 0 : dataTableApi.getTableConfiguration().rowHeight);
|
|
11358
|
+
if (rowHeight !== void 0) {
|
|
11359
|
+
dataTableApi == null ? void 0 : dataTableApi.setRowHeight(rowHeight);
|
|
11503
11360
|
}
|
|
11504
|
-
|
|
11505
|
-
|
|
11506
|
-
|
|
11507
|
-
headers: {
|
|
11508
|
-
"Content-Type": "application/json",
|
|
11509
|
-
"Accept-Language": locale2
|
|
11510
|
-
}
|
|
11511
|
-
});
|
|
11512
|
-
if (response.error) {
|
|
11513
|
-
throw response.error;
|
|
11361
|
+
dataTableApi == null ? void 0 : dataTableApi.setTableConfiguration(tableConfig);
|
|
11362
|
+
if (onTableConfigChange) {
|
|
11363
|
+
onTableConfigChange(tableConfig);
|
|
11514
11364
|
}
|
|
11515
|
-
return response.data;
|
|
11516
|
-
},
|
|
11517
|
-
onSuccess: (savedView) => {
|
|
11518
|
-
if (method === "DELETE" || method === "POST") {
|
|
11519
|
-
queryClient2.invalidateQueries({
|
|
11520
|
-
queryKey: ["savedViews", domain, tableName]
|
|
11521
|
-
});
|
|
11522
|
-
return;
|
|
11523
|
-
} else {
|
|
11524
|
-
const oldData = queryClient2.getQueryData([
|
|
11525
|
-
"savedViews",
|
|
11526
|
-
domain,
|
|
11527
|
-
tableName
|
|
11528
|
-
]);
|
|
11529
|
-
const oldView = oldData == null ? void 0 : oldData.find(
|
|
11530
|
-
(item) => item.share_token === savedView.share_token
|
|
11531
|
-
);
|
|
11532
|
-
if ((oldView == null ? void 0 : oldView.name) !== savedView.name) {
|
|
11533
|
-
queryClient2.invalidateQueries({
|
|
11534
|
-
queryKey: ["savedViews", domain, tableName]
|
|
11535
|
-
});
|
|
11536
|
-
return;
|
|
11537
|
-
}
|
|
11538
|
-
}
|
|
11539
|
-
queryClient2.setQueryData(
|
|
11540
|
-
["savedViews", domain, tableName],
|
|
11541
|
-
(oldData) => {
|
|
11542
|
-
if (!oldData)
|
|
11543
|
-
return [savedView];
|
|
11544
|
-
return oldData.map(
|
|
11545
|
-
(item) => item.share_token === savedView.share_token ? savedView : item
|
|
11546
|
-
);
|
|
11547
|
-
}
|
|
11548
|
-
);
|
|
11549
|
-
}
|
|
11550
|
-
});
|
|
11551
|
-
};
|
|
11552
|
-
|
|
11553
|
-
// src/utils/constants/viewLevels.ts
|
|
11554
|
-
var VIEW_LEVELS = ["company", "project", "personal"];
|
|
11555
|
-
|
|
11556
|
-
// src/utils/api/queries.ts
|
|
11557
|
-
var PAGE_SIZE = 50 * VIEW_LEVELS.length;
|
|
11558
|
-
var useSavedViewsQuery = (props) => {
|
|
11559
|
-
const { projectId, companyId, domain, tableName } = props;
|
|
11560
|
-
const url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views?table_name=${tableName}&permissions_domain=${domain}`;
|
|
11561
|
-
return useQuery({
|
|
11562
|
-
queryKey: ["savedViews", domain, tableName],
|
|
11563
|
-
queryFn: async () => {
|
|
11564
|
-
const getUrl2 = `${url}&per_page=${PAGE_SIZE}`;
|
|
11565
|
-
const response = await requestJSON(getUrl2);
|
|
11566
|
-
return response.data;
|
|
11567
|
-
}
|
|
11568
|
-
});
|
|
11569
|
-
};
|
|
11570
|
-
var useSavedViewsPermissions = (props) => {
|
|
11571
|
-
const { projectId, companyId, domain } = props;
|
|
11572
|
-
const url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views/permissions?permissions_domain=${domain}`;
|
|
11573
|
-
return useQuery({
|
|
11574
|
-
queryKey: ["savedViewsConfig", domain],
|
|
11575
|
-
queryFn: async () => {
|
|
11576
|
-
const response = await requestJSON(url);
|
|
11577
|
-
return response.data;
|
|
11578
|
-
}
|
|
11579
|
-
});
|
|
11580
|
-
};
|
|
11581
|
-
var useCreateSavedView = (props) => useApiRequest(props, "POST", [
|
|
11582
|
-
"createSavedView",
|
|
11583
|
-
props.domain,
|
|
11584
|
-
props.tableName
|
|
11585
|
-
]);
|
|
11586
|
-
var useUpdateSavedView = (props) => useApiRequest(props, "PUT", [
|
|
11587
|
-
"updateSavedView",
|
|
11588
|
-
props.domain,
|
|
11589
|
-
props.tableName
|
|
11590
|
-
]);
|
|
11591
|
-
var useDeleteSavedView = (props) => useApiRequest(props, "DELETE", [
|
|
11592
|
-
"deleteSavedView",
|
|
11593
|
-
props.domain,
|
|
11594
|
-
props.tableName
|
|
11595
|
-
]);
|
|
11596
|
-
var useFetchSavedViewById = (savedViewToken, queryInput, enabled = true) => {
|
|
11597
|
-
const { projectId, companyId } = queryInput;
|
|
11598
|
-
return useQuery({
|
|
11599
|
-
enabled: enabled && Boolean(savedViewToken),
|
|
11600
|
-
queryKey: ["savedView", savedViewToken],
|
|
11601
|
-
queryFn: async () => {
|
|
11602
|
-
const url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views/${savedViewToken}`;
|
|
11603
|
-
const response = await requestJSON(url);
|
|
11604
|
-
return response.data;
|
|
11605
|
-
}
|
|
11606
|
-
});
|
|
11607
|
-
};
|
|
11608
|
-
|
|
11609
|
-
// src/components/panels/PanelContentUtils.ts
|
|
11610
|
-
var import_lodash = __toESM(require_lodash());
|
|
11611
|
-
|
|
11612
|
-
// src/components/adapters/smart-grid/SmartGridUtils.ts
|
|
11613
|
-
function getSmartGridConfig(api) {
|
|
11614
|
-
const columnState = api.getColumnState();
|
|
11615
|
-
const columnGroupState = api.getColumnGroupState();
|
|
11616
|
-
const rowGroupState = api.getRowGroupColumns().map((col) => col.getColId());
|
|
11617
|
-
const rowHeight = api.getGridOption("rowHeight") ?? api.getSizesForCurrentTheme().rowHeight;
|
|
11618
|
-
const filterState = api.getFilterModel();
|
|
11619
|
-
return {
|
|
11620
|
-
columnState,
|
|
11621
|
-
rowHeight,
|
|
11622
|
-
columnGroupState,
|
|
11623
|
-
rowGroupState,
|
|
11624
|
-
filterState
|
|
11625
|
-
};
|
|
11626
|
-
}
|
|
11627
|
-
function setSmartGridConfig(api, config) {
|
|
11628
|
-
api.applyColumnState({
|
|
11629
|
-
state: config.columnState,
|
|
11630
|
-
applyOrder: true
|
|
11631
|
-
});
|
|
11632
|
-
api.setColumnGroupState(config.columnGroupState);
|
|
11633
|
-
api.setRowGroupColumns(config.rowGroupState);
|
|
11634
|
-
api.setFilterModel(config.filterState);
|
|
11635
|
-
if (config.rowHeight) {
|
|
11636
|
-
api.setGridOption("rowHeight", config.rowHeight);
|
|
11637
|
-
}
|
|
11638
|
-
}
|
|
11639
|
-
|
|
11640
|
-
// src/components/saved-views/SavedViewsUtils.ts
|
|
11641
|
-
var customAndConfigSync = (viewTableConfig, defaultTableConfig) => {
|
|
11642
|
-
if (!viewTableConfig && !defaultTableConfig)
|
|
11643
|
-
return void 0;
|
|
11644
|
-
if (!(viewTableConfig == null ? void 0 : viewTableConfig.columnState))
|
|
11645
|
-
return defaultTableConfig;
|
|
11646
|
-
if (!(defaultTableConfig == null ? void 0 : defaultTableConfig.columnState))
|
|
11647
|
-
return viewTableConfig;
|
|
11648
|
-
const viewColumns = viewTableConfig.columnState;
|
|
11649
|
-
const defaultViewColumns = defaultTableConfig.columnState;
|
|
11650
|
-
if (!Array.isArray(viewColumns) || !Array.isArray(defaultViewColumns))
|
|
11651
|
-
return void 0;
|
|
11652
|
-
const viewFields = new Set(
|
|
11653
|
-
viewColumns.map((col) => getColumnIdentifier(col))
|
|
11654
|
-
);
|
|
11655
|
-
const defaultViewFields = new Set(
|
|
11656
|
-
defaultViewColumns.map((col) => getColumnIdentifier(col))
|
|
11657
|
-
);
|
|
11658
|
-
const newColumns = defaultViewColumns.filter(
|
|
11659
|
-
(col) => !viewFields.has(getColumnIdentifier(col))
|
|
11660
|
-
);
|
|
11661
|
-
const updatedColumns = viewColumns.filter((col) => {
|
|
11662
|
-
const identifier = getColumnIdentifier(col);
|
|
11663
|
-
return identifier.startsWith("ag-Grid-") || defaultViewFields.has(identifier);
|
|
11664
|
-
});
|
|
11665
|
-
const finalColumns = [...updatedColumns, ...newColumns];
|
|
11666
|
-
return {
|
|
11667
|
-
...viewTableConfig,
|
|
11668
|
-
columnState: finalColumns
|
|
11669
|
-
};
|
|
11670
|
-
};
|
|
11671
|
-
var getColumnIdentifier = (col) => {
|
|
11672
|
-
if ("field" in col && typeof col.field === "string") {
|
|
11673
|
-
return col.field;
|
|
11674
|
-
}
|
|
11675
|
-
if ("colId" in col && typeof col.colId === "string") {
|
|
11676
|
-
return col.colId;
|
|
11677
|
-
}
|
|
11678
|
-
return "";
|
|
11679
|
-
};
|
|
11680
|
-
var updateTableConfig = (view, tableApi, provider) => {
|
|
11681
|
-
if (provider === "smart-grid") {
|
|
11682
|
-
setSmartGridConfig(
|
|
11683
|
-
tableApi,
|
|
11684
|
-
view.table_config
|
|
11685
|
-
);
|
|
11686
|
-
} else {
|
|
11687
|
-
const dataTableApi = tableApi;
|
|
11688
|
-
const tableConfig = view.table_config;
|
|
11689
|
-
if (tableConfig) {
|
|
11690
|
-
const rowHeight = (tableConfig == null ? void 0 : tableConfig.rowHeight) ?? (dataTableApi == null ? void 0 : dataTableApi.getTableConfiguration().rowHeight);
|
|
11691
|
-
if (rowHeight !== void 0) {
|
|
11692
|
-
dataTableApi == null ? void 0 : dataTableApi.setRowHeight(rowHeight);
|
|
11693
|
-
}
|
|
11694
|
-
dataTableApi == null ? void 0 : dataTableApi.setTableConfiguration(tableConfig);
|
|
11695
11365
|
}
|
|
11696
11366
|
}
|
|
11697
11367
|
};
|
|
11698
11368
|
|
|
11699
|
-
// src/components/
|
|
11369
|
+
// src/SavedViews/components/Panels/PanelContentUtils.ts
|
|
11700
11370
|
var getOrderedVisibleColumns = (columns, idKey) => {
|
|
11701
11371
|
if (!columns)
|
|
11702
11372
|
return [];
|
|
@@ -11755,12 +11425,13 @@ var normalizeForComparison = (config) => {
|
|
|
11755
11425
|
if (!(config == null ? void 0 : config.columnState))
|
|
11756
11426
|
return config;
|
|
11757
11427
|
return {
|
|
11758
|
-
...config,
|
|
11428
|
+
...import_lodash.default.omit(config, ["enableRowGrouping", "enableColumnGrouping"]),
|
|
11759
11429
|
columnState: config.columnState.map((col) => {
|
|
11430
|
+
const res = import_lodash.default.omit(col, ["aggFunc"]);
|
|
11760
11431
|
if (col.flex) {
|
|
11761
|
-
return import_lodash.default.omit(
|
|
11432
|
+
return import_lodash.default.omit(res, ["width", "flex"]);
|
|
11762
11433
|
}
|
|
11763
|
-
return
|
|
11434
|
+
return res;
|
|
11764
11435
|
})
|
|
11765
11436
|
};
|
|
11766
11437
|
};
|
|
@@ -11773,10 +11444,14 @@ var isEqual = (viewTableConfig, tableConfig, defaultViewConfig, provider) => {
|
|
|
11773
11444
|
);
|
|
11774
11445
|
const normalizedViewConfig = normalizeForComparison(syncedViewTableConfig);
|
|
11775
11446
|
const normalizedCurrentConfig = normalizeForComparison(tableConfig);
|
|
11776
|
-
|
|
11777
|
-
|
|
11778
|
-
|
|
11779
|
-
|
|
11447
|
+
const cleanedViewConfig = cleanObject(normalizedViewConfig, provider);
|
|
11448
|
+
const cleanedCurrentConfig = cleanObject(normalizedCurrentConfig, provider);
|
|
11449
|
+
console.log("xx:Difference between view config and current config:", {
|
|
11450
|
+
viewConfig: cleanedViewConfig,
|
|
11451
|
+
currentConfig: cleanedCurrentConfig,
|
|
11452
|
+
areEqual: import_lodash.default.isEqual(cleanedViewConfig, cleanedCurrentConfig)
|
|
11453
|
+
});
|
|
11454
|
+
return import_lodash.default.isEqual(cleanedViewConfig, cleanedCurrentConfig);
|
|
11780
11455
|
};
|
|
11781
11456
|
var hasPermissionForViewLevel = (viewLevel, permissions) => {
|
|
11782
11457
|
switch (viewLevel) {
|
|
@@ -11791,7 +11466,7 @@ var hasPermissionForViewLevel = (viewLevel, permissions) => {
|
|
|
11791
11466
|
}
|
|
11792
11467
|
};
|
|
11793
11468
|
|
|
11794
|
-
// src/components/
|
|
11469
|
+
// src/SavedViews/components/Panels/useGroups.ts
|
|
11795
11470
|
import { useState as useState2 } from "react";
|
|
11796
11471
|
var useGroups = () => {
|
|
11797
11472
|
const [groups, setGroups] = useState2(
|
|
@@ -11803,23 +11478,23 @@ var useGroups = () => {
|
|
|
11803
11478
|
return { groups, toggleGroup };
|
|
11804
11479
|
};
|
|
11805
11480
|
|
|
11806
|
-
// src/components/
|
|
11481
|
+
// src/SavedViews/components/Panels/ViewLevelHeader.tsx
|
|
11807
11482
|
import {
|
|
11808
11483
|
colors,
|
|
11809
11484
|
Flex as Flex2,
|
|
11810
11485
|
spacing,
|
|
11811
11486
|
Typography,
|
|
11812
|
-
useI18nContext as
|
|
11487
|
+
useI18nContext as useI18nContext3
|
|
11813
11488
|
} from "@procore/core-react";
|
|
11814
|
-
import
|
|
11489
|
+
import React14 from "react";
|
|
11815
11490
|
var groupIcon = (group) => {
|
|
11816
11491
|
switch (group) {
|
|
11817
11492
|
case "personal":
|
|
11818
|
-
return /* @__PURE__ */
|
|
11493
|
+
return /* @__PURE__ */ React14.createElement(Person_default, null);
|
|
11819
11494
|
case "project":
|
|
11820
|
-
return /* @__PURE__ */
|
|
11495
|
+
return /* @__PURE__ */ React14.createElement(Excavator_default, null);
|
|
11821
11496
|
case "company":
|
|
11822
|
-
return /* @__PURE__ */
|
|
11497
|
+
return /* @__PURE__ */ React14.createElement(Building_default, null);
|
|
11823
11498
|
}
|
|
11824
11499
|
};
|
|
11825
11500
|
var Header = styled_components_esm_default(Flex2)`
|
|
@@ -11829,8 +11504,8 @@ var Header = styled_components_esm_default(Flex2)`
|
|
|
11829
11504
|
}
|
|
11830
11505
|
`;
|
|
11831
11506
|
var ViewLevelHeader = ({ expanded, toggleGroup, group }) => {
|
|
11832
|
-
const I18n =
|
|
11833
|
-
return /* @__PURE__ */
|
|
11507
|
+
const I18n = useI18nContext3();
|
|
11508
|
+
return /* @__PURE__ */ React14.createElement(
|
|
11834
11509
|
Header,
|
|
11835
11510
|
{
|
|
11836
11511
|
alignItems: "center",
|
|
@@ -11839,14 +11514,14 @@ var ViewLevelHeader = ({ expanded, toggleGroup, group }) => {
|
|
|
11839
11514
|
style: { cursor: "pointer" },
|
|
11840
11515
|
onClick: () => toggleGroup(group)
|
|
11841
11516
|
},
|
|
11842
|
-
expanded ? /* @__PURE__ */
|
|
11517
|
+
expanded ? /* @__PURE__ */ React14.createElement(ChevronDown_default, { size: "sm" }) : /* @__PURE__ */ React14.createElement(ChevronRight_default, { size: "sm" }),
|
|
11843
11518
|
groupIcon(group),
|
|
11844
|
-
/* @__PURE__ */
|
|
11519
|
+
/* @__PURE__ */ React14.createElement(Typography, { weight: "semibold" }, I18n.t(`savedViews.viewLevel.${group}`))
|
|
11845
11520
|
);
|
|
11846
11521
|
};
|
|
11847
11522
|
var ViewLevelHeader_default = ViewLevelHeader;
|
|
11848
11523
|
|
|
11849
|
-
// src/utils/
|
|
11524
|
+
// src/utils/Hooks/useScrollToRef.ts
|
|
11850
11525
|
import { useEffect, useRef } from "react";
|
|
11851
11526
|
var useScrollToRef = (dependency) => {
|
|
11852
11527
|
const ref = useRef(null);
|
|
@@ -11858,13 +11533,7 @@ var useScrollToRef = (dependency) => {
|
|
|
11858
11533
|
return ref;
|
|
11859
11534
|
};
|
|
11860
11535
|
|
|
11861
|
-
// src/components/
|
|
11862
|
-
import {
|
|
11863
|
-
colors as colors2,
|
|
11864
|
-
DetailPage,
|
|
11865
|
-
UNSAFE_Menu as MenuImperative,
|
|
11866
|
-
spacing as spacing2
|
|
11867
|
-
} from "@procore/core-react";
|
|
11536
|
+
// src/SavedViews/components/Panels/PanelContent.tsx
|
|
11868
11537
|
var Row = styled_components_esm_default(MenuImperative.Item)`
|
|
11869
11538
|
width: 100%;
|
|
11870
11539
|
padding-left: 35px;
|
|
@@ -11881,85 +11550,61 @@ var Panel2 = styled_components_esm_default(DetailPage.Card)`
|
|
|
11881
11550
|
padding-top: ${spacing2.sm}px;
|
|
11882
11551
|
box-shadow: none;
|
|
11883
11552
|
`;
|
|
11884
|
-
|
|
11885
|
-
// src/components/panels/PanelContent.tsx
|
|
11886
11553
|
var PanelContent = (props) => {
|
|
11887
|
-
|
|
11888
|
-
const { showToast } =
|
|
11889
|
-
const I18n =
|
|
11890
|
-
const {
|
|
11891
|
-
const
|
|
11892
|
-
const {
|
|
11893
|
-
|
|
11894
|
-
|
|
11895
|
-
const errorToastRef =
|
|
11896
|
-
|
|
11554
|
+
var _a;
|
|
11555
|
+
const { showToast } = useToastAlertContext();
|
|
11556
|
+
const I18n = useI18nContext4();
|
|
11557
|
+
const { useSavedViewsQuery: useSavedViewsQuery2, useSavedViewsPermissions: useSavedViewsPermissions2, useUpdateSavedView: useUpdateSavedView2 } = props.backend;
|
|
11558
|
+
const { mutate: updateSavedView, isPending: isUpdateLoading } = useUpdateSavedView2(props.queryInput);
|
|
11559
|
+
const { data: savedViews, error: savedViewsError } = useSavedViewsQuery2(
|
|
11560
|
+
props.queryInput
|
|
11561
|
+
);
|
|
11562
|
+
const errorToastRef = React15.useRef(null);
|
|
11563
|
+
React15.useEffect(() => {
|
|
11897
11564
|
if (savedViewsError && savedViewsError !== errorToastRef.current) {
|
|
11898
11565
|
showToast.error(I18n.t("savedViews.errors.fetch"));
|
|
11899
11566
|
errorToastRef.current = savedViewsError;
|
|
11900
11567
|
}
|
|
11901
|
-
}, [savedViewsError
|
|
11902
|
-
const { data: permissions } =
|
|
11568
|
+
}, [savedViewsError]);
|
|
11569
|
+
const { data: permissions } = useSavedViewsPermissions2(props.queryInput);
|
|
11903
11570
|
const selectedRowRef = useScrollToRef(savedViews);
|
|
11904
|
-
const { groups, toggleGroup } = useGroups();
|
|
11905
|
-
const isTemporarySelected = (selectedSavedView == null ? void 0 : selectedSavedView.id) === "temporary";
|
|
11906
|
-
const temporaryView = savedViews == null ? void 0 : savedViews.find((view) => view.id === "temporary");
|
|
11907
|
-
const presetViews = props.presetViews || [props.defaultView];
|
|
11908
11571
|
const onUpdate = (data) => {
|
|
11909
11572
|
const newSavedView = {
|
|
11910
11573
|
...data,
|
|
11911
|
-
...selectedSavedView,
|
|
11912
|
-
table_config: tableConfig
|
|
11574
|
+
...props.selectedSavedView,
|
|
11575
|
+
table_config: props.tableConfig
|
|
11913
11576
|
};
|
|
11914
11577
|
updateSavedView(newSavedView, {
|
|
11915
11578
|
onSuccess: () => {
|
|
11916
11579
|
showToast.success(I18n.t("savedViews.update.success"));
|
|
11917
|
-
props.
|
|
11580
|
+
props.updateLocalStorage(newSavedView);
|
|
11581
|
+
props.setSelectedSavedView(newSavedView);
|
|
11918
11582
|
},
|
|
11919
11583
|
onError: () => {
|
|
11920
11584
|
showToast.error(I18n.t("savedViews.errors.update"));
|
|
11921
11585
|
}
|
|
11922
11586
|
});
|
|
11923
11587
|
};
|
|
11924
|
-
|
|
11588
|
+
const { groups, toggleGroup } = useGroups();
|
|
11589
|
+
const isDefaultSelected = ((_a = props.selectedSavedView) == null ? void 0 : _a.id) === "default";
|
|
11590
|
+
return /* @__PURE__ */ React15.createElement(Panel2, { "data-testid": "inner-panel" }, /* @__PURE__ */ React15.createElement(Flex3, { direction: "column", style: { height: "100%", width: "100%" } }, /* @__PURE__ */ React15.createElement(
|
|
11925
11591
|
Row,
|
|
11926
11592
|
{
|
|
11927
|
-
selected:
|
|
11928
|
-
onClick: () => props.onSelect({ item:
|
|
11929
|
-
ref:
|
|
11593
|
+
selected: isDefaultSelected,
|
|
11594
|
+
onClick: () => props.onSelect({ item: props.defaultView }),
|
|
11595
|
+
ref: isDefaultSelected ? selectedRowRef : null
|
|
11930
11596
|
},
|
|
11931
|
-
/* @__PURE__ */
|
|
11597
|
+
/* @__PURE__ */ React15.createElement(
|
|
11932
11598
|
SavedViewCollectionMenuItem,
|
|
11933
11599
|
{
|
|
11934
|
-
item:
|
|
11935
|
-
selected:
|
|
11936
|
-
onClearTemporary: props.onClearTemporary
|
|
11600
|
+
item: props.defaultView,
|
|
11601
|
+
selected: isDefaultSelected
|
|
11937
11602
|
}
|
|
11938
11603
|
)
|
|
11939
|
-
),
|
|
11940
|
-
const isSelected = (selectedSavedView == null ? void 0 : selectedSavedView.id) === presetView.id;
|
|
11941
|
-
return /* @__PURE__ */ React17.createElement(
|
|
11942
|
-
Row,
|
|
11943
|
-
{
|
|
11944
|
-
key: presetView.id,
|
|
11945
|
-
selected: isSelected,
|
|
11946
|
-
onClick: () => props.onSelect({ item: presetView }),
|
|
11947
|
-
ref: isSelected ? selectedRowRef : null
|
|
11948
|
-
},
|
|
11949
|
-
/* @__PURE__ */ React17.createElement(
|
|
11950
|
-
SavedViewCollectionMenuItem,
|
|
11951
|
-
{
|
|
11952
|
-
item: presetView,
|
|
11953
|
-
selected: isSelected
|
|
11954
|
-
}
|
|
11955
|
-
)
|
|
11956
|
-
);
|
|
11957
|
-
}), VIEW_LEVELS.map((level) => {
|
|
11604
|
+
), VIEW_LEVELS.map((level) => {
|
|
11958
11605
|
const isExpanded = groups[level];
|
|
11959
|
-
const views = isExpanded && savedViews ? savedViews.filter(
|
|
11960
|
-
|
|
11961
|
-
) : [];
|
|
11962
|
-
return /* @__PURE__ */ React17.createElement(React17.Fragment, { key: level }, /* @__PURE__ */ React17.createElement(
|
|
11606
|
+
const views = isExpanded && savedViews ? savedViews.filter((view) => view.view_level === level) : [];
|
|
11607
|
+
return /* @__PURE__ */ React15.createElement(React15.Fragment, { key: level }, /* @__PURE__ */ React15.createElement(
|
|
11963
11608
|
ViewLevelHeader_default,
|
|
11964
11609
|
{
|
|
11965
11610
|
group: level,
|
|
@@ -11967,15 +11612,16 @@ var PanelContent = (props) => {
|
|
|
11967
11612
|
expanded: isExpanded
|
|
11968
11613
|
}
|
|
11969
11614
|
), views.map((view) => {
|
|
11970
|
-
|
|
11615
|
+
var _a2;
|
|
11616
|
+
const isSelected = ((_a2 = props.selectedSavedView) == null ? void 0 : _a2.id) === view.id;
|
|
11971
11617
|
const canUpdate = isSelected && hasPermissionForViewLevel(view.view_level, permissions) && !isEqual(
|
|
11972
11618
|
view.table_config,
|
|
11973
|
-
tableConfig,
|
|
11619
|
+
props.tableConfig,
|
|
11974
11620
|
props.defaultView.table_config,
|
|
11975
11621
|
props.provider
|
|
11976
11622
|
);
|
|
11977
11623
|
const canEditOrDelete = isSelected && hasPermissionForViewLevel(view.view_level, permissions);
|
|
11978
|
-
return /* @__PURE__ */
|
|
11624
|
+
return /* @__PURE__ */ React15.createElement(
|
|
11979
11625
|
Row,
|
|
11980
11626
|
{
|
|
11981
11627
|
key: view.id,
|
|
@@ -11986,7 +11632,7 @@ var PanelContent = (props) => {
|
|
|
11986
11632
|
},
|
|
11987
11633
|
ref: isSelected ? selectedRowRef : null
|
|
11988
11634
|
},
|
|
11989
|
-
/* @__PURE__ */
|
|
11635
|
+
/* @__PURE__ */ React15.createElement(
|
|
11990
11636
|
SavedViewCollectionMenuItem,
|
|
11991
11637
|
{
|
|
11992
11638
|
item: view,
|
|
@@ -12006,20 +11652,79 @@ var PanelContent = (props) => {
|
|
|
12006
11652
|
})));
|
|
12007
11653
|
};
|
|
12008
11654
|
|
|
12009
|
-
// src/components/
|
|
11655
|
+
// src/SavedViews/components/SavedViews/SmartGrid/SmartGridSavedViews.tsx
|
|
11656
|
+
import React20 from "react";
|
|
11657
|
+
|
|
11658
|
+
// src/SavedViews/components/SavedViews/SmartGrid/SmartGridDefaultSavedView.tsx
|
|
11659
|
+
import { useI18nContext as useI18nContext5 } from "@procore/core-react";
|
|
11660
|
+
var useDefaultViewName = (domain, defaultViewName) => {
|
|
11661
|
+
const i18n = useI18nContext5();
|
|
11662
|
+
return defaultViewName || i18n.t(domain, {
|
|
11663
|
+
scope: "savedViews.defaultViewTitle",
|
|
11664
|
+
defaultValue: "Default View"
|
|
11665
|
+
});
|
|
11666
|
+
};
|
|
11667
|
+
var useDefaultView = (props) => {
|
|
11668
|
+
const name = useDefaultViewName(props.domain, props.defaultViewName);
|
|
11669
|
+
return {
|
|
11670
|
+
id: "default",
|
|
11671
|
+
view_level: "default",
|
|
11672
|
+
name,
|
|
11673
|
+
table_config: {}
|
|
11674
|
+
};
|
|
11675
|
+
};
|
|
11676
|
+
|
|
11677
|
+
// src/SavedViews/components/SavedViews/SmartGrid/useSmartGridConfig.ts
|
|
11678
|
+
import { useState as useState3, useEffect as useEffect2 } from "react";
|
|
11679
|
+
var GRID_STATE_EVENTS = [
|
|
11680
|
+
"sortChanged",
|
|
11681
|
+
"filterOpened",
|
|
11682
|
+
"filterChanged",
|
|
11683
|
+
"columnRowGroupChanged",
|
|
11684
|
+
"dragStopped",
|
|
11685
|
+
"columnResized",
|
|
11686
|
+
"columnVisible",
|
|
11687
|
+
"columnPinned",
|
|
11688
|
+
"columnMoved",
|
|
11689
|
+
"modelUpdated",
|
|
11690
|
+
"gridColumnsChanged",
|
|
11691
|
+
"gridReady"
|
|
11692
|
+
];
|
|
11693
|
+
var useSmartGridConfig = (gridApi) => {
|
|
11694
|
+
const [config, setConfig] = useState3(
|
|
11695
|
+
() => getSmartGridConfig(gridApi)
|
|
11696
|
+
);
|
|
11697
|
+
useEffect2(() => {
|
|
11698
|
+
if (!gridApi)
|
|
11699
|
+
return;
|
|
11700
|
+
const updateConfig = () => {
|
|
11701
|
+
setConfig(getSmartGridConfig(gridApi));
|
|
11702
|
+
};
|
|
11703
|
+
GRID_STATE_EVENTS.forEach((event) => {
|
|
11704
|
+
gridApi.addEventListener(event, updateConfig);
|
|
11705
|
+
});
|
|
11706
|
+
return () => {
|
|
11707
|
+
GRID_STATE_EVENTS.forEach((event) => {
|
|
11708
|
+
gridApi.removeEventListener(event, updateConfig);
|
|
11709
|
+
});
|
|
11710
|
+
};
|
|
11711
|
+
}, [gridApi]);
|
|
11712
|
+
return { config, setConfig };
|
|
11713
|
+
};
|
|
11714
|
+
|
|
11715
|
+
// src/SavedViews/components/SavedViews/SavedViews.tsx
|
|
12010
11716
|
import {
|
|
12011
11717
|
Box as Box2,
|
|
12012
|
-
Button as
|
|
12013
|
-
Flex as
|
|
11718
|
+
Button as Button5,
|
|
11719
|
+
Flex as Flex5,
|
|
12014
11720
|
Panel as Panel3,
|
|
12015
11721
|
Tooltip,
|
|
12016
|
-
useI18nContext as
|
|
11722
|
+
useI18nContext as useI18nContext10
|
|
12017
11723
|
} from "@procore/core-react";
|
|
12018
|
-
import
|
|
11724
|
+
import React19, { useState as useState4 } from "react";
|
|
12019
11725
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
12020
|
-
import { useToastAlertContext as useToastAlertContext3, ToastAlertProvider } from "@procore/toast-alert";
|
|
12021
11726
|
|
|
12022
|
-
// src/components/
|
|
11727
|
+
// src/SavedViews/components/SavedViewsModals/SavedViewsDeleteConfirmationModalShared.tsx
|
|
12023
11728
|
import {
|
|
12024
11729
|
Button as Button3,
|
|
12025
11730
|
ConfirmModal,
|
|
@@ -12027,14 +11732,14 @@ import {
|
|
|
12027
11732
|
P as P2,
|
|
12028
11733
|
useI18nContext as useI18nContext6
|
|
12029
11734
|
} from "@procore/core-react";
|
|
12030
|
-
import
|
|
11735
|
+
import React16 from "react";
|
|
12031
11736
|
var SavedViewsDeleteConfirmationModalShared = ({
|
|
12032
11737
|
onCancel,
|
|
12033
11738
|
onDelete,
|
|
12034
11739
|
open
|
|
12035
11740
|
}) => {
|
|
12036
11741
|
const i18n = useI18nContext6();
|
|
12037
|
-
return /* @__PURE__ */
|
|
11742
|
+
return /* @__PURE__ */ React16.createElement(
|
|
12038
11743
|
ConfirmModal,
|
|
12039
11744
|
{
|
|
12040
11745
|
"data-testid": "delete-confirmation-modal",
|
|
@@ -12044,15 +11749,15 @@ var SavedViewsDeleteConfirmationModalShared = ({
|
|
|
12044
11749
|
onClose: onCancel,
|
|
12045
11750
|
style: { overflowWrap: "anywhere" }
|
|
12046
11751
|
},
|
|
12047
|
-
/* @__PURE__ */
|
|
12048
|
-
/* @__PURE__ */
|
|
11752
|
+
/* @__PURE__ */ React16.createElement(Modal.Body, null, /* @__PURE__ */ React16.createElement(P2, null, i18n.t("savedViews.modal.delete.description"))),
|
|
11753
|
+
/* @__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"))))
|
|
12049
11754
|
);
|
|
12050
11755
|
};
|
|
12051
11756
|
|
|
12052
|
-
// src/components/
|
|
12053
|
-
import
|
|
11757
|
+
// src/SavedViews/components/SavedViewsModals/SavedViewsFormModal.tsx
|
|
11758
|
+
import React18 from "react";
|
|
12054
11759
|
|
|
12055
|
-
// src/components/
|
|
11760
|
+
// src/SavedViews/components/SavedViewsModals/SavedViewsCreateUpdateModalBase.tsx
|
|
12056
11761
|
import {
|
|
12057
11762
|
Banner,
|
|
12058
11763
|
Button as Button4,
|
|
@@ -12066,7 +11771,7 @@ import {
|
|
|
12066
11771
|
Typography as Typography2,
|
|
12067
11772
|
useI18nContext as useI18nContext7
|
|
12068
11773
|
} from "@procore/core-react";
|
|
12069
|
-
import * as
|
|
11774
|
+
import * as React17 from "react";
|
|
12070
11775
|
|
|
12071
11776
|
// ../../node_modules/yup/index.esm.js
|
|
12072
11777
|
var import_property_expr = __toESM(require_property_expr());
|
|
@@ -14360,7 +14065,7 @@ var TupleSchema = class extends Schema {
|
|
|
14360
14065
|
};
|
|
14361
14066
|
create$1.prototype = TupleSchema.prototype;
|
|
14362
14067
|
|
|
14363
|
-
// src/components/
|
|
14068
|
+
// src/SavedViews/components/SavedViewsModals/CreateUpdateModalBaseUtils.ts
|
|
14364
14069
|
var getViewLevelOptions = (permissions, i18n) => {
|
|
14365
14070
|
const options = ["personal"];
|
|
14366
14071
|
if (permissions == null ? void 0 : permissions.can_create_project_saved_views)
|
|
@@ -14393,11 +14098,12 @@ function extractMessage(error, I18n) {
|
|
|
14393
14098
|
return { form: I18n.t("savedViews.modal.errors.unknown") };
|
|
14394
14099
|
}
|
|
14395
14100
|
|
|
14396
|
-
// src/components/
|
|
14101
|
+
// src/SavedViews/components/SavedViewsModals/SavedViewsCreateUpdateModalBase.tsx
|
|
14102
|
+
var { useEffect: useEffect3, useRef: useRef2 } = React17;
|
|
14397
14103
|
var ScrollContainer = styled_components_esm_default("div")`
|
|
14398
14104
|
overflow: auto;
|
|
14399
14105
|
`;
|
|
14400
|
-
var
|
|
14106
|
+
var SavedViewsCreateUpdateModalBase = ({
|
|
14401
14107
|
open,
|
|
14402
14108
|
mode,
|
|
14403
14109
|
onCancel,
|
|
@@ -14409,23 +14115,40 @@ var FormModalBase = ({
|
|
|
14409
14115
|
tableName,
|
|
14410
14116
|
defaultView,
|
|
14411
14117
|
selectedSavedView,
|
|
14118
|
+
setSelectedSavedView,
|
|
14412
14119
|
setOpenEditCreateModal,
|
|
14413
|
-
onSelect
|
|
14120
|
+
onSelect,
|
|
14121
|
+
backend
|
|
14414
14122
|
}) => {
|
|
14415
14123
|
const I18n = useI18nContext7();
|
|
14416
14124
|
const NAME_MAX_LENGTH = 150;
|
|
14125
|
+
const originalBodyWidth = useRef2("");
|
|
14126
|
+
useEffect3(() => {
|
|
14127
|
+
if (open) {
|
|
14128
|
+
originalBodyWidth.current = document.body.style.width || "";
|
|
14129
|
+
document.body.style.width = "100%";
|
|
14130
|
+
} else {
|
|
14131
|
+
document.body.style.width = originalBodyWidth.current;
|
|
14132
|
+
}
|
|
14133
|
+
return () => {
|
|
14134
|
+
if (originalBodyWidth.current !== void 0) {
|
|
14135
|
+
document.body.style.width = originalBodyWidth.current;
|
|
14136
|
+
}
|
|
14137
|
+
};
|
|
14138
|
+
}, [open]);
|
|
14139
|
+
const { useCreateSavedView: useCreateSavedView2, useUpdateSavedView: useUpdateSavedView2, useSavedViewsPermissions: useSavedViewsPermissions2 } = backend;
|
|
14417
14140
|
const {
|
|
14418
14141
|
mutate: createSavedView,
|
|
14419
14142
|
isPending: isCreating,
|
|
14420
14143
|
error: createError,
|
|
14421
14144
|
reset: resetCreateMutation
|
|
14422
|
-
} =
|
|
14145
|
+
} = useCreateSavedView2(queryInput);
|
|
14423
14146
|
const {
|
|
14424
14147
|
mutate: updateSavedView,
|
|
14425
14148
|
isPending: isUpdating,
|
|
14426
14149
|
error: updateError,
|
|
14427
14150
|
reset: resetUpdateMutation
|
|
14428
|
-
} =
|
|
14151
|
+
} = useUpdateSavedView2(queryInput);
|
|
14429
14152
|
const resetMutations = () => {
|
|
14430
14153
|
resetCreateMutation();
|
|
14431
14154
|
resetUpdateMutation();
|
|
@@ -14434,7 +14157,7 @@ var FormModalBase = ({
|
|
|
14434
14157
|
resetMutations();
|
|
14435
14158
|
onCancel();
|
|
14436
14159
|
};
|
|
14437
|
-
const { data: permissions } =
|
|
14160
|
+
const { data: permissions } = useSavedViewsPermissions2(queryInput);
|
|
14438
14161
|
const isLoading = isCreating || isUpdating;
|
|
14439
14162
|
const errors = extractMessage(createError || updateError, I18n);
|
|
14440
14163
|
const handleOnSubmit = (data) => {
|
|
@@ -14446,8 +14169,8 @@ var FormModalBase = ({
|
|
|
14446
14169
|
};
|
|
14447
14170
|
updateSavedView(body, {
|
|
14448
14171
|
onSuccess: (updatedSavedView) => {
|
|
14449
|
-
onSelect(updatedSavedView);
|
|
14450
14172
|
setOpenEditCreateModal(false);
|
|
14173
|
+
setSelectedSavedView(updatedSavedView);
|
|
14451
14174
|
}
|
|
14452
14175
|
});
|
|
14453
14176
|
} else {
|
|
@@ -14466,7 +14189,7 @@ var FormModalBase = ({
|
|
|
14466
14189
|
}
|
|
14467
14190
|
};
|
|
14468
14191
|
const viewLevelOptions = getViewLevelOptions(permissions, I18n);
|
|
14469
|
-
return /* @__PURE__ */
|
|
14192
|
+
return /* @__PURE__ */ React17.createElement(
|
|
14470
14193
|
Modal2,
|
|
14471
14194
|
{
|
|
14472
14195
|
"aria-label": I18n.t("savedViews.ariaLabels.modal"),
|
|
@@ -14475,14 +14198,14 @@ var FormModalBase = ({
|
|
|
14475
14198
|
style: { width: "540px" },
|
|
14476
14199
|
"data-testid": "create-update-modal"
|
|
14477
14200
|
},
|
|
14478
|
-
/* @__PURE__ */
|
|
14201
|
+
/* @__PURE__ */ React17.createElement(ScrollContainer, null, /* @__PURE__ */ React17.createElement(
|
|
14479
14202
|
Modal2.Header,
|
|
14480
14203
|
{
|
|
14481
14204
|
onClose,
|
|
14482
14205
|
style: { borderBottom: `1px solid ${colors3.gray85}` }
|
|
14483
14206
|
},
|
|
14484
|
-
/* @__PURE__ */
|
|
14485
|
-
), /* @__PURE__ */
|
|
14207
|
+
/* @__PURE__ */ React17.createElement(H2, null, header)
|
|
14208
|
+
), /* @__PURE__ */ React17.createElement(
|
|
14486
14209
|
Form,
|
|
14487
14210
|
{
|
|
14488
14211
|
initialValues: {
|
|
@@ -14508,13 +14231,13 @@ var FormModalBase = ({
|
|
|
14508
14231
|
onReset: onCancel,
|
|
14509
14232
|
validateOnChange: true
|
|
14510
14233
|
},
|
|
14511
|
-
/* @__PURE__ */
|
|
14234
|
+
/* @__PURE__ */ React17.createElement(Form.Form, { name: header }, /* @__PURE__ */ React17.createElement(
|
|
14512
14235
|
Modal2.Body,
|
|
14513
14236
|
{
|
|
14514
14237
|
style: { paddingTop: 0, paddingBottom: 0, marginTop: spacing3.lg }
|
|
14515
14238
|
},
|
|
14516
|
-
errors && /* @__PURE__ */
|
|
14517
|
-
/* @__PURE__ */
|
|
14239
|
+
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 == null ? void 0 : errors.form) || I18n.t(`savedViews.modal.errors.description.${mode}`)))),
|
|
14240
|
+
/* @__PURE__ */ React17.createElement(Form.Row, null, /* @__PURE__ */ React17.createElement(
|
|
14518
14241
|
Form.Text,
|
|
14519
14242
|
{
|
|
14520
14243
|
name: "name",
|
|
@@ -14525,12 +14248,12 @@ var FormModalBase = ({
|
|
|
14525
14248
|
onChange: () => resetMutations()
|
|
14526
14249
|
}
|
|
14527
14250
|
)),
|
|
14528
|
-
/* @__PURE__ */
|
|
14251
|
+
/* @__PURE__ */ React17.createElement(
|
|
14529
14252
|
Form.Row,
|
|
14530
14253
|
{
|
|
14531
14254
|
style: { marginTop: (errors == null ? void 0 : errors.name) ? spacing3.xl : spacing3.none }
|
|
14532
14255
|
},
|
|
14533
|
-
/* @__PURE__ */
|
|
14256
|
+
/* @__PURE__ */ React17.createElement(
|
|
14534
14257
|
Form.TextArea,
|
|
14535
14258
|
{
|
|
14536
14259
|
name: "description",
|
|
@@ -14541,18 +14264,19 @@ var FormModalBase = ({
|
|
|
14541
14264
|
}
|
|
14542
14265
|
)
|
|
14543
14266
|
),
|
|
14544
|
-
viewLevelOptions.length > 1 && mode === "create" /* CREATE */ ? /* @__PURE__ */
|
|
14267
|
+
viewLevelOptions.length > 1 && mode === "create" /* CREATE */ ? /* @__PURE__ */ React17.createElement(Form.Row, null, /* @__PURE__ */ React17.createElement(
|
|
14545
14268
|
Form.Select,
|
|
14546
14269
|
{
|
|
14547
14270
|
name: "view_level",
|
|
14271
|
+
qa: { label: "view-level" },
|
|
14548
14272
|
options: viewLevelOptions,
|
|
14549
14273
|
label: I18n.t("savedViews.modal.fields.viewLevel"),
|
|
14550
14274
|
colWidth: 12,
|
|
14551
14275
|
onSearch: false,
|
|
14552
14276
|
onClear: false
|
|
14553
14277
|
}
|
|
14554
|
-
)) : /* @__PURE__ */
|
|
14555
|
-
), /* @__PURE__ */
|
|
14278
|
+
)) : /* @__PURE__ */ React17.createElement(React17.Fragment, null)
|
|
14279
|
+
), /* @__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(
|
|
14556
14280
|
Button4,
|
|
14557
14281
|
{
|
|
14558
14282
|
"data-testid": "create-update-modal-button",
|
|
@@ -14567,9 +14291,9 @@ var FormModalBase = ({
|
|
|
14567
14291
|
);
|
|
14568
14292
|
};
|
|
14569
14293
|
|
|
14570
|
-
// src/components/
|
|
14294
|
+
// src/SavedViews/components/SavedViewsModals/SavedViewsFormModal.tsx
|
|
14571
14295
|
import { useI18nContext as useI18nContext8 } from "@procore/core-react";
|
|
14572
|
-
var
|
|
14296
|
+
var SavedViewsFormModal = ({
|
|
14573
14297
|
open,
|
|
14574
14298
|
mode,
|
|
14575
14299
|
onCancel,
|
|
@@ -14577,13 +14301,15 @@ var FormModal = ({
|
|
|
14577
14301
|
tableName,
|
|
14578
14302
|
queryInput,
|
|
14579
14303
|
selectedSavedView,
|
|
14304
|
+
setSelectedSavedView,
|
|
14580
14305
|
setOpenEditCreateModal,
|
|
14581
14306
|
onSelect,
|
|
14582
|
-
defaultView
|
|
14307
|
+
defaultView,
|
|
14308
|
+
backend
|
|
14583
14309
|
}) => {
|
|
14584
14310
|
const i18n = useI18nContext8();
|
|
14585
|
-
return /* @__PURE__ */
|
|
14586
|
-
|
|
14311
|
+
return /* @__PURE__ */ React18.createElement(
|
|
14312
|
+
SavedViewsCreateUpdateModalBase,
|
|
14587
14313
|
{
|
|
14588
14314
|
open,
|
|
14589
14315
|
mode,
|
|
@@ -14595,333 +14321,174 @@ var FormModal = ({
|
|
|
14595
14321
|
tableConfig,
|
|
14596
14322
|
tableName,
|
|
14597
14323
|
selectedSavedView,
|
|
14324
|
+
setSelectedSavedView,
|
|
14598
14325
|
setOpenEditCreateModal,
|
|
14599
14326
|
onSelect,
|
|
14600
|
-
defaultView
|
|
14327
|
+
defaultView,
|
|
14328
|
+
backend
|
|
14601
14329
|
}
|
|
14602
14330
|
);
|
|
14603
14331
|
};
|
|
14604
14332
|
|
|
14605
|
-
//
|
|
14606
|
-
|
|
14607
|
-
|
|
14608
|
-
|
|
14609
|
-
|
|
14610
|
-
|
|
14611
|
-
|
|
14612
|
-
|
|
14613
|
-
|
|
14614
|
-
|
|
14615
|
-
|
|
14616
|
-
|
|
14617
|
-
|
|
14618
|
-
|
|
14619
|
-
|
|
14620
|
-
|
|
14621
|
-
|
|
14622
|
-
|
|
14623
|
-
|
|
14624
|
-
|
|
14625
|
-
|
|
14626
|
-
|
|
14627
|
-
|
|
14628
|
-
|
|
14629
|
-
}
|
|
14630
|
-
|
|
14631
|
-
|
|
14632
|
-
|
|
14633
|
-
|
|
14634
|
-
|
|
14635
|
-
|
|
14636
|
-
|
|
14637
|
-
|
|
14638
|
-
|
|
14639
|
-
|
|
14640
|
-
|
|
14641
|
-
|
|
14642
|
-
|
|
14643
|
-
|
|
14644
|
-
"data-testid": "shared-view-form-modal",
|
|
14645
|
-
open,
|
|
14646
|
-
onClickOverlay: onClose,
|
|
14647
|
-
style: { width: "540px" }
|
|
14648
|
-
},
|
|
14649
|
-
/* @__PURE__ */ React21.createElement(
|
|
14650
|
-
Modal3.Header,
|
|
14651
|
-
{
|
|
14652
|
-
onClose,
|
|
14653
|
-
style: {
|
|
14654
|
-
paddingTop: spacing4.lg,
|
|
14655
|
-
paddingBottom: spacing4.xs,
|
|
14656
|
-
paddingLeft: spacing4.xl,
|
|
14657
|
-
paddingRight: spacing4.xl
|
|
14658
|
-
}
|
|
14659
|
-
},
|
|
14660
|
-
I18n.t("savedViews.modal.create.title")
|
|
14661
|
-
),
|
|
14662
|
-
/* @__PURE__ */ React21.createElement(
|
|
14663
|
-
P3,
|
|
14664
|
-
{
|
|
14665
|
-
style: {
|
|
14666
|
-
paddingLeft: spacing4.xl,
|
|
14667
|
-
paddingRight: spacing4.xl,
|
|
14668
|
-
paddingBottom: spacing4.lg,
|
|
14669
|
-
paddingTop: spacing4.none,
|
|
14670
|
-
margin: 0,
|
|
14671
|
-
color: colors4.gray45,
|
|
14672
|
-
whiteSpace: "pre-line"
|
|
14673
|
-
}
|
|
14674
|
-
},
|
|
14675
|
-
I18n.t("savedViews.modal.copyConfirmation.description")
|
|
14676
|
-
),
|
|
14677
|
-
/* @__PURE__ */ React21.createElement(
|
|
14678
|
-
Form2,
|
|
14679
|
-
{
|
|
14680
|
-
initialValues: {
|
|
14681
|
-
name: fetchedView.name,
|
|
14682
|
-
description: fetchedView.description ?? ""
|
|
14683
|
-
},
|
|
14684
|
-
view: "create",
|
|
14685
|
-
validationSchema: create$3().shape({
|
|
14686
|
-
name: create$6().trim().max(
|
|
14687
|
-
NAME_MAX_LENGTH,
|
|
14688
|
-
I18n.t("savedViews.modal.errors.maxLengthName", {
|
|
14689
|
-
maxLength: NAME_MAX_LENGTH
|
|
14690
|
-
})
|
|
14691
|
-
).required(I18n.t("savedViews.modal.errors.required"))
|
|
14692
|
-
}),
|
|
14693
|
-
onSubmit: handleOnSubmit,
|
|
14694
|
-
validateOnChange: true
|
|
14695
|
-
},
|
|
14696
|
-
/* @__PURE__ */ React21.createElement(Form2.Form, { name: "share-view-form" }, /* @__PURE__ */ React21.createElement(
|
|
14697
|
-
Modal3.Body,
|
|
14698
|
-
{
|
|
14699
|
-
style: {
|
|
14700
|
-
paddingTop: spacing4.lg,
|
|
14701
|
-
paddingBottom: 0,
|
|
14702
|
-
borderTop: `1px solid ${colors4.gray85}`
|
|
14703
|
-
}
|
|
14704
|
-
},
|
|
14705
|
-
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", {
|
|
14706
|
-
mode: "create"
|
|
14707
|
-
})), /* @__PURE__ */ React21.createElement(Banner2.Body, null, (errors == null ? void 0 : errors.form) || I18n.t("savedViews.modal.errors.description.create")))),
|
|
14708
|
-
/* @__PURE__ */ React21.createElement(Form2.Row, null, /* @__PURE__ */ React21.createElement(
|
|
14709
|
-
Form2.Text,
|
|
14710
|
-
{
|
|
14711
|
-
name: "name",
|
|
14712
|
-
error: errors == null ? void 0 : errors.name,
|
|
14713
|
-
placeholder: I18n.t("savedViews.modal.fields.name"),
|
|
14714
|
-
label: I18n.t("savedViews.modal.fields.name"),
|
|
14715
|
-
colWidth: 12,
|
|
14716
|
-
onChange: handleNameChange
|
|
14717
|
-
}
|
|
14718
|
-
)),
|
|
14719
|
-
/* @__PURE__ */ React21.createElement(
|
|
14720
|
-
Form2.Row,
|
|
14721
|
-
{
|
|
14722
|
-
style: { marginTop: (errors == null ? void 0 : errors.name) ? spacing4.xl : spacing4.none }
|
|
14723
|
-
},
|
|
14724
|
-
/* @__PURE__ */ React21.createElement(
|
|
14725
|
-
Form2.TextArea,
|
|
14726
|
-
{
|
|
14727
|
-
name: "description",
|
|
14728
|
-
placeholder: I18n.t("savedViews.modal.fields.description"),
|
|
14729
|
-
label: I18n.t("savedViews.modal.fields.description"),
|
|
14730
|
-
colWidth: 12,
|
|
14731
|
-
resize: "vertical"
|
|
14732
|
-
}
|
|
14733
|
-
)
|
|
14734
|
-
)
|
|
14735
|
-
), /* @__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(
|
|
14736
|
-
Button5,
|
|
14737
|
-
{
|
|
14738
|
-
variant: "secondary",
|
|
14739
|
-
onClick: onCreateTemporaryView,
|
|
14740
|
-
"data-testid": "view-temporarily-button",
|
|
14741
|
-
disabled: isCreating
|
|
14742
|
-
},
|
|
14743
|
-
I18n.t("savedViews.actions.viewTemporarily")
|
|
14744
|
-
), /* @__PURE__ */ React21.createElement(
|
|
14745
|
-
Button5,
|
|
14746
|
-
{
|
|
14747
|
-
type: "submit",
|
|
14748
|
-
variant: "primary",
|
|
14749
|
-
"data-testid": "create-view-button",
|
|
14750
|
-
disabled: isCreating,
|
|
14751
|
-
loading: isCreating
|
|
14752
|
-
},
|
|
14753
|
-
I18n.t("savedViews.actions.create")
|
|
14754
|
-
)))))
|
|
14755
|
-
)
|
|
14333
|
+
// ../../node_modules/@procore/core-http/dist/modern/index.js
|
|
14334
|
+
function getCSRFToken() {
|
|
14335
|
+
const token = document.cookie.match("(^|;)\\s*csrf_token\\s*=\\s*([^;]+)");
|
|
14336
|
+
return token ? decodeURIComponent(token.pop() || "") : "";
|
|
14337
|
+
}
|
|
14338
|
+
function getCSRFHeader() {
|
|
14339
|
+
const csrfToken = getCSRFToken();
|
|
14340
|
+
return csrfToken ? { "X-CSRF-TOKEN": csrfToken } : {};
|
|
14341
|
+
}
|
|
14342
|
+
function removeLeadingSlash(url) {
|
|
14343
|
+
return url.startsWith("/") ? url.substring(1, url.length) : url;
|
|
14344
|
+
}
|
|
14345
|
+
function removeTrailingSlash(url) {
|
|
14346
|
+
return url.endsWith("/") ? url.substring(0, url.length - 1) : url;
|
|
14347
|
+
}
|
|
14348
|
+
function applyBaseUrl(url, baseUrl) {
|
|
14349
|
+
return `${removeTrailingSlash(baseUrl)}/${removeLeadingSlash(url)}`;
|
|
14350
|
+
}
|
|
14351
|
+
function getOptions({ headers, ...options }) {
|
|
14352
|
+
const opts = {
|
|
14353
|
+
credentials: "same-origin",
|
|
14354
|
+
headers: {
|
|
14355
|
+
...getCSRFHeader(),
|
|
14356
|
+
...headers
|
|
14357
|
+
},
|
|
14358
|
+
mode: "same-origin",
|
|
14359
|
+
...options
|
|
14360
|
+
};
|
|
14361
|
+
return opts;
|
|
14362
|
+
}
|
|
14363
|
+
function getUrl(url, baseUrl) {
|
|
14364
|
+
return baseUrl ? applyBaseUrl(url, baseUrl) : url;
|
|
14365
|
+
}
|
|
14366
|
+
function request(url, { baseUrl, ...options } = {}) {
|
|
14367
|
+
return fetch(getUrl(url, baseUrl), getOptions(options));
|
|
14368
|
+
}
|
|
14369
|
+
function requestJSON(url, requestParams = {}) {
|
|
14370
|
+
return request(url, requestParams).then(
|
|
14371
|
+
(response) => response.json()
|
|
14756
14372
|
);
|
|
14757
|
-
}
|
|
14758
|
-
|
|
14759
|
-
// src/utils/hooks/useViewSelection.ts
|
|
14760
|
-
import { useState as useState3, useCallback as useCallback2, useEffect as useEffect2, useRef as useRef2, useMemo } from "react";
|
|
14761
|
-
import { useSearchParams } from "react-router-dom";
|
|
14762
|
-
import { useI18nContext as useI18nContext10 } from "@procore/core-react";
|
|
14373
|
+
}
|
|
14763
14374
|
|
|
14764
|
-
// src/utils/
|
|
14765
|
-
|
|
14766
|
-
save(key, view) {
|
|
14767
|
-
localStorage.setItem(key, JSON.stringify(view));
|
|
14768
|
-
},
|
|
14769
|
-
load(key, defaultView) {
|
|
14770
|
-
try {
|
|
14771
|
-
const stored = localStorage.getItem(key);
|
|
14772
|
-
if (!stored)
|
|
14773
|
-
return defaultView;
|
|
14774
|
-
const parsed = JSON.parse(stored);
|
|
14775
|
-
if (!parsed)
|
|
14776
|
-
return defaultView;
|
|
14777
|
-
const isTableConfigOnly = !parsed.id && !parsed.share_token;
|
|
14778
|
-
return isTableConfigOnly ? { ...defaultView, table_config: parsed } : parsed;
|
|
14779
|
-
} catch {
|
|
14780
|
-
return defaultView;
|
|
14781
|
-
}
|
|
14782
|
-
},
|
|
14783
|
-
remove(key) {
|
|
14784
|
-
localStorage.removeItem(key);
|
|
14785
|
-
}
|
|
14786
|
-
};
|
|
14375
|
+
// src/utils/Api/queries.ts
|
|
14376
|
+
import { useQuery } from "@tanstack/react-query";
|
|
14787
14377
|
|
|
14788
|
-
// src/utils/
|
|
14789
|
-
|
|
14790
|
-
|
|
14791
|
-
|
|
14792
|
-
|
|
14793
|
-
|
|
14794
|
-
|
|
14795
|
-
|
|
14796
|
-
|
|
14797
|
-
|
|
14798
|
-
|
|
14799
|
-
|
|
14800
|
-
|
|
14801
|
-
|
|
14802
|
-
}
|
|
14803
|
-
|
|
14804
|
-
|
|
14805
|
-
|
|
14806
|
-
|
|
14807
|
-
|
|
14808
|
-
|
|
14809
|
-
|
|
14810
|
-
|
|
14811
|
-
};
|
|
14812
|
-
|
|
14813
|
-
|
|
14814
|
-
|
|
14815
|
-
|
|
14816
|
-
const updatedParams = new URLSearchParams(currentParams);
|
|
14817
|
-
updatedParams.set("saved-view", previousParam);
|
|
14818
|
-
return updatedParams;
|
|
14819
|
-
},
|
|
14820
|
-
{ replace: true }
|
|
14821
|
-
);
|
|
14822
|
-
}
|
|
14823
|
-
};
|
|
14824
|
-
var useViewSelection = (config, savedViews, presetViews, openSharedViewModal) => {
|
|
14825
|
-
const I18n = useI18nContext10();
|
|
14826
|
-
const storageKey = `savedView_${config.domain}_${config.tableName}_${config.companyId}_${config.projectId}_${config.userId}`;
|
|
14827
|
-
const temporaryStorageKey = `${storageKey}-temporary`;
|
|
14828
|
-
const [searchParams, setSearchParams] = useSearchParams();
|
|
14829
|
-
const previousSavedViewParamRef = useRef2(null);
|
|
14830
|
-
const [selectedSavedView, setSelectedSavedView] = useState3(() => {
|
|
14831
|
-
const stored = ViewStorage.load(storageKey, config.defaultView);
|
|
14832
|
-
return stored ?? config.defaultView;
|
|
14833
|
-
});
|
|
14834
|
-
const [temporaryView, setTemporaryView] = useState3(() => {
|
|
14835
|
-
const loaded = ViewStorage.load(temporaryStorageKey, config.defaultView);
|
|
14836
|
-
return loaded && (loaded.id === "temporary" || loaded.view_level === "temporary") ? loaded : null;
|
|
14837
|
-
});
|
|
14838
|
-
const persistViewToStorageAndUrl = useCallback2(
|
|
14839
|
-
(view) => {
|
|
14840
|
-
ViewStorage.save(storageKey, view);
|
|
14841
|
-
setViewInUrl(view, setSearchParams);
|
|
14842
|
-
},
|
|
14843
|
-
[storageKey, setSearchParams]
|
|
14844
|
-
);
|
|
14845
|
-
const baseViews = useMemo(
|
|
14846
|
-
() => [...savedViews ?? [], ...presetViews ?? []],
|
|
14847
|
-
[savedViews, presetViews]
|
|
14848
|
-
);
|
|
14849
|
-
const allViews = useMemo(
|
|
14850
|
-
() => temporaryView ? [...baseViews, temporaryView] : baseViews,
|
|
14851
|
-
[baseViews, temporaryView]
|
|
14852
|
-
);
|
|
14853
|
-
const selectView = useCallback2(
|
|
14854
|
-
(view) => {
|
|
14855
|
-
const viewToSelect = config.onSelect({ item: view });
|
|
14856
|
-
setSelectedSavedView(viewToSelect);
|
|
14857
|
-
persistViewToStorageAndUrl(viewToSelect);
|
|
14858
|
-
return viewToSelect;
|
|
14859
|
-
},
|
|
14860
|
-
[config, persistViewToStorageAndUrl]
|
|
14861
|
-
);
|
|
14862
|
-
const createTemporaryView = useCallback2(
|
|
14863
|
-
(fetchedView) => {
|
|
14864
|
-
const tempView = {
|
|
14865
|
-
...fetchedView,
|
|
14866
|
-
id: "temporary",
|
|
14867
|
-
name: I18n.t("savedViews.temporaryViewName"),
|
|
14868
|
-
view_level: "temporary"
|
|
14869
|
-
};
|
|
14870
|
-
ViewStorage.save(temporaryStorageKey, tempView);
|
|
14871
|
-
setTemporaryView(tempView);
|
|
14872
|
-
selectView(tempView);
|
|
14873
|
-
return tempView;
|
|
14378
|
+
// src/utils/Api/queriesHandler.ts
|
|
14379
|
+
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
14380
|
+
import { useI18nContext as useI18nContext9 } from "@procore/core-react";
|
|
14381
|
+
var useApiRequest = (props, method, mutationKey) => {
|
|
14382
|
+
const { projectId, companyId, domain, tableName } = props;
|
|
14383
|
+
const queryClient2 = useQueryClient();
|
|
14384
|
+
const { locale: locale2 } = useI18nContext9();
|
|
14385
|
+
return useMutation({
|
|
14386
|
+
mutationKey,
|
|
14387
|
+
mutationFn: async (savedView) => {
|
|
14388
|
+
let url = "";
|
|
14389
|
+
if (method === "DELETE" || method === "PUT") {
|
|
14390
|
+
url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views/${savedView.id}?permissions_domain=${domain}`;
|
|
14391
|
+
} else {
|
|
14392
|
+
url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views?table_name=${tableName}&permissions_domain=${domain}`;
|
|
14393
|
+
}
|
|
14394
|
+
const response = await requestJSON(url, {
|
|
14395
|
+
method,
|
|
14396
|
+
body: JSON.stringify(savedView),
|
|
14397
|
+
headers: {
|
|
14398
|
+
"Content-Type": "application/json",
|
|
14399
|
+
"Accept-Language": locale2
|
|
14400
|
+
}
|
|
14401
|
+
});
|
|
14402
|
+
if (response.error) {
|
|
14403
|
+
throw response.error;
|
|
14404
|
+
}
|
|
14405
|
+
return response.data;
|
|
14874
14406
|
},
|
|
14875
|
-
|
|
14876
|
-
|
|
14877
|
-
|
|
14878
|
-
|
|
14879
|
-
|
|
14880
|
-
selectView(config.defaultView);
|
|
14881
|
-
}, [temporaryStorageKey, config.defaultView, selectView]);
|
|
14882
|
-
const isViewAlreadySelected = useCallback2(
|
|
14883
|
-
(viewId) => checkIsViewSelected(selectedSavedView, viewId),
|
|
14884
|
-
[selectedSavedView]
|
|
14885
|
-
);
|
|
14886
|
-
const handleSavedViewFromUrl = useCallback2(
|
|
14887
|
-
(viewId) => {
|
|
14888
|
-
if (isViewAlreadySelected(viewId)) {
|
|
14407
|
+
onSuccess: (savedView) => {
|
|
14408
|
+
if (method === "DELETE" || method === "POST") {
|
|
14409
|
+
queryClient2.invalidateQueries({
|
|
14410
|
+
queryKey: ["savedViews", domain, tableName]
|
|
14411
|
+
});
|
|
14889
14412
|
return;
|
|
14890
|
-
}
|
|
14891
|
-
const viewInList = findViewByToken(allViews, viewId);
|
|
14892
|
-
if (viewInList) {
|
|
14893
|
-
selectView(viewInList);
|
|
14894
14413
|
} else {
|
|
14895
|
-
|
|
14414
|
+
const oldData = queryClient2.getQueryData([
|
|
14415
|
+
"savedViews",
|
|
14416
|
+
domain,
|
|
14417
|
+
tableName
|
|
14418
|
+
]);
|
|
14419
|
+
const oldView = oldData == null ? void 0 : oldData.find((item) => item.id === savedView.id);
|
|
14420
|
+
if ((oldView == null ? void 0 : oldView.name) !== savedView.name) {
|
|
14421
|
+
queryClient2.invalidateQueries({
|
|
14422
|
+
queryKey: ["savedViews", domain, tableName]
|
|
14423
|
+
});
|
|
14424
|
+
return;
|
|
14425
|
+
}
|
|
14896
14426
|
}
|
|
14897
|
-
|
|
14898
|
-
|
|
14899
|
-
|
|
14900
|
-
|
|
14901
|
-
|
|
14902
|
-
|
|
14903
|
-
|
|
14904
|
-
|
|
14905
|
-
|
|
14906
|
-
|
|
14907
|
-
|
|
14908
|
-
|
|
14427
|
+
queryClient2.setQueryData(
|
|
14428
|
+
["savedViews", domain, tableName],
|
|
14429
|
+
(oldData) => {
|
|
14430
|
+
if (!oldData)
|
|
14431
|
+
return [savedView];
|
|
14432
|
+
return oldData.map(
|
|
14433
|
+
(item) => item.id === savedView.id ? savedView : item
|
|
14434
|
+
);
|
|
14435
|
+
}
|
|
14436
|
+
);
|
|
14437
|
+
}
|
|
14438
|
+
});
|
|
14439
|
+
};
|
|
14440
|
+
|
|
14441
|
+
// src/utils/Api/queries.ts
|
|
14442
|
+
var PAGE_SIZE = 50 * VIEW_LEVELS.length;
|
|
14443
|
+
var useSavedViewsQuery = (props) => {
|
|
14444
|
+
const { projectId, companyId, domain, tableName } = props;
|
|
14445
|
+
const url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views?table_name=${tableName}&permissions_domain=${domain}`;
|
|
14446
|
+
return useQuery({
|
|
14447
|
+
enabled: props.enableSavedViews,
|
|
14448
|
+
queryKey: ["savedViews", domain, tableName],
|
|
14449
|
+
queryFn: async () => {
|
|
14450
|
+
const getUrl2 = `${url}&per_page=${PAGE_SIZE}`;
|
|
14451
|
+
const response = await requestJSON(getUrl2);
|
|
14452
|
+
return response.data;
|
|
14909
14453
|
}
|
|
14910
|
-
|
|
14911
|
-
|
|
14454
|
+
});
|
|
14455
|
+
};
|
|
14456
|
+
var useSavedViewsPermissions = (props) => {
|
|
14457
|
+
const { projectId, companyId, domain } = props;
|
|
14458
|
+
const url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views/permissions?permissions_domain=${domain}`;
|
|
14459
|
+
return useQuery({
|
|
14460
|
+
enabled: props.enableSavedViews,
|
|
14461
|
+
queryKey: ["savedViewsConfig", domain],
|
|
14462
|
+
queryFn: async () => {
|
|
14463
|
+
const response = await requestJSON(url);
|
|
14464
|
+
return response.data;
|
|
14912
14465
|
}
|
|
14913
|
-
}
|
|
14914
|
-
return {
|
|
14915
|
-
selectedView: selectedSavedView,
|
|
14916
|
-
selectView,
|
|
14917
|
-
temporaryView,
|
|
14918
|
-
createTemporaryView,
|
|
14919
|
-
clearTemporaryView,
|
|
14920
|
-
allViews
|
|
14921
|
-
};
|
|
14466
|
+
});
|
|
14922
14467
|
};
|
|
14468
|
+
var useCreateSavedView = (props) => useApiRequest(props, "POST", [
|
|
14469
|
+
"createSavedView",
|
|
14470
|
+
props.domain,
|
|
14471
|
+
props.tableName
|
|
14472
|
+
]);
|
|
14473
|
+
var useUpdateSavedView = (props) => useApiRequest(props, "PUT", [
|
|
14474
|
+
"updateSavedView",
|
|
14475
|
+
props.domain,
|
|
14476
|
+
props.tableName
|
|
14477
|
+
]);
|
|
14478
|
+
var useDeleteSavedView = (props) => useApiRequest(props, "DELETE", [
|
|
14479
|
+
"deleteSavedView",
|
|
14480
|
+
props.domain,
|
|
14481
|
+
props.tableName
|
|
14482
|
+
]);
|
|
14483
|
+
var createQueries = (customBackend) => ({
|
|
14484
|
+
useSavedViewsQuery: (customBackend == null ? void 0 : customBackend.useSavedViewsQuery) ?? useSavedViewsQuery,
|
|
14485
|
+
useSavedViewsPermissions: (customBackend == null ? void 0 : customBackend.useSavedViewsPermissions) ?? useSavedViewsPermissions,
|
|
14486
|
+
useCreateSavedView: (customBackend == null ? void 0 : customBackend.useCreateSavedView) ?? useCreateSavedView,
|
|
14487
|
+
useUpdateSavedView: (customBackend == null ? void 0 : customBackend.useUpdateSavedView) ?? useUpdateSavedView,
|
|
14488
|
+
useDeleteSavedView: (customBackend == null ? void 0 : customBackend.useDeleteSavedView) ?? useDeleteSavedView
|
|
14489
|
+
});
|
|
14923
14490
|
|
|
14924
|
-
// src/components/
|
|
14491
|
+
// src/SavedViews/components/SavedViews/SavedViews.tsx
|
|
14925
14492
|
var StyledPanel = styled_components_esm_default.div`
|
|
14926
14493
|
border: ${({ provider }) => provider === "data-table" ? "1px solid #d6dadc" : "none"};
|
|
14927
14494
|
`;
|
|
@@ -14931,122 +14498,79 @@ var SavedViewsContent = (props) => {
|
|
|
14931
14498
|
const queryInput = {
|
|
14932
14499
|
domain: props.domain,
|
|
14933
14500
|
tableName: props.tableName,
|
|
14501
|
+
enableSavedViews: props.enableSavedViews,
|
|
14934
14502
|
projectId,
|
|
14935
14503
|
companyId
|
|
14936
14504
|
};
|
|
14937
|
-
const
|
|
14938
|
-
const { mutate: deleteSavedView } = useDeleteSavedView(queryInput);
|
|
14939
|
-
const
|
|
14940
|
-
|
|
14941
|
-
|
|
14942
|
-
|
|
14943
|
-
|
|
14944
|
-
|
|
14945
|
-
|
|
14946
|
-
|
|
14947
|
-
|
|
14948
|
-
|
|
14949
|
-
setModalData(null);
|
|
14950
|
-
}, []);
|
|
14951
|
-
const isModalOpen = (type) => activeModal === type;
|
|
14952
|
-
const openSharedViewModal = (viewId) => {
|
|
14953
|
-
openModal("sharedView" /* SHARED_VIEW */, { viewId });
|
|
14954
|
-
};
|
|
14955
|
-
const {
|
|
14956
|
-
selectedView,
|
|
14957
|
-
selectView,
|
|
14958
|
-
createTemporaryView,
|
|
14959
|
-
clearTemporaryView,
|
|
14960
|
-
allViews
|
|
14961
|
-
} = useViewSelection(
|
|
14962
|
-
{
|
|
14963
|
-
domain: props.domain,
|
|
14964
|
-
tableName: props.tableName,
|
|
14965
|
-
userId: props.userId,
|
|
14966
|
-
projectId,
|
|
14967
|
-
companyId,
|
|
14968
|
-
defaultView: props.defaultView,
|
|
14969
|
-
onSelect: props.onSelect
|
|
14970
|
-
},
|
|
14971
|
-
savedViews,
|
|
14972
|
-
props.presetViews,
|
|
14973
|
-
openSharedViewModal
|
|
14974
|
-
);
|
|
14975
|
-
const { data: fetchedView, isError: fetchError } = useFetchSavedViewById(
|
|
14976
|
-
(modalData == null ? void 0 : modalData.viewId) ?? null,
|
|
14977
|
-
queryInput,
|
|
14978
|
-
Boolean(modalData == null ? void 0 : modalData.viewId)
|
|
14979
|
-
);
|
|
14980
|
-
const {
|
|
14981
|
-
mutate: createSavedView,
|
|
14982
|
-
isPending: isCreating,
|
|
14983
|
-
error: createError,
|
|
14984
|
-
reset: resetCreateError
|
|
14985
|
-
} = useCreateSavedView(queryInput);
|
|
14986
|
-
useEffect3(() => {
|
|
14987
|
-
if (fetchError) {
|
|
14988
|
-
showToast.error(i18n.t("savedViews.errors.notFound"));
|
|
14989
|
-
selectView(selectedView ?? props.defaultView);
|
|
14990
|
-
closeModal();
|
|
14505
|
+
const backend = createQueries(props.backend);
|
|
14506
|
+
const { mutate: deleteSavedView } = backend.useDeleteSavedView(queryInput);
|
|
14507
|
+
const [selectedSavedView, setSelectedSavedView] = useState4(() => {
|
|
14508
|
+
try {
|
|
14509
|
+
const savedView = JSON.parse(
|
|
14510
|
+
localStorage.getItem(
|
|
14511
|
+
`${props.domain}_${props.tableName}_${props.stickyViewsKey}_${projectId}_${props.userId}`
|
|
14512
|
+
)
|
|
14513
|
+
);
|
|
14514
|
+
return savedView || props.defaultView;
|
|
14515
|
+
} catch (e2) {
|
|
14516
|
+
return props.defaultView;
|
|
14991
14517
|
}
|
|
14992
|
-
}
|
|
14993
|
-
const
|
|
14994
|
-
if (
|
|
14995
|
-
|
|
14996
|
-
|
|
14518
|
+
});
|
|
14519
|
+
const updateLocalStorage = (view) => {
|
|
14520
|
+
if (props.stickyViewsKey) {
|
|
14521
|
+
localStorage.setItem(
|
|
14522
|
+
`${props.domain}_${props.tableName}_${props.stickyViewsKey}_${projectId}_${props.userId}`,
|
|
14523
|
+
JSON.stringify(view)
|
|
14524
|
+
);
|
|
14997
14525
|
}
|
|
14998
14526
|
};
|
|
14999
|
-
const
|
|
15000
|
-
|
|
15001
|
-
|
|
15002
|
-
|
|
15003
|
-
|
|
15004
|
-
|
|
15005
|
-
|
|
15006
|
-
|
|
15007
|
-
|
|
15008
|
-
share_token: ""
|
|
15009
|
-
};
|
|
15010
|
-
createSavedView(viewToCreate, {
|
|
15011
|
-
onSuccess: (newView) => {
|
|
15012
|
-
showToast.success(i18n.t("savedViews.create.success"));
|
|
15013
|
-
selectView(newView);
|
|
15014
|
-
closeModal();
|
|
15015
|
-
}
|
|
14527
|
+
const handleViewItemSelect = ({ item }) => {
|
|
14528
|
+
const viewToSetAsSelected = props.onSelect({ item });
|
|
14529
|
+
setSelectedSavedView(viewToSetAsSelected);
|
|
14530
|
+
updateLocalStorage(viewToSetAsSelected);
|
|
14531
|
+
};
|
|
14532
|
+
const onDelete = () => {
|
|
14533
|
+
if (selectedSavedView) {
|
|
14534
|
+
deleteSavedView(selectedSavedView, {
|
|
14535
|
+
onSuccess: () => handleViewItemSelect({ item: props.defaultView })
|
|
15016
14536
|
});
|
|
15017
14537
|
}
|
|
15018
14538
|
};
|
|
15019
|
-
const
|
|
15020
|
-
|
|
15021
|
-
|
|
14539
|
+
const i18n = useI18nContext10();
|
|
14540
|
+
const [openDeleteModal, setOpenDeleteModal] = useState4(false);
|
|
14541
|
+
const [openEditCreateModal, setOpenEditCreateModal] = useState4(false);
|
|
14542
|
+
const [editCreateModalType, setEditCreateModalType] = useState4(
|
|
14543
|
+
"create" /* CREATE */
|
|
14544
|
+
);
|
|
14545
|
+
const onCloseDeleteModal = () => {
|
|
14546
|
+
setOpenDeleteModal(false);
|
|
15022
14547
|
};
|
|
15023
|
-
const
|
|
15024
|
-
|
|
15025
|
-
|
|
15026
|
-
|
|
15027
|
-
|
|
15028
|
-
|
|
14548
|
+
const onCloseEditModal = () => {
|
|
14549
|
+
setOpenEditCreateModal(false);
|
|
14550
|
+
};
|
|
14551
|
+
const openModal = (type) => {
|
|
14552
|
+
setEditCreateModalType(type);
|
|
14553
|
+
setOpenEditCreateModal(true);
|
|
15029
14554
|
};
|
|
15030
|
-
const
|
|
15031
|
-
|
|
15032
|
-
closeModal();
|
|
14555
|
+
const onOpenDeleteModal = () => {
|
|
14556
|
+
setOpenDeleteModal(true);
|
|
15033
14557
|
};
|
|
15034
|
-
return /* @__PURE__ */
|
|
14558
|
+
return /* @__PURE__ */ React19.createElement(StyledPanel, { provider: props.provider }, /* @__PURE__ */ React19.createElement(
|
|
15035
14559
|
ExpandedPanel,
|
|
15036
14560
|
{
|
|
15037
14561
|
"data-testid": "saved-view-expanded-panel",
|
|
15038
14562
|
provider: props.provider
|
|
15039
14563
|
},
|
|
15040
|
-
/* @__PURE__ */
|
|
14564
|
+
/* @__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(
|
|
15041
14565
|
Tooltip,
|
|
15042
14566
|
{
|
|
15043
14567
|
overlay: i18n.t("savedViews.actions.create"),
|
|
15044
14568
|
showDelay: 1e3
|
|
15045
14569
|
},
|
|
15046
|
-
/* @__PURE__ */
|
|
15047
|
-
|
|
14570
|
+
/* @__PURE__ */ React19.createElement("span", null, /* @__PURE__ */ React19.createElement(
|
|
14571
|
+
Button5,
|
|
15048
14572
|
{
|
|
15049
|
-
icon: /* @__PURE__ */
|
|
14573
|
+
icon: /* @__PURE__ */ React19.createElement(Plus_default, null),
|
|
15050
14574
|
variant: "secondary",
|
|
15051
14575
|
"data-testid": "expanded-panel-create-button",
|
|
15052
14576
|
onClick: () => openModal("create" /* CREATE */),
|
|
@@ -15055,221 +14579,121 @@ var SavedViewsContent = (props) => {
|
|
|
15055
14579
|
i18n.t("savedViews.actions.create")
|
|
15056
14580
|
))
|
|
15057
14581
|
)),
|
|
15058
|
-
/* @__PURE__ */
|
|
14582
|
+
/* @__PURE__ */ React19.createElement(Panel3.Body, { style: { display: "flex", flexFlow: "column" } }, /* @__PURE__ */ React19.createElement(
|
|
15059
14583
|
PanelContent,
|
|
15060
14584
|
{
|
|
15061
|
-
onSelect:
|
|
14585
|
+
onSelect: handleViewItemSelect,
|
|
15062
14586
|
openModal,
|
|
15063
|
-
onDelete:
|
|
14587
|
+
onDelete: onOpenDeleteModal,
|
|
14588
|
+
updateLocalStorage,
|
|
14589
|
+
setSelectedSavedView,
|
|
15064
14590
|
queryInput,
|
|
15065
|
-
selectedSavedView
|
|
14591
|
+
selectedSavedView,
|
|
15066
14592
|
tableConfig: props.tableConfig,
|
|
15067
14593
|
defaultView: props.defaultView,
|
|
15068
|
-
|
|
15069
|
-
savedViews: allViews,
|
|
14594
|
+
stickyViewsKey: props.stickyViewsKey,
|
|
15070
14595
|
provider: props.provider,
|
|
15071
14596
|
userId: props.userId,
|
|
15072
|
-
|
|
14597
|
+
backend
|
|
15073
14598
|
}
|
|
15074
14599
|
))
|
|
15075
|
-
),
|
|
15076
|
-
|
|
14600
|
+
), /* @__PURE__ */ React19.createElement(
|
|
14601
|
+
SavedViewsFormModal,
|
|
15077
14602
|
{
|
|
15078
|
-
open:
|
|
15079
|
-
mode:
|
|
15080
|
-
onCancel:
|
|
14603
|
+
open: openEditCreateModal,
|
|
14604
|
+
mode: editCreateModalType,
|
|
14605
|
+
onCancel: onCloseEditModal,
|
|
15081
14606
|
queryInput,
|
|
15082
14607
|
tableConfig: props.tableConfig,
|
|
15083
14608
|
tableName: props.tableName,
|
|
15084
|
-
selectedSavedView
|
|
15085
|
-
|
|
15086
|
-
|
|
15087
|
-
|
|
14609
|
+
selectedSavedView,
|
|
14610
|
+
setSelectedSavedView,
|
|
14611
|
+
onSelect: (view) => handleViewItemSelect({ item: view }),
|
|
14612
|
+
setOpenEditCreateModal,
|
|
14613
|
+
defaultView: props.defaultView,
|
|
14614
|
+
backend
|
|
15088
14615
|
}
|
|
15089
|
-
),
|
|
14616
|
+
), selectedSavedView && /* @__PURE__ */ React19.createElement(
|
|
15090
14617
|
SavedViewsDeleteConfirmationModalShared,
|
|
15091
14618
|
{
|
|
15092
|
-
open:
|
|
15093
|
-
onDelete:
|
|
15094
|
-
|
|
15095
|
-
|
|
15096
|
-
|
|
15097
|
-
|
|
15098
|
-
{
|
|
15099
|
-
open: true,
|
|
15100
|
-
fetchedView,
|
|
15101
|
-
onClose: selectCurrentViewAndCloseModal,
|
|
15102
|
-
onCreateTemporaryView: viewSharedViewTemporarily,
|
|
15103
|
-
onCreateView: createPersonalCopyOfSharedView,
|
|
15104
|
-
createError,
|
|
15105
|
-
isCreating,
|
|
15106
|
-
resetCreateError
|
|
14619
|
+
open: openDeleteModal,
|
|
14620
|
+
onDelete: () => {
|
|
14621
|
+
onDelete();
|
|
14622
|
+
onCloseDeleteModal();
|
|
14623
|
+
},
|
|
14624
|
+
onCancel: onCloseDeleteModal
|
|
15107
14625
|
}
|
|
15108
14626
|
));
|
|
15109
14627
|
};
|
|
15110
14628
|
var SavedViews = (props) => {
|
|
15111
|
-
return /* @__PURE__ */
|
|
14629
|
+
return /* @__PURE__ */ React19.createElement(EnvironmentI18nProvider, null, /* @__PURE__ */ React19.createElement(QueryClientProvider, { client: queryClient }, /* @__PURE__ */ React19.createElement(SavedViewsContent, { ...props })));
|
|
15112
14630
|
};
|
|
15113
14631
|
|
|
15114
|
-
// src/components/
|
|
15115
|
-
import
|
|
15116
|
-
|
|
15117
|
-
// src/components/adapters/smart-grid/SmartGridDefaultSavedView.tsx
|
|
15118
|
-
import { useMemo as useMemo2 } from "react";
|
|
15119
|
-
var DEFAULT_COLUMN_STATE = {
|
|
15120
|
-
hide: false,
|
|
15121
|
-
pinned: null,
|
|
15122
|
-
width: 200,
|
|
15123
|
-
sort: null,
|
|
15124
|
-
sortIndex: null,
|
|
15125
|
-
pivot: false,
|
|
15126
|
-
pivotIndex: null,
|
|
15127
|
-
aggFunc: null,
|
|
15128
|
-
rowGroup: false,
|
|
15129
|
-
rowGroupIndex: null,
|
|
15130
|
-
flex: null
|
|
15131
|
-
};
|
|
15132
|
-
var getColumnStateFromDefs = (columnDefs) => {
|
|
15133
|
-
return columnDefs.map((colDef) => {
|
|
15134
|
-
const field = colDef.field ?? colDef.colId;
|
|
15135
|
-
if (!field)
|
|
15136
|
-
return null;
|
|
15137
|
-
return {
|
|
15138
|
-
colId: field,
|
|
15139
|
-
hide: colDef.hide ?? false,
|
|
15140
|
-
pinned: colDef.pinned ?? null,
|
|
15141
|
-
width: colDef.width ?? colDef.minWidth ?? DEFAULT_COLUMN_STATE.width,
|
|
15142
|
-
sort: null,
|
|
15143
|
-
sortIndex: null,
|
|
15144
|
-
pivot: false,
|
|
15145
|
-
pivotIndex: null,
|
|
15146
|
-
aggFunc: null,
|
|
15147
|
-
rowGroup: false,
|
|
15148
|
-
rowGroupIndex: null,
|
|
15149
|
-
flex: colDef.flex ?? null
|
|
15150
|
-
};
|
|
15151
|
-
}).filter((col) => col !== null);
|
|
15152
|
-
};
|
|
15153
|
-
var extractDefaultView = (gridApi, receivedConfig) => {
|
|
15154
|
-
var _a, _b;
|
|
15155
|
-
const columnDefs = gridApi.getColumnDefs() ?? [];
|
|
15156
|
-
const defaultColumnState = ((_a = receivedConfig == null ? void 0 : receivedConfig.columnState) == null ? void 0 : _a.length) ? receivedConfig.columnState : getColumnStateFromDefs(columnDefs);
|
|
15157
|
-
const result = {
|
|
15158
|
-
columnState: defaultColumnState,
|
|
15159
|
-
columnGroupState: (receivedConfig == null ? void 0 : receivedConfig.columnGroupState) ?? [],
|
|
15160
|
-
rowGroupState: (receivedConfig == null ? void 0 : receivedConfig.rowGroupState) ?? [],
|
|
15161
|
-
filterState: (receivedConfig == null ? void 0 : receivedConfig.filterState) ?? {},
|
|
15162
|
-
rowHeight: (receivedConfig == null ? void 0 : receivedConfig.rowHeight) ?? ((_b = gridApi.getSizesForCurrentTheme()) == null ? void 0 : _b.rowHeight)
|
|
15163
|
-
};
|
|
15164
|
-
return result;
|
|
15165
|
-
};
|
|
15166
|
-
var useNormalizedDefaultViews = (defaultViews, gridApi) => {
|
|
15167
|
-
return useMemo2(() => {
|
|
15168
|
-
if (!gridApi)
|
|
15169
|
-
return defaultViews.map((view) => ({ ...view, share_token: view.id }));
|
|
15170
|
-
return defaultViews.map((view) => ({
|
|
15171
|
-
...view,
|
|
15172
|
-
share_token: view.id,
|
|
15173
|
-
table_config: extractDefaultView(gridApi, view.table_config)
|
|
15174
|
-
}));
|
|
15175
|
-
}, [defaultViews, gridApi]);
|
|
15176
|
-
};
|
|
15177
|
-
|
|
15178
|
-
// src/components/adapters/smart-grid/useSmartGridConfig.ts
|
|
15179
|
-
import { useState as useState5, useEffect as useEffect4 } from "react";
|
|
15180
|
-
var GRID_STATE_EVENTS = [
|
|
15181
|
-
"sortChanged",
|
|
15182
|
-
"filterOpened",
|
|
15183
|
-
"filterChanged",
|
|
15184
|
-
"columnRowGroupChanged",
|
|
15185
|
-
"dragStopped",
|
|
15186
|
-
"columnResized",
|
|
15187
|
-
"columnVisible",
|
|
15188
|
-
"columnPinned",
|
|
15189
|
-
"columnMoved",
|
|
15190
|
-
"modelUpdated",
|
|
15191
|
-
"gridColumnsChanged",
|
|
15192
|
-
"gridReady"
|
|
15193
|
-
];
|
|
15194
|
-
var useSmartGridConfig = (gridApi) => {
|
|
15195
|
-
const [config, setConfig] = useState5(
|
|
15196
|
-
() => getSmartGridConfig(gridApi)
|
|
15197
|
-
);
|
|
15198
|
-
useEffect4(() => {
|
|
15199
|
-
if (!gridApi)
|
|
15200
|
-
return;
|
|
15201
|
-
const updateConfig = () => {
|
|
15202
|
-
setConfig(getSmartGridConfig(gridApi));
|
|
15203
|
-
};
|
|
15204
|
-
GRID_STATE_EVENTS.forEach((event) => {
|
|
15205
|
-
gridApi.addEventListener(event, updateConfig);
|
|
15206
|
-
});
|
|
15207
|
-
return () => {
|
|
15208
|
-
GRID_STATE_EVENTS.forEach((event) => {
|
|
15209
|
-
gridApi.removeEventListener(event, updateConfig);
|
|
15210
|
-
});
|
|
15211
|
-
};
|
|
15212
|
-
}, [gridApi]);
|
|
15213
|
-
return { config, setConfig };
|
|
15214
|
-
};
|
|
15215
|
-
|
|
15216
|
-
// src/components/adapters/smart-grid/SmartGridSavedViews.tsx
|
|
14632
|
+
// src/SavedViews/components/SavedViews/SmartGrid/SmartGridSavedViews.tsx
|
|
14633
|
+
import { ToastAlertProvider } from "@procore/toast-alert";
|
|
15217
14634
|
var SmartGridSavedViews = (props) => {
|
|
15218
|
-
const { gridApi,
|
|
14635
|
+
const { gridApi, projectId, companyId } = props;
|
|
15219
14636
|
const { config: tableConfig, setConfig: setTableConfig } = useSmartGridConfig(gridApi);
|
|
15220
|
-
const
|
|
15221
|
-
|
|
15222
|
-
|
|
15223
|
-
|
|
15224
|
-
|
|
15225
|
-
|
|
15226
|
-
|
|
15227
|
-
|
|
15228
|
-
|
|
15229
|
-
|
|
15230
|
-
|
|
15231
|
-
|
|
15232
|
-
|
|
15233
|
-
|
|
15234
|
-
|
|
15235
|
-
|
|
15236
|
-
|
|
15237
|
-
|
|
15238
|
-
|
|
15239
|
-
|
|
15240
|
-
|
|
15241
|
-
|
|
15242
|
-
|
|
15243
|
-
|
|
15244
|
-
|
|
15245
|
-
|
|
14637
|
+
const defaultView = useDefaultView({
|
|
14638
|
+
defaultViewName: props.defaultViewName,
|
|
14639
|
+
domain: props.domain
|
|
14640
|
+
});
|
|
14641
|
+
const onSelect = ({ item }) => {
|
|
14642
|
+
var _a;
|
|
14643
|
+
if (!gridApi)
|
|
14644
|
+
return item;
|
|
14645
|
+
if (item.id === "default") {
|
|
14646
|
+
gridApi.autoSizeAllColumns();
|
|
14647
|
+
gridApi.resetColumnState();
|
|
14648
|
+
gridApi.setFilterModel(props.defaultViewFilters);
|
|
14649
|
+
gridApi.setGridOption("rowHeight", props.defaultRowHeight);
|
|
14650
|
+
gridApi.refreshCells();
|
|
14651
|
+
return item;
|
|
14652
|
+
}
|
|
14653
|
+
const tableConfig2 = item.table_config;
|
|
14654
|
+
const updatedItemConfig = ((_a = props.transformSettings) == null ? void 0 : _a.call(props, tableConfig2)) ?? tableConfig2;
|
|
14655
|
+
const updatedView = {
|
|
14656
|
+
...item,
|
|
14657
|
+
table_config: customAndConfigSync(
|
|
14658
|
+
updatedItemConfig,
|
|
14659
|
+
tableConfig2
|
|
14660
|
+
)
|
|
14661
|
+
};
|
|
14662
|
+
updateTableConfig(updatedView, gridApi, "smart-grid");
|
|
14663
|
+
setTableConfig(updatedView.table_config);
|
|
14664
|
+
return updatedView;
|
|
14665
|
+
};
|
|
14666
|
+
return /* @__PURE__ */ React20.createElement(ToastAlertProvider, null, /* @__PURE__ */ React20.createElement(
|
|
15246
14667
|
SavedViews,
|
|
15247
14668
|
{
|
|
15248
14669
|
onSelect,
|
|
15249
14670
|
domain: props.domain,
|
|
15250
|
-
userId,
|
|
14671
|
+
userId: props.userId,
|
|
15251
14672
|
projectId,
|
|
15252
14673
|
companyId,
|
|
15253
14674
|
provider: "smart-grid",
|
|
15254
14675
|
defaultView,
|
|
15255
|
-
presetViews,
|
|
15256
14676
|
tableName: props.tableName,
|
|
15257
|
-
tableConfig
|
|
14677
|
+
tableConfig,
|
|
14678
|
+
stickyViewsKey: props.stickyViewsKey,
|
|
14679
|
+
enableSavedViews: props.enableSavedViews,
|
|
14680
|
+
backend: props.backend
|
|
15258
14681
|
}
|
|
15259
|
-
);
|
|
14682
|
+
));
|
|
15260
14683
|
};
|
|
15261
14684
|
|
|
15262
|
-
// src/components/
|
|
15263
|
-
import
|
|
15264
|
-
forwardRef as
|
|
14685
|
+
// src/SavedViews/components/SavedViews/DataTable/DataTableSavedViews.tsx
|
|
14686
|
+
import React21, {
|
|
14687
|
+
forwardRef as forwardRef9,
|
|
15265
14688
|
useImperativeHandle,
|
|
15266
|
-
useState as
|
|
15267
|
-
useCallback as
|
|
14689
|
+
useState as useState5,
|
|
14690
|
+
useCallback as useCallback2
|
|
15268
14691
|
} from "react";
|
|
15269
14692
|
|
|
15270
|
-
// src/components/
|
|
15271
|
-
import { useMemo
|
|
15272
|
-
|
|
14693
|
+
// src/SavedViews/components/SavedViews/DataTable/DataTableDefaultSavedView.tsx
|
|
14694
|
+
import { useMemo } from "react";
|
|
14695
|
+
import { useI18nContext as useI18nContext11 } from "@procore/core-react";
|
|
14696
|
+
var DEFAULT_COLUMN_STATE = {
|
|
15273
14697
|
hidden: false,
|
|
15274
14698
|
pinned: null,
|
|
15275
14699
|
width: 200,
|
|
@@ -15284,7 +14708,7 @@ var getColumnState = (columnDefinitions) => {
|
|
|
15284
14708
|
if (column.field.includes("custom_field")) {
|
|
15285
14709
|
return {
|
|
15286
14710
|
field: column.field,
|
|
15287
|
-
...
|
|
14711
|
+
...DEFAULT_COLUMN_STATE
|
|
15288
14712
|
};
|
|
15289
14713
|
}
|
|
15290
14714
|
return {
|
|
@@ -15295,11 +14719,11 @@ var getColumnState = (columnDefinitions) => {
|
|
|
15295
14719
|
rowGroupIndex: null,
|
|
15296
14720
|
sort: null,
|
|
15297
14721
|
sortIndex: null,
|
|
15298
|
-
width: (column.minWidth ??
|
|
14722
|
+
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
|
|
15299
14723
|
};
|
|
15300
14724
|
});
|
|
15301
14725
|
};
|
|
15302
|
-
var
|
|
14726
|
+
var extractDefaultView = (columnDefinitions, receivedConfigFromTool) => {
|
|
15303
14727
|
var _a, _b, _c;
|
|
15304
14728
|
const defaultColumnState = getColumnState(columnDefinitions);
|
|
15305
14729
|
const result = {
|
|
@@ -15315,77 +14739,92 @@ var extractDefaultView2 = (columnDefinitions, receivedConfigFromTool) => {
|
|
|
15315
14739
|
};
|
|
15316
14740
|
return result;
|
|
15317
14741
|
};
|
|
15318
|
-
var
|
|
15319
|
-
|
|
15320
|
-
|
|
15321
|
-
|
|
15322
|
-
|
|
15323
|
-
|
|
15324
|
-
|
|
15325
|
-
|
|
14742
|
+
var useDefaultViewName2 = (domain, defaultViewName) => {
|
|
14743
|
+
const i18n = useI18nContext11();
|
|
14744
|
+
return defaultViewName || i18n.t(domain, {
|
|
14745
|
+
scope: "savedViews.defaultViewTitle",
|
|
14746
|
+
defaultValue: "Default View"
|
|
14747
|
+
});
|
|
14748
|
+
};
|
|
14749
|
+
var useDefaultView2 = (props) => {
|
|
14750
|
+
const name = useDefaultViewName2(props.domain, props.defaultViewName);
|
|
14751
|
+
const extractedDefaultConfig = useMemo(
|
|
14752
|
+
() => extractDefaultView(props.columnDefinitions, props.receivedConfigFromTool),
|
|
14753
|
+
[props.columnDefinitions, props.receivedConfigFromTool]
|
|
15326
14754
|
);
|
|
14755
|
+
return {
|
|
14756
|
+
id: "default",
|
|
14757
|
+
view_level: "default",
|
|
14758
|
+
name,
|
|
14759
|
+
table_config: extractedDefaultConfig
|
|
14760
|
+
};
|
|
15327
14761
|
};
|
|
15328
14762
|
|
|
15329
|
-
// src/components/
|
|
15330
|
-
|
|
15331
|
-
|
|
15332
|
-
const
|
|
15333
|
-
|
|
15334
|
-
props.
|
|
15335
|
-
);
|
|
15336
|
-
const defaultView = presetViews.find((view) => view.id === "default") ?? presetViews[0];
|
|
15337
|
-
const [internalTableConfig, setInternalTableConfig] = useState6(
|
|
15338
|
-
ViewStorage.load(props.stickyViewsKey, defaultView).table_config
|
|
14763
|
+
// src/SavedViews/components/SavedViews/DataTable/DataTableSavedViews.tsx
|
|
14764
|
+
import { ToastAlertProvider as ToastAlertProvider2 } from "@procore/toast-alert";
|
|
14765
|
+
var DataTableSavedViews = forwardRef9((props, ref) => {
|
|
14766
|
+
const { tableApi, onTableConfigChange, projectId, companyId } = props;
|
|
14767
|
+
const [internalTableConfig, setInternalTableConfig] = useState5(
|
|
14768
|
+
props.defaultViewConfig
|
|
15339
14769
|
);
|
|
15340
14770
|
useImperativeHandle(ref, () => ({
|
|
15341
14771
|
setTableConfig: (newConfig) => {
|
|
15342
|
-
|
|
14772
|
+
handleConfigChange(newConfig);
|
|
15343
14773
|
}
|
|
15344
14774
|
}));
|
|
15345
|
-
const
|
|
15346
|
-
(
|
|
15347
|
-
|
|
15348
|
-
|
|
15349
|
-
...item,
|
|
15350
|
-
table_config: customAndConfigSync(
|
|
15351
|
-
item.table_config,
|
|
15352
|
-
defaultView.table_config
|
|
15353
|
-
)
|
|
15354
|
-
};
|
|
15355
|
-
updateTableConfig(updatedView, tableApi, "data-table");
|
|
15356
|
-
setInternalTableConfig(updatedView.table_config);
|
|
15357
|
-
return updatedView;
|
|
14775
|
+
const handleConfigChange = useCallback2(
|
|
14776
|
+
(newConfig) => {
|
|
14777
|
+
setInternalTableConfig(newConfig);
|
|
14778
|
+
onTableConfigChange(newConfig);
|
|
15358
14779
|
},
|
|
15359
|
-
[
|
|
14780
|
+
[onTableConfigChange]
|
|
15360
14781
|
);
|
|
14782
|
+
const defaultView = useDefaultView2({
|
|
14783
|
+
defaultViewName: props.defaultViewName,
|
|
14784
|
+
receivedConfigFromTool: props.defaultViewConfig,
|
|
14785
|
+
domain: props.domain,
|
|
14786
|
+
columnDefinitions: props.columnDefinitions
|
|
14787
|
+
});
|
|
14788
|
+
const onSelect = ({ item }) => {
|
|
14789
|
+
const isDefaultView = item.id === "default";
|
|
14790
|
+
const updatedView = isDefaultView ? defaultView : {
|
|
14791
|
+
...item,
|
|
14792
|
+
table_config: customAndConfigSync(
|
|
14793
|
+
item.table_config,
|
|
14794
|
+
defaultView.table_config
|
|
14795
|
+
)
|
|
14796
|
+
};
|
|
14797
|
+
updateTableConfig(updatedView, tableApi, "data-table", handleConfigChange);
|
|
14798
|
+
return updatedView;
|
|
14799
|
+
};
|
|
15361
14800
|
if (!internalTableConfig) {
|
|
15362
14801
|
return null;
|
|
15363
14802
|
}
|
|
15364
|
-
return /* @__PURE__ */
|
|
14803
|
+
return /* @__PURE__ */ React21.createElement(ToastAlertProvider2, null, /* @__PURE__ */ React21.createElement(
|
|
15365
14804
|
SavedViews,
|
|
15366
14805
|
{
|
|
15367
14806
|
onSelect,
|
|
15368
14807
|
domain: props.domain,
|
|
15369
|
-
userId,
|
|
14808
|
+
userId: props.userId,
|
|
15370
14809
|
projectId,
|
|
15371
14810
|
companyId,
|
|
15372
14811
|
provider: "data-table",
|
|
15373
14812
|
defaultView,
|
|
15374
|
-
presetViews,
|
|
15375
14813
|
tableName: props.tableName,
|
|
15376
|
-
tableConfig: internalTableConfig
|
|
14814
|
+
tableConfig: internalTableConfig,
|
|
14815
|
+
stickyViewsKey: props.stickyViewsKey,
|
|
14816
|
+
enableSavedViews: props.enableSavedViews
|
|
15377
14817
|
}
|
|
15378
|
-
);
|
|
14818
|
+
));
|
|
15379
14819
|
});
|
|
15380
14820
|
DataTableSavedViews.displayName = "DataTableSavedViews";
|
|
15381
14821
|
export {
|
|
15382
14822
|
DataTableSavedViews,
|
|
15383
14823
|
ExpandedPanel,
|
|
15384
|
-
FormModal,
|
|
15385
14824
|
PanelContent,
|
|
15386
14825
|
SavedViewCollectionMenuItem,
|
|
15387
|
-
SavedViews,
|
|
15388
14826
|
SavedViewsDeleteConfirmationModalShared,
|
|
14827
|
+
SavedViewsFormModal,
|
|
15389
14828
|
SmartGridSavedViews,
|
|
15390
14829
|
getTranslations,
|
|
15391
14830
|
useSavedViewsPanel_default as useSavedViewsPanel
|