@procore/saved-views 5.1.0-alpha.4 → 5.1.0-alpha.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 +61 -40
- package/dist/legacy/index.d.ts +61 -40
- package/dist/legacy/index.js +447 -335
- package/dist/legacy/index.mjs +426 -317
- package/dist/modern/index.d.mts +61 -40
- package/dist/modern/index.d.ts +61 -40
- package/dist/modern/index.js +446 -333
- package/dist/modern/index.mjs +425 -315
- package/package.json +1 -1
package/dist/modern/index.mjs
CHANGED
|
@@ -8468,7 +8468,7 @@ var require_toposort = __commonJS({
|
|
|
8468
8468
|
}
|
|
8469
8469
|
});
|
|
8470
8470
|
|
|
8471
|
-
// src/utils/
|
|
8471
|
+
// src/utils/translations/translations.ts
|
|
8472
8472
|
var import_globalization_toolkit = __toESM(require_dist());
|
|
8473
8473
|
|
|
8474
8474
|
// src/locales/de-DE.json
|
|
@@ -8851,6 +8851,9 @@ var en_default = {
|
|
|
8851
8851
|
update: {
|
|
8852
8852
|
success: "The saved view was successfully updated."
|
|
8853
8853
|
},
|
|
8854
|
+
create: {
|
|
8855
|
+
success: "The saved view was successfully created."
|
|
8856
|
+
},
|
|
8854
8857
|
copy: {
|
|
8855
8858
|
success: "The link was successfully created and copied to the clipboard."
|
|
8856
8859
|
},
|
|
@@ -8859,7 +8862,8 @@ var en_default = {
|
|
|
8859
8862
|
create: "Sorry, the saved view couldn't be created. Try again.",
|
|
8860
8863
|
update: "Sorry, the saved view couldn't be updated. Try again.",
|
|
8861
8864
|
delete: "Sorry, the saved view couldn't be deleted. Try again.",
|
|
8862
|
-
copyFailed: "Failed to copy share link to clipboard"
|
|
8865
|
+
copyFailed: "Failed to copy share link to clipboard",
|
|
8866
|
+
notFound: "Sorry, the saved view could not be found. Please try again."
|
|
8863
8867
|
},
|
|
8864
8868
|
defaultViewTitle: {
|
|
8865
8869
|
rfi: "All RFIs",
|
|
@@ -9264,6 +9268,84 @@ var is_IS_default = {
|
|
|
9264
9268
|
}
|
|
9265
9269
|
};
|
|
9266
9270
|
|
|
9271
|
+
// src/locales/it-IT.json
|
|
9272
|
+
var it_IT_default = {
|
|
9273
|
+
savedViews: {
|
|
9274
|
+
name: "Vista salvata",
|
|
9275
|
+
title: "Viste salvate",
|
|
9276
|
+
tooltip: "Creare e salvare qualsiasi layout di tabella personalizzato per tornare rapidamente alla vista preferita.",
|
|
9277
|
+
button: {
|
|
9278
|
+
title: "Viste"
|
|
9279
|
+
},
|
|
9280
|
+
actions: {
|
|
9281
|
+
update: "Aggiorna",
|
|
9282
|
+
delete: "Elimina",
|
|
9283
|
+
create: "Crea",
|
|
9284
|
+
edit: "Modifica",
|
|
9285
|
+
cancel: "Annulla",
|
|
9286
|
+
close: "Chiudi"
|
|
9287
|
+
},
|
|
9288
|
+
modal: {
|
|
9289
|
+
edit: {
|
|
9290
|
+
title: "Aggiorna vista salvata"
|
|
9291
|
+
},
|
|
9292
|
+
create: {
|
|
9293
|
+
title: "Crea vista salvata"
|
|
9294
|
+
},
|
|
9295
|
+
delete: {
|
|
9296
|
+
headline: "Elimina vista salvata",
|
|
9297
|
+
description: "Una volta eliminata, non sar\xE0 pi\xF9 possibile ripristinare la vista."
|
|
9298
|
+
},
|
|
9299
|
+
fields: {
|
|
9300
|
+
name: "Nome",
|
|
9301
|
+
description: "Descrizione",
|
|
9302
|
+
viewLevel: "Livello vista",
|
|
9303
|
+
viewLevels: {
|
|
9304
|
+
company: "Vista dell'azienda",
|
|
9305
|
+
project: "Vista del progetto",
|
|
9306
|
+
personal: "Vista personale"
|
|
9307
|
+
}
|
|
9308
|
+
},
|
|
9309
|
+
errors: {
|
|
9310
|
+
maxLengthName: "Non pu\xF2 contenere pi\xF9 di {{maxLength}} caratteri.",
|
|
9311
|
+
required: "Il campo non pu\xF2 essere vuoto.",
|
|
9312
|
+
duplicateName: "Esiste gi\xE0 una vista salvata con questo nome. Rinominarla e riprovare.",
|
|
9313
|
+
unknown: "Si \xE8 verificato un errore. Riprovare.",
|
|
9314
|
+
title: "Impossibile {{mode}} questa vista salvata",
|
|
9315
|
+
description: {
|
|
9316
|
+
create: "Correggere gli errori di seguito e provare a creare di nuovo",
|
|
9317
|
+
update: "Correggere gli errori di seguito e provare ad aggiornare di nuovo"
|
|
9318
|
+
}
|
|
9319
|
+
},
|
|
9320
|
+
info: {
|
|
9321
|
+
required_fields: "campi obbligatori"
|
|
9322
|
+
}
|
|
9323
|
+
},
|
|
9324
|
+
ariaLabels: {
|
|
9325
|
+
menuItem: "Voce di menu Viste salvate {{name}}",
|
|
9326
|
+
modal: "Finestra modale per creare/aggiornare viste salvate"
|
|
9327
|
+
},
|
|
9328
|
+
update: {
|
|
9329
|
+
success: "Vista salvata aggiornata correttamente."
|
|
9330
|
+
},
|
|
9331
|
+
errors: {
|
|
9332
|
+
fetch: "Impossibile recuperare le viste salvate. Riprovare.",
|
|
9333
|
+
create: "Impossibile creare la vista salvata. Riprovare.",
|
|
9334
|
+
update: "Impossibile aggiornare la vista salvata. Riprovare.",
|
|
9335
|
+
delete: "Impossibile eliminare la vista salvata. Riprovare."
|
|
9336
|
+
},
|
|
9337
|
+
defaultViewTitle: {
|
|
9338
|
+
rfi: "Tutte le RDI",
|
|
9339
|
+
submittal_log: "Tutti gli elementi da inoltrare"
|
|
9340
|
+
},
|
|
9341
|
+
viewLevel: {
|
|
9342
|
+
company: "Viste dell'azienda",
|
|
9343
|
+
project: "Viste del progetto",
|
|
9344
|
+
personal: "Viste personali"
|
|
9345
|
+
}
|
|
9346
|
+
}
|
|
9347
|
+
};
|
|
9348
|
+
|
|
9267
9349
|
// src/locales/ja-JP.json
|
|
9268
9350
|
var ja_JP_default = {
|
|
9269
9351
|
savedViews: {
|
|
@@ -9654,8 +9736,8 @@ var zh_SG_default = {
|
|
|
9654
9736
|
}
|
|
9655
9737
|
};
|
|
9656
9738
|
|
|
9657
|
-
// src/
|
|
9658
|
-
var
|
|
9739
|
+
// src/locales/index.ts
|
|
9740
|
+
var locales_default = {
|
|
9659
9741
|
"de-DE": de_DE_default,
|
|
9660
9742
|
"en-AU": en_AU_default,
|
|
9661
9743
|
"en-CA": en_CA_default,
|
|
@@ -9666,12 +9748,18 @@ var supportedLocales = {
|
|
|
9666
9748
|
"fr-CA": fr_CA_default,
|
|
9667
9749
|
"fr-FR": fr_FR_default,
|
|
9668
9750
|
"is-IS": is_IS_default,
|
|
9751
|
+
"it-IT": it_IT_default,
|
|
9669
9752
|
"ja-JP": ja_JP_default,
|
|
9753
|
+
"pl-PL": pl_PL_default,
|
|
9670
9754
|
"pt-BR": pt_BR_default,
|
|
9671
9755
|
"th-TH": th_TH_default,
|
|
9672
|
-
"zh-SG": zh_SG_default
|
|
9673
|
-
|
|
9674
|
-
|
|
9756
|
+
"zh-SG": zh_SG_default
|
|
9757
|
+
};
|
|
9758
|
+
|
|
9759
|
+
// src/utils/translations/translations.ts
|
|
9760
|
+
var supportedLocales = {
|
|
9761
|
+
...locales_default,
|
|
9762
|
+
pseudo: locales_default.en
|
|
9675
9763
|
};
|
|
9676
9764
|
function getTranslations(envLocale) {
|
|
9677
9765
|
return Object.fromEntries(
|
|
@@ -9682,7 +9770,7 @@ function getTranslations(envLocale) {
|
|
|
9682
9770
|
);
|
|
9683
9771
|
}
|
|
9684
9772
|
|
|
9685
|
-
// src/
|
|
9773
|
+
// src/components/buttons/useSavedViewsPanel.tsx
|
|
9686
9774
|
import { useState } from "react";
|
|
9687
9775
|
|
|
9688
9776
|
// ../../node_modules/tslib/tslib.es6.mjs
|
|
@@ -9894,7 +9982,7 @@ var Plus = React11.forwardRef(function Plus2(props, ref) {
|
|
|
9894
9982
|
Plus.displayName = "Plus";
|
|
9895
9983
|
var Plus_default = Plus;
|
|
9896
9984
|
|
|
9897
|
-
// src/
|
|
9985
|
+
// src/components/buttons/SavedViewsButton.tsx
|
|
9898
9986
|
import { Button } from "@procore/core-react";
|
|
9899
9987
|
import React13 from "react";
|
|
9900
9988
|
|
|
@@ -11109,7 +11197,7 @@ var Ue = function() {
|
|
|
11109
11197
|
"production" !== process.env.NODE_ENV && "undefined" != typeof navigator && "ReactNative" === navigator.product && console.warn("It looks like you've imported 'styled-components' on React Native.\nPerhaps you're looking to import 'styled-components/native'?\nRead more about this at https://www.styled-components.com/docs/basics#react-native"), "production" !== process.env.NODE_ENV && "test" !== process.env.NODE_ENV && "undefined" != typeof window && (window["__styled-components-init__"] = window["__styled-components-init__"] || 0, 1 === window["__styled-components-init__"] && console.warn("It looks like there are several instances of 'styled-components' initialized in this application. This may cause dynamic styles to not render properly, errors during the rehydration process, a missing theme prop, and makes your application bigger without good reason.\n\nSee https://s-c.sh/2BAXzed for more info."), window["__styled-components-init__"] += 1);
|
|
11110
11198
|
var styled_components_esm_default = Ye;
|
|
11111
11199
|
|
|
11112
|
-
// src/
|
|
11200
|
+
// src/components/EnvironmentI18nProvider.tsx
|
|
11113
11201
|
import React12 from "react";
|
|
11114
11202
|
import { I18nContext, useI18n, useI18nContext } from "@procore/core-react";
|
|
11115
11203
|
import { useRequestTranslations } from "@procore/cdn-translations";
|
|
@@ -11139,7 +11227,7 @@ var EnvironmentI18nProvider = ({ children }) => {
|
|
|
11139
11227
|
return /* @__PURE__ */ React12.createElement(I18nContext.Provider, { value: i18n }, children);
|
|
11140
11228
|
};
|
|
11141
11229
|
|
|
11142
|
-
// src/
|
|
11230
|
+
// src/components/buttons/SavedViewsButton.tsx
|
|
11143
11231
|
var StyledButton = styled_components_esm_default(Button)`
|
|
11144
11232
|
background-color: hsl(218, 75%, 96%);
|
|
11145
11233
|
color: hsl(218, 75%, 45%);
|
|
@@ -11175,7 +11263,7 @@ var SavedViewsButton = ({
|
|
|
11175
11263
|
));
|
|
11176
11264
|
};
|
|
11177
11265
|
|
|
11178
|
-
// src/
|
|
11266
|
+
// src/components/buttons/useSavedViewsPanel.tsx
|
|
11179
11267
|
import React14 from "react";
|
|
11180
11268
|
var useSavedViewsPanel = (domain, tableName) => {
|
|
11181
11269
|
const key = (domain2, tableName2) => `savedViewsPanel-${domain2}-${tableName2}`;
|
|
@@ -11191,7 +11279,7 @@ var useSavedViewsPanel = (domain, tableName) => {
|
|
|
11191
11279
|
};
|
|
11192
11280
|
var useSavedViewsPanel_default = useSavedViewsPanel;
|
|
11193
11281
|
|
|
11194
|
-
// src/
|
|
11282
|
+
// src/components/menu-items/SavedViewsCollectionsMenuItem.tsx
|
|
11195
11283
|
import {
|
|
11196
11284
|
Box,
|
|
11197
11285
|
Button as Button2,
|
|
@@ -11215,6 +11303,11 @@ var Container2 = styled_components_esm_default(Flex)`
|
|
|
11215
11303
|
|
|
11216
11304
|
${({ "aria-selected": selected }) => selected ? "color: hsl(218, 75%, 45%);" : ""}
|
|
11217
11305
|
`;
|
|
11306
|
+
var IconWrapper = styled_components_esm_default.span`
|
|
11307
|
+
display: flex;
|
|
11308
|
+
align-items: center;
|
|
11309
|
+
justify-content: center;
|
|
11310
|
+
`;
|
|
11218
11311
|
var SavedViewCollectionMenuItem = (props) => {
|
|
11219
11312
|
const onClick = React15.useCallback(
|
|
11220
11313
|
(a2) => {
|
|
@@ -11281,7 +11374,7 @@ var SavedViewCollectionMenuItem = (props) => {
|
|
|
11281
11374
|
},
|
|
11282
11375
|
props.item.name
|
|
11283
11376
|
),
|
|
11284
|
-
/* @__PURE__ */ React15.createElement(RowActionsBox, null, /* @__PURE__ */ React15.createElement(Box, { justifyContent: "space-between" }, props.item.
|
|
11377
|
+
/* @__PURE__ */ React15.createElement(RowActionsBox, null, /* @__PURE__ */ React15.createElement(Box, { justifyContent: "space-between" }, props.item.view_level !== "default" && props.canUpdate && /* @__PURE__ */ React15.createElement("div", null, /* @__PURE__ */ React15.createElement(
|
|
11285
11378
|
Button2,
|
|
11286
11379
|
{
|
|
11287
11380
|
onClick: updateItem,
|
|
@@ -11292,7 +11385,7 @@ var SavedViewCollectionMenuItem = (props) => {
|
|
|
11292
11385
|
loading: props.isUpdateProcessing
|
|
11293
11386
|
},
|
|
11294
11387
|
i18n.t("savedViews.actions.update")
|
|
11295
|
-
)), props.item.
|
|
11388
|
+
)), props.item.view_level !== "default" && props.selected && !props.canUpdate && props.item.id !== "temporary" && /* @__PURE__ */ React15.createElement("div", null, /* @__PURE__ */ React15.createElement(
|
|
11296
11389
|
Button2,
|
|
11297
11390
|
{
|
|
11298
11391
|
onClick: copyShareLink,
|
|
@@ -11301,7 +11394,7 @@ var SavedViewCollectionMenuItem = (props) => {
|
|
|
11301
11394
|
"aria-label": i18n.t("savedViews.actions.copyShareLink"),
|
|
11302
11395
|
"data-testid": "copy-share-link-button"
|
|
11303
11396
|
},
|
|
11304
|
-
/* @__PURE__ */ React15.createElement(Link_default, { size: "sm" })
|
|
11397
|
+
/* @__PURE__ */ React15.createElement(IconWrapper, null, /* @__PURE__ */ React15.createElement(Link_default, { size: "sm" }))
|
|
11305
11398
|
)), props.item.id === "temporary" && /* @__PURE__ */ React15.createElement("div", null, /* @__PURE__ */ React15.createElement(
|
|
11306
11399
|
Button2,
|
|
11307
11400
|
{
|
|
@@ -11315,8 +11408,8 @@ var SavedViewCollectionMenuItem = (props) => {
|
|
|
11315
11408
|
title: i18n.t("savedViews.actions.clearTemporary"),
|
|
11316
11409
|
"data-testid": "clear-temporary-view-button"
|
|
11317
11410
|
},
|
|
11318
|
-
/* @__PURE__ */ React15.createElement(Clear_default, { size: "sm" })
|
|
11319
|
-
))), /* @__PURE__ */ React15.createElement(Box, null, props.item.
|
|
11411
|
+
/* @__PURE__ */ React15.createElement(IconWrapper, null, /* @__PURE__ */ React15.createElement(Clear_default, { size: "sm" }))
|
|
11412
|
+
))), /* @__PURE__ */ React15.createElement(Box, null, props.item.view_level !== "default" && props.canEditOrDelete && /* @__PURE__ */ React15.createElement("div", { onClick: (e2) => e2.stopPropagation() }, /* @__PURE__ */ React15.createElement(
|
|
11320
11413
|
DropdownFlyout,
|
|
11321
11414
|
{
|
|
11322
11415
|
"data-testid": "saved-view-overflow-button",
|
|
@@ -11331,7 +11424,7 @@ var SavedViewCollectionMenuItem = (props) => {
|
|
|
11331
11424
|
);
|
|
11332
11425
|
};
|
|
11333
11426
|
|
|
11334
|
-
// src/
|
|
11427
|
+
// src/components/panels/ExpandedPanel.tsx
|
|
11335
11428
|
import { Panel } from "@procore/core-react";
|
|
11336
11429
|
var ExpandedPanel = styled_components_esm_default(Panel)`
|
|
11337
11430
|
width: ${({ provider }) => provider === "data-table" ? "316px" : "100%"};
|
|
@@ -11339,15 +11432,8 @@ var ExpandedPanel = styled_components_esm_default(Panel)`
|
|
|
11339
11432
|
border-radius: 4px 0 0 4px;
|
|
11340
11433
|
`;
|
|
11341
11434
|
|
|
11342
|
-
// src/
|
|
11343
|
-
import {
|
|
11344
|
-
colors as colors2,
|
|
11345
|
-
DetailPage,
|
|
11346
|
-
Flex as Flex3,
|
|
11347
|
-
UNSAFE_Menu as MenuImperative,
|
|
11348
|
-
spacing as spacing2,
|
|
11349
|
-
useI18nContext as useI18nContext5
|
|
11350
|
-
} from "@procore/core-react";
|
|
11435
|
+
// src/components/panels/PanelContent.tsx
|
|
11436
|
+
import { Flex as Flex3, useI18nContext as useI18nContext5 } from "@procore/core-react";
|
|
11351
11437
|
import { useToastAlertContext as useToastAlertContext2 } from "@procore/toast-alert";
|
|
11352
11438
|
import React17 from "react";
|
|
11353
11439
|
|
|
@@ -11393,10 +11479,10 @@ function requestJSON(url, requestParams = {}) {
|
|
|
11393
11479
|
);
|
|
11394
11480
|
}
|
|
11395
11481
|
|
|
11396
|
-
// src/utils/
|
|
11482
|
+
// src/utils/api/queries.ts
|
|
11397
11483
|
import { useQuery } from "@tanstack/react-query";
|
|
11398
11484
|
|
|
11399
|
-
// src/utils/
|
|
11485
|
+
// src/utils/api/queriesHandler.ts
|
|
11400
11486
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
11401
11487
|
import { useI18nContext as useI18nContext3 } from "@procore/core-react";
|
|
11402
11488
|
var useApiRequest = (props, method, mutationKey) => {
|
|
@@ -11461,10 +11547,10 @@ var useApiRequest = (props, method, mutationKey) => {
|
|
|
11461
11547
|
});
|
|
11462
11548
|
};
|
|
11463
11549
|
|
|
11464
|
-
// src/utils/
|
|
11550
|
+
// src/utils/constants/viewLevels.ts
|
|
11465
11551
|
var VIEW_LEVELS = ["company", "project", "personal"];
|
|
11466
11552
|
|
|
11467
|
-
// src/utils/
|
|
11553
|
+
// src/utils/api/queries.ts
|
|
11468
11554
|
var PAGE_SIZE = 50 * VIEW_LEVELS.length;
|
|
11469
11555
|
var useSavedViewsQuery = (props) => {
|
|
11470
11556
|
const { projectId, companyId, domain, tableName } = props;
|
|
@@ -11517,24 +11603,23 @@ var useFetchSavedViewById = (savedViewToken, queryInput, enabled = true) => {
|
|
|
11517
11603
|
});
|
|
11518
11604
|
};
|
|
11519
11605
|
|
|
11520
|
-
// src/
|
|
11606
|
+
// src/components/panels/PanelContentUtils.ts
|
|
11521
11607
|
var import_lodash = __toESM(require_lodash());
|
|
11522
11608
|
|
|
11523
|
-
// src/
|
|
11609
|
+
// src/components/adapters/smart-grid/SmartGridUtils.ts
|
|
11524
11610
|
function getSmartGridConfig(api) {
|
|
11525
|
-
const
|
|
11526
|
-
const
|
|
11527
|
-
const
|
|
11528
|
-
const
|
|
11529
|
-
const
|
|
11530
|
-
|
|
11531
|
-
columnState
|
|
11532
|
-
rowHeight
|
|
11533
|
-
columnGroupState
|
|
11534
|
-
rowGroupState
|
|
11535
|
-
filterState
|
|
11611
|
+
const columnState = api.getColumnState();
|
|
11612
|
+
const columnGroupState = api.getColumnGroupState();
|
|
11613
|
+
const rowGroupState = api.getRowGroupColumns().map((col) => col.getColId());
|
|
11614
|
+
const rowHeight = api.getGridOption("rowHeight") ?? api.getSizesForCurrentTheme().rowHeight;
|
|
11615
|
+
const filterState = api.getFilterModel();
|
|
11616
|
+
return {
|
|
11617
|
+
columnState,
|
|
11618
|
+
rowHeight,
|
|
11619
|
+
columnGroupState,
|
|
11620
|
+
rowGroupState,
|
|
11621
|
+
filterState
|
|
11536
11622
|
};
|
|
11537
|
-
return smartGridConfig;
|
|
11538
11623
|
}
|
|
11539
11624
|
function setSmartGridConfig(api, config) {
|
|
11540
11625
|
api.applyColumnState({
|
|
@@ -11549,7 +11634,7 @@ function setSmartGridConfig(api, config) {
|
|
|
11549
11634
|
}
|
|
11550
11635
|
}
|
|
11551
11636
|
|
|
11552
|
-
// src/
|
|
11637
|
+
// src/components/saved-views/SavedViewsUtils.ts
|
|
11553
11638
|
var customAndConfigSync = (viewTableConfig, defaultTableConfig) => {
|
|
11554
11639
|
if (!viewTableConfig && !defaultTableConfig)
|
|
11555
11640
|
return void 0;
|
|
@@ -11608,7 +11693,7 @@ var updateTableConfig = (view, tableApi, provider) => {
|
|
|
11608
11693
|
}
|
|
11609
11694
|
};
|
|
11610
11695
|
|
|
11611
|
-
// src/
|
|
11696
|
+
// src/components/panels/PanelContentUtils.ts
|
|
11612
11697
|
var getOrderedVisibleColumns = (columns, idKey) => {
|
|
11613
11698
|
if (!columns)
|
|
11614
11699
|
return [];
|
|
@@ -11703,7 +11788,7 @@ var hasPermissionForViewLevel = (viewLevel, permissions) => {
|
|
|
11703
11788
|
}
|
|
11704
11789
|
};
|
|
11705
11790
|
|
|
11706
|
-
// src/
|
|
11791
|
+
// src/components/panels/useGroups.ts
|
|
11707
11792
|
import { useState as useState2 } from "react";
|
|
11708
11793
|
var useGroups = () => {
|
|
11709
11794
|
const [groups, setGroups] = useState2(
|
|
@@ -11715,7 +11800,7 @@ var useGroups = () => {
|
|
|
11715
11800
|
return { groups, toggleGroup };
|
|
11716
11801
|
};
|
|
11717
11802
|
|
|
11718
|
-
// src/
|
|
11803
|
+
// src/components/panels/ViewLevelHeader.tsx
|
|
11719
11804
|
import {
|
|
11720
11805
|
colors,
|
|
11721
11806
|
Flex as Flex2,
|
|
@@ -11758,7 +11843,7 @@ var ViewLevelHeader = ({ expanded, toggleGroup, group }) => {
|
|
|
11758
11843
|
};
|
|
11759
11844
|
var ViewLevelHeader_default = ViewLevelHeader;
|
|
11760
11845
|
|
|
11761
|
-
// src/utils/
|
|
11846
|
+
// src/utils/hooks/useScrollToRef.ts
|
|
11762
11847
|
import { useEffect, useRef } from "react";
|
|
11763
11848
|
var useScrollToRef = (dependency) => {
|
|
11764
11849
|
const ref = useRef(null);
|
|
@@ -11770,7 +11855,13 @@ var useScrollToRef = (dependency) => {
|
|
|
11770
11855
|
return ref;
|
|
11771
11856
|
};
|
|
11772
11857
|
|
|
11773
|
-
// src/
|
|
11858
|
+
// src/components/panels/PanelContent.styles.ts
|
|
11859
|
+
import {
|
|
11860
|
+
colors as colors2,
|
|
11861
|
+
DetailPage,
|
|
11862
|
+
UNSAFE_Menu as MenuImperative,
|
|
11863
|
+
spacing as spacing2
|
|
11864
|
+
} from "@procore/core-react";
|
|
11774
11865
|
var Row = styled_components_esm_default(MenuImperative.Item)`
|
|
11775
11866
|
width: 100%;
|
|
11776
11867
|
padding-left: 35px;
|
|
@@ -11787,11 +11878,17 @@ var Panel2 = styled_components_esm_default(DetailPage.Card)`
|
|
|
11787
11878
|
padding-top: ${spacing2.sm}px;
|
|
11788
11879
|
box-shadow: none;
|
|
11789
11880
|
`;
|
|
11881
|
+
|
|
11882
|
+
// src/components/panels/PanelContent.tsx
|
|
11790
11883
|
var PanelContent = (props) => {
|
|
11884
|
+
const { queryInput, selectedSavedView, tableConfig } = props;
|
|
11791
11885
|
const { showToast } = useToastAlertContext2();
|
|
11792
11886
|
const I18n = useI18nContext5();
|
|
11793
|
-
const {
|
|
11794
|
-
const
|
|
11887
|
+
const { data: savedViewsFromQuery, error: savedViewsError } = useSavedViewsQuery(props.queryInput);
|
|
11888
|
+
const updateMutation = useUpdateSavedView(queryInput);
|
|
11889
|
+
const { mutate: updateSavedView } = updateMutation;
|
|
11890
|
+
const isUpdateLoading = "isPending" in updateMutation ? updateMutation.isPending : updateMutation.isLoading ?? false;
|
|
11891
|
+
const savedViews = props.savedViews ?? savedViewsFromQuery;
|
|
11795
11892
|
const errorToastRef = React17.useRef(null);
|
|
11796
11893
|
React17.useEffect(() => {
|
|
11797
11894
|
if (savedViewsError && savedViewsError !== errorToastRef.current) {
|
|
@@ -11800,12 +11897,16 @@ var PanelContent = (props) => {
|
|
|
11800
11897
|
}
|
|
11801
11898
|
}, [savedViewsError, showToast, I18n]);
|
|
11802
11899
|
const { data: permissions } = useSavedViewsPermissions(props.queryInput);
|
|
11803
|
-
const selectedRowRef = useScrollToRef(
|
|
11900
|
+
const selectedRowRef = useScrollToRef(savedViews);
|
|
11901
|
+
const { groups, toggleGroup } = useGroups();
|
|
11902
|
+
const isTemporarySelected = selectedSavedView?.id === "temporary";
|
|
11903
|
+
const temporaryView = savedViews?.find((view) => view.id === "temporary");
|
|
11904
|
+
const presetViews = props.presetViews || [props.defaultView];
|
|
11804
11905
|
const onUpdate = (data) => {
|
|
11805
11906
|
const newSavedView = {
|
|
11806
11907
|
...data,
|
|
11807
|
-
...
|
|
11808
|
-
table_config:
|
|
11908
|
+
...selectedSavedView,
|
|
11909
|
+
table_config: tableConfig
|
|
11809
11910
|
};
|
|
11810
11911
|
updateSavedView(newSavedView, {
|
|
11811
11912
|
onSuccess: () => {
|
|
@@ -11817,12 +11918,6 @@ var PanelContent = (props) => {
|
|
|
11817
11918
|
}
|
|
11818
11919
|
});
|
|
11819
11920
|
};
|
|
11820
|
-
const { groups, toggleGroup } = useGroups();
|
|
11821
|
-
const isDefaultSelected = props.selectedSavedView?.id === "default";
|
|
11822
|
-
const isTemporarySelected = props.selectedSavedView?.id === "temporary";
|
|
11823
|
-
const temporaryView = props.savedViews?.find(
|
|
11824
|
-
(view) => view.id === "temporary"
|
|
11825
|
-
);
|
|
11826
11921
|
return /* @__PURE__ */ React17.createElement(Panel2, { "data-testid": "inner-panel" }, /* @__PURE__ */ React17.createElement(Flex3, { direction: "column", style: { height: "100%", width: "100%" } }, temporaryView && /* @__PURE__ */ React17.createElement(
|
|
11827
11922
|
Row,
|
|
11828
11923
|
{
|
|
@@ -11838,23 +11933,27 @@ var PanelContent = (props) => {
|
|
|
11838
11933
|
onClearTemporary: props.onClearTemporary
|
|
11839
11934
|
}
|
|
11840
11935
|
)
|
|
11841
|
-
),
|
|
11842
|
-
|
|
11843
|
-
|
|
11844
|
-
|
|
11845
|
-
onClick: () => props.onSelect({ item: props.defaultView }),
|
|
11846
|
-
ref: isDefaultSelected ? selectedRowRef : null
|
|
11847
|
-
},
|
|
11848
|
-
/* @__PURE__ */ React17.createElement(
|
|
11849
|
-
SavedViewCollectionMenuItem,
|
|
11936
|
+
), presetViews.map((presetView) => {
|
|
11937
|
+
const isSelected = selectedSavedView?.id === presetView.id;
|
|
11938
|
+
return /* @__PURE__ */ React17.createElement(
|
|
11939
|
+
Row,
|
|
11850
11940
|
{
|
|
11851
|
-
|
|
11852
|
-
selected:
|
|
11853
|
-
|
|
11854
|
-
|
|
11855
|
-
|
|
11941
|
+
key: presetView.id,
|
|
11942
|
+
selected: isSelected,
|
|
11943
|
+
onClick: () => props.onSelect({ item: presetView }),
|
|
11944
|
+
ref: isSelected ? selectedRowRef : null
|
|
11945
|
+
},
|
|
11946
|
+
/* @__PURE__ */ React17.createElement(
|
|
11947
|
+
SavedViewCollectionMenuItem,
|
|
11948
|
+
{
|
|
11949
|
+
item: presetView,
|
|
11950
|
+
selected: isSelected
|
|
11951
|
+
}
|
|
11952
|
+
)
|
|
11953
|
+
);
|
|
11954
|
+
}), VIEW_LEVELS.map((level) => {
|
|
11856
11955
|
const isExpanded = groups[level];
|
|
11857
|
-
const views = isExpanded &&
|
|
11956
|
+
const views = isExpanded && savedViews ? savedViews.filter(
|
|
11858
11957
|
(view) => view.view_level === level && view.id !== "temporary"
|
|
11859
11958
|
) : [];
|
|
11860
11959
|
return /* @__PURE__ */ React17.createElement(React17.Fragment, { key: level }, /* @__PURE__ */ React17.createElement(
|
|
@@ -11865,10 +11964,10 @@ var PanelContent = (props) => {
|
|
|
11865
11964
|
expanded: isExpanded
|
|
11866
11965
|
}
|
|
11867
11966
|
), views.map((view) => {
|
|
11868
|
-
const isSelected =
|
|
11967
|
+
const isSelected = selectedSavedView?.id === view.id;
|
|
11869
11968
|
const canUpdate = isSelected && hasPermissionForViewLevel(view.view_level, permissions) && !isEqual(
|
|
11870
11969
|
view.table_config,
|
|
11871
|
-
|
|
11970
|
+
tableConfig,
|
|
11872
11971
|
props.defaultView.table_config,
|
|
11873
11972
|
props.provider
|
|
11874
11973
|
);
|
|
@@ -11904,67 +12003,7 @@ var PanelContent = (props) => {
|
|
|
11904
12003
|
})));
|
|
11905
12004
|
};
|
|
11906
12005
|
|
|
11907
|
-
// src/
|
|
11908
|
-
import React23, { useCallback as useCallback4 } from "react";
|
|
11909
|
-
|
|
11910
|
-
// src/SavedViews/components/SavedViews/SmartGrid/SmartGridDefaultSavedView.tsx
|
|
11911
|
-
import { useI18nContext as useI18nContext6 } from "@procore/core-react";
|
|
11912
|
-
var useDefaultViewName = (domain, defaultViewName) => {
|
|
11913
|
-
const i18n = useI18nContext6();
|
|
11914
|
-
return defaultViewName || i18n.t(domain, {
|
|
11915
|
-
scope: "savedViews.defaultViewTitle",
|
|
11916
|
-
defaultValue: "Default View"
|
|
11917
|
-
});
|
|
11918
|
-
};
|
|
11919
|
-
var useDefaultView = (props) => {
|
|
11920
|
-
const name = useDefaultViewName(props.domain, props.defaultViewName);
|
|
11921
|
-
return {
|
|
11922
|
-
id: "default",
|
|
11923
|
-
view_level: "default",
|
|
11924
|
-
name,
|
|
11925
|
-
table_config: {}
|
|
11926
|
-
};
|
|
11927
|
-
};
|
|
11928
|
-
|
|
11929
|
-
// src/SavedViews/components/SavedViews/SmartGrid/useSmartGridConfig.ts
|
|
11930
|
-
import { useState as useState3, useEffect as useEffect2 } from "react";
|
|
11931
|
-
var GRID_STATE_EVENTS = [
|
|
11932
|
-
"sortChanged",
|
|
11933
|
-
"filterOpened",
|
|
11934
|
-
"filterChanged",
|
|
11935
|
-
"columnRowGroupChanged",
|
|
11936
|
-
"dragStopped",
|
|
11937
|
-
"columnResized",
|
|
11938
|
-
"columnVisible",
|
|
11939
|
-
"columnPinned",
|
|
11940
|
-
"columnMoved",
|
|
11941
|
-
"modelUpdated",
|
|
11942
|
-
"gridColumnsChanged",
|
|
11943
|
-
"gridReady"
|
|
11944
|
-
];
|
|
11945
|
-
var useSmartGridConfig = (gridApi) => {
|
|
11946
|
-
const [config, setConfig] = useState3(
|
|
11947
|
-
() => getSmartGridConfig(gridApi)
|
|
11948
|
-
);
|
|
11949
|
-
useEffect2(() => {
|
|
11950
|
-
if (!gridApi)
|
|
11951
|
-
return;
|
|
11952
|
-
const updateConfig = () => {
|
|
11953
|
-
setConfig(getSmartGridConfig(gridApi));
|
|
11954
|
-
};
|
|
11955
|
-
GRID_STATE_EVENTS.forEach((event) => {
|
|
11956
|
-
gridApi.addEventListener(event, updateConfig);
|
|
11957
|
-
});
|
|
11958
|
-
return () => {
|
|
11959
|
-
GRID_STATE_EVENTS.forEach((event) => {
|
|
11960
|
-
gridApi.removeEventListener(event, updateConfig);
|
|
11961
|
-
});
|
|
11962
|
-
};
|
|
11963
|
-
}, [gridApi]);
|
|
11964
|
-
return { config, setConfig };
|
|
11965
|
-
};
|
|
11966
|
-
|
|
11967
|
-
// src/SavedViews/components/SavedViews/SavedViews.tsx
|
|
12006
|
+
// src/components/saved-views/SavedViews.tsx
|
|
11968
12007
|
import {
|
|
11969
12008
|
Box as Box2,
|
|
11970
12009
|
Button as Button6,
|
|
@@ -11973,16 +12012,17 @@ import {
|
|
|
11973
12012
|
Tooltip,
|
|
11974
12013
|
useI18nContext as useI18nContext11
|
|
11975
12014
|
} from "@procore/core-react";
|
|
11976
|
-
import React22, { useState as
|
|
12015
|
+
import React22, { useState as useState4, useEffect as useEffect3, useCallback as useCallback3 } from "react";
|
|
11977
12016
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
12017
|
+
import { useToastAlertContext as useToastAlertContext3, ToastAlertProvider } from "@procore/toast-alert";
|
|
11978
12018
|
|
|
11979
|
-
// src/
|
|
12019
|
+
// src/components/modals/DeleteConfirmationModal.tsx
|
|
11980
12020
|
import {
|
|
11981
12021
|
Button as Button3,
|
|
11982
12022
|
ConfirmModal,
|
|
11983
12023
|
Modal,
|
|
11984
12024
|
P as P2,
|
|
11985
|
-
useI18nContext as
|
|
12025
|
+
useI18nContext as useI18nContext6
|
|
11986
12026
|
} from "@procore/core-react";
|
|
11987
12027
|
import React18 from "react";
|
|
11988
12028
|
var SavedViewsDeleteConfirmationModalShared = ({
|
|
@@ -11990,7 +12030,7 @@ var SavedViewsDeleteConfirmationModalShared = ({
|
|
|
11990
12030
|
onDelete,
|
|
11991
12031
|
open
|
|
11992
12032
|
}) => {
|
|
11993
|
-
const i18n =
|
|
12033
|
+
const i18n = useI18nContext6();
|
|
11994
12034
|
return /* @__PURE__ */ React18.createElement(
|
|
11995
12035
|
ConfirmModal,
|
|
11996
12036
|
{
|
|
@@ -12006,10 +12046,10 @@ var SavedViewsDeleteConfirmationModalShared = ({
|
|
|
12006
12046
|
);
|
|
12007
12047
|
};
|
|
12008
12048
|
|
|
12009
|
-
// src/
|
|
12049
|
+
// src/components/modals/form-modal/FormModal.tsx
|
|
12010
12050
|
import React20 from "react";
|
|
12011
12051
|
|
|
12012
|
-
// src/
|
|
12052
|
+
// src/components/modals/form-modal/FormModalBase.tsx
|
|
12013
12053
|
import {
|
|
12014
12054
|
Banner,
|
|
12015
12055
|
Button as Button4,
|
|
@@ -12021,7 +12061,7 @@ import {
|
|
|
12021
12061
|
Modal as Modal2,
|
|
12022
12062
|
spacing as spacing3,
|
|
12023
12063
|
Typography as Typography2,
|
|
12024
|
-
useI18nContext as
|
|
12064
|
+
useI18nContext as useI18nContext7
|
|
12025
12065
|
} from "@procore/core-react";
|
|
12026
12066
|
import * as React19 from "react";
|
|
12027
12067
|
|
|
@@ -14317,7 +14357,7 @@ var TupleSchema = class extends Schema {
|
|
|
14317
14357
|
};
|
|
14318
14358
|
create$1.prototype = TupleSchema.prototype;
|
|
14319
14359
|
|
|
14320
|
-
// src/
|
|
14360
|
+
// src/components/modals/form-modal/FormModalBaseUtils.ts
|
|
14321
14361
|
var getViewLevelOptions = (permissions, i18n) => {
|
|
14322
14362
|
const options = ["personal"];
|
|
14323
14363
|
if (permissions?.can_create_project_saved_views)
|
|
@@ -14350,11 +14390,11 @@ function extractMessage(error, I18n) {
|
|
|
14350
14390
|
return { form: I18n.t("savedViews.modal.errors.unknown") };
|
|
14351
14391
|
}
|
|
14352
14392
|
|
|
14353
|
-
// src/
|
|
14393
|
+
// src/components/modals/form-modal/FormModalBase.tsx
|
|
14354
14394
|
var ScrollContainer = styled_components_esm_default("div")`
|
|
14355
14395
|
overflow: auto;
|
|
14356
14396
|
`;
|
|
14357
|
-
var
|
|
14397
|
+
var FormModalBase = ({
|
|
14358
14398
|
open,
|
|
14359
14399
|
mode,
|
|
14360
14400
|
onCancel,
|
|
@@ -14369,7 +14409,7 @@ var SavedViewsCreateUpdateModalBase = ({
|
|
|
14369
14409
|
setOpenEditCreateModal,
|
|
14370
14410
|
onSelect
|
|
14371
14411
|
}) => {
|
|
14372
|
-
const I18n =
|
|
14412
|
+
const I18n = useI18nContext7();
|
|
14373
14413
|
const NAME_MAX_LENGTH = 150;
|
|
14374
14414
|
const {
|
|
14375
14415
|
mutate: createSavedView,
|
|
@@ -14524,9 +14564,9 @@ var SavedViewsCreateUpdateModalBase = ({
|
|
|
14524
14564
|
);
|
|
14525
14565
|
};
|
|
14526
14566
|
|
|
14527
|
-
// src/
|
|
14528
|
-
import { useI18nContext as
|
|
14529
|
-
var
|
|
14567
|
+
// src/components/modals/form-modal/FormModal.tsx
|
|
14568
|
+
import { useI18nContext as useI18nContext8 } from "@procore/core-react";
|
|
14569
|
+
var FormModal = ({
|
|
14530
14570
|
open,
|
|
14531
14571
|
mode,
|
|
14532
14572
|
onCancel,
|
|
@@ -14538,9 +14578,9 @@ var SavedViewsFormModal = ({
|
|
|
14538
14578
|
onSelect,
|
|
14539
14579
|
defaultView
|
|
14540
14580
|
}) => {
|
|
14541
|
-
const i18n =
|
|
14581
|
+
const i18n = useI18nContext8();
|
|
14542
14582
|
return /* @__PURE__ */ React20.createElement(
|
|
14543
|
-
|
|
14583
|
+
FormModalBase,
|
|
14544
14584
|
{
|
|
14545
14585
|
open,
|
|
14546
14586
|
mode,
|
|
@@ -14559,7 +14599,7 @@ var SavedViewsFormModal = ({
|
|
|
14559
14599
|
);
|
|
14560
14600
|
};
|
|
14561
14601
|
|
|
14562
|
-
// src/
|
|
14602
|
+
// src/components/modals/form-modal/SharedViewFormModal.tsx
|
|
14563
14603
|
import {
|
|
14564
14604
|
Banner as Banner2,
|
|
14565
14605
|
Button as Button5,
|
|
@@ -14571,7 +14611,7 @@ import {
|
|
|
14571
14611
|
P as P3,
|
|
14572
14612
|
spacing as spacing4,
|
|
14573
14613
|
Typography as Typography3,
|
|
14574
|
-
useI18nContext as
|
|
14614
|
+
useI18nContext as useI18nContext9
|
|
14575
14615
|
} from "@procore/core-react";
|
|
14576
14616
|
import * as React21 from "react";
|
|
14577
14617
|
var SharedViewFormModal = ({
|
|
@@ -14584,7 +14624,7 @@ var SharedViewFormModal = ({
|
|
|
14584
14624
|
isCreating,
|
|
14585
14625
|
resetCreateError
|
|
14586
14626
|
}) => {
|
|
14587
|
-
const I18n =
|
|
14627
|
+
const I18n = useI18nContext9();
|
|
14588
14628
|
const NAME_MAX_LENGTH = 150;
|
|
14589
14629
|
const errors = extractMessage(createError, I18n);
|
|
14590
14630
|
const handleNameChange = () => {
|
|
@@ -14713,21 +14753,28 @@ var SharedViewFormModal = ({
|
|
|
14713
14753
|
);
|
|
14714
14754
|
};
|
|
14715
14755
|
|
|
14716
|
-
// src/utils/
|
|
14717
|
-
import { useState as
|
|
14756
|
+
// src/utils/hooks/useViewSelection.ts
|
|
14757
|
+
import { useState as useState3, useCallback as useCallback2, useEffect as useEffect2, useRef as useRef2, useMemo } from "react";
|
|
14718
14758
|
import { useSearchParams } from "react-router-dom";
|
|
14759
|
+
import { useI18nContext as useI18nContext10 } from "@procore/core-react";
|
|
14719
14760
|
|
|
14720
14761
|
// src/utils/viewStorage.ts
|
|
14721
14762
|
var ViewStorage = {
|
|
14722
14763
|
save(key, view) {
|
|
14723
14764
|
localStorage.setItem(key, JSON.stringify(view));
|
|
14724
14765
|
},
|
|
14725
|
-
load(key) {
|
|
14766
|
+
load(key, defaultView) {
|
|
14726
14767
|
try {
|
|
14727
14768
|
const stored = localStorage.getItem(key);
|
|
14728
|
-
|
|
14729
|
-
|
|
14730
|
-
|
|
14769
|
+
if (!stored)
|
|
14770
|
+
return defaultView;
|
|
14771
|
+
const parsed = JSON.parse(stored);
|
|
14772
|
+
if (!parsed)
|
|
14773
|
+
return defaultView;
|
|
14774
|
+
const isTableConfigOnly = !parsed.id && !parsed.share_token;
|
|
14775
|
+
return isTableConfigOnly ? { ...defaultView, table_config: parsed } : parsed;
|
|
14776
|
+
} catch {
|
|
14777
|
+
return defaultView;
|
|
14731
14778
|
}
|
|
14732
14779
|
},
|
|
14733
14780
|
remove(key) {
|
|
@@ -14735,7 +14782,7 @@ var ViewStorage = {
|
|
|
14735
14782
|
}
|
|
14736
14783
|
};
|
|
14737
14784
|
|
|
14738
|
-
// src/utils/
|
|
14785
|
+
// src/utils/hooks/useViewSelection.ts
|
|
14739
14786
|
var getUpdatedSearchParams = (currentParams, view) => {
|
|
14740
14787
|
const updatedParams = new URLSearchParams(currentParams);
|
|
14741
14788
|
if (view.id === "default") {
|
|
@@ -14750,55 +14797,72 @@ var getUpdatedSearchParams = (currentParams, view) => {
|
|
|
14750
14797
|
var checkIsViewSelected = (selectedView, viewId) => {
|
|
14751
14798
|
return selectedView?.share_token === viewId || selectedView?.id === viewId;
|
|
14752
14799
|
};
|
|
14753
|
-
var
|
|
14754
|
-
|
|
14755
|
-
|
|
14800
|
+
var findViewByToken = (views, token) => {
|
|
14801
|
+
return views.find((view) => view.share_token === token);
|
|
14802
|
+
};
|
|
14803
|
+
var setViewInUrl = (view, setSearchParams) => {
|
|
14804
|
+
setSearchParams(
|
|
14805
|
+
(currentParams) => getUpdatedSearchParams(currentParams, view),
|
|
14806
|
+
{ replace: true }
|
|
14807
|
+
);
|
|
14808
|
+
};
|
|
14809
|
+
var restoreUrlParameter = (currentParam, previousParam, setSearchParams) => {
|
|
14810
|
+
if (previousParam && !currentParam) {
|
|
14811
|
+
setSearchParams(
|
|
14812
|
+
(currentParams) => {
|
|
14813
|
+
const updatedParams = new URLSearchParams(currentParams);
|
|
14814
|
+
updatedParams.set("saved-view", previousParam);
|
|
14815
|
+
return updatedParams;
|
|
14816
|
+
},
|
|
14817
|
+
{ replace: true }
|
|
14818
|
+
);
|
|
14819
|
+
}
|
|
14820
|
+
};
|
|
14821
|
+
var useViewSelection = (config, savedViews, presetViews, openSharedViewModal) => {
|
|
14822
|
+
const I18n = useI18nContext10();
|
|
14823
|
+
const storageKey = `savedView_${config.domain}_${config.tableName}_${config.companyId}_${config.projectId}_${config.userId}`;
|
|
14824
|
+
const temporaryStorageKey = `${storageKey}-temporary`;
|
|
14756
14825
|
const [searchParams, setSearchParams] = useSearchParams();
|
|
14757
14826
|
const previousSavedViewParamRef = useRef2(null);
|
|
14758
|
-
const [selectedSavedView, setSelectedSavedView] =
|
|
14759
|
-
const stored = ViewStorage.load(storageKey);
|
|
14827
|
+
const [selectedSavedView, setSelectedSavedView] = useState3(() => {
|
|
14828
|
+
const stored = ViewStorage.load(storageKey, config.defaultView);
|
|
14760
14829
|
return stored ?? config.defaultView;
|
|
14761
14830
|
});
|
|
14762
|
-
const [temporaryView, setTemporaryView] =
|
|
14763
|
-
|
|
14831
|
+
const [temporaryView, setTemporaryView] = useState3(() => {
|
|
14832
|
+
const loaded = ViewStorage.load(temporaryStorageKey, config.defaultView);
|
|
14833
|
+
return loaded && (loaded.id === "temporary" || loaded.view_level === "temporary") ? loaded : null;
|
|
14764
14834
|
});
|
|
14765
|
-
const
|
|
14835
|
+
const persistViewToStorageAndUrl = useCallback2(
|
|
14766
14836
|
(view) => {
|
|
14767
|
-
|
|
14768
|
-
|
|
14769
|
-
}
|
|
14837
|
+
ViewStorage.save(storageKey, view);
|
|
14838
|
+
setViewInUrl(view, setSearchParams);
|
|
14770
14839
|
},
|
|
14771
|
-
[
|
|
14840
|
+
[storageKey, setSearchParams]
|
|
14772
14841
|
);
|
|
14773
|
-
const
|
|
14774
|
-
(
|
|
14775
|
-
|
|
14776
|
-
|
|
14777
|
-
|
|
14778
|
-
|
|
14779
|
-
|
|
14780
|
-
);
|
|
14781
|
-
},
|
|
14782
|
-
[setSearchParams]
|
|
14842
|
+
const baseViews = useMemo(
|
|
14843
|
+
() => [...savedViews ?? [], ...presetViews ?? []],
|
|
14844
|
+
[savedViews, presetViews]
|
|
14845
|
+
);
|
|
14846
|
+
const allViews = useMemo(
|
|
14847
|
+
() => temporaryView ? [...baseViews, temporaryView] : baseViews,
|
|
14848
|
+
[baseViews, temporaryView]
|
|
14783
14849
|
);
|
|
14784
|
-
const baseViews = savedViews ?? [];
|
|
14785
|
-
const allViews = temporaryView ? [...baseViews, temporaryView] : baseViews;
|
|
14786
14850
|
const selectView = useCallback2(
|
|
14787
14851
|
(view) => {
|
|
14788
14852
|
const viewToSelect = config.onSelect({ item: view });
|
|
14789
14853
|
setSelectedSavedView(viewToSelect);
|
|
14790
|
-
|
|
14791
|
-
updateUrlForView(viewToSelect);
|
|
14854
|
+
persistViewToStorageAndUrl(viewToSelect);
|
|
14792
14855
|
return viewToSelect;
|
|
14793
14856
|
},
|
|
14794
|
-
[config,
|
|
14857
|
+
[config, persistViewToStorageAndUrl]
|
|
14795
14858
|
);
|
|
14796
14859
|
const createTemporaryView = useCallback2(
|
|
14797
14860
|
(fetchedView) => {
|
|
14798
14861
|
const tempView = {
|
|
14799
14862
|
...fetchedView,
|
|
14800
14863
|
id: "temporary",
|
|
14801
|
-
name: "
|
|
14864
|
+
name: I18n.t("savedViews.temporaryViewName"),
|
|
14865
|
+
view_level: "temporary"
|
|
14802
14866
|
};
|
|
14803
14867
|
ViewStorage.save(temporaryStorageKey, tempView);
|
|
14804
14868
|
setTemporaryView(tempView);
|
|
@@ -14821,7 +14885,7 @@ var useViewSelection = (config, savedViews, openSharedViewModal) => {
|
|
|
14821
14885
|
if (isViewAlreadySelected(viewId)) {
|
|
14822
14886
|
return;
|
|
14823
14887
|
}
|
|
14824
|
-
const viewInList = allViews
|
|
14888
|
+
const viewInList = findViewByToken(allViews, viewId);
|
|
14825
14889
|
if (viewInList) {
|
|
14826
14890
|
selectView(viewInList);
|
|
14827
14891
|
} else {
|
|
@@ -14830,36 +14894,20 @@ var useViewSelection = (config, savedViews, openSharedViewModal) => {
|
|
|
14830
14894
|
},
|
|
14831
14895
|
[isViewAlreadySelected, openSharedViewModal, allViews, selectView]
|
|
14832
14896
|
);
|
|
14833
|
-
|
|
14834
|
-
if (!allViews.length)
|
|
14835
|
-
return;
|
|
14897
|
+
useEffect2(() => {
|
|
14836
14898
|
const savedViewId = searchParams.get("saved-view");
|
|
14899
|
+
restoreUrlParameter(
|
|
14900
|
+
savedViewId,
|
|
14901
|
+
previousSavedViewParamRef.current,
|
|
14902
|
+
setSearchParams
|
|
14903
|
+
);
|
|
14837
14904
|
if (savedViewId) {
|
|
14838
|
-
|
|
14839
|
-
}
|
|
14840
|
-
}, [
|
|
14841
|
-
searchParams.get("saved-view"),
|
|
14842
|
-
savedViews,
|
|
14843
|
-
temporaryView,
|
|
14844
|
-
handleSavedViewFromUrl,
|
|
14845
|
-
allViews.length
|
|
14846
|
-
]);
|
|
14847
|
-
useEffect3(() => {
|
|
14848
|
-
const currentSavedViewParam = searchParams.get("saved-view");
|
|
14849
|
-
if (previousSavedViewParamRef.current && !currentSavedViewParam) {
|
|
14850
|
-
setSearchParams(
|
|
14851
|
-
(currentParams) => {
|
|
14852
|
-
const updatedParams = new URLSearchParams(currentParams);
|
|
14853
|
-
updatedParams.set("saved-view", previousSavedViewParamRef.current);
|
|
14854
|
-
return updatedParams;
|
|
14855
|
-
},
|
|
14856
|
-
{ replace: true }
|
|
14857
|
-
);
|
|
14905
|
+
previousSavedViewParamRef.current = savedViewId;
|
|
14858
14906
|
}
|
|
14859
|
-
if (
|
|
14860
|
-
|
|
14907
|
+
if (savedViewId && allViews.length > 0) {
|
|
14908
|
+
handleSavedViewFromUrl(savedViewId);
|
|
14861
14909
|
}
|
|
14862
|
-
}, [searchParams
|
|
14910
|
+
}, [searchParams, handleSavedViewFromUrl, allViews.length]);
|
|
14863
14911
|
return {
|
|
14864
14912
|
selectedView: selectedSavedView,
|
|
14865
14913
|
selectView,
|
|
@@ -14870,7 +14918,7 @@ var useViewSelection = (config, savedViews, openSharedViewModal) => {
|
|
|
14870
14918
|
};
|
|
14871
14919
|
};
|
|
14872
14920
|
|
|
14873
|
-
// src/
|
|
14921
|
+
// src/components/saved-views/SavedViews.tsx
|
|
14874
14922
|
var StyledPanel = styled_components_esm_default.div`
|
|
14875
14923
|
border: ${({ provider }) => provider === "data-table" ? "1px solid #d6dadc" : "none"};
|
|
14876
14924
|
`;
|
|
@@ -14885,8 +14933,10 @@ var SavedViewsContent = (props) => {
|
|
|
14885
14933
|
};
|
|
14886
14934
|
const { data: savedViews } = useSavedViewsQuery(queryInput);
|
|
14887
14935
|
const { mutate: deleteSavedView } = useDeleteSavedView(queryInput);
|
|
14888
|
-
const
|
|
14889
|
-
const
|
|
14936
|
+
const { showToast } = useToastAlertContext3();
|
|
14937
|
+
const i18n = useI18nContext11();
|
|
14938
|
+
const [activeModal, setActiveModal] = useState4(null);
|
|
14939
|
+
const [modalData, setModalData] = useState4(null);
|
|
14890
14940
|
const openModal = (type, data) => {
|
|
14891
14941
|
setActiveModal(type);
|
|
14892
14942
|
setModalData(data ?? null);
|
|
@@ -14909,13 +14959,14 @@ var SavedViewsContent = (props) => {
|
|
|
14909
14959
|
{
|
|
14910
14960
|
domain: props.domain,
|
|
14911
14961
|
tableName: props.tableName,
|
|
14912
|
-
stickyViewsKey: props.stickyViewsKey,
|
|
14913
14962
|
userId: props.userId,
|
|
14914
14963
|
projectId,
|
|
14964
|
+
companyId,
|
|
14915
14965
|
defaultView: props.defaultView,
|
|
14916
14966
|
onSelect: props.onSelect
|
|
14917
14967
|
},
|
|
14918
14968
|
savedViews,
|
|
14969
|
+
props.presetViews,
|
|
14919
14970
|
openSharedViewModal
|
|
14920
14971
|
);
|
|
14921
14972
|
const { data: fetchedView, isError: fetchError } = useFetchSavedViewById(
|
|
@@ -14929,8 +14980,9 @@ var SavedViewsContent = (props) => {
|
|
|
14929
14980
|
error: createError,
|
|
14930
14981
|
reset: resetCreateError
|
|
14931
14982
|
} = useCreateSavedView(queryInput);
|
|
14932
|
-
|
|
14983
|
+
useEffect3(() => {
|
|
14933
14984
|
if (fetchError) {
|
|
14985
|
+
showToast.error(i18n.t("savedViews.errors.notFound"));
|
|
14934
14986
|
selectView(selectedView ?? props.defaultView);
|
|
14935
14987
|
closeModal();
|
|
14936
14988
|
}
|
|
@@ -14954,6 +15006,7 @@ var SavedViewsContent = (props) => {
|
|
|
14954
15006
|
};
|
|
14955
15007
|
createSavedView(viewToCreate, {
|
|
14956
15008
|
onSuccess: (newView) => {
|
|
15009
|
+
showToast.success(i18n.t("savedViews.create.success"));
|
|
14957
15010
|
selectView(newView);
|
|
14958
15011
|
closeModal();
|
|
14959
15012
|
}
|
|
@@ -14975,7 +15028,6 @@ var SavedViewsContent = (props) => {
|
|
|
14975
15028
|
deleteSelectedView();
|
|
14976
15029
|
closeModal();
|
|
14977
15030
|
};
|
|
14978
|
-
const i18n = useI18nContext11();
|
|
14979
15031
|
return /* @__PURE__ */ React22.createElement(StyledPanel, { provider: props.provider }, /* @__PURE__ */ React22.createElement(
|
|
14980
15032
|
ExpandedPanel,
|
|
14981
15033
|
{
|
|
@@ -15010,7 +15062,7 @@ var SavedViewsContent = (props) => {
|
|
|
15010
15062
|
selectedSavedView: selectedView,
|
|
15011
15063
|
tableConfig: props.tableConfig,
|
|
15012
15064
|
defaultView: props.defaultView,
|
|
15013
|
-
|
|
15065
|
+
presetViews: props.presetViews,
|
|
15014
15066
|
savedViews: allViews,
|
|
15015
15067
|
provider: props.provider,
|
|
15016
15068
|
userId: props.userId,
|
|
@@ -15018,7 +15070,7 @@ var SavedViewsContent = (props) => {
|
|
|
15018
15070
|
}
|
|
15019
15071
|
))
|
|
15020
15072
|
), (isModalOpen("create" /* CREATE */) || isModalOpen("update" /* UPDATE */)) && /* @__PURE__ */ React22.createElement(
|
|
15021
|
-
|
|
15073
|
+
FormModal,
|
|
15022
15074
|
{
|
|
15023
15075
|
open: true,
|
|
15024
15076
|
mode: activeModal,
|
|
@@ -15053,31 +15105,124 @@ var SavedViewsContent = (props) => {
|
|
|
15053
15105
|
));
|
|
15054
15106
|
};
|
|
15055
15107
|
var SavedViews = (props) => {
|
|
15056
|
-
return /* @__PURE__ */ React22.createElement(EnvironmentI18nProvider, null, /* @__PURE__ */ React22.createElement(QueryClientProvider, { client: queryClient }, /* @__PURE__ */ React22.createElement(SavedViewsContent, { ...props })));
|
|
15108
|
+
return /* @__PURE__ */ React22.createElement(EnvironmentI18nProvider, null, /* @__PURE__ */ React22.createElement(QueryClientProvider, { client: queryClient }, /* @__PURE__ */ React22.createElement(ToastAlertProvider, null, /* @__PURE__ */ React22.createElement(SavedViewsContent, { ...props }))));
|
|
15057
15109
|
};
|
|
15058
15110
|
|
|
15059
|
-
// src/
|
|
15060
|
-
import {
|
|
15061
|
-
|
|
15062
|
-
|
|
15111
|
+
// src/components/adapters/smart-grid/SmartGridSavedViews.tsx
|
|
15112
|
+
import React23, { useCallback as useCallback4 } from "react";
|
|
15113
|
+
|
|
15114
|
+
// src/components/adapters/smart-grid/SmartGridDefaultSavedView.tsx
|
|
15115
|
+
import { useMemo as useMemo2 } from "react";
|
|
15116
|
+
var DEFAULT_COLUMN_STATE = {
|
|
15117
|
+
hide: false,
|
|
15118
|
+
pinned: null,
|
|
15119
|
+
width: 200,
|
|
15120
|
+
sort: null,
|
|
15121
|
+
sortIndex: null,
|
|
15122
|
+
pivot: false,
|
|
15123
|
+
pivotIndex: null,
|
|
15124
|
+
aggFunc: null,
|
|
15125
|
+
rowGroup: false,
|
|
15126
|
+
rowGroupIndex: null,
|
|
15127
|
+
flex: null
|
|
15128
|
+
};
|
|
15129
|
+
var getColumnStateFromDefs = (columnDefs) => {
|
|
15130
|
+
return columnDefs.map((colDef) => {
|
|
15131
|
+
const field = colDef.field ?? colDef.colId;
|
|
15132
|
+
if (!field)
|
|
15133
|
+
return null;
|
|
15134
|
+
return {
|
|
15135
|
+
colId: field,
|
|
15136
|
+
hide: colDef.hide ?? false,
|
|
15137
|
+
pinned: colDef.pinned ?? null,
|
|
15138
|
+
width: colDef.width ?? colDef.minWidth ?? DEFAULT_COLUMN_STATE.width,
|
|
15139
|
+
sort: null,
|
|
15140
|
+
sortIndex: null,
|
|
15141
|
+
pivot: false,
|
|
15142
|
+
pivotIndex: null,
|
|
15143
|
+
aggFunc: null,
|
|
15144
|
+
rowGroup: false,
|
|
15145
|
+
rowGroupIndex: null,
|
|
15146
|
+
flex: colDef.flex ?? null
|
|
15147
|
+
};
|
|
15148
|
+
}).filter((col) => col !== null);
|
|
15149
|
+
};
|
|
15150
|
+
var extractDefaultView = (gridApi, receivedConfig) => {
|
|
15151
|
+
const columnDefs = gridApi.getColumnDefs() ?? [];
|
|
15152
|
+
const defaultColumnState = receivedConfig?.columnState?.length ? receivedConfig.columnState : getColumnStateFromDefs(columnDefs);
|
|
15153
|
+
const result = {
|
|
15154
|
+
columnState: defaultColumnState,
|
|
15155
|
+
columnGroupState: receivedConfig?.columnGroupState ?? [],
|
|
15156
|
+
rowGroupState: receivedConfig?.rowGroupState ?? [],
|
|
15157
|
+
filterState: receivedConfig?.filterState ?? {},
|
|
15158
|
+
rowHeight: receivedConfig?.rowHeight ?? gridApi.getSizesForCurrentTheme()?.rowHeight
|
|
15159
|
+
};
|
|
15160
|
+
return result;
|
|
15161
|
+
};
|
|
15162
|
+
var useNormalizedDefaultViews = (defaultViews, gridApi) => {
|
|
15163
|
+
return useMemo2(() => {
|
|
15164
|
+
if (!gridApi)
|
|
15165
|
+
return defaultViews.map((view) => ({ ...view, share_token: view.id }));
|
|
15166
|
+
return defaultViews.map((view) => ({
|
|
15167
|
+
...view,
|
|
15168
|
+
share_token: view.id,
|
|
15169
|
+
table_config: extractDefaultView(gridApi, view.table_config)
|
|
15170
|
+
}));
|
|
15171
|
+
}, [defaultViews, gridApi]);
|
|
15063
15172
|
};
|
|
15173
|
+
|
|
15174
|
+
// src/components/adapters/smart-grid/useSmartGridConfig.ts
|
|
15175
|
+
import { useState as useState5, useEffect as useEffect4 } from "react";
|
|
15176
|
+
var GRID_STATE_EVENTS = [
|
|
15177
|
+
"sortChanged",
|
|
15178
|
+
"filterOpened",
|
|
15179
|
+
"filterChanged",
|
|
15180
|
+
"columnRowGroupChanged",
|
|
15181
|
+
"dragStopped",
|
|
15182
|
+
"columnResized",
|
|
15183
|
+
"columnVisible",
|
|
15184
|
+
"columnPinned",
|
|
15185
|
+
"columnMoved",
|
|
15186
|
+
"modelUpdated",
|
|
15187
|
+
"gridColumnsChanged",
|
|
15188
|
+
"gridReady"
|
|
15189
|
+
];
|
|
15190
|
+
var useSmartGridConfig = (gridApi) => {
|
|
15191
|
+
const [config, setConfig] = useState5(
|
|
15192
|
+
() => getSmartGridConfig(gridApi)
|
|
15193
|
+
);
|
|
15194
|
+
useEffect4(() => {
|
|
15195
|
+
if (!gridApi)
|
|
15196
|
+
return;
|
|
15197
|
+
const updateConfig = () => {
|
|
15198
|
+
setConfig(getSmartGridConfig(gridApi));
|
|
15199
|
+
};
|
|
15200
|
+
GRID_STATE_EVENTS.forEach((event) => {
|
|
15201
|
+
gridApi.addEventListener(event, updateConfig);
|
|
15202
|
+
});
|
|
15203
|
+
return () => {
|
|
15204
|
+
GRID_STATE_EVENTS.forEach((event) => {
|
|
15205
|
+
gridApi.removeEventListener(event, updateConfig);
|
|
15206
|
+
});
|
|
15207
|
+
};
|
|
15208
|
+
}, [gridApi]);
|
|
15209
|
+
return { config, setConfig };
|
|
15210
|
+
};
|
|
15211
|
+
|
|
15212
|
+
// src/components/adapters/smart-grid/SmartGridSavedViews.tsx
|
|
15064
15213
|
var SmartGridSavedViews = (props) => {
|
|
15065
15214
|
const { gridApi, userId, projectId, companyId } = props;
|
|
15066
15215
|
const { config: tableConfig, setConfig: setTableConfig } = useSmartGridConfig(gridApi);
|
|
15067
|
-
const
|
|
15068
|
-
|
|
15069
|
-
domain: props.domain
|
|
15070
|
-
});
|
|
15216
|
+
const presetViews = useNormalizedDefaultViews(props.defaultViews, gridApi);
|
|
15217
|
+
const defaultView = presetViews.find((view) => view.id === "default") ?? presetViews[0];
|
|
15071
15218
|
const onSelect = useCallback4(
|
|
15072
15219
|
({ item }) => {
|
|
15073
15220
|
if (!gridApi)
|
|
15074
15221
|
return item;
|
|
15075
|
-
|
|
15076
|
-
|
|
15077
|
-
gridApi
|
|
15078
|
-
|
|
15079
|
-
gridApi.setGridOption("rowHeight", props.defaultRowHeight);
|
|
15080
|
-
gridApi.refreshCells();
|
|
15222
|
+
const isPresetView = item.view_level === "default";
|
|
15223
|
+
if (isPresetView) {
|
|
15224
|
+
updateTableConfig(item, gridApi, "smart-grid");
|
|
15225
|
+
setTableConfig(item.table_config);
|
|
15081
15226
|
return item;
|
|
15082
15227
|
}
|
|
15083
15228
|
const updatedView = {
|
|
@@ -15091,22 +15236,9 @@ var SmartGridSavedViews = (props) => {
|
|
|
15091
15236
|
setTableConfig(updatedView.table_config);
|
|
15092
15237
|
return updatedView;
|
|
15093
15238
|
},
|
|
15094
|
-
[
|
|
15095
|
-
gridApi,
|
|
15096
|
-
props.defaultViewFilters,
|
|
15097
|
-
props.defaultRowHeight,
|
|
15098
|
-
tableConfig,
|
|
15099
|
-
setTableConfig
|
|
15100
|
-
]
|
|
15101
|
-
);
|
|
15102
|
-
const stickyViewsKey = generateStickyViewsKey(
|
|
15103
|
-
props.domain,
|
|
15104
|
-
props.tableName,
|
|
15105
|
-
userId,
|
|
15106
|
-
projectId,
|
|
15107
|
-
companyId
|
|
15239
|
+
[gridApi, tableConfig, setTableConfig]
|
|
15108
15240
|
);
|
|
15109
|
-
return /* @__PURE__ */ React23.createElement(
|
|
15241
|
+
return /* @__PURE__ */ React23.createElement(
|
|
15110
15242
|
SavedViews,
|
|
15111
15243
|
{
|
|
15112
15244
|
onSelect,
|
|
@@ -15116,14 +15248,14 @@ var SmartGridSavedViews = (props) => {
|
|
|
15116
15248
|
companyId,
|
|
15117
15249
|
provider: "smart-grid",
|
|
15118
15250
|
defaultView,
|
|
15251
|
+
presetViews,
|
|
15119
15252
|
tableName: props.tableName,
|
|
15120
|
-
tableConfig
|
|
15121
|
-
stickyViewsKey
|
|
15253
|
+
tableConfig
|
|
15122
15254
|
}
|
|
15123
|
-
)
|
|
15255
|
+
);
|
|
15124
15256
|
};
|
|
15125
15257
|
|
|
15126
|
-
// src/
|
|
15258
|
+
// src/components/adapters/data-table/DataTableSavedViews.tsx
|
|
15127
15259
|
import React24, {
|
|
15128
15260
|
forwardRef as forwardRef11,
|
|
15129
15261
|
useImperativeHandle,
|
|
@@ -15131,10 +15263,9 @@ import React24, {
|
|
|
15131
15263
|
useCallback as useCallback5
|
|
15132
15264
|
} from "react";
|
|
15133
15265
|
|
|
15134
|
-
// src/
|
|
15135
|
-
import { useMemo } from "react";
|
|
15136
|
-
|
|
15137
|
-
var DEFAULT_COLUMN_STATE = {
|
|
15266
|
+
// src/components/adapters/data-table/DataTableDefaultSavedView.tsx
|
|
15267
|
+
import { useMemo as useMemo3 } from "react";
|
|
15268
|
+
var DEFAULT_COLUMN_STATE2 = {
|
|
15138
15269
|
hidden: false,
|
|
15139
15270
|
pinned: null,
|
|
15140
15271
|
width: 200,
|
|
@@ -15149,7 +15280,7 @@ var getColumnState = (columnDefinitions) => {
|
|
|
15149
15280
|
if (column.field.includes("custom_field")) {
|
|
15150
15281
|
return {
|
|
15151
15282
|
field: column.field,
|
|
15152
|
-
...
|
|
15283
|
+
...DEFAULT_COLUMN_STATE2
|
|
15153
15284
|
};
|
|
15154
15285
|
}
|
|
15155
15286
|
return {
|
|
@@ -15160,11 +15291,11 @@ var getColumnState = (columnDefinitions) => {
|
|
|
15160
15291
|
rowGroupIndex: null,
|
|
15161
15292
|
sort: null,
|
|
15162
15293
|
sortIndex: null,
|
|
15163
|
-
width: (column.minWidth ??
|
|
15294
|
+
width: (column.minWidth ?? DEFAULT_COLUMN_STATE2.width) > DEFAULT_COLUMN_STATE2.width ? column.minWidth ?? DEFAULT_COLUMN_STATE2.width : (column.maxWidth ?? DEFAULT_COLUMN_STATE2.width) < DEFAULT_COLUMN_STATE2.width ? column.maxWidth ?? DEFAULT_COLUMN_STATE2.width : DEFAULT_COLUMN_STATE2.width
|
|
15164
15295
|
};
|
|
15165
15296
|
});
|
|
15166
15297
|
};
|
|
15167
|
-
var
|
|
15298
|
+
var extractDefaultView2 = (columnDefinitions, receivedConfigFromTool) => {
|
|
15168
15299
|
const defaultColumnState = getColumnState(columnDefinitions);
|
|
15169
15300
|
const result = {
|
|
15170
15301
|
columnState: receivedConfigFromTool?.columnState?.length ? receivedConfigFromTool.columnState : defaultColumnState,
|
|
@@ -15179,52 +15310,37 @@ var extractDefaultView = (columnDefinitions, receivedConfigFromTool) => {
|
|
|
15179
15310
|
};
|
|
15180
15311
|
return result;
|
|
15181
15312
|
};
|
|
15182
|
-
var
|
|
15183
|
-
|
|
15184
|
-
|
|
15185
|
-
|
|
15186
|
-
|
|
15187
|
-
|
|
15188
|
-
}
|
|
15189
|
-
|
|
15190
|
-
const name = useDefaultViewName2(props.domain, props.defaultViewName);
|
|
15191
|
-
const extractedDefaultConfig = useMemo(
|
|
15192
|
-
() => extractDefaultView(props.columnDefinitions, props.receivedConfigFromTool),
|
|
15193
|
-
[props.columnDefinitions, props.receivedConfigFromTool]
|
|
15313
|
+
var useNormalizedDefaultViews2 = (defaultViews, columnDefinitions) => {
|
|
15314
|
+
return useMemo3(
|
|
15315
|
+
() => defaultViews.map((view) => ({
|
|
15316
|
+
...view,
|
|
15317
|
+
share_token: "",
|
|
15318
|
+
table_config: extractDefaultView2(columnDefinitions, view.table_config)
|
|
15319
|
+
})),
|
|
15320
|
+
[defaultViews, columnDefinitions]
|
|
15194
15321
|
);
|
|
15195
|
-
return {
|
|
15196
|
-
id: "default",
|
|
15197
|
-
view_level: "default",
|
|
15198
|
-
name,
|
|
15199
|
-
table_config: extractedDefaultConfig
|
|
15200
|
-
};
|
|
15201
15322
|
};
|
|
15202
15323
|
|
|
15203
|
-
// src/
|
|
15204
|
-
import { ToastAlertProvider as ToastAlertProvider2 } from "@procore/toast-alert";
|
|
15205
|
-
var generateStickyViewsKey2 = (domain, tableName, userId, projectId, companyId) => {
|
|
15206
|
-
return `savedView-${domain}-${tableName}-${companyId}-${projectId}-${userId}`;
|
|
15207
|
-
};
|
|
15324
|
+
// src/components/adapters/data-table/DataTableSavedViews.tsx
|
|
15208
15325
|
var DataTableSavedViews = forwardRef11((props, ref) => {
|
|
15209
15326
|
const { tableApi, userId, projectId, companyId } = props;
|
|
15327
|
+
const presetViews = useNormalizedDefaultViews2(
|
|
15328
|
+
props.defaultViews,
|
|
15329
|
+
props.columnDefinitions
|
|
15330
|
+
);
|
|
15331
|
+
const defaultView = presetViews.find((view) => view.id === "default") ?? presetViews[0];
|
|
15210
15332
|
const [internalTableConfig, setInternalTableConfig] = useState6(
|
|
15211
|
-
props.
|
|
15333
|
+
ViewStorage.load(props.stickyViewsKey, defaultView).table_config
|
|
15212
15334
|
);
|
|
15213
15335
|
useImperativeHandle(ref, () => ({
|
|
15214
15336
|
setTableConfig: (newConfig) => {
|
|
15215
15337
|
setInternalTableConfig(newConfig);
|
|
15216
15338
|
}
|
|
15217
15339
|
}));
|
|
15218
|
-
const defaultView = useDefaultView2({
|
|
15219
|
-
defaultViewName: props.defaultViewName,
|
|
15220
|
-
receivedConfigFromTool: props.defaultViewConfig,
|
|
15221
|
-
domain: props.domain,
|
|
15222
|
-
columnDefinitions: props.columnDefinitions
|
|
15223
|
-
});
|
|
15224
15340
|
const onSelect = useCallback5(
|
|
15225
15341
|
({ item }) => {
|
|
15226
|
-
const
|
|
15227
|
-
const updatedView =
|
|
15342
|
+
const isPresetView = item.view_level === "default";
|
|
15343
|
+
const updatedView = isPresetView ? item : {
|
|
15228
15344
|
...item,
|
|
15229
15345
|
table_config: customAndConfigSync(
|
|
15230
15346
|
item.table_config,
|
|
@@ -15240,14 +15356,7 @@ var DataTableSavedViews = forwardRef11((props, ref) => {
|
|
|
15240
15356
|
if (!internalTableConfig) {
|
|
15241
15357
|
return null;
|
|
15242
15358
|
}
|
|
15243
|
-
|
|
15244
|
-
props.domain,
|
|
15245
|
-
props.tableName,
|
|
15246
|
-
userId,
|
|
15247
|
-
projectId,
|
|
15248
|
-
companyId
|
|
15249
|
-
);
|
|
15250
|
-
return /* @__PURE__ */ React24.createElement(ToastAlertProvider2, null, /* @__PURE__ */ React24.createElement(
|
|
15359
|
+
return /* @__PURE__ */ React24.createElement(
|
|
15251
15360
|
SavedViews,
|
|
15252
15361
|
{
|
|
15253
15362
|
onSelect,
|
|
@@ -15257,20 +15366,21 @@ var DataTableSavedViews = forwardRef11((props, ref) => {
|
|
|
15257
15366
|
companyId,
|
|
15258
15367
|
provider: "data-table",
|
|
15259
15368
|
defaultView,
|
|
15369
|
+
presetViews,
|
|
15260
15370
|
tableName: props.tableName,
|
|
15261
|
-
tableConfig: internalTableConfig
|
|
15262
|
-
stickyViewsKey
|
|
15371
|
+
tableConfig: internalTableConfig
|
|
15263
15372
|
}
|
|
15264
|
-
)
|
|
15373
|
+
);
|
|
15265
15374
|
});
|
|
15266
15375
|
DataTableSavedViews.displayName = "DataTableSavedViews";
|
|
15267
15376
|
export {
|
|
15268
15377
|
DataTableSavedViews,
|
|
15269
15378
|
ExpandedPanel,
|
|
15379
|
+
FormModal,
|
|
15270
15380
|
PanelContent,
|
|
15271
15381
|
SavedViewCollectionMenuItem,
|
|
15382
|
+
SavedViews,
|
|
15272
15383
|
SavedViewsDeleteConfirmationModalShared,
|
|
15273
|
-
SavedViewsFormModal,
|
|
15274
15384
|
SmartGridSavedViews,
|
|
15275
15385
|
getTranslations,
|
|
15276
15386
|
useSavedViewsPanel_default as useSavedViewsPanel
|