@pdg/react-form 1.0.38 → 1.0.40

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.
@@ -5,6 +5,8 @@ export interface FormFileProps extends CommonSxProps, FormValueItemProps {
5
5
  accept?: string;
6
6
  hideUrl?: boolean;
7
7
  hideLink?: boolean;
8
+ hideUpload?: boolean;
9
+ hideRemove?: boolean;
8
10
  labelShrink?: boolean;
9
11
  maxFileSize?: number;
10
12
  preview?: ReactNode;
package/dist/index.esm.js CHANGED
@@ -11780,12 +11780,12 @@ FormDateRangePicker.defaultProps = FormDateRangePickerDefaultProps;var FormFileD
11780
11780
  React__default.createElement(Button, { variant: 'text', onClick: handleSubmit }, "\uD655\uC778"))));
11781
11781
  };
11782
11782
  LinkDialog.displayName = 'LinkDialog';
11783
- LinkDialog.defaultProps = LinkDialogDefaultProps;var css_248z$1 = ".FormFile .control-wrap {\n display: inline-flex;\n}\n.FormFile .control-wrap .file-name-wrap .file-name {\n min-width: 350px;\n}\n.FormFile .control-wrap .file-name-wrap .file-name .MuiInputBase-root {\n padding-right: 7px;\n}\n.FormFile .control-wrap .input-file {\n display: none;\n}\n.FormFile .control-wrap .form-file-btn {\n padding: 0;\n}\n.FormFile .control-wrap .form-file-btn label {\n cursor: pointer;\n display: flex;\n width: 100%;\n height: 100%;\n justify-content: center;\n align-items: center;\n padding: 0 10px;\n}\n.FormFile .control-wrap .form-file-btn label .FormIcon {\n margin-right: 5px;\n}\n.FormFile .control-wrap .input-file-wrap {\n display: flex;\n}\n.FormFile .control-wrap .input-file-wrap .input-file-btn .FormIcon {\n margin-left: -3px;\n}\n.FormFile .control-wrap .input-file-wrap .link-btn {\n border-left: 0;\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n}\n.FormFile .control-wrap .input-file-wrap .remove-btn {\n border-left: 0;\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n}\n.FormFile.with-value .control-wrap .input-file-wrap .link-btn {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n}\n.FormFile:not(.hide-file-name) .input-file-wrap .input-file-btn {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n}\n.FormFile:not(.hide-link) .input-file-wrap .input-file-btn, .FormFile.with-value .input-file-wrap .input-file-btn {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n}\n.FormFile.full-width .control-wrap {\n display: flex;\n}\n.FormFile.full-width .control-wrap .file-name-wrap {\n flex: 1;\n}\n.FormFile.variant-standard .file-name-wrap .file-name .MuiInputBase-root {\n padding-right: 0;\n}\n\n.FormFile:not(.hide-file-name).variant-outlined .form-file-btn label, .FormFile:not(.hide-file-name).variant-filled .form-file-btn label {\n padding-top: 10px;\n padding-bottom: 10px;\n}\n.FormFile:not(.hide-file-name).variant-standard .form-file-btn label {\n padding-top: 5px;\n padding-bottom: 5px;\n}\n.FormFile:not(.hide-file-name).size-small .form-file-btn label {\n padding-top: 5px;\n padding-bottom: 5px;\n}\n\n.FormFile.hide-file-name:not(.with-label).variant-outlined .form-file-btn {\n height: 52px;\n}\n.FormFile.hide-file-name:not(.with-label).variant-filled .form-file-btn {\n height: 52px;\n}\n.FormFile.hide-file-name:not(.with-label).variant-standard .form-file-btn {\n height: 28px;\n}\n.FormFile.hide-file-name:not(.with-label).size-small.variant-outlined .form-file-btn {\n height: 37px;\n}\n.FormFile.hide-file-name:not(.with-label).size-small.variant-filled .form-file-btn {\n height: 44px;\n}\n.FormFile.hide-file-name:not(.with-label).size-small.variant-standard .form-file-btn {\n height: 26px;\n}\n.FormFile.hide-file-name.with-label.variant-outlined .form-file-btn {\n height: 37px;\n}\n.FormFile.hide-file-name.with-label.variant-filled .form-file-btn {\n height: 37px;\n}\n.FormFile.hide-file-name.with-label.variant-standard .form-file-btn {\n height: 28px;\n}\n.FormFile.hide-file-name.with-label.size-small.variant-outlined .form-file-btn {\n height: 24px;\n}\n.FormFile.hide-file-name.with-label.size-small.variant-filled .form-file-btn {\n height: 31px;\n}\n.FormFile.hide-file-name.with-label.size-small.variant-standard .form-file-btn {\n height: 26px;\n}\n\n.Form .FormCol.with-label .FormFile.hide-file-name.variant-outlined .form-file-btn {\n height: 37px;\n}\n.Form .FormCol.with-label .FormFile.hide-file-name.variant-filled .form-file-btn {\n height: 37px;\n}\n.Form .FormCol.with-label .FormFile.hide-file-name.variant-standard .form-file-btn {\n height: 28px;\n}\n.Form .FormCol.with-label .FormFile.hide-file-name.size-small.variant-outlined .form-file-btn {\n height: 24px;\n}\n.Form .FormCol.with-label .FormFile.hide-file-name.size-small.variant-filled .form-file-btn {\n height: 31px;\n}\n.Form .FormCol.with-label .FormFile.hide-file-name.size-small.variant-standard .form-file-btn {\n height: 26px;\n}";
11783
+ LinkDialog.defaultProps = LinkDialogDefaultProps;var css_248z$1 = ".FormFile .control-wrap {\n display: inline-flex;\n}\n.FormFile .control-wrap .file-name-wrap .file-name {\n min-width: 350px;\n}\n.FormFile .control-wrap .file-name-wrap .file-name .MuiInputBase-root {\n padding-right: 7px;\n}\n.FormFile .control-wrap .input-file {\n display: none;\n}\n.FormFile .control-wrap .form-file-btn {\n padding: 0;\n}\n.FormFile .control-wrap .form-file-btn label {\n cursor: pointer;\n display: flex;\n width: 100%;\n height: 100%;\n justify-content: center;\n align-items: center;\n padding: 0 10px;\n}\n.FormFile .control-wrap .form-file-btn label .FormIcon {\n margin-right: 5px;\n}\n.FormFile .control-wrap .input-file-wrap {\n display: flex;\n}\n.FormFile .control-wrap .input-file-wrap .input-file-btn .FormIcon {\n margin-left: -3px;\n}\n.FormFile .control-wrap .input-file-wrap .form-file-btn:first-of-type:not(:last-of-type) {\n border-right: 0;\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n}\n.FormFile .control-wrap .input-file-wrap .form-file-btn:last-of-type:not(:first-of-type) {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n}\n.FormFile .control-wrap .input-file-wrap .form-file-btn:not(:first-of-type):not(:last-of-type) {\n border-right: 0;\n border-radius: 0;\n}\n.FormFile.full-width .control-wrap {\n display: flex;\n}\n.FormFile.full-width .control-wrap .file-name-wrap {\n flex: 1;\n}\n.FormFile.variant-standard .file-name-wrap .file-name .MuiInputBase-root {\n padding-right: 0;\n}\n\n.FormFile:not(.hide-file-name).variant-outlined .form-file-btn label, .FormFile:not(.hide-file-name).variant-filled .form-file-btn label {\n padding-top: 10px;\n padding-bottom: 10px;\n}\n.FormFile:not(.hide-file-name).variant-standard .form-file-btn label {\n padding-top: 5px;\n padding-bottom: 5px;\n}\n.FormFile:not(.hide-file-name).size-small .form-file-btn label {\n padding-top: 5px;\n padding-bottom: 5px;\n}\n\n.FormFile.hide-file-name:not(.with-label).variant-outlined .form-file-btn {\n height: 52px;\n}\n.FormFile.hide-file-name:not(.with-label).variant-filled .form-file-btn {\n height: 52px;\n}\n.FormFile.hide-file-name:not(.with-label).variant-standard .form-file-btn {\n height: 28px;\n}\n.FormFile.hide-file-name:not(.with-label).size-small.variant-outlined .form-file-btn {\n height: 37px;\n}\n.FormFile.hide-file-name:not(.with-label).size-small.variant-filled .form-file-btn {\n height: 44px;\n}\n.FormFile.hide-file-name:not(.with-label).size-small.variant-standard .form-file-btn {\n height: 26px;\n}\n.FormFile.hide-file-name.with-label.variant-outlined .form-file-btn {\n height: 37px;\n}\n.FormFile.hide-file-name.with-label.variant-filled .form-file-btn {\n height: 37px;\n}\n.FormFile.hide-file-name.with-label.variant-standard .form-file-btn {\n height: 28px;\n}\n.FormFile.hide-file-name.with-label.size-small.variant-outlined .form-file-btn {\n height: 24px;\n}\n.FormFile.hide-file-name.with-label.size-small.variant-filled .form-file-btn {\n height: 31px;\n}\n.FormFile.hide-file-name.with-label.size-small.variant-standard .form-file-btn {\n height: 26px;\n}\n\n.Form .FormCol.with-label .FormFile.hide-file-name.variant-outlined .form-file-btn {\n height: 37px;\n}\n.Form .FormCol.with-label .FormFile.hide-file-name.variant-filled .form-file-btn {\n height: 37px;\n}\n.Form .FormCol.with-label .FormFile.hide-file-name.variant-standard .form-file-btn {\n height: 28px;\n}\n.Form .FormCol.with-label .FormFile.hide-file-name.size-small.variant-outlined .form-file-btn {\n height: 24px;\n}\n.Form .FormCol.with-label .FormFile.hide-file-name.size-small.variant-filled .form-file-btn {\n height: 31px;\n}\n.Form .FormCol.with-label .FormFile.hide-file-name.size-small.variant-standard .form-file-btn {\n height: 26px;\n}";
11784
11784
  styleInject(css_248z$1);var FormFile = React__default.forwardRef(function (_a, ref) {
11785
11785
  // ID --------------------------------------------------------------------------------------------------------------
11786
11786
  var initVariant = _a.variant, initSize = _a.size, initColor = _a.color, initFocused = _a.focused, initLabelShrink = _a.labelShrink, initFullWidth = _a.fullWidth,
11787
11787
  //----------------------------------------------------------------------------------------------------------------
11788
- accept = _a.accept, hideUrl = _a.hideUrl, hideLink = _a.hideLink, maxFileSize = _a.maxFileSize, preview = _a.preview, hidden = _a.hidden, onFile = _a.onFile, onLink = _a.onLink,
11788
+ accept = _a.accept, hideUrl = _a.hideUrl, hideLink = _a.hideLink, hideUpload = _a.hideUpload, hideRemove = _a.hideRemove, maxFileSize = _a.maxFileSize, preview = _a.preview, hidden = _a.hidden, onFile = _a.onFile, onLink = _a.onLink,
11789
11789
  //----------------------------------------------------------------------------------------------------------------
11790
11790
  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,
11791
11791
  //----------------------------------------------------------------------------------------------------------------
@@ -12019,7 +12019,7 @@ styleInject(css_248z$1);var FormFile = React__default.forwardRef(function (_a, r
12019
12019
  }
12020
12020
  }, [name, onLink, onValueChangeByUser, setValue]);
12021
12021
  // Render ----------------------------------------------------------------------------------------------------------
12022
- return (React__default.createElement(FormItemBase, { variant: variant, size: size, color: color, focused: focused, className: classNames$1(className, 'FormValueItem', 'FormFile', "variant-".concat(variant), "size-".concat(size), !!initLabel && 'with-label', !!fullWidth && 'full-width', !!hideUrl && 'hide-file-name', !!hideLink && 'hide-link', notEmpty(value) && 'with-value'), labelIcon: hideUrl ? labelIcon : undefined, label: hideUrl ? initLabel : undefined, error: error, required: required, fullWidth: fullWidth, hidden: hidden, helperText: React__default.createElement("div", null,
12022
+ return (React__default.createElement(FormItemBase, { variant: variant, size: size, color: color, focused: focused, className: classNames$1(className, 'FormValueItem', 'FormFile', "variant-".concat(variant), "size-".concat(size), !!initLabel && 'with-label', !!fullWidth && 'full-width', !!hideUrl && 'hide-file-name', !!hideLink && 'hide-link', !!hideUpload && 'hide-upload', !!hideRemove && 'hide-remove', notEmpty(value) && 'with-value'), labelIcon: hideUrl ? labelIcon : undefined, label: hideUrl ? initLabel : undefined, error: error, required: required, fullWidth: fullWidth, hidden: hidden, helperText: React__default.createElement("div", null,
12023
12023
  preview,
12024
12024
  React__default.createElement("div", null, helperText)), hideLabel: !hideUrl, helperTextProps: {
12025
12025
  style: {
@@ -12031,31 +12031,33 @@ styleInject(css_248z$1);var FormFile = React__default.forwardRef(function (_a, r
12031
12031
  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, tabIndex: -1 }, InputProps: {
12032
12032
  endAdornment: (React__default.createElement(InputAdornment, { position: 'end' },
12033
12033
  React__default.createElement("div", { className: 'input-file-wrap' },
12034
- React__default.createElement(Button, { variant: 'text', className: 'input-file-btn form-file-btn', color: error ? 'error' : color, disabled: readOnly || disabled, ref: fileUploadBtnRef },
12035
- React__default.createElement("label", { htmlFor: id },
12036
- React__default.createElement(FormIcon, null, "upload"),
12037
- "\uD30C\uC77C \uC5C5\uB85C\uB4DC")),
12038
- React__default.createElement("input", { type: 'file', accept: accept, id: id, value: fileValue, className: 'input-file', onChange: handleFileChange }),
12034
+ !hideUpload && (React__default.createElement(React__default.Fragment, null,
12035
+ React__default.createElement(Button, { variant: 'text', className: 'input-file-btn form-file-btn', color: error ? 'error' : color, disabled: readOnly || disabled, ref: fileUploadBtnRef },
12036
+ React__default.createElement("label", { htmlFor: id },
12037
+ React__default.createElement(FormIcon, null, "upload"),
12038
+ "\uD30C\uC77C \uC5C5\uB85C\uB4DC")),
12039
+ React__default.createElement("input", { type: 'file', accept: accept, id: id, value: fileValue, className: 'input-file', onChange: handleFileChange }))),
12039
12040
  !hideLink && (React__default.createElement(Button, { variant: 'text', className: 'link-btn form-file-btn', color: error ? 'error' : color, disabled: readOnly || disabled, onClick: handleLinkClick },
12040
12041
  React__default.createElement("label", null,
12041
12042
  React__default.createElement(FormIcon, null, "link"),
12042
12043
  "\uB9C1\uD06C"))),
12043
- notEmpty(value) && (React__default.createElement(Button, { variant: 'text', className: 'remove-btn form-file-btn', color: error ? 'error' : color, disabled: readOnly || disabled, onClick: handleRemoveClick },
12044
+ !hideRemove && notEmpty(value) && (React__default.createElement(Button, { variant: 'text', className: 'remove-btn form-file-btn', color: error ? 'error' : color, disabled: readOnly || disabled, onClick: handleRemoveClick },
12044
12045
  React__default.createElement("label", null,
12045
12046
  React__default.createElement(FormIcon, null, "Close"),
12046
12047
  "\uC0AD\uC81C")))))),
12047
12048
  }, placeholder: '\uD30C\uC77C\uC744 \uC120\uD0DD\uD558\uC138\uC694' }))),
12048
12049
  !!hideUrl && (React__default.createElement("div", { className: 'input-file-wrap' },
12049
- React__default.createElement(Button, { variant: 'outlined', className: 'input-file-btn form-file-btn', color: error ? 'error' : color, ref: fileUploadBtnRef, disabled: disabled },
12050
- React__default.createElement("label", { htmlFor: id },
12051
- React__default.createElement(FormIcon, null, "upload"),
12052
- "\uD30C\uC77C \uC5C5\uB85C\uB4DC")),
12053
- React__default.createElement("input", { type: 'file', accept: accept, id: id, value: fileValue, className: 'input-file', onChange: handleFileChange }),
12050
+ !hideUpload && (React__default.createElement(React__default.Fragment, null,
12051
+ React__default.createElement(Button, { variant: 'outlined', className: 'input-file-btn form-file-btn', color: error ? 'error' : color, ref: fileUploadBtnRef, disabled: disabled },
12052
+ React__default.createElement("label", { htmlFor: id },
12053
+ React__default.createElement(FormIcon, null, "upload"),
12054
+ "\uD30C\uC77C \uC5C5\uB85C\uB4DC")),
12055
+ React__default.createElement("input", { type: 'file', accept: accept, id: id, value: fileValue, className: 'input-file', onChange: handleFileChange }))),
12054
12056
  !hideLink && (React__default.createElement(Button, { variant: 'outlined', className: 'link-btn form-file-btn', color: error ? 'error' : color, onClick: handleLinkClick, disabled: disabled },
12055
12057
  React__default.createElement("label", null,
12056
12058
  React__default.createElement(FormIcon, null, "link"),
12057
12059
  "\uB9C1\uD06C"))),
12058
- notEmpty(value) && (React__default.createElement(Button, { variant: 'outlined', className: 'remove-btn form-file-btn', color: error ? 'error' : color, disabled: disabled, onClick: handleRemoveClick },
12060
+ !hideRemove && notEmpty(value) && (React__default.createElement(Button, { variant: 'outlined', className: 'remove-btn form-file-btn', color: error ? 'error' : color, disabled: disabled, onClick: handleRemoveClick },
12059
12061
  React__default.createElement("label", null,
12060
12062
  React__default.createElement(FormIcon, null, "Close"),
12061
12063
  "\uC0AD\uC81C"))))),