react-schema-form 0.9.6 → 1.0.1
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.js +75 -76
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +65 -66
- package/dist/index.modern.js.map +1 -1
- package/package.json +43 -33
- package/CHANGELOG.md +0 -314
package/dist/index.modern.js
CHANGED
|
@@ -8,41 +8,42 @@ import isUndefined from 'lodash/isUndefined';
|
|
|
8
8
|
import ObjectPath from 'objectpath';
|
|
9
9
|
import tv4 from 'tv4';
|
|
10
10
|
import notevil from 'notevil';
|
|
11
|
-
import TextField from '@material
|
|
12
|
-
import FormLabel from '@material
|
|
13
|
-
import FormHelperText from '@material
|
|
11
|
+
import TextField from '@mui/material/TextField';
|
|
12
|
+
import FormLabel from '@mui/material/FormLabel';
|
|
13
|
+
import FormHelperText from '@mui/material/FormHelperText';
|
|
14
14
|
import ReactMde from 'react-mde';
|
|
15
15
|
import { Converter } from 'showdown';
|
|
16
16
|
import 'react-mde/lib/styles/css/react-mde-all.css';
|
|
17
|
-
import MenuItem from '@material
|
|
18
|
-
import MuiSelect from '@material
|
|
19
|
-
import InputLabel from '@material
|
|
20
|
-
import FormControl from '@material
|
|
21
|
-
import
|
|
22
|
-
import Chip from '@material
|
|
23
|
-
import FormControlLabel from '@material
|
|
24
|
-
import RadioGroup from '@material
|
|
25
|
-
import Radio from '@material
|
|
26
|
-
import Checkbox$1 from '@material
|
|
27
|
-
import FormGroup from '@material
|
|
28
|
-
import Typography from '@material
|
|
29
|
-
import Button from '@material
|
|
30
|
-
import Card from '@material
|
|
31
|
-
import IconButton from '@material
|
|
32
|
-
import DeleteIcon from '@
|
|
17
|
+
import MenuItem from '@mui/material/MenuItem';
|
|
18
|
+
import MuiSelect from '@mui/material/Select';
|
|
19
|
+
import InputLabel from '@mui/material/InputLabel';
|
|
20
|
+
import FormControl from '@mui/material/FormControl';
|
|
21
|
+
import withStyles from '@mui/styles/withStyles';
|
|
22
|
+
import Chip from '@mui/material/Chip';
|
|
23
|
+
import FormControlLabel from '@mui/material/FormControlLabel';
|
|
24
|
+
import RadioGroup from '@mui/material/RadioGroup';
|
|
25
|
+
import Radio from '@mui/material/Radio';
|
|
26
|
+
import Checkbox$1 from '@mui/material/Checkbox';
|
|
27
|
+
import FormGroup from '@mui/material/FormGroup';
|
|
28
|
+
import Typography from '@mui/material/Typography';
|
|
29
|
+
import Button from '@mui/material/Button';
|
|
30
|
+
import Card from '@mui/material/Card';
|
|
31
|
+
import IconButton from '@mui/material/IconButton';
|
|
32
|
+
import DeleteIcon from '@mui/icons-material/Close';
|
|
33
33
|
import classNames from 'classnames';
|
|
34
|
-
import { FormGroup as FormGroup$1, FormControlLabel as FormControlLabel$1, Checkbox as Checkbox$2, Button as Button$1, Card as Card$1 } from '@material
|
|
34
|
+
import { FormGroup as FormGroup$1, FormControlLabel as FormControlLabel$1, Checkbox as Checkbox$2, Button as Button$1, Card as Card$1 } from '@mui/material';
|
|
35
35
|
import CheckboxTree from 'react-checkbox-tree';
|
|
36
36
|
import 'react-checkbox-tree/lib/react-checkbox-tree.css';
|
|
37
|
-
import CheckBoxIcon from '@
|
|
38
|
-
import CheckBoxOutlineBlankIcon from '@
|
|
39
|
-
import IndeterminateCheckBoxIcon from '@
|
|
40
|
-
import ChevronRightIcon from '@
|
|
41
|
-
import KeyboardArrowDownIcon from '@
|
|
42
|
-
import AddBoxIcon from '@
|
|
43
|
-
import FolderIcon from '@
|
|
44
|
-
import FolderOpenIcon from '@
|
|
45
|
-
import InsertDriveFileIcon from '@
|
|
37
|
+
import CheckBoxIcon from '@mui/icons-material/CheckBox';
|
|
38
|
+
import CheckBoxOutlineBlankIcon from '@mui/icons-material/CheckBoxOutlineBlank';
|
|
39
|
+
import IndeterminateCheckBoxIcon from '@mui/icons-material/IndeterminateCheckBox';
|
|
40
|
+
import ChevronRightIcon from '@mui/icons-material/ChevronRight';
|
|
41
|
+
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
|
|
42
|
+
import AddBoxIcon from '@mui/icons-material/AddBox';
|
|
43
|
+
import FolderIcon from '@mui/icons-material/Folder';
|
|
44
|
+
import FolderOpenIcon from '@mui/icons-material/FolderOpen';
|
|
45
|
+
import InsertDriveFileIcon from '@mui/icons-material/InsertDriveFile';
|
|
46
|
+
import Cookies from 'universal-cookie';
|
|
46
47
|
|
|
47
48
|
function _extends() {
|
|
48
49
|
_extends = Object.assign || function (target) {
|
|
@@ -65,7 +66,17 @@ function _extends() {
|
|
|
65
66
|
function _inheritsLoose(subClass, superClass) {
|
|
66
67
|
subClass.prototype = Object.create(superClass.prototype);
|
|
67
68
|
subClass.prototype.constructor = subClass;
|
|
68
|
-
|
|
69
|
+
|
|
70
|
+
_setPrototypeOf(subClass, superClass);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function _setPrototypeOf(o, p) {
|
|
74
|
+
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
75
|
+
o.__proto__ = p;
|
|
76
|
+
return o;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
return _setPrototypeOf(o, p);
|
|
69
80
|
}
|
|
70
81
|
|
|
71
82
|
function _assertThisInitialized(self) {
|
|
@@ -829,7 +840,7 @@ var ComposedComponent = (function (ComposedComponent, defaultProps) {
|
|
|
829
840
|
localization = _this$props.localization;
|
|
830
841
|
var getLocalizedString = localization && localization.getLocalizedString;
|
|
831
842
|
var value = null;
|
|
832
|
-
var type = form.
|
|
843
|
+
var type = form.schema ? form.schema.type : form.type;
|
|
833
844
|
|
|
834
845
|
switch (type) {
|
|
835
846
|
case 'integer':
|
|
@@ -843,35 +854,6 @@ var ComposedComponent = (function (ComposedComponent, defaultProps) {
|
|
|
843
854
|
value = e.target.checked;
|
|
844
855
|
break;
|
|
845
856
|
|
|
846
|
-
case 'checkbox':
|
|
847
|
-
value = e.target.checked;
|
|
848
|
-
break;
|
|
849
|
-
|
|
850
|
-
case 'markdown':
|
|
851
|
-
if (v && v.length > 0) {
|
|
852
|
-
value = v;
|
|
853
|
-
} else {
|
|
854
|
-
value = '';
|
|
855
|
-
}
|
|
856
|
-
|
|
857
|
-
break;
|
|
858
|
-
|
|
859
|
-
case 'taxonomy':
|
|
860
|
-
if (v && v.length) {
|
|
861
|
-
value = v;
|
|
862
|
-
} else {
|
|
863
|
-
value = [];
|
|
864
|
-
}
|
|
865
|
-
|
|
866
|
-
break;
|
|
867
|
-
|
|
868
|
-
case 'tBoolean':
|
|
869
|
-
if (e.target.value !== 'yes' || e.target.value !== 'no') {
|
|
870
|
-
value = v;
|
|
871
|
-
}
|
|
872
|
-
|
|
873
|
-
break;
|
|
874
|
-
|
|
875
857
|
case 'array':
|
|
876
858
|
value = e;
|
|
877
859
|
break;
|
|
@@ -1042,7 +1024,11 @@ var Markdown = function Markdown(props) {
|
|
|
1042
1024
|
setText = _useState2[1];
|
|
1043
1025
|
|
|
1044
1026
|
useEffect(function () {
|
|
1045
|
-
onChangeValidate(
|
|
1027
|
+
onChangeValidate({
|
|
1028
|
+
target: {
|
|
1029
|
+
value: text
|
|
1030
|
+
}
|
|
1031
|
+
});
|
|
1046
1032
|
}, [text]);
|
|
1047
1033
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormLabel, {
|
|
1048
1034
|
required: form.required
|
|
@@ -1161,7 +1147,8 @@ function Select(props) {
|
|
|
1161
1147
|
}
|
|
1162
1148
|
|
|
1163
1149
|
var _useState = useState(utils.getValueFromModel(model, form.key) || defaultValue),
|
|
1164
|
-
currentValue = _useState[0]
|
|
1150
|
+
currentValue = _useState[0],
|
|
1151
|
+
setCurrentValue = _useState[1];
|
|
1165
1152
|
|
|
1166
1153
|
useEffect(function () {
|
|
1167
1154
|
setDefault(key, model, form, currentValue);
|
|
@@ -1169,6 +1156,7 @@ function Select(props) {
|
|
|
1169
1156
|
|
|
1170
1157
|
var onSelected = function onSelected(event) {
|
|
1171
1158
|
var selectedValue = event.target.value;
|
|
1159
|
+
setCurrentValue(selectedValue);
|
|
1172
1160
|
|
|
1173
1161
|
if (isObject) {
|
|
1174
1162
|
var item = values.find(function (each) {
|
|
@@ -1191,7 +1179,7 @@ function Select(props) {
|
|
|
1191
1179
|
|
|
1192
1180
|
var menuItems = [];
|
|
1193
1181
|
|
|
1194
|
-
if (
|
|
1182
|
+
if (isObject) {
|
|
1195
1183
|
menuItems = form.schema["enum"].map(function (item, idx) {
|
|
1196
1184
|
return (
|
|
1197
1185
|
/*#__PURE__*/
|
|
@@ -1729,7 +1717,8 @@ var ArrayComponent = /*#__PURE__*/function (_Component) {
|
|
|
1729
1717
|
className: classes.elementsContainer
|
|
1730
1718
|
}, forms), /*#__PURE__*/React.createElement(IconButton, {
|
|
1731
1719
|
onClick: _this2.onDelete(i),
|
|
1732
|
-
className: classes.deleteItemButton
|
|
1720
|
+
className: classes.deleteItemButton,
|
|
1721
|
+
size: "large"
|
|
1733
1722
|
}, /*#__PURE__*/React.createElement(DeleteIcon, {
|
|
1734
1723
|
fontSize: "small"
|
|
1735
1724
|
}))));
|
|
@@ -1920,11 +1909,21 @@ function Taxonomy(props) {
|
|
|
1920
1909
|
setTerms = _useState3[1];
|
|
1921
1910
|
|
|
1922
1911
|
useEffect(function () {
|
|
1923
|
-
onChangeValidate(
|
|
1912
|
+
onChangeValidate(taxonomies);
|
|
1924
1913
|
}, [taxonomies]);
|
|
1925
1914
|
|
|
1926
1915
|
var fetchCateogry = function fetchCateogry(url) {
|
|
1927
|
-
|
|
1916
|
+
var cookies = new Cookies();
|
|
1917
|
+
var headers = {
|
|
1918
|
+
'Content-Type': 'application/json'
|
|
1919
|
+
};
|
|
1920
|
+
if (cookies.get('csrf')) Object.assign(headers, {
|
|
1921
|
+
'X-CSRF-TOKEN': cookies.get('csrf')
|
|
1922
|
+
});
|
|
1923
|
+
fetch(url, {
|
|
1924
|
+
headers: headers,
|
|
1925
|
+
credentials: 'include'
|
|
1926
|
+
}).then(function (res) {
|
|
1928
1927
|
if (res.ok) {
|
|
1929
1928
|
return res.json();
|
|
1930
1929
|
}
|