@procore/saved-views 1.1.0-alpha.4 → 1.1.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/legacy/index.js +267 -191
- package/dist/legacy/index.mjs +294 -219
- package/dist/modern/index.js +266 -191
- package/dist/modern/index.mjs +293 -219
- package/package.json +3 -2
package/dist/legacy/index.mjs
CHANGED
|
@@ -110,7 +110,7 @@ var require_react_is_production_min = __commonJS({
|
|
|
110
110
|
var E2 = n2;
|
|
111
111
|
var F2 = c2;
|
|
112
112
|
var G2 = f2;
|
|
113
|
-
var
|
|
113
|
+
var H2 = e2;
|
|
114
114
|
var I = l2;
|
|
115
115
|
exports.ContextConsumer = h;
|
|
116
116
|
exports.ContextProvider = z2;
|
|
@@ -121,7 +121,7 @@ var require_react_is_production_min = __commonJS({
|
|
|
121
121
|
exports.Memo = E2;
|
|
122
122
|
exports.Portal = F2;
|
|
123
123
|
exports.Profiler = G2;
|
|
124
|
-
exports.StrictMode =
|
|
124
|
+
exports.StrictMode = H2;
|
|
125
125
|
exports.Suspense = I;
|
|
126
126
|
exports.isAsyncMode = function() {
|
|
127
127
|
return false;
|
|
@@ -7868,7 +7868,7 @@ function __rest(s2, e2) {
|
|
|
7868
7868
|
return t2;
|
|
7869
7869
|
}
|
|
7870
7870
|
|
|
7871
|
-
//
|
|
7871
|
+
// node_modules/@procore/core-icons/dist/Icon.js
|
|
7872
7872
|
import * as React from "react";
|
|
7873
7873
|
function getSize(size) {
|
|
7874
7874
|
if (size === "sm") {
|
|
@@ -7887,7 +7887,7 @@ function Icon(_a) {
|
|
|
7887
7887
|
return React.isValidElement(children) ? React.cloneElement(children, __assign(__assign({ "aria-hidden": true, "data-qa": "ci-".concat(props.name) }, props), { width: getSize(props.size), height: getSize(props.size), focusable: false, style: __assign(__assign({}, props.style), { flex: "0 0 auto" }) })) : null;
|
|
7888
7888
|
}
|
|
7889
7889
|
|
|
7890
|
-
//
|
|
7890
|
+
// node_modules/@procore/core-icons/dist/icons/Building.js
|
|
7891
7891
|
import * as React2 from "react";
|
|
7892
7892
|
var Building = React2.forwardRef(function Building2(props, ref) {
|
|
7893
7893
|
return React2.createElement(
|
|
@@ -7903,7 +7903,7 @@ var Building = React2.forwardRef(function Building2(props, ref) {
|
|
|
7903
7903
|
Building.displayName = "Building";
|
|
7904
7904
|
var Building_default = Building;
|
|
7905
7905
|
|
|
7906
|
-
//
|
|
7906
|
+
// node_modules/@procore/core-icons/dist/icons/ChevronDown.js
|
|
7907
7907
|
import * as React3 from "react";
|
|
7908
7908
|
var ChevronDown = React3.forwardRef(function ChevronDown2(props, ref) {
|
|
7909
7909
|
return React3.createElement(
|
|
@@ -7919,7 +7919,7 @@ var ChevronDown = React3.forwardRef(function ChevronDown2(props, ref) {
|
|
|
7919
7919
|
ChevronDown.displayName = "ChevronDown";
|
|
7920
7920
|
var ChevronDown_default = ChevronDown;
|
|
7921
7921
|
|
|
7922
|
-
//
|
|
7922
|
+
// node_modules/@procore/core-icons/dist/icons/ChevronRight.js
|
|
7923
7923
|
import * as React4 from "react";
|
|
7924
7924
|
var ChevronRight = React4.forwardRef(function ChevronRight2(props, ref) {
|
|
7925
7925
|
return React4.createElement(
|
|
@@ -7935,7 +7935,7 @@ var ChevronRight = React4.forwardRef(function ChevronRight2(props, ref) {
|
|
|
7935
7935
|
ChevronRight.displayName = "ChevronRight";
|
|
7936
7936
|
var ChevronRight_default = ChevronRight;
|
|
7937
7937
|
|
|
7938
|
-
//
|
|
7938
|
+
// node_modules/@procore/core-icons/dist/icons/Clear.js
|
|
7939
7939
|
import * as React5 from "react";
|
|
7940
7940
|
var Clear = React5.forwardRef(function Clear2(props, ref) {
|
|
7941
7941
|
return React5.createElement(
|
|
@@ -7951,7 +7951,7 @@ var Clear = React5.forwardRef(function Clear2(props, ref) {
|
|
|
7951
7951
|
Clear.displayName = "Clear";
|
|
7952
7952
|
var Clear_default = Clear;
|
|
7953
7953
|
|
|
7954
|
-
//
|
|
7954
|
+
// node_modules/@procore/core-icons/dist/icons/Excavator.js
|
|
7955
7955
|
import * as React6 from "react";
|
|
7956
7956
|
var Excavator = React6.forwardRef(function Excavator2(props, ref) {
|
|
7957
7957
|
return React6.createElement(
|
|
@@ -7968,7 +7968,7 @@ var Excavator = React6.forwardRef(function Excavator2(props, ref) {
|
|
|
7968
7968
|
Excavator.displayName = "Excavator";
|
|
7969
7969
|
var Excavator_default = Excavator;
|
|
7970
7970
|
|
|
7971
|
-
//
|
|
7971
|
+
// node_modules/@procore/core-icons/dist/icons/ExpandSidebar.js
|
|
7972
7972
|
import * as React7 from "react";
|
|
7973
7973
|
var ExpandSidebar = React7.forwardRef(function ExpandSidebar2(props, ref) {
|
|
7974
7974
|
return React7.createElement(
|
|
@@ -7986,7 +7986,7 @@ var ExpandSidebar = React7.forwardRef(function ExpandSidebar2(props, ref) {
|
|
|
7986
7986
|
ExpandSidebar.displayName = "ExpandSidebar";
|
|
7987
7987
|
var ExpandSidebar_default = ExpandSidebar;
|
|
7988
7988
|
|
|
7989
|
-
//
|
|
7989
|
+
// node_modules/@procore/core-icons/dist/icons/Help.js
|
|
7990
7990
|
import * as React8 from "react";
|
|
7991
7991
|
var Help = React8.forwardRef(function Help2(props, ref) {
|
|
7992
7992
|
return React8.createElement(
|
|
@@ -8002,7 +8002,7 @@ var Help = React8.forwardRef(function Help2(props, ref) {
|
|
|
8002
8002
|
Help.displayName = "Help";
|
|
8003
8003
|
var Help_default = Help;
|
|
8004
8004
|
|
|
8005
|
-
//
|
|
8005
|
+
// node_modules/@procore/core-icons/dist/icons/Link.js
|
|
8006
8006
|
import * as React9 from "react";
|
|
8007
8007
|
var Link = React9.forwardRef(function Link2(props, ref) {
|
|
8008
8008
|
return React9.createElement(
|
|
@@ -8019,7 +8019,7 @@ var Link = React9.forwardRef(function Link2(props, ref) {
|
|
|
8019
8019
|
Link.displayName = "Link";
|
|
8020
8020
|
var Link_default = Link;
|
|
8021
8021
|
|
|
8022
|
-
//
|
|
8022
|
+
// node_modules/@procore/core-icons/dist/icons/Person.js
|
|
8023
8023
|
import * as React10 from "react";
|
|
8024
8024
|
var Person = React10.forwardRef(function Person2(props, ref) {
|
|
8025
8025
|
return React10.createElement(
|
|
@@ -8035,7 +8035,7 @@ var Person = React10.forwardRef(function Person2(props, ref) {
|
|
|
8035
8035
|
Person.displayName = "Person";
|
|
8036
8036
|
var Person_default = Person;
|
|
8037
8037
|
|
|
8038
|
-
//
|
|
8038
|
+
// node_modules/@procore/core-icons/dist/icons/Plus.js
|
|
8039
8039
|
import * as React11 from "react";
|
|
8040
8040
|
var Plus = React11.forwardRef(function Plus2(props, ref) {
|
|
8041
8041
|
return React11.createElement(
|
|
@@ -8148,7 +8148,7 @@ function stylis_min(W2) {
|
|
|
8148
8148
|
}
|
|
8149
8149
|
k2 = M2(c2, r2, k2, g2, a2 + 1);
|
|
8150
8150
|
t2 = k2.length;
|
|
8151
|
-
0 < A2 && (r2 = X2(O2, f2, I), C2 =
|
|
8151
|
+
0 < A2 && (r2 = X2(O2, f2, I), C2 = H2(3, k2, r2, c2, D2, z2, t2, g2, a2, h), f2 = r2.join(""), void 0 !== C2 && 0 === (t2 = (k2 = C2.trim()).length) && (g2 = 0, k2 = ""));
|
|
8152
8152
|
if (0 < t2)
|
|
8153
8153
|
switch (g2) {
|
|
8154
8154
|
case 115:
|
|
@@ -8181,7 +8181,7 @@ function stylis_min(W2) {
|
|
|
8181
8181
|
case 59:
|
|
8182
8182
|
f2 = (0 < r2 ? f2.replace(N, "") : f2).trim();
|
|
8183
8183
|
if (1 < (t2 = f2.length))
|
|
8184
|
-
switch (0 === u2 && (q2 = f2.charCodeAt(0), 45 === q2 || 96 < q2 && 123 > q2) && (t2 = (f2 = f2.replace(" ", ":")).length), 0 < A2 && void 0 !== (C2 =
|
|
8184
|
+
switch (0 === u2 && (q2 = f2.charCodeAt(0), 45 === q2 || 96 < q2 && 123 > q2) && (t2 = (f2 = f2.replace(" ", ":")).length), 0 < A2 && void 0 !== (C2 = H2(1, f2, c2, d, D2, z2, p.length, h, a2, h)) && 0 === (t2 = (f2 = C2.trim()).length) && (f2 = "\0\0"), q2 = f2.charCodeAt(0), g2 = f2.charCodeAt(1), q2) {
|
|
8185
8185
|
case 0:
|
|
8186
8186
|
break;
|
|
8187
8187
|
case 64:
|
|
@@ -8201,7 +8201,7 @@ function stylis_min(W2) {
|
|
|
8201
8201
|
case 13:
|
|
8202
8202
|
case 10:
|
|
8203
8203
|
47 === b2 ? b2 = 0 : 0 === 1 + q2 && 107 !== h && 0 < f2.length && (r2 = 1, f2 += "\0");
|
|
8204
|
-
0 < A2 * Y2 &&
|
|
8204
|
+
0 < A2 * Y2 && H2(0, f2, c2, d, D2, z2, p.length, h, a2, h);
|
|
8205
8205
|
z2 = 1;
|
|
8206
8206
|
D2++;
|
|
8207
8207
|
break;
|
|
@@ -8310,7 +8310,7 @@ function stylis_min(W2) {
|
|
|
8310
8310
|
t2 = p.length;
|
|
8311
8311
|
if (0 < t2) {
|
|
8312
8312
|
r2 = c2;
|
|
8313
|
-
if (0 < A2 && (C2 =
|
|
8313
|
+
if (0 < A2 && (C2 = H2(2, p, r2, d, D2, z2, t2, h, a2, h), void 0 !== C2 && 0 === (p = C2).length))
|
|
8314
8314
|
return G3 + p + F3;
|
|
8315
8315
|
p = r2.join(",") + "{" + p + "}";
|
|
8316
8316
|
if (0 !== w2 * E2) {
|
|
@@ -8487,7 +8487,7 @@ function stylis_min(W2) {
|
|
|
8487
8487
|
var e2 = P4(c2, c2.charCodeAt(0), c2.charCodeAt(1), c2.charCodeAt(2));
|
|
8488
8488
|
return e2 !== c2 + ";" ? e2.replace(oa, " or ($1)").substring(4) : "(" + c2 + ")";
|
|
8489
8489
|
}
|
|
8490
|
-
function
|
|
8490
|
+
function H2(d, c2, e2, h, a2, m2, b2, v2, n2, q2) {
|
|
8491
8491
|
for (var g2 = 0, x2 = c2, w3; g2 < A2; ++g2) {
|
|
8492
8492
|
switch (w3 = S2[g2].call(B2, d, x2, e2, h, a2, m2, b2, v2, n2, q2)) {
|
|
8493
8493
|
case void 0:
|
|
@@ -8531,11 +8531,11 @@ function stylis_min(W2) {
|
|
|
8531
8531
|
V2 = e2;
|
|
8532
8532
|
e2 = [V2];
|
|
8533
8533
|
if (0 < A2) {
|
|
8534
|
-
var h =
|
|
8534
|
+
var h = H2(-1, c2, e2, e2, D2, z2, 0, 0, 0, 0);
|
|
8535
8535
|
void 0 !== h && "string" === typeof h && (c2 = h);
|
|
8536
8536
|
}
|
|
8537
8537
|
var a2 = M2(O2, e2, c2, 0, 0);
|
|
8538
|
-
0 < A2 && (h =
|
|
8538
|
+
0 < A2 && (h = H2(-2, a2, e2, e2, D2, z2, a2.length, 0, 0, 0), void 0 !== h && (a2 = h));
|
|
8539
8539
|
V2 = "";
|
|
8540
8540
|
E2 = 0;
|
|
8541
8541
|
z2 = D2 = 1;
|
|
@@ -9343,8 +9343,8 @@ var useSavedViewsPanel = (domain, tableName) => {
|
|
|
9343
9343
|
setIsOpen(!isOpen);
|
|
9344
9344
|
localStorage.setItem(key(domain, tableName), JSON.stringify(!isOpen));
|
|
9345
9345
|
};
|
|
9346
|
-
const
|
|
9347
|
-
return { isOpen, SavedViewsButton:
|
|
9346
|
+
const Button8 = () => /* @__PURE__ */ React14.createElement(SavedViewsButton, { handleClick, isOpen });
|
|
9347
|
+
return { isOpen, SavedViewsButton: Button8 };
|
|
9348
9348
|
};
|
|
9349
9349
|
var useSavedViewsPanel_default = useSavedViewsPanel;
|
|
9350
9350
|
|
|
@@ -9426,6 +9426,17 @@ var SavedViewCollectionMenuItem = (props) => {
|
|
|
9426
9426
|
label: i18n.t("savedViews.actions.delete")
|
|
9427
9427
|
}
|
|
9428
9428
|
];
|
|
9429
|
+
const preventEventBubbleToNotTriggerViewSelectEvent = React15.useCallback(
|
|
9430
|
+
(e2) => {
|
|
9431
|
+
e2.stopPropagation();
|
|
9432
|
+
},
|
|
9433
|
+
[]
|
|
9434
|
+
);
|
|
9435
|
+
const hasUpdateButton = props.item.view_level !== "default" && props.canUpdate;
|
|
9436
|
+
const hasCopyShareLinkButton = props.item.view_level !== "default" && props.selected && !props.canUpdate && props.item.id !== "temporary";
|
|
9437
|
+
const hasClearTemporaryButton = props.item.id === "temporary";
|
|
9438
|
+
const hasOverflowMenu = props.item.view_level !== "default" && props.canEditOrDelete;
|
|
9439
|
+
const hasActions = hasUpdateButton || hasCopyShareLinkButton || hasClearTemporaryButton || hasOverflowMenu;
|
|
9429
9440
|
return /* @__PURE__ */ React15.createElement(
|
|
9430
9441
|
Container2,
|
|
9431
9442
|
{
|
|
@@ -9435,7 +9446,8 @@ var SavedViewCollectionMenuItem = (props) => {
|
|
|
9435
9446
|
"aria-label": i18n.t("savedViews.ariaLabels.menuItem", {
|
|
9436
9447
|
name: props.item.name
|
|
9437
9448
|
}),
|
|
9438
|
-
"data-testid": "saved-view-collection-menu-item"
|
|
9449
|
+
"data-testid": "saved-view-collection-menu-item",
|
|
9450
|
+
onKeyDown: preventEventBubbleToNotTriggerViewSelectEvent
|
|
9439
9451
|
},
|
|
9440
9452
|
/* @__PURE__ */ React15.createElement(
|
|
9441
9453
|
"span",
|
|
@@ -9445,7 +9457,7 @@ var SavedViewCollectionMenuItem = (props) => {
|
|
|
9445
9457
|
},
|
|
9446
9458
|
props.item.name
|
|
9447
9459
|
),
|
|
9448
|
-
/* @__PURE__ */ React15.createElement(RowActionsBox, null, /* @__PURE__ */ React15.createElement(Box, { justifyContent: "space-between" },
|
|
9460
|
+
hasActions && /* @__PURE__ */ React15.createElement(RowActionsBox, null, /* @__PURE__ */ React15.createElement(Box, { justifyContent: "space-between" }, hasUpdateButton && /* @__PURE__ */ React15.createElement(
|
|
9449
9461
|
Button2,
|
|
9450
9462
|
{
|
|
9451
9463
|
onClick: updateItem,
|
|
@@ -9456,7 +9468,7 @@ var SavedViewCollectionMenuItem = (props) => {
|
|
|
9456
9468
|
loading: props.isUpdateProcessing
|
|
9457
9469
|
},
|
|
9458
9470
|
i18n.t("savedViews.actions.update")
|
|
9459
|
-
)
|
|
9471
|
+
), hasCopyShareLinkButton && /* @__PURE__ */ React15.createElement(
|
|
9460
9472
|
Button2,
|
|
9461
9473
|
{
|
|
9462
9474
|
onClick: copyShareLink,
|
|
@@ -9466,7 +9478,7 @@ var SavedViewCollectionMenuItem = (props) => {
|
|
|
9466
9478
|
"data-testid": "copy-share-link-button"
|
|
9467
9479
|
},
|
|
9468
9480
|
/* @__PURE__ */ React15.createElement(IconWrapper, null, /* @__PURE__ */ React15.createElement(Link_default, { size: "sm" }))
|
|
9469
|
-
)
|
|
9481
|
+
), hasClearTemporaryButton && /* @__PURE__ */ React15.createElement(
|
|
9470
9482
|
Button2,
|
|
9471
9483
|
{
|
|
9472
9484
|
onClick: (e2) => {
|
|
@@ -9481,7 +9493,7 @@ var SavedViewCollectionMenuItem = (props) => {
|
|
|
9481
9493
|
"data-testid": "clear-temporary-view-button"
|
|
9482
9494
|
},
|
|
9483
9495
|
/* @__PURE__ */ React15.createElement(IconWrapper, null, /* @__PURE__ */ React15.createElement(Clear_default, { size: "sm" }))
|
|
9484
|
-
))
|
|
9496
|
+
)), /* @__PURE__ */ React15.createElement(Box, null, hasOverflowMenu && /* @__PURE__ */ React15.createElement(
|
|
9485
9497
|
DropdownFlyout,
|
|
9486
9498
|
{
|
|
9487
9499
|
"data-testid": "saved-view-overflow-button",
|
|
@@ -9492,7 +9504,7 @@ var SavedViewCollectionMenuItem = (props) => {
|
|
|
9492
9504
|
variant: "tertiary",
|
|
9493
9505
|
disabled: props.isUpdateProcessing
|
|
9494
9506
|
}
|
|
9495
|
-
)))
|
|
9507
|
+
)))
|
|
9496
9508
|
);
|
|
9497
9509
|
};
|
|
9498
9510
|
|
|
@@ -9505,7 +9517,7 @@ var ExpandedPanel = styled_components_esm_default(Panel)`
|
|
|
9505
9517
|
`;
|
|
9506
9518
|
|
|
9507
9519
|
// src/components/panels/PanelContent.tsx
|
|
9508
|
-
import { Flex as
|
|
9520
|
+
import { Flex as Flex2, MenuImperative as MenuImperative2, useI18nContext as useI18nContext5 } from "@procore/core-react";
|
|
9509
9521
|
import { useToastAlertContext as useToastAlertContext2 } from "@procore/toast-alert";
|
|
9510
9522
|
import React17 from "react";
|
|
9511
9523
|
|
|
@@ -9881,9 +9893,9 @@ var useGroups = (isProjectLevelTool) => {
|
|
|
9881
9893
|
|
|
9882
9894
|
// src/components/panels/ViewLevelHeader.tsx
|
|
9883
9895
|
import {
|
|
9896
|
+
Box as Box2,
|
|
9897
|
+
Button as Button3,
|
|
9884
9898
|
colors,
|
|
9885
|
-
Flex as Flex2,
|
|
9886
|
-
spacing,
|
|
9887
9899
|
Typography,
|
|
9888
9900
|
useI18nContext as useI18nContext4
|
|
9889
9901
|
} from "@procore/core-react";
|
|
@@ -9898,27 +9910,31 @@ var groupIcon = (group) => {
|
|
|
9898
9910
|
return /* @__PURE__ */ React16.createElement(Building_default, null);
|
|
9899
9911
|
}
|
|
9900
9912
|
};
|
|
9901
|
-
var
|
|
9902
|
-
width: 100%;
|
|
9913
|
+
var StyledButton2 = styled_components_esm_default(Button3)`
|
|
9903
9914
|
&:hover {
|
|
9904
9915
|
background-color: ${colors.gray98};
|
|
9905
9916
|
}
|
|
9906
9917
|
`;
|
|
9907
9918
|
var ViewLevelHeader = ({ expanded, toggleGroup, group }) => {
|
|
9908
9919
|
const I18n = useI18nContext4();
|
|
9909
|
-
return /* @__PURE__ */ React16.createElement(
|
|
9910
|
-
|
|
9920
|
+
return /* @__PURE__ */ React16.createElement(Box2, { style: { width: "100%" } }, /* @__PURE__ */ React16.createElement(
|
|
9921
|
+
StyledButton2,
|
|
9911
9922
|
{
|
|
9912
|
-
|
|
9913
|
-
|
|
9914
|
-
|
|
9915
|
-
|
|
9916
|
-
|
|
9923
|
+
block: true,
|
|
9924
|
+
style: {
|
|
9925
|
+
justifyContent: "start",
|
|
9926
|
+
height: "40px"
|
|
9927
|
+
},
|
|
9928
|
+
variant: "tertiary",
|
|
9929
|
+
size: "sm",
|
|
9930
|
+
onClick: () => toggleGroup(group),
|
|
9931
|
+
"aria-controls": `saved-views-collections-${group}`,
|
|
9932
|
+
"aria-expanded": expanded,
|
|
9933
|
+
icon: expanded ? /* @__PURE__ */ React16.createElement(ChevronDown_default, { size: "sm" }) : /* @__PURE__ */ React16.createElement(ChevronRight_default, { size: "sm" })
|
|
9917
9934
|
},
|
|
9918
|
-
expanded ? /* @__PURE__ */ React16.createElement(ChevronDown_default, { size: "sm" }) : /* @__PURE__ */ React16.createElement(ChevronRight_default, { size: "sm" }),
|
|
9919
9935
|
groupIcon(group),
|
|
9920
9936
|
/* @__PURE__ */ React16.createElement(Typography, { weight: "semibold" }, I18n.t(`savedViews.viewLevel.${group}`))
|
|
9921
|
-
);
|
|
9937
|
+
));
|
|
9922
9938
|
};
|
|
9923
9939
|
var ViewLevelHeader_default = ViewLevelHeader;
|
|
9924
9940
|
|
|
@@ -9938,8 +9954,8 @@ var useScrollToRef = (dependency) => {
|
|
|
9938
9954
|
import {
|
|
9939
9955
|
colors as colors2,
|
|
9940
9956
|
DetailPage,
|
|
9941
|
-
|
|
9942
|
-
spacing
|
|
9957
|
+
MenuImperative,
|
|
9958
|
+
spacing
|
|
9943
9959
|
} from "@procore/core-react";
|
|
9944
9960
|
var Row = styled_components_esm_default(MenuImperative.Item)`
|
|
9945
9961
|
width: 100%;
|
|
@@ -9954,11 +9970,16 @@ var Row = styled_components_esm_default(MenuImperative.Item)`
|
|
|
9954
9970
|
var Panel2 = styled_components_esm_default(DetailPage.Card)`
|
|
9955
9971
|
margin: 0;
|
|
9956
9972
|
height: 100%;
|
|
9957
|
-
padding-top: ${
|
|
9973
|
+
padding-top: ${spacing.sm}px;
|
|
9958
9974
|
box-shadow: none;
|
|
9959
9975
|
`;
|
|
9960
9976
|
|
|
9961
9977
|
// src/components/panels/PanelContent.tsx
|
|
9978
|
+
var StyledMenuImperative = styled_components_esm_default(MenuImperative2)`
|
|
9979
|
+
div[role='listbox'] {
|
|
9980
|
+
padding: 0;
|
|
9981
|
+
}
|
|
9982
|
+
`;
|
|
9962
9983
|
var PanelContent = (props) => {
|
|
9963
9984
|
const { queryInput, selectedSavedView, tableConfig } = props;
|
|
9964
9985
|
const { showToast } = useToastAlertContext2();
|
|
@@ -9999,40 +10020,52 @@ var PanelContent = (props) => {
|
|
|
9999
10020
|
}
|
|
10000
10021
|
});
|
|
10001
10022
|
};
|
|
10002
|
-
return /* @__PURE__ */ React17.createElement(Panel2, { "data-testid": "inner-panel" }, /* @__PURE__ */ React17.createElement(
|
|
10003
|
-
|
|
10023
|
+
return /* @__PURE__ */ React17.createElement(Panel2, { "data-testid": "inner-panel" }, /* @__PURE__ */ React17.createElement(Flex2, { direction: "column", style: { height: "100%", width: "100%" } }, (temporaryView || presetViews) && /* @__PURE__ */ React17.createElement(
|
|
10024
|
+
StyledMenuImperative,
|
|
10004
10025
|
{
|
|
10005
|
-
|
|
10006
|
-
|
|
10007
|
-
|
|
10026
|
+
role: "listbox",
|
|
10027
|
+
onSelect: (selection) => {
|
|
10028
|
+
if ((selectedSavedView == null ? void 0 : selectedSavedView.id) !== selection.item.id) {
|
|
10029
|
+
props.onSelect({ item: selection.item });
|
|
10030
|
+
}
|
|
10031
|
+
}
|
|
10008
10032
|
},
|
|
10009
|
-
/* @__PURE__ */ React17.createElement(
|
|
10010
|
-
|
|
10033
|
+
/* @__PURE__ */ React17.createElement(MenuImperative2.Options, null, temporaryView && /* @__PURE__ */ React17.createElement(
|
|
10034
|
+
Row,
|
|
10011
10035
|
{
|
|
10036
|
+
key: temporaryView.id,
|
|
10012
10037
|
item: temporaryView,
|
|
10013
10038
|
selected: isTemporarySelected,
|
|
10014
|
-
|
|
10015
|
-
}
|
|
10016
|
-
)
|
|
10017
|
-
), presetViews.map((presetView) => {
|
|
10018
|
-
const isSelected = (selectedSavedView == null ? void 0 : selectedSavedView.id) === presetView.id;
|
|
10019
|
-
return /* @__PURE__ */ React17.createElement(
|
|
10020
|
-
Row,
|
|
10021
|
-
{
|
|
10022
|
-
key: presetView.id,
|
|
10023
|
-
selected: isSelected,
|
|
10024
|
-
onClick: () => props.onSelect({ item: presetView }),
|
|
10025
|
-
ref: isSelected ? selectedRowRef : null
|
|
10039
|
+
ref: isTemporarySelected ? selectedRowRef : null
|
|
10026
10040
|
},
|
|
10027
10041
|
/* @__PURE__ */ React17.createElement(
|
|
10028
10042
|
SavedViewCollectionMenuItem,
|
|
10029
10043
|
{
|
|
10030
|
-
item:
|
|
10031
|
-
selected:
|
|
10044
|
+
item: temporaryView,
|
|
10045
|
+
selected: isTemporarySelected,
|
|
10046
|
+
onClearTemporary: props.onClearTemporary
|
|
10032
10047
|
}
|
|
10033
10048
|
)
|
|
10034
|
-
)
|
|
10035
|
-
|
|
10049
|
+
), presetViews.map((presetView) => {
|
|
10050
|
+
const isSelected = (selectedSavedView == null ? void 0 : selectedSavedView.id) === presetView.id;
|
|
10051
|
+
return /* @__PURE__ */ React17.createElement(
|
|
10052
|
+
Row,
|
|
10053
|
+
{
|
|
10054
|
+
key: presetView.id,
|
|
10055
|
+
item: presetView,
|
|
10056
|
+
selected: isSelected,
|
|
10057
|
+
ref: isSelected ? selectedRowRef : null
|
|
10058
|
+
},
|
|
10059
|
+
/* @__PURE__ */ React17.createElement(
|
|
10060
|
+
SavedViewCollectionMenuItem,
|
|
10061
|
+
{
|
|
10062
|
+
item: presetView,
|
|
10063
|
+
selected: isSelected
|
|
10064
|
+
}
|
|
10065
|
+
)
|
|
10066
|
+
);
|
|
10067
|
+
}))
|
|
10068
|
+
), viewLevels.map((level) => {
|
|
10036
10069
|
const isExpanded = groups[level];
|
|
10037
10070
|
const views = isExpanded && savedViews ? savedViews.filter(
|
|
10038
10071
|
(view) => view.view_level === level && view.id !== "temporary"
|
|
@@ -10044,62 +10077,74 @@ var PanelContent = (props) => {
|
|
|
10044
10077
|
toggleGroup,
|
|
10045
10078
|
expanded: isExpanded
|
|
10046
10079
|
}
|
|
10047
|
-
), views.
|
|
10048
|
-
|
|
10049
|
-
|
|
10050
|
-
|
|
10051
|
-
|
|
10052
|
-
|
|
10053
|
-
|
|
10054
|
-
|
|
10055
|
-
|
|
10056
|
-
|
|
10057
|
-
|
|
10058
|
-
|
|
10059
|
-
|
|
10060
|
-
|
|
10061
|
-
|
|
10062
|
-
|
|
10063
|
-
|
|
10064
|
-
|
|
10065
|
-
|
|
10066
|
-
|
|
10067
|
-
|
|
10068
|
-
|
|
10080
|
+
), isExpanded && views.length > 0 && /* @__PURE__ */ React17.createElement(
|
|
10081
|
+
StyledMenuImperative,
|
|
10082
|
+
{
|
|
10083
|
+
id: `saved-views-collections-${level}`,
|
|
10084
|
+
role: "listbox",
|
|
10085
|
+
onSelect: (selection) => {
|
|
10086
|
+
if ((selectedSavedView == null ? void 0 : selectedSavedView.id) !== selection.item.id) {
|
|
10087
|
+
props.onSelect({ item: selection.item });
|
|
10088
|
+
}
|
|
10089
|
+
}
|
|
10090
|
+
},
|
|
10091
|
+
/* @__PURE__ */ React17.createElement(MenuImperative2.Options, null, views.map((view) => {
|
|
10092
|
+
const isSelected = (selectedSavedView == null ? void 0 : selectedSavedView.id) === view.id;
|
|
10093
|
+
const canUpdate = isSelected && hasPermissionForViewLevel(
|
|
10094
|
+
view.view_level,
|
|
10095
|
+
permissions
|
|
10096
|
+
) && !isEqual(
|
|
10097
|
+
view.table_config,
|
|
10098
|
+
tableConfig,
|
|
10099
|
+
props.defaultView.table_config,
|
|
10100
|
+
props.provider
|
|
10101
|
+
);
|
|
10102
|
+
const canEditOrDelete = isSelected && hasPermissionForViewLevel(view.view_level, permissions);
|
|
10103
|
+
return /* @__PURE__ */ React17.createElement(
|
|
10104
|
+
Row,
|
|
10069
10105
|
{
|
|
10070
|
-
item: view,
|
|
10071
10106
|
key: view.id,
|
|
10107
|
+
item: view,
|
|
10072
10108
|
selected: isSelected,
|
|
10073
|
-
|
|
10074
|
-
|
|
10075
|
-
|
|
10076
|
-
|
|
10077
|
-
|
|
10078
|
-
|
|
10079
|
-
|
|
10080
|
-
|
|
10081
|
-
|
|
10082
|
-
|
|
10083
|
-
|
|
10109
|
+
ref: isSelected ? selectedRowRef : null
|
|
10110
|
+
},
|
|
10111
|
+
/* @__PURE__ */ React17.createElement(
|
|
10112
|
+
SavedViewCollectionMenuItem,
|
|
10113
|
+
{
|
|
10114
|
+
item: view,
|
|
10115
|
+
key: view.id,
|
|
10116
|
+
selected: isSelected,
|
|
10117
|
+
canUpdate,
|
|
10118
|
+
canEditOrDelete,
|
|
10119
|
+
onUpdate: (data) => onUpdate(data),
|
|
10120
|
+
isUpdateProcessing: isUpdateLoading,
|
|
10121
|
+
onEdit: () => props.openModal("update" /* UPDATE */),
|
|
10122
|
+
onDelete: props.onDelete,
|
|
10123
|
+
permissions
|
|
10124
|
+
}
|
|
10125
|
+
)
|
|
10126
|
+
);
|
|
10127
|
+
}))
|
|
10128
|
+
));
|
|
10084
10129
|
})));
|
|
10085
10130
|
};
|
|
10086
10131
|
|
|
10087
10132
|
// src/components/saved-views/SavedViews.tsx
|
|
10088
10133
|
import {
|
|
10089
|
-
Box as
|
|
10090
|
-
Button as
|
|
10091
|
-
Flex as
|
|
10134
|
+
Box as Box3,
|
|
10135
|
+
Button as Button7,
|
|
10136
|
+
Flex as Flex5,
|
|
10092
10137
|
Panel as Panel3,
|
|
10093
10138
|
Tooltip,
|
|
10094
|
-
useI18nContext as
|
|
10139
|
+
useI18nContext as useI18nContext12
|
|
10095
10140
|
} from "@procore/core-react";
|
|
10096
|
-
import
|
|
10141
|
+
import React23, { useState as useState4, useEffect as useEffect4, useCallback as useCallback3 } from "react";
|
|
10097
10142
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
10098
10143
|
import { useToastAlertContext as useToastAlertContext3, ToastAlertProvider } from "@procore/toast-alert";
|
|
10099
10144
|
|
|
10100
10145
|
// src/components/modals/DeleteConfirmationModal.tsx
|
|
10101
10146
|
import {
|
|
10102
|
-
Button as
|
|
10147
|
+
Button as Button4,
|
|
10103
10148
|
ConfirmModal,
|
|
10104
10149
|
Modal,
|
|
10105
10150
|
P as P2,
|
|
@@ -10123,28 +10168,27 @@ var SavedViewsDeleteConfirmationModalShared = ({
|
|
|
10123
10168
|
style: { overflowWrap: "anywhere" }
|
|
10124
10169
|
},
|
|
10125
10170
|
/* @__PURE__ */ React18.createElement(Modal.Body, null, /* @__PURE__ */ React18.createElement(P2, null, i18n.t("savedViews.modal.delete.description"))),
|
|
10126
|
-
/* @__PURE__ */ React18.createElement(Modal.Footer, null, /* @__PURE__ */ React18.createElement(Modal.FooterButtons, null, /* @__PURE__ */ React18.createElement(
|
|
10171
|
+
/* @__PURE__ */ React18.createElement(Modal.Footer, null, /* @__PURE__ */ React18.createElement(Modal.FooterButtons, null, /* @__PURE__ */ React18.createElement(Button4, { variant: "secondary", onClick: onCancel }, i18n.t("savedViews.actions.cancel")), /* @__PURE__ */ React18.createElement(Button4, { variant: "primary", onClick: onDelete }, i18n.t("savedViews.actions.delete"))))
|
|
10127
10172
|
);
|
|
10128
10173
|
};
|
|
10129
10174
|
|
|
10130
10175
|
// src/components/modals/form-modal/FormModal.tsx
|
|
10131
|
-
import
|
|
10176
|
+
import React21 from "react";
|
|
10132
10177
|
|
|
10133
10178
|
// src/components/modals/form-modal/FormModalBase.tsx
|
|
10134
10179
|
import {
|
|
10135
10180
|
Banner,
|
|
10136
|
-
Button as
|
|
10181
|
+
Button as Button5,
|
|
10137
10182
|
colors as colors3,
|
|
10138
10183
|
ErrorBanner,
|
|
10139
|
-
Flex as
|
|
10140
|
-
Form,
|
|
10141
|
-
H2,
|
|
10184
|
+
Flex as Flex3,
|
|
10185
|
+
Form as Form2,
|
|
10142
10186
|
Modal as Modal2,
|
|
10143
|
-
spacing as
|
|
10187
|
+
spacing as spacing2,
|
|
10144
10188
|
Typography as Typography2,
|
|
10145
|
-
useI18nContext as
|
|
10189
|
+
useI18nContext as useI18nContext8
|
|
10146
10190
|
} from "@procore/core-react";
|
|
10147
|
-
import * as
|
|
10191
|
+
import * as React20 from "react";
|
|
10148
10192
|
import * as yup from "yup";
|
|
10149
10193
|
|
|
10150
10194
|
// src/components/modals/form-modal/FormModalBaseUtils.ts
|
|
@@ -10181,6 +10225,37 @@ function extractMessage(error, I18n) {
|
|
|
10181
10225
|
return { form: I18n.t("savedViews.modal.errors.unknown") };
|
|
10182
10226
|
}
|
|
10183
10227
|
|
|
10228
|
+
// src/components/modals/form-modal/NameInputField.tsx
|
|
10229
|
+
import { Form, useFormContext, useI18nContext as useI18nContext7 } from "@procore/core-react";
|
|
10230
|
+
import * as React19 from "react";
|
|
10231
|
+
var NAME_INPUT_ID = "saved-view-form-name-input";
|
|
10232
|
+
var NameInputField = ({
|
|
10233
|
+
error,
|
|
10234
|
+
onResetMutations
|
|
10235
|
+
}) => {
|
|
10236
|
+
const I18n = useI18nContext7();
|
|
10237
|
+
const label = I18n.t("savedViews.modal.fields.name");
|
|
10238
|
+
const { errors: formErrors, submitCount } = useFormContext();
|
|
10239
|
+
React19.useEffect(() => {
|
|
10240
|
+
var _a;
|
|
10241
|
+
if (submitCount > 0 && (formErrors == null ? void 0 : formErrors.name)) {
|
|
10242
|
+
(_a = document.getElementById(NAME_INPUT_ID)) == null ? void 0 : _a.focus();
|
|
10243
|
+
}
|
|
10244
|
+
}, [formErrors == null ? void 0 : formErrors.name, submitCount]);
|
|
10245
|
+
return /* @__PURE__ */ React19.createElement(
|
|
10246
|
+
Form.Text,
|
|
10247
|
+
{
|
|
10248
|
+
id: NAME_INPUT_ID,
|
|
10249
|
+
name: "name",
|
|
10250
|
+
error,
|
|
10251
|
+
placeholder: label,
|
|
10252
|
+
label,
|
|
10253
|
+
colWidth: 12,
|
|
10254
|
+
onChange: onResetMutations
|
|
10255
|
+
}
|
|
10256
|
+
);
|
|
10257
|
+
};
|
|
10258
|
+
|
|
10184
10259
|
// src/components/modals/form-modal/FormModalBase.tsx
|
|
10185
10260
|
var ScrollContainer = styled_components_esm_default("div")`
|
|
10186
10261
|
overflow: auto;
|
|
@@ -10200,7 +10275,7 @@ var FormModalBase = ({
|
|
|
10200
10275
|
setOpenEditCreateModal,
|
|
10201
10276
|
onSelect
|
|
10202
10277
|
}) => {
|
|
10203
|
-
const I18n =
|
|
10278
|
+
const I18n = useI18nContext8();
|
|
10204
10279
|
const NAME_MAX_LENGTH = 150;
|
|
10205
10280
|
const {
|
|
10206
10281
|
mutate: createSavedView,
|
|
@@ -10259,24 +10334,17 @@ var FormModalBase = ({
|
|
|
10259
10334
|
I18n,
|
|
10260
10335
|
isProjectLevelTool
|
|
10261
10336
|
);
|
|
10262
|
-
return /* @__PURE__ */
|
|
10337
|
+
return /* @__PURE__ */ React20.createElement(
|
|
10263
10338
|
Modal2,
|
|
10264
10339
|
{
|
|
10265
|
-
"
|
|
10266
|
-
|
|
10340
|
+
howToClose: ["x", "scrim"],
|
|
10341
|
+
onClose,
|
|
10267
10342
|
open,
|
|
10268
|
-
|
|
10343
|
+
width: "md",
|
|
10269
10344
|
"data-testid": "create-update-modal"
|
|
10270
10345
|
},
|
|
10271
|
-
/* @__PURE__ */
|
|
10272
|
-
|
|
10273
|
-
{
|
|
10274
|
-
onClose,
|
|
10275
|
-
style: { borderBottom: `1px solid ${colors3.gray85}` }
|
|
10276
|
-
},
|
|
10277
|
-
/* @__PURE__ */ React19.createElement(H2, null, header)
|
|
10278
|
-
), /* @__PURE__ */ React19.createElement(
|
|
10279
|
-
Form,
|
|
10346
|
+
/* @__PURE__ */ React20.createElement(ScrollContainer, null, /* @__PURE__ */ React20.createElement(Modal2.Header, { style: { borderBottom: `1px solid ${colors3.gray85}` } }, /* @__PURE__ */ React20.createElement(Modal2.Heading, null, header)), /* @__PURE__ */ React20.createElement(
|
|
10347
|
+
Form2,
|
|
10280
10348
|
{
|
|
10281
10349
|
initialValues: {
|
|
10282
10350
|
name: initialName,
|
|
@@ -10301,30 +10369,26 @@ var FormModalBase = ({
|
|
|
10301
10369
|
onReset: onCancel,
|
|
10302
10370
|
validateOnChange: true
|
|
10303
10371
|
},
|
|
10304
|
-
/* @__PURE__ */
|
|
10372
|
+
/* @__PURE__ */ React20.createElement(Form2.Form, { name: header }, /* @__PURE__ */ React20.createElement(
|
|
10305
10373
|
Modal2.Body,
|
|
10306
10374
|
{
|
|
10307
|
-
style: { paddingTop: 0, paddingBottom: 0, marginTop:
|
|
10375
|
+
style: { paddingTop: 0, paddingBottom: 0, marginTop: spacing2.lg }
|
|
10308
10376
|
},
|
|
10309
|
-
errors && /* @__PURE__ */
|
|
10310
|
-
/* @__PURE__ */
|
|
10311
|
-
|
|
10377
|
+
errors && /* @__PURE__ */ React20.createElement(ErrorBanner, { style: { marginBottom: spacing2.xl } }, /* @__PURE__ */ React20.createElement(Banner.Content, null, /* @__PURE__ */ React20.createElement(Banner.Title, null, I18n.t("savedViews.modal.errors.title", { mode })), /* @__PURE__ */ React20.createElement(Banner.Body, null, (errors == null ? void 0 : errors.form) || I18n.t(`savedViews.modal.errors.description.${mode}`)))),
|
|
10378
|
+
/* @__PURE__ */ React20.createElement(Form2.Row, null, /* @__PURE__ */ React20.createElement(
|
|
10379
|
+
NameInputField,
|
|
10312
10380
|
{
|
|
10313
|
-
name: "name",
|
|
10314
10381
|
error: errors == null ? void 0 : errors.name,
|
|
10315
|
-
|
|
10316
|
-
label: I18n.t("savedViews.modal.fields.name"),
|
|
10317
|
-
colWidth: 12,
|
|
10318
|
-
onChange: () => resetMutations()
|
|
10382
|
+
onResetMutations: resetMutations
|
|
10319
10383
|
}
|
|
10320
10384
|
)),
|
|
10321
|
-
/* @__PURE__ */
|
|
10322
|
-
|
|
10385
|
+
/* @__PURE__ */ React20.createElement(
|
|
10386
|
+
Form2.Row,
|
|
10323
10387
|
{
|
|
10324
|
-
style: { marginTop: (errors == null ? void 0 : errors.name) ?
|
|
10388
|
+
style: { marginTop: (errors == null ? void 0 : errors.name) ? spacing2.xl : spacing2.none }
|
|
10325
10389
|
},
|
|
10326
|
-
/* @__PURE__ */
|
|
10327
|
-
|
|
10390
|
+
/* @__PURE__ */ React20.createElement(
|
|
10391
|
+
Form2.TextArea,
|
|
10328
10392
|
{
|
|
10329
10393
|
name: "description",
|
|
10330
10394
|
placeholder: I18n.t("savedViews.modal.fields.description"),
|
|
@@ -10334,8 +10398,8 @@ var FormModalBase = ({
|
|
|
10334
10398
|
}
|
|
10335
10399
|
)
|
|
10336
10400
|
),
|
|
10337
|
-
viewLevelOptions.length > 1 && mode === "create" /* CREATE */ ? /* @__PURE__ */
|
|
10338
|
-
|
|
10401
|
+
viewLevelOptions.length > 1 && mode === "create" /* CREATE */ ? /* @__PURE__ */ React20.createElement(Form2.Row, null, /* @__PURE__ */ React20.createElement(
|
|
10402
|
+
Form2.Select,
|
|
10339
10403
|
{
|
|
10340
10404
|
name: "view_level",
|
|
10341
10405
|
options: viewLevelOptions,
|
|
@@ -10344,9 +10408,9 @@ var FormModalBase = ({
|
|
|
10344
10408
|
onSearch: false,
|
|
10345
10409
|
onClear: false
|
|
10346
10410
|
}
|
|
10347
|
-
)) : /* @__PURE__ */
|
|
10348
|
-
), /* @__PURE__ */
|
|
10349
|
-
|
|
10411
|
+
)) : /* @__PURE__ */ React20.createElement(React20.Fragment, null)
|
|
10412
|
+
), /* @__PURE__ */ React20.createElement(Modal2.Footer, { style: { borderTop: `1px solid ${colors3.gray85}` } }, /* @__PURE__ */ React20.createElement(Flex3, { grow: "1", justifyContent: "space-between", alignItems: "center" }, /* @__PURE__ */ React20.createElement(Typography2, { color: "gray45", italic: true }, /* @__PURE__ */ React20.createElement(Typography2, { color: "red45" }, "*"), " ", I18n.t("savedViews.modal.info.required_fields")), /* @__PURE__ */ React20.createElement(Modal2.FooterButtons, null, /* @__PURE__ */ React20.createElement(Button5, { type: "reset", variant: "tertiary", disabled: isLoading }, I18n.t("savedViews.actions.cancel")), /* @__PURE__ */ React20.createElement(
|
|
10413
|
+
Button5,
|
|
10350
10414
|
{
|
|
10351
10415
|
"data-testid": "create-update-modal-button",
|
|
10352
10416
|
type: "submit",
|
|
@@ -10361,7 +10425,7 @@ var FormModalBase = ({
|
|
|
10361
10425
|
};
|
|
10362
10426
|
|
|
10363
10427
|
// src/components/modals/form-modal/FormModal.tsx
|
|
10364
|
-
import { useI18nContext as
|
|
10428
|
+
import { useI18nContext as useI18nContext9 } from "@procore/core-react";
|
|
10365
10429
|
var FormModal = ({
|
|
10366
10430
|
open,
|
|
10367
10431
|
mode,
|
|
@@ -10374,8 +10438,8 @@ var FormModal = ({
|
|
|
10374
10438
|
onSelect,
|
|
10375
10439
|
defaultView
|
|
10376
10440
|
}) => {
|
|
10377
|
-
const i18n =
|
|
10378
|
-
return /* @__PURE__ */
|
|
10441
|
+
const i18n = useI18nContext9();
|
|
10442
|
+
return /* @__PURE__ */ React21.createElement(
|
|
10379
10443
|
FormModalBase,
|
|
10380
10444
|
{
|
|
10381
10445
|
open,
|
|
@@ -10398,18 +10462,18 @@ var FormModal = ({
|
|
|
10398
10462
|
// src/components/modals/form-modal/SharedViewFormModal.tsx
|
|
10399
10463
|
import {
|
|
10400
10464
|
Banner as Banner2,
|
|
10401
|
-
Button as
|
|
10465
|
+
Button as Button6,
|
|
10402
10466
|
colors as colors4,
|
|
10403
10467
|
ErrorBanner as ErrorBanner2,
|
|
10404
|
-
Flex as
|
|
10405
|
-
Form as
|
|
10468
|
+
Flex as Flex4,
|
|
10469
|
+
Form as Form3,
|
|
10406
10470
|
Modal as Modal3,
|
|
10407
10471
|
P as P3,
|
|
10408
|
-
spacing as
|
|
10472
|
+
spacing as spacing3,
|
|
10409
10473
|
Typography as Typography3,
|
|
10410
|
-
useI18nContext as
|
|
10474
|
+
useI18nContext as useI18nContext10
|
|
10411
10475
|
} from "@procore/core-react";
|
|
10412
|
-
import * as
|
|
10476
|
+
import * as React22 from "react";
|
|
10413
10477
|
import * as yup2 from "yup";
|
|
10414
10478
|
var SharedViewFormModal = ({
|
|
10415
10479
|
open,
|
|
@@ -10421,7 +10485,7 @@ var SharedViewFormModal = ({
|
|
|
10421
10485
|
isCreating,
|
|
10422
10486
|
resetCreateError
|
|
10423
10487
|
}) => {
|
|
10424
|
-
const I18n =
|
|
10488
|
+
const I18n = useI18nContext10();
|
|
10425
10489
|
const NAME_MAX_LENGTH = 150;
|
|
10426
10490
|
const errors = extractMessage(createError, I18n);
|
|
10427
10491
|
const handleNameChange = () => {
|
|
@@ -10432,35 +10496,36 @@ var SharedViewFormModal = ({
|
|
|
10432
10496
|
const handleOnSubmit = (data) => {
|
|
10433
10497
|
onCreateView(data.name, data.description);
|
|
10434
10498
|
};
|
|
10435
|
-
return /* @__PURE__ */
|
|
10499
|
+
return /* @__PURE__ */ React22.createElement(
|
|
10436
10500
|
Modal3,
|
|
10437
10501
|
{
|
|
10438
10502
|
"data-testid": "shared-view-form-modal",
|
|
10439
10503
|
open,
|
|
10440
|
-
|
|
10504
|
+
howToClose: ["x", "scrim"],
|
|
10505
|
+
onClose,
|
|
10441
10506
|
style: { width: "540px" }
|
|
10442
10507
|
},
|
|
10443
|
-
/* @__PURE__ */
|
|
10508
|
+
/* @__PURE__ */ React22.createElement(
|
|
10444
10509
|
Modal3.Header,
|
|
10445
10510
|
{
|
|
10446
10511
|
onClose,
|
|
10447
10512
|
style: {
|
|
10448
|
-
paddingTop:
|
|
10449
|
-
paddingBottom:
|
|
10450
|
-
paddingLeft:
|
|
10451
|
-
paddingRight:
|
|
10513
|
+
paddingTop: spacing3.lg,
|
|
10514
|
+
paddingBottom: spacing3.xs,
|
|
10515
|
+
paddingLeft: spacing3.xl,
|
|
10516
|
+
paddingRight: spacing3.xl
|
|
10452
10517
|
}
|
|
10453
10518
|
},
|
|
10454
|
-
I18n.t("savedViews.modal.create.title")
|
|
10519
|
+
/* @__PURE__ */ React22.createElement(Modal3.Heading, null, I18n.t("savedViews.modal.create.title"))
|
|
10455
10520
|
),
|
|
10456
|
-
/* @__PURE__ */
|
|
10521
|
+
/* @__PURE__ */ React22.createElement(
|
|
10457
10522
|
P3,
|
|
10458
10523
|
{
|
|
10459
10524
|
style: {
|
|
10460
|
-
paddingLeft:
|
|
10461
|
-
paddingRight:
|
|
10462
|
-
paddingBottom:
|
|
10463
|
-
paddingTop:
|
|
10525
|
+
paddingLeft: spacing3.xl,
|
|
10526
|
+
paddingRight: spacing3.xl,
|
|
10527
|
+
paddingBottom: spacing3.lg,
|
|
10528
|
+
paddingTop: spacing3.none,
|
|
10464
10529
|
margin: 0,
|
|
10465
10530
|
color: colors4.gray45,
|
|
10466
10531
|
whiteSpace: "pre-line"
|
|
@@ -10468,8 +10533,8 @@ var SharedViewFormModal = ({
|
|
|
10468
10533
|
},
|
|
10469
10534
|
I18n.t("savedViews.modal.copyConfirmation.description")
|
|
10470
10535
|
),
|
|
10471
|
-
/* @__PURE__ */
|
|
10472
|
-
|
|
10536
|
+
/* @__PURE__ */ React22.createElement(
|
|
10537
|
+
Form3,
|
|
10473
10538
|
{
|
|
10474
10539
|
initialValues: {
|
|
10475
10540
|
name: fetchedView.name,
|
|
@@ -10487,36 +10552,32 @@ var SharedViewFormModal = ({
|
|
|
10487
10552
|
onSubmit: handleOnSubmit,
|
|
10488
10553
|
validateOnChange: true
|
|
10489
10554
|
},
|
|
10490
|
-
/* @__PURE__ */
|
|
10555
|
+
/* @__PURE__ */ React22.createElement(Form3.Form, { name: "share-view-form" }, /* @__PURE__ */ React22.createElement(
|
|
10491
10556
|
Modal3.Body,
|
|
10492
10557
|
{
|
|
10493
10558
|
style: {
|
|
10494
|
-
paddingTop:
|
|
10559
|
+
paddingTop: spacing3.lg,
|
|
10495
10560
|
paddingBottom: 0,
|
|
10496
10561
|
borderTop: `1px solid ${colors4.gray85}`
|
|
10497
10562
|
}
|
|
10498
10563
|
},
|
|
10499
|
-
errors && /* @__PURE__ */
|
|
10564
|
+
errors && /* @__PURE__ */ React22.createElement(ErrorBanner2, { style: { marginBottom: spacing3.xl } }, /* @__PURE__ */ React22.createElement(Banner2.Content, null, /* @__PURE__ */ React22.createElement(Banner2.Title, null, I18n.t("savedViews.modal.errors.title", {
|
|
10500
10565
|
mode: "create"
|
|
10501
|
-
})), /* @__PURE__ */
|
|
10502
|
-
/* @__PURE__ */
|
|
10503
|
-
|
|
10566
|
+
})), /* @__PURE__ */ React22.createElement(Banner2.Body, null, (errors == null ? void 0 : errors.form) || I18n.t("savedViews.modal.errors.description.create")))),
|
|
10567
|
+
/* @__PURE__ */ React22.createElement(Form3.Row, null, /* @__PURE__ */ React22.createElement(
|
|
10568
|
+
NameInputField,
|
|
10504
10569
|
{
|
|
10505
|
-
name: "name",
|
|
10506
10570
|
error: errors == null ? void 0 : errors.name,
|
|
10507
|
-
|
|
10508
|
-
label: I18n.t("savedViews.modal.fields.name"),
|
|
10509
|
-
colWidth: 12,
|
|
10510
|
-
onChange: handleNameChange
|
|
10571
|
+
onResetMutations: handleNameChange
|
|
10511
10572
|
}
|
|
10512
10573
|
)),
|
|
10513
|
-
/* @__PURE__ */
|
|
10514
|
-
|
|
10574
|
+
/* @__PURE__ */ React22.createElement(
|
|
10575
|
+
Form3.Row,
|
|
10515
10576
|
{
|
|
10516
|
-
style: { marginTop: (errors == null ? void 0 : errors.name) ?
|
|
10577
|
+
style: { marginTop: (errors == null ? void 0 : errors.name) ? spacing3.xl : spacing3.none }
|
|
10517
10578
|
},
|
|
10518
|
-
/* @__PURE__ */
|
|
10519
|
-
|
|
10579
|
+
/* @__PURE__ */ React22.createElement(
|
|
10580
|
+
Form3.TextArea,
|
|
10520
10581
|
{
|
|
10521
10582
|
name: "description",
|
|
10522
10583
|
placeholder: I18n.t("savedViews.modal.fields.description"),
|
|
@@ -10526,8 +10587,8 @@ var SharedViewFormModal = ({
|
|
|
10526
10587
|
}
|
|
10527
10588
|
)
|
|
10528
10589
|
)
|
|
10529
|
-
), /* @__PURE__ */
|
|
10530
|
-
|
|
10590
|
+
), /* @__PURE__ */ React22.createElement(Modal3.Footer, { style: { borderTop: `1px solid ${colors4.gray85}` } }, /* @__PURE__ */ React22.createElement(Flex4, { grow: "1", justifyContent: "space-between", alignItems: "center" }, /* @__PURE__ */ React22.createElement(Typography3, { color: "gray45", italic: true }, /* @__PURE__ */ React22.createElement(Typography3, { color: "red45" }, "*"), " ", I18n.t("savedViews.modal.info.required_fields")), /* @__PURE__ */ React22.createElement(Modal3.FooterButtons, null, /* @__PURE__ */ React22.createElement(
|
|
10591
|
+
Button6,
|
|
10531
10592
|
{
|
|
10532
10593
|
variant: "secondary",
|
|
10533
10594
|
onClick: onCreateTemporaryView,
|
|
@@ -10535,8 +10596,8 @@ var SharedViewFormModal = ({
|
|
|
10535
10596
|
disabled: isCreating
|
|
10536
10597
|
},
|
|
10537
10598
|
I18n.t("savedViews.actions.viewTemporarily")
|
|
10538
|
-
), /* @__PURE__ */
|
|
10539
|
-
|
|
10599
|
+
), /* @__PURE__ */ React22.createElement(
|
|
10600
|
+
Button6,
|
|
10540
10601
|
{
|
|
10541
10602
|
type: "submit",
|
|
10542
10603
|
variant: "primary",
|
|
@@ -10551,9 +10612,9 @@ var SharedViewFormModal = ({
|
|
|
10551
10612
|
};
|
|
10552
10613
|
|
|
10553
10614
|
// src/utils/hooks/useViewSelection.ts
|
|
10554
|
-
import { useState as useState3, useCallback as useCallback2, useEffect as
|
|
10615
|
+
import { useState as useState3, useCallback as useCallback2, useEffect as useEffect3, useRef as useRef2, useMemo } from "react";
|
|
10555
10616
|
import { useSearchParams } from "react-router-dom";
|
|
10556
|
-
import { useI18nContext as
|
|
10617
|
+
import { useI18nContext as useI18nContext11 } from "@procore/core-react";
|
|
10557
10618
|
|
|
10558
10619
|
// src/utils/viewStorage.ts
|
|
10559
10620
|
var ViewStorage = {
|
|
@@ -10616,7 +10677,7 @@ var restoreUrlParameter = (currentParam, previousParam, setSearchParams) => {
|
|
|
10616
10677
|
}
|
|
10617
10678
|
};
|
|
10618
10679
|
var useViewSelection = (config, savedViews, presetViews, openSharedViewModal) => {
|
|
10619
|
-
const I18n =
|
|
10680
|
+
const I18n = useI18nContext11();
|
|
10620
10681
|
const projectIdSegment = config.projectId ?? "company";
|
|
10621
10682
|
const storageKey = `savedView_${config.domain}_${config.tableName}_${config.companyId}_${projectIdSegment}_${config.userId}`;
|
|
10622
10683
|
const temporaryStorageKey = `${storageKey}-temporary`;
|
|
@@ -10692,7 +10753,7 @@ var useViewSelection = (config, savedViews, presetViews, openSharedViewModal) =>
|
|
|
10692
10753
|
},
|
|
10693
10754
|
[isViewAlreadySelected, openSharedViewModal, allViews, selectView]
|
|
10694
10755
|
);
|
|
10695
|
-
|
|
10756
|
+
useEffect3(() => {
|
|
10696
10757
|
const savedViewId = searchParams.get("saved-view");
|
|
10697
10758
|
restoreUrlParameter(
|
|
10698
10759
|
savedViewId,
|
|
@@ -10732,7 +10793,7 @@ var SavedViewsContent = (props) => {
|
|
|
10732
10793
|
const { data: savedViews } = useSavedViewsQuery(queryInput);
|
|
10733
10794
|
const { mutate: deleteSavedView } = useDeleteSavedView(queryInput);
|
|
10734
10795
|
const { showToast } = useToastAlertContext3();
|
|
10735
|
-
const i18n =
|
|
10796
|
+
const i18n = useI18nContext12();
|
|
10736
10797
|
const [activeModal, setActiveModal] = useState4(null);
|
|
10737
10798
|
const [modalData, setModalData] = useState4(null);
|
|
10738
10799
|
const openModal = (type, data) => {
|
|
@@ -10778,7 +10839,7 @@ var SavedViewsContent = (props) => {
|
|
|
10778
10839
|
error: createError,
|
|
10779
10840
|
reset: resetCreateError
|
|
10780
10841
|
} = useCreateSavedView(queryInput);
|
|
10781
|
-
|
|
10842
|
+
useEffect4(() => {
|
|
10782
10843
|
if (fetchError) {
|
|
10783
10844
|
showToast.error(i18n.t("savedViews.errors.notFound"));
|
|
10784
10845
|
selectView(selectedView ?? props.defaultView);
|
|
@@ -10826,31 +10887,45 @@ var SavedViewsContent = (props) => {
|
|
|
10826
10887
|
deleteSelectedView();
|
|
10827
10888
|
closeModal();
|
|
10828
10889
|
};
|
|
10829
|
-
return /* @__PURE__ */
|
|
10890
|
+
return /* @__PURE__ */ React23.createElement(StyledPanel, { provider: props.provider }, /* @__PURE__ */ React23.createElement(
|
|
10830
10891
|
ExpandedPanel,
|
|
10831
10892
|
{
|
|
10832
10893
|
"data-testid": "saved-view-expanded-panel",
|
|
10833
10894
|
provider: props.provider
|
|
10834
10895
|
},
|
|
10835
|
-
/* @__PURE__ */
|
|
10896
|
+
/* @__PURE__ */ React23.createElement(Panel3.Header, { id: "saved-views-collections-panel-header" }, /* @__PURE__ */ React23.createElement(Panel3.Title, null, /* @__PURE__ */ React23.createElement(Flex5, { alignItems: "center" }, /* @__PURE__ */ React23.createElement(Box3, { paddingRight: "sm" }, i18n.t("savedViews.title")), /* @__PURE__ */ React23.createElement(
|
|
10897
|
+
Tooltip,
|
|
10898
|
+
{
|
|
10899
|
+
showDelay: 200,
|
|
10900
|
+
overlay: /* @__PURE__ */ React23.createElement(Tooltip.Content, null, i18n.t("savedViews.tooltip"))
|
|
10901
|
+
},
|
|
10902
|
+
/* @__PURE__ */ React23.createElement(
|
|
10903
|
+
Help_default,
|
|
10904
|
+
{
|
|
10905
|
+
tabIndex: 0,
|
|
10906
|
+
size: "sm",
|
|
10907
|
+
"aria-label": i18n.t("savedViews.tooltip")
|
|
10908
|
+
}
|
|
10909
|
+
)
|
|
10910
|
+
))), /* @__PURE__ */ React23.createElement(
|
|
10836
10911
|
Tooltip,
|
|
10837
10912
|
{
|
|
10838
10913
|
overlay: i18n.t("savedViews.actions.create"),
|
|
10839
10914
|
showDelay: 1e3
|
|
10840
10915
|
},
|
|
10841
|
-
/* @__PURE__ */
|
|
10842
|
-
|
|
10916
|
+
/* @__PURE__ */ React23.createElement(
|
|
10917
|
+
Button7,
|
|
10843
10918
|
{
|
|
10844
|
-
icon: /* @__PURE__ */
|
|
10919
|
+
icon: /* @__PURE__ */ React23.createElement(Plus_default, null),
|
|
10845
10920
|
variant: "secondary",
|
|
10846
10921
|
"data-testid": "expanded-panel-create-button",
|
|
10847
10922
|
onClick: () => openModal("create" /* CREATE */),
|
|
10848
10923
|
"aria-label": i18n.t("savedViews.actions.create")
|
|
10849
10924
|
},
|
|
10850
10925
|
i18n.t("savedViews.actions.create")
|
|
10851
|
-
)
|
|
10926
|
+
)
|
|
10852
10927
|
)),
|
|
10853
|
-
/* @__PURE__ */
|
|
10928
|
+
/* @__PURE__ */ React23.createElement(Panel3.Body, { style: { display: "flex", flexFlow: "column" } }, /* @__PURE__ */ React23.createElement(
|
|
10854
10929
|
PanelContent,
|
|
10855
10930
|
{
|
|
10856
10931
|
onSelect: ({ item }) => selectView(item),
|
|
@@ -10867,7 +10942,7 @@ var SavedViewsContent = (props) => {
|
|
|
10867
10942
|
onClearTemporary: clearTemporaryView
|
|
10868
10943
|
}
|
|
10869
10944
|
))
|
|
10870
|
-
), (isModalOpen("create" /* CREATE */) || isModalOpen("update" /* UPDATE */)) && /* @__PURE__ */
|
|
10945
|
+
), (isModalOpen("create" /* CREATE */) || isModalOpen("update" /* UPDATE */)) && /* @__PURE__ */ React23.createElement(
|
|
10871
10946
|
FormModal,
|
|
10872
10947
|
{
|
|
10873
10948
|
open: true,
|
|
@@ -10881,14 +10956,14 @@ var SavedViewsContent = (props) => {
|
|
|
10881
10956
|
setOpenEditCreateModal: closeModal,
|
|
10882
10957
|
defaultView: props.defaultView
|
|
10883
10958
|
}
|
|
10884
|
-
), selectedView && isModalOpen("delete" /* DELETE */) && /* @__PURE__ */
|
|
10959
|
+
), selectedView && isModalOpen("delete" /* DELETE */) && /* @__PURE__ */ React23.createElement(
|
|
10885
10960
|
SavedViewsDeleteConfirmationModalShared,
|
|
10886
10961
|
{
|
|
10887
10962
|
open: true,
|
|
10888
10963
|
onDelete: confirmDeleteAndCloseModal,
|
|
10889
10964
|
onCancel: closeModal
|
|
10890
10965
|
}
|
|
10891
|
-
), fetchedView && isModalOpen("sharedView" /* SHARED_VIEW */) && /* @__PURE__ */
|
|
10966
|
+
), fetchedView && isModalOpen("sharedView" /* SHARED_VIEW */) && /* @__PURE__ */ React23.createElement(
|
|
10892
10967
|
SharedViewFormModal,
|
|
10893
10968
|
{
|
|
10894
10969
|
open: true,
|
|
@@ -10903,11 +10978,11 @@ var SavedViewsContent = (props) => {
|
|
|
10903
10978
|
));
|
|
10904
10979
|
};
|
|
10905
10980
|
var SavedViews = (props) => {
|
|
10906
|
-
return /* @__PURE__ */
|
|
10981
|
+
return /* @__PURE__ */ React23.createElement(EnvironmentI18nProvider, null, /* @__PURE__ */ React23.createElement(QueryClientProvider, { client: queryClient }, /* @__PURE__ */ React23.createElement(ToastAlertProvider, null, /* @__PURE__ */ React23.createElement(SavedViewsContent, { ...props }))));
|
|
10907
10982
|
};
|
|
10908
10983
|
|
|
10909
10984
|
// src/components/adapters/smart-grid/SmartGridSavedViews.tsx
|
|
10910
|
-
import
|
|
10985
|
+
import React24, { useCallback as useCallback4 } from "react";
|
|
10911
10986
|
|
|
10912
10987
|
// src/components/adapters/smart-grid/SmartGridDefaultSavedView.tsx
|
|
10913
10988
|
import { useMemo as useMemo2 } from "react";
|
|
@@ -10971,7 +11046,7 @@ var useNormalizedDefaultViews = (defaultViews, gridApi) => {
|
|
|
10971
11046
|
};
|
|
10972
11047
|
|
|
10973
11048
|
// src/components/adapters/smart-grid/useSmartGridConfig.ts
|
|
10974
|
-
import { useState as useState5, useEffect as
|
|
11049
|
+
import { useState as useState5, useEffect as useEffect5 } from "react";
|
|
10975
11050
|
var GRID_STATE_EVENTS = [
|
|
10976
11051
|
"sortChanged",
|
|
10977
11052
|
"filterOpened",
|
|
@@ -10990,7 +11065,7 @@ var useSmartGridConfig = (gridApi) => {
|
|
|
10990
11065
|
const [config, setConfig] = useState5(
|
|
10991
11066
|
() => getSmartGridConfig(gridApi)
|
|
10992
11067
|
);
|
|
10993
|
-
|
|
11068
|
+
useEffect5(() => {
|
|
10994
11069
|
if (!gridApi)
|
|
10995
11070
|
return;
|
|
10996
11071
|
const updateConfig = () => {
|
|
@@ -11037,7 +11112,7 @@ var SmartGridSavedViews = (props) => {
|
|
|
11037
11112
|
},
|
|
11038
11113
|
[gridApi, tableConfig, setTableConfig]
|
|
11039
11114
|
);
|
|
11040
|
-
return /* @__PURE__ */
|
|
11115
|
+
return /* @__PURE__ */ React24.createElement(
|
|
11041
11116
|
SavedViews,
|
|
11042
11117
|
{
|
|
11043
11118
|
onSelect,
|
|
@@ -11055,7 +11130,7 @@ var SmartGridSavedViews = (props) => {
|
|
|
11055
11130
|
};
|
|
11056
11131
|
|
|
11057
11132
|
// src/components/adapters/data-table/DataTableSavedViews.tsx
|
|
11058
|
-
import
|
|
11133
|
+
import React25, {
|
|
11059
11134
|
forwardRef as forwardRef11,
|
|
11060
11135
|
useImperativeHandle,
|
|
11061
11136
|
useState as useState6,
|
|
@@ -11156,7 +11231,7 @@ var DataTableSavedViews = forwardRef11((props, ref) => {
|
|
|
11156
11231
|
if (!internalTableConfig) {
|
|
11157
11232
|
return null;
|
|
11158
11233
|
}
|
|
11159
|
-
return /* @__PURE__ */
|
|
11234
|
+
return /* @__PURE__ */ React25.createElement(
|
|
11160
11235
|
SavedViews,
|
|
11161
11236
|
{
|
|
11162
11237
|
onSelect,
|