@owp/core 2.5.9 → 2.5.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/index10.js +2 -2
- package/dist/_virtual/index12.js +2 -2
- package/dist/_virtual/index13.js +2 -2
- package/dist/_virtual/index14.js +2 -2
- package/dist/_virtual/index15.js +2 -2
- package/dist/_virtual/index16.js +4 -4
- package/dist/_virtual/index17.js +4 -4
- package/dist/_virtual/index18.js +4 -4
- package/dist/_virtual/index19.js +4 -4
- package/dist/_virtual/index20.js +2 -2
- package/dist/_virtual/index21.js +2 -2
- package/dist/_virtual/index22.js +2 -2
- package/dist/_virtual/index5.js +2 -2
- package/dist/components/OwpTable/OwpFieldTable.js +108 -92
- package/dist/components/OwpTable/OwpFieldTable.js.map +1 -1
- package/dist/components/OwpTable/OwpTable.js +161 -141
- package/dist/components/OwpTable/OwpTable.js.map +1 -1
- package/dist/components/OwpTable/internal/FieldTableValue.js +43 -0
- package/dist/components/OwpTable/internal/FieldTableValue.js.map +1 -0
- package/dist/components/OwpTable/internal/defaultTableStyle.js +13 -10
- package/dist/components/OwpTable/internal/defaultTableStyle.js.map +1 -1
- package/dist/components/OwpTreeGrid/OwpTreeGrid.js +170 -169
- package/dist/components/OwpTreeGrid/OwpTreeGrid.js.map +1 -1
- package/dist/components/OwpTreeGrid/internal/treeGridRuntime.js +195 -147
- package/dist/components/OwpTreeGrid/internal/treeGridRuntime.js.map +1 -1
- package/dist/components/OwpTreeGrid/internal/treeGridTheme.js +79 -76
- package/dist/components/OwpTreeGrid/internal/treeGridTheme.js.map +1 -1
- package/dist/configs/defaultConfig.js +110 -70
- package/dist/configs/defaultConfig.js.map +1 -1
- package/dist/constants/tableTheme.js +7 -6
- package/dist/constants/tableTheme.js.map +1 -1
- package/dist/features/themePreview/components/ThemePreviewCanvas.js +275 -273
- package/dist/features/themePreview/components/ThemePreviewCanvas.js.map +1 -1
- package/dist/features/themePreview/components/ThemePreviewCanvasSections.js +552 -316
- package/dist/features/themePreview/components/ThemePreviewCanvasSections.js.map +1 -1
- package/dist/features/themePreview/components/ThemePreviewColorField.js +227 -202
- package/dist/features/themePreview/components/ThemePreviewColorField.js.map +1 -1
- package/dist/features/themePreview/components/ThemePreviewControls.js +270 -220
- package/dist/features/themePreview/components/ThemePreviewControls.js.map +1 -1
- package/dist/features/themePreview/components/themePreviewCanvas.shared.js +38 -38
- package/dist/features/themePreview/components/themePreviewCanvas.shared.js.map +1 -1
- package/dist/features/themePreview/configs/settings.js +33 -20
- package/dist/features/themePreview/configs/settings.js.map +1 -1
- package/dist/features/themePreview/dialogs/ThemePreviewDialog.js +227 -220
- package/dist/features/themePreview/dialogs/ThemePreviewDialog.js.map +1 -1
- package/dist/features/themePreview/hooks/useThemePreview.js +250 -226
- package/dist/features/themePreview/hooks/useThemePreview.js.map +1 -1
- package/dist/features/themePreview/utils/themePreviewDefinitions.js +63 -30
- package/dist/features/themePreview/utils/themePreviewDefinitions.js.map +1 -1
- package/dist/features/themePreview/utils/themePreviewSettings.js +188 -151
- package/dist/features/themePreview/utils/themePreviewSettings.js.map +1 -1
- package/dist/features/themePreview.js +18 -17
- package/dist/layout/components/navbar/NavbarToggleButton.js +46 -42
- package/dist/layout/components/navbar/NavbarToggleButton.js.map +1 -1
- package/dist/layout/components/toggles/NavigationSearchToggle.js +3 -3
- package/dist/node_modules/.pnpm/autosuggest-highlight@3.3.4/node_modules/autosuggest-highlight/match/index.js +1 -1
- package/dist/node_modules/.pnpm/autosuggest-highlight@3.3.4/node_modules/autosuggest-highlight/parse/index.js +1 -1
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/CODE128/index.js +1 -1
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/CODE39/index.js +1 -1
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/CODE93/constants.js +1 -1
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/CODE93/index.js +1 -1
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/EAN_UPC/index.js +1 -1
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/GenericBarcode/index.js +1 -1
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/ITF/constants.js +1 -1
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/ITF/index.js +1 -1
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/MSI/index.js +1 -1
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/codabar/index.js +1 -1
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/pharmacode/index.js +1 -1
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/renderers/index.js +1 -1
- package/dist/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/index.js +1 -1
- package/dist/node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/index.js +1 -1
- package/dist/node_modules/.pnpm/react-overlays@5.2.1_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/react-overlays/esm/Portal.js +1 -1
- package/dist/owp-app.css +1 -1
- package/dist/types/components/OwpTable/OwpFieldTable.d.ts +7 -3
- package/dist/types/components/OwpTable/OwpTable.d.ts +3 -1
- package/dist/types/components/OwpTable/internal/FieldTableValue.d.ts +17 -0
- package/dist/types/components/OwpTable/internal/defaultTableStyle.d.ts +3 -0
- package/dist/types/components/OwpTreeGrid/OwpTreeGrid.d.ts +3 -1
- package/dist/types/components/OwpTreeGrid/internal/treeGridTheme.d.ts +1 -1
- package/dist/types/configs/defaultConfig.d.ts +42 -3
- package/dist/types/constants/tableTheme.d.ts +1 -0
- package/dist/types/features/themePreview/components/ThemePreviewCanvasSections.d.ts +8 -0
- package/dist/types/features/themePreview/components/themePreviewCanvas.shared.d.ts +3 -3
- package/dist/types/features/themePreview/configs/settings.d.ts +12 -0
- package/dist/types/features/themePreview/utils/index.d.ts +1 -1
- package/dist/types/features/themePreview/utils/themePreviewSettings.d.ts +11 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/types/OwpMuiThemeTypes.d.ts +9 -0
- package/dist/types/types/OwpTableThemeTypes.d.ts +1 -0
- package/dist/types/types/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,112 +1,123 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
import { jsxs as
|
|
4
|
-
import { resolveOwpGridTheme as
|
|
5
|
-
import { resolveOwpTableTheme as
|
|
6
|
-
import { getTreeGridFontFaceStyles as
|
|
7
|
-
import { useGetCurrentSettings as
|
|
8
|
-
import { Typography as
|
|
9
|
-
import { clsx as
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import { useMemo as
|
|
19
|
-
import { getTreeGridContainerSx as
|
|
20
|
-
import { getDefaultTableHeaderCellSx as
|
|
21
|
-
import { isNumber as
|
|
22
|
-
import { isArray as
|
|
23
|
-
import { isEmpty as
|
|
24
|
-
const
|
|
1
|
+
var Y = Object.defineProperty;
|
|
2
|
+
var b = (e, o) => Y(e, "name", { value: o, configurable: !0 });
|
|
3
|
+
import { jsxs as y, jsx as m, Fragment as j } from "../../node_modules/.pnpm/@emotion_react@11.14.0_@types_react@19.2.14_react@19.2.4/node_modules/@emotion/react/jsx-runtime/dist/emotion-react-jsx-runtime.browser.esm.js";
|
|
4
|
+
import { resolveOwpGridTheme as k } from "../../constants/gridTheme.js";
|
|
5
|
+
import { resolveOwpTableTheme as H } from "../../constants/tableTheme.js";
|
|
6
|
+
import { getTreeGridFontFaceStyles as q } from "../../constants/treeGrid.js";
|
|
7
|
+
import { useGetCurrentSettings as I } from "../../hooks/useOwpSettings.js";
|
|
8
|
+
import { Typography as z, styled as F, Divider as J } from "@mui/material";
|
|
9
|
+
import { clsx as K } from "../../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.js";
|
|
10
|
+
import Q from "@mui/material/GlobalStyles";
|
|
11
|
+
import V from "@mui/material/Paper";
|
|
12
|
+
import W from "@mui/material/Table";
|
|
13
|
+
import X from "@mui/material/TableBody";
|
|
14
|
+
import S from "@mui/material/TableCell";
|
|
15
|
+
import Z from "@mui/material/TableContainer";
|
|
16
|
+
import U from "@mui/material/TableHead";
|
|
17
|
+
import P from "@mui/material/TableRow";
|
|
18
|
+
import { useMemo as w } from "react";
|
|
19
|
+
import { getTreeGridContainerSx as oo, getTreeGridBodyRowSx as eo, TREEGRID_TABLE_BODY_BORDER_COLOR as ro, getTreeGridBodyCellSx as to, TREEGRID_TABLE_HEADER_BORDER_COLOR as lo, getTreeGridHeaderCellSx as io, getTreeGridCellBaseSx as ao } from "./internal/treeGridTableStyle.js";
|
|
20
|
+
import { getDefaultTableHeaderCellSx as N, getDefaultTableCellSx as mo, defaultStyledTableTheme as L } from "./internal/defaultTableStyle.js";
|
|
21
|
+
import { isNumber as bo } from "../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/compat/predicate/isNumber.js";
|
|
22
|
+
import { isArray as $ } from "../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/compat/predicate/isArray.js";
|
|
23
|
+
import { isEmpty as no } from "../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/compat/predicate/isEmpty.js";
|
|
24
|
+
const G = /* @__PURE__ */ b((e) => e ? Object.keys(e).filter((o) => !o.includes("Span")) : [], "getTableColumnKeys"), _ = /* @__PURE__ */ b((e, o) => e[`${o}Sx`] ?? {}, "getTableCellSx"), D = /* @__PURE__ */ b((e, o, r) => e[`${o}${r}`] ?? void 0, "getTableCellSpan"), E = /* @__PURE__ */ b((...e) => e.reduce((o, r) => r ? [...o, ...$(r) ? r : [r]] : o, []), "mergeSx"), fo = {
|
|
25
25
|
border: 0,
|
|
26
26
|
borderRadius: 0,
|
|
27
27
|
overflow: "visible"
|
|
28
|
+
}, B = {
|
|
29
|
+
dark: "rgba(241,245,249,.12)",
|
|
30
|
+
light: "#e2e8f0"
|
|
28
31
|
};
|
|
29
|
-
function
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
function po({
|
|
33
|
+
borderColor: e,
|
|
34
|
+
totalCount: o
|
|
35
|
+
}) {
|
|
36
|
+
return /* @__PURE__ */ y(j, { children: [
|
|
37
|
+
/* @__PURE__ */ m(J, { sx: e ? { borderColor: e } : void 0 }),
|
|
38
|
+
/* @__PURE__ */ y(z, { className: "w-full py-8 pr-12", align: "right", children: [
|
|
33
39
|
"전체: ",
|
|
34
|
-
|
|
40
|
+
bo(o) ? o.toLocaleString() : 0,
|
|
35
41
|
" 건"
|
|
36
42
|
] })
|
|
37
43
|
] });
|
|
38
44
|
}
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
canBodyFullHeight:
|
|
42
|
-
canUseTreeGridStyle:
|
|
43
|
-
children:
|
|
44
|
-
className:
|
|
45
|
-
containerProps:
|
|
46
|
-
footerSlot:
|
|
45
|
+
b(po, "OwpTableTotalCount");
|
|
46
|
+
const ho = /* @__PURE__ */ b(({
|
|
47
|
+
canBodyFullHeight: e,
|
|
48
|
+
canUseTreeGridStyle: o,
|
|
49
|
+
children: r,
|
|
50
|
+
className: T,
|
|
51
|
+
containerProps: l,
|
|
52
|
+
footerSlot: t,
|
|
47
53
|
tableTheme: d,
|
|
48
|
-
tableLayout:
|
|
49
|
-
...
|
|
54
|
+
tableLayout: s,
|
|
55
|
+
...v
|
|
50
56
|
}) => {
|
|
51
|
-
|
|
57
|
+
var x, R, g;
|
|
58
|
+
const i = I(), c = ((g = (R = (x = i == null ? void 0 : i.theme) == null ? void 0 : x.main) == null ? void 0 : R.palette) == null ? void 0 : g.mode) === "dark" ? B.dark : B.light, u = w(
|
|
52
59
|
() => {
|
|
53
|
-
var
|
|
54
|
-
return
|
|
60
|
+
var n, f;
|
|
61
|
+
return k((f = (n = i == null ? void 0 : i.theme) == null ? void 0 : n.main) == null ? void 0 : f.grid);
|
|
55
62
|
},
|
|
56
63
|
[i]
|
|
57
|
-
),
|
|
64
|
+
), C = w(
|
|
58
65
|
() => {
|
|
59
|
-
var
|
|
60
|
-
return d ??
|
|
66
|
+
var n, f;
|
|
67
|
+
return d ?? H((f = (n = i == null ? void 0 : i.theme) == null ? void 0 : n.main) == null ? void 0 : f.table, {
|
|
68
|
+
...L,
|
|
69
|
+
borderColor: c
|
|
70
|
+
});
|
|
61
71
|
},
|
|
62
|
-
[i, d]
|
|
72
|
+
[i, c, d]
|
|
63
73
|
);
|
|
64
|
-
return /* @__PURE__ */
|
|
65
|
-
|
|
66
|
-
/* @__PURE__ */
|
|
67
|
-
|
|
74
|
+
return /* @__PURE__ */ y(j, { children: [
|
|
75
|
+
o && /* @__PURE__ */ m(Q, { styles: q() }),
|
|
76
|
+
/* @__PURE__ */ y(
|
|
77
|
+
Z,
|
|
68
78
|
{
|
|
69
|
-
component:
|
|
79
|
+
component: V,
|
|
70
80
|
variant: "outlined",
|
|
71
|
-
...
|
|
72
|
-
sx:
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
o &&
|
|
76
|
-
|
|
81
|
+
...l,
|
|
82
|
+
sx: E(
|
|
83
|
+
!o && { borderColor: C.borderColor },
|
|
84
|
+
o && fo,
|
|
85
|
+
o && oo(u),
|
|
86
|
+
e && { height: "100%" },
|
|
87
|
+
l == null ? void 0 : l.sx
|
|
77
88
|
),
|
|
78
89
|
children: [
|
|
79
|
-
/* @__PURE__ */
|
|
80
|
-
|
|
90
|
+
/* @__PURE__ */ m(
|
|
91
|
+
To,
|
|
81
92
|
{
|
|
82
|
-
...
|
|
83
|
-
canBodyFullHeight:
|
|
84
|
-
canUseTreeGridStyle:
|
|
85
|
-
tableTheme:
|
|
86
|
-
treeGridTheme:
|
|
87
|
-
className:
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
93
|
+
...v,
|
|
94
|
+
canBodyFullHeight: e,
|
|
95
|
+
canUseTreeGridStyle: o,
|
|
96
|
+
tableTheme: C,
|
|
97
|
+
treeGridTheme: u,
|
|
98
|
+
className: K(
|
|
99
|
+
e && "h-full",
|
|
100
|
+
s === "fixed" ? "table-fixed" : s === "auto" ? "table-auto" : "",
|
|
101
|
+
T
|
|
91
102
|
),
|
|
92
|
-
children:
|
|
103
|
+
children: r
|
|
93
104
|
}
|
|
94
105
|
),
|
|
95
|
-
|
|
106
|
+
t
|
|
96
107
|
]
|
|
97
108
|
}
|
|
98
109
|
)
|
|
99
110
|
] });
|
|
100
|
-
}, "StyledTable"),
|
|
101
|
-
shouldForwardProp: /* @__PURE__ */
|
|
111
|
+
}, "StyledTable"), To = F(W, {
|
|
112
|
+
shouldForwardProp: /* @__PURE__ */ b((e) => e !== "canBodyFullHeight" && e !== "canUseTreeGridStyle" && e !== "tableTheme" && e !== "treeGridTheme", "shouldForwardProp")
|
|
102
113
|
})(
|
|
103
|
-
({ theme:
|
|
104
|
-
const
|
|
114
|
+
({ theme: e, canBodyFullHeight: o, canUseTreeGridStyle: r, tableTheme: T, treeGridTheme: l }) => {
|
|
115
|
+
const t = l ?? k(), d = T ?? L;
|
|
105
116
|
return {
|
|
106
|
-
...
|
|
117
|
+
...o && {
|
|
107
118
|
height: "100%"
|
|
108
119
|
},
|
|
109
|
-
...
|
|
120
|
+
...o && {
|
|
110
121
|
"& .MuiTableBody-root": {
|
|
111
122
|
height: "100%"
|
|
112
123
|
},
|
|
@@ -114,34 +125,34 @@ const ae = /* @__PURE__ */ n(({
|
|
|
114
125
|
height: "100%"
|
|
115
126
|
}
|
|
116
127
|
},
|
|
117
|
-
"& .MuiTableCell-root":
|
|
118
|
-
...
|
|
128
|
+
"& .MuiTableCell-root": r ? {
|
|
129
|
+
...ao(t)
|
|
119
130
|
} : void 0,
|
|
120
|
-
...!
|
|
131
|
+
...!r && {
|
|
121
132
|
"& .MuiTableRow-root > .MuiTableCell-root + .MuiTableCell-root": {
|
|
122
|
-
borderLeft: `1px solid ${
|
|
133
|
+
borderLeft: `1px solid ${d.borderColor}`
|
|
123
134
|
}
|
|
124
135
|
},
|
|
125
|
-
"& th":
|
|
126
|
-
...
|
|
136
|
+
"& th": r ? {
|
|
137
|
+
...io(t),
|
|
127
138
|
"&:first-of-type": {
|
|
128
|
-
borderLeft: `1px solid ${
|
|
139
|
+
borderLeft: `1px solid ${lo}`
|
|
129
140
|
}
|
|
130
141
|
} : {
|
|
131
|
-
...
|
|
142
|
+
...N(d, e.palette.grey[200])
|
|
132
143
|
},
|
|
133
|
-
"& td":
|
|
134
|
-
...
|
|
144
|
+
"& td": r ? {
|
|
145
|
+
...to(t),
|
|
135
146
|
"&:first-of-type": {
|
|
136
|
-
borderLeft: `1px solid ${
|
|
147
|
+
borderLeft: `1px solid ${ro}`
|
|
137
148
|
}
|
|
138
149
|
} : {
|
|
139
|
-
...
|
|
150
|
+
...mo(d)
|
|
140
151
|
},
|
|
141
|
-
...
|
|
142
|
-
"& tbody > .MuiTableRow-root":
|
|
152
|
+
...r && {
|
|
153
|
+
"& tbody > .MuiTableRow-root": eo(t)
|
|
143
154
|
},
|
|
144
|
-
...
|
|
155
|
+
...r && {
|
|
145
156
|
"& tbody > tr:first-of-type > th:first-of-type": {
|
|
146
157
|
borderTopLeftRadius: "inherit"
|
|
147
158
|
},
|
|
@@ -151,85 +162,94 @@ const ae = /* @__PURE__ */ n(({
|
|
|
151
162
|
}
|
|
152
163
|
};
|
|
153
164
|
}
|
|
154
|
-
),
|
|
165
|
+
), A = F(P)`
|
|
155
166
|
/* &:last-child th,
|
|
156
167
|
&:last-child td {
|
|
157
168
|
border-bottom: 0;
|
|
158
169
|
} */
|
|
159
170
|
`;
|
|
160
|
-
function
|
|
161
|
-
canTotalCountRow:
|
|
162
|
-
headers:
|
|
163
|
-
rows:
|
|
164
|
-
totalCount:
|
|
165
|
-
...
|
|
171
|
+
function ko({
|
|
172
|
+
canTotalCountRow: e = !1,
|
|
173
|
+
headers: o,
|
|
174
|
+
rows: r,
|
|
175
|
+
totalCount: T,
|
|
176
|
+
...l
|
|
166
177
|
}) {
|
|
167
|
-
var
|
|
168
|
-
const
|
|
178
|
+
var u, C, x, R, g, n, f, M;
|
|
179
|
+
const t = I(), d = ((x = (C = (u = t == null ? void 0 : t.theme) == null ? void 0 : u.main) == null ? void 0 : C.palette) == null ? void 0 : x.mode) === "dark" ? B.dark : B.light, s = w(
|
|
169
180
|
() => {
|
|
170
|
-
var
|
|
171
|
-
return
|
|
181
|
+
var a, p;
|
|
182
|
+
return l.tableTheme ?? H((p = (a = t == null ? void 0 : t.theme) == null ? void 0 : a.main) == null ? void 0 : p.table, {
|
|
183
|
+
...L,
|
|
184
|
+
borderColor: d
|
|
185
|
+
});
|
|
172
186
|
},
|
|
173
|
-
[
|
|
174
|
-
),
|
|
175
|
-
() =>
|
|
176
|
-
[
|
|
177
|
-
),
|
|
178
|
-
() => $(
|
|
179
|
-
[
|
|
180
|
-
),
|
|
181
|
-
return /* @__PURE__ */
|
|
182
|
-
|
|
187
|
+
[t, d, l.tableTheme]
|
|
188
|
+
), v = w(
|
|
189
|
+
() => $(o) ? o : no(o) ? [] : [o],
|
|
190
|
+
[o]
|
|
191
|
+
), i = w(
|
|
192
|
+
() => G($(o) ? o[0] : o),
|
|
193
|
+
[o]
|
|
194
|
+
), c = (f = (n = (g = (R = t == null ? void 0 : t.theme) == null ? void 0 : R.main) == null ? void 0 : g.table) == null ? void 0 : n.row) == null ? void 0 : f.backgroundColor;
|
|
195
|
+
return /* @__PURE__ */ y(
|
|
196
|
+
ho,
|
|
183
197
|
{
|
|
184
|
-
...
|
|
198
|
+
...l,
|
|
185
199
|
containerProps: {
|
|
186
|
-
...
|
|
187
|
-
sx:
|
|
188
|
-
!
|
|
189
|
-
(
|
|
200
|
+
...l.containerProps,
|
|
201
|
+
sx: E(
|
|
202
|
+
!l.canUseTreeGridStyle && c && { backgroundColor: c },
|
|
203
|
+
(M = l.containerProps) == null ? void 0 : M.sx
|
|
190
204
|
)
|
|
191
205
|
},
|
|
192
|
-
footerSlot:
|
|
193
|
-
|
|
194
|
-
|
|
206
|
+
footerSlot: e ? /* @__PURE__ */ m(
|
|
207
|
+
po,
|
|
208
|
+
{
|
|
209
|
+
borderColor: s.borderColor,
|
|
210
|
+
totalCount: typeof T > "u" ? r.length : T
|
|
211
|
+
}
|
|
212
|
+
) : void 0,
|
|
213
|
+
className: K(l.tableLayout && "w-full", l.className),
|
|
214
|
+
tableTheme: s,
|
|
195
215
|
children: [
|
|
196
|
-
/* @__PURE__ */
|
|
197
|
-
|
|
216
|
+
/* @__PURE__ */ m(U, { children: v.map((a, p) => /* @__PURE__ */ m(A, { children: G(a).map((h) => /* @__PURE__ */ m(
|
|
217
|
+
S,
|
|
198
218
|
{
|
|
199
219
|
className: "whitespace-pre-wrap",
|
|
200
|
-
sx:
|
|
201
|
-
!
|
|
202
|
-
|
|
220
|
+
sx: E(
|
|
221
|
+
!l.canUseTreeGridStyle && N(s),
|
|
222
|
+
_(a, h)
|
|
203
223
|
),
|
|
204
|
-
colSpan:
|
|
205
|
-
rowSpan:
|
|
224
|
+
colSpan: D(a, h, "ColSpan"),
|
|
225
|
+
rowSpan: D(a, h, "RowSpan"),
|
|
206
226
|
align: "center",
|
|
207
|
-
children:
|
|
227
|
+
children: a[h]
|
|
208
228
|
},
|
|
209
|
-
`table-header-${p}-${
|
|
229
|
+
`table-header-${p}-${h}`
|
|
210
230
|
)) }, `table-header-${p}`)) }),
|
|
211
|
-
/* @__PURE__ */
|
|
212
|
-
const
|
|
213
|
-
return /* @__PURE__ */
|
|
214
|
-
|
|
231
|
+
/* @__PURE__ */ m(X, { children: r.map((a, p) => {
|
|
232
|
+
const h = a;
|
|
233
|
+
return /* @__PURE__ */ m(A, { children: i.map((O) => /* @__PURE__ */ m(
|
|
234
|
+
S,
|
|
215
235
|
{
|
|
216
236
|
className: "whitespace-pre-wrap h-64",
|
|
217
|
-
sx:
|
|
237
|
+
sx: _(h, O),
|
|
218
238
|
align: "center",
|
|
219
|
-
children:
|
|
239
|
+
children: h[O]
|
|
220
240
|
},
|
|
221
|
-
`table-row-cell-${p}-${
|
|
241
|
+
`table-row-cell-${p}-${O}`
|
|
222
242
|
)) }, `table-row-${p}`);
|
|
223
243
|
}) })
|
|
224
244
|
]
|
|
225
245
|
}
|
|
226
246
|
);
|
|
227
247
|
}
|
|
228
|
-
|
|
248
|
+
b(ko, "OwpTable");
|
|
229
249
|
export {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
250
|
+
ko as OwpTable,
|
|
251
|
+
po as OwpTableTotalCount,
|
|
252
|
+
ho as StyledTable,
|
|
253
|
+
A as StyledTableRow
|
|
234
254
|
};
|
|
235
255
|
//# sourceMappingURL=OwpTable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OwpTable.js","sources":["../../../src/components/OwpTable/OwpTable.tsx"],"sourcesContent":["import {\n resolveOwpGridTheme,\n type OwpResolvedGridThemeConfigType,\n} from '@/constants/gridTheme';\nimport {\n resolveOwpTableTheme,\n type OwpResolvedTableThemeConfigType,\n} from '@/constants/tableTheme';\nimport { getTreeGridFontFaceStyles } from '@/constants/treeGrid';\nimport { useGetCurrentSettings } from '@/hooks/useOwpSettings';\nimport { Divider, styled, Typography, type SxProps, type Theme } from '@mui/material';\nimport clsx from 'clsx';\nimport GlobalStyles from '@mui/material/GlobalStyles';\nimport Paper from '@mui/material/Paper';\nimport Table, { type TableProps } from '@mui/material/Table';\nimport TableBody from '@mui/material/TableBody';\nimport TableCell from '@mui/material/TableCell';\nimport TableContainer, { type TableContainerProps } from '@mui/material/TableContainer';\nimport TableHead from '@mui/material/TableHead';\nimport TableRow from '@mui/material/TableRow';\nimport { isArray, isEmpty, isNumber } from 'es-toolkit/compat';\nimport { type ReactNode, useMemo } from 'react';\nimport {\n getTreeGridBodyCellSx,\n getTreeGridBodyRowSx,\n getTreeGridCellBaseSx,\n getTreeGridContainerSx,\n getTreeGridHeaderCellSx,\n TREEGRID_TABLE_BODY_BORDER_COLOR,\n TREEGRID_TABLE_HEADER_BORDER_COLOR,\n} from './internal/treeGridTableStyle';\nimport {\n defaultStyledTableTheme,\n getDefaultTableCellSx,\n getDefaultTableHeaderCellSx,\n} from './internal/defaultTableStyle';\n\ntype OwpTableCellValue = string | number;\ntype OwpTableHeaderRow = Record<string, OwpTableCellValue>;\ntype OwpTableRowData = Record<string, unknown>;\n\nconst getTableColumnKeys = (row?: Record<string, unknown>) => {\n if (!row) {\n return [];\n }\n\n return Object.keys(row).filter((keyName) => !keyName.includes('Span'));\n};\n\nconst getTableCellSx = (row: Record<string, unknown>, keyName: string) => {\n return (row[`${keyName}Sx`] as SxProps<Theme>) ?? {};\n};\n\nconst getTableCellSpan = (\n row: Record<string, unknown>,\n keyName: string,\n spanType: 'ColSpan' | 'RowSpan',\n) => {\n return (row[`${keyName}${spanType}`] as number | undefined) ?? undefined;\n};\n\nconst mergeSx = (...styles: Array<SxProps<Theme> | undefined | false>): SxProps<Theme> =>\n styles.reduce<Array<Exclude<SxProps<Theme>, readonly unknown[]>>>((acc, style) => {\n if (!style) {\n return acc;\n }\n\n return [...acc, ...(isArray(style) ? style : [style])];\n }, []) as SxProps<Theme>;\n\nconst treeGridContainerSx = {\n border: 0,\n borderRadius: 0,\n overflow: 'visible',\n} as const;\n\ninterface StyledTableProps extends TableProps {\n canBodyFullHeight?: boolean;\n canUseTreeGridStyle?: boolean;\n containerProps?: TableContainerProps;\n footerSlot?: ReactNode;\n tableTheme?: OwpResolvedTableThemeConfigType;\n tableLayout?: 'auto' | 'fixed';\n treeGridTheme?: OwpResolvedGridThemeConfigType;\n title?: string;\n children: ReactNode;\n}\n\ntype StyledTableInnerProps = Pick<\n StyledTableProps,\n 'canBodyFullHeight' | 'canUseTreeGridStyle' | 'tableTheme' | 'treeGridTheme'\n>;\n\n/**\n * 총 row 수 표시 영역\n * @param totalCount 전체 row 수\n */\nexport function OwpTableTotalCount({ totalCount }: { totalCount?: number }) {\n return (\n <>\n <Divider />\n <Typography className=\"w-full py-8 pr-12\" align=\"right\">\n 전체: {isNumber(totalCount) ? totalCount.toLocaleString() : 0} 건\n </Typography>\n </>\n );\n}\n\n/**\n * StyledTable 스타일 컴포넌트\n * @param canBodyFullHeight body full height 사용 여부\n * @param canUseTreeGridStyle TreeGrid 스타일 사용 여부\n * @param children 하위 콘텐츠\n * @param containerProps containerProps props\n * @param footerSlot footer 영역\n * @param tableLayout tableLayout 값\n */\nexport const StyledTable = ({\n canBodyFullHeight,\n canUseTreeGridStyle,\n children,\n className,\n containerProps,\n footerSlot,\n tableTheme: tableThemeProp,\n tableLayout,\n ...tableProps\n}: StyledTableProps) => {\n const currentSettings = useGetCurrentSettings();\n const treeGridTheme = useMemo(\n () => resolveOwpGridTheme(currentSettings?.theme?.main?.grid),\n [currentSettings],\n );\n const tableTheme = useMemo(\n () =>\n tableThemeProp ??\n resolveOwpTableTheme(currentSettings?.theme?.main?.table, defaultStyledTableTheme),\n [currentSettings, tableThemeProp],\n );\n\n return (\n <>\n {canUseTreeGridStyle && <GlobalStyles styles={getTreeGridFontFaceStyles()} />}\n <TableContainer\n component={Paper}\n variant=\"outlined\"\n {...containerProps}\n sx={mergeSx(\n canUseTreeGridStyle && treeGridContainerSx,\n canUseTreeGridStyle && getTreeGridContainerSx(treeGridTheme),\n canBodyFullHeight && { height: '100%' },\n containerProps?.sx,\n )}\n >\n <StyledTableInner\n {...tableProps}\n canBodyFullHeight={canBodyFullHeight}\n canUseTreeGridStyle={canUseTreeGridStyle}\n tableTheme={tableTheme}\n treeGridTheme={treeGridTheme}\n className={clsx(\n canBodyFullHeight && 'h-full',\n tableLayout === 'fixed' ? 'table-fixed' : tableLayout === 'auto' ? 'table-auto' : '',\n className,\n )}\n >\n {children}\n </StyledTableInner>\n {footerSlot}\n </TableContainer>\n </>\n );\n};\n\nconst StyledTableInner = styled(Table, {\n shouldForwardProp: (prop) =>\n prop !== 'canBodyFullHeight' &&\n prop !== 'canUseTreeGridStyle' &&\n prop !== 'tableTheme' &&\n prop !== 'treeGridTheme',\n})<StyledTableInnerProps>(\n ({ theme, canBodyFullHeight, canUseTreeGridStyle, tableTheme, treeGridTheme }) => {\n const resolvedTreeGridTheme = treeGridTheme ?? resolveOwpGridTheme();\n const resolvedTableTheme = tableTheme ?? defaultStyledTableTheme;\n\n return {\n ...(canBodyFullHeight && {\n height: '100%',\n }),\n ...(canBodyFullHeight && {\n '& .MuiTableBody-root': {\n height: '100%',\n },\n '& .MuiTableBody-root > .MuiTableRow-root': {\n height: '100%',\n },\n }),\n '& .MuiTableCell-root': canUseTreeGridStyle\n ? {\n ...getTreeGridCellBaseSx(resolvedTreeGridTheme),\n }\n : undefined,\n ...(!canUseTreeGridStyle && {\n '& .MuiTableRow-root > .MuiTableCell-root + .MuiTableCell-root': {\n borderLeft: `1px solid ${theme.palette.divider}`,\n },\n }),\n '& th': canUseTreeGridStyle\n ? {\n ...getTreeGridHeaderCellSx(resolvedTreeGridTheme),\n '&:first-of-type': {\n borderLeft: `1px solid ${TREEGRID_TABLE_HEADER_BORDER_COLOR}`,\n },\n }\n : {\n ...getDefaultTableHeaderCellSx(resolvedTableTheme, theme.palette.grey[200]),\n },\n '& td': canUseTreeGridStyle\n ? {\n ...getTreeGridBodyCellSx(resolvedTreeGridTheme),\n '&:first-of-type': {\n borderLeft: `1px solid ${TREEGRID_TABLE_BODY_BORDER_COLOR}`,\n },\n }\n : {\n ...getDefaultTableCellSx(resolvedTableTheme),\n },\n ...(canUseTreeGridStyle && {\n '& tbody > .MuiTableRow-root': getTreeGridBodyRowSx(resolvedTreeGridTheme),\n }),\n ...(canUseTreeGridStyle && {\n '& tbody > tr:first-of-type > th:first-of-type': {\n borderTopLeftRadius: 'inherit',\n },\n '& tbody > tr:first-of-type > td:last-of-type': {\n borderTopRightRadius: 'inherit',\n },\n }),\n };\n },\n);\n\nexport const StyledTableRow = styled(TableRow)`\n /* &:last-child th,\n &:last-child td {\n border-bottom: 0;\n } */\n`;\n\ninterface OwpTableProps<T> extends Omit<StyledTableProps, 'children'> {\n canTotalCountRow?: boolean;\n headers: OwpTableHeaderRow | OwpTableHeaderRow[];\n rows: T[];\n totalCount?: number;\n}\n\n/**\n * OwpTable 컴포넌트\n * @param canTotalCountRow 전체 row 수 표시 여부\n * @param headers headers 값\n * @param rows 행 데이터 목록\n * @param totalCount 전체 row 수\n */\nexport function OwpTable<T>({\n canTotalCountRow = false,\n headers,\n rows,\n totalCount,\n ...restTableProps\n}: OwpTableProps<T>) {\n const currentSettings = useGetCurrentSettings();\n const tableTheme = useMemo(\n () =>\n restTableProps.tableTheme ??\n resolveOwpTableTheme(currentSettings?.theme?.main?.table, defaultStyledTableTheme),\n [currentSettings, restTableProps.tableTheme],\n );\n const resolvedHeaderRows = useMemo(\n () => (isArray(headers) ? headers : isEmpty(headers) ? [] : [headers]),\n [headers],\n );\n const commonKeyListData = useMemo(\n () => getTableColumnKeys(isArray(headers) ? headers[0] : headers),\n [headers],\n );\n const tableBackgroundColor = currentSettings?.theme?.main?.table?.row?.backgroundColor;\n\n return (\n <StyledTable\n {...restTableProps}\n containerProps={{\n ...restTableProps.containerProps,\n sx: mergeSx(\n !restTableProps.canUseTreeGridStyle &&\n tableBackgroundColor && { backgroundColor: tableBackgroundColor },\n restTableProps.containerProps?.sx,\n ),\n }}\n footerSlot={\n canTotalCountRow ? (\n <OwpTableTotalCount totalCount={typeof totalCount === 'undefined' ? rows.length : totalCount} />\n ) : undefined\n }\n className={clsx(restTableProps.tableLayout && 'w-full', restTableProps.className)}\n tableTheme={tableTheme}\n >\n <TableHead>\n {resolvedHeaderRows.map((headerData, index) => (\n <StyledTableRow key={`table-header-${index}`}>\n {getTableColumnKeys(headerData).map((keyName) => (\n <TableCell\n key={`table-header-${index}-${keyName}`}\n className=\"whitespace-pre-wrap\"\n sx={mergeSx(\n !restTableProps.canUseTreeGridStyle && getDefaultTableHeaderCellSx(tableTheme),\n getTableCellSx(headerData, keyName),\n )}\n colSpan={getTableCellSpan(headerData, keyName, 'ColSpan')}\n rowSpan={getTableCellSpan(headerData, keyName, 'RowSpan')}\n align=\"center\"\n >\n {headerData[keyName]}\n </TableCell>\n ))}\n </StyledTableRow>\n ))}\n </TableHead>\n <TableBody>\n {rows.map((row, index) => {\n const currentRow = row as OwpTableRowData;\n\n return (\n <StyledTableRow key={`table-row-${index}`}>\n {commonKeyListData.map((keyName) => (\n <TableCell\n key={`table-row-cell-${index}-${keyName}`}\n className=\"whitespace-pre-wrap h-64\"\n sx={getTableCellSx(currentRow, keyName)}\n align=\"center\"\n >\n {currentRow[keyName] as ReactNode}\n </TableCell>\n ))}\n </StyledTableRow>\n );\n })}\n </TableBody>\n </StyledTable>\n );\n}\n"],"names":["getTableColumnKeys","__name","row","keyName","getTableCellSx","getTableCellSpan","spanType","mergeSx","styles","acc","style","isArray","treeGridContainerSx","OwpTableTotalCount","totalCount","jsxs","Fragment","jsx","Divider","Typography","isNumber","StyledTable","canBodyFullHeight","canUseTreeGridStyle","children","className","containerProps","footerSlot","tableThemeProp","tableLayout","tableProps","currentSettings","useGetCurrentSettings","treeGridTheme","useMemo","resolveOwpGridTheme","_b","_a","tableTheme","resolveOwpTableTheme","defaultStyledTableTheme","GlobalStyles","getTreeGridFontFaceStyles","TableContainer","Paper","getTreeGridContainerSx","StyledTableInner","clsx","styled","Table","prop","theme","resolvedTreeGridTheme","resolvedTableTheme","getTreeGridCellBaseSx","getTreeGridHeaderCellSx","TREEGRID_TABLE_HEADER_BORDER_COLOR","getDefaultTableHeaderCellSx","getTreeGridBodyCellSx","TREEGRID_TABLE_BODY_BORDER_COLOR","getDefaultTableCellSx","getTreeGridBodyRowSx","StyledTableRow","TableRow","OwpTable","canTotalCountRow","headers","rows","restTableProps","resolvedHeaderRows","isEmpty","commonKeyListData","tableBackgroundColor","_d","_c","_e","TableHead","headerData","index","TableCell","TableBody","currentRow"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAyCA,MAAMA,IAAqB,gBAAAC,EAAA,CAACC,MACrBA,IAIE,OAAO,KAAKA,CAAG,EAAE,OAAO,CAACC,MAAY,CAACA,EAAQ,SAAS,MAAM,CAAC,IAH5D,CAAA,GAFgB,uBAQrBC,IAAiB,gBAAAH,EAAA,CAACC,GAA8BC,MAC5CD,EAAI,GAAGC,CAAO,IAAI,KAAwB,CAAA,GAD7B,mBAIjBE,IAAmB,gBAAAJ,EAAA,CACvBC,GACAC,GACAG,MAEQJ,EAAI,GAAGC,CAAO,GAAGG,CAAQ,EAAE,KAA4B,QALxC,qBAQnBC,IAAU,gBAAAN,EAAA,IAAIO,MAClBA,EAAO,OAA2D,CAACC,GAAKC,MACjEA,IAIE,CAAC,GAAGD,GAAK,GAAIE,EAAQD,CAAK,IAAIA,IAAQ,CAACA,CAAK,CAAE,IAH5CD,GAIR,EAAE,GAPS,YASVG,KAAsB;AAAA,EAC1B,QAAQ;AAAA,EACR,cAAc;AAAA,EACd,UAAU;AACZ;AAuBO,SAASC,GAAmB,EAAE,YAAAC,KAAuC;AAC1E,SACE,gBAAAC,EAAAC,GAAA,EACE,UAAA;AAAA,IAAA,gBAAAC,EAACC,GAAA,EAAQ;AAAA,IACT,gBAAAH,EAACI,GAAA,EAAW,WAAU,qBAAoB,OAAM,SAAQ,UAAA;AAAA,MAAA;AAAA,MACjDC,GAASN,CAAU,IAAIA,EAAW,mBAAmB;AAAA,MAAE;AAAA,IAAA,EAAA,CAC9D;AAAA,EAAA,GACF;AAEJ;AATgBb,EAAAY,IAAA;AAoBT,MAAMQ,KAAc,gBAAApB,EAAA,CAAC;AAAA,EAC1B,mBAAAqB;AAAA,EACA,qBAAAC;AAAA,EACA,UAAAC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U;AAAA,cACV,IAAI3E,EAAe6E,GAAY9E,CAAO;AAAA,cACtC,OAAM;AAAA,cAEL,YAAWA,CAAO;AAAA,YAAA;AAAA,YALd,kBAAkB2E,CAAK,IAAI3E,CAAO;AAAA,UAAA,CAO1C,KAVkB,aAAa2E,CAAK,EAWvC;AAAA,QAEJ,CAAC,EAAA,CACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;AAtFgB7E,EAAA+D,IAAA;"}
|
|
1
|
+
{"version":3,"file":"OwpTable.js","sources":["../../../src/components/OwpTable/OwpTable.tsx"],"sourcesContent":["import {\n resolveOwpGridTheme,\n type OwpResolvedGridThemeConfigType,\n} from '@/constants/gridTheme';\nimport {\n resolveOwpTableTheme,\n type OwpResolvedTableThemeConfigType,\n} from '@/constants/tableTheme';\nimport { getTreeGridFontFaceStyles } from '@/constants/treeGrid';\nimport { useGetCurrentSettings } from '@/hooks/useOwpSettings';\nimport { Divider, styled, Typography, type SxProps, type Theme } from '@mui/material';\nimport clsx from 'clsx';\nimport GlobalStyles from '@mui/material/GlobalStyles';\nimport Paper from '@mui/material/Paper';\nimport Table, { type TableProps } from '@mui/material/Table';\nimport TableBody from '@mui/material/TableBody';\nimport TableCell from '@mui/material/TableCell';\nimport TableContainer, { type TableContainerProps } from '@mui/material/TableContainer';\nimport TableHead from '@mui/material/TableHead';\nimport TableRow from '@mui/material/TableRow';\nimport { isArray, isEmpty, isNumber } from 'es-toolkit/compat';\nimport { type ReactNode, useMemo } from 'react';\nimport {\n getTreeGridBodyCellSx,\n getTreeGridBodyRowSx,\n getTreeGridCellBaseSx,\n getTreeGridContainerSx,\n getTreeGridHeaderCellSx,\n TREEGRID_TABLE_BODY_BORDER_COLOR,\n TREEGRID_TABLE_HEADER_BORDER_COLOR,\n} from './internal/treeGridTableStyle';\nimport {\n defaultStyledTableTheme,\n getDefaultTableCellSx,\n getDefaultTableHeaderCellSx,\n} from './internal/defaultTableStyle';\n\ntype OwpTableCellValue = string | number;\ntype OwpTableHeaderRow = Record<string, OwpTableCellValue>;\ntype OwpTableRowData = Record<string, unknown>;\n\nconst getTableColumnKeys = (row?: Record<string, unknown>) => {\n if (!row) {\n return [];\n }\n\n return Object.keys(row).filter((keyName) => !keyName.includes('Span'));\n};\n\nconst getTableCellSx = (row: Record<string, unknown>, keyName: string) => {\n return (row[`${keyName}Sx`] as SxProps<Theme>) ?? {};\n};\n\nconst getTableCellSpan = (\n row: Record<string, unknown>,\n keyName: string,\n spanType: 'ColSpan' | 'RowSpan',\n) => {\n return (row[`${keyName}${spanType}`] as number | undefined) ?? undefined;\n};\n\nconst mergeSx = (...styles: Array<SxProps<Theme> | undefined | false>): SxProps<Theme> =>\n styles.reduce<Array<Exclude<SxProps<Theme>, readonly unknown[]>>>((acc, style) => {\n if (!style) {\n return acc;\n }\n\n return [...acc, ...(isArray(style) ? style : [style])];\n }, []) as SxProps<Theme>;\n\nconst treeGridContainerSx = {\n border: 0,\n borderRadius: 0,\n overflow: 'visible',\n} as const;\nconst defaultTableBorderColorByMode = {\n dark: 'rgba(241,245,249,.12)',\n light: '#e2e8f0',\n} as const;\n\ninterface StyledTableProps extends TableProps {\n canBodyFullHeight?: boolean;\n canUseTreeGridStyle?: boolean;\n containerProps?: TableContainerProps;\n footerSlot?: ReactNode;\n tableTheme?: OwpResolvedTableThemeConfigType;\n tableLayout?: 'auto' | 'fixed';\n treeGridTheme?: OwpResolvedGridThemeConfigType;\n title?: string;\n children: ReactNode;\n}\n\ntype StyledTableInnerProps = Pick<\n StyledTableProps,\n 'canBodyFullHeight' | 'canUseTreeGridStyle' | 'tableTheme' | 'treeGridTheme'\n>;\n\n/**\n * 총 row 수 표시 영역\n * @param borderColor 경계선 색상\n * @param totalCount 전체 row 수\n */\nexport function OwpTableTotalCount({\n borderColor,\n totalCount,\n}: {\n borderColor?: string;\n totalCount?: number;\n}) {\n return (\n <>\n <Divider sx={borderColor ? { borderColor } : undefined} />\n <Typography className=\"w-full py-8 pr-12\" align=\"right\">\n 전체: {isNumber(totalCount) ? totalCount.toLocaleString() : 0} 건\n </Typography>\n </>\n );\n}\n\n/**\n * StyledTable 스타일 컴포넌트\n * @param canBodyFullHeight body full height 사용 여부\n * @param canUseTreeGridStyle TreeGrid 스타일 사용 여부\n * @param children 하위 콘텐츠\n * @param containerProps containerProps props\n * @param footerSlot footer 영역\n * @param tableLayout tableLayout 값\n */\nexport const StyledTable = ({\n canBodyFullHeight,\n canUseTreeGridStyle,\n children,\n className,\n containerProps,\n footerSlot,\n tableTheme: tableThemeProp,\n tableLayout,\n ...tableProps\n}: StyledTableProps) => {\n const currentSettings = useGetCurrentSettings();\n const defaultTableBorderColor =\n currentSettings?.theme?.main?.palette?.mode === 'dark'\n ? defaultTableBorderColorByMode.dark\n : defaultTableBorderColorByMode.light;\n const treeGridTheme = useMemo(\n () => resolveOwpGridTheme(currentSettings?.theme?.main?.grid),\n [currentSettings],\n );\n const tableTheme = useMemo(\n () =>\n tableThemeProp ??\n resolveOwpTableTheme(currentSettings?.theme?.main?.table, {\n ...defaultStyledTableTheme,\n borderColor: defaultTableBorderColor,\n }),\n [currentSettings, defaultTableBorderColor, tableThemeProp],\n );\n\n return (\n <>\n {canUseTreeGridStyle && <GlobalStyles styles={getTreeGridFontFaceStyles()} />}\n <TableContainer\n component={Paper}\n variant=\"outlined\"\n {...containerProps}\n sx={mergeSx(\n !canUseTreeGridStyle && { borderColor: tableTheme.borderColor },\n canUseTreeGridStyle && treeGridContainerSx,\n canUseTreeGridStyle && getTreeGridContainerSx(treeGridTheme),\n canBodyFullHeight && { height: '100%' },\n containerProps?.sx,\n )}\n >\n <StyledTableInner\n {...tableProps}\n canBodyFullHeight={canBodyFullHeight}\n canUseTreeGridStyle={canUseTreeGridStyle}\n tableTheme={tableTheme}\n treeGridTheme={treeGridTheme}\n className={clsx(\n canBodyFullHeight && 'h-full',\n tableLayout === 'fixed' ? 'table-fixed' : tableLayout === 'auto' ? 'table-auto' : '',\n className,\n )}\n >\n {children}\n </StyledTableInner>\n {footerSlot}\n </TableContainer>\n </>\n );\n};\n\nconst StyledTableInner = styled(Table, {\n shouldForwardProp: (prop) =>\n prop !== 'canBodyFullHeight' &&\n prop !== 'canUseTreeGridStyle' &&\n prop !== 'tableTheme' &&\n prop !== 'treeGridTheme',\n})<StyledTableInnerProps>(\n ({ theme, canBodyFullHeight, canUseTreeGridStyle, tableTheme, treeGridTheme }) => {\n const resolvedTreeGridTheme = treeGridTheme ?? resolveOwpGridTheme();\n const resolvedTableTheme = tableTheme ?? defaultStyledTableTheme;\n\n return {\n ...(canBodyFullHeight && {\n height: '100%',\n }),\n ...(canBodyFullHeight && {\n '& .MuiTableBody-root': {\n height: '100%',\n },\n '& .MuiTableBody-root > .MuiTableRow-root': {\n height: '100%',\n },\n }),\n '& .MuiTableCell-root': canUseTreeGridStyle\n ? {\n ...getTreeGridCellBaseSx(resolvedTreeGridTheme),\n }\n : undefined,\n ...(!canUseTreeGridStyle && {\n '& .MuiTableRow-root > .MuiTableCell-root + .MuiTableCell-root': {\n borderLeft: `1px solid ${resolvedTableTheme.borderColor}`,\n },\n }),\n '& th': canUseTreeGridStyle\n ? {\n ...getTreeGridHeaderCellSx(resolvedTreeGridTheme),\n '&:first-of-type': {\n borderLeft: `1px solid ${TREEGRID_TABLE_HEADER_BORDER_COLOR}`,\n },\n }\n : {\n ...getDefaultTableHeaderCellSx(resolvedTableTheme, theme.palette.grey[200]),\n },\n '& td': canUseTreeGridStyle\n ? {\n ...getTreeGridBodyCellSx(resolvedTreeGridTheme),\n '&:first-of-type': {\n borderLeft: `1px solid ${TREEGRID_TABLE_BODY_BORDER_COLOR}`,\n },\n }\n : {\n ...getDefaultTableCellSx(resolvedTableTheme),\n },\n ...(canUseTreeGridStyle && {\n '& tbody > .MuiTableRow-root': getTreeGridBodyRowSx(resolvedTreeGridTheme),\n }),\n ...(canUseTreeGridStyle && {\n '& tbody > tr:first-of-type > th:first-of-type': {\n borderTopLeftRadius: 'inherit',\n },\n '& tbody > tr:first-of-type > td:last-of-type': {\n borderTopRightRadius: 'inherit',\n },\n }),\n };\n },\n);\n\nexport const StyledTableRow = styled(TableRow)`\n /* &:last-child th,\n &:last-child td {\n border-bottom: 0;\n } */\n`;\n\ninterface OwpTableProps<T> extends Omit<StyledTableProps, 'children'> {\n canTotalCountRow?: boolean;\n headers: OwpTableHeaderRow | OwpTableHeaderRow[];\n rows: T[];\n totalCount?: number;\n}\n\n/**\n * OwpTable 컴포넌트\n * @param canTotalCountRow 전체 row 수 표시 여부\n * @param headers headers 값\n * @param rows 행 데이터 목록\n * @param totalCount 전체 row 수\n */\nexport function OwpTable<T>({\n canTotalCountRow = false,\n headers,\n rows,\n totalCount,\n ...restTableProps\n}: OwpTableProps<T>) {\n const currentSettings = useGetCurrentSettings();\n const defaultTableBorderColor =\n currentSettings?.theme?.main?.palette?.mode === 'dark'\n ? defaultTableBorderColorByMode.dark\n : defaultTableBorderColorByMode.light;\n const tableTheme = useMemo(\n () =>\n restTableProps.tableTheme ??\n resolveOwpTableTheme(currentSettings?.theme?.main?.table, {\n ...defaultStyledTableTheme,\n borderColor: defaultTableBorderColor,\n }),\n [currentSettings, defaultTableBorderColor, restTableProps.tableTheme],\n );\n const resolvedHeaderRows = useMemo(\n () => (isArray(headers) ? headers : isEmpty(headers) ? [] : [headers]),\n [headers],\n );\n const commonKeyListData = useMemo(\n () => getTableColumnKeys(isArray(headers) ? headers[0] : headers),\n [headers],\n );\n const tableBackgroundColor = currentSettings?.theme?.main?.table?.row?.backgroundColor;\n\n return (\n <StyledTable\n {...restTableProps}\n containerProps={{\n ...restTableProps.containerProps,\n sx: mergeSx(\n !restTableProps.canUseTreeGridStyle &&\n tableBackgroundColor && { backgroundColor: tableBackgroundColor },\n restTableProps.containerProps?.sx,\n ),\n }}\n footerSlot={\n canTotalCountRow ? (\n <OwpTableTotalCount\n borderColor={tableTheme.borderColor}\n totalCount={typeof totalCount === 'undefined' ? rows.length : totalCount}\n />\n ) : undefined\n }\n className={clsx(restTableProps.tableLayout && 'w-full', restTableProps.className)}\n tableTheme={tableTheme}\n >\n <TableHead>\n {resolvedHeaderRows.map((headerData, index) => (\n <StyledTableRow key={`table-header-${index}`}>\n {getTableColumnKeys(headerData).map((keyName) => (\n <TableCell\n key={`table-header-${index}-${keyName}`}\n className=\"whitespace-pre-wrap\"\n sx={mergeSx(\n !restTableProps.canUseTreeGridStyle && getDefaultTableHeaderCellSx(tableTheme),\n getTableCellSx(headerData, keyName),\n )}\n colSpan={getTableCellSpan(headerData, keyName, 'ColSpan')}\n rowSpan={getTableCellSpan(headerData, keyName, 'RowSpan')}\n align=\"center\"\n >\n {headerData[keyName]}\n </TableCell>\n ))}\n </StyledTableRow>\n ))}\n </TableHead>\n <TableBody>\n {rows.map((row, index) => {\n const currentRow = row as OwpTableRowData;\n\n return (\n <StyledTableRow key={`table-row-${index}`}>\n {commonKeyListData.map((keyName) => (\n <TableCell\n key={`table-row-cell-${index}-${keyName}`}\n className=\"whitespace-pre-wrap h-64\"\n sx={getTableCellSx(currentRow, keyName)}\n align=\"center\"\n >\n {currentRow[keyName] as ReactNode}\n </TableCell>\n ))}\n </StyledTableRow>\n );\n })}\n </TableBody>\n </StyledTable>\n );\n}\n"],"names":["getTableColumnKeys","__name","row","keyName","getTableCellSx","getTableCellSpan","spanType","mergeSx","styles","acc","style","isArray","treeGridContainerSx","defaultTableBorderColorByMode","OwpTableTotalCount","borderColor","totalCount","jsxs","Fragment","jsx","Divider","Typography","isNumber","StyledTable","canBodyFullHeight","canUseTreeGridStyle","children","className","containerProps","footerSlot","tableThemeProp","tableLayout","tableProps","currentSettings","useGetCurrentSettings","defaultTableBorderColor","_c","_b","_a","treeGridTheme","useMemo","resolveOwpGridTheme","tableTheme","resolveOwpTableTheme","defaultStyledTableTheme","GlobalStyles","getTreeGridFontFaceStyles","TableContainer","Paper","getTreeGridContainerSx","StyledTableInner","clsx","styled","Table","prop","theme","resolvedTreeGridTheme","resolvedTableTheme","getTreeGridCellBaseSx","getTreeGridHeaderCellSx","TREEGRID_TABLE_HEADER_BORDER_COLOR","getDefaultTableHeaderCellSx","getTreeGridBodyCellSx","TREEGRID_TABLE_BODY_BORDER_COLOR","getDefaultTableCellSx","getTreeGridBodyRowSx","StyledTableRow","TableRow","OwpTable","canTotalCountRow","headers","rows","restTableProps","resolvedHeaderRows","isEmpty","commonKeyListData","tableBackgroundColor","_g","_f","_e","_d","_h","TableHead","headerData","index","TableCell","TableBody","currentRow"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAyCA,MAAMA,IAAqB,gBAAAC,EAAA,CAACC,MACrBA,IAIE,OAAO,KAAKA,CAAG,EAAE,OAAO,CAACC,MAAY,CAACA,EAAQ,SAAS,MAAM,CAAC,IAH5D,CAAA,GAFgB,uBAQrBC,IAAiB,gBAAAH,EAAA,CAACC,GAA8BC,MAC5CD,EAAI,GAAGC,CAAO,IAAI,KAAwB,CAAA,GAD7B,mBAIjBE,IAAmB,gBAAAJ,EAAA,CACvBC,GACAC,GACAG,MAEQJ,EAAI,GAAGC,CAAO,GAAGG,CAAQ,EAAE,KAA4B,QALxC,qBAQnBC,IAAU,gBAAAN,EAAA,IAAIO,MAClBA,EAAO,OAA2D,CAACC,GAAKC,MACjEA,IAIE,CAAC,GAAGD,GAAK,GAAIE,EAAQD,CAAK,IAAIA,IAAQ,CAACA,CAAK,CAAE,IAH5CD,GAIR,EAAE,GAPS,YASVG,KAAsB;AAAA,EAC1B,QAAQ;AAAA,EACR,cAAc;AAAA,EACd,UAAU;AACZ,GACMC,IAAgC;AAAA,EACpC,MAAM;AAAA,EACN,OAAO;AACT;AAwBO,SAASC,GAAmB;AAAA,EACjC,aAAAC;AAAA,EACA,YAAAC;AACF,GAGG;AACD,SACE,gBAAAC,EAAAC,GAAA,EACE,UAAA;AAAA,IAAA,gBAAAC,EAACC,KAAQ,IAAIL,IAAc,EAAE,aAAAA,EAAA,IAAgB,QAAW;AAAA,IACxD,gBAAAE,EAACI,GAAA,EAAW,WAAU,qBAAoB,OAAM,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,gBAAAvB,EAAC+D,GAAA,EACE,UAAAT,EAAmB,IAAI,CAACU,GAAYC,MACnC,gBAAAjE,EAAC+C,GAAA,EACE,UAAAlE,EAAmBmF,CAAU,EAAE,IAAI,CAAChF,MACnC,gBAAAgB;AAAA,UAACkE;AAAA,UAAA;AAAA,YAEC,WAAU;AAAA,YACV,IAAI9E;AAAA,cACF,CAACiE,EAAe,uBAAuBX,EAA4BnB,CAAU;AAAA,cAC7EtC,EAAe+E,GAAYhF,CAAO;AAAA,YAAA;AAAA,YAEpC,SAASE,EAAiB8E,GAAYhF,GAAS,SAAS;AAAA,YACxD,SAASE,EAAiB8E,GAAYhF,GAAS,SAAS;AAAA,YACxD,OAAM;AAAA,YAEL,YAAWA,CAAO;AAAA,UAAA;AAAA,UAVd,gBAAgBiF,CAAK,IAAIjF,CAAO;AAAA,QAAA,CAYxC,EAAA,GAfkB,gBAAgBiF,CAAK,EAgB1C,CACD,EAAA,CACH;AAAA,0BACCE,GAAA,EACE,UAAAf,EAAK,IAAI,CAACrE,GAAKkF,MAAU;AACxB,gBAAMG,IAAarF;AAEnB,iBACE,gBAAAiB,EAAC+C,GAAA,EACE,UAAAS,EAAkB,IAAI,CAACxE,MACtB,gBAAAgB;AAAA,YAACkE;AAAA,YAAA;AAAA,cAEC,WAAU;AAAA,cACV,IAAIjF,EAAemF,GAAYpF,CAAO;AAAA,cACtC,OAAM;AAAA,cAEL,YAAWA,CAAO;AAAA,YAAA;AAAA,YALd,kBAAkBiF,CAAK,IAAIjF,CAAO;AAAA,UAAA,CAO1C,KAVkB,aAAaiF,CAAK,EAWvC;AAAA,QAEJ,CAAC,EAAA,CACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;AAhGgBnF,EAAAmE,IAAA;"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
var u = Object.defineProperty;
|
|
2
|
+
var i = (r, t) => u(r, "name", { value: t, configurable: !0 });
|
|
3
|
+
import { jsx as a } from "../../../node_modules/.pnpm/@emotion_react@11.14.0_@types_react@19.2.14_react@19.2.4/node_modules/@emotion/react/jsx-runtime/dist/emotion-react-jsx-runtime.browser.esm.js";
|
|
4
|
+
import { getDisplayValue as n } from "../../../utils/getDisplayValue.js";
|
|
5
|
+
import { Typography as c } from "@mui/material";
|
|
6
|
+
const m = {
|
|
7
|
+
display: "block",
|
|
8
|
+
px: 1.25,
|
|
9
|
+
py: 0.625,
|
|
10
|
+
color: "inherit"
|
|
11
|
+
}, s = /* @__PURE__ */ i((r) => {
|
|
12
|
+
const t = Array.isArray(r) ? r : r ? [r] : [];
|
|
13
|
+
return [m, ...t];
|
|
14
|
+
}, "getMergedValueSx"), l = /* @__PURE__ */ i(({
|
|
15
|
+
children: r,
|
|
16
|
+
className: t,
|
|
17
|
+
sx: e
|
|
18
|
+
}) => /* @__PURE__ */ a(c, { variant: "body1", className: t, sx: s(e), children: r }), "FieldTableValueTypography"), p = /* @__PURE__ */ i((r) => r == null || r === "" ? n() : String(r), "getTextDisplayValue"), y = /* @__PURE__ */ i((r, t) => {
|
|
19
|
+
if (r === "" || r == null)
|
|
20
|
+
return n();
|
|
21
|
+
const e = Number(r);
|
|
22
|
+
if (!Number.isFinite(e))
|
|
23
|
+
return n();
|
|
24
|
+
if (t == null)
|
|
25
|
+
return n(e.toLocaleString());
|
|
26
|
+
const o = Math.max(0, Math.trunc(t));
|
|
27
|
+
return n(
|
|
28
|
+
e.toLocaleString(void 0, {
|
|
29
|
+
minimumFractionDigits: 0,
|
|
30
|
+
maximumFractionDigits: o
|
|
31
|
+
})
|
|
32
|
+
);
|
|
33
|
+
}, "getNumberDisplayValue"), V = /* @__PURE__ */ i(({ value: r, className: t, sx: e }) => /* @__PURE__ */ a(l, { className: t, sx: e, children: p(r) }), "FieldTableTextValue"), h = /* @__PURE__ */ i(({
|
|
34
|
+
value: r,
|
|
35
|
+
valueDecimals: t,
|
|
36
|
+
className: e,
|
|
37
|
+
sx: o
|
|
38
|
+
}) => /* @__PURE__ */ a(l, { className: e, sx: o, children: y(r, t) }), "FieldTableNumberValue");
|
|
39
|
+
export {
|
|
40
|
+
h as FieldTableNumberValue,
|
|
41
|
+
V as FieldTableTextValue
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=FieldTableValue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FieldTableValue.js","sources":["../../../../src/components/OwpTable/internal/FieldTableValue.tsx"],"sourcesContent":["import { getDisplayValue } from '@/utils';\nimport { Typography, type SxProps, type Theme } from '@mui/material';\nimport type { ReactNode } from 'react';\n\nconst valueSx = {\n display: 'block',\n px: 1.25,\n py: 0.625,\n color: 'inherit',\n} as const;\n\nconst getMergedValueSx = (sx?: SxProps<Theme>): SxProps<Theme> => {\n const sxArray = Array.isArray(sx) ? sx : sx ? [sx] : [];\n\n return [valueSx, ...sxArray] as SxProps<Theme>;\n};\n\ninterface FieldTableValueTypographyProps {\n children: ReactNode;\n className?: string;\n sx?: SxProps<Theme>;\n}\n\n/** 필드 테이블 값 타이포그래피 */\nconst FieldTableValueTypography = ({\n children,\n className,\n sx,\n}: FieldTableValueTypographyProps) => (\n <Typography variant=\"body1\" className={className} sx={getMergedValueSx(sx)}>\n {children}\n </Typography>\n);\n\nconst getTextDisplayValue = (value?: string | number | null) =>\n value == null || value === '' ? getDisplayValue() : String(value);\n\nconst getNumberDisplayValue = (\n value?: string | number | null,\n valueDecimals?: number,\n): string => {\n if (value === '' || value == null) {\n return getDisplayValue();\n }\n\n const numberValue = Number(value);\n\n if (!Number.isFinite(numberValue)) {\n return getDisplayValue();\n }\n\n if (valueDecimals == null) {\n return getDisplayValue(numberValue.toLocaleString());\n }\n\n const maximumFractionDigits = Math.max(0, Math.trunc(valueDecimals));\n\n return getDisplayValue(\n numberValue.toLocaleString(undefined, {\n minimumFractionDigits: 0,\n maximumFractionDigits,\n }),\n );\n};\n\ninterface FieldTableTextValueProps {\n value?: string | number | null;\n className?: string;\n sx?: SxProps<Theme>;\n}\n\n/** 필드 테이블 문자 값 표시 */\nexport const FieldTableTextValue = ({ value, className, sx }: FieldTableTextValueProps) => (\n <FieldTableValueTypography className={className} sx={sx}>\n {getTextDisplayValue(value)}\n </FieldTableValueTypography>\n);\n\ninterface FieldTableNumberValueProps {\n value?: string | number | null;\n valueDecimals?: number;\n className?: string;\n sx?: SxProps<Theme>;\n}\n\n/** 필드 테이블 숫자 값 표시 */\nexport const FieldTableNumberValue = ({\n value,\n valueDecimals,\n className,\n sx,\n}: FieldTableNumberValueProps) => (\n <FieldTableValueTypography className={className} sx={sx}>\n {getNumberDisplayValue(value, valueDecimals)}\n </FieldTableValueTypography>\n);\n"],"names":["valueSx","getMergedValueSx","__name","sx","sxArray","FieldTableValueTypography","children","className","jsx","Typography","getTextDisplayValue","value","getDisplayValue","getNumberDisplayValue","valueDecimals","numberValue","maximumFractionDigits","FieldTableTextValue","FieldTableNumberValue"],"mappings":";;;;;AAIA,MAAMA,IAAU;AAAA,EACd,SAAS;AAAA,EACT,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,OAAO;AACT,GAEMC,IAAmB,gBAAAC,EAAA,CAACC,MAAwC;AAChE,QAAMC,IAAU,MAAM,QAAQD,CAAE,IAAIA,IAAKA,IAAK,CAACA,CAAE,IAAI,CAAA;AAErD,SAAO,CAACH,GAAS,GAAGI,CAAO;AAC7B,GAJyB,qBAanBC,IAA4B,gBAAAH,EAAA,CAAC;AAAA,EACjC,UAAAI;AAAA,EACA,WAAAC;AAAA,EACA,IAAAJ;AACF,MACE,gBAAAK,EAACC,KAAW,SAAQ,SAAQ,WAAAF,GAAsB,IAAIN,EAAiBE,CAAE,GACtE,UAAAG,EAAA,CACH,GAPgC,8BAU5BI,IAAsB,gBAAAR,EAAA,CAACS,MAC3BA,KAAS,QAAQA,MAAU,KAAKC,EAAA,IAAoB,OAAOD,CAAK,GADtC,wBAGtBE,IAAwB,gBAAAX,EAAA,CAC5BS,GACAG,MACW;AACX,MAAIH,MAAU,MAAMA,KAAS;AAC3B,WAAOC,EAAA;AAGT,QAAMG,IAAc,OAAOJ,CAAK;AAEhC,MAAI,CAAC,OAAO,SAASI,CAAW;AAC9B,WAAOH,EAAA;AAGT,MAAIE,KAAiB;AACnB,WAAOF,EAAgBG,EAAY,gBAAgB;AAGrD,QAAMC,IAAwB,KAAK,IAAI,GAAG,KAAK,MAAMF,CAAa,CAAC;AAEnE,SAAOF;AAAA,IACLG,EAAY,eAAe,QAAW;AAAA,MACpC,uBAAuB;AAAA,MACvB,uBAAAC;AAAA,IAAA,CACD;AAAA,EAAA;AAEL,GA1B8B,0BAmCjBC,IAAsB,gBAAAf,EAAA,CAAC,EAAE,OAAAS,GAAO,WAAAJ,GAAW,IAAAJ,EAAA,MACtD,gBAAAK,EAACH,GAAA,EAA0B,WAAAE,GAAsB,IAAAJ,GAC9C,UAAAO,EAAoBC,CAAK,EAAA,CAC5B,GAHiC,wBActBO,IAAwB,gBAAAhB,EAAA,CAAC;AAAA,EACpC,OAAAS;AAAA,EACA,eAAAG;AAAA,EACA,WAAAP;AAAA,EACA,IAAAJ;AACF,wBACGE,GAAA,EAA0B,WAAAE,GAAsB,IAAAJ,GAC9C,UAAAU,EAAsBF,GAAOG,CAAa,EAAA,CAC7C,GARmC;"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
var l = Object.defineProperty;
|
|
2
|
-
var
|
|
2
|
+
var r = (o, e) => l(o, "name", { value: e, configurable: !0 });
|
|
3
3
|
import { grey as n } from "@mui/material/colors";
|
|
4
4
|
const a = "7px 10px", d = {
|
|
5
|
+
borderColor: "#e2e8f0",
|
|
5
6
|
header: {
|
|
6
7
|
backgroundColor: "",
|
|
7
8
|
color: "inherit",
|
|
@@ -12,27 +13,29 @@ const a = "7px 10px", d = {
|
|
|
12
13
|
backgroundColor: "",
|
|
13
14
|
fontSize: "1.7rem"
|
|
14
15
|
}
|
|
15
|
-
}, t = /* @__PURE__ */
|
|
16
|
+
}, t = /* @__PURE__ */ r(() => ({
|
|
16
17
|
padding: a,
|
|
17
18
|
borderLeft: "none",
|
|
18
19
|
borderRight: "none"
|
|
19
|
-
}), "getDefaultTableCellBaseSx"), f = /* @__PURE__ */
|
|
20
|
+
}), "getDefaultTableCellBaseSx"), f = /* @__PURE__ */ r((o) => ({
|
|
20
21
|
...t(),
|
|
22
|
+
borderBottomColor: o.borderColor,
|
|
21
23
|
...o.cell.backgroundColor && {
|
|
22
24
|
backgroundColor: o.cell.backgroundColor
|
|
23
25
|
},
|
|
24
26
|
fontSize: o.cell.fontSize
|
|
25
|
-
}), "getDefaultTableCellSx"),
|
|
27
|
+
}), "getDefaultTableCellSx"), b = /* @__PURE__ */ r((o, e = n[200]) => ({
|
|
26
28
|
...t(),
|
|
27
|
-
backgroundColor: o.header.backgroundColor ||
|
|
29
|
+
backgroundColor: o.header.backgroundColor || e,
|
|
30
|
+
borderBottomColor: o.borderColor,
|
|
28
31
|
color: o.header.color,
|
|
29
32
|
fontSize: o.header.fontSize,
|
|
30
33
|
fontWeight: o.header.fontWeight
|
|
31
|
-
}), "getDefaultTableHeaderCellSx"),
|
|
34
|
+
}), "getDefaultTableHeaderCellSx"), g = /* @__PURE__ */ r((o) => ({
|
|
32
35
|
color: o.header.color,
|
|
33
36
|
fontSize: o.header.fontSize,
|
|
34
37
|
fontWeight: o.header.fontWeight
|
|
35
|
-
}), "getDefaultTableHeaderLabelSx"),
|
|
38
|
+
}), "getDefaultTableHeaderLabelSx"), u = {
|
|
36
39
|
"&.MuiTableSortLabel-root": {
|
|
37
40
|
color: "inherit"
|
|
38
41
|
},
|
|
@@ -48,9 +51,9 @@ const a = "7px 10px", d = {
|
|
|
48
51
|
};
|
|
49
52
|
export {
|
|
50
53
|
d as defaultStyledTableTheme,
|
|
51
|
-
|
|
54
|
+
u as defaultTableSortLabelSx,
|
|
52
55
|
f as getDefaultTableCellSx,
|
|
53
|
-
|
|
54
|
-
|
|
56
|
+
b as getDefaultTableHeaderCellSx,
|
|
57
|
+
g as getDefaultTableHeaderLabelSx
|
|
55
58
|
};
|
|
56
59
|
//# sourceMappingURL=defaultTableStyle.js.map
|