@pdg/react-form 1.2.8 → 1.2.10

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,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import { PFormBlockProps as Props } from './PFormBlock.types';
3
- declare const PFormBlock: ({ ref, variant: initVariant, size: initSize, color: initColor, spacing: initSpacing, focused: initFocused, labelShrink: initLabelShrink, fullWidth: initFullWidth, icon, label, line, lineVerticalMargin, error, warning, hidden, collapse, collapseIn: initCollapseIn, children, className, style: initStyle, sx, }: Props) => React.JSX.Element;
3
+ declare const PFormBlock: ({ ref, variant: initVariant, size: initSize, color: initColor, spacing: initSpacing, focused: initFocused, labelShrink: initLabelShrink, fullWidth: initFullWidth, icon, label, line, lineVerticalMargin, error, warning, endAdornment, hidden, collapse, collapseIn: initCollapseIn, children, className, style: initStyle, sx, }: Props) => React.JSX.Element;
4
4
  export default PFormBlock;
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { ReactNode } from 'react';
2
2
  import { PartialPick, PCommonSxProps } from '../../@types';
3
3
  import { PFormDividerProps } from '../PFormDivider';
4
4
  import { PFormContextValue } from '../../PFormContext';
@@ -8,4 +8,5 @@ export interface PFormBlockProps extends PCommonSxProps, PartialPick<PFormContex
8
8
  collapseIn?: boolean;
9
9
  error?: boolean;
10
10
  warning?: boolean;
11
+ endAdornment?: ReactNode;
11
12
  }
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import { PFormDividerProps as Props } from './PFormDivider.types';
3
- declare const PFormDivider: ({ ref, size: initSize, icon, label, line, lineVerticalMargin, hidden, collapse, collapseIn, error, warning, onCollapseChange, className, style: initStyle, sx, }: Props) => React.JSX.Element;
3
+ declare const PFormDivider: ({ ref, size: initSize, icon, label, line, lineVerticalMargin, hidden, collapse, collapseIn, error, warning, endAdornment, onCollapseChange, className, style: initStyle, sx, }: Props) => React.JSX.Element;
4
4
  export default PFormDivider;
@@ -15,5 +15,6 @@ export interface PFormDividerProps extends PCommonSxProps {
15
15
  collapseIn?: boolean;
16
16
  error?: boolean;
17
17
  warning?: boolean;
18
+ endAdornment?: ReactNode;
18
19
  onCollapseChange?: (collapseIn: boolean) => void;
19
20
  }
package/dist/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import {c}from'react/compiler-runtime';import React,{createContext,useContext,useRef,useState,useId,useEffect}from'react';import classNames from'classnames';import {Box,styled,useTheme,InputLabel,Grid,Collapse,FormHelperText,TextField,InputAdornment,IconButton,Chip,Autocomplete,Icon,MenuItem,Checkbox,CircularProgress,Input,OutlinedInput,FilledInput,FormControl,Typography,FormControlLabel,Radio,RadioGroup,ToggleButton,ToggleButtonGroup,Rating,Skeleton,darken,Button,Tooltip,tooltipClasses,ClickAwayListener,DialogTitle,DialogContent,DialogActions,Dialog,Switch,Paper,Menu}from'@mui/material';import {empty,notEmpty,equal,ifEmpty}from'@pdg/compare';import dayjs from'dayjs';import {useAutoUpdateRef,useForwardRef,useFirstSkipChanged,useEventLayoutEffect,useEventEffect,useChanged,useFirstSkipEffect,useTimeoutRef,clearTimeoutRef}from'@pdg/react-hook';import {PButton,PIcon,PIconText}from'@pdg/react-component';import {useResizeDetector}from'react-resize-detector';import {formatTelNo,formatBusinessNo,formatPersonalNo}from'@pdg/formatting';import {NumericFormat}from'react-number-format';import {CheckBox,CheckBoxOutlineBlank,RadioButtonChecked,RadioButtonUnchecked}from'@mui/icons-material';import {Editor}from'@tinymce/tinymce-react';import {AdapterDayjs}from'@mui/x-date-pickers/AdapterDayjs';import {StaticDatePicker,PickersDay,DesktopDatePicker,LocalizationProvider,StaticDateTimePicker,DesktopDateTimePicker}from'@mui/x-date-pickers';import SimpleBar from'simplebar-react';import'dayjs/locale/ko';import {useLocation}from'react-router';function insertStyle(css) {
1
+ import {c}from'react/compiler-runtime';import React,{createContext,useContext,useRef,useState,useId,useEffect}from'react';import classNames from'classnames';import {Box,styled,useTheme,InputLabel,Grid,Collapse,FormHelperText,TextField,InputAdornment,IconButton,Chip,Autocomplete,Icon,MenuItem,Checkbox,CircularProgress,Input,OutlinedInput,FilledInput,FormControl,Typography,FormControlLabel,Radio,RadioGroup,ToggleButton,ToggleButtonGroup,Rating,Skeleton,darken,Button,Tooltip,tooltipClasses,ClickAwayListener,DialogTitle,DialogContent,DialogActions,Dialog,Switch,Paper,Menu}from'@mui/material';import {empty,notEmpty,equal,ifEmpty}from'@pdg/compare';import dayjs from'dayjs';import {useAutoUpdateRef,useForwardRef,useFirstSkipChanged,useEventLayoutEffect,useEventEffect,useChanged,useFirstSkipEffect,useTimeoutRef,clearTimeoutRef}from'@pdg/react-hook';import {PButton,PIcon,PStack,PIconButton,PIconText}from'@pdg/react-component';import {useResizeDetector}from'react-resize-detector';import {formatTelNo,formatBusinessNo,formatPersonalNo}from'@pdg/formatting';import {NumericFormat}from'react-number-format';import {CheckBox,CheckBoxOutlineBlank,RadioButtonChecked,RadioButtonUnchecked}from'@mui/icons-material';import {Editor}from'@tinymce/tinymce-react';import {AdapterDayjs}from'@mui/x-date-pickers/AdapterDayjs';import {StaticDatePicker,PickersDay,DesktopDatePicker,LocalizationProvider,StaticDateTimePicker,DesktopDateTimePicker}from'@mui/x-date-pickers';import SimpleBar from'simplebar-react';import'dayjs/locale/ko';import {useLocation}from'react-router';function insertStyle(css) {
2
2
  if (!css || typeof window === 'undefined')
3
3
  return;
4
4
  const style = document.createElement('style');
@@ -423,9 +423,11 @@ var appendFormValueData = function appendFormValueData(data, itemCommands) {
423
423
  }
424
424
  });
