@procore/saved-views 5.0.0 → 5.1.0-alpha.1
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 +4 -1
- package/dist/legacy/index.d.ts +4 -1
- package/dist/legacy/index.js +527 -161
- package/dist/legacy/index.mjs +551 -185
- package/dist/modern/index.d.mts +4 -1
- package/dist/modern/index.d.ts +4 -1
- package/dist/modern/index.js +526 -160
- package/dist/modern/index.mjs +550 -184
- 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",
|
|
@@ -11264,8 +11316,8 @@ import {
|
|
|
11264
11316
|
spacing as spacing2,
|
|
11265
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";
|
|
11269
11321
|
|
|
11270
11322
|
// ../../node_modules/@procore/core-http/dist/modern/index.js
|
|
11271
11323
|
function getCSRFToken() {
|
|
@@ -11420,6 +11472,18 @@ var useDeleteSavedView = (props) => useApiRequest(props, "DELETE", [
|
|
|
11420
11472
|
props.domain,
|
|
11421
11473
|
props.tableName
|
|
11422
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
|
+
};
|
|
11423
11487
|
|
|
11424
11488
|
// src/SavedViews/components/Panels/PanelContentUtils.ts
|
|
11425
11489
|
var import_lodash = __toESM(require_lodash());
|
|
@@ -11630,15 +11694,15 @@ import {
|
|
|
11630
11694
|
Typography,
|
|
11631
11695
|
useI18nContext as useI18nContext4
|
|
11632
11696
|
} from "@procore/core-react";
|
|
11633
|
-
import
|
|
11697
|
+
import React15 from "react";
|
|
11634
11698
|
var groupIcon = (group) => {
|
|
11635
11699
|
switch (group) {
|
|
11636
11700
|
case "personal":
|
|
11637
|
-
return /* @__PURE__ */
|
|
11701
|
+
return /* @__PURE__ */ React15.createElement(Person_default, null);
|
|
11638
11702
|
case "project":
|
|
11639
|
-
return /* @__PURE__ */
|
|
11703
|
+
return /* @__PURE__ */ React15.createElement(Excavator_default, null);
|
|
11640
11704
|
case "company":
|
|
11641
|
-
return /* @__PURE__ */
|
|
11705
|
+
return /* @__PURE__ */ React15.createElement(Building_default, null);
|
|
11642
11706
|
}
|
|
11643
11707
|
};
|
|
11644
11708
|
var Header = styled_components_esm_default(Flex2)`
|
|
@@ -11649,7 +11713,7 @@ var Header = styled_components_esm_default(Flex2)`
|
|
|
11649
11713
|
`;
|
|
11650
11714
|
var ViewLevelHeader = ({ expanded, toggleGroup, group }) => {
|
|
11651
11715
|
const I18n = useI18nContext4();
|
|
11652
|
-
return /* @__PURE__ */
|
|
11716
|
+
return /* @__PURE__ */ React15.createElement(
|
|
11653
11717
|
Header,
|
|
11654
11718
|
{
|
|
11655
11719
|
alignItems: "center",
|
|
@@ -11658,9 +11722,9 @@ var ViewLevelHeader = ({ expanded, toggleGroup, group }) => {
|
|
|
11658
11722
|
style: { cursor: "pointer" },
|
|
11659
11723
|
onClick: () => toggleGroup(group)
|
|
11660
11724
|
},
|
|
11661
|
-
expanded ? /* @__PURE__ */
|
|
11725
|
+
expanded ? /* @__PURE__ */ React15.createElement(ChevronDown_default, { size: "sm" }) : /* @__PURE__ */ React15.createElement(ChevronRight_default, { size: "sm" }),
|
|
11662
11726
|
groupIcon(group),
|
|
11663
|
-
/* @__PURE__ */
|
|
11727
|
+
/* @__PURE__ */ React15.createElement(Typography, { weight: "semibold" }, I18n.t(`savedViews.viewLevel.${group}`))
|
|
11664
11728
|
);
|
|
11665
11729
|
};
|
|
11666
11730
|
var ViewLevelHeader_default = ViewLevelHeader;
|
|
@@ -11695,19 +11759,18 @@ var Panel2 = styled_components_esm_default(DetailPage.Card)`
|
|
|
11695
11759
|
box-shadow: none;
|
|
11696
11760
|
`;
|
|
11697
11761
|
var PanelContent = (props) => {
|
|
11698
|
-
const { showToast } =
|
|
11762
|
+
const { showToast } = useToastAlertContext2();
|
|
11699
11763
|
const I18n = useI18nContext5();
|
|
11700
11764
|
const { mutate: updateSavedView, isPending: isUpdateLoading } = useUpdateSavedView(props.queryInput);
|
|
11701
|
-
const { data:
|
|
11702
|
-
|
|
11703
|
-
);
|
|
11704
|
-
|
|
11705
|
-
React15.useEffect(() => {
|
|
11765
|
+
const { data: savedViewsFromQuery, error: savedViewsError } = useSavedViewsQuery(props.queryInput);
|
|
11766
|
+
const savedViews = props.savedViews ?? savedViewsFromQuery;
|
|
11767
|
+
const errorToastRef = React16.useRef(null);
|
|
11768
|
+
React16.useEffect(() => {
|
|
11706
11769
|
if (savedViewsError && savedViewsError !== errorToastRef.current) {
|
|
11707
11770
|
showToast.error(I18n.t("savedViews.errors.fetch"));
|
|
11708
11771
|
errorToastRef.current = savedViewsError;
|
|
11709
11772
|
}
|
|
11710
|
-
}, [savedViewsError]);
|
|
11773
|
+
}, [savedViewsError, showToast, I18n]);
|
|
11711
11774
|
const { data: permissions } = useSavedViewsPermissions(props.queryInput);
|
|
11712
11775
|
const selectedRowRef = useScrollToRef(savedViews);
|
|
11713
11776
|
const onUpdate = (data) => {
|
|
@@ -11729,14 +11792,30 @@ var PanelContent = (props) => {
|
|
|
11729
11792
|
};
|
|
11730
11793
|
const { groups, toggleGroup } = useGroups();
|
|
11731
11794
|
const isDefaultSelected = props.selectedSavedView?.id === "default";
|
|
11732
|
-
|
|
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(
|
|
11733
11812
|
Row,
|
|
11734
11813
|
{
|
|
11735
11814
|
selected: isDefaultSelected,
|
|
11736
11815
|
onClick: () => props.onSelect({ item: props.defaultView }),
|
|
11737
11816
|
ref: isDefaultSelected ? selectedRowRef : null
|
|
11738
11817
|
},
|
|
11739
|
-
/* @__PURE__ */
|
|
11818
|
+
/* @__PURE__ */ React16.createElement(
|
|
11740
11819
|
SavedViewCollectionMenuItem,
|
|
11741
11820
|
{
|
|
11742
11821
|
item: props.defaultView,
|
|
@@ -11745,8 +11824,10 @@ var PanelContent = (props) => {
|
|
|
11745
11824
|
)
|
|
11746
11825
|
), VIEW_LEVELS.map((level) => {
|
|
11747
11826
|
const isExpanded = groups[level];
|
|
11748
|
-
const views = isExpanded && savedViews ? savedViews.filter(
|
|
11749
|
-
|
|
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(
|
|
11750
11831
|
ViewLevelHeader_default,
|
|
11751
11832
|
{
|
|
11752
11833
|
group: level,
|
|
@@ -11762,7 +11843,7 @@ var PanelContent = (props) => {
|
|
|
11762
11843
|
props.provider
|
|
11763
11844
|
);
|
|
11764
11845
|
const canEditOrDelete = isSelected && hasPermissionForViewLevel(view.view_level, permissions);
|
|
11765
|
-
return /* @__PURE__ */
|
|
11846
|
+
return /* @__PURE__ */ React16.createElement(
|
|
11766
11847
|
Row,
|
|
11767
11848
|
{
|
|
11768
11849
|
key: view.id,
|
|
@@ -11773,7 +11854,7 @@ var PanelContent = (props) => {
|
|
|
11773
11854
|
},
|
|
11774
11855
|
ref: isSelected ? selectedRowRef : null
|
|
11775
11856
|
},
|
|
11776
|
-
/* @__PURE__ */
|
|
11857
|
+
/* @__PURE__ */ React16.createElement(
|
|
11777
11858
|
SavedViewCollectionMenuItem,
|
|
11778
11859
|
{
|
|
11779
11860
|
item: view,
|
|
@@ -11794,7 +11875,7 @@ var PanelContent = (props) => {
|
|
|
11794
11875
|
};
|
|
11795
11876
|
|
|
11796
11877
|
// src/SavedViews/components/SavedViews/SmartGrid/SmartGridSavedViews.tsx
|
|
11797
|
-
import
|
|
11878
|
+
import React23 from "react";
|
|
11798
11879
|
|
|
11799
11880
|
// src/SavedViews/components/SavedViews/SmartGrid/SmartGridDefaultSavedView.tsx
|
|
11800
11881
|
import { useI18nContext as useI18nContext6 } from "@procore/core-react";
|
|
@@ -11856,13 +11937,13 @@ var useSmartGridConfig = (gridApi) => {
|
|
|
11856
11937
|
// src/SavedViews/components/SavedViews/SavedViews.tsx
|
|
11857
11938
|
import {
|
|
11858
11939
|
Box as Box2,
|
|
11859
|
-
Button as
|
|
11940
|
+
Button as Button6,
|
|
11860
11941
|
Flex as Flex5,
|
|
11861
11942
|
Panel as Panel3,
|
|
11862
11943
|
Tooltip,
|
|
11863
|
-
useI18nContext as
|
|
11944
|
+
useI18nContext as useI18nContext11
|
|
11864
11945
|
} from "@procore/core-react";
|
|
11865
|
-
import
|
|
11946
|
+
import React22 from "react";
|
|
11866
11947
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
11867
11948
|
|
|
11868
11949
|
// src/SavedViews/components/SavedViewsModals/SavedViewsDeleteConfirmationModalShared.tsx
|
|
@@ -11873,14 +11954,14 @@ import {
|
|
|
11873
11954
|
P as P2,
|
|
11874
11955
|
useI18nContext as useI18nContext7
|
|
11875
11956
|
} from "@procore/core-react";
|
|
11876
|
-
import
|
|
11957
|
+
import React17 from "react";
|
|
11877
11958
|
var SavedViewsDeleteConfirmationModalShared = ({
|
|
11878
11959
|
onCancel,
|
|
11879
11960
|
onDelete,
|
|
11880
11961
|
open
|
|
11881
11962
|
}) => {
|
|
11882
11963
|
const i18n = useI18nContext7();
|
|
11883
|
-
return /* @__PURE__ */
|
|
11964
|
+
return /* @__PURE__ */ React17.createElement(
|
|
11884
11965
|
ConfirmModal,
|
|
11885
11966
|
{
|
|
11886
11967
|
"data-testid": "delete-confirmation-modal",
|
|
@@ -11890,13 +11971,13 @@ var SavedViewsDeleteConfirmationModalShared = ({
|
|
|
11890
11971
|
onClose: onCancel,
|
|
11891
11972
|
style: { overflowWrap: "anywhere" }
|
|
11892
11973
|
},
|
|
11893
|
-
/* @__PURE__ */
|
|
11894
|
-
/* @__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"))))
|
|
11895
11976
|
);
|
|
11896
11977
|
};
|
|
11897
11978
|
|
|
11898
11979
|
// src/SavedViews/components/SavedViewsModals/SavedViewsFormModal.tsx
|
|
11899
|
-
import
|
|
11980
|
+
import React19 from "react";
|
|
11900
11981
|
|
|
11901
11982
|
// src/SavedViews/components/SavedViewsModals/SavedViewsCreateUpdateModalBase.tsx
|
|
11902
11983
|
import {
|
|
@@ -11912,7 +11993,7 @@ import {
|
|
|
11912
11993
|
Typography as Typography2,
|
|
11913
11994
|
useI18nContext as useI18nContext8
|
|
11914
11995
|
} from "@procore/core-react";
|
|
11915
|
-
import * as
|
|
11996
|
+
import * as React18 from "react";
|
|
11916
11997
|
|
|
11917
11998
|
// ../../node_modules/yup/index.esm.js
|
|
11918
11999
|
var import_property_expr = __toESM(require_property_expr());
|
|
@@ -14313,7 +14394,7 @@ var SavedViewsCreateUpdateModalBase = ({
|
|
|
14313
14394
|
}
|
|
14314
14395
|
};
|
|
14315
14396
|
const viewLevelOptions = getViewLevelOptions(permissions, I18n);
|
|
14316
|
-
return /* @__PURE__ */
|
|
14397
|
+
return /* @__PURE__ */ React18.createElement(
|
|
14317
14398
|
Modal2,
|
|
14318
14399
|
{
|
|
14319
14400
|
"aria-label": I18n.t("savedViews.ariaLabels.modal"),
|
|
@@ -14322,14 +14403,14 @@ var SavedViewsCreateUpdateModalBase = ({
|
|
|
14322
14403
|
style: { width: "540px" },
|
|
14323
14404
|
"data-testid": "create-update-modal"
|
|
14324
14405
|
},
|
|
14325
|
-
/* @__PURE__ */
|
|
14406
|
+
/* @__PURE__ */ React18.createElement(ScrollContainer, null, /* @__PURE__ */ React18.createElement(
|
|
14326
14407
|
Modal2.Header,
|
|
14327
14408
|
{
|
|
14328
14409
|
onClose,
|
|
14329
14410
|
style: { borderBottom: `1px solid ${colors3.gray85}` }
|
|
14330
14411
|
},
|
|
14331
|
-
/* @__PURE__ */
|
|
14332
|
-
), /* @__PURE__ */
|
|
14412
|
+
/* @__PURE__ */ React18.createElement(H2, null, header)
|
|
14413
|
+
), /* @__PURE__ */ React18.createElement(
|
|
14333
14414
|
Form,
|
|
14334
14415
|
{
|
|
14335
14416
|
initialValues: {
|
|
@@ -14355,13 +14436,13 @@ var SavedViewsCreateUpdateModalBase = ({
|
|
|
14355
14436
|
onReset: onCancel,
|
|
14356
14437
|
validateOnChange: true
|
|
14357
14438
|
},
|
|
14358
|
-
/* @__PURE__ */
|
|
14439
|
+
/* @__PURE__ */ React18.createElement(Form.Form, { name: header }, /* @__PURE__ */ React18.createElement(
|
|
14359
14440
|
Modal2.Body,
|
|
14360
14441
|
{
|
|
14361
14442
|
style: { paddingTop: 0, paddingBottom: 0, marginTop: spacing3.lg }
|
|
14362
14443
|
},
|
|
14363
|
-
errors && /* @__PURE__ */
|
|
14364
|
-
/* @__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(
|
|
14365
14446
|
Form.Text,
|
|
14366
14447
|
{
|
|
14367
14448
|
name: "name",
|
|
@@ -14372,12 +14453,12 @@ var SavedViewsCreateUpdateModalBase = ({
|
|
|
14372
14453
|
onChange: () => resetMutations()
|
|
14373
14454
|
}
|
|
14374
14455
|
)),
|
|
14375
|
-
/* @__PURE__ */
|
|
14456
|
+
/* @__PURE__ */ React18.createElement(
|
|
14376
14457
|
Form.Row,
|
|
14377
14458
|
{
|
|
14378
14459
|
style: { marginTop: errors?.name ? spacing3.xl : spacing3.none }
|
|
14379
14460
|
},
|
|
14380
|
-
/* @__PURE__ */
|
|
14461
|
+
/* @__PURE__ */ React18.createElement(
|
|
14381
14462
|
Form.TextArea,
|
|
14382
14463
|
{
|
|
14383
14464
|
name: "description",
|
|
@@ -14388,7 +14469,7 @@ var SavedViewsCreateUpdateModalBase = ({
|
|
|
14388
14469
|
}
|
|
14389
14470
|
)
|
|
14390
14471
|
),
|
|
14391
|
-
viewLevelOptions.length > 1 && mode === "create" /* CREATE */ ? /* @__PURE__ */
|
|
14472
|
+
viewLevelOptions.length > 1 && mode === "create" /* CREATE */ ? /* @__PURE__ */ React18.createElement(Form.Row, null, /* @__PURE__ */ React18.createElement(
|
|
14392
14473
|
Form.Select,
|
|
14393
14474
|
{
|
|
14394
14475
|
name: "view_level",
|
|
@@ -14398,8 +14479,8 @@ var SavedViewsCreateUpdateModalBase = ({
|
|
|
14398
14479
|
onSearch: false,
|
|
14399
14480
|
onClear: false
|
|
14400
14481
|
}
|
|
14401
|
-
)) : /* @__PURE__ */
|
|
14402
|
-
), /* @__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(
|
|
14403
14484
|
Button4,
|
|
14404
14485
|
{
|
|
14405
14486
|
"data-testid": "create-update-modal-button",
|
|
@@ -14430,7 +14511,7 @@ var SavedViewsFormModal = ({
|
|
|
14430
14511
|
defaultView
|
|
14431
14512
|
}) => {
|
|
14432
14513
|
const i18n = useI18nContext9();
|
|
14433
|
-
return /* @__PURE__ */
|
|
14514
|
+
return /* @__PURE__ */ React19.createElement(
|
|
14434
14515
|
SavedViewsCreateUpdateModalBase,
|
|
14435
14516
|
{
|
|
14436
14517
|
open,
|
|
@@ -14451,88 +14532,366 @@ var SavedViewsFormModal = ({
|
|
|
14451
14532
|
);
|
|
14452
14533
|
};
|
|
14453
14534
|
|
|
14454
|
-
// src/SavedViews/components/
|
|
14455
|
-
|
|
14456
|
-
|
|
14457
|
-
|
|
14458
|
-
|
|
14459
|
-
|
|
14460
|
-
|
|
14461
|
-
const queryInput = {
|
|
14462
|
-
domain: props.domain,
|
|
14463
|
-
tableName: props.tableName,
|
|
14464
|
-
enableSavedViews: props.enableSavedViews,
|
|
14465
|
-
projectId,
|
|
14466
|
-
companyId
|
|
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?.();
|
|
14467
14542
|
};
|
|
14468
|
-
const
|
|
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
|
+
)))
|
|
14574
|
+
);
|
|
14575
|
+
};
|
|
14576
|
+
|
|
14577
|
+
// src/utils/Hooks/useViewSelection.ts
|
|
14578
|
+
import { useState as useState4, useCallback as useCallback2 } from "react";
|
|
14579
|
+
|
|
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);
|
|
14589
|
+
}
|
|
14590
|
+
return;
|
|
14591
|
+
}
|
|
14592
|
+
const viewInUserViews = availableViews.find((v2) => v2.id === savedViewId);
|
|
14593
|
+
if (viewInUserViews) {
|
|
14594
|
+
if (viewInUserViews.id !== selectedView?.id) {
|
|
14595
|
+
onViewFound(viewInUserViews);
|
|
14596
|
+
}
|
|
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);
|
|
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) => {
|
|
14469
14645
|
const [selectedSavedView, setSelectedSavedView] = useState4(() => {
|
|
14470
14646
|
try {
|
|
14471
14647
|
const savedView = JSON.parse(
|
|
14472
14648
|
localStorage.getItem(
|
|
14473
|
-
`${
|
|
14649
|
+
`${config.domain}_${config.tableName}_${config.stickyViewsKey}_${config.projectId}_${config.userId}`
|
|
14474
14650
|
)
|
|
14475
14651
|
);
|
|
14476
|
-
return savedView ||
|
|
14652
|
+
return savedView || config.defaultView;
|
|
14477
14653
|
} catch (e2) {
|
|
14478
|
-
return
|
|
14654
|
+
return config.defaultView;
|
|
14479
14655
|
}
|
|
14480
14656
|
});
|
|
14481
|
-
const
|
|
14482
|
-
|
|
14483
|
-
|
|
14484
|
-
|
|
14485
|
-
|
|
14486
|
-
|
|
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;
|
|
14487
14692
|
}
|
|
14693
|
+
openCrossUserModal(viewId);
|
|
14488
14694
|
};
|
|
14489
|
-
const
|
|
14490
|
-
|
|
14491
|
-
|
|
14492
|
-
|
|
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
|
|
14493
14721
|
};
|
|
14494
|
-
|
|
14495
|
-
|
|
14496
|
-
|
|
14497
|
-
|
|
14722
|
+
};
|
|
14723
|
+
|
|
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();
|
|
14744
|
+
}
|
|
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
|
+
}
|
|
14498
14760
|
});
|
|
14499
14761
|
}
|
|
14500
14762
|
};
|
|
14501
|
-
const
|
|
14502
|
-
|
|
14503
|
-
|
|
14504
|
-
|
|
14505
|
-
|
|
14763
|
+
const selectCurrentViewAndCloseModal = () => {
|
|
14764
|
+
actions.selectView(selectedSavedView ?? defaultView);
|
|
14765
|
+
actions.closeModal();
|
|
14766
|
+
};
|
|
14767
|
+
return {
|
|
14768
|
+
fetchedView,
|
|
14769
|
+
viewSharedViewTemporarily,
|
|
14770
|
+
createPersonalCopyOfSharedView,
|
|
14771
|
+
selectCurrentViewAndCloseModal
|
|
14772
|
+
};
|
|
14773
|
+
};
|
|
14774
|
+
|
|
14775
|
+
// src/utils/Hooks/useModalState.ts
|
|
14776
|
+
import { useState as useState5, useCallback as useCallback3 } from "react";
|
|
14777
|
+
var useModalState = () => {
|
|
14778
|
+
const [activeModal, setActiveModal] = useState5(null);
|
|
14779
|
+
const [modalData, setModalData] = useState5(null);
|
|
14780
|
+
const openModal = useCallback3(
|
|
14781
|
+
(type, data) => {
|
|
14782
|
+
setActiveModal(type);
|
|
14783
|
+
setModalData(data ?? null);
|
|
14784
|
+
},
|
|
14785
|
+
[]
|
|
14786
|
+
);
|
|
14787
|
+
const closeModal = useCallback3(() => {
|
|
14788
|
+
setActiveModal(null);
|
|
14789
|
+
setModalData(null);
|
|
14790
|
+
}, []);
|
|
14791
|
+
const isModalOpen = useCallback3(
|
|
14792
|
+
(type) => {
|
|
14793
|
+
return activeModal === type;
|
|
14794
|
+
},
|
|
14795
|
+
[activeModal]
|
|
14506
14796
|
);
|
|
14507
|
-
|
|
14508
|
-
|
|
14797
|
+
return {
|
|
14798
|
+
openModal,
|
|
14799
|
+
closeModal,
|
|
14800
|
+
isModalOpen,
|
|
14801
|
+
modalData,
|
|
14802
|
+
activeModal
|
|
14509
14803
|
};
|
|
14510
|
-
|
|
14511
|
-
|
|
14804
|
+
};
|
|
14805
|
+
|
|
14806
|
+
// src/SavedViews/components/SavedViews/SavedViews.tsx
|
|
14807
|
+
var StyledPanel = styled_components_esm_default.div`
|
|
14808
|
+
border: ${({ provider }) => provider === "data-table" ? "1px solid #d6dadc" : "none"};
|
|
14809
|
+
`;
|
|
14810
|
+
var queryClient = new QueryClient();
|
|
14811
|
+
var SavedViewsContent = (props) => {
|
|
14812
|
+
const { projectId, companyId } = props;
|
|
14813
|
+
const queryInput = {
|
|
14814
|
+
domain: props.domain,
|
|
14815
|
+
tableName: props.tableName,
|
|
14816
|
+
enableSavedViews: props.enableSavedViews,
|
|
14817
|
+
projectId,
|
|
14818
|
+
companyId
|
|
14512
14819
|
};
|
|
14513
|
-
const
|
|
14514
|
-
|
|
14515
|
-
|
|
14820
|
+
const { data: savedViews } = useSavedViewsQuery(queryInput);
|
|
14821
|
+
const { mutate: deleteSavedView } = useDeleteSavedView(queryInput);
|
|
14822
|
+
const { openModal, closeModal, isModalOpen, modalData, activeModal } = useModalState();
|
|
14823
|
+
const openCrossUserModal = (viewId) => {
|
|
14824
|
+
openModal("crossUser" /* CROSS_USER */, { viewId });
|
|
14516
14825
|
};
|
|
14517
|
-
const
|
|
14518
|
-
|
|
14826
|
+
const {
|
|
14827
|
+
selectedView,
|
|
14828
|
+
selectView,
|
|
14829
|
+
updateLocalStorage,
|
|
14830
|
+
temporaryView,
|
|
14831
|
+
createTemporaryView
|
|
14832
|
+
} = useViewSelection(
|
|
14833
|
+
{
|
|
14834
|
+
domain: props.domain,
|
|
14835
|
+
tableName: props.tableName,
|
|
14836
|
+
stickyViewsKey: props.stickyViewsKey,
|
|
14837
|
+
userId: props.userId,
|
|
14838
|
+
projectId,
|
|
14839
|
+
defaultView: props.defaultView,
|
|
14840
|
+
onSelect: props.onSelect
|
|
14841
|
+
},
|
|
14842
|
+
savedViews,
|
|
14843
|
+
openCrossUserModal
|
|
14844
|
+
);
|
|
14845
|
+
const {
|
|
14846
|
+
fetchedView,
|
|
14847
|
+
viewSharedViewTemporarily,
|
|
14848
|
+
createPersonalCopyOfSharedView,
|
|
14849
|
+
selectCurrentViewAndCloseModal
|
|
14850
|
+
} = useCrossUserSharing(
|
|
14851
|
+
queryInput,
|
|
14852
|
+
modalData?.viewId ?? null,
|
|
14853
|
+
selectedView,
|
|
14854
|
+
props.defaultView,
|
|
14855
|
+
{
|
|
14856
|
+
selectView,
|
|
14857
|
+
createTemporaryView,
|
|
14858
|
+
closeModal
|
|
14859
|
+
},
|
|
14860
|
+
props.tableName
|
|
14861
|
+
);
|
|
14862
|
+
const deleteSelectedView = () => {
|
|
14863
|
+
if (selectedView) {
|
|
14864
|
+
deleteSavedView(selectedView, {
|
|
14865
|
+
onSuccess: () => selectView(props.defaultView)
|
|
14866
|
+
});
|
|
14867
|
+
}
|
|
14868
|
+
};
|
|
14869
|
+
const confirmDeleteAndCloseModal = () => {
|
|
14870
|
+
deleteSelectedView();
|
|
14871
|
+
closeModal();
|
|
14519
14872
|
};
|
|
14520
|
-
|
|
14873
|
+
const i18n = useI18nContext11();
|
|
14874
|
+
const selectSavedViewFromList = ({ item }) => selectView(item);
|
|
14875
|
+
const setSelectedSavedView = (view) => {
|
|
14876
|
+
selectView(view);
|
|
14877
|
+
};
|
|
14878
|
+
const allViews = temporaryView ? [...savedViews ?? [], temporaryView] : savedViews ?? [];
|
|
14879
|
+
return /* @__PURE__ */ React22.createElement(StyledPanel, { provider: props.provider }, /* @__PURE__ */ React22.createElement(
|
|
14521
14880
|
ExpandedPanel,
|
|
14522
14881
|
{
|
|
14523
14882
|
"data-testid": "saved-view-expanded-panel",
|
|
14524
14883
|
provider: props.provider
|
|
14525
14884
|
},
|
|
14526
|
-
/* @__PURE__ */
|
|
14885
|
+
/* @__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(
|
|
14527
14886
|
Tooltip,
|
|
14528
14887
|
{
|
|
14529
14888
|
overlay: i18n.t("savedViews.actions.create"),
|
|
14530
14889
|
showDelay: 1e3
|
|
14531
14890
|
},
|
|
14532
|
-
/* @__PURE__ */
|
|
14533
|
-
|
|
14891
|
+
/* @__PURE__ */ React22.createElement("span", null, /* @__PURE__ */ React22.createElement(
|
|
14892
|
+
Button6,
|
|
14534
14893
|
{
|
|
14535
|
-
icon: /* @__PURE__ */
|
|
14894
|
+
icon: /* @__PURE__ */ React22.createElement(Plus_default, null),
|
|
14536
14895
|
variant: "secondary",
|
|
14537
14896
|
"data-testid": "expanded-panel-create-button",
|
|
14538
14897
|
onClick: () => openModal("create" /* CREATE */),
|
|
@@ -14541,52 +14900,59 @@ var SavedViewsContent = (props) => {
|
|
|
14541
14900
|
i18n.t("savedViews.actions.create")
|
|
14542
14901
|
))
|
|
14543
14902
|
)),
|
|
14544
|
-
/* @__PURE__ */
|
|
14903
|
+
/* @__PURE__ */ React22.createElement(Panel3.Body, { style: { display: "flex", flexFlow: "column" } }, /* @__PURE__ */ React22.createElement(
|
|
14545
14904
|
PanelContent,
|
|
14546
14905
|
{
|
|
14547
|
-
onSelect:
|
|
14906
|
+
onSelect: selectSavedViewFromList,
|
|
14548
14907
|
openModal,
|
|
14549
|
-
onDelete:
|
|
14908
|
+
onDelete: () => openModal("delete" /* DELETE */),
|
|
14550
14909
|
updateLocalStorage,
|
|
14551
14910
|
setSelectedSavedView,
|
|
14552
14911
|
queryInput,
|
|
14553
|
-
selectedSavedView,
|
|
14912
|
+
selectedSavedView: selectedView,
|
|
14554
14913
|
tableConfig: props.tableConfig,
|
|
14555
14914
|
defaultView: props.defaultView,
|
|
14556
14915
|
stickyViewsKey: props.stickyViewsKey,
|
|
14916
|
+
savedViews: allViews,
|
|
14557
14917
|
provider: props.provider,
|
|
14558
14918
|
userId: props.userId
|
|
14559
14919
|
}
|
|
14560
14920
|
))
|
|
14561
|
-
), /* @__PURE__ */
|
|
14921
|
+
), (isModalOpen("create" /* CREATE */) || isModalOpen("update" /* UPDATE */)) && /* @__PURE__ */ React22.createElement(
|
|
14562
14922
|
SavedViewsFormModal,
|
|
14563
14923
|
{
|
|
14564
|
-
open:
|
|
14565
|
-
mode:
|
|
14566
|
-
onCancel:
|
|
14924
|
+
open: true,
|
|
14925
|
+
mode: activeModal,
|
|
14926
|
+
onCancel: closeModal,
|
|
14567
14927
|
queryInput,
|
|
14568
14928
|
tableConfig: props.tableConfig,
|
|
14569
14929
|
tableName: props.tableName,
|
|
14570
|
-
selectedSavedView,
|
|
14930
|
+
selectedSavedView: selectedView,
|
|
14571
14931
|
setSelectedSavedView,
|
|
14572
|
-
onSelect:
|
|
14573
|
-
setOpenEditCreateModal,
|
|
14932
|
+
onSelect: selectView,
|
|
14933
|
+
setOpenEditCreateModal: closeModal,
|
|
14574
14934
|
defaultView: props.defaultView
|
|
14575
14935
|
}
|
|
14576
|
-
),
|
|
14936
|
+
), selectedView && isModalOpen("delete" /* DELETE */) && /* @__PURE__ */ React22.createElement(
|
|
14577
14937
|
SavedViewsDeleteConfirmationModalShared,
|
|
14578
14938
|
{
|
|
14579
|
-
open:
|
|
14580
|
-
onDelete:
|
|
14581
|
-
|
|
14582
|
-
|
|
14583
|
-
|
|
14584
|
-
|
|
14939
|
+
open: true,
|
|
14940
|
+
onDelete: confirmDeleteAndCloseModal,
|
|
14941
|
+
onCancel: closeModal
|
|
14942
|
+
}
|
|
14943
|
+
), fetchedView && isModalOpen("crossUser" /* CROSS_USER */) && /* @__PURE__ */ React22.createElement(
|
|
14944
|
+
CreateViewConfirmationModal,
|
|
14945
|
+
{
|
|
14946
|
+
open: true,
|
|
14947
|
+
savedViewName: fetchedView.name,
|
|
14948
|
+
onClose: selectCurrentViewAndCloseModal,
|
|
14949
|
+
onViewTemporarily: viewSharedViewTemporarily,
|
|
14950
|
+
onCreateView: createPersonalCopyOfSharedView
|
|
14585
14951
|
}
|
|
14586
14952
|
));
|
|
14587
14953
|
};
|
|
14588
14954
|
var SavedViews = (props) => {
|
|
14589
|
-
return /* @__PURE__ */
|
|
14955
|
+
return /* @__PURE__ */ React22.createElement(EnvironmentI18nProvider, null, /* @__PURE__ */ React22.createElement(QueryClientProvider, { client: queryClient }, /* @__PURE__ */ React22.createElement(SavedViewsContent, { ...props })));
|
|
14590
14956
|
};
|
|
14591
14957
|
|
|
14592
14958
|
// src/SavedViews/components/SavedViews/SmartGrid/SmartGridSavedViews.tsx
|
|
@@ -14620,7 +14986,7 @@ var SmartGridSavedViews = (props) => {
|
|
|
14620
14986
|
setTableConfig(updatedView.table_config);
|
|
14621
14987
|
return updatedView;
|
|
14622
14988
|
};
|
|
14623
|
-
return /* @__PURE__ */
|
|
14989
|
+
return /* @__PURE__ */ React23.createElement(ToastAlertProvider, null, /* @__PURE__ */ React23.createElement(
|
|
14624
14990
|
SavedViews,
|
|
14625
14991
|
{
|
|
14626
14992
|
onSelect,
|
|
@@ -14639,16 +15005,16 @@ var SmartGridSavedViews = (props) => {
|
|
|
14639
15005
|
};
|
|
14640
15006
|
|
|
14641
15007
|
// src/SavedViews/components/SavedViews/DataTable/DataTableSavedViews.tsx
|
|
14642
|
-
import
|
|
14643
|
-
forwardRef as
|
|
15008
|
+
import React24, {
|
|
15009
|
+
forwardRef as forwardRef10,
|
|
14644
15010
|
useImperativeHandle,
|
|
14645
|
-
useState as
|
|
14646
|
-
useCallback as
|
|
15011
|
+
useState as useState6,
|
|
15012
|
+
useCallback as useCallback4
|
|
14647
15013
|
} from "react";
|
|
14648
15014
|
|
|
14649
15015
|
// src/SavedViews/components/SavedViews/DataTable/DataTableDefaultSavedView.tsx
|
|
14650
15016
|
import { useMemo } from "react";
|
|
14651
|
-
import { useI18nContext as
|
|
15017
|
+
import { useI18nContext as useI18nContext12 } from "@procore/core-react";
|
|
14652
15018
|
var DEFAULT_COLUMN_STATE = {
|
|
14653
15019
|
hidden: false,
|
|
14654
15020
|
pinned: null,
|
|
@@ -14695,7 +15061,7 @@ var extractDefaultView = (columnDefinitions, receivedConfigFromTool) => {
|
|
|
14695
15061
|
return result;
|
|
14696
15062
|
};
|
|
14697
15063
|
var useDefaultViewName2 = (domain, defaultViewName) => {
|
|
14698
|
-
const i18n =
|
|
15064
|
+
const i18n = useI18nContext12();
|
|
14699
15065
|
return defaultViewName || i18n.t(domain, {
|
|
14700
15066
|
scope: "savedViews.defaultViewTitle",
|
|
14701
15067
|
defaultValue: "Default View"
|
|
@@ -14717,9 +15083,9 @@ var useDefaultView2 = (props) => {
|
|
|
14717
15083
|
|
|
14718
15084
|
// src/SavedViews/components/SavedViews/DataTable/DataTableSavedViews.tsx
|
|
14719
15085
|
import { ToastAlertProvider as ToastAlertProvider2 } from "@procore/toast-alert";
|
|
14720
|
-
var DataTableSavedViews =
|
|
15086
|
+
var DataTableSavedViews = forwardRef10((props, ref) => {
|
|
14721
15087
|
const { tableApi, onTableConfigChange, projectId, companyId } = props;
|
|
14722
|
-
const [internalTableConfig, setInternalTableConfig] =
|
|
15088
|
+
const [internalTableConfig, setInternalTableConfig] = useState6(
|
|
14723
15089
|
props.defaultViewConfig
|
|
14724
15090
|
);
|
|
14725
15091
|
useImperativeHandle(ref, () => ({
|
|
@@ -14727,7 +15093,7 @@ var DataTableSavedViews = forwardRef9((props, ref) => {
|
|
|
14727
15093
|
handleConfigChange(newConfig);
|
|
14728
15094
|
}
|
|
14729
15095
|
}));
|
|
14730
|
-
const handleConfigChange =
|
|
15096
|
+
const handleConfigChange = useCallback4(
|
|
14731
15097
|
(newConfig) => {
|
|
14732
15098
|
setInternalTableConfig(newConfig);
|
|
14733
15099
|
onTableConfigChange(newConfig);
|
|
@@ -14755,7 +15121,7 @@ var DataTableSavedViews = forwardRef9((props, ref) => {
|
|
|
14755
15121
|
if (!internalTableConfig) {
|
|
14756
15122
|
return null;
|
|
14757
15123
|
}
|
|
14758
|
-
return /* @__PURE__ */
|
|
15124
|
+
return /* @__PURE__ */ React24.createElement(ToastAlertProvider2, null, /* @__PURE__ */ React24.createElement(
|
|
14759
15125
|
SavedViews,
|
|
14760
15126
|
{
|
|
14761
15127
|
onSelect,
|