@maif/react-forms 1.0.7 → 1.0.11
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/README.md +1 -0
- package/dist/react-form.js +1 -1
- package/lib/form.js +100 -108
- package/lib/format.d.ts +1 -0
- package/lib/format.js +2 -1
- package/lib/inputs/ArrayInput.js +1 -1
- package/lib/inputs/CodeInput.d.ts +2 -1
- package/lib/inputs/CodeInput.js +21 -3
- package/lib/inputs/Collapse.d.ts +0 -1
- package/lib/inputs/Collapse.js +18 -55
- package/lib/inputs/SelectInput.js +72 -16
- package/lib/style.d.ts +71 -31
- package/lib/style.js +54 -52
- package/lib/styleContext.d.ts +1 -1
- package/lib/utils.d.ts +1 -0
- package/lib/utils.js +31 -0
- package/package.json +2 -1
|
@@ -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); }
|
|
@@ -46,31 +54,35 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
46
54
|
var valueToSelectOption = function valueToSelectOption(value) {
|
|
47
55
|
var possibleValues = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
48
56
|
var isMulti = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
57
|
+
var maybeTransformer = arguments.length > 3 ? arguments[3] : undefined;
|
|
49
58
|
|
|
50
59
|
if (value === null) {
|
|
51
60
|
return null;
|
|
52
61
|
}
|
|
53
62
|
|
|
54
63
|
if (isMulti) {
|
|
55
|
-
return value.map(function (
|
|
56
|
-
return
|
|
57
|
-
|
|
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([]);
|
|
58
69
|
}
|
|
59
70
|
|
|
60
71
|
var maybeValue = (0, _Option.option)(possibleValues.find(function (v) {
|
|
61
|
-
return v.value
|
|
72
|
+
return (0, _utils.deepEqual)(v.value, value);
|
|
62
73
|
}));
|
|
63
|
-
return {
|
|
74
|
+
return maybeValue.getOrElse({
|
|
64
75
|
label: maybeValue.map(function (v) {
|
|
65
76
|
return v.label;
|
|
66
77
|
}).getOrElse(value),
|
|
67
78
|
value: maybeValue.map(function (v) {
|
|
68
79
|
return v.value;
|
|
69
80
|
}).getOrElse(value)
|
|
70
|
-
};
|
|
81
|
+
});
|
|
71
82
|
};
|
|
72
83
|
|
|
73
84
|
var SelectInput = function SelectInput(props) {
|
|
85
|
+
var classes = (0, _styleContext.useCustomStyle)();
|
|
74
86
|
var possibleValues = (props.possibleValues || []).map(function (v) {
|
|
75
87
|
return props.transformer ? props.transformer(v) : v;
|
|
76
88
|
}).map(function (v) {
|
|
@@ -90,13 +102,13 @@ var SelectInput = function SelectInput(props) {
|
|
|
90
102
|
values = _useState4[0],
|
|
91
103
|
setValues = _useState4[1];
|
|
92
104
|
|
|
93
|
-
var _useState5 = (0, _react.useState)(valueToSelectOption(props.value || props.defaultValue, possibleValues, props.isMulti)),
|
|
105
|
+
var _useState5 = (0, _react.useState)(valueToSelectOption(props.value || props.defaultValue, possibleValues, props.isMulti, props.transformer)),
|
|
94
106
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
95
107
|
value = _useState6[0],
|
|
96
108
|
setValue = _useState6[1];
|
|
97
109
|
|
|
98
110
|
(0, _react.useEffect)(function () {
|
|
99
|
-
setValue(valueToSelectOption(props.value, values, props.isMulti));
|
|
111
|
+
setValue(valueToSelectOption(props.value, values, props.isMulti, props.transformer));
|
|
100
112
|
}, [props.value, values]);
|
|
101
113
|
(0, _react.useEffect)(function () {
|
|
102
114
|
if (props.optionsFrom) {
|
|
@@ -110,7 +122,7 @@ var SelectInput = function SelectInput(props) {
|
|
|
110
122
|
return r.json();
|
|
111
123
|
}).then(function (values) {
|
|
112
124
|
return values.map(function (x) {
|
|
113
|
-
return props.transformer ? props.transformer(x) : valueToSelectOption(x);
|
|
125
|
+
return props.transformer ? props.transformer(x) : valueToSelectOption(x, values, props.isMulti, props.transformer);
|
|
114
126
|
});
|
|
115
127
|
}).then(function (values) {
|
|
116
128
|
setValues(values);
|
|
@@ -121,7 +133,7 @@ var SelectInput = function SelectInput(props) {
|
|
|
121
133
|
});
|
|
122
134
|
}
|
|
123
135
|
}
|
|
124
|
-
}, [
|
|
136
|
+
}, [props.optionsFrom]);
|
|
125
137
|
|
|
126
138
|
var onChange = function onChange(changes) {
|
|
127
139
|
setValue(changes);
|
|
@@ -135,13 +147,57 @@ var SelectInput = function SelectInput(props) {
|
|
|
135
147
|
}
|
|
136
148
|
};
|
|
137
149
|
|
|
138
|
-
var
|
|
139
|
-
var
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
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);
|
|
143
179
|
};
|
|
144
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
|
+
|
|
145
201
|
if (props.createOption) {
|
|
146
202
|
return /*#__PURE__*/_react["default"].createElement(_creatable["default"], _extends({}, props, {
|
|
147
203
|
name: "".concat(props.label, "-search"),
|
|
@@ -153,7 +209,7 @@ var SelectInput = function SelectInput(props) {
|
|
|
153
209
|
onChange: onChange,
|
|
154
210
|
options: values,
|
|
155
211
|
onCreateOption: function onCreateOption(option) {
|
|
156
|
-
return
|
|
212
|
+
return handleCreate(option, props.onCreateOption);
|
|
157
213
|
},
|
|
158
214
|
classNamePrefix: "react-form-select",
|
|
159
215
|
className: props.className
|
package/lib/style.d.ts
CHANGED
|
@@ -17,7 +17,8 @@ export namespace style {
|
|
|
17
17
|
const padding: number;
|
|
18
18
|
const fontSize: string;
|
|
19
19
|
const cursor: string;
|
|
20
|
-
const
|
|
20
|
+
const borderWidth: string;
|
|
21
|
+
const backgroundColor: string;
|
|
21
22
|
}
|
|
22
23
|
namespace btn_sm {
|
|
23
24
|
const fontSize_1: string;
|
|
@@ -36,39 +37,59 @@ export namespace style {
|
|
|
36
37
|
};
|
|
37
38
|
};
|
|
38
39
|
const btn_red: {
|
|
39
|
-
color:
|
|
40
|
-
|
|
41
|
-
borderColor: string;
|
|
40
|
+
color: any;
|
|
41
|
+
borderColor: any;
|
|
42
42
|
"&:hover": {
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
color: string;
|
|
44
|
+
backgroundColor: any;
|
|
45
|
+
borderColor: any;
|
|
46
|
+
};
|
|
47
|
+
"&.active": {
|
|
48
|
+
color: string;
|
|
49
|
+
backgroundColor: any;
|
|
50
|
+
borderColor: any;
|
|
45
51
|
};
|
|
46
52
|
};
|
|
47
53
|
const btn_green: {
|
|
48
|
-
color:
|
|
49
|
-
|
|
50
|
-
borderColor: string;
|
|
54
|
+
color: any;
|
|
55
|
+
borderColor: any;
|
|
51
56
|
"&:hover": {
|
|
52
|
-
|
|
53
|
-
|
|
57
|
+
color: string;
|
|
58
|
+
backgroundColor: any;
|
|
59
|
+
borderColor: any;
|
|
60
|
+
};
|
|
61
|
+
"&.active": {
|
|
62
|
+
color: string;
|
|
63
|
+
backgroundColor: any;
|
|
64
|
+
borderColor: any;
|
|
54
65
|
};
|
|
55
66
|
};
|
|
56
67
|
const btn_blue: {
|
|
57
|
-
color:
|
|
58
|
-
|
|
59
|
-
borderColor: string;
|
|
68
|
+
color: any;
|
|
69
|
+
borderColor: any;
|
|
60
70
|
"&:hover": {
|
|
61
|
-
|
|
62
|
-
|
|
71
|
+
color: string;
|
|
72
|
+
backgroundColor: any;
|
|
73
|
+
borderColor: any;
|
|
74
|
+
};
|
|
75
|
+
"&.active": {
|
|
76
|
+
color: string;
|
|
77
|
+
backgroundColor: any;
|
|
78
|
+
borderColor: any;
|
|
63
79
|
};
|
|
64
80
|
};
|
|
65
81
|
const btn_grey: {
|
|
66
|
-
color:
|
|
67
|
-
|
|
68
|
-
borderColor: string;
|
|
82
|
+
color: any;
|
|
83
|
+
borderColor: any;
|
|
69
84
|
"&:hover": {
|
|
70
|
-
|
|
71
|
-
|
|
85
|
+
color: string;
|
|
86
|
+
backgroundColor: any;
|
|
87
|
+
borderColor: any;
|
|
88
|
+
};
|
|
89
|
+
"&.active": {
|
|
90
|
+
color: string;
|
|
91
|
+
backgroundColor: any;
|
|
92
|
+
borderColor: any;
|
|
72
93
|
};
|
|
73
94
|
};
|
|
74
95
|
namespace txt_red {
|
|
@@ -109,13 +130,16 @@ export namespace style {
|
|
|
109
130
|
const display_1: string;
|
|
110
131
|
export { display_1 as display };
|
|
111
132
|
}
|
|
112
|
-
namespace
|
|
113
|
-
const
|
|
114
|
-
export { flexDirection_1 as flexDirection };
|
|
133
|
+
namespace flexColumn {
|
|
134
|
+
const flexDirection: string;
|
|
115
135
|
}
|
|
116
|
-
namespace
|
|
136
|
+
namespace justifyContentBetween {
|
|
117
137
|
const justifyContent: string;
|
|
118
138
|
}
|
|
139
|
+
namespace jc_end {
|
|
140
|
+
const justifyContent_1: string;
|
|
141
|
+
export { justifyContent_1 as justifyContent };
|
|
142
|
+
}
|
|
119
143
|
namespace ac_center {
|
|
120
144
|
const alignContent: string;
|
|
121
145
|
}
|
|
@@ -129,8 +153,8 @@ export namespace style {
|
|
|
129
153
|
namespace collapse {
|
|
130
154
|
const display_2: string;
|
|
131
155
|
export { display_2 as display };
|
|
132
|
-
const
|
|
133
|
-
export {
|
|
156
|
+
const justifyContent_2: string;
|
|
157
|
+
export { justifyContent_2 as justifyContent };
|
|
134
158
|
const cursor_2: string;
|
|
135
159
|
export { cursor_2 as cursor };
|
|
136
160
|
}
|
|
@@ -139,6 +163,10 @@ export namespace style {
|
|
|
139
163
|
const marginTop_3: number;
|
|
140
164
|
export { marginTop_3 as marginTop };
|
|
141
165
|
}
|
|
166
|
+
namespace collapse_error {
|
|
167
|
+
const color_1: string;
|
|
168
|
+
export { color_1 as color };
|
|
169
|
+
}
|
|
142
170
|
const datepicker: {
|
|
143
171
|
"& input": {
|
|
144
172
|
borderRadius: string;
|
|
@@ -146,11 +174,23 @@ export namespace style {
|
|
|
146
174
|
};
|
|
147
175
|
const code: {};
|
|
148
176
|
namespace input__boolean__on {
|
|
149
|
-
const color_1: string;
|
|
150
|
-
export { color_1 as color };
|
|
151
|
-
}
|
|
152
|
-
namespace input__boolean__off {
|
|
153
177
|
const color_2: string;
|
|
154
178
|
export { color_2 as color };
|
|
155
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
|
+
}
|
|
156
196
|
}
|
package/lib/style.js
CHANGED
|
@@ -4,7 +4,29 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.style = void 0;
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
var _style;
|
|
9
|
+
|
|
10
|
+
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; }
|
|
11
|
+
|
|
12
|
+
var buttonOutline = function buttonOutline(color, darker) {
|
|
13
|
+
return {
|
|
14
|
+
color: color,
|
|
15
|
+
borderColor: color,
|
|
16
|
+
"&:hover": {
|
|
17
|
+
color: '#fff',
|
|
18
|
+
backgroundColor: color,
|
|
19
|
+
borderColor: darker
|
|
20
|
+
},
|
|
21
|
+
"&.active": {
|
|
22
|
+
color: '#fff',
|
|
23
|
+
backgroundColor: color,
|
|
24
|
+
borderColor: darker
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
var style = (_style = {
|
|
8
30
|
input: {
|
|
9
31
|
display: "block",
|
|
10
32
|
width: "100%",
|
|
@@ -23,7 +45,8 @@ var style = {
|
|
|
23
45
|
padding: 10,
|
|
24
46
|
fontSize: "1rem",
|
|
25
47
|
cursor: "pointer",
|
|
26
|
-
|
|
48
|
+
borderWidth: '1px',
|
|
49
|
+
backgroundColor: '#fff'
|
|
27
50
|
},
|
|
28
51
|
btn_sm: {
|
|
29
52
|
fontSize: "0.875rem",
|
|
@@ -39,42 +62,10 @@ var style = {
|
|
|
39
62
|
borderBottomLeftRadius: 0
|
|
40
63
|
}
|
|
41
64
|
},
|
|
42
|
-
btn_red:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"&:hover": {
|
|
47
|
-
backgroundColor: "#c82333",
|
|
48
|
-
borderColor: "#bd2130"
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
btn_green: {
|
|
52
|
-
color: "#fff",
|
|
53
|
-
backgroundColor: "#28a745",
|
|
54
|
-
borderColor: "#28a745",
|
|
55
|
-
"&:hover": {
|
|
56
|
-
backgroundColor: "#218838",
|
|
57
|
-
borderColor: "#1e7e34"
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
btn_blue: {
|
|
61
|
-
color: "#fff",
|
|
62
|
-
backgroundColor: "#007bff",
|
|
63
|
-
borderColor: "#007bff",
|
|
64
|
-
"&:hover": {
|
|
65
|
-
backgroundColor: "#0069d9",
|
|
66
|
-
borderColor: "#0062cc"
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
btn_grey: {
|
|
70
|
-
color: "#fff",
|
|
71
|
-
backgroundColor: "#6c757d",
|
|
72
|
-
borderColor: "#6c757d",
|
|
73
|
-
"&:hover": {
|
|
74
|
-
backgroundColor: "#5c636a",
|
|
75
|
-
borderColor: "#5c636a"
|
|
76
|
-
}
|
|
77
|
-
},
|
|
65
|
+
btn_red: buttonOutline("#dc3545", "#bd2130"),
|
|
66
|
+
btn_green: buttonOutline("#28a745", "#1e7e34"),
|
|
67
|
+
btn_blue: buttonOutline("#007bff", "#0069d9"),
|
|
68
|
+
btn_grey: buttonOutline("#6c757d", "#5c636a"),
|
|
78
69
|
txt_red: {
|
|
79
70
|
color: "#dc3545"
|
|
80
71
|
},
|
|
@@ -108,9 +99,12 @@ var style = {
|
|
|
108
99
|
flex: {
|
|
109
100
|
display: "flex"
|
|
110
101
|
},
|
|
111
|
-
|
|
102
|
+
flexColumn: {
|
|
112
103
|
flexDirection: "column"
|
|
113
104
|
},
|
|
105
|
+
justifyContentBetween: {
|
|
106
|
+
justifyContent: "space-between"
|
|
107
|
+
},
|
|
114
108
|
jc_end: {
|
|
115
109
|
justifyContent: "end"
|
|
116
110
|
},
|
|
@@ -131,18 +125,26 @@ var style = {
|
|
|
131
125
|
collapse_label: {
|
|
132
126
|
fontWeight: "bold",
|
|
133
127
|
marginTop: 7
|
|
134
|
-
},
|
|
135
|
-
datepicker: {
|
|
136
|
-
"& input": {
|
|
137
|
-
borderRadius: "4px"
|
|
138
|
-
}
|
|
139
|
-
},
|
|
140
|
-
code: {},
|
|
141
|
-
input__boolean__on: {
|
|
142
|
-
color: "MediumSeaGreen"
|
|
143
|
-
},
|
|
144
|
-
input__boolean__off: {
|
|
145
|
-
color: "tomato"
|
|
146
128
|
}
|
|
147
|
-
}
|
|
129
|
+
}, _defineProperty(_style, "collapse_label", {
|
|
130
|
+
fontWeight: "bold",
|
|
131
|
+
marginTop: 7
|
|
132
|
+
}), _defineProperty(_style, "collapse_error", {
|
|
133
|
+
color: '#dc3545'
|
|
134
|
+
}), _defineProperty(_style, "datepicker", {
|
|
135
|
+
"& input": {
|
|
136
|
+
borderRadius: "4px"
|
|
137
|
+
}
|
|
138
|
+
}), _defineProperty(_style, "code", {}), _defineProperty(_style, "input__boolean__on", {
|
|
139
|
+
color: "MediumSeaGreen"
|
|
140
|
+
}), _defineProperty(_style, "input__boolean__off", {
|
|
141
|
+
color: "tomato"
|
|
142
|
+
}), _defineProperty(_style, "input__invalid", {
|
|
143
|
+
borderColor: '#dc3545 !important'
|
|
144
|
+
}), _defineProperty(_style, "invalid_feedback", {
|
|
145
|
+
width: "100%",
|
|
146
|
+
marginTop: ".25rem",
|
|
147
|
+
fontSize: "80%",
|
|
148
|
+
color: "#dc3545"
|
|
149
|
+
}), _style);
|
|
148
150
|
exports.style = style;
|
package/lib/styleContext.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export function useCustomStyle(overrideStyle?: {}): import("jss").Classes<"code" | "flex" | "
|
|
1
|
+
export function useCustomStyle(overrideStyle?: {}): import("jss").Classes<"code" | "flex" | "input" | "btn" | "btn_sm" | "btn_group" | "btn_red" | "btn_green" | "btn_blue" | "btn_grey" | "txt_red" | "ml_5" | "ml_10" | "mt_5" | "mt_10" | "mt_20" | "mb_5" | "p_15" | "pr_15" | "d_none" | "flexColumn" | "justifyContentBetween" | "jc_end" | "ac_center" | "ai_center" | "cursor_pointer" | "collapse" | "collapse_label" | "collapse_error" | "datepicker" | "input__boolean__on" | "input__boolean__off" | "input__invalid" | "invalid_feedback">;
|
package/lib/utils.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function deepEqual(a: any, b: any): boolean;
|
package/lib/utils.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.deepEqual = void 0;
|
|
7
|
+
|
|
8
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
9
|
+
|
|
10
|
+
var deepEqual = function deepEqual(a, b) {
|
|
11
|
+
if (a === b) return true;
|
|
12
|
+
if (_typeof(a) !== 'object' || _typeof(b) !== 'object' || a === null || b === null) return false;
|
|
13
|
+
var keysA = Object.keys(a),
|
|
14
|
+
keysB = Object.keys(b);
|
|
15
|
+
if (keysA.length !== keysB.length) return false;
|
|
16
|
+
|
|
17
|
+
for (var _i = 0, _keysA = keysA; _i < _keysA.length; _i++) {
|
|
18
|
+
var key = _keysA[_i];
|
|
19
|
+
if (!keysB.includes(key)) return false;
|
|
20
|
+
|
|
21
|
+
if (typeof a[key] === 'function' || typeof b[key] === 'function') {
|
|
22
|
+
if (a[key].toString() !== b[key].toString()) return false;
|
|
23
|
+
} else {
|
|
24
|
+
if (!deepEqual(a[key], b[key])) return false;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return true;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
exports.deepEqual = deepEqual;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maif/react-forms",
|
|
3
3
|
"description": "Build react safe forms as fast as possible",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.11",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"author": "MAIF team",
|
|
7
7
|
"keywords": [
|
|
@@ -97,6 +97,7 @@
|
|
|
97
97
|
"dependencies": {
|
|
98
98
|
"@fortawesome/fontawesome-free": "^5.15.3",
|
|
99
99
|
"@hookform/resolvers": "2.4.0",
|
|
100
|
+
"@popperjs/core": "^2.11.2",
|
|
100
101
|
"@testing-library/jest-dom": "^5.11.4",
|
|
101
102
|
"@testing-library/react": "^11.1.0",
|
|
102
103
|
"@testing-library/user-event": "^12.1.10",
|