@visns-studio/visns-components 4.1.2 → 4.1.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.
@@ -468,6 +468,29 @@ function Form({
468
468
  }
469
469
  };
470
470
 
471
+ const handleSort = async (e) => {
472
+ try {
473
+ if (e) {
474
+ e.preventDefault();
475
+ }
476
+
477
+ const url = formSettings.sortButton.url;
478
+ const method = 'POST';
479
+
480
+ const res = await CustomFetch(url, method, {
481
+ id: formData[formSettings.primaryKey],
482
+ });
483
+
484
+ if (res.data.error === '') {
485
+ toast.success('Files successfully sorted by name.');
486
+
487
+ fetchData();
488
+ }
489
+ } catch (err) {
490
+ console.info(err);
491
+ }
492
+ };
493
+
471
494
  const handleSubmit = async (e) => {
472
495
  try {
473
496
  if (e) {
@@ -1255,11 +1278,20 @@ function Form({
1255
1278
  </button>
1256
1279
  )}
1257
1280
 
1258
- <button className="btn" onClick={handleSubmit}>
1259
- {formSettings?.save?.button?.label
1260
- ? formSettings.save.button.label
1261
- : 'Save'}
1262
- </button>
1281
+ {formSettings.hasOwnProperty('sortButton') &&
1282
+ formSettings.sortButton.url ? (
1283
+ <button className="btn" onClick={handleSort}>
1284
+ {formSettings.sortButton.label
1285
+ ? formSettings.sortButton.label
1286
+ : 'Sort'}
1287
+ </button>
1288
+ ) : (
1289
+ <button className="btn" onClick={handleSubmit}>
1290
+ {formSettings?.save?.button?.label
1291
+ ? formSettings.save.button.label
1292
+ : 'Save'}
1293
+ </button>
1294
+ )}
1263
1295
  </div>
1264
1296
  </div>
1265
1297
  );
@@ -41,7 +41,7 @@
41
41
  }
42
42
 
43
43
  .link:hover {
44
- background: var(--item-color) !important;
44
+ background: var(--primary-color) !important;
45
45
  }
46
46
 
47
47
  .activetab button {
package/package.json CHANGED
@@ -57,7 +57,7 @@
57
57
  "react-dom": "^17.0.1"
58
58
  },
59
59
  "name": "@visns-studio/visns-components",
60
- "version": "4.1.2",
60
+ "version": "4.1.4",
61
61
  "description": "Various packages to assist in the development of our Custom Applications.",
62
62
  "main": "index.js",
63
63
  "scripts": {