@scenid/react-formulator 0.4.0 → 0.4.2

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/index.cjs.js CHANGED
@@ -29300,7 +29300,7 @@ var FormControlField$1 = function FormControlField(_ref) {
29300
29300
  control: control,
29301
29301
  label: label,
29302
29302
  labelPlacement: finalProps.labelPlacement || 'end'
29303
- }), !isSwitch && !isRepeater && !isRender && control, dirty && hasErrors && /*#__PURE__*/React__default["default"].createElement(_FormHelperText__default["default"], null, errors.map(function (e) {
29303
+ }), !isSwitch && !isRepeater && !isRender && control, dirty && !disabled && hasErrors && /*#__PURE__*/React__default["default"].createElement(_FormHelperText__default["default"], null, errors.map(function (e) {
29304
29304
  return e.message;
29305
29305
  }).join('. ')));
29306
29306
  };
@@ -31896,6 +31896,9 @@ var FormAutocomplete = function FormAutocomplete(_ref) {
31896
31896
  }
31897
31897
  });
31898
31898
  }, [onChange]);
31899
+ React.useEffect(function () {
31900
+ fetch();
31901
+ }, []);
31899
31902
 
31900
31903
  if (readOnly) {
31901
31904
  return /*#__PURE__*/React__default["default"].createElement(FormField$1, {
@@ -31910,7 +31913,8 @@ var FormAutocomplete = function FormAutocomplete(_ref) {
31910
31913
  return /*#__PURE__*/React__default["default"].createElement(_FormControl__default["default"], {
31911
31914
  error: dirty && hasErrors,
31912
31915
  margin: "dense",
31913
- fullWidth: true
31916
+ fullWidth: true,
31917
+ required: required
31914
31918
  }, /*#__PURE__*/React__default["default"].createElement(SelectOrCreate, {
31915
31919
  loading: loading,
31916
31920
  label: label,
@@ -31941,7 +31945,7 @@ var FormAutocomplete = function FormAutocomplete(_ref) {
31941
31945
  },
31942
31946
  onClose: abort,
31943
31947
  onChange: changeValue
31944
- }), dirty && hasErrors && /*#__PURE__*/React__default["default"].createElement(_FormHelperText__default["default"], null, errors.map(function (e) {
31948
+ }), dirty && !disabled && hasErrors && /*#__PURE__*/React__default["default"].createElement(_FormHelperText__default["default"], null, errors.map(function (e) {
31945
31949
  return e.message;
31946
31950
  }).join('. ')));
31947
31951
  };
package/dist/index.esm.js CHANGED
@@ -29231,7 +29231,7 @@ var FormControlField$1 = function FormControlField(_ref) {
29231
29231
  control: control,
29232
29232
  label: label,
29233
29233
  labelPlacement: finalProps.labelPlacement || 'end'
29234
- }), !isSwitch && !isRepeater && !isRender && control, dirty && hasErrors && /*#__PURE__*/React__default.createElement(_FormHelperText, null, errors.map(function (e) {
29234
+ }), !isSwitch && !isRepeater && !isRender && control, dirty && !disabled && hasErrors && /*#__PURE__*/React__default.createElement(_FormHelperText, null, errors.map(function (e) {
29235
29235
  return e.message;
29236
29236
  }).join('. ')));
29237
29237
  };
@@ -31827,6 +31827,9 @@ var FormAutocomplete = function FormAutocomplete(_ref) {
31827
31827
  }
31828
31828
  });
31829
31829
  }, [onChange]);
31830
+ useEffect(function () {
31831
+ fetch();
31832
+ }, []);
31830
31833
 
31831
31834
  if (readOnly) {
31832
31835
  return /*#__PURE__*/React__default.createElement(FormField$1, {
@@ -31841,7 +31844,8 @@ var FormAutocomplete = function FormAutocomplete(_ref) {
31841
31844
  return /*#__PURE__*/React__default.createElement(_FormControl, {
31842
31845
  error: dirty && hasErrors,
31843
31846
  margin: "dense",
31844
- fullWidth: true
31847
+ fullWidth: true,
31848
+ required: required
31845
31849
  }, /*#__PURE__*/React__default.createElement(SelectOrCreate, {
31846
31850
  loading: loading,
31847
31851
  label: label,
@@ -31872,7 +31876,7 @@ var FormAutocomplete = function FormAutocomplete(_ref) {
31872
31876
  },
31873
31877
  onClose: abort,
31874
31878
  onChange: changeValue
31875
- }), dirty && hasErrors && /*#__PURE__*/React__default.createElement(_FormHelperText, null, errors.map(function (e) {
31879
+ }), dirty && !disabled && hasErrors && /*#__PURE__*/React__default.createElement(_FormHelperText, null, errors.map(function (e) {
31876
31880
  return e.message;
31877
31881
  }).join('. ')));
31878
31882
  };
package/firebase.json CHANGED
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "hosting": {
3
+ "site": "react-formulator",
3
4
  "public": "storybook-static",
4
5
  "ignore": [
5
6
  "firebase.json",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scenid/react-formulator",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "main": "dist/index.cjs.js",
5
5
  "module": "dist/index.esm.js",
6
6
  "repository": "https://dennykoch@bitbucket.org/scenid/react-formulator.git",
@@ -1,4 +1,4 @@
1
- import React, { useCallback } from 'react'
1
+ import React, { useEffect, useCallback } from 'react'
2
2
  import PropTypes from 'prop-types'
3
3
 
4
4
  import { Box, Typography, FormControl, FormHelperText } from '@material-ui/core'
@@ -29,6 +29,8 @@ const FormAutocomplete = ({
29
29
 
30
30
  const changeValue = useCallback(newValue => { onChange({ target: { name, value: newValue?.entry || '' } }) }, [onChange])
31
31
 
32
+ useEffect(() => { fetch() }, [])
33
+
32
34
  if (readOnly) {
33
35
  return (
34
36
  <FormField
@@ -46,6 +48,7 @@ const FormAutocomplete = ({
46
48
  error={dirty && hasErrors}
47
49
  margin="dense"
48
50
  fullWidth
51
+ required={required}
49
52
  >
50
53
  <SelectOrCreate
51
54
  loading={loading}
@@ -86,7 +89,7 @@ const FormAutocomplete = ({
86
89
  onChange={changeValue}
87
90
  />
88
91
  {
89
- (dirty && hasErrors)
92
+ (dirty && !disabled && hasErrors)
90
93
  && (
91
94
  <FormHelperText>
92
95
  {errors.map(e => e.message).join('. ')}
@@ -124,7 +124,7 @@ const FormControlField = ({
124
124
  && control
125
125
  }
126
126
  {
127
- (dirty && hasErrors)
127
+ (dirty && !disabled && hasErrors)
128
128
  && (
129
129
  <FormHelperText>
130
130
  {errors.map(e => e.message).join('. ')}