@procore/saved-views 1.1.0-alpha.3 → 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 +295 -195
- package/dist/legacy/index.mjs +322 -223
- package/dist/modern/index.js +294 -195
- package/dist/modern/index.mjs +321 -223
- package/package.json +3 -2
package/dist/modern/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
|
|
|
@@ -9424,6 +9424,17 @@ var SavedViewCollectionMenuItem = (props) => {
|
|
|
9424
9424
|
label: i18n.t("savedViews.actions.delete")
|
|
9425
9425
|
}
|
|
9426
9426
|
];
|
|
9427
|
+
const preventEventBubbleToNotTriggerViewSelectEvent = React15.useCallback(
|
|
9428
|
+
(e2) => {
|
|
9429
|
+
e2.stopPropagation();
|
|
9430
|
+
},
|
|
9431
|
+
[]
|
|
9432
|
+
);
|
|
9433
|
+
const hasUpdateButton = props.item.view_level !== "default" && props.canUpdate;
|
|
9434
|
+
const hasCopyShareLinkButton = props.item.view_level !== "default" && props.selected && !props.canUpdate && props.item.id !== "temporary";
|
|
9435
|
+
const hasClearTemporaryButton = props.item.id === "temporary";
|
|
9436
|
+
const hasOverflowMenu = props.item.view_level !== "default" && props.canEditOrDelete;
|
|
9437
|
+
const hasActions = hasUpdateButton || hasCopyShareLinkButton || hasClearTemporaryButton || hasOverflowMenu;
|
|
9427
9438
|
return /* @__PURE__ */ React15.createElement(
|
|
9428
9439
|
Container2,
|
|
9429
9440
|
{
|
|
@@ -9433,7 +9444,8 @@ var SavedViewCollectionMenuItem = (props) => {
|
|
|
9433
9444
|
"aria-label": i18n.t("savedViews.ariaLabels.menuItem", {
|
|
9434
9445
|
name: props.item.name
|
|
9435
9446
|
}),
|
|
9436
|
-
"data-testid": "saved-view-collection-menu-item"
|
|
9447
|
+
"data-testid": "saved-view-collection-menu-item",
|
|
9448
|
+
onKeyDown: preventEventBubbleToNotTriggerViewSelectEvent
|
|
9437
9449
|
},
|
|
9438
9450
|
/* @__PURE__ */ React15.createElement(
|
|
9439
9451
|
"span",
|
|
@@ -9443,7 +9455,7 @@ var SavedViewCollectionMenuItem = (props) => {
|
|
|
9443
9455
|
},
|
|
9444
9456
|
props.item.name
|
|
9445
9457
|
),
|
|
9446
|
-
/* @__PURE__ */ React15.createElement(RowActionsBox, null, /* @__PURE__ */ React15.createElement(Box, { justifyContent: "space-between" },
|
|
9458
|
+
hasActions && /* @__PURE__ */ React15.createElement(RowActionsBox, null, /* @__PURE__ */ React15.createElement(Box, { justifyContent: "space-between" }, hasUpdateButton && /* @__PURE__ */ React15.createElement(
|
|
9447
9459
|
Button2,
|
|
9448
9460
|
{
|
|
9449
9461
|
onClick: updateItem,
|
|
@@ -9454,7 +9466,7 @@ var SavedViewCollectionMenuItem = (props) => {
|
|
|
9454
9466
|
loading: props.isUpdateProcessing
|
|
9455
9467
|
},
|
|
9456
9468
|
i18n.t("savedViews.actions.update")
|
|
9457
|
-
)
|
|
9469
|
+
), hasCopyShareLinkButton && /* @__PURE__ */ React15.createElement(
|
|
9458
9470
|
Button2,
|
|
9459
9471
|
{
|
|
9460
9472
|
onClick: copyShareLink,
|
|
@@ -9464,7 +9476,7 @@ var SavedViewCollectionMenuItem = (props) => {
|
|
|
9464
9476
|
"data-testid": "copy-share-link-button"
|
|
9465
9477
|
},
|
|
9466
9478
|
/* @__PURE__ */ React15.createElement(IconWrapper, null, /* @__PURE__ */ React15.createElement(Link_default, { size: "sm" }))
|
|
9467
|
-
)
|
|
9479
|
+
), hasClearTemporaryButton && /* @__PURE__ */ React15.createElement(
|
|
9468
9480
|
Button2,
|
|
9469
9481
|
{
|
|
9470
9482
|
onClick: (e2) => {
|
|
@@ -9478,7 +9490,7 @@ var SavedViewCollectionMenuItem = (props) => {
|
|
|
9478
9490
|
"data-testid": "clear-temporary-view-button"
|
|
9479
9491
|
},
|
|
9480
9492
|
/* @__PURE__ */ React15.createElement(IconWrapper, null, /* @__PURE__ */ React15.createElement(Clear_default, { size: "sm" }))
|
|
9481
|
-
))
|
|
9493
|
+
)), /* @__PURE__ */ React15.createElement(Box, null, hasOverflowMenu && /* @__PURE__ */ React15.createElement(
|
|
9482
9494
|
DropdownFlyout,
|
|
9483
9495
|
{
|
|
9484
9496
|
"data-testid": "saved-view-overflow-button",
|
|
@@ -9489,7 +9501,7 @@ var SavedViewCollectionMenuItem = (props) => {
|
|
|
9489
9501
|
variant: "tertiary",
|
|
9490
9502
|
disabled: props.isUpdateProcessing
|
|
9491
9503
|
}
|
|
9492
|
-
)))
|
|
9504
|
+
)))
|
|
9493
9505
|
);
|
|
9494
9506
|
};
|
|
9495
9507
|
|
|
@@ -9502,7 +9514,7 @@ var ExpandedPanel = styled_components_esm_default(Panel)`
|
|
|
9502
9514
|
`;
|
|
9503
9515
|
|
|
9504
9516
|
// src/components/panels/PanelContent.tsx
|
|
9505
|
-
import { Flex as
|
|
9517
|
+
import { Flex as Flex2, MenuImperative as MenuImperative2, useI18nContext as useI18nContext5 } from "@procore/core-react";
|
|
9506
9518
|
import { useToastAlertContext as useToastAlertContext2 } from "@procore/toast-alert";
|
|
9507
9519
|
import React17 from "react";
|
|
9508
9520
|
|
|
@@ -9769,18 +9781,40 @@ var getOrderedVisibleColumns = (columns, idKey) => {
|
|
|
9769
9781
|
});
|
|
9770
9782
|
return [leftAction, ...middleColumns, rightAction].filter(Boolean);
|
|
9771
9783
|
};
|
|
9784
|
+
var SMART_GRID_COLUMN_COMPARE_KEYS = [
|
|
9785
|
+
"colId",
|
|
9786
|
+
"hide",
|
|
9787
|
+
"width",
|
|
9788
|
+
"sort",
|
|
9789
|
+
"sortIndex",
|
|
9790
|
+
"pinned",
|
|
9791
|
+
"rowGroup",
|
|
9792
|
+
"rowGroupIndex",
|
|
9793
|
+
"pivot",
|
|
9794
|
+
"pivotIndex"
|
|
9795
|
+
];
|
|
9796
|
+
var DATA_TABLE_COLUMN_COMPARE_KEYS = [
|
|
9797
|
+
"field",
|
|
9798
|
+
"hidden",
|
|
9799
|
+
"width",
|
|
9800
|
+
"sort",
|
|
9801
|
+
"sortIndex",
|
|
9802
|
+
"pinned",
|
|
9803
|
+
"rowGroup",
|
|
9804
|
+
"rowGroupIndex"
|
|
9805
|
+
];
|
|
9772
9806
|
var cleanObject = (table_config, provider) => {
|
|
9773
9807
|
if (provider === "smart-grid") {
|
|
9774
9808
|
const smartGridConfig = table_config;
|
|
9775
|
-
if (!smartGridConfig.filterState)
|
|
9776
|
-
return table_config;
|
|
9777
9809
|
const orderedColumns = getOrderedVisibleColumns(
|
|
9778
9810
|
smartGridConfig.columnState,
|
|
9779
9811
|
"colId"
|
|
9780
9812
|
);
|
|
9781
9813
|
return {
|
|
9782
9814
|
...smartGridConfig,
|
|
9783
|
-
columnState: orderedColumns
|
|
9815
|
+
columnState: orderedColumns.map(
|
|
9816
|
+
(col) => import_lodash.default.pick(col, SMART_GRID_COLUMN_COMPARE_KEYS)
|
|
9817
|
+
)
|
|
9784
9818
|
};
|
|
9785
9819
|
} else {
|
|
9786
9820
|
const dataTableConfig = table_config;
|
|
@@ -9792,7 +9826,9 @@ var cleanObject = (table_config, provider) => {
|
|
|
9792
9826
|
);
|
|
9793
9827
|
return {
|
|
9794
9828
|
...dataTableConfig,
|
|
9795
|
-
columnState: orderedColumns
|
|
9829
|
+
columnState: orderedColumns.map(
|
|
9830
|
+
(col) => import_lodash.default.pick(col, DATA_TABLE_COLUMN_COMPARE_KEYS)
|
|
9831
|
+
),
|
|
9796
9832
|
serverFilters: dataTableConfig.serverFilters.map(
|
|
9797
9833
|
(filter) => import_lodash.default.omit(filter, "filterRenderer")
|
|
9798
9834
|
)
|
|
@@ -9854,9 +9890,9 @@ var useGroups = (isProjectLevelTool) => {
|
|
|
9854
9890
|
|
|
9855
9891
|
// src/components/panels/ViewLevelHeader.tsx
|
|
9856
9892
|
import {
|
|
9893
|
+
Box as Box2,
|
|
9894
|
+
Button as Button3,
|
|
9857
9895
|
colors,
|
|
9858
|
-
Flex as Flex2,
|
|
9859
|
-
spacing,
|
|
9860
9896
|
Typography,
|
|
9861
9897
|
useI18nContext as useI18nContext4
|
|
9862
9898
|
} from "@procore/core-react";
|
|
@@ -9871,27 +9907,31 @@ var groupIcon = (group) => {
|
|
|
9871
9907
|
return /* @__PURE__ */ React16.createElement(Building_default, null);
|
|
9872
9908
|
}
|
|
9873
9909
|
};
|
|
9874
|
-
var
|
|
9875
|
-
width: 100%;
|
|
9910
|
+
var StyledButton2 = styled_components_esm_default(Button3)`
|
|
9876
9911
|
&:hover {
|
|
9877
9912
|
background-color: ${colors.gray98};
|
|
9878
9913
|
}
|
|
9879
9914
|
`;
|
|
9880
9915
|
var ViewLevelHeader = ({ expanded, toggleGroup, group }) => {
|
|
9881
9916
|
const I18n = useI18nContext4();
|
|
9882
|
-
return /* @__PURE__ */ React16.createElement(
|
|
9883
|
-
|
|
9917
|
+
return /* @__PURE__ */ React16.createElement(Box2, { style: { width: "100%" } }, /* @__PURE__ */ React16.createElement(
|
|
9918
|
+
StyledButton2,
|
|
9884
9919
|
{
|
|
9885
|
-
|
|
9886
|
-
|
|
9887
|
-
|
|
9888
|
-
|
|
9889
|
-
|
|
9920
|
+
block: true,
|
|
9921
|
+
style: {
|
|
9922
|
+
justifyContent: "start",
|
|
9923
|
+
height: "40px"
|
|
9924
|
+
},
|
|
9925
|
+
variant: "tertiary",
|
|
9926
|
+
size: "sm",
|
|
9927
|
+
onClick: () => toggleGroup(group),
|
|
9928
|
+
"aria-controls": `saved-views-collections-${group}`,
|
|
9929
|
+
"aria-expanded": expanded,
|
|
9930
|
+
icon: expanded ? /* @__PURE__ */ React16.createElement(ChevronDown_default, { size: "sm" }) : /* @__PURE__ */ React16.createElement(ChevronRight_default, { size: "sm" })
|
|
9890
9931
|
},
|
|
9891
|
-
expanded ? /* @__PURE__ */ React16.createElement(ChevronDown_default, { size: "sm" }) : /* @__PURE__ */ React16.createElement(ChevronRight_default, { size: "sm" }),
|
|
9892
9932
|
groupIcon(group),
|
|
9893
9933
|
/* @__PURE__ */ React16.createElement(Typography, { weight: "semibold" }, I18n.t(`savedViews.viewLevel.${group}`))
|
|
9894
|
-
);
|
|
9934
|
+
));
|
|
9895
9935
|
};
|
|
9896
9936
|
var ViewLevelHeader_default = ViewLevelHeader;
|
|
9897
9937
|
|
|
@@ -9911,8 +9951,8 @@ var useScrollToRef = (dependency) => {
|
|
|
9911
9951
|
import {
|
|
9912
9952
|
colors as colors2,
|
|
9913
9953
|
DetailPage,
|
|
9914
|
-
|
|
9915
|
-
spacing
|
|
9954
|
+
MenuImperative,
|
|
9955
|
+
spacing
|
|
9916
9956
|
} from "@procore/core-react";
|
|
9917
9957
|
var Row = styled_components_esm_default(MenuImperative.Item)`
|
|
9918
9958
|
width: 100%;
|
|
@@ -9927,11 +9967,16 @@ var Row = styled_components_esm_default(MenuImperative.Item)`
|
|
|
9927
9967
|
var Panel2 = styled_components_esm_default(DetailPage.Card)`
|
|
9928
9968
|
margin: 0;
|
|
9929
9969
|
height: 100%;
|
|
9930
|
-
padding-top: ${
|
|
9970
|
+
padding-top: ${spacing.sm}px;
|
|
9931
9971
|
box-shadow: none;
|
|
9932
9972
|
`;
|
|
9933
9973
|
|
|
9934
9974
|
// src/components/panels/PanelContent.tsx
|
|
9975
|
+
var StyledMenuImperative = styled_components_esm_default(MenuImperative2)`
|
|
9976
|
+
div[role='listbox'] {
|
|
9977
|
+
padding: 0;
|
|
9978
|
+
}
|
|
9979
|
+
`;
|
|
9935
9980
|
var PanelContent = (props) => {
|
|
9936
9981
|
const { queryInput, selectedSavedView, tableConfig } = props;
|
|
9937
9982
|
const { showToast } = useToastAlertContext2();
|
|
@@ -9972,40 +10017,52 @@ var PanelContent = (props) => {
|
|
|
9972
10017
|
}
|
|
9973
10018
|
});
|
|
9974
10019
|
};
|
|
9975
|
-
return /* @__PURE__ */ React17.createElement(Panel2, { "data-testid": "inner-panel" }, /* @__PURE__ */ React17.createElement(
|
|
9976
|
-
|
|
10020
|
+
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(
|
|
10021
|
+
StyledMenuImperative,
|
|
9977
10022
|
{
|
|
9978
|
-
|
|
9979
|
-
|
|
9980
|
-
|
|
10023
|
+
role: "listbox",
|
|
10024
|
+
onSelect: (selection) => {
|
|
10025
|
+
if (selectedSavedView?.id !== selection.item.id) {
|
|
10026
|
+
props.onSelect({ item: selection.item });
|
|
10027
|
+
}
|
|
10028
|
+
}
|
|
9981
10029
|
},
|
|
9982
|
-
/* @__PURE__ */ React17.createElement(
|
|
9983
|
-
|
|
10030
|
+
/* @__PURE__ */ React17.createElement(MenuImperative2.Options, null, temporaryView && /* @__PURE__ */ React17.createElement(
|
|
10031
|
+
Row,
|
|
9984
10032
|
{
|
|
10033
|
+
key: temporaryView.id,
|
|
9985
10034
|
item: temporaryView,
|
|
9986
10035
|
selected: isTemporarySelected,
|
|
9987
|
-
|
|
9988
|
-
}
|
|
9989
|
-
)
|
|
9990
|
-
), presetViews.map((presetView) => {
|
|
9991
|
-
const isSelected = selectedSavedView?.id === presetView.id;
|
|
9992
|
-
return /* @__PURE__ */ React17.createElement(
|
|
9993
|
-
Row,
|
|
9994
|
-
{
|
|
9995
|
-
key: presetView.id,
|
|
9996
|
-
selected: isSelected,
|
|
9997
|
-
onClick: () => props.onSelect({ item: presetView }),
|
|
9998
|
-
ref: isSelected ? selectedRowRef : null
|
|
10036
|
+
ref: isTemporarySelected ? selectedRowRef : null
|
|
9999
10037
|
},
|
|
10000
10038
|
/* @__PURE__ */ React17.createElement(
|
|
10001
10039
|
SavedViewCollectionMenuItem,
|
|
10002
10040
|
{
|
|
10003
|
-
item:
|
|
10004
|
-
selected:
|
|
10041
|
+
item: temporaryView,
|
|
10042
|
+
selected: isTemporarySelected,
|
|
10043
|
+
onClearTemporary: props.onClearTemporary
|
|
10005
10044
|
}
|
|
10006
10045
|
)
|
|
10007
|
-
)
|
|
10008
|
-
|
|
10046
|
+
), presetViews.map((presetView) => {
|
|
10047
|
+
const isSelected = selectedSavedView?.id === presetView.id;
|
|
10048
|
+
return /* @__PURE__ */ React17.createElement(
|
|
10049
|
+
Row,
|
|
10050
|
+
{
|
|
10051
|
+
key: presetView.id,
|
|
10052
|
+
item: presetView,
|
|
10053
|
+
selected: isSelected,
|
|
10054
|
+
ref: isSelected ? selectedRowRef : null
|
|
10055
|
+
},
|
|
10056
|
+
/* @__PURE__ */ React17.createElement(
|
|
10057
|
+
SavedViewCollectionMenuItem,
|
|
10058
|
+
{
|
|
10059
|
+
item: presetView,
|
|
10060
|
+
selected: isSelected
|
|
10061
|
+
}
|
|
10062
|
+
)
|
|
10063
|
+
);
|
|
10064
|
+
}))
|
|
10065
|
+
), viewLevels.map((level) => {
|
|
10009
10066
|
const isExpanded = groups[level];
|
|
10010
10067
|
const views = isExpanded && savedViews ? savedViews.filter(
|
|
10011
10068
|
(view) => view.view_level === level && view.id !== "temporary"
|
|
@@ -10017,62 +10074,74 @@ var PanelContent = (props) => {
|
|
|
10017
10074
|
toggleGroup,
|
|
10018
10075
|
expanded: isExpanded
|
|
10019
10076
|
}
|
|
10020
|
-
), views.
|
|
10021
|
-
|
|
10022
|
-
|
|
10023
|
-
|
|
10024
|
-
|
|
10025
|
-
|
|
10026
|
-
|
|
10027
|
-
|
|
10028
|
-
|
|
10029
|
-
|
|
10030
|
-
|
|
10031
|
-
|
|
10032
|
-
|
|
10033
|
-
|
|
10034
|
-
|
|
10035
|
-
|
|
10036
|
-
|
|
10037
|
-
|
|
10038
|
-
|
|
10039
|
-
|
|
10040
|
-
|
|
10041
|
-
|
|
10077
|
+
), isExpanded && views.length > 0 && /* @__PURE__ */ React17.createElement(
|
|
10078
|
+
StyledMenuImperative,
|
|
10079
|
+
{
|
|
10080
|
+
id: `saved-views-collections-${level}`,
|
|
10081
|
+
role: "listbox",
|
|
10082
|
+
onSelect: (selection) => {
|
|
10083
|
+
if (selectedSavedView?.id !== selection.item.id) {
|
|
10084
|
+
props.onSelect({ item: selection.item });
|
|
10085
|
+
}
|
|
10086
|
+
}
|
|
10087
|
+
},
|
|
10088
|
+
/* @__PURE__ */ React17.createElement(MenuImperative2.Options, null, views.map((view) => {
|
|
10089
|
+
const isSelected = selectedSavedView?.id === view.id;
|
|
10090
|
+
const canUpdate = isSelected && hasPermissionForViewLevel(
|
|
10091
|
+
view.view_level,
|
|
10092
|
+
permissions
|
|
10093
|
+
) && !isEqual(
|
|
10094
|
+
view.table_config,
|
|
10095
|
+
tableConfig,
|
|
10096
|
+
props.defaultView.table_config,
|
|
10097
|
+
props.provider
|
|
10098
|
+
);
|
|
10099
|
+
const canEditOrDelete = isSelected && hasPermissionForViewLevel(view.view_level, permissions);
|
|
10100
|
+
return /* @__PURE__ */ React17.createElement(
|
|
10101
|
+
Row,
|
|
10042
10102
|
{
|
|
10043
|
-
item: view,
|
|
10044
10103
|
key: view.id,
|
|
10104
|
+
item: view,
|
|
10045
10105
|
selected: isSelected,
|
|
10046
|
-
|
|
10047
|
-
|
|
10048
|
-
|
|
10049
|
-
|
|
10050
|
-
|
|
10051
|
-
|
|
10052
|
-
|
|
10053
|
-
|
|
10054
|
-
|
|
10055
|
-
|
|
10056
|
-
|
|
10106
|
+
ref: isSelected ? selectedRowRef : null
|
|
10107
|
+
},
|
|
10108
|
+
/* @__PURE__ */ React17.createElement(
|
|
10109
|
+
SavedViewCollectionMenuItem,
|
|
10110
|
+
{
|
|
10111
|
+
item: view,
|
|
10112
|
+
key: view.id,
|
|
10113
|
+
selected: isSelected,
|
|
10114
|
+
canUpdate,
|
|
10115
|
+
canEditOrDelete,
|
|
10116
|
+
onUpdate: (data) => onUpdate(data),
|
|
10117
|
+
isUpdateProcessing: isUpdateLoading,
|
|
10118
|
+
onEdit: () => props.openModal("update" /* UPDATE */),
|
|
10119
|
+
onDelete: props.onDelete,
|
|
10120
|
+
permissions
|
|
10121
|
+
}
|
|
10122
|
+
)
|
|
10123
|
+
);
|
|
10124
|
+
}))
|
|
10125
|
+
));
|
|
10057
10126
|
})));
|
|
10058
10127
|
};
|
|
10059
10128
|
|
|
10060
10129
|
// src/components/saved-views/SavedViews.tsx
|
|
10061
10130
|
import {
|
|
10062
|
-
Box as
|
|
10063
|
-
Button as
|
|
10064
|
-
Flex as
|
|
10131
|
+
Box as Box3,
|
|
10132
|
+
Button as Button7,
|
|
10133
|
+
Flex as Flex5,
|
|
10065
10134
|
Panel as Panel3,
|
|
10066
10135
|
Tooltip,
|
|
10067
|
-
useI18nContext as
|
|
10136
|
+
useI18nContext as useI18nContext12
|
|
10068
10137
|
} from "@procore/core-react";
|
|
10069
|
-
import
|
|
10138
|
+
import React23, { useState as useState4, useEffect as useEffect4, useCallback as useCallback3 } from "react";
|
|
10070
10139
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
10071
10140
|
import { useToastAlertContext as useToastAlertContext3, ToastAlertProvider } from "@procore/toast-alert";
|
|
10072
10141
|
|
|
10073
10142
|
// src/components/modals/DeleteConfirmationModal.tsx
|
|
10074
10143
|
import {
|
|
10075
|
-
Button as
|
|
10144
|
+
Button as Button4,
|
|
10076
10145
|
ConfirmModal,
|
|
10077
10146
|
Modal,
|
|
10078
10147
|
P as P2,
|
|
@@ -10096,28 +10165,27 @@ var SavedViewsDeleteConfirmationModalShared = ({
|
|
|
10096
10165
|
style: { overflowWrap: "anywhere" }
|
|
10097
10166
|
},
|
|
10098
10167
|
/* @__PURE__ */ React18.createElement(Modal.Body, null, /* @__PURE__ */ React18.createElement(P2, null, i18n.t("savedViews.modal.delete.description"))),
|
|
10099
|
-
/* @__PURE__ */ React18.createElement(Modal.Footer, null, /* @__PURE__ */ React18.createElement(Modal.FooterButtons, null, /* @__PURE__ */ React18.createElement(
|
|
10168
|
+
/* @__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"))))
|
|
10100
10169
|
);
|
|
10101
10170
|
};
|
|
10102
10171
|
|
|
10103
10172
|
// src/components/modals/form-modal/FormModal.tsx
|
|
10104
|
-
import
|
|
10173
|
+
import React21 from "react";
|
|
10105
10174
|
|
|
10106
10175
|
// src/components/modals/form-modal/FormModalBase.tsx
|
|
10107
10176
|
import {
|
|
10108
10177
|
Banner,
|
|
10109
|
-
Button as
|
|
10178
|
+
Button as Button5,
|
|
10110
10179
|
colors as colors3,
|
|
10111
10180
|
ErrorBanner,
|
|
10112
|
-
Flex as
|
|
10113
|
-
Form,
|
|
10114
|
-
H2,
|
|
10181
|
+
Flex as Flex3,
|
|
10182
|
+
Form as Form2,
|
|
10115
10183
|
Modal as Modal2,
|
|
10116
|
-
spacing as
|
|
10184
|
+
spacing as spacing2,
|
|
10117
10185
|
Typography as Typography2,
|
|
10118
|
-
useI18nContext as
|
|
10186
|
+
useI18nContext as useI18nContext8
|
|
10119
10187
|
} from "@procore/core-react";
|
|
10120
|
-
import * as
|
|
10188
|
+
import * as React20 from "react";
|
|
10121
10189
|
import * as yup from "yup";
|
|
10122
10190
|
|
|
10123
10191
|
// src/components/modals/form-modal/FormModalBaseUtils.ts
|
|
@@ -10154,6 +10222,36 @@ function extractMessage(error, I18n) {
|
|
|
10154
10222
|
return { form: I18n.t("savedViews.modal.errors.unknown") };
|
|
10155
10223
|
}
|
|
10156
10224
|
|
|
10225
|
+
// src/components/modals/form-modal/NameInputField.tsx
|
|
10226
|
+
import { Form, useFormContext, useI18nContext as useI18nContext7 } from "@procore/core-react";
|
|
10227
|
+
import * as React19 from "react";
|
|
10228
|
+
var NAME_INPUT_ID = "saved-view-form-name-input";
|
|
10229
|
+
var NameInputField = ({
|
|
10230
|
+
error,
|
|
10231
|
+
onResetMutations
|
|
10232
|
+
}) => {
|
|
10233
|
+
const I18n = useI18nContext7();
|
|
10234
|
+
const label = I18n.t("savedViews.modal.fields.name");
|
|
10235
|
+
const { errors: formErrors, submitCount } = useFormContext();
|
|
10236
|
+
React19.useEffect(() => {
|
|
10237
|
+
if (submitCount > 0 && formErrors?.name) {
|
|
10238
|
+
document.getElementById(NAME_INPUT_ID)?.focus();
|
|
10239
|
+
}
|
|
10240
|
+
}, [formErrors?.name, submitCount]);
|
|
10241
|
+
return /* @__PURE__ */ React19.createElement(
|
|
10242
|
+
Form.Text,
|
|
10243
|
+
{
|
|
10244
|
+
id: NAME_INPUT_ID,
|
|
10245
|
+
name: "name",
|
|
10246
|
+
error,
|
|
10247
|
+
placeholder: label,
|
|
10248
|
+
label,
|
|
10249
|
+
colWidth: 12,
|
|
10250
|
+
onChange: onResetMutations
|
|
10251
|
+
}
|
|
10252
|
+
);
|
|
10253
|
+
};
|
|
10254
|
+
|
|
10157
10255
|
// src/components/modals/form-modal/FormModalBase.tsx
|
|
10158
10256
|
var ScrollContainer = styled_components_esm_default("div")`
|
|
10159
10257
|
overflow: auto;
|
|
@@ -10173,7 +10271,7 @@ var FormModalBase = ({
|
|
|
10173
10271
|
setOpenEditCreateModal,
|
|
10174
10272
|
onSelect
|
|
10175
10273
|
}) => {
|
|
10176
|
-
const I18n =
|
|
10274
|
+
const I18n = useI18nContext8();
|
|
10177
10275
|
const NAME_MAX_LENGTH = 150;
|
|
10178
10276
|
const {
|
|
10179
10277
|
mutate: createSavedView,
|
|
@@ -10232,24 +10330,17 @@ var FormModalBase = ({
|
|
|
10232
10330
|
I18n,
|
|
10233
10331
|
isProjectLevelTool
|
|
10234
10332
|
);
|
|
10235
|
-
return /* @__PURE__ */
|
|
10333
|
+
return /* @__PURE__ */ React20.createElement(
|
|
10236
10334
|
Modal2,
|
|
10237
10335
|
{
|
|
10238
|
-
"
|
|
10239
|
-
|
|
10336
|
+
howToClose: ["x", "scrim"],
|
|
10337
|
+
onClose,
|
|
10240
10338
|
open,
|
|
10241
|
-
|
|
10339
|
+
width: "md",
|
|
10242
10340
|
"data-testid": "create-update-modal"
|
|
10243
10341
|
},
|
|
10244
|
-
/* @__PURE__ */
|
|
10245
|
-
|
|
10246
|
-
{
|
|
10247
|
-
onClose,
|
|
10248
|
-
style: { borderBottom: `1px solid ${colors3.gray85}` }
|
|
10249
|
-
},
|
|
10250
|
-
/* @__PURE__ */ React19.createElement(H2, null, header)
|
|
10251
|
-
), /* @__PURE__ */ React19.createElement(
|
|
10252
|
-
Form,
|
|
10342
|
+
/* @__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(
|
|
10343
|
+
Form2,
|
|
10253
10344
|
{
|
|
10254
10345
|
initialValues: {
|
|
10255
10346
|
name: initialName,
|
|
@@ -10274,30 +10365,26 @@ var FormModalBase = ({
|
|
|
10274
10365
|
onReset: onCancel,
|
|
10275
10366
|
validateOnChange: true
|
|
10276
10367
|
},
|
|
10277
|
-
/* @__PURE__ */
|
|
10368
|
+
/* @__PURE__ */ React20.createElement(Form2.Form, { name: header }, /* @__PURE__ */ React20.createElement(
|
|
10278
10369
|
Modal2.Body,
|
|
10279
10370
|
{
|
|
10280
|
-
style: { paddingTop: 0, paddingBottom: 0, marginTop:
|
|
10371
|
+
style: { paddingTop: 0, paddingBottom: 0, marginTop: spacing2.lg }
|
|
10281
10372
|
},
|
|
10282
|
-
errors && /* @__PURE__ */
|
|
10283
|
-
/* @__PURE__ */
|
|
10284
|
-
|
|
10373
|
+
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?.form || I18n.t(`savedViews.modal.errors.description.${mode}`)))),
|
|
10374
|
+
/* @__PURE__ */ React20.createElement(Form2.Row, null, /* @__PURE__ */ React20.createElement(
|
|
10375
|
+
NameInputField,
|
|
10285
10376
|
{
|
|
10286
|
-
name: "name",
|
|
10287
10377
|
error: errors?.name,
|
|
10288
|
-
|
|
10289
|
-
label: I18n.t("savedViews.modal.fields.name"),
|
|
10290
|
-
colWidth: 12,
|
|
10291
|
-
onChange: () => resetMutations()
|
|
10378
|
+
onResetMutations: resetMutations
|
|
10292
10379
|
}
|
|
10293
10380
|
)),
|
|
10294
|
-
/* @__PURE__ */
|
|
10295
|
-
|
|
10381
|
+
/* @__PURE__ */ React20.createElement(
|
|
10382
|
+
Form2.Row,
|
|
10296
10383
|
{
|
|
10297
|
-
style: { marginTop: errors?.name ?
|
|
10384
|
+
style: { marginTop: errors?.name ? spacing2.xl : spacing2.none }
|
|
10298
10385
|
},
|
|
10299
|
-
/* @__PURE__ */
|
|
10300
|
-
|
|
10386
|
+
/* @__PURE__ */ React20.createElement(
|
|
10387
|
+
Form2.TextArea,
|
|
10301
10388
|
{
|
|
10302
10389
|
name: "description",
|
|
10303
10390
|
placeholder: I18n.t("savedViews.modal.fields.description"),
|
|
@@ -10307,8 +10394,8 @@ var FormModalBase = ({
|
|
|
10307
10394
|
}
|
|
10308
10395
|
)
|
|
10309
10396
|
),
|
|
10310
|
-
viewLevelOptions.length > 1 && mode === "create" /* CREATE */ ? /* @__PURE__ */
|
|
10311
|
-
|
|
10397
|
+
viewLevelOptions.length > 1 && mode === "create" /* CREATE */ ? /* @__PURE__ */ React20.createElement(Form2.Row, null, /* @__PURE__ */ React20.createElement(
|
|
10398
|
+
Form2.Select,
|
|
10312
10399
|
{
|
|
10313
10400
|
name: "view_level",
|
|
10314
10401
|
options: viewLevelOptions,
|
|
@@ -10317,9 +10404,9 @@ var FormModalBase = ({
|
|
|
10317
10404
|
onSearch: false,
|
|
10318
10405
|
onClear: false
|
|
10319
10406
|
}
|
|
10320
|
-
)) : /* @__PURE__ */
|
|
10321
|
-
), /* @__PURE__ */
|
|
10322
|
-
|
|
10407
|
+
)) : /* @__PURE__ */ React20.createElement(React20.Fragment, null)
|
|
10408
|
+
), /* @__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(
|
|
10409
|
+
Button5,
|
|
10323
10410
|
{
|
|
10324
10411
|
"data-testid": "create-update-modal-button",
|
|
10325
10412
|
type: "submit",
|
|
@@ -10334,7 +10421,7 @@ var FormModalBase = ({
|
|
|
10334
10421
|
};
|
|
10335
10422
|
|
|
10336
10423
|
// src/components/modals/form-modal/FormModal.tsx
|
|
10337
|
-
import { useI18nContext as
|
|
10424
|
+
import { useI18nContext as useI18nContext9 } from "@procore/core-react";
|
|
10338
10425
|
var FormModal = ({
|
|
10339
10426
|
open,
|
|
10340
10427
|
mode,
|
|
@@ -10347,8 +10434,8 @@ var FormModal = ({
|
|
|
10347
10434
|
onSelect,
|
|
10348
10435
|
defaultView
|
|
10349
10436
|
}) => {
|
|
10350
|
-
const i18n =
|
|
10351
|
-
return /* @__PURE__ */
|
|
10437
|
+
const i18n = useI18nContext9();
|
|
10438
|
+
return /* @__PURE__ */ React21.createElement(
|
|
10352
10439
|
FormModalBase,
|
|
10353
10440
|
{
|
|
10354
10441
|
open,
|
|
@@ -10371,18 +10458,18 @@ var FormModal = ({
|
|
|
10371
10458
|
// src/components/modals/form-modal/SharedViewFormModal.tsx
|
|
10372
10459
|
import {
|
|
10373
10460
|
Banner as Banner2,
|
|
10374
|
-
Button as
|
|
10461
|
+
Button as Button6,
|
|
10375
10462
|
colors as colors4,
|
|
10376
10463
|
ErrorBanner as ErrorBanner2,
|
|
10377
|
-
Flex as
|
|
10378
|
-
Form as
|
|
10464
|
+
Flex as Flex4,
|
|
10465
|
+
Form as Form3,
|
|
10379
10466
|
Modal as Modal3,
|
|
10380
10467
|
P as P3,
|
|
10381
|
-
spacing as
|
|
10468
|
+
spacing as spacing3,
|
|
10382
10469
|
Typography as Typography3,
|
|
10383
|
-
useI18nContext as
|
|
10470
|
+
useI18nContext as useI18nContext10
|
|
10384
10471
|
} from "@procore/core-react";
|
|
10385
|
-
import * as
|
|
10472
|
+
import * as React22 from "react";
|
|
10386
10473
|
import * as yup2 from "yup";
|
|
10387
10474
|
var SharedViewFormModal = ({
|
|
10388
10475
|
open,
|
|
@@ -10394,7 +10481,7 @@ var SharedViewFormModal = ({
|
|
|
10394
10481
|
isCreating,
|
|
10395
10482
|
resetCreateError
|
|
10396
10483
|
}) => {
|
|
10397
|
-
const I18n =
|
|
10484
|
+
const I18n = useI18nContext10();
|
|
10398
10485
|
const NAME_MAX_LENGTH = 150;
|
|
10399
10486
|
const errors = extractMessage(createError, I18n);
|
|
10400
10487
|
const handleNameChange = () => {
|
|
@@ -10405,35 +10492,36 @@ var SharedViewFormModal = ({
|
|
|
10405
10492
|
const handleOnSubmit = (data) => {
|
|
10406
10493
|
onCreateView(data.name, data.description);
|
|
10407
10494
|
};
|
|
10408
|
-
return /* @__PURE__ */
|
|
10495
|
+
return /* @__PURE__ */ React22.createElement(
|
|
10409
10496
|
Modal3,
|
|
10410
10497
|
{
|
|
10411
10498
|
"data-testid": "shared-view-form-modal",
|
|
10412
10499
|
open,
|
|
10413
|
-
|
|
10500
|
+
howToClose: ["x", "scrim"],
|
|
10501
|
+
onClose,
|
|
10414
10502
|
style: { width: "540px" }
|
|
10415
10503
|
},
|
|
10416
|
-
/* @__PURE__ */
|
|
10504
|
+
/* @__PURE__ */ React22.createElement(
|
|
10417
10505
|
Modal3.Header,
|
|
10418
10506
|
{
|
|
10419
10507
|
onClose,
|
|
10420
10508
|
style: {
|
|
10421
|
-
paddingTop:
|
|
10422
|
-
paddingBottom:
|
|
10423
|
-
paddingLeft:
|
|
10424
|
-
paddingRight:
|
|
10509
|
+
paddingTop: spacing3.lg,
|
|
10510
|
+
paddingBottom: spacing3.xs,
|
|
10511
|
+
paddingLeft: spacing3.xl,
|
|
10512
|
+
paddingRight: spacing3.xl
|
|
10425
10513
|
}
|
|
10426
10514
|
},
|
|
10427
|
-
I18n.t("savedViews.modal.create.title")
|
|
10515
|
+
/* @__PURE__ */ React22.createElement(Modal3.Heading, null, I18n.t("savedViews.modal.create.title"))
|
|
10428
10516
|
),
|
|
10429
|
-
/* @__PURE__ */
|
|
10517
|
+
/* @__PURE__ */ React22.createElement(
|
|
10430
10518
|
P3,
|
|
10431
10519
|
{
|
|
10432
10520
|
style: {
|
|
10433
|
-
paddingLeft:
|
|
10434
|
-
paddingRight:
|
|
10435
|
-
paddingBottom:
|
|
10436
|
-
paddingTop:
|
|
10521
|
+
paddingLeft: spacing3.xl,
|
|
10522
|
+
paddingRight: spacing3.xl,
|
|
10523
|
+
paddingBottom: spacing3.lg,
|
|
10524
|
+
paddingTop: spacing3.none,
|
|
10437
10525
|
margin: 0,
|
|
10438
10526
|
color: colors4.gray45,
|
|
10439
10527
|
whiteSpace: "pre-line"
|
|
@@ -10441,8 +10529,8 @@ var SharedViewFormModal = ({
|
|
|
10441
10529
|
},
|
|
10442
10530
|
I18n.t("savedViews.modal.copyConfirmation.description")
|
|
10443
10531
|
),
|
|
10444
|
-
/* @__PURE__ */
|
|
10445
|
-
|
|
10532
|
+
/* @__PURE__ */ React22.createElement(
|
|
10533
|
+
Form3,
|
|
10446
10534
|
{
|
|
10447
10535
|
initialValues: {
|
|
10448
10536
|
name: fetchedView.name,
|
|
@@ -10460,36 +10548,32 @@ var SharedViewFormModal = ({
|
|
|
10460
10548
|
onSubmit: handleOnSubmit,
|
|
10461
10549
|
validateOnChange: true
|
|
10462
10550
|
},
|
|
10463
|
-
/* @__PURE__ */
|
|
10551
|
+
/* @__PURE__ */ React22.createElement(Form3.Form, { name: "share-view-form" }, /* @__PURE__ */ React22.createElement(
|
|
10464
10552
|
Modal3.Body,
|
|
10465
10553
|
{
|
|
10466
10554
|
style: {
|
|
10467
|
-
paddingTop:
|
|
10555
|
+
paddingTop: spacing3.lg,
|
|
10468
10556
|
paddingBottom: 0,
|
|
10469
10557
|
borderTop: `1px solid ${colors4.gray85}`
|
|
10470
10558
|
}
|
|
10471
10559
|
},
|
|
10472
|
-
errors && /* @__PURE__ */
|
|
10560
|
+
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", {
|
|
10473
10561
|
mode: "create"
|
|
10474
|
-
})), /* @__PURE__ */
|
|
10475
|
-
/* @__PURE__ */
|
|
10476
|
-
|
|
10562
|
+
})), /* @__PURE__ */ React22.createElement(Banner2.Body, null, errors?.form || I18n.t("savedViews.modal.errors.description.create")))),
|
|
10563
|
+
/* @__PURE__ */ React22.createElement(Form3.Row, null, /* @__PURE__ */ React22.createElement(
|
|
10564
|
+
NameInputField,
|
|
10477
10565
|
{
|
|
10478
|
-
name: "name",
|
|
10479
10566
|
error: errors?.name,
|
|
10480
|
-
|
|
10481
|
-
label: I18n.t("savedViews.modal.fields.name"),
|
|
10482
|
-
colWidth: 12,
|
|
10483
|
-
onChange: handleNameChange
|
|
10567
|
+
onResetMutations: handleNameChange
|
|
10484
10568
|
}
|
|
10485
10569
|
)),
|
|
10486
|
-
/* @__PURE__ */
|
|
10487
|
-
|
|
10570
|
+
/* @__PURE__ */ React22.createElement(
|
|
10571
|
+
Form3.Row,
|
|
10488
10572
|
{
|
|
10489
|
-
style: { marginTop: errors?.name ?
|
|
10573
|
+
style: { marginTop: errors?.name ? spacing3.xl : spacing3.none }
|
|
10490
10574
|
},
|
|
10491
|
-
/* @__PURE__ */
|
|
10492
|
-
|
|
10575
|
+
/* @__PURE__ */ React22.createElement(
|
|
10576
|
+
Form3.TextArea,
|
|
10493
10577
|
{
|
|
10494
10578
|
name: "description",
|
|
10495
10579
|
placeholder: I18n.t("savedViews.modal.fields.description"),
|
|
@@ -10499,8 +10583,8 @@ var SharedViewFormModal = ({
|
|
|
10499
10583
|
}
|
|
10500
10584
|
)
|
|
10501
10585
|
)
|
|
10502
|
-
), /* @__PURE__ */
|
|
10503
|
-
|
|
10586
|
+
), /* @__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(
|
|
10587
|
+
Button6,
|
|
10504
10588
|
{
|
|
10505
10589
|
variant: "secondary",
|
|
10506
10590
|
onClick: onCreateTemporaryView,
|
|
@@ -10508,8 +10592,8 @@ var SharedViewFormModal = ({
|
|
|
10508
10592
|
disabled: isCreating
|
|
10509
10593
|
},
|
|
10510
10594
|
I18n.t("savedViews.actions.viewTemporarily")
|
|
10511
|
-
), /* @__PURE__ */
|
|
10512
|
-
|
|
10595
|
+
), /* @__PURE__ */ React22.createElement(
|
|
10596
|
+
Button6,
|
|
10513
10597
|
{
|
|
10514
10598
|
type: "submit",
|
|
10515
10599
|
variant: "primary",
|
|
@@ -10524,9 +10608,9 @@ var SharedViewFormModal = ({
|
|
|
10524
10608
|
};
|
|
10525
10609
|
|
|
10526
10610
|
// src/utils/hooks/useViewSelection.ts
|
|
10527
|
-
import { useState as useState3, useCallback as useCallback2, useEffect as
|
|
10611
|
+
import { useState as useState3, useCallback as useCallback2, useEffect as useEffect3, useRef as useRef2, useMemo } from "react";
|
|
10528
10612
|
import { useSearchParams } from "react-router-dom";
|
|
10529
|
-
import { useI18nContext as
|
|
10613
|
+
import { useI18nContext as useI18nContext11 } from "@procore/core-react";
|
|
10530
10614
|
|
|
10531
10615
|
// src/utils/viewStorage.ts
|
|
10532
10616
|
var ViewStorage = {
|
|
@@ -10589,7 +10673,7 @@ var restoreUrlParameter = (currentParam, previousParam, setSearchParams) => {
|
|
|
10589
10673
|
}
|
|
10590
10674
|
};
|
|
10591
10675
|
var useViewSelection = (config, savedViews, presetViews, openSharedViewModal) => {
|
|
10592
|
-
const I18n =
|
|
10676
|
+
const I18n = useI18nContext11();
|
|
10593
10677
|
const projectIdSegment = config.projectId ?? "company";
|
|
10594
10678
|
const storageKey = `savedView_${config.domain}_${config.tableName}_${config.companyId}_${projectIdSegment}_${config.userId}`;
|
|
10595
10679
|
const temporaryStorageKey = `${storageKey}-temporary`;
|
|
@@ -10665,7 +10749,7 @@ var useViewSelection = (config, savedViews, presetViews, openSharedViewModal) =>
|
|
|
10665
10749
|
},
|
|
10666
10750
|
[isViewAlreadySelected, openSharedViewModal, allViews, selectView]
|
|
10667
10751
|
);
|
|
10668
|
-
|
|
10752
|
+
useEffect3(() => {
|
|
10669
10753
|
const savedViewId = searchParams.get("saved-view");
|
|
10670
10754
|
restoreUrlParameter(
|
|
10671
10755
|
savedViewId,
|
|
@@ -10705,7 +10789,7 @@ var SavedViewsContent = (props) => {
|
|
|
10705
10789
|
const { data: savedViews } = useSavedViewsQuery(queryInput);
|
|
10706
10790
|
const { mutate: deleteSavedView } = useDeleteSavedView(queryInput);
|
|
10707
10791
|
const { showToast } = useToastAlertContext3();
|
|
10708
|
-
const i18n =
|
|
10792
|
+
const i18n = useI18nContext12();
|
|
10709
10793
|
const [activeModal, setActiveModal] = useState4(null);
|
|
10710
10794
|
const [modalData, setModalData] = useState4(null);
|
|
10711
10795
|
const openModal = (type, data) => {
|
|
@@ -10751,7 +10835,7 @@ var SavedViewsContent = (props) => {
|
|
|
10751
10835
|
error: createError,
|
|
10752
10836
|
reset: resetCreateError
|
|
10753
10837
|
} = useCreateSavedView(queryInput);
|
|
10754
|
-
|
|
10838
|
+
useEffect4(() => {
|
|
10755
10839
|
if (fetchError) {
|
|
10756
10840
|
showToast.error(i18n.t("savedViews.errors.notFound"));
|
|
10757
10841
|
selectView(selectedView ?? props.defaultView);
|
|
@@ -10799,31 +10883,45 @@ var SavedViewsContent = (props) => {
|
|
|
10799
10883
|
deleteSelectedView();
|
|
10800
10884
|
closeModal();
|
|
10801
10885
|
};
|
|
10802
|
-
return /* @__PURE__ */
|
|
10886
|
+
return /* @__PURE__ */ React23.createElement(StyledPanel, { provider: props.provider }, /* @__PURE__ */ React23.createElement(
|
|
10803
10887
|
ExpandedPanel,
|
|
10804
10888
|
{
|
|
10805
10889
|
"data-testid": "saved-view-expanded-panel",
|
|
10806
10890
|
provider: props.provider
|
|
10807
10891
|
},
|
|
10808
|
-
/* @__PURE__ */
|
|
10892
|
+
/* @__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(
|
|
10893
|
+
Tooltip,
|
|
10894
|
+
{
|
|
10895
|
+
showDelay: 200,
|
|
10896
|
+
overlay: /* @__PURE__ */ React23.createElement(Tooltip.Content, null, i18n.t("savedViews.tooltip"))
|
|
10897
|
+
},
|
|
10898
|
+
/* @__PURE__ */ React23.createElement(
|
|
10899
|
+
Help_default,
|
|
10900
|
+
{
|
|
10901
|
+
tabIndex: 0,
|
|
10902
|
+
size: "sm",
|
|
10903
|
+
"aria-label": i18n.t("savedViews.tooltip")
|
|
10904
|
+
}
|
|
10905
|
+
)
|
|
10906
|
+
))), /* @__PURE__ */ React23.createElement(
|
|
10809
10907
|
Tooltip,
|
|
10810
10908
|
{
|
|
10811
10909
|
overlay: i18n.t("savedViews.actions.create"),
|
|
10812
10910
|
showDelay: 1e3
|
|
10813
10911
|
},
|
|
10814
|
-
/* @__PURE__ */
|
|
10815
|
-
|
|
10912
|
+
/* @__PURE__ */ React23.createElement(
|
|
10913
|
+
Button7,
|
|
10816
10914
|
{
|
|
10817
|
-
icon: /* @__PURE__ */
|
|
10915
|
+
icon: /* @__PURE__ */ React23.createElement(Plus_default, null),
|
|
10818
10916
|
variant: "secondary",
|
|
10819
10917
|
"data-testid": "expanded-panel-create-button",
|
|
10820
10918
|
onClick: () => openModal("create" /* CREATE */),
|
|
10821
10919
|
"aria-label": i18n.t("savedViews.actions.create")
|
|
10822
10920
|
},
|
|
10823
10921
|
i18n.t("savedViews.actions.create")
|
|
10824
|
-
)
|
|
10922
|
+
)
|
|
10825
10923
|
)),
|
|
10826
|
-
/* @__PURE__ */
|
|
10924
|
+
/* @__PURE__ */ React23.createElement(Panel3.Body, { style: { display: "flex", flexFlow: "column" } }, /* @__PURE__ */ React23.createElement(
|
|
10827
10925
|
PanelContent,
|
|
10828
10926
|
{
|
|
10829
10927
|
onSelect: ({ item }) => selectView(item),
|
|
@@ -10840,7 +10938,7 @@ var SavedViewsContent = (props) => {
|
|
|
10840
10938
|
onClearTemporary: clearTemporaryView
|
|
10841
10939
|
}
|
|
10842
10940
|
))
|
|
10843
|
-
), (isModalOpen("create" /* CREATE */) || isModalOpen("update" /* UPDATE */)) && /* @__PURE__ */
|
|
10941
|
+
), (isModalOpen("create" /* CREATE */) || isModalOpen("update" /* UPDATE */)) && /* @__PURE__ */ React23.createElement(
|
|
10844
10942
|
FormModal,
|
|
10845
10943
|
{
|
|
10846
10944
|
open: true,
|
|
@@ -10854,14 +10952,14 @@ var SavedViewsContent = (props) => {
|
|
|
10854
10952
|
setOpenEditCreateModal: closeModal,
|
|
10855
10953
|
defaultView: props.defaultView
|
|
10856
10954
|
}
|
|
10857
|
-
), selectedView && isModalOpen("delete" /* DELETE */) && /* @__PURE__ */
|
|
10955
|
+
), selectedView && isModalOpen("delete" /* DELETE */) && /* @__PURE__ */ React23.createElement(
|
|
10858
10956
|
SavedViewsDeleteConfirmationModalShared,
|
|
10859
10957
|
{
|
|
10860
10958
|
open: true,
|
|
10861
10959
|
onDelete: confirmDeleteAndCloseModal,
|
|
10862
10960
|
onCancel: closeModal
|
|
10863
10961
|
}
|
|
10864
|
-
), fetchedView && isModalOpen("sharedView" /* SHARED_VIEW */) && /* @__PURE__ */
|
|
10962
|
+
), fetchedView && isModalOpen("sharedView" /* SHARED_VIEW */) && /* @__PURE__ */ React23.createElement(
|
|
10865
10963
|
SharedViewFormModal,
|
|
10866
10964
|
{
|
|
10867
10965
|
open: true,
|
|
@@ -10876,11 +10974,11 @@ var SavedViewsContent = (props) => {
|
|
|
10876
10974
|
));
|
|
10877
10975
|
};
|
|
10878
10976
|
var SavedViews = (props) => {
|
|
10879
|
-
return /* @__PURE__ */
|
|
10977
|
+
return /* @__PURE__ */ React23.createElement(EnvironmentI18nProvider, null, /* @__PURE__ */ React23.createElement(QueryClientProvider, { client: queryClient }, /* @__PURE__ */ React23.createElement(ToastAlertProvider, null, /* @__PURE__ */ React23.createElement(SavedViewsContent, { ...props }))));
|
|
10880
10978
|
};
|
|
10881
10979
|
|
|
10882
10980
|
// src/components/adapters/smart-grid/SmartGridSavedViews.tsx
|
|
10883
|
-
import
|
|
10981
|
+
import React24, { useCallback as useCallback4 } from "react";
|
|
10884
10982
|
|
|
10885
10983
|
// src/components/adapters/smart-grid/SmartGridDefaultSavedView.tsx
|
|
10886
10984
|
import { useMemo as useMemo2 } from "react";
|
|
@@ -10943,7 +11041,7 @@ var useNormalizedDefaultViews = (defaultViews, gridApi) => {
|
|
|
10943
11041
|
};
|
|
10944
11042
|
|
|
10945
11043
|
// src/components/adapters/smart-grid/useSmartGridConfig.ts
|
|
10946
|
-
import { useState as useState5, useEffect as
|
|
11044
|
+
import { useState as useState5, useEffect as useEffect5 } from "react";
|
|
10947
11045
|
var GRID_STATE_EVENTS = [
|
|
10948
11046
|
"sortChanged",
|
|
10949
11047
|
"filterOpened",
|
|
@@ -10962,7 +11060,7 @@ var useSmartGridConfig = (gridApi) => {
|
|
|
10962
11060
|
const [config, setConfig] = useState5(
|
|
10963
11061
|
() => getSmartGridConfig(gridApi)
|
|
10964
11062
|
);
|
|
10965
|
-
|
|
11063
|
+
useEffect5(() => {
|
|
10966
11064
|
if (!gridApi)
|
|
10967
11065
|
return;
|
|
10968
11066
|
const updateConfig = () => {
|
|
@@ -11009,7 +11107,7 @@ var SmartGridSavedViews = (props) => {
|
|
|
11009
11107
|
},
|
|
11010
11108
|
[gridApi, tableConfig, setTableConfig]
|
|
11011
11109
|
);
|
|
11012
|
-
return /* @__PURE__ */
|
|
11110
|
+
return /* @__PURE__ */ React24.createElement(
|
|
11013
11111
|
SavedViews,
|
|
11014
11112
|
{
|
|
11015
11113
|
onSelect,
|
|
@@ -11027,7 +11125,7 @@ var SmartGridSavedViews = (props) => {
|
|
|
11027
11125
|
};
|
|
11028
11126
|
|
|
11029
11127
|
// src/components/adapters/data-table/DataTableSavedViews.tsx
|
|
11030
|
-
import
|
|
11128
|
+
import React25, {
|
|
11031
11129
|
forwardRef as forwardRef11,
|
|
11032
11130
|
useImperativeHandle,
|
|
11033
11131
|
useState as useState6,
|
|
@@ -11127,7 +11225,7 @@ var DataTableSavedViews = forwardRef11((props, ref) => {
|
|
|
11127
11225
|
if (!internalTableConfig) {
|
|
11128
11226
|
return null;
|
|
11129
11227
|
}
|
|
11130
|
-
return /* @__PURE__ */
|
|
11228
|
+
return /* @__PURE__ */ React25.createElement(
|
|
11131
11229
|
SavedViews,
|
|
11132
11230
|
{
|
|
11133
11231
|
onSelect,
|