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