@plumile/ui 0.1.114 → 0.1.116
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/admin/templates/admin_shell_layout/AdminShellLayout.js +15 -14
- package/lib/esm/admin/templates/admin_shell_layout/AdminShellLayout.js.map +1 -1
- package/lib/esm/atomic/atoms/modal/Modal.js +14 -14
- package/lib/esm/atomic/atoms/modal/Modal.js.map +1 -1
- package/lib/esm/atomic/molecules/markdown/components/MarkdownLink.css.js +0 -1
- package/lib/esm/atomic/molecules/markdown/components/MarkdownTableCell.css.js +1 -0
- package/lib/esm/backoffice/organisms/backoffice_data_table/BackofficeDataTable.js +59 -56
- package/lib/esm/backoffice/organisms/backoffice_data_table/BackofficeDataTable.js.map +1 -1
- package/lib/esm/backoffice/organisms/backoffice_data_table/backofficeDataTable.css.js +2 -2
- package/lib/esm/backoffice/organisms/backoffice_data_table/backofficeDataTable.css.js.map +1 -1
- package/lib/esm/backoffice/organisms/backoffice_virtualized_connection_table/BackofficeVirtualizedConnectionTable.js +3 -2
- package/lib/esm/backoffice/organisms/backoffice_virtualized_connection_table/BackofficeVirtualizedConnectionTable.js.map +1 -1
- package/lib/esm/backoffice/templates/detail_page_template/DetailPageTemplate.js +42 -39
- package/lib/esm/backoffice/templates/detail_page_template/DetailPageTemplate.js.map +1 -1
- package/lib/esm/backoffice/templates/detail_page_template/detailPageTemplate.css.js +3 -3
- package/lib/esm/backoffice/templates/detail_page_template/detailPageTemplate.css.js.map +1 -1
- package/lib/esm/backoffice/templates/list_page_template/ListPageTemplate.js +45 -29
- package/lib/esm/backoffice/templates/list_page_template/ListPageTemplate.js.map +1 -1
- package/lib/esm/backoffice/templates/list_page_template/listPageTemplate.css.js +73 -13
- package/lib/esm/backoffice/templates/list_page_template/listPageTemplate.css.js.map +1 -1
- package/lib/esm/components/data-table/DataTable.css.js +52 -52
- package/lib/esm/components/data-table/DataTable.css.js.map +1 -1
- package/lib/esm/components/data-table/DataTable.js +43 -39
- package/lib/esm/components/data-table/DataTable.js.map +1 -1
- package/lib/esm/components/data-table/ResponsiveRecordList.css.js +7 -7
- package/lib/esm/components/data-table/ResponsiveRecordList.css.js.map +1 -1
- package/lib/esm/components/data-table/ResponsiveRecordList.js +86 -61
- package/lib/esm/components/data-table/ResponsiveRecordList.js.map +1 -1
- package/lib/esm/components/data-table/VirtualizedConnectionTable.js +158 -142
- package/lib/esm/components/data-table/VirtualizedConnectionTable.js.map +1 -1
- package/lib/esm/components/layout/AppShell.js +2 -1
- package/lib/esm/components/layout/AppShell.js.map +1 -1
- package/lib/esm/components/layout/PageShell.css.js +8 -8
- package/lib/esm/components/layout/PageShell.css.js.map +1 -1
- package/lib/esm/components/layout/PageShell.js +115 -107
- package/lib/esm/components/layout/PageShell.js.map +1 -1
- package/lib/esm/focus/focusable.js +1 -1
- package/lib/esm/focus/focusable.js.map +1 -1
- package/lib/esm/style.css +1 -1
- package/lib/types/admin/templates/admin_shell_layout/AdminShellLayout.d.ts +3 -2
- package/lib/types/admin/templates/admin_shell_layout/AdminShellLayout.d.ts.map +1 -1
- package/lib/types/atomic/atoms/modal/Modal.d.ts.map +1 -1
- package/lib/types/backoffice/organisms/backoffice_data_table/BackofficeDataTable.d.ts +3 -2
- package/lib/types/backoffice/organisms/backoffice_data_table/BackofficeDataTable.d.ts.map +1 -1
- package/lib/types/backoffice/organisms/backoffice_data_table/backofficeDataTable.css.d.ts +1 -0
- package/lib/types/backoffice/organisms/backoffice_data_table/backofficeDataTable.css.d.ts.map +1 -1
- package/lib/types/backoffice/organisms/backoffice_virtualized_connection_table/BackofficeVirtualizedConnectionTable.d.ts +3 -2
- package/lib/types/backoffice/organisms/backoffice_virtualized_connection_table/BackofficeVirtualizedConnectionTable.d.ts.map +1 -1
- package/lib/types/backoffice/templates/detail_page_template/DetailPageTemplate.d.ts.map +1 -1
- package/lib/types/backoffice/templates/detail_page_template/detailPageTemplate.css.d.ts +5 -0
- package/lib/types/backoffice/templates/detail_page_template/detailPageTemplate.css.d.ts.map +1 -1
- package/lib/types/backoffice/templates/list_page_template/ListPageTemplate.d.ts +1 -0
- package/lib/types/backoffice/templates/list_page_template/ListPageTemplate.d.ts.map +1 -1
- package/lib/types/backoffice/templates/list_page_template/listPageTemplate.css.d.ts +17 -2
- package/lib/types/backoffice/templates/list_page_template/listPageTemplate.css.d.ts.map +1 -1
- package/lib/types/components/data-table/DataTable.css.d.ts +2 -0
- package/lib/types/components/data-table/DataTable.css.d.ts.map +1 -1
- package/lib/types/components/data-table/DataTable.d.ts +5 -2
- package/lib/types/components/data-table/DataTable.d.ts.map +1 -1
- package/lib/types/components/data-table/ResponsiveRecordList.css.d.ts +2 -0
- package/lib/types/components/data-table/ResponsiveRecordList.css.d.ts.map +1 -1
- package/lib/types/components/data-table/ResponsiveRecordList.d.ts +1 -1
- package/lib/types/components/data-table/ResponsiveRecordList.d.ts.map +1 -1
- package/lib/types/components/data-table/VirtualizedConnectionTable.d.ts +3 -2
- package/lib/types/components/data-table/VirtualizedConnectionTable.d.ts.map +1 -1
- package/lib/types/components/layout/AppShell.d.ts +3 -2
- package/lib/types/components/layout/AppShell.d.ts.map +1 -1
- package/lib/types/components/layout/PageShell.css.d.ts +3 -0
- package/lib/types/components/layout/PageShell.css.d.ts.map +1 -1
- package/lib/types/components/layout/PageShell.d.ts +3 -1
- package/lib/types/components/layout/PageShell.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -3,28 +3,29 @@ import { AdminSidebar as t } from "../../organisms/admin_sidebar/AdminSidebar.js
|
|
|
3
3
|
import { AdminTopbar as n } from "../../organisms/admin_topbar/AdminTopbar.js";
|
|
4
4
|
import { jsx as r } from "react/jsx-runtime";
|
|
5
5
|
//#region src/admin/templates/admin_shell_layout/AdminShellLayout.tsx
|
|
6
|
-
var i = ({ children: i, sidebar: a, mobileSidebar: o, topbar: s, actions: c, tabs: l }) => {
|
|
7
|
-
let
|
|
8
|
-
|
|
6
|
+
var i = ({ children: i, sidebar: a, mobileSidebar: o, topbar: s, actions: c, tabs: l, contentScrollMode: u }) => {
|
|
7
|
+
let d = a.isCollapsed !== !0, f = null;
|
|
8
|
+
d && (f = /* @__PURE__ */ r(t, {
|
|
9
9
|
...a,
|
|
10
10
|
isCollapsed: !1
|
|
11
11
|
}));
|
|
12
|
-
let
|
|
13
|
-
o != null && (
|
|
14
|
-
let
|
|
15
|
-
s != null && (
|
|
16
|
-
let
|
|
17
|
-
return typeof a.expandToggleLabel == "string" && (
|
|
18
|
-
sidebar:
|
|
19
|
-
mobileSidebar:
|
|
20
|
-
desktopSidebarOpen:
|
|
12
|
+
let p;
|
|
13
|
+
o != null && (p = /* @__PURE__ */ r(t, { ...o }));
|
|
14
|
+
let m = null;
|
|
15
|
+
s != null && (m = /* @__PURE__ */ r(n, { ...s }));
|
|
16
|
+
let h;
|
|
17
|
+
return typeof a.expandToggleLabel == "string" && (h = a.expandToggleLabel), /* @__PURE__ */ r(e, {
|
|
18
|
+
sidebar: f,
|
|
19
|
+
mobileSidebar: p,
|
|
20
|
+
desktopSidebarOpen: d,
|
|
21
21
|
onOpenDesktopSidebar: () => {
|
|
22
22
|
a.onCollapsedChange?.(!1);
|
|
23
23
|
},
|
|
24
|
-
openDesktopSidebarLabel:
|
|
25
|
-
breadcrumbSlot:
|
|
24
|
+
openDesktopSidebarLabel: h,
|
|
25
|
+
breadcrumbSlot: m,
|
|
26
26
|
actions: c,
|
|
27
27
|
tabs: l,
|
|
28
|
+
contentScrollMode: u,
|
|
28
29
|
children: i
|
|
29
30
|
});
|
|
30
31
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdminShellLayout.js","names":[],"sources":["../../../../../src/admin/templates/admin_shell_layout/AdminShellLayout.tsx"],"sourcesContent":["import { type JSX, type ReactNode } from 'react';\n\nimport { AppShell } from '../../../components/layout/AppShell.js';\nimport {\n AdminSidebar,\n type AdminSidebarProps,\n} from '../../organisms/admin_sidebar/AdminSidebar.js';\nimport {\n AdminTopbar,\n type AdminTopbarProps,\n} from '../../organisms/admin_topbar/AdminTopbar.js';\nimport type {\n PageShellActions,\n PageShellTab,\n} from '../../../components/layout/PageShell.js';\n\nexport type AdminShellLayoutProps = {\n children: ReactNode;\n sidebar: AdminSidebarProps;\n mobileSidebar?: AdminSidebarProps;\n topbar?: AdminTopbarProps;\n actions?: PageShellActions;\n tabs?: PageShellTab[];\n};\n\nexport const AdminShellLayout = ({\n children,\n sidebar,\n mobileSidebar,\n topbar,\n actions,\n tabs,\n}: AdminShellLayoutProps): JSX.Element => {\n const isDesktopSidebarOpen = sidebar.isCollapsed !== true;\n let sidebarNode: JSX.Element | null = null;\n if (isDesktopSidebarOpen) {\n sidebarNode = <AdminSidebar {...sidebar} isCollapsed={false} />;\n }\n let mobileSidebarNode: JSX.Element | undefined;\n if (mobileSidebar != null) {\n mobileSidebarNode = <AdminSidebar {...mobileSidebar} />;\n }\n let topbarNode: JSX.Element | null = null;\n if (topbar != null) {\n topbarNode = <AdminTopbar {...topbar} />;\n }\n\n let openDesktopSidebarLabel: string | undefined;\n if (typeof sidebar.expandToggleLabel === 'string') {\n openDesktopSidebarLabel = sidebar.expandToggleLabel;\n }\n\n return (\n <AppShell\n sidebar={sidebarNode}\n mobileSidebar={mobileSidebarNode}\n desktopSidebarOpen={isDesktopSidebarOpen}\n onOpenDesktopSidebar={() => {\n sidebar.onCollapsedChange?.(false);\n }}\n openDesktopSidebarLabel={openDesktopSidebarLabel}\n breadcrumbSlot={topbarNode}\n actions={actions}\n tabs={tabs}\n >\n {children}\n </AppShell>\n );\n};\n\nexport default AdminShellLayout;\n"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"AdminShellLayout.js","names":[],"sources":["../../../../../src/admin/templates/admin_shell_layout/AdminShellLayout.tsx"],"sourcesContent":["import { type JSX, type ReactNode } from 'react';\n\nimport { AppShell } from '../../../components/layout/AppShell.js';\nimport {\n AdminSidebar,\n type AdminSidebarProps,\n} from '../../organisms/admin_sidebar/AdminSidebar.js';\nimport {\n AdminTopbar,\n type AdminTopbarProps,\n} from '../../organisms/admin_topbar/AdminTopbar.js';\nimport type {\n PageShellActions,\n PageShellContentScrollMode,\n PageShellTab,\n} from '../../../components/layout/PageShell.js';\n\nexport type AdminShellLayoutProps = {\n children: ReactNode;\n sidebar: AdminSidebarProps;\n mobileSidebar?: AdminSidebarProps;\n topbar?: AdminTopbarProps;\n actions?: PageShellActions;\n tabs?: PageShellTab[];\n contentScrollMode?: PageShellContentScrollMode;\n};\n\nexport const AdminShellLayout = ({\n children,\n sidebar,\n mobileSidebar,\n topbar,\n actions,\n tabs,\n contentScrollMode,\n}: AdminShellLayoutProps): JSX.Element => {\n const isDesktopSidebarOpen = sidebar.isCollapsed !== true;\n let sidebarNode: JSX.Element | null = null;\n if (isDesktopSidebarOpen) {\n sidebarNode = <AdminSidebar {...sidebar} isCollapsed={false} />;\n }\n let mobileSidebarNode: JSX.Element | undefined;\n if (mobileSidebar != null) {\n mobileSidebarNode = <AdminSidebar {...mobileSidebar} />;\n }\n let topbarNode: JSX.Element | null = null;\n if (topbar != null) {\n topbarNode = <AdminTopbar {...topbar} />;\n }\n\n let openDesktopSidebarLabel: string | undefined;\n if (typeof sidebar.expandToggleLabel === 'string') {\n openDesktopSidebarLabel = sidebar.expandToggleLabel;\n }\n\n return (\n <AppShell\n sidebar={sidebarNode}\n mobileSidebar={mobileSidebarNode}\n desktopSidebarOpen={isDesktopSidebarOpen}\n onOpenDesktopSidebar={() => {\n sidebar.onCollapsedChange?.(false);\n }}\n openDesktopSidebarLabel={openDesktopSidebarLabel}\n breadcrumbSlot={topbarNode}\n actions={actions}\n tabs={tabs}\n contentScrollMode={contentScrollMode}\n >\n {children}\n </AppShell>\n );\n};\n\nexport default AdminShellLayout;\n"],"mappings":";;;;;AA2BA,IAAa,KAAoB,EAC/B,aACA,YACA,kBACA,WACA,YACA,SACA,2BACwC;CACxC,IAAM,IAAuB,EAAQ,gBAAgB,IACjD,IAAkC;CACtC,AAAI,MACF,IAAc,kBAAC,GAAD;EAAc,GAAI;EAAS,aAAa;EAAS,CAAA;CAEjE,IAAI;CACJ,AAAI,KAAiB,SACnB,IAAoB,kBAAC,GAAD,EAAc,GAAI,GAAiB,CAAA;CAEzD,IAAI,IAAiC;CACrC,AAAI,KAAU,SACZ,IAAa,kBAAC,GAAD,EAAa,GAAI,GAAU,CAAA;CAG1C,IAAI;CAKJ,OAJI,OAAO,EAAQ,qBAAsB,aACvC,IAA0B,EAAQ,oBAIlC,kBAAC,GAAD;EACE,SAAS;EACT,eAAe;EACf,oBAAoB;EACpB,4BAA4B;GAC1B,EAAQ,oBAAoB,GAAM;;EAEX;EACzB,gBAAgB;EACP;EACH;EACa;EAElB;EACQ,CAAA"}
|
|
@@ -8,15 +8,17 @@ import { useTranslation as _ } from "react-i18next";
|
|
|
8
8
|
import { createPortal as v } from "react-dom";
|
|
9
9
|
//#region src/atomic/atoms/modal/Modal.tsx
|
|
10
10
|
var y = (y) => {
|
|
11
|
-
let { isOpen: b, onClose: x, title: S, children: C, footer: w, closeAriaLabel: T, initialFocus: E } = y, { t: D } = _("ui"), O = f(), k = p(null), A = p(null);
|
|
11
|
+
let { isOpen: b, onClose: x, title: S, children: C, footer: w, closeAriaLabel: T, initialFocus: E } = y, { t: D } = _("ui"), O = f(), k = p(null), A = p(null), j = p(E), M = p(x);
|
|
12
12
|
d(() => {
|
|
13
|
-
|
|
13
|
+
j.current = E, M.current = x;
|
|
14
|
+
}), d(() => {
|
|
15
|
+
if (!b) return;
|
|
14
16
|
document.activeElement instanceof HTMLElement && (A.current = document.activeElement);
|
|
15
17
|
let r = k.current;
|
|
16
|
-
r != null && e(n(r,
|
|
18
|
+
r != null && e(n(r, j.current));
|
|
17
19
|
let i = (e) => {
|
|
18
20
|
if (e.key === "Escape") {
|
|
19
|
-
|
|
21
|
+
M.current();
|
|
20
22
|
return;
|
|
21
23
|
}
|
|
22
24
|
if (e.key !== "Tab") return;
|
|
@@ -34,18 +36,16 @@ var y = (y) => {
|
|
|
34
36
|
!e.shiftKey && document.activeElement === a && (e.preventDefault(), i.focus());
|
|
35
37
|
};
|
|
36
38
|
return window.addEventListener("keydown", i), () => {
|
|
37
|
-
window.removeEventListener("keydown", i)
|
|
39
|
+
window.removeEventListener("keydown", i);
|
|
40
|
+
let e = A.current;
|
|
41
|
+
e != null && e.isConnected && document.contains(e) && e.focus(), A.current = null;
|
|
38
42
|
};
|
|
39
|
-
}, [
|
|
40
|
-
|
|
41
|
-
b,
|
|
42
|
-
x
|
|
43
|
-
]);
|
|
44
|
-
let j = (e) => {
|
|
43
|
+
}, [b]);
|
|
44
|
+
let N = (e) => {
|
|
45
45
|
e.stopPropagation();
|
|
46
46
|
};
|
|
47
47
|
if (!b) return null;
|
|
48
|
-
let
|
|
48
|
+
let P = /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h(i, {
|
|
49
49
|
isVisible: b,
|
|
50
50
|
onClick: x
|
|
51
51
|
}), /* @__PURE__ */ h("div", {
|
|
@@ -53,7 +53,7 @@ var y = (y) => {
|
|
|
53
53
|
children: /* @__PURE__ */ g("div", {
|
|
54
54
|
className: o,
|
|
55
55
|
ref: k,
|
|
56
|
-
onClick:
|
|
56
|
+
onClick: N,
|
|
57
57
|
role: "dialog",
|
|
58
58
|
"aria-modal": "true",
|
|
59
59
|
"aria-labelledby": O,
|
|
@@ -88,7 +88,7 @@ var y = (y) => {
|
|
|
88
88
|
]
|
|
89
89
|
})
|
|
90
90
|
})] });
|
|
91
|
-
return typeof document > "u" ?
|
|
91
|
+
return typeof document > "u" ? P : v(P, document.body);
|
|
92
92
|
};
|
|
93
93
|
//#endregion
|
|
94
94
|
export { y as Modal };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.js","names":[],"sources":["../../../../../src/atomic/atoms/modal/Modal.tsx"],"sourcesContent":["import React, { type JSX, useEffect, useId, useRef } from 'react';\nimport { createPortal } from 'react-dom';\nimport { useTranslation } from 'react-i18next';\n\nimport { ModalCloseSvg } from '../../../icons/ModalCloseSvg.js';\nimport { Overlay } from '../overlay/Overlay.js';\nimport {\n focusElement,\n getFocusableElements,\n resolveInitialFocusTarget,\n type InitialFocusTarget,\n} from '../../../focus/focusable.js';\nimport * as styles from './modal.css.js';\n\ntype Props = {\n isOpen: boolean;\n onClose: () => void;\n title: string;\n children: React.ReactNode;\n footer?: React.ReactNode;\n closeAriaLabel?: string;\n initialFocus: InitialFocusTarget;\n};\n\nexport const Modal = (props: Props): JSX.Element | null => {\n const {\n isOpen,\n onClose,\n title,\n children,\n footer,\n closeAriaLabel,\n initialFocus,\n } = props;\n const { t } = useTranslation('ui');\n const titleId = useId();\n const modalRef = useRef<HTMLDivElement>(null);\n const restoreFocusRef = useRef<HTMLElement | null>(null);\n\n useEffect(() => {\n if (!isOpen) {\n return
|
|
1
|
+
{"version":3,"file":"Modal.js","names":[],"sources":["../../../../../src/atomic/atoms/modal/Modal.tsx"],"sourcesContent":["import React, { type JSX, useEffect, useId, useRef } from 'react';\nimport { createPortal } from 'react-dom';\nimport { useTranslation } from 'react-i18next';\n\nimport { ModalCloseSvg } from '../../../icons/ModalCloseSvg.js';\nimport { Overlay } from '../overlay/Overlay.js';\nimport {\n focusElement,\n getFocusableElements,\n resolveInitialFocusTarget,\n type InitialFocusTarget,\n} from '../../../focus/focusable.js';\nimport * as styles from './modal.css.js';\n\ntype Props = {\n isOpen: boolean;\n onClose: () => void;\n title: string;\n children: React.ReactNode;\n footer?: React.ReactNode;\n closeAriaLabel?: string;\n initialFocus: InitialFocusTarget;\n};\n\nexport const Modal = (props: Props): JSX.Element | null => {\n const {\n isOpen,\n onClose,\n title,\n children,\n footer,\n closeAriaLabel,\n initialFocus,\n } = props;\n const { t } = useTranslation('ui');\n const titleId = useId();\n const modalRef = useRef<HTMLDivElement>(null);\n const restoreFocusRef = useRef<HTMLElement | null>(null);\n const initialFocusRef = useRef(initialFocus);\n const onCloseRef = useRef(onClose);\n\n useEffect(() => {\n initialFocusRef.current = initialFocus;\n onCloseRef.current = onClose;\n });\n\n useEffect(() => {\n if (!isOpen) {\n return undefined;\n }\n\n if (document.activeElement instanceof HTMLElement) {\n restoreFocusRef.current = document.activeElement;\n }\n\n const modalElement = modalRef.current;\n if (modalElement != null) {\n focusElement(\n resolveInitialFocusTarget(modalElement, initialFocusRef.current),\n );\n }\n\n const handleKeyDown = (e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n onCloseRef.current();\n return;\n }\n\n if (e.key !== 'Tab') {\n return;\n }\n\n const modalElement = modalRef.current;\n if (modalElement == null) {\n return;\n }\n\n const focusableElements = getFocusableElements(modalElement);\n\n const firstElement = focusableElements[0];\n const lastElement = focusableElements[focusableElements.length - 1];\n if (firstElement == null || lastElement == null) {\n e.preventDefault();\n modalElement.focus();\n return;\n }\n\n if (e.shiftKey && document.activeElement === firstElement) {\n e.preventDefault();\n lastElement.focus();\n return;\n }\n\n if (!e.shiftKey && document.activeElement === lastElement) {\n e.preventDefault();\n firstElement.focus();\n }\n };\n\n window.addEventListener('keydown', handleKeyDown);\n\n return () => {\n window.removeEventListener('keydown', handleKeyDown);\n const restoreFocusElement = restoreFocusRef.current;\n if (\n restoreFocusElement != null &&\n restoreFocusElement.isConnected &&\n document.contains(restoreFocusElement)\n ) {\n restoreFocusElement.focus();\n }\n restoreFocusRef.current = null;\n };\n }, [isOpen]);\n\n // Prevent click from bubbling to overlay\n const handleModalClick = (e: React.MouseEvent) => {\n e.stopPropagation();\n };\n\n if (!isOpen) {\n return null;\n }\n\n const modalContent = (\n <>\n <Overlay isVisible={isOpen} onClick={onClose} />\n <div className={styles.modalContainer}>\n <div\n className={styles.modal}\n ref={modalRef}\n onClick={handleModalClick}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={titleId}\n tabIndex={-1}\n >\n <div className={styles.modalHeader}>\n <h2 id={titleId} className={styles.modalTitle}>\n {title}\n </h2>\n <button\n className={styles.closeButton}\n onClick={onClose}\n aria-label={closeAriaLabel ?? t('common.actions.close')}\n type=\"button\"\n >\n <ModalCloseSvg width={20} height={20} aria-hidden=\"true\" />\n </button>\n </div>\n <div className={styles.modalContent}>{children}</div>\n {footer != null && <div className={styles.modalFooter}>{footer}</div>}\n </div>\n </div>\n </>\n );\n\n if (typeof document === 'undefined') {\n return modalContent;\n }\n\n return createPortal(modalContent, document.body);\n};\n"],"mappings":";;;;;;;;;AAwBA,IAAa,KAAS,MAAqC;CACzD,IAAM,EACJ,WACA,YACA,UACA,aACA,WACA,mBACA,oBACE,GACE,EAAE,SAAM,EAAe,KAAK,EAC5B,IAAU,GAAO,EACjB,IAAW,EAAuB,KAAK,EACvC,IAAkB,EAA2B,KAAK,EAClD,IAAkB,EAAO,EAAa,EACtC,IAAa,EAAO,EAAQ;CAOlC,AALA,QAAgB;EAEd,AADA,EAAgB,UAAU,GAC1B,EAAW,UAAU;GACrB,EAEF,QAAgB;EACd,IAAI,CAAC,GACH;EAGF,AAAI,SAAS,yBAAyB,gBACpC,EAAgB,UAAU,SAAS;EAGrC,IAAM,IAAe,EAAS;EAC9B,AAAI,KAAgB,QAClB,EACE,EAA0B,GAAc,EAAgB,QAAQ,CACjE;EAGH,IAAM,KAAiB,MAAqB;GAC1C,IAAI,EAAE,QAAQ,UAAU;IACtB,EAAW,SAAS;IACpB;;GAGF,IAAI,EAAE,QAAQ,OACZ;GAGF,IAAM,IAAe,EAAS;GAC9B,IAAI,KAAgB,MAClB;GAGF,IAAM,IAAoB,EAAqB,EAAa,EAEtD,IAAe,EAAkB,IACjC,IAAc,EAAkB,EAAkB,SAAS;GACjE,IAAI,KAAgB,QAAQ,KAAe,MAAM;IAE/C,AADA,EAAE,gBAAgB,EAClB,EAAa,OAAO;IACpB;;GAGF,IAAI,EAAE,YAAY,SAAS,kBAAkB,GAAc;IAEzD,AADA,EAAE,gBAAgB,EAClB,EAAY,OAAO;IACnB;;GAGF,AAAI,CAAC,EAAE,YAAY,SAAS,kBAAkB,MAC5C,EAAE,gBAAgB,EAClB,EAAa,OAAO;;EAMxB,OAFA,OAAO,iBAAiB,WAAW,EAAc,QAEpC;GACX,OAAO,oBAAoB,WAAW,EAAc;GACpD,IAAM,IAAsB,EAAgB;GAQ5C,AANE,KAAuB,QACvB,EAAoB,eACpB,SAAS,SAAS,EAAoB,IAEtC,EAAoB,OAAO,EAE7B,EAAgB,UAAU;;IAE3B,CAAC,EAAO,CAAC;CAGZ,IAAM,KAAoB,MAAwB;EAChD,EAAE,iBAAiB;;CAGrB,IAAI,CAAC,GACH,OAAO;CAGT,IAAM,IACJ,kBAAA,GAAA,EAAA,UAAA,CACE,kBAAC,GAAD;EAAS,WAAW;EAAQ,SAAS;EAAW,CAAA,EAChD,kBAAC,OAAD;EAAK,WAAW;YACd,kBAAC,OAAD;GACE,WAAW;GACX,KAAK;GACL,SAAS;GACT,MAAK;GACL,cAAW;GACX,mBAAiB;GACjB,UAAU;aAPZ;IASE,kBAAC,OAAD;KAAK,WAAW;eAAhB,CACE,kBAAC,MAAD;MAAI,IAAI;MAAS,WAAW;gBACzB;MACE,CAAA,EACL,kBAAC,UAAD;MACE,WAAW;MACX,SAAS;MACT,cAAY,KAAkB,EAAE,uBAAuB;MACvD,MAAK;gBAEL,kBAAC,GAAD;OAAe,OAAO;OAAI,QAAQ;OAAI,eAAY;OAAS,CAAA;MACpD,CAAA,CACL;;IACN,kBAAC,OAAD;KAAK,WAAW;KAAsB;KAAe,CAAA;IACpD,KAAU,QAAQ,kBAAC,OAAD;KAAK,WAAW;eAAqB;KAAa,CAAA;IACjE;;EACF,CAAA,CACL,EAAA,CAAA;CAOL,OAJI,OAAO,WAAa,MACf,IAGF,EAAa,GAAc,SAAS,KAAK"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/* empty css */
|
|
2
|
-
/* empty css */
|
|
3
2
|
/* empty css */
|
|
4
3
|
//#region src/atomic/molecules/markdown/components/MarkdownLink.css.ts
|
|
5
4
|
var e = "xtwkbg1 xtwkbg0 txvbqb3d txvbqb6b txvbqb78 txvbqb6x txvbqb7m txvbqbuu7", t = "xtwkbg3 xtwkbg1 xtwkbg0 txvbqb3d txvbqb6b txvbqb78 txvbqb6x txvbqb7m txvbqbuu7 xtwkbg2 txvbqbcp txvbqb9jg txvbqbany", n = "xtwkbg5 xtwkbg4 txvbqb9jg", r = "xtwkbg7 xtwkbg6 txvbqbf txvbqb3b";
|
|
@@ -3,23 +3,23 @@ import { Checkbox as t } from "../../../atomic/atoms/checkbox/Checkbox.js";
|
|
|
3
3
|
import { DataTable as n } from "../../../components/data-table/DataTable.js";
|
|
4
4
|
import { BulkActionsBar as r } from "../../molecules/bulk_actions_bar/BulkActionsBar.js";
|
|
5
5
|
import { TableToolbar as i } from "../../molecules/table_toolbar/TableToolbar.js";
|
|
6
|
-
import { selectionCell as a, wrapper as o } from "./backofficeDataTable.css.js";
|
|
7
|
-
import { useCallback as
|
|
8
|
-
import { jsx as
|
|
9
|
-
import { useTranslation as
|
|
6
|
+
import { selectionCell as a, wrapper as o, wrapperContained as s } from "./backofficeDataTable.css.js";
|
|
7
|
+
import { useCallback as c, useMemo as l } from "react";
|
|
8
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
9
|
+
import { useTranslation as f } from "react-i18next";
|
|
10
10
|
//#region src/backoffice/organisms/backoffice_data_table/BackofficeDataTable.tsx
|
|
11
|
-
var
|
|
11
|
+
var p = (e, t) => e.mobileRole === "action" ? "3.75rem" : e.isPrimary === !0 || t === 0 ? "minmax(16rem, 1fr)" : e.align === "right" || e.align === "center" ? "minmax(5.5rem, 7rem)" : "minmax(10rem, 0.75fr)", m = (e, t) => {
|
|
12
12
|
if (e.length === 0) return;
|
|
13
|
-
let n = e.map((e, t) =>
|
|
13
|
+
let n = e.map((e, t) => p(e, t)).join(" ");
|
|
14
14
|
return t ? `2.75rem ${n}` : n;
|
|
15
|
-
},
|
|
15
|
+
}, h = (e) => {
|
|
16
16
|
let { rows: n, selection: r, selectAllLabel: i, selectRowLabel: o } = e, s = [];
|
|
17
17
|
for (let e of n) e.selectable && s.push(e.id);
|
|
18
|
-
let c = s.filter((e) => r.selectedRowIds.has(e)).length,
|
|
18
|
+
let c = s.filter((e) => r.selectedRowIds.has(e)).length, l = s.length > 0 && c === s.length, d = c > 0 && !l, f = l;
|
|
19
19
|
d && (f = "mixed");
|
|
20
20
|
let p = () => {
|
|
21
21
|
if (s.length !== 0) {
|
|
22
|
-
if (
|
|
22
|
+
if (l) {
|
|
23
23
|
r.onSelectionChange(/* @__PURE__ */ new Set());
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
@@ -28,10 +28,10 @@ var f = (e, t) => e.mobileRole === "action" ? "3.75rem" : e.isPrimary === !0 ||
|
|
|
28
28
|
};
|
|
29
29
|
return {
|
|
30
30
|
id: "__select",
|
|
31
|
-
header: /* @__PURE__ */
|
|
31
|
+
header: /* @__PURE__ */ u("div", {
|
|
32
32
|
className: a,
|
|
33
|
-
children: /* @__PURE__ */
|
|
34
|
-
checked:
|
|
33
|
+
children: /* @__PURE__ */ u(t, {
|
|
34
|
+
checked: l,
|
|
35
35
|
disabled: s.length === 0,
|
|
36
36
|
indeterminate: d,
|
|
37
37
|
onChange: () => {
|
|
@@ -43,9 +43,9 @@ var f = (e, t) => e.mobileRole === "action" ? "3.75rem" : e.isPrimary === !0 ||
|
|
|
43
43
|
}),
|
|
44
44
|
cell: (e) => {
|
|
45
45
|
let { id: n, selectable: i } = e, s = r.selectedRowIds.has(n), c = o(e.row, e.index);
|
|
46
|
-
return /* @__PURE__ */
|
|
46
|
+
return /* @__PURE__ */ u("div", {
|
|
47
47
|
className: a,
|
|
48
|
-
children: /* @__PURE__ */
|
|
48
|
+
children: /* @__PURE__ */ u(t, {
|
|
49
49
|
checked: s,
|
|
50
50
|
disabled: !i,
|
|
51
51
|
onChange: () => {
|
|
@@ -58,73 +58,76 @@ var f = (e, t) => e.mobileRole === "action" ? "3.75rem" : e.isPrimary === !0 ||
|
|
|
58
58
|
},
|
|
59
59
|
className: a
|
|
60
60
|
};
|
|
61
|
-
},
|
|
62
|
-
let { t:
|
|
61
|
+
}, g = ({ columns: t, rows: a, getRowId: p, toolbar: g, selection: _, bulkActions: v, emptyState: y, className: b, selectAllLabel: x, selectRowLabel: S, ariaLabel: C, bodyScrollMode: w = "page" }) => {
|
|
62
|
+
let { t: T } = f("ui"), E = l(() => a.map((e, t) => ({
|
|
63
63
|
row: e,
|
|
64
64
|
index: t,
|
|
65
|
-
id:
|
|
66
|
-
selectable:
|
|
65
|
+
id: p(e, t),
|
|
66
|
+
selectable: _?.isRowSelectable?.(e, t) ?? !0
|
|
67
67
|
})), [
|
|
68
|
-
|
|
68
|
+
p,
|
|
69
69
|
a,
|
|
70
|
-
|
|
71
|
-
]),
|
|
72
|
-
rows:
|
|
73
|
-
selection:
|
|
74
|
-
selectAllLabel:
|
|
75
|
-
selectRowLabel:
|
|
70
|
+
_
|
|
71
|
+
]), D = l(() => _ == null ? null : h({
|
|
72
|
+
rows: E,
|
|
73
|
+
selection: _,
|
|
74
|
+
selectAllLabel: x ?? T("backoffice.dataTable.selectAll"),
|
|
75
|
+
selectRowLabel: S ?? ((e, t) => T("backoffice.dataTable.selectRow", { index: t + 1 }))
|
|
76
76
|
}), [
|
|
77
|
-
b,
|
|
78
77
|
x,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
78
|
+
S,
|
|
79
|
+
_,
|
|
80
|
+
T,
|
|
81
|
+
E
|
|
82
|
+
]), O = l(() => {
|
|
83
83
|
let e = t.map((e) => ({
|
|
84
84
|
...e,
|
|
85
85
|
cell: (t) => e.cell(t.row)
|
|
86
86
|
}));
|
|
87
|
-
return
|
|
88
|
-
}, [t,
|
|
89
|
-
if (
|
|
87
|
+
return D == null ? e : [D, ...e];
|
|
88
|
+
}, [t, D]), k = l(() => {
|
|
89
|
+
if (O.some((e) => e.isPrimary === !0) || O.length === 0) return O;
|
|
90
90
|
let e = 0;
|
|
91
|
-
return
|
|
91
|
+
return D != null && O.length > 1 && (e = 1), O.map((t, n) => n === e ? {
|
|
92
92
|
...t,
|
|
93
93
|
isPrimary: !0
|
|
94
94
|
} : t);
|
|
95
|
-
}, [
|
|
96
|
-
|
|
97
|
-
let
|
|
98
|
-
|
|
99
|
-
}, [
|
|
100
|
-
|
|
101
|
-
let
|
|
102
|
-
|
|
103
|
-
selectedCount:
|
|
104
|
-
actions:
|
|
105
|
-
onClearSelection:
|
|
106
|
-
}))
|
|
107
|
-
|
|
95
|
+
}, [O, D]), A = l(() => m(k, D != null), [k, D]), j = 0;
|
|
96
|
+
_ != null && (j = _.selectedRowIds.size);
|
|
97
|
+
let M = c(() => {
|
|
98
|
+
_?.onSelectionChange(/* @__PURE__ */ new Set());
|
|
99
|
+
}, [_]), N = null;
|
|
100
|
+
g != null && (N = /* @__PURE__ */ u(i, { ...g }));
|
|
101
|
+
let P = null;
|
|
102
|
+
_ != null && (P = /* @__PURE__ */ u(r, {
|
|
103
|
+
selectedCount: j,
|
|
104
|
+
actions: v,
|
|
105
|
+
onClearSelection: M
|
|
106
|
+
}));
|
|
107
|
+
let F = null;
|
|
108
|
+
return w === "contained" && (F = s), /* @__PURE__ */ d("div", {
|
|
109
|
+
className: e(o, F, b),
|
|
108
110
|
children: [
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
/* @__PURE__ */
|
|
112
|
-
ariaLabel:
|
|
113
|
-
columns:
|
|
114
|
-
rows:
|
|
111
|
+
N,
|
|
112
|
+
P,
|
|
113
|
+
/* @__PURE__ */ u(n, {
|
|
114
|
+
ariaLabel: C ?? T("backoffice.dataTable.label"),
|
|
115
|
+
columns: k,
|
|
116
|
+
rows: E,
|
|
115
117
|
getRowId: (e) => e.id,
|
|
116
|
-
emptyState:
|
|
118
|
+
emptyState: y,
|
|
117
119
|
className: void 0,
|
|
118
120
|
headerClassName: void 0,
|
|
119
121
|
bodyClassName: void 0,
|
|
120
122
|
rowClassName: void 0,
|
|
121
123
|
gridTemplateClassName: void 0,
|
|
122
|
-
gridTemplateColumns:
|
|
124
|
+
gridTemplateColumns: A,
|
|
125
|
+
bodyScrollMode: w
|
|
123
126
|
})
|
|
124
127
|
]
|
|
125
128
|
});
|
|
126
129
|
};
|
|
127
130
|
//#endregion
|
|
128
|
-
export {
|
|
131
|
+
export { g as BackofficeDataTable, g as default };
|
|
129
132
|
|
|
130
133
|
//# sourceMappingURL=BackofficeDataTable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackofficeDataTable.js","names":[],"sources":["../../../../../src/backoffice/organisms/backoffice_data_table/BackofficeDataTable.tsx"],"sourcesContent":["import { useCallback, useMemo, type JSX, type ReactNode } from 'react';\nimport { useTranslation } from 'react-i18next';\n\nimport { Checkbox } from '../../../atomic/atoms/checkbox/Checkbox.js';\nimport { cx } from '../../../theme/tools.js';\nimport {\n DataTable,\n type DataTableColumn,\n type GetRowId,\n} from '../../../components/data-table/DataTable.js';\n\nimport { BulkActionsBar } from '../../molecules/bulk_actions_bar/BulkActionsBar.js';\nimport {\n TableToolbar,\n type TableToolbarProps,\n} from '../../molecules/table_toolbar/TableToolbar.js';\n\nimport * as styles from './backofficeDataTable.css.js';\n\nexport type BackofficeDataTableSelection<Row> = {\n selectedRowIds: ReadonlySet<string>;\n onSelectionChange: (next: ReadonlySet<string>) => void;\n isRowSelectable?: (row: Row, index: number) => boolean;\n};\n\nexport type BackofficeDataTableProps<Row> = {\n columns: readonly DataTableColumn<Row>[];\n rows: readonly Row[];\n getRowId: GetRowId<Row>;\n toolbar?: TableToolbarProps;\n selection?: BackofficeDataTableSelection<Row>;\n bulkActions?: ReactNode;\n emptyState?: JSX.Element;\n className?: string;\n selectAllLabel?: string;\n selectRowLabel?: (row: Row, index: number) => string;\n ariaLabel?: string;\n};\n\ntype WrappedRow<Row> = {\n row: Row;\n index: number;\n id: string;\n selectable: boolean;\n};\n\nconst resolveColumnTemplate = <Row,>(\n column: DataTableColumn<Row>,\n index: number,\n): string => {\n if (column.mobileRole === 'action') {\n return '3.75rem';\n }\n if (column.isPrimary === true || index === 0) {\n return 'minmax(16rem, 1fr)';\n }\n if (column.align === 'right' || column.align === 'center') {\n return 'minmax(5.5rem, 7rem)';\n }\n return 'minmax(10rem, 0.75fr)';\n};\n\nconst buildGridTemplateColumns = <Row,>(\n columns: readonly DataTableColumn<Row>[],\n hasSelection: boolean,\n): string | undefined => {\n if (columns.length === 0) {\n return undefined;\n }\n const template = columns\n .map((column, index) => {\n return resolveColumnTemplate(column, index);\n })\n .join(' ');\n if (!hasSelection) {\n return template;\n }\n return `2.75rem ${template}`;\n};\n\nconst buildSelectionColumn = <Row,>(options: {\n rows: readonly WrappedRow<Row>[];\n selection: BackofficeDataTableSelection<Row>;\n selectAllLabel: string;\n selectRowLabel: (row: Row, index: number) => string;\n}): DataTableColumn<WrappedRow<Row>> => {\n const { rows, selection, selectAllLabel, selectRowLabel } = options;\n\n const selectableRowIds: string[] = [];\n for (const wrapped of rows) {\n if (wrapped.selectable) {\n selectableRowIds.push(wrapped.id);\n }\n }\n\n const selectedCount = selectableRowIds.filter((id) => {\n return selection.selectedRowIds.has(id);\n }).length;\n\n const isAllSelected =\n selectableRowIds.length > 0 && selectedCount === selectableRowIds.length;\n const isPartiallySelected = selectedCount > 0 && !isAllSelected;\n let selectAllAriaChecked: boolean | 'mixed' = isAllSelected;\n if (isPartiallySelected) {\n selectAllAriaChecked = 'mixed';\n }\n\n const toggleAll = (): void => {\n if (selectableRowIds.length === 0) {\n return;\n }\n if (isAllSelected) {\n selection.onSelectionChange(new Set());\n return;\n }\n selection.onSelectionChange(new Set(selectableRowIds));\n };\n\n return {\n id: '__select',\n header: (\n <div className={styles.selectionCell}>\n <Checkbox\n checked={isAllSelected}\n disabled={selectableRowIds.length === 0}\n indeterminate={isPartiallySelected}\n onChange={() => {\n toggleAll();\n }}\n aria-checked={selectAllAriaChecked}\n aria-label={selectAllLabel}\n />\n </div>\n ),\n cell: (wrapped) => {\n const { id: rowId, selectable } = wrapped;\n const checked = selection.selectedRowIds.has(rowId);\n const rowLabel = selectRowLabel(wrapped.row, wrapped.index);\n\n return (\n <div className={styles.selectionCell}>\n <Checkbox\n checked={checked}\n disabled={!selectable}\n onChange={() => {\n const next = new Set(selection.selectedRowIds);\n if (next.has(rowId)) {\n next.delete(rowId);\n } else if (selectable) {\n next.add(rowId);\n }\n selection.onSelectionChange(next);\n }}\n aria-label={rowLabel}\n />\n </div>\n );\n },\n className: styles.selectionCell,\n };\n};\n\nexport const BackofficeDataTable = <Row,>({\n columns,\n rows,\n getRowId,\n toolbar,\n selection,\n bulkActions,\n emptyState,\n className,\n selectAllLabel,\n selectRowLabel,\n ariaLabel,\n}: BackofficeDataTableProps<Row>): JSX.Element => {\n const { t } = useTranslation('ui');\n const wrappedRows = useMemo<readonly WrappedRow<Row>[]>(() => {\n return rows.map((row, index) => {\n const id = getRowId(row, index);\n const selectable = selection?.isRowSelectable?.(row, index) ?? true;\n return { row, index, id, selectable };\n });\n }, [getRowId, rows, selection]);\n\n const selectionColumn = useMemo(() => {\n if (selection == null) {\n return null;\n }\n return buildSelectionColumn({\n rows: wrappedRows,\n selection,\n selectAllLabel: selectAllLabel ?? t('backoffice.dataTable.selectAll'),\n selectRowLabel:\n selectRowLabel ??\n ((_row, index) => {\n return t('backoffice.dataTable.selectRow', {\n index: index + 1,\n });\n }),\n });\n }, [selectAllLabel, selectRowLabel, selection, t, wrappedRows]);\n\n const resolvedColumns = useMemo(() => {\n const mapped = columns.map<DataTableColumn<WrappedRow<Row>>>((column) => {\n return {\n ...column,\n cell: (wrapped: WrappedRow<Row>) => {\n return column.cell(wrapped.row);\n },\n };\n });\n if (selectionColumn == null) {\n return mapped;\n }\n return [selectionColumn, ...mapped];\n }, [columns, selectionColumn]);\n\n const columnsWithPrimary = useMemo(() => {\n const hasPrimary = resolvedColumns.some((column) => {\n return column.isPrimary === true;\n });\n if (hasPrimary) {\n return resolvedColumns;\n }\n if (resolvedColumns.length === 0) {\n return resolvedColumns;\n }\n let primaryIndex = 0;\n if (selectionColumn != null && resolvedColumns.length > 1) {\n primaryIndex = 1;\n }\n return resolvedColumns.map((column, index) => {\n if (index === primaryIndex) {\n return { ...column, isPrimary: true };\n }\n return column;\n });\n }, [resolvedColumns, selectionColumn]);\n\n const gridTemplateColumns = useMemo(() => {\n return buildGridTemplateColumns(\n columnsWithPrimary,\n selectionColumn != null,\n );\n }, [columnsWithPrimary, selectionColumn]);\n\n let selectedCount = 0;\n if (selection != null) {\n selectedCount = selection.selectedRowIds.size;\n }\n\n const handleClearSelection = useCallback(() => {\n if (selection != null) {\n selection.onSelectionChange(new Set());\n }\n }, [selection]);\n\n let toolbarNode: JSX.Element | null = null;\n if (toolbar != null) {\n toolbarNode = <TableToolbar {...toolbar} />;\n }\n\n let bulkActionsNode: JSX.Element | null = null;\n if (selection != null) {\n bulkActionsNode = (\n <BulkActionsBar\n selectedCount={selectedCount}\n actions={bulkActions}\n onClearSelection={handleClearSelection}\n />\n );\n }\n\n return (\n <div className={cx(styles.wrapper, className)}>\n {toolbarNode}\n {bulkActionsNode}\n\n <DataTable\n ariaLabel={ariaLabel ?? t('backoffice.dataTable.label')}\n columns={columnsWithPrimary}\n rows={wrappedRows}\n getRowId={(wrapped: WrappedRow<Row>) => {\n return wrapped.id;\n }}\n emptyState={emptyState}\n className={undefined}\n headerClassName={undefined}\n bodyClassName={undefined}\n rowClassName={undefined}\n gridTemplateClassName={undefined}\n gridTemplateColumns={gridTemplateColumns}\n />\n </div>\n );\n};\n\nexport default BackofficeDataTable;\n"],"mappings":";;;;;;;;;;AA8CA,IAAM,KACJ,GACA,MAEI,EAAO,eAAe,WACjB,YAEL,EAAO,cAAc,MAAQ,MAAU,IAClC,uBAEL,EAAO,UAAU,WAAW,EAAO,UAAU,WACxC,yBAEF,yBAGH,KACJ,GACA,MACuB;CACvB,IAAI,EAAQ,WAAW,GACrB;CAEF,IAAM,IAAW,EACd,KAAK,GAAQ,MACL,EAAsB,GAAQ,EAAM,CAC3C,CACD,KAAK,IAAI;CAIZ,OAHK,IA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EAAc,GAAI,GAAW,CAAA;CAG7C,IAAI,IAAsC;CAW1C,OAVI,KAAa,SACf,IACE,kBAAC,GAAD;EACiB;EACf,SAAS;EACT,kBAAkB;EAClB,CAAA,GAKJ,kBAAC,OAAD;EAAK,WAAW,EAAG,GAAgB,EAAU;YAA7C;GACG;GACA;GAED,kBAAC,GAAD;IACE,WAAW,KAAa,EAAE,6BAA6B;IACvD,SAAS;IACT,MAAM;IACN,WAAW,MACF,EAAQ;IAEL;IACZ,WAAW,KAAA;IACX,iBAAiB,KAAA;IACjB,eAAe,KAAA;IACf,cAAc,KAAA;IACd,uBAAuB,KAAA;IACF;IACrB,CAAA;GACE"}
|
|
1
|
+
{"version":3,"file":"BackofficeDataTable.js","names":[],"sources":["../../../../../src/backoffice/organisms/backoffice_data_table/BackofficeDataTable.tsx"],"sourcesContent":["import { useCallback, useMemo, type JSX, type ReactNode } from 'react';\nimport { useTranslation } from 'react-i18next';\n\nimport { Checkbox } from '../../../atomic/atoms/checkbox/Checkbox.js';\nimport { cx } from '../../../theme/tools.js';\nimport {\n DataTable,\n type DataTableBodyScrollMode,\n type DataTableColumn,\n type GetRowId,\n} from '../../../components/data-table/DataTable.js';\n\nimport { BulkActionsBar } from '../../molecules/bulk_actions_bar/BulkActionsBar.js';\nimport {\n TableToolbar,\n type TableToolbarProps,\n} from '../../molecules/table_toolbar/TableToolbar.js';\n\nimport * as styles from './backofficeDataTable.css.js';\n\nexport type BackofficeDataTableSelection<Row> = {\n selectedRowIds: ReadonlySet<string>;\n onSelectionChange: (next: ReadonlySet<string>) => void;\n isRowSelectable?: (row: Row, index: number) => boolean;\n};\n\nexport type BackofficeDataTableProps<Row> = {\n columns: readonly DataTableColumn<Row>[];\n rows: readonly Row[];\n getRowId: GetRowId<Row>;\n toolbar?: TableToolbarProps;\n selection?: BackofficeDataTableSelection<Row>;\n bulkActions?: ReactNode;\n emptyState?: JSX.Element;\n className?: string;\n selectAllLabel?: string;\n selectRowLabel?: (row: Row, index: number) => string;\n ariaLabel?: string;\n bodyScrollMode?: DataTableBodyScrollMode;\n};\n\ntype WrappedRow<Row> = {\n row: Row;\n index: number;\n id: string;\n selectable: boolean;\n};\n\nconst resolveColumnTemplate = <Row,>(\n column: DataTableColumn<Row>,\n index: number,\n): string => {\n if (column.mobileRole === 'action') {\n return '3.75rem';\n }\n if (column.isPrimary === true || index === 0) {\n return 'minmax(16rem, 1fr)';\n }\n if (column.align === 'right' || column.align === 'center') {\n return 'minmax(5.5rem, 7rem)';\n }\n return 'minmax(10rem, 0.75fr)';\n};\n\nconst buildGridTemplateColumns = <Row,>(\n columns: readonly DataTableColumn<Row>[],\n hasSelection: boolean,\n): string | undefined => {\n if (columns.length === 0) {\n return undefined;\n }\n const template = columns\n .map((column, index) => {\n return resolveColumnTemplate(column, index);\n })\n .join(' ');\n if (!hasSelection) {\n return template;\n }\n return `2.75rem ${template}`;\n};\n\nconst buildSelectionColumn = <Row,>(options: {\n rows: readonly WrappedRow<Row>[];\n selection: BackofficeDataTableSelection<Row>;\n selectAllLabel: string;\n selectRowLabel: (row: Row, index: number) => string;\n}): DataTableColumn<WrappedRow<Row>> => {\n const { rows, selection, selectAllLabel, selectRowLabel } = options;\n\n const selectableRowIds: string[] = [];\n for (const wrapped of rows) {\n if (wrapped.selectable) {\n selectableRowIds.push(wrapped.id);\n }\n }\n\n const selectedCount = selectableRowIds.filter((id) => {\n return selection.selectedRowIds.has(id);\n }).length;\n\n const isAllSelected =\n selectableRowIds.length > 0 && selectedCount === selectableRowIds.length;\n const isPartiallySelected = selectedCount > 0 && !isAllSelected;\n let selectAllAriaChecked: boolean | 'mixed' = isAllSelected;\n if (isPartiallySelected) {\n selectAllAriaChecked = 'mixed';\n }\n\n const toggleAll = (): void => {\n if (selectableRowIds.length === 0) {\n return;\n }\n if (isAllSelected) {\n selection.onSelectionChange(new Set());\n return;\n }\n selection.onSelectionChange(new Set(selectableRowIds));\n };\n\n return {\n id: '__select',\n header: (\n <div className={styles.selectionCell}>\n <Checkbox\n checked={isAllSelected}\n disabled={selectableRowIds.length === 0}\n indeterminate={isPartiallySelected}\n onChange={() => {\n toggleAll();\n }}\n aria-checked={selectAllAriaChecked}\n aria-label={selectAllLabel}\n />\n </div>\n ),\n cell: (wrapped) => {\n const { id: rowId, selectable } = wrapped;\n const checked = selection.selectedRowIds.has(rowId);\n const rowLabel = selectRowLabel(wrapped.row, wrapped.index);\n\n return (\n <div className={styles.selectionCell}>\n <Checkbox\n checked={checked}\n disabled={!selectable}\n onChange={() => {\n const next = new Set(selection.selectedRowIds);\n if (next.has(rowId)) {\n next.delete(rowId);\n } else if (selectable) {\n next.add(rowId);\n }\n selection.onSelectionChange(next);\n }}\n aria-label={rowLabel}\n />\n </div>\n );\n },\n className: styles.selectionCell,\n };\n};\n\nexport const BackofficeDataTable = <Row,>({\n columns,\n rows,\n getRowId,\n toolbar,\n selection,\n bulkActions,\n emptyState,\n className,\n selectAllLabel,\n selectRowLabel,\n ariaLabel,\n bodyScrollMode = 'page',\n}: BackofficeDataTableProps<Row>): JSX.Element => {\n const { t } = useTranslation('ui');\n const wrappedRows = useMemo<readonly WrappedRow<Row>[]>(() => {\n return rows.map((row, index) => {\n const id = getRowId(row, index);\n const selectable = selection?.isRowSelectable?.(row, index) ?? true;\n return { row, index, id, selectable };\n });\n }, [getRowId, rows, selection]);\n\n const selectionColumn = useMemo(() => {\n if (selection == null) {\n return null;\n }\n return buildSelectionColumn({\n rows: wrappedRows,\n selection,\n selectAllLabel: selectAllLabel ?? t('backoffice.dataTable.selectAll'),\n selectRowLabel:\n selectRowLabel ??\n ((_row, index) => {\n return t('backoffice.dataTable.selectRow', {\n index: index + 1,\n });\n }),\n });\n }, [selectAllLabel, selectRowLabel, selection, t, wrappedRows]);\n\n const resolvedColumns = useMemo(() => {\n const mapped = columns.map<DataTableColumn<WrappedRow<Row>>>((column) => {\n return {\n ...column,\n cell: (wrapped: WrappedRow<Row>) => {\n return column.cell(wrapped.row);\n },\n };\n });\n if (selectionColumn == null) {\n return mapped;\n }\n return [selectionColumn, ...mapped];\n }, [columns, selectionColumn]);\n\n const columnsWithPrimary = useMemo(() => {\n const hasPrimary = resolvedColumns.some((column) => {\n return column.isPrimary === true;\n });\n if (hasPrimary) {\n return resolvedColumns;\n }\n if (resolvedColumns.length === 0) {\n return resolvedColumns;\n }\n let primaryIndex = 0;\n if (selectionColumn != null && resolvedColumns.length > 1) {\n primaryIndex = 1;\n }\n return resolvedColumns.map((column, index) => {\n if (index === primaryIndex) {\n return { ...column, isPrimary: true };\n }\n return column;\n });\n }, [resolvedColumns, selectionColumn]);\n\n const gridTemplateColumns = useMemo(() => {\n return buildGridTemplateColumns(\n columnsWithPrimary,\n selectionColumn != null,\n );\n }, [columnsWithPrimary, selectionColumn]);\n\n let selectedCount = 0;\n if (selection != null) {\n selectedCount = selection.selectedRowIds.size;\n }\n\n const handleClearSelection = useCallback(() => {\n if (selection != null) {\n selection.onSelectionChange(new Set());\n }\n }, [selection]);\n\n let toolbarNode: JSX.Element | null = null;\n if (toolbar != null) {\n toolbarNode = <TableToolbar {...toolbar} />;\n }\n\n let bulkActionsNode: JSX.Element | null = null;\n if (selection != null) {\n bulkActionsNode = (\n <BulkActionsBar\n selectedCount={selectedCount}\n actions={bulkActions}\n onClearSelection={handleClearSelection}\n />\n );\n }\n\n let containedWrapperClassName: string | null = null;\n if (bodyScrollMode === 'contained') {\n containedWrapperClassName = styles.wrapperContained;\n }\n\n return (\n <div className={cx(styles.wrapper, containedWrapperClassName, className)}>\n {toolbarNode}\n {bulkActionsNode}\n\n <DataTable\n ariaLabel={ariaLabel ?? t('backoffice.dataTable.label')}\n columns={columnsWithPrimary}\n rows={wrappedRows}\n getRowId={(wrapped: WrappedRow<Row>) => {\n return wrapped.id;\n }}\n emptyState={emptyState}\n className={undefined}\n headerClassName={undefined}\n bodyClassName={undefined}\n rowClassName={undefined}\n gridTemplateClassName={undefined}\n gridTemplateColumns={gridTemplateColumns}\n bodyScrollMode={bodyScrollMode}\n />\n </div>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AE,GAAG;GAAQ,WAAW;GAAM,GAEhC,EACP;IACD,CAAC,GAAiB,EAAgB,CAAC,EAEhC,IAAsB,QACnB,EACL,GACA,KAAmB,KACpB,EACA,CAAC,GAAoB,EAAgB,CAAC,EAErC,IAAgB;CACpB,AAAI,KAAa,SACf,IAAgB,EAAU,eAAe;CAG3C,IAAM,IAAuB,QAAkB;EAC7C,AAAI,GACQ,kCAAkB,IAAI,KAAK,CAAC;IAEvC,CAAC,EAAU,CAAC,EAEX,IAAkC;CACtC,AAAI,KAAW,SACb,IAAc,kBAAC,GAAD,EAAc,GAAI,GAAW,CAAA;CAG7C,IAAI,IAAsC;CAC1C,AAAI,KAAa,SACf,IACE,kBAAC,GAAD;EACiB;EACf,SAAS;EACT,kBAAkB;EAClB,CAAA;CAIN,IAAI,IAA2C;CAK/C,OAJI,MAAmB,gBACrB,IAA4B,IAI5B,kBAAC,OAAD;EAAK,WAAW,EAAG,GAAgB,GAA2B,EAAU;YAAxE;GACG;GACA;GAED,kBAAC,GAAD;IACE,WAAW,KAAa,EAAE,6BAA6B;IACvD,SAAS;IACT,MAAM;IACN,WAAW,MACF,EAAQ;IAEL;IACZ,WAAW,KAAA;IACX,iBAAiB,KAAA;IACjB,eAAe,KAAA;IACf,cAAc,KAAA;IACd,uBAAuB,KAAA;IACF;IACL;IAChB,CAAA;GACE"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/* empty css */
|
|
2
2
|
/* empty css */
|
|
3
3
|
//#region src/backoffice/organisms/backoffice_data_table/backofficeDataTable.css.ts
|
|
4
|
-
var e = "x4h99m0 txvbqb9ip txvbqbai7 txvbqbaog", t = "x4h99m1 txvbqbdoy";
|
|
4
|
+
var e = "x4h99m0 txvbqb9ip txvbqbai7 txvbqbaog", t = "x4h99m1 txvbqbcgg txvbqbjh7", n = "x4h99m2 txvbqbdoy";
|
|
5
5
|
//#endregion
|
|
6
|
-
export {
|
|
6
|
+
export { n as selectionCell, e as wrapper, t as wrapperContained };
|
|
7
7
|
|
|
8
8
|
//# sourceMappingURL=backofficeDataTable.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backofficeDataTable.css.js","names":[],"sources":["../../../../../src/backoffice/organisms/backoffice_data_table/backofficeDataTable.css.ts"],"sourcesContent":["import { sprinkles } from '../../../theme/sprinkles.css.js';\n\nexport const wrapper = sprinkles({\n display: 'flex',\n flexDirection: 'column',\n gap: 3,\n});\n\nexport const selectionCell = sprinkles({\n justifyContent: 'center',\n});\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"backofficeDataTable.css.js","names":[],"sources":["../../../../../src/backoffice/organisms/backoffice_data_table/backofficeDataTable.css.ts"],"sourcesContent":["import { sprinkles } from '../../../theme/sprinkles.css.js';\n\nexport const wrapper = sprinkles({\n display: 'flex',\n flexDirection: 'column',\n gap: 3,\n});\n\nexport const wrapperContained = sprinkles({\n height: 'full',\n minHeight: 0,\n});\n\nexport const selectionCell = sprinkles({\n justifyContent: 'center',\n});\n"],"mappings":""}
|
|
@@ -2,7 +2,7 @@ import { VirtualizedConnectionTable as e } from "../../../components/data-table/
|
|
|
2
2
|
import { mapInfiniteScroll as t, mapVirtualization as n } from "./helpers.js";
|
|
3
3
|
import { jsx as r } from "react/jsx-runtime";
|
|
4
4
|
//#region src/backoffice/organisms/backoffice_virtualized_connection_table/BackofficeVirtualizedConnectionTable.tsx
|
|
5
|
-
var i = ({ columns: i, rows: a, getRowId: o, emptyState: s, className: c, gridTemplateColumns: l, virtualization: u, infiniteScroll: d, hasNextPage: f, isLoadingMore: p, onLoadMore: m, ariaLabel: h, ariaLabelledBy: g }) => /* @__PURE__ */ r(e, {
|
|
5
|
+
var i = ({ columns: i, rows: a, getRowId: o, emptyState: s, className: c, gridTemplateColumns: l, virtualization: u, infiniteScroll: d, hasNextPage: f, isLoadingMore: p, onLoadMore: m, ariaLabel: h, ariaLabelledBy: g, bodyScrollMode: _ }) => /* @__PURE__ */ r(e, {
|
|
6
6
|
columns: i,
|
|
7
7
|
rows: a,
|
|
8
8
|
getRowId: o,
|
|
@@ -17,7 +17,8 @@ var i = ({ columns: i, rows: a, getRowId: o, emptyState: s, className: c, gridTe
|
|
|
17
17
|
isLoadingMore: p,
|
|
18
18
|
onLoadMore: m,
|
|
19
19
|
ariaLabel: h,
|
|
20
|
-
ariaLabelledBy: g
|
|
20
|
+
ariaLabelledBy: g,
|
|
21
|
+
bodyScrollMode: _
|
|
21
22
|
});
|
|
22
23
|
//#endregion
|
|
23
24
|
export { i as BackofficeVirtualizedConnectionTable, i as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackofficeVirtualizedConnectionTable.js","names":[],"sources":["../../../../../src/backoffice/organisms/backoffice_virtualized_connection_table/BackofficeVirtualizedConnectionTable.tsx"],"sourcesContent":["import { type JSX } from 'react';\nimport { VirtualizedConnectionTable } from '../../../components/data-table/VirtualizedConnectionTable.js';\nimport type {\n DataTableColumn,\n GetRowId,\n} from '../../../components/data-table/DataTable.js';\nimport { mapInfiniteScroll, mapVirtualization } from './helpers.js';\n\nexport type BackofficeVirtualizationConfig = {\n enabled: boolean;\n rowHeightPx: number;\n overscan: number;\n};\n\nexport type BackofficeInfiniteScrollConfig = {\n enabled: boolean;\n thresholdPx?: number;\n autoLoad?: boolean;\n};\n\nexport type BackofficeVirtualizedConnectionTableProps<Row> = {\n columns: readonly DataTableColumn<Row>[];\n rows: readonly Row[];\n getRowId: GetRowId<Row>;\n emptyState?: JSX.Element;\n className?: string;\n gridTemplateColumns?: string;\n\n virtualization?: BackofficeVirtualizationConfig;\n\n infiniteScroll?: BackofficeInfiniteScrollConfig;\n hasNextPage?: boolean;\n isLoadingMore?: boolean;\n onLoadMore?: () => void;\n ariaLabel?: string;\n ariaLabelledBy?: string;\n};\n\nexport const BackofficeVirtualizedConnectionTable = <Row,>({\n columns,\n rows,\n getRowId,\n emptyState,\n className,\n gridTemplateColumns,\n virtualization,\n infiniteScroll,\n hasNextPage,\n isLoadingMore,\n onLoadMore,\n ariaLabel,\n ariaLabelledBy,\n}: BackofficeVirtualizedConnectionTableProps<Row>): JSX.Element => {\n return (\n <VirtualizedConnectionTable\n columns={columns}\n rows={rows}\n getRowId={getRowId}\n emptyState={emptyState}\n className={className}\n gridTemplateColumns={gridTemplateColumns}\n kind={undefined}\n classes={undefined}\n virtualization={mapVirtualization(virtualization)}\n infiniteScroll={mapInfiniteScroll(infiniteScroll)}\n hasNextPage={hasNextPage}\n isLoadingMore={isLoadingMore}\n onLoadMore={onLoadMore}\n ariaLabel={ariaLabel}\n ariaLabelledBy={ariaLabelledBy}\n />\n );\n};\n\nexport default BackofficeVirtualizedConnectionTable;\n"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"BackofficeVirtualizedConnectionTable.js","names":[],"sources":["../../../../../src/backoffice/organisms/backoffice_virtualized_connection_table/BackofficeVirtualizedConnectionTable.tsx"],"sourcesContent":["import { type JSX } from 'react';\nimport { VirtualizedConnectionTable } from '../../../components/data-table/VirtualizedConnectionTable.js';\nimport type {\n DataTableBodyScrollMode,\n DataTableColumn,\n GetRowId,\n} from '../../../components/data-table/DataTable.js';\nimport { mapInfiniteScroll, mapVirtualization } from './helpers.js';\n\nexport type BackofficeVirtualizationConfig = {\n enabled: boolean;\n rowHeightPx: number;\n overscan: number;\n};\n\nexport type BackofficeInfiniteScrollConfig = {\n enabled: boolean;\n thresholdPx?: number;\n autoLoad?: boolean;\n};\n\nexport type BackofficeVirtualizedConnectionTableProps<Row> = {\n columns: readonly DataTableColumn<Row>[];\n rows: readonly Row[];\n getRowId: GetRowId<Row>;\n emptyState?: JSX.Element;\n className?: string;\n gridTemplateColumns?: string;\n\n virtualization?: BackofficeVirtualizationConfig;\n\n infiniteScroll?: BackofficeInfiniteScrollConfig;\n hasNextPage?: boolean;\n isLoadingMore?: boolean;\n onLoadMore?: () => void;\n ariaLabel?: string;\n ariaLabelledBy?: string;\n bodyScrollMode?: DataTableBodyScrollMode;\n};\n\nexport const BackofficeVirtualizedConnectionTable = <Row,>({\n columns,\n rows,\n getRowId,\n emptyState,\n className,\n gridTemplateColumns,\n virtualization,\n infiniteScroll,\n hasNextPage,\n isLoadingMore,\n onLoadMore,\n ariaLabel,\n ariaLabelledBy,\n bodyScrollMode,\n}: BackofficeVirtualizedConnectionTableProps<Row>): JSX.Element => {\n return (\n <VirtualizedConnectionTable\n columns={columns}\n rows={rows}\n getRowId={getRowId}\n emptyState={emptyState}\n className={className}\n gridTemplateColumns={gridTemplateColumns}\n kind={undefined}\n classes={undefined}\n virtualization={mapVirtualization(virtualization)}\n infiniteScroll={mapInfiniteScroll(infiniteScroll)}\n hasNextPage={hasNextPage}\n isLoadingMore={isLoadingMore}\n onLoadMore={onLoadMore}\n ariaLabel={ariaLabel}\n ariaLabelledBy={ariaLabelledBy}\n bodyScrollMode={bodyScrollMode}\n />\n );\n};\n\nexport default BackofficeVirtualizedConnectionTable;\n"],"mappings":";;;;AAwCA,IAAa,KAA8C,EACzD,YACA,SACA,aACA,eACA,cACA,wBACA,mBACA,mBACA,gBACA,kBACA,eACA,cACA,mBACA,wBAGE,kBAAC,GAAD;CACW;CACH;CACI;CACE;CACD;CACU;CACrB,MAAM,KAAA;CACN,SAAS,KAAA;CACT,gBAAgB,EAAkB,EAAe;CACjD,gBAAgB,EAAkB,EAAe;CACpC;CACE;CACH;CACD;CACK;CACA;CAChB,CAAA"}
|
|
@@ -1,54 +1,57 @@
|
|
|
1
1
|
import { cx as e } from "../../../theme/tools.js";
|
|
2
2
|
import { EntityHeader as t } from "../../organisms/entity_header/EntityHeader.js";
|
|
3
|
-
import { body as n,
|
|
4
|
-
import { jsx as
|
|
3
|
+
import { body as n, bodyRow as r, bodyViewport as i, container as a, containerNoTabs as o, containerWithTabs as s, headerCard as c, headerCardDensity as l, rowSingle as u, rowSplit as d, rowSplitBase as f, sidePanelBase as p, sidePanelCard as m, sidePanelPlain as h, sidePanelTopVar as g, staticRow as _ } from "./detailPageTemplate.css.js";
|
|
4
|
+
import { jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
5
5
|
//#region src/backoffice/templates/detail_page_template/DetailPageTemplate.tsx
|
|
6
|
-
var
|
|
7
|
-
let { children:
|
|
8
|
-
|
|
9
|
-
let
|
|
10
|
-
|
|
11
|
-
let
|
|
12
|
-
|
|
13
|
-
let
|
|
14
|
-
|
|
15
|
-
let
|
|
16
|
-
|
|
17
|
-
let
|
|
18
|
-
|
|
19
|
-
let
|
|
20
|
-
return /* @__PURE__ */
|
|
21
|
-
className: e(
|
|
22
|
-
style:
|
|
6
|
+
var b = (b) => {
|
|
7
|
+
let { children: x, aboveContent: S, className: C, tabsNode: w, sidePanel: T, sidePanelVariant: E = "card", sidePanelStickyTop: D, layoutVariant: O, headerDensity: k = "default" } = b, A = T != null, j = "single";
|
|
8
|
+
A && (j = "split");
|
|
9
|
+
let M = O ?? j;
|
|
10
|
+
A || (M = "single");
|
|
11
|
+
let N = M === "split", P = u;
|
|
12
|
+
N && (P = e(d, f));
|
|
13
|
+
let F;
|
|
14
|
+
F = "headerNode" in b ? b.headerNode : /* @__PURE__ */ v(t, { ...b.header });
|
|
15
|
+
let I = D?.trim(), L;
|
|
16
|
+
I != null && I !== "" && (L = { [g]: I });
|
|
17
|
+
let R = m;
|
|
18
|
+
E === "plain" && (R = h);
|
|
19
|
+
let z = e(p, R), B = w != null, V = o;
|
|
20
|
+
return B && (V = s), /* @__PURE__ */ y("div", {
|
|
21
|
+
className: e(a, V, C),
|
|
22
|
+
style: L,
|
|
23
23
|
children: [
|
|
24
|
-
/* @__PURE__ */
|
|
25
|
-
className:
|
|
26
|
-
children: /* @__PURE__ */
|
|
27
|
-
className: e(
|
|
28
|
-
children:
|
|
24
|
+
/* @__PURE__ */ v("div", {
|
|
25
|
+
className: e(P, _),
|
|
26
|
+
children: /* @__PURE__ */ v("div", {
|
|
27
|
+
className: e(c, l[k]),
|
|
28
|
+
children: F
|
|
29
29
|
})
|
|
30
30
|
}),
|
|
31
|
-
|
|
32
|
-
className:
|
|
33
|
-
children: /* @__PURE__ */
|
|
34
|
-
className: "
|
|
35
|
-
children:
|
|
31
|
+
B && /* @__PURE__ */ v("div", {
|
|
32
|
+
className: e(P, "eno74p5 txvbqbjh7"),
|
|
33
|
+
children: /* @__PURE__ */ v("div", {
|
|
34
|
+
className: "eno74pj eno74pi txvbqbpty txvbqbv49 txvbqbly7 txvbqbuv7",
|
|
35
|
+
children: w
|
|
36
36
|
})
|
|
37
37
|
}),
|
|
38
|
-
/* @__PURE__ */
|
|
39
|
-
className:
|
|
40
|
-
children:
|
|
41
|
-
className:
|
|
42
|
-
children: [
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
38
|
+
/* @__PURE__ */ v("div", {
|
|
39
|
+
className: i,
|
|
40
|
+
children: /* @__PURE__ */ y("div", {
|
|
41
|
+
className: e(P, r),
|
|
42
|
+
children: [/* @__PURE__ */ y("div", {
|
|
43
|
+
className: n,
|
|
44
|
+
children: [S, x]
|
|
45
|
+
}), A && /* @__PURE__ */ v("aside", {
|
|
46
|
+
className: z,
|
|
47
|
+
children: T
|
|
48
|
+
})]
|
|
49
|
+
})
|
|
47
50
|
})
|
|
48
51
|
]
|
|
49
52
|
});
|
|
50
53
|
};
|
|
51
54
|
//#endregion
|
|
52
|
-
export {
|
|
55
|
+
export { b as DetailPageTemplate, b as default };
|
|
53
56
|
|
|
54
57
|
//# sourceMappingURL=DetailPageTemplate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DetailPageTemplate.js","names":[],"sources":["../../../../../src/backoffice/templates/detail_page_template/DetailPageTemplate.tsx"],"sourcesContent":["import { type CSSProperties, type JSX, type ReactNode } from 'react';\n\nimport {\n EntityHeader,\n type EntityHeaderProps,\n} from '../../organisms/entity_header/EntityHeader.js';\nimport * as styles from './detailPageTemplate.css.js';\nimport { cx } from '../../../theme/tools.js';\n\ntype WithHeaderProps = {\n header: EntityHeaderProps;\n headerNode?: never;\n};\n\ntype WithHeaderNode = {\n header?: never;\n headerNode: ReactNode;\n};\n\nexport type DetailSidePanelVariant = 'card' | 'plain';\nexport type DetailLayoutVariant = 'single' | 'split';\nexport type DetailHeaderDensity = 'default' | 'compact';\n\nexport type DetailPageTemplateProps = (WithHeaderProps | WithHeaderNode) & {\n children: ReactNode;\n aboveContent?: ReactNode;\n tabsNode?: ReactNode;\n sidePanel?: ReactNode;\n sidePanelVariant?: DetailSidePanelVariant;\n sidePanelStickyTop?: string;\n layoutVariant?: DetailLayoutVariant;\n headerDensity?: DetailHeaderDensity;\n className?: string;\n};\n\nexport const DetailPageTemplate = (\n props: DetailPageTemplateProps,\n): JSX.Element => {\n const {\n children,\n aboveContent,\n className,\n tabsNode,\n sidePanel,\n sidePanelVariant = 'card',\n sidePanelStickyTop,\n layoutVariant,\n headerDensity = 'default',\n } = props;\n\n const hasSidePanel = sidePanel != null;\n let autoLayoutVariant: DetailLayoutVariant = 'single';\n if (hasSidePanel) {\n autoLayoutVariant = 'split';\n }\n let resolvedLayoutVariant = layoutVariant ?? autoLayoutVariant;\n if (!hasSidePanel) {\n resolvedLayoutVariant = 'single';\n }\n const isSplitLayout = resolvedLayoutVariant === 'split';\n let rowClassName = styles.rowSingle;\n if (isSplitLayout) {\n rowClassName = cx(styles.rowSplit, styles.rowSplitBase);\n }\n\n let resolvedHeader: ReactNode;\n if ('headerNode' in props) {\n resolvedHeader = props.headerNode;\n } else {\n resolvedHeader = <EntityHeader {...props.header} />;\n }\n\n const resolvedStickyTop = sidePanelStickyTop?.trim();\n let containerStyle: CSSProperties | undefined;\n if (resolvedStickyTop != null && resolvedStickyTop !== '') {\n containerStyle = {\n [styles.sidePanelTopVar]: resolvedStickyTop,\n };\n }\n\n let sidePanelClassName = styles.sidePanelCard;\n if (sidePanelVariant === 'plain') {\n sidePanelClassName = styles.sidePanelPlain;\n }\n const resolvedSidePanelClassName = cx(\n styles.sidePanelBase,\n sidePanelClassName,\n );\n\n return (\n <div
|
|
1
|
+
{"version":3,"file":"DetailPageTemplate.js","names":[],"sources":["../../../../../src/backoffice/templates/detail_page_template/DetailPageTemplate.tsx"],"sourcesContent":["import { type CSSProperties, type JSX, type ReactNode } from 'react';\n\nimport {\n EntityHeader,\n type EntityHeaderProps,\n} from '../../organisms/entity_header/EntityHeader.js';\nimport * as styles from './detailPageTemplate.css.js';\nimport { cx } from '../../../theme/tools.js';\n\ntype WithHeaderProps = {\n header: EntityHeaderProps;\n headerNode?: never;\n};\n\ntype WithHeaderNode = {\n header?: never;\n headerNode: ReactNode;\n};\n\nexport type DetailSidePanelVariant = 'card' | 'plain';\nexport type DetailLayoutVariant = 'single' | 'split';\nexport type DetailHeaderDensity = 'default' | 'compact';\n\nexport type DetailPageTemplateProps = (WithHeaderProps | WithHeaderNode) & {\n children: ReactNode;\n aboveContent?: ReactNode;\n tabsNode?: ReactNode;\n sidePanel?: ReactNode;\n sidePanelVariant?: DetailSidePanelVariant;\n sidePanelStickyTop?: string;\n layoutVariant?: DetailLayoutVariant;\n headerDensity?: DetailHeaderDensity;\n className?: string;\n};\n\nexport const DetailPageTemplate = (\n props: DetailPageTemplateProps,\n): JSX.Element => {\n const {\n children,\n aboveContent,\n className,\n tabsNode,\n sidePanel,\n sidePanelVariant = 'card',\n sidePanelStickyTop,\n layoutVariant,\n headerDensity = 'default',\n } = props;\n\n const hasSidePanel = sidePanel != null;\n let autoLayoutVariant: DetailLayoutVariant = 'single';\n if (hasSidePanel) {\n autoLayoutVariant = 'split';\n }\n let resolvedLayoutVariant = layoutVariant ?? autoLayoutVariant;\n if (!hasSidePanel) {\n resolvedLayoutVariant = 'single';\n }\n const isSplitLayout = resolvedLayoutVariant === 'split';\n let rowClassName = styles.rowSingle;\n if (isSplitLayout) {\n rowClassName = cx(styles.rowSplit, styles.rowSplitBase);\n }\n\n let resolvedHeader: ReactNode;\n if ('headerNode' in props) {\n resolvedHeader = props.headerNode;\n } else {\n resolvedHeader = <EntityHeader {...props.header} />;\n }\n\n const resolvedStickyTop = sidePanelStickyTop?.trim();\n let containerStyle: CSSProperties | undefined;\n if (resolvedStickyTop != null && resolvedStickyTop !== '') {\n containerStyle = {\n [styles.sidePanelTopVar]: resolvedStickyTop,\n };\n }\n\n let sidePanelClassName = styles.sidePanelCard;\n if (sidePanelVariant === 'plain') {\n sidePanelClassName = styles.sidePanelPlain;\n }\n const resolvedSidePanelClassName = cx(\n styles.sidePanelBase,\n sidePanelClassName,\n );\n\n const hasTabs = tabsNode != null;\n let tabsContainerClassName = styles.containerNoTabs;\n if (hasTabs) {\n tabsContainerClassName = styles.containerWithTabs;\n }\n\n return (\n <div\n className={cx(styles.container, tabsContainerClassName, className)}\n style={containerStyle}\n >\n <div className={cx(rowClassName, styles.staticRow)}>\n <div\n className={cx(\n styles.headerCard,\n styles.headerCardDensity[headerDensity],\n )}\n >\n {resolvedHeader}\n </div>\n </div>\n {hasTabs && (\n <div className={cx(rowClassName, styles.staticRow)}>\n <div className={styles.tabsRow}>{tabsNode}</div>\n </div>\n )}\n <div className={styles.bodyViewport}>\n <div className={cx(rowClassName, styles.bodyRow)}>\n <div className={styles.body}>\n {aboveContent}\n {children}\n </div>\n {hasSidePanel && (\n <aside className={resolvedSidePanelClassName}>{sidePanel}</aside>\n )}\n </div>\n </div>\n </div>\n );\n};\n\nexport default DetailPageTemplate;\n"],"mappings":";;;;;AAmCA,IAAa,KACX,MACgB;CAChB,IAAM,EACJ,aACA,iBACA,cACA,aACA,cACA,sBAAmB,QACnB,uBACA,kBACA,mBAAgB,cACd,GAEE,IAAe,KAAa,MAC9B,IAAyC;CAC7C,AAAI,MACF,IAAoB;CAEtB,IAAI,IAAwB,KAAiB;CAC7C,AAAK,MACH,IAAwB;CAE1B,IAAM,IAAgB,MAA0B,SAC5C,IAAe;CACnB,AAAI,MACF,IAAe,EAAG,GAAiB,EAAoB;CAGzD,IAAI;CACJ,AAGE,IAHE,gBAAgB,IACD,EAAM,aAEN,kBAAC,GAAD,EAAc,GAAI,EAAM,QAAU,CAAA;CAGrD,IAAM,IAAoB,GAAoB,MAAM,EAChD;CACJ,AAAI,KAAqB,QAAQ,MAAsB,OACrD,IAAiB,GACd,IAAyB,GAC3B;CAGH,IAAI,IAAqB;CACzB,AAAI,MAAqB,YACvB,IAAqB;CAEvB,IAAM,IAA6B,EACjC,GACA,EACD,EAEK,IAAU,KAAY,MACxB,IAAyB;CAK7B,OAJI,MACF,IAAyB,IAIzB,kBAAC,OAAD;EACE,WAAW,EAAG,GAAkB,GAAwB,EAAU;EAClE,OAAO;YAFT;GAIE,kBAAC,OAAD;IAAK,WAAW,EAAG,GAAc,EAAiB;cAChD,kBAAC,OAAD;KACE,WAAW,EACT,GACA,EAAyB,GAC1B;eAEA;KACG,CAAA;IACF,CAAA;GACL,KACC,kBAAC,OAAD;IAAK,WAAW,EAAG,GAAc,oBAAiB;cAChD,kBAAC,OAAD;KAAK,WAAW;eAAiB;KAAe,CAAA;IAC5C,CAAA;GAER,kBAAC,OAAD;IAAK,WAAW;cACd,kBAAC,OAAD;KAAK,WAAW,EAAG,GAAc,EAAe;eAAhD,CACE,kBAAC,OAAD;MAAK,WAAW;gBAAhB,CACG,GACA,EACG;SACL,KACC,kBAAC,SAAD;MAAO,WAAW;gBAA6B;MAAkB,CAAA,CAE/D;;IACF,CAAA;GACF"}
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
/* empty css */
|
|
9
9
|
/* empty css */
|
|
10
10
|
//#region src/backoffice/templates/detail_page_template/detailPageTemplate.css.ts
|
|
11
|
-
var e = "var(--eno74p0)", t = "eno74p2 eno74p1
|
|
11
|
+
var e = "var(--eno74p0)", t = "eno74p2 eno74p1 txvbqb9iy txvbqbaop txvbqbcgg txvbqbjh7", n = "eno74p3", r = "eno74p4", i = "eno74p5 txvbqbjh7", a = "eno74p6 txvbqbu7g txvbqbk5y txvbqb9ip txvbqbai7 txvbqbaop", o = "eno74p7 txvbqb9iy txvbqbbwp txvbqbbxf txvbqbc7 txvbqbco", s = "eno74p8 txvbqbjh7", c = "eno74p9 txvbqbu7g txvbqbk5y txvbqbaop", l = "eno74pa", u = {
|
|
12
12
|
default: "_1995g4r1 _1995g4r0 _1995g4r2 _1995g4rb _1995g4rd _1995g4rg _1995g4rm",
|
|
13
13
|
compact: "_1995g4r1 _1995g4r0 _1995g4r2 _1995g4ra _1995g4rd _1995g4rg _1995g4rl"
|
|
14
|
-
},
|
|
14
|
+
}, d = "eno74pb txvbqb9ip txvbqbai7 txvbqbaop txvbqbk5y txvbqbjh7", f = "eno74pd eno74pc txvbqbjh7", p = "eno74pf eno74pe txvbqbpu7 txvbqbpu6 txvbqb9ip txvbqbai7 txvbqbaog txvbqbk5y txvbqbjh7 txvbqbdp", m = "eno74pg _1995g4r1 _1995g4r0 _1995g4r3 _1995g4ra _1995g4rd _1995g4rg _1995g4rl", h = "eno74ph txvbqb12g txvbqb1py txvbqbv0t txvbqblag txvbqb8ug", g = "eno74pj eno74pi txvbqbpty txvbqbv49 txvbqbly7 txvbqbuv7";
|
|
15
15
|
//#endregion
|
|
16
|
-
export {
|
|
16
|
+
export { d as body, s as bodyRow, f as bodyViewport, t as container, n as containerNoTabs, r as containerWithTabs, l as headerCard, u as headerCardDensity, a as rowSingle, o as rowSplit, c as rowSplitBase, p as sidePanelBase, m as sidePanelCard, h as sidePanelPlain, e as sidePanelTopVar, i as staticRow, g as tabsRow };
|
|
17
17
|
|
|
18
18
|
//# sourceMappingURL=detailPageTemplate.css.js.map
|