@plumile/backoffice-react 0.1.165 → 0.1.166
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/authRefreshNotice.css.js +0 -1
- package/lib/esm/auth/login/loginPage.css.js +1 -0
- package/lib/esm/components/backoffice/detail/BackofficeDetailRelationListBlock.js +85 -69
- package/lib/esm/components/backoffice/detail/BackofficeDetailRelationListBlock.js.map +1 -1
- package/lib/esm/components/backoffice/filters/backofficeFilterAction.css.js +1 -0
- package/lib/esm/components/backoffice/layout/breadcrumb/backofficeTopbarBreadcrumb.css.js +0 -1
- package/lib/esm/components/backoffice/refs/BackofficeLazyEntityCount.js +17 -8
- package/lib/esm/components/backoffice/refs/BackofficeLazyEntityCount.js.map +1 -1
- package/lib/esm/components/backoffice/scaffolds/BackofficeEntityListScaffold.js +54 -53
- package/lib/esm/components/backoffice/scaffolds/BackofficeEntityListScaffold.js.map +1 -1
- package/lib/esm/index.js +21 -21
- package/lib/esm/pages/BackofficeEntityDetailPage.js +19 -19
- package/lib/esm/pages/BackofficeEntityDetailPage.js.map +1 -1
- package/lib/esm/pages/BackofficeEntityListPage.js +112 -99
- package/lib/esm/pages/BackofficeEntityListPage.js.map +1 -1
- package/lib/types/components/backoffice/detail/BackofficeDetailRelationListBlock.d.ts.map +1 -1
- package/lib/types/components/backoffice/refs/BackofficeLazyEntityCount.d.ts +13 -1
- package/lib/types/components/backoffice/refs/BackofficeLazyEntityCount.d.ts.map +1 -1
- package/lib/types/components/backoffice/scaffolds/BackofficeEntityListScaffold.d.ts +1 -0
- package/lib/types/components/backoffice/scaffolds/BackofficeEntityListScaffold.d.ts.map +1 -1
- package/lib/types/pages/BackofficeEntityListPage.d.ts.map +1 -1
- package/package.json +6 -6
|
@@ -5,106 +5,122 @@ import { buildDataTableColumns as r } from "../columns/buildDataTableColumns.js"
|
|
|
5
5
|
import { useBackofficeLoadMore as i } from "../../../hooks/useBackofficeLoadMore.js";
|
|
6
6
|
import { useBackofficeListRefetch as a } from "../../../hooks/useBackofficeListRefetch.js";
|
|
7
7
|
import { BackofficeEntityListScaffold as o } from "../scaffolds/BackofficeEntityListScaffold.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
8
|
+
import { BackofficeLazyEntityCountLabel as s } from "../refs/BackofficeLazyEntityCount.js";
|
|
9
|
+
import { Suspense as c, useCallback as l, useMemo as u, useState as d } from "react";
|
|
10
|
+
import { InlineBanner as f } from "@plumile/ui/components/feedback/InlineBanner.js";
|
|
11
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
12
|
+
import { useTranslation as m } from "react-i18next";
|
|
13
|
+
import * as h from "react-relay";
|
|
14
|
+
import { BACKOFFICE_LIST_REFETCH_POLICY as g, BACKOFFICE_RELATED_TAB_PAGE_SIZE as _ } from "@plumile/backoffice-core/constants.js";
|
|
15
|
+
import { setWhereValue as v } from "@plumile/backoffice-core/filters/where.js";
|
|
16
|
+
import { BackofficeTableSkeleton as y } from "@plumile/ui/backoffice/molecules/backoffice_table_skeleton/BackofficeTableSkeleton.js";
|
|
16
17
|
//#region src/components/backoffice/detail/BackofficeDetailRelationListBlock.tsx
|
|
17
|
-
var { useLazyLoadQuery:
|
|
18
|
+
var { useLazyLoadQuery: b, usePaginationFragment: x } = h, S = () => {
|
|
18
19
|
let { t } = e();
|
|
19
|
-
return /* @__PURE__ */
|
|
20
|
+
return /* @__PURE__ */ p(y, {
|
|
20
21
|
rows: 6,
|
|
21
22
|
ariaLabel: t("common.loading")
|
|
22
23
|
});
|
|
23
|
-
},
|
|
24
|
-
let { t:
|
|
24
|
+
}, C = ({ title: t, config: n, relation: c, value: f }) => {
|
|
25
|
+
let { t: h } = m(), { t: y } = e(), S = n.list, C = n.listDefaults ?? S.defaultState ?? {
|
|
25
26
|
where: null,
|
|
26
27
|
sort: null
|
|
27
|
-
}, [
|
|
28
|
-
where:
|
|
29
|
-
sort:
|
|
30
|
-
}),
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
]),
|
|
36
|
-
where:
|
|
37
|
-
sort:
|
|
38
|
-
count:
|
|
28
|
+
}, [w, T] = d({
|
|
29
|
+
where: C.where,
|
|
30
|
+
sort: C.sort ?? null
|
|
31
|
+
}), [E, D] = d(0), O = u(() => f == null || f.trim() === "" ? null : v(w.where, c.whereKey, f, c.path), [
|
|
32
|
+
c.path,
|
|
33
|
+
c.whereKey,
|
|
34
|
+
w.where,
|
|
35
|
+
f
|
|
36
|
+
]), k = O ?? w.where, A = w.sort ?? C.sort, j = u(() => ({
|
|
37
|
+
where: k,
|
|
38
|
+
sort: A,
|
|
39
|
+
count: _,
|
|
39
40
|
cursor: null
|
|
40
|
-
}), [
|
|
41
|
-
tApp:
|
|
42
|
-
t:
|
|
41
|
+
}), [k, A]), M = u(() => S.buildQueryVariables(j), [S, j]), N = b(S.query, M, { fetchPolicy: "store-or-network" }), { data: P, loadNext: F, hasNext: I, isLoadingNext: L, refetch: R } = x(S.fragment, N), z = S.getConnection(P), B = u(() => z.edges.map((e) => S.toRow(e.node)), [z.edges, S]), V = u(() => r(S.columns, {
|
|
42
|
+
tApp: h,
|
|
43
|
+
t: y
|
|
43
44
|
}), [
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
]),
|
|
48
|
-
refetch:
|
|
49
|
-
variables:
|
|
50
|
-
defaults:
|
|
51
|
-
where:
|
|
52
|
-
sort:
|
|
53
|
-
count:
|
|
45
|
+
S.columns,
|
|
46
|
+
y,
|
|
47
|
+
h
|
|
48
|
+
]), H = l((e) => S.getRowId(e), [S]), { isRefreshing: U, onRefresh: W } = a({
|
|
49
|
+
refetch: R,
|
|
50
|
+
variables: j,
|
|
51
|
+
defaults: u(() => ({
|
|
52
|
+
where: O ?? C.where,
|
|
53
|
+
sort: C.sort,
|
|
54
|
+
count: _,
|
|
54
55
|
cursor: null
|
|
55
56
|
}), [
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
C.sort,
|
|
58
|
+
C.where,
|
|
59
|
+
O
|
|
59
60
|
]),
|
|
60
|
-
fetchPolicy:
|
|
61
|
-
buildQueryVariables:
|
|
62
|
-
}),
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
61
|
+
fetchPolicy: g,
|
|
62
|
+
buildQueryVariables: S.buildQueryVariables
|
|
63
|
+
}), G = l(() => {
|
|
64
|
+
D((e) => e + 1), W();
|
|
65
|
+
}, [W]), K = i({
|
|
66
|
+
hasNext: I,
|
|
67
|
+
isLoadingNext: L,
|
|
68
|
+
loadNext: F,
|
|
69
|
+
count: _
|
|
70
|
+
}), q = null;
|
|
71
|
+
B.length > 0 && (q = /* @__PURE__ */ p("span", { children: y("list.loaded", { count: B.length }) }));
|
|
72
|
+
let J = /* @__PURE__ */ p(s, {
|
|
73
|
+
count: S.count,
|
|
74
|
+
where: k,
|
|
75
|
+
fetchKey: E,
|
|
76
|
+
fallback: q,
|
|
77
|
+
children: (e) => /* @__PURE__ */ p("span", { children: y("list.showing", {
|
|
78
|
+
shown: B.length,
|
|
79
|
+
total: e
|
|
80
|
+
}) })
|
|
67
81
|
});
|
|
68
|
-
return /* @__PURE__ */
|
|
82
|
+
return /* @__PURE__ */ p(o, {
|
|
69
83
|
config: n,
|
|
70
|
-
state:
|
|
84
|
+
state: w,
|
|
71
85
|
pushState: (e) => {
|
|
72
|
-
|
|
86
|
+
T(e);
|
|
73
87
|
},
|
|
74
88
|
header: { title: t },
|
|
75
|
-
rows:
|
|
76
|
-
columns:
|
|
77
|
-
getRowId:
|
|
78
|
-
hasNextPage:
|
|
79
|
-
isLoadingMore:
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
89
|
+
rows: B,
|
|
90
|
+
columns: V,
|
|
91
|
+
getRowId: H,
|
|
92
|
+
hasNextPage: I,
|
|
93
|
+
isLoadingMore: L,
|
|
94
|
+
isRefreshing: U,
|
|
95
|
+
onLoadMore: K,
|
|
96
|
+
onRefresh: G,
|
|
97
|
+
totalCount: null,
|
|
98
|
+
loadedCountLabel: J,
|
|
83
99
|
variant: "embedded"
|
|
84
100
|
});
|
|
85
|
-
},
|
|
86
|
-
let { t: a } = e(), o = n(
|
|
87
|
-
if (o.status === "loading") return /* @__PURE__ */
|
|
101
|
+
}, w = ({ title: t, relation: r, value: i }) => {
|
|
102
|
+
let { t: a } = e(), o = n(u(() => [r.target], [r.target]));
|
|
103
|
+
if (o.status === "loading") return /* @__PURE__ */ p(y, {
|
|
88
104
|
rows: 6,
|
|
89
105
|
ariaLabel: a("common.loading")
|
|
90
106
|
});
|
|
91
|
-
if (o.status === "error") return /* @__PURE__ */ f
|
|
107
|
+
if (o.status === "error") return /* @__PURE__ */ p(f, {
|
|
92
108
|
tone: "warning",
|
|
93
109
|
title: a("relations.unavailable.title"),
|
|
94
110
|
children: a("relations.unavailable.description")
|
|
95
111
|
});
|
|
96
112
|
let s = o.modules[r.target]?.config;
|
|
97
|
-
return s == null ? null : /* @__PURE__ */
|
|
113
|
+
return s == null ? null : /* @__PURE__ */ p(C, {
|
|
98
114
|
title: t,
|
|
99
115
|
config: s,
|
|
100
116
|
relation: r,
|
|
101
117
|
value: i
|
|
102
118
|
});
|
|
103
|
-
},
|
|
104
|
-
fallback: () => /* @__PURE__ */
|
|
105
|
-
children: /* @__PURE__ */
|
|
106
|
-
fallback: /* @__PURE__ */
|
|
107
|
-
children: /* @__PURE__ */
|
|
119
|
+
}, T = ({ title: e, relation: n, value: r }) => /* @__PURE__ */ p(t, {
|
|
120
|
+
fallback: () => /* @__PURE__ */ p(S, {}),
|
|
121
|
+
children: /* @__PURE__ */ p(c, {
|
|
122
|
+
fallback: /* @__PURE__ */ p(S, {}),
|
|
123
|
+
children: /* @__PURE__ */ p(w, {
|
|
108
124
|
title: e,
|
|
109
125
|
relation: n,
|
|
110
126
|
value: r
|
|
@@ -112,6 +128,6 @@ var { useLazyLoadQuery: y, usePaginationFragment: b } = m, x = () => {
|
|
|
112
128
|
})
|
|
113
129
|
});
|
|
114
130
|
//#endregion
|
|
115
|
-
export {
|
|
131
|
+
export { T as BackofficeDetailRelationListBlock, T as default };
|
|
116
132
|
|
|
117
133
|
//# sourceMappingURL=BackofficeDetailRelationListBlock.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackofficeDetailRelationListBlock.js","names":[],"sources":["../../../../../src/components/backoffice/detail/BackofficeDetailRelationListBlock.tsx"],"sourcesContent":["import { Suspense, useCallback, useMemo, useState, type JSX } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport * as ReactRelay from 'react-relay';\nimport type { OperationType } from 'relay-runtime';\n\nimport {\n BACKOFFICE_LIST_REFETCH_POLICY,\n BACKOFFICE_RELATED_TAB_PAGE_SIZE,\n} from '@plumile/backoffice-core/constants.js';\nimport { setWhereValue } from '@plumile/backoffice-core/filters/where.js';\nimport type {\n BackofficeListState,\n BackofficeRuntimeRelationFilterSpec,\n BackofficeRuntimeResolvedListFacetConfig,\n} from '@plumile/backoffice-core/types.js';\nimport { BackofficeTableSkeleton } from '@plumile/ui/backoffice/molecules/backoffice_table_skeleton/BackofficeTableSkeleton.js';\nimport { InlineBanner } from '@plumile/ui/components/feedback/InlineBanner.js';\n\nimport { buildDataTableColumns } from '../columns/buildDataTableColumns.js';\nimport { useBackofficeLoadMore } from '../../../hooks/useBackofficeLoadMore.js';\nimport { useBackofficeListRefetch } from '../../../hooks/useBackofficeListRefetch.js';\nimport { useBackofficeReactTranslation } from '../../../i18n/useBackofficeReactTranslation.js';\nimport { useBackofficeListEntitiesLoader } from '../../../provider/useBackofficeEntityLoader.js';\nimport { BackofficeEntityListScaffold } from '../scaffolds/BackofficeEntityListScaffold.js';\nimport { BackofficeErrorBoundary } from '../errors/BackofficeErrorBoundary.js';\n\nconst { useLazyLoadQuery, usePaginationFragment } = ReactRelay;\n\nexport type BackofficeDetailRelationListBlockProps = {\n title: string;\n relation: BackofficeRuntimeRelationFilterSpec;\n value: string | null;\n};\n\ntype RelationListContentProps = {\n title: string;\n config: BackofficeRuntimeResolvedListFacetConfig;\n relation: BackofficeRuntimeRelationFilterSpec;\n value: string | null;\n};\n\ntype RelationListBlockBodyProps = {\n title: string;\n relation: BackofficeRuntimeRelationFilterSpec;\n value: string | null;\n};\n\nconst RelationListSkeleton = (): JSX.Element => {\n const { t } = useBackofficeReactTranslation();\n\n return <BackofficeTableSkeleton rows={6} ariaLabel={t('common.loading')} />;\n};\n\nconst RelationListContent = ({\n title,\n config,\n relation,\n value,\n}: RelationListContentProps): JSX.Element | null => {\n const { t: tApp } = useTranslation();\n const { t } = useBackofficeReactTranslation();\n const listConfig = config.list;\n const listDefaults = config.listDefaults ??\n listConfig.defaultState ?? { where: null, sort: null };\n\n const [state, setState] = useState<BackofficeListState<unknown, string>>({\n where: listDefaults.where as never,\n sort: listDefaults.sort ?? null,\n });\n\n const relationWhere = useMemo(() => {\n if (value == null || value.trim() === '') {\n return null;\n }\n return setWhereValue(\n state.where as Record<string, unknown> | null,\n relation.whereKey as never,\n value,\n relation.path,\n );\n }, [relation.path, relation.whereKey, state.where, value]);\n\n const effectiveWhere = relationWhere ?? (state.where as never);\n const resolvedSort = state.sort ?? listDefaults.sort;\n const variablesBase = useMemo(() => {\n return {\n where: effectiveWhere as never,\n sort: resolvedSort as never,\n count: BACKOFFICE_RELATED_TAB_PAGE_SIZE,\n cursor: null,\n };\n }, [effectiveWhere, resolvedSort]);\n\n const variables = useMemo(() => {\n return listConfig.buildQueryVariables(variablesBase);\n }, [listConfig, variablesBase]);\n\n const queryData = useLazyLoadQuery<OperationType>(\n listConfig.query,\n variables,\n { fetchPolicy: 'store-or-network' },\n );\n\n const {\n data: fragmentData,\n loadNext,\n hasNext,\n isLoadingNext,\n refetch,\n } = usePaginationFragment(listConfig.fragment, queryData as never);\n\n const connection = listConfig.getConnection(fragmentData);\n const rows = useMemo(() => {\n return connection.edges.map((edge) => {\n return listConfig.toRow(edge.node);\n });\n }, [connection.edges, listConfig]);\n\n const columns = useMemo(() => {\n return buildDataTableColumns(listConfig.columns, {\n tApp,\n t,\n });\n }, [listConfig.columns, t, tApp]);\n\n const getRowId = useCallback(\n (row: unknown) => {\n return listConfig.getRowId(row);\n },\n [listConfig],\n );\n\n const defaults = useMemo(() => {\n const baseWhere = relationWhere ?? listDefaults.where;\n return {\n where: baseWhere,\n sort: listDefaults.sort,\n count: BACKOFFICE_RELATED_TAB_PAGE_SIZE,\n cursor: null,\n };\n }, [listDefaults.sort, listDefaults.where, relationWhere]);\n\n const { onRefresh } = useBackofficeListRefetch({\n refetch,\n variables: variablesBase,\n defaults,\n fetchPolicy: BACKOFFICE_LIST_REFETCH_POLICY,\n buildQueryVariables: listConfig.buildQueryVariables,\n });\n\n const handleLoadMore = useBackofficeLoadMore({\n hasNext,\n isLoadingNext,\n loadNext,\n count: BACKOFFICE_RELATED_TAB_PAGE_SIZE,\n });\n\n return (\n <BackofficeEntityListScaffold\n config={config as never}\n state={state as never}\n pushState={(next) => {\n setState(next);\n }}\n header={{ title }}\n rows={rows}\n columns={columns as never}\n getRowId={getRowId}\n hasNextPage={hasNext}\n isLoadingMore={isLoadingNext}\n onLoadMore={handleLoadMore}\n onRefresh={onRefresh}\n totalCount={connection.totalCount ?? null}\n variant=\"embedded\"\n />\n );\n};\n\nconst RelationListBlockBody = ({\n title,\n relation,\n value,\n}: RelationListBlockBodyProps): JSX.Element | null => {\n const { t } = useBackofficeReactTranslation();\n const relatedEntityIds = useMemo(() => {\n return [relation.target];\n }, [relation.target]);\n const relatedEntitiesState =\n useBackofficeListEntitiesLoader(relatedEntityIds);\n\n if (relatedEntitiesState.status === 'loading') {\n return <BackofficeTableSkeleton rows={6} ariaLabel={t('common.loading')} />;\n }\n\n if (relatedEntitiesState.status === 'error') {\n return (\n <InlineBanner tone=\"warning\" title={t('relations.unavailable.title')}>\n {t('relations.unavailable.description')}\n </InlineBanner>\n );\n }\n\n const config = relatedEntitiesState.modules[relation.target]?.config;\n if (config == null) {\n return null;\n }\n\n return (\n <RelationListContent\n title={title}\n config={config}\n relation={relation}\n value={value}\n />\n );\n};\n\nexport const BackofficeDetailRelationListBlock = ({\n title,\n relation,\n value,\n}: BackofficeDetailRelationListBlockProps): JSX.Element => {\n return (\n <BackofficeErrorBoundary\n fallback={() => {\n return <RelationListSkeleton />;\n }}\n >\n <Suspense fallback={<RelationListSkeleton />}>\n <RelationListBlockBody\n title={title}\n relation={relation}\n value={value}\n />\n </Suspense>\n </BackofficeErrorBoundary>\n );\n};\n\nexport default BackofficeDetailRelationListBlock;\n"],"mappings":";;;;;;;;;;;;;;;;AA0BA,IAAM,EAAE,kBAAA,GAAkB,uBAAA,MAA0B,GAqB9C,UAA0C;CAC9C,IAAM,EAAE,MAAM,EAA8B;CAE5C,OAAO,kBAAC,GAAD;EAAyB,MAAM;EAAG,WAAW,EAAE,gBAAgB;CAAI,CAAA;AAC5E,GAEM,KAAuB,EAC3B,UACA,WACA,aACA,eACkD;CAClD,IAAM,EAAE,GAAG,MAAS,EAAe,GAC7B,EAAE,SAAM,EAA8B,GACtC,IAAa,EAAO,MACpB,IAAe,EAAO,gBAC1B,EAAW,gBAAgB;EAAE,OAAO;EAAM,MAAM;CAAK,GAEjD,CAAC,GAAO,KAAY,EAA+C;EACvE,OAAO,EAAa;EACpB,MAAM,EAAa,QAAQ;CAC7B,CAAC,GAEK,IAAgB,QAChB,KAAS,QAAQ,EAAM,KAAK,MAAM,KAC7B,OAEF,EACL,EAAM,OACN,EAAS,UACT,GACA,EAAS,IACX,GACC;EAAC,EAAS;EAAM,EAAS;EAAU,EAAM;EAAO;CAAK,CAAC,GAEnD,IAAiB,KAAkB,EAAM,OACzC,IAAe,EAAM,QAAQ,EAAa,MAC1C,IAAgB,SACb;EACL,OAAO;EACP,MAAM;EACN,OAAO;EACP,QAAQ;CACV,IACC,CAAC,GAAgB,C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AgB;CAAI,CAAA;CAG5E,IAAI,EAAqB,WAAW,SAClC,OACE,kBAAC,GAAD;EAAc,MAAK;EAAU,OAAO,EAAE,6BAA6B;YAChE,EAAE,mCAAmC;CAC1B,CAAA;CAIlB,IAAM,IAAS,EAAqB,QAAQ,EAAS,SAAS;CAK9D,OAJI,KAAU,OACL,OAIP,kBAAC,GAAD;EACS;EACC;EACE;EACH;CACR,CAAA;AAEL,GAEa,KAAqC,EAChD,UACA,aACA,eAGE,kBAAC,GAAD;CACE,gBACS,kBAAC,GAAD,CAAuB,CAAA;WAGhC,kBAAC,GAAD;EAAU,UAAU,kBAAC,GAAD,CAAuB,CAAA;YACzC,kBAAC,GAAD;GACS;GACG;GACH;EACR,CAAA;CACO,CAAA;AACa,CAAA"}
|
|
1
|
+
{"version":3,"file":"BackofficeDetailRelationListBlock.js","names":[],"sources":["../../../../../src/components/backoffice/detail/BackofficeDetailRelationListBlock.tsx"],"sourcesContent":["import { Suspense, useCallback, useMemo, useState, type JSX } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport * as ReactRelay from 'react-relay';\nimport type { OperationType } from 'relay-runtime';\n\nimport {\n BACKOFFICE_LIST_REFETCH_POLICY,\n BACKOFFICE_RELATED_TAB_PAGE_SIZE,\n} from '@plumile/backoffice-core/constants.js';\nimport { setWhereValue } from '@plumile/backoffice-core/filters/where.js';\nimport type {\n BackofficeListState,\n BackofficeRuntimeRelationFilterSpec,\n BackofficeRuntimeResolvedListFacetConfig,\n} from '@plumile/backoffice-core/types.js';\nimport { BackofficeTableSkeleton } from '@plumile/ui/backoffice/molecules/backoffice_table_skeleton/BackofficeTableSkeleton.js';\nimport { InlineBanner } from '@plumile/ui/components/feedback/InlineBanner.js';\n\nimport { buildDataTableColumns } from '../columns/buildDataTableColumns.js';\nimport { useBackofficeLoadMore } from '../../../hooks/useBackofficeLoadMore.js';\nimport { useBackofficeListRefetch } from '../../../hooks/useBackofficeListRefetch.js';\nimport { useBackofficeReactTranslation } from '../../../i18n/useBackofficeReactTranslation.js';\nimport { useBackofficeListEntitiesLoader } from '../../../provider/useBackofficeEntityLoader.js';\nimport { BackofficeEntityListScaffold } from '../scaffolds/BackofficeEntityListScaffold.js';\nimport { BackofficeErrorBoundary } from '../errors/BackofficeErrorBoundary.js';\nimport { BackofficeLazyEntityCountLabel } from '../refs/BackofficeLazyEntityCount.js';\n\nconst { useLazyLoadQuery, usePaginationFragment } = ReactRelay;\n\nexport type BackofficeDetailRelationListBlockProps = {\n title: string;\n relation: BackofficeRuntimeRelationFilterSpec;\n value: string | null;\n};\n\ntype RelationListContentProps = {\n title: string;\n config: BackofficeRuntimeResolvedListFacetConfig;\n relation: BackofficeRuntimeRelationFilterSpec;\n value: string | null;\n};\n\ntype RelationListBlockBodyProps = {\n title: string;\n relation: BackofficeRuntimeRelationFilterSpec;\n value: string | null;\n};\n\nconst RelationListSkeleton = (): JSX.Element => {\n const { t } = useBackofficeReactTranslation();\n\n return <BackofficeTableSkeleton rows={6} ariaLabel={t('common.loading')} />;\n};\n\nconst RelationListContent = ({\n title,\n config,\n relation,\n value,\n}: RelationListContentProps): JSX.Element | null => {\n const { t: tApp } = useTranslation();\n const { t } = useBackofficeReactTranslation();\n const listConfig = config.list;\n const listDefaults = config.listDefaults ??\n listConfig.defaultState ?? { where: null, sort: null };\n\n const [state, setState] = useState<BackofficeListState<unknown, string>>({\n where: listDefaults.where as never,\n sort: listDefaults.sort ?? null,\n });\n const [countFetchKey, setCountFetchKey] = useState(0);\n\n const relationWhere = useMemo(() => {\n if (value == null || value.trim() === '') {\n return null;\n }\n return setWhereValue(\n state.where as Record<string, unknown> | null,\n relation.whereKey as never,\n value,\n relation.path,\n );\n }, [relation.path, relation.whereKey, state.where, value]);\n\n const effectiveWhere = relationWhere ?? (state.where as never);\n const resolvedSort = state.sort ?? listDefaults.sort;\n const variablesBase = useMemo(() => {\n return {\n where: effectiveWhere as never,\n sort: resolvedSort as never,\n count: BACKOFFICE_RELATED_TAB_PAGE_SIZE,\n cursor: null,\n };\n }, [effectiveWhere, resolvedSort]);\n\n const variables = useMemo(() => {\n return listConfig.buildQueryVariables(variablesBase);\n }, [listConfig, variablesBase]);\n\n const queryData = useLazyLoadQuery<OperationType>(\n listConfig.query,\n variables,\n { fetchPolicy: 'store-or-network' },\n );\n\n const {\n data: fragmentData,\n loadNext,\n hasNext,\n isLoadingNext,\n refetch,\n } = usePaginationFragment(listConfig.fragment, queryData as never);\n\n const connection = listConfig.getConnection(fragmentData);\n const rows = useMemo(() => {\n return connection.edges.map((edge) => {\n return listConfig.toRow(edge.node);\n });\n }, [connection.edges, listConfig]);\n\n const columns = useMemo(() => {\n return buildDataTableColumns(listConfig.columns, {\n tApp,\n t,\n });\n }, [listConfig.columns, t, tApp]);\n\n const getRowId = useCallback(\n (row: unknown) => {\n return listConfig.getRowId(row);\n },\n [listConfig],\n );\n\n const defaults = useMemo(() => {\n const baseWhere = relationWhere ?? listDefaults.where;\n return {\n where: baseWhere,\n sort: listDefaults.sort,\n count: BACKOFFICE_RELATED_TAB_PAGE_SIZE,\n cursor: null,\n };\n }, [listDefaults.sort, listDefaults.where, relationWhere]);\n\n const { isRefreshing, onRefresh } = useBackofficeListRefetch({\n refetch,\n variables: variablesBase,\n defaults,\n fetchPolicy: BACKOFFICE_LIST_REFETCH_POLICY,\n buildQueryVariables: listConfig.buildQueryVariables,\n });\n\n const handleRefresh = useCallback(() => {\n setCountFetchKey((current) => {\n return current + 1;\n });\n onRefresh();\n }, [onRefresh]);\n\n const handleLoadMore = useBackofficeLoadMore({\n hasNext,\n isLoadingNext,\n loadNext,\n count: BACKOFFICE_RELATED_TAB_PAGE_SIZE,\n });\n\n let loadedCountFallback: JSX.Element | null = null;\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={effectiveWhere}\n fetchKey={countFetchKey}\n fallback={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 as never}\n state={state as never}\n pushState={(next) => {\n setState(next);\n }}\n header={{ title }}\n rows={rows}\n columns={columns as never}\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 variant=\"embedded\"\n />\n );\n};\n\nconst RelationListBlockBody = ({\n title,\n relation,\n value,\n}: RelationListBlockBodyProps): JSX.Element | null => {\n const { t } = useBackofficeReactTranslation();\n const relatedEntityIds = useMemo(() => {\n return [relation.target];\n }, [relation.target]);\n const relatedEntitiesState =\n useBackofficeListEntitiesLoader(relatedEntityIds);\n\n if (relatedEntitiesState.status === 'loading') {\n return <BackofficeTableSkeleton rows={6} ariaLabel={t('common.loading')} />;\n }\n\n if (relatedEntitiesState.status === 'error') {\n return (\n <InlineBanner tone=\"warning\" title={t('relations.unavailable.title')}>\n {t('relations.unavailable.description')}\n </InlineBanner>\n );\n }\n\n const config = relatedEntitiesState.modules[relation.target]?.config;\n if (config == null) {\n return null;\n }\n\n return (\n <RelationListContent\n title={title}\n config={config}\n relation={relation}\n value={value}\n />\n );\n};\n\nexport const BackofficeDetailRelationListBlock = ({\n title,\n relation,\n value,\n}: BackofficeDetailRelationListBlockProps): JSX.Element => {\n return (\n <BackofficeErrorBoundary\n fallback={() => {\n return <RelationListSkeleton />;\n }}\n >\n <Suspense fallback={<RelationListSkeleton />}>\n <RelationListBlockBody\n title={title}\n relation={relation}\n value={value}\n />\n </Suspense>\n </BackofficeErrorBoundary>\n );\n};\n\nexport default BackofficeDetailRelationListBlock;\n"],"mappings":";;;;;;;;;;;;;;;;;AA2BA,IAAM,EAAE,kBAAA,GAAkB,uBAAA,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,EAAqB,WAAW,SAClC,OACE,kBAAC,GAAD;EAAc,MAAK;EAAU,OAAO,EAAE,6BAA6B;YAChE,EAAE,mCAAmC;CAC1B,CAAA;CAIlB,IAAM,IAAS,EAAqB,QAAQ,EAAS,SAAS;CAK9D,OAJI,KAAU,OACL,OAIP,kBAAC,GAAD;EACS;EACC;EACE;EACH;CACR,CAAA;AAEL,GAEa,KAAqC,EAChD,UACA,aACA,eAGE,kBAAC,GAAD;CACE,gBACS,kBAAC,GAAD,CAAuB,CAAA;WAGhC,kBAAC,GAAD;EAAU,UAAU,kBAAC,GAAD,CAAuB,CAAA;YACzC,kBAAC,GAAD;GACS;GACG;GACH;EACR,CAAA;CACO,CAAA;AACa,CAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* empty css */
|
|
1
2
|
/* empty css */
|
|
2
3
|
//#region src/components/backoffice/filters/backofficeFilterAction.css.ts
|
|
3
4
|
var e = "hwnq700 txvbqbfqq txvbqbey txvbqbls4 txvbqbh6d txvbqb19gp txvbqbjm4 txvbqbwvi txvbqb2tz txvbqb28o txvbqb2sj txvbqb1d9 txvbqb1b83 txvbqb1bhb txvbqbv txvbqb3f txvbqb7h txvbqb75 txvbqb7t txvbqb1eol txvbqb1czh txvbqb1dth qbwcue0 txvbqb1ffs txvbqb1ga0", t = "txvbqb19fm txvbqbjl1";
|
|
@@ -4,28 +4,37 @@ import { Suspense as n } from "react";
|
|
|
4
4
|
import { Fragment as r, jsx as i } from "react/jsx-runtime";
|
|
5
5
|
import { useLazyLoadQuery as a } from "react-relay";
|
|
6
6
|
//#region src/components/backoffice/refs/BackofficeLazyEntityCount.tsx
|
|
7
|
-
var o = "store-or-network", s = ({
|
|
8
|
-
let
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
var o = "store-or-network", s = ({ count: e, where: t, fetchKey: n, children: s }) => {
|
|
8
|
+
let c = e.buildVariables({ where: t }), l = a(e.query, c, {
|
|
9
|
+
fetchPolicy: o,
|
|
10
|
+
fetchKey: n
|
|
11
|
+
}), u = e.getCount(l);
|
|
12
|
+
return u == null ? null : s == null ? /* @__PURE__ */ i(r, { children: u }) : /* @__PURE__ */ i(r, { children: s(u) });
|
|
13
|
+
}, c = ({ fallback: t, ...a }) => /* @__PURE__ */ i(e, {
|
|
14
|
+
fallback: () => /* @__PURE__ */ i(r, { children: t }),
|
|
15
|
+
children: /* @__PURE__ */ i(n, {
|
|
16
|
+
fallback: t,
|
|
17
|
+
children: /* @__PURE__ */ i(s, { ...a })
|
|
18
|
+
})
|
|
19
|
+
}), l = ({ entity: e, where: n }) => {
|
|
11
20
|
let r = t([e]);
|
|
12
21
|
if (r.status !== "loaded") return null;
|
|
13
22
|
let a = r.modules[e]?.config;
|
|
14
23
|
return a == null ? null : /* @__PURE__ */ i(s, {
|
|
15
|
-
|
|
24
|
+
count: a.list.count,
|
|
16
25
|
where: n
|
|
17
26
|
});
|
|
18
|
-
},
|
|
27
|
+
}, u = ({ entity: t, where: r }) => /* @__PURE__ */ i(e, {
|
|
19
28
|
fallback: () => null,
|
|
20
29
|
children: /* @__PURE__ */ i(n, {
|
|
21
30
|
fallback: null,
|
|
22
|
-
children: /* @__PURE__ */ i(
|
|
31
|
+
children: /* @__PURE__ */ i(l, {
|
|
23
32
|
entity: t,
|
|
24
33
|
where: r
|
|
25
34
|
})
|
|
26
35
|
})
|
|
27
36
|
});
|
|
28
37
|
//#endregion
|
|
29
|
-
export {
|
|
38
|
+
export { s as BackofficeEntityCountValue, u as BackofficeLazyEntityCount, u as default, c as BackofficeLazyEntityCountLabel };
|
|
30
39
|
|
|
31
40
|
//# sourceMappingURL=BackofficeLazyEntityCount.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackofficeLazyEntityCount.js","names":[],"sources":["../../../../../src/components/backoffice/refs/BackofficeLazyEntityCount.tsx"],"sourcesContent":["import { Suspense, type JSX } from 'react';\nimport { useLazyLoadQuery } from 'react-relay';\nimport type { OperationType } from 'relay-runtime';\n\nimport type {
|
|
1
|
+
{"version":3,"file":"BackofficeLazyEntityCount.js","names":[],"sources":["../../../../../src/components/backoffice/refs/BackofficeLazyEntityCount.tsx"],"sourcesContent":["import { Suspense, type JSX, type ReactNode } from 'react';\nimport { useLazyLoadQuery } from 'react-relay';\nimport type { OperationType } from 'relay-runtime';\n\nimport type { BackofficeRuntimeEntityCountConfig } from '@plumile/backoffice-core/types.js';\n\nimport { useBackofficeListEntitiesLoader } from '../../../provider/useBackofficeEntityLoader.js';\nimport { BackofficeErrorBoundary } from '../errors/BackofficeErrorBoundary.js';\n\nconst COUNT_FETCH_POLICY = 'store-or-network' as const;\n\nexport type BackofficeLazyEntityCountProps<\n Where extends Record<string, unknown> = Record<string, unknown>,\n> = {\n entity: string;\n where: Where | null;\n};\n\nexport type BackofficeEntityCountValueProps<\n Where extends Record<string, unknown> = Record<string, unknown>,\n> = {\n count: BackofficeRuntimeEntityCountConfig<Where>;\n where: Where | null;\n fetchKey?: string | number;\n children?: (value: number) => ReactNode;\n};\n\nexport type BackofficeLazyEntityCountLabelProps<\n Where extends Record<string, unknown> = Record<string, unknown>,\n> = BackofficeEntityCountValueProps<Where> & {\n fallback: ReactNode;\n};\n\nexport const BackofficeEntityCountValue = <\n Where extends Record<string, unknown> = Record<string, unknown>,\n>({\n count,\n where,\n fetchKey,\n children,\n}: BackofficeEntityCountValueProps<Where>): JSX.Element | null => {\n const variables = count.buildVariables({ where });\n const data = useLazyLoadQuery<OperationType>(count.query, variables, {\n fetchPolicy: COUNT_FETCH_POLICY,\n fetchKey,\n });\n const value = count.getCount(data);\n if (value == null) {\n return null;\n }\n if (children == null) {\n return <>{value}</>;\n }\n return <>{children(value)}</>;\n};\n\nexport const BackofficeLazyEntityCountLabel = <\n Where extends Record<string, unknown> = Record<string, unknown>,\n>({\n fallback,\n ...props\n}: BackofficeLazyEntityCountLabelProps<Where>): JSX.Element => {\n return (\n <BackofficeErrorBoundary\n fallback={() => {\n return <>{fallback}</>;\n }}\n >\n <Suspense fallback={fallback}>\n <BackofficeEntityCountValue {...props} />\n </Suspense>\n </BackofficeErrorBoundary>\n );\n};\n\nconst BackofficeLazyEntityCountBody = ({\n entity,\n where,\n}: BackofficeLazyEntityCountProps): JSX.Element | null => {\n const relatedEntitiesState = useBackofficeListEntitiesLoader([entity]);\n if (relatedEntitiesState.status !== 'loaded') {\n return null;\n }\n\n const config = relatedEntitiesState.modules[entity]?.config;\n if (config == null) {\n return null;\n }\n\n return <BackofficeEntityCountValue count={config.list.count} where={where} />;\n};\n\nexport const BackofficeLazyEntityCount = ({\n entity,\n where,\n}: BackofficeLazyEntityCountProps): JSX.Element | null => {\n return (\n <BackofficeErrorBoundary\n fallback={() => {\n return null;\n }}\n >\n <Suspense fallback={null}>\n <BackofficeLazyEntityCountBody entity={entity} where={where} />\n </Suspense>\n </BackofficeErrorBoundary>\n );\n};\n\nexport default BackofficeLazyEntityCount;\n"],"mappings":";;;;;;AASA,IAAM,IAAqB,oBAwBd,KAEX,EACA,UACA,UACA,aACA,kBACgE;CAChE,IAAM,IAAY,EAAM,eAAe,EAAE,SAAM,CAAC,GAC1C,IAAO,EAAgC,EAAM,OAAO,GAAW;EACnE,aAAa;EACb;CACF,CAAC,GACK,IAAQ,EAAM,SAAS,CAAI;CAOjC,OANI,KAAS,OACJ,OAEL,KAAY,OACP,kBAAA,GAAA,EAAA,UAAG,EAAQ,CAAA,IAEb,kBAAA,GAAA,EAAA,UAAG,EAAS,CAAK,EAAI,CAAA;AAC9B,GAEa,KAEX,EACA,aACA,GAAG,QAGD,kBAAC,GAAD;CACE,gBACS,kBAAA,GAAA,EAAA,UAAG,EAAW,CAAA;WAGvB,kBAAC,GAAD;EAAoB;YAClB,kBAAC,GAAD,EAA4B,GAAI,EAAQ,CAAA;CAChC,CAAA;AACa,CAAA,GAIvB,KAAiC,EACrC,WACA,eACwD;CACxD,IAAM,IAAuB,EAAgC,CAAC,CAAM,CAAC;CACrE,IAAI,EAAqB,WAAW,UAClC,OAAO;CAGT,IAAM,IAAS,EAAqB,QAAQ,IAAS;CAKrD,OAJI,KAAU,OACL,OAGF,kBAAC,GAAD;EAA4B,OAAO,EAAO,KAAK;EAAc;CAAQ,CAAA;AAC9E,GAEa,KAA6B,EACxC,WACA,eAGE,kBAAC,GAAD;CACE,gBACS;WAGT,kBAAC,GAAD;EAAU,UAAU;YAClB,kBAAC,GAAD;GAAuC;GAAe;EAAQ,CAAA;CACtD,CAAA;AACa,CAAA"}
|
|
@@ -58,7 +58,7 @@ var C = (e, t) => e(t), w = (e, t) => e.fromGraphQL != null && t != null ? e.fro
|
|
|
58
58
|
let n = new Date(t);
|
|
59
59
|
return Number.isNaN(n.getTime()) ? t : n.toISOString();
|
|
60
60
|
}, T = (i) => {
|
|
61
|
-
let { t: b } = oe(), { t: T } = e(), { config: E, state: D, pushState: O, rows: k, getRowId: A, columns: j, gridTemplateColumns: M, hasNextPage: N, isLoadingMore: P, isRefreshing: Se = !1, onLoadMore: F, onRefresh: I, totalCount: L,
|
|
61
|
+
let { t: b } = oe(), { t: T } = e(), { config: E, state: D, pushState: O, rows: k, getRowId: A, columns: j, gridTemplateColumns: M, hasNextPage: N, isLoadingMore: P, isRefreshing: Se = !1, onLoadMore: F, onRefresh: I, totalCount: L, loadedCountLabel: R, emptyState: z, statusBanner: B, header: Ce, headerActions: we, isLoadingInitial: Te = !1, variant: Ee = "page", showFilters: De = !0 } = i, V = E.list, Oe = E.listDefaults ?? V.defaultState ?? {
|
|
62
62
|
where: null,
|
|
63
63
|
sort: null
|
|
64
64
|
}, H = p(() => j.some((e) => e.isPrimary === !0) || j.length === 0 ? j : j.map((e, t) => {
|
|
@@ -121,8 +121,8 @@ var C = (e, t) => e(t), w = (e, t) => e.fromGraphQL != null && t != null ? e.fro
|
|
|
121
121
|
T,
|
|
122
122
|
b
|
|
123
123
|
]), W = f(() => {
|
|
124
|
-
O({ ...
|
|
125
|
-
}, [
|
|
124
|
+
O({ ...Oe });
|
|
125
|
+
}, [Oe, O]), [ke, Ae] = m(!1), [G, je] = m(""), [K, Me] = m(null), q = f((e) => {
|
|
126
126
|
let n = e.whereKey ?? e.id, r = w(e, D.where), i = "";
|
|
127
127
|
typeof r == "string" && (i = r), typeof r == "number" && Number.isFinite(r) && (i = String(r));
|
|
128
128
|
let s = C(e.label, b);
|
|
@@ -249,7 +249,7 @@ var C = (e, t) => e(t), w = (e, t) => e.fromGraphQL != null && t != null ? e.fro
|
|
|
249
249
|
isResolving: i,
|
|
250
250
|
placeholder: T("filters.placeholders.anyEntity", { label: s }),
|
|
251
251
|
onPick: () => {
|
|
252
|
-
|
|
252
|
+
Me({
|
|
253
253
|
entity: e.entity,
|
|
254
254
|
whereKey: n,
|
|
255
255
|
label: s,
|
|
@@ -279,15 +279,15 @@ var C = (e, t) => e(t), w = (e, t) => e.fromGraphQL != null && t != null ? e.fro
|
|
|
279
279
|
D,
|
|
280
280
|
T,
|
|
281
281
|
b
|
|
282
|
-
]),
|
|
282
|
+
]), Ne = p(() => V.filters.some((e) => e.placement != null), [V.filters]), J = p(() => {
|
|
283
283
|
if (V.filters.length === 0) return [];
|
|
284
284
|
let e = V.ui?.toolbar?.maxPromotedFilters ?? 3;
|
|
285
|
-
return
|
|
285
|
+
return Ne ? V.filters.filter((e) => e.placement === "quick" || e.placement === "both") : V.filters.slice(0, e);
|
|
286
286
|
}, [
|
|
287
287
|
V.filters,
|
|
288
288
|
V.ui?.toolbar,
|
|
289
|
-
|
|
290
|
-
]), Y = p(() => V.filters.filter((e) => e.placement == null ? !0 : e.placement === "drawer" || e.placement === "both"), [V.filters]), X = p(() => J.find((e) => e.kind === "text"), [J]),
|
|
289
|
+
Ne
|
|
290
|
+
]), Y = p(() => V.filters.filter((e) => e.placement == null ? !0 : e.placement === "drawer" || e.placement === "both"), [V.filters]), X = p(() => J.find((e) => e.kind === "text"), [J]), Pe = p(() => {
|
|
291
291
|
let e = J.filter((e) => e !== X);
|
|
292
292
|
return e.length === 0 ? null : /* @__PURE__ */ g("div", {
|
|
293
293
|
className: ee,
|
|
@@ -297,7 +297,7 @@ var C = (e, t) => e(t), w = (e, t) => e.fromGraphQL != null && t != null ? e.fro
|
|
|
297
297
|
J,
|
|
298
298
|
q,
|
|
299
299
|
X
|
|
300
|
-
]),
|
|
300
|
+
]), Fe = p(() => X == null ? null : q(X), [q, X]), Ie = p(() => {
|
|
301
301
|
if (V.sorts.length === 0) return null;
|
|
302
302
|
let e = V.sorts[0];
|
|
303
303
|
return e == null ? null : /* @__PURE__ */ g(y, {
|
|
@@ -322,10 +322,10 @@ var C = (e, t) => e(t), w = (e, t) => e.fromGraphQL != null && t != null ? e.fro
|
|
|
322
322
|
D,
|
|
323
323
|
T,
|
|
324
324
|
b
|
|
325
|
-
]),
|
|
325
|
+
]), Le = p(() => U.length === 0 ? null : /* @__PURE__ */ g(me, {
|
|
326
326
|
chips: U,
|
|
327
327
|
onClearAll: W
|
|
328
|
-
}), [U, W]),
|
|
328
|
+
}), [U, W]), Re = p(() => {
|
|
329
329
|
if (Y.length === 0) return [];
|
|
330
330
|
let e = G.trim().toLowerCase(), t = [];
|
|
331
331
|
for (let n of Y) {
|
|
@@ -349,7 +349,7 @@ var C = (e, t) => e(t), w = (e, t) => e.fromGraphQL != null && t != null ? e.fro
|
|
|
349
349
|
q,
|
|
350
350
|
T,
|
|
351
351
|
b
|
|
352
|
-
]),
|
|
352
|
+
]), ze = p(() => {
|
|
353
353
|
if (Y.length === 0) return null;
|
|
354
354
|
let e = U.length, t = T("filters.trigger");
|
|
355
355
|
return e > 0 && (t = T("filters.triggerWithCount", { count: e })), /* @__PURE__ */ g(v, {
|
|
@@ -357,7 +357,7 @@ var C = (e, t) => e(t), w = (e, t) => e.fromGraphQL != null && t != null ? e.fro
|
|
|
357
357
|
variant: "secondary",
|
|
358
358
|
size: "small",
|
|
359
359
|
onClick: () => {
|
|
360
|
-
|
|
360
|
+
Ae(!0);
|
|
361
361
|
},
|
|
362
362
|
children: t
|
|
363
363
|
});
|
|
@@ -365,19 +365,19 @@ var C = (e, t) => e(t), w = (e, t) => e.fromGraphQL != null && t != null ? e.fro
|
|
|
365
365
|
U.length,
|
|
366
366
|
Y.length,
|
|
367
367
|
T
|
|
368
|
-
]),
|
|
369
|
-
isOpen:
|
|
368
|
+
]), Be = /* @__PURE__ */ g(le, {
|
|
369
|
+
isOpen: ke,
|
|
370
370
|
onClose: () => {
|
|
371
|
-
|
|
371
|
+
Ae(!1), je("");
|
|
372
372
|
},
|
|
373
|
-
sections:
|
|
373
|
+
sections: Re,
|
|
374
374
|
searchValue: G,
|
|
375
375
|
onSearchChange: (e) => {
|
|
376
|
-
|
|
376
|
+
je(e);
|
|
377
377
|
},
|
|
378
378
|
onReset: W,
|
|
379
379
|
emptyLabel: G.trim() === "" ? void 0 : T("filters.drawer.emptySearchResults")
|
|
380
|
-
}),
|
|
380
|
+
}), Ve = p(() => z ?? (Te ? /* @__PURE__ */ g(ce, {
|
|
381
381
|
variant: "embedded",
|
|
382
382
|
ariaLabel: T("common.loading")
|
|
383
383
|
}) : U.length > 0 ? /* @__PURE__ */ g(se, {
|
|
@@ -395,14 +395,15 @@ var C = (e, t) => e(t), w = (e, t) => e.fromGraphQL != null && t != null ? e.fro
|
|
|
395
395
|
description: T("emptyState.listEmpty.description")
|
|
396
396
|
})), [
|
|
397
397
|
U.length,
|
|
398
|
-
|
|
398
|
+
z,
|
|
399
399
|
W,
|
|
400
|
-
|
|
400
|
+
Te,
|
|
401
401
|
T
|
|
402
|
-
]),
|
|
402
|
+
]), He = p(() => R ?? (typeof L == "number" ? /* @__PURE__ */ g("span", { children: T("list.showing", {
|
|
403
403
|
shown: k.length,
|
|
404
404
|
total: L
|
|
405
|
-
}) }) : k.length === 0 ? null : /* @__PURE__ */ g("span", { children: T("list.loaded", { count: k.length }) }), [
|
|
405
|
+
}) }) : k.length === 0 ? null : /* @__PURE__ */ g("span", { children: T("list.loaded", { count: k.length }) })), [
|
|
406
|
+
R,
|
|
406
407
|
k.length,
|
|
407
408
|
T,
|
|
408
409
|
L
|
|
@@ -431,14 +432,14 @@ var C = (e, t) => e(t), w = (e, t) => e.fromGraphQL != null && t != null ? e.fro
|
|
|
431
432
|
Z.infiniteScroll.showInconsistentPageInfo,
|
|
432
433
|
L
|
|
433
434
|
]);
|
|
434
|
-
let
|
|
435
|
-
enabled: !
|
|
435
|
+
let Ue = i.virtualize === !0 || Z.virtualization.enabled, { sentinelRef: We } = l({
|
|
436
|
+
enabled: !Ue && Z.infiniteScroll.enabled,
|
|
436
437
|
hasNextPage: N,
|
|
437
438
|
isLoading: P,
|
|
438
439
|
onIntersect: F,
|
|
439
440
|
rootMargin: Z.infiniteScroll.rootMargin,
|
|
440
441
|
threshold: Z.infiniteScroll.threshold
|
|
441
|
-
}),
|
|
442
|
+
}), Ge = Ce?.title ?? C(V.title, b), Ke = Ce?.subtitle, qe = H.find((e) => e.mobileRole === "action" || e.id === "actions"), Je = V.ui?.displayMode ?? V.responsive?.mode ?? "auto", Ye = V.ui?.density ?? V.responsive?.density ?? "compact", Xe = /* @__PURE__ */ g(n, {
|
|
442
443
|
fallback: (e) => {
|
|
443
444
|
let { reset: t } = e;
|
|
444
445
|
return /* @__PURE__ */ g(ae, {
|
|
@@ -456,11 +457,11 @@ var C = (e, t) => e(t), w = (e, t) => e.fromGraphQL != null && t != null ? e.fro
|
|
|
456
457
|
children: T("list.errors.tableFailed")
|
|
457
458
|
});
|
|
458
459
|
},
|
|
459
|
-
children:
|
|
460
|
+
children: Ue ? /* @__PURE__ */ g(_e, {
|
|
460
461
|
columns: H,
|
|
461
462
|
rows: k,
|
|
462
463
|
getRowId: A,
|
|
463
|
-
emptyState:
|
|
464
|
+
emptyState: Ve,
|
|
464
465
|
className: S,
|
|
465
466
|
gridTemplateColumns: M,
|
|
466
467
|
virtualization: Z.virtualization,
|
|
@@ -477,23 +478,23 @@ var C = (e, t) => e(t), w = (e, t) => e.fromGraphQL != null && t != null ? e.fro
|
|
|
477
478
|
columns: H,
|
|
478
479
|
rows: k,
|
|
479
480
|
getRowId: A,
|
|
480
|
-
emptyState:
|
|
481
|
+
emptyState: Ve,
|
|
481
482
|
className: S,
|
|
482
483
|
gridTemplateColumns: M,
|
|
483
|
-
mode:
|
|
484
|
-
density:
|
|
484
|
+
mode: Je,
|
|
485
|
+
density: Ye,
|
|
485
486
|
bodyScrollMode: c,
|
|
486
487
|
bodyFooterNode: Z.infiniteScroll.enabled ? /* @__PURE__ */ g("div", {
|
|
487
|
-
ref:
|
|
488
|
+
ref: We,
|
|
488
489
|
"aria-hidden": "true"
|
|
489
490
|
}) : null,
|
|
490
|
-
renderAction: (e) =>
|
|
491
|
+
renderAction: (e) => qe?.cell(e) ?? null
|
|
491
492
|
})
|
|
492
|
-
}),
|
|
493
|
-
search:
|
|
494
|
-
primaryFilters:
|
|
495
|
-
filterDrawerTrigger:
|
|
496
|
-
sort:
|
|
493
|
+
}), Ze = De ? /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g(pe, {
|
|
494
|
+
search: Fe,
|
|
495
|
+
primaryFilters: Pe,
|
|
496
|
+
filterDrawerTrigger: ze,
|
|
497
|
+
sort: Ie,
|
|
497
498
|
utilityActions: I == null ? null : /* @__PURE__ */ g(v, {
|
|
498
499
|
type: "button",
|
|
499
500
|
variant: "secondary",
|
|
@@ -505,17 +506,17 @@ var C = (e, t) => e(t), w = (e, t) => e.fromGraphQL != null && t != null ? e.fro
|
|
|
505
506
|
},
|
|
506
507
|
children: T("list.actions.refresh")
|
|
507
508
|
}),
|
|
508
|
-
chips:
|
|
509
|
+
chips: Le,
|
|
509
510
|
density: "compact"
|
|
510
|
-
}),
|
|
511
|
+
}), Be] }) : null, Qe = /* @__PURE__ */ _("div", {
|
|
511
512
|
className: re,
|
|
512
|
-
children: [
|
|
513
|
+
children: [Xe, /* @__PURE__ */ g(r, {
|
|
513
514
|
isOpen: K != null,
|
|
514
515
|
entity: K?.entity ?? E.id,
|
|
515
516
|
title: K?.label ?? T("picker.title"),
|
|
516
517
|
scope: K?.scope,
|
|
517
518
|
onClose: () => {
|
|
518
|
-
|
|
519
|
+
Me(null);
|
|
519
520
|
},
|
|
520
521
|
onSelectId: (e) => {
|
|
521
522
|
if (K == null) return;
|
|
@@ -534,12 +535,12 @@ var C = (e, t) => e(t), w = (e, t) => e.fromGraphQL != null && t != null ? e.fro
|
|
|
534
535
|
isLoading: P,
|
|
535
536
|
pageInfoState: Q ? "inconsistent" : P ? "loading" : N ? "ready" : "complete",
|
|
536
537
|
labels: {
|
|
537
|
-
loaded:
|
|
538
|
+
loaded: He,
|
|
538
539
|
loading: T("list.loadMore.loading"),
|
|
539
540
|
end: T("list.loadMore.end")
|
|
540
541
|
}
|
|
541
542
|
}) }) : null;
|
|
542
|
-
return
|
|
543
|
+
return Ee === "embedded" ? /* @__PURE__ */ g(s, {
|
|
543
544
|
config: E,
|
|
544
545
|
state: D,
|
|
545
546
|
pushState: O,
|
|
@@ -548,11 +549,11 @@ var C = (e, t) => e(t), w = (e, t) => e.fromGraphQL != null && t != null ? e.fro
|
|
|
548
549
|
children: [
|
|
549
550
|
/* @__PURE__ */ g("div", {
|
|
550
551
|
className: ne,
|
|
551
|
-
children:
|
|
552
|
+
children: Ge
|
|
552
553
|
}),
|
|
553
|
-
Xe,
|
|
554
|
-
z,
|
|
555
554
|
Ze,
|
|
555
|
+
B,
|
|
556
|
+
Qe,
|
|
556
557
|
$
|
|
557
558
|
]
|
|
558
559
|
})
|
|
@@ -562,13 +563,13 @@ var C = (e, t) => e(t), w = (e, t) => e.fromGraphQL != null && t != null ? e.fro
|
|
|
562
563
|
pushState: O,
|
|
563
564
|
children: /* @__PURE__ */ g(he, {
|
|
564
565
|
headerNode: /* @__PURE__ */ g(fe, {
|
|
565
|
-
title:
|
|
566
|
-
subtitle:
|
|
567
|
-
actions:
|
|
566
|
+
title: Ge,
|
|
567
|
+
subtitle: Ke,
|
|
568
|
+
actions: we
|
|
568
569
|
}),
|
|
569
|
-
toolbarNode:
|
|
570
|
-
statusNode:
|
|
571
|
-
tableNode:
|
|
570
|
+
toolbarNode: Ze,
|
|
571
|
+
statusNode: B,
|
|
572
|
+
tableNode: Qe,
|
|
572
573
|
tableFooterNode: $,
|
|
573
574
|
presentation: "flat",
|
|
574
575
|
bodyScrollMode: c
|