@owp/core 2.1.7 → 2.2.0
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/components/OwpTable/OwpTable.js +21 -21
- package/dist/components/OwpTable/OwpTable.js.map +1 -1
- package/dist/components/OwpTreeGrid/OwpTreeGrid.js +193 -136
- package/dist/components/OwpTreeGrid/OwpTreeGrid.js.map +1 -1
- package/dist/components/OwpTreeGrid/OwpTreeGridLoadingOverlay.js +28 -0
- package/dist/components/OwpTreeGrid/OwpTreeGridLoadingOverlay.js.map +1 -0
- package/dist/components/OwpTreeGrid/OwpTreeGridNoDataOverlay.js +45 -0
- package/dist/components/OwpTreeGrid/OwpTreeGridNoDataOverlay.js.map +1 -0
- package/dist/components/OwpTreeGrid/hooks/useOwpTreeGridOverlayFrame.js +84 -0
- package/dist/components/OwpTreeGrid/hooks/useOwpTreeGridOverlayFrame.js.map +1 -0
- package/dist/components/OwpTreeGrid/{utils.js → utils/index.js} +2 -2
- package/dist/components/OwpTreeGrid/utils/index.js.map +1 -0
- package/dist/contexts/OwpAppProvider.js.map +1 -1
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/CODE128/constants.js +1 -1
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/EAN_UPC/constants.js +1 -1
- package/dist/node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/utils.js +1 -1
- package/dist/node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/utils.js +1 -1
- package/dist/owp-app.css +1 -1
- package/dist/types/components/OwpTreeGrid/OwpTreeGrid.d.ts +2 -7
- package/dist/types/components/OwpTreeGrid/OwpTreeGridLoadingOverlay.d.ts +10 -0
- package/dist/types/components/OwpTreeGrid/OwpTreeGridNoDataOverlay.d.ts +14 -0
- package/dist/types/components/OwpTreeGrid/hooks/useOwpTreeGridOverlayFrame.d.ts +22 -0
- package/dist/types/components/OwpTreeGrid/{utils.d.ts → utils/index.d.ts} +1 -1
- package/dist/types/contexts/OwpAppProvider.d.ts +1 -0
- package/dist/utils/rebuildValue.js +41 -39
- package/dist/utils/rebuildValue.js.map +1 -1
- package/dist/utils/treeGridUtil.js +1 -1
- package/package.json +1 -1
- package/dist/components/OwpTreeGrid/utils.js.map +0 -1
|
@@ -26,7 +26,7 @@ const g = /* @__PURE__ */ l((t) => t ? Object.keys(t).filter((o) => !o.includes(
|
|
|
26
26
|
fontWeight: "normal",
|
|
27
27
|
src: "url('/assets/vendors/Grid/Styles/Roboto-Light.ttf') format('truetype')"
|
|
28
28
|
}
|
|
29
|
-
},
|
|
29
|
+
}, S = {
|
|
30
30
|
fontFamily: "RobotoLight, sans-serif",
|
|
31
31
|
fontSize: "14px",
|
|
32
32
|
fontWeight: "normal",
|
|
@@ -100,7 +100,7 @@ const I = /* @__PURE__ */ l(({
|
|
|
100
100
|
},
|
|
101
101
|
"& .MuiTableCell-root": r ? {
|
|
102
102
|
boxSizing: "border-box",
|
|
103
|
-
...
|
|
103
|
+
...S,
|
|
104
104
|
overflow: "hidden",
|
|
105
105
|
textOverflow: "ellipsis",
|
|
106
106
|
verticalAlign: "middle",
|
|
@@ -110,15 +110,15 @@ const I = /* @__PURE__ */ l(({
|
|
|
110
110
|
padding: "7px 10px",
|
|
111
111
|
borderLeft: `1px solid ${t.palette.divider}`,
|
|
112
112
|
borderRight: `1px solid ${t.palette.divider}`,
|
|
113
|
-
"&:first-
|
|
113
|
+
"&:first-child": {
|
|
114
114
|
borderLeft: "none"
|
|
115
115
|
},
|
|
116
|
-
"&:last-
|
|
116
|
+
"&:last-child": {
|
|
117
117
|
borderRight: "none"
|
|
118
118
|
}
|
|
119
119
|
},
|
|
120
120
|
"& th": r ? {
|
|
121
|
-
...
|
|
121
|
+
...S,
|
|
122
122
|
backgroundColor: "#586980",
|
|
123
123
|
borderTop: "1px solid #6F7F94",
|
|
124
124
|
borderBottom: "1px solid #6F7F94",
|
|
@@ -153,7 +153,7 @@ const I = /* @__PURE__ */ l(({
|
|
|
153
153
|
borderTopRightRadius: "inherit"
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
|
-
})),
|
|
156
|
+
})), y = T(z)`
|
|
157
157
|
/* &:last-child th,
|
|
158
158
|
&:last-child td {
|
|
159
159
|
border-bottom: 0;
|
|
@@ -180,30 +180,30 @@ function lo({
|
|
|
180
180
|
footerSlot: t ? /* @__PURE__ */ e(G, { totalCount: typeof a > "u" ? r.length : a }) : void 0,
|
|
181
181
|
className: v(n.tableLayout && "w-full", n.className),
|
|
182
182
|
children: [
|
|
183
|
-
/* @__PURE__ */ e(j, { children: b.map((i,
|
|
183
|
+
/* @__PURE__ */ e(j, { children: b.map((i, p) => /* @__PURE__ */ e(y, { children: g(i).map((d) => /* @__PURE__ */ e(
|
|
184
184
|
h,
|
|
185
185
|
{
|
|
186
186
|
className: "whitespace-pre-wrap",
|
|
187
|
-
sx: u(i,
|
|
188
|
-
colSpan: w(i,
|
|
189
|
-
rowSpan: w(i,
|
|
187
|
+
sx: u(i, d),
|
|
188
|
+
colSpan: w(i, d, "ColSpan"),
|
|
189
|
+
rowSpan: w(i, d, "RowSpan"),
|
|
190
190
|
align: "center",
|
|
191
|
-
children: i[
|
|
191
|
+
children: i[d]
|
|
192
192
|
},
|
|
193
|
-
`table-header-${
|
|
194
|
-
)) }, `table-header-${
|
|
195
|
-
/* @__PURE__ */ e(E, { children: r.map((i,
|
|
196
|
-
const
|
|
197
|
-
return /* @__PURE__ */ e(
|
|
193
|
+
`table-header-${p}-${d}`
|
|
194
|
+
)) }, `table-header-${p}`)) }),
|
|
195
|
+
/* @__PURE__ */ e(E, { children: r.map((i, p) => {
|
|
196
|
+
const d = i;
|
|
197
|
+
return /* @__PURE__ */ e(y, { children: s.map((m) => /* @__PURE__ */ e(
|
|
198
198
|
h,
|
|
199
199
|
{
|
|
200
200
|
className: "whitespace-pre-wrap h-64",
|
|
201
|
-
sx: u(
|
|
201
|
+
sx: u(d, m),
|
|
202
202
|
align: "center",
|
|
203
|
-
children:
|
|
203
|
+
children: d[m]
|
|
204
204
|
},
|
|
205
|
-
`table-row-cell-${
|
|
206
|
-
)) }, `table-row-${
|
|
205
|
+
`table-row-cell-${p}-${m}`
|
|
206
|
+
)) }, `table-row-${p}`);
|
|
207
207
|
}) })
|
|
208
208
|
]
|
|
209
209
|
}
|
|
@@ -214,6 +214,6 @@ export {
|
|
|
214
214
|
lo as OwpTable,
|
|
215
215
|
G as OwpTableTotalCount,
|
|
216
216
|
I as StyledTable,
|
|
217
|
-
|
|
217
|
+
y as StyledTableRow
|
|
218
218
|
};
|
|
219
219
|
//# sourceMappingURL=OwpTable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OwpTable.js","sources":["../../../src/components/OwpTable/OwpTable.tsx"],"sourcesContent":["import { 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';\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\nconst treeGridFontFaceStyles = {\n '@font-face': {\n fontFamily: 'RobotoLight',\n fontStyle: 'normal',\n fontWeight: 'normal',\n src: \"url('/assets/vendors/Grid/Styles/Roboto-Light.ttf') format('truetype')\",\n },\n} as const;\n\nconst treeGridFontSx = {\n fontFamily: 'RobotoLight, sans-serif',\n fontSize: '14px',\n fontWeight: 'normal',\n lineHeight: '16px',\n} as const;\n\ninterface StyledTableProps extends TableProps {\n canBodyFullHeight?: boolean;\n canUseTreeGridStyle?: boolean;\n containerProps?: TableContainerProps;\n footerSlot?: ReactNode;\n tableLayout?: 'auto' | 'fixed';\n title?: string;\n children: ReactNode;\n}\n\ntype StyledTableInnerProps = Pick<StyledTableProps, 'canBodyFullHeight' | 'canUseTreeGridStyle'>;\n\n/**\n * 총 row 수 표시 영역\n * @param totalCount 전체 row 수\n */\nexport function OwpTableTotalCount({ totalCount }: { totalCount?: number }) {\n return (\n <>\n <Divider />\n <Typography className=\"h-[30px] w-full pr-12 my-8\" 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 tableLayout,\n ...tableProps\n}: StyledTableProps) => {\n return (\n <>\n {canUseTreeGridStyle && <GlobalStyles styles={treeGridFontFaceStyles} />}\n <TableContainer\n component={Paper}\n variant=\"outlined\"\n {...containerProps}\n sx={mergeSx(\n canUseTreeGridStyle && treeGridContainerSx,\n canBodyFullHeight && { height: '100%' },\n containerProps?.sx,\n )}\n >\n <StyledTableInner\n {...tableProps}\n canBodyFullHeight={canBodyFullHeight}\n canUseTreeGridStyle={canUseTreeGridStyle}\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) => prop !== 'canBodyFullHeight' && prop !== 'canUseTreeGridStyle',\n})<StyledTableInnerProps>(({ theme, canBodyFullHeight, canUseTreeGridStyle }) => ({\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 boxSizing: 'border-box',\n ...treeGridFontSx,\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n verticalAlign: 'middle',\n whiteSpace: 'nowrap',\n }\n : {\n fontSize: '1.7rem',\n padding: '7px 10px',\n borderLeft: `1px solid ${theme.palette.divider}`,\n borderRight: `1px solid ${theme.palette.divider}`,\n '&:first-of-type': {\n borderLeft: 'none',\n },\n '&:last-of-type': {\n borderRight: 'none',\n },\n },\n '& th': canUseTreeGridStyle\n ? {\n ...treeGridFontSx,\n backgroundColor: '#586980',\n borderTop: '1px solid #6F7F94',\n borderBottom: '1px solid #6F7F94',\n borderLeft: 0,\n borderRight: '1px solid #6F7F94',\n color: 'white',\n height: 33,\n minHeight: 33,\n padding: '7px 2px 6px 10px',\n '&:first-of-type': {\n borderLeft: '1px solid #6F7F94',\n },\n }\n : {\n backgroundColor: theme.palette.grey[200],\n fontWeight: 600,\n },\n '& td': canUseTreeGridStyle\n ? {\n borderBottom: '1px solid #CDD8E4',\n borderLeft: 0,\n borderRight: '1px solid #CDD8E4',\n color: '#111112',\n padding: '7px 10px 6px',\n '&:first-of-type': {\n borderLeft: '1px solid #CDD8E4',\n },\n }\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\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 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\n return (\n <StyledTable\n {...restTableProps}\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 >\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={getTableCellSx(headerData, keyName)}\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","treeGridFontFaceStyles","treeGridFontSx","OwpTableTotalCount","totalCount","jsxs","Fragment","jsx","Divider","Typography","isNumber","StyledTable","canBodyFullHeight","canUseTreeGridStyle","children","className","containerProps","footerSlot","tableLayout","tableProps","GlobalStyles","TableContainer","Paper","StyledTableInner","clsx","styled","Table","prop","theme","StyledTableRow","TableRow","OwpTable","canTotalCountRow","headers","rows","restTableProps","resolvedHeaderRows","useMemo","isEmpty","commonKeyListData","TableHead","headerData","index","TableCell","TableBody","currentRow"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,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,I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ACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;AAlEgBrD,EAAA0C,IAAA;"}
|
|
1
|
+
{"version":3,"file":"OwpTable.js","sources":["../../../src/components/OwpTable/OwpTable.tsx"],"sourcesContent":["import { 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';\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\nconst treeGridFontFaceStyles = {\n '@font-face': {\n fontFamily: 'RobotoLight',\n fontStyle: 'normal',\n fontWeight: 'normal',\n src: \"url('/assets/vendors/Grid/Styles/Roboto-Light.ttf') format('truetype')\",\n },\n} as const;\n\nconst treeGridFontSx = {\n fontFamily: 'RobotoLight, sans-serif',\n fontSize: '14px',\n fontWeight: 'normal',\n lineHeight: '16px',\n} as const;\n\ninterface StyledTableProps extends TableProps {\n canBodyFullHeight?: boolean;\n canUseTreeGridStyle?: boolean;\n containerProps?: TableContainerProps;\n footerSlot?: ReactNode;\n tableLayout?: 'auto' | 'fixed';\n title?: string;\n children: ReactNode;\n}\n\ntype StyledTableInnerProps = Pick<StyledTableProps, 'canBodyFullHeight' | 'canUseTreeGridStyle'>;\n\n/**\n * 총 row 수 표시 영역\n * @param totalCount 전체 row 수\n */\nexport function OwpTableTotalCount({ totalCount }: { totalCount?: number }) {\n return (\n <>\n <Divider />\n <Typography className=\"h-[30px] w-full pr-12 my-8\" 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 tableLayout,\n ...tableProps\n}: StyledTableProps) => {\n return (\n <>\n {canUseTreeGridStyle && <GlobalStyles styles={treeGridFontFaceStyles} />}\n <TableContainer\n component={Paper}\n variant=\"outlined\"\n {...containerProps}\n sx={mergeSx(\n canUseTreeGridStyle && treeGridContainerSx,\n canBodyFullHeight && { height: '100%' },\n containerProps?.sx,\n )}\n >\n <StyledTableInner\n {...tableProps}\n canBodyFullHeight={canBodyFullHeight}\n canUseTreeGridStyle={canUseTreeGridStyle}\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) => prop !== 'canBodyFullHeight' && prop !== 'canUseTreeGridStyle',\n})<StyledTableInnerProps>(({ theme, canBodyFullHeight, canUseTreeGridStyle }) => ({\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 boxSizing: 'border-box',\n ...treeGridFontSx,\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n verticalAlign: 'middle',\n whiteSpace: 'nowrap',\n }\n : {\n fontSize: '1.7rem',\n padding: '7px 10px',\n borderLeft: `1px solid ${theme.palette.divider}`,\n borderRight: `1px solid ${theme.palette.divider}`,\n '&:first-child': {\n borderLeft: 'none',\n },\n '&:last-child': {\n borderRight: 'none',\n },\n },\n '& th': canUseTreeGridStyle\n ? {\n ...treeGridFontSx,\n backgroundColor: '#586980',\n borderTop: '1px solid #6F7F94',\n borderBottom: '1px solid #6F7F94',\n borderLeft: 0,\n borderRight: '1px solid #6F7F94',\n color: 'white',\n height: 33,\n minHeight: 33,\n padding: '7px 2px 6px 10px',\n '&:first-of-type': {\n borderLeft: '1px solid #6F7F94',\n },\n }\n : {\n backgroundColor: theme.palette.grey[200],\n fontWeight: 600,\n },\n '& td': canUseTreeGridStyle\n ? {\n borderBottom: '1px solid #CDD8E4',\n borderLeft: 0,\n borderRight: '1px solid #CDD8E4',\n color: '#111112',\n padding: '7px 10px 6px',\n '&:first-of-type': {\n borderLeft: '1px solid #CDD8E4',\n },\n }\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\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 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\n return (\n <StyledTable\n {...restTableProps}\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 >\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={getTableCellSx(headerData, keyName)}\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","treeGridFontFaceStyles","treeGridFontSx","OwpTableTotalCount","totalCount","jsxs","Fragment","jsx","Divider","Typography","isNumber","StyledTable","canBodyFullHeight","canUseTreeGridStyle","children","className","containerProps","footerSlot","tableLayout","tableProps","GlobalStyles","TableContainer","Paper","StyledTableInner","clsx","styled","Table","prop","theme","StyledTableRow","TableRow","OwpTable","canTotalCountRow","headers","rows","restTableProps","resolvedHeaderRows","useMemo","isEmpty","commonKeyListData","TableHead","headerData","index","TableCell","TableBody","currentRow"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,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,IAAsB;AAAA,EAC1B,QAAQ;AAAA,EACR,cAAc;AAAA,EACd,UAAU;AACZ,GAEMC,IAAyB;AAAA,EAC7B,cAAc;AAA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UAAAzC,EAAmBqD,CAAU,EAAE,IAAI,CAAClD,MACnC,gBAAAgB;AAAA,UAACoC;AAAA,UAAA;AAAA,YAEC,WAAU;AAAA,YACV,IAAInD,EAAeiD,GAAYlD,CAAO;AAAA,YACtC,SAASE,EAAiBgD,GAAYlD,GAAS,SAAS;AAAA,YACxD,SAASE,EAAiBgD,GAAYlD,GAAS,SAAS;AAAA,YACxD,OAAM;AAAA,YAEL,YAAWA,CAAO;AAAA,UAAA;AAAA,UAPd,gBAAgBmD,CAAK,IAAInD,CAAO;AAAA,QAAA,CASxC,EAAA,GAZkB,gBAAgBmD,CAAK,EAa1C,CACD,EAAA,CACH;AAAA,0BACCE,GAAA,EACE,UAAAV,EAAK,IAAI,CAAC5C,GAAKoD,MAAU;AACxB,gBAAMG,IAAavD;AAEnB,iBACE,gBAAAiB,EAACsB,GAAA,EACE,UAAAU,EAAkB,IAAI,CAAChD,MACtB,gBAAAgB;AAAA,YAACoC;AAAA,YAAA;AAAA,cAEC,WAAU;AAAA,cACV,IAAInD,EAAeqD,GAAYtD,CAAO;AAAA,cACtC,OAAM;AAAA,cAEL,YAAWA,CAAO;AAAA,YAAA;AAAA,YALd,kBAAkBmD,CAAK,IAAInD,CAAO;AAAA,UAAA,CAO1C,KAVkB,aAAamD,CAAK,EAWvC;AAAA,QAEJ,CAAC,EAAA,CACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;AAlEgBrD,EAAA0C,IAAA;"}
|
|
@@ -1,186 +1,243 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
import { jsx as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
1
|
+
var pe = Object.defineProperty;
|
|
2
|
+
var o = (e, n) => pe(e, "name", { value: n, configurable: !0 });
|
|
3
|
+
import { jsxs as me, jsx as W } 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 { useOwpTranslation as Te } from "../../hooks/useOwpTranslation.js";
|
|
5
|
+
import { useGetCurrentLanguage as ve } from "../../hooks/useCurrentLanguage.js";
|
|
6
|
+
import { useRef as i, useState as ie, useEffect as X, useLayoutEffect as Ge } from "react";
|
|
7
|
+
import { useOwpTreeGridOverlayFrame as ye } from "./hooks/useOwpTreeGridOverlayFrame.js";
|
|
8
|
+
import { OwpTreeGridLoadingOverlay as De } from "./OwpTreeGridLoadingOverlay.js";
|
|
9
|
+
import { OwpTreeGridNoDataOverlay as we } from "./OwpTreeGridNoDataOverlay.js";
|
|
10
|
+
import { applyTreeGridLayoutToGrid as ue } from "./utils/index.js";
|
|
11
|
+
import { isEmpty as B } from "../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/compat/predicate/isEmpty.js";
|
|
12
|
+
import { delay as Ee } from "../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/compat/function/delay.js";
|
|
13
|
+
import { isEqual as Re } from "../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/predicate/isEqual.js";
|
|
14
|
+
import { omit as Oe } from "../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/compat/object/omit.js";
|
|
15
|
+
import { debounce as $ } from "../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/compat/function/debounce.js";
|
|
16
|
+
import { get as ge } from "../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/compat/object/get.js";
|
|
17
|
+
const Be = 300, se = {
|
|
14
18
|
en: "/assets/vendors/Grid/TextEN.xml",
|
|
15
19
|
kr: "/assets/vendors/Grid/TextKR.xml"
|
|
16
|
-
},
|
|
20
|
+
}, ce = /* @__PURE__ */ o((e) => `${e}?noCache=${Date.now()}`, "appendNoCacheQuery"), be = /* @__PURE__ */ o((e) => e === "kr" ? se.kr : se.en, "getTreeGridTextResourceUrl"), Se = /* @__PURE__ */ o((e) => e != null && e.includes("assets") ? ce(e) : (
|
|
17
21
|
// @ts-expect-error - API base URL env is provided by host app
|
|
18
22
|
`undefined/${e}?noCache=${Date.now()}`
|
|
19
|
-
), "resolveTreeGridDataUrl"),
|
|
23
|
+
), "resolveTreeGridDataUrl"), Ie = /* @__PURE__ */ o((e, n, s) => e ? { Url: Se(n) } : { Data: { Body: [B(s) ? [] : s] } }, "buildTreeGridDataSource"), Le = /* @__PURE__ */ o(({
|
|
20
24
|
id: e,
|
|
21
25
|
layoutUrl: n,
|
|
22
|
-
dataUrl:
|
|
23
|
-
bodyData:
|
|
24
|
-
useDataUrl:
|
|
25
|
-
width:
|
|
26
|
-
height:
|
|
27
|
-
languageId:
|
|
26
|
+
dataUrl: s,
|
|
27
|
+
bodyData: f,
|
|
28
|
+
useDataUrl: l,
|
|
29
|
+
width: p,
|
|
30
|
+
height: G,
|
|
31
|
+
languageId: y
|
|
28
32
|
}) => ({
|
|
29
33
|
id: e,
|
|
30
|
-
Layout: { Url:
|
|
31
|
-
Data:
|
|
34
|
+
Layout: { Url: ce(n ?? "") },
|
|
35
|
+
Data: Ie(l, s, f),
|
|
32
36
|
Text: {
|
|
33
|
-
Url:
|
|
37
|
+
Url: be(y)
|
|
34
38
|
},
|
|
35
|
-
width:
|
|
36
|
-
height:
|
|
39
|
+
width: p,
|
|
40
|
+
height: G,
|
|
37
41
|
Debug: "Error"
|
|
38
|
-
}), "buildTreeGridInitializationOptions"),
|
|
39
|
-
var
|
|
40
|
-
const
|
|
42
|
+
}), "buildTreeGridInitializationOptions"), xe = /* @__PURE__ */ o((e) => ge(e, "Data.Data.Data.Body.0"), "getTreeGridBodyData"), Ce = /* @__PURE__ */ o((e, n, s) => {
|
|
43
|
+
var l;
|
|
44
|
+
const f = (l = e.Data) == null ? void 0 : l.Data;
|
|
41
45
|
e.Data.Data = {
|
|
42
|
-
...
|
|
46
|
+
...f,
|
|
43
47
|
Data: { Body: [n || []] },
|
|
44
48
|
Url: ""
|
|
45
|
-
}, e.ReloadBody();
|
|
46
|
-
}, "replaceTreeGridBodyData"),
|
|
49
|
+
}, e.ReloadBody(s);
|
|
50
|
+
}, "replaceTreeGridBodyData"), _e = /* @__PURE__ */ o(({
|
|
47
51
|
id: e,
|
|
48
52
|
onSelect: n,
|
|
49
|
-
onRowClick:
|
|
50
|
-
onRowAdd:
|
|
51
|
-
onRowDelete:
|
|
52
|
-
onRowUndelete:
|
|
53
|
-
onRowChange:
|
|
54
|
-
onClickButton:
|
|
55
|
-
onSave:
|
|
56
|
-
onReady:
|
|
57
|
-
onAfterValueChanged:
|
|
58
|
-
treeGridInstanceRef:
|
|
59
|
-
latestLayoutOverridesRef:
|
|
60
|
-
appliedLayoutOverridesRef:
|
|
61
|
-
appliedBodyDataPropRef:
|
|
62
|
-
hasAppliedInitialLayoutRef:
|
|
63
|
-
setIsTreeGridReady:
|
|
53
|
+
onRowClick: s,
|
|
54
|
+
onRowAdd: f,
|
|
55
|
+
onRowDelete: l,
|
|
56
|
+
onRowUndelete: p,
|
|
57
|
+
onRowChange: G,
|
|
58
|
+
onClickButton: y,
|
|
59
|
+
onSave: b,
|
|
60
|
+
onReady: m,
|
|
61
|
+
onAfterValueChanged: c,
|
|
62
|
+
treeGridInstanceRef: M,
|
|
63
|
+
latestLayoutOverridesRef: k,
|
|
64
|
+
appliedLayoutOverridesRef: q,
|
|
65
|
+
appliedBodyDataPropRef: A,
|
|
66
|
+
hasAppliedInitialLayoutRef: S,
|
|
67
|
+
setIsTreeGridReady: H
|
|
64
68
|
}) => {
|
|
65
|
-
const
|
|
69
|
+
const I = c ?? G;
|
|
66
70
|
window.TGSetEvent("OnRowAdd", e, (t, r) => {
|
|
67
|
-
r.CanEdit = 1, r.CanDelete = 1,
|
|
68
|
-
}), typeof
|
|
71
|
+
r.CanEdit = 1, r.CanDelete = 1, f == null || f(t, r);
|
|
72
|
+
}), typeof s == "function" && window.TGSetEvent(
|
|
69
73
|
"OnClick",
|
|
70
74
|
e,
|
|
71
|
-
|
|
72
|
-
|
|
75
|
+
$((t, r, u, T, a, P) => {
|
|
76
|
+
s(t, r, u, T, a, P);
|
|
73
77
|
}, 300)
|
|
74
|
-
), typeof
|
|
78
|
+
), typeof y == "function" && window.TGSetEvent(
|
|
75
79
|
"OnClickButton",
|
|
76
80
|
e,
|
|
77
|
-
|
|
78
|
-
|
|
81
|
+
$((t, r, u, T) => {
|
|
82
|
+
y(t, r, u, T);
|
|
79
83
|
}, 300)
|
|
80
|
-
), typeof
|
|
81
|
-
|
|
82
|
-
}), typeof
|
|
83
|
-
|
|
84
|
-
}), typeof
|
|
85
|
-
|
|
84
|
+
), typeof l == "function" && window.TGSetEvent("OnRowDelete", e, (t, r, u) => {
|
|
85
|
+
l(t, r, u);
|
|
86
|
+
}), typeof p == "function" && window.TGSetEvent("OnRowUndelete", e, (t, r) => {
|
|
87
|
+
p(t, r);
|
|
88
|
+
}), typeof I == "function" && window.TGSetEvent("OnAfterValueChanged", e, (t, r, u, T) => {
|
|
89
|
+
I(t, r, u, T);
|
|
86
90
|
}), typeof n == "function" && window.TGSetEvent(
|
|
87
91
|
"OnSelect",
|
|
88
92
|
e,
|
|
89
|
-
|
|
93
|
+
$((t) => {
|
|
90
94
|
const r = t.GetSelRows() ?? [];
|
|
91
95
|
n(r);
|
|
92
96
|
}, 100)
|
|
93
|
-
), typeof
|
|
94
|
-
|
|
97
|
+
), typeof b == "function" && window.TGSetEvent("OnSave", e, (t, r, u) => {
|
|
98
|
+
b(t, r, u);
|
|
95
99
|
}), window.TGSetEvent(
|
|
96
100
|
"OnReady",
|
|
97
101
|
e,
|
|
98
|
-
|
|
99
|
-
if (!
|
|
100
|
-
const r =
|
|
101
|
-
|
|
102
|
+
$((t) => {
|
|
103
|
+
if (!S.current) {
|
|
104
|
+
const r = k.current;
|
|
105
|
+
S.current = !0, ue(t, r), M.current = t, q.current = r, A.current = xe(t), H(!0), m == null || m(t);
|
|
102
106
|
}
|
|
103
107
|
}, 100)
|
|
104
108
|
);
|
|
105
|
-
}, "bindTreeGridEvents"),
|
|
109
|
+
}, "bindTreeGridEvents"), Qe = /* @__PURE__ */ o(({
|
|
106
110
|
id: e = "treeGridWrapper",
|
|
107
111
|
containerStyle: n,
|
|
108
|
-
containerClassName:
|
|
109
|
-
className:
|
|
110
|
-
style:
|
|
111
|
-
height:
|
|
112
|
-
width:
|
|
113
|
-
layoutUrl:
|
|
114
|
-
dataUrl:
|
|
115
|
-
layoutOverrides:
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
onReady: U,
|
|
130
|
-
onAfterValueChanged: X
|
|
112
|
+
containerClassName: s,
|
|
113
|
+
className: f,
|
|
114
|
+
style: l,
|
|
115
|
+
height: p = "100%",
|
|
116
|
+
width: G = "100%",
|
|
117
|
+
layoutUrl: y,
|
|
118
|
+
dataUrl: b,
|
|
119
|
+
layoutOverrides: m,
|
|
120
|
+
data: c,
|
|
121
|
+
useDataUrl: M,
|
|
122
|
+
onSelect: k,
|
|
123
|
+
onRowClick: q,
|
|
124
|
+
onRowAdd: A,
|
|
125
|
+
onRowDelete: S,
|
|
126
|
+
onRowUndelete: H,
|
|
127
|
+
onRowChange: I,
|
|
128
|
+
onClickButton: t,
|
|
129
|
+
onSave: r,
|
|
130
|
+
onReady: u,
|
|
131
|
+
onAfterValueChanged: T,
|
|
132
|
+
showLoading: a = !0
|
|
131
133
|
}) => {
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
134
|
+
const { t: P } = Te(), d = i(null), J = i(null), h = i(m), Y = i(c), L = i(void 0), x = i(void 0), ae = i(!1), E = i(0), D = i(null), R = i(void 0), O = i(void 0), [j, fe] = ie(!1), [le, g] = ie(!1), C = ve(), Z = i(C.id), de = a && c !== void 0 && j && x.current !== c, F = a && (le || de), U = !F && c !== void 0 && B(c);
|
|
135
|
+
h.current = m, Y.current = c;
|
|
136
|
+
const ee = ye({
|
|
137
|
+
visible: F || U,
|
|
138
|
+
containerRef: J,
|
|
139
|
+
treeGridInstanceRef: d
|
|
140
|
+
}), _ = /* @__PURE__ */ o(() => {
|
|
141
|
+
R.current !== void 0 && (window.clearTimeout(R.current), R.current = void 0);
|
|
142
|
+
}, "clearBindingLoadingHideTimeout"), z = /* @__PURE__ */ o(() => {
|
|
143
|
+
O.current !== void 0 && (window.clearTimeout(O.current), O.current = void 0);
|
|
144
|
+
}, "clearBodyReloadStartTimeout");
|
|
145
|
+
X(() => {
|
|
146
|
+
a || (z(), _(), D.current = null, g(!1));
|
|
147
|
+
}, [a]), X(() => {
|
|
148
|
+
var w;
|
|
149
|
+
if (C.id !== Z.current && !B(d.current) && ((w = d.current) == null || w.Dispose(), d.current = null, Z.current = C.id), !!B(d.current))
|
|
150
|
+
return _e({
|
|
151
|
+
id: e,
|
|
152
|
+
onSelect: k,
|
|
153
|
+
onRowClick: q,
|
|
154
|
+
onRowAdd: A,
|
|
155
|
+
onRowDelete: S,
|
|
156
|
+
onRowUndelete: H,
|
|
157
|
+
onRowChange: I,
|
|
158
|
+
onClickButton: t,
|
|
159
|
+
onSave: r,
|
|
160
|
+
onReady: u,
|
|
161
|
+
onAfterValueChanged: T,
|
|
162
|
+
treeGridInstanceRef: d,
|
|
163
|
+
latestLayoutOverridesRef: h,
|
|
164
|
+
appliedLayoutOverridesRef: L,
|
|
165
|
+
appliedBodyDataPropRef: x,
|
|
166
|
+
hasAppliedInitialLayoutRef: ae,
|
|
167
|
+
setIsTreeGridReady: fe
|
|
168
|
+
}), window.TreeGrid(
|
|
169
|
+
Le({
|
|
140
170
|
id: e,
|
|
141
|
-
layoutUrl:
|
|
142
|
-
dataUrl:
|
|
143
|
-
bodyData:
|
|
144
|
-
useDataUrl:
|
|
145
|
-
width:
|
|
146
|
-
height:
|
|
147
|
-
languageId:
|
|
171
|
+
layoutUrl: y,
|
|
172
|
+
dataUrl: b,
|
|
173
|
+
bodyData: c,
|
|
174
|
+
useDataUrl: M,
|
|
175
|
+
width: G,
|
|
176
|
+
height: p,
|
|
177
|
+
languageId: C.id
|
|
148
178
|
}),
|
|
149
179
|
e,
|
|
150
180
|
e
|
|
151
|
-
),
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
onRowAdd: w,
|
|
156
|
-
onRowDelete: t,
|
|
157
|
-
onRowUndelete: r,
|
|
158
|
-
onRowChange: s,
|
|
159
|
-
onClickButton: a,
|
|
160
|
-
onSave: I,
|
|
161
|
-
onReady: U,
|
|
162
|
-
onAfterValueChanged: X,
|
|
163
|
-
treeGridInstanceRef: f,
|
|
164
|
-
latestLayoutOverridesRef: $,
|
|
165
|
-
appliedLayoutOverridesRef: O,
|
|
166
|
-
appliedBodyDataPropRef: _,
|
|
167
|
-
hasAppliedInitialLayoutRef: J,
|
|
168
|
-
setIsTreeGridReady: M
|
|
169
|
-
}), () => {
|
|
170
|
-
te(() => {
|
|
171
|
-
var d;
|
|
172
|
-
(d = f.current) == null || d.Dispose();
|
|
181
|
+
), () => {
|
|
182
|
+
Ee(() => {
|
|
183
|
+
var v;
|
|
184
|
+
(v = d.current) == null || v.Dispose();
|
|
173
185
|
}, 200);
|
|
174
186
|
};
|
|
175
|
-
}, []),
|
|
176
|
-
const
|
|
177
|
-
if (
|
|
187
|
+
}, []), Ge(() => {
|
|
188
|
+
const w = d.current, v = h.current, N = Y.current;
|
|
189
|
+
if (B(w) || !j)
|
|
178
190
|
return;
|
|
179
|
-
const
|
|
180
|
-
!
|
|
181
|
-
|
|
191
|
+
const te = L.current !== v && !Re(L.current, v), Q = x.current !== N;
|
|
192
|
+
if (!(!te && !Q) && (te && (ue(w, v, Q), L.current = v), Q)) {
|
|
193
|
+
const V = E.current + 1, re = /* @__PURE__ */ o(() => {
|
|
194
|
+
O.current = void 0, Ce(w, N, () => {
|
|
195
|
+
if (E.current !== V)
|
|
196
|
+
return;
|
|
197
|
+
const ne = D.current;
|
|
198
|
+
if (!a || ne === null) {
|
|
199
|
+
D.current = null, g(!1);
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
const oe = Math.max(
|
|
203
|
+
0,
|
|
204
|
+
Be - (Date.now() - ne)
|
|
205
|
+
);
|
|
206
|
+
if (_(), oe === 0) {
|
|
207
|
+
D.current = null, g(!1);
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
R.current = window.setTimeout(() => {
|
|
211
|
+
E.current === V && (R.current = void 0, D.current = null, g(!1));
|
|
212
|
+
}, oe);
|
|
213
|
+
});
|
|
214
|
+
}, "runBodyReload");
|
|
215
|
+
E.current = V, a && N !== void 0 ? (z(), _(), D.current = Date.now(), g(!0), O.current = window.setTimeout(() => {
|
|
216
|
+
E.current === V && re();
|
|
217
|
+
}, 0)) : re(), x.current = N;
|
|
218
|
+
}
|
|
219
|
+
}, [j, m, c, a]), X(() => () => {
|
|
220
|
+
z(), _();
|
|
221
|
+
}, []);
|
|
222
|
+
const K = {
|
|
223
|
+
height: p,
|
|
224
|
+
width: G,
|
|
225
|
+
...n
|
|
226
|
+
};
|
|
227
|
+
return (a || U) && (K.position = n != null && n.position && n.position !== "static" ? n.position : "relative", K.isolation = "isolate"), /* @__PURE__ */ me("div", { ref: J, className: s, style: K, children: [
|
|
228
|
+
/* @__PURE__ */ W("div", { id: e, className: f, style: Oe(l, ["height", "width"]) }),
|
|
229
|
+
/* @__PURE__ */ W(
|
|
230
|
+
we,
|
|
231
|
+
{
|
|
232
|
+
visible: U,
|
|
233
|
+
message: P("Message.조회된 결과가 없습니다."),
|
|
234
|
+
overlayFrame: ee
|
|
235
|
+
}
|
|
236
|
+
),
|
|
237
|
+
/* @__PURE__ */ W(De, { visible: F, overlayFrame: ee })
|
|
238
|
+
] });
|
|
182
239
|
}, "OwpTreeGrid");
|
|
183
240
|
export {
|
|
184
|
-
|
|
241
|
+
Qe as OwpTreeGrid
|
|
185
242
|
};
|
|
186
243
|
//# sourceMappingURL=OwpTreeGrid.js.map
|