@visns-studio/visns-components 4.7.6 → 4.7.8
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/package.json
CHANGED
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"react-dom": "^17.0.0 || ^18.0.0"
|
|
76
76
|
},
|
|
77
77
|
"name": "@visns-studio/visns-components",
|
|
78
|
-
"version": "4.7.
|
|
78
|
+
"version": "4.7.8",
|
|
79
79
|
"description": "Various packages to assist in the development of our Custom Applications.",
|
|
80
80
|
"main": "src/index.js",
|
|
81
81
|
"files": [
|
|
@@ -13,6 +13,7 @@ function VisnsAsyncSelect({
|
|
|
13
13
|
onKeyDown,
|
|
14
14
|
placeholder,
|
|
15
15
|
settings,
|
|
16
|
+
style,
|
|
16
17
|
}) {
|
|
17
18
|
const loadSuggestedOptions = useCallback(
|
|
18
19
|
debounce((inputValue, callback) => {
|
|
@@ -111,6 +112,13 @@ function VisnsAsyncSelect({
|
|
|
111
112
|
...styles,
|
|
112
113
|
zIndex: 9999,
|
|
113
114
|
}),
|
|
115
|
+
control: (base) => ({
|
|
116
|
+
...base,
|
|
117
|
+
minHeight:
|
|
118
|
+
style && style.multi_select_height
|
|
119
|
+
? style.multi_select_height
|
|
120
|
+
: '52px',
|
|
121
|
+
}),
|
|
114
122
|
input: (styles) => ({
|
|
115
123
|
...styles,
|
|
116
124
|
padding: 0,
|
|
@@ -25,6 +25,7 @@ import VisnsDropZone from '../cms/DropZone';
|
|
|
25
25
|
|
|
26
26
|
import 'react-toggle/style.css';
|
|
27
27
|
import 'react-datepicker/dist/react-datepicker.css';
|
|
28
|
+
import Item from '../cms/sorting/Item';
|
|
28
29
|
|
|
29
30
|
function Field({
|
|
30
31
|
api,
|
|
@@ -32,6 +33,7 @@ function Field({
|
|
|
32
33
|
childDropdownCallback,
|
|
33
34
|
fetchData,
|
|
34
35
|
formData,
|
|
36
|
+
formSettings,
|
|
35
37
|
inputValue,
|
|
36
38
|
inputClass,
|
|
37
39
|
mapbox,
|
|
@@ -153,83 +155,71 @@ function Field({
|
|
|
153
155
|
}
|
|
154
156
|
}, [settings, counter]);
|
|
155
157
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
let filter = {};
|
|
158
|
+
const fetchChildDropdownData = (s, v) => {
|
|
159
|
+
let filter = {};
|
|
159
160
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
? inputValue.value
|
|
163
|
-
: inputValue;
|
|
164
|
-
|
|
165
|
-
if (_inputValue > 0) {
|
|
166
|
-
if (Array.isArray(settings.child)) {
|
|
167
|
-
settings.child.forEach((a) => {
|
|
168
|
-
filter = {
|
|
169
|
-
where: [
|
|
170
|
-
{
|
|
171
|
-
id: settings.id,
|
|
172
|
-
value: _inputValue,
|
|
173
|
-
},
|
|
174
|
-
],
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
if (a.fields) {
|
|
178
|
-
filter.fields = a.fields;
|
|
179
|
-
}
|
|
161
|
+
if (s.child && v) {
|
|
162
|
+
let _inputValue = v.value ? v.value : v;
|
|
180
163
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
CustomFetch(
|
|
186
|
-
a.url,
|
|
187
|
-
'POST',
|
|
188
|
-
filter,
|
|
189
|
-
function (result) {
|
|
190
|
-
childDropdownCallback({
|
|
191
|
-
id: a.id,
|
|
192
|
-
data: result.data,
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
);
|
|
196
|
-
});
|
|
197
|
-
} else {
|
|
164
|
+
if (_inputValue > 0) {
|
|
165
|
+
if (Array.isArray(s.child)) {
|
|
166
|
+
s.child.forEach((a) => {
|
|
198
167
|
filter = {
|
|
199
168
|
where: [
|
|
200
169
|
{
|
|
201
|
-
id:
|
|
170
|
+
id: s.id,
|
|
202
171
|
value: _inputValue,
|
|
203
172
|
},
|
|
204
173
|
],
|
|
205
174
|
};
|
|
206
175
|
|
|
207
|
-
if (
|
|
208
|
-
filter.fields =
|
|
176
|
+
if (a.fields) {
|
|
177
|
+
filter.fields = a.fields;
|
|
209
178
|
}
|
|
210
179
|
|
|
211
|
-
if (
|
|
212
|
-
filter.orderBy =
|
|
180
|
+
if (a.orderBy) {
|
|
181
|
+
filter.orderBy = a.orderBy;
|
|
213
182
|
}
|
|
214
183
|
|
|
215
|
-
CustomFetch(
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
184
|
+
CustomFetch(a.url, 'POST', filter, function (result) {
|
|
185
|
+
childDropdownCallback({
|
|
186
|
+
id: a.id,
|
|
187
|
+
data: result.data,
|
|
188
|
+
});
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
} else {
|
|
192
|
+
filter = {
|
|
193
|
+
where: [
|
|
194
|
+
{
|
|
195
|
+
id: s.id,
|
|
196
|
+
value: _inputValue,
|
|
197
|
+
},
|
|
198
|
+
],
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
if (s.fields) {
|
|
202
|
+
filter.fields = s.fields;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
if (s.orderBy) {
|
|
206
|
+
filter.orderBy = s.orderBy;
|
|
226
207
|
}
|
|
208
|
+
|
|
209
|
+
CustomFetch(s.child.url, 'POST', filter, function (result) {
|
|
210
|
+
childDropdownCallback({
|
|
211
|
+
id: s.child.id,
|
|
212
|
+
data: result.data,
|
|
213
|
+
});
|
|
214
|
+
});
|
|
227
215
|
}
|
|
228
216
|
}
|
|
229
|
-
}
|
|
217
|
+
}
|
|
218
|
+
};
|
|
230
219
|
|
|
231
|
-
|
|
232
|
-
|
|
220
|
+
useEffect(() => {
|
|
221
|
+
fetchChildDropdownData(settings, inputValue);
|
|
222
|
+
}, [inputValue, settings]);
|
|
233
223
|
|
|
234
224
|
useEffect(() => {
|
|
235
225
|
const processOptions = () => {
|
|
@@ -259,7 +249,7 @@ function Field({
|
|
|
259
249
|
};
|
|
260
250
|
|
|
261
251
|
processOptions();
|
|
262
|
-
}, [settings.options, settings]);
|
|
252
|
+
}, [settings.options, settings, counter]);
|
|
263
253
|
|
|
264
254
|
const renderLabel = () => {
|
|
265
255
|
if (
|
|
@@ -1601,6 +1591,21 @@ function Field({
|
|
|
1601
1591
|
setCounter(counter + 1);
|
|
1602
1592
|
};
|
|
1603
1593
|
|
|
1594
|
+
useEffect(() => {
|
|
1595
|
+
if (counter > 0) {
|
|
1596
|
+
if (settings.create.parent_id !== '') {
|
|
1597
|
+
formSettings.fields.forEach((item) => {
|
|
1598
|
+
if (item.id === settings.create.parent_id) {
|
|
1599
|
+
fetchChildDropdownData(
|
|
1600
|
+
item,
|
|
1601
|
+
formData[settings.create.parent_id]
|
|
1602
|
+
);
|
|
1603
|
+
}
|
|
1604
|
+
});
|
|
1605
|
+
}
|
|
1606
|
+
}
|
|
1607
|
+
}, [counter]);
|
|
1608
|
+
|
|
1604
1609
|
return (
|
|
1605
1610
|
<div className={formItemClass} style={formItemStyle}>
|
|
1606
1611
|
<label className={styles.fi__label}>
|
|
@@ -693,8 +693,6 @@ function Form({
|
|
|
693
693
|
return acc;
|
|
694
694
|
}, {});
|
|
695
695
|
|
|
696
|
-
console.info(payload);
|
|
697
|
-
|
|
698
696
|
const res = await CustomFetch(url, method, payload);
|
|
699
697
|
|
|
700
698
|
if (res.data.error === '') {
|
|
@@ -1158,6 +1156,7 @@ function Form({
|
|
|
1158
1156
|
}
|
|
1159
1157
|
fetchData={fetchData}
|
|
1160
1158
|
formData={formData}
|
|
1159
|
+
formSettings={formSettings}
|
|
1161
1160
|
inputClass={inputClass}
|
|
1162
1161
|
inputValue={renderInputValue(
|
|
1163
1162
|
item,
|
|
@@ -1302,6 +1301,7 @@ function Form({
|
|
|
1302
1301
|
}
|
|
1303
1302
|
fetchData={fetchData}
|
|
1304
1303
|
formData={formData}
|
|
1304
|
+
formSettings={formSettings}
|
|
1305
1305
|
inputClass={inputClass}
|
|
1306
1306
|
inputValue={renderInputValue(
|
|
1307
1307
|
item,
|