@pdg/react-table 1.0.79 → 1.0.80

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.
@@ -1,9 +1 @@
1
- declare const ll: (message?: any, ...optionalParams: any[]) => void;
2
- declare const nextTick: (callback: () => void) => void;
3
- export { ll, nextTick };
4
- export * from './compare';
5
- export * from './number';
6
1
  export * from './table';
7
- export * from './tel';
8
- export * from './companyNo';
9
- export * from './personalNo';
package/dist/index.d.ts CHANGED
@@ -3,5 +3,4 @@ export * from './Table';
3
3
  export * from './SearchTable';
4
4
  export * from './TableButton';
5
5
  export * from './TableMenuButton';
6
- export * from './TableIcon';
7
6
  export * from './InfoTable';
package/dist/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import React,{createContext,useContext,useMemo,useCallback,useState,useEffect,useRef,useLayoutEffect,useId}from'react';import classNames from'classnames';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 SimpleBar from'simplebar-react';import {useResizeDetector}from'react-resize-detector';import {useSortable,sortableKeyboardCoordinates,arrayMove,SortableContext,verticalListSortingStrategy}from'@dnd-kit/sortable';import dayjs from'dayjs';import {useAutoUpdateLayoutState}from'@pdg/react-hook';import {useSensors,useSensor,MouseSensor,TouchSensor,KeyboardSensor,DndContext,closestCenter}from'@dnd-kit/core';import'simplebar-react/dist/simplebar.min.css';import {v4}from'uuid';import {Search,SearchGroup,FormHidden,FormIcon}from'@pdg/react-form';import {CopyToClipboard}from'react-copy-to-clipboard';/******************************************************************************
1
+ import React,{createContext,useContext,useMemo,useCallback,useState,useEffect,useRef,useLayoutEffect,useId}from'react';import classNames from'classnames';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 SimpleBar from'simplebar-react';import {useResizeDetector}from'react-resize-detector';import {useSortable,sortableKeyboardCoordinates,arrayMove,SortableContext,verticalListSortingStrategy}from'@dnd-kit/sortable';import dayjs from'dayjs';import {personalNoAutoDash,companyNoAutoDash,telAutoDash,numberFormat,notEmpty,equal,empty}from'@pdg/util';import {useAutoUpdateLayoutState}from'@pdg/react-hook';import {useSensors,useSensor,MouseSensor,TouchSensor,KeyboardSensor,DndContext,closestCenter}from'@dnd-kit/core';import'simplebar-react/dist/simplebar.min.css';import {v4}from'uuid';import {Search,SearchGroup,FormHidden,FormIcon}from'@pdg/react-form';import {PdgIcon}from'@pdg/react-component';import {CopyToClipboard}from'react-copy-to-clipboard';/******************************************************************************
2
2
  Copyright (c) Microsoft Corporation.
3
3
 
4
4
  Permission to use, copy, modify, and/or distribute this software for any
@@ -111,49 +111,7 @@ var templateObject_1$4;var TableBodyRowDefaultProps = {};const CSS = /*#__PURE__
111
111
  }
112
112
 
113
113
  }
114
- });var empty = function (v) {
115
- var result = false;
116
- if (v == null) {
117
- result = true;
118
- }
119
- else if (typeof v === 'string') {
120
- result = v === '';
121
- }
122
- else if (typeof v === 'object') {
123
- if (Array.isArray(v)) {
124
- result = v.length === 0;
125
- }
126
- else if (!(v instanceof Date)) {
127
- result = Object.entries(v).length === 0;
128
- }
129
- }
130
- return result;
131
- };
132
- var notEmpty = function (v) {
133
- return !empty(v);
134
- };
135
- var equal = function (v1, v2) {
136
- if (v1 === v2)
137
- return true;
138
- if (typeof v1 !== typeof v2)
139
- return false;
140
- if (v1 == null || v2 == null)
141
- return false;
142
- if (Array.isArray(v1) && Array.isArray(v2)) {
143
- if (v1.length !== v2.length)
144
- return false;
145
- for (var i = 0; i < v1.length; i += 1) {
146
- if (v1[i] !== v2[i])
147
- return false;
148
- }
149
- }
150
- else {
151
- return v1 === v2;
152
- }
153
- return true;
154
- };function numberWithThousandSeparator(x) {
155
- return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
156
- }function getTableColumnAlign(column, defaultAlign) {
114
+ });function getTableColumnAlign(column, defaultAlign) {
157
115
  switch (column.type) {
158
116
  case 'number':
159
117
  return column.align ? column.align : 'right';
@@ -187,96 +145,6 @@ function typographyColorToSxColor(color) {
187
145
  else {
188
146
  return color;
189
147
  }
190
- }function getTelAutoDash(tel) {
191
- if (tel == null)
192
- return null;
193
- var str = tel.replace(/[^0-9*]/g, '');
194
- var isLastDash = tel.substr(tel.length - 1, 1) === '-';
195
- if (str.substr(0, 1) !== '0' && !['15', '16', '18'].includes(str.substr(0, 2))) {
196
- return tel;
197
- }
198
- var tmp = '';
199
- var preLen;
200
- switch (str.substr(0, 2)) {
201
- case '02':
202
- preLen = 2;
203
- break;
204
- case '15':
205
- case '16':
206
- case '18':
207
- preLen = 4;
208
- break;
209
- default:
210
- preLen = 3;
211
- }
212
- if (['15', '16', '18'].includes(str.substr(0, 2))) {
213
- if (str.length <= preLen) {
214
- tmp = str;
215
- }
216
- else if (str.length <= preLen + 4) {
217
- tmp += str.substr(0, preLen);
218
- tmp += '-';
219
- tmp += str.substr(preLen);
220
- }
221
- else {
222
- tmp = str;
223
- }
224
- }
225
- else if (str.length <= preLen) {
226
- tmp = str;
227
- }
228
- else if (str.length <= preLen + 3) {
229
- tmp += str.substr(0, preLen);
230
- tmp += '-';
231
- tmp += str.substr(preLen);
232
- }
233
- else if (str.length <= preLen + 7) {
234
- tmp += str.substr(0, preLen);
235
- tmp += '-';
236
- tmp += str.substr(preLen, 3);
237
- tmp += '-';
238
- tmp += str.substr(preLen + 3);
239
- }
240
- else if (str.length <= preLen + 8) {
241
- tmp += str.substr(0, preLen);
242
- tmp += '-';
243
- tmp += str.substr(preLen, 4);
244
- tmp += '-';
245
- tmp += str.substr(preLen + 4);
246
- }
247
- else {
248
- tmp = str;
249
- }
250
- if (isLastDash) {
251
- if (str.length === preLen) {
252
- tmp += '-';
253
- }
254
- }
255
- return tmp;
256
- }/********************************************************************************************************************
257
- * 사업자등록번호 하이픈 추가
258
- * @param companyNo 사업자등록번호
259
- * @returns 하이픈이 추가된 사업자등록번호
260
- * ******************************************************************************************************************/
261
- function companyNoAutoDash(companyNo) {
262
- var str = companyNo.replace(/[^0-9*]/g, '');
263
- var values = [str.slice(0, 3)];
264
- if (str.length > 3)
265
- values.push(str.slice(3, 5));
266
- if (str.length > 5)
267
- values.push(str.slice(5));
268
- return values.join('-');
269
- }/********************************************************************************************************************
270
- * 주민등록번호에 하이픈 추가하는 함수
271
- * @param personalNo 주민등록번호
272
- * @returns 하이픈 추가된 주민등록번호
273
- * ******************************************************************************************************************/
274
- function personalNoAutoDash(personalNo) {
275
- var str = personalNo.replace(/[^0-9*]/g, '');
276
- var values = [str.slice(0, 6)];
277
- if (str.length > 6)
278
- values.push(str.slice(6));
279
- return values.join('-');
280
148
  }var TableContextDefaultValue = {
281
149
  menuOpen: false,
282
150
  openMenuId: undefined,
@@ -509,7 +377,7 @@ var TableBodyCell = function (_a) {
509
377
  switch (column.type) {
510
378
  case 'number':
511
379
  if (typeof data === 'string' || typeof data === 'number') {
512
- data = numberWithThousandSeparator(data);
380
+ data = numberFormat(data);
513
381
  }
514
382
  if (column.numberPrefix) {
515
383
  data = (React.createElement(React.Fragment, null,
@@ -524,7 +392,7 @@ var TableBodyCell = function (_a) {
524
392
  break;
525
393
  case 'tel':
526
394
  if (typeof data === 'string') {
527
- data = getTelAutoDash(data);
395
+ data = telAutoDash(data);
528
396
  }
529
397
  break;
530
398
  case 'company_no':
@@ -1777,20 +1645,12 @@ SearchTable.displayName = 'SearchTable';
1777
1645
  SearchTable.defaultProps = SearchTableDefaultProps;var TableButtonDefaultProps = {
1778
1646
  variant: 'outlined',
1779
1647
  color: 'primary',
1780
- };var TableIconDefaultProps = {};var TableIcon = React.forwardRef(function (_a, ref) {
1781
- // Memo --------------------------------------------------------------------------------------------------------------
1782
- var className = _a.className, initChildren = _a.children, props = __rest(_a, ["className", "children"]);
1783
- var children = useMemo(function () { return initChildren.replace(/[A-Z]/g, function (letter, idx) { return "".concat(idx > 0 ? '_' : '').concat(letter.toLowerCase()); }); }, [initChildren]);
1784
- // Render ----------------------------------------------------------------------------------------------------------
1785
- return (React.createElement(Icon, __assign({ ref: ref }, props, { className: classNames('TableIcon', className) }), children));
1786
- });
1787
- TableIcon.displayName = 'TableIcon';
1788
- TableIcon.defaultProps = TableIconDefaultProps;var TableButton = React.forwardRef(function (_a, ref) {
1648
+ };var TableButton = React.forwardRef(function (_a, ref) {
1789
1649
  var children = _a.children, className = _a.className, initSx = _a.sx, color = _a.color, icon = _a.icon, startIcon = _a.startIcon, endIcon = _a.endIcon, onClick = _a.onClick, props = __rest(_a, ["children", "className", "sx", "color", "icon", "startIcon", "endIcon", "onClick"]);
1790
1650
  var sx = useMemo(function () { return (__assign({ minWidth: 0, px: !startIcon && !endIcon ? 0.7 : 1.7 }, initSx)); }, [endIcon, initSx, startIcon]);
1791
1651
  // Render ----------------------------------------------------------------------------------------------------------
1792
- return (React.createElement(Button, __assign({ ref: ref, className: classNames(className, 'TableButton'), type: 'button', size: 'small', sx: sx, color: color, onClick: onClick, startIcon: startIcon ? (React.createElement(TableIcon, { fontSize: 'small', sx: { mr: -0.5 } }, startIcon)) : undefined, endIcon: endIcon ? (React.createElement(TableIcon, { fontSize: 'small', sx: { ml: -0.5 } }, endIcon)) : undefined }, props),
1793
- icon && (React.createElement(TableIcon, { fontSize: 'small', color: color }, icon)),
1652
+ return (React.createElement(Button, __assign({ ref: ref, className: classNames(className, 'TableButton'), type: 'button', size: 'small', sx: sx, color: color, onClick: onClick, startIcon: startIcon ? (React.createElement(PdgIcon, { fontSize: 'small', sx: { mr: -0.5 } }, startIcon)) : undefined, endIcon: endIcon ? (React.createElement(PdgIcon, { fontSize: 'small', sx: { ml: -0.5 } }, endIcon)) : undefined }, props),
1653
+ icon && (React.createElement(PdgIcon, { fontSize: 'small', color: color }, icon)),
1794
1654
  children));
1795
1655
  });
1796
1656
  TableButton.displayName = 'TableButton';
@@ -1870,8 +1730,8 @@ TableButton.defaultProps = TableButtonDefaultProps;var TableMenuButtonDefaultPro
1870
1730
  }
1871
1731
  }
1872
1732
  anchorRef.current = r;
1873
- }, id: buttonId, "aria-controls": open ? menuId : undefined, "aria-expanded": open ? 'true' : undefined, "aria-haspopup": 'true', className: classNames(className, 'TableMenuButton'), type: 'button', size: 'small', sx: sx, color: color, onClick: handleClick, startIcon: startIcon ? (React.createElement(TableIcon, { fontSize: 'small', sx: { mr: -0.5 } }, startIcon)) : undefined, endIcon: endIcon ? (React.createElement(TableIcon, { fontSize: 'small', sx: { ml: -0.5 } }, endIcon)) : undefined }, props),
1874
- icon && (React.createElement(TableIcon, { fontSize: 'small', color: color }, icon)),
1733
+ }, id: buttonId, "aria-controls": open ? menuId : undefined, "aria-expanded": open ? 'true' : undefined, "aria-haspopup": 'true', className: classNames(className, 'TableMenuButton'), type: 'button', size: 'small', sx: sx, color: color, onClick: handleClick, startIcon: startIcon ? (React.createElement(PdgIcon, { fontSize: 'small', sx: { mr: -0.5 } }, startIcon)) : undefined, endIcon: endIcon ? (React.createElement(PdgIcon, { fontSize: 'small', sx: { ml: -0.5 } }, endIcon)) : undefined }, props),
1734
+ icon && (React.createElement(PdgIcon, { fontSize: 'small', color: color }, icon)),
1875
1735
  children),
1876
1736
  React.createElement(Popper, { className: 'TableMenuButton-Popper', open: open, anchorEl: anchorRef.current, role: undefined, placement: placement, transition: true, style: { zIndex: inModal ? (zIndex === undefined ? 1301 : zIndex) : zIndex } }, function (_a) {
1877
1737
  var TransitionProps = _a.TransitionProps, placement = _a.placement;
@@ -2001,7 +1861,7 @@ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, temp
2001
1861
  switch (item.type) {
2002
1862
  case 'number':
2003
1863
  if (typeof data === 'string' || typeof data === 'number') {
2004
- data = numberWithThousandSeparator(data);
1864
+ data = numberFormat(data);
2005
1865
  if (item.numberPrefix) {
2006
1866
  data = (React.createElement(React.Fragment, null,
2007
1867
  React.createElement("span", { style: { opacity: 0.5, marginRight: 2 } }, item.numberPrefix),
@@ -2016,7 +1876,7 @@ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, temp
2016
1876
  break;
2017
1877
  case 'tel':
2018
1878
  if (typeof data === 'string') {
2019
- data = getTelAutoDash(data);
1879
+ data = telAutoDash(data);
2020
1880
  }
2021
1881
  break;
2022
1882
  case 'email':
@@ -2092,9 +1952,9 @@ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, temp
2092
1952
  item.clipboard && notEmpty(copyToClipboardText_1) && (React.createElement(ValueClipboard, null,
2093
1953
  React.createElement(CopyToClipboard, { text: copyToClipboardText_1, onCopy: onCopyToClipboard ? function () { return onCopyToClipboard(item, copyToClipboardText_1); } : undefined },
2094
1954
  React.createElement(ClipboardIconButton, __assign({ size: 'small', color: 'primary' }, item.clipboardProps),
2095
- React.createElement(TableIcon, null, item.clipboardIcon || 'ContentPaste'))))))));
1955
+ React.createElement(PdgIcon, null, item.clipboardIcon || 'ContentPaste'))))))));
2096
1956
  }
