@owp/core 2.3.1 → 2.4.1

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 (151) hide show
  1. package/dist/_virtual/index11.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/_virtual/index16.js +5 -2
  6. package/dist/_virtual/index16.js.map +1 -1
  7. package/dist/_virtual/index17.js +5 -2
  8. package/dist/_virtual/index17.js.map +1 -1
  9. package/dist/_virtual/index18.js +4 -4
  10. package/dist/_virtual/index19.js +4 -4
  11. package/dist/_virtual/index20.js +2 -5
  12. package/dist/_virtual/index20.js.map +1 -1
  13. package/dist/_virtual/index5.js +2 -5
  14. package/dist/_virtual/index5.js.map +1 -1
  15. package/dist/_virtual/index6.js +2 -2
  16. package/dist/_virtual/index7.js +2 -2
  17. package/dist/components/OwpCommonCode/OwpCommonCodeRadioGroup.js +38 -38
  18. package/dist/components/OwpCommonCode/OwpCommonCodeRadioGroup.js.map +1 -1
  19. package/dist/components/OwpFieldHelperText/OwpFieldHelperText.js +34 -0
  20. package/dist/components/OwpFieldHelperText/OwpFieldHelperText.js.map +1 -0
  21. package/dist/components/OwpLayout/OwpLayout.js +39 -39
  22. package/dist/components/OwpLayout/OwpLayout.js.map +1 -1
  23. package/dist/components/OwpRequiredHelperText/OwpRequiredHelperText.js +38 -0
  24. package/dist/components/OwpRequiredHelperText/OwpRequiredHelperText.js.map +1 -0
  25. package/dist/components/OwpTable/OwpFieldTable.js +99 -0
  26. package/dist/components/OwpTable/OwpFieldTable.js.map +1 -0
  27. package/dist/components/OwpTextField/OwpTextMaskField.js +138 -87
  28. package/dist/components/OwpTextField/OwpTextMaskField.js.map +1 -1
  29. package/dist/components/OwpTreeGrid/OwpTreeGrid.js +169 -148
  30. package/dist/components/OwpTreeGrid/OwpTreeGrid.js.map +1 -1
  31. package/dist/components/OwpTreeGrid/internal/OwpTreeGridLoadingOverlay.js +1 -1
  32. package/dist/components/OwpTreeGrid/internal/OwpTreeGridLoadingOverlay.js.map +1 -1
  33. package/dist/components/OwpTreeGrid/internal/OwpTreeGridNoDataOverlay.js +1 -1
  34. package/dist/components/OwpTreeGrid/internal/OwpTreeGridNoDataOverlay.js.map +1 -1
  35. package/dist/components/OwpTreeGrid/{hooks → internal/hooks}/useOwpTreeGridOverlayFrame.js +1 -1
  36. package/dist/components/OwpTreeGrid/internal/hooks/useOwpTreeGridOverlayFrame.js.map +1 -0
  37. package/dist/components/OwpTreeGrid/internal/treeGridColumnEditRules.js +84 -0
  38. package/dist/components/OwpTreeGrid/internal/treeGridColumnEditRules.js.map +1 -0
  39. package/dist/components/OwpTreeGrid/internal/treeGridRuntime.js +114 -103
  40. package/dist/components/OwpTreeGrid/internal/treeGridRuntime.js.map +1 -1
  41. package/dist/components/OwpTreeGrid/internal/utils/perf.js.map +1 -0
  42. package/dist/hooks/useCurrentUserSeq.js +20 -6
  43. package/dist/hooks/useCurrentUserSeq.js.map +1 -1
  44. package/dist/hooks.js +50 -49
  45. package/dist/index.js +74 -70
  46. package/dist/index.js.map +1 -1
  47. package/dist/layout/Layout.js +24 -24
  48. package/dist/layout/Layout.js.map +1 -1
  49. package/dist/layout/components/toggles/NavigationSearchToggle.js +3 -3
  50. package/dist/layout/themeLayouts.js.map +1 -1
  51. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/CODE128/constants.js +1 -1
  52. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/CODE128/index.js +1 -1
  53. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/CODE39/index.js +1 -1
  54. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/CODE93/index.js +1 -1
  55. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/EAN_UPC/constants.js +1 -1
  56. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/EAN_UPC/index.js +1 -1
  57. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/GenericBarcode/index.js +1 -1
  58. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/ITF/index.js +1 -1
  59. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/MSI/index.js +1 -1
  60. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/codabar/index.js +1 -1
  61. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/pharmacode/index.js +1 -1
  62. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/renderers/index.js +1 -1
  63. package/dist/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/index.js +1 -1
  64. package/dist/node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/index.js +1 -1
  65. package/dist/node_modules/.pnpm/react-overlays@5.2.1_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/react-overlays/esm/Portal.js +1 -1
  66. package/dist/owp-app.css +1 -1
  67. package/dist/types/components/OwpFieldHelperText/OwpFieldHelperText.d.ts +14 -0
  68. package/dist/types/components/OwpFieldHelperText/index.d.ts +2 -0
  69. package/dist/types/components/OwpRequiredHelperText/OwpRequiredHelperText.d.ts +18 -0
  70. package/dist/types/components/OwpRequiredHelperText/index.d.ts +2 -0
  71. package/dist/types/components/OwpTable/{OwpVerticalTable.d.ts → OwpFieldTable.d.ts} +9 -8
  72. package/dist/types/components/OwpTable/index.d.ts +1 -1
  73. package/dist/types/components/OwpTextField/OwpTextMaskField.d.ts +5 -3
  74. package/dist/types/components/OwpTreeGrid/OwpTreeGrid.d.ts +7 -1
  75. package/dist/types/components/OwpTreeGrid/index.d.ts +1 -1
  76. package/dist/types/components/OwpTreeGrid/internal/OwpTreeGridLoadingOverlay.d.ts +1 -1
  77. package/dist/types/components/OwpTreeGrid/internal/OwpTreeGridNoDataOverlay.d.ts +1 -1
  78. package/dist/types/components/OwpTreeGrid/internal/treeGridColumnEditRules.d.ts +60 -0
  79. package/dist/types/components/OwpTreeGrid/internal/treeGridRuntime.d.ts +7 -2
  80. package/dist/types/hooks/useCurrentUserSeq.d.ts +11 -2
  81. package/dist/types/index.d.ts +3 -1
  82. package/dist/types/layout/Layout.d.ts +2 -0
  83. package/dist/types/layout/themeLayouts.d.ts +2 -0
  84. package/package.json +3 -3
  85. package/dist/components/OwpTable/OwpVerticalTable.js +0 -96
  86. package/dist/components/OwpTable/OwpVerticalTable.js.map +0 -1
  87. package/dist/components/OwpTreeGrid/hooks/useOwpTreeGridOverlayFrame.js.map +0 -1
  88. package/dist/components/OwpTreeGrid/utils/perf.js.map +0 -1
  89. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/controls/html-contenteditable-mask-element.js +0 -39
  90. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/controls/html-contenteditable-mask-element.js.map +0 -1
  91. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/controls/html-input-mask-element.js +0 -36
  92. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/controls/html-input-mask-element.js.map +0 -1
  93. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/controls/html-mask-element.js +0 -52
  94. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/controls/html-mask-element.js.map +0 -1
  95. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/controls/input-history.js +0 -35
  96. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/controls/input-history.js.map +0 -1
  97. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/controls/input.js +0 -227
  98. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/controls/input.js.map +0 -1
  99. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/controls/mask-element.js +0 -48
  100. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/controls/mask-element.js.map +0 -1
  101. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/core/action-details.js +0 -56
  102. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/core/action-details.js.map +0 -1
  103. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/core/change-details.js +0 -41
  104. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/core/change-details.js.map +0 -1
  105. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/core/continuous-tail-details.js +0 -47
  106. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/core/continuous-tail-details.js.map +0 -1
  107. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/core/holder.js +0 -10
  108. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/core/holder.js.map +0 -1
  109. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/core/utils.js +0 -76
  110. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/core/utils.js.map +0 -1
  111. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/index.js +0 -51
  112. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/index.js.map +0 -1
  113. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/masked/base.js +0 -257
  114. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/masked/base.js.map +0 -1
  115. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/masked/date.js +0 -121
  116. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/masked/date.js.map +0 -1
  117. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/masked/dynamic.js +0 -227
  118. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/masked/dynamic.js.map +0 -1
  119. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/masked/enum.js +0 -74
  120. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/masked/enum.js.map +0 -1
  121. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/masked/factory.js +0 -52
  122. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/masked/factory.js.map +0 -1
  123. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/masked/function.js +0 -28
  124. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/masked/function.js.map +0 -1
  125. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/masked/number.js +0 -217
  126. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/masked/number.js.map +0 -1
  127. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/masked/pattern/chunk-tail-details.js +0 -108
  128. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/masked/pattern/chunk-tail-details.js.map +0 -1
  129. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/masked/pattern/cursor.js +0 -105
  130. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/masked/pattern/cursor.js.map +0 -1
  131. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/masked/pattern/fixed-definition.js +0 -107
  132. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/masked/pattern/fixed-definition.js.map +0 -1
  133. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/masked/pattern/input-definition.js +0 -138
  134. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/masked/pattern/input-definition.js.map +0 -1
  135. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/masked/pattern.js +0 -327
  136. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/masked/pattern.js.map +0 -1
  137. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/masked/pipe.js +0 -28
  138. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/masked/pipe.js.map +0 -1
  139. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/masked/range.js +0 -83
  140. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/masked/range.js.map +0 -1
  141. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/masked/regexp.js +0 -26
  142. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/masked/regexp.js.map +0 -1
  143. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/masked/repeat.js +0 -109
  144. package/dist/node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/masked/repeat.js.map +0 -1
  145. package/dist/node_modules/.pnpm/react-imask@7.6.1_react@19.2.4/node_modules/react-imask/esm/input.js +0 -28
  146. package/dist/node_modules/.pnpm/react-imask@7.6.1_react@19.2.4/node_modules/react-imask/esm/input.js.map +0 -1
  147. package/dist/node_modules/.pnpm/react-imask@7.6.1_react@19.2.4/node_modules/react-imask/esm/mixin.js +0 -136
  148. package/dist/node_modules/.pnpm/react-imask@7.6.1_react@19.2.4/node_modules/react-imask/esm/mixin.js.map +0 -1
  149. /package/dist/components/OwpTreeGrid/{utils → internal/utils}/perf.js +0 -0
  150. /package/dist/types/components/OwpTreeGrid/{hooks → internal/hooks}/useOwpTreeGridOverlayFrame.d.ts +0 -0
  151. /package/dist/types/components/OwpTreeGrid/{utils → internal/utils}/perf.d.ts +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OwpFieldTable.js","sources":["../../../src/components/OwpTable/OwpFieldTable.tsx"],"sourcesContent":["import { Checkbox, TableBody, TableCell, type TableCellProps } from '@mui/material';\nimport clsx from 'clsx';\nimport dayjs from 'dayjs';\nimport { isNaN, toNumber } from 'es-toolkit/compat';\nimport { Fragment, type CSSProperties, type ReactNode } from 'react';\nimport { StyledTable, StyledTableRow } from './OwpTable';\n\ntype OwpFieldTableCell = {\n title: string;\n key: string;\n required?: boolean;\n disableLocaleString?: boolean;\n useDate?: boolean;\n withTime?: boolean;\n withTimeAndSec?: boolean;\n useCheckbox?: boolean;\n colSpan?: number;\n rowSpan?: number;\n style?: CSSProperties;\n render?: () => ReactNode;\n validate?: (v?: number | string) => boolean;\n};\n\ntype OwpFieldTableValue = string | number | '';\ntype OwpFieldTableDataRecord = Record<string, OwpFieldTableValue | undefined>;\n\ninterface OwpFieldTableProps {\n layout: OwpFieldTableCell[][];\n data?: OwpFieldTableDataRecord;\n titleSx?: TableCellProps['sx'];\n treeGridTitleCellSx?: TableCellProps['sx'] & CSSProperties;\n cellSx?: TableCellProps['sx'] & CSSProperties;\n titleWidth?: number | string;\n colGroupSlot?: ReactNode;\n className?: string;\n tableLayout?: 'auto' | 'fixed';\n canUseTreeGridStyle?: boolean;\n}\n\nconst DEFAULT_CHECKBOX_FONT_SIZE = 28;\n\nconst defaultTreeGridTitleCellSx = {\n '&&': {\n fontFamily: 'inherit',\n fontSize: '1.7rem',\n fontWeight: 600,\n lineHeight: 'normal',\n minHeight: 'unset',\n padding: '7px 10px',\n },\n} as const;\n\nconst treeGridContainerSx = {\n borderRadius: 0,\n overflow: 'visible',\n} as const;\n\nconst treeGridFirstRowCellSx = {\n borderTop: '1px solid #CDD8E4',\n} as const;\n\n/** 필수 헤더 타이틀 */\nconst getRequiredTitle = (title: string) => (\n <>\n {title}\n <span className=\"ml-4 text-red-600\">*</span>\n </>\n);\n\nconst getFieldTableValue = (data: OwpFieldTableProps['data'], key: string) => {\n return data?.[key];\n};\n\nconst getCheckboxChecked = (\n value: OwpFieldTableValue | undefined,\n validate?: OwpFieldTableCell['validate'],\n) => {\n if (typeof validate === 'function') {\n return validate(value);\n }\n\n if (isNaN(toNumber(value))) {\n return value === 'Y';\n }\n\n return Boolean(Number(value));\n};\n\nconst getDateFormat = (cell: OwpFieldTableCell) => {\n if (cell.withTime) {\n return 'YYYY-MM-DD HH:mm';\n }\n\n if (cell.withTimeAndSec) {\n return 'YYYY-MM-DD HH:mm:ss';\n }\n\n return 'YYYY-MM-DD';\n};\n\nconst renderFieldTableCellValue = (\n cell: OwpFieldTableCell,\n data: OwpFieldTableProps['data'],\n cellSx?: OwpFieldTableProps['cellSx'],\n): ReactNode => {\n const value = getFieldTableValue(data, cell.key);\n\n if (typeof cell.render === 'function') {\n return cell.render();\n }\n\n if (cell.useCheckbox) {\n return (\n <Checkbox\n checked={getCheckboxChecked(value, cell.validate)}\n sx={{ '& .MuiSvgIcon-root': { fontSize: cellSx?.fontSize ?? DEFAULT_CHECKBOX_FONT_SIZE } }}\n />\n );\n }\n\n if (cell.useDate) {\n return value ? dayjs(value).format(getDateFormat(cell)) : value;\n }\n\n if (cell.disableLocaleString) {\n return value;\n }\n\n return value?.toLocaleString();\n};\n\n/**\n * OwpFieldTable 컴포넌트\n * @param layout layout 값\n * @param titleWidth titleWidth 값\n * @param titleSx titleSx 값\n * @param treeGridTitleCellSx TreeGrid title cell sx 값\n * @param cellSx cellSx 값\n * @param data 데이터\n * @param colGroupSlot colGroupSlot 값\n * @param className className 값\n * @param tableLayout tableLayout 값\n * @param canUseTreeGridStyle TreeGrid 스타일 사용 여부\n */\nexport function OwpFieldTable({\n layout,\n titleWidth,\n titleSx,\n treeGridTitleCellSx,\n cellSx,\n data,\n colGroupSlot,\n className,\n tableLayout = 'fixed',\n canUseTreeGridStyle = false,\n}: OwpFieldTableProps) {\n return (\n <StyledTable\n canUseTreeGridStyle={canUseTreeGridStyle}\n className={clsx('w-full', className)}\n containerProps={{ sx: canUseTreeGridStyle ? treeGridContainerSx : undefined }}\n tableLayout={tableLayout}\n >\n {colGroupSlot}\n <TableBody>\n {layout.map((cols, rowIndex) => (\n <StyledTableRow key={`owp-field-col-${rowIndex}`}>\n {cols.map((col, colIndex) => (\n <Fragment key={`owp-field-cell-${rowIndex}-${colIndex}`}>\n <TableCell\n component=\"th\"\n className=\"whitespace-pre-wrap\"\n width={titleWidth ?? 200}\n sx={{\n ...(canUseTreeGridStyle ? defaultTreeGridTitleCellSx : {}),\n ...(canUseTreeGridStyle ? (treeGridTitleCellSx ?? {}) : {}),\n ...(canUseTreeGridStyle && rowIndex === 0 ? treeGridFirstRowCellSx : {}),\n ...(titleSx ?? {}),\n }}\n rowSpan={col?.rowSpan}\n >\n {col.required ? getRequiredTitle(col.title) : col.title}\n </TableCell>\n <TableCell\n className=\"whitespace-pre-wrap\"\n sx={{\n ...(canUseTreeGridStyle && rowIndex === 0 ? treeGridFirstRowCellSx : {}),\n ...(cellSx ?? {}),\n }}\n style={col?.style ?? {}}\n colSpan={col?.colSpan}\n rowSpan={col?.rowSpan}\n >\n {renderFieldTableCellValue(col, data, cellSx)}\n </TableCell>\n </Fragment>\n ))}\n </StyledTableRow>\n ))}\n </TableBody>\n </StyledTable>\n );\n}\n"],"names":["DEFAULT_CHECKBOX_FONT_SIZE","defaultTreeGridTitleCellSx","treeGridContainerSx","treeGridFirstRowCellSx","getRequiredTitle","__name","title","jsxs","Fragment","jsx","getFieldTableValue","data","key","getCheckboxChecked","value","validate","isNaN","toNumber","getDateFormat","cell","renderFieldTableCellValue","cellSx","Checkbox","dayjs","OwpFieldTable","layout","titleWidth","titleSx","treeGridTitleCellSx","colGroupSlot","className","tableLayout","canUseTreeGridStyle","StyledTable","clsx","TableBody","cols","rowIndex","StyledTableRow","col","colIndex","TableCell"],"mappings":";;;;;;;;;;AAuCA,MAAMA,IAA6B,IAE7BC,IAA6B;AAAA,EACjC,MAAM;AAAA,IACJ,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,SAAS;AAAA,EAAA;AAEb,GAEMC,IAAsB;AAAA,EAC1B,cAAc;AAAA,EACd,UAAU;AACZ,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,YAAA;AAAA,UAAA;AAAA,QAC9C,EAAA,GA1Ba,kBAAkBgB,CAAQ,IAAIG,CAAQ,EA2BrD,CACD,EAAA,GA9BkB,iBAAiBH,CAAQ,EA+B9C,CACD,EAAA,CACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;AA1DgBhC,EAAAmB,GAAA;"}
