@owp/core 2.2.1 → 2.2.3

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.
Files changed (73) hide show
  1. package/dist/_virtual/index10.js +2 -2
  2. package/dist/_virtual/index12.js +2 -2
  3. package/dist/_virtual/index13.js +2 -2
  4. package/dist/_virtual/index14.js +2 -2
  5. package/dist/components/OwpMrtTable/OwpMrtTable.js +223 -196
  6. package/dist/components/OwpMrtTable/OwpMrtTable.js.map +1 -1
  7. package/dist/components/OwpMrtTable/OwpMrtTableNoDataOverlay.js +53 -0
  8. package/dist/components/OwpMrtTable/OwpMrtTableNoDataOverlay.js.map +1 -0
  9. package/dist/components/OwpSection/OwpSection.js +35 -35
  10. package/dist/components/OwpSection/OwpSection.js.map +1 -1
  11. package/dist/components/OwpTreeGrid/OwpTreeGrid.js +291 -192
  12. package/dist/components/OwpTreeGrid/OwpTreeGrid.js.map +1 -1
  13. package/dist/components/OwpTreeGrid/hooks/useOwpTreeGridOverlayFrame.js +48 -46
  14. package/dist/components/OwpTreeGrid/hooks/useOwpTreeGridOverlayFrame.js.map +1 -1
  15. package/dist/components/OwpTreeGrid/perf.js +31 -0
  16. package/dist/components/OwpTreeGrid/perf.js.map +1 -0
  17. package/dist/components/OwpTreeGridResetChangesButton/OwpTreeGridResetChangesButton.js +34 -0
  18. package/dist/components/OwpTreeGridResetChangesButton/OwpTreeGridResetChangesButton.js.map +1 -0
  19. package/dist/index.js +25 -23
  20. package/dist/index.js.map +1 -1
  21. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/CODE128/index.js +1 -1
  22. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/CODE39/index.js +1 -1
  23. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/CODE93/index.js +1 -1
  24. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/EAN_UPC/constants.js +1 -1
  25. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/EAN_UPC/index.js +1 -1
  26. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/GenericBarcode/index.js +1 -1
  27. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/ITF/constants.js +1 -1
  28. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/ITF/index.js +1 -1
  29. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/MSI/index.js +1 -1
  30. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/codabar/index.js +1 -1
  31. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/pharmacode/index.js +1 -1
  32. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/renderers/index.js +1 -1
  33. package/dist/node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/utils.js +1 -1
  34. package/dist/node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/utils.js +1 -1
  35. package/dist/types/components/OwpMrtTable/OwpMrtTable.d.ts +2 -0
  36. package/dist/types/components/OwpMrtTable/OwpMrtTableNoDataOverlay.d.ts +14 -0
  37. package/dist/types/components/OwpTreeGrid/hooks/useOwpTreeGridOverlayFrame.d.ts +2 -1
  38. package/dist/types/components/OwpTreeGrid/perf.d.ts +30 -0
  39. package/dist/types/components/OwpTreeGridResetChangesButton/OwpTreeGridResetChangesButton.d.ts +13 -0
  40. package/dist/types/components/OwpTreeGridResetChangesButton/index.d.ts +1 -0
  41. package/dist/types/index.d.ts +1 -0
  42. package/dist/types/utils/index.d.ts +1 -0
  43. package/dist/types/utils/preloadOnIdle.d.ts +7 -0
  44. package/dist/types/utils/treeGridBodyRowsEvent.d.ts +9 -0
  45. package/dist/utils/exceljsBrowser.js +6 -6
  46. package/dist/utils/exceljsBrowser.js.map +1 -1
  47. package/dist/utils/jszipBrowser.js +6 -6
  48. package/dist/utils/jszipBrowser.js.map +1 -1
  49. package/dist/utils/preloadOnIdle.js +27 -0
  50. package/dist/utils/preloadOnIdle.js.map +1 -0
  51. package/dist/utils/treeGridBodyRowsEvent.js +14 -0
  52. package/dist/utils/treeGridBodyRowsEvent.js.map +1 -0
  53. package/dist/utils/treeGridExportExcelUtil.js +306 -268
  54. package/dist/utils/treeGridExportExcelUtil.js.map +1 -1
  55. package/dist/utils/treeGridUtil.js +79 -72
  56. package/dist/utils/treeGridUtil.js.map +1 -1
  57. package/dist/utils.js +64 -62
  58. package/dist/utils.js.map +1 -1
  59. package/package.json +1 -1
  60. package/dist/_virtual/_commonjs-dynamic-modules.js +0 -10
  61. package/dist/_virtual/_commonjs-dynamic-modules.js.map +0 -1
  62. package/dist/_virtual/exceljs.min.js +0 -31
  63. package/dist/_virtual/exceljs.min.js.map +0 -1
  64. package/dist/_virtual/exceljs.min2.js +0 -5
  65. package/dist/_virtual/exceljs.min2.js.map +0 -1
  66. package/dist/_virtual/jszip.min.js +0 -31
  67. package/dist/_virtual/jszip.min.js.map +0 -1
  68. package/dist/_virtual/jszip.min2.js +0 -5
  69. package/dist/_virtual/jszip.min2.js.map +0 -1
  70. package/dist/node_modules/.pnpm/exceljs@4.4.0/node_modules/exceljs/dist/exceljs.min.js +0 -23540
  71. package/dist/node_modules/.pnpm/exceljs@4.4.0/node_modules/exceljs/dist/exceljs.min.js.map +0 -1
  72. package/dist/node_modules/.pnpm/jszip@3.10.1/node_modules/jszip/dist/jszip.min.js +0 -2385
  73. package/dist/node_modules/.pnpm/jszip@3.10.1/node_modules/jszip/dist/jszip.min.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"OwpTreeGrid.js","sources":["../../../src/components/OwpTreeGrid/OwpTreeGrid.tsx"],"sourcesContent":["import { useOwpTranslation } from '@/hooks/useOwpTranslation';\nimport { useGetCurrentLanguage } from '@/hooks/useCurrentLanguage';\nimport { debounce, delay, get, isEmpty, isEqual, omit } from 'es-toolkit/compat';\nimport {\n type CSSProperties,\n type Dispatch,\n type RefObject,\n type SetStateAction,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n} from 'react';\nimport { useOwpTreeGridOverlayFrame } from './hooks/useOwpTreeGridOverlayFrame';\nimport { OwpTreeGridLoadingOverlay } from './OwpTreeGridLoadingOverlay';\nimport { OwpTreeGridNoDataOverlay } from './OwpTreeGridNoDataOverlay';\nimport { applyTreeGridLayoutToGrid } from './utils';\n\ntype TreeGridLayoutScalarValue = string | number;\ntype TreeGridNestedLayoutFields = Record<string, TreeGridLayoutScalarValue>;\ntype TreeGridLayoutFields = Record<string, TreeGridLayoutScalarValue | TreeGridNestedLayoutFields>;\ntype TreeGridSectionFields = Record<string, TreeGridLayoutScalarValue>;\n\nconst TREE_GRID_BINDING_LOADING_MIN_VISIBLE_MS = 300;\n\nexport interface OwpTreeGridLayout {\n Header?: TreeGridLayoutFields;\n Toolbar?: TreeGridSectionFields;\n Foot?: TreeGridSectionFields;\n}\n\nexport type OwpTreeGridLayoutConfig = OwpTreeGridLayout;\nexport type THeader = OwpTreeGridLayoutConfig;\nexport type OwpTreeGridBodyData<T> = Record<string, never> | [] | undefined | T[];\nexport type OwpTreeGridData<T> = OwpTreeGridBodyData<T>;\nexport type TData<T> = OwpTreeGridBodyData<T>;\nexport type OwpTreeGridRowModel<T> = TRow & T;\nexport type OwpTreeGridSelectedRows<T> = OwpTreeGridRowModel<T>[];\n\ntype OwpTreeGridSelectHandler<T> = (selectedRows: OwpTreeGridSelectedRows<T>) => void;\ntype OwpTreeGridRowAddHandler<T> = (grid: TGrid, row: OwpTreeGridRowModel<T>) => void;\ntype OwpTreeGridRowDeleteHandler<T> = (\n grid: TGrid,\n row: OwpTreeGridRowModel<T>,\n deleteType: number,\n) => void;\ntype OwpTreeGridRowUndeleteHandler<T> = (grid: TGrid, row: OwpTreeGridRowModel<T>) => void;\ntype OwpTreeGridButtonClickHandler<T> = (\n grid: TGrid,\n row: OwpTreeGridRowModel<T>,\n col: string,\n event: Event,\n) => void;\ntype OwpTreeGridRowClickHandler<T> = (\n grid: TGrid,\n row: OwpTreeGridRowModel<T>,\n col: string,\n x: number,\n y: number,\n event: Event,\n) => void;\ntype OwpTreeGridSaveHandler<T> = (\n grid: TGrid,\n row: OwpTreeGridRowModel<T>,\n autoupdate: boolean | number,\n) => void;\ntype OwpTreeGridCellValue = unknown;\ntype OwpTreeGridAfterValueChangedHandler<T> = (\n grid: TGrid,\n row: OwpTreeGridRowModel<T>,\n col: string,\n value: OwpTreeGridCellValue,\n) => void;\n\nexport interface OwpTreeGridProps<T> {\n id: string;\n className?: string;\n containerStyle?: CSSProperties;\n containerClassName?: string;\n layoutUrl?: string;\n dataUrl?: string;\n layoutOverrides?: OwpTreeGridLayoutConfig;\n data?: OwpTreeGridBodyData<T>;\n style?: CSSProperties;\n height?: string | number;\n width?: string | number;\n useDataUrl?: boolean;\n onSelect?: OwpTreeGridSelectHandler<T>;\n onRowAdd?: OwpTreeGridRowAddHandler<T>;\n onRowDelete?: OwpTreeGridRowDeleteHandler<T>;\n onRowUndelete?: OwpTreeGridRowUndeleteHandler<T>;\n onRowChange?: OwpTreeGridAfterValueChangedHandler<T>;\n onClickButton?: OwpTreeGridButtonClickHandler<T>;\n onReady?: (grid: TGrid) => void;\n onRowClick?: OwpTreeGridRowClickHandler<T>;\n onSave?: OwpTreeGridSaveHandler<T>;\n onAfterValueChanged?: OwpTreeGridAfterValueChangedHandler<T>;\n loading?: boolean;\n showLoading?: boolean;\n}\n\ntype TreeGridEventBindingOptions<T> = Pick<\n OwpTreeGridProps<T>,\n | 'id'\n | 'onSelect'\n | 'onRowClick'\n | 'onRowAdd'\n | 'onRowDelete'\n | 'onRowUndelete'\n | 'onRowChange'\n | 'onClickButton'\n | 'onSave'\n | 'onReady'\n | 'onAfterValueChanged'\n> & {\n treeGridInstanceRef: RefObject<TGrid>;\n latestLayoutOverridesRef: RefObject<OwpTreeGridLayoutConfig | undefined>;\n appliedLayoutOverridesRef: RefObject<OwpTreeGridLayoutConfig | undefined>;\n appliedBodyDataPropRef: RefObject<OwpTreeGridBodyData<T>>;\n hasAppliedInitialLayoutRef: RefObject<boolean>;\n setIsTreeGridReady: Dispatch<SetStateAction<boolean>>;\n};\n\ntype TreeGridInitializationInput<T> = {\n id: string;\n layoutUrl?: string;\n dataUrl?: string;\n bodyData: OwpTreeGridBodyData<T>;\n useDataUrl?: boolean;\n width?: string | number;\n height?: string | number;\n languageId: string;\n};\n\nconst TREE_GRID_TEXT_RESOURCE_URLS = {\n en: '/assets/vendors/Grid/TextEN.xml',\n kr: '/assets/vendors/Grid/TextKR.xml',\n} as const;\n\nconst appendNoCacheQuery = (url: string) => {\n return `${url}?noCache=${Date.now()}`;\n};\n\nconst getTreeGridTextResourceUrl = (languageId: string) => {\n return languageId === 'kr' ? TREE_GRID_TEXT_RESOURCE_URLS.kr : TREE_GRID_TEXT_RESOURCE_URLS.en;\n};\n\nconst resolveTreeGridDataUrl = (dataUrl?: string) => {\n return dataUrl?.includes('assets')\n ? appendNoCacheQuery(dataUrl)\n : // @ts-expect-error - API base URL env is provided by host app\n `${import.meta.env.VITE_API_BASE_URL}/${dataUrl}?noCache=${Date.now()}`;\n};\n\nconst buildTreeGridDataSource = <T,>(\n useDataUrl: boolean | undefined,\n dataUrl: string | undefined,\n bodyData: OwpTreeGridBodyData<T>,\n) => {\n if (useDataUrl) {\n return { Url: resolveTreeGridDataUrl(dataUrl) };\n }\n\n return { Data: { Body: [isEmpty(bodyData) ? [] : bodyData] } };\n};\n\nconst buildTreeGridInitializationOptions = <T,>({\n id,\n layoutUrl,\n dataUrl,\n bodyData,\n useDataUrl,\n width,\n height,\n languageId,\n}: TreeGridInitializationInput<T>) => {\n return {\n id,\n Layout: { Url: appendNoCacheQuery(layoutUrl ?? '') },\n Data: buildTreeGridDataSource(useDataUrl, dataUrl, bodyData),\n Text: {\n Url: getTreeGridTextResourceUrl(languageId),\n },\n width,\n height,\n Debug: 'Error',\n };\n};\n\nconst getTreeGridBodyData = (grid: TGrid | null) => {\n return get(grid, 'Data.Data.Data.Body.0');\n};\n\nconst replaceTreeGridBodyData = <T,>(\n grid: TGrid,\n bodyData: OwpTreeGridBodyData<T>,\n onReloadFinish?: (code: number) => void,\n) => {\n // @ts-expect-error - TreeGrid Data.Data shape is not reflected in bundled types\n const currentDataConfig = grid.Data?.Data;\n\n // @ts-expect-error - TreeGrid Data.Data shape is not reflected in bundled types\n grid.Data.Data = {\n ...currentDataConfig,\n Data: { Body: [bodyData || []] },\n Url: '',\n };\n\n grid.ReloadBody(onReloadFinish);\n};\n\nconst bindTreeGridEvents = <T,>({\n id,\n onSelect,\n onRowClick,\n onRowAdd,\n onRowDelete,\n onRowUndelete,\n onRowChange,\n onClickButton,\n onSave,\n onReady,\n onAfterValueChanged,\n treeGridInstanceRef,\n latestLayoutOverridesRef,\n appliedLayoutOverridesRef,\n appliedBodyDataPropRef,\n hasAppliedInitialLayoutRef,\n setIsTreeGridReady,\n}: TreeGridEventBindingOptions<T>) => {\n const valueChangedHandler = onAfterValueChanged ?? onRowChange;\n\n window.TGSetEvent('OnRowAdd', id, (grid, row) => {\n row.CanEdit = 1;\n row.CanDelete = 1;\n\n onRowAdd?.(grid, row as OwpTreeGridRowModel<T>);\n });\n\n if (typeof onRowClick === 'function') {\n window.TGSetEvent(\n 'OnClick',\n id,\n debounce((grid, row, col, x, y, event) => {\n onRowClick(grid, row as OwpTreeGridRowModel<T>, col, x, y, event);\n }, 300),\n );\n }\n\n if (typeof onClickButton === 'function') {\n window.TGSetEvent(\n 'OnClickButton',\n id,\n debounce((grid, row, col, event) => {\n onClickButton(grid, row as OwpTreeGridRowModel<T>, col, event);\n }, 300),\n );\n }\n\n if (typeof onRowDelete === 'function') {\n window.TGSetEvent('OnRowDelete', id, (grid, row, deleteType) => {\n onRowDelete(grid, row as OwpTreeGridRowModel<T>, deleteType);\n });\n }\n if (typeof onRowUndelete === 'function') {\n window.TGSetEvent('OnRowUndelete', id, (grid, row) => {\n onRowUndelete(grid, row as OwpTreeGridRowModel<T>);\n });\n }\n if (typeof valueChangedHandler === 'function') {\n window.TGSetEvent('OnAfterValueChanged', id, (grid, row, col, value) => {\n valueChangedHandler(grid, row as OwpTreeGridRowModel<T>, col, value);\n });\n }\n if (typeof onSelect === 'function') {\n window.TGSetEvent(\n 'OnSelect',\n id,\n debounce((grid) => {\n const selectedRows = (grid.GetSelRows() ?? []) as OwpTreeGridSelectedRows<T>;\n onSelect(selectedRows);\n }, 100),\n );\n }\n if (typeof onSave === 'function') {\n window.TGSetEvent('OnSave', id, (grid, row, autoupdate) => {\n onSave(grid, row as OwpTreeGridRowModel<T>, autoupdate);\n });\n }\n\n window.TGSetEvent(\n 'OnReady',\n id,\n debounce((grid) => {\n if (!hasAppliedInitialLayoutRef.current) {\n const latestLayoutOverrides = latestLayoutOverridesRef.current;\n\n hasAppliedInitialLayoutRef.current = true;\n applyTreeGridLayoutToGrid(grid, latestLayoutOverrides);\n treeGridInstanceRef.current = grid;\n appliedLayoutOverridesRef.current = latestLayoutOverrides;\n appliedBodyDataPropRef.current = getTreeGridBodyData(grid) as OwpTreeGridBodyData<T>;\n setIsTreeGridReady(true);\n onReady?.(grid);\n }\n }, 100),\n );\n};\n\n/**\n * OwpTreeGrid 컴포넌트\n * @param id 식별자\n * @param containerStyle containerStyle 값\n * @param containerClassName containerClassName 값\n * @param className CSS 클래스명\n * @param style 스타일 객체\n * @param height height 값\n */\nconst OwpTreeGrid = <T,>({\n id = 'treeGridWrapper',\n containerStyle,\n containerClassName,\n className,\n style,\n height = '100%',\n width = '100%',\n layoutUrl,\n dataUrl,\n layoutOverrides,\n data,\n useDataUrl,\n onSelect,\n onRowClick,\n onRowAdd,\n onRowDelete,\n onRowUndelete,\n onRowChange,\n onClickButton,\n onSave,\n onReady,\n onAfterValueChanged,\n loading,\n showLoading = true,\n}: OwpTreeGridProps<T>) => {\n const { t } = useOwpTranslation();\n const treeGridInstanceRef = useRef<TGrid>(null);\n const treeGridContainerRef = useRef<HTMLDivElement | null>(null);\n const latestLayoutOverridesRef = useRef<OwpTreeGridLayoutConfig | undefined>(layoutOverrides);\n const latestBodyDataPropRef = useRef<OwpTreeGridBodyData<T>>(data);\n const stagedBodyDataPropRef = useRef<OwpTreeGridBodyData<T>>(undefined);\n const hasStagedBodyDataPropRef = useRef(false);\n const appliedLayoutOverridesRef = useRef<OwpTreeGridLayoutConfig | undefined>(undefined);\n const appliedBodyDataPropRef = useRef<OwpTreeGridBodyData<T>>(undefined);\n const hasAppliedInitialLayoutRef = useRef(false);\n const bodyReloadSequenceRef = useRef(0);\n const bindingLoadingStartedAtRef = useRef<number | null>(null);\n const bindingLoadingHideTimeoutRef = useRef<number | undefined>(undefined);\n const bodyReloadStartTimeoutRef = useRef<number | undefined>(undefined);\n const [isTreeGridReady, setIsTreeGridReady] = useState(false);\n const [isBindingLoadingVisible, setIsBindingLoadingVisible] = useState(false);\n const currentLanguage = useGetCurrentLanguage();\n const currentLanguageIdRef = useRef(currentLanguage.id);\n const isPendingBodyReload =\n showLoading &&\n data !== undefined &&\n isTreeGridReady &&\n appliedBodyDataPropRef.current !== data;\n const isInternalLoadingVisible = showLoading && (isBindingLoadingVisible || isPendingBodyReload);\n const isLoadingOverlayVisible = (showLoading && loading === true) || isInternalLoadingVisible;\n const isNoDataVisible = !isLoadingOverlayVisible && data !== undefined && isEmpty(data);\n\n latestLayoutOverridesRef.current = layoutOverrides;\n latestBodyDataPropRef.current = data;\n\n const overlayFrame = useOwpTreeGridOverlayFrame({\n visible: isLoadingOverlayVisible || isNoDataVisible,\n containerRef: treeGridContainerRef,\n treeGridInstanceRef,\n });\n\n const clearBindingLoadingHideTimeout = () => {\n if (bindingLoadingHideTimeoutRef.current !== undefined) {\n window.clearTimeout(bindingLoadingHideTimeoutRef.current);\n bindingLoadingHideTimeoutRef.current = undefined;\n }\n };\n\n const clearBodyReloadStartTimeout = () => {\n if (bodyReloadStartTimeoutRef.current !== undefined) {\n window.clearTimeout(bodyReloadStartTimeoutRef.current);\n bodyReloadStartTimeoutRef.current = undefined;\n }\n };\n\n useEffect(() => {\n if (!showLoading) {\n clearBodyReloadStartTimeout();\n clearBindingLoadingHideTimeout();\n bindingLoadingStartedAtRef.current = null;\n setIsBindingLoadingVisible(false);\n }\n }, [showLoading]);\n\n useEffect(() => {\n if (\n currentLanguage.id !== currentLanguageIdRef.current &&\n !isEmpty(treeGridInstanceRef.current)\n ) {\n treeGridInstanceRef.current?.Dispose();\n treeGridInstanceRef.current = null;\n currentLanguageIdRef.current = currentLanguage.id;\n }\n\n if (!isEmpty(treeGridInstanceRef.current)) {\n return;\n }\n\n bindTreeGridEvents({\n id,\n onSelect,\n onRowClick,\n onRowAdd,\n onRowDelete,\n onRowUndelete,\n onRowChange,\n onClickButton,\n onSave,\n onReady,\n onAfterValueChanged,\n treeGridInstanceRef,\n latestLayoutOverridesRef,\n appliedLayoutOverridesRef,\n appliedBodyDataPropRef,\n hasAppliedInitialLayoutRef,\n setIsTreeGridReady,\n });\n\n window.TreeGrid(\n buildTreeGridInitializationOptions({\n id,\n layoutUrl,\n dataUrl,\n bodyData: data,\n useDataUrl,\n width,\n height,\n languageId: currentLanguage.id,\n }),\n id,\n id,\n );\n\n return () => {\n delay(() => {\n treeGridInstanceRef.current?.Dispose();\n }, 200);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useLayoutEffect(() => {\n const treeGrid = treeGridInstanceRef.current;\n const nextLayoutOverrides = latestLayoutOverridesRef.current;\n const nextBodyData = latestBodyDataPropRef.current;\n\n if (isEmpty(treeGrid) || !isTreeGridReady) {\n return;\n }\n\n const shouldApplyLayoutOverrides =\n appliedLayoutOverridesRef.current !== nextLayoutOverrides &&\n !isEqual(appliedLayoutOverridesRef.current, nextLayoutOverrides);\n const shouldApplyBodyData =\n appliedBodyDataPropRef.current !== nextBodyData &&\n (!hasStagedBodyDataPropRef.current || stagedBodyDataPropRef.current !== nextBodyData);\n\n if (!shouldApplyLayoutOverrides && !shouldApplyBodyData) {\n return;\n }\n\n if (shouldApplyLayoutOverrides) {\n applyTreeGridLayoutToGrid(treeGrid, nextLayoutOverrides, shouldApplyBodyData);\n appliedLayoutOverridesRef.current = nextLayoutOverrides;\n }\n\n if (shouldApplyBodyData) {\n const reloadSequence = bodyReloadSequenceRef.current + 1;\n const runBodyReload = () => {\n const bodyDataToApply = stagedBodyDataPropRef.current;\n\n bodyReloadStartTimeoutRef.current = undefined;\n\n replaceTreeGridBodyData(treeGrid, bodyDataToApply, () => {\n if (bodyReloadSequenceRef.current !== reloadSequence) {\n return;\n }\n\n appliedBodyDataPropRef.current = bodyDataToApply;\n\n if (stagedBodyDataPropRef.current === bodyDataToApply) {\n stagedBodyDataPropRef.current = undefined;\n hasStagedBodyDataPropRef.current = false;\n }\n\n const startedAt = bindingLoadingStartedAtRef.current;\n\n if (!showLoading || startedAt === null) {\n bindingLoadingStartedAtRef.current = null;\n setIsBindingLoadingVisible(false);\n return;\n }\n\n const remainingVisibleTime = Math.max(\n 0,\n TREE_GRID_BINDING_LOADING_MIN_VISIBLE_MS - (Date.now() - startedAt),\n );\n\n clearBindingLoadingHideTimeout();\n\n if (remainingVisibleTime === 0) {\n bindingLoadingStartedAtRef.current = null;\n setIsBindingLoadingVisible(false);\n return;\n }\n\n bindingLoadingHideTimeoutRef.current = window.setTimeout(() => {\n if (bodyReloadSequenceRef.current !== reloadSequence) {\n return;\n }\n\n bindingLoadingHideTimeoutRef.current = undefined;\n bindingLoadingStartedAtRef.current = null;\n setIsBindingLoadingVisible(false);\n }, remainingVisibleTime);\n });\n };\n\n bodyReloadSequenceRef.current = reloadSequence;\n stagedBodyDataPropRef.current = nextBodyData;\n hasStagedBodyDataPropRef.current = true;\n\n if (showLoading && nextBodyData !== undefined) {\n clearBodyReloadStartTimeout();\n clearBindingLoadingHideTimeout();\n bindingLoadingStartedAtRef.current = Date.now();\n setIsBindingLoadingVisible(true);\n bodyReloadStartTimeoutRef.current = window.setTimeout(() => {\n if (bodyReloadSequenceRef.current !== reloadSequence) {\n return;\n }\n\n runBodyReload();\n }, 0);\n } else {\n runBodyReload();\n }\n }\n }, [isTreeGridReady, layoutOverrides, data, showLoading]);\n\n useEffect(() => {\n return () => {\n clearBodyReloadStartTimeout();\n clearBindingLoadingHideTimeout();\n };\n }, []);\n\n const resolvedContainerStyle: CSSProperties = {\n height,\n width,\n ...containerStyle,\n };\n\n if (showLoading || isNoDataVisible) {\n resolvedContainerStyle.position =\n containerStyle?.position && containerStyle.position !== 'static'\n ? containerStyle.position\n : 'relative';\n resolvedContainerStyle.isolation = 'isolate';\n }\n\n return (\n <div ref={treeGridContainerRef} className={containerClassName} style={resolvedContainerStyle}>\n <div id={id} className={className} style={omit(style, ['height', 'width'])} />\n <OwpTreeGridNoDataOverlay\n visible={isNoDataVisible}\n message={t('Message.조회된 결과가 없습니다.')}\n overlayFrame={overlayFrame}\n />\n <OwpTreeGridLoadingOverlay visible={isLoadingOverlayVisible} overlayFrame={overlayFrame} />\n </div>\n );\n};\n\nexport { OwpTreeGrid };\n"],"names":["TREE_GRID_BINDING_LOADING_MIN_VISIBLE_MS","TREE_GRID_TEXT_RESOURCE_URLS","appendNoCacheQuery","__name","url","getTreeGridTextResourceUrl","languageId","resolveTreeGridDataUrl","dataUrl","buildTreeGridDataSource","useDataUrl","bodyData","isEmpty","buildTreeGridInitializationOptions","id","layoutUrl","width","height","getTreeGridBodyData","grid","get","replaceTreeGridBodyData","onReloadFinish","currentDataConfig","_a","bindTreeGridEvents","onSelect","onRowClick","onRowAdd","onRowDelete","onRowUndelete","onRowChange","onClickButton","onSave","onReady","onAfterValueChanged","treeGridInstanceRef","latestLayoutOverridesRef","appliedLayoutOverridesRef","appliedBodyDataPropRef","hasAppliedInitialLayoutRef","setIsTreeGridReady","valueChangedHandler","row","debounce","col","x","y","event","deleteType","value","selectedRows","autoupdate","latestLayoutOverrides","applyTreeGridLayoutToGrid","OwpTreeGrid","containerStyle","containerClassName","className","style","layoutOverrides","data","loading","showLoading","t","useOwpTranslation","useRef","treeGridContainerRef","latestBodyDataPropRef","stagedBodyDataPropRef","hasStagedBodyDataPropRef","bodyReloadSequenceRef","bindingLoadingStartedAtRef","bindingLoadingHideTimeoutRef","bodyReloadStartTimeoutRef","isTreeGridReady","useState","isBindingLoadingVisible","setIsBindingLoadingVisible","currentLanguage","useGetCurrentLanguage","currentLanguageIdRef","isPendingBodyReload","isLoadingOverlayVisible","isNoDataVisible","overlayFrame","useOwpTreeGridOverlayFrame","clearBindingLoadingHideTimeout","clearBodyReloadStartTimeout","useEffect","delay","useLayoutEffect","treeGrid","nextLayoutOverrides","nextBodyData","shouldApplyLayoutOverrides","isEqual","shouldApplyBodyData","reloadSequence","runBodyReload","bodyDataToApply","startedAt","remainingVisibleTime","resolvedContainerStyle","jsx","omit","OwpTreeGridNoDataOverlay","OwpTreeGridLoadingOverlay"],"mappings":";;;;;;;;;;;;;;;;AAuBA,MAAMA,KAA2C,KA+G3CC,KAA+B;AAAA,EACnC,IAAI;AAAA,EACJ,IAAI;AACN,GAEMC,KAAqB,gBAAAC,EAAA,CAACC,MACnB,GAAGA,CAAG,YAAY,KAAK,KAAK,IADV,uBAIrBC,KAA6B,gBAAAF,EAAA,CAACG,MAC3BA,MAAe,OAAOL,GAA6B,KAAKA,GAA6B,IAD3D,+BAI7BM,KAAyB,gBAAAJ,EAAA,CAACK,MACvBA,KAAA,QAAAA,EAAS,SAAS,YACrBN,GAAmBM,CAAO;AAAA;AAAA,EAE1B,aAAwCA,CAAO,YAAY,KAAK,KAAK;AAAA,GAJ5C,2BAOzBC,KAA0B,gBAAAN,EAAA,CAC9BO,GACAF,GACAG,MAEID,IACK,EAAE,KAAKH,GAAuBC,CAAO,EAAA,IAGvC,EAAE,MAAM,EAAE,MAAM,CAACI,EAA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EAAsB,YAAY2B,KAItCC,GAAA;AAAA,MACF,GAAG,CAAC,KAEJA,GAAA;AAAA,IAEJ;AAAA,EACF,GAAG,CAACxB,GAAiBf,GAAiBC,GAAME,CAAW,CAAC,GAExD0B,EAAU,MACD,MAAM;AACX,IAAAD,EAAA,GACAD,EAAA;AAAA,EACF,GACC,CAAA,CAAE;AAEL,QAAMgB,IAAwC;AAAA,IAC5C,QAAAtF;AAAA,IACA,OAAAD;AAAA,IACA,GAAGwC;AAAA,EAAA;AAGL,UAAIO,KAAeqB,OACjBmB,EAAuB,WACrB/C,KAAA,QAAAA,EAAgB,YAAYA,EAAe,aAAa,WACpDA,EAAe,WACf,YACN+C,EAAuB,YAAY,+BAIlC,OAAA,EAAI,KAAKpC,IAAsB,WAAWV,GAAoB,OAAO8C,GACpE,UAAA;AAAA,IAAA,gBAAAC,EAAC,OAAA,EAAI,IAAA1F,GAAQ,WAAA4C,GAAsB,OAAO+C,GAAK9C,GAAO,CAAC,UAAU,OAAO,CAAC,GAAG;AAAA,IAC5E,gBAAA6C;AAAA,MAACE;AAAA,MAAA;AAAA,QACC,SAAStB;AAAA,QACT,SAASpB,GAAE,uBAAuB;AAAA,QAClC,cAAAqB;AAAA,MAAA;AAAA,IAAA;AAAA,sBAEDsB,IAAA,EAA0B,SAASxB,GAAyB,cAAAE,IAA4B;AAAA,EAAA,GAC3F;AAEJ,GAjRoB;"}
