@pdg/react-form 1.0.32 → 1.0.34

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,6 +1,6 @@
1
1
  import { CommonSxProps, FormValueItemCommands, FormValueItemProps } from '../../@types';
2
2
  import { ReactNode } from 'react';
3
- export interface FormFileProps extends CommonSxProps, Omit<FormValueItemProps, 'readOnly'> {
3
+ export interface FormFileProps extends CommonSxProps, FormValueItemProps {
4
4
  required?: boolean;
5
5
  accept?: string;
6
6
  hideUrl?: boolean;
package/dist/index.esm.js CHANGED
@@ -2558,7 +2558,7 @@ styleInject(css_248z$h);var FormTag = React__default.forwardRef(function (_a, re
2558
2558
  onBlur(e);
2559
2559
  }, [appendTag, inputValue, onBlur]);
2560
2560
  var handleRenderTags = useCallback(function (tags) {
2561
- return tags.map(function (tag) { return (React__default.createElement(Chip, { className: 'MuiAutocomplete-tag', key: tag, label: tag, size: 'small', disabled: disabled, onDelete: readOnly || disabled ? undefined : function () { return removeTag(tag); } })); });
2561
+ return tags.map(function (tag) { return (React__default.createElement(Chip, { className: 'MuiAutocomplete-tag', key: tag, label: tag, size: 'small', disabled: readOnly || disabled, onDelete: readOnly || disabled ? undefined : function () { return removeTag(tag); } })); });
2562
2562
  }, [disabled, readOnly, removeTag]);
2563
2563
  // Render ----------------------------------------------------------------------------------------------------------
2564
2564
  return (React__default.createElement(FormContextProvider, { value: __assign$6({ fullWidth: formFullWidth, onAddValueItem: handleAddValueItem,
@@ -4110,6 +4110,7 @@ NumberFormatCustom.displayName = 'NumberFormatCustom';var FormNumberDefaultProps
4110
4110
  var className = _a.className, allowLeadingZeros = _a.allowLeadingZeros, allowNegative = _a.allowNegative, thousandSeparator = _a.thousandSeparator, allowDecimal = _a.allowDecimal, decimalScale = _a.decimalScale, prefix = _a.prefix, suffix = _a.suffix, readOnly = _a.readOnly, tabIndex = _a.tabIndex, initMuiInputProps = _a.InputProps, props = __rest$3(_a, ["className", "allowLeadingZeros", "allowNegative", "thousandSeparator", "allowDecimal", "decimalScale", "prefix", "suffix", "readOnly", "tabIndex", "InputProps"]);
4111
4111
  var muiInputProps = useMemo(function () {
4112
4112
  var inputProps = {
4113
+ className: readOnly ? 'Mui-disabled' : undefined,
4113
4114
  allowLeadingZeros: allowLeadingZeros,
4114
4115
  allowNegative: allowNegative,
4115
4116
  thousandSeparator: thousandSeparator,
@@ -4140,7 +4141,7 @@ NumberFormatCustom.displayName = 'NumberFormatCustom';var FormNumberDefaultProps
4140
4141
  thousandSeparator,
4141
4142
  ]);
4142
4143
  // Render ----------------------------------------------------------------------------------------------------------
4143
- return React__default.createElement(FormText, __assign$6({ ref: ref, className: classNames$1(className, 'FormNumber'), InputProps: muiInputProps }, props));
4144
+ return (React__default.createElement(FormText, __assign$6({ ref: ref, className: classNames$1(className, 'FormNumber'), InputProps: muiInputProps, readOnly: readOnly }, props)));
4144
4145
  });
4145
4146
  FormNumber.displayName = 'FormNumber';
4146
4147
  FormNumber.defaultProps = FormNumberDefaultProps;var FormSearchDefaultProps = __assign$6({}, FormTextDefaultProps);var css_248z$f = ".FormSearch input[type=search]::-webkit-search-decoration,\n.FormSearch input[type=search]::-webkit-search-cancel-button,\n.FormSearch input[type=search]::-webkit-search-results-button,\n.FormSearch input[type=search]::-webkit-search-results-decoration {\n -webkit-appearance: none;\n}";
@@ -7911,7 +7912,7 @@ FormTextEditor.defaultProps = FormTextEditorDefaultProps;var FormAutocompleteDef
7911
7912
  }
7912
7913
  }, renderTags: function (value, getTagProps) {
7913
7914
  return value.map(function (option, index) { return (React__default.createElement(Chip, __assign$6({ size: 'small', label: onRenderTag ? onRenderTag(option) : option.label }, getTagProps({ index: index })))); });
7914
- }, renderInput: function (params) { return (React__default.createElement(FormTextField, __assign$6({}, params, { ref: textFieldRef, name: name, variant: variant, size: size, color: color, labelIcon: labelIcon, label: label, labelShrink: labelShrink, required: required, focused: focused, error: error, helperText: helperText, placeholder: placeholder, noFormValueItem: true, InputProps: __assign$6(__assign$6({}, params.InputProps), { endAdornment: (React__default.createElement(React__default.Fragment, null,
7915
+ }, renderInput: function (params) { return (React__default.createElement(FormTextField, __assign$6({}, params, { ref: textFieldRef, name: name, variant: variant, size: size, color: color, labelIcon: labelIcon, label: label, labelShrink: labelShrink, required: required, focused: focused, error: error, readOnly: readOnly, helperText: helperText, placeholder: placeholder, noFormValueItem: true, InputProps: __assign$6(__assign$6({}, params.InputProps), { endAdornment: (React__default.createElement(React__default.Fragment, null,
7915
7916
  loading || isOnGetItemLoading ? React__default.createElement(CircularProgress$1, { color: 'inherit', size: 20 }) : null,
7916
7917
  params.InputProps.endAdornment)) }), inputProps: readOnly || disabled ? __assign$6(__assign$6({}, params.inputProps), { tabIndex: -1 }) : params.inputProps }))); } }));
7917
7918
  });
@@ -10501,6 +10502,7 @@ styleInject(css_248z$5);var PrivateDatePicker = React__default.forwardRef(functi
10501
10502
  var inputProps = __assign$6(__assign$6({}, initInputProps), { readOnly: readOnly });
10502
10503
  if (readOnly) {
10503
10504
  inputProps.tabIndex = -1;
10505
+ inputProps.className = classNames$1(inputProps.className, 'Mui-disabled');
10504
10506
  }
10505
10507
  var muiInputProps = __assign$6(__assign$6({}, initMuiInputProps), { endAdornment: undefined });
10506
10508
  if (startAdornment || icon || muiInputProps.startAdornment) {
@@ -11070,6 +11072,7 @@ styleInject(css_248z$2);var InputDatePicker = function (_a) {
11070
11072
  var inputProps = __assign$6({}, initInputProps);
11071
11073
  if (readOnly) {
11072
11074
  inputProps.tabIndex = -1;
11075
+ inputProps.className = classNames$1(inputProps.className, 'Mui-disabled');
11073
11076
  }
11074
11077
  return (React__default.createElement(TextField, __assign$6({}, params, { style: __assign$6(__assign$6({}, inputStyle), style), variant: variant, size: size, color: color, focused: focused, fullWidth: fullWidth, required: required, name: id, label: label, error: error || inputError, inputRef: function (ref) {
11075
11078
  if (inputInputRef) {
@@ -11672,7 +11675,7 @@ styleInject(css_248z$1);var FormFile = React__default.forwardRef(function (_a, r
11672
11675
  //----------------------------------------------------------------------------------------------------------------
11673
11676
  accept = _a.accept, hideUrl = _a.hideUrl, hideLink = _a.hideLink, maxFileSize = _a.maxFileSize, preview = _a.preview, hidden = _a.hidden, onFile = _a.onFile, onLink = _a.onLink,
11674
11677
  //----------------------------------------------------------------------------------------------------------------
11675
- name = _a.name, labelIcon = _a.labelIcon, initLabel = _a.label, required = _a.required, initDisabled = _a.disabled, initError = _a.error, initHelperText = _a.helperText, initValue = _a.value, exceptValue = _a.exceptValue, onChange = _a.onChange, onValidate = _a.onValidate,
11678
+ 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, exceptValue = _a.exceptValue, onChange = _a.onChange, onValidate = _a.onValidate,
11676
11679
  //----------------------------------------------------------------------------------------------------------------
11677
11680
  className = _a.className;
11678
11681
  var id = useId();
@@ -11907,16 +11910,16 @@ styleInject(css_248z$1);var FormFile = React__default.forwardRef(function (_a, r
11907
11910
  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: {
11908
11911
  endAdornment: (React__default.createElement(InputAdornment, { position: 'end' },
11909
11912
  React__default.createElement("div", { className: 'input-file-wrap' },
11910
- React__default.createElement(Button, { variant: 'text', className: 'input-file-btn form-file-btn', color: error ? 'error' : color, disabled: disabled, ref: fileUploadBtnRef },
11913
+ React__default.createElement(Button, { variant: 'text', className: 'input-file-btn form-file-btn', color: error ? 'error' : color, disabled: readOnly || disabled, ref: fileUploadBtnRef },
11911
11914
  React__default.createElement("label", { htmlFor: id },
11912
11915
  React__default.createElement(FormIcon, null, "upload"),
11913
11916
  "\uD30C\uC77C \uC5C5\uB85C\uB4DC")),
11914
11917
  React__default.createElement("input", { type: 'file', accept: accept, id: id, value: fileValue, className: 'input-file', onChange: handleFileChange }),
11915
- !hideLink && (React__default.createElement(Button, { variant: 'text', className: 'link-btn form-file-btn', color: error ? 'error' : color, disabled: disabled, onClick: handleLinkClick },
11918
+ !hideLink && (React__default.createElement(Button, { variant: 'text', className: 'link-btn form-file-btn', color: error ? 'error' : color, disabled: readOnly || disabled, onClick: handleLinkClick },
11916
11919
  React__default.createElement("label", null,
11917
11920
  React__default.createElement(FormIcon, null, "link"),
11918
11921
  "\uB9C1\uD06C"))),
11919
- notEmpty(value) && (React__default.createElement(Button, { variant: 'text', className: 'remove-btn form-file-btn', color: error ? 'error' : color, disabled: disabled, onClick: handleRemoveClick },
11922
+ notEmpty(value) && (React__default.createElement(Button, { variant: 'text', className: 'remove-btn form-file-btn', color: error ? 'error' : color, disabled: readOnly || disabled, onClick: handleRemoveClick },
11920
11923
  React__default.createElement("label", null,
11921
11924
  React__default.createElement(FormIcon, null, "Close"),
11922
11925
  "\uC0AD\uC81C")))))),