@visns-studio/visns-components 3.5.3 → 3.5.5
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/crm/DataGrid.jsx +55 -39
- package/components/crm/Field.jsx +62 -8
- package/package.json +1 -1
|
@@ -578,45 +578,47 @@ const DataGrid = forwardRef(
|
|
|
578
578
|
} else {
|
|
579
579
|
const column = rowProps.columns[columnIndex];
|
|
580
580
|
|
|
581
|
-
if (column.
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
if (
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
581
|
+
if (column.id !== '__checkbox-column') {
|
|
582
|
+
if (column.link && column.link.url) {
|
|
583
|
+
const fileRelationArray = column.id.split('.');
|
|
584
|
+
const linkUrl = column.link.url;
|
|
585
|
+
const linkKey = rowProps.columns[columnIndex].link.key;
|
|
586
|
+
const rowData = rowProps.data[linkKey];
|
|
587
|
+
|
|
588
|
+
if (column.link.hasOwnProperty('folder')) {
|
|
589
|
+
const linkFolder =
|
|
590
|
+
rowProps.columns[columnIndex].link.folder;
|
|
591
|
+
|
|
592
|
+
if (rowProps.data[fileRelationArray[0]]) {
|
|
593
|
+
if (linkFolder !== '') {
|
|
594
|
+
window.open(
|
|
595
|
+
`${linkUrl}${rowData}/${linkFolder}`
|
|
596
|
+
);
|
|
597
|
+
} else {
|
|
598
|
+
window.open(`${linkUrl}${rowData}`);
|
|
599
|
+
}
|
|
598
600
|
}
|
|
601
|
+
} else {
|
|
602
|
+
navigate(`${linkUrl}${rowData}`);
|
|
599
603
|
}
|
|
604
|
+
} else if (column.link && column.link.popup) {
|
|
605
|
+
const linkPopup = column.link.popup;
|
|
606
|
+
const linkKey = rowProps.columns[columnIndex].link.key;
|
|
607
|
+
const rowData = rowProps.data[linkKey];
|
|
608
|
+
|
|
609
|
+
window.open(
|
|
610
|
+
`${linkPopup}/${rowData}`,
|
|
611
|
+
'',
|
|
612
|
+
'width=1440,height=1024,menubar=1,resizable=1,status=1,titlebar=1,toolbar=1'
|
|
613
|
+
);
|
|
600
614
|
} else {
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
const linkPopup = column.link.popup;
|
|
605
|
-
const linkKey = rowProps.columns[columnIndex].link.key;
|
|
606
|
-
const rowData = rowProps.data[linkKey];
|
|
607
|
-
|
|
608
|
-
window.open(
|
|
609
|
-
`${linkPopup}/${rowData}`,
|
|
610
|
-
'',
|
|
611
|
-
'width=1440,height=1024,menubar=1,resizable=1,status=1,titlebar=1,toolbar=1'
|
|
612
|
-
);
|
|
613
|
-
} else {
|
|
614
|
-
const updateSetting = settings.find(
|
|
615
|
-
(setting) => setting.id === 'update'
|
|
616
|
-
);
|
|
615
|
+
const updateSetting = settings.find(
|
|
616
|
+
(setting) => setting.id === 'update'
|
|
617
|
+
);
|
|
617
618
|
|
|
618
|
-
|
|
619
|
-
|
|
619
|
+
if (updateSetting) {
|
|
620
|
+
modalOpen('update', rowProps.data[form.primaryKey]);
|
|
621
|
+
}
|
|
620
622
|
}
|
|
621
623
|
}
|
|
622
624
|
}
|
|
@@ -1936,10 +1938,24 @@ const DataGrid = forwardRef(
|
|
|
1936
1938
|
e.stopPropagation();
|
|
1937
1939
|
e.preventDefault();
|
|
1938
1940
|
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
column.
|
|
1942
|
-
|
|
1941
|
+
// Check if every required field in column.validate exists and is truthy in data
|
|
1942
|
+
const isValid =
|
|
1943
|
+
column.validate?.every(
|
|
1944
|
+
(v) => data[v]
|
|
1945
|
+
) ?? true;
|
|
1946
|
+
|
|
1947
|
+
if (isValid) {
|
|
1948
|
+
handleTimer(
|
|
1949
|
+
data[
|
|
1950
|
+
form.primaryKey
|
|
1951
|
+
],
|
|
1952
|
+
column.id
|
|
1953
|
+
);
|
|
1954
|
+
} else {
|
|
1955
|
+
toast.error(
|
|
1956
|
+
'Please complete the required fields before starting the timer.'
|
|
1957
|
+
);
|
|
1958
|
+
}
|
|
1943
1959
|
}}
|
|
1944
1960
|
>
|
|
1945
1961
|
<Alarm
|
package/components/crm/Field.jsx
CHANGED
|
@@ -120,6 +120,7 @@ function Field({
|
|
|
120
120
|
break;
|
|
121
121
|
case 'dropdown-ajax':
|
|
122
122
|
case 'multi-dropdown-ajax':
|
|
123
|
+
case 'radio-ajax':
|
|
123
124
|
fetchOptions();
|
|
124
125
|
break;
|
|
125
126
|
default:
|
|
@@ -230,6 +231,7 @@ function Field({
|
|
|
230
231
|
[
|
|
231
232
|
'address',
|
|
232
233
|
'async-dropdown-ajax',
|
|
234
|
+
'checkbox',
|
|
233
235
|
'colour',
|
|
234
236
|
'copytoclipboard',
|
|
235
237
|
'date',
|
|
@@ -244,6 +246,8 @@ function Field({
|
|
|
244
246
|
'plaindatetime',
|
|
245
247
|
'plainrelation',
|
|
246
248
|
'plainrelationarray',
|
|
249
|
+
'radio',
|
|
250
|
+
'radio-ajax',
|
|
247
251
|
'richeditor',
|
|
248
252
|
'time',
|
|
249
253
|
].includes(settings.type)
|
|
@@ -271,13 +275,6 @@ function Field({
|
|
|
271
275
|
}
|
|
272
276
|
} else if (['plaintextheading'].includes(settings.type)) {
|
|
273
277
|
return <h2>{settings.label ? settings.label : ''}</h2>;
|
|
274
|
-
} else if (['checkbox'].includes(settings.type)) {
|
|
275
|
-
return (
|
|
276
|
-
<span className="fi__spancheckbox">
|
|
277
|
-
{settings.label ? settings.label : ''}{' '}
|
|
278
|
-
{settings.required ? '*' : ''}
|
|
279
|
-
</span>
|
|
280
|
-
);
|
|
281
278
|
}
|
|
282
279
|
};
|
|
283
280
|
|
|
@@ -319,8 +316,62 @@ function Field({
|
|
|
319
316
|
|
|
320
317
|
const renderInput = () => {
|
|
321
318
|
switch (settings.type) {
|
|
319
|
+
case 'radio':
|
|
320
|
+
return settings.options?.length > 0 ? (
|
|
321
|
+
<div className="fi__optionscontainer">
|
|
322
|
+
{settings.options.map((option, index) => (
|
|
323
|
+
<div
|
|
324
|
+
key={`${settings.id}-checkbox-option-${index}`}
|
|
325
|
+
className="fi__checkboxcontainer"
|
|
326
|
+
>
|
|
327
|
+
<input
|
|
328
|
+
name={settings.id}
|
|
329
|
+
data-name={settings.id}
|
|
330
|
+
type="radio"
|
|
331
|
+
className="fi__customcheckbox"
|
|
332
|
+
value={option.id}
|
|
333
|
+
checked={
|
|
334
|
+
parseInt(inputValue) ===
|
|
335
|
+
parseInt(option.id)
|
|
336
|
+
}
|
|
337
|
+
onChange={onChange}
|
|
338
|
+
/>
|
|
339
|
+
<label className="fi__checkboxlabel">
|
|
340
|
+
{option.label}
|
|
341
|
+
</label>{' '}
|
|
342
|
+
</div>
|
|
343
|
+
))}
|
|
344
|
+
</div>
|
|
345
|
+
) : null;
|
|
346
|
+
case 'radio-ajax':
|
|
347
|
+
return options?.length > 0 ? (
|
|
348
|
+
<div className="fi__optionscontainer">
|
|
349
|
+
{options.map((option, index) => (
|
|
350
|
+
<div
|
|
351
|
+
key={`${settings.id}-checkbox-option-${index}`}
|
|
352
|
+
className="fi__checkboxcontainer"
|
|
353
|
+
>
|
|
354
|
+
<input
|
|
355
|
+
name={settings.id}
|
|
356
|
+
data-name={settings.id}
|
|
357
|
+
type="radio"
|
|
358
|
+
className="fi__customcheckbox"
|
|
359
|
+
value={option.id}
|
|
360
|
+
checked={
|
|
361
|
+
parseInt(inputValue) ===
|
|
362
|
+
parseInt(option.id)
|
|
363
|
+
}
|
|
364
|
+
onChange={onChange}
|
|
365
|
+
/>
|
|
366
|
+
<label className="fi__checkboxlabel">
|
|
367
|
+
{option.label}
|
|
368
|
+
</label>{' '}
|
|
369
|
+
</div>
|
|
370
|
+
))}
|
|
371
|
+
</div>
|
|
372
|
+
) : null;
|
|
322
373
|
case 'checkbox':
|
|
323
|
-
return settings.options
|
|
374
|
+
return settings.options?.length > 0 ? (
|
|
324
375
|
<div className="fi__optionscontainer">
|
|
325
376
|
{settings.options.map((option, index) => (
|
|
326
377
|
<div
|
|
@@ -329,6 +380,7 @@ function Field({
|
|
|
329
380
|
>
|
|
330
381
|
<input
|
|
331
382
|
name={settings.id}
|
|
383
|
+
data-name={settings.id}
|
|
332
384
|
type="checkbox"
|
|
333
385
|
className="fi__customcheckbox"
|
|
334
386
|
value={option.label}
|
|
@@ -970,6 +1022,8 @@ function Field({
|
|
|
970
1022
|
'plainrelationarray',
|
|
971
1023
|
'plaintext',
|
|
972
1024
|
'plaintextheading',
|
|
1025
|
+
'radio',
|
|
1026
|
+
'radio-ajax',
|
|
973
1027
|
'richeditor',
|
|
974
1028
|
'time',
|
|
975
1029
|
'toggle',
|
package/package.json
CHANGED