425
425
  if (isAllValid) {
426
- onSubmitRef.current && onSubmitRef.current(data);
426
+ var _onSubmitRef$current;
427
+ (_onSubmitRef$current = onSubmitRef.current) === null || _onSubmitRef$current === void 0 || _onSubmitRef$current.call(onSubmitRef, data);
427
428
  } else {
428
- onInvalidRef.current && onInvalidRef.current(invalidItems);
429
+ var _onInvalidRef$current;
430
+ (_onInvalidRef$current = onInvalidRef.current) === null || _onInvalidRef$current === void 0 || _onInvalidRef$current.call(onInvalidRef, invalidItems);
429
431
  setTimeout(function () {
430
432
  var _valueItems$current$f;
431
433
  (_valueItems$current$f = valueItems.current[firstInvalidItemId]) === null || _valueItems$current$f === void 0 || _valueItems$current$f.focusValidate();
@@ -1126,7 +1128,7 @@ var StyledWarningLineBox = styled(Box)(function (_ref2) {
1126
1128
  position: 'relative'
1127
1129
  };
1128
1130
  var PFormDivider = function PFormDivider(t0) {
1129
- var $ = c(47);
1131
+ var $ = c(48);
1130
1132
  var ref = t0.ref,
1131
1133
  initSize = t0.size,
1132
1134
  icon = t0.icon,
@@ -1138,6 +1140,7 @@ var PFormDivider = function PFormDivider(t0) {
1138
1140
  collapseIn = t0.collapseIn,
1139
1141
  error = t0.error,
1140
1142
  warning = t0.warning,
1143
+ endAdornment = t0.endAdornment,
1141
1144
  onCollapseChange = t0.onCollapseChange,
1142
1145
  className = t0.className,
1143
1146
  initStyle = t0.style,
@@ -1185,7 +1188,7 @@ var PFormDivider = function PFormDivider(t0) {
1185
1188
  if ($[4] !== collapse || $[5] !== collapseIn || $[6] !== onCollapseChange) {
1186
1189
  t4 = function t4() {
1187
1190
  if (collapse) {
1188
- onCollapseChange && onCollapseChange(!collapseIn);
1191
+ onCollapseChange === null || onCollapseChange === void 0 || onCollapseChange(!collapseIn);
1189
1192
  }
1190
1193
  };
1191
1194
  $[4] = collapse;
@@ -1280,40 +1283,51 @@ var PFormDivider = function PFormDivider(t0) {
1280
1283
  t11 = $[28];
1281
1284
  }
1282
1285
  var t12;
1283
- if ($[29] !== collapse || $[30] !== collapseIn || $[31] !== error || $[32] !== warning) {
1284
- t12 = collapse && /*#__PURE__*/React.createElement(PIcon, {
1286
+ if ($[29] !== collapse || $[30] !== collapseIn || $[31] !== endAdornment || $[32] !== error || $[33] !== warning) {
1287
+ t12 = (endAdornment || collapse) && /*#__PURE__*/React.createElement(PStack, {
1288
+ row: true,
1289
+ center: true,
1290
+ sx: {
1291
+ ml: endAdornment && collapse ? 2 : 1
1292
+ }
1293
+ }, endAdornment && /*#__PURE__*/React.createElement(Box, {
1285
1294
  sx: {
1286
- opacity: 0.6,
1287
- ml: 1
1295
+ my: -2
1296
+ },
1297
+ onClick: _temp$x
1298
+ }, endAdornment), collapse && /*#__PURE__*/React.createElement(PIconButton, {
1299
+ sx: {
1300
+ my: -2
1288
1301
  },
1289
1302
  color: error ? "error" : warning ? "warning" : undefined
1290
- }, collapseIn ? "KeyboardDoubleArrowUp" : "KeyboardDoubleArrowDown");
1303
+ }, collapseIn ? "KeyboardDoubleArrowUp" : "KeyboardDoubleArrowDown"));
1291
1304
  $[29] = collapse;
1292
1305
  $[30] = collapseIn;
1293
- $[31] = error;
1294
- $[32] = warning;
1295
- $[33] = t12;
1306
+ $[31] = endAdornment;
1307
+ $[32] = error;
1308
+ $[33] = warning;
1309
+ $[34] = t12;
1296
1310
  } else {
1297
- t12 = $[33];
1311
+ t12 = $[34];
1298
1312
  }
1299
1313
  var t13;
1300
- if ($[34] !== handleClick || $[35] !== t10 || $[36] !== t11 || $[37] !== t12 || $[38] !== t8 || $[39] !== t9) {
1314
+ if ($[35] !== handleClick || $[36] !== t10 || $[37] !== t11 || $[38] !== t12 || $[39] !== t8 || $[40] !== t9) {
1301
1315
  t13 = /*#__PURE__*/React.createElement(Box, {
1302
1316
  sx: t8,
1303
1317
  onClick: handleClick
1304
1318
  }, t9, t10, t11, t12);
1305
- $[34] = handleClick;
1306
- $[35] = t10;
1307
- $[36] = t11;
1308
- $[37] = t12;
1309
- $[38] = t8;
1310
- $[39] = t9;
1311
- $[40] = t13;
1319
+ $[35] = handleClick;
1320
+ $[36] = t10;
1321
+ $[37] = t11;
1322
+ $[38] = t12;
1323
+ $[39] = t8;
1324
+ $[40] = t9;
1325
+ $[41] = t13;
1312
1326
  } else {
1313
- t13 = $[40];
1327
+ t13 = $[41];
1314
1328
  }
1315
1329
  var t14;
1316
- if ($[41] !== ref || $[42] !== style || $[43] !== sx || $[44] !== t13 || $[45] !== t6) {
1330
+ if ($[42] !== ref || $[43] !== style || $[44] !== sx || $[45] !== t13 || $[46] !== t6) {
1317
1331
  t14 = /*#__PURE__*/React.createElement(Grid, {
1318
1332
  ref: ref,
1319
1333
  size: t5,
@@ -1321,20 +1335,23 @@ var PFormDivider = function PFormDivider(t0) {
1321
1335
  className: t6,
1322
1336
  sx: sx
1323
1337
  }, t13);
1324
- $[41] = ref;
1325
- $[42] = style;
1326
- $[43] = sx;
1327
- $[44] = t13;
1328
- $[45] = t6;
1329
- $[46] = t14;
1338
+ $[42] = ref;
1339
+ $[43] = style;
1340
+ $[44] = sx;
1341
+ $[45] = t13;
1342
+ $[46] = t6;
1343
+ $[47] = t14;
1330
1344
  } else {
1331
- t14 = $[46];
1345
+ t14 = $[47];
1332
1346
  }
1333
1347
  return t14;
1334
- };var _templateObject$h;
1348
+ };
1349
+ function _temp$x(e) {
1350
+ e.stopPropagation();
1351
+ }var _templateObject$h;
1335
1352
  var StyledWrapGrid$1 = styled(Grid)(_templateObject$h || (_templateObject$h = _taggedTemplateLiteral(["\n width: 100%;\n"])));var _excluded$B = ["variant", "size", "color", "spacing", "focused", "labelShrink", "fullWidth"];
1336
1353
  var PFormBlock = function PFormBlock(t0) {
1337
- var $ = c(66);
1354
+ var $ = c(67);
1338
1355
  var ref = t0.ref,
1339
1356
  initVariant = t0.variant,
1340
1357
  initSize = t0.size,
@@ -1349,6 +1366,7 @@ var PFormBlock = function PFormBlock(t0) {
1349
1366
  lineVerticalMargin = t0.lineVerticalMargin,
1350
1367
  error = t0.error,
1351
1368
  warning = t0.warning,
1369
+ endAdornment = t0.endAdornment,
1352
1370
  hidden = t0.hidden,
1353
1371
  collapse = t0.collapse,
1354
1372
  initCollapseIn = t0.collapseIn,
@@ -1491,7 +1509,7 @@ var PFormBlock = function PFormBlock(t0) {
1491
1509
  t8 = $[28];
1492
1510
  }
1493
1511
  var t9;
1494
- if ($[29] !== collapse || $[30] !== collapseIn || $[31] !== color || $[32] !== error || $[33] !== hidden || $[34] !== icon || $[35] !== label || $[36] !== line || $[37] !== lineVerticalMargin || $[38] !== size || $[39] !== warning) {
1512
+ if ($[29] !== collapse || $[30] !== collapseIn || $[31] !== color || $[32] !== endAdornment || $[33] !== error || $[34] !== hidden || $[35] !== icon || $[36] !== label || $[37] !== line || $[38] !== lineVerticalMargin || $[39] !== size || $[40] !== warning) {
1495
1513
  t9 = (icon || label || line || collapse) && /*#__PURE__*/React.createElement(PFormDivider, {
1496
1514
  className: "PFormBlock-header",
1497
1515
  collapse: collapse,
@@ -1505,6 +1523,7 @@ var PFormBlock = function PFormBlock(t0) {
1505
1523
  warning: warning,
1506
1524
  lineVerticalMargin: lineVerticalMargin,
1507
1525
  hidden: hidden,
1526
+ endAdornment: endAdornment,
1508
1527
  onCollapseChange: collapse ? function (newCollapseIn) {
1509
1528
  return setCollapseIn(newCollapseIn);
1510
1529
  } : undefined
@@ -1512,38 +1531,39 @@ var PFormBlock = function PFormBlock(t0) {
1512
1531
  $[29] = collapse;
1513
1532
  $[30] = collapseIn;
1514
1533
  $[31] = color;
1515
- $[32] = error;
1516
- $[33] = hidden;
1517
- $[34] = icon;
1518
- $[35] = label;
1519
- $[36] = line;
1520
- $[37] = lineVerticalMargin;
1521
- $[38] = size;
1522
- $[39] = warning;
1523
- $[40] = t9;
1534
+ $[32] = endAdornment;
1535
+ $[33] = error;
1536
+ $[34] = hidden;
1537
+ $[35] = icon;
1538
+ $[36] = label;
1539
+ $[37] = line;
1540
+ $[38] = lineVerticalMargin;
1541
+ $[39] = size;
1542
+ $[40] = warning;
1543
+ $[41] = t9;
1524
1544
  } else {
1525
- t9 = $[40];
1545
+ t9 = $[41];
1526
1546
  }
1527
1547
  var t10;
1528
- if ($[41] === Symbol["for"]("react.memo_cache_sentinel")) {
1548
+ if ($[42] === Symbol["for"]("react.memo_cache_sentinel")) {
1529
1549
  t10 = {
1530
1550
  xs: 12
1531
1551
  };
1532
- $[41] = t10;
1552
+ $[42] = t10;
1533
1553
  } else {
1534
- t10 = $[41];
1554
+ t10 = $[42];
1535
1555
  }
1536
1556
  var t11;
1537
- if ($[42] === Symbol["for"]("react.memo_cache_sentinel")) {
1557
+ if ($[43] === Symbol["for"]("react.memo_cache_sentinel")) {
1538
1558
  t11 = {
1539
1559
  xs: 12
1540
1560
  };
1541
- $[42] = t11;
1561
+ $[43] = t11;
1542
1562
  } else {
1543
- t11 = $[42];
1563
+ t11 = $[43];
1544
1564
  }
1545
1565
  var t12;
1546
- if ($[43] !== children || $[44] !== spacing) {
1566
+ if ($[44] !== children || $[45] !== spacing) {
1547
1567
  t12 = /*#__PURE__*/React.createElement(StyledWrapGrid$1, {
1548
1568
  size: t11,
1549
1569
  className: "PFormBlock-body"
@@ -1552,51 +1572,51 @@ var PFormBlock = function PFormBlock(t0) {
1552
1572
  container: true,
1553
1573
  spacing: spacing
1554
1574
  }, children));
1555
- $[43] = children;
1556
- $[44] = spacing;
1557
- $[45] = t12;
1575
+ $[44] = children;
1576
+ $[45] = spacing;
1577
+ $[46] = t12;
1558
1578
  } else {
1559
- t12 = $[45];
1579
+ t12 = $[46];
1560
1580
  }
1561
1581
  var t13;
1562
- if ($[46] !== spacing || $[47] !== t12) {
1582
+ if ($[47] !== spacing || $[48] !== t12) {
1563
1583
  t13 = /*#__PURE__*/React.createElement(Grid, {
1564
1584
  container: true,
1565
1585
  spacing: spacing
1566
1586
  }, t12);
1567
- $[46] = spacing;
1568
- $[47] = t12;
1569
- $[48] = t13;
1587
+ $[47] = spacing;
1588
+ $[48] = t12;
1589
+ $[49] = t13;
1570
1590
  } else {
1571
- t13 = $[48];
1591
+ t13 = $[49];
1572
1592
  }
1573
1593
  var t14;
1574
- if ($[49] !== Container || $[50] !== containerProps || $[51] !== t13) {
1594
+ if ($[50] !== Container || $[51] !== containerProps || $[52] !== t13) {
1575
1595
  t14 = /*#__PURE__*/React.createElement(StyledWrapGrid$1, {
1576
1596
  size: t10
1577
1597
  }, /*#__PURE__*/React.createElement(Container, containerProps, t13));
1578
- $[49] = Container;
1579
- $[50] = containerProps;
1580
- $[51] = t13;
1581
- $[52] = t14;
1598
+ $[50] = Container;
1599
+ $[51] = containerProps;
1600
+ $[52] = t13;
1601
+ $[53] = t14;
1582
1602
  } else {
1583
- t14 = $[52];
1603
+ t14 = $[53];
1584
1604
  }
1585
1605
  var t15;
1586
- if ($[53] !== spacing || $[54] !== t14 || $[55] !== t9) {
1606
+ if ($[54] !== spacing || $[55] !== t14 || $[56] !== t9) {
1587
1607
  t15 = /*#__PURE__*/React.createElement(Grid, {
1588
1608
  container: true,
1589
1609
  spacing: spacing
1590
1610
  }, t9, t14);
1591
- $[53] = spacing;
1592
- $[54] = t14;
1593
- $[55] = t9;
1594
- $[56] = t15;
1611
+ $[54] = spacing;
1612
+ $[55] = t14;
1613
+ $[56] = t9;
1614
+ $[57] = t15;
1595
1615
  } else {
1596
- t15 = $[56];
1616
+ t15 = $[57];
1597
1617
  }
1598
1618
  var t16;
1599
- if ($[57] !== ref || $[58] !== style || $[59] !== sx || $[60] !== t15 || $[61] !== t8) {
1619
+ if ($[58] !== ref || $[59] !== style || $[60] !== sx || $[61] !== t15 || $[62] !== t8) {
1600
1620
  t16 = /*#__PURE__*/React.createElement(Grid, {
1601
1621
  ref: ref,
1602
1622
  size: t7,
@@ -1604,25 +1624,25 @@ var PFormBlock = function PFormBlock(t0) {
1604
1624
  style: style,
1605
1625
  sx: sx
1606
1626
  }, t15);
1607
- $[57] = ref;
1608
- $[58] = style;
1609
- $[59] = sx;
1610
- $[60] = t15;
1611
- $[61] = t8;
1612
- $[62] = t16;
1627
+ $[58] = ref;
1628
+ $[59] = style;
1629
+ $[60] = sx;
1630
+ $[61] = t15;
1631
+ $[62] = t8;
1632
+ $[63] = t16;
1613
1633
  } else {
1614
- t16 = $[62];
1634
+ t16 = $[63];
1615
1635
  }
1616
1636
  var t17;
1617
- if ($[63] !== t16 || $[64] !== t6) {
1637
+ if ($[64] !== t16 || $[65] !== t6) {
1618
1638
  t17 = /*#__PURE__*/React.createElement(PFormContext.Provider, {
1619
1639
  value: t6
1620
1640
  }, t16);
1621
- $[63] = t16;
1622
- $[64] = t6;
1623
- $[65] = t17;
1641
+ $[64] = t16;
1642
+ $[65] = t6;
1643
+ $[66] = t17;
1624
1644
  } else {
1625
- t17 = $[65];
1645
+ t17 = $[66];
1626
1646
  }
1627
1647
  return t17;
1628
1648
  };var _templateObject$g;
@@ -11651,7 +11671,8 @@ function _temp$m() {
11651
11671
  finalValue_1.forEach(function (v_0) {
11652
11672
  var key = v_0.toString();
11653
11673
  if (itemsInfos[key]) {
11654
- computedComponentValue && computedComponentValue.push(itemsInfos[key]);
11674
+ var _computedComponentVal;
11675
+ (_computedComponentVal = computedComponentValue) === null || _computedComponentVal === void 0 || _computedComponentVal.push(itemsInfos[key]);
11655
11676
  }
11656
11677
  });
11657
11678
  } else {
@@ -13013,7 +13034,8 @@ var PrivateYearSelect = function PrivateYearSelect(t0) {
13013
13034
  var t3;
13014
13035
  if ($[3] !== onSelectRef) {
13015
13036
  t3 = function t3(e) {
13016
- onSelectRef.current && onSelectRef.current(Number(e.target.getAttribute("data-id")));
13037
+ var _onSelectRef$current;
13038
+ (_onSelectRef$current = onSelectRef.current) === null || _onSelectRef$current === void 0 || _onSelectRef$current.call(onSelectRef, Number(e.target.getAttribute("data-id")));
13017
13039
  };
13018
13040
  $[3] = onSelectRef;
13019
13041
  $[4] = t3;
@@ -13361,7 +13383,8 @@ var PrivateTimeSelect = function PrivateTimeSelect(t0) {
13361
13383
  var t6;
13362
13384
  if ($[5] !== onSelectRef) {
13363
13385
  t6 = function t6(e) {
13364
- onSelectRef.current && onSelectRef.current(Number(e.target.getAttribute("data-id")));
13386
+ var _onSelectRef$current;
13387
+ (_onSelectRef$current = onSelectRef.current) === null || _onSelectRef$current === void 0 || _onSelectRef$current.call(onSelectRef, Number(e.target.getAttribute("data-id")));
13365
13388
  };
13366
13389
  $[5] = onSelectRef;
13367
13390
  $[6] = t6;
@@ -17454,7 +17477,8 @@ function _temp$h() {
17454
17477
  var t2;
17455
17478
  if ($[0] !== onCloseRef) {
17456
17479
  t2 = function t2() {
17457
- onCloseRef.current && onCloseRef.current();
17480
+ var _onCloseRef$current;
17481
+ (_onCloseRef$current = onCloseRef.current) === null || _onCloseRef$current === void 0 || _onCloseRef$current.call(onCloseRef);
17458
17482
  };
17459
17483
  $[0] = onCloseRef;
17460
17484
  $[1] = t2;
@@ -22899,8 +22923,8 @@ function _temp2() {
22899
22923
  t3 = function t3() {
22900
22924
  var _inputRef$current;
22901
22925
  if ((_inputRef$current = inputRef.current) !== null && _inputRef$current !== void 0 && _inputRef$current.validate()) {
22902
- onConfirm && onConfirm(value);
22903
- onClose && onClose();
22926
+ onConfirm === null || onConfirm === void 0 || onConfirm(value);
22927
+ onClose === null || onClose === void 0 || onClose();
22904
22928
  } else {
22905
22929
  var _inputRef$current2;
22906
22930
  (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 || _inputRef$current2.focus();
@@ -22917,8 +22941,8 @@ function _temp2() {
22917
22941
  var t4;
22918
22942
  if ($[7] !== onCancel || $[8] !== onClose) {
22919
22943
  t4 = function t4() {
22920
- onCancel && onCancel();
22921
- onClose && onClose();
22944
+ onCancel === null || onCancel === void 0 || onCancel();
22945
+ onClose === null || onClose === void 0 || onClose();
22922
22946
  };
22923
22947
  $[7] = onCancel;
22924
22948
  $[8] = onClose;
@@ -22933,7 +22957,7 @@ function _temp2() {
22933
22957
  t6 = function t6(e, reason) {
22934
22958
  if (reason === "backdropClick") {
22935
22959
  if (empty(value)) {
22936
- onClose && onClose();
22960
+ onClose === null || onClose === void 0 || onClose();
22937
22961
  }
22938
22962
  }
22939
22963
  };
package/dist/index.js CHANGED
@@ -423,9 +423,11 @@ var appendFormValueData = function appendFormValueData(data, itemCommands) {
423
423
  }
424
424
  });
425
425
  if (isAllValid) {
426
- onSubmitRef.current && onSubmitRef.current(data);
426
+ var _onSubmitRef$current;
427
+ (_onSubmitRef$current = onSubmitRef.current) === null || _onSubmitRef$current === void 0 || _onSubmitRef$current.call(onSubmitRef, data);
427
428
  } else {
428
- onInvalidRef.current && onInvalidRef.current(invalidItems);
429
+ var _onInvalidRef$current;
430
+ (_onInvalidRef$current = onInvalidRef.current) === null || _onInvalidRef$current === void 0 || _onInvalidRef$current.call(onInvalidRef, invalidItems);
429
431
  setTimeout(function () {
430
432
  var _valueItems$current$f;
431
433
  (_valueItems$current$f = valueItems.current[firstInvalidItemId]) === null || _valueItems$current$f === void 0 || _valueItems$current$f.focusValidate();
@@ -1126,7 +1128,7 @@ var StyledWarningLineBox = material.styled(material.Box)(function (_ref2) {
1126
1128
  position: 'relative'
1127
1129
  };
1128
1130
  var PFormDivider = function PFormDivider(t0) {
1129
- var $ = compilerRuntime.c(47);
1131
+ var $ = compilerRuntime.c(48);
1130
1132
  var ref = t0.ref,
1131
1133
  initSize = t0.size,
1132
1134
  icon = t0.icon,
@@ -1138,6 +1140,7 @@ var PFormDivider = function PFormDivider(t0) {
1138
1140
  collapseIn = t0.collapseIn,
1139
1141
  error = t0.error,
1140
1142
  warning = t0.warning,
1143
+ endAdornment = t0.endAdornment,
1141
1144
  onCollapseChange = t0.onCollapseChange,
1142
1145
  className = t0.className,
1143
1146
  initStyle = t0.style,
@@ -1185,7 +1188,7 @@ var PFormDivider = function PFormDivider(t0) {
1185
1188
  if ($[4] !== collapse || $[5] !== collapseIn || $[6] !== onCollapseChange) {
1186
1189
  t4 = function t4() {
1187
1190
  if (collapse) {
1188
- onCollapseChange && onCollapseChange(!collapseIn);
1191
+ onCollapseChange === null || onCollapseChange === void 0 || onCollapseChange(!collapseIn);
1189
1192
  }
1190
1193
  };
1191
1194
  $[4] = collapse;
@@ -1280,40 +1283,51 @@ var PFormDivider = function PFormDivider(t0) {
1280
1283
  t11 = $[28];
1281
1284
  }
1282
1285
  var t12;
1283
- if ($[29] !== collapse || $[30] !== collapseIn || $[31] !== error || $[32] !== warning) {
1284
- t12 = collapse && /*#__PURE__*/React.createElement(reactComponent.PIcon, {
1286
+ if ($[29] !== collapse || $[30] !== collapseIn || $[31] !== endAdornment || $[32] !== error || $[33] !== warning) {
1287
+ t12 = (endAdornment || collapse) && /*#__PURE__*/React.createElement(reactComponent.PStack, {
1288
+ row: true,
1289
+ center: true,
1290
+ sx: {
1291
+ ml: endAdornment && collapse ? 2 : 1
1292
+ }
1293
+ }, endAdornment && /*#__PURE__*/React.createElement(material.Box, {
1285
1294
  sx: {
1286
- opacity: 0.6,
1287
- ml: 1
1295
+ my: -2
1296
+ },
1297
+ onClick: _temp$x
1298
+ }, endAdornment), collapse && /*#__PURE__*/React.createElement(reactComponent.PIconButton, {
1299
+ sx: {
1300
+ my: -2
1288
1301
  },
1289
1302
  color: error ? "error" : warning ? "warning" : undefined
1290
- }, collapseIn ? "KeyboardDoubleArrowUp" : "KeyboardDoubleArrowDown");
1303
+ }, collapseIn ? "KeyboardDoubleArrowUp" : "KeyboardDoubleArrowDown"));
1291
1304
  $[29] = collapse;
1292
1305
  $[30] = collapseIn;
1293
- $[31] = error;
1294
- $[32] = warning;
1295
- $[33] = t12;
1306
+ $[31] = endAdornment;
1307
+ $[32] = error;
1308
+ $[33] = warning;
1309
+ $[34] = t12;
1296
1310
  } else {
1297
- t12 = $[33];
1311
+ t12 = $[34];
1298
1312
  }
1299
1313
  var t13;
1300
- if ($[34] !== handleClick || $[35] !== t10 || $[36] !== t11 || $[37] !== t12 || $[38] !== t8 || $[39] !== t9) {
1314
+ if ($[35] !== handleClick || $[36] !== t10 || $[37] !== t11 || $[38] !== t12 || $[39] !== t8 || $[40] !== t9) {
1301
1315
  t13 = /*#__PURE__*/React.createElement(material.Box, {
1302
1316
  sx: t8,
1303
1317
  onClick: handleClick
1304
1318
  }, t9, t10, t11, t12);
1305
- $[34] = handleClick;
1306
- $[35] = t10;
1307
- $[36] = t11;
1308
- $[37] = t12;
1309
- $[38] = t8;
1310
- $[39] = t9;
1311
- $[40] = t13;
1319
+ $[35] = handleClick;
1320
+ $[36] = t10;
1321
+ $[37] = t11;
1322
+ $[38] = t12;
1323
+ $[39] = t8;
1324
+ $[40] = t9;
1325
+ $[41] = t13;
1312
1326
  } else {
1313
- t13 = $[40];
1327
+ t13 = $[41];
1314
1328
  }
1315
1329
  var t14;
1316
- if ($[41] !== ref || $[42] !== style || $[43] !== sx || $[44] !== t13 || $[45] !== t6) {
1330
+ if ($[42] !== ref || $[43] !== style || $[44] !== sx || $[45] !== t13 || $[46] !== t6) {
1317
1331
  t14 = /*#__PURE__*/React.createElement(material.Grid, {
1318
1332
  ref: ref,
1319
1333
  size: t5,
@@ -1321,20 +1335,23 @@ var PFormDivider = function PFormDivider(t0) {
1321
1335
  className: t6,
1322
1336
  sx: sx
1323
1337
  }, t13);
1324
- $[41] = ref;
1325
- $[42] = style;
1326
- $[43] = sx;
1327
- $[44] = t13;
1328
- $[45] = t6;
1329
- $[46] = t14;
1338
+ $[42] = ref;
1339
+ $[43] = style;
1340
+ $[44] = sx;
1341
+ $[45] = t13;
1342
+ $[46] = t6;
1343
+ $[47] = t14;
1330
1344
  } else {
1331
- t14 = $[46];
1345
+ t14 = $[47];
1332
1346
  }
1333
1347
  return t14;
1334
- };var _templateObject$h;
1348
+ };
1349
+ function _temp$x(e) {
1350
+ e.stopPropagation();
1351
+ }var _templateObject$h;
1335
1352
  var StyledWrapGrid$1 = material.styled(material.Grid)(_templateObject$h || (_templateObject$h = _taggedTemplateLiteral(["\n width: 100%;\n"])));var _excluded$B = ["variant", "size", "color", "spacing", "focused", "labelShrink", "fullWidth"];
1336
1353
  var PFormBlock = function PFormBlock(t0) {
1337
- var $ = compilerRuntime.c(66);
1354
+ var $ = compilerRuntime.c(67);
1338
1355
  var ref = t0.ref,
1339
1356
  initVariant = t0.variant,
1340
1357
  initSize = t0.size,
@@ -1349,6 +1366,7 @@ var PFormBlock = function PFormBlock(t0) {
1349
1366
  lineVerticalMargin = t0.lineVerticalMargin,
1350
1367
  error = t0.error,
1351
1368
  warning = t0.warning,
1369
+ endAdornment = t0.endAdornment,
1352
1370
  hidden = t0.hidden,
1353
1371
  collapse = t0.collapse,
1354
1372
  initCollapseIn = t0.collapseIn,
@@ -1491,7 +1509,7 @@ var PFormBlock = function PFormBlock(t0) {
1491
1509
  t8 = $[28];
1492
1510
  }
1493
1511
  var t9;
1494
- if ($[29] !== collapse || $[30] !== collapseIn || $[31] !== color || $[32] !== error || $[33] !== hidden || $[34] !== icon || $[35] !== label || $[36] !== line || $[37] !== lineVerticalMargin || $[38] !== size || $[39] !== warning) {
1512
+ if ($[29] !== collapse || $[30] !== collapseIn || $[31] !== color || $[32] !== endAdornment || $[33] !== error || $[34] !== hidden || $[35] !== icon || $[36] !== label || $[37] !== line || $[38] !== lineVerticalMargin || $[39] !== size || $[40] !== warning) {
1495
1513
  t9 = (icon || label || line || collapse) && /*#__PURE__*/React.createElement(PFormDivider, {
1496
1514
  className: "PFormBlock-header",
1497
1515
  collapse: collapse,
@@ -1505,6 +1523,7 @@ var PFormBlock = function PFormBlock(t0) {
1505
1523
  warning: warning,
1506
1524
  lineVerticalMargin: lineVerticalMargin,
1507
1525
  hidden: hidden,
1526
+ endAdornment: endAdornment,
1508
1527
  onCollapseChange: collapse ? function (newCollapseIn) {
1509
1528
  return setCollapseIn(newCollapseIn);
1510
1529
  } : undefined
@@ -1512,38 +1531,39 @@ var PFormBlock = function PFormBlock(t0) {
1512
1531
  $[29] = collapse;
1513
1532
  $[30] = collapseIn;
1514
1533
  $[31] = color;
1515
- $[32] = error;
1516
- $[33] = hidden;
1517
- $[34] = icon;
1518
- $[35] = label;
1519
- $[36] = line;
1520
- $[37] = lineVerticalMargin;
1521
- $[38] = size;
1522
- $[39] = warning;
1523
- $[40] = t9;
1534
+ $[32] = endAdornment;
1535
+ $[33] = error;
1536
+ $[34] = hidden;
1537
+ $[35] = icon;
1538
+ $[36] = label;
1539
+ $[37] = line;
1540
+ $[38] = lineVerticalMargin;
1541
+ $[39] = size;
1542
+ $[40] = warning;
1543
+ $[41] = t9;
1524
1544
  } else {
1525
- t9 = $[40];
1545
+ t9 = $[41];
1526
1546
  }
1527
1547
  var t10;
1528
- if ($[41] === Symbol["for"]("react.memo_cache_sentinel")) {
1548
+ if ($[42] === Symbol["for"]("react.memo_cache_sentinel")) {
1529
1549
  t10 = {
1530
1550
  xs: 12
1531
1551
  };
1532
- $[41] = t10;
1552
+ $[42] = t10;
1533
1553
  } else {
1534
- t10 = $[41];
1554
+ t10 = $[42];
1535
1555
  }
1536
1556
  var t11;
1537
- if ($[42] === Symbol["for"]("react.memo_cache_sentinel")) {
1557
+ if ($[43] === Symbol["for"]("react.memo_cache_sentinel")) {
1538
1558
  t11 = {
1539
1559
  xs: 12
1540
1560
  };
1541
- $[42] = t11;
1561
+ $[43] = t11;
1542
1562
  } else {
1543
- t11 = $[42];
1563
+ t11 = $[43];
1544
1564
  }
1545
1565
  var t12;
1546
- if ($[43] !== children || $[44] !== spacing) {
1566
+ if ($[44] !== children || $[45] !== spacing) {
1547
1567
  t12 = /*#__PURE__*/React.createElement(StyledWrapGrid$1, {
1548
1568
  size: t11,
1549
1569
  className: "PFormBlock-body"
@@ -1552,51 +1572,51 @@ var PFormBlock = function PFormBlock(t0) {
1552
1572
  container: true,
1553
1573
  spacing: spacing
1554
1574
  }, children));
1555
- $[43] = children;
1556
- $[44] = spacing;
1557
- $[45] = t12;
1575
+ $[44] = children;
1576
+ $[45] = spacing;
1577
+ $[46] = t12;
1558
1578
  } else {
1559
- t12 = $[45];
1579
+ t12 = $[46];
1560
1580
  }
1561
1581
  var t13;
1562
- if ($[46] !== spacing || $[47] !== t12) {
1582
+ if ($[47] !== spacing || $[48] !== t12) {
1563
1583
  t13 = /*#__PURE__*/React.createElement(material.Grid, {
1564
1584
  container: true,
1565
1585
  spacing: spacing
1566
1586
  }, t12);
1567
- $[46] = spacing;
1568
- $[47] = t12;
1569
- $[48] = t13;
1587
+ $[47] = spacing;
1588
+ $[48] = t12;
1589
+ $[49] = t13;
1570
1590
  } else {
1571
- t13 = $[48];
1591
+ t13 = $[49];
1572
1592
  }
1573
1593
  var t14;
1574
- if ($[49] !== Container || $[50] !== containerProps || $[51] !== t13) {
1594
+ if ($[50] !== Container || $[51] !== containerProps || $[52] !== t13) {
1575
1595
  t14 = /*#__PURE__*/React.createElement(StyledWrapGrid$1, {
1576
1596
  size: t10
1577
1597
  }, /*#__PURE__*/React.createElement(Container, containerProps, t13));
1578
- $[49] = Container;
1579
- $[50] = containerProps;
1580
- $[51] = t13;
1581
- $[52] = t14;
1598
+ $[50] = Container;
1599
+ $[51] = containerProps;
1600
+ $[52] = t13;
1601
+ $[53] = t14;
1582
1602
  } else {
1583
- t14 = $[52];
1603
+ t14 = $[53];
1584
1604
  }
1585
1605
  var t15;
1586
- if ($[53] !== spacing || $[54] !== t14 || $[55] !== t9) {
1606
+ if ($[54] !== spacing || $[55] !== t14 || $[56] !== t9) {
1587
1607
  t15 = /*#__PURE__*/React.createElement(material.Grid, {
1588
1608
  container: true,
1589
1609
  spacing: spacing
1590
1610
  }, t9, t14);
1591
- $[53] = spacing;
1592
- $[54] = t14;
1593
- $[55] = t9;
1594
- $[56] = t15;
1611
+ $[54] = spacing;
1612
+ $[55] = t14;
1613
+ $[56] = t9;
1614
+ $[57] = t15;
1595
1615
  } else {
1596
- t15 = $[56];
1616
+ t15 = $[57];
1597
1617
  }
1598
1618
  var t16;
1599
- if ($[57] !== ref || $[58] !== style || $[59] !== sx || $[60] !== t15 || $[61] !== t8) {
1619
+ if ($[58] !== ref || $[59] !== style || $[60] !== sx || $[61] !== t15 || $[62] !== t8) {
1600
1620
  t16 = /*#__PURE__*/React.createElement(material.Grid, {
1601
1621
  ref: ref,
1602
1622
  size: t7,
@@ -1604,25 +1624,25 @@ var PFormBlock = function PFormBlock(t0) {
1604
1624
  style: style,
1605
1625
  sx: sx
1606
1626
  }, t15);
1607
- $[57] = ref;
1608
- $[58] = style;
1609
- $[59] = sx;
1610
- $[60] = t15;
1611
- $[61] = t8;
1612
- $[62] = t16;
1627
+ $[58] = ref;
1628
+ $[59] = style;
1629
+ $[60] = sx;
1630
+ $[61] = t15;
1631
+ $[62] = t8;
1632
+ $[63] = t16;
1613
1633
  } else {
1614
- t16 = $[62];
1634
+ t16 = $[63];
1615
1635
  }
1616
1636
  var t17;
1617
- if ($[63] !== t16 || $[64] !== t6) {
1637
+ if ($[64] !== t16 || $[65] !== t6) {
1618
1638
  t17 = /*#__PURE__*/React.createElement(PFormContext.Provider, {
1619
1639
  value: t6
1620
1640
  }, t16);
1621
- $[63] = t16;
1622
- $[64] = t6;
1623
- $[65] = t17;
1641
+ $[64] = t16;
1642
+ $[65] = t6;
1643
+ $[66] = t17;
1624
1644
  } else {
1625
- t17 = $[65];
1645
+ t17 = $[66];
1626
1646
  }
1627
1647
  return t17;
1628
1648
  };var _templateObject$g;
@@ -11651,7 +11671,8 @@ function _temp$m() {
11651
11671
  finalValue_1.forEach(function (v_0) {
11652
11672
  var key = v_0.toString();
11653
11673
  if (itemsInfos[key]) {
11654
- computedComponentValue && computedComponentValue.push(itemsInfos[key]);
11674
+ var _computedComponentVal;
11675
+ (_computedComponentVal = computedComponentValue) === null || _computedComponentVal === void 0 || _computedComponentVal.push(itemsInfos[key]);
11655
11676
  }
11656
11677
  });
11657
11678
  } else {
@@ -13013,7 +13034,8 @@ var PrivateYearSelect = function PrivateYearSelect(t0) {
13013
13034
  var t3;
13014
13035
  if ($[3] !== onSelectRef) {
13015
13036
  t3 = function t3(e) {
13016
- onSelectRef.current && onSelectRef.current(Number(e.target.getAttribute("data-id")));
13037
+ var _onSelectRef$current;
13038
+ (_onSelectRef$current = onSelectRef.current) === null || _onSelectRef$current === void 0 || _onSelectRef$current.call(onSelectRef, Number(e.target.getAttribute("data-id")));
13017
13039
  };
13018
13040
  $[3] = onSelectRef;
13019
13041
  $[4] = t3;
@@ -13361,7 +13383,8 @@ var PrivateTimeSelect = function PrivateTimeSelect(t0) {
13361
13383
  var t6;
13362
13384
  if ($[5] !== onSelectRef) {
13363
13385
  t6 = function t6(e) {
13364
- onSelectRef.current && onSelectRef.current(Number(e.target.getAttribute("data-id")));
13386
+ var _onSelectRef$current;
13387
+ (_onSelectRef$current = onSelectRef.current) === null || _onSelectRef$current === void 0 || _onSelectRef$current.call(onSelectRef, Number(e.target.getAttribute("data-id")));
13365
13388
  };
13366
13389
  $[5] = onSelectRef;
13367
13390
  $[6] = t6;
@@ -17454,7 +17477,8 @@ function _temp$h() {
17454
17477
  var t2;
17455
17478
  if ($[0] !== onCloseRef) {
17456
17479
  t2 = function t2() {
17457
- onCloseRef.current && onCloseRef.current();
17480
+ var _onCloseRef$current;
17481
+ (_onCloseRef$current = onCloseRef.current) === null || _onCloseRef$current === void 0 || _onCloseRef$current.call(onCloseRef);
17458
17482
  };
17459
17483
  $[0] = onCloseRef;
17460
17484
  $[1] = t2;
@@ -22899,8 +22923,8 @@ function _temp2() {
22899
22923
  t3 = function t3() {
22900
22924
  var _inputRef$current;
22901
22925
  if ((_inputRef$current = inputRef.current) !== null && _inputRef$current !== void 0 && _inputRef$current.validate()) {
22902
- onConfirm && onConfirm(value);
22903
- onClose && onClose();
22926
+ onConfirm === null || onConfirm === void 0 || onConfirm(value);
22927
+ onClose === null || onClose === void 0 || onClose();
22904
22928
  } else {
22905
22929
  var _inputRef$current2;
22906
22930
  (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 || _inputRef$current2.focus();
@@ -22917,8 +22941,8 @@ function _temp2() {
22917
22941
  var t4;
22918
22942
  if ($[7] !== onCancel || $[8] !== onClose) {
22919
22943
  t4 = function t4() {
22920
- onCancel && onCancel();
22921
- onClose && onClose();
22944
+ onCancel === null || onCancel === void 0 || onCancel();
22945
+ onClose === null || onClose === void 0 || onClose();
22922
22946
  };
22923
22947
  $[7] = onCancel;
22924
22948
  $[8] = onClose;
@@ -22933,7 +22957,7 @@ function _temp2() {
22933
22957
  t6 = function t6(e, reason) {
22934
22958
  if (reason === "backdropClick") {
22935
22959
  if (compare.empty(value)) {
22936
- onClose && onClose();
22960
+ onClose === null || onClose === void 0 || onClose();
22937
22961
  }
22938
22962
  }
22939
22963
  };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@pdg/react-form",
3
3
  "title": "Typescript React Form Module",
4
4
  "description": "Typescript React Form Module",
5
- "version": "1.2.8",
5
+ "version": "1.2.10",
6
6
  "type": "module",
7
7
  "main": "./dist/index.js",
8
8
  "module": "./dist/index.esm.js",