@procore/saved-views 5.0.0-alpha.4 → 5.1.0-alpha
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/dist/legacy/index.d.mts +13 -27
- package/dist/legacy/index.d.ts +13 -27
- package/dist/legacy/index.js +708 -383
- package/dist/legacy/index.mjs +707 -382
- package/dist/modern/index.d.mts +13 -27
- package/dist/modern/index.d.ts +13 -27
- package/dist/modern/index.js +707 -381
- package/dist/modern/index.mjs +706 -380
- package/package.json +4 -2
package/dist/modern/index.mjs
CHANGED
|
@@ -69,7 +69,7 @@ var require_big = __commonJS({
|
|
|
69
69
|
"use strict";
|
|
70
70
|
(function(GLOBAL) {
|
|
71
71
|
"use strict";
|
|
72
|
-
var Big, DP = 20, RM = 1, MAX_DP = 1e6, MAX_POWER = 1e6, NE = -7, PE = 21, STRICT = false, NAME = "[big.js] ", INVALID = NAME + "Invalid ", INVALID_DP = INVALID + "decimal places", INVALID_RM = INVALID + "rounding mode", DIV_BY_ZERO = NAME + "Division by zero",
|
|
72
|
+
var Big, DP = 20, RM = 1, MAX_DP = 1e6, MAX_POWER = 1e6, NE = -7, PE = 21, STRICT = false, NAME = "[big.js] ", INVALID = NAME + "Invalid ", INVALID_DP = INVALID + "decimal places", INVALID_RM = INVALID + "rounding mode", DIV_BY_ZERO = NAME + "Division by zero", P4 = {}, UNDEFINED = void 0, NUMERIC = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;
|
|
73
73
|
function _Big_() {
|
|
74
74
|
function Big2(n2) {
|
|
75
75
|
var x2 = this;
|
|
@@ -90,7 +90,7 @@ var require_big = __commonJS({
|
|
|
90
90
|
}
|
|
91
91
|
x2.constructor = Big2;
|
|
92
92
|
}
|
|
93
|
-
Big2.prototype =
|
|
93
|
+
Big2.prototype = P4;
|
|
94
94
|
Big2.DP = DP;
|
|
95
95
|
Big2.RM = RM;
|
|
96
96
|
Big2.NE = NE;
|
|
@@ -187,12 +187,12 @@ var require_big = __commonJS({
|
|
|
187
187
|
}
|
|
188
188
|
return x2.s < 0 && isNonzero ? "-" + s2 : s2;
|
|
189
189
|
}
|
|
190
|
-
|
|
190
|
+
P4.abs = function() {
|
|
191
191
|
var x2 = new this.constructor(this);
|
|
192
192
|
x2.s = 1;
|
|
193
193
|
return x2;
|
|
194
194
|
};
|
|
195
|
-
|
|
195
|
+
P4.cmp = function(y2) {
|
|
196
196
|
var isneg, x2 = this, xc = x2.c, yc = (y2 = new x2.constructor(y2)).c, i2 = x2.s, j2 = y2.s, k2 = x2.e, l2 = y2.e;
|
|
197
197
|
if (!xc[0] || !yc[0])
|
|
198
198
|
return !xc[0] ? !yc[0] ? 0 : -j2 : i2;
|
|
@@ -208,7 +208,7 @@ var require_big = __commonJS({
|
|
|
208
208
|
}
|
|
209
209
|
return k2 == l2 ? 0 : k2 > l2 ^ isneg ? 1 : -1;
|
|
210
210
|
};
|
|
211
|
-
|
|
211
|
+
P4.div = function(y2) {
|
|
212
212
|
var x2 = this, Big2 = x2.constructor, a2 = x2.c, b2 = (y2 = new Big2(y2)).c, k2 = x2.s == y2.s ? 1 : -1, dp = Big2.DP;
|
|
213
213
|
if (dp !== ~~dp || dp < 0 || dp > MAX_DP) {
|
|
214
214
|
throw Error(INVALID_DP);
|
|
@@ -271,22 +271,22 @@ var require_big = __commonJS({
|
|
|
271
271
|
round(q2, p, Big2.RM, r2[0] !== UNDEFINED);
|
|
272
272
|
return q2;
|
|
273
273
|
};
|
|
274
|
-
|
|
274
|
+
P4.eq = function(y2) {
|
|
275
275
|
return this.cmp(y2) === 0;
|
|
276
276
|
};
|
|
277
|
-
|
|
277
|
+
P4.gt = function(y2) {
|
|
278
278
|
return this.cmp(y2) > 0;
|
|
279
279
|
};
|
|
280
|
-
|
|
280
|
+
P4.gte = function(y2) {
|
|
281
281
|
return this.cmp(y2) > -1;
|
|
282
282
|
};
|
|
283
|
-
|
|
283
|
+
P4.lt = function(y2) {
|
|
284
284
|
return this.cmp(y2) < 0;
|
|
285
285
|
};
|
|
286
|
-
|
|
286
|
+
P4.lte = function(y2) {
|
|
287
287
|
return this.cmp(y2) < 1;
|
|
288
288
|
};
|
|
289
|
-
|
|
289
|
+
P4.minus = P4.sub = function(y2) {
|
|
290
290
|
var i2, j2, t2, xlty, x2 = this, Big2 = x2.constructor, a2 = x2.s, b2 = (y2 = new Big2(y2)).s;
|
|
291
291
|
if (a2 != b2) {
|
|
292
292
|
y2.s = -b2;
|
|
@@ -356,7 +356,7 @@ var require_big = __commonJS({
|
|
|
356
356
|
y2.e = ye2;
|
|
357
357
|
return y2;
|
|
358
358
|
};
|
|
359
|
-
|
|
359
|
+
P4.mod = function(y2) {
|
|
360
360
|
var ygtx, x2 = this, Big2 = x2.constructor, a2 = x2.s, b2 = (y2 = new Big2(y2)).s;
|
|
361
361
|
if (!y2.c[0]) {
|
|
362
362
|
throw Error(DIV_BY_ZERO);
|
|
@@ -375,12 +375,12 @@ var require_big = __commonJS({
|
|
|
375
375
|
Big2.RM = b2;
|
|
376
376
|
return this.minus(x2.times(y2));
|
|
377
377
|
};
|
|
378
|
-
|
|
378
|
+
P4.neg = function() {
|
|
379
379
|
var x2 = new this.constructor(this);
|
|
380
380
|
x2.s = -x2.s;
|
|
381
381
|
return x2;
|
|
382
382
|
};
|
|
383
|
-
|
|
383
|
+
P4.plus = P4.add = function(y2) {
|
|
384
384
|
var e2, k2, t2, x2 = this, Big2 = x2.constructor;
|
|
385
385
|
y2 = new Big2(y2);
|
|
386
386
|
if (x2.s != y2.s) {
|
|
@@ -430,7 +430,7 @@ var require_big = __commonJS({
|
|
|
430
430
|
y2.e = ye2;
|
|
431
431
|
return y2;
|
|
432
432
|
};
|
|
433
|
-
|
|
433
|
+
P4.pow = function(n2) {
|
|
434
434
|
var x2 = this, one = new x2.constructor("1"), y2 = one, isneg = n2 < 0;
|
|
435
435
|
if (n2 !== ~~n2 || n2 < -MAX_POWER || n2 > MAX_POWER) {
|
|
436
436
|
throw Error(INVALID + "exponent");
|
|
@@ -447,13 +447,13 @@ var require_big = __commonJS({
|
|
|
447
447
|
}
|
|
448
448
|
return isneg ? one.div(y2) : y2;
|
|
449
449
|
};
|
|
450
|
-
|
|
450
|
+
P4.prec = function(sd, rm) {
|
|
451
451
|
if (sd !== ~~sd || sd < 1 || sd > MAX_DP) {
|
|
452
452
|
throw Error(INVALID + "precision");
|
|
453
453
|
}
|
|
454
454
|
return round(new this.constructor(this), sd, rm);
|
|
455
455
|
};
|
|
456
|
-
|
|
456
|
+
P4.round = function(dp, rm) {
|
|
457
457
|
if (dp === UNDEFINED)
|
|
458
458
|
dp = 0;
|
|
459
459
|
else if (dp !== ~~dp || dp < -MAX_DP || dp > MAX_DP) {
|
|
@@ -461,7 +461,7 @@ var require_big = __commonJS({
|
|
|
461
461
|
}
|
|
462
462
|
return round(new this.constructor(this), dp + this.e + 1, rm);
|
|
463
463
|
};
|
|
464
|
-
|
|
464
|
+
P4.sqrt = function() {
|
|
465
465
|
var r2, c2, t2, x2 = this, Big2 = x2.constructor, s2 = x2.s, e2 = x2.e, half = new Big2("0.5");
|
|
466
466
|
if (!x2.c[0])
|
|
467
467
|
return new Big2(x2);
|
|
@@ -486,7 +486,7 @@ var require_big = __commonJS({
|
|
|
486
486
|
} while (t2.c.slice(0, e2).join("") !== r2.c.slice(0, e2).join(""));
|
|
487
487
|
return round(r2, (Big2.DP -= 4) + r2.e + 1, Big2.RM);
|
|
488
488
|
};
|
|
489
|
-
|
|
489
|
+
P4.times = P4.mul = function(y2) {
|
|
490
490
|
var c2, x2 = this, Big2 = x2.constructor, xc = x2.c, yc = (y2 = new Big2(y2)).c, a2 = xc.length, b2 = yc.length, i2 = x2.e, j2 = y2.e;
|
|
491
491
|
y2.s = x2.s == y2.s ? 1 : -1;
|
|
492
492
|
if (!xc[0] || !yc[0]) {
|
|
@@ -522,7 +522,7 @@ var require_big = __commonJS({
|
|
|
522
522
|
y2.c = c2;
|
|
523
523
|
return y2;
|
|
524
524
|
};
|
|
525
|
-
|
|
525
|
+
P4.toExponential = function(dp, rm) {
|
|
526
526
|
var x2 = this, n2 = x2.c[0];
|
|
527
527
|
if (dp !== UNDEFINED) {
|
|
528
528
|
if (dp !== ~~dp || dp < 0 || dp > MAX_DP) {
|
|
@@ -534,7 +534,7 @@ var require_big = __commonJS({
|
|
|
534
534
|
}
|
|
535
535
|
return stringify(x2, true, !!n2);
|
|
536
536
|
};
|
|
537
|
-
|
|
537
|
+
P4.toFixed = function(dp, rm) {
|
|
538
538
|
var x2 = this, n2 = x2.c[0];
|
|
539
539
|
if (dp !== UNDEFINED) {
|
|
540
540
|
if (dp !== ~~dp || dp < 0 || dp > MAX_DP) {
|
|
@@ -546,18 +546,18 @@ var require_big = __commonJS({
|
|
|
546
546
|
}
|
|
547
547
|
return stringify(x2, false, !!n2);
|
|
548
548
|
};
|
|
549
|
-
|
|
549
|
+
P4.toJSON = P4.toString = function() {
|
|
550
550
|
var x2 = this, Big2 = x2.constructor;
|
|
551
551
|
return stringify(x2, x2.e <= Big2.NE || x2.e >= Big2.PE, !!x2.c[0]);
|
|
552
552
|
};
|
|
553
|
-
|
|
553
|
+
P4.toNumber = function() {
|
|
554
554
|
var n2 = +stringify(this, true, true);
|
|
555
555
|
if (this.constructor.strict === true && !this.eq(n2.toString())) {
|
|
556
556
|
throw Error(NAME + "Imprecise conversion");
|
|
557
557
|
}
|
|
558
558
|
return n2;
|
|
559
559
|
};
|
|
560
|
-
|
|
560
|
+
P4.toPrecision = function(sd, rm) {
|
|
561
561
|
var x2 = this, Big2 = x2.constructor, n2 = x2.c[0];
|
|
562
562
|
if (sd !== UNDEFINED) {
|
|
563
563
|
if (sd !== ~~sd || sd < 1 || sd > MAX_DP) {
|
|
@@ -569,7 +569,7 @@ var require_big = __commonJS({
|
|
|
569
569
|
}
|
|
570
570
|
return stringify(x2, sd <= x2.e || x2.e <= Big2.NE || x2.e >= Big2.PE, !!n2);
|
|
571
571
|
};
|
|
572
|
-
|
|
572
|
+
P4.valueOf = function() {
|
|
573
573
|
var x2 = this, Big2 = x2.constructor;
|
|
574
574
|
if (Big2.strict === true) {
|
|
575
575
|
throw Error(NAME + "valueOf disallowed");
|
|
@@ -1879,13 +1879,13 @@ var require_GetFallbackLocaleList = __commonJS({
|
|
|
1879
1879
|
var require_GetTranslationsFromLocale = __commonJS({
|
|
1880
1880
|
"../../node_modules/@procore/globalization-toolkit/dist/getTranslationsFromLocale/GetTranslationsFromLocale.js"(exports) {
|
|
1881
1881
|
"use strict";
|
|
1882
|
-
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments,
|
|
1882
|
+
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P4, generator) {
|
|
1883
1883
|
function adopt(value) {
|
|
1884
|
-
return value instanceof
|
|
1884
|
+
return value instanceof P4 ? value : new P4(function(resolve) {
|
|
1885
1885
|
resolve(value);
|
|
1886
1886
|
});
|
|
1887
1887
|
}
|
|
1888
|
-
return new (
|
|
1888
|
+
return new (P4 || (P4 = Promise))(function(resolve, reject) {
|
|
1889
1889
|
function fulfilled(value) {
|
|
1890
1890
|
try {
|
|
1891
1891
|
step(generator.next(value));
|
|
@@ -8798,7 +8798,11 @@ var en_default = {
|
|
|
8798
8798
|
create: "Create",
|
|
8799
8799
|
edit: "Edit",
|
|
8800
8800
|
cancel: "Cancel",
|
|
8801
|
-
close: "Close"
|
|
8801
|
+
close: "Close",
|
|
8802
|
+
viewTemporarily: "View Temporarily",
|
|
8803
|
+
createView: "Create View",
|
|
8804
|
+
copyShareLink: "Copy Share Link",
|
|
8805
|
+
linkCopied: "Share link copied to clipboard"
|
|
8802
8806
|
},
|
|
8803
8807
|
modal: {
|
|
8804
8808
|
edit: {
|
|
@@ -8811,6 +8815,10 @@ var en_default = {
|
|
|
8811
8815
|
headline: "Delete Saved View",
|
|
8812
8816
|
description: "This view cannot be restored once it has been deleted."
|
|
8813
8817
|
},
|
|
8818
|
+
copyConfirmation: {
|
|
8819
|
+
headline: 'Create "{{savedViewName}}" as a personal saved view?',
|
|
8820
|
+
description: "You pasted a link to a saved view that does not yet exist for you. You can create it as a personal saved view or just view it temporarily."
|
|
8821
|
+
},
|
|
8814
8822
|
fields: {
|
|
8815
8823
|
name: "Name",
|
|
8816
8824
|
description: "Description",
|
|
@@ -8843,11 +8851,15 @@ var en_default = {
|
|
|
8843
8851
|
update: {
|
|
8844
8852
|
success: "The saved view was successfully updated."
|
|
8845
8853
|
},
|
|
8854
|
+
copy: {
|
|
8855
|
+
success: "The link was successfully created and copied to the clipboard."
|
|
8856
|
+
},
|
|
8846
8857
|
errors: {
|
|
8847
8858
|
fetch: "Sorry, the saved views couldn't be fetched. Try again.",
|
|
8848
8859
|
create: "Sorry, the saved view couldn't be created. Try again.",
|
|
8849
8860
|
update: "Sorry, the saved view couldn't be updated. Try again.",
|
|
8850
|
-
delete: "Sorry, the saved view couldn't be deleted. Try again."
|
|
8861
|
+
delete: "Sorry, the saved view couldn't be deleted. Try again.",
|
|
8862
|
+
copyFailed: "Failed to copy share link to clipboard"
|
|
8851
8863
|
},
|
|
8852
8864
|
defaultViewTitle: {
|
|
8853
8865
|
rfi: "All RFIs",
|
|
@@ -9816,16 +9828,33 @@ var Help = React7.forwardRef(function Help2(props, ref) {
|
|
|
9816
9828
|
Help.displayName = "Help";
|
|
9817
9829
|
var Help_default = Help;
|
|
9818
9830
|
|
|
9819
|
-
// ../../node_modules/@procore/core-icons/dist/icons/
|
|
9831
|
+
// ../../node_modules/@procore/core-icons/dist/icons/Link.js
|
|
9820
9832
|
import * as React8 from "react";
|
|
9821
|
-
var
|
|
9833
|
+
var Link = React8.forwardRef(function Link2(props, ref) {
|
|
9822
9834
|
return React8.createElement(
|
|
9823
9835
|
Icon,
|
|
9824
|
-
__assign({}, props, { name: "
|
|
9836
|
+
__assign({}, props, { name: "Link" }),
|
|
9825
9837
|
React8.createElement(
|
|
9826
9838
|
"svg",
|
|
9827
9839
|
{ width: "24", height: "24", viewBox: "0 0 24 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ref },
|
|
9828
|
-
React8.createElement("path", { d: "
|
|
9840
|
+
React8.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" }),
|
|
9841
|
+
React8.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" })
|
|
9842
|
+
)
|
|
9843
|
+
);
|
|
9844
|
+
});
|
|
9845
|
+
Link.displayName = "Link";
|
|
9846
|
+
var Link_default = Link;
|
|
9847
|
+
|
|
9848
|
+
// ../../node_modules/@procore/core-icons/dist/icons/Person.js
|
|
9849
|
+
import * as React9 from "react";
|
|
9850
|
+
var Person = React9.forwardRef(function Person2(props, ref) {
|
|
9851
|
+
return React9.createElement(
|
|
9852
|
+
Icon,
|
|
9853
|
+
__assign({}, props, { name: "Person" }),
|
|
9854
|
+
React9.createElement(
|
|
9855
|
+
"svg",
|
|
9856
|
+
{ width: "24", height: "24", viewBox: "0 0 24 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ref },
|
|
9857
|
+
React9.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" })
|
|
9829
9858
|
)
|
|
9830
9859
|
);
|
|
9831
9860
|
});
|
|
@@ -9833,15 +9862,15 @@ Person.displayName = "Person";
|
|
|
9833
9862
|
var Person_default = Person;
|
|
9834
9863
|
|
|
9835
9864
|
// ../../node_modules/@procore/core-icons/dist/icons/Plus.js
|
|
9836
|
-
import * as
|
|
9837
|
-
var Plus =
|
|
9838
|
-
return
|
|
9865
|
+
import * as React10 from "react";
|
|
9866
|
+
var Plus = React10.forwardRef(function Plus2(props, ref) {
|
|
9867
|
+
return React10.createElement(
|
|
9839
9868
|
Icon,
|
|
9840
9869
|
__assign({}, props, { name: "Plus" }),
|
|
9841
|
-
|
|
9870
|
+
React10.createElement(
|
|
9842
9871
|
"svg",
|
|
9843
9872
|
{ width: "24", height: "24", viewBox: "0 0 24 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ref },
|
|
9844
|
-
|
|
9873
|
+
React10.createElement("path", { d: "M13.25 5H10.75V10.75H5V13.25H10.75V19H13.25V13.25H19V10.75H13.25V5Z", fill: "currentColor" })
|
|
9845
9874
|
)
|
|
9846
9875
|
);
|
|
9847
9876
|
});
|
|
@@ -9850,7 +9879,7 @@ var Plus_default = Plus;
|
|
|
9850
9879
|
|
|
9851
9880
|
// src/SavedViews/components/Buttons/SavedViewsButton.tsx
|
|
9852
9881
|
import { Button } from "@procore/core-react";
|
|
9853
|
-
import
|
|
9882
|
+
import React12 from "react";
|
|
9854
9883
|
|
|
9855
9884
|
// node_modules/styled-components/dist/styled-components.esm.js
|
|
9856
9885
|
var import_react_is = __toESM(require_react_is());
|
|
@@ -9987,7 +10016,7 @@ function stylis_min(W2) {
|
|
|
9987
10016
|
break;
|
|
9988
10017
|
}
|
|
9989
10018
|
default:
|
|
9990
|
-
58 !== f2.charCodeAt(t2 - 1) && (p +=
|
|
10019
|
+
58 !== f2.charCodeAt(t2 - 1) && (p += P4(f2, q2, g2, f2.charCodeAt(2)));
|
|
9991
10020
|
}
|
|
9992
10021
|
I = r2 = u2 = q2 = 0;
|
|
9993
10022
|
f2 = "";
|
|
@@ -10160,7 +10189,7 @@ function stylis_min(W2) {
|
|
|
10160
10189
|
}
|
|
10161
10190
|
return d + c2;
|
|
10162
10191
|
}
|
|
10163
|
-
function
|
|
10192
|
+
function P4(d, c2, e2, h) {
|
|
10164
10193
|
var a2 = d + ";", m2 = 2 * c2 + 3 * e2 + 4 * h;
|
|
10165
10194
|
if (944 === m2) {
|
|
10166
10195
|
d = a2.indexOf(":", 9) + 1;
|
|
@@ -10267,7 +10296,7 @@ function stylis_min(W2) {
|
|
|
10267
10296
|
case 931:
|
|
10268
10297
|
case 953:
|
|
10269
10298
|
if (true === la.test(d))
|
|
10270
|
-
return 115 === (b2 = d.substring(d.indexOf(":") + 1)).charCodeAt(0) ?
|
|
10299
|
+
return 115 === (b2 = d.substring(d.indexOf(":") + 1)).charCodeAt(0) ? P4(d.replace("stretch", "fill-available"), c2, e2, h).replace(":fill-available", ":stretch") : a2.replace(b2, "-webkit-" + b2) + a2.replace(b2, "-moz-" + b2.replace("fill-", "")) + a2;
|
|
10271
10300
|
break;
|
|
10272
10301
|
case 962:
|
|
10273
10302
|
if (a2 = "-webkit-" + a2 + (102 === a2.charCodeAt(5) ? "-ms-" + a2 : "") + a2, 211 === e2 + h && 105 === a2.charCodeAt(13) && 0 < a2.indexOf("transform", 10))
|
|
@@ -10281,7 +10310,7 @@ function stylis_min(W2) {
|
|
|
10281
10310
|
return R2(2 !== c2 ? h : h.replace(na, "$1"), e2, c2);
|
|
10282
10311
|
}
|
|
10283
10312
|
function ea(d, c2) {
|
|
10284
|
-
var e2 =
|
|
10313
|
+
var e2 = P4(c2, c2.charCodeAt(0), c2.charCodeAt(1), c2.charCodeAt(2));
|
|
10285
10314
|
return e2 !== c2 + ";" ? e2.replace(oa, " or ($1)").substring(4) : "(" + c2 + ")";
|
|
10286
10315
|
}
|
|
10287
10316
|
function H3(d, c2, e2, h, a2, m2, b2, v2, n2, q2) {
|
|
@@ -10939,7 +10968,7 @@ function Fe(e2, t2, n2) {
|
|
|
10939
10968
|
o2 && e2.shouldForwardProp && (N = t2.shouldForwardProp ? function(n3, r2, o3) {
|
|
10940
10969
|
return e2.shouldForwardProp(n3, r2, o3) && t2.shouldForwardProp(n3, r2, o3);
|
|
10941
10970
|
} : e2.shouldForwardProp);
|
|
10942
|
-
var A2, C2 = new re(n2, v2, o2 ? e2.componentStyle : void 0), I = C2.isStatic && 0 === c2.length,
|
|
10971
|
+
var A2, C2 = new re(n2, v2, o2 ? e2.componentStyle : void 0), I = C2.isStatic && 0 === c2.length, P4 = function(e3, t3) {
|
|
10943
10972
|
return function(e4, t4, n3, r2) {
|
|
10944
10973
|
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) {
|
|
10945
10974
|
void 0 === e5 && (e5 = S);
|
|
@@ -10958,7 +10987,7 @@ function Fe(e2, t2, n2) {
|
|
|
10958
10987
|
return t4.style && v3.style !== t4.style && (A3.style = m({}, t4.style, {}, v3.style)), A3.className = Array.prototype.concat(c3, d2, g2 !== d2 ? g2 : null, t4.className, v3.className).filter(Boolean).join(" "), A3.ref = E2, u(b2, A3);
|
|
10959
10988
|
}(A2, e3, t3, I);
|
|
10960
10989
|
};
|
|
10961
|
-
return
|
|
10990
|
+
return P4.displayName = y2, (A2 = r.forwardRef(P4)).attrs = _3, A2.componentStyle = C2, A2.displayName = y2, A2.shouldForwardProp = N, A2.foldedComponentIds = o2 ? Array.prototype.concat(e2.foldedComponentIds, e2.styledComponentId) : g, A2.styledComponentId = v2, A2.target = o2 ? e2.target : e2, A2.withComponent = function(e3) {
|
|
10962
10991
|
var r2 = t2.componentId, o3 = function(e4, t3) {
|
|
10963
10992
|
if (null == e4)
|
|
10964
10993
|
return {};
|
|
@@ -11064,7 +11093,7 @@ var Ue = function() {
|
|
|
11064
11093
|
var styled_components_esm_default = Ye;
|
|
11065
11094
|
|
|
11066
11095
|
// src/SavedViews/components/EnvironmentI18nProvider.tsx
|
|
11067
|
-
import
|
|
11096
|
+
import React11 from "react";
|
|
11068
11097
|
import { I18nContext, useI18n, useI18nContext } from "@procore/core-react";
|
|
11069
11098
|
import { useRequestTranslations } from "@procore/cdn-translations";
|
|
11070
11099
|
var useCDNTranslations = () => {
|
|
@@ -11090,7 +11119,7 @@ var useCDNTranslations = () => {
|
|
|
11090
11119
|
};
|
|
11091
11120
|
var EnvironmentI18nProvider = ({ children }) => {
|
|
11092
11121
|
const i18n = useCDNTranslations();
|
|
11093
|
-
return /* @__PURE__ */
|
|
11122
|
+
return /* @__PURE__ */ React11.createElement(I18nContext.Provider, { value: i18n }, children);
|
|
11094
11123
|
};
|
|
11095
11124
|
|
|
11096
11125
|
// src/SavedViews/components/Buttons/SavedViewsButton.tsx
|
|
@@ -11117,12 +11146,12 @@ var SavedViewsButton = ({
|
|
|
11117
11146
|
isOpen
|
|
11118
11147
|
}) => {
|
|
11119
11148
|
const I18n = useCDNTranslations();
|
|
11120
|
-
return /* @__PURE__ */
|
|
11149
|
+
return /* @__PURE__ */ React12.createElement(Container, null, /* @__PURE__ */ React12.createElement(
|
|
11121
11150
|
StyledButton,
|
|
11122
11151
|
{
|
|
11123
11152
|
variant: "secondary",
|
|
11124
11153
|
onClick: handleClick,
|
|
11125
|
-
icon: /* @__PURE__ */
|
|
11154
|
+
icon: /* @__PURE__ */ React12.createElement(StyledIcon, { left: isOpen }),
|
|
11126
11155
|
"data-testid": "saved-views-button"
|
|
11127
11156
|
},
|
|
11128
11157
|
I18n.t("savedViews.button.title")
|
|
@@ -11130,7 +11159,7 @@ var SavedViewsButton = ({
|
|
|
11130
11159
|
};
|
|
11131
11160
|
|
|
11132
11161
|
// src/SavedViews/components/Buttons/useSavedViewsPanel.tsx
|
|
11133
|
-
import
|
|
11162
|
+
import React13 from "react";
|
|
11134
11163
|
var useSavedViewsPanel = (domain, tableName) => {
|
|
11135
11164
|
const key = (domain2, tableName2) => `savedViewsPanel-${domain2}-${tableName2}`;
|
|
11136
11165
|
const [isOpen, setIsOpen] = useState(
|
|
@@ -11140,8 +11169,8 @@ var useSavedViewsPanel = (domain, tableName) => {
|
|
|
11140
11169
|
setIsOpen(!isOpen);
|
|
11141
11170
|
localStorage.setItem(key(domain, tableName), JSON.stringify(!isOpen));
|
|
11142
11171
|
};
|
|
11143
|
-
const
|
|
11144
|
-
return { isOpen, SavedViewsButton:
|
|
11172
|
+
const Button7 = () => /* @__PURE__ */ React13.createElement(SavedViewsButton, { handleClick, isOpen });
|
|
11173
|
+
return { isOpen, SavedViewsButton: Button7 };
|
|
11145
11174
|
};
|
|
11146
11175
|
var useSavedViewsPanel_default = useSavedViewsPanel;
|
|
11147
11176
|
|
|
@@ -11153,7 +11182,8 @@ import {
|
|
|
11153
11182
|
Flex,
|
|
11154
11183
|
useI18nContext as useI18nContext2
|
|
11155
11184
|
} from "@procore/core-react";
|
|
11156
|
-
import * as
|
|
11185
|
+
import * as React14 from "react";
|
|
11186
|
+
import { useToastAlertContext } from "@procore/toast-alert";
|
|
11157
11187
|
var RowActionsBox = styled_components_esm_default(Flex)`
|
|
11158
11188
|
justify-content: center;
|
|
11159
11189
|
align-items: center;
|
|
@@ -11169,7 +11199,7 @@ var Container2 = styled_components_esm_default(Flex)`
|
|
|
11169
11199
|
${({ "aria-selected": selected }) => selected ? "color: hsl(218, 75%, 45%);" : ""}
|
|
11170
11200
|
`;
|
|
11171
11201
|
var SavedViewCollectionMenuItem = (props) => {
|
|
11172
|
-
const onClick =
|
|
11202
|
+
const onClick = React14.useCallback(
|
|
11173
11203
|
(a2) => {
|
|
11174
11204
|
if (!props.item) {
|
|
11175
11205
|
return;
|
|
@@ -11191,7 +11221,19 @@ var SavedViewCollectionMenuItem = (props) => {
|
|
|
11191
11221
|
event.stopPropagation();
|
|
11192
11222
|
props.onUpdate?.(props.item);
|
|
11193
11223
|
};
|
|
11224
|
+
const { showToast } = useToastAlertContext();
|
|
11194
11225
|
const i18n = useI18nContext2();
|
|
11226
|
+
const copyShareLink = async (event) => {
|
|
11227
|
+
event.stopPropagation();
|
|
11228
|
+
try {
|
|
11229
|
+
const currentUrl = new URL(window.location.href);
|
|
11230
|
+
await navigator.clipboard.writeText(currentUrl.toString());
|
|
11231
|
+
showToast.success(i18n.t("savedViews.actions.linkCopied"));
|
|
11232
|
+
} catch (error) {
|
|
11233
|
+
console.error("Failed to copy link:", error);
|
|
11234
|
+
showToast.error(i18n.t("savedViews.errors.copyFailed"));
|
|
11235
|
+
}
|
|
11236
|
+
};
|
|
11195
11237
|
const flyoutMenuOptions = [
|
|
11196
11238
|
{
|
|
11197
11239
|
value: "editNameDesc",
|
|
@@ -11202,7 +11244,7 @@ var SavedViewCollectionMenuItem = (props) => {
|
|
|
11202
11244
|
label: i18n.t("savedViews.actions.delete")
|
|
11203
11245
|
}
|
|
11204
11246
|
];
|
|
11205
|
-
return /* @__PURE__ */
|
|
11247
|
+
return /* @__PURE__ */ React14.createElement(
|
|
11206
11248
|
Container2,
|
|
11207
11249
|
{
|
|
11208
11250
|
"aria-selected": Boolean(props.selected),
|
|
@@ -11213,7 +11255,7 @@ var SavedViewCollectionMenuItem = (props) => {
|
|
|
11213
11255
|
}),
|
|
11214
11256
|
"data-testid": "saved-view-collection-menu-item"
|
|
11215
11257
|
},
|
|
11216
|
-
/* @__PURE__ */
|
|
11258
|
+
/* @__PURE__ */ React14.createElement(
|
|
11217
11259
|
"span",
|
|
11218
11260
|
{
|
|
11219
11261
|
"data-testid": "saved-view-display-name",
|
|
@@ -11221,7 +11263,7 @@ var SavedViewCollectionMenuItem = (props) => {
|
|
|
11221
11263
|
},
|
|
11222
11264
|
props.item.name
|
|
11223
11265
|
),
|
|
11224
|
-
/* @__PURE__ */
|
|
11266
|
+
/* @__PURE__ */ React14.createElement(RowActionsBox, null, /* @__PURE__ */ React14.createElement(Box, { justifyContent: "space-between" }, props.item.id !== "default" && props.canUpdate && /* @__PURE__ */ React14.createElement("div", null, /* @__PURE__ */ React14.createElement(
|
|
11225
11267
|
Button2,
|
|
11226
11268
|
{
|
|
11227
11269
|
onClick: updateItem,
|
|
@@ -11232,7 +11274,17 @@ var SavedViewCollectionMenuItem = (props) => {
|
|
|
11232
11274
|
loading: props.isUpdateProcessing
|
|
11233
11275
|
},
|
|
11234
11276
|
i18n.t("savedViews.actions.update")
|
|
11235
|
-
))
|
|
11277
|
+
)), props.item.id !== "default" && props.selected && !props.canUpdate && props.item.id !== "temporary" && /* @__PURE__ */ React14.createElement("div", null, /* @__PURE__ */ React14.createElement(
|
|
11278
|
+
Button2,
|
|
11279
|
+
{
|
|
11280
|
+
onClick: copyShareLink,
|
|
11281
|
+
variant: "tertiary",
|
|
11282
|
+
size: "sm",
|
|
11283
|
+
"aria-label": i18n.t("savedViews.actions.copyShareLink"),
|
|
11284
|
+
"data-testid": "copy-share-link-button"
|
|
11285
|
+
},
|
|
11286
|
+
/* @__PURE__ */ React14.createElement(Link_default, { size: "sm" })
|
|
11287
|
+
))), /* @__PURE__ */ React14.createElement(Box, null, props.item.id !== "default" && props.canEditOrDelete && /* @__PURE__ */ React14.createElement("div", { onClick: (e2) => e2.stopPropagation() }, /* @__PURE__ */ React14.createElement(
|
|
11236
11288
|
DropdownFlyout,
|
|
11237
11289
|
{
|
|
11238
11290
|
"data-testid": "saved-view-overflow-button",
|
|
@@ -11262,14 +11314,177 @@ import {
|
|
|
11262
11314
|
Flex as Flex3,
|
|
11263
11315
|
UNSAFE_Menu as MenuImperative,
|
|
11264
11316
|
spacing as spacing2,
|
|
11265
|
-
useI18nContext as
|
|
11317
|
+
useI18nContext as useI18nContext5
|
|
11266
11318
|
} from "@procore/core-react";
|
|
11267
|
-
import { useToastAlertContext } from "@procore/toast-alert";
|
|
11268
|
-
import
|
|
11319
|
+
import { useToastAlertContext as useToastAlertContext2 } from "@procore/toast-alert";
|
|
11320
|
+
import React16 from "react";
|
|
11321
|
+
|
|
11322
|
+
// ../../node_modules/@procore/core-http/dist/modern/index.js
|
|
11323
|
+
function getCSRFToken() {
|
|
11324
|
+
const token = document.cookie.match("(^|;)\\s*csrf_token\\s*=\\s*([^;]+)");
|
|
11325
|
+
return token ? decodeURIComponent(token.pop() || "") : "";
|
|
11326
|
+
}
|
|
11327
|
+
function getCSRFHeader() {
|
|
11328
|
+
const csrfToken = getCSRFToken();
|
|
11329
|
+
return csrfToken ? { "X-CSRF-TOKEN": csrfToken } : {};
|
|
11330
|
+
}
|
|
11331
|
+
function removeLeadingSlash(url) {
|
|
11332
|
+
return url.startsWith("/") ? url.substring(1, url.length) : url;
|
|
11333
|
+
}
|
|
11334
|
+
function removeTrailingSlash(url) {
|
|
11335
|
+
return url.endsWith("/") ? url.substring(0, url.length - 1) : url;
|
|
11336
|
+
}
|
|
11337
|
+
function applyBaseUrl(url, baseUrl) {
|
|
11338
|
+
return `${removeTrailingSlash(baseUrl)}/${removeLeadingSlash(url)}`;
|
|
11339
|
+
}
|
|
11340
|
+
function getOptions({ headers, ...options }) {
|
|
11341
|
+
const opts = {
|
|
11342
|
+
credentials: "same-origin",
|
|
11343
|
+
headers: {
|
|
11344
|
+
...getCSRFHeader(),
|
|
11345
|
+
...headers
|
|
11346
|
+
},
|
|
11347
|
+
mode: "same-origin",
|
|
11348
|
+
...options
|
|
11349
|
+
};
|
|
11350
|
+
return opts;
|
|
11351
|
+
}
|
|
11352
|
+
function getUrl(url, baseUrl) {
|
|
11353
|
+
return baseUrl ? applyBaseUrl(url, baseUrl) : url;
|
|
11354
|
+
}
|
|
11355
|
+
function request(url, { baseUrl, ...options } = {}) {
|
|
11356
|
+
return fetch(getUrl(url, baseUrl), getOptions(options));
|
|
11357
|
+
}
|
|
11358
|
+
function requestJSON(url, requestParams = {}) {
|
|
11359
|
+
return request(url, requestParams).then(
|
|
11360
|
+
(response) => response.json()
|
|
11361
|
+
);
|
|
11362
|
+
}
|
|
11363
|
+
|
|
11364
|
+
// src/utils/Api/queries.ts
|
|
11365
|
+
import { useQuery } from "@tanstack/react-query";
|
|
11366
|
+
|
|
11367
|
+
// src/utils/Api/queriesHandler.ts
|
|
11368
|
+
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
11369
|
+
import { useI18nContext as useI18nContext3 } from "@procore/core-react";
|
|
11370
|
+
var useApiRequest = (props, method, mutationKey) => {
|
|
11371
|
+
const { projectId, companyId, domain, tableName } = props;
|
|
11372
|
+
const queryClient2 = useQueryClient();
|
|
11373
|
+
const { locale: locale2 } = useI18nContext3();
|
|
11374
|
+
return useMutation({
|
|
11375
|
+
mutationKey,
|
|
11376
|
+
mutationFn: async (savedView) => {
|
|
11377
|
+
let url = "";
|
|
11378
|
+
if (method === "DELETE" || method === "PUT") {
|
|
11379
|
+
url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views/${savedView.id}?permissions_domain=${domain}`;
|
|
11380
|
+
} else {
|
|
11381
|
+
url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views?table_name=${tableName}&permissions_domain=${domain}`;
|
|
11382
|
+
}
|
|
11383
|
+
const response = await requestJSON(url, {
|
|
11384
|
+
method,
|
|
11385
|
+
body: JSON.stringify(savedView),
|
|
11386
|
+
headers: {
|
|
11387
|
+
"Content-Type": "application/json",
|
|
11388
|
+
"Accept-Language": locale2
|
|
11389
|
+
}
|
|
11390
|
+
});
|
|
11391
|
+
if (response.error) {
|
|
11392
|
+
throw response.error;
|
|
11393
|
+
}
|
|
11394
|
+
return response.data;
|
|
11395
|
+
},
|
|
11396
|
+
onSuccess: (savedView) => {
|
|
11397
|
+
if (method === "DELETE" || method === "POST") {
|
|
11398
|
+
queryClient2.invalidateQueries({
|
|
11399
|
+
queryKey: ["savedViews", domain, tableName]
|
|
11400
|
+
});
|
|
11401
|
+
return;
|
|
11402
|
+
} else {
|
|
11403
|
+
const oldData = queryClient2.getQueryData([
|
|
11404
|
+
"savedViews",
|
|
11405
|
+
domain,
|
|
11406
|
+
tableName
|
|
11407
|
+
]);
|
|
11408
|
+
const oldView = oldData?.find((item) => item.id === savedView.id);
|
|
11409
|
+
if (oldView?.name !== savedView.name) {
|
|
11410
|
+
queryClient2.invalidateQueries({
|
|
11411
|
+
queryKey: ["savedViews", domain, tableName]
|
|
11412
|
+
});
|
|
11413
|
+
return;
|
|
11414
|
+
}
|
|
11415
|
+
}
|
|
11416
|
+
queryClient2.setQueryData(
|
|
11417
|
+
["savedViews", domain, tableName],
|
|
11418
|
+
(oldData) => {
|
|
11419
|
+
if (!oldData)
|
|
11420
|
+
return [savedView];
|
|
11421
|
+
return oldData.map(
|
|
11422
|
+
(item) => item.id === savedView.id ? savedView : item
|
|
11423
|
+
);
|
|
11424
|
+
}
|
|
11425
|
+
);
|
|
11426
|
+
}
|
|
11427
|
+
});
|
|
11428
|
+
};
|
|
11269
11429
|
|
|
11270
11430
|
// src/utils/Constants/viewLevels.ts
|
|
11271
11431
|
var VIEW_LEVELS = ["company", "project", "personal"];
|
|
11272
11432
|
|
|
11433
|
+
// src/utils/Api/queries.ts
|
|
11434
|
+
var PAGE_SIZE = 50 * VIEW_LEVELS.length;
|
|
11435
|
+
var useSavedViewsQuery = (props) => {
|
|
11436
|
+
const { projectId, companyId, domain, tableName } = props;
|
|
11437
|
+
const url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views?table_name=${tableName}&permissions_domain=${domain}`;
|
|
11438
|
+
return useQuery({
|
|
11439
|
+
enabled: props.enableSavedViews,
|
|
11440
|
+
queryKey: ["savedViews", domain, tableName],
|
|
11441
|
+
queryFn: async () => {
|
|
11442
|
+
const getUrl2 = `${url}&per_page=${PAGE_SIZE}`;
|
|
11443
|
+
const response = await requestJSON(getUrl2);
|
|
11444
|
+
return response.data;
|
|
11445
|
+
}
|
|
11446
|
+
});
|
|
11447
|
+
};
|
|
11448
|
+
var useSavedViewsPermissions = (props) => {
|
|
11449
|
+
const { projectId, companyId, domain } = props;
|
|
11450
|
+
const url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views/permissions?permissions_domain=${domain}`;
|
|
11451
|
+
return useQuery({
|
|
11452
|
+
enabled: props.enableSavedViews,
|
|
11453
|
+
queryKey: ["savedViewsConfig", domain],
|
|
11454
|
+
queryFn: async () => {
|
|
11455
|
+
const response = await requestJSON(url);
|
|
11456
|
+
return response.data;
|
|
11457
|
+
}
|
|
11458
|
+
});
|
|
11459
|
+
};
|
|
11460
|
+
var useCreateSavedView = (props) => useApiRequest(props, "POST", [
|
|
11461
|
+
"createSavedView",
|
|
11462
|
+
props.domain,
|
|
11463
|
+
props.tableName
|
|
11464
|
+
]);
|
|
11465
|
+
var useUpdateSavedView = (props) => useApiRequest(props, "PUT", [
|
|
11466
|
+
"updateSavedView",
|
|
11467
|
+
props.domain,
|
|
11468
|
+
props.tableName
|
|
11469
|
+
]);
|
|
11470
|
+
var useDeleteSavedView = (props) => useApiRequest(props, "DELETE", [
|
|
11471
|
+
"deleteSavedView",
|
|
11472
|
+
props.domain,
|
|
11473
|
+
props.tableName
|
|
11474
|
+
]);
|
|
11475
|
+
var useFetchSavedViewById = (savedViewId, queryInput, enabled = true) => {
|
|
11476
|
+
const { projectId, companyId } = queryInput;
|
|
11477
|
+
return useQuery({
|
|
11478
|
+
enabled: enabled && Boolean(savedViewId),
|
|
11479
|
+
queryKey: ["savedView", savedViewId],
|
|
11480
|
+
queryFn: async () => {
|
|
11481
|
+
const url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views/${savedViewId}`;
|
|
11482
|
+
const response = await requestJSON(url);
|
|
11483
|
+
return response.data;
|
|
11484
|
+
}
|
|
11485
|
+
});
|
|
11486
|
+
};
|
|
11487
|
+
|
|
11273
11488
|
// src/SavedViews/components/Panels/PanelContentUtils.ts
|
|
11274
11489
|
var import_lodash = __toESM(require_lodash());
|
|
11275
11490
|
|
|
@@ -11284,7 +11499,7 @@ function getSmartGridConfig(api) {
|
|
|
11284
11499
|
columnState: columnStateResult,
|
|
11285
11500
|
rowHeight: rowHeightResult,
|
|
11286
11501
|
columnGroupState: columnGroupStateResult,
|
|
11287
|
-
rowGroupState: rowGroupStateResult
|
|
11502
|
+
rowGroupState: rowGroupStateResult,
|
|
11288
11503
|
filterState: serverFiltersResult
|
|
11289
11504
|
};
|
|
11290
11505
|
return smartGridConfig;
|
|
@@ -11477,17 +11692,17 @@ import {
|
|
|
11477
11692
|
Flex as Flex2,
|
|
11478
11693
|
spacing,
|
|
11479
11694
|
Typography,
|
|
11480
|
-
useI18nContext as
|
|
11695
|
+
useI18nContext as useI18nContext4
|
|
11481
11696
|
} from "@procore/core-react";
|
|
11482
|
-
import
|
|
11697
|
+
import React15 from "react";
|
|
11483
11698
|
var groupIcon = (group) => {
|
|
11484
11699
|
switch (group) {
|
|
11485
11700
|
case "personal":
|
|
11486
|
-
return /* @__PURE__ */
|
|
11701
|
+
return /* @__PURE__ */ React15.createElement(Person_default, null);
|
|
11487
11702
|
case "project":
|
|
11488
|
-
return /* @__PURE__ */
|
|
11703
|
+
return /* @__PURE__ */ React15.createElement(Excavator_default, null);
|
|
11489
11704
|
case "company":
|
|
11490
|
-
return /* @__PURE__ */
|
|
11705
|
+
return /* @__PURE__ */ React15.createElement(Building_default, null);
|
|
11491
11706
|
}
|
|
11492
11707
|
};
|
|
11493
11708
|
var Header = styled_components_esm_default(Flex2)`
|
|
@@ -11497,8 +11712,8 @@ var Header = styled_components_esm_default(Flex2)`
|
|
|
11497
11712
|
}
|
|
11498
11713
|
`;
|
|
11499
11714
|
var ViewLevelHeader = ({ expanded, toggleGroup, group }) => {
|
|
11500
|
-
const I18n =
|
|
11501
|
-
return /* @__PURE__ */
|
|
11715
|
+
const I18n = useI18nContext4();
|
|
11716
|
+
return /* @__PURE__ */ React15.createElement(
|
|
11502
11717
|
Header,
|
|
11503
11718
|
{
|
|
11504
11719
|
alignItems: "center",
|
|
@@ -11507,9 +11722,9 @@ var ViewLevelHeader = ({ expanded, toggleGroup, group }) => {
|
|
|
11507
11722
|
style: { cursor: "pointer" },
|
|
11508
11723
|
onClick: () => toggleGroup(group)
|
|
11509
11724
|
},
|
|
11510
|
-
expanded ? /* @__PURE__ */
|
|
11725
|
+
expanded ? /* @__PURE__ */ React15.createElement(ChevronDown_default, { size: "sm" }) : /* @__PURE__ */ React15.createElement(ChevronRight_default, { size: "sm" }),
|
|
11511
11726
|
groupIcon(group),
|
|
11512
|
-
/* @__PURE__ */
|
|
11727
|
+
/* @__PURE__ */ React15.createElement(Typography, { weight: "semibold" }, I18n.t(`savedViews.viewLevel.${group}`))
|
|
11513
11728
|
);
|
|
11514
11729
|
};
|
|
11515
11730
|
var ViewLevelHeader_default = ViewLevelHeader;
|
|
@@ -11544,21 +11759,19 @@ var Panel2 = styled_components_esm_default(DetailPage.Card)`
|
|
|
11544
11759
|
box-shadow: none;
|
|
11545
11760
|
`;
|
|
11546
11761
|
var PanelContent = (props) => {
|
|
11547
|
-
const { showToast } =
|
|
11548
|
-
const I18n =
|
|
11549
|
-
const {
|
|
11550
|
-
const {
|
|
11551
|
-
const
|
|
11552
|
-
|
|
11553
|
-
)
|
|
11554
|
-
const errorToastRef = React15.useRef(null);
|
|
11555
|
-
React15.useEffect(() => {
|
|
11762
|
+
const { showToast } = useToastAlertContext2();
|
|
11763
|
+
const I18n = useI18nContext5();
|
|
11764
|
+
const { mutate: updateSavedView, isPending: isUpdateLoading } = useUpdateSavedView(props.queryInput);
|
|
11765
|
+
const { data: savedViewsFromQuery, error: savedViewsError } = useSavedViewsQuery(props.queryInput);
|
|
11766
|
+
const savedViews = props.savedViews ?? savedViewsFromQuery;
|
|
11767
|
+
const errorToastRef = React16.useRef(null);
|
|
11768
|
+
React16.useEffect(() => {
|
|
11556
11769
|
if (savedViewsError && savedViewsError !== errorToastRef.current) {
|
|
11557
11770
|
showToast.error(I18n.t("savedViews.errors.fetch"));
|
|
11558
11771
|
errorToastRef.current = savedViewsError;
|
|
11559
11772
|
}
|
|
11560
|
-
}, [savedViewsError]);
|
|
11561
|
-
const { data: permissions } =
|
|
11773
|
+
}, [savedViewsError, showToast, I18n]);
|
|
11774
|
+
const { data: permissions } = useSavedViewsPermissions(props.queryInput);
|
|
11562
11775
|
const selectedRowRef = useScrollToRef(savedViews);
|
|
11563
11776
|
const onUpdate = (data) => {
|
|
11564
11777
|
const newSavedView = {
|
|
@@ -11579,14 +11792,30 @@ var PanelContent = (props) => {
|
|
|
11579
11792
|
};
|
|
11580
11793
|
const { groups, toggleGroup } = useGroups();
|
|
11581
11794
|
const isDefaultSelected = props.selectedSavedView?.id === "default";
|
|
11582
|
-
|
|
11795
|
+
const isTemporarySelected = props.selectedSavedView?.id === "temporary";
|
|
11796
|
+
const temporaryView = savedViews?.find((view) => view.id === "temporary");
|
|
11797
|
+
return /* @__PURE__ */ React16.createElement(Panel2, { "data-testid": "inner-panel" }, /* @__PURE__ */ React16.createElement(Flex3, { direction: "column", style: { height: "100%", width: "100%" } }, temporaryView && /* @__PURE__ */ React16.createElement(
|
|
11798
|
+
Row,
|
|
11799
|
+
{
|
|
11800
|
+
selected: isTemporarySelected,
|
|
11801
|
+
onClick: () => props.onSelect({ item: temporaryView }),
|
|
11802
|
+
ref: isTemporarySelected ? selectedRowRef : null
|
|
11803
|
+
},
|
|
11804
|
+
/* @__PURE__ */ React16.createElement(
|
|
11805
|
+
SavedViewCollectionMenuItem,
|
|
11806
|
+
{
|
|
11807
|
+
item: temporaryView,
|
|
11808
|
+
selected: isTemporarySelected
|
|
11809
|
+
}
|
|
11810
|
+
)
|
|
11811
|
+
), /* @__PURE__ */ React16.createElement(
|
|
11583
11812
|
Row,
|
|
11584
11813
|
{
|
|
11585
11814
|
selected: isDefaultSelected,
|
|
11586
11815
|
onClick: () => props.onSelect({ item: props.defaultView }),
|
|
11587
11816
|
ref: isDefaultSelected ? selectedRowRef : null
|
|
11588
11817
|
},
|
|
11589
|
-
/* @__PURE__ */
|
|
11818
|
+
/* @__PURE__ */ React16.createElement(
|
|
11590
11819
|
SavedViewCollectionMenuItem,
|
|
11591
11820
|
{
|
|
11592
11821
|
item: props.defaultView,
|
|
@@ -11595,8 +11824,10 @@ var PanelContent = (props) => {
|
|
|
11595
11824
|
)
|
|
11596
11825
|
), VIEW_LEVELS.map((level) => {
|
|
11597
11826
|
const isExpanded = groups[level];
|
|
11598
|
-
const views = isExpanded && savedViews ? savedViews.filter(
|
|
11599
|
-
|
|
11827
|
+
const views = isExpanded && savedViews ? savedViews.filter(
|
|
11828
|
+
(view) => view.view_level === level && view.id !== "temporary"
|
|
11829
|
+
) : [];
|
|
11830
|
+
return /* @__PURE__ */ React16.createElement(React16.Fragment, { key: level }, /* @__PURE__ */ React16.createElement(
|
|
11600
11831
|
ViewLevelHeader_default,
|
|
11601
11832
|
{
|
|
11602
11833
|
group: level,
|
|
@@ -11612,7 +11843,7 @@ var PanelContent = (props) => {
|
|
|
11612
11843
|
props.provider
|
|
11613
11844
|
);
|
|
11614
11845
|
const canEditOrDelete = isSelected && hasPermissionForViewLevel(view.view_level, permissions);
|
|
11615
|
-
return /* @__PURE__ */
|
|
11846
|
+
return /* @__PURE__ */ React16.createElement(
|
|
11616
11847
|
Row,
|
|
11617
11848
|
{
|
|
11618
11849
|
key: view.id,
|
|
@@ -11623,7 +11854,7 @@ var PanelContent = (props) => {
|
|
|
11623
11854
|
},
|
|
11624
11855
|
ref: isSelected ? selectedRowRef : null
|
|
11625
11856
|
},
|
|
11626
|
-
/* @__PURE__ */
|
|
11857
|
+
/* @__PURE__ */ React16.createElement(
|
|
11627
11858
|
SavedViewCollectionMenuItem,
|
|
11628
11859
|
{
|
|
11629
11860
|
item: view,
|
|
@@ -11644,12 +11875,12 @@ var PanelContent = (props) => {
|
|
|
11644
11875
|
};
|
|
11645
11876
|
|
|
11646
11877
|
// src/SavedViews/components/SavedViews/SmartGrid/SmartGridSavedViews.tsx
|
|
11647
|
-
import
|
|
11878
|
+
import React23 from "react";
|
|
11648
11879
|
|
|
11649
11880
|
// src/SavedViews/components/SavedViews/SmartGrid/SmartGridDefaultSavedView.tsx
|
|
11650
|
-
import { useI18nContext as
|
|
11881
|
+
import { useI18nContext as useI18nContext6 } from "@procore/core-react";
|
|
11651
11882
|
var useDefaultViewName = (domain, defaultViewName) => {
|
|
11652
|
-
const i18n =
|
|
11883
|
+
const i18n = useI18nContext6();
|
|
11653
11884
|
return defaultViewName || i18n.t(domain, {
|
|
11654
11885
|
scope: "savedViews.defaultViewTitle",
|
|
11655
11886
|
defaultValue: "Default View"
|
|
@@ -11706,13 +11937,13 @@ var useSmartGridConfig = (gridApi) => {
|
|
|
11706
11937
|
// src/SavedViews/components/SavedViews/SavedViews.tsx
|
|
11707
11938
|
import {
|
|
11708
11939
|
Box as Box2,
|
|
11709
|
-
Button as
|
|
11940
|
+
Button as Button6,
|
|
11710
11941
|
Flex as Flex5,
|
|
11711
11942
|
Panel as Panel3,
|
|
11712
11943
|
Tooltip,
|
|
11713
|
-
useI18nContext as
|
|
11944
|
+
useI18nContext as useI18nContext11
|
|
11714
11945
|
} from "@procore/core-react";
|
|
11715
|
-
import
|
|
11946
|
+
import React22 from "react";
|
|
11716
11947
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
11717
11948
|
|
|
11718
11949
|
// src/SavedViews/components/SavedViewsModals/SavedViewsDeleteConfirmationModalShared.tsx
|
|
@@ -11721,16 +11952,16 @@ import {
|
|
|
11721
11952
|
ConfirmModal,
|
|
11722
11953
|
Modal,
|
|
11723
11954
|
P as P2,
|
|
11724
|
-
useI18nContext as
|
|
11955
|
+
useI18nContext as useI18nContext7
|
|
11725
11956
|
} from "@procore/core-react";
|
|
11726
|
-
import
|
|
11957
|
+
import React17 from "react";
|
|
11727
11958
|
var SavedViewsDeleteConfirmationModalShared = ({
|
|
11728
11959
|
onCancel,
|
|
11729
11960
|
onDelete,
|
|
11730
11961
|
open
|
|
11731
11962
|
}) => {
|
|
11732
|
-
const i18n =
|
|
11733
|
-
return /* @__PURE__ */
|
|
11963
|
+
const i18n = useI18nContext7();
|
|
11964
|
+
return /* @__PURE__ */ React17.createElement(
|
|
11734
11965
|
ConfirmModal,
|
|
11735
11966
|
{
|
|
11736
11967
|
"data-testid": "delete-confirmation-modal",
|
|
@@ -11740,13 +11971,13 @@ var SavedViewsDeleteConfirmationModalShared = ({
|
|
|
11740
11971
|
onClose: onCancel,
|
|
11741
11972
|
style: { overflowWrap: "anywhere" }
|
|
11742
11973
|
},
|
|
11743
|
-
/* @__PURE__ */
|
|
11744
|
-
/* @__PURE__ */
|
|
11974
|
+
/* @__PURE__ */ React17.createElement(Modal.Body, null, /* @__PURE__ */ React17.createElement(P2, null, i18n.t("savedViews.modal.delete.description"))),
|
|
11975
|
+
/* @__PURE__ */ React17.createElement(Modal.Footer, null, /* @__PURE__ */ React17.createElement(Modal.FooterButtons, null, /* @__PURE__ */ React17.createElement(Button3, { variant: "secondary", onClick: onCancel }, i18n.t("savedViews.actions.cancel")), /* @__PURE__ */ React17.createElement(Button3, { variant: "primary", onClick: onDelete }, i18n.t("savedViews.actions.delete"))))
|
|
11745
11976
|
);
|
|
11746
11977
|
};
|
|
11747
11978
|
|
|
11748
11979
|
// src/SavedViews/components/SavedViewsModals/SavedViewsFormModal.tsx
|
|
11749
|
-
import
|
|
11980
|
+
import React19 from "react";
|
|
11750
11981
|
|
|
11751
11982
|
// src/SavedViews/components/SavedViewsModals/SavedViewsCreateUpdateModalBase.tsx
|
|
11752
11983
|
import {
|
|
@@ -11760,9 +11991,9 @@ import {
|
|
|
11760
11991
|
Modal as Modal2,
|
|
11761
11992
|
spacing as spacing3,
|
|
11762
11993
|
Typography as Typography2,
|
|
11763
|
-
useI18nContext as
|
|
11994
|
+
useI18nContext as useI18nContext8
|
|
11764
11995
|
} from "@procore/core-react";
|
|
11765
|
-
import * as
|
|
11996
|
+
import * as React18 from "react";
|
|
11766
11997
|
|
|
11767
11998
|
// ../../node_modules/yup/index.esm.js
|
|
11768
11999
|
var import_property_expr = __toESM(require_property_expr());
|
|
@@ -14090,7 +14321,6 @@ function extractMessage(error, I18n) {
|
|
|
14090
14321
|
}
|
|
14091
14322
|
|
|
14092
14323
|
// src/SavedViews/components/SavedViewsModals/SavedViewsCreateUpdateModalBase.tsx
|
|
14093
|
-
var { useEffect: useEffect3, useRef: useRef2 } = React17;
|
|
14094
14324
|
var ScrollContainer = styled_components_esm_default("div")`
|
|
14095
14325
|
overflow: auto;
|
|
14096
14326
|
`;
|
|
@@ -14108,38 +14338,22 @@ var SavedViewsCreateUpdateModalBase = ({
|
|
|
14108
14338
|
selectedSavedView,
|
|
14109
14339
|
setSelectedSavedView,
|
|
14110
14340
|
setOpenEditCreateModal,
|
|
14111
|
-
onSelect
|
|
14112
|
-
backend
|
|
14341
|
+
onSelect
|
|
14113
14342
|
}) => {
|
|
14114
|
-
const I18n =
|
|
14343
|
+
const I18n = useI18nContext8();
|
|
14115
14344
|
const NAME_MAX_LENGTH = 150;
|
|
14116
|
-
const originalBodyWidth = useRef2("");
|
|
14117
|
-
useEffect3(() => {
|
|
14118
|
-
if (open) {
|
|
14119
|
-
originalBodyWidth.current = document.body.style.width || "";
|
|
14120
|
-
document.body.style.width = "100%";
|
|
14121
|
-
} else {
|
|
14122
|
-
document.body.style.width = originalBodyWidth.current;
|
|
14123
|
-
}
|
|
14124
|
-
return () => {
|
|
14125
|
-
if (originalBodyWidth.current !== void 0) {
|
|
14126
|
-
document.body.style.width = originalBodyWidth.current;
|
|
14127
|
-
}
|
|
14128
|
-
};
|
|
14129
|
-
}, [open]);
|
|
14130
|
-
const { useCreateSavedView: useCreateSavedView2, useUpdateSavedView: useUpdateSavedView2, useSavedViewsPermissions: useSavedViewsPermissions2 } = backend;
|
|
14131
14345
|
const {
|
|
14132
14346
|
mutate: createSavedView,
|
|
14133
14347
|
isPending: isCreating,
|
|
14134
14348
|
error: createError,
|
|
14135
14349
|
reset: resetCreateMutation
|
|
14136
|
-
} =
|
|
14350
|
+
} = useCreateSavedView(queryInput);
|
|
14137
14351
|
const {
|
|
14138
14352
|
mutate: updateSavedView,
|
|
14139
14353
|
isPending: isUpdating,
|
|
14140
14354
|
error: updateError,
|
|
14141
14355
|
reset: resetUpdateMutation
|
|
14142
|
-
} =
|
|
14356
|
+
} = useUpdateSavedView(queryInput);
|
|
14143
14357
|
const resetMutations = () => {
|
|
14144
14358
|
resetCreateMutation();
|
|
14145
14359
|
resetUpdateMutation();
|
|
@@ -14148,7 +14362,7 @@ var SavedViewsCreateUpdateModalBase = ({
|
|
|
14148
14362
|
resetMutations();
|
|
14149
14363
|
onCancel();
|
|
14150
14364
|
};
|
|
14151
|
-
const { data: permissions } =
|
|
14365
|
+
const { data: permissions } = useSavedViewsPermissions(queryInput);
|
|
14152
14366
|
const isLoading = isCreating || isUpdating;
|
|
14153
14367
|
const errors = extractMessage(createError || updateError, I18n);
|
|
14154
14368
|
const handleOnSubmit = (data) => {
|
|
@@ -14180,7 +14394,7 @@ var SavedViewsCreateUpdateModalBase = ({
|
|
|
14180
14394
|
}
|
|
14181
14395
|
};
|
|
14182
14396
|
const viewLevelOptions = getViewLevelOptions(permissions, I18n);
|
|
14183
|
-
return /* @__PURE__ */
|
|
14397
|
+
return /* @__PURE__ */ React18.createElement(
|
|
14184
14398
|
Modal2,
|
|
14185
14399
|
{
|
|
14186
14400
|
"aria-label": I18n.t("savedViews.ariaLabels.modal"),
|
|
@@ -14189,14 +14403,14 @@ var SavedViewsCreateUpdateModalBase = ({
|
|
|
14189
14403
|
style: { width: "540px" },
|
|
14190
14404
|
"data-testid": "create-update-modal"
|
|
14191
14405
|
},
|
|
14192
|
-
/* @__PURE__ */
|
|
14406
|
+
/* @__PURE__ */ React18.createElement(ScrollContainer, null, /* @__PURE__ */ React18.createElement(
|
|
14193
14407
|
Modal2.Header,
|
|
14194
14408
|
{
|
|
14195
14409
|
onClose,
|
|
14196
14410
|
style: { borderBottom: `1px solid ${colors3.gray85}` }
|
|
14197
14411
|
},
|
|
14198
|
-
/* @__PURE__ */
|
|
14199
|
-
), /* @__PURE__ */
|
|
14412
|
+
/* @__PURE__ */ React18.createElement(H2, null, header)
|
|
14413
|
+
), /* @__PURE__ */ React18.createElement(
|
|
14200
14414
|
Form,
|
|
14201
14415
|
{
|
|
14202
14416
|
initialValues: {
|
|
@@ -14222,13 +14436,13 @@ var SavedViewsCreateUpdateModalBase = ({
|
|
|
14222
14436
|
onReset: onCancel,
|
|
14223
14437
|
validateOnChange: true
|
|
14224
14438
|
},
|
|
14225
|
-
/* @__PURE__ */
|
|
14439
|
+
/* @__PURE__ */ React18.createElement(Form.Form, { name: header }, /* @__PURE__ */ React18.createElement(
|
|
14226
14440
|
Modal2.Body,
|
|
14227
14441
|
{
|
|
14228
14442
|
style: { paddingTop: 0, paddingBottom: 0, marginTop: spacing3.lg }
|
|
14229
14443
|
},
|
|
14230
|
-
errors && /* @__PURE__ */
|
|
14231
|
-
/* @__PURE__ */
|
|
14444
|
+
errors && /* @__PURE__ */ React18.createElement(ErrorBanner, { style: { marginBottom: spacing3.xl } }, /* @__PURE__ */ React18.createElement(Banner.Content, null, /* @__PURE__ */ React18.createElement(Banner.Title, null, I18n.t("savedViews.modal.errors.title", { mode })), /* @__PURE__ */ React18.createElement(Banner.Body, null, errors?.form || I18n.t(`savedViews.modal.errors.description.${mode}`)))),
|
|
14445
|
+
/* @__PURE__ */ React18.createElement(Form.Row, null, /* @__PURE__ */ React18.createElement(
|
|
14232
14446
|
Form.Text,
|
|
14233
14447
|
{
|
|
14234
14448
|
name: "name",
|
|
@@ -14239,12 +14453,12 @@ var SavedViewsCreateUpdateModalBase = ({
|
|
|
14239
14453
|
onChange: () => resetMutations()
|
|
14240
14454
|
}
|
|
14241
14455
|
)),
|
|
14242
|
-
/* @__PURE__ */
|
|
14456
|
+
/* @__PURE__ */ React18.createElement(
|
|
14243
14457
|
Form.Row,
|
|
14244
14458
|
{
|
|
14245
14459
|
style: { marginTop: errors?.name ? spacing3.xl : spacing3.none }
|
|
14246
14460
|
},
|
|
14247
|
-
/* @__PURE__ */
|
|
14461
|
+
/* @__PURE__ */ React18.createElement(
|
|
14248
14462
|
Form.TextArea,
|
|
14249
14463
|
{
|
|
14250
14464
|
name: "description",
|
|
@@ -14255,19 +14469,18 @@ var SavedViewsCreateUpdateModalBase = ({
|
|
|
14255
14469
|
}
|
|
14256
14470
|
)
|
|
14257
14471
|
),
|
|
14258
|
-
viewLevelOptions.length > 1 && mode === "create" /* CREATE */ ? /* @__PURE__ */
|
|
14472
|
+
viewLevelOptions.length > 1 && mode === "create" /* CREATE */ ? /* @__PURE__ */ React18.createElement(Form.Row, null, /* @__PURE__ */ React18.createElement(
|
|
14259
14473
|
Form.Select,
|
|
14260
14474
|
{
|
|
14261
14475
|
name: "view_level",
|
|
14262
|
-
qa: { label: "view-level" },
|
|
14263
14476
|
options: viewLevelOptions,
|
|
14264
14477
|
label: I18n.t("savedViews.modal.fields.viewLevel"),
|
|
14265
14478
|
colWidth: 12,
|
|
14266
14479
|
onSearch: false,
|
|
14267
14480
|
onClear: false
|
|
14268
14481
|
}
|
|
14269
|
-
)) : /* @__PURE__ */
|
|
14270
|
-
), /* @__PURE__ */
|
|
14482
|
+
)) : /* @__PURE__ */ React18.createElement(React18.Fragment, null)
|
|
14483
|
+
), /* @__PURE__ */ React18.createElement(Modal2.Footer, { style: { borderTop: `1px solid ${colors3.gray85}` } }, /* @__PURE__ */ React18.createElement(Flex4, { grow: "1", justifyContent: "space-between", alignItems: "center" }, /* @__PURE__ */ React18.createElement(Typography2, { color: "gray45", italic: true }, /* @__PURE__ */ React18.createElement(Typography2, { color: "red45" }, "*"), " ", I18n.t("savedViews.modal.info.required_fields")), /* @__PURE__ */ React18.createElement(Modal2.FooterButtons, null, /* @__PURE__ */ React18.createElement(Button4, { type: "reset", variant: "tertiary", disabled: isLoading }, I18n.t("savedViews.actions.cancel")), /* @__PURE__ */ React18.createElement(
|
|
14271
14484
|
Button4,
|
|
14272
14485
|
{
|
|
14273
14486
|
"data-testid": "create-update-modal-button",
|
|
@@ -14283,7 +14496,7 @@ var SavedViewsCreateUpdateModalBase = ({
|
|
|
14283
14496
|
};
|
|
14284
14497
|
|
|
14285
14498
|
// src/SavedViews/components/SavedViewsModals/SavedViewsFormModal.tsx
|
|
14286
|
-
import { useI18nContext as
|
|
14499
|
+
import { useI18nContext as useI18nContext9 } from "@procore/core-react";
|
|
14287
14500
|
var SavedViewsFormModal = ({
|
|
14288
14501
|
open,
|
|
14289
14502
|
mode,
|
|
@@ -14295,11 +14508,10 @@ var SavedViewsFormModal = ({
|
|
|
14295
14508
|
setSelectedSavedView,
|
|
14296
14509
|
setOpenEditCreateModal,
|
|
14297
14510
|
onSelect,
|
|
14298
|
-
defaultView
|
|
14299
|
-
backend
|
|
14511
|
+
defaultView
|
|
14300
14512
|
}) => {
|
|
14301
|
-
const i18n =
|
|
14302
|
-
return /* @__PURE__ */
|
|
14513
|
+
const i18n = useI18nContext9();
|
|
14514
|
+
return /* @__PURE__ */ React19.createElement(
|
|
14303
14515
|
SavedViewsCreateUpdateModalBase,
|
|
14304
14516
|
{
|
|
14305
14517
|
open,
|
|
@@ -14315,169 +14527,276 @@ var SavedViewsFormModal = ({
|
|
|
14315
14527
|
setSelectedSavedView,
|
|
14316
14528
|
setOpenEditCreateModal,
|
|
14317
14529
|
onSelect,
|
|
14318
|
-
defaultView
|
|
14319
|
-
backend
|
|
14530
|
+
defaultView
|
|
14320
14531
|
}
|
|
14321
14532
|
);
|
|
14322
14533
|
};
|
|
14323
14534
|
|
|
14324
|
-
//
|
|
14325
|
-
|
|
14326
|
-
|
|
14327
|
-
|
|
14328
|
-
|
|
14329
|
-
|
|
14330
|
-
|
|
14331
|
-
return csrfToken ? { "X-CSRF-TOKEN": csrfToken } : {};
|
|
14332
|
-
}
|
|
14333
|
-
function removeLeadingSlash(url) {
|
|
14334
|
-
return url.startsWith("/") ? url.substring(1, url.length) : url;
|
|
14335
|
-
}
|
|
14336
|
-
function removeTrailingSlash(url) {
|
|
14337
|
-
return url.endsWith("/") ? url.substring(0, url.length - 1) : url;
|
|
14338
|
-
}
|
|
14339
|
-
function applyBaseUrl(url, baseUrl) {
|
|
14340
|
-
return `${removeTrailingSlash(baseUrl)}/${removeLeadingSlash(url)}`;
|
|
14341
|
-
}
|
|
14342
|
-
function getOptions({ headers, ...options }) {
|
|
14343
|
-
const opts = {
|
|
14344
|
-
credentials: "same-origin",
|
|
14345
|
-
headers: {
|
|
14346
|
-
...getCSRFHeader(),
|
|
14347
|
-
...headers
|
|
14348
|
-
},
|
|
14349
|
-
mode: "same-origin",
|
|
14350
|
-
...options
|
|
14535
|
+
// src/SavedViews/components/SavedViewsModals/CopyViewConfirmationModal.tsx
|
|
14536
|
+
import { Button as Button5, Modal as Modal3, P as P3, useI18nContext as useI18nContext10 } from "@procore/core-react";
|
|
14537
|
+
import React20 from "react";
|
|
14538
|
+
var CreateViewConfirmationModal = ({ open, savedViewName, onClose, onViewTemporarily, onCreateView }) => {
|
|
14539
|
+
const i18n = useI18nContext10();
|
|
14540
|
+
const handleViewTemporarily = () => {
|
|
14541
|
+
onViewTemporarily?.();
|
|
14351
14542
|
};
|
|
14352
|
-
|
|
14353
|
-
|
|
14354
|
-
|
|
14355
|
-
return
|
|
14356
|
-
|
|
14357
|
-
|
|
14358
|
-
|
|
14359
|
-
|
|
14360
|
-
|
|
14361
|
-
|
|
14362
|
-
(
|
|
14543
|
+
const handleCreateView = () => {
|
|
14544
|
+
onCreateView?.();
|
|
14545
|
+
};
|
|
14546
|
+
return /* @__PURE__ */ React20.createElement(
|
|
14547
|
+
Modal3,
|
|
14548
|
+
{
|
|
14549
|
+
"data-testid": "create-view-confirmation-modal",
|
|
14550
|
+
open,
|
|
14551
|
+
onClickOverlay: onClose
|
|
14552
|
+
},
|
|
14553
|
+
/* @__PURE__ */ React20.createElement(Modal3.Header, { onClose }, i18n.t("savedViews.modal.copyConfirmation.headline", {
|
|
14554
|
+
savedViewName
|
|
14555
|
+
})),
|
|
14556
|
+
/* @__PURE__ */ React20.createElement(Modal3.Body, null, /* @__PURE__ */ React20.createElement(P3, null, i18n.t("savedViews.modal.copyConfirmation.description"))),
|
|
14557
|
+
/* @__PURE__ */ React20.createElement(Modal3.Footer, null, /* @__PURE__ */ React20.createElement(Modal3.FooterButtons, null, /* @__PURE__ */ React20.createElement(
|
|
14558
|
+
Button5,
|
|
14559
|
+
{
|
|
14560
|
+
variant: "secondary",
|
|
14561
|
+
onClick: handleViewTemporarily,
|
|
14562
|
+
"data-testid": "view-temporarily-button"
|
|
14563
|
+
},
|
|
14564
|
+
i18n.t("savedViews.actions.viewTemporarily")
|
|
14565
|
+
), /* @__PURE__ */ React20.createElement(
|
|
14566
|
+
Button5,
|
|
14567
|
+
{
|
|
14568
|
+
variant: "primary",
|
|
14569
|
+
onClick: handleCreateView,
|
|
14570
|
+
"data-testid": "create-view-button"
|
|
14571
|
+
},
|
|
14572
|
+
i18n.t("savedViews.actions.createView")
|
|
14573
|
+
)))
|
|
14363
14574
|
);
|
|
14364
|
-
}
|
|
14575
|
+
};
|
|
14365
14576
|
|
|
14366
|
-
// src/utils/
|
|
14367
|
-
import {
|
|
14577
|
+
// src/utils/Hooks/useViewSelection.ts
|
|
14578
|
+
import { useState as useState4, useCallback as useCallback2 } from "react";
|
|
14368
14579
|
|
|
14369
|
-
// src/utils/
|
|
14370
|
-
import {
|
|
14371
|
-
import {
|
|
14372
|
-
var
|
|
14373
|
-
const
|
|
14374
|
-
const
|
|
14375
|
-
|
|
14376
|
-
|
|
14377
|
-
|
|
14378
|
-
mutationFn: async (savedView) => {
|
|
14379
|
-
let url = "";
|
|
14380
|
-
if (method === "DELETE" || method === "PUT") {
|
|
14381
|
-
url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views/${savedView.id}?permissions_domain=${domain}`;
|
|
14382
|
-
} else {
|
|
14383
|
-
url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views?table_name=${tableName}&permissions_domain=${domain}`;
|
|
14580
|
+
// src/utils/Hooks/useUrlSync.ts
|
|
14581
|
+
import { useEffect as useEffect3 } from "react";
|
|
14582
|
+
import { useSearchParams } from "react-router-dom";
|
|
14583
|
+
var useUrlSync = (selectedView, availableViews, defaultView, onViewFound, onViewNotFound) => {
|
|
14584
|
+
const [searchParams, setSearchParams] = useSearchParams();
|
|
14585
|
+
const applySavedViewFromUrl = (savedViewId) => {
|
|
14586
|
+
if (savedViewId === "default") {
|
|
14587
|
+
if (defaultView.id !== selectedView?.id) {
|
|
14588
|
+
onViewFound(defaultView);
|
|
14384
14589
|
}
|
|
14385
|
-
|
|
14386
|
-
|
|
14387
|
-
|
|
14388
|
-
|
|
14389
|
-
|
|
14390
|
-
|
|
14391
|
-
}
|
|
14392
|
-
});
|
|
14393
|
-
if (response.error) {
|
|
14394
|
-
throw response.error;
|
|
14395
|
-
}
|
|
14396
|
-
return response.data;
|
|
14397
|
-
},
|
|
14398
|
-
onSuccess: (savedView) => {
|
|
14399
|
-
if (method === "DELETE" || method === "POST") {
|
|
14400
|
-
queryClient2.invalidateQueries({
|
|
14401
|
-
queryKey: ["savedViews", domain, tableName]
|
|
14402
|
-
});
|
|
14403
|
-
return;
|
|
14404
|
-
} else {
|
|
14405
|
-
const oldData = queryClient2.getQueryData([
|
|
14406
|
-
"savedViews",
|
|
14407
|
-
domain,
|
|
14408
|
-
tableName
|
|
14409
|
-
]);
|
|
14410
|
-
const oldView = oldData?.find((item) => item.id === savedView.id);
|
|
14411
|
-
if (oldView?.name !== savedView.name) {
|
|
14412
|
-
queryClient2.invalidateQueries({
|
|
14413
|
-
queryKey: ["savedViews", domain, tableName]
|
|
14414
|
-
});
|
|
14415
|
-
return;
|
|
14416
|
-
}
|
|
14590
|
+
return;
|
|
14591
|
+
}
|
|
14592
|
+
const viewInUserViews = availableViews.find((v2) => v2.id === savedViewId);
|
|
14593
|
+
if (viewInUserViews) {
|
|
14594
|
+
if (viewInUserViews.id !== selectedView?.id) {
|
|
14595
|
+
onViewFound(viewInUserViews);
|
|
14417
14596
|
}
|
|
14418
|
-
|
|
14419
|
-
|
|
14420
|
-
|
|
14421
|
-
|
|
14422
|
-
|
|
14423
|
-
|
|
14424
|
-
|
|
14425
|
-
|
|
14597
|
+
} else {
|
|
14598
|
+
onViewNotFound(savedViewId);
|
|
14599
|
+
}
|
|
14600
|
+
};
|
|
14601
|
+
const applyListView = (viewParam) => {
|
|
14602
|
+
if (viewParam === "list" && defaultView.id !== selectedView?.id) {
|
|
14603
|
+
onViewFound(defaultView);
|
|
14604
|
+
}
|
|
14605
|
+
};
|
|
14606
|
+
useEffect3(() => {
|
|
14607
|
+
if (!availableViews.length)
|
|
14608
|
+
return;
|
|
14609
|
+
const savedViewId = searchParams.get("saved-view");
|
|
14610
|
+
const viewParamFromConsumer = searchParams.get("view");
|
|
14611
|
+
if (savedViewId) {
|
|
14612
|
+
applySavedViewFromUrl(savedViewId);
|
|
14613
|
+
return;
|
|
14614
|
+
}
|
|
14615
|
+
if (viewParamFromConsumer) {
|
|
14616
|
+
applyListView(viewParamFromConsumer);
|
|
14617
|
+
}
|
|
14618
|
+
}, [
|
|
14619
|
+
searchParams,
|
|
14620
|
+
availableViews,
|
|
14621
|
+
defaultView,
|
|
14622
|
+
selectedView,
|
|
14623
|
+
onViewFound,
|
|
14624
|
+
onViewNotFound
|
|
14625
|
+
]);
|
|
14626
|
+
const updateUrl = (view) => {
|
|
14627
|
+
setSearchParams(
|
|
14628
|
+
(currentParams) => {
|
|
14629
|
+
const updatedParams = new URLSearchParams(currentParams);
|
|
14630
|
+
if (view.id === "default") {
|
|
14631
|
+
updatedParams.delete("saved-view");
|
|
14632
|
+
} else {
|
|
14633
|
+
updatedParams.set("saved-view", view.id);
|
|
14426
14634
|
}
|
|
14635
|
+
return updatedParams;
|
|
14636
|
+
},
|
|
14637
|
+
{ replace: true }
|
|
14638
|
+
);
|
|
14639
|
+
};
|
|
14640
|
+
return { updateUrl };
|
|
14641
|
+
};
|
|
14642
|
+
|
|
14643
|
+
// src/utils/Hooks/useViewSelection.ts
|
|
14644
|
+
var useViewSelection = (config, savedViews, openCrossUserModal) => {
|
|
14645
|
+
const [selectedSavedView, setSelectedSavedView] = useState4(() => {
|
|
14646
|
+
try {
|
|
14647
|
+
const savedView = JSON.parse(
|
|
14648
|
+
localStorage.getItem(
|
|
14649
|
+
`${config.domain}_${config.tableName}_${config.stickyViewsKey}_${config.projectId}_${config.userId}`
|
|
14650
|
+
)
|
|
14427
14651
|
);
|
|
14652
|
+
return savedView || config.defaultView;
|
|
14653
|
+
} catch (e2) {
|
|
14654
|
+
return config.defaultView;
|
|
14428
14655
|
}
|
|
14429
14656
|
});
|
|
14657
|
+
const [temporaryView, setTemporaryView] = useState4(null);
|
|
14658
|
+
const createTemporaryView = useCallback2((fetchedView) => {
|
|
14659
|
+
const tempView = {
|
|
14660
|
+
...fetchedView,
|
|
14661
|
+
id: "temporary",
|
|
14662
|
+
name: "Temporary View"
|
|
14663
|
+
};
|
|
14664
|
+
setTemporaryView(tempView);
|
|
14665
|
+
return tempView;
|
|
14666
|
+
}, []);
|
|
14667
|
+
const clearTemporaryView = useCallback2(() => setTemporaryView(null), []);
|
|
14668
|
+
const updateLocalStorage = useCallback2(
|
|
14669
|
+
(view) => {
|
|
14670
|
+
if (config.stickyViewsKey) {
|
|
14671
|
+
localStorage.setItem(
|
|
14672
|
+
`${config.domain}_${config.tableName}_${config.stickyViewsKey}_${config.projectId}_${config.userId}`,
|
|
14673
|
+
JSON.stringify(view)
|
|
14674
|
+
);
|
|
14675
|
+
}
|
|
14676
|
+
},
|
|
14677
|
+
[
|
|
14678
|
+
config.domain,
|
|
14679
|
+
config.tableName,
|
|
14680
|
+
config.stickyViewsKey,
|
|
14681
|
+
config.projectId,
|
|
14682
|
+
config.userId
|
|
14683
|
+
]
|
|
14684
|
+
);
|
|
14685
|
+
const allViews = temporaryView ? [...savedViews ?? [], temporaryView] : savedViews ?? [];
|
|
14686
|
+
const onUrlViewFound = (foundView) => {
|
|
14687
|
+
selectView(foundView);
|
|
14688
|
+
};
|
|
14689
|
+
const onUrlViewNotFound = (viewId) => {
|
|
14690
|
+
if (viewId === selectedSavedView?.id) {
|
|
14691
|
+
return;
|
|
14692
|
+
}
|
|
14693
|
+
openCrossUserModal(viewId);
|
|
14694
|
+
};
|
|
14695
|
+
const { updateUrl } = useUrlSync(
|
|
14696
|
+
selectedSavedView,
|
|
14697
|
+
allViews,
|
|
14698
|
+
config.defaultView,
|
|
14699
|
+
onUrlViewFound,
|
|
14700
|
+
onUrlViewNotFound
|
|
14701
|
+
);
|
|
14702
|
+
const selectView = useCallback2(
|
|
14703
|
+
(view) => {
|
|
14704
|
+
if (view.id !== "temporary" && temporaryView) {
|
|
14705
|
+
clearTemporaryView();
|
|
14706
|
+
}
|
|
14707
|
+
const viewToSelect = config.onSelect({ item: view });
|
|
14708
|
+
setSelectedSavedView(viewToSelect);
|
|
14709
|
+
updateLocalStorage(viewToSelect);
|
|
14710
|
+
updateUrl(viewToSelect);
|
|
14711
|
+
return viewToSelect;
|
|
14712
|
+
},
|
|
14713
|
+
[config, temporaryView, clearTemporaryView, updateLocalStorage, updateUrl]
|
|
14714
|
+
);
|
|
14715
|
+
return {
|
|
14716
|
+
selectedView: selectedSavedView,
|
|
14717
|
+
selectView,
|
|
14718
|
+
updateLocalStorage,
|
|
14719
|
+
temporaryView,
|
|
14720
|
+
createTemporaryView
|
|
14721
|
+
};
|
|
14430
14722
|
};
|
|
14431
14723
|
|
|
14432
|
-
// src/utils/
|
|
14433
|
-
|
|
14434
|
-
var
|
|
14435
|
-
const {
|
|
14436
|
-
|
|
14437
|
-
|
|
14438
|
-
|
|
14439
|
-
|
|
14440
|
-
|
|
14441
|
-
|
|
14442
|
-
|
|
14443
|
-
|
|
14724
|
+
// src/utils/Hooks/useCrossUserSharing.ts
|
|
14725
|
+
import React21 from "react";
|
|
14726
|
+
var useCrossUserSharing = (queryInput, viewId, selectedSavedView, defaultView, actions, tableName) => {
|
|
14727
|
+
const { data: fetchedView, isError: fetchError } = useFetchSavedViewById(
|
|
14728
|
+
viewId,
|
|
14729
|
+
queryInput,
|
|
14730
|
+
Boolean(viewId)
|
|
14731
|
+
);
|
|
14732
|
+
const { mutate: createSavedView } = useCreateSavedView(queryInput);
|
|
14733
|
+
React21.useEffect(() => {
|
|
14734
|
+
if (fetchError && viewId) {
|
|
14735
|
+
actions.selectView(selectedSavedView ?? defaultView);
|
|
14736
|
+
actions.closeModal();
|
|
14737
|
+
}
|
|
14738
|
+
}, [fetchError, viewId, actions, selectedSavedView, defaultView]);
|
|
14739
|
+
const viewSharedViewTemporarily = () => {
|
|
14740
|
+
if (fetchedView) {
|
|
14741
|
+
const tempView = actions.createTemporaryView(fetchedView);
|
|
14742
|
+
actions.selectView(tempView);
|
|
14743
|
+
actions.closeModal();
|
|
14444
14744
|
}
|
|
14445
|
-
}
|
|
14446
|
-
|
|
14447
|
-
|
|
14448
|
-
|
|
14449
|
-
|
|
14450
|
-
|
|
14451
|
-
|
|
14452
|
-
|
|
14453
|
-
|
|
14454
|
-
|
|
14455
|
-
|
|
14745
|
+
};
|
|
14746
|
+
const createPersonalCopyOfSharedView = () => {
|
|
14747
|
+
if (fetchedView) {
|
|
14748
|
+
const viewToCreate = {
|
|
14749
|
+
name: fetchedView.name,
|
|
14750
|
+
description: fetchedView.description,
|
|
14751
|
+
table_name: tableName,
|
|
14752
|
+
table_config: fetchedView.table_config,
|
|
14753
|
+
view_level: "personal"
|
|
14754
|
+
};
|
|
14755
|
+
createSavedView(viewToCreate, {
|
|
14756
|
+
onSuccess: (newView) => {
|
|
14757
|
+
actions.selectView(newView);
|
|
14758
|
+
actions.closeModal();
|
|
14759
|
+
}
|
|
14760
|
+
});
|
|
14456
14761
|
}
|
|
14457
|
-
}
|
|
14762
|
+
};
|
|
14763
|
+
return {
|
|
14764
|
+
fetchedView,
|
|
14765
|
+
viewSharedViewTemporarily,
|
|
14766
|
+
createPersonalCopyOfSharedView
|
|
14767
|
+
};
|
|
14768
|
+
};
|
|
14769
|
+
|
|
14770
|
+
// src/utils/Hooks/useModalState.ts
|
|
14771
|
+
import { useState as useState5, useCallback as useCallback3 } from "react";
|
|
14772
|
+
var useModalState = () => {
|
|
14773
|
+
const [activeModal, setActiveModal] = useState5(null);
|
|
14774
|
+
const [modalData, setModalData] = useState5(null);
|
|
14775
|
+
const openModal = useCallback3(
|
|
14776
|
+
(type, data) => {
|
|
14777
|
+
setActiveModal(type);
|
|
14778
|
+
setModalData(data ?? null);
|
|
14779
|
+
},
|
|
14780
|
+
[]
|
|
14781
|
+
);
|
|
14782
|
+
const closeModal = useCallback3(() => {
|
|
14783
|
+
setActiveModal(null);
|
|
14784
|
+
setModalData(null);
|
|
14785
|
+
}, []);
|
|
14786
|
+
const isModalOpen = useCallback3(
|
|
14787
|
+
(type) => {
|
|
14788
|
+
return activeModal === type;
|
|
14789
|
+
},
|
|
14790
|
+
[activeModal]
|
|
14791
|
+
);
|
|
14792
|
+
return {
|
|
14793
|
+
openModal,
|
|
14794
|
+
closeModal,
|
|
14795
|
+
isModalOpen,
|
|
14796
|
+
modalData,
|
|
14797
|
+
activeModal
|
|
14798
|
+
};
|
|
14458
14799
|
};
|
|
14459
|
-
var useCreateSavedView = (props) => useApiRequest(props, "POST", [
|
|
14460
|
-
"createSavedView",
|
|
14461
|
-
props.domain,
|
|
14462
|
-
props.tableName
|
|
14463
|
-
]);
|
|
14464
|
-
var useUpdateSavedView = (props) => useApiRequest(props, "PUT", [
|
|
14465
|
-
"updateSavedView",
|
|
14466
|
-
props.domain,
|
|
14467
|
-
props.tableName
|
|
14468
|
-
]);
|
|
14469
|
-
var useDeleteSavedView = (props) => useApiRequest(props, "DELETE", [
|
|
14470
|
-
"deleteSavedView",
|
|
14471
|
-
props.domain,
|
|
14472
|
-
props.tableName
|
|
14473
|
-
]);
|
|
14474
|
-
var createQueries = (customBackend) => ({
|
|
14475
|
-
useSavedViewsQuery: customBackend?.useSavedViewsQuery ?? useSavedViewsQuery,
|
|
14476
|
-
useSavedViewsPermissions: customBackend?.useSavedViewsPermissions ?? useSavedViewsPermissions,
|
|
14477
|
-
useCreateSavedView: customBackend?.useCreateSavedView ?? useCreateSavedView,
|
|
14478
|
-
useUpdateSavedView: customBackend?.useUpdateSavedView ?? useUpdateSavedView,
|
|
14479
|
-
useDeleteSavedView: customBackend?.useDeleteSavedView ?? useDeleteSavedView
|
|
14480
|
-
});
|
|
14481
14800
|
|
|
14482
14801
|
// src/SavedViews/components/SavedViews/SavedViews.tsx
|
|
14483
14802
|
var StyledPanel = styled_components_esm_default.div`
|
|
@@ -14493,75 +14812,80 @@ var SavedViewsContent = (props) => {
|
|
|
14493
14812
|
projectId,
|
|
14494
14813
|
companyId
|
|
14495
14814
|
};
|
|
14496
|
-
const
|
|
14497
|
-
const { mutate: deleteSavedView } =
|
|
14498
|
-
const
|
|
14499
|
-
|
|
14500
|
-
|
|
14501
|
-
localStorage.getItem(
|
|
14502
|
-
`${props.domain}_${props.tableName}_${props.stickyViewsKey}_${projectId}_${props.userId}`
|
|
14503
|
-
)
|
|
14504
|
-
);
|
|
14505
|
-
return savedView || props.defaultView;
|
|
14506
|
-
} catch (e2) {
|
|
14507
|
-
return props.defaultView;
|
|
14508
|
-
}
|
|
14509
|
-
});
|
|
14510
|
-
const updateLocalStorage = (view) => {
|
|
14511
|
-
if (props.stickyViewsKey) {
|
|
14512
|
-
localStorage.setItem(
|
|
14513
|
-
`${props.domain}_${props.tableName}_${props.stickyViewsKey}_${projectId}_${props.userId}`,
|
|
14514
|
-
JSON.stringify(view)
|
|
14515
|
-
);
|
|
14516
|
-
}
|
|
14815
|
+
const { data: savedViews } = useSavedViewsQuery(queryInput);
|
|
14816
|
+
const { mutate: deleteSavedView } = useDeleteSavedView(queryInput);
|
|
14817
|
+
const { openModal, closeModal, isModalOpen, modalData, activeModal } = useModalState();
|
|
14818
|
+
const openCrossUserModal = (viewId) => {
|
|
14819
|
+
openModal("crossUser" /* CROSS_USER */, { viewId });
|
|
14517
14820
|
};
|
|
14518
|
-
const
|
|
14519
|
-
|
|
14520
|
-
|
|
14521
|
-
updateLocalStorage
|
|
14522
|
-
|
|
14523
|
-
|
|
14524
|
-
|
|
14525
|
-
|
|
14526
|
-
|
|
14821
|
+
const {
|
|
14822
|
+
selectedView,
|
|
14823
|
+
selectView,
|
|
14824
|
+
updateLocalStorage,
|
|
14825
|
+
temporaryView,
|
|
14826
|
+
createTemporaryView
|
|
14827
|
+
} = useViewSelection(
|
|
14828
|
+
{
|
|
14829
|
+
domain: props.domain,
|
|
14830
|
+
tableName: props.tableName,
|
|
14831
|
+
stickyViewsKey: props.stickyViewsKey,
|
|
14832
|
+
userId: props.userId,
|
|
14833
|
+
projectId,
|
|
14834
|
+
defaultView: props.defaultView,
|
|
14835
|
+
onSelect: props.onSelect
|
|
14836
|
+
},
|
|
14837
|
+
savedViews,
|
|
14838
|
+
openCrossUserModal
|
|
14839
|
+
);
|
|
14840
|
+
const {
|
|
14841
|
+
fetchedView,
|
|
14842
|
+
viewSharedViewTemporarily,
|
|
14843
|
+
createPersonalCopyOfSharedView
|
|
14844
|
+
} = useCrossUserSharing(
|
|
14845
|
+
queryInput,
|
|
14846
|
+
modalData?.viewId ?? null,
|
|
14847
|
+
selectedView,
|
|
14848
|
+
props.defaultView,
|
|
14849
|
+
{
|
|
14850
|
+
selectView,
|
|
14851
|
+
createTemporaryView,
|
|
14852
|
+
closeModal
|
|
14853
|
+
},
|
|
14854
|
+
props.tableName
|
|
14855
|
+
);
|
|
14856
|
+
const deleteSelectedView = () => {
|
|
14857
|
+
if (selectedView) {
|
|
14858
|
+
deleteSavedView(selectedView, {
|
|
14859
|
+
onSuccess: () => selectView(props.defaultView)
|
|
14527
14860
|
});
|
|
14528
14861
|
}
|
|
14529
14862
|
};
|
|
14530
|
-
const
|
|
14531
|
-
|
|
14532
|
-
|
|
14533
|
-
const [editCreateModalType, setEditCreateModalType] = useState4(
|
|
14534
|
-
"create" /* CREATE */
|
|
14535
|
-
);
|
|
14536
|
-
const onCloseDeleteModal = () => {
|
|
14537
|
-
setOpenDeleteModal(false);
|
|
14538
|
-
};
|
|
14539
|
-
const onCloseEditModal = () => {
|
|
14540
|
-
setOpenEditCreateModal(false);
|
|
14541
|
-
};
|
|
14542
|
-
const openModal = (type) => {
|
|
14543
|
-
setEditCreateModalType(type);
|
|
14544
|
-
setOpenEditCreateModal(true);
|
|
14863
|
+
const confirmDeleteAndCloseModal = () => {
|
|
14864
|
+
deleteSelectedView();
|
|
14865
|
+
closeModal();
|
|
14545
14866
|
};
|
|
14546
|
-
const
|
|
14547
|
-
|
|
14867
|
+
const i18n = useI18nContext11();
|
|
14868
|
+
const selectSavedViewFromList = ({ item }) => selectView(item);
|
|
14869
|
+
const setSelectedSavedView = (view) => {
|
|
14870
|
+
selectView(view);
|
|
14548
14871
|
};
|
|
14549
|
-
|
|
14872
|
+
const allViews = temporaryView ? [...savedViews ?? [], temporaryView] : savedViews ?? [];
|
|
14873
|
+
return /* @__PURE__ */ React22.createElement(StyledPanel, { provider: props.provider }, /* @__PURE__ */ React22.createElement(
|
|
14550
14874
|
ExpandedPanel,
|
|
14551
14875
|
{
|
|
14552
14876
|
"data-testid": "saved-view-expanded-panel",
|
|
14553
14877
|
provider: props.provider
|
|
14554
14878
|
},
|
|
14555
|
-
/* @__PURE__ */
|
|
14879
|
+
/* @__PURE__ */ React22.createElement(Panel3.Header, { id: "saved-views-collections-panel-header" }, /* @__PURE__ */ React22.createElement(Panel3.Title, null, /* @__PURE__ */ React22.createElement(Flex5, { alignItems: "center" }, /* @__PURE__ */ React22.createElement(Box2, { paddingRight: "sm" }, i18n.t("savedViews.title")), /* @__PURE__ */ React22.createElement(Tooltip, { showDelay: 200, overlay: i18n.t("savedViews.tooltip") }, /* @__PURE__ */ React22.createElement(Help_default, { size: "sm" })))), /* @__PURE__ */ React22.createElement(
|
|
14556
14880
|
Tooltip,
|
|
14557
14881
|
{
|
|
14558
14882
|
overlay: i18n.t("savedViews.actions.create"),
|
|
14559
14883
|
showDelay: 1e3
|
|
14560
14884
|
},
|
|
14561
|
-
/* @__PURE__ */
|
|
14562
|
-
|
|
14885
|
+
/* @__PURE__ */ React22.createElement("span", null, /* @__PURE__ */ React22.createElement(
|
|
14886
|
+
Button6,
|
|
14563
14887
|
{
|
|
14564
|
-
icon: /* @__PURE__ */
|
|
14888
|
+
icon: /* @__PURE__ */ React22.createElement(Plus_default, null),
|
|
14565
14889
|
variant: "secondary",
|
|
14566
14890
|
"data-testid": "expanded-panel-create-button",
|
|
14567
14891
|
onClick: () => openModal("create" /* CREATE */),
|
|
@@ -14570,54 +14894,59 @@ var SavedViewsContent = (props) => {
|
|
|
14570
14894
|
i18n.t("savedViews.actions.create")
|
|
14571
14895
|
))
|
|
14572
14896
|
)),
|
|
14573
|
-
/* @__PURE__ */
|
|
14897
|
+
/* @__PURE__ */ React22.createElement(Panel3.Body, { style: { display: "flex", flexFlow: "column" } }, /* @__PURE__ */ React22.createElement(
|
|
14574
14898
|
PanelContent,
|
|
14575
14899
|
{
|
|
14576
|
-
onSelect:
|
|
14900
|
+
onSelect: selectSavedViewFromList,
|
|
14577
14901
|
openModal,
|
|
14578
|
-
onDelete:
|
|
14902
|
+
onDelete: () => openModal("delete" /* DELETE */),
|
|
14579
14903
|
updateLocalStorage,
|
|
14580
14904
|
setSelectedSavedView,
|
|
14581
14905
|
queryInput,
|
|
14582
|
-
selectedSavedView,
|
|
14906
|
+
selectedSavedView: selectedView,
|
|
14583
14907
|
tableConfig: props.tableConfig,
|
|
14584
14908
|
defaultView: props.defaultView,
|
|
14585
14909
|
stickyViewsKey: props.stickyViewsKey,
|
|
14910
|
+
savedViews: allViews,
|
|
14586
14911
|
provider: props.provider,
|
|
14587
|
-
userId: props.userId
|
|
14588
|
-
backend
|
|
14912
|
+
userId: props.userId
|
|
14589
14913
|
}
|
|
14590
14914
|
))
|
|
14591
|
-
), /* @__PURE__ */
|
|
14915
|
+
), (isModalOpen("create" /* CREATE */) || isModalOpen("update" /* UPDATE */)) && /* @__PURE__ */ React22.createElement(
|
|
14592
14916
|
SavedViewsFormModal,
|
|
14593
14917
|
{
|
|
14594
|
-
open:
|
|
14595
|
-
mode:
|
|
14596
|
-
onCancel:
|
|
14918
|
+
open: true,
|
|
14919
|
+
mode: activeModal,
|
|
14920
|
+
onCancel: closeModal,
|
|
14597
14921
|
queryInput,
|
|
14598
14922
|
tableConfig: props.tableConfig,
|
|
14599
14923
|
tableName: props.tableName,
|
|
14600
|
-
selectedSavedView,
|
|
14924
|
+
selectedSavedView: selectedView,
|
|
14601
14925
|
setSelectedSavedView,
|
|
14602
|
-
onSelect:
|
|
14603
|
-
setOpenEditCreateModal,
|
|
14604
|
-
defaultView: props.defaultView
|
|
14605
|
-
backend
|
|
14926
|
+
onSelect: selectView,
|
|
14927
|
+
setOpenEditCreateModal: closeModal,
|
|
14928
|
+
defaultView: props.defaultView
|
|
14606
14929
|
}
|
|
14607
|
-
),
|
|
14930
|
+
), selectedView && isModalOpen("delete" /* DELETE */) && /* @__PURE__ */ React22.createElement(
|
|
14608
14931
|
SavedViewsDeleteConfirmationModalShared,
|
|
14609
14932
|
{
|
|
14610
|
-
open:
|
|
14611
|
-
onDelete:
|
|
14612
|
-
|
|
14613
|
-
|
|
14614
|
-
|
|
14615
|
-
|
|
14933
|
+
open: true,
|
|
14934
|
+
onDelete: confirmDeleteAndCloseModal,
|
|
14935
|
+
onCancel: closeModal
|
|
14936
|
+
}
|
|
14937
|
+
), fetchedView && isModalOpen("crossUser" /* CROSS_USER */) && /* @__PURE__ */ React22.createElement(
|
|
14938
|
+
CreateViewConfirmationModal,
|
|
14939
|
+
{
|
|
14940
|
+
open: true,
|
|
14941
|
+
savedViewName: fetchedView.name,
|
|
14942
|
+
onClose: closeModal,
|
|
14943
|
+
onViewTemporarily: viewSharedViewTemporarily,
|
|
14944
|
+
onCreateView: createPersonalCopyOfSharedView
|
|
14616
14945
|
}
|
|
14617
14946
|
));
|
|
14618
14947
|
};
|
|
14619
14948
|
var SavedViews = (props) => {
|
|
14620
|
-
return /* @__PURE__ */
|
|
14949
|
+
return /* @__PURE__ */ React22.createElement(EnvironmentI18nProvider, null, /* @__PURE__ */ React22.createElement(QueryClientProvider, { client: queryClient }, /* @__PURE__ */ React22.createElement(SavedViewsContent, { ...props })));
|
|
14621
14950
|
};
|
|
14622
14951
|
|
|
14623
14952
|
// src/SavedViews/components/SavedViews/SmartGrid/SmartGridSavedViews.tsx
|
|
@@ -14640,20 +14969,18 @@ var SmartGridSavedViews = (props) => {
|
|
|
14640
14969
|
gridApi.refreshCells();
|
|
14641
14970
|
return item;
|
|
14642
14971
|
}
|
|
14643
|
-
const tableConfig2 = item.table_config;
|
|
14644
|
-
const updatedItemConfig = props.transformSettings?.(tableConfig2) ?? tableConfig2;
|
|
14645
14972
|
const updatedView = {
|
|
14646
14973
|
...item,
|
|
14647
14974
|
table_config: customAndConfigSync(
|
|
14648
|
-
|
|
14649
|
-
|
|
14975
|
+
item.table_config,
|
|
14976
|
+
tableConfig
|
|
14650
14977
|
)
|
|
14651
14978
|
};
|
|
14652
14979
|
updateTableConfig(updatedView, gridApi, "smart-grid");
|
|
14653
14980
|
setTableConfig(updatedView.table_config);
|
|
14654
14981
|
return updatedView;
|
|
14655
14982
|
};
|
|
14656
|
-
return /* @__PURE__ */
|
|
14983
|
+
return /* @__PURE__ */ React23.createElement(ToastAlertProvider, null, /* @__PURE__ */ React23.createElement(
|
|
14657
14984
|
SavedViews,
|
|
14658
14985
|
{
|
|
14659
14986
|
onSelect,
|
|
@@ -14666,23 +14993,22 @@ var SmartGridSavedViews = (props) => {
|
|
|
14666
14993
|
tableName: props.tableName,
|
|
14667
14994
|
tableConfig,
|
|
14668
14995
|
stickyViewsKey: props.stickyViewsKey,
|
|
14669
|
-
enableSavedViews: props.enableSavedViews
|
|
14670
|
-
backend: props.backend
|
|
14996
|
+
enableSavedViews: props.enableSavedViews
|
|
14671
14997
|
}
|
|
14672
14998
|
));
|
|
14673
14999
|
};
|
|
14674
15000
|
|
|
14675
15001
|
// src/SavedViews/components/SavedViews/DataTable/DataTableSavedViews.tsx
|
|
14676
|
-
import
|
|
14677
|
-
forwardRef as
|
|
15002
|
+
import React24, {
|
|
15003
|
+
forwardRef as forwardRef10,
|
|
14678
15004
|
useImperativeHandle,
|
|
14679
|
-
useState as
|
|
14680
|
-
useCallback as
|
|
15005
|
+
useState as useState6,
|
|
15006
|
+
useCallback as useCallback4
|
|
14681
15007
|
} from "react";
|
|
14682
15008
|
|
|
14683
15009
|
// src/SavedViews/components/SavedViews/DataTable/DataTableDefaultSavedView.tsx
|
|
14684
15010
|
import { useMemo } from "react";
|
|
14685
|
-
import { useI18nContext as
|
|
15011
|
+
import { useI18nContext as useI18nContext12 } from "@procore/core-react";
|
|
14686
15012
|
var DEFAULT_COLUMN_STATE = {
|
|
14687
15013
|
hidden: false,
|
|
14688
15014
|
pinned: null,
|
|
@@ -14729,7 +15055,7 @@ var extractDefaultView = (columnDefinitions, receivedConfigFromTool) => {
|
|
|
14729
15055
|
return result;
|
|
14730
15056
|
};
|
|
14731
15057
|
var useDefaultViewName2 = (domain, defaultViewName) => {
|
|
14732
|
-
const i18n =
|
|
15058
|
+
const i18n = useI18nContext12();
|
|
14733
15059
|
return defaultViewName || i18n.t(domain, {
|
|
14734
15060
|
scope: "savedViews.defaultViewTitle",
|
|
14735
15061
|
defaultValue: "Default View"
|
|
@@ -14751,9 +15077,9 @@ var useDefaultView2 = (props) => {
|
|
|
14751
15077
|
|
|
14752
15078
|
// src/SavedViews/components/SavedViews/DataTable/DataTableSavedViews.tsx
|
|
14753
15079
|
import { ToastAlertProvider as ToastAlertProvider2 } from "@procore/toast-alert";
|
|
14754
|
-
var DataTableSavedViews =
|
|
15080
|
+
var DataTableSavedViews = forwardRef10((props, ref) => {
|
|
14755
15081
|
const { tableApi, onTableConfigChange, projectId, companyId } = props;
|
|
14756
|
-
const [internalTableConfig, setInternalTableConfig] =
|
|
15082
|
+
const [internalTableConfig, setInternalTableConfig] = useState6(
|
|
14757
15083
|
props.defaultViewConfig
|
|
14758
15084
|
);
|
|
14759
15085
|
useImperativeHandle(ref, () => ({
|
|
@@ -14761,7 +15087,7 @@ var DataTableSavedViews = forwardRef9((props, ref) => {
|
|
|
14761
15087
|
handleConfigChange(newConfig);
|
|
14762
15088
|
}
|
|
14763
15089
|
}));
|
|
14764
|
-
const handleConfigChange =
|
|
15090
|
+
const handleConfigChange = useCallback4(
|
|
14765
15091
|
(newConfig) => {
|
|
14766
15092
|
setInternalTableConfig(newConfig);
|
|
14767
15093
|
onTableConfigChange(newConfig);
|
|
@@ -14789,7 +15115,7 @@ var DataTableSavedViews = forwardRef9((props, ref) => {
|
|
|
14789
15115
|
if (!internalTableConfig) {
|
|
14790
15116
|
return null;
|
|
14791
15117
|
}
|
|
14792
|
-
return /* @__PURE__ */
|
|
15118
|
+
return /* @__PURE__ */ React24.createElement(ToastAlertProvider2, null, /* @__PURE__ */ React24.createElement(
|
|
14793
15119
|
SavedViews,
|
|
14794
15120
|
{
|
|
14795
15121
|
onSelect,
|