@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/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",
|
|
@@ -11266,8 +11318,8 @@ import {
|
|
|
11266
11318
|
spacing as spacing2,
|
|
11267
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";
|
|
11271
11323
|
|
|
11272
11324
|
// ../../node_modules/@procore/core-http/dist/modern/index.js
|
|
11273
11325
|
function getCSRFToken() {
|
|
@@ -11422,6 +11474,18 @@ var useDeleteSavedView = (props) => useApiRequest(props, "DELETE", [
|
|
|
11422
11474
|
props.domain,
|
|
11423
11475
|
props.tableName
|
|
11424
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
|
+
};
|
|
11425
11489
|
|
|
11426
11490
|
// src/SavedViews/components/Panels/PanelContentUtils.ts
|
|
11427
11491
|
var import_lodash = __toESM(require_lodash());
|
|
@@ -11632,15 +11696,15 @@ import {
|
|
|
11632
11696
|
Typography,
|
|
11633
11697
|
useI18nContext as useI18nContext4
|
|
11634
11698
|
} from "@procore/core-react";
|
|
11635
|
-
import
|
|
11699
|
+
import React15 from "react";
|
|
11636
11700
|
var groupIcon = (group) => {
|
|
11637
11701
|
switch (group) {
|
|
11638
11702
|
case "personal":
|
|
11639
|
-
return /* @__PURE__ */
|
|
11703
|
+
return /* @__PURE__ */ React15.createElement(Person_default, null);
|
|
11640
11704
|
case "project":
|
|
11641
|
-
return /* @__PURE__ */
|
|
11705
|
+
return /* @__PURE__ */ React15.createElement(Excavator_default, null);
|
|
11642
11706
|
case "company":
|
|
11643
|
-
return /* @__PURE__ */
|
|
11707
|
+
return /* @__PURE__ */ React15.createElement(Building_default, null);
|
|
11644
11708
|
}
|
|
11645
11709
|
};
|
|
11646
11710
|
var Header = styled_components_esm_default(Flex2)`
|
|
@@ -11651,7 +11715,7 @@ var Header = styled_components_esm_default(Flex2)`
|
|
|
11651
11715
|
`;
|
|
11652
11716
|
var ViewLevelHeader = ({ expanded, toggleGroup, group }) => {
|
|
11653
11717
|
const I18n = useI18nContext4();
|
|
11654
|
-
return /* @__PURE__ */
|
|
11718
|
+
return /* @__PURE__ */ React15.createElement(
|
|
11655
11719
|
Header,
|
|
11656
11720
|
{
|
|
11657
11721
|
alignItems: "center",
|
|
@@ -11660,9 +11724,9 @@ var ViewLevelHeader = ({ expanded, toggleGroup, group }) => {
|
|
|
11660
11724
|
style: { cursor: "pointer" },
|
|
11661
11725
|
onClick: () => toggleGroup(group)
|
|
11662
11726
|
},
|
|
11663
|
-
expanded ? /* @__PURE__ */
|
|
11727
|
+
expanded ? /* @__PURE__ */ React15.createElement(ChevronDown_default, { size: "sm" }) : /* @__PURE__ */ React15.createElement(ChevronRight_default, { size: "sm" }),
|
|
11664
11728
|
groupIcon(group),
|
|
11665
|
-
/* @__PURE__ */
|
|
11729
|
+
/* @__PURE__ */ React15.createElement(Typography, { weight: "semibold" }, I18n.t(`savedViews.viewLevel.${group}`))
|
|
11666
11730
|
);
|
|
11667
11731
|
};
|
|
11668
11732
|
var ViewLevelHeader_default = ViewLevelHeader;
|
|
@@ -11697,20 +11761,19 @@ var Panel2 = styled_components_esm_default(DetailPage.Card)`
|
|
|
11697
11761
|
box-shadow: none;
|
|
11698
11762
|
`;
|
|
11699
11763
|
var PanelContent = (props) => {
|
|
11700
|
-
var _a;
|
|
11701
|
-
const { showToast } =
|
|
11764
|
+
var _a, _b;
|
|
11765
|
+
const { showToast } = useToastAlertContext2();
|
|
11702
11766
|
const I18n = useI18nContext5();
|
|
11703
11767
|
const { mutate: updateSavedView, isPending: isUpdateLoading } = useUpdateSavedView(props.queryInput);
|
|
11704
|
-
const { data:
|
|
11705
|
-
|
|
11706
|
-
);
|
|
11707
|
-
|
|
11708
|
-
React15.useEffect(() => {
|
|
11768
|
+
const { data: savedViewsFromQuery, error: savedViewsError } = useSavedViewsQuery(props.queryInput);
|
|
11769
|
+
const savedViews = props.savedViews ?? savedViewsFromQuery;
|
|
11770
|
+
const errorToastRef = React16.useRef(null);
|
|
11771
|
+
React16.useEffect(() => {
|
|
11709
11772
|
if (savedViewsError && savedViewsError !== errorToastRef.current) {
|
|
11710
11773
|
showToast.error(I18n.t("savedViews.errors.fetch"));
|
|
11711
11774
|
errorToastRef.current = savedViewsError;
|
|
11712
11775
|
}
|
|
11713
|
-
}, [savedViewsError]);
|
|
11776
|
+
}, [savedViewsError, showToast, I18n]);
|
|
11714
11777
|
const { data: permissions } = useSavedViewsPermissions(props.queryInput);
|
|
11715
11778
|
const selectedRowRef = useScrollToRef(savedViews);
|
|
11716
11779
|
const onUpdate = (data) => {
|
|
@@ -11732,14 +11795,30 @@ var PanelContent = (props) => {
|
|
|
11732
11795
|
};
|
|
11733
11796
|
const { groups, toggleGroup } = useGroups();
|
|
11734
11797
|
const isDefaultSelected = ((_a = props.selectedSavedView) == null ? void 0 : _a.id) === "default";
|
|
11735
|
-
|
|
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(
|
|
11736
11815
|
Row,
|
|
11737
11816
|
{
|
|
11738
11817
|
selected: isDefaultSelected,
|
|
11739
11818
|
onClick: () => props.onSelect({ item: props.defaultView }),
|
|
11740
11819
|
ref: isDefaultSelected ? selectedRowRef : null
|
|
11741
11820
|
},
|
|
11742
|
-
/* @__PURE__ */
|
|
11821
|
+
/* @__PURE__ */ React16.createElement(
|
|
11743
11822
|
SavedViewCollectionMenuItem,
|
|
11744
11823
|
{
|
|
11745
11824
|
item: props.defaultView,
|
|
@@ -11748,8 +11827,10 @@ var PanelContent = (props) => {
|
|
|
11748
11827
|
)
|
|
11749
11828
|
), VIEW_LEVELS.map((level) => {
|
|
11750
11829
|
const isExpanded = groups[level];
|
|
11751
|
-
const views = isExpanded && savedViews ? savedViews.filter(
|
|
11752
|
-
|
|
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(
|
|
11753
11834
|
ViewLevelHeader_default,
|
|
11754
11835
|
{
|
|
11755
11836
|
group: level,
|
|
@@ -11766,7 +11847,7 @@ var PanelContent = (props) => {
|
|
|
11766
11847
|
props.provider
|
|
11767
11848
|
);
|
|
11768
11849
|
const canEditOrDelete = isSelected && hasPermissionForViewLevel(view.view_level, permissions);
|
|
11769
|
-
return /* @__PURE__ */
|
|
11850
|
+
return /* @__PURE__ */ React16.createElement(
|
|
11770
11851
|
Row,
|
|
11771
11852
|
{
|
|
11772
11853
|
key: view.id,
|
|
@@ -11777,7 +11858,7 @@ var PanelContent = (props) => {
|
|
|
11777
11858
|
},
|
|
11778
11859
|
ref: isSelected ? selectedRowRef : null
|
|
11779
11860
|
},
|
|
11780
|
-
/* @__PURE__ */
|
|
11861
|
+
/* @__PURE__ */ React16.createElement(
|
|
11781
11862
|
SavedViewCollectionMenuItem,
|
|
11782
11863
|
{
|
|
11783
11864
|
item: view,
|
|
@@ -11798,7 +11879,7 @@ var PanelContent = (props) => {
|
|
|
11798
11879
|
};
|
|
11799
11880
|
|
|
11800
11881
|
// src/SavedViews/components/SavedViews/SmartGrid/SmartGridSavedViews.tsx
|
|
11801
|
-
import
|
|
11882
|
+
import React23 from "react";
|
|
11802
11883
|
|
|
11803
11884
|
// src/SavedViews/components/SavedViews/SmartGrid/SmartGridDefaultSavedView.tsx
|
|
11804
11885
|
import { useI18nContext as useI18nContext6 } from "@procore/core-react";
|
|
@@ -11860,13 +11941,13 @@ var useSmartGridConfig = (gridApi) => {
|
|
|
11860
11941
|
// src/SavedViews/components/SavedViews/SavedViews.tsx
|
|
11861
11942
|
import {
|
|
11862
11943
|
Box as Box2,
|
|
11863
|
-
Button as
|
|
11944
|
+
Button as Button6,
|
|
11864
11945
|
Flex as Flex5,
|
|
11865
11946
|
Panel as Panel3,
|
|
11866
11947
|
Tooltip,
|
|
11867
|
-
useI18nContext as
|
|
11948
|
+
useI18nContext as useI18nContext11
|
|
11868
11949
|
} from "@procore/core-react";
|
|
11869
|
-
import
|
|
11950
|
+
import React22 from "react";
|
|
11870
11951
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
11871
11952
|
|
|
11872
11953
|
// src/SavedViews/components/SavedViewsModals/SavedViewsDeleteConfirmationModalShared.tsx
|
|
@@ -11877,14 +11958,14 @@ import {
|
|
|
11877
11958
|
P as P2,
|
|
11878
11959
|
useI18nContext as useI18nContext7
|
|
11879
11960
|
} from "@procore/core-react";
|
|
11880
|
-
import
|
|
11961
|
+
import React17 from "react";
|
|
11881
11962
|
var SavedViewsDeleteConfirmationModalShared = ({
|
|
11882
11963
|
onCancel,
|
|
11883
11964
|
onDelete,
|
|
11884
11965
|
open
|
|
11885
11966
|
}) => {
|
|
11886
11967
|
const i18n = useI18nContext7();
|
|
11887
|
-
return /* @__PURE__ */
|
|
11968
|
+
return /* @__PURE__ */ React17.createElement(
|
|
11888
11969
|
ConfirmModal,
|
|
11889
11970
|
{
|
|
11890
11971
|
"data-testid": "delete-confirmation-modal",
|
|
@@ -11894,13 +11975,13 @@ var SavedViewsDeleteConfirmationModalShared = ({
|
|
|
11894
11975
|
onClose: onCancel,
|
|
11895
11976
|
style: { overflowWrap: "anywhere" }
|
|
11896
11977
|
},
|
|
11897
|
-
/* @__PURE__ */
|
|
11898
|
-
/* @__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"))))
|
|
11899
11980
|
);
|
|
11900
11981
|
};
|
|
11901
11982
|
|
|
11902
11983
|
// src/SavedViews/components/SavedViewsModals/SavedViewsFormModal.tsx
|
|
11903
|
-
import
|
|
11984
|
+
import React19 from "react";
|
|
11904
11985
|
|
|
11905
11986
|
// src/SavedViews/components/SavedViewsModals/SavedViewsCreateUpdateModalBase.tsx
|
|
11906
11987
|
import {
|
|
@@ -11916,7 +11997,7 @@ import {
|
|
|
11916
11997
|
Typography as Typography2,
|
|
11917
11998
|
useI18nContext as useI18nContext8
|
|
11918
11999
|
} from "@procore/core-react";
|
|
11919
|
-
import * as
|
|
12000
|
+
import * as React18 from "react";
|
|
11920
12001
|
|
|
11921
12002
|
// ../../node_modules/yup/index.esm.js
|
|
11922
12003
|
var import_property_expr = __toESM(require_property_expr());
|
|
@@ -14317,7 +14398,7 @@ var SavedViewsCreateUpdateModalBase = ({
|
|
|
14317
14398
|
}
|
|
14318
14399
|
};
|
|
14319
14400
|
const viewLevelOptions = getViewLevelOptions(permissions, I18n);
|
|
14320
|
-
return /* @__PURE__ */
|
|
14401
|
+
return /* @__PURE__ */ React18.createElement(
|
|
14321
14402
|
Modal2,
|
|
14322
14403
|
{
|
|
14323
14404
|
"aria-label": I18n.t("savedViews.ariaLabels.modal"),
|
|
@@ -14326,14 +14407,14 @@ var SavedViewsCreateUpdateModalBase = ({
|
|
|
14326
14407
|
style: { width: "540px" },
|
|
14327
14408
|
"data-testid": "create-update-modal"
|
|
14328
14409
|
},
|
|
14329
|
-
/* @__PURE__ */
|
|
14410
|
+
/* @__PURE__ */ React18.createElement(ScrollContainer, null, /* @__PURE__ */ React18.createElement(
|
|
14330
14411
|
Modal2.Header,
|
|
14331
14412
|
{
|
|
14332
14413
|
onClose,
|
|
14333
14414
|
style: { borderBottom: `1px solid ${colors3.gray85}` }
|
|
14334
14415
|
},
|
|
14335
|
-
/* @__PURE__ */
|
|
14336
|
-
), /* @__PURE__ */
|
|
14416
|
+
/* @__PURE__ */ React18.createElement(H2, null, header)
|
|
14417
|
+
), /* @__PURE__ */ React18.createElement(
|
|
14337
14418
|
Form,
|
|
14338
14419
|
{
|
|
14339
14420
|
initialValues: {
|
|
@@ -14359,13 +14440,13 @@ var SavedViewsCreateUpdateModalBase = ({
|
|
|
14359
14440
|
onReset: onCancel,
|
|
14360
14441
|
validateOnChange: true
|
|
14361
14442
|
},
|
|
14362
|
-
/* @__PURE__ */
|
|
14443
|
+
/* @__PURE__ */ React18.createElement(Form.Form, { name: header }, /* @__PURE__ */ React18.createElement(
|
|
14363
14444
|
Modal2.Body,
|
|
14364
14445
|
{
|
|
14365
14446
|
style: { paddingTop: 0, paddingBottom: 0, marginTop: spacing3.lg }
|
|
14366
14447
|
},
|
|
14367
|
-
errors && /* @__PURE__ */
|
|
14368
|
-
/* @__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(
|
|
14369
14450
|
Form.Text,
|
|
14370
14451
|
{
|
|
14371
14452
|
name: "name",
|
|
@@ -14376,12 +14457,12 @@ var SavedViewsCreateUpdateModalBase = ({
|
|
|
14376
14457
|
onChange: () => resetMutations()
|
|
14377
14458
|
}
|
|
14378
14459
|
)),
|
|
14379
|
-
/* @__PURE__ */
|
|
14460
|
+
/* @__PURE__ */ React18.createElement(
|
|
14380
14461
|
Form.Row,
|
|
14381
14462
|
{
|
|
14382
14463
|
style: { marginTop: (errors == null ? void 0 : errors.name) ? spacing3.xl : spacing3.none }
|
|
14383
14464
|
},
|
|
14384
|
-
/* @__PURE__ */
|
|
14465
|
+
/* @__PURE__ */ React18.createElement(
|
|
14385
14466
|
Form.TextArea,
|
|
14386
14467
|
{
|
|
14387
14468
|
name: "description",
|
|
@@ -14392,7 +14473,7 @@ var SavedViewsCreateUpdateModalBase = ({
|
|
|
14392
14473
|
}
|
|
14393
14474
|
)
|
|
14394
14475
|
),
|
|
14395
|
-
viewLevelOptions.length > 1 && mode === "create" /* CREATE */ ? /* @__PURE__ */
|
|
14476
|
+
viewLevelOptions.length > 1 && mode === "create" /* CREATE */ ? /* @__PURE__ */ React18.createElement(Form.Row, null, /* @__PURE__ */ React18.createElement(
|
|
14396
14477
|
Form.Select,
|
|
14397
14478
|
{
|
|
14398
14479
|
name: "view_level",
|
|
@@ -14402,8 +14483,8 @@ var SavedViewsCreateUpdateModalBase = ({
|
|
|
14402
14483
|
onSearch: false,
|
|
14403
14484
|
onClear: false
|
|
14404
14485
|
}
|
|
14405
|
-
)) : /* @__PURE__ */
|
|
14406
|
-
), /* @__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(
|
|
14407
14488
|
Button4,
|
|
14408
14489
|
{
|
|
14409
14490
|
"data-testid": "create-update-modal-button",
|
|
@@ -14434,7 +14515,7 @@ var SavedViewsFormModal = ({
|
|
|
14434
14515
|
defaultView
|
|
14435
14516
|
}) => {
|
|
14436
14517
|
const i18n = useI18nContext9();
|
|
14437
|
-
return /* @__PURE__ */
|
|
14518
|
+
return /* @__PURE__ */ React19.createElement(
|
|
14438
14519
|
SavedViewsCreateUpdateModalBase,
|
|
14439
14520
|
{
|
|
14440
14521
|
open,
|
|
@@ -14455,88 +14536,366 @@ var SavedViewsFormModal = ({
|
|
|
14455
14536
|
);
|
|
14456
14537
|
};
|
|
14457
14538
|
|
|
14458
|
-
// src/SavedViews/components/
|
|
14459
|
-
|
|
14460
|
-
|
|
14461
|
-
|
|
14462
|
-
|
|
14463
|
-
|
|
14464
|
-
|
|
14465
|
-
const queryInput = {
|
|
14466
|
-
domain: props.domain,
|
|
14467
|
-
tableName: props.tableName,
|
|
14468
|
-
enableSavedViews: props.enableSavedViews,
|
|
14469
|
-
projectId,
|
|
14470
|
-
companyId
|
|
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();
|
|
14471
14546
|
};
|
|
14472
|
-
const
|
|
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
|
+
)))
|
|
14578
|
+
);
|
|
14579
|
+
};
|
|
14580
|
+
|
|
14581
|
+
// src/utils/Hooks/useViewSelection.ts
|
|
14582
|
+
import { useState as useState4, useCallback as useCallback2 } from "react";
|
|
14583
|
+
|
|
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);
|
|
14593
|
+
}
|
|
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);
|
|
14600
|
+
}
|
|
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);
|
|
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) => {
|
|
14473
14649
|
const [selectedSavedView, setSelectedSavedView] = useState4(() => {
|
|
14474
14650
|
try {
|
|
14475
14651
|
const savedView = JSON.parse(
|
|
14476
14652
|
localStorage.getItem(
|
|
14477
|
-
`${
|
|
14653
|
+
`${config.domain}_${config.tableName}_${config.stickyViewsKey}_${config.projectId}_${config.userId}`
|
|
14478
14654
|
)
|
|
14479
14655
|
);
|
|
14480
|
-
return savedView ||
|
|
14656
|
+
return savedView || config.defaultView;
|
|
14481
14657
|
} catch (e2) {
|
|
14482
|
-
return
|
|
14658
|
+
return config.defaultView;
|
|
14483
14659
|
}
|
|
14484
14660
|
});
|
|
14485
|
-
const
|
|
14486
|
-
|
|
14487
|
-
|
|
14488
|
-
|
|
14489
|
-
|
|
14490
|
-
|
|
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;
|
|
14491
14696
|
}
|
|
14697
|
+
openCrossUserModal(viewId);
|
|
14492
14698
|
};
|
|
14493
|
-
const
|
|
14494
|
-
|
|
14495
|
-
|
|
14496
|
-
|
|
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
|
|
14497
14725
|
};
|
|
14498
|
-
|
|
14499
|
-
|
|
14500
|
-
|
|
14501
|
-
|
|
14726
|
+
};
|
|
14727
|
+
|
|
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();
|
|
14748
|
+
}
|
|
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
|
+
}
|
|
14502
14764
|
});
|
|
14503
14765
|
}
|
|
14504
14766
|
};
|
|
14505
|
-
const
|
|
14506
|
-
|
|
14507
|
-
|
|
14508
|
-
|
|
14509
|
-
|
|
14767
|
+
const selectCurrentViewAndCloseModal = () => {
|
|
14768
|
+
actions.selectView(selectedSavedView ?? defaultView);
|
|
14769
|
+
actions.closeModal();
|
|
14770
|
+
};
|
|
14771
|
+
return {
|
|
14772
|
+
fetchedView,
|
|
14773
|
+
viewSharedViewTemporarily,
|
|
14774
|
+
createPersonalCopyOfSharedView,
|
|
14775
|
+
selectCurrentViewAndCloseModal
|
|
14776
|
+
};
|
|
14777
|
+
};
|
|
14778
|
+
|
|
14779
|
+
// src/utils/Hooks/useModalState.ts
|
|
14780
|
+
import { useState as useState5, useCallback as useCallback3 } from "react";
|
|
14781
|
+
var useModalState = () => {
|
|
14782
|
+
const [activeModal, setActiveModal] = useState5(null);
|
|
14783
|
+
const [modalData, setModalData] = useState5(null);
|
|
14784
|
+
const openModal = useCallback3(
|
|
14785
|
+
(type, data) => {
|
|
14786
|
+
setActiveModal(type);
|
|
14787
|
+
setModalData(data ?? null);
|
|
14788
|
+
},
|
|
14789
|
+
[]
|
|
14790
|
+
);
|
|
14791
|
+
const closeModal = useCallback3(() => {
|
|
14792
|
+
setActiveModal(null);
|
|
14793
|
+
setModalData(null);
|
|
14794
|
+
}, []);
|
|
14795
|
+
const isModalOpen = useCallback3(
|
|
14796
|
+
(type) => {
|
|
14797
|
+
return activeModal === type;
|
|
14798
|
+
},
|
|
14799
|
+
[activeModal]
|
|
14510
14800
|
);
|
|
14511
|
-
|
|
14512
|
-
|
|
14801
|
+
return {
|
|
14802
|
+
openModal,
|
|
14803
|
+
closeModal,
|
|
14804
|
+
isModalOpen,
|
|
14805
|
+
modalData,
|
|
14806
|
+
activeModal
|
|
14513
14807
|
};
|
|
14514
|
-
|
|
14515
|
-
|
|
14808
|
+
};
|
|
14809
|
+
|
|
14810
|
+
// src/SavedViews/components/SavedViews/SavedViews.tsx
|
|
14811
|
+
var StyledPanel = styled_components_esm_default.div`
|
|
14812
|
+
border: ${({ provider }) => provider === "data-table" ? "1px solid #d6dadc" : "none"};
|
|
14813
|
+
`;
|
|
14814
|
+
var queryClient = new QueryClient();
|
|
14815
|
+
var SavedViewsContent = (props) => {
|
|
14816
|
+
const { projectId, companyId } = props;
|
|
14817
|
+
const queryInput = {
|
|
14818
|
+
domain: props.domain,
|
|
14819
|
+
tableName: props.tableName,
|
|
14820
|
+
enableSavedViews: props.enableSavedViews,
|
|
14821
|
+
projectId,
|
|
14822
|
+
companyId
|
|
14516
14823
|
};
|
|
14517
|
-
const
|
|
14518
|
-
|
|
14519
|
-
|
|
14824
|
+
const { data: savedViews } = useSavedViewsQuery(queryInput);
|
|
14825
|
+
const { mutate: deleteSavedView } = useDeleteSavedView(queryInput);
|
|
14826
|
+
const { openModal, closeModal, isModalOpen, modalData, activeModal } = useModalState();
|
|
14827
|
+
const openCrossUserModal = (viewId) => {
|
|
14828
|
+
openModal("crossUser" /* CROSS_USER */, { viewId });
|
|
14520
14829
|
};
|
|
14521
|
-
const
|
|
14522
|
-
|
|
14830
|
+
const {
|
|
14831
|
+
selectedView,
|
|
14832
|
+
selectView,
|
|
14833
|
+
updateLocalStorage,
|
|
14834
|
+
temporaryView,
|
|
14835
|
+
createTemporaryView
|
|
14836
|
+
} = useViewSelection(
|
|
14837
|
+
{
|
|
14838
|
+
domain: props.domain,
|
|
14839
|
+
tableName: props.tableName,
|
|
14840
|
+
stickyViewsKey: props.stickyViewsKey,
|
|
14841
|
+
userId: props.userId,
|
|
14842
|
+
projectId,
|
|
14843
|
+
defaultView: props.defaultView,
|
|
14844
|
+
onSelect: props.onSelect
|
|
14845
|
+
},
|
|
14846
|
+
savedViews,
|
|
14847
|
+
openCrossUserModal
|
|
14848
|
+
);
|
|
14849
|
+
const {
|
|
14850
|
+
fetchedView,
|
|
14851
|
+
viewSharedViewTemporarily,
|
|
14852
|
+
createPersonalCopyOfSharedView,
|
|
14853
|
+
selectCurrentViewAndCloseModal
|
|
14854
|
+
} = useCrossUserSharing(
|
|
14855
|
+
queryInput,
|
|
14856
|
+
(modalData == null ? void 0 : modalData.viewId) ?? null,
|
|
14857
|
+
selectedView,
|
|
14858
|
+
props.defaultView,
|
|
14859
|
+
{
|
|
14860
|
+
selectView,
|
|
14861
|
+
createTemporaryView,
|
|
14862
|
+
closeModal
|
|
14863
|
+
},
|
|
14864
|
+
props.tableName
|
|
14865
|
+
);
|
|
14866
|
+
const deleteSelectedView = () => {
|
|
14867
|
+
if (selectedView) {
|
|
14868
|
+
deleteSavedView(selectedView, {
|
|
14869
|
+
onSuccess: () => selectView(props.defaultView)
|
|
14870
|
+
});
|
|
14871
|
+
}
|
|
14872
|
+
};
|
|
14873
|
+
const confirmDeleteAndCloseModal = () => {
|
|
14874
|
+
deleteSelectedView();
|
|
14875
|
+
closeModal();
|
|
14523
14876
|
};
|
|
14524
|
-
|
|
14877
|
+
const i18n = useI18nContext11();
|
|
14878
|
+
const selectSavedViewFromList = ({ item }) => selectView(item);
|
|
14879
|
+
const setSelectedSavedView = (view) => {
|
|
14880
|
+
selectView(view);
|
|
14881
|
+
};
|
|
14882
|
+
const allViews = temporaryView ? [...savedViews ?? [], temporaryView] : savedViews ?? [];
|
|
14883
|
+
return /* @__PURE__ */ React22.createElement(StyledPanel, { provider: props.provider }, /* @__PURE__ */ React22.createElement(
|
|
14525
14884
|
ExpandedPanel,
|
|
14526
14885
|
{
|
|
14527
14886
|
"data-testid": "saved-view-expanded-panel",
|
|
14528
14887
|
provider: props.provider
|
|
14529
14888
|
},
|
|
14530
|
-
/* @__PURE__ */
|
|
14889
|
+
/* @__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(
|
|
14531
14890
|
Tooltip,
|
|
14532
14891
|
{
|
|
14533
14892
|
overlay: i18n.t("savedViews.actions.create"),
|
|
14534
14893
|
showDelay: 1e3
|
|
14535
14894
|
},
|
|
14536
|
-
/* @__PURE__ */
|
|
14537
|
-
|
|
14895
|
+
/* @__PURE__ */ React22.createElement("span", null, /* @__PURE__ */ React22.createElement(
|
|
14896
|
+
Button6,
|
|
14538
14897
|
{
|
|
14539
|
-
icon: /* @__PURE__ */
|
|
14898
|
+
icon: /* @__PURE__ */ React22.createElement(Plus_default, null),
|
|
14540
14899
|
variant: "secondary",
|
|
14541
14900
|
"data-testid": "expanded-panel-create-button",
|
|
14542
14901
|
onClick: () => openModal("create" /* CREATE */),
|
|
@@ -14545,52 +14904,59 @@ var SavedViewsContent = (props) => {
|
|
|
14545
14904
|
i18n.t("savedViews.actions.create")
|
|
14546
14905
|
))
|
|
14547
14906
|
)),
|
|
14548
|
-
/* @__PURE__ */
|
|
14907
|
+
/* @__PURE__ */ React22.createElement(Panel3.Body, { style: { display: "flex", flexFlow: "column" } }, /* @__PURE__ */ React22.createElement(
|
|
14549
14908
|
PanelContent,
|
|
14550
14909
|
{
|
|
14551
|
-
onSelect:
|
|
14910
|
+
onSelect: selectSavedViewFromList,
|
|
14552
14911
|
openModal,
|
|
14553
|
-
onDelete:
|
|
14912
|
+
onDelete: () => openModal("delete" /* DELETE */),
|
|
14554
14913
|
updateLocalStorage,
|
|
14555
14914
|
setSelectedSavedView,
|
|
14556
14915
|
queryInput,
|
|
14557
|
-
selectedSavedView,
|
|
14916
|
+
selectedSavedView: selectedView,
|
|
14558
14917
|
tableConfig: props.tableConfig,
|
|
14559
14918
|
defaultView: props.defaultView,
|
|
14560
14919
|
stickyViewsKey: props.stickyViewsKey,
|
|
14920
|
+
savedViews: allViews,
|
|
14561
14921
|
provider: props.provider,
|
|
14562
14922
|
userId: props.userId
|
|
14563
14923
|
}
|
|
14564
14924
|
))
|
|
14565
|
-
), /* @__PURE__ */
|
|
14925
|
+
), (isModalOpen("create" /* CREATE */) || isModalOpen("update" /* UPDATE */)) && /* @__PURE__ */ React22.createElement(
|
|
14566
14926
|
SavedViewsFormModal,
|
|
14567
14927
|
{
|
|
14568
|
-
open:
|
|
14569
|
-
mode:
|
|
14570
|
-
onCancel:
|
|
14928
|
+
open: true,
|
|
14929
|
+
mode: activeModal,
|
|
14930
|
+
onCancel: closeModal,
|
|
14571
14931
|
queryInput,
|
|
14572
14932
|
tableConfig: props.tableConfig,
|
|
14573
14933
|
tableName: props.tableName,
|
|
14574
|
-
selectedSavedView,
|
|
14934
|
+
selectedSavedView: selectedView,
|
|
14575
14935
|
setSelectedSavedView,
|
|
14576
|
-
onSelect:
|
|
14577
|
-
setOpenEditCreateModal,
|
|
14936
|
+
onSelect: selectView,
|
|
14937
|
+
setOpenEditCreateModal: closeModal,
|
|
14578
14938
|
defaultView: props.defaultView
|
|
14579
14939
|
}
|
|
14580
|
-
),
|
|
14940
|
+
), selectedView && isModalOpen("delete" /* DELETE */) && /* @__PURE__ */ React22.createElement(
|
|
14581
14941
|
SavedViewsDeleteConfirmationModalShared,
|
|
14582
14942
|
{
|
|
14583
|
-
open:
|
|
14584
|
-
onDelete:
|
|
14585
|
-
|
|
14586
|
-
|
|
14587
|
-
|
|
14588
|
-
|
|
14943
|
+
open: true,
|
|
14944
|
+
onDelete: confirmDeleteAndCloseModal,
|
|
14945
|
+
onCancel: closeModal
|
|
14946
|
+
}
|
|
14947
|
+
), fetchedView && isModalOpen("crossUser" /* CROSS_USER */) && /* @__PURE__ */ React22.createElement(
|
|
14948
|
+
CreateViewConfirmationModal,
|
|
14949
|
+
{
|
|
14950
|
+
open: true,
|
|
14951
|
+
savedViewName: fetchedView.name,
|
|
14952
|
+
onClose: selectCurrentViewAndCloseModal,
|
|
14953
|
+
onViewTemporarily: viewSharedViewTemporarily,
|
|
14954
|
+
onCreateView: createPersonalCopyOfSharedView
|
|
14589
14955
|
}
|
|
14590
14956
|
));
|
|
14591
14957
|
};
|
|
14592
14958
|
var SavedViews = (props) => {
|
|
14593
|
-
return /* @__PURE__ */
|
|
14959
|
+
return /* @__PURE__ */ React22.createElement(EnvironmentI18nProvider, null, /* @__PURE__ */ React22.createElement(QueryClientProvider, { client: queryClient }, /* @__PURE__ */ React22.createElement(SavedViewsContent, { ...props })));
|
|
14594
14960
|
};
|
|
14595
14961
|
|
|
14596
14962
|
// src/SavedViews/components/SavedViews/SmartGrid/SmartGridSavedViews.tsx
|
|
@@ -14624,7 +14990,7 @@ var SmartGridSavedViews = (props) => {
|
|
|
14624
14990
|
setTableConfig(updatedView.table_config);
|
|
14625
14991
|
return updatedView;
|
|
14626
14992
|
};
|
|
14627
|
-
return /* @__PURE__ */
|
|
14993
|
+
return /* @__PURE__ */ React23.createElement(ToastAlertProvider, null, /* @__PURE__ */ React23.createElement(
|
|
14628
14994
|
SavedViews,
|
|
14629
14995
|
{
|
|
14630
14996
|
onSelect,
|
|
@@ -14643,16 +15009,16 @@ var SmartGridSavedViews = (props) => {
|
|
|
14643
15009
|
};
|
|
14644
15010
|
|
|
14645
15011
|
// src/SavedViews/components/SavedViews/DataTable/DataTableSavedViews.tsx
|
|
14646
|
-
import
|
|
14647
|
-
forwardRef as
|
|
15012
|
+
import React24, {
|
|
15013
|
+
forwardRef as forwardRef10,
|
|
14648
15014
|
useImperativeHandle,
|
|
14649
|
-
useState as
|
|
14650
|
-
useCallback as
|
|
15015
|
+
useState as useState6,
|
|
15016
|
+
useCallback as useCallback4
|
|
14651
15017
|
} from "react";
|
|
14652
15018
|
|
|
14653
15019
|
// src/SavedViews/components/SavedViews/DataTable/DataTableDefaultSavedView.tsx
|
|
14654
15020
|
import { useMemo } from "react";
|
|
14655
|
-
import { useI18nContext as
|
|
15021
|
+
import { useI18nContext as useI18nContext12 } from "@procore/core-react";
|
|
14656
15022
|
var DEFAULT_COLUMN_STATE = {
|
|
14657
15023
|
hidden: false,
|
|
14658
15024
|
pinned: null,
|
|
@@ -14700,7 +15066,7 @@ var extractDefaultView = (columnDefinitions, receivedConfigFromTool) => {
|
|
|
14700
15066
|
return result;
|
|
14701
15067
|
};
|
|
14702
15068
|
var useDefaultViewName2 = (domain, defaultViewName) => {
|
|
14703
|
-
const i18n =
|
|
15069
|
+
const i18n = useI18nContext12();
|
|
14704
15070
|
return defaultViewName || i18n.t(domain, {
|
|
14705
15071
|
scope: "savedViews.defaultViewTitle",
|
|
14706
15072
|
defaultValue: "Default View"
|
|
@@ -14722,9 +15088,9 @@ var useDefaultView2 = (props) => {
|
|
|
14722
15088
|
|
|
14723
15089
|
// src/SavedViews/components/SavedViews/DataTable/DataTableSavedViews.tsx
|
|
14724
15090
|
import { ToastAlertProvider as ToastAlertProvider2 } from "@procore/toast-alert";
|
|
14725
|
-
var DataTableSavedViews =
|
|
15091
|
+
var DataTableSavedViews = forwardRef10((props, ref) => {
|
|
14726
15092
|
const { tableApi, onTableConfigChange, projectId, companyId } = props;
|
|
14727
|
-
const [internalTableConfig, setInternalTableConfig] =
|
|
15093
|
+
const [internalTableConfig, setInternalTableConfig] = useState6(
|
|
14728
15094
|
props.defaultViewConfig
|
|
14729
15095
|
);
|
|
14730
15096
|
useImperativeHandle(ref, () => ({
|
|
@@ -14732,7 +15098,7 @@ var DataTableSavedViews = forwardRef9((props, ref) => {
|
|
|
14732
15098
|
handleConfigChange(newConfig);
|
|
14733
15099
|
}
|
|
14734
15100
|
}));
|
|
14735
|
-
const handleConfigChange =
|
|
15101
|
+
const handleConfigChange = useCallback4(
|
|
14736
15102
|
(newConfig) => {
|
|
14737
15103
|
setInternalTableConfig(newConfig);
|
|
14738
15104
|
onTableConfigChange(newConfig);
|
|
@@ -14760,7 +15126,7 @@ var DataTableSavedViews = forwardRef9((props, ref) => {
|
|
|
14760
15126
|
if (!internalTableConfig) {
|
|
14761
15127
|
return null;
|
|
14762
15128
|
}
|
|
14763
|
-
return /* @__PURE__ */
|
|
15129
|
+
return /* @__PURE__ */ React24.createElement(ToastAlertProvider2, null, /* @__PURE__ */ React24.createElement(
|
|
14764
15130
|
SavedViews,
|
|
14765
15131
|
{
|
|
14766
15132
|
onSelect,
|