@@ -1,106 +1,157 @@
1
- var j = Object.defineProperty;
2
- var r = (o, t) => j(o, "name", { value: t, configurable: !0 });
3
- import { jsxs as v, jsx as n } 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 { FormHelperText as O } from "@mui/material";
5
- import P from "@mui/material/FormControl";
6
- import R from "@mui/material/Input";
7
- import V from "@mui/material/InputLabel";
8
- import { useId as b, forwardRef as A } from "react";
9
- import "../../node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/index.js";
10
- import "../../node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/controls/input.js";
11
- import "../../node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/masked/factory.js";
12
- import "../../node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/controls/mask-element.js";
13
- import "../../node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/controls/html-input-mask-element.js";
14
- import "../../node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/controls/html-mask-element.js";
15
- import "../../node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/controls/html-contenteditable-mask-element.js";
16
- import "../../node_modules/.pnpm/imask@7.6.1/node_modules/imask/esm/controls/input-history.js";
17
- import H from "../../node_modules/.pnpm/react-imask@7.6.1_react@19.2.4/node_modules/react-imask/esm/input.js";
18
- import "../../node_modules/.pnpm/react-imask@7.6.1_react@19.2.4/node_modules/react-imask/esm/mixin.js";
19
- const L = A(/* @__PURE__ */ r(function(t, e) {
20
- const { onMaskChange: m, mask: i, definitions: p, name: s, ...a } = t, { onChange: c, ...u } = a;
21
- return /* @__PURE__ */ n(
22
- H,
1
+ var z = Object.defineProperty;
2
+ var i = (e, r) => z(e, "name", { value: r, configurable: !0 });
3
+ import { jsxs as E, jsx as M } 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 { FormHelperText as j } from "@mui/material";
5
+ import y from "@mui/material/FormControl";
6
+ import b from "@mui/material/Input";
7
+ import A from "@mui/material/InputLabel";
8
+ import { useId as H, forwardRef as L, useRef as s, useEffect as p } from "react";
9
+ import { InputMask as P } from "imask";
10
+ function $(e, r) {
11
+ if (typeof e == "function") {
12
+ e(r);
13
+ return;
14
+ }
15
+ e && (e.current = r);
16
+ }
17
+ i($, "assignInputRef");
18
+ function T({
19
+ mask: e,
20
+ definitions: r
21
+ }) {
22
+ return {
23
+ mask: e,
24
+ definitions: r,
25
+ overwrite: !0
26
+ };
27
+ }
28
+ i(T, "buildTextMaskOptions");
29
+ const q = L(/* @__PURE__ */ i(function(r, h) {
30
+ const {
31
+ onMaskChange: c,
32
+ mask: a,
33
+ definitions: l,
34
+ name: f,
35
+ value: o,
36
+ defaultValue: d,
37
+ ownerState: O,
38
+ as: C,
39
+ onChange: R,
40
+ ...V
41
+ } = r, k = s(null), u = s(null), g = s(c), v = s(f), x = s(T({ mask: a, definitions: l })), m = s(o !== void 0 ? o : d);
42
+ p(() => {
43
+ g.current = c;
44
+ }, [c]), p(() => {
45
+ v.current = f;
46
+ }, [f]), p(() => {
47
+ const n = k.current;
48
+ if (!n)
49
+ return;
50
+ const t = new P(
51
+ n,
52
+ x.current
53
+ ), S = /* @__PURE__ */ i(() => {
54
+ g.current({
55
+ target: {
56
+ name: v.current ?? n.name ?? "",
57
+ value: t.value
58
+ },
59
+ unmaskedValue: t.unmaskedValue
60
+ });
61
+ }, "emitMaskChange");
62
+ if (t.on("accept", S), u.current = t, m.current !== void 0) {
63
+ const F = m.current == null ? "" : String(m.current);
64
+ t.value !== F && (t.value = F);
65
+ }
66
+ return () => {
67
+ t.off("accept", S), t.destroy(), u.current === t && (u.current = null);
68
+ };
69
+ }, []), p(() => {
70
+ const n = u.current;
71
+ n && n.updateOptions(T({ mask: a, definitions: l }));
72
+ }, [a, l]), p(() => {
73
+ const n = u.current;
74
+ if (!n || o === void 0)
75
+ return;
76
+ const t = o == null ? "" : String(o);
77
+ n.value !== t && (n.value = t);
78
+ }, [o]);
79
+ const I = o !== void 0 ? o : d, w = I == null ? "" : String(I);
80
+ return /* @__PURE__ */ M(
81
+ "input",
23
82
  {
24
- ...u,
25
- mask: i,
26
- definitions: p,
27
- inputRef: e,
28
- onAccept: /* @__PURE__ */ r((d, f) => {
29
- m({
30
- target: {
31
- name: s ?? "",
32
- value: String(d ?? "")
33
- },
34
- unmaskedValue: f.unmaskedValue
35
- });
36
- }, "onAccept"),
37
- overwrite: !0
83
+ ...V,
84
+ defaultValue: w,
85
+ onChange: R,
86
+ ref: /* @__PURE__ */ i((n) => {
87
+ k.current = n, $(h, n);
88
+ }, "ref")
38
89
  }
39
90
  );
40
91
  }, "TextMaskCustom2"));
41
- function Z({
42
- className: o,
43
- sx: t,
44
- id: e,
45
- name: m,
46
- label: i,
47
- value: p,
48
- defaultValue: s,
49
- color: a,
50
- onChange: c,
51
- error: u,
52
- helperText: d,
53
- mask: f,
54
- definitions: l,
55
- variant: h,
56
- fullWidth: g,
57
- disabled: x,
58
- required: C,
59
- placeholder: I,
60
- autoFocus: M,
61
- inputProps: F,
62
- inputRef: T
92
+ function W({
93
+ className: e,
94
+ sx: r,
95
+ id: h,
96
+ name: c,
97
+ label: a,
98
+ value: l,
99
+ defaultValue: f,
100
+ color: o,
101
+ onChange: d,
102
+ error: O,
103
+ helperText: C,
104
+ mask: R,
105
+ definitions: V,
106
+ variant: k,
107
+ fullWidth: u,
108
+ disabled: g,
109
+ required: v,
110
+ placeholder: x,
111
+ autoFocus: m,
112
+ inputProps: I,
113
+ inputRef: w
63
114
  }) {
64
- const w = b(), k = e ?? `text-mask-input-${w}`;
65
- return /* @__PURE__ */ v(
66
- P,
115
+ const n = H(), t = h ?? `text-mask-input-${n}`;
116
+ return /* @__PURE__ */ E(
117
+ y,
67
118
  {
68
- color: a,
69
- variant: h,
70
- fullWidth: g,
71
- error: u,
72
- disabled: x,
73
- required: C,
119
+ color: o,
120
+ variant: k,
121
+ fullWidth: u,
122
+ error: O,
123
+ disabled: g,
124
+ required: v,
74
125
  children: [
75
- /* @__PURE__ */ n(V, { htmlFor: k, children: i }),
76
- /* @__PURE__ */ n(
77
- R,
126
+ a ? /* @__PURE__ */ M(A, { htmlFor: t, children: a }) : null,
127
+ /* @__PURE__ */ M(
128
+ b,
78
129
  {
79
- className: o,
80
- sx: t,
81
- value: p,
82
- defaultValue: s,
83
- name: m,
84
- id: k,
85
- placeholder: I,
86
- autoFocus: M,
87
- inputRef: T,
88
- inputComponent: L,
130
+ className: e,
131
+ sx: r,
132
+ value: l,
133
+ defaultValue: f,
134
+ name: c,
135
+ id: t,
136
+ placeholder: x,
137
+ autoFocus: m,
138
+ inputRef: w,
139
+ inputComponent: q,
89
140
  inputProps: {
90
- ...F,
91
- onMaskChange: c,
92
- mask: f,
93
- definitions: l
141
+ ...I,
142
+ onMaskChange: d,
143
+ mask: R,
144
+ definitions: V
94
145
  }
95
146
  }
96
147
  ),
97
- /* @__PURE__ */ n(O, { children: d })
148
+ C ? /* @__PURE__ */ M(j, { children: C }) : null
98
149
  ]
99
150
  }
100
151
  );
101
152
  }
102
- r(Z, "OwpTextMaskField");
153
+ i(W, "OwpTextMaskField");
103
154
  export {
104
- Z as OwpTextMaskField
155
+ W as OwpTextMaskField
105
156
  };
106
157
  //# sourceMappingURL=OwpTextMaskField.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"OwpTextMaskField.js","sources":["../../../src/components/OwpTextField/OwpTextMaskField.tsx"],"sourcesContent":["import { FormHelperText } from '@mui/material';\nimport FormControl from '@mui/material/FormControl';\nimport type { FormControlProps } from '@mui/material/FormControl';\nimport Input from '@mui/material/Input';\nimport type { InputProps as MuiInputProps } from '@mui/material/Input';\nimport type { InputBaseComponentProps } from '@mui/material/InputBase';\nimport InputLabel from '@mui/material/InputLabel';\nimport { forwardRef, type ReactNode, useId } from 'react';\nimport { IMaskInput } from 'react-imask';\n\ntype TextMaskFieldChangeEvent = {\n target: { name: string; value: string };\n unmaskedValue: string;\n};\n\ninterface CustomProps {\n onMaskChange: (event: TextMaskFieldChangeEvent) => void;\n name?: string;\n mask: string;\n definitions?: Record<string, unknown>;\n}\n\ntype OwpTextMaskFieldProps = Omit<MuiInputProps, 'onChange' | 'inputComponent'> &\n Omit<CustomProps, 'onMaskChange'> & {\n label?: ReactNode;\n helperText?: ReactNode;\n variant?: FormControlProps['variant'];\n onChange: CustomProps['onMaskChange'];\n };\n\n/** 마스크 입력 어댑터 */\ntype TextMaskCustomProps = InputBaseComponentProps & CustomProps;\n\nconst TextMaskCustom = forwardRef<HTMLInputElement, TextMaskCustomProps>(function TextMaskCustom(\n props,\n ref,\n) {\n const { onMaskChange, mask, definitions, name, ...other } = props;\n const { onChange: ignoredOnChange, ...imaskInputProps } = other;\n\n void ignoredOnChange;\n\n return (\n <IMaskInput\n {...imaskInputProps}\n mask={mask}\n definitions={definitions}\n inputRef={ref}\n onAccept={(value, maskRef) => {\n onMaskChange({\n target: {\n name: name ?? '',\n value: String(value ?? ''),\n },\n unmaskedValue: maskRef.unmaskedValue,\n });\n }}\n overwrite\n />\n );\n});\n\n/**\n * 마스크 텍스트 입력 필드\n * @param mask 입력 마스크 문자열\n * @param definitions 사용자 정의 마스크 정의\n * @param onChange 마스크 변경 이벤트 핸들러\n */\nexport function OwpTextMaskField({\n className,\n sx,\n id: idProp,\n name,\n label,\n value,\n defaultValue,\n color,\n onChange,\n error,\n helperText,\n mask,\n definitions,\n variant,\n fullWidth,\n disabled,\n required,\n placeholder,\n autoFocus,\n inputProps,\n inputRef,\n}: OwpTextMaskFieldProps) {\n const generatedId = useId();\n const id = idProp ?? `text-mask-input-${generatedId}`;\n\n return (\n <FormControl\n color={color}\n variant={variant}\n fullWidth={fullWidth}\n error={error}\n disabled={disabled}\n required={required}\n >\n <InputLabel htmlFor={id}>{label}</InputLabel>\n <Input\n className={className}\n sx={sx}\n value={value}\n defaultValue={defaultValue}\n name={name}\n id={id}\n placeholder={placeholder}\n autoFocus={autoFocus}\n inputRef={inputRef}\n inputComponent={TextMaskCustom}\n inputProps={{\n ...inputProps,\n onMaskChange: onChange,\n mask,\n definitions,\n }}\n />\n <FormHelperText>{helperText}</FormHelperText>\n </FormControl>\n );\n}\n"],"names":["TextMaskCustom","forwardRef","__name","props","ref","onMaskChange","mask","definitions","name","other","ignoredOnChange","imaskInputProps","jsx","IMaskInput","value","maskRef","OwpTextMaskField","className","sx","idProp","label","defaultValue","color","onChange","error","helperText","variant","fullWidth","disabled","required","placeholder","autoFocus","inputProps","inputRef","generatedId","useId","id","jsxs","FormControl","InputLabel","Input","FormHelperText"],"mappings":";;;;;;;;;;;;;;;;;;AAiCA,MAAMA,IAAiBC,EAAkD,gBAAAC,EAAA,SACvEC,GACAC,GACA;AACA,QAAM,EAAE,cAAAC,GAAc,MAAAC,GAAM,aAAAC,GAAa,MAAAC,GAAM,GAAGC,MAAUN,GACtD,EAAE,UAAUO,GAAiB,GAAGC,MAAoBF;AAI1D,SACE,gBAAAG;AAAA,IAACC;AAAA,IAAA;AAAA,MACE,GAAGF;AAAA,MACJ,MAAAL;AAAA,MACA,aAAAC;AAAA,MACA,UAAUH;AAAA,MACV,UAAU,gBAAAF,EAAA,CAACY,GAAOC,MAAY;AAC5B,QAAAV,EAAa;AAAA,UACX,QAAQ;AAAA,YACN,MAAMG,KAAQ;AAAA,YACd,OAAO,OAAOM,KAAS,EAAE;AAAA,UAAA;AAAA,UAE3B,eAAeC,EAAQ;AAAA,QAAA,CACxB;AAAA,MACH,GARU;AAAA,MASV,WAAS;AAAA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vB,EAAAc,GAAA;"}
1
+ {"version":3,"file":"OwpTextMaskField.js","sources":["../../../src/components/OwpTextField/OwpTextMaskField.tsx"],"sourcesContent":["import { FormHelperText } from '@mui/material';\nimport FormControl from '@mui/material/FormControl';\nimport type { FormControlProps } from '@mui/material/FormControl';\nimport Input from '@mui/material/Input';\nimport type { InputProps as MuiInputProps } from '@mui/material/Input';\nimport type { InputBaseComponentProps } from '@mui/material/InputBase';\nimport InputLabel from '@mui/material/InputLabel';\nimport {\n forwardRef,\n type ForwardedRef,\n type ReactNode,\n useEffect,\n useId,\n useRef,\n} from 'react';\nimport { InputMask as IMaskInput, type Definitions, type FactoryOpts } from 'imask';\n\ntype TextMaskFieldChangeEvent = {\n target: { name: string; value: string };\n unmaskedValue: string;\n};\n\ntype TextMaskValue = FactoryOpts['mask'];\n\ninterface CustomProps {\n onMaskChange: (event: TextMaskFieldChangeEvent) => void;\n name?: string;\n mask: TextMaskValue;\n definitions?: Definitions;\n}\n\ntype OwpTextMaskFieldProps = Omit<MuiInputProps, 'onChange' | 'inputComponent'> &\n Omit<CustomProps, 'onMaskChange'> & {\n label?: ReactNode;\n helperText?: ReactNode;\n variant?: FormControlProps['variant'];\n onChange: CustomProps['onMaskChange'];\n };\n\n/** 마스크 입력 어댑터 */\ntype TextMaskCustomProps = InputBaseComponentProps & CustomProps;\n\ntype TextMaskOptions = FactoryOpts & {\n definitions?: Definitions;\n overwrite: true;\n};\n\n/** ref 전달 정규화 */\nfunction assignInputRef<T>(ref: ForwardedRef<T>, value: T | null) {\n if (typeof ref === 'function') {\n ref(value);\n return;\n }\n\n if (ref) {\n ref.current = value;\n }\n}\n\n/** 마스크 옵션 생성 */\nfunction buildTextMaskOptions({\n mask,\n definitions,\n}: Pick<CustomProps, 'mask' | 'definitions'>): TextMaskOptions {\n return {\n mask,\n definitions,\n overwrite: true,\n } as TextMaskOptions;\n}\n\nconst TextMaskCustom = forwardRef<HTMLInputElement, TextMaskCustomProps>(function TextMaskCustom(\n props,\n ref,\n) {\n const {\n onMaskChange,\n mask,\n definitions,\n name,\n value,\n defaultValue,\n ownerState: ignoredOwnerState,\n as: ignoredAs,\n onChange,\n ...other\n } = props;\n const inputElementRef = useRef<HTMLInputElement | null>(null);\n const maskRef = useRef<IMaskInput<FactoryOpts> | null>(null);\n const onMaskChangeRef = useRef(onMaskChange);\n const nameRef = useRef(name);\n const initialMaskOptionsRef = useRef(buildTextMaskOptions({ mask, definitions }));\n const initialValueRef = useRef(value !== undefined ? value : defaultValue);\n\n void ignoredOwnerState;\n void ignoredAs;\n\n useEffect(() => {\n onMaskChangeRef.current = onMaskChange;\n }, [onMaskChange]);\n\n useEffect(() => {\n nameRef.current = name;\n }, [name]);\n\n useEffect(() => {\n const inputElement = inputElementRef.current;\n\n if (!inputElement) {\n return;\n }\n\n const maskInstance = new IMaskInput(\n inputElement,\n initialMaskOptionsRef.current as FactoryOpts,\n );\n const emitMaskChange = () => {\n onMaskChangeRef.current({\n target: {\n name: nameRef.current ?? inputElement.name ?? '',\n value: maskInstance.value,\n },\n unmaskedValue: maskInstance.unmaskedValue,\n });\n };\n\n maskInstance.on('accept', emitMaskChange);\n maskRef.current = maskInstance;\n\n if (initialValueRef.current !== undefined) {\n const normalizedInitialValue =\n initialValueRef.current == null ? '' : String(initialValueRef.current);\n\n if (maskInstance.value !== normalizedInitialValue) {\n maskInstance.value = normalizedInitialValue;\n }\n }\n\n return () => {\n maskInstance.off('accept', emitMaskChange);\n maskInstance.destroy();\n\n if (maskRef.current === maskInstance) {\n maskRef.current = null;\n }\n };\n }, []);\n\n useEffect(() => {\n const maskInstance = maskRef.current;\n\n if (!maskInstance) {\n return;\n }\n\n maskInstance.updateOptions(buildTextMaskOptions({ mask, definitions }) as FactoryOpts);\n }, [mask, definitions]);\n\n useEffect(() => {\n const maskInstance = maskRef.current;\n\n if (!maskInstance || value === undefined) {\n return;\n }\n\n const normalizedValue = value == null ? '' : String(value);\n\n if (maskInstance.value !== normalizedValue) {\n maskInstance.value = normalizedValue;\n }\n }, [value]);\n\n const initialValue = value !== undefined ? value : defaultValue;\n const normalizedInitialValue = initialValue == null ? '' : String(initialValue);\n\n return (\n <input\n {...other}\n defaultValue={normalizedInitialValue}\n onChange={onChange}\n ref={(element) => {\n inputElementRef.current = element;\n assignInputRef(ref, element);\n }}\n />\n );\n});\n\n/**\n * 마스크 텍스트 입력 필드\n * @param mask 입력 마스크 정의\n * @param definitions 사용자 정의 마스크 정의\n * @param onChange 마스크 변경 이벤트 핸들러\n */\nexport function OwpTextMaskField({\n className,\n sx,\n id: idProp,\n name,\n label,\n value,\n defaultValue,\n color,\n onChange,\n error,\n helperText,\n mask,\n definitions,\n variant,\n fullWidth,\n disabled,\n required,\n placeholder,\n autoFocus,\n inputProps,\n inputRef,\n}: OwpTextMaskFieldProps) {\n const generatedId = useId();\n const id = idProp ?? `text-mask-input-${generatedId}`;\n\n return (\n <FormControl\n color={color}\n variant={variant}\n fullWidth={fullWidth}\n error={error}\n disabled={disabled}\n required={required}\n >\n {label ? <InputLabel htmlFor={id}>{label}</InputLabel> : null}\n <Input\n className={className}\n sx={sx}\n value={value}\n defaultValue={defaultValue}\n name={name}\n id={id}\n placeholder={placeholder}\n autoFocus={autoFocus}\n inputRef={inputRef}\n inputComponent={TextMaskCustom}\n inputProps={{\n ...inputProps,\n onMaskChange: onChange,\n mask,\n definitions,\n }}\n />\n {helperText ? <FormHelperText>{helperText}</FormHelperText> : null}\n </FormControl>\n );\n}\n"],"names":["assignInputRef","ref","value","__name","buildTextMaskOptions","mask","definitions","TextMaskCustom","forwardRef","props","onMaskChange","name","defaultValue","ignoredOwnerState","ignoredAs","onChange","other","inputElementRef","useRef","maskRef","onMaskChangeRef","nameRef","initialMaskOptionsRef","initialValueRef","useEffect","inputElement","maskInstance","IMaskInput","emitMaskChange","normalizedInitialValue","normalizedValue","initialValue","jsx","element","OwpTextMaskField","className","sx","idProp","label","color","error","helperText","variant","fullWidth","disabled","required","placeholder","autoFocus","inputProps","inputRef","generatedId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