@plumile/backoffice-react 0.1.188 → 0.1.190
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/lib/esm/auth/login/LoginFlow.js.map +1 -1
- package/lib/esm/auth/login/MethodChooser.js.map +1 -1
- package/lib/esm/auth/login/MfaChallengeForm.js.map +1 -1
- package/lib/esm/auth/login/PasskeyLoginForm.js.map +1 -1
- package/lib/esm/auth/login/loginPage.css.js +2 -0
- package/lib/esm/auth/login/synchronizeAuthStatusQuery.js.map +1 -1
- package/lib/esm/auth/pages/AcceptInvitationScreen.js.map +1 -1
- package/lib/esm/auth/pages/PasswordResetCompleteScreen.js.map +1 -1
- package/lib/esm/auth/pages/PasswordResetRequestScreen.js.map +1 -1
- package/lib/esm/auth/pages/VerifyEmailScreen.js.map +1 -1
- package/lib/esm/components/backoffice/actions/LazyBackofficeEntityActionFormDialog.js.map +1 -1
- package/lib/esm/components/backoffice/billing/BackofficeBillingUsageChart.js.map +1 -1
- package/lib/esm/components/backoffice/columns/buildDataTableColumns.js.map +1 -1
- package/lib/esm/components/backoffice/detail/BackofficeLifecycleTimelineSection.js.map +1 -1
- package/lib/esm/components/backoffice/detail/BackofficeTokenUsageBreakdown.js.map +1 -1
- package/lib/esm/components/backoffice/detail/backofficeDetailRelationLink.css.js +1 -0
- package/lib/esm/components/backoffice/detail/backofficeEntitySummaryHeader.css.js +0 -1
- package/lib/esm/components/backoffice/detail/createBackofficeEntityLinkProps.js.map +1 -1
- package/lib/esm/components/backoffice/detail/detailPayloadUtils.js.map +1 -1
- package/lib/esm/components/backoffice/filters/backofficeFilterAction.css.js +0 -1
- package/lib/esm/components/backoffice/filters/deferredFilterSearchInput.css.js +0 -1
- package/lib/esm/components/backoffice/layout/breadcrumb/assertValidBreadcrumb.js.map +1 -1
- package/lib/esm/components/backoffice/layout/buildSidebarSections.js.map +1 -1
- package/lib/esm/components/backoffice/layout/mapViewerToSidebarProfileView.js.map +1 -1
- package/lib/esm/components/backoffice/layout/sidebarUtils.js.map +1 -1
- package/lib/esm/components/backoffice/links/resolveBackofficeLink.js.map +1 -1
- package/lib/esm/components/backoffice/links/resolveBackofficeTargetIcon.js.map +1 -1
- package/lib/esm/components/backoffice/list/RowFlagsCell.js.map +1 -1
- package/lib/esm/components/backoffice/pickers/EntityIdPickerDialog.js.map +1 -1
- package/lib/esm/components/backoffice/refs/BackofficeLazyEntityCount.js.map +1 -1
- package/lib/esm/components/backoffice/refs/BackofficeRelatedCountLink.js.map +1 -1
- package/lib/esm/components/backoffice/routing/BackofficeContentBoundary.js.map +1 -1
- package/lib/esm/components/backoffice/scaffolds/BackofficeEntityListScaffold.js +368 -281
- package/lib/esm/components/backoffice/scaffolds/BackofficeEntityListScaffold.js.map +1 -1
- package/lib/esm/components/backoffice/scaffolds/backofficeEntityListScaffold.css.js +2 -2
- package/lib/esm/components/backoffice/scaffolds/backofficeEntityListScaffold.css.js.map +1 -1
- package/lib/esm/components/backoffice/shared/backofficeFilterableCell.css.js +1 -1
- package/lib/esm/components/backoffice/technical/TechnicalIdentifierValue.js.map +1 -1
- package/lib/esm/filters/filterHelpers.js +1 -1
- package/lib/esm/filters/filterHelpers.js.map +1 -1
- package/lib/esm/hooks/useAuth.js.map +1 -1
- package/lib/esm/hooks/useBackofficeAuth.js.map +1 -1
- package/lib/esm/hooks/useBackofficeInfiniteScrollSentinel.js.map +1 -1
- package/lib/esm/hooks/useBackofficeListUrlState.js.map +1 -1
- package/lib/esm/hooks/useBackofficeSessionAuth.js.map +1 -1
- package/lib/esm/hooks/useConditionalSubscription.js.map +1 -1
- package/lib/esm/hooks/useSidebarGroupCollapse.js.map +1 -1
- package/lib/esm/i18n/createI18nInstance.js.map +1 -1
- package/lib/esm/i18n/locales/en/backofficeReact.js +409 -405
- package/lib/esm/i18n/locales/en/backofficeReact.js.map +1 -1
- package/lib/esm/i18n/locales/fr/backofficeReact.js +412 -407
- package/lib/esm/i18n/locales/fr/backofficeReact.js.map +1 -1
- package/lib/esm/i18n/mergeResourceLanguages.js.map +1 -1
- package/lib/esm/i18n/resources.js +1 -1
- package/lib/esm/i18n/resources.js.map +1 -1
- package/lib/esm/i18n/useBackofficeFormats.js.map +1 -1
- package/lib/esm/modules/base64.js.map +1 -1
- package/lib/esm/modules/formatFileSize.js.map +1 -1
- package/lib/esm/modules/uploads.js +17 -17
- package/lib/esm/modules/uploads.js.map +1 -1
- package/lib/esm/modules/webauthn.js.map +1 -1
- package/lib/esm/node_modules/@babel/runtime/helpers/objectSpread2.js.map +1 -1
- package/lib/esm/node_modules/@babel/runtime/helpers/toPrimitive.js.map +1 -1
- package/lib/esm/node_modules/@babel/runtime/helpers/toPropertyKey.js.map +1 -1
- package/lib/esm/node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js.map +1 -1
- package/lib/esm/node_modules/@vanilla-extract/recipes/dist/createRuntimeFn-62c9670f.esm.js +1 -1
- package/lib/esm/node_modules/@vanilla-extract/recipes/dist/createRuntimeFn-62c9670f.esm.js.map +1 -1
- package/lib/esm/node_modules/fbjs/lib/areEqual.js.map +1 -1
- package/lib/esm/node_modules/relay-test-utils/lib/RelayMockPayloadGenerator.js.map +1 -1
- package/lib/esm/node_modules/relay-test-utils/lib/RelayModernMockEnvironment.js.map +1 -1
- package/lib/esm/node_modules/relay-test-utils/lib/RelayResolverTestUtils.js.map +1 -1
- package/lib/esm/pages/BackofficeDashboardPage.js.map +1 -1
- package/lib/esm/pages/BackofficeDashboardWidgetContent.js.map +1 -1
- package/lib/esm/pages/BackofficeEntityDetailLayoutPage.js.map +1 -1
- package/lib/esm/pages/BackofficeEntityDetailPage.js.map +1 -1
- package/lib/esm/pages/BackofficeEntityDetailPage.view-helpers.js.map +1 -1
- package/lib/esm/pages/BackofficeEntityListDataPage.js +77 -70
- package/lib/esm/pages/BackofficeEntityListDataPage.js.map +1 -1
- package/lib/esm/pages/BackofficeEntityListPage.helpers.js +5 -5
- package/lib/esm/pages/BackofficeEntityListPage.helpers.js.map +1 -1
- package/lib/esm/pages/BackofficeEntityListPage.js +89 -85
- package/lib/esm/pages/BackofficeEntityListPage.js.map +1 -1
- package/lib/esm/pages/BackofficeEntityListRouteContext.js.map +1 -1
- package/lib/esm/pages/BackofficeHubPage.js.map +1 -1
- package/lib/esm/pages/BackofficeLayoutPage.js.map +1 -1
- package/lib/esm/pages/BackofficeLoginPage.js.map +1 -1
- package/lib/esm/pages/BackofficePasswordResetRequestPage.js.map +1 -1
- package/lib/esm/pages/BackofficeVerifyEmailPage.js.map +1 -1
- package/lib/esm/pages/detail/BackofficeEntityDetailManifestFallback.js.map +1 -1
- package/lib/esm/pages/detail/pageResolution.js.map +1 -1
- package/lib/esm/provider/BackofficeListUiStateContext.js +88 -0
- package/lib/esm/provider/BackofficeListUiStateContext.js.map +1 -0
- package/lib/esm/provider/BackofficeProvider.js +80 -79
- package/lib/esm/provider/BackofficeProvider.js.map +1 -1
- package/lib/esm/provider/entityRegistry.js.map +1 -1
- package/lib/esm/provider/lazyValue.js.map +1 -1
- package/lib/esm/provider/useBackofficeEntityLoader.js.map +1 -1
- package/lib/esm/relay/connectionUtils.js.map +1 -1
- package/lib/esm/relay/envHelpers.js.map +1 -1
- package/lib/esm/router/createBackofficeRoutes.js.map +1 -1
- package/lib/esm/storybook/relay/RelayStory.js.map +1 -1
- package/lib/esm/storybook/relay/mockResolvers.js.map +1 -1
- package/lib/types/components/backoffice/detail/BackofficeLifecycleTimelineSection.d.ts.map +1 -1
- package/lib/types/components/backoffice/pickers/EntityIdPickerDialog.d.ts.map +1 -1
- package/lib/types/components/backoffice/scaffolds/BackofficeEntityListScaffold.d.ts +2 -0
- package/lib/types/components/backoffice/scaffolds/BackofficeEntityListScaffold.d.ts.map +1 -1
- package/lib/types/components/backoffice/scaffolds/backofficeEntityListScaffold.css.d.ts +2 -0
- package/lib/types/components/backoffice/scaffolds/backofficeEntityListScaffold.css.d.ts.map +1 -1
- package/lib/types/components/backoffice/technical/TechnicalIdentifierValue.d.ts.map +1 -1
- package/lib/types/filters/filterHelpers.d.ts.map +1 -1
- package/lib/types/hooks/useAuth.d.ts.map +1 -1
- package/lib/types/i18n/resources.d.ts +7 -0
- package/lib/types/i18n/resources.d.ts.map +1 -1
- package/lib/types/modules/uploads.d.ts.map +1 -1
- package/lib/types/modules/webauthn.d.ts.map +1 -1
- package/lib/types/pages/BackofficeEntityListDataPage.d.ts.map +1 -1
- package/lib/types/pages/BackofficeEntityListPage.d.ts.map +1 -1
- package/lib/types/pages/BackofficeEntityListRouteContext.d.ts +2 -0
- package/lib/types/pages/BackofficeEntityListRouteContext.d.ts.map +1 -1
- package/lib/types/pages/BackofficePasswordResetRequestPage.d.ts.map +1 -1
- package/lib/types/pages/BackofficeVerifyEmailPage.d.ts.map +1 -1
- package/lib/types/pages/detail/pageResolution.d.ts.map +1 -1
- package/lib/types/provider/BackofficeListUiStateContext.d.ts +21 -0
- package/lib/types/provider/BackofficeListUiStateContext.d.ts.map +1 -0
- package/lib/types/provider/BackofficeProvider.d.ts.map +1 -1
- package/lib/types/provider/types.d.ts.map +1 -1
- package/package.json +16 -16
|
@@ -13,80 +13,86 @@ import { jsx as h } from "react/jsx-runtime";
|
|
|
13
13
|
import { Button as g } from "@plumile/ui/atomic/atoms/button/Button.js";
|
|
14
14
|
import { loadQuery as _, usePreloadedQuery as v } from "react-relay";
|
|
15
15
|
import { BACKOFFICE_LIST_DEFAULTS as y, BACKOFFICE_LIST_REFETCH_POLICY as b } from "@plumile/backoffice-core/constants.js";
|
|
16
|
+
import { stableListVariablesKey as x } from "@plumile/backoffice-core/state/stableKey.js";
|
|
16
17
|
//#region src/pages/BackofficeEntityListDataPage.tsx
|
|
17
|
-
function
|
|
18
|
-
let { config: a, state:
|
|
18
|
+
function S({ queryRef: t }) {
|
|
19
|
+
let { config: a, state: p, pushState: m, headerActions: g, columns: _, gridTemplateColumns: S, getRowId: C, countFetchKey: w, bumpCountFetchKey: T, filterDrawerState: E, registerRefresh: D } = c(), O = a.list, { t: k } = e(), A = v(O.query, t), { data: j, loadNext: M, hasNext: N, isLoadingNext: P, refetch: F } = n(O.fragment, A), I = O.getConnection(j), L = d(() => I.edges.map((e) => O.toRow(e.node)), [I.edges, O]), R = a.listDefaults ?? O.defaultState ?? {
|
|
19
20
|
where: null,
|
|
20
21
|
sort: null
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
22
|
+
}, z = p.sort ?? R.sort, { pageSize: B } = y, V = d(() => ({
|
|
23
|
+
where: p.where,
|
|
24
|
+
sort: z,
|
|
25
|
+
count: B,
|
|
26
|
+
cursor: null
|
|
27
|
+
}), [
|
|
28
|
+
B,
|
|
29
|
+
z,
|
|
30
|
+
p.where
|
|
31
|
+
]), H = d(() => x(V), [V]), U = f(H), { isRefreshing: W, onRefresh: G } = o({
|
|
32
|
+
refetch: F,
|
|
33
|
+
variables: V,
|
|
33
34
|
defaults: {
|
|
34
|
-
where:
|
|
35
|
-
sort:
|
|
36
|
-
count:
|
|
35
|
+
where: R.where,
|
|
36
|
+
sort: R.sort,
|
|
37
|
+
count: B,
|
|
37
38
|
cursor: null
|
|
38
39
|
},
|
|
39
40
|
fetchPolicy: b,
|
|
40
|
-
buildQueryVariables:
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
41
|
+
buildQueryVariables: O.buildQueryVariables
|
|
42
|
+
});
|
|
43
|
+
u(() => {
|
|
44
|
+
U.current !== H && (U.current = H, T());
|
|
45
|
+
}, [T, H]);
|
|
46
|
+
let K = l(() => {
|
|
47
|
+
T(), G();
|
|
48
|
+
}, [T, G]);
|
|
49
|
+
u(() => (D(K), () => {
|
|
50
|
+
D(null);
|
|
51
|
+
}), [K, D]);
|
|
52
|
+
let q = s({
|
|
53
|
+
hasNext: N,
|
|
54
|
+
isLoadingNext: P,
|
|
55
|
+
loadNext: M,
|
|
56
|
+
count: B
|
|
57
|
+
}), J = /* @__PURE__ */ h("span", { children: k("common.loading") });
|
|
58
|
+
return L.length > 0 && (J = /* @__PURE__ */ h("span", { children: k("list.loaded", { count: L.length }) })), /* @__PURE__ */ h(i, {
|
|
54
59
|
config: a,
|
|
55
|
-
state:
|
|
56
|
-
pushState:
|
|
57
|
-
headerActions:
|
|
58
|
-
rows:
|
|
59
|
-
columns:
|
|
60
|
-
gridTemplateColumns:
|
|
61
|
-
getRowId:
|
|
62
|
-
hasNextPage:
|
|
63
|
-
isLoadingMore:
|
|
64
|
-
isRefreshing:
|
|
65
|
-
onLoadMore:
|
|
66
|
-
onRefresh:
|
|
60
|
+
state: p,
|
|
61
|
+
pushState: m,
|
|
62
|
+
headerActions: g,
|
|
63
|
+
rows: L,
|
|
64
|
+
columns: _,
|
|
65
|
+
gridTemplateColumns: S,
|
|
66
|
+
getRowId: C,
|
|
67
|
+
hasNextPage: N,
|
|
68
|
+
isLoadingMore: P,
|
|
69
|
+
isRefreshing: W,
|
|
70
|
+
onLoadMore: q,
|
|
71
|
+
onRefresh: K,
|
|
67
72
|
totalCount: null,
|
|
68
73
|
loadedCountLabel: /* @__PURE__ */ h(r, {
|
|
69
|
-
count:
|
|
70
|
-
where:
|
|
71
|
-
fetchKey:
|
|
72
|
-
loadingFallback:
|
|
73
|
-
children: (e) => /* @__PURE__ */ h("span", { children:
|
|
74
|
-
shown:
|
|
74
|
+
count: O.count,
|
|
75
|
+
where: p.where,
|
|
76
|
+
fetchKey: w,
|
|
77
|
+
loadingFallback: J,
|
|
78
|
+
children: (e) => /* @__PURE__ */ h("span", { children: k("list.showing", {
|
|
79
|
+
shown: L.length,
|
|
75
80
|
total: e
|
|
76
81
|
}) })
|
|
77
|
-
})
|
|
82
|
+
}),
|
|
83
|
+
filterDrawerState: E
|
|
78
84
|
});
|
|
79
85
|
}
|
|
80
|
-
var
|
|
81
|
-
let { config: r, state: o, pushState: s, headerActions: d, columns: v, gridTemplateColumns: b, getRowId:
|
|
82
|
-
|
|
86
|
+
var C = ({ prepared: n }) => {
|
|
87
|
+
let { config: r, state: o, pushState: s, headerActions: d, columns: v, gridTemplateColumns: b, getRowId: x, filterDrawerState: C } = c(), w = a(), { t: T } = e(), [E, D] = p(() => n.query), O = f(null), k = l(() => {
|
|
88
|
+
O.current?.dispose(), O.current = null;
|
|
83
89
|
}, []);
|
|
84
90
|
u(() => {
|
|
85
|
-
|
|
86
|
-
}, [
|
|
87
|
-
|
|
88
|
-
}, [
|
|
89
|
-
let
|
|
91
|
+
k(), D(n.query);
|
|
92
|
+
}, [k, n.query]), u(() => () => {
|
|
93
|
+
k();
|
|
94
|
+
}, [k]);
|
|
95
|
+
let A = l(() => {
|
|
90
96
|
let e = r.list, t = r.listDefaults ?? e.defaultState ?? {
|
|
91
97
|
where: null,
|
|
92
98
|
sort: null
|
|
@@ -95,12 +101,12 @@ var S = ({ prepared: n }) => {
|
|
|
95
101
|
sort: o.sort ?? t.sort,
|
|
96
102
|
count: n,
|
|
97
103
|
cursor: null
|
|
98
|
-
}, a = e.buildQueryVariables(i), s = _(
|
|
99
|
-
|
|
104
|
+
}, a = e.buildQueryVariables(i), s = _(w, e.query, a, { fetchPolicy: "network-only" });
|
|
105
|
+
k(), O.current = s, D(s);
|
|
100
106
|
}, [
|
|
101
107
|
r,
|
|
102
|
-
|
|
103
|
-
|
|
108
|
+
k,
|
|
109
|
+
w,
|
|
104
110
|
o.sort,
|
|
105
111
|
o.where
|
|
106
112
|
]);
|
|
@@ -113,34 +119,35 @@ var S = ({ prepared: n }) => {
|
|
|
113
119
|
rows: [],
|
|
114
120
|
columns: v,
|
|
115
121
|
gridTemplateColumns: b,
|
|
116
|
-
getRowId:
|
|
122
|
+
getRowId: x,
|
|
117
123
|
hasNextPage: !1,
|
|
118
124
|
isLoadingMore: !1,
|
|
119
125
|
isRefreshing: !1,
|
|
120
126
|
onLoadMore: () => {},
|
|
121
127
|
onRefresh: () => {
|
|
122
|
-
e(),
|
|
128
|
+
e(), A();
|
|
123
129
|
},
|
|
124
130
|
totalCount: null,
|
|
131
|
+
filterDrawerState: C,
|
|
125
132
|
emptyState: /* @__PURE__ */ h(m, {
|
|
126
133
|
tone: "danger",
|
|
127
|
-
title:
|
|
134
|
+
title: T("list.errors.title"),
|
|
128
135
|
actions: /* @__PURE__ */ h(g, {
|
|
129
136
|
type: "button",
|
|
130
137
|
variant: "secondary",
|
|
131
138
|
size: "small",
|
|
132
139
|
onClick: () => {
|
|
133
|
-
e(),
|
|
140
|
+
e(), A();
|
|
134
141
|
},
|
|
135
|
-
children:
|
|
142
|
+
children: T("list.actions.retry")
|
|
136
143
|
}),
|
|
137
|
-
children:
|
|
144
|
+
children: T("list.errors.tableFailed")
|
|
138
145
|
})
|
|
139
146
|
}),
|
|
140
|
-
children: /* @__PURE__ */ h(
|
|
147
|
+
children: /* @__PURE__ */ h(S, { queryRef: E })
|
|
141
148
|
});
|
|
142
149
|
};
|
|
143
150
|
//#endregion
|
|
144
|
-
export {
|
|
151
|
+
export { C as BackofficeEntityListDataPage, C as default };
|
|
145
152
|
|
|
146
153
|
//# sourceMappingURL=BackofficeEntityListDataPage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackofficeEntityListDataPage.js","names":[],"sources":["../../../src/pages/BackofficeEntityListDataPage.tsx"],"sourcesContent":["import {\n type JSX,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { loadQuery, usePreloadedQuery } from 'react-relay';\nimport type { OperationType } from 'relay-runtime';\nimport {\n BACKOFFICE_LIST_DEFAULTS,\n BACKOFFICE_LIST_REFETCH_POLICY,\n} from '@plumile/backoffice-core/constants.js';\nimport type { BackofficePreparedListDataRoute } from '@plumile/backoffice-core/types.js';\nimport { Button } from '@plumile/ui/atomic/atoms/button/Button.js';\nimport { InlineBanner } from '@plumile/ui/components/feedback/InlineBanner.js';\n\nimport { BackofficeErrorBoundary } from '../components/backoffice/errors/BackofficeErrorBoundary.js';\nimport { BackofficeEntityListScaffold } from '../components/backoffice/scaffolds/BackofficeEntityListScaffold.js';\nimport { BackofficeLazyEntityCountLabel } from '../components/backoffice/refs/BackofficeLazyEntityCount.js';\nimport { useBackofficeLoadMore } from '../hooks/useBackofficeLoadMore.js';\nimport { useBackofficeListRefetch } from '../hooks/useBackofficeListRefetch.js';\nimport { useBackofficeReactTranslation } from '../i18n/useBackofficeReactTranslation.js';\nimport { useBackofficePaginationFragment } from '../relay/typedRelayHooks.js';\nimport { useRelayEnvironment } from '../relay/useRelayEnvironment.js';\nimport { useBackofficeEntityListRouteContext } from './BackofficeEntityListRouteContext.js';\n\nexport type BackofficeEntityListDataPageProps = {\n prepared: BackofficePreparedListDataRoute;\n};\n\ntype BackofficeEntityConnectionListDataProps = {\n queryRef: BackofficePreparedListDataRoute['query'];\n};\n\n/**\n * Renders the Relay-backed row data under the list layout route boundary.\n */\nfunction BackofficeEntityConnectionListData({\n queryRef,\n}: BackofficeEntityConnectionListDataProps): JSX.Element | null {\n const {\n config,\n state,\n pushState,\n headerActions,\n columns,\n gridTemplateColumns,\n getRowId,\n countFetchKey,\n bumpCountFetchKey,\n registerRefresh,\n } = useBackofficeEntityListRouteContext();\n const listConfig = config.list;\n const { t } = useBackofficeReactTranslation();\n\n const queryData = usePreloadedQuery(listConfig.query, queryRef);\n const {\n data: fragmentData,\n loadNext,\n hasNext,\n isLoadingNext,\n refetch,\n } = useBackofficePaginationFragment<OperationType, unknown, unknown>(\n listConfig.fragment,\n queryData,\n );\n\n const connection = listConfig.getConnection(fragmentData);\n\n const rows = useMemo(() => {\n return connection.edges.map((edge) => {\n return listConfig.toRow(edge.node);\n });\n }, [connection.edges, listConfig]);\n\n const listDefaults = config.listDefaults ??\n listConfig.defaultState ?? { where: null, sort: null };\n const resolvedSort = state.sort ?? listDefaults.sort;\n const { pageSize } = BACKOFFICE_LIST_DEFAULTS;\n\n const baseVariables = useMemo(() => {\n return {\n where: state.where,\n sort: resolvedSort,\n count: pageSize,\n cursor: null,\n };\n }, [pageSize, resolvedSort, state.where]);\n\n const { isRefreshing, onRefresh } = useBackofficeListRefetch({\n refetch,\n variables: baseVariables,\n defaults: {\n where: listDefaults.where,\n sort: listDefaults.sort,\n count: pageSize,\n cursor: null,\n },\n fetchPolicy: BACKOFFICE_LIST_REFETCH_POLICY,\n buildQueryVariables: listConfig.buildQueryVariables,\n });\n\n const handleRefresh = useCallback(() => {\n bumpCountFetchKey();\n onRefresh();\n }, [bumpCountFetchKey, onRefresh]);\n\n useEffect(() => {\n registerRefresh(handleRefresh);\n return () => {\n registerRefresh(null);\n };\n }, [handleRefresh, registerRefresh]);\n\n const handleLoadMore = useBackofficeLoadMore({\n hasNext,\n isLoadingNext,\n loadNext,\n count: pageSize,\n });\n\n let loadedCountFallback: JSX.Element = <span>{t('common.loading')}</span>;\n if (rows.length > 0) {\n loadedCountFallback = (\n <span>\n {t('list.loaded', {\n count: rows.length,\n })}\n </span>\n );\n }\n const loadedCountLabel = (\n <BackofficeLazyEntityCountLabel\n count={listConfig.count}\n where={state.where}\n fetchKey={countFetchKey}\n loadingFallback={loadedCountFallback}\n >\n {(totalCount) => {\n return (\n <span>\n {t('list.showing', {\n shown: rows.length,\n total: totalCount,\n })}\n </span>\n );\n }}\n </BackofficeLazyEntityCountLabel>\n );\n\n return (\n <BackofficeEntityListScaffold\n config={config}\n state={state}\n pushState={pushState}\n headerActions={headerActions}\n rows={rows}\n columns={columns}\n gridTemplateColumns={gridTemplateColumns}\n getRowId={getRowId}\n hasNextPage={hasNext}\n isLoadingMore={isLoadingNext}\n isRefreshing={isRefreshing}\n onLoadMore={handleLoadMore}\n onRefresh={handleRefresh}\n totalCount={null}\n loadedCountLabel={loadedCountLabel}\n />\n );\n}\n\nexport const BackofficeEntityListDataPage = ({\n prepared,\n}: BackofficeEntityListDataPageProps): JSX.Element | null => {\n const {\n config,\n state,\n pushState,\n headerActions,\n columns,\n gridTemplateColumns,\n getRowId,\n } = useBackofficeEntityListRouteContext();\n const relayEnvironment = useRelayEnvironment();\n const { t } = useBackofficeReactTranslation();\n const [queryRef, setQueryRef] = useState(() => {\n return prepared.query;\n });\n const ownedQueryRef = useRef<BackofficePreparedListDataRoute['query'] | null>(\n null,\n );\n\n const disposeOwnedQueryRef = useCallback(() => {\n ownedQueryRef.current?.dispose();\n ownedQueryRef.current = null;\n }, []);\n\n useEffect(() => {\n disposeOwnedQueryRef();\n setQueryRef(prepared.query);\n }, [disposeOwnedQueryRef, prepared.query]);\n\n useEffect(() => {\n return () => {\n disposeOwnedQueryRef();\n };\n }, [disposeOwnedQueryRef]);\n\n const reloadInitialQuery = useCallback(() => {\n const listConfig = config.list;\n const listDefaults = config.listDefaults ??\n listConfig.defaultState ?? { where: null, sort: null };\n const { pageSize } = BACKOFFICE_LIST_DEFAULTS;\n const variablesBase = {\n where: state.where,\n sort: state.sort ?? listDefaults.sort,\n count: pageSize,\n cursor: null,\n };\n const variables = listConfig.buildQueryVariables(variablesBase);\n const nextQueryRef = loadQuery<OperationType>(\n relayEnvironment,\n listConfig.query,\n variables,\n {\n fetchPolicy: 'network-only',\n },\n );\n disposeOwnedQueryRef();\n ownedQueryRef.current = nextQueryRef;\n setQueryRef(nextQueryRef);\n }, [config, disposeOwnedQueryRef, relayEnvironment, state.sort, state.where]);\n\n return (\n <BackofficeErrorBoundary\n fallback={({ reset }) => {\n return (\n <BackofficeEntityListScaffold\n config={config}\n state={state}\n pushState={pushState}\n headerActions={headerActions}\n rows={[]}\n columns={columns}\n gridTemplateColumns={gridTemplateColumns}\n getRowId={getRowId}\n hasNextPage={false}\n isLoadingMore={false}\n isRefreshing={false}\n onLoadMore={() => {}}\n onRefresh={() => {\n reset();\n reloadInitialQuery();\n }}\n totalCount={null}\n emptyState={\n <InlineBanner\n tone=\"danger\"\n title={t('list.errors.title')}\n actions={\n <Button\n type=\"button\"\n variant=\"secondary\"\n size=\"small\"\n onClick={() => {\n reset();\n reloadInitialQuery();\n }}\n >\n {t('list.actions.retry')}\n </Button>\n }\n >\n {t('list.errors.tableFailed')}\n </InlineBanner>\n }\n />\n );\n }}\n >\n <BackofficeEntityConnectionListData queryRef={queryRef} />\n </BackofficeErrorBoundary>\n );\n};\n\nexport default BackofficeEntityListDataPage;\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"BackofficeEntityListDataPage.js","names":[],"sources":["../../../src/pages/BackofficeEntityListDataPage.tsx"],"sourcesContent":["import {\n type JSX,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { loadQuery, usePreloadedQuery } from 'react-relay';\nimport type { OperationType } from 'relay-runtime';\nimport {\n BACKOFFICE_LIST_DEFAULTS,\n BACKOFFICE_LIST_REFETCH_POLICY,\n} from '@plumile/backoffice-core/constants.js';\nimport { stableListVariablesKey } from '@plumile/backoffice-core/state/stableKey.js';\nimport type { BackofficePreparedListDataRoute } from '@plumile/backoffice-core/types.js';\nimport { Button } from '@plumile/ui/atomic/atoms/button/Button.js';\nimport { InlineBanner } from '@plumile/ui/components/feedback/InlineBanner.js';\n\nimport { BackofficeErrorBoundary } from '../components/backoffice/errors/BackofficeErrorBoundary.js';\nimport { BackofficeEntityListScaffold } from '../components/backoffice/scaffolds/BackofficeEntityListScaffold.js';\nimport { BackofficeLazyEntityCountLabel } from '../components/backoffice/refs/BackofficeLazyEntityCount.js';\nimport { useBackofficeLoadMore } from '../hooks/useBackofficeLoadMore.js';\nimport { useBackofficeListRefetch } from '../hooks/useBackofficeListRefetch.js';\nimport { useBackofficeReactTranslation } from '../i18n/useBackofficeReactTranslation.js';\nimport { useBackofficePaginationFragment } from '../relay/typedRelayHooks.js';\nimport { useRelayEnvironment } from '../relay/useRelayEnvironment.js';\nimport { useBackofficeEntityListRouteContext } from './BackofficeEntityListRouteContext.js';\n\nexport type BackofficeEntityListDataPageProps = {\n prepared: BackofficePreparedListDataRoute;\n};\n\ntype BackofficeEntityConnectionListDataProps = {\n queryRef: BackofficePreparedListDataRoute['query'];\n};\n\n/**\n * Renders the Relay-backed row data under the list layout route boundary.\n */\nfunction BackofficeEntityConnectionListData({\n queryRef,\n}: BackofficeEntityConnectionListDataProps): JSX.Element | null {\n const {\n config,\n state,\n pushState,\n headerActions,\n columns,\n gridTemplateColumns,\n getRowId,\n countFetchKey,\n bumpCountFetchKey,\n filterDrawerState,\n registerRefresh,\n } = useBackofficeEntityListRouteContext();\n const listConfig = config.list;\n const { t } = useBackofficeReactTranslation();\n\n const queryData = usePreloadedQuery(listConfig.query, queryRef);\n const {\n data: fragmentData,\n loadNext,\n hasNext,\n isLoadingNext,\n refetch,\n } = useBackofficePaginationFragment<OperationType, unknown, unknown>(\n listConfig.fragment,\n queryData,\n );\n\n const connection = listConfig.getConnection(fragmentData);\n\n const rows = useMemo(() => {\n return connection.edges.map((edge) => {\n return listConfig.toRow(edge.node);\n });\n }, [connection.edges, listConfig]);\n\n const listDefaults = config.listDefaults ??\n listConfig.defaultState ?? { where: null, sort: null };\n const resolvedSort = state.sort ?? listDefaults.sort;\n const { pageSize } = BACKOFFICE_LIST_DEFAULTS;\n\n const baseVariables = useMemo(() => {\n return {\n where: state.where,\n sort: resolvedSort,\n count: pageSize,\n cursor: null,\n };\n }, [pageSize, resolvedSort, state.where]);\n const countVariablesKey = useMemo(() => {\n return stableListVariablesKey(baseVariables);\n }, [baseVariables]);\n const previousCountVariablesKeyRef = useRef(countVariablesKey);\n\n const { isRefreshing, onRefresh } = useBackofficeListRefetch({\n refetch,\n variables: baseVariables,\n defaults: {\n where: listDefaults.where,\n sort: listDefaults.sort,\n count: pageSize,\n cursor: null,\n },\n fetchPolicy: BACKOFFICE_LIST_REFETCH_POLICY,\n buildQueryVariables: listConfig.buildQueryVariables,\n });\n\n useEffect(() => {\n if (previousCountVariablesKeyRef.current === countVariablesKey) {\n return;\n }\n previousCountVariablesKeyRef.current = countVariablesKey;\n bumpCountFetchKey();\n }, [bumpCountFetchKey, countVariablesKey]);\n\n const handleRefresh = useCallback(() => {\n bumpCountFetchKey();\n onRefresh();\n }, [bumpCountFetchKey, onRefresh]);\n\n useEffect(() => {\n registerRefresh(handleRefresh);\n return () => {\n registerRefresh(null);\n };\n }, [handleRefresh, registerRefresh]);\n\n const handleLoadMore = useBackofficeLoadMore({\n hasNext,\n isLoadingNext,\n loadNext,\n count: pageSize,\n });\n\n let loadedCountFallback: JSX.Element = <span>{t('common.loading')}</span>;\n if (rows.length > 0) {\n loadedCountFallback = (\n <span>\n {t('list.loaded', {\n count: rows.length,\n })}\n </span>\n );\n }\n const loadedCountLabel = (\n <BackofficeLazyEntityCountLabel\n count={listConfig.count}\n where={state.where}\n fetchKey={countFetchKey}\n loadingFallback={loadedCountFallback}\n >\n {(totalCount) => {\n return (\n <span>\n {t('list.showing', {\n shown: rows.length,\n total: totalCount,\n })}\n </span>\n );\n }}\n </BackofficeLazyEntityCountLabel>\n );\n\n return (\n <BackofficeEntityListScaffold\n config={config}\n state={state}\n pushState={pushState}\n headerActions={headerActions}\n rows={rows}\n columns={columns}\n gridTemplateColumns={gridTemplateColumns}\n getRowId={getRowId}\n hasNextPage={hasNext}\n isLoadingMore={isLoadingNext}\n isRefreshing={isRefreshing}\n onLoadMore={handleLoadMore}\n onRefresh={handleRefresh}\n totalCount={null}\n loadedCountLabel={loadedCountLabel}\n filterDrawerState={filterDrawerState}\n />\n );\n}\n\nexport const BackofficeEntityListDataPage = ({\n prepared,\n}: BackofficeEntityListDataPageProps): JSX.Element | null => {\n const {\n config,\n state,\n pushState,\n headerActions,\n columns,\n gridTemplateColumns,\n getRowId,\n filterDrawerState,\n } = useBackofficeEntityListRouteContext();\n const relayEnvironment = useRelayEnvironment();\n const { t } = useBackofficeReactTranslation();\n const [queryRef, setQueryRef] = useState(() => {\n return prepared.query;\n });\n const ownedQueryRef = useRef<BackofficePreparedListDataRoute['query'] | null>(\n null,\n );\n\n const disposeOwnedQueryRef = useCallback(() => {\n ownedQueryRef.current?.dispose();\n ownedQueryRef.current = null;\n }, []);\n\n useEffect(() => {\n disposeOwnedQueryRef();\n setQueryRef(prepared.query);\n }, [disposeOwnedQueryRef, prepared.query]);\n\n useEffect(() => {\n return () => {\n disposeOwnedQueryRef();\n };\n }, [disposeOwnedQueryRef]);\n\n const reloadInitialQuery = useCallback(() => {\n const listConfig = config.list;\n const listDefaults = config.listDefaults ??\n listConfig.defaultState ?? { where: null, sort: null };\n const { pageSize } = BACKOFFICE_LIST_DEFAULTS;\n const variablesBase = {\n where: state.where,\n sort: state.sort ?? listDefaults.sort,\n count: pageSize,\n cursor: null,\n };\n const variables = listConfig.buildQueryVariables(variablesBase);\n const nextQueryRef = loadQuery<OperationType>(\n relayEnvironment,\n listConfig.query,\n variables,\n {\n fetchPolicy: 'network-only',\n },\n );\n disposeOwnedQueryRef();\n ownedQueryRef.current = nextQueryRef;\n setQueryRef(nextQueryRef);\n }, [config, disposeOwnedQueryRef, relayEnvironment, state.sort, state.where]);\n\n return (\n <BackofficeErrorBoundary\n fallback={({ reset }) => {\n return (\n <BackofficeEntityListScaffold\n config={config}\n state={state}\n pushState={pushState}\n headerActions={headerActions}\n rows={[]}\n columns={columns}\n gridTemplateColumns={gridTemplateColumns}\n getRowId={getRowId}\n hasNextPage={false}\n isLoadingMore={false}\n isRefreshing={false}\n onLoadMore={() => {}}\n onRefresh={() => {\n reset();\n reloadInitialQuery();\n }}\n totalCount={null}\n filterDrawerState={filterDrawerState}\n emptyState={\n <InlineBanner\n tone=\"danger\"\n title={t('list.errors.title')}\n actions={\n <Button\n type=\"button\"\n variant=\"secondary\"\n size=\"small\"\n onClick={() => {\n reset();\n reloadInitialQuery();\n }}\n >\n {t('list.actions.retry')}\n </Button>\n }\n >\n {t('list.errors.tableFailed')}\n </InlineBanner>\n }\n />\n );\n }}\n >\n <BackofficeEntityConnectionListData queryRef={queryRef} />\n </BackofficeErrorBoundary>\n );\n};\n\nexport default BackofficeEntityListDataPage;\n"],"mappings":"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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/pages/BackofficeEntityListPage.helpers.tsx
|
|
2
|
-
var e =
|
|
2
|
+
var e = {
|
|
3
3
|
xs: "minmax(3.5rem, 7rem)",
|
|
4
4
|
s: "minmax(5rem, 10rem)",
|
|
5
5
|
statusAction: "minmax(7rem, 12rem)",
|
|
@@ -7,13 +7,13 @@ var e = 24, t = 6, n = 4, r = 32, i = 8, a = {
|
|
|
7
7
|
l: "minmax(9rem, 18rem)",
|
|
8
8
|
xl: "minmax(11rem, 24rem)",
|
|
9
9
|
fluid: "minmax(0, 1fr)"
|
|
10
|
-
},
|
|
10
|
+
}, t = (e) => e <= 0 ? 0 : 8 + 24 * e + 6 * Math.max(0, e - 1), n = (e) => e <= 0 ? 0 : 28 + 32 * e + 8 * Math.max(0, e - 1), r = (t, n) => t.mobileRole === "action" ? "60px" : t.isPrimary === !0 ? "minmax(0, 1.4fr)" : "size" in t && typeof t.size == "string" ? e[t.size] : n, i = (e) => e.kind === "route", a = (e) => e.kind === "formMutation", o = (e, t) => e ?? (t === 0 ? "primary" : "secondary"), s = (e) => {
|
|
11
11
|
if (typeof e != "object" || !e || !("id" in e)) return null;
|
|
12
12
|
let t = e.id;
|
|
13
13
|
if (typeof t != "string") return null;
|
|
14
14
|
let n = t.trim();
|
|
15
15
|
return n === "" ? null : n;
|
|
16
|
-
},
|
|
16
|
+
}, c = (e, t) => e(t), l = (e) => {
|
|
17
17
|
let { ariaLabel: t, fallback: n, resolveDetailHref: r, className: i, renderAction: a } = e;
|
|
18
18
|
return {
|
|
19
19
|
id: "actions",
|
|
@@ -21,7 +21,7 @@ var e = 24, t = 6, n = 4, r = 32, i = 8, a = {
|
|
|
21
21
|
className: i,
|
|
22
22
|
mobileRole: "action",
|
|
23
23
|
cell: (e) => {
|
|
24
|
-
let i =
|
|
24
|
+
let i = s(e);
|
|
25
25
|
if (i == null) return n;
|
|
26
26
|
let o = r(i);
|
|
27
27
|
return o == null ? n : a({
|
|
@@ -32,6 +32,6 @@ var e = 24, t = 6, n = 4, r = 32, i = 8, a = {
|
|
|
32
32
|
};
|
|
33
33
|
};
|
|
34
34
|
//#endregion
|
|
35
|
-
export {
|
|
35
|
+
export { l as buildActionsColumn, n as computeActionsColumnWidthPx, t as computeRowFlagsColumnWidthPx, a as isFormMutationAction, i as isRouteAction, o as resolveActionVariant, c as resolveLabel, s as resolveRowId, r as resolveTrackBySize };
|
|
36
36
|
|
|
37
37
|
//# sourceMappingURL=BackofficeEntityListPage.helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackofficeEntityListPage.helpers.js","names":[],"sources":["../../../src/pages/BackofficeEntityListPage.helpers.tsx"],"sourcesContent":["import type { ComponentProps, JSX } from 'react';\n\nimport type {\n BackofficeEntityFormMutationActionSpec,\n BackofficeEntityRouteActionSpec,\n BackofficeListActionSpec,\n BackofficeRuntimeConnectionListConfig,\n BackofficeRuntimeResolvedListFacetConfig,\n I18nLabel,\n} from '@plumile/backoffice-core/types.js';\nimport type { Button } from '@plumile/ui/atomic/atoms/button/Button.js';\nimport type { DataTableColumn } from '@plumile/ui/components/data-table/DataTable.js';\nimport type { TFunction } from 'i18next';\n\nimport type { BackofficeSizedDataTableColumn } from '../components/backoffice/columns/buildDataTableColumns.js';\n\ntype ButtonVariant = ComponentProps<typeof Button>['variant'];\n\nconst ROW_FLAGS_SLOT_PX = 24;\nconst ROW_FLAGS_GAP_PX = 6;\nconst ROW_FLAGS_PADDING_X_PX = 4;\n\nconst ACTIONS_SLOT_PX = 32;\nconst ACTIONS_GAP_PX = 8;\nconst ACTIONS_PADDING_X_PX = 12;\nconst ACTIONS_SAFETY_PX = 4;\n\nconst listColumnTrackBySize: Record<\n BackofficeSizedDataTableColumn<unknown>['size'],\n string\n> = {\n xs: 'minmax(3.5rem, 7rem)',\n s: 'minmax(5rem, 10rem)',\n statusAction: 'minmax(7rem, 12rem)',\n m: 'minmax(7rem, 14rem)',\n l: 'minmax(9rem, 18rem)',\n xl: 'minmax(11rem, 24rem)',\n fluid: 'minmax(0, 1fr)',\n};\n\nexport const computeRowFlagsColumnWidthPx = (flagCount: number): number => {\n if (flagCount <= 0) {\n return 0;\n }\n return (\n ROW_FLAGS_PADDING_X_PX * 2 +\n ROW_FLAGS_SLOT_PX * flagCount +\n ROW_FLAGS_GAP_PX * Math.max(0, flagCount - 1)\n );\n};\n\nexport const computeActionsColumnWidthPx = (actionCount: number): number => {\n if (actionCount <= 0) {\n return 0;\n }\n return (\n ACTIONS_SAFETY_PX +\n ACTIONS_PADDING_X_PX * 2 +\n ACTIONS_SLOT_PX * actionCount +\n ACTIONS_GAP_PX * Math.max(0, actionCount - 1)\n );\n};\n\nexport const resolveTrackBySize = (\n column: DataTableColumn<unknown>,\n fallback: string,\n): string => {\n if (column.mobileRole === 'action') {\n return '60px';\n }\n if (column.isPrimary === true) {\n return 'minmax(0, 1.4fr)';\n }\n if ('size' in column && typeof column.size === 'string') {\n return listColumnTrackBySize[\n column.size as BackofficeSizedDataTableColumn<unknown>['size']\n ];\n }\n return fallback;\n};\n\nexport const isRouteAction = (\n action: BackofficeListActionSpec,\n): action is BackofficeEntityRouteActionSpec<null> => {\n return action.kind === 'route';\n};\n\nexport const isFormMutationAction = (\n action: BackofficeListActionSpec,\n): action is BackofficeEntityFormMutationActionSpec<null, any, any, any> => {\n return action.kind === 'formMutation';\n};\n\nexport const resolveActionVariant = (\n actionVariant: ButtonVariant | undefined,\n index: number,\n): Exclude<ButtonVariant, undefined> => {\n if (actionVariant != null) {\n return actionVariant;\n }\n if (index === 0) {\n return 'primary';\n }\n return 'secondary';\n};\n\nexport const resolveRowId = (row: unknown): string | null => {\n if (row == null || typeof row !== 'object') {\n return null;\n }\n if (!('id' in row)) {\n return null;\n }\n const value = (row as { id?: unknown }).id;\n if (typeof value !== 'string') {\n return null;\n }\n const trimmed = value.trim();\n if (trimmed === '') {\n return null;\n }\n return trimmed;\n};\n\nexport type ConnectionListConfig = BackofficeRuntimeResolvedListFacetConfig & {\n list: BackofficeRuntimeConnectionListConfig;\n};\n\nexport const resolveLabel = (label: I18nLabel, tApp: TFunction): string => {\n return label(tApp);\n};\n\nexport const buildActionsColumn = (options: {\n ariaLabel: string;\n fallback: string;\n resolveDetailHref: (id: string) => string | null;\n className?: string;\n renderAction: (input: { href: string; ariaLabel: string }) => JSX.Element;\n}): DataTableColumn<unknown> => {\n const { ariaLabel, fallback, resolveDetailHref, className, renderAction } =\n options;\n\n return {\n id: 'actions',\n header: '',\n className,\n mobileRole: 'action',\n cell: (row) => {\n const id = resolveRowId(row);\n if (id == null) {\n return fallback;\n }\n const href = resolveDetailHref(id);\n if (href == null) {\n return fallback;\n }\n return renderAction({ href, ariaLabel });\n },\n };\n};\n"],"mappings":";AAkBA,
|
|
1
|
+
{"version":3,"file":"BackofficeEntityListPage.helpers.js","names":[],"sources":["../../../src/pages/BackofficeEntityListPage.helpers.tsx"],"sourcesContent":["import type { ComponentProps, JSX } from 'react';\n\nimport type {\n BackofficeEntityFormMutationActionSpec,\n BackofficeEntityRouteActionSpec,\n BackofficeListActionSpec,\n BackofficeRuntimeConnectionListConfig,\n BackofficeRuntimeResolvedListFacetConfig,\n I18nLabel,\n} from '@plumile/backoffice-core/types.js';\nimport type { Button } from '@plumile/ui/atomic/atoms/button/Button.js';\nimport type { DataTableColumn } from '@plumile/ui/components/data-table/DataTable.js';\nimport type { TFunction } from 'i18next';\n\nimport type { BackofficeSizedDataTableColumn } from '../components/backoffice/columns/buildDataTableColumns.js';\n\ntype ButtonVariant = ComponentProps<typeof Button>['variant'];\n\nconst ROW_FLAGS_SLOT_PX = 24;\nconst ROW_FLAGS_GAP_PX = 6;\nconst ROW_FLAGS_PADDING_X_PX = 4;\n\nconst ACTIONS_SLOT_PX = 32;\nconst ACTIONS_GAP_PX = 8;\nconst ACTIONS_PADDING_X_PX = 12;\nconst ACTIONS_SAFETY_PX = 4;\n\nconst listColumnTrackBySize: Record<\n BackofficeSizedDataTableColumn<unknown>['size'],\n string\n> = {\n xs: 'minmax(3.5rem, 7rem)',\n s: 'minmax(5rem, 10rem)',\n statusAction: 'minmax(7rem, 12rem)',\n m: 'minmax(7rem, 14rem)',\n l: 'minmax(9rem, 18rem)',\n xl: 'minmax(11rem, 24rem)',\n fluid: 'minmax(0, 1fr)',\n};\n\nexport const computeRowFlagsColumnWidthPx = (flagCount: number): number => {\n if (flagCount <= 0) {\n return 0;\n }\n return (\n ROW_FLAGS_PADDING_X_PX * 2 +\n ROW_FLAGS_SLOT_PX * flagCount +\n ROW_FLAGS_GAP_PX * Math.max(0, flagCount - 1)\n );\n};\n\nexport const computeActionsColumnWidthPx = (actionCount: number): number => {\n if (actionCount <= 0) {\n return 0;\n }\n return (\n ACTIONS_SAFETY_PX +\n ACTIONS_PADDING_X_PX * 2 +\n ACTIONS_SLOT_PX * actionCount +\n ACTIONS_GAP_PX * Math.max(0, actionCount - 1)\n );\n};\n\nexport const resolveTrackBySize = (\n column: DataTableColumn<unknown>,\n fallback: string,\n): string => {\n if (column.mobileRole === 'action') {\n return '60px';\n }\n if (column.isPrimary === true) {\n return 'minmax(0, 1.4fr)';\n }\n if ('size' in column && typeof column.size === 'string') {\n return listColumnTrackBySize[\n column.size as BackofficeSizedDataTableColumn<unknown>['size']\n ];\n }\n return fallback;\n};\n\nexport const isRouteAction = (\n action: BackofficeListActionSpec,\n): action is BackofficeEntityRouteActionSpec<null> => {\n return action.kind === 'route';\n};\n\nexport const isFormMutationAction = (\n action: BackofficeListActionSpec,\n): action is BackofficeEntityFormMutationActionSpec<null, any, any, any> => {\n return action.kind === 'formMutation';\n};\n\nexport const resolveActionVariant = (\n actionVariant: ButtonVariant | undefined,\n index: number,\n): Exclude<ButtonVariant, undefined> => {\n if (actionVariant != null) {\n return actionVariant;\n }\n if (index === 0) {\n return 'primary';\n }\n return 'secondary';\n};\n\nexport const resolveRowId = (row: unknown): string | null => {\n if (row == null || typeof row !== 'object') {\n return null;\n }\n if (!('id' in row)) {\n return null;\n }\n const value = (row as { id?: unknown }).id;\n if (typeof value !== 'string') {\n return null;\n }\n const trimmed = value.trim();\n if (trimmed === '') {\n return null;\n }\n return trimmed;\n};\n\nexport type ConnectionListConfig = BackofficeRuntimeResolvedListFacetConfig & {\n list: BackofficeRuntimeConnectionListConfig;\n};\n\nexport const resolveLabel = (label: I18nLabel, tApp: TFunction): string => {\n return label(tApp);\n};\n\nexport const buildActionsColumn = (options: {\n ariaLabel: string;\n fallback: string;\n resolveDetailHref: (id: string) => string | null;\n className?: string;\n renderAction: (input: { href: string; ariaLabel: string }) => JSX.Element;\n}): DataTableColumn<unknown> => {\n const { ariaLabel, fallback, resolveDetailHref, className, renderAction } =\n options;\n\n return {\n id: 'actions',\n header: '',\n className,\n mobileRole: 'action',\n cell: (row) => {\n const id = resolveRowId(row);\n if (id == null) {\n return fallback;\n }\n const href = resolveDetailHref(id);\n if (href == null) {\n return fallback;\n }\n return renderAction({ href, ariaLabel });\n },\n };\n};\n"],"mappings":";AAkBA,IASM,IAGF;CACF,IAAI;CACJ,GAAG;CACH,cAAc;CACd,GAAG;CACH,GAAG;CACH,IAAI;CACJ,OAAO;AACT,GAEa,KAAgC,MACvC,KAAa,IACR,IAGP,IACA,KAAoB,IACpB,IAAmB,KAAK,IAAI,GAAG,IAAY,CAAC,GAInC,KAA+B,MACtC,KAAe,IACV,IAGP,KAEA,KAAkB,IAClB,IAAiB,KAAK,IAAI,GAAG,IAAc,CAAC,GAInC,KACX,GACA,MAEI,EAAO,eAAe,WACjB,SAEL,EAAO,cAAc,KAChB,qBAEL,UAAU,KAAU,OAAO,EAAO,QAAS,WACtC,EACL,EAAO,QAGJ,GAGI,KACX,MAEO,EAAO,SAAS,SAGZ,KACX,MAEO,EAAO,SAAS,gBAGZ,KACX,GACA,MAEI,MAGA,MAAU,IACL,YAEF,cAGI,KAAgB,MAAgC;CAI3D,IAHmB,OAAO,KAAQ,aAA9B,KAGA,EAAE,QAAQ,IACZ,OAAO;CAET,IAAM,IAAS,EAAyB;CACxC,IAAI,OAAO,KAAU,UACnB,OAAO;CAET,IAAM,IAAU,EAAM,KAAK;CAI3B,OAHI,MAAY,KACP,OAEF;AACT,GAMa,KAAgB,GAAkB,MACtC,EAAM,CAAI,GAGN,KAAsB,MAMH;CAC9B,IAAM,EAAE,cAAW,aAAU,sBAAmB,cAAW,oBACzD;CAEF,OAAO;EACL,IAAI;EACJ,QAAQ;EACR;EACA,YAAY;EACZ,OAAO,MAAQ;GACb,IAAM,IAAK,EAAa,CAAG;GAC3B,IAAI,KAAM,MACR,OAAO;GAET,IAAM,IAAO,EAAkB,CAAE;GAIjC,OAHI,KAAQ,OACH,IAEF,EAAa;IAAE;IAAM;GAAU,CAAC;EACzC;CACF;AACF"}
|
|
@@ -7,19 +7,20 @@ import { rowFlagsColumnCell as a } from "../components/backoffice/list/RowFlagsC
|
|
|
7
7
|
import { RowFlagsCell as o } from "../components/backoffice/list/RowFlagsCell.js";
|
|
8
8
|
import { BackofficeEntityListScaffold as s } from "../components/backoffice/scaffolds/BackofficeEntityListScaffold.js";
|
|
9
9
|
import { useBackofficeListUrlState as c } from "../hooks/useBackofficeListUrlState.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
10
|
+
import { createBackofficeEntityListUiStateKey as l, useBackofficeListFilterDrawerState as u } from "../provider/BackofficeListUiStateContext.js";
|
|
11
|
+
import { BackofficeEntityListRouteProvider as d } from "./BackofficeEntityListRouteContext.js";
|
|
12
|
+
import { buildActionsColumn as f, computeActionsColumnWidthPx as p, computeRowFlagsColumnWidthPx as m, isFormMutationAction as h, isRouteAction as g, resolveActionVariant as _, resolveLabel as v, resolveTrackBySize as y } from "./BackofficeEntityListPage.helpers.js";
|
|
13
|
+
import { actionTrigger as b, actionsColumnCell as x, headerActions as S } from "./backofficeEntityListPage.css.js";
|
|
14
|
+
import { Suspense as C, useCallback as w, useMemo as T, useRef as E, useState as D } from "react";
|
|
15
|
+
import { jsx as O, jsxs as k } from "react/jsx-runtime";
|
|
16
|
+
import { useTranslation as A } from "react-i18next";
|
|
17
|
+
import { Button as j } from "@plumile/ui/atomic/atoms/button/Button.js";
|
|
18
|
+
import M from "@plumile/router/routing/Link.js";
|
|
19
|
+
import { LinkButton as N } from "@plumile/ui/atomic/atoms/button/LinkButton.js";
|
|
20
|
+
import { TableCell as P } from "@plumile/ui/components/data-table/TableCell.js";
|
|
21
|
+
import { EyeSvg as F } from "@plumile/ui/icons/EyeSvg.js";
|
|
21
22
|
//#region src/pages/BackofficeEntityListPage.tsx
|
|
22
|
-
var
|
|
23
|
+
var I = (e, t, n, r) => {
|
|
23
24
|
let i = t != null && t.length > 0, s = e;
|
|
24
25
|
if (i) {
|
|
25
26
|
let n = [{
|
|
@@ -27,7 +28,7 @@ var P = (e, t, n, r) => {
|
|
|
27
28
|
header: "",
|
|
28
29
|
className: a,
|
|
29
30
|
mobileRole: "badge",
|
|
30
|
-
cell: (e) => /* @__PURE__ */
|
|
31
|
+
cell: (e) => /* @__PURE__ */ O(o, {
|
|
31
32
|
row: e,
|
|
32
33
|
flags: t,
|
|
33
34
|
tApp: r
|
|
@@ -40,54 +41,54 @@ var P = (e, t, n, r) => {
|
|
|
40
41
|
}
|
|
41
42
|
let c = 0;
|
|
42
43
|
i && (c = t.length);
|
|
43
|
-
let l =
|
|
44
|
-
i && (
|
|
45
|
-
let
|
|
44
|
+
let l = m(c), u = p(n), d = 0;
|
|
45
|
+
i && (d = 1);
|
|
46
|
+
let f = s.length - d - 1, h = s.slice(d, d + Math.max(0, f)).map((e) => y(e, "1fr")).join(" "), g = "";
|
|
46
47
|
return g = i ? `${l}px ${h} ${u}px` : `${h} ${u}px`, {
|
|
47
48
|
columns: s,
|
|
48
49
|
gridTemplateColumns: g
|
|
49
50
|
};
|
|
50
|
-
},
|
|
51
|
-
let
|
|
52
|
-
|
|
53
|
-
}, []), { columns:
|
|
54
|
-
let e = n(
|
|
55
|
-
tApp:
|
|
56
|
-
t:
|
|
57
|
-
}), t =
|
|
58
|
-
ariaLabel:
|
|
59
|
-
fallback:
|
|
60
|
-
className:
|
|
51
|
+
}, L = ({ children: i, config: a, breadcrumb: o }) => {
|
|
52
|
+
let p = a.list, { t: m } = A(), { t: y } = e(), [L, R] = D(null), [z, B] = D(0), V = E(null), H = w((e) => {
|
|
53
|
+
V.current = e;
|
|
54
|
+
}, []), { columns: U, gridTemplateColumns: W } = T(() => {
|
|
55
|
+
let e = n(p.columns, {
|
|
56
|
+
tApp: m,
|
|
57
|
+
t: y
|
|
58
|
+
}), t = f({
|
|
59
|
+
ariaLabel: y("actions.view"),
|
|
60
|
+
fallback: y("common.notAvailable"),
|
|
61
|
+
className: x,
|
|
61
62
|
resolveDetailHref: (e) => a.routes.detail(e),
|
|
62
|
-
renderAction: ({ href: e, ariaLabel: t }) => /* @__PURE__ */
|
|
63
|
+
renderAction: ({ href: e, ariaLabel: t }) => /* @__PURE__ */ O(P.Actions, { children: /* @__PURE__ */ O(M, {
|
|
63
64
|
to: e,
|
|
64
|
-
className:
|
|
65
|
+
className: b,
|
|
65
66
|
"aria-label": t,
|
|
66
67
|
title: t,
|
|
67
68
|
preloadOnHover: "code",
|
|
68
|
-
children: /* @__PURE__ */
|
|
69
|
+
children: /* @__PURE__ */ O(F, {
|
|
69
70
|
width: 16,
|
|
70
71
|
height: 16
|
|
71
72
|
})
|
|
72
73
|
}) })
|
|
73
74
|
});
|
|
74
|
-
return
|
|
75
|
+
return I([...e, t], p.rowFlags, 1, m);
|
|
75
76
|
}, [
|
|
76
77
|
a.routes,
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
]),
|
|
82
|
-
|
|
83
|
-
}, []),
|
|
84
|
-
if (
|
|
85
|
-
className:
|
|
86
|
-
children:
|
|
87
|
-
let { variant: n } = e, r =
|
|
88
|
-
e.ariaLabel != null && (i =
|
|
89
|
-
let a =
|
|
90
|
-
return
|
|
78
|
+
p.columns,
|
|
79
|
+
p.rowFlags,
|
|
80
|
+
y,
|
|
81
|
+
m
|
|
82
|
+
]), G = w((e) => p.getRowId(e), [p]), { state: K, pushState: q } = c(a), J = u(T(() => l(a.id), [a.id])), Y = w(() => {
|
|
83
|
+
B((e) => e + 1), V.current?.();
|
|
84
|
+
}, []), X = T(() => a.listActions ?? [], [a.listActions]), Z = T(() => X.filter((e) => e.isVisible == null ? !0 : e.isVisible(null)), [X]), Q = T(() => {
|
|
85
|
+
if (Z.length !== 0) return /* @__PURE__ */ O("div", {
|
|
86
|
+
className: S,
|
|
87
|
+
children: Z.map((e, t) => {
|
|
88
|
+
let { variant: n } = e, r = v(e.label, m), i = r;
|
|
89
|
+
e.ariaLabel != null && (i = v(e.ariaLabel, m));
|
|
90
|
+
let a = _(n, t), o = e.size ?? "small", s = e.isDisabled?.(null) === !0;
|
|
91
|
+
return g(e) ? /* @__PURE__ */ O(N, {
|
|
91
92
|
to: e.to(null),
|
|
92
93
|
variant: a,
|
|
93
94
|
size: o,
|
|
@@ -95,80 +96,83 @@ var P = (e, t, n, r) => {
|
|
|
95
96
|
"aria-label": i,
|
|
96
97
|
preloadOnHover: "code-and-data",
|
|
97
98
|
children: r
|
|
98
|
-
}, e.id) :
|
|
99
|
+
}, e.id) : h(e) ? /* @__PURE__ */ O(j, {
|
|
99
100
|
type: "button",
|
|
100
101
|
variant: a,
|
|
101
102
|
size: o,
|
|
102
103
|
disabled: s,
|
|
103
104
|
onClick: () => {
|
|
104
|
-
|
|
105
|
+
R(e.id);
|
|
105
106
|
},
|
|
106
107
|
"aria-label": i,
|
|
107
108
|
children: r
|
|
108
109
|
}, e.id) : null;
|
|
109
110
|
})
|
|
110
111
|
});
|
|
111
|
-
}, [
|
|
112
|
-
return /* @__PURE__ */
|
|
112
|
+
}, [m, Z]), $ = X.find((e) => e.id === L);
|
|
113
|
+
return /* @__PURE__ */ k(r, {
|
|
113
114
|
breadcrumb: o,
|
|
114
|
-
children: [/* @__PURE__ */
|
|
115
|
-
value:
|
|
115
|
+
children: [/* @__PURE__ */ O(d, {
|
|
116
|
+
value: T(() => ({
|
|
116
117
|
config: a,
|
|
117
|
-
state:
|
|
118
|
-
pushState:
|
|
119
|
-
headerActions:
|
|
120
|
-
columns:
|
|
121
|
-
gridTemplateColumns:
|
|
122
|
-
getRowId:
|
|
123
|
-
countFetchKey:
|
|
118
|
+
state: K,
|
|
119
|
+
pushState: q,
|
|
120
|
+
headerActions: Q,
|
|
121
|
+
columns: U,
|
|
122
|
+
gridTemplateColumns: W,
|
|
123
|
+
getRowId: G,
|
|
124
|
+
countFetchKey: z,
|
|
125
|
+
filterDrawerState: J,
|
|
124
126
|
bumpCountFetchKey: () => {
|
|
125
|
-
|
|
127
|
+
B((e) => e + 1);
|
|
126
128
|
},
|
|
127
|
-
registerRefresh:
|
|
129
|
+
registerRefresh: H
|
|
128
130
|
}), [
|
|
129
|
-
V,
|
|
130
|
-
a,
|
|
131
|
-
L,
|
|
132
131
|
U,
|
|
133
|
-
|
|
134
|
-
|
|
132
|
+
a,
|
|
133
|
+
z,
|
|
134
|
+
J,
|
|
135
135
|
G,
|
|
136
|
-
|
|
137
|
-
|
|
136
|
+
W,
|
|
137
|
+
Q,
|
|
138
|
+
q,
|
|
139
|
+
H,
|
|
140
|
+
K
|
|
138
141
|
]),
|
|
139
|
-
children: /* @__PURE__ */
|
|
140
|
-
fallback: /* @__PURE__ */
|
|
142
|
+
children: /* @__PURE__ */ O(C, {
|
|
143
|
+
fallback: /* @__PURE__ */ O(s, {
|
|
141
144
|
config: a,
|
|
142
|
-
state:
|
|
143
|
-
pushState:
|
|
144
|
-
headerActions:
|
|
145
|
+
state: K,
|
|
146
|
+
pushState: q,
|
|
147
|
+
headerActions: Q,
|
|
145
148
|
rows: [],
|
|
146
|
-
columns:
|
|
147
|
-
gridTemplateColumns:
|
|
148
|
-
getRowId:
|
|
149
|
+
columns: U,
|
|
150
|
+
gridTemplateColumns: W,
|
|
151
|
+
getRowId: G,
|
|
149
152
|
hasNextPage: !1,
|
|
150
153
|
isLoadingMore: !1,
|
|
151
154
|
isRefreshing: !1,
|
|
152
155
|
onLoadMore: () => {},
|
|
153
|
-
onRefresh:
|
|
156
|
+
onRefresh: Y,
|
|
154
157
|
totalCount: null,
|
|
155
|
-
isLoadingInitial: !0
|
|
158
|
+
isLoadingInitial: !0,
|
|
159
|
+
filterDrawerState: J
|
|
156
160
|
}),
|
|
157
161
|
children: i
|
|
158
162
|
})
|
|
159
|
-
}),
|
|
163
|
+
}), $ != null && h($) && /* @__PURE__ */ O(t, {
|
|
160
164
|
isOpen: !0,
|
|
161
|
-
action:
|
|
165
|
+
action: $,
|
|
162
166
|
node: null,
|
|
163
167
|
onClose: () => {
|
|
164
|
-
|
|
168
|
+
R(null);
|
|
165
169
|
},
|
|
166
|
-
onSuccess:
|
|
170
|
+
onSuccess: Y
|
|
167
171
|
})]
|
|
168
172
|
});
|
|
169
|
-
},
|
|
170
|
-
let { t: r } =
|
|
171
|
-
return /* @__PURE__ */
|
|
173
|
+
}, R = ({ children: e, entityManifest: t, config: n }) => {
|
|
174
|
+
let { t: r } = A();
|
|
175
|
+
return /* @__PURE__ */ O(L, {
|
|
172
176
|
children: e,
|
|
173
177
|
entityManifest: t,
|
|
174
178
|
config: n,
|
|
@@ -176,6 +180,6 @@ var P = (e, t, n, r) => {
|
|
|
176
180
|
});
|
|
177
181
|
};
|
|
178
182
|
//#endregion
|
|
179
|
-
export {
|
|
183
|
+
export { R as BackofficeEntityListPage, R as default };
|
|
180
184
|
|
|
181
185
|
//# sourceMappingURL=BackofficeEntityListPage.js.map
|