@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/legacy/index.mjs
CHANGED
|
@@ -69,7 +69,7 @@ var require_big = __commonJS({
|
|
|
69
69
|
"use strict";
|
|
70
70
|
(function(GLOBAL) {
|
|
71
71
|
"use strict";
|
|
72
|
-
var Big, DP = 20, RM = 1, MAX_DP = 1e6, MAX_POWER = 1e6, NE = -7, PE = 21, STRICT = false, NAME = "[big.js] ", INVALID = NAME + "Invalid ", INVALID_DP = INVALID + "decimal places", INVALID_RM = INVALID + "rounding mode", DIV_BY_ZERO = NAME + "Division by zero",
|
|
72
|
+
var Big, DP = 20, RM = 1, MAX_DP = 1e6, MAX_POWER = 1e6, NE = -7, PE = 21, STRICT = false, NAME = "[big.js] ", INVALID = NAME + "Invalid ", INVALID_DP = INVALID + "decimal places", INVALID_RM = INVALID + "rounding mode", DIV_BY_ZERO = NAME + "Division by zero", 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
|
var _a, _b;
|
|
11175
11205
|
if (!props.item) {
|
|
@@ -11193,7 +11223,19 @@ var SavedViewCollectionMenuItem = (props) => {
|
|
|
11193
11223
|
event.stopPropagation();
|
|
11194
11224
|
(_a = props.onUpdate) == null ? void 0 : _a.call(props, props.item);
|
|
11195
11225
|
};
|
|
11226
|
+
const { showToast } = useToastAlertContext();
|
|
11196
11227
|
const i18n = useI18nContext2();
|
|
11228
|
+
const copyShareLink = async (event) => {
|
|
11229
|
+
event.stopPropagation();
|
|
11230
|
+
try {
|
|
11231
|
+
const currentUrl = new URL(window.location.href);
|
|
11232
|
+
await navigator.clipboard.writeText(currentUrl.toString());
|
|
11233
|
+
showToast.success(i18n.t("savedViews.actions.linkCopied"));
|
|
11234
|
+
} catch (error) {
|
|
11235
|
+
console.error("Failed to copy link:", error);
|
|
11236
|
+
showToast.error(i18n.t("savedViews.errors.copyFailed"));
|
|
11237
|
+
}
|
|
11238
|
+
};
|
|
11197
11239
|
const flyoutMenuOptions = [
|
|
11198
11240
|
{
|
|
11199
11241
|
value: "editNameDesc",
|
|
@@ -11204,7 +11246,7 @@ var SavedViewCollectionMenuItem = (props) => {
|
|
|
11204
11246
|
label: i18n.t("savedViews.actions.delete")
|
|
11205
11247
|
}
|
|
11206
11248
|
];
|
|
11207
|
-
return /* @__PURE__ */
|
|
11249
|
+
return /* @__PURE__ */ React14.createElement(
|
|
11208
11250
|
Container2,
|
|
11209
11251
|
{
|
|
11210
11252
|
"aria-selected": Boolean(props.selected),
|
|
@@ -11215,7 +11257,7 @@ var SavedViewCollectionMenuItem = (props) => {
|
|
|
11215
11257
|
}),
|
|
11216
11258
|
"data-testid": "saved-view-collection-menu-item"
|
|
11217
11259
|
},
|
|
11218
|
-
/* @__PURE__ */
|
|
11260
|
+
/* @__PURE__ */ React14.createElement(
|
|
11219
11261
|
"span",
|
|
11220
11262
|
{
|
|
11221
11263
|
"data-testid": "saved-view-display-name",
|
|
@@ -11223,7 +11265,7 @@ var SavedViewCollectionMenuItem = (props) => {
|
|
|
11223
11265
|
},
|
|
11224
11266
|
props.item.name
|
|
11225
11267
|
),
|
|
11226
|
-
/* @__PURE__ */
|
|
11268
|
+
/* @__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(
|
|
11227
11269
|
Button2,
|
|
11228
11270
|
{
|
|
11229
11271
|
onClick: updateItem,
|
|
@@ -11234,7 +11276,17 @@ var SavedViewCollectionMenuItem = (props) => {
|
|
|
11234
11276
|
loading: props.isUpdateProcessing
|
|
11235
11277
|
},
|
|
11236
11278
|
i18n.t("savedViews.actions.update")
|
|
11237
|
-
))
|
|
11279
|
+
)), props.item.id !== "default" && props.selected && !props.canUpdate && props.item.id !== "temporary" && /* @__PURE__ */ React14.createElement("div", null, /* @__PURE__ */ React14.createElement(
|
|
11280
|
+
Button2,
|
|
11281
|
+
{
|
|
11282
|
+
onClick: copyShareLink,
|
|
11283
|
+
variant: "tertiary",
|
|
11284
|
+
size: "sm",
|
|
11285
|
+
"aria-label": i18n.t("savedViews.actions.copyShareLink"),
|
|
11286
|
+
"data-testid": "copy-share-link-button"
|
|
11287
|
+
},
|
|
11288
|
+
/* @__PURE__ */ React14.createElement(Link_default, { size: "sm" })
|
|
11289
|
+
))), /* @__PURE__ */ React14.createElement(Box, null, props.item.id !== "default" && props.canEditOrDelete && /* @__PURE__ */ React14.createElement("div", { onClick: (e2) => e2.stopPropagation() }, /* @__PURE__ */ React14.createElement(
|
|
11238
11290
|
DropdownFlyout,
|
|
11239
11291
|
{
|
|
11240
11292
|
"data-testid": "saved-view-overflow-button",
|
|
@@ -11264,14 +11316,177 @@ import {
|
|
|
11264
11316
|
Flex as Flex3,
|
|
11265
11317
|
UNSAFE_Menu as MenuImperative,
|
|
11266
11318
|
spacing as spacing2,
|
|
11267
|
-
useI18nContext as
|
|
11319
|
+
useI18nContext as useI18nContext5
|
|
11268
11320
|
} from "@procore/core-react";
|
|
11269
|
-
import { useToastAlertContext } from "@procore/toast-alert";
|
|
11270
|
-
import
|
|
11321
|
+
import { useToastAlertContext as useToastAlertContext2 } from "@procore/toast-alert";
|
|
11322
|
+
import React16 from "react";
|
|
11323
|
+
|
|
11324
|
+
// ../../node_modules/@procore/core-http/dist/modern/index.js
|
|
11325
|
+
function getCSRFToken() {
|
|
11326
|
+
const token = document.cookie.match("(^|;)\\s*csrf_token\\s*=\\s*([^;]+)");
|
|
11327
|
+
return token ? decodeURIComponent(token.pop() || "") : "";
|
|
11328
|
+
}
|
|
11329
|
+
function getCSRFHeader() {
|
|
11330
|
+
const csrfToken = getCSRFToken();
|
|
11331
|
+
return csrfToken ? { "X-CSRF-TOKEN": csrfToken } : {};
|
|
11332
|
+
}
|
|
11333
|
+
function removeLeadingSlash(url) {
|
|
11334
|
+
return url.startsWith("/") ? url.substring(1, url.length) : url;
|
|
11335
|
+
}
|
|
11336
|
+
function removeTrailingSlash(url) {
|
|
11337
|
+
return url.endsWith("/") ? url.substring(0, url.length - 1) : url;
|
|
11338
|
+
}
|
|
11339
|
+
function applyBaseUrl(url, baseUrl) {
|
|
11340
|
+
return `${removeTrailingSlash(baseUrl)}/${removeLeadingSlash(url)}`;
|
|
11341
|
+
}
|
|
11342
|
+
function getOptions({ headers, ...options }) {
|
|
11343
|
+
const opts = {
|
|
11344
|
+
credentials: "same-origin",
|
|
11345
|
+
headers: {
|
|
11346
|
+
...getCSRFHeader(),
|
|
11347
|
+
...headers
|
|
11348
|
+
},
|
|
11349
|
+
mode: "same-origin",
|
|
11350
|
+
...options
|
|
11351
|
+
};
|
|
11352
|
+
return opts;
|
|
11353
|
+
}
|
|
11354
|
+
function getUrl(url, baseUrl) {
|
|
11355
|
+
return baseUrl ? applyBaseUrl(url, baseUrl) : url;
|
|
11356
|
+
}
|
|
11357
|
+
function request(url, { baseUrl, ...options } = {}) {
|
|
11358
|
+
return fetch(getUrl(url, baseUrl), getOptions(options));
|
|
11359
|
+
}
|
|
11360
|
+
function requestJSON(url, requestParams = {}) {
|
|
11361
|
+
return request(url, requestParams).then(
|
|
11362
|
+
(response) => response.json()
|
|
11363
|
+
);
|
|
11364
|
+
}
|
|
11365
|
+
|
|
11366
|
+
// src/utils/Api/queries.ts
|
|
11367
|
+
import { useQuery } from "@tanstack/react-query";
|
|
11368
|
+
|
|
11369
|
+
// src/utils/Api/queriesHandler.ts
|
|
11370
|
+
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
11371
|
+
import { useI18nContext as useI18nContext3 } from "@procore/core-react";
|
|
11372
|
+
var useApiRequest = (props, method, mutationKey) => {
|
|
11373
|
+
const { projectId, companyId, domain, tableName } = props;
|
|
11374
|
+
const queryClient2 = useQueryClient();
|
|
11375
|
+
const { locale: locale2 } = useI18nContext3();
|
|
11376
|
+
return useMutation({
|
|
11377
|
+
mutationKey,
|
|
11378
|
+
mutationFn: async (savedView) => {
|
|
11379
|
+
let url = "";
|
|
11380
|
+
if (method === "DELETE" || method === "PUT") {
|
|
11381
|
+
url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views/${savedView.id}?permissions_domain=${domain}`;
|
|
11382
|
+
} else {
|
|
11383
|
+
url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views?table_name=${tableName}&permissions_domain=${domain}`;
|
|
11384
|
+
}
|
|
11385
|
+
const response = await requestJSON(url, {
|
|
11386
|
+
method,
|
|
11387
|
+
body: JSON.stringify(savedView),
|
|
11388
|
+
headers: {
|
|
11389
|
+
"Content-Type": "application/json",
|
|
11390
|
+
"Accept-Language": locale2
|
|
11391
|
+
}
|
|
11392
|
+
});
|
|
11393
|
+
if (response.error) {
|
|
11394
|
+
throw response.error;
|
|
11395
|
+
}
|
|
11396
|
+
return response.data;
|
|
11397
|
+
},
|
|
11398
|
+
onSuccess: (savedView) => {
|
|
11399
|
+
if (method === "DELETE" || method === "POST") {
|
|
11400
|
+
queryClient2.invalidateQueries({
|
|
11401
|
+
queryKey: ["savedViews", domain, tableName]
|
|
11402
|
+
});
|
|
11403
|
+
return;
|
|
11404
|
+
} else {
|
|
11405
|
+
const oldData = queryClient2.getQueryData([
|
|
11406
|
+
"savedViews",
|
|
11407
|
+
domain,
|
|
11408
|
+
tableName
|
|
11409
|
+
]);
|
|
11410
|
+
const oldView = oldData == null ? void 0 : oldData.find((item) => item.id === savedView.id);
|
|
11411
|
+
if ((oldView == null ? void 0 : oldView.name) !== savedView.name) {
|
|
11412
|
+
queryClient2.invalidateQueries({
|
|
11413
|
+
queryKey: ["savedViews", domain, tableName]
|
|
11414
|
+
});
|
|
11415
|
+
return;
|
|
11416
|
+
}
|
|
11417
|
+
}
|
|
11418
|
+
queryClient2.setQueryData(
|
|
11419
|
+
["savedViews", domain, tableName],
|
|
11420
|
+
(oldData) => {
|
|
11421
|
+
if (!oldData)
|
|
11422
|
+
return [savedView];
|
|
11423
|
+
return oldData.map(
|
|
11424
|
+
(item) => item.id === savedView.id ? savedView : item
|
|
11425
|
+
);
|
|
11426
|
+
}
|
|
11427
|
+
);
|
|
11428
|
+
}
|
|
11429
|
+
});
|
|
11430
|
+
};
|
|
11271
11431
|
|
|
11272
11432
|
// src/utils/Constants/viewLevels.ts
|
|
11273
11433
|
var VIEW_LEVELS = ["company", "project", "personal"];
|
|
11274
11434
|
|
|
11435
|
+
// src/utils/Api/queries.ts
|
|
11436
|
+
var PAGE_SIZE = 50 * VIEW_LEVELS.length;
|
|
11437
|
+
var useSavedViewsQuery = (props) => {
|
|
11438
|
+
const { projectId, companyId, domain, tableName } = props;
|
|
11439
|
+
const url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views?table_name=${tableName}&permissions_domain=${domain}`;
|
|
11440
|
+
return useQuery({
|
|
11441
|
+
enabled: props.enableSavedViews,
|
|
11442
|
+
queryKey: ["savedViews", domain, tableName],
|
|
11443
|
+
queryFn: async () => {
|
|
11444
|
+
const getUrl2 = `${url}&per_page=${PAGE_SIZE}`;
|
|
11445
|
+
const response = await requestJSON(getUrl2);
|
|
11446
|
+
return response.data;
|
|
11447
|
+
}
|
|
11448
|
+
});
|
|
11449
|
+
};
|
|
11450
|
+
var useSavedViewsPermissions = (props) => {
|
|
11451
|
+
const { projectId, companyId, domain } = props;
|
|
11452
|
+
const url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views/permissions?permissions_domain=${domain}`;
|
|
11453
|
+
return useQuery({
|
|
11454
|
+
enabled: props.enableSavedViews,
|
|
11455
|
+
queryKey: ["savedViewsConfig", domain],
|
|
11456
|
+
queryFn: async () => {
|
|
11457
|
+
const response = await requestJSON(url);
|
|
11458
|
+
return response.data;
|
|
11459
|
+
}
|
|
11460
|
+
});
|
|
11461
|
+
};
|
|
11462
|
+
var useCreateSavedView = (props) => useApiRequest(props, "POST", [
|
|
11463
|
+
"createSavedView",
|
|
11464
|
+
props.domain,
|
|
11465
|
+
props.tableName
|
|
11466
|
+
]);
|
|
11467
|
+
var useUpdateSavedView = (props) => useApiRequest(props, "PUT", [
|
|
11468
|
+
"updateSavedView",
|
|
11469
|
+
props.domain,
|
|
11470
|
+
props.tableName
|
|
11471
|
+
]);
|
|
11472
|
+
var useDeleteSavedView = (props) => useApiRequest(props, "DELETE", [
|
|
11473
|
+
"deleteSavedView",
|
|
11474
|
+
props.domain,
|
|
11475
|
+
props.tableName
|
|
11476
|
+
]);
|
|
11477
|
+
var useFetchSavedViewById = (savedViewId, queryInput, enabled = true) => {
|
|
11478
|
+
const { projectId, companyId } = queryInput;
|
|
11479
|
+
return useQuery({
|
|
11480
|
+
enabled: enabled && Boolean(savedViewId),
|
|
11481
|
+
queryKey: ["savedView", savedViewId],
|
|
11482
|
+
queryFn: async () => {
|
|
11483
|
+
const url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views/${savedViewId}`;
|
|
11484
|
+
const response = await requestJSON(url);
|
|
11485
|
+
return response.data;
|
|
11486
|
+
}
|
|
11487
|
+
});
|
|
11488
|
+
};
|
|
11489
|
+
|
|
11275
11490
|
// src/SavedViews/components/Panels/PanelContentUtils.ts
|
|
11276
11491
|
var import_lodash = __toESM(require_lodash());
|
|
11277
11492
|
|
|
@@ -11286,7 +11501,7 @@ function getSmartGridConfig(api) {
|
|
|
11286
11501
|
columnState: columnStateResult,
|
|
11287
11502
|
rowHeight: rowHeightResult,
|
|
11288
11503
|
columnGroupState: columnGroupStateResult,
|
|
11289
|
-
rowGroupState: rowGroupStateResult
|
|
11504
|
+
rowGroupState: rowGroupStateResult,
|
|
11290
11505
|
filterState: serverFiltersResult
|
|
11291
11506
|
};
|
|
11292
11507
|
return smartGridConfig;
|
|
@@ -11479,17 +11694,17 @@ import {
|
|
|
11479
11694
|
Flex as Flex2,
|
|
11480
11695
|
spacing,
|
|
11481
11696
|
Typography,
|
|
11482
|
-
useI18nContext as
|
|
11697
|
+
useI18nContext as useI18nContext4
|
|
11483
11698
|
} from "@procore/core-react";
|
|
11484
|
-
import
|
|
11699
|
+
import React15 from "react";
|
|
11485
11700
|
var groupIcon = (group) => {
|
|
11486
11701
|
switch (group) {
|
|
11487
11702
|
case "personal":
|
|
11488
|
-
return /* @__PURE__ */
|
|
11703
|
+
return /* @__PURE__ */ React15.createElement(Person_default, null);
|
|
11489
11704
|
case "project":
|
|
11490
|
-
return /* @__PURE__ */
|
|
11705
|
+
return /* @__PURE__ */ React15.createElement(Excavator_default, null);
|
|
11491
11706
|
case "company":
|
|
11492
|
-
return /* @__PURE__ */
|
|
11707
|
+
return /* @__PURE__ */ React15.createElement(Building_default, null);
|
|
11493
11708
|
}
|
|
11494
11709
|
};
|
|
11495
11710
|
var Header = styled_components_esm_default(Flex2)`
|
|
@@ -11499,8 +11714,8 @@ var Header = styled_components_esm_default(Flex2)`
|
|
|
11499
11714
|
}
|
|
11500
11715
|
`;
|
|
11501
11716
|
var ViewLevelHeader = ({ expanded, toggleGroup, group }) => {
|
|
11502
|
-
const I18n =
|
|
11503
|
-
return /* @__PURE__ */
|
|
11717
|
+
const I18n = useI18nContext4();
|
|
11718
|
+
return /* @__PURE__ */ React15.createElement(
|
|
11504
11719
|
Header,
|
|
11505
11720
|
{
|
|
11506
11721
|
alignItems: "center",
|
|
@@ -11509,9 +11724,9 @@ var ViewLevelHeader = ({ expanded, toggleGroup, group }) => {
|
|
|
11509
11724
|
style: { cursor: "pointer" },
|
|
11510
11725
|
onClick: () => toggleGroup(group)
|
|
11511
11726
|
},
|
|
11512
|
-
expanded ? /* @__PURE__ */
|
|
11727
|
+
expanded ? /* @__PURE__ */ React15.createElement(ChevronDown_default, { size: "sm" }) : /* @__PURE__ */ React15.createElement(ChevronRight_default, { size: "sm" }),
|
|
11513
11728
|
groupIcon(group),
|
|
11514
|
-
/* @__PURE__ */
|
|
11729
|
+
/* @__PURE__ */ React15.createElement(Typography, { weight: "semibold" }, I18n.t(`savedViews.viewLevel.${group}`))
|
|
11515
11730
|
);
|
|
11516
11731
|
};
|
|
11517
11732
|
var ViewLevelHeader_default = ViewLevelHeader;
|
|
@@ -11546,22 +11761,20 @@ var Panel2 = styled_components_esm_default(DetailPage.Card)`
|
|
|
11546
11761
|
box-shadow: none;
|
|
11547
11762
|
`;
|
|
11548
11763
|
var PanelContent = (props) => {
|
|
11549
|
-
var _a;
|
|
11550
|
-
const { showToast } =
|
|
11551
|
-
const I18n =
|
|
11552
|
-
const {
|
|
11553
|
-
const {
|
|
11554
|
-
const
|
|
11555
|
-
|
|
11556
|
-
)
|
|
11557
|
-
const errorToastRef = React15.useRef(null);
|
|
11558
|
-
React15.useEffect(() => {
|
|
11764
|
+
var _a, _b;
|
|
11765
|
+
const { showToast } = useToastAlertContext2();
|
|
11766
|
+
const I18n = useI18nContext5();
|
|
11767
|
+
const { mutate: updateSavedView, isPending: isUpdateLoading } = useUpdateSavedView(props.queryInput);
|
|
11768
|
+
const { data: savedViewsFromQuery, error: savedViewsError } = useSavedViewsQuery(props.queryInput);
|
|
11769
|
+
const savedViews = props.savedViews ?? savedViewsFromQuery;
|
|
11770
|
+
const errorToastRef = React16.useRef(null);
|
|
11771
|
+
React16.useEffect(() => {
|
|
11559
11772
|
if (savedViewsError && savedViewsError !== errorToastRef.current) {
|
|
11560
11773
|
showToast.error(I18n.t("savedViews.errors.fetch"));
|
|
11561
11774
|
errorToastRef.current = savedViewsError;
|
|
11562
11775
|
}
|
|
11563
|
-
}, [savedViewsError]);
|
|
11564
|
-
const { data: permissions } =
|
|
11776
|
+
}, [savedViewsError, showToast, I18n]);
|
|
11777
|
+
const { data: permissions } = useSavedViewsPermissions(props.queryInput);
|
|
11565
11778
|
const selectedRowRef = useScrollToRef(savedViews);
|
|
11566
11779
|
const onUpdate = (data) => {
|
|
11567
11780
|
const newSavedView = {
|
|
@@ -11582,14 +11795,30 @@ var PanelContent = (props) => {
|
|
|
11582
11795
|
};
|
|
11583
11796
|
const { groups, toggleGroup } = useGroups();
|
|
11584
11797
|
const isDefaultSelected = ((_a = props.selectedSavedView) == null ? void 0 : _a.id) === "default";
|
|
11585
|
-
|
|
11798
|
+
const isTemporarySelected = ((_b = props.selectedSavedView) == null ? void 0 : _b.id) === "temporary";
|
|
11799
|
+
const temporaryView = savedViews == null ? void 0 : savedViews.find((view) => view.id === "temporary");
|
|
11800
|
+
return /* @__PURE__ */ React16.createElement(Panel2, { "data-testid": "inner-panel" }, /* @__PURE__ */ React16.createElement(Flex3, { direction: "column", style: { height: "100%", width: "100%" } }, temporaryView && /* @__PURE__ */ React16.createElement(
|
|
11801
|
+
Row,
|
|
11802
|
+
{
|
|
11803
|
+
selected: isTemporarySelected,
|
|
11804
|
+
onClick: () => props.onSelect({ item: temporaryView }),
|
|
11805
|
+
ref: isTemporarySelected ? selectedRowRef : null
|
|
11806
|
+
},
|
|
11807
|
+
/* @__PURE__ */ React16.createElement(
|
|
11808
|
+
SavedViewCollectionMenuItem,
|
|
11809
|
+
{
|
|
11810
|
+
item: temporaryView,
|
|
11811
|
+
selected: isTemporarySelected
|
|
11812
|
+
}
|
|
11813
|
+
)
|
|
11814
|
+
), /* @__PURE__ */ React16.createElement(
|
|
11586
11815
|
Row,
|
|
11587
11816
|
{
|
|
11588
11817
|
selected: isDefaultSelected,
|
|
11589
11818
|
onClick: () => props.onSelect({ item: props.defaultView }),
|
|
11590
11819
|
ref: isDefaultSelected ? selectedRowRef : null
|
|
11591
11820
|
},
|
|
11592
|
-
/* @__PURE__ */
|
|
11821
|
+
/* @__PURE__ */ React16.createElement(
|
|
11593
11822
|
SavedViewCollectionMenuItem,
|
|
11594
11823
|
{
|
|
11595
11824
|
item: props.defaultView,
|
|
@@ -11598,8 +11827,10 @@ var PanelContent = (props) => {
|
|
|
11598
11827
|
)
|
|
11599
11828
|
), VIEW_LEVELS.map((level) => {
|
|
11600
11829
|
const isExpanded = groups[level];
|
|
11601
|
-
const views = isExpanded && savedViews ? savedViews.filter(
|
|
11602
|
-
|
|
11830
|
+
const views = isExpanded && savedViews ? savedViews.filter(
|
|
11831
|
+
(view) => view.view_level === level && view.id !== "temporary"
|
|
11832
|
+
) : [];
|
|
11833
|
+
return /* @__PURE__ */ React16.createElement(React16.Fragment, { key: level }, /* @__PURE__ */ React16.createElement(
|
|
11603
11834
|
ViewLevelHeader_default,
|
|
11604
11835
|
{
|
|
11605
11836
|
group: level,
|
|
@@ -11616,7 +11847,7 @@ var PanelContent = (props) => {
|
|
|
11616
11847
|
props.provider
|
|
11617
11848
|
);
|
|
11618
11849
|
const canEditOrDelete = isSelected && hasPermissionForViewLevel(view.view_level, permissions);
|
|
11619
|
-
return /* @__PURE__ */
|
|
11850
|
+
return /* @__PURE__ */ React16.createElement(
|
|
11620
11851
|
Row,
|
|
11621
11852
|
{
|
|
11622
11853
|
key: view.id,
|
|
@@ -11627,7 +11858,7 @@ var PanelContent = (props) => {
|
|
|
11627
11858
|
},
|
|
11628
11859
|
ref: isSelected ? selectedRowRef : null
|
|
11629
11860
|
},
|
|
11630
|
-
/* @__PURE__ */
|
|
11861
|
+
/* @__PURE__ */ React16.createElement(
|
|
11631
11862
|
SavedViewCollectionMenuItem,
|
|
11632
11863
|
{
|
|
11633
11864
|
item: view,
|
|
@@ -11648,12 +11879,12 @@ var PanelContent = (props) => {
|
|
|
11648
11879
|
};
|
|
11649
11880
|
|
|
11650
11881
|
// src/SavedViews/components/SavedViews/SmartGrid/SmartGridSavedViews.tsx
|
|
11651
|
-
import
|
|
11882
|
+
import React23 from "react";
|
|
11652
11883
|
|
|
11653
11884
|
// src/SavedViews/components/SavedViews/SmartGrid/SmartGridDefaultSavedView.tsx
|
|
11654
|
-
import { useI18nContext as
|
|
11885
|
+
import { useI18nContext as useI18nContext6 } from "@procore/core-react";
|
|
11655
11886
|
var useDefaultViewName = (domain, defaultViewName) => {
|
|
11656
|
-
const i18n =
|
|
11887
|
+
const i18n = useI18nContext6();
|
|
11657
11888
|
return defaultViewName || i18n.t(domain, {
|
|
11658
11889
|
scope: "savedViews.defaultViewTitle",
|
|
11659
11890
|
defaultValue: "Default View"
|
|
@@ -11710,13 +11941,13 @@ var useSmartGridConfig = (gridApi) => {
|
|
|
11710
11941
|
// src/SavedViews/components/SavedViews/SavedViews.tsx
|
|
11711
11942
|
import {
|
|
11712
11943
|
Box as Box2,
|
|
11713
|
-
Button as
|
|
11944
|
+
Button as Button6,
|
|
11714
11945
|
Flex as Flex5,
|
|
11715
11946
|
Panel as Panel3,
|
|
11716
11947
|
Tooltip,
|
|
11717
|
-
useI18nContext as
|
|
11948
|
+
useI18nContext as useI18nContext11
|
|
11718
11949
|
} from "@procore/core-react";
|
|
11719
|
-
import
|
|
11950
|
+
import React22 from "react";
|
|
11720
11951
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
11721
11952
|
|
|
11722
11953
|
// src/SavedViews/components/SavedViewsModals/SavedViewsDeleteConfirmationModalShared.tsx
|
|
@@ -11725,16 +11956,16 @@ import {
|
|
|
11725
11956
|
ConfirmModal,
|
|
11726
11957
|
Modal,
|
|
11727
11958
|
P as P2,
|
|
11728
|
-
useI18nContext as
|
|
11959
|
+
useI18nContext as useI18nContext7
|
|
11729
11960
|
} from "@procore/core-react";
|
|
11730
|
-
import
|
|
11961
|
+
import React17 from "react";
|
|
11731
11962
|
var SavedViewsDeleteConfirmationModalShared = ({
|
|
11732
11963
|
onCancel,
|
|
11733
11964
|
onDelete,
|
|
11734
11965
|
open
|
|
11735
11966
|
}) => {
|
|
11736
|
-
const i18n =
|
|
11737
|
-
return /* @__PURE__ */
|
|
11967
|
+
const i18n = useI18nContext7();
|
|
11968
|
+
return /* @__PURE__ */ React17.createElement(
|
|
11738
11969
|
ConfirmModal,
|
|
11739
11970
|
{
|
|
11740
11971
|
"data-testid": "delete-confirmation-modal",
|
|
@@ -11744,13 +11975,13 @@ var SavedViewsDeleteConfirmationModalShared = ({
|
|
|
11744
11975
|
onClose: onCancel,
|
|
11745
11976
|
style: { overflowWrap: "anywhere" }
|
|
11746
11977
|
},
|
|
11747
|
-
/* @__PURE__ */
|
|
11748
|
-
/* @__PURE__ */
|
|
11978
|
+
/* @__PURE__ */ React17.createElement(Modal.Body, null, /* @__PURE__ */ React17.createElement(P2, null, i18n.t("savedViews.modal.delete.description"))),
|
|
11979
|
+
/* @__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"))))
|
|
11749
11980
|
);
|
|
11750
11981
|
};
|
|
11751
11982
|
|
|
11752
11983
|
// src/SavedViews/components/SavedViewsModals/SavedViewsFormModal.tsx
|
|
11753
|
-
import
|
|
11984
|
+
import React19 from "react";
|
|
11754
11985
|
|
|
11755
11986
|
// src/SavedViews/components/SavedViewsModals/SavedViewsCreateUpdateModalBase.tsx
|
|
11756
11987
|
import {
|
|
@@ -11764,9 +11995,9 @@ import {
|
|
|
11764
11995
|
Modal as Modal2,
|
|
11765
11996
|
spacing as spacing3,
|
|
11766
11997
|
Typography as Typography2,
|
|
11767
|
-
useI18nContext as
|
|
11998
|
+
useI18nContext as useI18nContext8
|
|
11768
11999
|
} from "@procore/core-react";
|
|
11769
|
-
import * as
|
|
12000
|
+
import * as React18 from "react";
|
|
11770
12001
|
|
|
11771
12002
|
// ../../node_modules/yup/index.esm.js
|
|
11772
12003
|
var import_property_expr = __toESM(require_property_expr());
|
|
@@ -14094,7 +14325,6 @@ function extractMessage(error, I18n) {
|
|
|
14094
14325
|
}
|
|
14095
14326
|
|
|
14096
14327
|
// src/SavedViews/components/SavedViewsModals/SavedViewsCreateUpdateModalBase.tsx
|
|
14097
|
-
var { useEffect: useEffect3, useRef: useRef2 } = React17;
|
|
14098
14328
|
var ScrollContainer = styled_components_esm_default("div")`
|
|
14099
14329
|
overflow: auto;
|
|
14100
14330
|
`;
|
|
@@ -14112,38 +14342,22 @@ var SavedViewsCreateUpdateModalBase = ({
|
|
|
14112
14342
|
selectedSavedView,
|
|
14113
14343
|
setSelectedSavedView,
|
|
14114
14344
|
setOpenEditCreateModal,
|
|
14115
|
-
onSelect
|
|
14116
|
-
backend
|
|
14345
|
+
onSelect
|
|
14117
14346
|
}) => {
|
|
14118
|
-
const I18n =
|
|
14347
|
+
const I18n = useI18nContext8();
|
|
14119
14348
|
const NAME_MAX_LENGTH = 150;
|
|
14120
|
-
const originalBodyWidth = useRef2("");
|
|
14121
|
-
useEffect3(() => {
|
|
14122
|
-
if (open) {
|
|
14123
|
-
originalBodyWidth.current = document.body.style.width || "";
|
|
14124
|
-
document.body.style.width = "100%";
|
|
14125
|
-
} else {
|
|
14126
|
-
document.body.style.width = originalBodyWidth.current;
|
|
14127
|
-
}
|
|
14128
|
-
return () => {
|
|
14129
|
-
if (originalBodyWidth.current !== void 0) {
|
|
14130
|
-
document.body.style.width = originalBodyWidth.current;
|
|
14131
|
-
}
|
|
14132
|
-
};
|
|
14133
|
-
}, [open]);
|
|
14134
|
-
const { useCreateSavedView: useCreateSavedView2, useUpdateSavedView: useUpdateSavedView2, useSavedViewsPermissions: useSavedViewsPermissions2 } = backend;
|
|
14135
14349
|
const {
|
|
14136
14350
|
mutate: createSavedView,
|
|
14137
14351
|
isPending: isCreating,
|
|
14138
14352
|
error: createError,
|
|
14139
14353
|
reset: resetCreateMutation
|
|
14140
|
-
} =
|
|
14354
|
+
} = useCreateSavedView(queryInput);
|
|
14141
14355
|
const {
|
|
14142
14356
|
mutate: updateSavedView,
|
|
14143
14357
|
isPending: isUpdating,
|
|
14144
14358
|
error: updateError,
|
|
14145
14359
|
reset: resetUpdateMutation
|
|
14146
|
-
} =
|
|
14360
|
+
} = useUpdateSavedView(queryInput);
|
|
14147
14361
|
const resetMutations = () => {
|
|
14148
14362
|
resetCreateMutation();
|
|
14149
14363
|
resetUpdateMutation();
|
|
@@ -14152,7 +14366,7 @@ var SavedViewsCreateUpdateModalBase = ({
|
|
|
14152
14366
|
resetMutations();
|
|
14153
14367
|
onCancel();
|
|
14154
14368
|
};
|
|
14155
|
-
const { data: permissions } =
|
|
14369
|
+
const { data: permissions } = useSavedViewsPermissions(queryInput);
|
|
14156
14370
|
const isLoading = isCreating || isUpdating;
|
|
14157
14371
|
const errors = extractMessage(createError || updateError, I18n);
|
|
14158
14372
|
const handleOnSubmit = (data) => {
|
|
@@ -14184,7 +14398,7 @@ var SavedViewsCreateUpdateModalBase = ({
|
|
|
14184
14398
|
}
|
|
14185
14399
|
};
|
|
14186
14400
|
const viewLevelOptions = getViewLevelOptions(permissions, I18n);
|
|
14187
|
-
return /* @__PURE__ */
|
|
14401
|
+
return /* @__PURE__ */ React18.createElement(
|
|
14188
14402
|
Modal2,
|
|
14189
14403
|
{
|
|
14190
14404
|
"aria-label": I18n.t("savedViews.ariaLabels.modal"),
|
|
@@ -14193,14 +14407,14 @@ var SavedViewsCreateUpdateModalBase = ({
|
|
|
14193
14407
|
style: { width: "540px" },
|
|
14194
14408
|
"data-testid": "create-update-modal"
|
|
14195
14409
|
},
|
|
14196
|
-
/* @__PURE__ */
|
|
14410
|
+
/* @__PURE__ */ React18.createElement(ScrollContainer, null, /* @__PURE__ */ React18.createElement(
|
|
14197
14411
|
Modal2.Header,
|
|
14198
14412
|
{
|
|
14199
14413
|
onClose,
|
|
14200
14414
|
style: { borderBottom: `1px solid ${colors3.gray85}` }
|
|
14201
14415
|
},
|
|
14202
|
-
/* @__PURE__ */
|
|
14203
|
-
), /* @__PURE__ */
|
|
14416
|
+
/* @__PURE__ */ React18.createElement(H2, null, header)
|
|
14417
|
+
), /* @__PURE__ */ React18.createElement(
|
|
14204
14418
|
Form,
|
|
14205
14419
|
{
|
|
14206
14420
|
initialValues: {
|
|
@@ -14226,13 +14440,13 @@ var SavedViewsCreateUpdateModalBase = ({
|
|
|
14226
14440
|
onReset: onCancel,
|
|
14227
14441
|
validateOnChange: true
|
|
14228
14442
|
},
|
|
14229
|
-
/* @__PURE__ */
|
|
14443
|
+
/* @__PURE__ */ React18.createElement(Form.Form, { name: header }, /* @__PURE__ */ React18.createElement(
|
|
14230
14444
|
Modal2.Body,
|
|
14231
14445
|
{
|
|
14232
14446
|
style: { paddingTop: 0, paddingBottom: 0, marginTop: spacing3.lg }
|
|
14233
14447
|
},
|
|
14234
|
-
errors && /* @__PURE__ */
|
|
14235
|
-
/* @__PURE__ */
|
|
14448
|
+
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 == null ? void 0 : errors.form) || I18n.t(`savedViews.modal.errors.description.${mode}`)))),
|
|
14449
|
+
/* @__PURE__ */ React18.createElement(Form.Row, null, /* @__PURE__ */ React18.createElement(
|
|
14236
14450
|
Form.Text,
|
|
14237
14451
|
{
|
|
14238
14452
|
name: "name",
|
|
@@ -14243,12 +14457,12 @@ var SavedViewsCreateUpdateModalBase = ({
|
|
|
14243
14457
|
onChange: () => resetMutations()
|
|
14244
14458
|
}
|
|
14245
14459
|
)),
|
|
14246
|
-
/* @__PURE__ */
|
|
14460
|
+
/* @__PURE__ */ React18.createElement(
|
|
14247
14461
|
Form.Row,
|
|
14248
14462
|
{
|
|
14249
14463
|
style: { marginTop: (errors == null ? void 0 : errors.name) ? spacing3.xl : spacing3.none }
|
|
14250
14464
|
},
|
|
14251
|
-
/* @__PURE__ */
|
|
14465
|
+
/* @__PURE__ */ React18.createElement(
|
|
14252
14466
|
Form.TextArea,
|
|
14253
14467
|
{
|
|
14254
14468
|
name: "description",
|
|
@@ -14259,19 +14473,18 @@ var SavedViewsCreateUpdateModalBase = ({
|
|
|
14259
14473
|
}
|
|
14260
14474
|
)
|
|
14261
14475
|
),
|
|
14262
|
-
viewLevelOptions.length > 1 && mode === "create" /* CREATE */ ? /* @__PURE__ */
|
|
14476
|
+
viewLevelOptions.length > 1 && mode === "create" /* CREATE */ ? /* @__PURE__ */ React18.createElement(Form.Row, null, /* @__PURE__ */ React18.createElement(
|
|
14263
14477
|
Form.Select,
|
|
14264
14478
|
{
|
|
14265
14479
|
name: "view_level",
|
|
14266
|
-
qa: { label: "view-level" },
|
|
14267
14480
|
options: viewLevelOptions,
|
|
14268
14481
|
label: I18n.t("savedViews.modal.fields.viewLevel"),
|
|
14269
14482
|
colWidth: 12,
|
|
14270
14483
|
onSearch: false,
|
|
14271
14484
|
onClear: false
|
|
14272
14485
|
}
|
|
14273
|
-
)) : /* @__PURE__ */
|
|
14274
|
-
), /* @__PURE__ */
|
|
14486
|
+
)) : /* @__PURE__ */ React18.createElement(React18.Fragment, null)
|
|
14487
|
+
), /* @__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(
|
|
14275
14488
|
Button4,
|
|
14276
14489
|
{
|
|
14277
14490
|
"data-testid": "create-update-modal-button",
|
|
@@ -14287,7 +14500,7 @@ var SavedViewsCreateUpdateModalBase = ({
|
|
|
14287
14500
|
};
|
|
14288
14501
|
|
|
14289
14502
|
// src/SavedViews/components/SavedViewsModals/SavedViewsFormModal.tsx
|
|
14290
|
-
import { useI18nContext as
|
|
14503
|
+
import { useI18nContext as useI18nContext9 } from "@procore/core-react";
|
|
14291
14504
|
var SavedViewsFormModal = ({
|
|
14292
14505
|
open,
|
|
14293
14506
|
mode,
|
|
@@ -14299,11 +14512,10 @@ var SavedViewsFormModal = ({
|
|
|
14299
14512
|
setSelectedSavedView,
|
|
14300
14513
|
setOpenEditCreateModal,
|
|
14301
14514
|
onSelect,
|
|
14302
|
-
defaultView
|
|
14303
|
-
backend
|
|
14515
|
+
defaultView
|
|
14304
14516
|
}) => {
|
|
14305
|
-
const i18n =
|
|
14306
|
-
return /* @__PURE__ */
|
|
14517
|
+
const i18n = useI18nContext9();
|
|
14518
|
+
return /* @__PURE__ */ React19.createElement(
|
|
14307
14519
|
SavedViewsCreateUpdateModalBase,
|
|
14308
14520
|
{
|
|
14309
14521
|
open,
|
|
@@ -14319,169 +14531,276 @@ var SavedViewsFormModal = ({
|
|
|
14319
14531
|
setSelectedSavedView,
|
|
14320
14532
|
setOpenEditCreateModal,
|
|
14321
14533
|
onSelect,
|
|
14322
|
-
defaultView
|
|
14323
|
-
backend
|
|
14534
|
+
defaultView
|
|
14324
14535
|
}
|
|
14325
14536
|
);
|
|
14326
14537
|
};
|
|
14327
14538
|
|
|
14328
|
-
//
|
|
14329
|
-
|
|
14330
|
-
|
|
14331
|
-
|
|
14332
|
-
|
|
14333
|
-
|
|
14334
|
-
|
|
14335
|
-
return csrfToken ? { "X-CSRF-TOKEN": csrfToken } : {};
|
|
14336
|
-
}
|
|
14337
|
-
function removeLeadingSlash(url) {
|
|
14338
|
-
return url.startsWith("/") ? url.substring(1, url.length) : url;
|
|
14339
|
-
}
|
|
14340
|
-
function removeTrailingSlash(url) {
|
|
14341
|
-
return url.endsWith("/") ? url.substring(0, url.length - 1) : url;
|
|
14342
|
-
}
|
|
14343
|
-
function applyBaseUrl(url, baseUrl) {
|
|
14344
|
-
return `${removeTrailingSlash(baseUrl)}/${removeLeadingSlash(url)}`;
|
|
14345
|
-
}
|
|
14346
|
-
function getOptions({ headers, ...options }) {
|
|
14347
|
-
const opts = {
|
|
14348
|
-
credentials: "same-origin",
|
|
14349
|
-
headers: {
|
|
14350
|
-
...getCSRFHeader(),
|
|
14351
|
-
...headers
|
|
14352
|
-
},
|
|
14353
|
-
mode: "same-origin",
|
|
14354
|
-
...options
|
|
14539
|
+
// src/SavedViews/components/SavedViewsModals/CopyViewConfirmationModal.tsx
|
|
14540
|
+
import { Button as Button5, Modal as Modal3, P as P3, useI18nContext as useI18nContext10 } from "@procore/core-react";
|
|
14541
|
+
import React20 from "react";
|
|
14542
|
+
var CreateViewConfirmationModal = ({ open, savedViewName, onClose, onViewTemporarily, onCreateView }) => {
|
|
14543
|
+
const i18n = useI18nContext10();
|
|
14544
|
+
const handleViewTemporarily = () => {
|
|
14545
|
+
onViewTemporarily == null ? void 0 : onViewTemporarily();
|
|
14355
14546
|
};
|
|
14356
|
-
|
|
14357
|
-
|
|
14358
|
-
|
|
14359
|
-
return
|
|
14360
|
-
|
|
14361
|
-
|
|
14362
|
-
|
|
14363
|
-
|
|
14364
|
-
|
|
14365
|
-
|
|
14366
|
-
(
|
|
14547
|
+
const handleCreateView = () => {
|
|
14548
|
+
onCreateView == null ? void 0 : onCreateView();
|
|
14549
|
+
};
|
|
14550
|
+
return /* @__PURE__ */ React20.createElement(
|
|
14551
|
+
Modal3,
|
|
14552
|
+
{
|
|
14553
|
+
"data-testid": "create-view-confirmation-modal",
|
|
14554
|
+
open,
|
|
14555
|
+
onClickOverlay: onClose
|
|
14556
|
+
},
|
|
14557
|
+
/* @__PURE__ */ React20.createElement(Modal3.Header, { onClose }, i18n.t("savedViews.modal.copyConfirmation.headline", {
|
|
14558
|
+
savedViewName
|
|
14559
|
+
})),
|
|
14560
|
+
/* @__PURE__ */ React20.createElement(Modal3.Body, null, /* @__PURE__ */ React20.createElement(P3, null, i18n.t("savedViews.modal.copyConfirmation.description"))),
|
|
14561
|
+
/* @__PURE__ */ React20.createElement(Modal3.Footer, null, /* @__PURE__ */ React20.createElement(Modal3.FooterButtons, null, /* @__PURE__ */ React20.createElement(
|
|
14562
|
+
Button5,
|
|
14563
|
+
{
|
|
14564
|
+
variant: "secondary",
|
|
14565
|
+
onClick: handleViewTemporarily,
|
|
14566
|
+
"data-testid": "view-temporarily-button"
|
|
14567
|
+
},
|
|
14568
|
+
i18n.t("savedViews.actions.viewTemporarily")
|
|
14569
|
+
), /* @__PURE__ */ React20.createElement(
|
|
14570
|
+
Button5,
|
|
14571
|
+
{
|
|
14572
|
+
variant: "primary",
|
|
14573
|
+
onClick: handleCreateView,
|
|
14574
|
+
"data-testid": "create-view-button"
|
|
14575
|
+
},
|
|
14576
|
+
i18n.t("savedViews.actions.createView")
|
|
14577
|
+
)))
|
|
14367
14578
|
);
|
|
14368
|
-
}
|
|
14579
|
+
};
|
|
14369
14580
|
|
|
14370
|
-
// src/utils/
|
|
14371
|
-
import {
|
|
14581
|
+
// src/utils/Hooks/useViewSelection.ts
|
|
14582
|
+
import { useState as useState4, useCallback as useCallback2 } from "react";
|
|
14372
14583
|
|
|
14373
|
-
// src/utils/
|
|
14374
|
-
import {
|
|
14375
|
-
import {
|
|
14376
|
-
var
|
|
14377
|
-
const
|
|
14378
|
-
const
|
|
14379
|
-
|
|
14380
|
-
|
|
14381
|
-
|
|
14382
|
-
mutationFn: async (savedView) => {
|
|
14383
|
-
let url = "";
|
|
14384
|
-
if (method === "DELETE" || method === "PUT") {
|
|
14385
|
-
url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views/${savedView.id}?permissions_domain=${domain}`;
|
|
14386
|
-
} else {
|
|
14387
|
-
url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views?table_name=${tableName}&permissions_domain=${domain}`;
|
|
14584
|
+
// src/utils/Hooks/useUrlSync.ts
|
|
14585
|
+
import { useEffect as useEffect3 } from "react";
|
|
14586
|
+
import { useSearchParams } from "react-router-dom";
|
|
14587
|
+
var useUrlSync = (selectedView, availableViews, defaultView, onViewFound, onViewNotFound) => {
|
|
14588
|
+
const [searchParams, setSearchParams] = useSearchParams();
|
|
14589
|
+
const applySavedViewFromUrl = (savedViewId) => {
|
|
14590
|
+
if (savedViewId === "default") {
|
|
14591
|
+
if (defaultView.id !== (selectedView == null ? void 0 : selectedView.id)) {
|
|
14592
|
+
onViewFound(defaultView);
|
|
14388
14593
|
}
|
|
14389
|
-
|
|
14390
|
-
|
|
14391
|
-
|
|
14392
|
-
|
|
14393
|
-
|
|
14394
|
-
|
|
14395
|
-
}
|
|
14396
|
-
});
|
|
14397
|
-
if (response.error) {
|
|
14398
|
-
throw response.error;
|
|
14399
|
-
}
|
|
14400
|
-
return response.data;
|
|
14401
|
-
},
|
|
14402
|
-
onSuccess: (savedView) => {
|
|
14403
|
-
if (method === "DELETE" || method === "POST") {
|
|
14404
|
-
queryClient2.invalidateQueries({
|
|
14405
|
-
queryKey: ["savedViews", domain, tableName]
|
|
14406
|
-
});
|
|
14407
|
-
return;
|
|
14408
|
-
} else {
|
|
14409
|
-
const oldData = queryClient2.getQueryData([
|
|
14410
|
-
"savedViews",
|
|
14411
|
-
domain,
|
|
14412
|
-
tableName
|
|
14413
|
-
]);
|
|
14414
|
-
const oldView = oldData == null ? void 0 : oldData.find((item) => item.id === savedView.id);
|
|
14415
|
-
if ((oldView == null ? void 0 : oldView.name) !== savedView.name) {
|
|
14416
|
-
queryClient2.invalidateQueries({
|
|
14417
|
-
queryKey: ["savedViews", domain, tableName]
|
|
14418
|
-
});
|
|
14419
|
-
return;
|
|
14420
|
-
}
|
|
14594
|
+
return;
|
|
14595
|
+
}
|
|
14596
|
+
const viewInUserViews = availableViews.find((v2) => v2.id === savedViewId);
|
|
14597
|
+
if (viewInUserViews) {
|
|
14598
|
+
if (viewInUserViews.id !== (selectedView == null ? void 0 : selectedView.id)) {
|
|
14599
|
+
onViewFound(viewInUserViews);
|
|
14421
14600
|
}
|
|
14422
|
-
|
|
14423
|
-
|
|
14424
|
-
|
|
14425
|
-
|
|
14426
|
-
|
|
14427
|
-
|
|
14428
|
-
|
|
14429
|
-
|
|
14601
|
+
} else {
|
|
14602
|
+
onViewNotFound(savedViewId);
|
|
14603
|
+
}
|
|
14604
|
+
};
|
|
14605
|
+
const applyListView = (viewParam) => {
|
|
14606
|
+
if (viewParam === "list" && defaultView.id !== (selectedView == null ? void 0 : selectedView.id)) {
|
|
14607
|
+
onViewFound(defaultView);
|
|
14608
|
+
}
|
|
14609
|
+
};
|
|
14610
|
+
useEffect3(() => {
|
|
14611
|
+
if (!availableViews.length)
|
|
14612
|
+
return;
|
|
14613
|
+
const savedViewId = searchParams.get("saved-view");
|
|
14614
|
+
const viewParamFromConsumer = searchParams.get("view");
|
|
14615
|
+
if (savedViewId) {
|
|
14616
|
+
applySavedViewFromUrl(savedViewId);
|
|
14617
|
+
return;
|
|
14618
|
+
}
|
|
14619
|
+
if (viewParamFromConsumer) {
|
|
14620
|
+
applyListView(viewParamFromConsumer);
|
|
14621
|
+
}
|
|
14622
|
+
}, [
|
|
14623
|
+
searchParams,
|
|
14624
|
+
availableViews,
|
|
14625
|
+
defaultView,
|
|
14626
|
+
selectedView,
|
|
14627
|
+
onViewFound,
|
|
14628
|
+
onViewNotFound
|
|
14629
|
+
]);
|
|
14630
|
+
const updateUrl = (view) => {
|
|
14631
|
+
setSearchParams(
|
|
14632
|
+
(currentParams) => {
|
|
14633
|
+
const updatedParams = new URLSearchParams(currentParams);
|
|
14634
|
+
if (view.id === "default") {
|
|
14635
|
+
updatedParams.delete("saved-view");
|
|
14636
|
+
} else {
|
|
14637
|
+
updatedParams.set("saved-view", view.id);
|
|
14430
14638
|
}
|
|
14639
|
+
return updatedParams;
|
|
14640
|
+
},
|
|
14641
|
+
{ replace: true }
|
|
14642
|
+
);
|
|
14643
|
+
};
|
|
14644
|
+
return { updateUrl };
|
|
14645
|
+
};
|
|
14646
|
+
|
|
14647
|
+
// src/utils/Hooks/useViewSelection.ts
|
|
14648
|
+
var useViewSelection = (config, savedViews, openCrossUserModal) => {
|
|
14649
|
+
const [selectedSavedView, setSelectedSavedView] = useState4(() => {
|
|
14650
|
+
try {
|
|
14651
|
+
const savedView = JSON.parse(
|
|
14652
|
+
localStorage.getItem(
|
|
14653
|
+
`${config.domain}_${config.tableName}_${config.stickyViewsKey}_${config.projectId}_${config.userId}`
|
|
14654
|
+
)
|
|
14431
14655
|
);
|
|
14656
|
+
return savedView || config.defaultView;
|
|
14657
|
+
} catch (e2) {
|
|
14658
|
+
return config.defaultView;
|
|
14432
14659
|
}
|
|
14433
14660
|
});
|
|
14661
|
+
const [temporaryView, setTemporaryView] = useState4(null);
|
|
14662
|
+
const createTemporaryView = useCallback2((fetchedView) => {
|
|
14663
|
+
const tempView = {
|
|
14664
|
+
...fetchedView,
|
|
14665
|
+
id: "temporary",
|
|
14666
|
+
name: "Temporary View"
|
|
14667
|
+
};
|
|
14668
|
+
setTemporaryView(tempView);
|
|
14669
|
+
return tempView;
|
|
14670
|
+
}, []);
|
|
14671
|
+
const clearTemporaryView = useCallback2(() => setTemporaryView(null), []);
|
|
14672
|
+
const updateLocalStorage = useCallback2(
|
|
14673
|
+
(view) => {
|
|
14674
|
+
if (config.stickyViewsKey) {
|
|
14675
|
+
localStorage.setItem(
|
|
14676
|
+
`${config.domain}_${config.tableName}_${config.stickyViewsKey}_${config.projectId}_${config.userId}`,
|
|
14677
|
+
JSON.stringify(view)
|
|
14678
|
+
);
|
|
14679
|
+
}
|
|
14680
|
+
},
|
|
14681
|
+
[
|
|
14682
|
+
config.domain,
|
|
14683
|
+
config.tableName,
|
|
14684
|
+
config.stickyViewsKey,
|
|
14685
|
+
config.projectId,
|
|
14686
|
+
config.userId
|
|
14687
|
+
]
|
|
14688
|
+
);
|
|
14689
|
+
const allViews = temporaryView ? [...savedViews ?? [], temporaryView] : savedViews ?? [];
|
|
14690
|
+
const onUrlViewFound = (foundView) => {
|
|
14691
|
+
selectView(foundView);
|
|
14692
|
+
};
|
|
14693
|
+
const onUrlViewNotFound = (viewId) => {
|
|
14694
|
+
if (viewId === (selectedSavedView == null ? void 0 : selectedSavedView.id)) {
|
|
14695
|
+
return;
|
|
14696
|
+
}
|
|
14697
|
+
openCrossUserModal(viewId);
|
|
14698
|
+
};
|
|
14699
|
+
const { updateUrl } = useUrlSync(
|
|
14700
|
+
selectedSavedView,
|
|
14701
|
+
allViews,
|
|
14702
|
+
config.defaultView,
|
|
14703
|
+
onUrlViewFound,
|
|
14704
|
+
onUrlViewNotFound
|
|
14705
|
+
);
|
|
14706
|
+
const selectView = useCallback2(
|
|
14707
|
+
(view) => {
|
|
14708
|
+
if (view.id !== "temporary" && temporaryView) {
|
|
14709
|
+
clearTemporaryView();
|
|
14710
|
+
}
|
|
14711
|
+
const viewToSelect = config.onSelect({ item: view });
|
|
14712
|
+
setSelectedSavedView(viewToSelect);
|
|
14713
|
+
updateLocalStorage(viewToSelect);
|
|
14714
|
+
updateUrl(viewToSelect);
|
|
14715
|
+
return viewToSelect;
|
|
14716
|
+
},
|
|
14717
|
+
[config, temporaryView, clearTemporaryView, updateLocalStorage, updateUrl]
|
|
14718
|
+
);
|
|
14719
|
+
return {
|
|
14720
|
+
selectedView: selectedSavedView,
|
|
14721
|
+
selectView,
|
|
14722
|
+
updateLocalStorage,
|
|
14723
|
+
temporaryView,
|
|
14724
|
+
createTemporaryView
|
|
14725
|
+
};
|
|
14434
14726
|
};
|
|
14435
14727
|
|
|
14436
|
-
// src/utils/
|
|
14437
|
-
|
|
14438
|
-
var
|
|
14439
|
-
const {
|
|
14440
|
-
|
|
14441
|
-
|
|
14442
|
-
|
|
14443
|
-
|
|
14444
|
-
|
|
14445
|
-
|
|
14446
|
-
|
|
14447
|
-
|
|
14728
|
+
// src/utils/Hooks/useCrossUserSharing.ts
|
|
14729
|
+
import React21 from "react";
|
|
14730
|
+
var useCrossUserSharing = (queryInput, viewId, selectedSavedView, defaultView, actions, tableName) => {
|
|
14731
|
+
const { data: fetchedView, isError: fetchError } = useFetchSavedViewById(
|
|
14732
|
+
viewId,
|
|
14733
|
+
queryInput,
|
|
14734
|
+
Boolean(viewId)
|
|
14735
|
+
);
|
|
14736
|
+
const { mutate: createSavedView } = useCreateSavedView(queryInput);
|
|
14737
|
+
React21.useEffect(() => {
|
|
14738
|
+
if (fetchError && viewId) {
|
|
14739
|
+
actions.selectView(selectedSavedView ?? defaultView);
|
|
14740
|
+
actions.closeModal();
|
|
14741
|
+
}
|
|
14742
|
+
}, [fetchError, viewId, actions, selectedSavedView, defaultView]);
|
|
14743
|
+
const viewSharedViewTemporarily = () => {
|
|
14744
|
+
if (fetchedView) {
|
|
14745
|
+
const tempView = actions.createTemporaryView(fetchedView);
|
|
14746
|
+
actions.selectView(tempView);
|
|
14747
|
+
actions.closeModal();
|
|
14448
14748
|
}
|
|
14449
|
-
}
|
|
14450
|
-
|
|
14451
|
-
|
|
14452
|
-
|
|
14453
|
-
|
|
14454
|
-
|
|
14455
|
-
|
|
14456
|
-
|
|
14457
|
-
|
|
14458
|
-
|
|
14459
|
-
|
|
14749
|
+
};
|
|
14750
|
+
const createPersonalCopyOfSharedView = () => {
|
|
14751
|
+
if (fetchedView) {
|
|
14752
|
+
const viewToCreate = {
|
|
14753
|
+
name: fetchedView.name,
|
|
14754
|
+
description: fetchedView.description,
|
|
14755
|
+
table_name: tableName,
|
|
14756
|
+
table_config: fetchedView.table_config,
|
|
14757
|
+
view_level: "personal"
|
|
14758
|
+
};
|
|
14759
|
+
createSavedView(viewToCreate, {
|
|
14760
|
+
onSuccess: (newView) => {
|
|
14761
|
+
actions.selectView(newView);
|
|
14762
|
+
actions.closeModal();
|
|
14763
|
+
}
|
|
14764
|
+
});
|
|
14460
14765
|
}
|
|
14461
|
-
}
|
|
14766
|
+
};
|
|
14767
|
+
return {
|
|
14768
|
+
fetchedView,
|
|
14769
|
+
viewSharedViewTemporarily,
|
|
14770
|
+
createPersonalCopyOfSharedView
|
|
14771
|
+
};
|
|
14772
|
+
};
|
|
14773
|
+
|
|
14774
|
+
// src/utils/Hooks/useModalState.ts
|
|
14775
|
+
import { useState as useState5, useCallback as useCallback3 } from "react";
|
|
14776
|
+
var useModalState = () => {
|
|
14777
|
+
const [activeModal, setActiveModal] = useState5(null);
|
|
14778
|
+
const [modalData, setModalData] = useState5(null);
|
|
14779
|
+
const openModal = useCallback3(
|
|
14780
|
+
(type, data) => {
|
|
14781
|
+
setActiveModal(type);
|
|
14782
|
+
setModalData(data ?? null);
|
|
14783
|
+
},
|
|
14784
|
+
[]
|
|
14785
|
+
);
|
|
14786
|
+
const closeModal = useCallback3(() => {
|
|
14787
|
+
setActiveModal(null);
|
|
14788
|
+
setModalData(null);
|
|
14789
|
+
}, []);
|
|
14790
|
+
const isModalOpen = useCallback3(
|
|
14791
|
+
(type) => {
|
|
14792
|
+
return activeModal === type;
|
|
14793
|
+
},
|
|
14794
|
+
[activeModal]
|
|
14795
|
+
);
|
|
14796
|
+
return {
|
|
14797
|
+
openModal,
|
|
14798
|
+
closeModal,
|
|
14799
|
+
isModalOpen,
|
|
14800
|
+
modalData,
|
|
14801
|
+
activeModal
|
|
14802
|
+
};
|
|
14462
14803
|
};
|
|
14463
|
-
var useCreateSavedView = (props) => useApiRequest(props, "POST", [
|
|
14464
|
-
"createSavedView",
|
|
14465
|
-
props.domain,
|
|
14466
|
-
props.tableName
|
|
14467
|
-
]);
|
|
14468
|
-
var useUpdateSavedView = (props) => useApiRequest(props, "PUT", [
|
|
14469
|
-
"updateSavedView",
|
|
14470
|
-
props.domain,
|
|
14471
|
-
props.tableName
|
|
14472
|
-
]);
|
|
14473
|
-
var useDeleteSavedView = (props) => useApiRequest(props, "DELETE", [
|
|
14474
|
-
"deleteSavedView",
|
|
14475
|
-
props.domain,
|
|
14476
|
-
props.tableName
|
|
14477
|
-
]);
|
|
14478
|
-
var createQueries = (customBackend) => ({
|
|
14479
|
-
useSavedViewsQuery: (customBackend == null ? void 0 : customBackend.useSavedViewsQuery) ?? useSavedViewsQuery,
|
|
14480
|
-
useSavedViewsPermissions: (customBackend == null ? void 0 : customBackend.useSavedViewsPermissions) ?? useSavedViewsPermissions,
|
|
14481
|
-
useCreateSavedView: (customBackend == null ? void 0 : customBackend.useCreateSavedView) ?? useCreateSavedView,
|
|
14482
|
-
useUpdateSavedView: (customBackend == null ? void 0 : customBackend.useUpdateSavedView) ?? useUpdateSavedView,
|
|
14483
|
-
useDeleteSavedView: (customBackend == null ? void 0 : customBackend.useDeleteSavedView) ?? useDeleteSavedView
|
|
14484
|
-
});
|
|
14485
14804
|
|
|
14486
14805
|
// src/SavedViews/components/SavedViews/SavedViews.tsx
|
|
14487
14806
|
var StyledPanel = styled_components_esm_default.div`
|
|
@@ -14497,75 +14816,80 @@ var SavedViewsContent = (props) => {
|
|
|
14497
14816
|
projectId,
|
|
14498
14817
|
companyId
|
|
14499
14818
|
};
|
|
14500
|
-
const
|
|
14501
|
-
const { mutate: deleteSavedView } =
|
|
14502
|
-
const
|
|
14503
|
-
|
|
14504
|
-
|
|
14505
|
-
localStorage.getItem(
|
|
14506
|
-
`${props.domain}_${props.tableName}_${props.stickyViewsKey}_${projectId}_${props.userId}`
|
|
14507
|
-
)
|
|
14508
|
-
);
|
|
14509
|
-
return savedView || props.defaultView;
|
|
14510
|
-
} catch (e2) {
|
|
14511
|
-
return props.defaultView;
|
|
14512
|
-
}
|
|
14513
|
-
});
|
|
14514
|
-
const updateLocalStorage = (view) => {
|
|
14515
|
-
if (props.stickyViewsKey) {
|
|
14516
|
-
localStorage.setItem(
|
|
14517
|
-
`${props.domain}_${props.tableName}_${props.stickyViewsKey}_${projectId}_${props.userId}`,
|
|
14518
|
-
JSON.stringify(view)
|
|
14519
|
-
);
|
|
14520
|
-
}
|
|
14521
|
-
};
|
|
14522
|
-
const handleViewItemSelect = ({ item }) => {
|
|
14523
|
-
const viewToSetAsSelected = props.onSelect({ item });
|
|
14524
|
-
setSelectedSavedView(viewToSetAsSelected);
|
|
14525
|
-
updateLocalStorage(viewToSetAsSelected);
|
|
14819
|
+
const { data: savedViews } = useSavedViewsQuery(queryInput);
|
|
14820
|
+
const { mutate: deleteSavedView } = useDeleteSavedView(queryInput);
|
|
14821
|
+
const { openModal, closeModal, isModalOpen, modalData, activeModal } = useModalState();
|
|
14822
|
+
const openCrossUserModal = (viewId) => {
|
|
14823
|
+
openModal("crossUser" /* CROSS_USER */, { viewId });
|
|
14526
14824
|
};
|
|
14527
|
-
const
|
|
14528
|
-
|
|
14529
|
-
|
|
14530
|
-
|
|
14825
|
+
const {
|
|
14826
|
+
selectedView,
|
|
14827
|
+
selectView,
|
|
14828
|
+
updateLocalStorage,
|
|
14829
|
+
temporaryView,
|
|
14830
|
+
createTemporaryView
|
|
14831
|
+
} = useViewSelection(
|
|
14832
|
+
{
|
|
14833
|
+
domain: props.domain,
|
|
14834
|
+
tableName: props.tableName,
|
|
14835
|
+
stickyViewsKey: props.stickyViewsKey,
|
|
14836
|
+
userId: props.userId,
|
|
14837
|
+
projectId,
|
|
14838
|
+
defaultView: props.defaultView,
|
|
14839
|
+
onSelect: props.onSelect
|
|
14840
|
+
},
|
|
14841
|
+
savedViews,
|
|
14842
|
+
openCrossUserModal
|
|
14843
|
+
);
|
|
14844
|
+
const {
|
|
14845
|
+
fetchedView,
|
|
14846
|
+
viewSharedViewTemporarily,
|
|
14847
|
+
createPersonalCopyOfSharedView
|
|
14848
|
+
} = useCrossUserSharing(
|
|
14849
|
+
queryInput,
|
|
14850
|
+
(modalData == null ? void 0 : modalData.viewId) ?? null,
|
|
14851
|
+
selectedView,
|
|
14852
|
+
props.defaultView,
|
|
14853
|
+
{
|
|
14854
|
+
selectView,
|
|
14855
|
+
createTemporaryView,
|
|
14856
|
+
closeModal
|
|
14857
|
+
},
|
|
14858
|
+
props.tableName
|
|
14859
|
+
);
|
|
14860
|
+
const deleteSelectedView = () => {
|
|
14861
|
+
if (selectedView) {
|
|
14862
|
+
deleteSavedView(selectedView, {
|
|
14863
|
+
onSuccess: () => selectView(props.defaultView)
|
|
14531
14864
|
});
|
|
14532
14865
|
}
|
|
14533
14866
|
};
|
|
14534
|
-
const
|
|
14535
|
-
|
|
14536
|
-
|
|
14537
|
-
const [editCreateModalType, setEditCreateModalType] = useState4(
|
|
14538
|
-
"create" /* CREATE */
|
|
14539
|
-
);
|
|
14540
|
-
const onCloseDeleteModal = () => {
|
|
14541
|
-
setOpenDeleteModal(false);
|
|
14542
|
-
};
|
|
14543
|
-
const onCloseEditModal = () => {
|
|
14544
|
-
setOpenEditCreateModal(false);
|
|
14867
|
+
const confirmDeleteAndCloseModal = () => {
|
|
14868
|
+
deleteSelectedView();
|
|
14869
|
+
closeModal();
|
|
14545
14870
|
};
|
|
14546
|
-
const
|
|
14547
|
-
|
|
14548
|
-
|
|
14549
|
-
|
|
14550
|
-
const onOpenDeleteModal = () => {
|
|
14551
|
-
setOpenDeleteModal(true);
|
|
14871
|
+
const i18n = useI18nContext11();
|
|
14872
|
+
const selectSavedViewFromList = ({ item }) => selectView(item);
|
|
14873
|
+
const setSelectedSavedView = (view) => {
|
|
14874
|
+
selectView(view);
|
|
14552
14875
|
};
|
|
14553
|
-
|
|
14876
|
+
const allViews = temporaryView ? [...savedViews ?? [], temporaryView] : savedViews ?? [];
|
|
14877
|
+
return /* @__PURE__ */ React22.createElement(StyledPanel, { provider: props.provider }, /* @__PURE__ */ React22.createElement(
|
|
14554
14878
|
ExpandedPanel,
|
|
14555
14879
|
{
|
|
14556
14880
|
"data-testid": "saved-view-expanded-panel",
|
|
14557
14881
|
provider: props.provider
|
|
14558
14882
|
},
|
|
14559
|
-
/* @__PURE__ */
|
|
14883
|
+
/* @__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(
|
|
14560
14884
|
Tooltip,
|
|
14561
14885
|
{
|
|
14562
14886
|
overlay: i18n.t("savedViews.actions.create"),
|
|
14563
14887
|
showDelay: 1e3
|
|
14564
14888
|
},
|
|
14565
|
-
/* @__PURE__ */
|
|
14566
|
-
|
|
14889
|
+
/* @__PURE__ */ React22.createElement("span", null, /* @__PURE__ */ React22.createElement(
|
|
14890
|
+
Button6,
|
|
14567
14891
|
{
|
|
14568
|
-
icon: /* @__PURE__ */
|
|
14892
|
+
icon: /* @__PURE__ */ React22.createElement(Plus_default, null),
|
|
14569
14893
|
variant: "secondary",
|
|
14570
14894
|
"data-testid": "expanded-panel-create-button",
|
|
14571
14895
|
onClick: () => openModal("create" /* CREATE */),
|
|
@@ -14574,54 +14898,59 @@ var SavedViewsContent = (props) => {
|
|
|
14574
14898
|
i18n.t("savedViews.actions.create")
|
|
14575
14899
|
))
|
|
14576
14900
|
)),
|
|
14577
|
-
/* @__PURE__ */
|
|
14901
|
+
/* @__PURE__ */ React22.createElement(Panel3.Body, { style: { display: "flex", flexFlow: "column" } }, /* @__PURE__ */ React22.createElement(
|
|
14578
14902
|
PanelContent,
|
|
14579
14903
|
{
|
|
14580
|
-
onSelect:
|
|
14904
|
+
onSelect: selectSavedViewFromList,
|
|
14581
14905
|
openModal,
|
|
14582
|
-
onDelete:
|
|
14906
|
+
onDelete: () => openModal("delete" /* DELETE */),
|
|
14583
14907
|
updateLocalStorage,
|
|
14584
14908
|
setSelectedSavedView,
|
|
14585
14909
|
queryInput,
|
|
14586
|
-
selectedSavedView,
|
|
14910
|
+
selectedSavedView: selectedView,
|
|
14587
14911
|
tableConfig: props.tableConfig,
|
|
14588
14912
|
defaultView: props.defaultView,
|
|
14589
14913
|
stickyViewsKey: props.stickyViewsKey,
|
|
14914
|
+
savedViews: allViews,
|
|
14590
14915
|
provider: props.provider,
|
|
14591
|
-
userId: props.userId
|
|
14592
|
-
backend
|
|
14916
|
+
userId: props.userId
|
|
14593
14917
|
}
|
|
14594
14918
|
))
|
|
14595
|
-
), /* @__PURE__ */
|
|
14919
|
+
), (isModalOpen("create" /* CREATE */) || isModalOpen("update" /* UPDATE */)) && /* @__PURE__ */ React22.createElement(
|
|
14596
14920
|
SavedViewsFormModal,
|
|
14597
14921
|
{
|
|
14598
|
-
open:
|
|
14599
|
-
mode:
|
|
14600
|
-
onCancel:
|
|
14922
|
+
open: true,
|
|
14923
|
+
mode: activeModal,
|
|
14924
|
+
onCancel: closeModal,
|
|
14601
14925
|
queryInput,
|
|
14602
14926
|
tableConfig: props.tableConfig,
|
|
14603
14927
|
tableName: props.tableName,
|
|
14604
|
-
selectedSavedView,
|
|
14928
|
+
selectedSavedView: selectedView,
|
|
14605
14929
|
setSelectedSavedView,
|
|
14606
|
-
onSelect:
|
|
14607
|
-
setOpenEditCreateModal,
|
|
14608
|
-
defaultView: props.defaultView
|
|
14609
|
-
backend
|
|
14930
|
+
onSelect: selectView,
|
|
14931
|
+
setOpenEditCreateModal: closeModal,
|
|
14932
|
+
defaultView: props.defaultView
|
|
14610
14933
|
}
|
|
14611
|
-
),
|
|
14934
|
+
), selectedView && isModalOpen("delete" /* DELETE */) && /* @__PURE__ */ React22.createElement(
|
|
14612
14935
|
SavedViewsDeleteConfirmationModalShared,
|
|
14613
14936
|
{
|
|
14614
|
-
open:
|
|
14615
|
-
onDelete:
|
|
14616
|
-
|
|
14617
|
-
|
|
14618
|
-
|
|
14619
|
-
|
|
14937
|
+
open: true,
|
|
14938
|
+
onDelete: confirmDeleteAndCloseModal,
|
|
14939
|
+
onCancel: closeModal
|
|
14940
|
+
}
|
|
14941
|
+
), fetchedView && isModalOpen("crossUser" /* CROSS_USER */) && /* @__PURE__ */ React22.createElement(
|
|
14942
|
+
CreateViewConfirmationModal,
|
|
14943
|
+
{
|
|
14944
|
+
open: true,
|
|
14945
|
+
savedViewName: fetchedView.name,
|
|
14946
|
+
onClose: closeModal,
|
|
14947
|
+
onViewTemporarily: viewSharedViewTemporarily,
|
|
14948
|
+
onCreateView: createPersonalCopyOfSharedView
|
|
14620
14949
|
}
|
|
14621
14950
|
));
|
|
14622
14951
|
};
|
|
14623
14952
|
var SavedViews = (props) => {
|
|
14624
|
-
return /* @__PURE__ */
|
|
14953
|
+
return /* @__PURE__ */ React22.createElement(EnvironmentI18nProvider, null, /* @__PURE__ */ React22.createElement(QueryClientProvider, { client: queryClient }, /* @__PURE__ */ React22.createElement(SavedViewsContent, { ...props })));
|
|
14625
14954
|
};
|
|
14626
14955
|
|
|
14627
14956
|
// src/SavedViews/components/SavedViews/SmartGrid/SmartGridSavedViews.tsx
|
|
@@ -14634,7 +14963,6 @@ var SmartGridSavedViews = (props) => {
|
|
|
14634
14963
|
domain: props.domain
|
|
14635
14964
|
});
|
|
14636
14965
|
const onSelect = ({ item }) => {
|
|
14637
|
-
var _a;
|
|
14638
14966
|
if (!gridApi)
|
|
14639
14967
|
return item;
|
|
14640
14968
|
if (item.id === "default") {
|
|
@@ -14645,20 +14973,18 @@ var SmartGridSavedViews = (props) => {
|
|
|
14645
14973
|
gridApi.refreshCells();
|
|
14646
14974
|
return item;
|
|
14647
14975
|
}
|
|
14648
|
-
const tableConfig2 = item.table_config;
|
|
14649
|
-
const updatedItemConfig = ((_a = props.transformSettings) == null ? void 0 : _a.call(props, tableConfig2)) ?? tableConfig2;
|
|
14650
14976
|
const updatedView = {
|
|
14651
14977
|
...item,
|
|
14652
14978
|
table_config: customAndConfigSync(
|
|
14653
|
-
|
|
14654
|
-
|
|
14979
|
+
item.table_config,
|
|
14980
|
+
tableConfig
|
|
14655
14981
|
)
|
|
14656
14982
|
};
|
|
14657
14983
|
updateTableConfig(updatedView, gridApi, "smart-grid");
|
|
14658
14984
|
setTableConfig(updatedView.table_config);
|
|
14659
14985
|
return updatedView;
|
|
14660
14986
|
};
|
|
14661
|
-
return /* @__PURE__ */
|
|
14987
|
+
return /* @__PURE__ */ React23.createElement(ToastAlertProvider, null, /* @__PURE__ */ React23.createElement(
|
|
14662
14988
|
SavedViews,
|
|
14663
14989
|
{
|
|
14664
14990
|
onSelect,
|
|
@@ -14671,23 +14997,22 @@ var SmartGridSavedViews = (props) => {
|
|
|
14671
14997
|
tableName: props.tableName,
|
|
14672
14998
|
tableConfig,
|
|
14673
14999
|
stickyViewsKey: props.stickyViewsKey,
|
|
14674
|
-
enableSavedViews: props.enableSavedViews
|
|
14675
|
-
backend: props.backend
|
|
15000
|
+
enableSavedViews: props.enableSavedViews
|
|
14676
15001
|
}
|
|
14677
15002
|
));
|
|
14678
15003
|
};
|
|
14679
15004
|
|
|
14680
15005
|
// src/SavedViews/components/SavedViews/DataTable/DataTableSavedViews.tsx
|
|
14681
|
-
import
|
|
14682
|
-
forwardRef as
|
|
15006
|
+
import React24, {
|
|
15007
|
+
forwardRef as forwardRef10,
|
|
14683
15008
|
useImperativeHandle,
|
|
14684
|
-
useState as
|
|
14685
|
-
useCallback as
|
|
15009
|
+
useState as useState6,
|
|
15010
|
+
useCallback as useCallback4
|
|
14686
15011
|
} from "react";
|
|
14687
15012
|
|
|
14688
15013
|
// src/SavedViews/components/SavedViews/DataTable/DataTableDefaultSavedView.tsx
|
|
14689
15014
|
import { useMemo } from "react";
|
|
14690
|
-
import { useI18nContext as
|
|
15015
|
+
import { useI18nContext as useI18nContext12 } from "@procore/core-react";
|
|
14691
15016
|
var DEFAULT_COLUMN_STATE = {
|
|
14692
15017
|
hidden: false,
|
|
14693
15018
|
pinned: null,
|
|
@@ -14735,7 +15060,7 @@ var extractDefaultView = (columnDefinitions, receivedConfigFromTool) => {
|
|
|
14735
15060
|
return result;
|
|
14736
15061
|
};
|
|
14737
15062
|
var useDefaultViewName2 = (domain, defaultViewName) => {
|
|
14738
|
-
const i18n =
|
|
15063
|
+
const i18n = useI18nContext12();
|
|
14739
15064
|
return defaultViewName || i18n.t(domain, {
|
|
14740
15065
|
scope: "savedViews.defaultViewTitle",
|
|
14741
15066
|
defaultValue: "Default View"
|
|
@@ -14757,9 +15082,9 @@ var useDefaultView2 = (props) => {
|
|
|
14757
15082
|
|
|
14758
15083
|
// src/SavedViews/components/SavedViews/DataTable/DataTableSavedViews.tsx
|
|
14759
15084
|
import { ToastAlertProvider as ToastAlertProvider2 } from "@procore/toast-alert";
|
|
14760
|
-
var DataTableSavedViews =
|
|
15085
|
+
var DataTableSavedViews = forwardRef10((props, ref) => {
|
|
14761
15086
|
const { tableApi, onTableConfigChange, projectId, companyId } = props;
|
|
14762
|
-
const [internalTableConfig, setInternalTableConfig] =
|
|
15087
|
+
const [internalTableConfig, setInternalTableConfig] = useState6(
|
|
14763
15088
|
props.defaultViewConfig
|
|
14764
15089
|
);
|
|
14765
15090
|
useImperativeHandle(ref, () => ({
|
|
@@ -14767,7 +15092,7 @@ var DataTableSavedViews = forwardRef9((props, ref) => {
|
|
|
14767
15092
|
handleConfigChange(newConfig);
|
|
14768
15093
|
}
|
|
14769
15094
|
}));
|
|
14770
|
-
const handleConfigChange =
|
|
15095
|
+
const handleConfigChange = useCallback4(
|
|
14771
15096
|
(newConfig) => {
|
|
14772
15097
|
setInternalTableConfig(newConfig);
|
|
14773
15098
|
onTableConfigChange(newConfig);
|
|
@@ -14795,7 +15120,7 @@ var DataTableSavedViews = forwardRef9((props, ref) => {
|
|
|
14795
15120
|
if (!internalTableConfig) {
|
|
14796
15121
|
return null;
|
|
14797
15122
|
}
|
|
14798
|
-
return /* @__PURE__ */
|
|
15123
|
+
return /* @__PURE__ */ React24.createElement(ToastAlertProvider2, null, /* @__PURE__ */ React24.createElement(
|
|
14799
15124
|
SavedViews,
|
|
14800
15125
|
{
|
|
14801
15126
|
onSelect,
|