@visns-studio/visns-components 4.6.13 → 4.7.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.
Files changed (107) hide show
  1. package/dist/104e5636d8ddb791614c.woff2 +0 -0
  2. package/dist/11fe6a83d647de5daf95.woff +0 -0
  3. package/dist/141e2a8c7836495afe2a.woff +0 -0
  4. package/dist/2ba5877f7079830b5383.woff +0 -0
  5. package/dist/2d6836f45b2037be41f3.woff +0 -0
  6. package/dist/399.0a0f3e0d21be1057d599.css +8 -0
  7. package/dist/399.b8f57fa3f8c0c10119e4.js +1 -0
  8. package/dist/47d566c3b1293dfd9d77.woff +0 -0
  9. package/dist/6282a13cbba671a71913.woff2 +0 -0
  10. package/dist/78266f551031aa9db127.woff +0 -0
  11. package/dist/7b7da89f1e3fdcbfe36c.woff2 +0 -0
  12. package/dist/7e78e8338af7efeda712.woff2 +0 -0
  13. package/dist/7fa387951673abf164b1.woff2 +0 -0
  14. package/dist/819d59862c2d0640aad8.woff +0 -0
  15. package/dist/b615e1a6c838ea059a56.woff +0 -0
  16. package/dist/b9b1aa739c660c4ce67c.woff2 +0 -0
  17. package/dist/c5f3640b11df9414facb.woff +0 -0
  18. package/dist/da26d162ff5af71d6590.woff2 +0 -0
  19. package/dist/dd5b2912dbf896310865.woff2 +0 -0
  20. package/dist/f282b331272463c1aa6c.woff2 +0 -0
  21. package/dist/main.83b033670d64419bb497.css +1 -0
  22. package/dist/main.b1723d17cd2d3513ab62.js +1 -0
  23. package/dist/report.html +39 -0
  24. package/dist/runtime.33c276593b23f8035b8d.js +1 -0
  25. package/package.json +26 -6
  26. package/.idea/codeStyles/Project.xml +0 -50
  27. package/.idea/codeStyles/codeStyleConfig.xml +0 -5
  28. package/.idea/deployment.xml +0 -4
  29. package/.idea/modules.xml +0 -8
  30. package/.idea/php.xml +0 -19
  31. package/.idea/vcs.xml +0 -6
  32. package/.idea/visns-components.iml +0 -8
  33. package/.prettierrc.json +0 -7
  34. package/.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs +0 -541
  35. package/.yarn/releases/yarn-3.6.1.cjs +0 -874
  36. package/.yarnrc.yml +0 -7
  37. package/components/cms/DataGrid.jsx +0 -1461
  38. package/components/cms/DropZone.jsx +0 -349
  39. package/components/cms/Field.jsx +0 -802
  40. package/components/cms/Form.jsx +0 -476
  41. package/components/cms/generic/CmsDetail.jsx +0 -36
  42. package/components/cms/generic/CmsIndex.jsx +0 -73
  43. package/components/cms/generic/CmsSort.jsx +0 -125
  44. package/components/cms/sorting/Item.jsx +0 -115
  45. package/components/cms/sorting/List.jsx +0 -30
  46. package/components/crm/AsyncSelect.jsx +0 -125
  47. package/components/crm/Autocomplete.jsx +0 -174
  48. package/components/crm/Breadcrumb.jsx +0 -52
  49. package/components/crm/Call.jsx +0 -220
  50. package/components/crm/DataGrid.jsx +0 -2701
  51. package/components/crm/Download.jsx +0 -101
  52. package/components/crm/Fetch.jsx +0 -119
  53. package/components/crm/Field.jsx +0 -1557
  54. package/components/crm/Form.jsx +0 -1409
  55. package/components/crm/Loader.jsx +0 -29
  56. package/components/crm/MultiSelect.jsx +0 -78
  57. package/components/crm/Navigation.jsx +0 -619
  58. package/components/crm/Notification.jsx +0 -197
  59. package/components/crm/QrCode.jsx +0 -83
  60. package/components/crm/Select.jsx +0 -58
  61. package/components/crm/SelectList.jsx +0 -21
  62. package/components/crm/TableFilter.jsx +0 -198
  63. package/components/crm/auth/Login.jsx +0 -230
  64. package/components/crm/auth/Profile.jsx +0 -280
  65. package/components/crm/auth/Reset.jsx +0 -111
  66. package/components/crm/auth/Verify.jsx +0 -174
  67. package/components/crm/auth/styles/Login.module.css +0 -245
  68. package/components/crm/auth/styles/Profile.module.css +0 -222
  69. package/components/crm/auth/styles/Reset.module.css +0 -216
  70. package/components/crm/auth/styles/Verify.module.css +0 -216
  71. package/components/crm/generic/AuditLog.jsx +0 -108
  72. package/components/crm/generic/AuditLogs.jsx +0 -115
  73. package/components/crm/generic/GenericAuth.jsx +0 -166
  74. package/components/crm/generic/GenericDashboard.jsx +0 -42
  75. package/components/crm/generic/GenericDetail.jsx +0 -1499
  76. package/components/crm/generic/GenericDynamic.jsx +0 -915
  77. package/components/crm/generic/GenericFormBuilder.jsx +0 -1765
  78. package/components/crm/generic/GenericIndex.jsx +0 -376
  79. package/components/crm/generic/GenericMain.jsx +0 -129
  80. package/components/crm/generic/GenericSort.jsx +0 -188
  81. package/components/crm/generic/NotificationList.jsx +0 -64
  82. package/components/crm/generic/styles/AuditLog.module.css +0 -147
  83. package/components/crm/generic/styles/AuditLogs.module.css +0 -92
  84. package/components/crm/generic/styles/GenericDetail.module.css +0 -634
  85. package/components/crm/generic/styles/GenericDynamic.module.css +0 -932
  86. package/components/crm/generic/styles/GenericFormBuilder.module.css +0 -944
  87. package/components/crm/generic/styles/GenericIndex.module.css +0 -247
  88. package/components/crm/generic/styles/GenericMain.module.css +0 -91
  89. package/components/crm/generic/styles/GenericSort.module.css +0 -123
  90. package/components/crm/generic/styles/NotificationList.module.css +0 -67
  91. package/components/crm/sorting/Item.jsx +0 -117
  92. package/components/crm/sorting/List.jsx +0 -32
  93. package/components/crm/sorting/styles/Item.module.css +0 -68
  94. package/components/crm/sorting/styles/List.module.css +0 -68
  95. package/components/crm/styles/AsyncSelect.module.css +0 -8
  96. package/components/crm/styles/Autocomplete.module.css +0 -44
  97. package/components/crm/styles/DataGrid.module.css +0 -210
  98. package/components/crm/styles/Field.module.css +0 -311
  99. package/components/crm/styles/Form.module.css +0 -499
  100. package/components/crm/styles/Loader.module.css +0 -94
  101. package/components/crm/styles/MultiSelect.module.css +0 -8
  102. package/components/crm/styles/Navigation.module.css +0 -978
  103. package/components/crm/styles/Notification.module.css +0 -147
  104. package/components/crm/styles/QrCode.module.css +0 -87
  105. package/components/crm/styles/TableFilter.module.css +0 -52
  106. package/components/styles/global.css +0 -73
  107. package/index.js +0 -86
