@pdg/react-table 1.0.72 → 1.0.74

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.
@@ -11,3 +11,4 @@ export declare const ValueClipboard: import("@emotion/styled").StyledComponent<i
11
11
  export declare const ClipboardIconButton: import("@emotion/styled").StyledComponent<import("@mui/material").IconButtonOwnProps & Omit<import("@mui/material").ButtonBaseOwnProps, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
12
12
  ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
13
13
  }, "style" | "className" | "tabIndex" | "color" | "children" | "sx" | "classes" | "action" | "centerRipple" | "disabled" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "edge" | "size"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
14
+ export declare const Line: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -4,9 +4,10 @@ import { CommonSxProps } from '../@types';
4
4
  export interface InfoTableInfo {
5
5
  [key: string]: any;
6
6
  }
7
- export type InfoTableItemType = 'text' | 'number' | 'tel' | 'url' | 'email' | 'date' | 'datetime' | 'date-hour' | 'date-minute' | 'company_no' | 'personal_no';
7
+ export type InfoTableItemType = 'text' | 'number' | 'tel' | 'url' | 'email' | 'date' | 'datetime' | 'date-hour' | 'date-minute' | 'company_no' | 'personal_no' | 'divider';
8
8
  export interface InfoTableItem<T = InfoTableInfo> {
9
- label: ReactNode;
9
+ icon?: string;
10
+ label?: ReactNode;
10
11
  name?: keyof T;
11
12
  type?: InfoTableItemType;
12
13
  ellipsis?: boolean;
@@ -15,6 +16,8 @@ export interface InfoTableItem<T = InfoTableInfo> {
15
16
  dateTwoLine?: boolean;
16
17
  numberPrefix?: string;
17
18
  numberSuffix?: string;
19
+ dividerColor?: TypographyProps['color'];
20
+ dividerLine?: boolean;
18
21
  style?: CommonSxProps['style'];
19
22
  sx?: BoxProps['sx'];
20
23
  labelClassName?: string;
@@ -56,6 +59,7 @@ export interface InfoTableProps<T = InfoTableInfo> {
56
59
  labelColor?: TypographyProps['color'];
57
60
  labelStyle?: CommonSxProps['style'];
58
61
  labelSx?: BoxProps['sx'];
62
+ dividerColor?: TypographyProps['color'];
59
63
  valueClassName?: string;
60
64
  valueStyle?: CommonSxProps['style'];
61
65
  valueSx?: CommonSxProps['sx'];
@@ -65,4 +69,4 @@ export interface InfoTableProps<T = InfoTableInfo> {
65
69
  items: InfoTableItems<T>;
66
70
  onCopyToClipboard?(item: InfoTableItem<T>, text: string): void;
67
71
  }
68
- export declare const InfoTableDefaultProps: Pick<InfoTableProps, 'spacing' | 'columnSpacing' | 'rowSpacing' | 'labelColor'>;
72
+ export declare const InfoTableDefaultProps: Pick<InfoTableProps, 'spacing' | 'columnSpacing' | 'rowSpacing' | 'labelColor' | 'dividerColor'>;
package/dist/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import*as React from'react';import React__default,{useRef,useState,useCallback,useEffect,isValidElement,createRef,cloneElement,PureComponent,createContext,useContext,useMemo,useLayoutEffect,useId}from'react';import {styled,TableRow,lighten,TableCell,Box,Tooltip,Checkbox,Stack,Pagination,useTheme,TableHead,TableBody,Icon,TableFooter,Paper,Table as Table$1,Grid,Button,Popper,Grow,ClickAwayListener,IconButton}from'@mui/material';import {findDOMNode}from'react-dom';import {useSortable,sortableKeyboardCoordinates,arrayMove,SortableContext,verticalListSortingStrategy}from'@dnd-kit/sortable';import dayjs from'dayjs';import {useSensors,useSensor,MouseSensor,TouchSensor,KeyboardSensor,DndContext,closestCenter}from'@dnd-kit/core';import {Search,SearchGroup,FormHidden}from'@pdg/react-form';/******************************************************************************
1
+ import*as React from'react';import React__default,{useRef,useState,useCallback,useEffect,isValidElement,createRef,cloneElement,PureComponent,createContext,useContext,useMemo,useLayoutEffect,useId}from'react';import {styled,TableRow,lighten,TableCell,Box,Tooltip,Checkbox,Stack,Pagination,useTheme,TableHead,TableBody,Icon,TableFooter,Paper,Table as Table$1,Grid,Button,Popper,Grow,ClickAwayListener,IconButton}from'@mui/material';import {findDOMNode}from'react-dom';import {useSortable,sortableKeyboardCoordinates,arrayMove,SortableContext,verticalListSortingStrategy}from'@dnd-kit/sortable';import dayjs from'dayjs';import {useSensors,useSensor,MouseSensor,TouchSensor,KeyboardSensor,DndContext,closestCenter}from'@dnd-kit/core';import {Search,SearchGroup,FormHidden,FormIcon}from'@pdg/react-form';/******************************************************************************
2
2
  Copyright (c) Microsoft Corporation.
3
3
 
4
4
  Permission to use, copy, modify, and/or distribute this software for any
@@ -2793,7 +2793,7 @@ function typographyColorToSxColor(color) {
2793
2793
  * @returns 하이픈이 추가된 사업자등록번호
2794
2794
  * ******************************************************************************************************************/
2795
2795
  function companyNoAutoDash(companyNo) {
2796
- var str = companyNo.replace(/[^0-9]/g, '');
2796
+ var str = companyNo.replace(/[^0-9*]/g, '');
2797
2797
  var values = [str.slice(0, 3)];
2798
2798
  if (str.length > 3)
2799
2799
  values.push(str.slice(3, 5));
@@ -2806,7 +2806,7 @@ function companyNoAutoDash(companyNo) {
2806
2806
  * @returns 하이픈 추가된 주민등록번호
2807
2807
  * ******************************************************************************************************************/
2808
2808
  function personalNoAutoDash(personalNo) {
2809
- var str = personalNo.replace(/[^0-9]/g, '');
2809
+ var str = personalNo.replace(/[^0-9*]/g, '');
2810
2810
  var values = [str.slice(0, 6)];
2811
2811
  if (str.length > 6)
2812
2812
  values.push(str.slice(6));
@@ -4607,13 +4607,15 @@ TableMenuButton.defaultProps = TableMenuButtonDefaultProps;var InfoTableDefaultP
4607
4607
  spacing: 2,
4608
4608
  rowSpacing: 3,
4609
4609
  labelColor: 'primary',
4610
+ dividerColor: 'gray',
4610
4611
  };var Label = styled(Box)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font-size: 12px;\n font-weight: bold;\n"], ["\n font-size: 12px;\n font-weight: bold;\n"])));
4611
4612
  var ValueWrap = styled(Box)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n margin-top: 3px;\n position: relative;\n display: flex;\n flex-direction: row;\n"], ["\n margin-top: 3px;\n position: relative;\n display: flex;\n flex-direction: row;\n"])));
4612
4613
  var Value = styled('div')(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n flex: 1;\n"], ["\n flex: 1;\n"])));
4613
4614
  var ValueEllipsis = styled('div')(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n flex: 1;\n position: relative;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n"], ["\n flex: 1;\n position: relative;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n"])));
4614
4615
  var ValueClipboard = styled('div')(templateObject_5 || (templateObject_5 = __makeTemplateObject([""], [""])));
4615
4616
  var ClipboardIconButton = styled(IconButton)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n margin-top: -10px;\n margin-bottom: -10px;\n"], ["\n margin-top: -10px;\n margin-bottom: -10px;\n"])));
4616
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;var Component = {};var toggleSelection = function () {
4617
+ var Line = styled('div')(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n border-top: 1px solid #efefef;\n height: 1px;\n flex: 1;\n"], ["\n border-top: 1px solid #efefef;\n height: 1px;\n flex: 1;\n"])));
4618
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;var Component = {};var toggleSelection = function () {
4617
4619
  var selection = document.getSelection();
4618
4620
  if (!selection.rangeCount) {
4619
4621
  return function () {};
@@ -4878,7 +4880,7 @@ _defineProperty(CopyToClipboard$1, "defaultProps", {
4878
4880
 
4879
4881
  CopyToClipboard.CopyToClipboard = CopyToClipboard;
4880
4882
  var lib = CopyToClipboard;var InfoTable = function (_a) {
4881
- var cols = _a.cols, spacing = _a.spacing, columnSpacing = _a.columnSpacing, rowSpacing = _a.rowSpacing, className = _a.className, style = _a.style, sx = _a.sx, labelClassName = _a.labelClassName, labelColor = _a.labelColor, labelStyle = _a.labelStyle, labelSx = _a.labelSx, valueClassName = _a.valueClassName, valueStyle = _a.valueStyle, valueSx = _a.valueSx, ellipsis = _a.ellipsis, valueUnderline = _a.valueUnderline, info = _a.info, items = _a.items, onCopyToClipboard = _a.onCopyToClipboard;
4883
+ var cols = _a.cols, spacing = _a.spacing, columnSpacing = _a.columnSpacing, rowSpacing = _a.rowSpacing, className = _a.className, style = _a.style, sx = _a.sx, labelClassName = _a.labelClassName, labelColor = _a.labelColor, labelStyle = _a.labelStyle, labelSx = _a.labelSx, dividerColor = _a.dividerColor, valueClassName = _a.valueClassName, valueStyle = _a.valueStyle, valueSx = _a.valueSx, ellipsis = _a.ellipsis, valueUnderline = _a.valueUnderline, info = _a.info, items = _a.items, onCopyToClipboard = _a.onCopyToClipboard;
4882
4884
  var sizeProps = useMemo(function () {
4883
4885
  var value = {};
4884
4886
  if (typeof cols === 'number') {
@@ -4900,7 +4902,7 @@ var lib = CopyToClipboard;var InfoTable = function (_a) {
4900
4902
  }, [cols]);
4901
4903
  return (React__default.createElement(Grid, { container: true, spacing: spacing, columnSpacing: columnSpacing, rowSpacing: rowSpacing, className: classNames('InfoTable', className), style: style, sx: sx }, items.map(function (item, idx) {
4902
4904
  if (item) {
4903
- var finalLabelColor = typographyColorToSxColor(item.labelColor || labelColor);
4905
+ var finalLabelColor = typographyColorToSxColor(item.type === 'divider' ? item.dividerColor || dividerColor : item.labelColor || labelColor);
4904
4906
  var finalLabelSx = combineSx(labelSx, item.labelSx, !!finalLabelColor && { color: finalLabelColor });
4905
4907
  var finalValueSx = combineSx(valueSx, item.valueSx);
4906
4908
  var valueUnderlineStyle = valueUnderline
@@ -5015,8 +5017,15 @@ var lib = CopyToClipboard;var InfoTable = function (_a) {
5015
5017
  if (empty(data))
5016
5018
  data = item.onRenderEmpty ? item.onRenderEmpty(info) : React__default.createElement(React__default.Fragment, null, "\u00A0");
5017
5019
  var copyToClipboardText_1 = item.clipboardText || (typeof data === 'string' ? data : typeof data === 'number' ? data.toString() : '');
5018
- return (React__default.createElement(Grid, __assign$3({ key: idx, item: true }, finalSizeProps, { className: item.className, style: item.style, sx: item.sx }),
5019
- React__default.createElement(Label, { className: classNames(labelClassName, item.labelClassName), style: __assign$3(__assign$3({}, item.labelStyle), labelStyle), sx: finalLabelSx }, item.label),
5020
+ return item.type === 'divider' ? (React__default.createElement(Grid, { key: idx, item: true, xs: 12 },
5021
+ React__default.createElement(Stack, { direction: 'row', spacing: 0.5, alignItems: 'center' },
5022
+ item.icon && (React__default.createElement(FormIcon, { sx: { color: item.dividerColor || dividerColor }, fontSize: 'small' }, item.icon)),
5023
+ item.label && (React__default.createElement(Label, { className: classNames(labelClassName, item.labelClassName), style: __assign$3(__assign$3({}, item.labelStyle), labelStyle), sx: finalLabelSx }, item.label)),
5024
+ item.dividerLine && (React__default.createElement(React__default.Fragment, null, item.icon || item.label ? (React__default.createElement("div", { style: { flex: 1, paddingLeft: 5 } },
5025
+ React__default.createElement(Line, null))) : (React__default.createElement(Line, null))))))) : (React__default.createElement(Grid, __assign$3({ key: idx, item: true }, finalSizeProps, { className: item.className, style: item.style, sx: item.sx }),
5026
+ React__default.createElement(Stack, { direction: 'row', spacing: 0.5, alignItems: 'center' },
5027
+ item.icon && (React__default.createElement(FormIcon, { sx: { color: finalLabelColor }, fontSize: 'small' }, "CalendarMonth")),
5028
+ React__default.createElement(Label, { className: classNames(labelClassName, item.labelClassName), style: __assign$3(__assign$3({}, item.labelStyle), labelStyle), sx: finalLabelSx }, item.label)),
5020
5029
  React__default.createElement(ValueWrap, { className: classNames(valueClassName, item.valueClassName), style: __assign$3(__assign$3(__assign$3({}, valueStyle), item.valueStyle), valueUnderlineStyle), sx: finalValueSx },
5021
5030
  item.ellipsis || ellipsis ? React__default.createElement(ValueEllipsis, null, data) : React__default.createElement(Value, null, data),
5022
5031
  item.clipboard && notEmpty(copyToClipboardText_1) && (React__default.createElement(ValueClipboard, null,