@visns-studio/visns-components 2.4.2 → 2.4.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.
package/components/cms/Field.jsx
CHANGED
|
@@ -464,7 +464,11 @@ const Field = ({
|
|
|
464
464
|
inputValue === null ? '' : inputValue
|
|
465
465
|
}
|
|
466
466
|
options={settings.options}
|
|
467
|
-
|
|
467
|
+
multi={
|
|
468
|
+
settings.multiple
|
|
469
|
+
? settings.multiple
|
|
470
|
+
: false
|
|
471
|
+
}
|
|
468
472
|
/>
|
|
469
473
|
);
|
|
470
474
|
break;
|
|
@@ -478,7 +482,11 @@ const Field = ({
|
|
|
478
482
|
inputValue === null ? '' : inputValue
|
|
479
483
|
}
|
|
480
484
|
options={options}
|
|
481
|
-
|
|
485
|
+
multi={
|
|
486
|
+
settings.multiple
|
|
487
|
+
? settings.multiple
|
|
488
|
+
: false
|
|
489
|
+
}
|
|
482
490
|
/>
|
|
483
491
|
);
|
|
484
492
|
break;
|
|
@@ -6,11 +6,8 @@ import { toast } from 'react-toastify';
|
|
|
6
6
|
import CustomFetch from '../../crm/Fetch';
|
|
7
7
|
import SortableList from '../sorting/List';
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
const { form } = location.state;
|
|
12
|
-
const [data, setData] = useState([]);
|
|
13
|
-
const url = form.url;
|
|
9
|
+
const ChildSort = ({ item, url }) => {
|
|
10
|
+
const [data, setData] = useState(item.child);
|
|
14
11
|
|
|
15
12
|
const onSortEnd = ({ oldIndex, newIndex }) => {
|
|
16
13
|
setData((prevItem) => arrayMoveImmutable(prevItem, oldIndex, newIndex));
|
|
@@ -34,6 +31,50 @@ function CmsSort({}) {
|
|
|
34
31
|
}
|
|
35
32
|
}, [data]);
|
|
36
33
|
|
|
34
|
+
return (
|
|
35
|
+
<>
|
|
36
|
+
<h1>{item.label}</h1>
|
|
37
|
+
<SortableList
|
|
38
|
+
items={data}
|
|
39
|
+
onSortEnd={onSortEnd}
|
|
40
|
+
axis="xy"
|
|
41
|
+
helperClass="dragitem"
|
|
42
|
+
transitionDuration={250}
|
|
43
|
+
/>
|
|
44
|
+
</>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const CmsSort = ({ setting, category = false }) => {
|
|
49
|
+
const location = useLocation();
|
|
50
|
+
const { form } = setting;
|
|
51
|
+
const [data, setData] = useState([]);
|
|
52
|
+
const url = form.url;
|
|
53
|
+
|
|
54
|
+
const onSortEnd = ({ oldIndex, newIndex }) => {
|
|
55
|
+
setData((prevItem) => arrayMoveImmutable(prevItem, oldIndex, newIndex));
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
if (category === false) {
|
|
60
|
+
if (data.length > 0) {
|
|
61
|
+
CustomFetch(
|
|
62
|
+
url + '/sort_update',
|
|
63
|
+
'POST',
|
|
64
|
+
{
|
|
65
|
+
list: data,
|
|
66
|
+
},
|
|
67
|
+
function (result) {
|
|
68
|
+
if (result.error === '') {
|
|
69
|
+
} else {
|
|
70
|
+
toast.error(String(result.error));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}, [data]);
|
|
77
|
+
|
|
37
78
|
useEffect(() => {
|
|
38
79
|
CustomFetch(url + '/sort_list', 'POST', {}, function (result) {
|
|
39
80
|
setData(result);
|
|
@@ -52,18 +93,29 @@ function CmsSort({}) {
|
|
|
52
93
|
<div className="grid">
|
|
53
94
|
<div className="grid__row">
|
|
54
95
|
<div className="grid__full">
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
96
|
+
{category === false ? (
|
|
97
|
+
<SortableList
|
|
98
|
+
items={data}
|
|
99
|
+
onSortEnd={onSortEnd}
|
|
100
|
+
axis="xy"
|
|
101
|
+
helperClass="dragitem"
|
|
102
|
+
transitionDuration={250}
|
|
103
|
+
/>
|
|
104
|
+
) : (
|
|
105
|
+
data.length > 0 &&
|
|
106
|
+
data.map((item) => (
|
|
107
|
+
<ChildSort
|
|
108
|
+
key={`category-${item.id}`}
|
|
109
|
+
item={item}
|
|
110
|
+
url={url}
|
|
111
|
+
/>
|
|
112
|
+
))
|
|
113
|
+
)}
|
|
62
114
|
</div>
|
|
63
115
|
</div>
|
|
64
116
|
</div>
|
|
65
117
|
</Reveal>
|
|
66
118
|
);
|
|
67
|
-
}
|
|
119
|
+
};
|
|
68
120
|
|
|
69
121
|
export default CmsSort;
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
Clipboard,
|
|
10
10
|
DoubleSword,
|
|
11
11
|
Draft,
|
|
12
|
+
Envelope,
|
|
12
13
|
Gear,
|
|
13
14
|
Grid,
|
|
14
15
|
Home,
|
|
@@ -113,6 +114,7 @@ function Navigation({
|
|
|
113
114
|
clipboard: Clipboard,
|
|
114
115
|
doubleSword: DoubleSword,
|
|
115
116
|
draft: Draft,
|
|
117
|
+
envelope: Envelope,
|
|
116
118
|
gear: Gear,
|
|
117
119
|
grid: Grid,
|
|
118
120
|
home: Home,
|
package/package.json
CHANGED