@maif/react-forms 1.0.5 → 1.0.9
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/.github/workflows/release.yml +1 -1
- package/README.md +1 -0
- package/dist/react-form.js +1 -1
- package/dist/react-form.js.LICENSE.txt +8 -0
- package/lib/form.d.ts +2 -11
- package/lib/form.js +138 -110
- package/lib/format.d.ts +1 -0
- package/lib/format.js +2 -1
- package/lib/inputs/ArrayInput.js +1 -1
- package/lib/inputs/BooleanInput.js +8 -11
- package/lib/inputs/CodeInput.d.ts +4 -1
- package/lib/inputs/CodeInput.js +31 -5
- package/lib/inputs/Collapse.d.ts +0 -1
- package/lib/inputs/Collapse.js +16 -55
- package/lib/inputs/SelectInput.js +97 -28
- package/lib/style.d.ts +196 -0
- package/lib/style.js +150 -0
- package/lib/styleContext.d.ts +1 -0
- package/lib/styleContext.js +29 -0
- package/lib/utils.d.ts +1 -0
- package/lib/utils.js +31 -0
- package/package.json +3 -2
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
export function CodeInput({ onChange, value, className, readOnly }: {
|
|
1
|
+
export function CodeInput({ onChange, value, className, readOnly, theme, mode, ...props }: {
|
|
2
|
+
[x: string]: any;
|
|
2
3
|
onChange: any;
|
|
3
4
|
value: any;
|
|
4
5
|
className?: string | undefined;
|
|
5
6
|
readOnly: any;
|
|
7
|
+
theme?: string | undefined;
|
|
8
|
+
mode?: string | undefined;
|
|
6
9
|
}): JSX.Element;
|
package/lib/inputs/CodeInput.js
CHANGED
|
@@ -9,45 +9,71 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
9
|
|
|
10
10
|
var _reactAce = _interopRequireDefault(require("react-ace"));
|
|
11
11
|
|
|
12
|
+
var _extBeautify = _interopRequireDefault(require("ace-builds/src-noconflict/ext-beautify"));
|
|
13
|
+
|
|
12
14
|
require("ace-builds/src-noconflict/mode-html");
|
|
13
15
|
|
|
14
16
|
require("ace-builds/src-noconflict/mode-json");
|
|
15
17
|
|
|
16
18
|
require("ace-builds/src-noconflict/mode-javascript");
|
|
17
19
|
|
|
20
|
+
require("ace-builds/src-noconflict/mode-css");
|
|
21
|
+
|
|
18
22
|
require("ace-builds/src-noconflict/mode-markdown");
|
|
19
23
|
|
|
20
24
|
require("ace-builds/src-noconflict/theme-monokai");
|
|
21
25
|
|
|
26
|
+
require("ace-builds/src-noconflict/theme-tomorrow");
|
|
27
|
+
|
|
22
28
|
require("ace-builds/src-noconflict/ext-searchbox");
|
|
23
29
|
|
|
24
30
|
require("ace-builds/src-noconflict/ext-language_tools");
|
|
25
31
|
|
|
32
|
+
var _excluded = ["onChange", "value", "className", "readOnly", "theme", "mode"];
|
|
33
|
+
|
|
26
34
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
27
35
|
|
|
36
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
37
|
+
|
|
38
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
39
|
+
|
|
28
40
|
var CodeInput = function CodeInput(_ref) {
|
|
29
41
|
var onChange = _ref.onChange,
|
|
30
42
|
value = _ref.value,
|
|
31
43
|
_ref$className = _ref.className,
|
|
32
44
|
className = _ref$className === void 0 ? '' : _ref$className,
|
|
33
|
-
readOnly = _ref.readOnly
|
|
45
|
+
readOnly = _ref.readOnly,
|
|
46
|
+
_ref$theme = _ref.theme,
|
|
47
|
+
theme = _ref$theme === void 0 ? 'monokai' : _ref$theme,
|
|
48
|
+
_ref$mode = _ref.mode,
|
|
49
|
+
mode = _ref$mode === void 0 ? 'javascript' : _ref$mode,
|
|
50
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
51
|
+
|
|
34
52
|
return /*#__PURE__*/_react["default"].createElement(_reactAce["default"], {
|
|
53
|
+
commands: _extBeautify["default"].commands,
|
|
35
54
|
className: className,
|
|
36
55
|
readOnly: readOnly,
|
|
37
56
|
style: {
|
|
38
57
|
zIndex: 0,
|
|
39
58
|
isolation: 'isolate'
|
|
40
59
|
},
|
|
41
|
-
mode:
|
|
42
|
-
theme:
|
|
60
|
+
mode: mode,
|
|
61
|
+
theme: theme,
|
|
43
62
|
onChange: onChange,
|
|
44
63
|
value: value,
|
|
45
64
|
name: "scriptParam",
|
|
46
65
|
editorProps: {
|
|
47
66
|
$blockScrolling: true
|
|
48
67
|
},
|
|
49
|
-
|
|
50
|
-
|
|
68
|
+
onLoad: function onLoad(editorInstance) {
|
|
69
|
+
editorInstance.container.style.resize = "both"; // mouseup = css resize end
|
|
70
|
+
|
|
71
|
+
document.addEventListener("mouseup", function (e) {
|
|
72
|
+
return editorInstance.resize();
|
|
73
|
+
});
|
|
74
|
+
},
|
|
75
|
+
height: props.height,
|
|
76
|
+
width: props.width,
|
|
51
77
|
showGutter: true,
|
|
52
78
|
tabSize: 2,
|
|
53
79
|
highlightActiveLine: true,
|
package/lib/inputs/Collapse.d.ts
CHANGED
package/lib/inputs/Collapse.js
CHANGED
|
@@ -5,7 +5,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.
|
|
8
|
+
exports.Collapse = void 0;
|
|
9
9
|
|
|
10
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
11
|
|
|
@@ -13,12 +13,16 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
13
13
|
|
|
14
14
|
var _reactFeather = require("react-feather");
|
|
15
15
|
|
|
16
|
+
var _styleContext = require("../styleContext");
|
|
17
|
+
|
|
16
18
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
19
|
|
|
18
20
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
21
|
|
|
20
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
21
23
|
|
|
24
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
25
|
+
|
|
22
26
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
23
27
|
|
|
24
28
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -37,68 +41,25 @@ var Collapse = function Collapse(props) {
|
|
|
37
41
|
collapsed = _useState2[0],
|
|
38
42
|
setCollapsed = _useState2[1];
|
|
39
43
|
|
|
44
|
+
var classes = (0, _styleContext.useCustomStyle)();
|
|
45
|
+
|
|
40
46
|
var toggle = function toggle(e) {
|
|
41
47
|
if (e && e.preventDefault) e.preventDefault();
|
|
42
48
|
setCollapsed(!collapsed);
|
|
43
49
|
};
|
|
44
50
|
|
|
45
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
46
|
-
className: (0, _classnames["default"])(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
className: "form-group row"
|
|
51
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
52
|
-
className: "col-sm-10",
|
|
53
|
-
onClick: toggle,
|
|
54
|
-
style: {
|
|
55
|
-
cursor: 'pointer'
|
|
56
|
-
}
|
|
51
|
+
return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("hr", {
|
|
52
|
+
className: (0, _classnames["default"])(_defineProperty({}, classes.collapse_error, props.errored))
|
|
53
|
+
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
54
|
+
className: "".concat(classes.cursor_pointer, " ").concat(classes.flex, " ").concat(classes.justifyContentBetween),
|
|
55
|
+
onClick: toggle
|
|
57
56
|
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
58
|
-
className: "
|
|
59
|
-
style: {
|
|
60
|
-
fontWeight: 'bold',
|
|
61
|
-
marginTop: 7
|
|
62
|
-
}
|
|
57
|
+
className: (0, _classnames["default"])(classes.collapse_label, _defineProperty({}, classes.collapse_error, props.errored))
|
|
63
58
|
}, props.label), /*#__PURE__*/_react["default"].createElement("button", {
|
|
64
59
|
type: "button",
|
|
65
|
-
className: "btn
|
|
66
|
-
style: {
|
|
67
|
-
"float": 'right'
|
|
68
|
-
},
|
|
69
|
-
onClick: toggle
|
|
70
|
-
}, !!collapsed && /*#__PURE__*/_react["default"].createElement(_reactFeather.Eye, null), !collapsed && /*#__PURE__*/_react["default"].createElement(_reactFeather.EyeOff, null)))), !collapsed && props.children, props.lineEnd && /*#__PURE__*/_react["default"].createElement("hr", null));
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
exports.Collapse = Collapse;
|
|
74
|
-
|
|
75
|
-
var Panel = function Panel(props) {
|
|
76
|
-
var _useState3 = (0, _react.useState)(props.initCollapsed || props.collapsed),
|
|
77
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
78
|
-
collapsed = _useState4[0],
|
|
79
|
-
setCollapsed = _useState4[1];
|
|
80
|
-
|
|
81
|
-
var toggle = function toggle(e) {
|
|
82
|
-
if (e && e.preventDefault) e.preventDefault();
|
|
83
|
-
setCollapsed(!collapsed);
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
87
|
-
className: "col-xs-12 col-sm-3"
|
|
88
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
89
|
-
className: "panel panel-primary",
|
|
90
|
-
style: {
|
|
91
|
-
marginBottom: 0
|
|
92
|
-
}
|
|
93
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
94
|
-
className: "panel-heading",
|
|
95
|
-
style: {
|
|
96
|
-
cursor: 'pointer'
|
|
97
|
-
},
|
|
60
|
+
className: (0, _classnames["default"])(classes.btn, _defineProperty({}, classes.collapse_error, props.errored)),
|
|
98
61
|
onClick: toggle
|
|
99
|
-
},
|
|
100
|
-
className: "panel-body"
|
|
101
|
-
}, props.children)));
|
|
62
|
+
}, !!collapsed && /*#__PURE__*/_react["default"].createElement(_reactFeather.Eye, null), !collapsed && /*#__PURE__*/_react["default"].createElement(_reactFeather.EyeOff, null))), !collapsed && props.children, props.lineEnd && /*#__PURE__*/_react["default"].createElement("hr", null));
|
|
102
63
|
};
|
|
103
64
|
|
|
104
|
-
exports.
|
|
65
|
+
exports.Collapse = Collapse;
|
|
@@ -9,12 +9,20 @@ exports.SelectInput = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
|
|
12
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
+
|
|
12
14
|
var _creatable = _interopRequireDefault(require("react-select/creatable"));
|
|
13
15
|
|
|
14
16
|
var _reactSelect = _interopRequireDefault(require("react-select"));
|
|
15
17
|
|
|
16
18
|
var _Option = require("../Option");
|
|
17
19
|
|
|
20
|
+
var _utils = require("../utils");
|
|
21
|
+
|
|
22
|
+
var _ = require("..");
|
|
23
|
+
|
|
24
|
+
var _styleContext = require("../styleContext");
|
|
25
|
+
|
|
18
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
27
|
|
|
20
28
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -44,47 +52,64 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
44
52
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
45
53
|
|
|
46
54
|
var valueToSelectOption = function valueToSelectOption(value) {
|
|
47
|
-
var
|
|
55
|
+
var possibleValues = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
56
|
+
var isMulti = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
57
|
+
var maybeTransformer = arguments.length > 3 ? arguments[3] : undefined;
|
|
48
58
|
|
|
49
59
|
if (value === null) {
|
|
50
60
|
return null;
|
|
51
61
|
}
|
|
52
62
|
|
|
53
63
|
if (isMulti) {
|
|
54
|
-
return value.map(function (
|
|
55
|
-
return
|
|
56
|
-
|
|
64
|
+
return (0, _Option.option)(value).map(function (v) {
|
|
65
|
+
return v.map(function (x) {
|
|
66
|
+
return valueToSelectOption(x, possibleValues, false, maybeTransformer);
|
|
67
|
+
});
|
|
68
|
+
}).getOrElse([]);
|
|
57
69
|
}
|
|
58
70
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
71
|
+
var maybeValue = (0, _Option.option)(possibleValues.find(function (v) {
|
|
72
|
+
return (0, _utils.deepEqual)(v.value, value);
|
|
73
|
+
}));
|
|
74
|
+
return maybeValue.getOrElse({
|
|
75
|
+
label: maybeValue.map(function (v) {
|
|
76
|
+
return v.label;
|
|
77
|
+
}).getOrElse(value),
|
|
78
|
+
value: maybeValue.map(function (v) {
|
|
79
|
+
return v.value;
|
|
80
|
+
}).getOrElse(value)
|
|
81
|
+
});
|
|
63
82
|
};
|
|
64
83
|
|
|
65
84
|
var SelectInput = function SelectInput(props) {
|
|
85
|
+
var classes = (0, _styleContext.useCustomStyle)();
|
|
86
|
+
var possibleValues = (props.possibleValues || []).map(function (v) {
|
|
87
|
+
return props.transformer ? props.transformer(v) : v;
|
|
88
|
+
}).map(function (v) {
|
|
89
|
+
return {
|
|
90
|
+
label: (v === null || v === void 0 ? void 0 : v.label) || v,
|
|
91
|
+
value: (v === null || v === void 0 ? void 0 : v.value) || v
|
|
92
|
+
};
|
|
93
|
+
});
|
|
94
|
+
|
|
66
95
|
var _useState = (0, _react.useState)(false),
|
|
67
96
|
_useState2 = _slicedToArray(_useState, 2),
|
|
68
97
|
loading = _useState2[0],
|
|
69
98
|
setLoading = _useState2[1];
|
|
70
99
|
|
|
71
|
-
var _useState3 = (0, _react.useState)(
|
|
100
|
+
var _useState3 = (0, _react.useState)(possibleValues),
|
|
72
101
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
73
|
-
|
|
74
|
-
|
|
102
|
+
values = _useState4[0],
|
|
103
|
+
setValues = _useState4[1];
|
|
75
104
|
|
|
76
|
-
var _useState5 = (0, _react.useState)((props.
|
|
77
|
-
return props.transformer ? props.transformer(v) : v;
|
|
78
|
-
}).map(function (v) {
|
|
79
|
-
return valueToSelectOption(v);
|
|
80
|
-
})),
|
|
105
|
+
var _useState5 = (0, _react.useState)(valueToSelectOption(props.value || props.defaultValue, possibleValues, props.isMulti, props.transformer)),
|
|
81
106
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
82
|
-
|
|
83
|
-
|
|
107
|
+
value = _useState6[0],
|
|
108
|
+
setValue = _useState6[1];
|
|
84
109
|
|
|
85
110
|
(0, _react.useEffect)(function () {
|
|
86
|
-
setValue(valueToSelectOption(props.value
|
|
87
|
-
}, []);
|
|
111
|
+
setValue(valueToSelectOption(props.value, values, props.isMulti, props.transformer));
|
|
112
|
+
}, [props.value, values]);
|
|
88
113
|
(0, _react.useEffect)(function () {
|
|
89
114
|
if (props.optionsFrom) {
|
|
90
115
|
var cond = (0, _Option.option)(props.fetchCondition).map(function (cond) {
|
|
@@ -97,7 +122,7 @@ var SelectInput = function SelectInput(props) {
|
|
|
97
122
|
return r.json();
|
|
98
123
|
}).then(function (values) {
|
|
99
124
|
return values.map(function (x) {
|
|
100
|
-
return props.transformer ? props.transformer(x) : valueToSelectOption(x);
|
|
125
|
+
return props.transformer ? props.transformer(x) : valueToSelectOption(x, values, props.isMulti, props.transformer);
|
|
101
126
|
});
|
|
102
127
|
}).then(function (values) {
|
|
103
128
|
setValues(values);
|
|
@@ -108,7 +133,7 @@ var SelectInput = function SelectInput(props) {
|
|
|
108
133
|
});
|
|
109
134
|
}
|
|
110
135
|
}
|
|
111
|
-
}, [
|
|
136
|
+
}, [props.optionsFrom]);
|
|
112
137
|
|
|
113
138
|
var onChange = function onChange(changes) {
|
|
114
139
|
setValue(changes);
|
|
@@ -122,13 +147,57 @@ var SelectInput = function SelectInput(props) {
|
|
|
122
147
|
}
|
|
123
148
|
};
|
|
124
149
|
|
|
125
|
-
var
|
|
126
|
-
var
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
150
|
+
var handleCreate = function handleCreate(label, fn) {
|
|
151
|
+
var createdValue = (0, _Option.option)(fn).map(function (func) {
|
|
152
|
+
return func(label);
|
|
153
|
+
}).map(function (createdOpt) {
|
|
154
|
+
return (0, _Option.option)(props.transformer).map(function (t) {
|
|
155
|
+
return t(createdOpt);
|
|
156
|
+
}).getOrElse(createdOpt);
|
|
157
|
+
}).getOrElse(valueToSelectOption(label, values));
|
|
158
|
+
setValues([].concat(_toConsumableArray(values), [createdValue]));
|
|
159
|
+
|
|
160
|
+
if (props.isMulti) {
|
|
161
|
+
onChange([].concat(_toConsumableArray(value), [createdValue]));
|
|
162
|
+
} else {
|
|
163
|
+
onChange(createdValue);
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
var handleSelectButtonClick = function handleSelectButtonClick(v) {
|
|
168
|
+
if (props.isMulti) {
|
|
169
|
+
if (value.includes(v)) {
|
|
170
|
+
return onChange(value.filter(function (val) {
|
|
171
|
+
return val.value !== v.value;
|
|
172
|
+
}));
|
|
173
|
+
} else {
|
|
174
|
+
return onChange([].concat(_toConsumableArray(value), [v]));
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
return onChange(v);
|
|
130
179
|
};
|
|
131
180
|
|
|
181
|
+
if (props.format === _.format.buttonsSelect) {
|
|
182
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
183
|
+
style: {
|
|
184
|
+
display: 'flex'
|
|
185
|
+
}
|
|
186
|
+
}, values.map(function (v, idx) {
|
|
187
|
+
var active = props.isMulti ? value.includes(v) : v.value === value.value;
|
|
188
|
+
return /*#__PURE__*/_react["default"].createElement("button", {
|
|
189
|
+
key: idx,
|
|
190
|
+
type: "button",
|
|
191
|
+
className: (0, _classnames["default"])(props.className, classes.btn, classes.btn_grey, classes.ml_5, {
|
|
192
|
+
active: active
|
|
193
|
+
}),
|
|
194
|
+
onClick: function onClick() {
|
|
195
|
+
return handleSelectButtonClick(v);
|
|
196
|
+
}
|
|
197
|
+
}, v.label);
|
|
198
|
+
}));
|
|
199
|
+
}
|
|
200
|
+
|
|
132
201
|
if (props.createOption) {
|
|
133
202
|
return /*#__PURE__*/_react["default"].createElement(_creatable["default"], _extends({}, props, {
|
|
134
203
|
name: "".concat(props.label, "-search"),
|
|
@@ -140,7 +209,7 @@ var SelectInput = function SelectInput(props) {
|
|
|
140
209
|
onChange: onChange,
|
|
141
210
|
options: values,
|
|
142
211
|
onCreateOption: function onCreateOption(option) {
|
|
143
|
-
return
|
|
212
|
+
return handleCreate(option, props.onCreateOption);
|
|
144
213
|
},
|
|
145
214
|
classNamePrefix: "react-form-select",
|
|
146
215
|
className: props.className
|
package/lib/style.d.ts
ADDED
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
export namespace style {
|
|
2
|
+
const input: {
|
|
3
|
+
display: string;
|
|
4
|
+
width: string;
|
|
5
|
+
padding: string;
|
|
6
|
+
fontSize: string;
|
|
7
|
+
color: string;
|
|
8
|
+
border: string;
|
|
9
|
+
borderRadius: number;
|
|
10
|
+
"&[readonly]": {
|
|
11
|
+
backgroundColor: string;
|
|
12
|
+
opacity: number;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
namespace btn {
|
|
16
|
+
const borderRadius: number;
|
|
17
|
+
const padding: number;
|
|
18
|
+
const fontSize: string;
|
|
19
|
+
const cursor: string;
|
|
20
|
+
const borderWidth: string;
|
|
21
|
+
const backgroundColor: string;
|
|
22
|
+
}
|
|
23
|
+
namespace btn_sm {
|
|
24
|
+
const fontSize_1: string;
|
|
25
|
+
export { fontSize_1 as fontSize };
|
|
26
|
+
const padding_1: string;
|
|
27
|
+
export { padding_1 as padding };
|
|
28
|
+
}
|
|
29
|
+
const btn_group: {
|
|
30
|
+
"& > button:not(:last-child)": {
|
|
31
|
+
borderTopRightRadius: number;
|
|
32
|
+
borderBottomRightRadius: number;
|
|
33
|
+
};
|
|
34
|
+
"& > button:not(:first-child)": {
|
|
35
|
+
borderTopLeftRadius: number;
|
|
36
|
+
borderBottomLeftRadius: number;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
const btn_red: {
|
|
40
|
+
color: any;
|
|
41
|
+
borderColor: any;
|
|
42
|
+
"&:hover": {
|
|
43
|
+
color: string;
|
|
44
|
+
backgroundColor: any;
|
|
45
|
+
borderColor: any;
|
|
46
|
+
};
|
|
47
|
+
"&.active": {
|
|
48
|
+
color: string;
|
|
49
|
+
backgroundColor: any;
|
|
50
|
+
borderColor: any;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
const btn_green: {
|
|
54
|
+
color: any;
|
|
55
|
+
borderColor: any;
|
|
56
|
+
"&:hover": {
|
|
57
|
+
color: string;
|
|
58
|
+
backgroundColor: any;
|
|
59
|
+
borderColor: any;
|
|
60
|
+
};
|
|
61
|
+
"&.active": {
|
|
62
|
+
color: string;
|
|
63
|
+
backgroundColor: any;
|
|
64
|
+
borderColor: any;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
const btn_blue: {
|
|
68
|
+
color: any;
|
|
69
|
+
borderColor: any;
|
|
70
|
+
"&:hover": {
|
|
71
|
+
color: string;
|
|
72
|
+
backgroundColor: any;
|
|
73
|
+
borderColor: any;
|
|
74
|
+
};
|
|
75
|
+
"&.active": {
|
|
76
|
+
color: string;
|
|
77
|
+
backgroundColor: any;
|
|
78
|
+
borderColor: any;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
const btn_grey: {
|
|
82
|
+
color: any;
|
|
83
|
+
borderColor: any;
|
|
84
|
+
"&:hover": {
|
|
85
|
+
color: string;
|
|
86
|
+
backgroundColor: any;
|
|
87
|
+
borderColor: any;
|
|
88
|
+
};
|
|
89
|
+
"&.active": {
|
|
90
|
+
color: string;
|
|
91
|
+
backgroundColor: any;
|
|
92
|
+
borderColor: any;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
namespace txt_red {
|
|
96
|
+
const color: string;
|
|
97
|
+
}
|
|
98
|
+
namespace ml_5 {
|
|
99
|
+
const marginLeft: number;
|
|
100
|
+
}
|
|
101
|
+
namespace ml_10 {
|
|
102
|
+
const marginLeft_1: number;
|
|
103
|
+
export { marginLeft_1 as marginLeft };
|
|
104
|
+
}
|
|
105
|
+
namespace mt_5 {
|
|
106
|
+
const marginTop: number;
|
|
107
|
+
}
|
|
108
|
+
namespace mt_10 {
|
|
109
|
+
const marginTop_1: number;
|
|
110
|
+
export { marginTop_1 as marginTop };
|
|
111
|
+
}
|
|
112
|
+
namespace mt_20 {
|
|
113
|
+
const marginTop_2: number;
|
|
114
|
+
export { marginTop_2 as marginTop };
|
|
115
|
+
}
|
|
116
|
+
namespace mb_5 {
|
|
117
|
+
const marginBottom: number;
|
|
118
|
+
}
|
|
119
|
+
namespace p_15 {
|
|
120
|
+
const padding_2: number;
|
|
121
|
+
export { padding_2 as padding };
|
|
122
|
+
}
|
|
123
|
+
namespace pr_15 {
|
|
124
|
+
const paddingRight: number;
|
|
125
|
+
}
|
|
126
|
+
namespace d_none {
|
|
127
|
+
const display: string;
|
|
128
|
+
}
|
|
129
|
+
namespace flex {
|
|
130
|
+
const display_1: string;
|
|
131
|
+
export { display_1 as display };
|
|
132
|
+
}
|
|
133
|
+
namespace flexColumn {
|
|
134
|
+
const flexDirection: string;
|
|
135
|
+
}
|
|
136
|
+
namespace justifyContentBetween {
|
|
137
|
+
const justifyContent: string;
|
|
138
|
+
}
|
|
139
|
+
namespace jc_end {
|
|
140
|
+
const justifyContent_1: string;
|
|
141
|
+
export { justifyContent_1 as justifyContent };
|
|
142
|
+
}
|
|
143
|
+
namespace ac_center {
|
|
144
|
+
const alignContent: string;
|
|
145
|
+
}
|
|
146
|
+
namespace ai_center {
|
|
147
|
+
const alignItems: string;
|
|
148
|
+
}
|
|
149
|
+
namespace cursor_pointer {
|
|
150
|
+
const cursor_1: string;
|
|
151
|
+
export { cursor_1 as cursor };
|
|
152
|
+
}
|
|
153
|
+
namespace collapse {
|
|
154
|
+
const display_2: string;
|
|
155
|
+
export { display_2 as display };
|
|
156
|
+
const justifyContent_2: string;
|
|
157
|
+
export { justifyContent_2 as justifyContent };
|
|
158
|
+
const cursor_2: string;
|
|
159
|
+
export { cursor_2 as cursor };
|
|
160
|
+
}
|
|
161
|
+
namespace collapse_label {
|
|
162
|
+
export const fontWeight: string;
|
|
163
|
+
const marginTop_3: number;
|
|
164
|
+
export { marginTop_3 as marginTop };
|
|
165
|
+
}
|
|
166
|
+
namespace collapse_error {
|
|
167
|
+
const color_1: string;
|
|
168
|
+
export { color_1 as color };
|
|
169
|
+
}
|
|
170
|
+
const datepicker: {
|
|
171
|
+
"& input": {
|
|
172
|
+
borderRadius: string;
|
|
173
|
+
};
|
|
174
|
+
};
|
|
175
|
+
const code: {};
|
|
176
|
+
namespace input__boolean__on {
|
|
177
|
+
const color_2: string;
|
|
178
|
+
export { color_2 as color };
|
|
179
|
+
}
|
|
180
|
+
namespace input__boolean__off {
|
|
181
|
+
const color_3: string;
|
|
182
|
+
export { color_3 as color };
|
|
183
|
+
}
|
|
184
|
+
namespace input__invalid {
|
|
185
|
+
const borderColor: string;
|
|
186
|
+
}
|
|
187
|
+
namespace invalid_feedback {
|
|
188
|
+
export const width: string;
|
|
189
|
+
const marginTop_4: string;
|
|
190
|
+
export { marginTop_4 as marginTop };
|
|
191
|
+
const fontSize_2: string;
|
|
192
|
+
export { fontSize_2 as fontSize };
|
|
193
|
+
const color_4: string;
|
|
194
|
+
export { color_4 as color };
|
|
195
|
+
}
|
|
196
|
+
}
|