@visns-studio/visns-components 5.12.8 → 5.12.9
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 +1 -1
- package/src/components/CategorizedDropZone.jsx +27 -2
- package/src/components/DropZone.jsx +6 -2
- package/src/components/Form.jsx +1 -1
- package/src/components/generic/CmsSort.jsx +10 -2
- package/src/components/generic/ConfirmationDialog.jsx +16 -3
- package/src/components/generic/GenericDashboard.jsx +1 -1
- package/src/components/generic/GenericDynamic.jsx +1 -1
- package/src/components/generic/GenericEditableTable.jsx +1 -1
- package/src/components/generic/GenericFormBuilder.jsx +1 -1
- package/src/components/generic/GenericSort.jsx +8 -1
- package/src/components/styles/CategorizedDropZone.module.scss +5 -0
- package/src/components/styles/GenericEditableTable.module.scss.backup +488 -0
- package/src/components/utils/ConfirmDialog.js +4 -10
- package/src/index.js +6 -0
- package/src/utils/ConfirmDialog.jsx +11 -65
package/package.json
CHANGED
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"react-dom": "^17.0.0 || ^18.0.0"
|
|
88
88
|
},
|
|
89
89
|
"name": "@visns-studio/visns-components",
|
|
90
|
-
"version": "5.12.
|
|
90
|
+
"version": "5.12.9",
|
|
91
91
|
"description": "Various packages to assist in the development of our Custom Applications.",
|
|
92
92
|
"main": "src/index.js",
|
|
93
93
|
"files": [
|
|
@@ -222,10 +222,35 @@ const CategorizedDropZone = ({
|
|
|
222
222
|
}
|
|
223
223
|
|
|
224
224
|
if (finalCategories.length === 0) {
|
|
225
|
+
// No categories available - show a simple dropzone without categorization
|
|
226
|
+
console.log('CategorizedDropZone: No categories, showing all files', {
|
|
227
|
+
dataKey,
|
|
228
|
+
files: entityData[dataKey] || [],
|
|
229
|
+
entityData
|
|
230
|
+
});
|
|
231
|
+
|
|
225
232
|
return (
|
|
226
233
|
<div className={styles.categorizedDropZone}>
|
|
227
|
-
<div className={styles.
|
|
228
|
-
|
|
234
|
+
<div className={styles.noCategoryContent}>
|
|
235
|
+
<DropZone
|
|
236
|
+
fetchData={fetchData || (() => {
|
|
237
|
+
console.log('Files updated (no categories)');
|
|
238
|
+
})}
|
|
239
|
+
files={entityData[dataKey] || []}
|
|
240
|
+
settings={{
|
|
241
|
+
url: url,
|
|
242
|
+
method: method,
|
|
243
|
+
type: 'gallery',
|
|
244
|
+
data: {
|
|
245
|
+
file_relationship: file_relationship,
|
|
246
|
+
file_description: '',
|
|
247
|
+
},
|
|
248
|
+
model: entityData?.constructor?.name || 'Design',
|
|
249
|
+
folder: folder,
|
|
250
|
+
filetype: filetype,
|
|
251
|
+
deleteUrl: deleteUrl
|
|
252
|
+
}}
|
|
253
|
+
/>
|
|
229
254
|
</div>
|
|
230
255
|
</div>
|
|
231
256
|
);
|
|
@@ -7,7 +7,7 @@ import { arrayMoveImmutable } from 'array-move';
|
|
|
7
7
|
import Popup from 'reactjs-popup';
|
|
8
8
|
import imageCompression from 'browser-image-compression';
|
|
9
9
|
|
|
10
|
-
import { confirmDialog } from '
|
|
10
|
+
import { confirmDialog } from './utils/ConfirmDialog';
|
|
11
11
|
import CustomFetch from './Fetch';
|
|
12
12
|
import Gallery from './Gallery';
|
|
13
13
|
import styles from './styles/DropZone.module.css';
|
|
@@ -189,14 +189,18 @@ function VisnsDropZone({ fetchData, files, settings }) {
|
|
|
189
189
|
|
|
190
190
|
useEffect(() => {
|
|
191
191
|
if (data?.length > 0) {
|
|
192
|
+
// Only send the ID field for each file for sorting
|
|
193
|
+
const sortData = data.map(file => ({ id: file.id }));
|
|
194
|
+
|
|
192
195
|
CustomFetch(
|
|
193
196
|
'/ajax/files/sort_update',
|
|
194
197
|
'POST',
|
|
195
198
|
{
|
|
196
|
-
list:
|
|
199
|
+
list: sortData,
|
|
197
200
|
},
|
|
198
201
|
function (result) {
|
|
199
202
|
if (result.error === '') {
|
|
203
|
+
console.log('Sort order updated successfully');
|
|
200
204
|
} else {
|
|
201
205
|
toast.error(String(result.error));
|
|
202
206
|
}
|
package/src/components/Form.jsx
CHANGED
|
@@ -11,7 +11,7 @@ import _ from 'lodash';
|
|
|
11
11
|
import ReactDataGrid from '@visns-studio/visns-datagrid-enterprise';
|
|
12
12
|
import { X } from 'lucide-react';
|
|
13
13
|
import imageCompression from 'browser-image-compression';
|
|
14
|
-
import { confirmDialog } from '
|
|
14
|
+
import { confirmDialog } from './utils/ConfirmDialog';
|
|
15
15
|
|
|
16
16
|
import '@visns-studio/visns-datagrid-enterprise/index.css';
|
|
17
17
|
|
|
@@ -15,14 +15,18 @@ const ChildSort = ({ item, url }) => {
|
|
|
15
15
|
|
|
16
16
|
useEffect(() => {
|
|
17
17
|
if (data.length > 0) {
|
|
18
|
+
// Only send the ID field for each item for sorting
|
|
19
|
+
const sortData = data.map(item => ({ id: item.id }));
|
|
20
|
+
|
|
18
21
|
CustomFetch(
|
|
19
22
|
url + '/sort_update',
|
|
20
23
|
'POST',
|
|
21
24
|
{
|
|
22
|
-
list:
|
|
25
|
+
list: sortData,
|
|
23
26
|
},
|
|
24
27
|
function (result) {
|
|
25
28
|
if (result.error === '') {
|
|
29
|
+
console.log('Sort order updated successfully');
|
|
26
30
|
} else {
|
|
27
31
|
toast.error(String(result.error));
|
|
28
32
|
}
|
|
@@ -60,14 +64,18 @@ const CmsSort = ({ setting, category = false }) => {
|
|
|
60
64
|
useEffect(() => {
|
|
61
65
|
if (category === false) {
|
|
62
66
|
if (data.length > 0) {
|
|
67
|
+
// Only send the ID field for each item for sorting
|
|
68
|
+
const sortData = data.map(item => ({ id: item.id }));
|
|
69
|
+
|
|
63
70
|
CustomFetch(
|
|
64
71
|
url + '/sort_update',
|
|
65
72
|
'POST',
|
|
66
73
|
{
|
|
67
|
-
list:
|
|
74
|
+
list: sortData,
|
|
68
75
|
},
|
|
69
76
|
function (result) {
|
|
70
77
|
if (result.error === '') {
|
|
78
|
+
console.log('Sort order updated successfully');
|
|
71
79
|
} else {
|
|
72
80
|
toast.error(String(result.error));
|
|
73
81
|
}
|
|
@@ -87,10 +87,23 @@ export const showConfirmDialog = ({
|
|
|
87
87
|
// Show SweetAlert2 dialog
|
|
88
88
|
return Swal.fire(swalOptions).then((result) => {
|
|
89
89
|
if (result.isConfirmed) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
90
|
+
try {
|
|
91
|
+
onConfirm();
|
|
92
|
+
} catch (error) {
|
|
93
|
+
console.error('Error executing onConfirm callback:', error);
|
|
94
|
+
}
|
|
95
|
+
} else if (result.dismiss === Swal.DismissReason.cancel || result.isDenied) {
|
|
96
|
+
try {
|
|
97
|
+
onCancel();
|
|
98
|
+
} catch (error) {
|
|
99
|
+
console.error('Error executing onCancel callback:', error);
|
|
100
|
+
}
|
|
93
101
|
}
|
|
102
|
+
|
|
103
|
+
return result;
|
|
104
|
+
}).catch((error) => {
|
|
105
|
+
console.error('SweetAlert2 error:', error);
|
|
106
|
+
return error;
|
|
94
107
|
});
|
|
95
108
|
};
|
|
96
109
|
|
|
@@ -9,7 +9,7 @@ import dayjs from 'dayjs';
|
|
|
9
9
|
import parse from 'html-react-parser';
|
|
10
10
|
import { createSwapy } from 'swapy';
|
|
11
11
|
import { X, Minus, Plus, Star, Trash2 } from 'lucide-react';
|
|
12
|
-
import { confirmDialog } from '
|
|
12
|
+
import { confirmDialog } from '../utils/ConfirmDialog';
|
|
13
13
|
|
|
14
14
|
import CustomFetch from '../Fetch';
|
|
15
15
|
import MultiSelect from '../MultiSelect';
|
|
@@ -4,7 +4,7 @@ import { toast } from 'react-toastify';
|
|
|
4
4
|
import { saveAs } from 'file-saver';
|
|
5
5
|
import parse from 'html-react-parser';
|
|
6
6
|
import { Delete, Download as DownloadIcon } from 'lucide-react';
|
|
7
|
-
import { confirmDialog } from '
|
|
7
|
+
import { confirmDialog } from '../utils/ConfirmDialog';
|
|
8
8
|
|
|
9
9
|
import CustomFetch from '../Fetch';
|
|
10
10
|
import Download from '../Download';
|
|
@@ -4,7 +4,7 @@ import debounce from 'lodash.debounce';
|
|
|
4
4
|
import { toast } from 'react-toastify';
|
|
5
5
|
import { Trash2, ArrowUp, ArrowDown, Copy, Droplets } from 'lucide-react';
|
|
6
6
|
import { Compact } from '@uiw/react-color';
|
|
7
|
-
import { confirmDialog } from '
|
|
7
|
+
import { confirmDialog } from '../utils/ConfirmDialog';
|
|
8
8
|
|
|
9
9
|
import CustomFetch from '../Fetch';
|
|
10
10
|
import MultiSelect from '../MultiSelect';
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
Edit as Pencil,
|
|
35
35
|
GripVertical as ChevronVertical,
|
|
36
36
|
} from 'lucide-react';
|
|
37
|
-
import { confirmDialog } from '
|
|
37
|
+
import { confirmDialog } from '../utils/ConfirmDialog';
|
|
38
38
|
|
|
39
39
|
import 'react-toggle/style.css';
|
|
40
40
|
import 'react-datepicker/dist/react-datepicker.css';
|
|
@@ -26,11 +26,14 @@ const ChildSort = ({ item, url }) => {
|
|
|
26
26
|
|
|
27
27
|
useEffect(() => {
|
|
28
28
|
if (data.length > 0) {
|
|
29
|
+
// Only send the ID field for each item for sorting
|
|
30
|
+
const sortData = data.map(item => ({ id: item.id }));
|
|
31
|
+
|
|
29
32
|
CustomFetch(
|
|
30
33
|
`${url}/sort_update`,
|
|
31
34
|
'POST',
|
|
32
35
|
{
|
|
33
|
-
list:
|
|
36
|
+
list: sortData,
|
|
34
37
|
},
|
|
35
38
|
function (result) {
|
|
36
39
|
if (result.error === '') {
|
|
@@ -108,6 +111,8 @@ const GenericSort = ({ category = false, layout = 'full' }) => {
|
|
|
108
111
|
payload.id = paramValue;
|
|
109
112
|
} else {
|
|
110
113
|
fetchUrl = fetchUrl + '/sort_update';
|
|
114
|
+
// For the standard sort_update endpoint, only send IDs
|
|
115
|
+
payload.list = sortData.map(item => ({ id: item.id }));
|
|
111
116
|
}
|
|
112
117
|
|
|
113
118
|
if (category === false) {
|
|
@@ -116,6 +121,8 @@ const GenericSort = ({ category = false, layout = 'full' }) => {
|
|
|
116
121
|
|
|
117
122
|
if (res.data.error !== '') {
|
|
118
123
|
toast.error(String(res.data.error));
|
|
124
|
+
} else {
|
|
125
|
+
toast.success('Sort updated successfully');
|
|
119
126
|
}
|
|
120
127
|
}
|
|
121
128
|
}
|
|
@@ -0,0 +1,488 @@
|
|
|
1
|
+
.schedulingTable {
|
|
2
|
+
width: 100%;
|
|
3
|
+
border-collapse: collapse;
|
|
4
|
+
margin: 0.5em 0; // Reduced margin
|
|
5
|
+
|
|
6
|
+
th,
|
|
7
|
+
td {
|
|
8
|
+
padding: 0.2rem; // Reduced padding for cells
|
|
9
|
+
text-align: left;
|
|
10
|
+
border: 1px solid rgba(var(--primary-rgb), 0.1);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
th {
|
|
14
|
+
padding: 0.25rem 0.5rem; // Less padding than before
|
|
15
|
+
font-size: 0.9rem; // Slightly smaller font size
|
|
16
|
+
font-weight: bold;
|
|
17
|
+
background-color: var(--primary-color);
|
|
18
|
+
color: white;
|
|
19
|
+
text-align: center;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
td {
|
|
23
|
+
background-color: rgba(var(--primary-rgb), 0.05);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/* Compact styling for native input and select elements */
|
|
27
|
+
input,
|
|
28
|
+
select {
|
|
29
|
+
padding: 0.25rem 0.5rem;
|
|
30
|
+
margin: 0;
|
|
31
|
+
font-size: 0.85rem;
|
|
32
|
+
height: 28px;
|
|
33
|
+
line-height: 1;
|
|
34
|
+
border: 1px solid rgba(var(--primary-rgb), 0.1);
|
|
35
|
+
box-sizing: border-box;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.categoryRow {
|
|
40
|
+
background-color: rgba(var(--primary-rgb), 0.15);
|
|
41
|
+
font-size: 1rem; // Reduced font size
|
|
42
|
+
font-weight: bold;
|
|
43
|
+
text-align: left;
|
|
44
|
+
padding: 0.5rem 0.75rem; // Reduced padding
|
|
45
|
+
border-bottom: 2px solid var(--primary-color);
|
|
46
|
+
color: var(--primary-color);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.totalRow {
|
|
50
|
+
background-color: rgba(var(--primary-rgb), 0.05);
|
|
51
|
+
font-weight: bold;
|
|
52
|
+
text-align: right;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.noDataMessage {
|
|
56
|
+
text-align: center;
|
|
57
|
+
color: var(--secondary-color);
|
|
58
|
+
font-size: 1rem;
|
|
59
|
+
padding: 1em;
|
|
60
|
+
margin: 1em auto;
|
|
61
|
+
background: #f9f9f9;
|
|
62
|
+
border: 1px solid #ddd;
|
|
63
|
+
border-radius: 6px;
|
|
64
|
+
max-width: 600px;
|
|
65
|
+
box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
|
|
66
|
+
font-style: italic;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.polActions {
|
|
70
|
+
position: fixed;
|
|
71
|
+
bottom: 15px;
|
|
72
|
+
right: 20px;
|
|
73
|
+
width: auto;
|
|
74
|
+
|
|
75
|
+
button {
|
|
76
|
+
display: block;
|
|
77
|
+
padding: 0.35em 1em;
|
|
78
|
+
margin: 0 0.15em;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.gridtxt {
|
|
83
|
+
&__header {
|
|
84
|
+
width: 100%;
|
|
85
|
+
display: block;
|
|
86
|
+
background: rgba(var(--primary-rgb), 0.05);
|
|
87
|
+
box-sizing: border-box;
|
|
88
|
+
padding: 10px 20px;
|
|
89
|
+
border-radius: var(--br);
|
|
90
|
+
margin-bottom: 0;
|
|
91
|
+
font-weight: 700;
|
|
92
|
+
text-align: center;
|
|
93
|
+
color: var(--paragraph-color);
|
|
94
|
+
|
|
95
|
+
span {
|
|
96
|
+
font-weight: 700;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
> ul {
|
|
101
|
+
width: 100%;
|
|
102
|
+
display: flex;
|
|
103
|
+
justify-content: flex-start;
|
|
104
|
+
flex-wrap: wrap;
|
|
105
|
+
list-style: none;
|
|
106
|
+
padding: 0.85rem;
|
|
107
|
+
margin: 0;
|
|
108
|
+
|
|
109
|
+
li {
|
|
110
|
+
flex: 0 0 calc(50% - 10px);
|
|
111
|
+
padding: 0.65rem;
|
|
112
|
+
border: 1px solid rgba(var(--primary-rgb), 0.095);
|
|
113
|
+
color: var(--paragraph-color);
|
|
114
|
+
background: rgba(var(--primary-rgb), 0.015);
|
|
115
|
+
margin: 3px;
|
|
116
|
+
border-radius: var(--br);
|
|
117
|
+
line-height: 1.45;
|
|
118
|
+
font-size: 0.85rem;
|
|
119
|
+
|
|
120
|
+
&.fw-grid-item {
|
|
121
|
+
flex: 0 0 calc(100% - 10px);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
&.notecolor {
|
|
125
|
+
border: 1px solid var(--secondary-color);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.btn {
|
|
132
|
+
width: max-content;
|
|
133
|
+
display: inline-block;
|
|
134
|
+
position: relative;
|
|
135
|
+
padding: 0.65rem 1rem;
|
|
136
|
+
cursor: pointer;
|
|
137
|
+
font-size: 1rem;
|
|
138
|
+
color: var(--tertiary-color);
|
|
139
|
+
text-decoration: none;
|
|
140
|
+
overflow: hidden;
|
|
141
|
+
background: var(--primary-color);
|
|
142
|
+
border: 1px solid rgba(var(--primary-color--rgb), 1.1);
|
|
143
|
+
border-radius: var(--br);
|
|
144
|
+
outline: none;
|
|
145
|
+
transition: all 0.2s cubic-bezier(0.85, 0, 0.15, 1) 0s;
|
|
146
|
+
font-size: 1.25em;
|
|
147
|
+
|
|
148
|
+
&:hover {
|
|
149
|
+
color: var(--primary-color);
|
|
150
|
+
background: var(--highlight-color);
|
|
151
|
+
border: 1px solid rgba(var(--highlight-rgb), 1.05);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.btn_compact {
|
|
156
|
+
width: max-content;
|
|
157
|
+
display: inline-block;
|
|
158
|
+
position: relative;
|
|
159
|
+
padding: 0.4rem 0.75rem; /* Reduced padding for a compact look */
|
|
160
|
+
cursor: pointer;
|
|
161
|
+
font-size: 1rem; /* Slightly smaller font size */
|
|
162
|
+
color: var(--tertiary-color);
|
|
163
|
+
text-decoration: none;
|
|
164
|
+
overflow: hidden;
|
|
165
|
+
background: var(--primary-color);
|
|
166
|
+
border: 1px solid rgba(var(--primary-color--rgb), 1.1);
|
|
167
|
+
border-radius: var(--br);
|
|
168
|
+
outline: none;
|
|
169
|
+
transition: all 0.2s cubic-bezier(0.85, 0, 0.15, 1) 0s;
|
|
170
|
+
|
|
171
|
+
&:hover {
|
|
172
|
+
color: var(--primary-color);
|
|
173
|
+
background: var(--highlight-color);
|
|
174
|
+
border: 1px solid rgba(var(--highlight-rgb), 1.05);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.tdactions {
|
|
179
|
+
width: 100%;
|
|
180
|
+
display: flex;
|
|
181
|
+
flex-wrap: nowrap;
|
|
182
|
+
justify-content: flex-start;
|
|
183
|
+
align-items: center;
|
|
184
|
+
gap: 0.1rem;
|
|
185
|
+
|
|
186
|
+
span {
|
|
187
|
+
display: flex;
|
|
188
|
+
align-items: center;
|
|
189
|
+
position: relative;
|
|
190
|
+
width: 16px;
|
|
191
|
+
height: 16px;
|
|
192
|
+
|
|
193
|
+
svg {
|
|
194
|
+
width: 16px;
|
|
195
|
+
height: 16px;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.noDataMessage {
|
|
201
|
+
text-align: center;
|
|
202
|
+
color: var(--primary-color);
|
|
203
|
+
font-size: 1rem;
|
|
204
|
+
padding: 2rem;
|
|
205
|
+
margin: 2rem auto;
|
|
206
|
+
background-color: var(--secondary-bg-color, #f8f8f8);
|
|
207
|
+
border: 1px solid rgba(var(--primary-rgb), 0.15);
|
|
208
|
+
border-radius: 6px;
|
|
209
|
+
max-width: 80%;
|
|
210
|
+
box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
|
|
211
|
+
font-weight: 500;
|
|
212
|
+
font-family: var(--font-family, Arial, sans-serif);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.noDataMessage:hover {
|
|
216
|
+
background-color: rgba(var(--primary-rgb), 0.05);
|
|
217
|
+
border-color: rgba(var(--primary-rgb), 0.2);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.subtotalRow {
|
|
221
|
+
background-color: rgba(var(--secondary-rgb), 0.15);
|
|
222
|
+
font-weight: bold;
|
|
223
|
+
text-align: right;
|
|
224
|
+
padding: 0.5em; // Reduced padding
|
|
225
|
+
font-size: 0.8rem; // Reduced font size
|
|
226
|
+
color: var(--primary-color);
|
|
227
|
+
border-top: 2px solid var(--primary-color);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.colour {
|
|
231
|
+
&__cover {
|
|
232
|
+
position: fixed;
|
|
233
|
+
top: 0;
|
|
234
|
+
right: 0;
|
|
235
|
+
bottom: 0;
|
|
236
|
+
left: 0;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
&__popover {
|
|
240
|
+
position: absolute;
|
|
241
|
+
z-index: 9999;
|
|
242
|
+
left: 50%;
|
|
243
|
+
top: 50%;
|
|
244
|
+
transform: translate(-50%, -50%);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/* Compact Inline Color Picker Styles */
|
|
249
|
+
.cpicker-inline {
|
|
250
|
+
width: 100%;
|
|
251
|
+
display: flex;
|
|
252
|
+
flex-direction: column;
|
|
253
|
+
gap: 8px;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.cpicker-preview-container {
|
|
257
|
+
display: flex;
|
|
258
|
+
align-items: center;
|
|
259
|
+
gap: 8px;
|
|
260
|
+
padding: 6px 10px;
|
|
261
|
+
background: #f8f9fa;
|
|
262
|
+
border: 1px solid #dee2e6;
|
|
263
|
+
border-radius: 6px;
|
|
264
|
+
min-height: 40px;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.cpicker__box {
|
|
268
|
+
width: 28px;
|
|
269
|
+
height: 28px;
|
|
270
|
+
border: 2px solid #dee2e6;
|
|
271
|
+
border-radius: 6px;
|
|
272
|
+
background-color: #ffffff;
|
|
273
|
+
position: relative;
|
|
274
|
+
overflow: hidden;
|
|
275
|
+
transition: all 0.2s ease;
|
|
276
|
+
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
277
|
+
flex-shrink: 0;
|
|
278
|
+
|
|
279
|
+
/* Checkerboard pattern for transparency */
|
|
280
|
+
background-image:
|
|
281
|
+
linear-gradient(45deg, #f0f0f0 25%, transparent 25%),
|
|
282
|
+
linear-gradient(-45deg, #f0f0f0 25%, transparent 25%),
|
|
283
|
+
linear-gradient(45deg, transparent 75%, #f0f0f0 75%),
|
|
284
|
+
linear-gradient(-45deg, transparent 75%, #f0f0f0 75%);
|
|
285
|
+
background-size: 6px 6px;
|
|
286
|
+
background-position: 0 0, 0 3px, 3px -3px, -3px 0px;
|
|
287
|
+
|
|
288
|
+
/* When no color is selected */
|
|
289
|
+
&[style=""] {
|
|
290
|
+
background:
|
|
291
|
+
linear-gradient(45deg,
|
|
292
|
+
transparent 40%,
|
|
293
|
+
#dc3545 42%,
|
|
294
|
+
#dc3545 58%,
|
|
295
|
+
transparent 60%
|
|
296
|
+
),
|
|
297
|
+
linear-gradient(-45deg,
|
|
298
|
+
transparent 40%,
|
|
299
|
+
#dc3545 42%,
|
|
300
|
+
#dc3545 58%,
|
|
301
|
+
transparent 60%
|
|
302
|
+
),
|
|
303
|
+
#ffffff;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.cpicker-value {
|
|
308
|
+
font-size: 0.8rem;
|
|
309
|
+
font-weight: 500;
|
|
310
|
+
color: #495057;
|
|
311
|
+
font-family: 'Courier New', monospace;
|
|
312
|
+
background: rgba(255, 255, 255, 0.9);
|
|
313
|
+
padding: 3px 6px;
|
|
314
|
+
border-radius: 3px;
|
|
315
|
+
border: 1px solid rgba(0, 0, 0, 0.1);
|
|
316
|
+
flex-grow: 1;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
.cpicker-container {
|
|
320
|
+
width: 100%;
|
|
321
|
+
display: flex;
|
|
322
|
+
justify-content: center;
|
|
323
|
+
padding: 8px;
|
|
324
|
+
background: #ffffff;
|
|
325
|
+
border: 1px solid #dee2e6;
|
|
326
|
+
border-radius: 6px;
|
|
327
|
+
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
|
|
328
|
+
|
|
329
|
+
/* Ensure Sketch picker fits well and is more compact */
|
|
330
|
+
.w-color-sketch {
|
|
331
|
+
box-shadow: none !important;
|
|
332
|
+
border: none !important;
|
|
333
|
+
border-radius: 6px !important;
|
|
334
|
+
max-width: 100% !important;
|
|
335
|
+
transform: scale(0.85) !important;
|
|
336
|
+
transform-origin: center top !important;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/* Further responsive scaling */
|
|
340
|
+
@media (max-width: 768px) {
|
|
341
|
+
padding: 6px;
|
|
342
|
+
|
|
343
|
+
.w-color-sketch {
|
|
344
|
+
transform: scale(0.75) !important;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
@media (max-width: 480px) {
|
|
349
|
+
padding: 4px;
|
|
350
|
+
|
|
351
|
+
.w-color-sketch {
|
|
352
|
+
transform: scale(0.65) !important;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
.colour_popover {
|
|
359
|
+
position: absolute;
|
|
360
|
+
background: white;
|
|
361
|
+
border-radius: 8px;
|
|
362
|
+
box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.15);
|
|
363
|
+
padding: 10px;
|
|
364
|
+
min-width: 200px;
|
|
365
|
+
display: flex;
|
|
366
|
+
flex-direction: column;
|
|
367
|
+
align-items: center;
|
|
368
|
+
z-index: 1000;
|
|
369
|
+
|
|
370
|
+
.clearContainer {
|
|
371
|
+
width: 100%;
|
|
372
|
+
display: flex;
|
|
373
|
+
justify-content: center;
|
|
374
|
+
margin-top: 8px;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
.clearButton {
|
|
378
|
+
width: 100%; /* Make button span the entire width */
|
|
379
|
+
background: rgba(
|
|
380
|
+
var(--primary-rgb),
|
|
381
|
+
0.1
|
|
382
|
+
); /* Soft transparent background */
|
|
383
|
+
color: var(--primary-color);
|
|
384
|
+
border: none;
|
|
385
|
+
border-top: 1px solid rgba(var(--primary-rgb), 0.2); /* Subtle separator */
|
|
386
|
+
border-radius: 0 0 8px 8px; /* Match colour picker's bottom corners */
|
|
387
|
+
font-size: 13px;
|
|
388
|
+
padding: 8px;
|
|
389
|
+
cursor: pointer;
|
|
390
|
+
transition: background 0.2s, border 0.2s, box-shadow 0.2s;
|
|
391
|
+
font-weight: 500;
|
|
392
|
+
text-align: center;
|
|
393
|
+
box-shadow: inset 0px 1px 3px rgba(0, 0, 0, 0.05);
|
|
394
|
+
|
|
395
|
+
&:hover {
|
|
396
|
+
background: rgba(var(--primary-rgb), 0.15);
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
&:active {
|
|
400
|
+
background: rgba(var(--primary-rgb), 0.25);
|
|
401
|
+
box-shadow: inset 0px 1px 3px rgba(0, 0, 0, 0.15);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/* Compact styling for react-select components */
|
|
407
|
+
.react-select__control {
|
|
408
|
+
min-height: 28px;
|
|
409
|
+
padding: 0;
|
|
410
|
+
font-size: 0.85rem;
|
|
411
|
+
border: 1px solid rgba(var(--primary-rgb), 0.1);
|
|
412
|
+
box-sizing: border-box;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
.react-select__value-container {
|
|
416
|
+
padding: 0 0.5rem;
|
|
417
|
+
margin: 0;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
.react-select__input {
|
|
421
|
+
margin: 0;
|
|
422
|
+
padding: 0;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
.react-select__indicator-separator {
|
|
426
|
+
display: none;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
.react-select__indicators {
|
|
430
|
+
padding: 0 0.25rem;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
.newRow {
|
|
434
|
+
background-color: rgba(
|
|
435
|
+
var(--primary-rgb),
|
|
436
|
+
0.15
|
|
437
|
+
); /* Slightly lighter background */
|
|
438
|
+
border-top: 1px dashed rgba(var(--primary-rgb), 0.3);
|
|
439
|
+
border-bottom: 1px dashed rgba(var(--primary-rgb), 0.3);
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
.datasetSelector {
|
|
443
|
+
display: flex;
|
|
444
|
+
align-items: center;
|
|
445
|
+
gap: 1rem;
|
|
446
|
+
margin-bottom: 1rem;
|
|
447
|
+
padding: 0.5rem 1rem;
|
|
448
|
+
background: rgba(var(--primary-rgb), 0.05);
|
|
449
|
+
border: 1px solid rgba(var(--primary-rgb), 0.15);
|
|
450
|
+
border-radius: var(--br);
|
|
451
|
+
|
|
452
|
+
label {
|
|
453
|
+
font-size: 0.9rem;
|
|
454
|
+
font-weight: bold;
|
|
455
|
+
color: var(--paragraph-color);
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
select {
|
|
459
|
+
padding: 0.4rem 0.75rem;
|
|
460
|
+
font-size: 0.9rem;
|
|
461
|
+
border: 1px solid rgba(var(--primary-rgb), 0.1);
|
|
462
|
+
border-radius: var(--br);
|
|
463
|
+
background: #fff;
|
|
464
|
+
outline: none;
|
|
465
|
+
box-shadow: none;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
/* New Dataset button styling to match .btn_compact */
|
|
469
|
+
button {
|
|
470
|
+
display: inline-block;
|
|
471
|
+
padding: 0.4rem 0.75rem;
|
|
472
|
+
font-size: 1rem;
|
|
473
|
+
color: var(--tertiary-color);
|
|
474
|
+
text-decoration: none;
|
|
475
|
+
background: var(--primary-color);
|
|
476
|
+
border: 1px solid rgba(var(--primary-color--rgb), 1.1);
|
|
477
|
+
border-radius: var(--br);
|
|
478
|
+
outline: none;
|
|
479
|
+
cursor: pointer;
|
|
480
|
+
transition: all 0.2s cubic-bezier(0.85, 0, 0.15, 1) 0s;
|
|
481
|
+
|
|
482
|
+
&:hover {
|
|
483
|
+
color: var(--primary-color);
|
|
484
|
+
background: var(--highlight-color);
|
|
485
|
+
border: 1px solid rgba(var(--highlight-rgb), 1.05);
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import Swal from 'sweetalert2';
|
|
2
2
|
import '../styles/SweetAlert.module.css';
|
|
3
3
|
|
|
4
|
+
|
|
5
|
+
|
|
4
6
|
/**
|
|
5
7
|
* A utility function that replaces react-confirm-alert with SweetAlert2
|
|
6
8
|
* while maintaining a similar look and feel.
|
|
@@ -133,17 +135,9 @@ export const confirmDialog = (options) => {
|
|
|
133
135
|
|
|
134
136
|
// Show SweetAlert2 dialog
|
|
135
137
|
Swal.fire(swalOptions).then((result) => {
|
|
136
|
-
if (
|
|
137
|
-
result.isConfirmed &&
|
|
138
|
-
yesButton &&
|
|
139
|
-
typeof yesButton.onClick === 'function'
|
|
140
|
-
) {
|
|
138
|
+
if (result.isConfirmed && yesButton && typeof yesButton.onClick === 'function') {
|
|
141
139
|
yesButton.onClick();
|
|
142
|
-
} else if (
|
|
143
|
-
result.dismiss === Swal.DismissReason.cancel &&
|
|
144
|
-
noButton &&
|
|
145
|
-
typeof noButton.onClick === 'function'
|
|
146
|
-
) {
|
|
140
|
+
} else if (result.dismiss === Swal.DismissReason.cancel && noButton && typeof noButton.onClick === 'function') {
|
|
147
141
|
noButton.onClick();
|
|
148
142
|
}
|
|
149
143
|
});
|
package/src/index.js
CHANGED
|
@@ -4,6 +4,10 @@ import DropZone from './components/DropZone';
|
|
|
4
4
|
import CategorizedDropZone from './components/CategorizedDropZone';
|
|
5
5
|
import SortableList from './components/sorting/List';
|
|
6
6
|
|
|
7
|
+
/** Utility Components */
|
|
8
|
+
import { confirmDialog } from './components/utils/ConfirmDialog';
|
|
9
|
+
import { showConfirmDialog } from './components/generic/ConfirmationDialog';
|
|
10
|
+
|
|
7
11
|
/** CRM Components */
|
|
8
12
|
import AsyncSelect from './components/AsyncSelect';
|
|
9
13
|
import AssociationManager from './components/AssociationManager';
|
|
@@ -95,6 +99,7 @@ export {
|
|
|
95
99
|
CmsDetail,
|
|
96
100
|
CmsIndex,
|
|
97
101
|
CmsSort,
|
|
102
|
+
confirmDialog,
|
|
98
103
|
CustomFetch,
|
|
99
104
|
DataGrid,
|
|
100
105
|
DataGridSearch,
|
|
@@ -133,6 +138,7 @@ export {
|
|
|
133
138
|
SectionTypeSelector,
|
|
134
139
|
SelectList,
|
|
135
140
|
Select,
|
|
141
|
+
showConfirmDialog,
|
|
136
142
|
SortableList,
|
|
137
143
|
StagePopupModal,
|
|
138
144
|
Table,
|
|
@@ -1,67 +1,13 @@
|
|
|
1
|
-
import { toast } from 'react-toastify';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* @param {Function} options.onConfirm - Function to call when confirmed
|
|
11
|
-
* @param {Function} options.onCancel - Function to call when cancelled
|
|
2
|
+
* @deprecated This confirmDialog implementation using react-toastify is deprecated.
|
|
3
|
+
* Use the SweetAlert2 version from './components/utils/ConfirmDialog' instead.
|
|
4
|
+
*
|
|
5
|
+
* Import path should be: import { confirmDialog } from './components/utils/ConfirmDialog';
|
|
6
|
+
*
|
|
7
|
+
* This file exists only for backward compatibility and will be removed in a future version.
|
|
12
8
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
onConfirm = () => {},
|
|
19
|
-
onCancel = () => {}
|
|
20
|
-
}) => {
|
|
21
|
-
// Create a custom toast with buttons
|
|
22
|
-
toast.info(
|
|
23
|
-
<div>
|
|
24
|
-
<div style={{ fontWeight: 'bold', marginBottom: '8px' }}>{title}</div>
|
|
25
|
-
<div style={{ marginBottom: '16px' }}>{message}</div>
|
|
26
|
-
<div style={{ display: 'flex', justifyContent: 'flex-end', gap: '8px' }}>
|
|
27
|
-
<button
|
|
28
|
-
onClick={() => {
|
|
29
|
-
toast.dismiss();
|
|
30
|
-
onCancel();
|
|
31
|
-
}}
|
|
32
|
-
style={{
|
|
33
|
-
padding: '6px 12px',
|
|
34
|
-
background: '#f5f5f5',
|
|
35
|
-
border: '1px solid #ddd',
|
|
36
|
-
borderRadius: '4px',
|
|
37
|
-
cursor: 'pointer'
|
|
38
|
-
}}
|
|
39
|
-
>
|
|
40
|
-
{cancelLabel}
|
|
41
|
-
</button>
|
|
42
|
-
<button
|
|
43
|
-
onClick={() => {
|
|
44
|
-
toast.dismiss();
|
|
45
|
-
onConfirm();
|
|
46
|
-
}}
|
|
47
|
-
style={{
|
|
48
|
-
padding: '6px 12px',
|
|
49
|
-
background: '#2563eb',
|
|
50
|
-
color: 'white',
|
|
51
|
-
border: 'none',
|
|
52
|
-
borderRadius: '4px',
|
|
53
|
-
cursor: 'pointer'
|
|
54
|
-
}}
|
|
55
|
-
>
|
|
56
|
-
{confirmLabel}
|
|
57
|
-
</button>
|
|
58
|
-
</div>
|
|
59
|
-
</div>,
|
|
60
|
-
{
|
|
61
|
-
autoClose: false,
|
|
62
|
-
closeButton: false,
|
|
63
|
-
closeOnClick: false,
|
|
64
|
-
draggable: false
|
|
65
|
-
}
|
|
66
|
-
);
|
|
67
|
-
};
|
|
9
|
+
|
|
10
|
+
console.warn('DEPRECATED: You are importing confirmDialog from utils/ConfirmDialog.jsx (toastify version). Please update your import to use ./components/utils/ConfirmDialog (SweetAlert2 version) instead.');
|
|
11
|
+
|
|
12
|
+
// Re-export the correct SweetAlert2 version
|
|
13
|
+
export { confirmDialog } from '../components/utils/ConfirmDialog';
|