1
+ {"version":3,"file":"OwpTreeGrid.js","sources":["../../../src/components/OwpTreeGrid/OwpTreeGrid.tsx"],"sourcesContent":["import { useOwpTranslation } from '@/hooks/useOwpTranslation';\nimport { useGetCurrentLanguage } from '@/hooks/useCurrentLanguage';\nimport {\n TREE_GRID_BODY_ROWS_CHANGED_EVENT,\n type TreeGridBodyRowsChangedEventDetail,\n} from '@/utils/treeGridBodyRowsEvent';\nimport { debounce, delay, get, isEmpty, isEqual, omit } from 'es-toolkit/compat';\n// Temporary TreeGrid perf instrumentation import. Remove with ./perf after profiling is finished.\nimport {\n countTreeGridPerf,\n getTreeGridPerfTimestamp,\n logTreeGridPerf,\n measureTreeGridPerf,\n} from './perf';\nimport {\n type CSSProperties,\n type Dispatch,\n type RefObject,\n type SetStateAction,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n} from 'react';\nimport { useOwpTreeGridOverlayFrame } from './hooks/useOwpTreeGridOverlayFrame';\nimport { OwpTreeGridLoadingOverlay } from './OwpTreeGridLoadingOverlay';\nimport { OwpTreeGridNoDataOverlay } from './OwpTreeGridNoDataOverlay';\nimport { applyTreeGridLayoutToGrid } from './utils';\n\ntype TreeGridLayoutScalarValue = string | number;\ntype TreeGridNestedLayoutFields = Record<string, TreeGridLayoutScalarValue>;\ntype TreeGridLayoutFields = Record<string, TreeGridLayoutScalarValue | TreeGridNestedLayoutFields>;\ntype TreeGridSectionFields = Record<string, TreeGridLayoutScalarValue>;\n\nconst TREE_GRID_BINDING_LOADING_MIN_VISIBLE_MS = 300;\n\nexport interface OwpTreeGridLayout {\n Header?: TreeGridLayoutFields;\n Toolbar?: TreeGridSectionFields;\n Foot?: TreeGridSectionFields;\n}\n\nexport type OwpTreeGridLayoutConfig = OwpTreeGridLayout;\nexport type THeader = OwpTreeGridLayoutConfig;\nexport type OwpTreeGridBodyData<T> = Record<string, never> | [] | undefined | T[];\nexport type OwpTreeGridData<T> = OwpTreeGridBodyData<T>;\nexport type TData<T> = OwpTreeGridBodyData<T>;\nexport type OwpTreeGridRowModel<T> = TRow & T;\nexport type OwpTreeGridSelectedRows<T> = OwpTreeGridRowModel<T>[];\n\ntype OwpTreeGridSelectHandler<T> = (selectedRows: OwpTreeGridSelectedRows<T>) => void;\ntype OwpTreeGridRowAddHandler<T> = (grid: TGrid, row: OwpTreeGridRowModel<T>) => void;\ntype OwpTreeGridRowDeleteHandler<T> = (\n grid: TGrid,\n row: OwpTreeGridRowModel<T>,\n deleteType: number,\n) => void;\ntype OwpTreeGridRowUndeleteHandler<T> = (grid: TGrid, row: OwpTreeGridRowModel<T>) => void;\ntype OwpTreeGridButtonClickHandler<T> = (\n grid: TGrid,\n row: OwpTreeGridRowModel<T>,\n col: string,\n event: Event,\n) => void;\ntype OwpTreeGridRowClickHandler<T> = (\n grid: TGrid,\n row: OwpTreeGridRowModel<T>,\n col: string,\n x: number,\n y: number,\n event: Event,\n) => void;\ntype OwpTreeGridSaveHandler<T> = (\n grid: TGrid,\n row: OwpTreeGridRowModel<T>,\n autoupdate: boolean | number,\n) => void;\ntype OwpTreeGridCellValue = unknown;\ntype OwpTreeGridAfterValueChangedHandler<T> = (\n grid: TGrid,\n row: OwpTreeGridRowModel<T>,\n col: string,\n value: OwpTreeGridCellValue,\n) => void;\n\nexport interface OwpTreeGridProps<T> {\n id: string;\n className?: string;\n containerStyle?: CSSProperties;\n containerClassName?: string;\n layoutUrl?: string;\n dataUrl?: string;\n layoutOverrides?: OwpTreeGridLayoutConfig;\n data?: OwpTreeGridBodyData<T>;\n style?: CSSProperties;\n height?: string | number;\n width?: string | number;\n useDataUrl?: boolean;\n onSelect?: OwpTreeGridSelectHandler<T>;\n onRowAdd?: OwpTreeGridRowAddHandler<T>;\n onRowDelete?: OwpTreeGridRowDeleteHandler<T>;\n onRowUndelete?: OwpTreeGridRowUndeleteHandler<T>;\n onRowChange?: OwpTreeGridAfterValueChangedHandler<T>;\n onClickButton?: OwpTreeGridButtonClickHandler<T>;\n onReady?: (grid: TGrid) => void;\n onRowClick?: OwpTreeGridRowClickHandler<T>;\n onSave?: OwpTreeGridSaveHandler<T>;\n onAfterValueChanged?: OwpTreeGridAfterValueChangedHandler<T>;\n loading?: boolean;\n showLoading?: boolean;\n}\n\ntype TreeGridEventHandlers<T> = Pick<\n OwpTreeGridProps<T>,\n | 'onSelect'\n | 'onRowClick'\n | 'onRowAdd'\n | 'onRowDelete'\n | 'onRowUndelete'\n | 'onRowChange'\n | 'onClickButton'\n | 'onSave'\n | 'onReady'\n | 'onAfterValueChanged'\n>;\n\ntype TreeGridEventBindingOptions<T> = Pick<OwpTreeGridProps<T>, 'id'> & {\n latestEventHandlersRef: RefObject<TreeGridEventHandlers<T>>;\n treeGridInstanceRef: RefObject<TGrid>;\n treeGridInitStartedAtRef: RefObject<number | null>;\n latestLayoutOverridesRef: RefObject<OwpTreeGridLayoutConfig | undefined>;\n appliedLayoutOverridesRef: RefObject<OwpTreeGridLayoutConfig | undefined>;\n appliedBodyDataPropRef: RefObject<OwpTreeGridBodyData<T>>;\n hasAppliedInitialLayoutRef: RefObject<boolean>;\n syncHasDisplayDataRows: (grid: TGrid | null) => void;\n setIsTreeGridReady: Dispatch<SetStateAction<boolean>>;\n};\n\ntype TreeGridInitializationInput<T> = {\n id: string;\n layoutUrl?: string;\n dataUrl?: string;\n bodyData: OwpTreeGridBodyData<T>;\n useDataUrl?: boolean;\n width?: string | number;\n height?: string | number;\n languageId: string;\n};\n\nconst TREE_GRID_TEXT_RESOURCE_URLS = {\n en: '/assets/vendors/Grid/TextEN.xml',\n kr: '/assets/vendors/Grid/TextKR.xml',\n} as const;\n\nconst appendNoCacheQuery = (url: string) => {\n return `${url}?noCache=${Date.now()}`;\n};\n\nconst getTreeGridTextResourceUrl = (languageId: string) => {\n return languageId === 'kr' ? TREE_GRID_TEXT_RESOURCE_URLS.kr : TREE_GRID_TEXT_RESOURCE_URLS.en;\n};\n\nconst resolveTreeGridDataUrl = (dataUrl?: string) => {\n return dataUrl?.includes('assets')\n ? appendNoCacheQuery(dataUrl)\n : // @ts-expect-error - API base URL env is provided by host app\n `${import.meta.env.VITE_API_BASE_URL}/${dataUrl}?noCache=${Date.now()}`;\n};\n\nconst buildTreeGridDataSource = <T,>(\n useDataUrl: boolean | undefined,\n dataUrl: string | undefined,\n bodyData: OwpTreeGridBodyData<T>,\n) => {\n if (useDataUrl) {\n return { Url: resolveTreeGridDataUrl(dataUrl) };\n }\n\n return { Data: { Body: [isEmpty(bodyData) ? [] : bodyData] } };\n};\n\nconst buildTreeGridInitializationOptions = <T,>({\n id,\n layoutUrl,\n dataUrl,\n bodyData,\n useDataUrl,\n width,\n height,\n languageId,\n}: TreeGridInitializationInput<T>) => {\n return {\n id,\n Layout: { Url: appendNoCacheQuery(layoutUrl ?? '') },\n Data: buildTreeGridDataSource(useDataUrl, dataUrl, bodyData),\n Text: {\n Url: getTreeGridTextResourceUrl(languageId),\n },\n width,\n height,\n Debug: 'Error',\n };\n};\n\nconst getTreeGridBodyData = (grid: TGrid | null) => {\n return get(grid, 'Data.Data.Data.Body.0');\n};\n\nconst getTreeGridBodyDataCount = <T,>(bodyData: OwpTreeGridBodyData<T>) => {\n return Array.isArray(bodyData) ? bodyData.length : 0;\n};\n\nconst isVisibleTreeGridRow = (row: TRow | null | undefined) => {\n const visible = (row as { Visible?: unknown } | null)?.Visible;\n\n return !!row && visible !== 0 && visible !== false && visible !== '0';\n};\n\n/**\n * TreeGrid 추가 행 여부\n * @param row TreeGrid 행\n */\nconst isAddedTreeGridRow = (row: TRow | null | undefined) => {\n const added = (row as { Added?: unknown } | null)?.Added;\n\n return !!row && added !== 0 && added !== false && added !== '0' && added !== undefined;\n};\n\n/**\n * TreeGrid 본문 표시 행 여부\n * @param row TreeGrid 행\n */\nconst isDisplayTreeGridRow = (row: TRow | null | undefined) => {\n if (!row || row.Fixed === 'Foot' || !isVisibleTreeGridRow(row)) {\n return false;\n }\n\n return row.Kind === 'Data' || isAddedTreeGridRow(row);\n};\n\n/**\n * TreeGrid 표시 데이터 행 존재 여부\n * @param grid TreeGrid 인스턴스\n */\nconst hasTreeGridDisplayDataRows = (grid: TGrid | null) => {\n if (!grid) {\n return false;\n }\n\n if (typeof grid.GetFirst === 'function' && typeof grid.GetNext === 'function') {\n let row = grid.GetFirst();\n\n while (row) {\n if (isDisplayTreeGridRow(row)) {\n return true;\n }\n\n row = grid.GetNext(row);\n }\n\n return false;\n }\n\n return Object.values(grid.Rows ?? {}).some((row) => {\n return isDisplayTreeGridRow(row);\n });\n};\n\nconst replaceTreeGridBodyData = <T,>(\n grid: TGrid,\n bodyData: OwpTreeGridBodyData<T>,\n onReloadFinish?: (code: number) => void,\n) => {\n // @ts-expect-error - TreeGrid Data.Data shape is not reflected in bundled types\n const currentDataConfig = grid.Data?.Data;\n\n // @ts-expect-error - TreeGrid Data.Data shape is not reflected in bundled types\n grid.Data.Data = {\n ...currentDataConfig,\n Data: { Body: [bodyData || []] },\n Url: '',\n };\n\n grid.ReloadBody(onReloadFinish);\n};\n\nconst bindTreeGridEvents = <T,>({\n id,\n latestEventHandlersRef,\n treeGridInstanceRef,\n treeGridInitStartedAtRef,\n latestLayoutOverridesRef,\n appliedLayoutOverridesRef,\n appliedBodyDataPropRef,\n hasAppliedInitialLayoutRef,\n syncHasDisplayDataRows,\n setIsTreeGridReady,\n}: TreeGridEventBindingOptions<T>) => {\n const initialEventHandlers = latestEventHandlersRef.current;\n\n window.TGSetEvent('OnRowAdd', id, (grid, row) => {\n row.CanEdit = 1;\n row.CanDelete = 1;\n\n latestEventHandlersRef.current?.onRowAdd?.(grid, row as OwpTreeGridRowModel<T>);\n });\n window.TGSetEvent('OnRowAdded', id, (grid) => {\n syncHasDisplayDataRows(grid);\n });\n\n if (typeof initialEventHandlers?.onRowClick === 'function') {\n window.TGSetEvent(\n 'OnClick',\n id,\n debounce((grid, row, col, x, y, event) => {\n latestEventHandlersRef.current?.onRowClick?.(\n grid,\n row as OwpTreeGridRowModel<T>,\n col,\n x,\n y,\n event,\n );\n }, 300),\n );\n }\n\n if (typeof initialEventHandlers?.onClickButton === 'function') {\n window.TGSetEvent(\n 'OnClickButton',\n id,\n debounce((grid, row, col, event) => {\n latestEventHandlersRef.current?.onClickButton?.(\n grid,\n row as OwpTreeGridRowModel<T>,\n col,\n event,\n );\n }, 300),\n );\n }\n\n if (typeof initialEventHandlers?.onRowDelete === 'function') {\n window.TGSetEvent('OnRowDelete', id, (grid, row, deleteType) => {\n syncHasDisplayDataRows(grid);\n latestEventHandlersRef.current?.onRowDelete?.(\n grid,\n row as OwpTreeGridRowModel<T>,\n deleteType,\n );\n });\n } else {\n window.TGSetEvent('OnRowDelete', id, (grid) => {\n syncHasDisplayDataRows(grid);\n });\n }\n if (typeof initialEventHandlers?.onRowUndelete === 'function') {\n window.TGSetEvent('OnRowUndelete', id, (grid, row) => {\n syncHasDisplayDataRows(grid);\n latestEventHandlersRef.current?.onRowUndelete?.(grid, row as OwpTreeGridRowModel<T>);\n });\n } else {\n window.TGSetEvent('OnRowUndelete', id, (grid) => {\n syncHasDisplayDataRows(grid);\n });\n }\n if (\n typeof initialEventHandlers?.onAfterValueChanged === 'function' ||\n typeof initialEventHandlers?.onRowChange === 'function'\n ) {\n window.TGSetEvent('OnAfterValueChanged', id, (grid, row, col, value) => {\n const valueChangedHandler =\n latestEventHandlersRef.current?.onAfterValueChanged ??\n latestEventHandlersRef.current?.onRowChange;\n\n valueChangedHandler?.(grid, row as OwpTreeGridRowModel<T>, col, value);\n });\n }\n if (typeof initialEventHandlers?.onSelect === 'function') {\n window.TGSetEvent(\n 'OnSelect',\n id,\n debounce((grid) => {\n const selectedRows = (grid.GetSelRows() ?? []) as OwpTreeGridSelectedRows<T>;\n latestEventHandlersRef.current?.onSelect?.(selectedRows);\n }, 100),\n );\n }\n if (typeof initialEventHandlers?.onSave === 'function') {\n window.TGSetEvent('OnSave', id, (grid, row, autoupdate) => {\n latestEventHandlersRef.current?.onSave?.(\n grid,\n row as OwpTreeGridRowModel<T>,\n autoupdate,\n );\n });\n }\n\n window.TGSetEvent(\n 'OnReady',\n id,\n debounce((grid) => {\n if (!hasAppliedInitialLayoutRef.current) {\n const latestLayoutOverrides = latestLayoutOverridesRef.current;\n\n hasAppliedInitialLayoutRef.current = true;\n applyTreeGridLayoutToGrid(grid, latestLayoutOverrides);\n treeGridInstanceRef.current = grid;\n appliedLayoutOverridesRef.current = latestLayoutOverrides;\n appliedBodyDataPropRef.current = getTreeGridBodyData(grid) as OwpTreeGridBodyData<T>;\n syncHasDisplayDataRows(grid);\n setIsTreeGridReady(true);\n measureTreeGridPerf(id, 'TreeGrid init ready', treeGridInitStartedAtRef.current, {\n bodyRowCount: getTreeGridBodyDataCount(\n getTreeGridBodyData(grid) as OwpTreeGridBodyData<T>,\n ),\n });\n treeGridInitStartedAtRef.current = null;\n latestEventHandlersRef.current?.onReady?.(grid);\n }\n }, 100),\n );\n};\n\n/**\n * OwpTreeGrid 컴포넌트\n * @param id 식별자\n * @param containerStyle containerStyle 값\n * @param containerClassName containerClassName 값\n * @param className CSS 클래스명\n * @param style 스타일 객체\n * @param height height 값\n */\nconst OwpTreeGrid = <T,>({\n id = 'treeGridWrapper',\n containerStyle,\n containerClassName,\n className,\n style,\n height = '100%',\n width = '100%',\n layoutUrl,\n dataUrl,\n layoutOverrides,\n data,\n useDataUrl,\n onSelect,\n onRowClick,\n onRowAdd,\n onRowDelete,\n onRowUndelete,\n onRowChange,\n onClickButton,\n onSave,\n onReady,\n onAfterValueChanged,\n loading,\n showLoading = true,\n}: OwpTreeGridProps<T>) => {\n const { t } = useOwpTranslation();\n const treeGridInstanceRef = useRef<TGrid>(null);\n const treeGridContainerRef = useRef<HTMLDivElement | null>(null);\n const treeGridInitStartedAtRef = useRef<number | null>(null);\n const bodyReloadStartedAtRef = useRef<number | null>(null);\n const latestLayoutOverridesRef = useRef<OwpTreeGridLayoutConfig | undefined>(layoutOverrides);\n const latestBodyDataPropRef = useRef<OwpTreeGridBodyData<T>>(data);\n const latestEventHandlersRef = useRef<TreeGridEventHandlers<T>>({\n onSelect,\n onRowClick,\n onRowAdd,\n onRowDelete,\n onRowUndelete,\n onRowChange,\n onClickButton,\n onSave,\n onReady,\n onAfterValueChanged,\n });\n const stagedBodyDataPropRef = useRef<OwpTreeGridBodyData<T>>(undefined);\n const hasStagedBodyDataPropRef = useRef(false);\n const appliedLayoutOverridesRef = useRef<OwpTreeGridLayoutConfig | undefined>(undefined);\n const appliedBodyDataPropRef = useRef<OwpTreeGridBodyData<T>>(undefined);\n const hasAppliedInitialLayoutRef = useRef(false);\n const bodyReloadSequenceRef = useRef(0);\n const bindingLoadingStartedAtRef = useRef<number | null>(null);\n const bindingLoadingHideTimeoutRef = useRef<number | undefined>(undefined);\n const bodyReloadStartTimeoutRef = useRef<number | undefined>(undefined);\n const [isTreeGridReady, setIsTreeGridReady] = useState(false);\n const [isBindingLoadingVisible, setIsBindingLoadingVisible] = useState(false);\n const [hasDisplayDataRows, setHasDisplayDataRows] = useState(false);\n const currentLanguage = useGetCurrentLanguage();\n const currentLanguageIdRef = useRef(currentLanguage.id);\n const isPendingBodyReload =\n showLoading &&\n data !== undefined &&\n isTreeGridReady &&\n appliedBodyDataPropRef.current !== data;\n const isInternalLoadingVisible = showLoading && (isBindingLoadingVisible || isPendingBodyReload);\n const isLoadingOverlayVisible = (showLoading && loading === true) || isInternalLoadingVisible;\n const isNoDataVisible =\n !isLoadingOverlayVisible && data !== undefined && isEmpty(data) && !hasDisplayDataRows;\n\n const syncHasDisplayDataRows = (grid: TGrid | null) => {\n setHasDisplayDataRows(hasTreeGridDisplayDataRows(grid));\n };\n\n latestLayoutOverridesRef.current = layoutOverrides;\n latestBodyDataPropRef.current = data;\n latestEventHandlersRef.current = {\n onSelect,\n onRowClick,\n onRowAdd,\n onRowDelete,\n onRowUndelete,\n onRowChange,\n onClickButton,\n onSave,\n onReady,\n onAfterValueChanged,\n };\n\n const overlayFrame = useOwpTreeGridOverlayFrame({\n visible: isLoadingOverlayVisible || isNoDataVisible,\n containerRef: treeGridContainerRef,\n treeGridInstanceRef,\n debugId: id,\n });\n\n const clearBindingLoadingHideTimeout = () => {\n if (bindingLoadingHideTimeoutRef.current !== undefined) {\n window.clearTimeout(bindingLoadingHideTimeoutRef.current);\n bindingLoadingHideTimeoutRef.current = undefined;\n }\n };\n\n const clearBodyReloadStartTimeout = () => {\n if (bodyReloadStartTimeoutRef.current !== undefined) {\n window.clearTimeout(bodyReloadStartTimeoutRef.current);\n bodyReloadStartTimeoutRef.current = undefined;\n }\n };\n\n useEffect(() => {\n const handleBodyRowsChanged = (event: Event) => {\n const customEvent = event as CustomEvent<TreeGridBodyRowsChangedEventDetail>;\n\n if (customEvent.detail?.gridId !== id) {\n return;\n }\n\n setHasDisplayDataRows(hasTreeGridDisplayDataRows(treeGridInstanceRef.current));\n };\n\n window.addEventListener(TREE_GRID_BODY_ROWS_CHANGED_EVENT, handleBodyRowsChanged);\n\n return () => {\n window.removeEventListener(TREE_GRID_BODY_ROWS_CHANGED_EVENT, handleBodyRowsChanged);\n };\n }, [id]);\n\n useEffect(() => {\n if (!showLoading) {\n clearBodyReloadStartTimeout();\n clearBindingLoadingHideTimeout();\n bindingLoadingStartedAtRef.current = null;\n setIsBindingLoadingVisible(false);\n }\n }, [showLoading]);\n\n useEffect(() => {\n if (\n currentLanguage.id !== currentLanguageIdRef.current &&\n !isEmpty(treeGridInstanceRef.current)\n ) {\n treeGridInstanceRef.current?.Dispose();\n treeGridInstanceRef.current = null;\n currentLanguageIdRef.current = currentLanguage.id;\n }\n\n if (!isEmpty(treeGridInstanceRef.current)) {\n return;\n }\n\n bindTreeGridEvents({\n id,\n latestEventHandlersRef,\n treeGridInstanceRef,\n treeGridInitStartedAtRef,\n latestLayoutOverridesRef,\n appliedLayoutOverridesRef,\n appliedBodyDataPropRef,\n hasAppliedInitialLayoutRef,\n syncHasDisplayDataRows,\n setIsTreeGridReady,\n });\n\n treeGridInitStartedAtRef.current = getTreeGridPerfTimestamp();\n countTreeGridPerf(id, 'init');\n logTreeGridPerf(id, 'TreeGrid init start', {\n useDataUrl: Boolean(useDataUrl),\n bodyRowCount: getTreeGridBodyDataCount(data),\n });\n\n window.TreeGrid(\n buildTreeGridInitializationOptions({\n id,\n layoutUrl,\n dataUrl,\n bodyData: data,\n useDataUrl,\n width,\n height,\n languageId: currentLanguage.id,\n }),\n id,\n id,\n );\n\n return () => {\n delay(() => {\n treeGridInstanceRef.current?.Dispose();\n }, 200);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useLayoutEffect(() => {\n const treeGrid = treeGridInstanceRef.current;\n const nextLayoutOverrides = latestLayoutOverridesRef.current;\n const nextBodyData = latestBodyDataPropRef.current;\n\n if (isEmpty(treeGrid) || !isTreeGridReady) {\n return;\n }\n\n const shouldApplyLayoutOverrides =\n appliedLayoutOverridesRef.current !== nextLayoutOverrides &&\n !isEqual(appliedLayoutOverridesRef.current, nextLayoutOverrides);\n const shouldApplyBodyData =\n appliedBodyDataPropRef.current !== nextBodyData &&\n (!hasStagedBodyDataPropRef.current || stagedBodyDataPropRef.current !== nextBodyData);\n\n if (!shouldApplyLayoutOverrides && !shouldApplyBodyData) {\n return;\n }\n\n if (shouldApplyLayoutOverrides) {\n const layoutApplyStartedAt = getTreeGridPerfTimestamp();\n\n applyTreeGridLayoutToGrid(treeGrid, nextLayoutOverrides, shouldApplyBodyData);\n appliedLayoutOverridesRef.current = nextLayoutOverrides;\n measureTreeGridPerf(id, 'apply layout', layoutApplyStartedAt, {\n disableBodyReload: Boolean(shouldApplyBodyData),\n });\n }\n\n if (shouldApplyBodyData) {\n const reloadSequence = bodyReloadSequenceRef.current + 1;\n const runBodyReload = () => {\n const bodyDataToApply = stagedBodyDataPropRef.current;\n\n bodyReloadStartTimeoutRef.current = undefined;\n bodyReloadStartedAtRef.current = getTreeGridPerfTimestamp();\n countTreeGridPerf(id, 'reload');\n logTreeGridPerf(id, 'ReloadBody start', {\n bodyRowCount: getTreeGridBodyDataCount(bodyDataToApply),\n });\n\n replaceTreeGridBodyData(treeGrid, bodyDataToApply, () => {\n if (bodyReloadSequenceRef.current !== reloadSequence) {\n return;\n }\n\n appliedBodyDataPropRef.current = bodyDataToApply;\n syncHasDisplayDataRows(treeGrid);\n measureTreeGridPerf(id, 'ReloadBody end', bodyReloadStartedAtRef.current, {\n bodyRowCount: getTreeGridBodyDataCount(bodyDataToApply),\n });\n bodyReloadStartedAtRef.current = null;\n\n if (stagedBodyDataPropRef.current === bodyDataToApply) {\n stagedBodyDataPropRef.current = undefined;\n hasStagedBodyDataPropRef.current = false;\n }\n\n const startedAt = bindingLoadingStartedAtRef.current;\n\n if (!showLoading || startedAt === null) {\n bindingLoadingStartedAtRef.current = null;\n setIsBindingLoadingVisible(false);\n return;\n }\n\n const remainingVisibleTime = Math.max(\n 0,\n TREE_GRID_BINDING_LOADING_MIN_VISIBLE_MS - (Date.now() - startedAt),\n );\n\n clearBindingLoadingHideTimeout();\n\n if (remainingVisibleTime === 0) {\n bindingLoadingStartedAtRef.current = null;\n setIsBindingLoadingVisible(false);\n return;\n }\n\n bindingLoadingHideTimeoutRef.current = window.setTimeout(() => {\n if (bodyReloadSequenceRef.current !== reloadSequence) {\n return;\n }\n\n bindingLoadingHideTimeoutRef.current = undefined;\n bindingLoadingStartedAtRef.current = null;\n setIsBindingLoadingVisible(false);\n }, remainingVisibleTime);\n });\n };\n\n bodyReloadSequenceRef.current = reloadSequence;\n stagedBodyDataPropRef.current = nextBodyData;\n hasStagedBodyDataPropRef.current = true;\n\n if (showLoading && nextBodyData !== undefined) {\n clearBodyReloadStartTimeout();\n clearBindingLoadingHideTimeout();\n bindingLoadingStartedAtRef.current = Date.now();\n setIsBindingLoadingVisible(true);\n bodyReloadStartTimeoutRef.current = window.setTimeout(() => {\n if (bodyReloadSequenceRef.current !== reloadSequence) {\n return;\n }\n\n runBodyReload();\n }, 0);\n } else {\n runBodyReload();\n }\n }\n }, [isTreeGridReady, layoutOverrides, data, showLoading, id]);\n\n useEffect(() => {\n return () => {\n clearBodyReloadStartTimeout();\n clearBindingLoadingHideTimeout();\n };\n }, []);\n\n const resolvedContainerStyle: CSSProperties = {\n height,\n width,\n ...containerStyle,\n };\n\n if (showLoading || isNoDataVisible) {\n resolvedContainerStyle.position =\n containerStyle?.position && containerStyle.position !== 'static'\n ? containerStyle.position\n : 'relative';\n resolvedContainerStyle.isolation = 'isolate';\n }\n\n return (\n <div ref={treeGridContainerRef} className={containerClassName} style={resolvedContainerStyle}>\n <div id={id} className={className} style={omit(style, ['height', 'width'])} />\n <OwpTreeGridNoDataOverlay\n visible={isNoDataVisible}\n message={t('Message.조회된 결과가 없습니다.')}\n overlayFrame={overlayFrame}\n />\n <OwpTreeGridLoadingOverlay visible={isLoadingOverlayVisible} overlayFrame={overlayFrame} />\n </div>\n );\n};\n\nexport { OwpTreeGrid };\n"],"names":["TREE_GRID_BINDING_LOADING_MIN_VISIBLE_MS","TREE_GRID_TEXT_RESOURCE_URLS","appendNoCacheQuery","__name","url","getTreeGridTextResourceUrl","languageId","resolveTreeGridDataUrl","dataUrl","buildTreeGridDataSource","useDataUrl","bodyData","isEmpty","buildTreeGridInitializationOptions","id","layoutUrl","width","height","getTreeGridBodyData","grid","get","getTreeGridBodyDataCount","isVisibleTreeGridRow","row","visible","isAddedTreeGridRow","added","isDisplayTreeGridRow","hasTreeGridDisplayDataRows","replaceTreeGridBodyData","onReloadFinish","currentDataConfig","_a","bindTreeGridEvents","latestEventHandlersRef","treeGridInstanceRef","treeGridInitStartedAtRef","latestLayoutOverridesRef","appliedLayoutOverridesRef","appliedBodyDataPropRef","hasAppliedInitialLayoutRef","syncHasDisplayDataRows","setIsTreeGridReady","initialEventHandlers","_b","debounce","col","x","y","event","deleteType","value","valueChangedHandler","selectedRows","autoupdate","latestLayoutOverrides","applyTreeGridLayoutToGrid","measureTreeGridPerf","OwpTreeGrid","containerStyle","containerClassName","className","style","layoutOverrides","data","onSelect","onRowClick","onRowAdd","onRowDelete","onRowUndelete","onRowChange","onClickButton","onSave","onReady","onAfterValueChanged","loading","showLoading","t","useOwpTranslation","useRef","treeGridContainerRef","bodyReloadStartedAtRef","latestBodyDataPropRef","stagedBodyDataPropRef","hasStagedBodyDataPropRef","bodyReloadSequenceRef","bindingLoadingStartedAtRef","bindingLoadingHideTimeoutRef","bodyReloadStartTimeoutRef","isTreeGridReady","useState","isBindingLoadingVisible","setIsBindingLoadingVisible","hasDisplayDataRows","setHasDisplayDataRows","currentLanguage","useGetCurrentLanguage","currentLanguageIdRef","isPendingBodyReload","isLoadingOverlayVisible","isNoDataVisible","overlayFrame","useOwpTreeGridOverlayFrame","clearBindingLoadingHideTimeout","clearBodyReloadStartTimeout","useEffect","handleBodyRowsChanged","TREE_GRID_BODY_ROWS_CHANGED_EVENT","getTreeGridPerfTimestamp","countTreeGridPerf","logTreeGridPerf","delay","useLayoutEffect","treeGrid","nextLayoutOverrides","nextBodyData","shouldApplyLayoutOverrides","isEqual","shouldApplyBodyData","layoutApplyStartedAt","reloadSequence","runBodyReload","bodyDataToApply","startedAt","remainingVisibleTime","resolvedContainerStyle","jsx","omit","OwpTreeGridNoDataOverlay","OwpTreeGridLoadingOverlay"],"mappings":";;;;;;;;;;;;;;;;;;AAkCA,MAAMA,KAA2C,KAmH3CC,KAA+B;AAAA,EACnC,IAAI;AAAA,EACJ,IAAI;AACN,GAEMC,KAAqB,gBAAAC,EAAA,CAACC,MACnB,GAAGA,CAAG,YAAY,KAAK,KAAK,IADV,uBAIrBC,KAA6B,gBAAAF,EAAA,CAACG,MAC3BA,MAAe,OAAOL,GAA6B,KAAKA,GAA6B,IAD3D,+BAI7BM,KAAyB,gBAAAJ,EAAA,CAACK,MACvBA,KAAA,QAAAA,EAAS,SAAS,YACrBN,GAAmBM,CAAO;AAAA;AAAA,EAE1B,aAAwCA,CAAO,YAAY,KAAK,KAAK;AAAA,GAJ5C,2BAOzBC,KAA0B,gBAAAN,EAAA,CAC9BO,GACAF,GACAG,MAEID,IACK,EAAE,KAAKH,GAAuBC,CAAO,EAAA,IAGvC,EAAE,MAAM,EAAE,MAAM,CAACI,EAAQD,CAAQ,IAAI,CAAA,IAAKA,CAAQ,IAAE,GAT7B,4BAY1BE,KAAqC,gBAAAV,EAAA,CAAK;AAAA,EAC9C,IAAAW;AAAA,EACA,WAAAC;AAAA,EACA,SAAAP;AAAA,EACA,UAAAG;AAAA,EACA,YAAAD;AAAA,EACA,OAAAM;AAAA,EACA,QAAAC;AAAA,EACA,YAAAX;AACF,OACS;AAAA,EACL,IAAAQ;AAAA,EACA,QAAQ,EAAE,KAAKZ,GAAmBa,KAAa,EAAE,EAAA;AAAA,EAC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AA;AAAA,EACF,GAAG,CAAChC,GAAiB1B,GAAiBC,GAAMY,GAAa9D,CAAE,CAAC,GAE5D2F,EAAU,MACD,MAAM;AACX,IAAAD,EAAA,GACAD,EAAA;AAAA,EACF,GACC,CAAA,CAAE;AAEL,QAAMsB,IAAwC;AAAA,IAC5C,QAAA5G;AAAA,IACA,OAAAD;AAAA,IACA,GAAG2C;AAAA,EAAA;AAGL,UAAIiB,KAAewB,OACjByB,EAAuB,WACrBlE,KAAA,QAAAA,EAAgB,YAAYA,EAAe,aAAa,WACpDA,EAAe,WACf,YACNkE,EAAuB,YAAY,+BAIlC,OAAA,EAAI,KAAK7C,IAAsB,WAAWpB,GAAoB,OAAOiE,GACpE,UAAA;AAAA,IAAA,gBAAAC,EAAC,OAAA,EAAI,IAAAhH,GAAQ,WAAA+C,GAAsB,OAAOkE,GAAKjE,GAAO,CAAC,UAAU,OAAO,CAAC,GAAG;AAAA,IAC5E,gBAAAgE;AAAA,MAACE;AAAA,MAAA;AAAA,QACC,SAAS5B;AAAA,QACT,SAASvB,GAAE,uBAAuB;AAAA,QAClC,cAAAwB;AAAA,MAAA;AAAA,IAAA;AAAA,sBAED4B,IAAA,EAA0B,SAAS9B,GAAyB,cAAAE,IAA4B;AAAA,EAAA,GAC3F;AAEJ,GAnVoB;"}
@@ -1,84 +1,86 @@
1
- var O = Object.defineProperty;
2
- var l = (i, o) => O(i, "name", { value: o, configurable: !0 });
3
- import { useState as R, useLayoutEffect as y } from "react";
4
- import { isEqual as E } from "../../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/predicate/isEqual.js";
5
- const T = 2147483646, D = 2147483647, g = /* @__PURE__ */ l((i, o) => {
6
- const c = (o == null ? void 0 : o.MainTag) ?? i, a = Array.from(
7
- c.querySelectorAll("table.TSMainTable")
1
+ var A = Object.defineProperty;
2
+ var l = (i, o) => A(i, "name", { value: o, configurable: !0 });
3
+ import { useState as g, useLayoutEffect as _ } from "react";
4
+ import { countTreeGridPerf as O, isTreeGridPerfEnabled as b, getTreeGridPerfTimestamp as F, measureTreeGridPerf as G } from "../perf.js";
5
+ import { isEqual as L } from "../../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/predicate/isEqual.js";
6
+ const N = 2147483646, P = 2147483647, R = /* @__PURE__ */ l((i, o) => {
7
+ const r = (o == null ? void 0 : o.MainTag) ?? i, a = Array.from(
8
+ r.querySelectorAll("table.TSMainTable")
8
9
  );
9
- return (a.length > 0 ? a : Array.from(c.querySelectorAll("table"))).reduce((e, t) => {
10
- const n = t.getBoundingClientRect(), d = e == null ? void 0 : e.getBoundingClientRect();
11
- return n.width <= 0 || n.height <= 0 ? e : d ? n.width * n.height > d.width * d.height ? t : e : t;
10
+ return (a.length > 0 ? a : Array.from(r.querySelectorAll("table"))).reduce((e, s) => {
11
+ const t = s.getBoundingClientRect(), n = e == null ? void 0 : e.getBoundingClientRect();
12
+ return t.width <= 0 || t.height <= 0 ? e : n ? t.width * t.height > n.width * n.height ? s : e : s;
12
13
  }, null);
13
- }, "getTreeGridMainTableElement"), A = /* @__PURE__ */ l((i, o) => {
14
- const s = i.getBoundingClientRect(), c = i.clientWidth || s.width, a = i.clientHeight || s.height, r = g(i, o);
15
- if (!r)
14
+ }, "getTreeGridMainTableElement"), D = /* @__PURE__ */ l((i, o) => {
15
+ const c = i.getBoundingClientRect(), r = i.clientWidth || c.width, a = i.clientHeight || c.height, h = R(i, o);
16
+ if (!h)
16
17
  return {
17
18
  left: 0,
18
19
  top: 0,
19
- width: c,
20
+ width: r,
20
21
  height: a
21
22
  };
22
- const e = r.getBoundingClientRect();
23
+ const e = h.getBoundingClientRect();
23
24
  return e.width <= 0 || e.height <= 0 ? {
24
25
  left: 0,
25
26
  top: 0,
26
- width: c,
27
+ width: r,
27
28
  height: a
28
29
  } : {
29
- left: e.left - s.left,
30
- top: e.top - s.top,
30
+ left: e.left - c.left,
31
+ top: e.top - c.top,
31
32
  width: e.width,
32
33
  height: e.height
33
34
  };
34
- }, "getTreeGridOverlayFrame"), G = /* @__PURE__ */ l(({
35
+ }, "getTreeGridOverlayFrame"), S = /* @__PURE__ */ l(({
35
36
  visible: i,
36
37
  containerRef: o,
37
- treeGridInstanceRef: s
38
+ treeGridInstanceRef: c,
39
+ debugId: r
38
40
  }) => {
39
- const [c, a] = R({
41
+ const [a, h] = g({
40
42
  left: 0,
41
43
  top: 0,
42
44
  width: 0,
43
45
  height: 0
44
46
  });
45
- return y(() => {
47
+ return _(() => {
46
48
  if (!i)
47
49
  return;
48
- const r = o.current;
49
- if (!r)
50
+ const e = o.current;
51
+ if (!e)
50
52
  return;
51
- let e, t, n = null;
52
- const d = { capture: !0 }, b = /* @__PURE__ */ l((h) => {
53
- if (!t || n === h) {
54
- n = h;
53
+ let s, t, n = null;
54
+ const f = { capture: !0 }, T = /* @__PURE__ */ l((d) => {
55
+ if (!t || n === d) {
56
+ n = d;
55
57
  return;
56
58
  }
57
- n && t.unobserve(n), n = h, n && t.observe(n);
58
- }, "syncObservedMainTableElement"), f = /* @__PURE__ */ l(() => {
59
- const h = s.current, p = g(r, h), v = A(r, h);
60
- b(p), a(
61
- (w) => E(w, v) ? w : v
62
- );
59
+ n && t.unobserve(n), n = d, n && t.observe(n);
60
+ }, "syncObservedMainTableElement"), m = /* @__PURE__ */ l(() => {
61
+ const d = r && b() ? F() : null, w = c.current, E = R(e, w), p = D(e, w);
62
+ r && O(r, "overlay update"), T(E), h(
63
+ (y) => L(y, p) ? y : p
64
+ ), r && G(r, "overlay update end", d);
63
65
  }, "updateOverlayFrame"), u = /* @__PURE__ */ l(() => {
64
- e !== void 0 && window.cancelAnimationFrame(e), e = window.requestAnimationFrame(() => {
65
- e = void 0, f();
66
+ r && O(r, "overlay schedule"), s !== void 0 && window.cancelAnimationFrame(s), s = window.requestAnimationFrame(() => {
67
+ s = void 0, m();
66
68
  });
67
69
  }, "scheduleOverlayFrameUpdate");
68
- typeof ResizeObserver < "u" && (t = new ResizeObserver(u), t.observe(r));
69
- const m = new MutationObserver(u);
70
- return m.observe(r, { childList: !0, subtree: !0 }), window.addEventListener("resize", u), r.addEventListener("scroll", u, d), f(), () => {
71
- e !== void 0 && window.cancelAnimationFrame(e), window.removeEventListener("resize", u), r.removeEventListener(
70
+ typeof ResizeObserver < "u" && (t = new ResizeObserver(u), t.observe(e));
71
+ const v = new MutationObserver(u);
72
+ return v.observe(e, { childList: !0, subtree: !0 }), window.addEventListener("resize", u), e.addEventListener("scroll", u, f), m(), () => {
73
+ s !== void 0 && window.cancelAnimationFrame(s), window.removeEventListener("resize", u), e.removeEventListener(
72
74
  "scroll",
73
75
  u,
74
- d
75
- ), m.disconnect(), t && n && t.unobserve(n), t == null || t.disconnect();
76
+ f
77
+ ), v.disconnect(), t && n && t.unobserve(n), t == null || t.disconnect();
76
78
  };
77
- }, [o, s, i]), c;
79
+ }, [o, c, i, r]), a;
78
80
  }, "useOwpTreeGridOverlayFrame");
79
81
  export {
80
- D as TREE_GRID_LOADING_OVERLAY_Z_INDEX,
81
- T as TREE_GRID_NO_DATA_OVERLAY_Z_INDEX,
82
- G as useOwpTreeGridOverlayFrame
82
+ P as TREE_GRID_LOADING_OVERLAY_Z_INDEX,
83
+ N as TREE_GRID_NO_DATA_OVERLAY_Z_INDEX,
84
+ S as useOwpTreeGridOverlayFrame
83
85
  };
84
86
  //# sourceMappingURL=useOwpTreeGridOverlayFrame.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useOwpTreeGridOverlayFrame.js","sources":["../../../../src/components/OwpTreeGrid/hooks/useOwpTreeGridOverlayFrame.ts"],"sourcesContent":["import { isEqual } from 'es-toolkit/compat';\nimport { type RefObject, useLayoutEffect, useState } from 'react';\n\nexport type OwpTreeGridOverlayFrame = {\n left: number;\n top: number;\n width: number;\n height: number;\n};\n\ntype UseOwpTreeGridOverlayFrameInput = {\n visible: boolean;\n containerRef: RefObject<HTMLDivElement | null>;\n treeGridInstanceRef: RefObject<TGrid>;\n};\n\nexport const TREE_GRID_NO_DATA_OVERLAY_Z_INDEX = 2147483646;\nexport const TREE_GRID_LOADING_OVERLAY_Z_INDEX = 2147483647;\n\nconst getTreeGridMainTableElement = (containerElement: HTMLDivElement, grid: TGrid | null) => {\n const mainTagElement = grid?.MainTag as HTMLElement | null | undefined;\n const scopedRootElement = mainTagElement ?? containerElement;\n const mainTableElements = Array.from(\n scopedRootElement.querySelectorAll<HTMLTableElement>('table.TSMainTable'),\n );\n\n const tableElements =\n mainTableElements.length > 0\n ? mainTableElements\n : Array.from(scopedRootElement.querySelectorAll<HTMLTableElement>('table'));\n\n return tableElements.reduce<HTMLTableElement | null>((largestTableElement, tableElement) => {\n const tableRect = tableElement.getBoundingClientRect();\n const largestTableRect = largestTableElement?.getBoundingClientRect();\n\n if (tableRect.width <= 0 || tableRect.height <= 0) {\n return largestTableElement;\n }\n\n if (!largestTableRect) {\n return tableElement;\n }\n\n return tableRect.width * tableRect.height > largestTableRect.width * largestTableRect.height\n ? tableElement\n : largestTableElement;\n }, null);\n};\n\nconst getTreeGridOverlayFrame = (\n containerElement: HTMLDivElement,\n grid: TGrid | null,\n): OwpTreeGridOverlayFrame => {\n const containerRect = containerElement.getBoundingClientRect();\n const fallbackWidth = containerElement.clientWidth || containerRect.width;\n const fallbackHeight = containerElement.clientHeight || containerRect.height;\n const mainTableElement = getTreeGridMainTableElement(containerElement, grid);\n\n if (!mainTableElement) {\n return {\n left: 0,\n top: 0,\n width: fallbackWidth,\n height: fallbackHeight,\n };\n }\n\n const tableRect = mainTableElement.getBoundingClientRect();\n\n if (tableRect.width <= 0 || tableRect.height <= 0) {\n return {\n left: 0,\n top: 0,\n width: fallbackWidth,\n height: fallbackHeight,\n };\n }\n\n return {\n left: tableRect.left - containerRect.left,\n top: tableRect.top - containerRect.top,\n width: tableRect.width,\n height: tableRect.height,\n };\n};\n\n/**\n * TreeGrid overlay frame hook\n * @param visible overlay visibility\n * @param containerRef TreeGrid container ref\n * @param treeGridInstanceRef TreeGrid instance ref\n */\nconst useOwpTreeGridOverlayFrame = ({\n visible,\n containerRef,\n treeGridInstanceRef,\n}: UseOwpTreeGridOverlayFrameInput) => {\n const [overlayFrame, setOverlayFrame] = useState<OwpTreeGridOverlayFrame>({\n left: 0,\n top: 0,\n width: 0,\n height: 0,\n });\n\n useLayoutEffect(() => {\n if (!visible) {\n return;\n }\n\n const containerElement = containerRef.current;\n\n if (!containerElement) {\n return;\n }\n\n let animationFrameId: number | undefined;\n let resizeObserver: ResizeObserver | undefined;\n let observedMainTableElement: HTMLTableElement | null = null;\n const scrollListenerOptions = { capture: true } as const;\n\n const syncObservedMainTableElement = (nextMainTableElement: HTMLTableElement | null) => {\n if (!resizeObserver || observedMainTableElement === nextMainTableElement) {\n observedMainTableElement = nextMainTableElement;\n return;\n }\n\n if (observedMainTableElement) {\n resizeObserver.unobserve(observedMainTableElement);\n }\n\n observedMainTableElement = nextMainTableElement;\n\n if (observedMainTableElement) {\n resizeObserver.observe(observedMainTableElement);\n }\n };\n\n const updateOverlayFrame = () => {\n const treeGrid = treeGridInstanceRef.current;\n const mainTableElement = getTreeGridMainTableElement(containerElement, treeGrid);\n const nextOverlayFrame = getTreeGridOverlayFrame(containerElement, treeGrid);\n\n syncObservedMainTableElement(mainTableElement);\n\n setOverlayFrame((currentOverlayFrame) =>\n isEqual(currentOverlayFrame, nextOverlayFrame) ? currentOverlayFrame : nextOverlayFrame,\n );\n };\n\n const scheduleOverlayFrameUpdate = () => {\n if (animationFrameId !== undefined) {\n window.cancelAnimationFrame(animationFrameId);\n }\n\n animationFrameId = window.requestAnimationFrame(() => {\n animationFrameId = undefined;\n updateOverlayFrame();\n });\n };\n\n if (typeof ResizeObserver !== 'undefined') {\n resizeObserver = new ResizeObserver(scheduleOverlayFrameUpdate);\n resizeObserver.observe(containerElement);\n }\n\n const mutationObserver = new MutationObserver(scheduleOverlayFrameUpdate);\n mutationObserver.observe(containerElement, { childList: true, subtree: true });\n window.addEventListener('resize', scheduleOverlayFrameUpdate);\n containerElement.addEventListener('scroll', scheduleOverlayFrameUpdate, scrollListenerOptions);\n updateOverlayFrame();\n\n return () => {\n if (animationFrameId !== undefined) {\n window.cancelAnimationFrame(animationFrameId);\n }\n\n window.removeEventListener('resize', scheduleOverlayFrameUpdate);\n containerElement.removeEventListener(\n 'scroll',\n scheduleOverlayFrameUpdate,\n scrollListenerOptions,\n );\n mutationObserver.disconnect();\n\n if (resizeObserver && observedMainTableElement) {\n resizeObserver.unobserve(observedMainTableElement);\n }\n\n resizeObserver?.disconnect();\n };\n }, [containerRef, treeGridInstanceRef, visible]);\n\n return overlayFrame;\n};\n\nexport { useOwpTreeGridOverlayFrame };\n"],"names":["TREE_GRID_NO_DATA_OVERLAY_Z_INDEX","TREE_GRID_LOADING_OVERLAY_Z_INDEX","getTreeGridMainTableElement","__name","containerElement","grid","scopedRootElement","mainTableElements","largestTableElement","tableElement","tableRect","largestTableRect","getTreeGridOverlayFrame","containerRect","fallbackWidth","fallbackHeight","mainTableElement","useOwpTreeGridOverlayFrame","visible","containerRef","treeGridInstanceRef","overlayFrame","setOverlayFrame","useState","useLayoutEffect","animationFrameId","resizeObserver","observedMainTableElement","scrollListenerOptions","syncObservedMainTableElement","nextMainTableElement","updateOverlayFrame","treeGrid","nextOverlayFrame","currentOverlayFrame","isEqual","scheduleOverlayFrameUpdate","mutationObserver"],"mappings":";;;;AAgBO,MAAMA,IAAoC,YACpCC,IAAoC,YAE3CC,IAA8B,gBAAAC,EAAA,CAACC,GAAkCC,MAAuB;AAE5F,QAAMC,KADiBD,KAAA,gBAAAA,EAAM,YACeD,GACtCG,IAAoB,MAAM;AAAA,IAC9BD,EAAkB,iBAAmC,mBAAmB;AAAA,EAAA;AAQ1E,UAJEC,EAAkB,SAAS,IACvBA,IACA,MAAM,KAAKD,EAAkB,iBAAmC,OAAO,CAAC,GAEzD,OAAgC,CAACE,GAAqBC,MAAiB;AAC1F,UAAMC,IAAYD,EAAa,sBAAA,GACzBE,IAAmBH,KAAA,gBAAAA,EAAqB;AAE9C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,UAAUC,CAAwB,GAGnDD,KAAA,QAAAA,EAAgB;AAAA,IAClB;AAAA,EACF,GAAG,CAACP,GAAcC,GAAqBF,CAAO,CAAC,GAExCG;AACT,GArGmC;"}
1
+ {"version":3,"file":"useOwpTreeGridOverlayFrame.js","sources":["../../../../src/components/OwpTreeGrid/hooks/useOwpTreeGridOverlayFrame.ts"],"sourcesContent":["import { isEqual } from 'es-toolkit/compat';\nimport { type RefObject, useLayoutEffect, useState } from 'react';\n// Temporary TreeGrid perf instrumentation import. Remove with ../perf after profiling is finished.\nimport {\n countTreeGridPerf,\n getTreeGridPerfTimestamp,\n isTreeGridPerfEnabled,\n measureTreeGridPerf,\n} from '../perf';\n\nexport type OwpTreeGridOverlayFrame = {\n left: number;\n top: number;\n width: number;\n height: number;\n};\n\ntype UseOwpTreeGridOverlayFrameInput = {\n visible: boolean;\n containerRef: RefObject<HTMLDivElement | null>;\n treeGridInstanceRef: RefObject<TGrid>;\n debugId?: string;\n};\n\nexport const TREE_GRID_NO_DATA_OVERLAY_Z_INDEX = 2147483646;\nexport const TREE_GRID_LOADING_OVERLAY_Z_INDEX = 2147483647;\n\nconst getTreeGridMainTableElement = (containerElement: HTMLDivElement, grid: TGrid | null) => {\n const mainTagElement = grid?.MainTag as HTMLElement | null | undefined;\n const scopedRootElement = mainTagElement ?? containerElement;\n const mainTableElements = Array.from(\n scopedRootElement.querySelectorAll<HTMLTableElement>('table.TSMainTable'),\n );\n\n const tableElements =\n mainTableElements.length > 0\n ? mainTableElements\n : Array.from(scopedRootElement.querySelectorAll<HTMLTableElement>('table'));\n\n return tableElements.reduce<HTMLTableElement | null>((largestTableElement, tableElement) => {\n const tableRect = tableElement.getBoundingClientRect();\n const largestTableRect = largestTableElement?.getBoundingClientRect();\n\n if (tableRect.width <= 0 || tableRect.height <= 0) {\n return largestTableElement;\n }\n\n if (!largestTableRect) {\n return tableElement;\n }\n\n return tableRect.width * tableRect.height > largestTableRect.width * largestTableRect.height\n ? tableElement\n : largestTableElement;\n }, null);\n};\n\nconst getTreeGridOverlayFrame = (\n containerElement: HTMLDivElement,\n grid: TGrid | null,\n): OwpTreeGridOverlayFrame => {\n const containerRect = containerElement.getBoundingClientRect();\n const fallbackWidth = containerElement.clientWidth || containerRect.width;\n const fallbackHeight = containerElement.clientHeight || containerRect.height;\n const mainTableElement = getTreeGridMainTableElement(containerElement, grid);\n\n if (!mainTableElement) {\n return {\n left: 0,\n top: 0,\n width: fallbackWidth,\n height: fallbackHeight,\n };\n }\n\n const tableRect = mainTableElement.getBoundingClientRect();\n\n if (tableRect.width <= 0 || tableRect.height <= 0) {\n return {\n left: 0,\n top: 0,\n width: fallbackWidth,\n height: fallbackHeight,\n };\n }\n\n return {\n left: tableRect.left - containerRect.left,\n top: tableRect.top - containerRect.top,\n width: tableRect.width,\n height: tableRect.height,\n };\n};\n\n/**\n * TreeGrid overlay frame hook\n * @param visible overlay visibility\n * @param containerRef TreeGrid container ref\n * @param treeGridInstanceRef TreeGrid instance ref\n */\nconst useOwpTreeGridOverlayFrame = ({\n visible,\n containerRef,\n treeGridInstanceRef,\n debugId,\n}: UseOwpTreeGridOverlayFrameInput) => {\n const [overlayFrame, setOverlayFrame] = useState<OwpTreeGridOverlayFrame>({\n left: 0,\n top: 0,\n width: 0,\n height: 0,\n });\n\n useLayoutEffect(() => {\n if (!visible) {\n return;\n }\n\n const containerElement = containerRef.current;\n\n if (!containerElement) {\n return;\n }\n\n let animationFrameId: number | undefined;\n let resizeObserver: ResizeObserver | undefined;\n let observedMainTableElement: HTMLTableElement | null = null;\n const scrollListenerOptions = { capture: true } as const;\n\n const syncObservedMainTableElement = (nextMainTableElement: HTMLTableElement | null) => {\n if (!resizeObserver || observedMainTableElement === nextMainTableElement) {\n observedMainTableElement = nextMainTableElement;\n return;\n }\n\n if (observedMainTableElement) {\n resizeObserver.unobserve(observedMainTableElement);\n }\n\n observedMainTableElement = nextMainTableElement;\n\n if (observedMainTableElement) {\n resizeObserver.observe(observedMainTableElement);\n }\n };\n\n const updateOverlayFrame = () => {\n const startedAt =\n debugId && isTreeGridPerfEnabled() ? getTreeGridPerfTimestamp() : null;\n const treeGrid = treeGridInstanceRef.current;\n const mainTableElement = getTreeGridMainTableElement(containerElement, treeGrid);\n const nextOverlayFrame = getTreeGridOverlayFrame(containerElement, treeGrid);\n\n if (debugId) {\n countTreeGridPerf(debugId, 'overlay update');\n }\n\n syncObservedMainTableElement(mainTableElement);\n\n setOverlayFrame((currentOverlayFrame) =>\n isEqual(currentOverlayFrame, nextOverlayFrame) ? currentOverlayFrame : nextOverlayFrame,\n );\n\n if (debugId) {\n measureTreeGridPerf(debugId, 'overlay update end', startedAt);\n }\n };\n\n const scheduleOverlayFrameUpdate = () => {\n if (debugId) {\n countTreeGridPerf(debugId, 'overlay schedule');\n }\n\n if (animationFrameId !== undefined) {\n window.cancelAnimationFrame(animationFrameId);\n }\n\n animationFrameId = window.requestAnimationFrame(() => {\n animationFrameId = undefined;\n updateOverlayFrame();\n });\n };\n\n if (typeof ResizeObserver !== 'undefined') {\n resizeObserver = new ResizeObserver(scheduleOverlayFrameUpdate);\n resizeObserver.observe(containerElement);\n }\n\n const mutationObserver = new MutationObserver(scheduleOverlayFrameUpdate);\n mutationObserver.observe(containerElement, { childList: true, subtree: true });\n window.addEventListener('resize', scheduleOverlayFrameUpdate);\n containerElement.addEventListener('scroll', scheduleOverlayFrameUpdate, scrollListenerOptions);\n updateOverlayFrame();\n\n return () => {\n if (animationFrameId !== undefined) {\n window.cancelAnimationFrame(animationFrameId);\n }\n\n window.removeEventListener('resize', scheduleOverlayFrameUpdate);\n containerElement.removeEventListener(\n 'scroll',\n scheduleOverlayFrameUpdate,\n scrollListenerOptions,\n );\n mutationObserver.disconnect();\n\n if (resizeObserver && observedMainTableElement) {\n resizeObserver.unobserve(observedMainTableElement);\n }\n\n resizeObserver?.disconnect();\n };\n }, [containerRef, treeGridInstanceRef, visible, debugId]);\n\n return overlayFrame;\n};\n\nexport { useOwpTreeGridOverlayFrame };\n"],"names":["TREE_GRID_NO_DATA_OVERLAY_Z_INDEX","TREE_GRID_LOADING_OVERLAY_Z_INDEX","getTreeGridMainTableElement","__name","containerElement","grid","scopedRootElement","mainTableElements","largestTableElement","tableElement","tableRect","largestTableRect","getTreeGridOverlayFrame","containerRect","fallbackWidth","fallbackHeight","mainTableElement","useOwpTreeGridOverlayFrame","visible","containerRef","treeGridInstanceRef","debugId","overlayFrame","setOverlayFrame","useState","useLayoutEffect","animationFrameId","resizeObserver","observedMainTableElement","scrollListenerOptions","syncObservedMainTableElement","nextMainTableElement","updateOverlayFrame","startedAt","isTreeGridPerfEnabled","getTreeGridPerfTimestamp","treeGrid","nextOverlayFrame","countTreeGridPerf","currentOverlayFrame","isEqual","measureTreeGridPerf","scheduleOverlayFrameUpdate","mutationObserver"],"mappings":";;;;;AAwBO,MAAMA,IAAoC,YACpCC,IAAoC,YAE3CC,IAA8B,gBAAAC,EAAA,CAACC,GAAkCC,MAAuB;AAE5F,QAAMC,KADiBD,KAAA,gBAAAA,EAAM,YACeD,GACtCG,IAAoB,MAAM;AAAA,IAC9BD,EAAkB,iBAAmC,mBAAmB;AAAA,EAAA;AAQ1E,UAJEC,EAAkB,SAAS,IACvBA,IACA,MAAM,KAAKD,EAAkB,iBAAmC,OAAO,CAAC,GAEzD,OAAgC,CAACE,GAAqBC,MAAiB;AAC1F,UAAMC,IAAYD,EAAa,sBAAA,GACzBE,IAAmBH,KAAA,gBAAAA,EAAqB;AAE9C,WAAIE,EAAU,SAAS,KAAKA,EAAU,UAAU,IACvCF,IAGJG,IAIED,EAAU,QAAQA,EAAU,SAASC,EAAiB,QAAQA,EAAiB,SAClFF,IACAD,IALKC;AAAA,EAMX,GAAG,IAAI;AACT,GA5BoC,gCA8B9BG,IAA0B,gBAAAT,EAAA,CAC9BC,GACAC,MAC4B;AAC5B,QAAMQ,IAAgBT,EAAiB,sBAAA,GACjCU,IAAgBV,EAAiB,eAAeS,EAAc,OAC9DE,IAAiBX,EAAiB,gBAA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GApHmC;"}
@@ -0,0 +1,31 @@
1
+ var c = Object.defineProperty;
2
+ var n = (e, r) => c(e, "name", { value: r, configurable: !0 });
3
+ const s = "__OWP_TREE_GRID_PERF__", i = /* @__PURE__ */ n(() => typeof window < "u" && !!window[s], "isTreeGridPerfEnabled"), u = /* @__PURE__ */ n(() => typeof performance < "u" ? performance.now() : Date.now(), "getTreeGridPerfTimestamp"), T = /* @__PURE__ */ n((e, r) => {
4
+ i() && console.count(`[OwpTreeGrid:${e}] ${r}`);
5
+ }, "countTreeGridPerf"), d = /* @__PURE__ */ n((e, r, o) => {
6
+ if (i()) {
7
+ if (o) {
8
+ console.info(`[OwpTreeGrid:${e}] ${r}`, o);
9
+ return;
10
+ }
11
+ console.info(`[OwpTreeGrid:${e}] ${r}`);
12
+ }
13
+ }, "logTreeGridPerf"), w = /* @__PURE__ */ n((e, r, o, t) => {
14
+ if (!i() || o === null)
15
+ return;
16
+ const f = Number((u() - o).toFixed(1));
17
+ if (t) {
18
+ console.info(`[OwpTreeGrid:${e}] ${r}`, { durationMs: f, ...t });
19
+ return;
20
+ }
21
+ console.info(`[OwpTreeGrid:${e}] ${r}`, { durationMs: f });
22
+ }, "measureTreeGridPerf");
23
+ export {
24
+ s as TREE_GRID_PERF_FLAG,
25
+ T as countTreeGridPerf,
26
+ u as getTreeGridPerfTimestamp,
27
+ i as isTreeGridPerfEnabled,
28
+ d as logTreeGridPerf,
29
+ w as measureTreeGridPerf
30
+ };
31
+ //# sourceMappingURL=perf.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"perf.js","sources":["../../../src/components/OwpTreeGrid/perf.ts"],"sourcesContent":["/** Temporary TreeGrid perf instrumentation. Remove after profiling is no longer needed. */\ntype TreeGridPerfWindow = Window & {\n __OWP_TREE_GRID_PERF__?: boolean;\n};\n\nexport const TREE_GRID_PERF_FLAG = '__OWP_TREE_GRID_PERF__';\n\n/**\n * TreeGrid 성능 계측 활성 여부\n */\nexport const isTreeGridPerfEnabled = () => {\n return typeof window !== 'undefined' && Boolean((window as TreeGridPerfWindow)[TREE_GRID_PERF_FLAG]);\n};\n\n/**\n * TreeGrid 성능 계측 타임스탬프 반환\n */\nexport const getTreeGridPerfTimestamp = () => {\n return typeof performance !== 'undefined' ? performance.now() : Date.now();\n};\n\n/**\n * TreeGrid 성능 계측 카운트 로그\n * @param gridId TreeGrid 인스턴스 ID\n * @param label 계측 라벨\n */\nexport const countTreeGridPerf = (gridId: string, label: string) => {\n if (!isTreeGridPerfEnabled()) {\n return;\n }\n\n console.count(`[OwpTreeGrid:${gridId}] ${label}`);\n};\n\n/**\n * TreeGrid 성능 계측 디버그 로그\n * @param gridId TreeGrid 인스턴스 ID\n * @param label 계측 라벨\n * @param payload 부가 정보\n */\nexport const logTreeGridPerf = (\n gridId: string,\n label: string,\n payload?: Record<string, unknown>,\n) => {\n if (!isTreeGridPerfEnabled()) {\n return;\n }\n\n if (payload) {\n console.info(`[OwpTreeGrid:${gridId}] ${label}`, payload);\n return;\n }\n\n console.info(`[OwpTreeGrid:${gridId}] ${label}`);\n};\n\n/**\n * TreeGrid 성능 계측 측정 로그\n * @param gridId TreeGrid 인스턴스 ID\n * @param label 계측 라벨\n * @param startedAt 시작 시각\n * @param payload 부가 정보\n */\nexport const measureTreeGridPerf = (\n gridId: string,\n label: string,\n startedAt: number | null,\n payload?: Record<string, unknown>,\n) => {\n if (!isTreeGridPerfEnabled() || startedAt === null) {\n return;\n }\n\n const durationMs = Number((getTreeGridPerfTimestamp() - startedAt).toFixed(1));\n\n if (payload) {\n console.info(`[OwpTreeGrid:${gridId}] ${label}`, { durationMs, ...payload });\n return;\n }\n\n console.info(`[OwpTreeGrid:${gridId}] ${label}`, { durationMs });\n};\n"],"names":["TREE_GRID_PERF_FLAG","isTreeGridPerfEnabled","__name","getTreeGridPerfTimestamp","countTreeGridPerf","gridId","label","logTreeGridPerf","payload","measureTreeGridPerf","startedAt","durationMs"],"mappings":";;AAKO,MAAMA,IAAsB,0BAKtBC,IAAwB,gBAAAC,EAAA,MAC5B,OAAO,SAAW,OAAe,EAAS,OAA8BF,CAAmB,GAD/D,0BAOxBG,IAA2B,gBAAAD,EAAA,MAC/B,OAAO,cAAgB,MAAc,YAAY,IAAA,IAAQ,KAAK,IAAA,GAD/B,6BAS3BE,IAAoB,gBAAAF,EAAA,CAACG,GAAgBC,MAAkB;AAClE,EAAKL,OAIL,QAAQ,MAAM,gBAAgBI,CAAM,KAAKC,CAAK,EAAE;AAClD,GANiC,sBAcpBC,IAAkB,gBAAAL,EAAA,CAC7BG,GACAC,GACAE,MACG;AACH,MAAKP,KAIL;AAAA,QAAIO,GAAS;AACX,cAAQ,KAAK,gBAAgBH,CAAM,KAAKC,CAAK,IAAIE,CAAO;AACxD;AAAA,IACF;AAEA,YAAQ,KAAK,gBAAgBH,CAAM,KAAKC,CAAK,EAAE;AAAA;AACjD,GAf+B,oBAwBlBG,IAAsB,gBAAAP,EAAA,CACjCG,GACAC,GACAI,GACAF,MACG;AACH,MAAI,CAACP,EAAA,KAA2BS,MAAc;AAC5C;AAGF,QAAMC,IAAa,QAAQR,EAAA,IAA6BO,GAAW,QAAQ,CAAC,CAAC;AAE7E,MAAIF,GAAS;AACX,YAAQ,KAAK,gBAAgBH,CAAM,KAAKC,CAAK,IAAI,EAAE,YAAAK,GAAY,GAAGH,EAAA,CAAS;AAC3E;AAAA,EACF;AAEA,UAAQ,KAAK,gBAAgBH,CAAM,KAAKC,CAAK,IAAI,EAAE,YAAAK,GAAY;AACjE,GAlBmC;"}
@@ -0,0 +1,34 @@
1
+ var f = Object.defineProperty;
2
+ var o = (r, t) => f(r, "name", { value: t, configurable: !0 });
3
+ import { jsx as d } 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 { useConfirm as u } from "../../hooks/useConfirm.js";
5
+ import { useOwpTranslation as p } from "../../hooks/useOwpTranslation.js";
6
+ import { resetTreeGridChangesById as c } from "../../utils/treeGridUtil.js";
7
+ import { Button as l } from "@mui/material";
8
+ const G = /* @__PURE__ */ o(({
9
+ gridId: r,
10
+ confirmTitle: t,
11
+ children: s,
12
+ onClick: e,
13
+ ...m
14
+ }) => {
15
+ const { t: n } = p(), { confirmInfo: a } = u();
16
+ return /* @__PURE__ */ d(
17
+ l,
18
+ {
19
+ variant: "outlined",
20
+ color: "primary",
21
+ ...m,
22
+ onClick: /* @__PURE__ */ o(async (i) => {
23
+ e == null || e(i), !(i.defaultPrevented || !await a({
24
+ title: t ?? n("Message.그리드 변경 사항을 초기화하시겠습니까?")
25
+ })) && c(r);
26
+ }, "handleClick"),
27
+ children: s ?? n("Button.변경 초기화")
28
+ }
29
+ );
30
+ }, "OwpTreeGridResetChangesButton");
31
+ export {
32
+ G as OwpTreeGridResetChangesButton
33
+ };
34
+ //# sourceMappingURL=OwpTreeGridResetChangesButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OwpTreeGridResetChangesButton.js","sources":["../../../src/components/OwpTreeGridResetChangesButton/OwpTreeGridResetChangesButton.tsx"],"sourcesContent":["import { useConfirm } from '@/hooks/useConfirm';\nimport { useOwpTranslation } from '@/hooks/useOwpTranslation';\nimport { resetTreeGridChangesById } from '@/utils/treeGridUtil';\nimport { Button, type ButtonProps } from '@mui/material';\nimport { type MouseEventHandler, type ReactNode } from 'react';\n\nexport interface OwpTreeGridResetChangesButtonProps extends ButtonProps {\n gridId: string;\n confirmTitle?: ReactNode | string;\n}\n\n/**\n * TreeGrid 변경 사항 초기화 버튼\n * @param gridId TreeGrid 인스턴스 ID\n * @param confirmTitle 확인 대화상자 제목\n */\nconst OwpTreeGridResetChangesButton = ({\n gridId,\n confirmTitle,\n children,\n onClick,\n ...buttonProps\n}: OwpTreeGridResetChangesButtonProps) => {\n const { t } = useOwpTranslation();\n const { confirmInfo } = useConfirm();\n\n const handleClick: MouseEventHandler<HTMLButtonElement> = async (event) => {\n onClick?.(event);\n\n if (event.defaultPrevented) {\n return;\n }\n\n const isConfirmed = await confirmInfo({\n title:\n confirmTitle ??\n t('Message.그리드 변경 사항을 초기화하시겠습니까?'),\n });\n\n if (!isConfirmed) {\n return;\n }\n\n resetTreeGridChangesById(gridId);\n };\n\n return (\n <Button\n variant=\"outlined\"\n color=\"primary\"\n {...buttonProps}\n onClick={handleClick}\n >\n {children ?? t('Button.변경 초기화')}\n </Button>\n );\n};\n\nexport { OwpTreeGridResetChangesButton };\n"],"names":["OwpTreeGridResetChangesButton","__name","gridId","confirmTitle","children","onClick","buttonProps","t","useOwpTranslation","confirmInfo","useConfirm","jsx","Button","event","resetTreeGridChangesById"],"mappings":";;;;;;;AAgBA,MAAMA,IAAgC,gBAAAC,EAAA,CAAC;AAAA,EACrC,QAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,GAAGC;AACL,MAA0C;AACxC,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAA,GACR,EAAE,aAAAC,EAAA,IAAgBC,EAAA;AAsBxB,SACE,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,SAAQ;AAAA,MACR,OAAM;AAAA,MACL,GAAGN;AAAA,MACJ,SAzBsD,gBAAAL,EAAA,OAAOY,MAAU;AAazE,QAZAR,KAAA,QAAAA,EAAUQ,IAEN,EAAAA,EAAM,oBAUN,CANgB,MAAMJ,EAAY;AAAA,UACpC,OACEN,KACAI,EAAE,+BAA+B;AAAA,QAAA,CACpC,MAMDO,EAAyBZ,CAAM;AAAA,MACjC,GAlB0D;AAAA,MA2BrD,UAAAE,KAAYG,EAAE,eAAe;AAAA,IAAA;AAAA,EAAA;AAGpC,GAxCsC;"}
package/dist/index.js CHANGED
@@ -2,14 +2,14 @@ import { DialogsProvider as r } from "@toolpad/core/useDialogs";
2
2
  import { themeLayouts as p } from "./layout/themeLayouts.js";
3
3
  import { createInitialOwpSettings as a, defaultSettings as f, defaultThemeOptions as x, defaultThemes as O, extendThemeWithMixins as w, generateSettings as i, getDefaultLayout as d, getDefaultThemeSettings as l, getParsedQuerySettings as n, mustHaveThemeOptions as g } from "./configs/defaultConfig.js";
4
4
  import { OwpAutoLogoutDialog as T } from "./components/OwpAutoLogoutDialog/OwpAutoLogoutDialog.js";
5
- import { OwpBarcodeInputField as S } from "./components/OwpBarcodeInput/OwpBarcodeInputField.js";
6
- import { OwpExportDataToExcelButton as P } from "./components/OwpExportExcelButton/OwpExportExcelButton.js";
5
+ import { OwpBarcodeInputField as c } from "./components/OwpBarcodeInput/OwpBarcodeInputField.js";
6
+ import { OwpExportDataToExcelButton as C } from "./components/OwpExportExcelButton/OwpExportExcelButton.js";
7
7
  import { OwpFileUploadButton as b } from "./components/OwpFileUploadButton/OwpFileUploadButton.js";
8
8
  import { OwpMoreActionsButton as h } from "./components/OwpMoreActionsButton/OwpMoreActionsButton.js";
9
9
  import { OwpPageCardedHeader as y } from "./components/OwpPageCarded/OwpPageCardedHeader.js";
10
- import { OwpPageCardedSidebar as B } from "./components/OwpPageCarded/OwpPageCardedSidebar.js";
10
+ import { OwpPageCardedSidebar as L } from "./components/OwpPageCarded/OwpPageCardedSidebar.js";
11
11
  import { OwpPageCardedSidebarContent as G } from "./components/OwpPageCarded/OwpPageCardedSidebarContent.js";
12
- import { OwpDatePicker as F } from "./components/OwpPicker/OwpDatePicker.js";
12
+ import { OwpDatePicker as v } from "./components/OwpPicker/OwpDatePicker.js";
13
13
  import { OwpDateRangePicker as I } from "./components/OwpPicker/OwpDateRangePicker.js";
14
14
  import { OwpTimePicker as A } from "./components/OwpPicker/OwpTimePicker.js";
15
15
  import { OwpWeekDatePicker as N } from "./components/OwpPicker/OwpWeekDatePicker.js";
@@ -26,14 +26,14 @@ import { OwpEventEmitter as xe } from "./components/OwpEventEmitter/OwpEventEmit
26
26
  import { OwpLanguageSwitcherSelect as we } from "./components/OwpLanguageSwitcherSelect/OwpLanguageSwitcherSelect.js";
27
27
  import { OwpCommonDialog as de, OwpDialog as le } from "./components/OwpDialog/OwpDialog.js";
28
28
  import { CommonCodeSelector as ge, OwpCommonCodeSelector as ue } from "./components/OwpCommonCode/OwpCommonCodeSelector.js";
29
- import { CommonCodeRadioGroup as ce, OwpCommonCodeRadioGroup as Se } from "./components/OwpCommonCode/OwpCommonCodeRadioGroup.js";
30
- import { OwpErrorStatusPage as Pe } from "./components/OwpErrorStatusPage/OwpErrorStatusPage.js";
29
+ import { CommonCodeRadioGroup as se, OwpCommonCodeRadioGroup as ce } from "./components/OwpCommonCode/OwpCommonCodeRadioGroup.js";
30
+ import { OwpErrorStatusPage as Ce } from "./components/OwpErrorStatusPage/OwpErrorStatusPage.js";
31
31
  import { OwpLayout as be } from "./components/OwpLayout/OwpLayout.js";
32
32
  import { OwpLoading as he } from "./components/OwpLoading/OwpLoading.js";
33
33
  import { OwpMrtTable as ye } from "./components/OwpMrtTable/OwpMrtTable.js";
34
- import { OwpNumberField as Be } from "./components/OwpNumberField/OwpNumberField.js";
34
+ import { OwpNumberField as Le } from "./components/OwpNumberField/OwpNumberField.js";
35
35
  import { OwpOptionSelector as Ge } from "./components/OwpOptionSelector/OwpOptionSelector.js";
36
- import { OwpPageCarded as Fe } from "./components/OwpPageCarded/OwpPageCarded.js";
36
+ import { OwpPageCarded as ve } from "./components/OwpPageCarded/OwpPageCarded.js";
37
37
  import { OwpPageContent as Ie } from "./components/OwpPageContent/OwpPageContent.js";
38
38
  import { OwpPageLockLoading as Ae } from "./components/OwpPageLockLoading/OwpPageLockLoading.js";
39
39
  import { OwpPageTitle as Ne } from "./components/OwpPageTitle/OwpPageTitle.js";
@@ -46,38 +46,39 @@ import { OwpSvgIcon as Xe } from "./components/OwpSvgIcon/OwpSvgIcon.js";
46
46
  import { OwpTab as $e } from "./components/OwpTabs/OwpTab.js";
47
47
  import { OwpTabs as oo } from "./components/OwpTabs/OwpTabs.js";
48
48
  import { OwpTreeGridExcelButton as to } from "./components/OwpTreeGridExcelButton/OwpTreeGridExcelButton.js";
49
- import { OwpTreeGrid as mo } from "./components/OwpTreeGrid/OwpTreeGrid.js";
50
- import { TreeGrid as fo } from "./components/OwpTreeGrid/TreeGrid.js";
51
- import { OwpYesNoSelector as Oo } from "./components/OwpYesNoSelector/OwpYesNoSelector.js";
49
+ import { OwpTreeGridResetChangesButton as mo } from "./components/OwpTreeGridResetChangesButton/OwpTreeGridResetChangesButton.js";
50
+ import { OwpTreeGrid as fo } from "./components/OwpTreeGrid/OwpTreeGrid.js";
51
+ import { TreeGrid as Oo } from "./components/OwpTreeGrid/TreeGrid.js";
52
+ import { OwpYesNoSelector as io } from "./components/OwpYesNoSelector/OwpYesNoSelector.js";
52
53
  export {
53
- ce as CommonCodeRadioGroup,
54
+ se as CommonCodeRadioGroup,
54
55
  ge as CommonCodeSelector,
55
56
  r as DialogsProvider,
56
57
  T as OwpAutoLogoutDialog,
57
- S as OwpBarcodeInputField,
58
- Se as OwpCommonCodeRadioGroup,
58
+ c as OwpBarcodeInputField,
59
+ ce as OwpCommonCodeRadioGroup,
59
60
  ue as OwpCommonCodeSelector,
60
61
  de as OwpCommonDialog,
61
62
  U as OwpDataTable,
62
- F as OwpDatePicker,
63
+ v as OwpDatePicker,
63
64
  I as OwpDateRangePicker,
64
65
  le as OwpDialog,
65
66
  ae as OwpErrorBoundary,
66
- Pe as OwpErrorStatusPage,
67
+ Ce as OwpErrorStatusPage,
67
68
  xe as OwpEventEmitter,
68
- P as OwpExportDataToExcelButton,
69
+ C as OwpExportDataToExcelButton,
69
70
  b as OwpFileUploadButton,
70
71
  we as OwpLanguageSwitcherSelect,
71
72
  be as OwpLayout,
72
73
  he as OwpLoading,
73
74
  h as OwpMoreActionsButton,
74
75
  ye as OwpMrtTable,
75
- Be as OwpNumberField,
76
+ Le as OwpNumberField,
76
77
  Ge as OwpOptionSelector,
77
78
  pe as OwpPageBreadcrumb,
78
- Fe as OwpPageCarded,
79
+ ve as OwpPageCarded,
79
80
  y as OwpPageCardedHeader,
80
- B as OwpPageCardedSidebar,
81
+ L as OwpPageCardedSidebar,
81
82
  G as OwpPageCardedSidebarContent,
82
83
  Ie as OwpPageContent,
83
84
  Ae as OwpPageLockLoading,
@@ -94,17 +95,18 @@ export {
94
95
  oo as OwpTabs,
95
96
  _ as OwpTextMaskField,
96
97
  A as OwpTimePicker,
97
- mo as OwpTreeGrid,
98
+ fo as OwpTreeGrid,
98
99
  to as OwpTreeGridExcelButton,
100
+ mo as OwpTreeGridResetChangesButton,
99
101
  ee as OwpTreeGridToolbar,
100
102
  K as OwpVerticalTable,
101
103
  N as OwpWeekDatePicker,
102
104
  Y as OwpYearRangePicker,
103
- Oo as OwpYesNoSelector,
105
+ io as OwpYesNoSelector,
104
106
  re as OwpZoomImageSlider,
105
107
  q as StyledTable,
106
108
  z as StyledTableRow,
107
- fo as TreeGrid,
109
+ Oo as TreeGrid,
108
110
  a as createInitialOwpSettings,
109
111
  f as defaultSettings,
110
112
  x as defaultThemeOptions,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,6 +1,6 @@
1
1
  var q = Object.defineProperty;
2
2
  var O = (C, _) => q(C, "name", { value: _, configurable: !0 });
3
- import { __exports as r } from "../../../../../../../../_virtual/index6.js";
3
+ import { __exports as r } from "../../../../../../../../_virtual/index7.js";
4
4
  import { __require as d } from "./CODE128_AUTO.js";
5
5
  import { __require as n } from "./CODE128A.js";
6
6
  import { __require as m } from "./CODE128B.js";
@@ -1,6 +1,6 @@
1
1
  var w = Object.defineProperty;
2
2
  var n = (f, a) => w(f, "name", { value: a, configurable: !0 });
3
- import { __exports as i } from "../../../../../../../../_virtual/index5.js";
3
+ import { __exports as i } from "../../../../../../../../_virtual/index6.js";
4
4
  import { __require as k } from "../Barcode.js";
5
5
  var _;
6
6
  function P() {
@@ -1,6 +1,6 @@
1
1
  var D = Object.defineProperty;
2
2
  var C = (u, t) => D(u, "name", { value: t, configurable: !0 });
3
- import { __exports as e } from "../../../../../../../../_virtual/index12.js";
3
+ import { __exports as e } from "../../../../../../../../_virtual/index13.js";
4
4
  import { __require as O } from "./CODE93.js";
5
5
  import { __require as E } from "./CODE93FullASCII.js";
6
6
  var l;
@@ -1,6 +1,6 @@
1
1
  var n = Object.defineProperty;
2
2
  var G = (r, t) => n(r, "name", { value: t, configurable: !0 });
3
- import { __exports as L } from "../../../../../../../../_virtual/constants3.js";
3
+ import { __exports as L } from "../../../../../../../../_virtual/constants2.js";
4
4
  var e;
5
5
  function o() {
6
6
  return e ? L : (e = 1, Object.defineProperty(L, "__esModule", {
@@ -1,6 +1,6 @@
1
1
  var C = Object.defineProperty;
2
2
  var i = (u, a) => C(u, "name", { value: a, configurable: !0 });
3
- import { __exports as r } from "../../../../../../../../_virtual/index7.js";
3
+ import { __exports as r } from "../../../../../../../../_virtual/index8.js";
4
4
  import { __require as U } from "./EAN13.js";
5
5
  import { __require as s } from "./EAN8.js";
6
6
  import { __require as l } from "./EAN5.js";