2097
1957
  })));
2098
1958
  };
2099
1959
  InfoTable.displayName = 'InfoTable';
2100
- InfoTable.defaultProps = InfoTableDefaultProps;export{InfoTable,InfoTableDefaultProps,SearchTable,SearchTableDefaultProps,Table,TableButton,TableButtonDefaultProps,TableDefaultProps,TableIcon,TableIconDefaultProps,TableMenuButton,TableMenuButtonDefaultProps};
1960
+ InfoTable.defaultProps = InfoTableDefaultProps;export{InfoTable,InfoTableDefaultProps,SearchTable,SearchTableDefaultProps,Table,TableButton,TableButtonDefaultProps,TableDefaultProps,TableMenuButton,TableMenuButtonDefaultProps};
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- 'use strict';var React=require('react'),classNames=require('classnames'),material=require('@mui/material'),SimpleBar=require('simplebar-react'),reactResizeDetector=require('react-resize-detector'),sortable=require('@dnd-kit/sortable'),dayjs=require('dayjs'),reactHook=require('@pdg/react-hook'),core=require('@dnd-kit/core');require('simplebar-react/dist/simplebar.min.css');var uuid=require('uuid'),reactForm=require('@pdg/react-form'),reactCopyToClipboard=require('react-copy-to-clipboard');/******************************************************************************
1
+ 'use strict';var React=require('react'),classNames=require('classnames'),material=require('@mui/material'),SimpleBar=require('simplebar-react'),reactResizeDetector=require('react-resize-detector'),sortable=require('@dnd-kit/sortable'),dayjs=require('dayjs'),util=require('@pdg/util'),reactHook=require('@pdg/react-hook'),core=require('@dnd-kit/core');require('simplebar-react/dist/simplebar.min.css');var uuid=require('uuid'),reactForm=require('@pdg/react-form'),reactComponent=require('@pdg/react-component'),reactCopyToClipboard=require('react-copy-to-clipboard');/******************************************************************************
2
2
  Copyright (c) Microsoft Corporation.
3
3
 
4
4
  Permission to use, copy, modify, and/or distribute this software for any
@@ -111,49 +111,7 @@ var templateObject_1$4;var TableBodyRowDefaultProps = {};const CSS = /*#__PURE__
111
111
  }
112
112
 
113
113
  }
114
- });var empty = function (v) {
115
- var result = false;
116
- if (v == null) {
117
- result = true;
118
- }
119
- else if (typeof v === 'string') {
120
- result = v === '';
121
- }
122
- else if (typeof v === 'object') {
123
- if (Array.isArray(v)) {
124
- result = v.length === 0;
125
- }
126
- else if (!(v instanceof Date)) {
127
- result = Object.entries(v).length === 0;
128
- }
129
- }
130
- return result;
131
- };
132
- var notEmpty = function (v) {
133
- return !empty(v);
134
- };
135
- var equal = function (v1, v2) {
136
- if (v1 === v2)
137
- return true;
138
- if (typeof v1 !== typeof v2)
139
- return false;
140
- if (v1 == null || v2 == null)
141
- return false;
142
- if (Array.isArray(v1) && Array.isArray(v2)) {
143
- if (v1.length !== v2.length)
144
- return false;
145
- for (var i = 0; i < v1.length; i += 1) {
146
- if (v1[i] !== v2[i])
147
- return false;
148
- }
149
- }
150
- else {
151
- return v1 === v2;
152
- }
153
- return true;
154
- };function numberWithThousandSeparator(x) {
155
- return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
156
- }function getTableColumnAlign(column, defaultAlign) {
114
+ });function getTableColumnAlign(column, defaultAlign) {
157
115
  switch (column.type) {
158
116
  case 'number':
159
117
  return column.align ? column.align : 'right';
@@ -187,96 +145,6 @@ function typographyColorToSxColor(color) {
187
145
  else {
188
146
  return color;
189
147
  }
190
- }function getTelAutoDash(tel) {
191
- if (tel == null)
192
- return null;
193
- var str = tel.replace(/[^0-9*]/g, '');
194
- var isLastDash = tel.substr(tel.length - 1, 1) === '-';
195
- if (str.substr(0, 1) !== '0' && !['15', '16', '18'].includes(str.substr(0, 2))) {
196
- return tel;
197
- }
198
- var tmp = '';
199
- var preLen;
200
- switch (str.substr(0, 2)) {
201
- case '02':
202
- preLen = 2;
203
- break;
204
- case '15':
205
- case '16':
206
- case '18':
207
- preLen = 4;
208
- break;
209
- default:
210
- preLen = 3;
211
- }
212
- if (['15', '16', '18'].includes(str.substr(0, 2))) {
213
- if (str.length <= preLen) {
214
- tmp = str;
215
- }
216
- else if (str.length <= preLen + 4) {
217
- tmp += str.substr(0, preLen);
218
- tmp += '-';
219
- tmp += str.substr(preLen);
220
- }
221
- else {
222
- tmp = str;
223
- }
224
- }
225
- else if (str.length <= preLen) {
226
- tmp = str;
227
- }
228
- else if (str.length <= preLen + 3) {
229
- tmp += str.substr(0, preLen);
230
- tmp += '-';
231
- tmp += str.substr(preLen);
232
- }
233
- else if (str.length <= preLen + 7) {
234
- tmp += str.substr(0, preLen);
235
- tmp += '-';
236
- tmp += str.substr(preLen, 3);
237
- tmp += '-';
238
- tmp += str.substr(preLen + 3);
239
- }
240
- else if (str.length <= preLen + 8) {
241
- tmp += str.substr(0, preLen);
242
- tmp += '-';
243
- tmp += str.substr(preLen, 4);
244
- tmp += '-';
245
- tmp += str.substr(preLen + 4);
246
- }
247
- else {
248
- tmp = str;
249
- }
250
- if (isLastDash) {
251
- if (str.length === preLen) {
252
- tmp += '-';
253
- }
254
- }
255
- return tmp;
256
- }/********************************************************************************************************************
257
- * 사업자등록번호 하이픈 추가
258
- * @param companyNo 사업자등록번호
259
- * @returns 하이픈이 추가된 사업자등록번호
260
- * ******************************************************************************************************************/
261
- function companyNoAutoDash(companyNo) {
262
- var str = companyNo.replace(/[^0-9*]/g, '');
263
- var values = [str.slice(0, 3)];
264
- if (str.length > 3)
265
- values.push(str.slice(3, 5));
266
- if (str.length > 5)
267
- values.push(str.slice(5));
268
- return values.join('-');
269
- }/********************************************************************************************************************
270
- * 주민등록번호에 하이픈 추가하는 함수
271
- * @param personalNo 주민등록번호
272
- * @returns 하이픈 추가된 주민등록번호
273
- * ******************************************************************************************************************/
274
- function personalNoAutoDash(personalNo) {
275
- var str = personalNo.replace(/[^0-9*]/g, '');
276
- var values = [str.slice(0, 6)];
277
- if (str.length > 6)
278
- values.push(str.slice(6));
279
- return values.join('-');
280
148
  }var TableContextDefaultValue = {
281
149
  menuOpen: false,
282
150
  openMenuId: undefined,
@@ -509,7 +377,7 @@ var TableBodyCell = function (_a) {
509
377
  switch (column.type) {
510
378
  case 'number':
511
379
  if (typeof data === 'string' || typeof data === 'number') {
512
- data = numberWithThousandSeparator(data);
380
+ data = util.numberFormat(data);
513
381
  }
514
382
  if (column.numberPrefix) {
515
383
  data = (React.createElement(React.Fragment, null,
@@ -524,17 +392,17 @@ var TableBodyCell = function (_a) {
524
392
  break;
525
393
  case 'tel':
526
394
  if (typeof data === 'string') {
527
- data = getTelAutoDash(data);
395
+ data = util.telAutoDash(data);
528
396
  }
529
397
  break;
530
398
  case 'company_no':
531
399
  if (typeof data === 'string') {
532
- data = companyNoAutoDash(data);
400
+ data = util.companyNoAutoDash(data);
533
401
  }
534
402
  break;
535
403
  case 'personal_no':
536
404
  if (typeof data === 'string') {
537
- data = personalNoAutoDash(data);
405
+ data = util.personalNoAutoDash(data);
538
406
  }
539
407
  break;
540
408
  case 'check':
@@ -1436,7 +1304,7 @@ Table.defaultProps = TableDefaultProps;var SearchTableDefaultProps = {};var Sear
1436
1304
  if (itemCommands) {
1437
1305
  switch (itemCommands.getType()) {
1438
1306
  case 'FormCheckbox':
1439
- if (notEmpty(value)) {
1307
+ if (util.notEmpty(value)) {
1440
1308
  var checkCommands = itemCommands;
1441
1309
  if (value.toString() === ((_a = itemCommands.getValue()) === null || _a === void 0 ? void 0 : _a.toString())) {
1442
1310
  checkCommands.setChecked(true);
@@ -1450,7 +1318,7 @@ Table.defaultProps = TableDefaultProps;var SearchTableDefaultProps = {};var Sear
1450
1318
  case 'FormDateTimePicker':
1451
1319
  case 'FormTimePicker':
1452
1320
  {
1453
- if (notEmpty(value)) {
1321
+ if (util.notEmpty(value)) {
1454
1322
  var dateCommands = itemCommands;
1455
1323
  var format = dateCommands.getFormValueFormat();
1456
1324
  var itemValue = dayjs(value, format);
@@ -1468,7 +1336,7 @@ Table.defaultProps = TableDefaultProps;var SearchTableDefaultProps = {};var Sear
1468
1336
  var toName = dateRangePickerCommands.getFormValueToName();
1469
1337
  var format = dateRangePickerCommands.getFormValueFormat();
1470
1338
  if (name === fromName) {
1471
- if (notEmpty(value)) {
1339
+ if (util.notEmpty(value)) {
1472
1340
  var startValue = dayjs(value, format);
1473
1341
  dateRangePickerCommands.setFromValue(startValue.isValid() ? startValue : null);
1474
1342
  }
@@ -1477,7 +1345,7 @@ Table.defaultProps = TableDefaultProps;var SearchTableDefaultProps = {};var Sear
1477
1345
  }
1478
1346
  }
1479
1347
  else if (name === toName) {
1480
- if (notEmpty(value)) {
1348
+ if (util.notEmpty(value)) {
1481
1349
  var endValue = dayjs(value, format);
1482
1350
  dateRangePickerCommands.setToValue(endValue.isValid() ? endValue : null);
1483
1351
  }
@@ -1493,10 +1361,10 @@ Table.defaultProps = TableDefaultProps;var SearchTableDefaultProps = {};var Sear
1493
1361
  var fromName = dateRangePickerCommands.getFormValueFromName();
1494
1362
  var toName = dateRangePickerCommands.getFormValueToName();
1495
1363
  if (name === fromName) {
1496
- dateRangePickerCommands.setFromValue(notEmpty(value) ? Number(value) : null);
1364
+ dateRangePickerCommands.setFromValue(util.notEmpty(value) ? Number(value) : null);
1497
1365
  }
1498
1366
  else if (name === toName) {
1499
- dateRangePickerCommands.setToValue(notEmpty(value) ? Number(value) : null);
1367
+ dateRangePickerCommands.setToValue(util.notEmpty(value) ? Number(value) : null);
1500
1368
  }
1501
1369
  }
1502
1370
  break;
@@ -1506,10 +1374,10 @@ Table.defaultProps = TableDefaultProps;var SearchTableDefaultProps = {};var Sear
1506
1374
  var yearName = monthCommands.getFormValueYearName();
1507
1375
  var monthName = monthCommands.getFormValueMonthName();
1508
1376
  if (name === yearName) {
1509
- monthCommands.setYear(notEmpty(value) ? Number(value) : null);
1377
+ monthCommands.setYear(util.notEmpty(value) ? Number(value) : null);
1510
1378
  }
1511
1379
  else if (name === monthName) {
1512
- monthCommands.setMonth(notEmpty(value) ? Number(value) : null);
1380
+ monthCommands.setMonth(util.notEmpty(value) ? Number(value) : null);
1513
1381
  }
1514
1382
  }
1515
1383
  break;
@@ -1521,16 +1389,16 @@ Table.defaultProps = TableDefaultProps;var SearchTableDefaultProps = {};var Sear
1521
1389
  var toYearName = monthRangeCommands.getFormValueToYearName();
1522
1390
  var toMonthName = monthRangeCommands.getFormValueToMonthName();
1523
1391
  if (name === fromYearName) {
1524
- monthRangeCommands.setFromYear(notEmpty(value) ? Number(value) : null);
1392
+ monthRangeCommands.setFromYear(util.notEmpty(value) ? Number(value) : null);
1525
1393
  }
1526
1394
  else if (name === fromMonthName) {
1527
- monthRangeCommands.setFromMonth(notEmpty(value) ? Number(value) : null);
1395
+ monthRangeCommands.setFromMonth(util.notEmpty(value) ? Number(value) : null);
1528
1396
  }
1529
1397
  else if (name === toYearName) {
1530
- monthRangeCommands.setToYear(notEmpty(value) ? Number(value) : null);
1398
+ monthRangeCommands.setToYear(util.notEmpty(value) ? Number(value) : null);
1531
1399
  }
1532
1400
  else if (name === toMonthName) {
1533
- monthRangeCommands.setToMonth(notEmpty(value) ? Number(value) : null);
1401
+ monthRangeCommands.setToMonth(util.notEmpty(value) ? Number(value) : null);
1534
1402
  }
1535
1403
  }
1536
1404
  break;
@@ -1673,7 +1541,7 @@ Table.defaultProps = TableDefaultProps;var SearchTableDefaultProps = {};var Sear
1673
1541
  resetValue = searchRef.current.getFormReset(name);
1674
1542
  break;
1675
1543
  }
1676
- if (resetValue != null && !equal(resetValue, value) && typeof value !== 'object') {
1544
+ if (resetValue != null && !util.equal(resetValue, value) && typeof value !== 'object') {
1677
1545
  hashes_1.push("".concat(name, "=").concat(encodeURIComponent(value)));
1678
1546
  }
1679
1547
  }
@@ -1777,20 +1645,12 @@ SearchTable.displayName = 'SearchTable';
1777
1645
  SearchTable.defaultProps = SearchTableDefaultProps;var TableButtonDefaultProps = {
1778
1646
  variant: 'outlined',
1779
1647
  color: 'primary',
1780
- };var TableIconDefaultProps = {};var TableIcon = React.forwardRef(function (_a, ref) {
1781
- // Memo --------------------------------------------------------------------------------------------------------------
1782
- var className = _a.className, initChildren = _a.children, props = __rest(_a, ["className", "children"]);
1783
- var children = React.useMemo(function () { return initChildren.replace(/[A-Z]/g, function (letter, idx) { return "".concat(idx > 0 ? '_' : '').concat(letter.toLowerCase()); }); }, [initChildren]);
1784
- // Render ----------------------------------------------------------------------------------------------------------
1785
- return (React.createElement(material.Icon, __assign({ ref: ref }, props, { className: classNames('TableIcon', className) }), children));
1786
- });
1787
- TableIcon.displayName = 'TableIcon';
1788
- TableIcon.defaultProps = TableIconDefaultProps;var TableButton = React.forwardRef(function (_a, ref) {
1648
+ };var TableButton = React.forwardRef(function (_a, ref) {
1789
1649
  var children = _a.children, className = _a.className, initSx = _a.sx, color = _a.color, icon = _a.icon, startIcon = _a.startIcon, endIcon = _a.endIcon, onClick = _a.onClick, props = __rest(_a, ["children", "className", "sx", "color", "icon", "startIcon", "endIcon", "onClick"]);
1790
1650
  var sx = React.useMemo(function () { return (__assign({ minWidth: 0, px: !startIcon && !endIcon ? 0.7 : 1.7 }, initSx)); }, [endIcon, initSx, startIcon]);
1791
1651
  // Render ----------------------------------------------------------------------------------------------------------
1792
- return (React.createElement(material.Button, __assign({ ref: ref, className: classNames(className, 'TableButton'), type: 'button', size: 'small', sx: sx, color: color, onClick: onClick, startIcon: startIcon ? (React.createElement(TableIcon, { fontSize: 'small', sx: { mr: -0.5 } }, startIcon)) : undefined, endIcon: endIcon ? (React.createElement(TableIcon, { fontSize: 'small', sx: { ml: -0.5 } }, endIcon)) : undefined }, props),
1793
- icon && (React.createElement(TableIcon, { fontSize: 'small', color: color }, icon)),
1652
+ return (React.createElement(material.Button, __assign({ ref: ref, className: classNames(className, 'TableButton'), type: 'button', size: 'small', sx: sx, color: color, onClick: onClick, startIcon: startIcon ? (React.createElement(reactComponent.PdgIcon, { fontSize: 'small', sx: { mr: -0.5 } }, startIcon)) : undefined, endIcon: endIcon ? (React.createElement(reactComponent.PdgIcon, { fontSize: 'small', sx: { ml: -0.5 } }, endIcon)) : undefined }, props),
1653
+ icon && (React.createElement(reactComponent.PdgIcon, { fontSize: 'small', color: color }, icon)),
1794
1654
  children));
1795
1655
  });
1796
1656
  TableButton.displayName = 'TableButton';
@@ -1870,8 +1730,8 @@ TableButton.defaultProps = TableButtonDefaultProps;var TableMenuButtonDefaultPro
1870
1730
  }
1871
1731
  }
1872
1732
  anchorRef.current = r;
1873
- }, id: buttonId, "aria-controls": open ? menuId : undefined, "aria-expanded": open ? 'true' : undefined, "aria-haspopup": 'true', className: classNames(className, 'TableMenuButton'), type: 'button', size: 'small', sx: sx, color: color, onClick: handleClick, startIcon: startIcon ? (React.createElement(TableIcon, { fontSize: 'small', sx: { mr: -0.5 } }, startIcon)) : undefined, endIcon: endIcon ? (React.createElement(TableIcon, { fontSize: 'small', sx: { ml: -0.5 } }, endIcon)) : undefined }, props),
1874
- icon && (React.createElement(TableIcon, { fontSize: 'small', color: color }, icon)),
1733
+ }, id: buttonId, "aria-controls": open ? menuId : undefined, "aria-expanded": open ? 'true' : undefined, "aria-haspopup": 'true', className: classNames(className, 'TableMenuButton'), type: 'button', size: 'small', sx: sx, color: color, onClick: handleClick, startIcon: startIcon ? (React.createElement(reactComponent.PdgIcon, { fontSize: 'small', sx: { mr: -0.5 } }, startIcon)) : undefined, endIcon: endIcon ? (React.createElement(reactComponent.PdgIcon, { fontSize: 'small', sx: { ml: -0.5 } }, endIcon)) : undefined }, props),
1734
+ icon && (React.createElement(reactComponent.PdgIcon, { fontSize: 'small', color: color }, icon)),
1875
1735
  children),
1876
1736
  React.createElement(material.Popper, { className: 'TableMenuButton-Popper', open: open, anchorEl: anchorRef.current, role: undefined, placement: placement, transition: true, style: { zIndex: inModal ? (zIndex === undefined ? 1301 : zIndex) : zIndex } }, function (_a) {
1877
1737
  var TransitionProps = _a.TransitionProps, placement = _a.placement;
@@ -1997,11 +1857,11 @@ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, temp
1997
1857
  if (item.onRender) {
1998
1858
  data = item.onRender(info);
1999
1859
  }
2000
- else if (notEmpty(data)) {
1860
+ else if (util.notEmpty(data)) {
2001
1861
  switch (item.type) {
2002
1862
  case 'number':
2003
1863
  if (typeof data === 'string' || typeof data === 'number') {
2004
- data = numberWithThousandSeparator(data);
1864
+ data = util.numberFormat(data);
2005
1865
  if (item.numberPrefix) {
2006
1866
  data = (React.createElement(React.Fragment, null,
2007
1867
  React.createElement("span", { style: { opacity: 0.5, marginRight: 2 } }, item.numberPrefix),
@@ -2016,7 +1876,7 @@ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, temp
2016
1876
  break;
2017
1877
  case 'tel':
2018
1878
  if (typeof data === 'string') {
2019
- data = getTelAutoDash(data);
1879
+ data = util.telAutoDash(data);
2020
1880
  }
2021
1881
  break;
2022
1882
  case 'email':
@@ -2033,12 +1893,12 @@ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, temp
2033
1893
  break;
2034
1894
  case 'company_no':
2035
1895
  if (typeof data === 'string') {
2036
- data = companyNoAutoDash(data);
1896
+ data = util.companyNoAutoDash(data);
2037
1897
  }
2038
1898
  break;
2039
1899
  case 'personal_no':
2040
1900
  if (typeof data === 'string') {
2041
- data = personalNoAutoDash(data);
1901
+ data = util.personalNoAutoDash(data);
2042
1902
  }
2043
1903
  break;
2044
1904
  case 'date':
@@ -2075,7 +1935,7 @@ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, temp
2075
1935
  break;
2076
1936
  }
2077
1937
  }
2078
- if (empty(data))
1938
+ if (util.empty(data))
2079
1939
  data = item.onRenderEmpty ? item.onRenderEmpty(info) : React.createElement(React.Fragment, null, "\u00A0");
2080
1940
  var copyToClipboardText_1 = item.clipboardText || (typeof data === 'string' ? data : typeof data === 'number' ? data.toString() : '');
2081
1941
  return item.type === 'divider' ? (React.createElement(material.Grid, { key: idx, item: true, xs: 12 },
@@ -2089,12 +1949,12 @@ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, temp
2089
1949
  React.createElement(Label, { className: classNames(labelClassName, item.labelClassName), style: __assign(__assign({}, item.labelStyle), labelStyle), sx: finalLabelSx }, item.label)),
2090
1950
  React.createElement(ValueWrap, { className: classNames(valueClassName, item.valueClassName), style: __assign(__assign(__assign({}, valueStyle), item.valueStyle), valueUnderlineStyle), sx: finalValueSx },
2091
1951
  item.ellipsis || ellipsis ? React.createElement(ValueEllipsis, null, data) : React.createElement(Value, null, data),
2092
- item.clipboard && notEmpty(copyToClipboardText_1) && (React.createElement(ValueClipboard, null,
1952
+ item.clipboard && util.notEmpty(copyToClipboardText_1) && (React.createElement(ValueClipboard, null,
2093
1953
  React.createElement(reactCopyToClipboard.CopyToClipboard, { text: copyToClipboardText_1, onCopy: onCopyToClipboard ? function () { return onCopyToClipboard(item, copyToClipboardText_1); } : undefined },
2094
1954
  React.createElement(ClipboardIconButton, __assign({ size: 'small', color: 'primary' }, item.clipboardProps),
2095
- React.createElement(TableIcon, null, item.clipboardIcon || 'ContentPaste'))))))));
1955
+ React.createElement(reactComponent.PdgIcon, null, item.clipboardIcon || 'ContentPaste'))))))));
2096
1956
  }
2097
1957
  })));
2098
1958
  };
2099
1959
  InfoTable.displayName = 'InfoTable';
2100
- InfoTable.defaultProps = InfoTableDefaultProps;exports.InfoTable=InfoTable;exports.InfoTableDefaultProps=InfoTableDefaultProps;exports.SearchTable=SearchTable;exports.SearchTableDefaultProps=SearchTableDefaultProps;exports.Table=Table;exports.TableButton=TableButton;exports.TableButtonDefaultProps=TableButtonDefaultProps;exports.TableDefaultProps=TableDefaultProps;exports.TableIcon=TableIcon;exports.TableIconDefaultProps=TableIconDefaultProps;exports.TableMenuButton=TableMenuButton;exports.TableMenuButtonDefaultProps=TableMenuButtonDefaultProps;
1960
+ InfoTable.defaultProps = InfoTableDefaultProps;exports.InfoTable=InfoTable;exports.InfoTableDefaultProps=InfoTableDefaultProps;exports.SearchTable=SearchTable;exports.SearchTableDefaultProps=SearchTableDefaultProps;exports.Table=Table;exports.TableButton=TableButton;exports.TableButtonDefaultProps=TableButtonDefaultProps;exports.TableDefaultProps=TableDefaultProps;exports.TableMenuButton=TableMenuButton;exports.TableMenuButtonDefaultProps=TableMenuButtonDefaultProps;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pdg/react-table",
3
3
  "title": "React Table",
4
- "version": "1.0.79",
4
+ "version": "1.0.80",
5
5
  "description": "React Table",
6
6
  "type": "module",
7
7
  "types": "dist/index.d.ts",
@@ -46,9 +46,10 @@
46
46
  "@mui/icons-material": "^5.15.13",
47
47
  "@mui/material": "^5.15.13",
48
48
  "@mui/x-date-pickers": "^6.19.7",
49
- "@pdg/react-component": "^1.0.5",
50
- "@pdg/react-hook": "^1.0.5",
51
- "@pdg/react-form": "^1.0.90",
49
+ "@pdg/react-component": "^1.0.6",
50
+ "@pdg/react-form": "^1.0.91",
51
+ "@pdg/react-hook": "^1.0.6",
52
+ "@pdg/util": "^1.0.3",
52
53
  "@tinymce/tinymce-react": "^4.3.2",
53
54
  "@types/react": "^17.0.0 || ^18.0.0",
54
55
  "@types/react-copy-to-clipboard": "^5.0.7",
@@ -1,6 +0,0 @@
1
- /********************************************************************************************************************
2
- * 사업자등록번호 하이픈 추가
3
- * @param companyNo 사업자등록번호
4
- * @returns 하이픈이 추가된 사업자등록번호
5
- * ******************************************************************************************************************/
6
- export declare function companyNoAutoDash(companyNo: string): string;
@@ -1,4 +0,0 @@
1
- declare const empty: (v: any) => boolean;
2
- declare const notEmpty: (v: any) => boolean;
3
- declare const equal: (v1: any, v2: any) => boolean;
4
- export { empty, notEmpty, equal };
@@ -1 +0,0 @@
1
- export declare function numberWithThousandSeparator(x: string | number): string;
@@ -1,6 +0,0 @@
1
- /********************************************************************************************************************
2
- * 주민등록번호에 하이픈 추가하는 함수
3
- * @param personalNo 주민등록번호
4
- * @returns 하이픈 추가된 주민등록번호
5
- * ******************************************************************************************************************/
6
- export declare function personalNoAutoDash(personalNo: string): string;
@@ -1 +0,0 @@
1
- export declare function getTelAutoDash(tel: string | null | undefined): string | null;
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- import { TableIconProps as Props } from './TableIcon.types';
3
- declare const TableIcon: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
4
- export default TableIcon;
@@ -1,5 +0,0 @@
1
- import { IconProps } from '@mui/material';
2
- export interface TableIconProps extends IconProps {
3
- children: string;
4
- }
5
- export declare const TableIconDefaultProps: {};
@@ -1,4 +0,0 @@
1
- import TableIcon from './TableIcon';
2
- export default TableIcon;
3
- export { TableIcon };
4
- export * from './TableIcon.types';