@pdg/react-form 1.0.48 → 1.0.49
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/FormItemCustom/FormFile/FormFile.types.d.ts +3 -0
- package/dist/index.esm.js +18 -12
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +18 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -5,12 +5,15 @@ export interface FormFileProps extends CommonSxProps, FormValueItemProps {
|
|
|
5
5
|
accept?: string;
|
|
6
6
|
hideUrl?: boolean;
|
|
7
7
|
uploadLabel?: string;
|
|
8
|
+
uploadTabIndex?: number;
|
|
8
9
|
hideUpload?: boolean;
|
|
9
10
|
hideUploadLabel?: boolean;
|
|
10
11
|
linkLabel?: string;
|
|
12
|
+
linkTabIndex?: number;
|
|
11
13
|
hideLink?: boolean;
|
|
12
14
|
hideLinkLabel?: boolean;
|
|
13
15
|
removeLabel?: string;
|
|
16
|
+
removeTabIndex?: number;
|
|
14
17
|
hideRemove?: boolean;
|
|
15
18
|
hideRemoveLabel?: boolean;
|
|
16
19
|
labelShrink?: boolean;
|
package/dist/index.esm.js
CHANGED
|
@@ -11808,7 +11808,7 @@ styleInject(css_248z$1);var FormFile = React__default.forwardRef(function (_a, r
|
|
|
11808
11808
|
// ID --------------------------------------------------------------------------------------------------------------
|
|
11809
11809
|
var initVariant = _a.variant, initSize = _a.size, initColor = _a.color, initFocused = _a.focused, initLabelShrink = _a.labelShrink, initFullWidth = _a.fullWidth,
|
|
11810
11810
|
//----------------------------------------------------------------------------------------------------------------
|
|
11811
|
-
accept = _a.accept, hideUrl = _a.hideUrl, uploadLabel = _a.uploadLabel, hideUpload = _a.hideUpload, hideUploadLabel = _a.hideUploadLabel, linkLabel = _a.linkLabel, hideLink = _a.hideLink, hideLinkLabel = _a.hideLinkLabel, removeLabel = _a.removeLabel, hideRemove = _a.hideRemove, hideRemoveLabel = _a.hideRemoveLabel, maxFileSize = _a.maxFileSize, preview = _a.preview, hidden = _a.hidden, onFile = _a.onFile, onLink = _a.onLink,
|
|
11811
|
+
accept = _a.accept, hideUrl = _a.hideUrl, uploadLabel = _a.uploadLabel, uploadTabIndex = _a.uploadTabIndex, hideUpload = _a.hideUpload, hideUploadLabel = _a.hideUploadLabel, linkLabel = _a.linkLabel, linkTabIndex = _a.linkTabIndex, hideLink = _a.hideLink, hideLinkLabel = _a.hideLinkLabel, removeLabel = _a.removeLabel, removeTabIndex = _a.removeTabIndex, hideRemove = _a.hideRemove, hideRemoveLabel = _a.hideRemoveLabel, maxFileSize = _a.maxFileSize, preview = _a.preview, hidden = _a.hidden, onFile = _a.onFile, onLink = _a.onLink,
|
|
11812
11812
|
//----------------------------------------------------------------------------------------------------------------
|
|
11813
11813
|
name = _a.name, labelIcon = _a.labelIcon, initLabel = _a.label, required = _a.required, readOnly = _a.readOnly, initDisabled = _a.disabled, initError = _a.error, initHelperText = _a.helperText, initValue = _a.value, initData = _a.data, exceptValue = _a.exceptValue, onChange = _a.onChange, onValidate = _a.onValidate,
|
|
11814
11814
|
//----------------------------------------------------------------------------------------------------------------
|
|
@@ -11826,6 +11826,7 @@ styleInject(css_248z$1);var FormFile = React__default.forwardRef(function (_a, r
|
|
|
11826
11826
|
// Ref -------------------------------------------------------------------------------------------------------------
|
|
11827
11827
|
var textFieldRef = useRef(null);
|
|
11828
11828
|
var fileUploadBtnRef = useRef(null);
|
|
11829
|
+
var linkBtnRef = useRef(null);
|
|
11829
11830
|
// State - value ---------------------------------------------------------------------------------------------------
|
|
11830
11831
|
var _c = useAutoUpdateState$1(initValue), value = _c[0], setValue = _c[1];
|
|
11831
11832
|
var fileValue = useState('')[0];
|
|
@@ -11851,14 +11852,19 @@ styleInject(css_248z$1);var FormFile = React__default.forwardRef(function (_a, r
|
|
|
11851
11852
|
}, [initLabel, labelIcon]);
|
|
11852
11853
|
// Function - focus ------------------------------------------------------------------------------------------------
|
|
11853
11854
|
var focus = useCallback(function () {
|
|
11854
|
-
var _a, _b;
|
|
11855
|
+
var _a, _b, _c;
|
|
11855
11856
|
if (hideUrl) {
|
|
11856
|
-
(
|
|
11857
|
+
if (hideUpload) {
|
|
11858
|
+
(_a = linkBtnRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
11859
|
+
}
|
|
11860
|
+
else {
|
|
11861
|
+
(_b = fileUploadBtnRef.current) === null || _b === void 0 ? void 0 : _b.focus();
|
|
11862
|
+
}
|
|
11857
11863
|
}
|
|
11858
11864
|
else {
|
|
11859
|
-
(
|
|
11865
|
+
(_c = textFieldRef.current) === null || _c === void 0 ? void 0 : _c.focus();
|
|
11860
11866
|
}
|
|
11861
|
-
}, [hideUrl]);
|
|
11867
|
+
}, [hideUpload, hideUrl]);
|
|
11862
11868
|
// Function - setErrorHelperText -----------------------------------------------------------------------------------
|
|
11863
11869
|
var setErrorHelperText = useCallback(function (error, helperText) {
|
|
11864
11870
|
setError(error);
|
|
@@ -12051,36 +12057,36 @@ styleInject(css_248z$1);var FormFile = React__default.forwardRef(function (_a, r
|
|
|
12051
12057
|
},
|
|
12052
12058
|
}, style: { width: fullWidth ? '100%' : undefined }, control: React__default.createElement("div", { className: 'control-wrap' },
|
|
12053
12059
|
!hideUrl && (React__default.createElement("div", { className: 'file-name-wrap' },
|
|
12054
|
-
React__default.createElement(TextField, { inputRef: textFieldRef, className: 'file-name', variant: variant, label: label, size: size, required: required, value: value || '', focused: focused, disabled: disabled, fullWidth: true, error: error, InputLabelProps: labelShrink ? { shrink: labelShrink } : undefined, inputProps: { readOnly: true
|
|
12060
|
+
React__default.createElement(TextField, { inputRef: textFieldRef, className: 'file-name', variant: variant, label: label, size: size, required: required, value: value || '', focused: focused, disabled: disabled, fullWidth: true, error: error, InputLabelProps: labelShrink ? { shrink: labelShrink } : undefined, inputProps: { readOnly: true }, InputProps: {
|
|
12055
12061
|
endAdornment: (React__default.createElement(InputAdornment, { position: 'end' },
|
|
12056
12062
|
React__default.createElement("div", { className: 'input-file-wrap' },
|
|
12057
12063
|
!hideUpload && (React__default.createElement(React__default.Fragment, null,
|
|
12058
|
-
React__default.createElement(Button, { variant: 'text', className: classNames$1('input-file-btn form-file-btn', !!hideUploadLabel && 'hidden-label'), color: error ? 'error' : color, disabled: readOnly || disabled, ref: fileUploadBtnRef },
|
|
12064
|
+
React__default.createElement(Button, { variant: 'text', tabIndex: uploadTabIndex == null ? -1 : uploadTabIndex, className: classNames$1('input-file-btn form-file-btn', !!hideUploadLabel && 'hidden-label'), color: error ? 'error' : color, disabled: readOnly || disabled, ref: fileUploadBtnRef },
|
|
12059
12065
|
React__default.createElement("label", { htmlFor: id },
|
|
12060
12066
|
React__default.createElement(FormIcon, null, "upload"),
|
|
12061
12067
|
!hideUploadLabel && (uploadLabel || '파일 업로드'))),
|
|
12062
12068
|
React__default.createElement("input", { type: 'file', accept: accept, id: id, value: fileValue, className: 'input-file', onChange: handleFileChange }))),
|
|
12063
|
-
!hideLink && (React__default.createElement(Button, { variant: 'text', className: classNames$1('link-btn form-file-btn', !!hideLinkLabel && 'hidden-label'), color: error ? 'error' : color, disabled: readOnly || disabled, onClick: handleLinkClick },
|
|
12069
|
+
!hideLink && (React__default.createElement(Button, { variant: 'text', tabIndex: linkTabIndex == null ? -1 : linkTabIndex, className: classNames$1('link-btn form-file-btn', !!hideLinkLabel && 'hidden-label'), color: error ? 'error' : color, disabled: readOnly || disabled, ref: linkBtnRef, onClick: handleLinkClick },
|
|
12064
12070
|
React__default.createElement("label", null,
|
|
12065
12071
|
React__default.createElement(FormIcon, null, "link"),
|
|
12066
12072
|
!hideLinkLabel && (linkLabel || '링크')))),
|
|
12067
|
-
!hideRemove && notEmpty(value) && (React__default.createElement(Button, { variant: 'text', className: classNames$1('remove-btn form-file-btn', !!hideRemoveLabel && 'hidden-label'), color: error ? 'error' : color, disabled: readOnly || disabled, onClick: handleRemoveClick },
|
|
12073
|
+
!hideRemove && notEmpty(value) && (React__default.createElement(Button, { variant: 'text', tabIndex: removeTabIndex == null ? -1 : removeTabIndex, className: classNames$1('remove-btn form-file-btn', !!hideRemoveLabel && 'hidden-label'), color: error ? 'error' : color, disabled: readOnly || disabled, onClick: handleRemoveClick },
|
|
12068
12074
|
React__default.createElement("label", null,
|
|
12069
12075
|
React__default.createElement(FormIcon, null, "Close"),
|
|
12070
12076
|
!hideRemoveLabel && (removeLabel || '삭제'))))))),
|
|
12071
12077
|
}, placeholder: '\uD30C\uC77C\uC744 \uC120\uD0DD\uD558\uC138\uC694' }))),
|
|
12072
12078
|
!!hideUrl && (React__default.createElement("div", { className: 'input-file-wrap' },
|
|
12073
12079
|
!hideUpload && (React__default.createElement(React__default.Fragment, null,
|
|
12074
|
-
React__default.createElement(Button, { variant: 'outlined', className: classNames$1('input-file-btn form-file-btn', !!hideUploadLabel && 'hidden-label'), color: error ? 'error' : color, ref: fileUploadBtnRef, disabled: disabled },
|
|
12080
|
+
React__default.createElement(Button, { variant: 'outlined', tabIndex: uploadTabIndex, className: classNames$1('input-file-btn form-file-btn', !!hideUploadLabel && 'hidden-label'), color: error ? 'error' : color, ref: fileUploadBtnRef, disabled: disabled },
|
|
12075
12081
|
React__default.createElement("label", { htmlFor: id },
|
|
12076
12082
|
React__default.createElement(FormIcon, null, "upload"),
|
|
12077
12083
|
!hideUploadLabel && (uploadLabel || '파일 업로드'))),
|
|
12078
12084
|
React__default.createElement("input", { type: 'file', accept: accept, id: id, value: fileValue, className: 'input-file', onChange: handleFileChange }))),
|
|
12079
|
-
!hideLink && (React__default.createElement(Button, { variant: 'outlined', className: classNames$1('link-btn form-file-btn', !!hideLinkLabel && 'hidden-label'), color: error ? 'error' : color, onClick: handleLinkClick, disabled: disabled },
|
|
12085
|
+
!hideLink && (React__default.createElement(Button, { variant: 'outlined', tabIndex: linkTabIndex, className: classNames$1('link-btn form-file-btn', !!hideLinkLabel && 'hidden-label'), color: error ? 'error' : color, onClick: handleLinkClick, disabled: disabled, ref: linkBtnRef },
|
|
12080
12086
|
React__default.createElement("label", null,
|
|
12081
12087
|
React__default.createElement(FormIcon, null, "link"),
|
|
12082
12088
|
!hideLinkLabel && (linkLabel || '링크')))),
|
|
12083
|
-
!hideRemove && notEmpty(value) && (React__default.createElement(Button, { variant: 'outlined', className: classNames$1('remove-btn form-file-btn', !!hideRemoveLabel && 'hidden-label'), color: error ? 'error' : color, disabled: disabled, onClick: handleRemoveClick },
|
|
12089
|
+
!hideRemove && notEmpty(value) && (React__default.createElement(Button, { variant: 'outlined', tabIndex: removeTabIndex, className: classNames$1('remove-btn form-file-btn', !!hideRemoveLabel && 'hidden-label'), color: error ? 'error' : color, disabled: disabled, onClick: handleRemoveClick },
|
|
12084
12090
|
React__default.createElement("label", null,
|
|
12085
12091
|
React__default.createElement(FormIcon, null, "Close"),
|
|
12086
12092
|
!hideRemoveLabel && (removeLabel || '삭제')))))),
|