@procore/saved-views 1.0.1-estimatingFork.5 → 1.0.1-estimatingFork.6
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 +1 -1
- package/dist/legacy/index.d.ts +1 -1
- package/dist/legacy/index.js +272 -199
- package/dist/legacy/index.mjs +297 -225
- package/dist/modern/index.d.mts +1 -1
- package/dist/modern/index.d.ts +1 -1
- package/dist/modern/index.js +271 -199
- package/dist/modern/index.mjs +296 -225
- 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
|
|
|
@@ -9526,7 +9538,7 @@ var useScrollToRef = (dependency) => {
|
|
|
9526
9538
|
};
|
|
9527
9539
|
|
|
9528
9540
|
// src/components/panels/PanelContent.tsx
|
|
9529
|
-
import { Flex as
|
|
9541
|
+
import { Flex as Flex2, MenuImperative as MenuImperative2, useI18nContext as useI18nContext4 } from "@procore/core-react";
|
|
9530
9542
|
import { useToastAlertContext as useToastAlertContext2 } from "@procore/toast-alert";
|
|
9531
9543
|
import React17 from "react";
|
|
9532
9544
|
|
|
@@ -9534,7 +9546,7 @@ import React17 from "react";
|
|
|
9534
9546
|
import {
|
|
9535
9547
|
colors,
|
|
9536
9548
|
DetailPage,
|
|
9537
|
-
|
|
9549
|
+
MenuImperative,
|
|
9538
9550
|
spacing
|
|
9539
9551
|
} from "@procore/core-react";
|
|
9540
9552
|
var Row = styled_components_esm_default(MenuImperative.Item)`
|
|
@@ -9798,9 +9810,9 @@ var useGroups = (isProjectLevelTool) => {
|
|
|
9798
9810
|
|
|
9799
9811
|
// src/components/panels/ViewLevelHeader.tsx
|
|
9800
9812
|
import {
|
|
9813
|
+
Box as Box2,
|
|
9814
|
+
Button as Button3,
|
|
9801
9815
|
colors as colors2,
|
|
9802
|
-
Flex as Flex2,
|
|
9803
|
-
spacing as spacing2,
|
|
9804
9816
|
Typography,
|
|
9805
9817
|
useI18nContext as useI18nContext3
|
|
9806
9818
|
} from "@procore/core-react";
|
|
@@ -9815,31 +9827,40 @@ var groupIcon = (group) => {
|
|
|
9815
9827
|
return /* @__PURE__ */ React16.createElement(Building_default, null);
|
|
9816
9828
|
}
|
|
9817
9829
|
};
|
|
9818
|
-
var
|
|
9819
|
-
width: 100%;
|
|
9830
|
+
var StyledButton2 = styled_components_esm_default(Button3)`
|
|
9820
9831
|
&:hover {
|
|
9821
9832
|
background-color: ${colors2.gray98};
|
|
9822
9833
|
}
|
|
9823
9834
|
`;
|
|
9824
9835
|
var ViewLevelHeader = ({ expanded, toggleGroup, group }) => {
|
|
9825
9836
|
const I18n = useI18nContext3();
|
|
9826
|
-
return /* @__PURE__ */ React16.createElement(
|
|
9827
|
-
|
|
9837
|
+
return /* @__PURE__ */ React16.createElement(Box2, { style: { width: "100%" } }, /* @__PURE__ */ React16.createElement(
|
|
9838
|
+
StyledButton2,
|
|
9828
9839
|
{
|
|
9829
|
-
|
|
9830
|
-
|
|
9831
|
-
|
|
9832
|
-
|
|
9833
|
-
|
|
9840
|
+
block: true,
|
|
9841
|
+
style: {
|
|
9842
|
+
justifyContent: "start",
|
|
9843
|
+
height: "40px"
|
|
9844
|
+
},
|
|
9845
|
+
variant: "tertiary",
|
|
9846
|
+
size: "sm",
|
|
9847
|
+
onClick: () => toggleGroup(group),
|
|
9848
|
+
"aria-controls": `saved-views-collections-${group}`,
|
|
9849
|
+
"aria-expanded": expanded,
|
|
9850
|
+
icon: expanded ? /* @__PURE__ */ React16.createElement(ChevronDown_default, { size: "sm" }) : /* @__PURE__ */ React16.createElement(ChevronRight_default, { size: "sm" })
|
|
9834
9851
|
},
|
|
9835
|
-
expanded ? /* @__PURE__ */ React16.createElement(ChevronDown_default, { size: "sm" }) : /* @__PURE__ */ React16.createElement(ChevronRight_default, { size: "sm" }),
|
|
9836
9852
|
groupIcon(group),
|
|
9837
9853
|
/* @__PURE__ */ React16.createElement(Typography, { weight: "semibold" }, I18n.t(`savedViews.viewLevel.${group}`))
|
|
9838
|
-
);
|
|
9854
|
+
));
|
|
9839
9855
|
};
|
|
9840
9856
|
var ViewLevelHeader_default = ViewLevelHeader;
|
|
9841
9857
|
|
|
9842
9858
|
// src/components/panels/PanelContent.tsx
|
|
9859
|
+
var StyledMenuImperative = styled_components_esm_default(MenuImperative2)`
|
|
9860
|
+
div[role='listbox'] {
|
|
9861
|
+
padding: 0;
|
|
9862
|
+
}
|
|
9863
|
+
`;
|
|
9843
9864
|
var PanelContent = (props) => {
|
|
9844
9865
|
const { queryInput, selectedSavedView, tableConfig } = props;
|
|
9845
9866
|
const { showToast } = useToastAlertContext2();
|
|
@@ -9882,42 +9903,52 @@ var PanelContent = (props) => {
|
|
|
9882
9903
|
}
|
|
9883
9904
|
});
|
|
9884
9905
|
};
|
|
9885
|
-
return /* @__PURE__ */ React17.createElement(Panel2, { "data-testid": "inner-panel" }, /* @__PURE__ */ React17.createElement(
|
|
9886
|
-
|
|
9906
|
+
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(
|
|
9907
|
+
StyledMenuImperative,
|
|
9887
9908
|
{
|
|
9888
|
-
|
|
9889
|
-
|
|
9890
|
-
|
|
9909
|
+
role: "listbox",
|
|
9910
|
+
onSelect: (selection) => {
|
|
9911
|
+
if ((selectedSavedView == null ? void 0 : selectedSavedView.id) !== selection.item.id) {
|
|
9912
|
+
props.onSelect({ item: selection.item });
|
|
9913
|
+
}
|
|
9914
|
+
}
|
|
9891
9915
|
},
|
|
9892
|
-
/* @__PURE__ */ React17.createElement(
|
|
9893
|
-
|
|
9916
|
+
/* @__PURE__ */ React17.createElement(MenuImperative2.Options, null, temporaryView && /* @__PURE__ */ React17.createElement(
|
|
9917
|
+
Row,
|
|
9894
9918
|
{
|
|
9919
|
+
key: temporaryView.id,
|
|
9895
9920
|
item: temporaryView,
|
|
9896
9921
|
selected: isTemporarySelected,
|
|
9897
|
-
|
|
9898
|
-
enableSharingViews: false
|
|
9899
|
-
}
|
|
9900
|
-
)
|
|
9901
|
-
), presetViews.map((presetView) => {
|
|
9902
|
-
const isSelected = (selectedSavedView == null ? void 0 : selectedSavedView.id) === presetView.id;
|
|
9903
|
-
return /* @__PURE__ */ React17.createElement(
|
|
9904
|
-
Row,
|
|
9905
|
-
{
|
|
9906
|
-
key: presetView.id,
|
|
9907
|
-
selected: isSelected,
|
|
9908
|
-
onClick: () => props.onSelect({ item: presetView }),
|
|
9909
|
-
ref: isSelected ? selectedRowRef : null
|
|
9922
|
+
ref: isTemporarySelected ? selectedRowRef : null
|
|
9910
9923
|
},
|
|
9911
9924
|
/* @__PURE__ */ React17.createElement(
|
|
9912
9925
|
SavedViewCollectionMenuItem,
|
|
9913
9926
|
{
|
|
9914
|
-
item:
|
|
9915
|
-
selected:
|
|
9916
|
-
|
|
9927
|
+
item: temporaryView,
|
|
9928
|
+
selected: isTemporarySelected,
|
|
9929
|
+
onClearTemporary: props.onClearTemporary
|
|
9917
9930
|
}
|
|
9918
9931
|
)
|
|
9919
|
-
)
|
|
9920
|
-
|
|
9932
|
+
), presetViews.map((presetView) => {
|
|
9933
|
+
const isSelected = (selectedSavedView == null ? void 0 : selectedSavedView.id) === presetView.id;
|
|
9934
|
+
return /* @__PURE__ */ React17.createElement(
|
|
9935
|
+
Row,
|
|
9936
|
+
{
|
|
9937
|
+
key: presetView.id,
|
|
9938
|
+
item: presetView,
|
|
9939
|
+
selected: isSelected,
|
|
9940
|
+
ref: isSelected ? selectedRowRef : null
|
|
9941
|
+
},
|
|
9942
|
+
/* @__PURE__ */ React17.createElement(
|
|
9943
|
+
SavedViewCollectionMenuItem,
|
|
9944
|
+
{
|
|
9945
|
+
item: presetView,
|
|
9946
|
+
selected: isSelected
|
|
9947
|
+
}
|
|
9948
|
+
)
|
|
9949
|
+
);
|
|
9950
|
+
}))
|
|
9951
|
+
), viewLevels.map((level) => {
|
|
9921
9952
|
const isExpanded = groups[level];
|
|
9922
9953
|
const views = isExpanded && savedViews ? savedViews.filter(
|
|
9923
9954
|
(view) => view.view_level === level && view.id !== "temporary"
|
|
@@ -9929,63 +9960,74 @@ var PanelContent = (props) => {
|
|
|
9929
9960
|
toggleGroup,
|
|
9930
9961
|
expanded: isExpanded
|
|
9931
9962
|
}
|
|
9932
|
-
), views.
|
|
9933
|
-
|
|
9934
|
-
|
|
9935
|
-
|
|
9936
|
-
|
|
9937
|
-
|
|
9938
|
-
|
|
9939
|
-
|
|
9940
|
-
|
|
9941
|
-
|
|
9942
|
-
|
|
9943
|
-
|
|
9944
|
-
|
|
9945
|
-
|
|
9946
|
-
|
|
9947
|
-
|
|
9948
|
-
|
|
9949
|
-
|
|
9950
|
-
|
|
9951
|
-
|
|
9952
|
-
|
|
9953
|
-
|
|
9963
|
+
), isExpanded && views.length > 0 && /* @__PURE__ */ React17.createElement(
|
|
9964
|
+
StyledMenuImperative,
|
|
9965
|
+
{
|
|
9966
|
+
id: `saved-views-collections-${level}`,
|
|
9967
|
+
role: "listbox",
|
|
9968
|
+
onSelect: (selection) => {
|
|
9969
|
+
if ((selectedSavedView == null ? void 0 : selectedSavedView.id) !== selection.item.id) {
|
|
9970
|
+
props.onSelect({ item: selection.item });
|
|
9971
|
+
}
|
|
9972
|
+
}
|
|
9973
|
+
},
|
|
9974
|
+
/* @__PURE__ */ React17.createElement(MenuImperative2.Options, null, views.map((view) => {
|
|
9975
|
+
const isSelected = (selectedSavedView == null ? void 0 : selectedSavedView.id) === view.id;
|
|
9976
|
+
const canUpdate = isSelected && hasPermissionForViewLevel(
|
|
9977
|
+
view.view_level,
|
|
9978
|
+
permissions
|
|
9979
|
+
) && !isEqual(
|
|
9980
|
+
view.table_config,
|
|
9981
|
+
tableConfig,
|
|
9982
|
+
props.defaultView.table_config,
|
|
9983
|
+
props.provider
|
|
9984
|
+
);
|
|
9985
|
+
const canEditOrDelete = isSelected && hasPermissionForViewLevel(view.view_level, permissions);
|
|
9986
|
+
return /* @__PURE__ */ React17.createElement(
|
|
9987
|
+
Row,
|
|
9954
9988
|
{
|
|
9955
|
-
item: view,
|
|
9956
9989
|
key: view.id,
|
|
9990
|
+
item: view,
|
|
9957
9991
|
selected: isSelected,
|
|
9958
|
-
|
|
9959
|
-
|
|
9960
|
-
|
|
9961
|
-
|
|
9962
|
-
|
|
9963
|
-
|
|
9964
|
-
|
|
9965
|
-
|
|
9966
|
-
|
|
9967
|
-
|
|
9968
|
-
|
|
9969
|
-
|
|
9992
|
+
ref: isSelected ? selectedRowRef : null
|
|
9993
|
+
},
|
|
9994
|
+
/* @__PURE__ */ React17.createElement(
|
|
9995
|
+
SavedViewCollectionMenuItem,
|
|
9996
|
+
{
|
|
9997
|
+
item: view,
|
|
9998
|
+
key: view.id,
|
|
9999
|
+
selected: isSelected,
|
|
10000
|
+
canUpdate,
|
|
10001
|
+
canEditOrDelete,
|
|
10002
|
+
onUpdate: (data) => onUpdate(data),
|
|
10003
|
+
isUpdateProcessing: isUpdateLoading,
|
|
10004
|
+
onEdit: () => props.openModal("update" /* UPDATE */),
|
|
10005
|
+
onDelete: props.onDelete,
|
|
10006
|
+
permissions
|
|
10007
|
+
}
|
|
10008
|
+
)
|
|
10009
|
+
);
|
|
10010
|
+
}))
|
|
10011
|
+
));
|
|
9970
10012
|
})));
|
|
9971
10013
|
};
|
|
9972
10014
|
|
|
9973
10015
|
// src/components/saved-views/SavedViews.tsx
|
|
9974
10016
|
import {
|
|
9975
|
-
Box as
|
|
9976
|
-
Button as
|
|
9977
|
-
Flex as
|
|
10017
|
+
Box as Box3,
|
|
10018
|
+
Button as Button7,
|
|
10019
|
+
Flex as Flex5,
|
|
9978
10020
|
Panel as Panel3,
|
|
9979
10021
|
Tooltip,
|
|
9980
|
-
useI18nContext as
|
|
10022
|
+
useI18nContext as useI18nContext12
|
|
9981
10023
|
} from "@procore/core-react";
|
|
9982
|
-
import
|
|
10024
|
+
import React23, { useState as useState4, useEffect as useEffect5, useCallback as useCallback3 } from "react";
|
|
9983
10025
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
9984
10026
|
import { useToastAlertContext as useToastAlertContext3, ToastAlertProvider } from "@procore/toast-alert";
|
|
9985
10027
|
|
|
9986
10028
|
// src/components/modals/DeleteConfirmationModal.tsx
|
|
9987
10029
|
import {
|
|
9988
|
-
Button as
|
|
10030
|
+
Button as Button4,
|
|
9989
10031
|
ConfirmModal,
|
|
9990
10032
|
Modal,
|
|
9991
10033
|
P as P2,
|
|
@@ -10009,28 +10051,27 @@ var SavedViewsDeleteConfirmationModalShared = ({
|
|
|
10009
10051
|
style: { overflowWrap: "anywhere" }
|
|
10010
10052
|
},
|
|
10011
10053
|
/* @__PURE__ */ React18.createElement(Modal.Body, null, /* @__PURE__ */ React18.createElement(P2, null, i18n.t("savedViews.modal.delete.description"))),
|
|
10012
|
-
/* @__PURE__ */ React18.createElement(Modal.Footer, null, /* @__PURE__ */ React18.createElement(Modal.FooterButtons, null, /* @__PURE__ */ React18.createElement(
|
|
10054
|
+
/* @__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"))))
|
|
10013
10055
|
);
|
|
10014
10056
|
};
|
|
10015
10057
|
|
|
10016
10058
|
// src/components/modals/form-modal/FormModal.tsx
|
|
10017
|
-
import
|
|
10059
|
+
import React21 from "react";
|
|
10018
10060
|
|
|
10019
10061
|
// src/components/modals/form-modal/FormModalBase.tsx
|
|
10020
10062
|
import {
|
|
10021
10063
|
Banner,
|
|
10022
|
-
Button as
|
|
10064
|
+
Button as Button5,
|
|
10023
10065
|
colors as colors3,
|
|
10024
10066
|
ErrorBanner,
|
|
10025
|
-
Flex as
|
|
10026
|
-
Form,
|
|
10027
|
-
H2,
|
|
10067
|
+
Flex as Flex3,
|
|
10068
|
+
Form as Form2,
|
|
10028
10069
|
Modal as Modal2,
|
|
10029
|
-
spacing as
|
|
10070
|
+
spacing as spacing2,
|
|
10030
10071
|
Typography as Typography2,
|
|
10031
|
-
useI18nContext as
|
|
10072
|
+
useI18nContext as useI18nContext7
|
|
10032
10073
|
} from "@procore/core-react";
|
|
10033
|
-
import * as
|
|
10074
|
+
import * as React20 from "react";
|
|
10034
10075
|
import * as yup from "yup";
|
|
10035
10076
|
|
|
10036
10077
|
// src/components/modals/form-modal/FormModalBaseUtils.ts
|
|
@@ -10067,8 +10108,39 @@ function extractMessage(error, I18n) {
|
|
|
10067
10108
|
return { form: I18n.t("savedViews.modal.errors.unknown") };
|
|
10068
10109
|
}
|
|
10069
10110
|
|
|
10111
|
+
// src/components/modals/form-modal/NameInputField.tsx
|
|
10112
|
+
import { Form, useFormContext, useI18nContext as useI18nContext6 } from "@procore/core-react";
|
|
10113
|
+
import * as React19 from "react";
|
|
10114
|
+
var NAME_INPUT_ID = "saved-view-form-name-input";
|
|
10115
|
+
var NameInputField = ({
|
|
10116
|
+
error,
|
|
10117
|
+
onResetMutations
|
|
10118
|
+
}) => {
|
|
10119
|
+
const I18n = useI18nContext6();
|
|
10120
|
+
const label = I18n.t("savedViews.modal.fields.name");
|
|
10121
|
+
const { errors: formErrors, submitCount } = useFormContext();
|
|
10122
|
+
React19.useEffect(() => {
|
|
10123
|
+
var _a;
|
|
10124
|
+
if (submitCount > 0 && (formErrors == null ? void 0 : formErrors.name)) {
|
|
10125
|
+
(_a = document.getElementById(NAME_INPUT_ID)) == null ? void 0 : _a.focus();
|
|
10126
|
+
}
|
|
10127
|
+
}, [formErrors == null ? void 0 : formErrors.name, submitCount]);
|
|
10128
|
+
return /* @__PURE__ */ React19.createElement(
|
|
10129
|
+
Form.Text,
|
|
10130
|
+
{
|
|
10131
|
+
id: NAME_INPUT_ID,
|
|
10132
|
+
name: "name",
|
|
10133
|
+
error,
|
|
10134
|
+
placeholder: label,
|
|
10135
|
+
label,
|
|
10136
|
+
colWidth: 12,
|
|
10137
|
+
onChange: onResetMutations
|
|
10138
|
+
}
|
|
10139
|
+
);
|
|
10140
|
+
};
|
|
10141
|
+
|
|
10070
10142
|
// src/components/modals/form-modal/FormModalBase.tsx
|
|
10071
|
-
var { useEffect:
|
|
10143
|
+
var { useEffect: useEffect3, useRef: useRef2 } = React20;
|
|
10072
10144
|
var ScrollContainer = styled_components_esm_default("div")`
|
|
10073
10145
|
overflow: auto;
|
|
10074
10146
|
`;
|
|
@@ -10088,10 +10160,10 @@ var FormModalBase = ({
|
|
|
10088
10160
|
onSelect,
|
|
10089
10161
|
backend
|
|
10090
10162
|
}) => {
|
|
10091
|
-
const I18n =
|
|
10163
|
+
const I18n = useI18nContext7();
|
|
10092
10164
|
const NAME_MAX_LENGTH = 150;
|
|
10093
10165
|
const originalBodyWidth = useRef2("");
|
|
10094
|
-
|
|
10166
|
+
useEffect3(() => {
|
|
10095
10167
|
if (open) {
|
|
10096
10168
|
originalBodyWidth.current = document.body.style.width || "";
|
|
10097
10169
|
document.body.style.width = "100%";
|
|
@@ -10162,24 +10234,17 @@ var FormModalBase = ({
|
|
|
10162
10234
|
I18n,
|
|
10163
10235
|
isProjectLevelTool
|
|
10164
10236
|
);
|
|
10165
|
-
return /* @__PURE__ */
|
|
10237
|
+
return /* @__PURE__ */ React20.createElement(
|
|
10166
10238
|
Modal2,
|
|
10167
10239
|
{
|
|
10168
|
-
"
|
|
10169
|
-
|
|
10240
|
+
howToClose: ["x", "scrim"],
|
|
10241
|
+
onClose,
|
|
10170
10242
|
open,
|
|
10171
|
-
|
|
10243
|
+
width: "md",
|
|
10172
10244
|
"data-testid": "create-update-modal"
|
|
10173
10245
|
},
|
|
10174
|
-
/* @__PURE__ */
|
|
10175
|
-
|
|
10176
|
-
{
|
|
10177
|
-
onClose,
|
|
10178
|
-
style: { borderBottom: `1px solid ${colors3.gray85}` }
|
|
10179
|
-
},
|
|
10180
|
-
/* @__PURE__ */ React19.createElement(H2, null, header)
|
|
10181
|
-
), /* @__PURE__ */ React19.createElement(
|
|
10182
|
-
Form,
|
|
10246
|
+
/* @__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(
|
|
10247
|
+
Form2,
|
|
10183
10248
|
{
|
|
10184
10249
|
initialValues: {
|
|
10185
10250
|
name: initialName,
|
|
@@ -10204,30 +10269,26 @@ var FormModalBase = ({
|
|
|
10204
10269
|
onReset: onCancel,
|
|
10205
10270
|
validateOnChange: true
|
|
10206
10271
|
},
|
|
10207
|
-
/* @__PURE__ */
|
|
10272
|
+
/* @__PURE__ */ React20.createElement(Form2.Form, { name: header }, /* @__PURE__ */ React20.createElement(
|
|
10208
10273
|
Modal2.Body,
|
|
10209
10274
|
{
|
|
10210
|
-
style: { paddingTop: 0, paddingBottom: 0, marginTop:
|
|
10275
|
+
style: { paddingTop: 0, paddingBottom: 0, marginTop: spacing2.lg }
|
|
10211
10276
|
},
|
|
10212
|
-
errors && /* @__PURE__ */
|
|
10213
|
-
/* @__PURE__ */
|
|
10214
|
-
|
|
10277
|
+
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}`)))),
|
|
10278
|
+
/* @__PURE__ */ React20.createElement(Form2.Row, null, /* @__PURE__ */ React20.createElement(
|
|
10279
|
+
NameInputField,
|
|
10215
10280
|
{
|
|
10216
|
-
name: "name",
|
|
10217
10281
|
error: errors == null ? void 0 : errors.name,
|
|
10218
|
-
|
|
10219
|
-
label: I18n.t("savedViews.modal.fields.name"),
|
|
10220
|
-
colWidth: 12,
|
|
10221
|
-
onChange: () => resetMutations()
|
|
10282
|
+
onResetMutations: resetMutations
|
|
10222
10283
|
}
|
|
10223
10284
|
)),
|
|
10224
|
-
/* @__PURE__ */
|
|
10225
|
-
|
|
10285
|
+
/* @__PURE__ */ React20.createElement(
|
|
10286
|
+
Form2.Row,
|
|
10226
10287
|
{
|
|
10227
|
-
style: { marginTop: (errors == null ? void 0 : errors.name) ?
|
|
10288
|
+
style: { marginTop: (errors == null ? void 0 : errors.name) ? spacing2.xl : spacing2.none }
|
|
10228
10289
|
},
|
|
10229
|
-
/* @__PURE__ */
|
|
10230
|
-
|
|
10290
|
+
/* @__PURE__ */ React20.createElement(
|
|
10291
|
+
Form2.TextArea,
|
|
10231
10292
|
{
|
|
10232
10293
|
name: "description",
|
|
10233
10294
|
placeholder: I18n.t("savedViews.modal.fields.description"),
|
|
@@ -10237,8 +10298,8 @@ var FormModalBase = ({
|
|
|
10237
10298
|
}
|
|
10238
10299
|
)
|
|
10239
10300
|
),
|
|
10240
|
-
viewLevelOptions.length > 1 && mode === "create" /* CREATE */ ? /* @__PURE__ */
|
|
10241
|
-
|
|
10301
|
+
viewLevelOptions.length > 1 && mode === "create" /* CREATE */ ? /* @__PURE__ */ React20.createElement(Form2.Row, null, /* @__PURE__ */ React20.createElement(
|
|
10302
|
+
Form2.Select,
|
|
10242
10303
|
{
|
|
10243
10304
|
name: "view_level",
|
|
10244
10305
|
qa: { label: "view-level" },
|
|
@@ -10248,9 +10309,9 @@ var FormModalBase = ({
|
|
|
10248
10309
|
onSearch: false,
|
|
10249
10310
|
onClear: false
|
|
10250
10311
|
}
|
|
10251
|
-
)) : /* @__PURE__ */
|
|
10252
|
-
), /* @__PURE__ */
|
|
10253
|
-
|
|
10312
|
+
)) : /* @__PURE__ */ React20.createElement(React20.Fragment, null)
|
|
10313
|
+
), /* @__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(
|
|
10314
|
+
Button5,
|
|
10254
10315
|
{
|
|
10255
10316
|
"data-testid": "create-update-modal-button",
|
|
10256
10317
|
type: "submit",
|
|
@@ -10265,7 +10326,7 @@ var FormModalBase = ({
|
|
|
10265
10326
|
};
|
|
10266
10327
|
|
|
10267
10328
|
// src/components/modals/form-modal/FormModal.tsx
|
|
10268
|
-
import { useI18nContext as
|
|
10329
|
+
import { useI18nContext as useI18nContext8 } from "@procore/core-react";
|
|
10269
10330
|
var FormModal = ({
|
|
10270
10331
|
open,
|
|
10271
10332
|
mode,
|
|
@@ -10279,8 +10340,8 @@ var FormModal = ({
|
|
|
10279
10340
|
defaultView,
|
|
10280
10341
|
backend
|
|
10281
10342
|
}) => {
|
|
10282
|
-
const i18n =
|
|
10283
|
-
return /* @__PURE__ */
|
|
10343
|
+
const i18n = useI18nContext8();
|
|
10344
|
+
return /* @__PURE__ */ React21.createElement(
|
|
10284
10345
|
FormModalBase,
|
|
10285
10346
|
{
|
|
10286
10347
|
open,
|
|
@@ -10304,18 +10365,18 @@ var FormModal = ({
|
|
|
10304
10365
|
// src/components/modals/form-modal/SharedViewFormModal.tsx
|
|
10305
10366
|
import {
|
|
10306
10367
|
Banner as Banner2,
|
|
10307
|
-
Button as
|
|
10368
|
+
Button as Button6,
|
|
10308
10369
|
colors as colors4,
|
|
10309
10370
|
ErrorBanner as ErrorBanner2,
|
|
10310
|
-
Flex as
|
|
10311
|
-
Form as
|
|
10371
|
+
Flex as Flex4,
|
|
10372
|
+
Form as Form3,
|
|
10312
10373
|
Modal as Modal3,
|
|
10313
10374
|
P as P3,
|
|
10314
|
-
spacing as
|
|
10375
|
+
spacing as spacing3,
|
|
10315
10376
|
Typography as Typography3,
|
|
10316
|
-
useI18nContext as
|
|
10377
|
+
useI18nContext as useI18nContext9
|
|
10317
10378
|
} from "@procore/core-react";
|
|
10318
|
-
import * as
|
|
10379
|
+
import * as React22 from "react";
|
|
10319
10380
|
import * as yup2 from "yup";
|
|
10320
10381
|
var SharedViewFormModal = ({
|
|
10321
10382
|
open,
|
|
@@ -10327,7 +10388,7 @@ var SharedViewFormModal = ({
|
|
|
10327
10388
|
isCreating,
|
|
10328
10389
|
resetCreateError
|
|
10329
10390
|
}) => {
|
|
10330
|
-
const I18n =
|
|
10391
|
+
const I18n = useI18nContext9();
|
|
10331
10392
|
const NAME_MAX_LENGTH = 150;
|
|
10332
10393
|
const errors = extractMessage(createError, I18n);
|
|
10333
10394
|
const handleNameChange = () => {
|
|
@@ -10338,35 +10399,36 @@ var SharedViewFormModal = ({
|
|
|
10338
10399
|
const handleOnSubmit = (data) => {
|
|
10339
10400
|
onCreateView(data.name, data.description);
|
|
10340
10401
|
};
|
|
10341
|
-
return /* @__PURE__ */
|
|
10402
|
+
return /* @__PURE__ */ React22.createElement(
|
|
10342
10403
|
Modal3,
|
|
10343
10404
|
{
|
|
10344
10405
|
"data-testid": "shared-view-form-modal",
|
|
10345
10406
|
open,
|
|
10346
|
-
|
|
10407
|
+
howToClose: ["x", "scrim"],
|
|
10408
|
+
onClose,
|
|
10347
10409
|
style: { width: "540px" }
|
|
10348
10410
|
},
|
|
10349
|
-
/* @__PURE__ */
|
|
10411
|
+
/* @__PURE__ */ React22.createElement(
|
|
10350
10412
|
Modal3.Header,
|
|
10351
10413
|
{
|
|
10352
10414
|
onClose,
|
|
10353
10415
|
style: {
|
|
10354
|
-
paddingTop:
|
|
10355
|
-
paddingBottom:
|
|
10356
|
-
paddingLeft:
|
|
10357
|
-
paddingRight:
|
|
10416
|
+
paddingTop: spacing3.lg,
|
|
10417
|
+
paddingBottom: spacing3.xs,
|
|
10418
|
+
paddingLeft: spacing3.xl,
|
|
10419
|
+
paddingRight: spacing3.xl
|
|
10358
10420
|
}
|
|
10359
10421
|
},
|
|
10360
|
-
I18n.t("savedViews.modal.create.title")
|
|
10422
|
+
/* @__PURE__ */ React22.createElement(Modal3.Heading, null, I18n.t("savedViews.modal.create.title"))
|
|
10361
10423
|
),
|
|
10362
|
-
/* @__PURE__ */
|
|
10424
|
+
/* @__PURE__ */ React22.createElement(
|
|
10363
10425
|
P3,
|
|
10364
10426
|
{
|
|
10365
10427
|
style: {
|
|
10366
|
-
paddingLeft:
|
|
10367
|
-
paddingRight:
|
|
10368
|
-
paddingBottom:
|
|
10369
|
-
paddingTop:
|
|
10428
|
+
paddingLeft: spacing3.xl,
|
|
10429
|
+
paddingRight: spacing3.xl,
|
|
10430
|
+
paddingBottom: spacing3.lg,
|
|
10431
|
+
paddingTop: spacing3.none,
|
|
10370
10432
|
margin: 0,
|
|
10371
10433
|
color: colors4.gray45,
|
|
10372
10434
|
whiteSpace: "pre-line"
|
|
@@ -10374,8 +10436,8 @@ var SharedViewFormModal = ({
|
|
|
10374
10436
|
},
|
|
10375
10437
|
I18n.t("savedViews.modal.copyConfirmation.description")
|
|
10376
10438
|
),
|
|
10377
|
-
/* @__PURE__ */
|
|
10378
|
-
|
|
10439
|
+
/* @__PURE__ */ React22.createElement(
|
|
10440
|
+
Form3,
|
|
10379
10441
|
{
|
|
10380
10442
|
initialValues: {
|
|
10381
10443
|
name: fetchedView.name,
|
|
@@ -10393,36 +10455,32 @@ var SharedViewFormModal = ({
|
|
|
10393
10455
|
onSubmit: handleOnSubmit,
|
|
10394
10456
|
validateOnChange: true
|
|
10395
10457
|
},
|
|
10396
|
-
/* @__PURE__ */
|
|
10458
|
+
/* @__PURE__ */ React22.createElement(Form3.Form, { name: "share-view-form" }, /* @__PURE__ */ React22.createElement(
|
|
10397
10459
|
Modal3.Body,
|
|
10398
10460
|
{
|
|
10399
10461
|
style: {
|
|
10400
|
-
paddingTop:
|
|
10462
|
+
paddingTop: spacing3.lg,
|
|
10401
10463
|
paddingBottom: 0,
|
|
10402
10464
|
borderTop: `1px solid ${colors4.gray85}`
|
|
10403
10465
|
}
|
|
10404
10466
|
},
|
|
10405
|
-
errors && /* @__PURE__ */
|
|
10467
|
+
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", {
|
|
10406
10468
|
mode: "create"
|
|
10407
|
-
})), /* @__PURE__ */
|
|
10408
|
-
/* @__PURE__ */
|
|
10409
|
-
|
|
10469
|
+
})), /* @__PURE__ */ React22.createElement(Banner2.Body, null, (errors == null ? void 0 : errors.form) || I18n.t("savedViews.modal.errors.description.create")))),
|
|
10470
|
+
/* @__PURE__ */ React22.createElement(Form3.Row, null, /* @__PURE__ */ React22.createElement(
|
|
10471
|
+
NameInputField,
|
|
10410
10472
|
{
|
|
10411
|
-
name: "name",
|
|
10412
10473
|
error: errors == null ? void 0 : errors.name,
|
|
10413
|
-
|
|
10414
|
-
label: I18n.t("savedViews.modal.fields.name"),
|
|
10415
|
-
colWidth: 12,
|
|
10416
|
-
onChange: handleNameChange
|
|
10474
|
+
onResetMutations: handleNameChange
|
|
10417
10475
|
}
|
|
10418
10476
|
)),
|
|
10419
|
-
/* @__PURE__ */
|
|
10420
|
-
|
|
10477
|
+
/* @__PURE__ */ React22.createElement(
|
|
10478
|
+
Form3.Row,
|
|
10421
10479
|
{
|
|
10422
|
-
style: { marginTop: (errors == null ? void 0 : errors.name) ?
|
|
10480
|
+
style: { marginTop: (errors == null ? void 0 : errors.name) ? spacing3.xl : spacing3.none }
|
|
10423
10481
|
},
|
|
10424
|
-
/* @__PURE__ */
|
|
10425
|
-
|
|
10482
|
+
/* @__PURE__ */ React22.createElement(
|
|
10483
|
+
Form3.TextArea,
|
|
10426
10484
|
{
|
|
10427
10485
|
name: "description",
|
|
10428
10486
|
placeholder: I18n.t("savedViews.modal.fields.description"),
|
|
@@ -10432,8 +10490,8 @@ var SharedViewFormModal = ({
|
|
|
10432
10490
|
}
|
|
10433
10491
|
)
|
|
10434
10492
|
)
|
|
10435
|
-
), /* @__PURE__ */
|
|
10436
|
-
|
|
10493
|
+
), /* @__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(
|
|
10494
|
+
Button6,
|
|
10437
10495
|
{
|
|
10438
10496
|
variant: "secondary",
|
|
10439
10497
|
onClick: onCreateTemporaryView,
|
|
@@ -10441,8 +10499,8 @@ var SharedViewFormModal = ({
|
|
|
10441
10499
|
disabled: isCreating
|
|
10442
10500
|
},
|
|
10443
10501
|
I18n.t("savedViews.actions.viewTemporarily")
|
|
10444
|
-
), /* @__PURE__ */
|
|
10445
|
-
|
|
10502
|
+
), /* @__PURE__ */ React22.createElement(
|
|
10503
|
+
Button6,
|
|
10446
10504
|
{
|
|
10447
10505
|
type: "submit",
|
|
10448
10506
|
variant: "primary",
|
|
@@ -10457,9 +10515,9 @@ var SharedViewFormModal = ({
|
|
|
10457
10515
|
};
|
|
10458
10516
|
|
|
10459
10517
|
// src/utils/hooks/useViewSelection.ts
|
|
10460
|
-
import { useState as useState3, useCallback as useCallback2, useEffect as
|
|
10518
|
+
import { useState as useState3, useCallback as useCallback2, useEffect as useEffect4, useRef as useRef3, useMemo } from "react";
|
|
10461
10519
|
import { useSearchParams } from "react-router-dom";
|
|
10462
|
-
import { useI18nContext as
|
|
10520
|
+
import { useI18nContext as useI18nContext10 } from "@procore/core-react";
|
|
10463
10521
|
|
|
10464
10522
|
// src/utils/viewStorage.ts
|
|
10465
10523
|
var ViewStorage = {
|
|
@@ -10522,7 +10580,7 @@ var restoreUrlParameter = (currentParam, previousParam, setSearchParams) => {
|
|
|
10522
10580
|
}
|
|
10523
10581
|
};
|
|
10524
10582
|
var useViewSelection = (config, savedViews, presetViews, openSharedViewModal) => {
|
|
10525
|
-
const I18n =
|
|
10583
|
+
const I18n = useI18nContext10();
|
|
10526
10584
|
const projectIdSegment = config.projectId ?? "company";
|
|
10527
10585
|
const storageKey = `savedView_${config.domain}_${config.tableName}_${config.companyId}_${projectIdSegment}_${config.userId}`;
|
|
10528
10586
|
const temporaryStorageKey = `${storageKey}-temporary`;
|
|
@@ -10598,7 +10656,7 @@ var useViewSelection = (config, savedViews, presetViews, openSharedViewModal) =>
|
|
|
10598
10656
|
},
|
|
10599
10657
|
[isViewAlreadySelected, openSharedViewModal, allViews, selectView]
|
|
10600
10658
|
);
|
|
10601
|
-
|
|
10659
|
+
useEffect4(() => {
|
|
10602
10660
|
const savedViewId = searchParams.get("saved-view");
|
|
10603
10661
|
restoreUrlParameter(
|
|
10604
10662
|
savedViewId,
|
|
@@ -10629,7 +10687,7 @@ import { useQuery } from "@tanstack/react-query";
|
|
|
10629
10687
|
// src/utils/api/queriesHandler.ts
|
|
10630
10688
|
import { requestJSON } from "@procore/core-http";
|
|
10631
10689
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
10632
|
-
import { useI18nContext as
|
|
10690
|
+
import { useI18nContext as useI18nContext11 } from "@procore/core-react";
|
|
10633
10691
|
var getBasePath = (companyId, projectId) => {
|
|
10634
10692
|
if (projectId) {
|
|
10635
10693
|
return `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views`;
|
|
@@ -10639,7 +10697,7 @@ var getBasePath = (companyId, projectId) => {
|
|
|
10639
10697
|
var useApiRequest = (props, method, mutationKey) => {
|
|
10640
10698
|
const { projectId, companyId, domain, tableName } = props;
|
|
10641
10699
|
const queryClient2 = useQueryClient();
|
|
10642
|
-
const { locale } =
|
|
10700
|
+
const { locale } = useI18nContext11();
|
|
10643
10701
|
const basePath = getBasePath(companyId, projectId);
|
|
10644
10702
|
const queryKey = ["savedViews", domain, tableName, companyId, projectId];
|
|
10645
10703
|
return useMutation({
|
|
@@ -10786,7 +10844,7 @@ var SavedViewsContent = (props) => {
|
|
|
10786
10844
|
const { data: savedViews } = backend.useSavedViewsQuery(queryInput);
|
|
10787
10845
|
const { mutate: deleteSavedView } = backend.useDeleteSavedView(queryInput);
|
|
10788
10846
|
const { showToast } = useToastAlertContext3();
|
|
10789
|
-
const i18n =
|
|
10847
|
+
const i18n = useI18nContext12();
|
|
10790
10848
|
const [activeModal, setActiveModal] = useState4(null);
|
|
10791
10849
|
const [modalData, setModalData] = useState4(null);
|
|
10792
10850
|
const openModal = (type, data) => {
|
|
@@ -10832,7 +10890,7 @@ var SavedViewsContent = (props) => {
|
|
|
10832
10890
|
error: createError,
|
|
10833
10891
|
reset: resetCreateError
|
|
10834
10892
|
} = backend.useCreateSavedView(queryInput);
|
|
10835
|
-
|
|
10893
|
+
useEffect5(() => {
|
|
10836
10894
|
if (fetchError) {
|
|
10837
10895
|
showToast.error(i18n.t("savedViews.errors.notFound"));
|
|
10838
10896
|
selectView(selectedView ?? props.defaultView);
|
|
@@ -10880,31 +10938,45 @@ var SavedViewsContent = (props) => {
|
|
|
10880
10938
|
deleteSelectedView();
|
|
10881
10939
|
closeModal();
|
|
10882
10940
|
};
|
|
10883
|
-
return /* @__PURE__ */
|
|
10941
|
+
return /* @__PURE__ */ React23.createElement(StyledPanel, { provider: props.provider }, /* @__PURE__ */ React23.createElement(
|
|
10884
10942
|
ExpandedPanel,
|
|
10885
10943
|
{
|
|
10886
10944
|
"data-testid": "saved-view-expanded-panel",
|
|
10887
10945
|
provider: props.provider
|
|
10888
10946
|
},
|
|
10889
|
-
/* @__PURE__ */
|
|
10947
|
+
/* @__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(
|
|
10948
|
+
Tooltip,
|
|
10949
|
+
{
|
|
10950
|
+
showDelay: 200,
|
|
10951
|
+
overlay: /* @__PURE__ */ React23.createElement(Tooltip.Content, null, i18n.t("savedViews.tooltip"))
|
|
10952
|
+
},
|
|
10953
|
+
/* @__PURE__ */ React23.createElement(
|
|
10954
|
+
Help_default,
|
|
10955
|
+
{
|
|
10956
|
+
tabIndex: 0,
|
|
10957
|
+
size: "sm",
|
|
10958
|
+
"aria-label": i18n.t("savedViews.tooltip")
|
|
10959
|
+
}
|
|
10960
|
+
)
|
|
10961
|
+
))), /* @__PURE__ */ React23.createElement(
|
|
10890
10962
|
Tooltip,
|
|
10891
10963
|
{
|
|
10892
10964
|
overlay: i18n.t("savedViews.actions.create"),
|
|
10893
10965
|
showDelay: 1e3
|
|
10894
10966
|
},
|
|
10895
|
-
/* @__PURE__ */
|
|
10896
|
-
|
|
10967
|
+
/* @__PURE__ */ React23.createElement(
|
|
10968
|
+
Button7,
|
|
10897
10969
|
{
|
|
10898
|
-
icon: /* @__PURE__ */
|
|
10970
|
+
icon: /* @__PURE__ */ React23.createElement(Plus_default, null),
|
|
10899
10971
|
variant: "secondary",
|
|
10900
10972
|
"data-testid": "expanded-panel-create-button",
|
|
10901
10973
|
onClick: () => openModal("create" /* CREATE */),
|
|
10902
10974
|
"aria-label": i18n.t("savedViews.actions.create")
|
|
10903
10975
|
},
|
|
10904
10976
|
i18n.t("savedViews.actions.create")
|
|
10905
|
-
)
|
|
10977
|
+
)
|
|
10906
10978
|
)),
|
|
10907
|
-
/* @__PURE__ */
|
|
10979
|
+
/* @__PURE__ */ React23.createElement(Panel3.Body, { style: { display: "flex", flexFlow: "column" } }, /* @__PURE__ */ React23.createElement(
|
|
10908
10980
|
PanelContent,
|
|
10909
10981
|
{
|
|
10910
10982
|
onSelect: ({ item }) => selectView(item),
|
|
@@ -10917,12 +10989,12 @@ var SavedViewsContent = (props) => {
|
|
|
10917
10989
|
presetViews: props.presetViews,
|
|
10918
10990
|
savedViews: allViews,
|
|
10919
10991
|
provider: props.provider,
|
|
10920
|
-
userId: props.userId
|
|
10992
|
+
userId: props.userId,
|
|
10921
10993
|
onClearTemporary: clearTemporaryView,
|
|
10922
10994
|
backend
|
|
10923
10995
|
}
|
|
10924
10996
|
))
|
|
10925
|
-
), (isModalOpen("create" /* CREATE */) || isModalOpen("update" /* UPDATE */)) && /* @__PURE__ */
|
|
10997
|
+
), (isModalOpen("create" /* CREATE */) || isModalOpen("update" /* UPDATE */)) && /* @__PURE__ */ React23.createElement(
|
|
10926
10998
|
FormModal,
|
|
10927
10999
|
{
|
|
10928
11000
|
open: true,
|
|
@@ -10937,14 +11009,14 @@ var SavedViewsContent = (props) => {
|
|
|
10937
11009
|
defaultView: props.defaultView,
|
|
10938
11010
|
backend
|
|
10939
11011
|
}
|
|
10940
|
-
), selectedView && isModalOpen("delete" /* DELETE */) && /* @__PURE__ */
|
|
11012
|
+
), selectedView && isModalOpen("delete" /* DELETE */) && /* @__PURE__ */ React23.createElement(
|
|
10941
11013
|
SavedViewsDeleteConfirmationModalShared,
|
|
10942
11014
|
{
|
|
10943
11015
|
open: true,
|
|
10944
11016
|
onDelete: confirmDeleteAndCloseModal,
|
|
10945
11017
|
onCancel: closeModal
|
|
10946
11018
|
}
|
|
10947
|
-
), fetchedView && isModalOpen("sharedView" /* SHARED_VIEW */) && /* @__PURE__ */
|
|
11019
|
+
), fetchedView && isModalOpen("sharedView" /* SHARED_VIEW */) && /* @__PURE__ */ React23.createElement(
|
|
10948
11020
|
SharedViewFormModal,
|
|
10949
11021
|
{
|
|
10950
11022
|
open: true,
|
|
@@ -10959,11 +11031,11 @@ var SavedViewsContent = (props) => {
|
|
|
10959
11031
|
));
|
|
10960
11032
|
};
|
|
10961
11033
|
var SavedViews = (props) => {
|
|
10962
|
-
return /* @__PURE__ */
|
|
11034
|
+
return /* @__PURE__ */ React23.createElement(EnvironmentI18nProvider, null, /* @__PURE__ */ React23.createElement(QueryClientProvider, { client: queryClient }, /* @__PURE__ */ React23.createElement(ToastAlertProvider, null, /* @__PURE__ */ React23.createElement(SavedViewsContent, { ...props }))));
|
|
10963
11035
|
};
|
|
10964
11036
|
|
|
10965
11037
|
// src/components/adapters/smart-grid/SmartGridSavedViews.tsx
|
|
10966
|
-
import
|
|
11038
|
+
import React24, { useCallback as useCallback4 } from "react";
|
|
10967
11039
|
|
|
10968
11040
|
// src/components/adapters/smart-grid/SmartGridDefaultSavedView.tsx
|
|
10969
11041
|
import { useMemo as useMemo2 } from "react";
|
|
@@ -11038,7 +11110,7 @@ var useNormalizedDefaultViews = (defaultViews, gridApi) => {
|
|
|
11038
11110
|
};
|
|
11039
11111
|
|
|
11040
11112
|
// src/components/adapters/smart-grid/useSmartGridConfig.ts
|
|
11041
|
-
import { useState as useState5, useEffect as
|
|
11113
|
+
import { useState as useState5, useEffect as useEffect6, useRef as useRef4 } from "react";
|
|
11042
11114
|
var GRID_STATE_EVENTS = [
|
|
11043
11115
|
"sortChanged",
|
|
11044
11116
|
"filterOpened",
|
|
@@ -11058,7 +11130,7 @@ var useSmartGridConfig = (gridApi) => {
|
|
|
11058
11130
|
() => getSmartGridConfig(gridApi)
|
|
11059
11131
|
);
|
|
11060
11132
|
const eventListenersDisabledRef = useRef4(false);
|
|
11061
|
-
|
|
11133
|
+
useEffect6(() => {
|
|
11062
11134
|
if (!gridApi)
|
|
11063
11135
|
return;
|
|
11064
11136
|
const updateConfig = () => {
|
|
@@ -11129,7 +11201,7 @@ var SmartGridSavedViews = (props) => {
|
|
|
11129
11201
|
},
|
|
11130
11202
|
[gridApi, tableConfig, setTableConfig]
|
|
11131
11203
|
);
|
|
11132
|
-
return /* @__PURE__ */
|
|
11204
|
+
return /* @__PURE__ */ React24.createElement(
|
|
11133
11205
|
SavedViews,
|
|
11134
11206
|
{
|
|
11135
11207
|
onSelect,
|
|
@@ -11148,7 +11220,7 @@ var SmartGridSavedViews = (props) => {
|
|
|
11148
11220
|
};
|
|
11149
11221
|
|
|
11150
11222
|
// src/components/adapters/data-table/DataTableSavedViews.tsx
|
|
11151
|
-
import
|
|
11223
|
+
import React25, {
|
|
11152
11224
|
forwardRef as forwardRef11,
|
|
11153
11225
|
useImperativeHandle,
|
|
11154
11226
|
useState as useState6,
|
|
@@ -11249,7 +11321,7 @@ var DataTableSavedViews = forwardRef11((props, ref) => {
|
|
|
11249
11321
|
if (!internalTableConfig) {
|
|
11250
11322
|
return null;
|
|
11251
11323
|
}
|
|
11252
|
-
return /* @__PURE__ */
|
|
11324
|
+
return /* @__PURE__ */ React25.createElement(
|
|
11253
11325
|
SavedViews,
|
|
11254
11326
|
{
|
|
11255
11327
|
onSelect,
|