@pdg/react-form 1.0.39 → 1.0.41

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.
@@ -33,6 +33,7 @@ export interface FormAutocompleteProps extends CommonSxProps, Omit<FormValueItem
33
33
  onRenderTag?: (item: FormAutocompleteItem) => ReactNode;
34
34
  onValue?: (value: FormAutocompleteValue) => FormAutocompleteValue;
35
35
  onAddItem?: (item: FormAutocompleteItem) => boolean | Promise<boolean>;
36
+ getOptionDisabled?: (item: FormAutocompleteItem) => boolean;
36
37
  }
37
38
  export declare const FormAutocompleteDefaultProps: Pick<FormAutocompleteProps, 'formValueSeparator' | 'noOptionsText'>;
38
39
  export interface FormAutocompleteCommands extends FormValueItemBaseCommands, FormArrayValueItemCommands, FormItemsValueItemCommands<FormAutocompleteItem>, FormMultipleValueItemCommands, FormLoadingValueItemCommands {
package/dist/index.esm.js CHANGED
@@ -7566,7 +7566,7 @@ FormTextEditor.defaultProps = FormTextEditorDefaultProps;var FormAutocompleteDef
7566
7566
  // ID --------------------------------------------------------------------------------------------------------------
7567
7567
  var initVariant = _a.variant, initSize = _a.size, initColor = _a.color, initFocused = _a.focused, initLabelShrink = _a.labelShrink, initFullWidth = _a.fullWidth,
7568
7568
  //----------------------------------------------------------------------------------------------------------------
7569
- name = _a.name, labelIcon = _a.labelIcon, label = _a.label, initLoading = _a.loading, initItems = _a.items, initValue = _a.value, initData = _a.data, initError = _a.error, initHelperText = _a.helperText, initDisabled = _a.disabled, readOnly = _a.readOnly, required = _a.required, exceptValue = _a.exceptValue, width = _a.width, placeholder = _a.placeholder, multiple = _a.multiple, formValueSeparator = _a.formValueSeparator, formValueSort = _a.formValueSort, disablePortal = _a.disablePortal, noOptionsText = _a.noOptionsText, loadingText = _a.loadingText, limitTags = _a.limitTags, openOnFocus = _a.openOnFocus, disableClearable = _a.disableClearable, async = _a.async, hidden = _a.hidden, onLoadItems = _a.onLoadItems, onAsyncLoadValueItem = _a.onAsyncLoadValueItem, onRenderItem = _a.onRenderItem, onRenderTag = _a.onRenderTag, onAddItem = _a.onAddItem,
7569
+ name = _a.name, labelIcon = _a.labelIcon, label = _a.label, initLoading = _a.loading, initItems = _a.items, initValue = _a.value, initData = _a.data, initError = _a.error, initHelperText = _a.helperText, initDisabled = _a.disabled, readOnly = _a.readOnly, required = _a.required, exceptValue = _a.exceptValue, width = _a.width, placeholder = _a.placeholder, multiple = _a.multiple, formValueSeparator = _a.formValueSeparator, formValueSort = _a.formValueSort, disablePortal = _a.disablePortal, noOptionsText = _a.noOptionsText, loadingText = _a.loadingText, limitTags = _a.limitTags, openOnFocus = _a.openOnFocus, disableClearable = _a.disableClearable, async = _a.async, hidden = _a.hidden, onLoadItems = _a.onLoadItems, onAsyncLoadValueItem = _a.onAsyncLoadValueItem, onRenderItem = _a.onRenderItem, onRenderTag = _a.onRenderTag, onAddItem = _a.onAddItem, getOptionDisabled = _a.getOptionDisabled,
7570
7570
  //----------------------------------------------------------------------------------------------------------------
7571
7571
  onChange = _a.onChange, onValue = _a.onValue, onValidate = _a.onValidate,
7572
7572
  //----------------------------------------------------------------------------------------------------------------
@@ -7997,7 +7997,7 @@ FormTextEditor.defaultProps = FormTextEditorDefaultProps;var FormAutocompleteDef
7997
7997
  }
7998
7998
  }, [multiple, getFinalValue, value, setValue, onValueChangeByUser, name, onRequestSearchSubmit, onAddItem]);
7999
7999
  // Render ----------------------------------------------------------------------------------------------------------
8000
- return (React__default.createElement(Autocomplete, { options: items || [], className: classNames$1(className, 'FormValueItem', 'FormAutocomplete'), sx: sx, multiple: multiple, fullWidth: !width && fullWidth, openOnFocus: openOnFocus, disableClearable: disableClearable, disablePortal: disablePortal, noOptionsText: noOptionsText, value: componentValue, style: style, isOptionEqualToValue: function (option, value) { return option.value === value.value; }, disabled: disabled, readOnly: readOnly, loading: loading || isOnGetItemLoading, loadingText: loadingText, limitTags: limitTags, onChange: function (e, value, reason, details) { return handleChange(value, reason, details); }, renderOption: function (props, option) { return (React__default.createElement("li", __assign$6({}, props, { key: option.value }), onRenderItem ? onRenderItem(option) : option.label)); }, onInputChange: function (event, newInputValue, reason) {
8000
+ return (React__default.createElement(Autocomplete, { options: items || [], className: classNames$1(className, 'FormValueItem', 'FormAutocomplete'), sx: sx, multiple: multiple, fullWidth: !width && fullWidth, openOnFocus: openOnFocus, disableClearable: disableClearable, disablePortal: disablePortal, noOptionsText: noOptionsText, value: componentValue, style: style, isOptionEqualToValue: function (option, value) { return option.value === value.value; }, getOptionDisabled: getOptionDisabled, disabled: disabled, readOnly: readOnly, loading: loading || isOnGetItemLoading, loadingText: loadingText, limitTags: limitTags, onChange: function (e, value, reason, details) { return handleChange(value, reason, details); }, renderOption: function (props, option) { return (React__default.createElement("li", __assign$6({}, props, { key: option.value }), onRenderItem ? onRenderItem(option) : option.label)); }, onInputChange: function (event, newInputValue, reason) {
8001
8001
  if (reason === 'input') {
8002
8002
  setInputValue(newInputValue);
8003
8003
  }
@@ -11780,7 +11780,7 @@ 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,
@@ -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,26 +12031,28 @@ 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
- !hideUpload && (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"),