@@ -1,802 +0,0 @@
1
- import React, { useState, useEffect, useRef } from 'react';
2
- import DatePicker from 'react-datepicker';
3
- import _ from 'lodash';
4
- import ReactQuill, { Quill } from 'react-quill';
5
- import { Editor } from '@tinymce/tinymce-react';
6
- import ImageUploader from 'quill-image-uploader';
7
- import Toggle from 'react-toggle';
8
- import { NumericFormat, PatternFormat } from 'react-number-format';
9
- import { motion } from 'framer-motion';
10
- import { toast } from 'react-toastify';
11
-
12
- import 'react-toggle/style.css';
13
- import 'react-quill/dist/quill.snow.css';
14
- import 'react-datepicker/dist/react-datepicker.css';
15
- import 'quill-image-uploader/dist/quill.imageUploader.min.css';
16
-
17
- import CustomFetch from '../crm/Fetch';
18
- import Select from '../crm/Select';
19
- import MultiSelect from '../crm/MultiSelect';
20
- import VisnsAutocomplete from '../crm/Autocomplete';
21
- import VisnsDropZone from './DropZone';
22
- import moment from 'moment';
23
-
24
- Quill.register('modules/imageUploader', ImageUploader);
25
-
26
- const modules = {
27
- toolbar: {
28
- container: [
29
- [{ header: [1, 2, false] }],
30
- ['bold', 'italic', 'underline', 'strike', 'blockquote'],
31
- [{ list: 'ordered' }, { list: 'bullet' }],
32
- ['link', 'image'],
33
- ['clean'],
34
- ],
35
- },
36
- imageUploader: {
37
- upload: async (file) => {
38
- return new Promise((resolve, reject) => {
39
- Vapor.store(file, {
40
- progress: (progress) => {
41
- console.info(progress * 100);
42
- },
43
- }).then((response) => {
44
- CustomFetch(
45
- '/ajax/files/upload',
46
- 'POST',
47
- response,
48
- function (res) {
49
- if (res.error === '') {
50
- resolve(res.path);
51
- } else {
52
- toast.error(
53
- res.error !== undefined ? res.error : ''
54
- );
55
- }
56
- }
57
- );
58
- });
59
- });
60
- },
61
- },
62
- };
63
-
64
- const Field = ({
65
- baseData,
66
- fetchData,
67
- inputValue,
68
- inputClass,
69
- onChange,
70
- onChangeDate,
71
- onChangeFile,
72
- onChangeRicheditor,
73
- onChangeSelect,
74
- onChangeToggle,
75
- setFormData,
76
- settings,
77
- uploadProgress,
78
- }) => {
79
- const editorRef = useRef(null);
80
- const inputFile = useRef(null);
81
- const [options, setOptions] = useState([]);
82
- const [dataOptions, setDataOptions] = useState([]);
83
- const [formItemStyle, setFormItemStyle] = useState({});
84
- const [formItemClass, setFormItemClass] = useState('formItem');
85
-
86
- useEffect(() => {
87
- switch (settings.type) {
88
- case 'hidden':
89
- setFormItemStyle({
90
- display: 'none',
91
- });
92
- break;
93
- case 'dropdown-ajax':
94
- let filter = {};
95
-
96
- if (
97
- settings.hasOwnProperty('where') &&
98
- settings.where.length > 0
99
- ) {
100
- filter = {
101
- where: settings.where,
102
- };
103
- }
104
-
105
- CustomFetch(settings.url, 'POST', filter, function (result) {
106
- setOptions(result.data);
107
-
108
- let dataArray = [];
109
-
110
- result.data.forEach((a) => {
111
- let _tempObject = a;
112
-
113
- if (!_.isEmpty(_tempObject)) {
114
- let modifiedObject = {};
115
-
116
- Object.keys(_tempObject).forEach(function (c) {
117
- if (c !== 'id' && c !== 'label') {
118
- modifiedObject['data-' + c] =
119
- _tempObject[c];
120
- }
121
- });
122
-
123
- dataArray.push(modifiedObject);
124
- }
125
- });
126
-
127
- if (dataArray.length > 0) {
128
- setDataOptions(dataArray);
129
- }
130
- });
131
- break;
132
- case 'multi-dropdown-ajax':
133
- let multiFilter = {};
134
-
135
- if (
136
- settings.hasOwnProperty('where') &&
137
- settings.where.length > 0
138
- ) {
139
- multiFilter = {
140
- where: settings.where,
141
- };
142
- }
143
-
144
- CustomFetch(
145
- settings.url,
146
- 'POST',
147
- multiFilter,
148
- function (result) {
149
- setOptions(result.data);
150
-
151
- let dataArray = [];
152
-
153
- result.data.forEach((a) => {
154
- let _tempObject = a;
155
-
156
- if (!_.isEmpty(_tempObject)) {
157
- let modifiedObject = {};
158
-
159
- Object.keys(_tempObject).forEach(function (c) {
160
- if (c !== 'id' && c !== 'label') {
161
- modifiedObject['data-' + c] =
162
- _tempObject[c];
163
- }
164
- });
165
-
166
- dataArray.push(modifiedObject);
167
- }
168
- });
169
-
170
- if (dataArray.length > 0) {
171
- setDataOptions(dataArray);
172
- }
173
- }
174
- );
175
- break;
176
- default:
177
- break;
178
- }
179
-
180
- if (settings.size === 'full') {
181
- setFormItemClass('formItem fwItem');
182
- }
183
- }, [settings]);
184
-
185
- useEffect(() => {
186
- let filter = {};
187
-
188
- if (settings.hasOwnProperty('child')) {
189
- if (inputValue > 0) {
190
- filter = {
191
- where: [
192
- {
193
- id: settings.id,
194
- value: inputValue,
195
- },
196
- ],
197
- };
198
-
199
- CustomFetch(
200
- settings.child.url,
201
- 'POST',
202
- filter,
203
- function (result) {
204
- childDropdownCallback({
205
- id: settings.child.id,
206
- data: result.data,
207
- });
208
- }
209
- );
210
- }
211
- }
212
- }, [inputValue, settings]);
213
-
214
- useEffect(() => {
215
- if (settings.hasOwnProperty('options')) {
216
- if (settings.options.length > 0) {
217
- let dataArray = [];
218
-
219
- settings.options.forEach((a) => {
220
- let _tempObject = a;
221
-
222
- if (!_.isEmpty(_tempObject)) {
223
- let modifiedObject = {};
224
-
225
- Object.keys(_tempObject).forEach(function (c) {
226
- if (c !== 'id' && c !== 'label') {
227
- modifiedObject['data-' + c] = _tempObject[c];
228
- }
229
- });
230
-
231
- dataArray.push(modifiedObject);
232
- }
233
- });
234
-
235
- if (dataArray.length > 0) {
236
- setDataOptions(dataArray);
237
- }
238
- }
239
- }
240
- }, [settings.options, settings]);
241
-
242
- return (
243
- <div className={formItemClass} style={formItemStyle}>
244
- <label
245
- className={
246
- settings.type === 'image' ||
247
- settings.type === 'richeditor' ||
248
- settings.type === 'gallery'
249
- ? 'fi__flabel'
250
- : 'fi__label'
251
- }
252
- >
253
- {(() => {
254
- if (
255
- settings.type === 'address' ||
256
- settings.type === 'date' ||
257
- settings.type === 'datetime' ||
258
- settings.type === 'checkbox' ||
259
- settings.type === 'multi-dropdown' ||
260
- settings.type === 'multi-dropdown-ajax'
261
- ) {
262
- return (
263
- <span className="fi__span prefocus">
264
- {settings.label}{' '}
265
- {settings.required === true ? '*' : ''}
266
- </span>
267
- );
268
- }
269
- })()}
270
-
271
- {(() => {
272
- if (
273
- settings.type === 'image' ||
274
- settings.type === 'richeditor' ||
275
- settings.type === 'gallery'
276
- ) {
277
- return (
278
- <>
279
- {settings.label}{' '}
280
- {settings.required === true ? '*' : ''}
281
- </>
282
- );
283
- }
284
- })()}
285
-
286
- {(() => {
287
- let htmlContainer;
288
- switch (settings.type) {
289
- case 'text':
290
- htmlContainer = (
291
- <input
292
- type="text"
293
- name={settings.id}
294
- readOnly={
295
- settings.hasOwnProperty('readOnly')
296
- ? settings.readOnly
297
- : false
298
- }
299
- className={inputClass[settings.id]}
300
- placeholder=" "
301
- onChange={onChange}
302
- value={
303
- inputValue && inputValue !== 'null'
304
- ? inputValue
305
- : ''
306
- }
307
- />
308
- );
309
- break;
310
- case 'json':
311
- htmlContainer = (
312
- <input
313
- type="text"
314
- name={settings.id}
315
- data-jsonkey={settings.key}
316
- className={inputClass[settings.id]}
317
- placeholder=" "
318
- onChange={onChange}
319
- value={
320
- inputValue && inputValue !== 'null'
321
- ? inputValue
322
- : ''
323
- }
324
- />
325
- );
326
- break;
327
- case 'password':
328
- htmlContainer = (
329
- <input
330
- type="password"
331
- name={settings.id}
332
- className={inputClass[settings.id]}
333
- placeholder=" "
334
- onChange={onChange}
335
- value={
336
- inputValue && inputValue !== 'null'
337
- ? inputValue
338
- : ''
339
- }
340
- />
341
- );
342
- break;
343
- case 'phone':
344
- htmlContainer = (
345
- <PatternFormat
346
- name={settings.id}
347
- className={inputClass[settings.id]}
348
- onValueChange={(values) => {
349
- onChangeNumberFormat(
350
- values,
351
- settings.id
352
- );
353
- }}
354
- format="## #### ####"
355
- allowEmptyFormatting
356
- mask="_"
357
- value={
358
- inputValue && inputValue !== 'null'
359
- ? inputValue
360
- : ''
361
- }
362
- />
363
- );
364
- break;
365
- case 'mobile':
366
- htmlContainer = (
367
- <PatternFormat
368
- className={inputClass[settings.id]}
369
- onValueChange={(values) => {
370
- onChangeNumberFormat(
371
- values,
372
- settings.id
373
- );
374
- }}
375
- format="#### ### ###"
376
- allowEmptyFormatting
377
- mask="_"
378
- value={
379
- inputValue && inputValue !== 'null'
380
- ? inputValue
381
- : ''
382
- }
383
- />
384
- );
385
- break;
386
- case 'currency':
387
- htmlContainer = (
388
- <NumericFormat
389
- name={settings.id}
390
- className={inputClass[settings.id]}
391
- onValueChange={(values) => {
392
- onChangeNumberFormat(
393
- values,
394
- settings.id
395
- );
396
- }}
397
- thousandSeparator={true}
398
- prefix={'$'}
399
- value={
400
- inputValue && inputValue !== 'null'
401
- ? inputValue
402
- : ''
403
- }
404
- />
405
- );
406
- break;
407
- case 'textarea':
408
- htmlContainer = (
409
- <textarea
410
- name={settings.id}
411
- className={inputClass[settings.id]}
412
- onChange={onChange}
413
- value={
414
- inputValue && inputValue !== 'null'
415
- ? inputValue
416
- : ''
417
- }
418
- style={{ height: '200px' }}
419
- ></textarea>
420
- );
421
- break;
422
- case 'address':
423
- htmlContainer = (
424
- <VisnsAutocomplete
425
- onSelect={(place) =>
426
- autocompleteCallback(place)
427
- }
428
- field={settings.id}
429
- setFormData={setFormData}
430
- api="pk.eyJ1IjoidmlzbnMtc3R1ZGlvIiwiYSI6ImNrbGlraW5vZDBhMDYycHBsdmk5b3ljbGQifQ.ZGUBk0PWac5GahUeVHdTpg"
431
- inputValue={inputValue}
432
- />
433
- );
434
- break;
435
- case 'dropdown':
436
- htmlContainer = (
437
- <Select
438
- settings={settings}
439
- className={inputClass[settings.id]}
440
- onChange={onChange}
441
- inputValue={
442
- inputValue === null ? '' : inputValue
443
- }
444
- options={settings.options}
445
- dataOptions={dataOptions}
446
- />
447
- );
448
- break;
449
- case 'dropdown-ajax':
450
- htmlContainer = (
451
- <Select
452
- settings={settings}
453
- className={inputClass[settings.id]}
454
- onChange={onChange}
455
- inputValue={
456
- inputValue === null ? '' : inputValue
457
- }
458
- options={options}
459
- dataOptions={dataOptions}
460
- />
461
- );
462
- break;
463
- case 'multi-dropdown':
464
- htmlContainer = (
465
- <MultiSelect
466
- settings={settings}
467
- className={inputClass[settings.id]}
468
- onChange={onChangeSelect}
469
- inputValue={
470
- inputValue === null ? '' : inputValue
471
- }
472
- options={settings.options}
473
- multi={
474
- settings.multiple
475
- ? settings.multiple
476
- : false
477
- }
478
- />
479
- );
480
- break;
481
- case 'multi-dropdown-ajax':
482
- htmlContainer = (
483
- <MultiSelect
484
- settings={settings}
485
- className={inputClass[settings.id]}
486
- onChange={onChangeSelect}
487
- inputValue={
488
- inputValue === null ? '' : inputValue
489
- }
490
- options={options}
491
- multi={
492
- settings.multiple
493
- ? settings.multiple
494
- : false
495
- }
496
- />
497
- );
498
- break;
499
- case 'file':
500
- htmlContainer = (
501
- <input
502
- type="file"
503
- name={settings.id}
504
- className={inputClass[settings.id]}
505
- onChange={onChangeFile}
506
- />
507
- );
508
- break;
509
-
510
- case 'line-break':
511
- htmlContainer = (
512
- <div className="formbreak">
513
- <span>
514
- {settings.label}{' '}
515
- {settings.required === true ? '*' : ''}
516
- </span>
517
- </div>
518
- );
519
- break;
520
- case 'checkbox':
521
- htmlContainer = (
522
- <input
523
- type="checkbox"
524
- name={settings.id}
525
- className={inputClass[settings.id]}
526
- placeholder=" "
527
- onChange={onChange}
528
- value={inputValue || ''}
529
- />
530
- );
531
- break;
532
- default:
533
- htmlContainer = '';
534
- break;
535
- }
536
-
537
- return htmlContainer;
538
- })()}
539
-
540
- {(() => {
541
- if (
542
- settings.type !== 'address' &&
543
- settings.type !== 'date' &&
544
- settings.type !== 'datetime' &&
545
- settings.type !== 'line-break' &&
546
- settings.type !== 'checkbox' &&
547
- settings.type !== 'multi-dropdown' &&
548
- settings.type !== 'multi-dropdown-ajax' &&
549
- settings.type !== 'toggle' &&
550
- settings.type !== 'richeditor' &&
551
- settings.type !== 'image' &&
552
- settings.type !== 'gallery'
553
- ) {
554
- return (
555
- <span className="fi__span">
556
- {settings.label}{' '}
557
- {settings.required === true ? '*' : ''}
558
- </span>
559
- );
560
- }
561
- })()}
562
- </label>
563
-
564
- {(() => {
565
- let htmlContainer;
566
- switch (settings.type) {
567
- case 'date':
568
- htmlContainer = (
569
- <DatePicker
570
- dateFormat={
571
- settings.format
572
- ? settings.format
573
- : 'dd-MM-yyyy'
574
- }
575
- className={inputClass[settings.id]}
576
- selected={
577
- inputValue
578
- ? moment(inputValue).toDate()
579
- : ''
580
- }
581
- showMonthDropdown
582
- showYearDropdown
583
- dropdownMode="select"
584
- onChange={(date) =>
585
- onChangeDate(date, settings.id)
586
- }
587
- />
588
- );
589
- break;
590
- case 'datetime':
591
- htmlContainer = (
592
- <DatePicker
593
- dateFormat={
594
- settings.format
595
- ? settings.format
596
- : 'dd-MM-yyyy hh:mm aa'
597
- }
598
- showTimeSelect
599
- className={inputClass[settings.id]}
600
- selected={
601
- inputValue
602
- ? moment(inputValue).toDate()
603
- : ''
604
- }
605
- showMonthDropdown
606
- showYearDropdown
607
- dropdownMode="select"
608
- onChange={(date) =>
609
- onChangeDate(date, settings.id)
610
- }
611
- shouldCloseOnSelect={true}
612
- />
613
- );
614
- break;
615
- case 'time':
616
- htmlContainer = (
617
- <DatePicker
618
- dateFormat={
619
- settings.format
620
- ? settings.format
621
- : 'hh:mm aa'
622
- }
623
- showTimeSelect
624
- showTimeSelectOnly
625
- timeIntervals={15}
626
- timeCaption="Time"
627
- className={inputClass[settings.id]}
628
- selected={
629
- inputValue
630
- ? moment(inputValue).toDate()
631
- : ''
632
- }
633
- onChange={(date) =>
634
- onChangeDate(date, settings.id)
635
- }
636
- shouldCloseOnSelect={true}
637
- />
638
- );
639
- break;
640
- case 'toggle':
641
- htmlContainer = (
642
- <div>
643
- <Toggle
644
- name={settings.id}
645
- data-show={
646
- settings.show
647
- ? JSON.stringify(settings.show)
648
- : ''
649
- }
650
- checked={
651
- inputValue !== undefined
652
- ? inputValue === ''
653
- ? false
654
- : inputValue === 'on'
655
- ? false
656
- : Boolean(inputValue)
657
- : false
658
- }
659
- onChange={onChangeToggle}
660
- />
661
- <span className="fi__toggletxt">
662
- {settings.label}{' '}
663
- {settings.required === true ? '*' : ''}
664
- </span>
665
- </div>
666
- );
667
- break;
668
- case 'richeditor':
669
- htmlContainer = (
670
- <Editor
671
- tinymceScriptSrc="https://d16lktya8ojp5z.cloudfront.net/generic/packages/tinymce_v701/tinymce.min.js"
672
- licenseKey="gpl"
673
- onEditorChange={(value, e) => {
674
- onChangeRicheditor(e, value, settings.id);
675
- }}
676
- onInit={(evt, editor) =>
677
- (editorRef.current = editor)
678
- }
679
- value={inputValue || ''}
680
- init={{
681
- branding: false,
682
- height: 500,
683
- menubar: false,
684
- plugins: [
685
- 'advlist',
686
- 'autolink',
687
- 'lists',
688
- 'link',
689
- 'image',
690
- 'charmap',
691
- 'preview',
692
- 'anchor',
693
- 'searchreplace',
694
- 'visualblocks',
695
- 'code',
696
- 'fullscreen',
697
- 'insertdatetime',
698
- 'media',
699
- 'table',
700
- 'code',
701
- ],
702
- toolbar:
703
- 'undo redo | blocks | ' +
704
- 'bold italic forecolor | alignleft aligncenter ' +
705
- 'alignright alignjustify | bullist numlist outdent indent | ' +
706
- 'removeformat | table',
707
- content_style:
708
- 'body { font-family:Helvetica,Arial,sans-serif; font-size:14px }',
709
- }}
710
- />
711
- );
712
- break;
713
- case 'image':
714
- htmlContainer = (
715
- <>
716
- <motion.div
717
- className="progress__bar"
718
- initial={{ width: '0%' }}
719
- animate={{
720
- width:
721
- uploadProgress[settings.id] + '%',
722
- }}
723
- transition={{
724
- duration: 3,
725
- ease: [0.165, 0.84, 0.44, 1.0],
726
- }}
727
- />
728
- <input
729
- type="file"
730
- name={settings.id}
731
- className={inputClass[settings.id]}
732
- onChange={onChangeFile}
733
- ref={inputFile}
734
- style={{ display: 'none' }}
735
- />
736
- <div
737
- onClick={() => {
738
- inputFile.current.click();
739
- }}
740
- >
741
- {inputValue && inputValue !== '' ? (
742
- <>
743
- {inputValue.file_url &&
744
- inputValue.file_url !== '' ? (
745
- <img
746
- src={inputValue.file_url}
747
- width="200"
748
- />
749
- ) : (
750
- <img
751
- src={URL.createObjectURL(
752
- inputValue
753
- )}
754
- width="200"
755
- />
756
- )}
757
- </>
758
- ) : (
759
- <div className="imageupload">
760
- <span>
761
- Click here to upload an image
762
- </span>
763
- </div>
764
- )}
765
- </div>
766
- </>
767
- );
768
- break;
769
- case 'gallery':
770
- if (
771
- baseData[settings.key] &&
772
- baseData[settings.key] > 0
773
- ) {
774
- const dropzoneUrl = `${settings.url}/${
775
- baseData[settings.key]
776
- }`;
777
-
778
- htmlContainer = (
779
- <VisnsDropZone
780
- fetchData={fetchData}
781
- files={baseData[settings.id]}
782
- settings={{
783
- url: dropzoneUrl,
784
- method: settings.method,
785
- type: 'gallery',
786
- }}
787
- />
788
- );
789
- }
790
- break;
791
- default:
792
- htmlContainer = '';
793
- break;
794
- }
795
-
796
- return htmlContainer;
797
- })()}
798
- </div>
799
- );
800
- };
801
-
802
- export default Field;