@visns-studio/visns-components 4.10.48 → 5.0.1-8.1
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 +29 -29
- package/src/components/cms/Field.jsx +39 -63
- package/src/components/crm/AsyncSelect.jsx +121 -15
- package/src/components/crm/Breadcrumb.jsx +2 -18
- package/src/components/crm/DataGrid.jsx +51 -424
- package/src/components/crm/Field.jsx +185 -358
- package/src/components/crm/Form.jsx +104 -92
- package/src/components/crm/MultiSelect.jsx +66 -45
- package/src/components/crm/Navigation.jsx +9 -92
- package/src/components/crm/QuickAction.jsx +1 -0
- package/src/components/crm/auth/Login.jsx +9 -1
- package/src/components/crm/auth/Profile.jsx +4 -2
- package/src/components/crm/auth/styles/Login.module.scss +52 -82
- package/src/components/crm/auth/styles/Profile.module.scss +150 -44
- package/src/components/crm/auth/styles/Reset.module.scss +55 -37
- package/src/components/crm/auth/styles/Verify.module.scss +55 -76
- package/src/components/crm/generic/GenericAuth.jsx +12 -5
- package/src/components/crm/generic/GenericDashboard.jsx +30 -340
- package/src/components/crm/generic/GenericDetail.jsx +534 -86
- package/src/components/crm/generic/GenericDynamic.jsx +76 -94
- package/src/components/crm/generic/GenericEditableTable.jsx +407 -0
- package/src/components/crm/generic/GenericFormBuilder.jsx +19 -79
- package/src/components/crm/generic/GenericIndex.jsx +1 -2
- package/src/components/crm/generic/styles/AuditLog.module.scss +4 -37
- package/src/components/crm/generic/styles/AuditLogs.module.scss +0 -51
- package/src/components/crm/generic/styles/GenericDetail.module.scss +263 -244
- package/src/components/crm/generic/styles/GenericDynamic.module.scss +100 -198
- package/src/components/crm/generic/styles/GenericEditableTable.module.scss +178 -0
- package/src/components/crm/generic/styles/GenericFormBuilder.module.scss +63 -101
- package/src/components/crm/generic/styles/GenericIndex.module.scss +46 -66
- package/src/components/crm/generic/styles/GenericMain.module.scss +7 -7
- package/src/components/crm/generic/styles/GenericSort.module.scss +0 -36
- package/src/components/crm/generic/styles/NotificationList.module.scss +1 -32
- package/src/components/crm/styles/Autocomplete.module.scss +12 -20
- package/src/components/crm/styles/DataGrid.module.scss +28 -86
- package/src/components/crm/styles/Field.module.scss +72 -252
- package/src/components/crm/styles/Form.module.scss +141 -450
- package/src/components/crm/styles/Navigation.module.scss +356 -507
- package/src/components/crm/styles/Notification.module.scss +1 -0
- package/src/components/crm/styles/QrCode.module.scss +4 -18
- package/src/components/crm/styles/SwitchAccount.module.scss +0 -1
- package/src/components/crm/styles/TableFilter.module.scss +2 -1
- package/src/components/styles/global.css +164 -34
- package/src/index.js +0 -8
- package/src/components/crm/generic/styles/GenericDashboard.module.scss +0 -325
- package/src/components/crm/sketch/SketchField.jsx +0 -395
- package/src/components/crm/sketch/arrow.jsx +0 -108
- package/src/components/crm/sketch/circle.jsx +0 -75
- package/src/components/crm/sketch/default-tool.jsx +0 -16
- package/src/components/crm/sketch/fabrictool.jsx +0 -22
- package/src/components/crm/sketch/history.jsx +0 -144
- package/src/components/crm/sketch/json/config.json +0 -14
- package/src/components/crm/sketch/line.jsx +0 -64
- package/src/components/crm/sketch/pan.jsx +0 -48
- package/src/components/crm/sketch/pencil.jsx +0 -36
- package/src/components/crm/sketch/rectangle-label-object.jsx +0 -69
- package/src/components/crm/sketch/rectangle-label.jsx +0 -93
- package/src/components/crm/sketch/rectangle.jsx +0 -76
- package/src/components/crm/sketch/select.jsx +0 -16
- package/src/components/crm/sketch/tools.jsx +0 -11
- package/src/components/crm/sketch/utils.jsx +0 -67
|
@@ -2,7 +2,7 @@ import '../styles/global.css';
|
|
|
2
2
|
|
|
3
3
|
import React, { useEffect, useRef, useState } from 'react';
|
|
4
4
|
import DatePicker from 'react-datepicker';
|
|
5
|
-
import _
|
|
5
|
+
import _ from 'lodash';
|
|
6
6
|
import Toggle from 'react-toggle';
|
|
7
7
|
import moment from 'moment';
|
|
8
8
|
import parse from 'html-react-parser';
|
|
@@ -11,18 +11,7 @@ import { BlockPicker } from 'react-color';
|
|
|
11
11
|
import { CopyToClipboard } from 'react-copy-to-clipboard';
|
|
12
12
|
import { NumericFormat, PatternFormat } from 'react-number-format';
|
|
13
13
|
import { Editor } from '@tinymce/tinymce-react';
|
|
14
|
-
import {
|
|
15
|
-
Edit,
|
|
16
|
-
ChevronRight,
|
|
17
|
-
Circle,
|
|
18
|
-
CircleFill,
|
|
19
|
-
CirclePlus,
|
|
20
|
-
CloudDownload,
|
|
21
|
-
Minus,
|
|
22
|
-
ArrowBack,
|
|
23
|
-
TrashCan,
|
|
24
|
-
CircleX,
|
|
25
|
-
} from 'akar-icons';
|
|
14
|
+
import { CirclePlus, CloudDownload, Copy, TrashCan } from 'akar-icons';
|
|
26
15
|
import { toast } from 'react-toastify';
|
|
27
16
|
import styles from './styles/Field.module.scss';
|
|
28
17
|
|
|
@@ -30,15 +19,13 @@ import CustomFetch from './Fetch';
|
|
|
30
19
|
import Form from './Form';
|
|
31
20
|
import MultiSelect from './MultiSelect';
|
|
32
21
|
import Select from './Select';
|
|
33
|
-
import SketchConfig from './sketch/json/config.json';
|
|
34
|
-
import SketchField from './sketch/SketchField';
|
|
35
|
-
import Tools from './sketch/tools';
|
|
36
22
|
import VisnsAsyncSelect from './AsyncSelect';
|
|
37
23
|
import VisnsAutocomplete from './Autocomplete';
|
|
38
24
|
import VisnsDropZone from '../cms/DropZone';
|
|
39
25
|
|
|
40
26
|
import 'react-toggle/style.css';
|
|
41
27
|
import 'react-datepicker/dist/react-datepicker.css';
|
|
28
|
+
import Item from '../cms/sorting/Item';
|
|
42
29
|
|
|
43
30
|
function Field({
|
|
44
31
|
api,
|
|
@@ -51,7 +38,6 @@ function Field({
|
|
|
51
38
|
inputClass,
|
|
52
39
|
mapbox,
|
|
53
40
|
onChange,
|
|
54
|
-
onChangeCanvas,
|
|
55
41
|
onChangeCheckbox,
|
|
56
42
|
onChangeCheckboxManual,
|
|
57
43
|
onChangeColour,
|
|
@@ -79,30 +65,6 @@ function Field({
|
|
|
79
65
|
const [formItemClass, setFormItemClass] = useState('');
|
|
80
66
|
const [options, setOptions] = useState([]);
|
|
81
67
|
|
|
82
|
-
/** Canvas States */
|
|
83
|
-
const [canvasPopupOpen, setCanvasPopupOpen] = useState(false);
|
|
84
|
-
const [canvasUrl, setCanvasUrl] = useState('');
|
|
85
|
-
const [sketchTool, setSketchTool] = useState(Tools.Pencil);
|
|
86
|
-
const [toolClass, setToolClass] = useState('pencil');
|
|
87
|
-
const [lineWidth, setLineWidth] = useState(2);
|
|
88
|
-
const [lineColor, setLineColor] = useState('rgba(0, 0, 0, 1)');
|
|
89
|
-
const sketchRef = useRef(null);
|
|
90
|
-
|
|
91
|
-
/** Canvas Functions */
|
|
92
|
-
const handleCanvasSave = async () => {
|
|
93
|
-
// Save the current canvas state
|
|
94
|
-
const canvasState = sketchRef.current.saveCanvasState();
|
|
95
|
-
|
|
96
|
-
// Export the canvas image data as a Base64 string
|
|
97
|
-
const imageData = await sketchRef.current.exportCanvasImage(); // Use await here
|
|
98
|
-
|
|
99
|
-
// Call the onChangeCanvas function with both values
|
|
100
|
-
onChangeCanvas(settings, canvasState, imageData);
|
|
101
|
-
|
|
102
|
-
// Close the canvas popup
|
|
103
|
-
setCanvasPopupOpen(false);
|
|
104
|
-
};
|
|
105
|
-
|
|
106
68
|
const cover = {
|
|
107
69
|
position: 'fixed',
|
|
108
70
|
top: '0px',
|
|
@@ -120,6 +82,7 @@ function Field({
|
|
|
120
82
|
useEffect(() => {
|
|
121
83
|
const fetchOptions = () => {
|
|
122
84
|
let filter = {};
|
|
85
|
+
|
|
123
86
|
if (settings.where?.length > 0) {
|
|
124
87
|
filter = {
|
|
125
88
|
where: settings.where,
|
|
@@ -192,13 +155,6 @@ function Field({
|
|
|
192
155
|
setFormItemClass(`${styles.formItem}`);
|
|
193
156
|
break;
|
|
194
157
|
}
|
|
195
|
-
|
|
196
|
-
if (settings.type === 'canvas') {
|
|
197
|
-
const canvasType = SketchConfig.canvasTypes.find(
|
|
198
|
-
(a) => a.id === settings.canvasType
|
|
199
|
-
);
|
|
200
|
-
setCanvasUrl(canvasType.url);
|
|
201
|
-
}
|
|
202
158
|
}, [settings, counter]);
|
|
203
159
|
|
|
204
160
|
const fetchChildDropdownData = (s, v) => {
|
|
@@ -227,12 +183,6 @@ function Field({
|
|
|
227
183
|
filter.orderBy = a.orderBy;
|
|
228
184
|
}
|
|
229
185
|
|
|
230
|
-
if (a.where) {
|
|
231
|
-
forEach(a.where, (w) => {
|
|
232
|
-
filter.where.push(w);
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
|
|
236
186
|
CustomFetch(a.url, 'POST', filter, function (result) {
|
|
237
187
|
childDropdownCallback({
|
|
238
188
|
id: a.id,
|
|
@@ -258,8 +208,8 @@ function Field({
|
|
|
258
208
|
filter.orderBy = s.orderBy;
|
|
259
209
|
}
|
|
260
210
|
|
|
261
|
-
if (
|
|
262
|
-
forEach(
|
|
211
|
+
if (a.where) {
|
|
212
|
+
forEach(a.where, (w) => {
|
|
263
213
|
filter.where.push(w);
|
|
264
214
|
});
|
|
265
215
|
}
|
|
@@ -310,66 +260,70 @@ function Field({
|
|
|
310
260
|
}, [settings.options, settings, counter]);
|
|
311
261
|
|
|
312
262
|
const renderLabel = () => {
|
|
313
|
-
if (
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
) {
|
|
344
|
-
return (
|
|
345
|
-
<span className={`${styles.fi__span} ${styles.prefocus}`}>
|
|
346
|
-
{settings.label} {settings.required ? '*' : ''}
|
|
347
|
-
</span>
|
|
348
|
-
);
|
|
349
|
-
} else if (['plaintext'].includes(settings.type)) {
|
|
350
|
-
if (settings.description) {
|
|
351
|
-
return (
|
|
352
|
-
<span>
|
|
353
|
-
{settings.description
|
|
354
|
-
? parse(settings.description)
|
|
355
|
-
: ''}
|
|
356
|
-
</span>
|
|
357
|
-
);
|
|
358
|
-
} else {
|
|
263
|
+
if (settings.label && settings.label !== '') {
|
|
264
|
+
if (
|
|
265
|
+
[
|
|
266
|
+
'address',
|
|
267
|
+
'async-dropdown-ajax',
|
|
268
|
+
'checkbox',
|
|
269
|
+
'colour',
|
|
270
|
+
'copytoclipboard',
|
|
271
|
+
'date',
|
|
272
|
+
'datetime',
|
|
273
|
+
'dropdown',
|
|
274
|
+
'dropdown-ajax',
|
|
275
|
+
'dynamicdata',
|
|
276
|
+
'file',
|
|
277
|
+
'gallery',
|
|
278
|
+
'image',
|
|
279
|
+
'multi-dropdown',
|
|
280
|
+
'multi-dropdown-ajax',
|
|
281
|
+
'plaindate',
|
|
282
|
+
'plaindatetime',
|
|
283
|
+
'plainrelation',
|
|
284
|
+
'plainrelationarray',
|
|
285
|
+
'radio',
|
|
286
|
+
'radio-ajax',
|
|
287
|
+
'signature',
|
|
288
|
+
'table_radio',
|
|
289
|
+
'table_text',
|
|
290
|
+
'time',
|
|
291
|
+
].includes(settings.type)
|
|
292
|
+
) {
|
|
359
293
|
return (
|
|
360
294
|
<span className={`${styles.fi__span} ${styles.prefocus}`}>
|
|
361
295
|
{settings.label} {settings.required ? '*' : ''}
|
|
362
296
|
</span>
|
|
363
297
|
);
|
|
298
|
+
} else if (['plaintext'].includes(settings.type)) {
|
|
299
|
+
if (settings.description) {
|
|
300
|
+
return (
|
|
301
|
+
<span>
|
|
302
|
+
{settings.description
|
|
303
|
+
? parse(settings.description)
|
|
304
|
+
: ''}
|
|
305
|
+
</span>
|
|
306
|
+
);
|
|
307
|
+
} else {
|
|
308
|
+
return (
|
|
309
|
+
<span
|
|
310
|
+
className={`${styles.fi__span} ${styles.prefocus}`}
|
|
311
|
+
>
|
|
312
|
+
{settings.label} {settings.required ? '*' : ''}
|
|
313
|
+
</span>
|
|
314
|
+
);
|
|
315
|
+
}
|
|
316
|
+
} else if (['plaintextheading'].includes(settings.type)) {
|
|
317
|
+
return <h2>{settings.label ? settings.label : ''}</h2>;
|
|
318
|
+
} else if (['section'].includes(settings.type)) {
|
|
319
|
+
return (
|
|
320
|
+
<div className={styles.gridtxt__header}>
|
|
321
|
+
<span>{settings.label}</span>
|
|
322
|
+
</div>
|
|
323
|
+
);
|
|
324
|
+
} else if (['richeditor', 'textarea'].includes(settings.type)) {
|
|
325
|
+
return settings.label;
|
|
364
326
|
}
|
|
365
|
-
} else if (['plaintextheading'].includes(settings.type)) {
|
|
366
|
-
return <h2>{settings.label ? settings.label : ''}</h2>;
|
|
367
|
-
} else if (['section'].includes(settings.type)) {
|
|
368
|
-
return (
|
|
369
|
-
<div className={styles.gridtxt__header}>
|
|
370
|
-
<span>{settings.label}</span>
|
|
371
|
-
</div>
|
|
372
|
-
);
|
|
373
327
|
}
|
|
374
328
|
};
|
|
375
329
|
|
|
@@ -426,35 +380,27 @@ function Field({
|
|
|
426
380
|
);
|
|
427
381
|
case 'async-dropdown-ajax':
|
|
428
382
|
return (
|
|
429
|
-
<
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
inputValue
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
console.info('a');
|
|
449
|
-
return canvasUrl ? (
|
|
450
|
-
<div
|
|
451
|
-
onClick={() => setCanvasPopupOpen(true)}
|
|
452
|
-
style={{ cursor: 'pointer' }}
|
|
453
|
-
>
|
|
454
|
-
<img src={canvasUrl} width="200" alt="Canvas Preview" />
|
|
383
|
+
<div className={styles.dropdownContainer}>
|
|
384
|
+
<VisnsAsyncSelect
|
|
385
|
+
settings={settings}
|
|
386
|
+
className={inputClass[settings.id]}
|
|
387
|
+
multi={
|
|
388
|
+
settings.hasOwnProperty('multi')
|
|
389
|
+
? settings.multi
|
|
390
|
+
: false
|
|
391
|
+
}
|
|
392
|
+
onChange={onChangeSelect}
|
|
393
|
+
inputValue={
|
|
394
|
+
inputValue === null || inputValue === undefined
|
|
395
|
+
? ''
|
|
396
|
+
: inputValue
|
|
397
|
+
}
|
|
398
|
+
options={options}
|
|
399
|
+
dataOptions={dataOptions}
|
|
400
|
+
isCreatable={settings.isCreatable || false}
|
|
401
|
+
/>
|
|
455
402
|
</div>
|
|
456
|
-
)
|
|
457
|
-
|
|
403
|
+
);
|
|
458
404
|
case 'checkbox':
|
|
459
405
|
return (
|
|
460
406
|
<div
|
|
@@ -743,7 +689,7 @@ function Field({
|
|
|
743
689
|
onChange={onChange}
|
|
744
690
|
/>
|
|
745
691
|
{inputValue && inputValue.length > 0 && (
|
|
746
|
-
<ul className=
|
|
692
|
+
<ul className="file-list">
|
|
747
693
|
{inputValue.map((file, index) => (
|
|
748
694
|
<li
|
|
749
695
|
key={`file-${settings.id}-${index}`}
|
|
@@ -754,9 +700,7 @@ function Field({
|
|
|
754
700
|
? file.file_name
|
|
755
701
|
: ''}
|
|
756
702
|
<button
|
|
757
|
-
className=
|
|
758
|
-
styles['trash-button']
|
|
759
|
-
}
|
|
703
|
+
className="trash-button"
|
|
760
704
|
onClick={(e) => {
|
|
761
705
|
e.preventDefault();
|
|
762
706
|
e.stopPropagation();
|
|
@@ -877,6 +821,13 @@ function Field({
|
|
|
877
821
|
|
|
878
822
|
return htmlContainer;
|
|
879
823
|
case 'html5_date':
|
|
824
|
+
// Convert inputValue to 'YYYY-MM-DD' if necessary
|
|
825
|
+
const formattedDate =
|
|
826
|
+
inputValue &&
|
|
827
|
+
moment(inputValue, moment.ISO_8601, true).isValid()
|
|
828
|
+
? moment(inputValue).format('YYYY-MM-DD')
|
|
829
|
+
: inputValue; // Use as-is if it's already in the correct format or invalid
|
|
830
|
+
|
|
880
831
|
return (
|
|
881
832
|
<input
|
|
882
833
|
type="date"
|
|
@@ -884,11 +835,7 @@ function Field({
|
|
|
884
835
|
className={inputClass[settings.id]}
|
|
885
836
|
placeholder=" "
|
|
886
837
|
onChange={onChange}
|
|
887
|
-
value={
|
|
888
|
-
inputValue && inputValue !== 'null'
|
|
889
|
-
? inputValue
|
|
890
|
-
: ''
|
|
891
|
-
}
|
|
838
|
+
value={formattedDate || ''}
|
|
892
839
|
autoComplete="off"
|
|
893
840
|
/>
|
|
894
841
|
);
|
|
@@ -1040,18 +987,9 @@ function Field({
|
|
|
1040
987
|
? settings.options
|
|
1041
988
|
: options
|
|
1042
989
|
}
|
|
990
|
+
isCreatable={settings.isCreatable || false}
|
|
1043
991
|
dataOptions={dataOptions}
|
|
1044
992
|
style={style}
|
|
1045
|
-
isCreatable={
|
|
1046
|
-
settings.hasOwnProperty('isCreatable')
|
|
1047
|
-
? settings.isCreatable
|
|
1048
|
-
: false
|
|
1049
|
-
}
|
|
1050
|
-
creatableConfig={
|
|
1051
|
-
settings.hasOwnProperty('creatableConfig')
|
|
1052
|
-
? settings.creatableConfig
|
|
1053
|
-
: {}
|
|
1054
|
-
}
|
|
1055
993
|
/>
|
|
1056
994
|
{settings.create && (
|
|
1057
995
|
<button
|
|
@@ -1252,77 +1190,6 @@ function Field({
|
|
|
1252
1190
|
))}
|
|
1253
1191
|
</div>
|
|
1254
1192
|
) : null;
|
|
1255
|
-
case 'richeditor':
|
|
1256
|
-
return (
|
|
1257
|
-
<Editor
|
|
1258
|
-
tinymceScriptSrc="https://d16lktya8ojp5z.cloudfront.net/generic/packages/tinymce_v701/tinymce.min.js"
|
|
1259
|
-
licenseKey="gpl"
|
|
1260
|
-
onEditorChange={(value, e) => {
|
|
1261
|
-
onChangeRicheditor(e, value, settings.id);
|
|
1262
|
-
}}
|
|
1263
|
-
onInit={(evt, editor) => (editorRef.current = editor)}
|
|
1264
|
-
value={inputValue || ''}
|
|
1265
|
-
init={{
|
|
1266
|
-
branding: false,
|
|
1267
|
-
height: settings.height ? settings.height : 500,
|
|
1268
|
-
menubar: false,
|
|
1269
|
-
plugins: [
|
|
1270
|
-
'advlist',
|
|
1271
|
-
'autolink',
|
|
1272
|
-
'lists',
|
|
1273
|
-
'link',
|
|
1274
|
-
'image',
|
|
1275
|
-
'charmap',
|
|
1276
|
-
'preview',
|
|
1277
|
-
'anchor',
|
|
1278
|
-
'searchreplace',
|
|
1279
|
-
'visualblocks',
|
|
1280
|
-
'code',
|
|
1281
|
-
'fullscreen',
|
|
1282
|
-
'insertdatetime',
|
|
1283
|
-
'media',
|
|
1284
|
-
'table',
|
|
1285
|
-
'code',
|
|
1286
|
-
],
|
|
1287
|
-
toolbar:
|
|
1288
|
-
'insertTextDropdown | undo redo | blocks | ' +
|
|
1289
|
-
'bold italic forecolor | alignleft aligncenter ' +
|
|
1290
|
-
'alignright alignjustify | bullist numlist outdent indent | ' +
|
|
1291
|
-
'removeformat | table',
|
|
1292
|
-
content_style:
|
|
1293
|
-
'body { font-family:Helvetica,Arial,sans-serif; font-size:14px }',
|
|
1294
|
-
setup: (editor) => {
|
|
1295
|
-
// Check if insertText exists and is an array of objects
|
|
1296
|
-
if (
|
|
1297
|
-
settings.insertText &&
|
|
1298
|
-
Array.isArray(settings.insertText) &&
|
|
1299
|
-
settings.insertText.length > 0
|
|
1300
|
-
) {
|
|
1301
|
-
editor.ui.registry.addMenuButton(
|
|
1302
|
-
'insertTextDropdown',
|
|
1303
|
-
{
|
|
1304
|
-
text: 'Insert Text',
|
|
1305
|
-
fetch: (callback) => {
|
|
1306
|
-
const items =
|
|
1307
|
-
settings.insertText.map(
|
|
1308
|
-
(textObj) => ({
|
|
1309
|
-
type: 'menuitem',
|
|
1310
|
-
text: textObj.text,
|
|
1311
|
-
onAction: () =>
|
|
1312
|
-
editor.insertContent(
|
|
1313
|
-
textObj.content
|
|
1314
|
-
),
|
|
1315
|
-
})
|
|
1316
|
-
);
|
|
1317
|
-
callback(items);
|
|
1318
|
-
},
|
|
1319
|
-
}
|
|
1320
|
-
);
|
|
1321
|
-
}
|
|
1322
|
-
},
|
|
1323
|
-
}}
|
|
1324
|
-
/>
|
|
1325
|
-
);
|
|
1326
1193
|
case 'signature':
|
|
1327
1194
|
return (
|
|
1328
1195
|
<>
|
|
@@ -1513,9 +1380,7 @@ function Field({
|
|
|
1513
1380
|
<th></th>
|
|
1514
1381
|
{tableRadioColumns.map((column, columnKey) => (
|
|
1515
1382
|
<th
|
|
1516
|
-
key={`${settings.id}-${
|
|
1517
|
-
column.id
|
|
1518
|
-
}-${Math.random()}`}
|
|
1383
|
+
key={`${settings.id}-${column.id}`}
|
|
1519
1384
|
style={{
|
|
1520
1385
|
width: '250px',
|
|
1521
1386
|
whiteSpace: 'nowrap',
|
|
@@ -1536,17 +1401,21 @@ function Field({
|
|
|
1536
1401
|
</tr>
|
|
1537
1402
|
</thead>
|
|
1538
1403
|
<tbody>
|
|
1539
|
-
{tableRadioRows.map((row
|
|
1404
|
+
{tableRadioRows.map((row) => (
|
|
1540
1405
|
<tr
|
|
1541
1406
|
key={`table-radio-row-${settings.id}-${row.id}`}
|
|
1542
1407
|
>
|
|
1543
|
-
<td
|
|
1408
|
+
<td
|
|
1409
|
+
style={{
|
|
1410
|
+
whiteSpace: 'nowrap',
|
|
1411
|
+
}}
|
|
1412
|
+
>
|
|
1413
|
+
{row.label}
|
|
1414
|
+
</td>
|
|
1544
1415
|
{tableRadioColumns.map((cell, cellKey) => (
|
|
1545
1416
|
<td
|
|
1546
|
-
key={`table-radio-cell-${settings.id}-${row.id}-${cell.id}
|
|
1417
|
+
key={`table-radio-cell-${settings.id}-${row.id}-${cell.id}`}
|
|
1547
1418
|
style={{
|
|
1548
|
-
width: '250px',
|
|
1549
|
-
whiteSpace: 'nowrap',
|
|
1550
1419
|
textAlign:
|
|
1551
1420
|
tableRadioColumns[cellKey]
|
|
1552
1421
|
.type === '' ||
|
|
@@ -1776,7 +1645,6 @@ function Field({
|
|
|
1776
1645
|
'address',
|
|
1777
1646
|
'async-dropdown-ajax',
|
|
1778
1647
|
'checkbox',
|
|
1779
|
-
'canvas',
|
|
1780
1648
|
'colour',
|
|
1781
1649
|
'copytoclipboard',
|
|
1782
1650
|
'date',
|
|
@@ -1803,6 +1671,7 @@ function Field({
|
|
|
1803
1671
|
'signature',
|
|
1804
1672
|
'table_radio',
|
|
1805
1673
|
'table_text',
|
|
1674
|
+
'textarea',
|
|
1806
1675
|
'time',
|
|
1807
1676
|
'toggle',
|
|
1808
1677
|
].includes(settings.type)
|
|
@@ -1846,6 +1715,78 @@ function Field({
|
|
|
1846
1715
|
shouldCloseOnSelect={true}
|
|
1847
1716
|
/>
|
|
1848
1717
|
);
|
|
1718
|
+
case 'richeditor':
|
|
1719
|
+
return (
|
|
1720
|
+
<Editor
|
|
1721
|
+
tinymceScriptSrc="https://d16lktya8ojp5z.cloudfront.net/generic/packages/tinymce_v701/tinymce.min.js"
|
|
1722
|
+
licenseKey="gpl"
|
|
1723
|
+
onEditorChange={(value, e) => {
|
|
1724
|
+
onChangeRicheditor(e, value, settings.id);
|
|
1725
|
+
}}
|
|
1726
|
+
onInit={(evt, editor) => (editorRef.current = editor)}
|
|
1727
|
+
value={inputValue || ''}
|
|
1728
|
+
init={{
|
|
1729
|
+
branding: false,
|
|
1730
|
+
height: settings.height ? settings.height : 500,
|
|
1731
|
+
menubar: false,
|
|
1732
|
+
plugins: [
|
|
1733
|
+
'advlist',
|
|
1734
|
+
'autolink',
|
|
1735
|
+
'lists',
|
|
1736
|
+
'link',
|
|
1737
|
+
'image',
|
|
1738
|
+
'charmap',
|
|
1739
|
+
'preview',
|
|
1740
|
+
'anchor',
|
|
1741
|
+
'searchreplace',
|
|
1742
|
+
'visualblocks',
|
|
1743
|
+
'code',
|
|
1744
|
+
'fullscreen',
|
|
1745
|
+
'insertdatetime',
|
|
1746
|
+
'media',
|
|
1747
|
+
'table',
|
|
1748
|
+
'code',
|
|
1749
|
+
'hr',
|
|
1750
|
+
],
|
|
1751
|
+
toolbar:
|
|
1752
|
+
'insertTextDropdown | undo redo | blocks | ' +
|
|
1753
|
+
'bold italic forecolor | alignleft aligncenter ' +
|
|
1754
|
+
'alignright alignjustify | bullist numlist outdent indent | ' +
|
|
1755
|
+
'hr | removeformat | table | code',
|
|
1756
|
+
content_style:
|
|
1757
|
+
'body { font-family:Helvetica,Arial,sans-serif; font-size:14px }',
|
|
1758
|
+
setup: (editor) => {
|
|
1759
|
+
// Check if insertText exists and is an array of objects
|
|
1760
|
+
if (
|
|
1761
|
+
settings.insertText &&
|
|
1762
|
+
Array.isArray(settings.insertText) &&
|
|
1763
|
+
settings.insertText.length > 0
|
|
1764
|
+
) {
|
|
1765
|
+
editor.ui.registry.addMenuButton(
|
|
1766
|
+
'insertTextDropdown',
|
|
1767
|
+
{
|
|
1768
|
+
text: 'Insert Text',
|
|
1769
|
+
fetch: (callback) => {
|
|
1770
|
+
const items =
|
|
1771
|
+
settings.insertText.map(
|
|
1772
|
+
(textObj) => ({
|
|
1773
|
+
type: 'menuitem',
|
|
1774
|
+
text: textObj.text,
|
|
1775
|
+
onAction: () =>
|
|
1776
|
+
editor.insertContent(
|
|
1777
|
+
textObj.content
|
|
1778
|
+
),
|
|
1779
|
+
})
|
|
1780
|
+
);
|
|
1781
|
+
callback(items);
|
|
1782
|
+
},
|
|
1783
|
+
}
|
|
1784
|
+
);
|
|
1785
|
+
}
|
|
1786
|
+
},
|
|
1787
|
+
}}
|
|
1788
|
+
/>
|
|
1789
|
+
);
|
|
1849
1790
|
case 'time':
|
|
1850
1791
|
return (
|
|
1851
1792
|
<DatePicker
|
|
@@ -1947,7 +1888,13 @@ function Field({
|
|
|
1947
1888
|
|
|
1948
1889
|
return (
|
|
1949
1890
|
<div className={formItemClass} style={formItemStyle}>
|
|
1950
|
-
<label
|
|
1891
|
+
<label
|
|
1892
|
+
className={
|
|
1893
|
+
['richeditor', 'textarea'].includes(settings.type)
|
|
1894
|
+
? ''
|
|
1895
|
+
: styles.fi__label
|
|
1896
|
+
}
|
|
1897
|
+
>
|
|
1951
1898
|
{renderLabel()}
|
|
1952
1899
|
{renderInput()}
|
|
1953
1900
|
{renderFieldLabel()}
|
|
@@ -1974,126 +1921,6 @@ function Field({
|
|
|
1974
1921
|
updateForm={setChildForm}
|
|
1975
1922
|
/>
|
|
1976
1923
|
</Popup>
|
|
1977
|
-
<Popup
|
|
1978
|
-
open={canvasPopupOpen}
|
|
1979
|
-
onClose={() => setCanvasPopupOpen(false)}
|
|
1980
|
-
closeOnDocumentClick={false}
|
|
1981
|
-
>
|
|
1982
|
-
<div className={`${styles.modalwrap} ${styles['top--modal']}`}>
|
|
1983
|
-
<div className={styles.modal}>
|
|
1984
|
-
<div className={styles.modal__header}>
|
|
1985
|
-
<h1>Edit Canvas</h1>
|
|
1986
|
-
<button
|
|
1987
|
-
className={styles.modal__close}
|
|
1988
|
-
onClick={() => setCanvasPopupOpen(false)}
|
|
1989
|
-
>
|
|
1990
|
-
<CircleX size={24} color="#FFF" />
|
|
1991
|
-
</button>
|
|
1992
|
-
</div>
|
|
1993
|
-
<div
|
|
1994
|
-
className={`${styles.modal__content} ${styles.drawDiv}`}
|
|
1995
|
-
>
|
|
1996
|
-
{/* Sketch Tools */}
|
|
1997
|
-
<ul className={styles.drawactions}>
|
|
1998
|
-
<li>
|
|
1999
|
-
<button
|
|
2000
|
-
onClick={() => {
|
|
2001
|
-
handleCanvasSave();
|
|
2002
|
-
}}
|
|
2003
|
-
className={styles['drawactions--save']}
|
|
2004
|
-
>
|
|
2005
|
-
<CloudDownload size={16} /> Save
|
|
2006
|
-
</button>
|
|
2007
|
-
</li>
|
|
2008
|
-
<li>
|
|
2009
|
-
<button
|
|
2010
|
-
onClick={() => {
|
|
2011
|
-
setSketchTool(Tools.Pencil);
|
|
2012
|
-
setToolClass('pencil');
|
|
2013
|
-
}}
|
|
2014
|
-
className={`${
|
|
2015
|
-
styles['drawaction-pencil']
|
|
2016
|
-
} ${
|
|
2017
|
-
toolClass === 'pencil'
|
|
2018
|
-
? styles['drawactive']
|
|
2019
|
-
: ''
|
|
2020
|
-
}`}
|
|
2021
|
-
>
|
|
2022
|
-
<Edit size={16} /> Pencil
|
|
2023
|
-
</button>
|
|
2024
|
-
</li>
|
|
2025
|
-
<li>
|
|
2026
|
-
<button
|
|
2027
|
-
onClick={() => {
|
|
2028
|
-
setSketchTool(Tools.Line);
|
|
2029
|
-
|
|
2030
|
-
setToolClass('line');
|
|
2031
|
-
}}
|
|
2032
|
-
className={`${
|
|
2033
|
-
styles['drawaction-line']
|
|
2034
|
-
} ${
|
|
2035
|
-
toolClass === 'line'
|
|
2036
|
-
? styles['drawactive']
|
|
2037
|
-
: ''
|
|
2038
|
-
}`}
|
|
2039
|
-
>
|
|
2040
|
-
<Minus size={16} /> Line
|
|
2041
|
-
</button>
|
|
2042
|
-
</li>
|
|
2043
|
-
<li>
|
|
2044
|
-
<button
|
|
2045
|
-
onClick={() => {
|
|
2046
|
-
setSketchTool(Tools.Circle);
|
|
2047
|
-
|
|
2048
|
-
setToolClass('circle');
|
|
2049
|
-
}}
|
|
2050
|
-
className={`${
|
|
2051
|
-
styles['drawaction-circle']
|
|
2052
|
-
} ${
|
|
2053
|
-
toolClass === 'circle'
|
|
2054
|
-
? styles['drawactive']
|
|
2055
|
-
: ''
|
|
2056
|
-
}`}
|
|
2057
|
-
>
|
|
2058
|
-
<Circle size={16} /> Circle
|
|
2059
|
-
</button>
|
|
2060
|
-
</li>
|
|
2061
|
-
<li>
|
|
2062
|
-
<button
|
|
2063
|
-
onClick={() => sketchRef.current.undo()}
|
|
2064
|
-
className={styles['drawaction-undo']}
|
|
2065
|
-
>
|
|
2066
|
-
<ArrowBack size={16} /> Undo
|
|
2067
|
-
</button>
|
|
2068
|
-
</li>
|
|
2069
|
-
<li>
|
|
2070
|
-
<button
|
|
2071
|
-
onClick={() =>
|
|
2072
|
-
sketchRef.current.clearCanvas()
|
|
2073
|
-
}
|
|
2074
|
-
className={styles['drawactions--clear']}
|
|
2075
|
-
>
|
|
2076
|
-
<TrashCan size={16} /> Clear
|
|
2077
|
-
</button>
|
|
2078
|
-
</li>
|
|
2079
|
-
</ul>
|
|
2080
|
-
{(canvasUrl || inputValue?.state) && (
|
|
2081
|
-
<SketchField
|
|
2082
|
-
ref={sketchRef}
|
|
2083
|
-
width={740}
|
|
2084
|
-
height={800}
|
|
2085
|
-
tool={sketchTool}
|
|
2086
|
-
lineColor={lineColor}
|
|
2087
|
-
lineWidth={lineWidth}
|
|
2088
|
-
className={styles.drawcontainer}
|
|
2089
|
-
backgroundImage={canvasUrl}
|
|
2090
|
-
defaultValue={inputValue?.state || null}
|
|
2091
|
-
/>
|
|
2092
|
-
)}
|
|
2093
|
-
</div>
|
|
2094
|
-
</div>
|
|
2095
|
-
</div>
|
|
2096
|
-
</Popup>
|
|
2097
1924
|
</div>
|
|
2098
1925
|
);
|
|
2099
1926
|
}
|