@visns-studio/visns-components 4.2.2 → 4.2.4

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.
@@ -29,6 +29,7 @@ function VisnsAsyncSelect({
29
29
  return new Promise((resolve, reject) => {
30
30
  let data = [];
31
31
 
32
+ // Prepare payload
32
33
  let payload = {
33
34
  where: [
34
35
  {
@@ -38,14 +39,21 @@ function VisnsAsyncSelect({
38
39
  ],
39
40
  };
40
41
 
41
- if (fields.length > 0) {
42
+ // Check and set fields from settings if fields prop is null or empty
43
+ if (fields && fields.length > 0) {
42
44
  payload.fields = fields;
45
+ } else if (settings.fields && settings.fields.length > 0) {
46
+ payload.fields = settings.fields;
43
47
  }
44
48
 
49
+ // Check and set orderBy from settings if orderBy prop is null or empty
45
50
  if (orderBy) {
46
51
  payload.orderBy = orderBy;
52
+ } else if (settings.orderBy) {
53
+ payload.orderBy = settings.orderBy;
47
54
  }
48
55
 
56
+ // Fetch data
49
57
  CustomFetch(
50
58
  settings.url,
51
59
  'POST',
@@ -92,7 +100,9 @@ function VisnsAsyncSelect({
92
100
  onChange(inputValue, action, settings.id);
93
101
  }}
94
102
  onKeyDown={(e) => {
95
- onKeyDown(e);
103
+ if (onKeyDown) {
104
+ onKeyDown(e);
105
+ }
96
106
  }}
97
107
  components={{ SelectList }}
98
108
  styles={{
@@ -159,6 +159,14 @@ function Field({
159
159
  ],
160
160
  };
161
161
 
162
+ if (a.fields) {
163
+ filter.fields = a.fields;
164
+ }
165
+
166
+ if (a.orderBy) {
167
+ filter.orderBy = a.orderBy;
168
+ }
169
+
162
170
  CustomFetch(
163
171
  a.url,
164
172
  'POST',
@@ -181,6 +189,14 @@ function Field({
181
189
  ],
182
190
  };
183
191
 
192
+ if (settings.fields) {
193
+ filter.fields = settings.fields;
194
+ }
195
+
196
+ if (settings.orderBy) {
197
+ filter.orderBy = settings.orderBy;
198
+ }
199
+
184
200
  CustomFetch(
185
201
  settings.child.url,
186
202
  'POST',
@@ -442,8 +442,12 @@ const GenericDynamic = ({
442
442
  }
443
443
  }
444
444
  } else {
445
- if (activeForm.length === 0 && templateStatus) {
446
- setActiveForm(data[type]);
445
+ if (
446
+ Object.keys(activeForm).length === 0 &&
447
+ templateStatus &&
448
+ data[type][0]
449
+ ) {
450
+ setActiveForm(data[type][0]);
447
451
  setActiveFormKey(0);
448
452
  }
449
453
  }
@@ -455,9 +459,15 @@ const GenericDynamic = ({
455
459
  useEffect(() => {
456
460
  if (data[type] && data[type].length > 0) {
457
461
  } else {
458
- if (multiple && templateStatus) {
459
- if (activeForm.hasOwnProperty('id') === false) {
460
- handleAddNewForm(false);
462
+ if (templateStatus) {
463
+ if (multiple) {
464
+ if (activeForm.hasOwnProperty('id') === false) {
465
+ handleAddNewForm(false);
466
+ }
467
+ } else {
468
+ if (Object.keys(activeForm).length === 0) {
469
+ handleAddNewForm(false);
470
+ }
461
471
  }
462
472
  }
463
473
  }
@@ -595,8 +605,7 @@ const GenericDynamic = ({
595
605
  </div>
596
606
  <div className={styles.formcontainer}>
597
607
  <div className={styles.modalForm}>
598
- {multiple &&
599
- typeof activeForm === 'object' &&
608
+ {typeof activeForm === 'object' &&
600
609
  !Array.isArray(activeForm)
601
610
  ? Object.entries(activeForm)
602
611
  .filter(
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "@nivo/core": "^0.87.0",
6
6
  "@nivo/line": "^0.87.0",
7
7
  "@nivo/pie": "^0.87.0",
8
- "@tinymce/tinymce-react": "^5.0.1",
8
+ "@tinymce/tinymce-react": "^5.1.1",
9
9
  "add": "^2.0.6",
10
10
  "akar-icons": "^1.9.31",
11
11
  "array-move": "^4.0.0",
@@ -13,12 +13,12 @@
13
13
  "axios": "^1.7.2",
14
14
  "dayjs": "^1.11.11",
15
15
  "file-saver": "^2.0.5",
16
- "framer-motion": "^11.2.6",
16
+ "framer-motion": "^11.2.10",
17
17
  "html-react-parser": "^5.1.10",
18
18
  "lodash": "^4.17.21",
19
19
  "lodash.debounce": "^4.0.8",
20
20
  "moment": "^2.30.1",
21
- "motion": "^10.17.0",
21
+ "motion": "^10.18.0",
22
22
  "numeral": "^2.0.6",
23
23
  "pluralize": "^8.0.0",
24
24
  "quill-image-uploader": "^1.3.0",
@@ -28,19 +28,19 @@
28
28
  "react-datepicker": "^6.9.0",
29
29
  "react-dropzone": "^14.2.3",
30
30
  "react-grid-gallery": "^1.0.1",
31
- "react-number-format": "^5.3.4",
31
+ "react-number-format": "^5.4.0",
32
32
  "react-password-strength-bar": "^0.4.1",
33
33
  "react-promise-tracker": "^2.1.1",
34
34
  "react-quill": "^2.0.0",
35
35
  "react-reveal": "^1.2.2",
36
36
  "react-select": "^5.8.0",
37
- "react-signature-pad-wrapper": "^3.4.0",
37
+ "react-signature-pad-wrapper": "^3.4.1",
38
38
  "react-slugify": "^3.0.3",
39
39
  "react-sortable-hoc": "^2.0.0",
40
40
  "react-to-print": "^2.15.1",
41
41
  "react-toastify": "^10.0.5",
42
42
  "react-toggle": "^4.1.3",
43
- "react-tooltip": "^5.26.4",
43
+ "react-tooltip": "^5.27.0",
44
44
  "react-window": "^1.8.10",
45
45
  "reactjs-popup": "^2.0.6",
46
46
  "truncate": "^3.0.0",
@@ -57,7 +57,7 @@
57
57
  "react-dom": "^17.0.1"
58
58
  },
59
59
  "name": "@visns-studio/visns-components",
60
- "version": "4.2.2",
60
+ "version": "4.2.4",
61
61
  "description": "Various packages to assist in the development of our Custom Applications.",
62
62
  "main": "index.js",
63
63
  "scripts": {