@pdg/react-form 1.0.42 → 1.0.44
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.
- package/dist/FormCommon/FormLabel/FormLabel.style.d.ts +1 -1
- package/dist/FormItemCustom/FormDateRangePicker/CustomDatePickerContainer/CustomDatePickerContainer.types.d.ts +5 -0
- package/dist/FormItemCustom/FormDateRangePicker/FormDateRangePicker.types.d.ts +5 -0
- package/dist/index.esm.js +33 -24
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +33 -24
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const IconFormIcon: import("@emotion/styled").StyledComponent<import("../FormIcon").FormIconProps & import("react").RefAttributes<HTMLAnchorElement> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
2
|
+
export declare const IconFormIcon: import("@emotion/styled").StyledComponent<Pick<import("../FormIcon").FormIconProps, "className" | "style" | "classes" | "baseClassName" | "children" | "color" | "fontSize" | "sx" | "slot" | "title" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture"> & import("react").RefAttributes<HTMLAnchorElement> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
3
3
|
export declare const ChildrenSpan: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
@@ -11,6 +11,11 @@ export interface CustomDatePickerContainerProps {
|
|
|
11
11
|
disableFuture?: boolean;
|
|
12
12
|
minDate?: Dayjs;
|
|
13
13
|
maxDate?: Dayjs;
|
|
14
|
+
onGetActionButtons?(): {
|
|
15
|
+
label: string;
|
|
16
|
+
start: Dayjs;
|
|
17
|
+
end: Dayjs;
|
|
18
|
+
}[];
|
|
14
19
|
onChange(newValue: CustomDatePickerValue): void;
|
|
15
20
|
onValueChange(selectType: CustomDatePickerSelectType, newValue: CustomDatePickerDateValue): void;
|
|
16
21
|
onMonthsChange(months: CustomDatePickerContainerMonths): void;
|
|
@@ -41,6 +41,11 @@ export interface FormDateRangePickerProps extends CommonSxProps, Omit<FormValueI
|
|
|
41
41
|
minDate?: Dayjs;
|
|
42
42
|
maxDate?: Dayjs;
|
|
43
43
|
hidden?: boolean;
|
|
44
|
+
onGetActionButtons?(): {
|
|
45
|
+
label: string;
|
|
46
|
+
start: Dayjs;
|
|
47
|
+
end: Dayjs;
|
|
48
|
+
}[];
|
|
44
49
|
onChange?(value: FormDateRangePickerValue): void;
|
|
45
50
|
onValidate?(value: FormDateRangePickerValue): boolean | string;
|
|
46
51
|
}
|
package/dist/index.esm.js
CHANGED
|
@@ -10707,6 +10707,10 @@ styleInject(css_248z$4);var CustomDatePicker = React__default.forwardRef(functio
|
|
|
10707
10707
|
return initValue ? initValue : [null, null];
|
|
10708
10708
|
}, [initValue]))[0];
|
|
10709
10709
|
var _b = useState(null), activeMonthValue = _b[0], setActiveMonthValue = _b[1];
|
|
10710
|
+
// Effect ------------------------------------------------------------------------------------------------------------
|
|
10711
|
+
useEffect(function () {
|
|
10712
|
+
setActiveMonthValue(null);
|
|
10713
|
+
}, [selectType]);
|
|
10710
10714
|
//--------------------------------------------------------------------------------------------------------------------
|
|
10711
10715
|
var leftArrowOnClickRef = useRef();
|
|
10712
10716
|
var rightArrowOnClickRef = useRef();
|
|
@@ -10887,7 +10891,7 @@ for (var i = 0; i < 12; i += 1) {
|
|
|
10887
10891
|
MONTHS[i] = i;
|
|
10888
10892
|
}
|
|
10889
10893
|
var CustomDatePickerContainer = React__default.forwardRef(function (_a, ref) {
|
|
10890
|
-
var selectType = _a.selectType, value = _a.value, calendarCount = _a.calendarCount, months = _a.months, disablePast = _a.disablePast, disableFuture = _a.disableFuture, maxDate = _a.maxDate, minDate = _a.minDate, onChange = _a.onChange, onValueChange = _a.onValueChange, onMonthsChange = _a.onMonthsChange;
|
|
10894
|
+
var selectType = _a.selectType, value = _a.value, calendarCount = _a.calendarCount, months = _a.months, disablePast = _a.disablePast, disableFuture = _a.disableFuture, maxDate = _a.maxDate, minDate = _a.minDate, onGetActionButtons = _a.onGetActionButtons, onChange = _a.onChange, onValueChange = _a.onValueChange, onMonthsChange = _a.onMonthsChange;
|
|
10891
10895
|
var theme = useTheme();
|
|
10892
10896
|
// Ref -------------------------------------------------------------------------------------------------------------
|
|
10893
10897
|
var datePicker1Ref = useRef(null);
|
|
@@ -11045,29 +11049,34 @@ var CustomDatePickerContainer = React__default.forwardRef(function (_a, ref) {
|
|
|
11045
11049
|
}, [onChange, availableDate]);
|
|
11046
11050
|
// Render ----------------------------------------------------------------------------------------------------------
|
|
11047
11051
|
var actionButtons = useMemo(function () {
|
|
11048
|
-
|
|
11049
|
-
|
|
11050
|
-
var dayOfWeek = now.day();
|
|
11051
|
-
var lastWeekDate;
|
|
11052
|
-
var thisWeekDate;
|
|
11053
|
-
if (dayOfWeek === 0) {
|
|
11054
|
-
lastWeekDate = [lastWeek.subtract(6, 'd'), lastWeek];
|
|
11055
|
-
thisWeekDate = [now.subtract(6, 'd'), now];
|
|
11052
|
+
if (onGetActionButtons) {
|
|
11053
|
+
return onGetActionButtons().map(function (info) { return getActionButton(info.start, info.end, info.label); });
|
|
11056
11054
|
}
|
|
11057
11055
|
else {
|
|
11058
|
-
|
|
11059
|
-
|
|
11060
|
-
|
|
11061
|
-
|
|
11062
|
-
|
|
11063
|
-
|
|
11064
|
-
|
|
11065
|
-
|
|
11066
|
-
|
|
11067
|
-
|
|
11068
|
-
|
|
11069
|
-
|
|
11070
|
-
|
|
11056
|
+
var now = dayjs().startOf('d');
|
|
11057
|
+
var lastWeek = now.subtract(1, 'week');
|
|
11058
|
+
var dayOfWeek = now.day();
|
|
11059
|
+
var lastWeekDate = void 0;
|
|
11060
|
+
var thisWeekDate = void 0;
|
|
11061
|
+
if (dayOfWeek === 0) {
|
|
11062
|
+
lastWeekDate = [lastWeek.subtract(6, 'd'), lastWeek];
|
|
11063
|
+
thisWeekDate = [now.subtract(6, 'd'), now];
|
|
11064
|
+
}
|
|
11065
|
+
else {
|
|
11066
|
+
lastWeekDate = [lastWeek.subtract(dayOfWeek - 1, 'd'), lastWeek.add(7 - dayOfWeek, 'd')];
|
|
11067
|
+
thisWeekDate = [now.subtract(dayOfWeek - 1, 'd'), now.add(7 - dayOfWeek, 'd')];
|
|
11068
|
+
}
|
|
11069
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
11070
|
+
getActionButton(now.subtract(1, 'month').startOf('month'), now.subtract(1, 'month').endOf('month'), '지난달'),
|
|
11071
|
+
getActionButton(now.startOf('month'), now.endOf('month'), '이번달'),
|
|
11072
|
+
getActionButton(now.subtract(29, 'd'), now, '최근 30일'),
|
|
11073
|
+
getActionButton(now.subtract(6, 'd'), now, '최근 7일'),
|
|
11074
|
+
getActionButton(lastWeekDate[0], lastWeekDate[1], '지난주'),
|
|
11075
|
+
getActionButton(thisWeekDate[0], thisWeekDate[1], '이번주'),
|
|
11076
|
+
getActionButton(now.subtract(1, 'd'), now.subtract(1, 'd'), '어제'),
|
|
11077
|
+
getActionButton(now, now, '오늘')));
|
|
11078
|
+
}
|
|
11079
|
+
}, [onGetActionButtons, getActionButton]);
|
|
11071
11080
|
return (React__default.createElement("div", { className: 'CustomDatePickerContainer' },
|
|
11072
11081
|
React__default.createElement(Grid, { container: true, direction: 'column' },
|
|
11073
11082
|
!yearSelectOpen && !monthSelectOpen && (React__default.createElement(Grid, { item: true },
|
|
@@ -11206,7 +11215,7 @@ var FormDateRangePicker = React__default.forwardRef(function (_a, ref) {
|
|
|
11206
11215
|
// ID --------------------------------------------------------------------------------------------------------------
|
|
11207
11216
|
var initVariant = _a.variant, initSize = _a.size, initColor = _a.color, initFocused = _a.focused, initLabelShrink = _a.labelShrink, initFullWidth = _a.fullWidth,
|
|
11208
11217
|
//--------------------------------------------------------------------------------------------------------------------
|
|
11209
|
-
name = _a.name, initValue = _a.value, initData = _a.data, startLabel = _a.startLabel, startLabelIcon = _a.startLabelIcon, endLabel = _a.endLabel, endLabelIcon = _a.endLabelIcon, initCalendarCount = _a.calendarCount, initFormat = _a.format, formValueFormat = _a.formValueFormat, allowSingleSelect = _a.allowSingleSelect, required = _a.required, requiredStart = _a.requiredStart, requiredEnd = _a.requiredEnd, readOnly = _a.readOnly, readOnlyStart = _a.readOnlyStart, readOnlyEnd = _a.readOnlyEnd, readOnlyInput = _a.readOnlyInput, initDisabled = _a.disabled, inputWidth = _a.inputWidth, exceptValue = _a.exceptValue, initError = _a.error, initHelperText = _a.helperText, formValueStartNameSuffix = _a.formValueStartNameSuffix, formValueEndNameSuffix = _a.formValueEndNameSuffix, icon = _a.icon, startIcon = _a.startIcon, endIcon = _a.endIcon, startAdornment = _a.startAdornment, startStartAdornment = _a.startStartAdornment, endStartAdornment = _a.endStartAdornment, endAdornment = _a.endAdornment, startEndAdornment = _a.startEndAdornment, endEndAdornment = _a.endEndAdornment, disablePast = _a.disablePast, disableFuture = _a.disableFuture, minDate = _a.minDate, maxDate = _a.maxDate, hidden = _a.hidden, onChange = _a.onChange, onValidate = _a.onValidate,
|
|
11218
|
+
name = _a.name, initValue = _a.value, initData = _a.data, startLabel = _a.startLabel, startLabelIcon = _a.startLabelIcon, endLabel = _a.endLabel, endLabelIcon = _a.endLabelIcon, initCalendarCount = _a.calendarCount, initFormat = _a.format, formValueFormat = _a.formValueFormat, allowSingleSelect = _a.allowSingleSelect, required = _a.required, requiredStart = _a.requiredStart, requiredEnd = _a.requiredEnd, readOnly = _a.readOnly, readOnlyStart = _a.readOnlyStart, readOnlyEnd = _a.readOnlyEnd, readOnlyInput = _a.readOnlyInput, initDisabled = _a.disabled, inputWidth = _a.inputWidth, exceptValue = _a.exceptValue, initError = _a.error, initHelperText = _a.helperText, formValueStartNameSuffix = _a.formValueStartNameSuffix, formValueEndNameSuffix = _a.formValueEndNameSuffix, icon = _a.icon, startIcon = _a.startIcon, endIcon = _a.endIcon, startAdornment = _a.startAdornment, startStartAdornment = _a.startStartAdornment, endStartAdornment = _a.endStartAdornment, endAdornment = _a.endAdornment, startEndAdornment = _a.startEndAdornment, endEndAdornment = _a.endEndAdornment, disablePast = _a.disablePast, disableFuture = _a.disableFuture, minDate = _a.minDate, maxDate = _a.maxDate, hidden = _a.hidden, onGetActionButtons = _a.onGetActionButtons, onChange = _a.onChange, onValidate = _a.onValidate,
|
|
11210
11219
|
// -------------------------------------------------------------------------------------------------------------------
|
|
11211
11220
|
className = _a.className;
|
|
11212
11221
|
var id = useId();
|
|
@@ -11720,7 +11729,7 @@ var FormDateRangePicker = React__default.forwardRef(function (_a, ref) {
|
|
|
11720
11729
|
},
|
|
11721
11730
|
],
|
|
11722
11731
|
}, title: React__default.createElement("div", { style: { display: 'flex' } },
|
|
11723
|
-
React__default.createElement(CustomDatePickerContainer, { ref: containerRef, calendarCount: calendarCount, selectType: selectType, value: value, months: months, disablePast: disablePast, disableFuture: disableFuture, minDate: minDate, maxDate: maxDate, onChange: handleChange, onValueChange: handleValueChange, onMonthsChange: setMonths })) },
|
|
11732
|
+
React__default.createElement(CustomDatePickerContainer, { ref: containerRef, calendarCount: calendarCount, selectType: selectType, value: value, months: months, disablePast: disablePast, disableFuture: disableFuture, minDate: minDate, maxDate: maxDate, onGetActionButtons: onGetActionButtons, onChange: handleChange, onValueChange: handleValueChange, onMonthsChange: setMonths })) },
|
|
11724
11733
|
React__default.createElement(Grid, { container: true, alignItems: 'center' },
|
|
11725
11734
|
React__default.createElement(Grid, { item: true, flex: 1 },
|
|
11726
11735
|
React__default.createElement(InputDatePicker, __assign$6({}, inputDatePickerProps, { style: inputStyle, value: value[0], label: startLabel, labelIcon: startLabelIcon, error: error || startError, focused: focused || (open && selectType === 'start'), required: required || requiredStart, readOnly: readOnly || readOnlyStart, readOnlyInput: readOnlyInput, icon: startIcon || icon, startAdornment: startStartAdornment || startAdornment, endAdornment: startEndAdornment || endAdornment, inputRef: startDateTextFieldRef, onChange: function (newValue) { return handleInputDatePickerChange('start', newValue); }, onFocus: function () { return handleInputDatePickerFocus('start'); }, onError: function (reason) { return (startInputDatePickerErrorRef.current = reason); } }))),
|