@tyx1703/json-schema-editor-visual 1.0.0

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.
@@ -0,0 +1,735 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useState } from "react";
3
+ import { Checkbox, Col, Input, InputNumber, Row, Select, Switch, Tooltip } from "antd";
4
+ import { QuestionCircleOutlined } from "@ant-design/icons";
5
+ import "./schemaJson.css";
6
+ import { isNil } from "../../utils.js";
7
+ import MonacoEditor from "../MonacoEditor/index.js";
8
+ import { useLocalProvider } from "../LocalProvider/index.js";
9
+ const { TextArea: TextArea } = Input;
10
+ const Option = Select.Option;
11
+ const changeOtherValue = (value, name, data, change)=>{
12
+ data[name] = value;
13
+ change(data);
14
+ };
15
+ const SchemaString = ({ data, changeCustomValue, format })=>{
16
+ const LocalProvider = useLocalProvider();
17
+ const [checked, setChecked] = useState(!isNil(data.enum));
18
+ useEffect(()=>{
19
+ setChecked(!isNil(data.enum));
20
+ }, [
21
+ data.enum
22
+ ]);
23
+ const handleChangeOtherValue = (value, name)=>{
24
+ data[name] = value;
25
+ changeCustomValue(data);
26
+ };
27
+ const changeEnumOtherValue = (value)=>{
28
+ const arr = value.split('\n');
29
+ if (0 !== arr.length && (1 !== arr.length || arr[0])) {
30
+ data.enum = arr;
31
+ changeCustomValue(data);
32
+ } else {
33
+ delete data.enum;
34
+ changeCustomValue(data);
35
+ }
36
+ };
37
+ const changeEnumDescOtherValue = (value)=>{
38
+ data.enumDesc = value;
39
+ changeCustomValue(data);
40
+ };
41
+ const onChangeCheckBox = (checked)=>{
42
+ setChecked(checked);
43
+ if (!checked) {
44
+ delete data.enum;
45
+ changeCustomValue(data);
46
+ }
47
+ };
48
+ return /*#__PURE__*/ jsxs("div", {
49
+ children: [
50
+ /*#__PURE__*/ jsx("div", {
51
+ className: "default-setting",
52
+ children: LocalProvider('base_setting')
53
+ }),
54
+ /*#__PURE__*/ jsxs(Row, {
55
+ className: "other-row",
56
+ align: "middle",
57
+ children: [
58
+ /*#__PURE__*/ jsxs(Col, {
59
+ span: 4,
60
+ className: "other-label",
61
+ children: [
62
+ LocalProvider('default'),
63
+ ":"
64
+ ]
65
+ }),
66
+ /*#__PURE__*/ jsx(Col, {
67
+ span: 20,
68
+ children: /*#__PURE__*/ jsx(Input, {
69
+ value: data.default,
70
+ placeholder: LocalProvider('default'),
71
+ onChange: (e)=>handleChangeOtherValue(e.target.value, 'default')
72
+ })
73
+ })
74
+ ]
75
+ }),
76
+ /*#__PURE__*/ jsxs(Row, {
77
+ className: "other-row",
78
+ align: "middle",
79
+ children: [
80
+ /*#__PURE__*/ jsx(Col, {
81
+ span: 12,
82
+ children: /*#__PURE__*/ jsxs(Row, {
83
+ align: "middle",
84
+ children: [
85
+ /*#__PURE__*/ jsxs(Col, {
86
+ span: 8,
87
+ className: "other-label",
88
+ children: [
89
+ LocalProvider('minLength'),
90
+ ":"
91
+ ]
92
+ }),
93
+ /*#__PURE__*/ jsx(Col, {
94
+ span: 16,
95
+ children: /*#__PURE__*/ jsx(InputNumber, {
96
+ value: data.minLength,
97
+ placeholder: "min.length",
98
+ onChange: (e)=>handleChangeOtherValue(e, 'minLength')
99
+ })
100
+ })
101
+ ]
102
+ })
103
+ }),
104
+ /*#__PURE__*/ jsx(Col, {
105
+ span: 12,
106
+ children: /*#__PURE__*/ jsxs(Row, {
107
+ align: "middle",
108
+ children: [
109
+ /*#__PURE__*/ jsxs(Col, {
110
+ span: 8,
111
+ className: "other-label",
112
+ children: [
113
+ LocalProvider('maxLength'),
114
+ ":"
115
+ ]
116
+ }),
117
+ /*#__PURE__*/ jsx(Col, {
118
+ span: 16,
119
+ children: /*#__PURE__*/ jsx(InputNumber, {
120
+ value: data.maxLength,
121
+ placeholder: "max.length",
122
+ onChange: (e)=>handleChangeOtherValue(e, 'maxLength')
123
+ })
124
+ })
125
+ ]
126
+ })
127
+ })
128
+ ]
129
+ }),
130
+ /*#__PURE__*/ jsxs(Row, {
131
+ className: "other-row",
132
+ align: "middle",
133
+ children: [
134
+ /*#__PURE__*/ jsx(Col, {
135
+ span: 4,
136
+ className: "other-label",
137
+ children: /*#__PURE__*/ jsxs("span", {
138
+ children: [
139
+ "Pattern\xa0",
140
+ /*#__PURE__*/ jsx(Tooltip, {
141
+ title: LocalProvider('pattern'),
142
+ children: /*#__PURE__*/ jsx(QuestionCircleOutlined, {
143
+ type: "question-circle-o",
144
+ style: {
145
+ width: '10px'
146
+ }
147
+ })
148
+ }),
149
+ "\xa0 :"
150
+ ]
151
+ })
152
+ }),
153
+ /*#__PURE__*/ jsx(Col, {
154
+ span: 20,
155
+ children: /*#__PURE__*/ jsx(Input, {
156
+ value: data.pattern,
157
+ placeholder: "Pattern",
158
+ onChange: (e)=>handleChangeOtherValue(e.target.value, 'pattern')
159
+ })
160
+ })
161
+ ]
162
+ }),
163
+ /*#__PURE__*/ jsxs(Row, {
164
+ className: "other-row",
165
+ align: "middle",
166
+ children: [
167
+ /*#__PURE__*/ jsx(Col, {
168
+ span: 4,
169
+ className: "other-label",
170
+ children: /*#__PURE__*/ jsxs("span", {
171
+ children: [
172
+ LocalProvider('enum'),
173
+ /*#__PURE__*/ jsx(Checkbox, {
174
+ checked: checked,
175
+ onChange: (e)=>onChangeCheckBox(e.target.checked)
176
+ }),
177
+ ' ',
178
+ ":"
179
+ ]
180
+ })
181
+ }),
182
+ /*#__PURE__*/ jsx(Col, {
183
+ span: 20,
184
+ children: /*#__PURE__*/ jsx(TextArea, {
185
+ value: data.enum && data.enum.length && data.enum.join('\n'),
186
+ disabled: !checked,
187
+ placeholder: LocalProvider('enum_msg'),
188
+ autoSize: {
189
+ minRows: 2,
190
+ maxRows: 6
191
+ },
192
+ onChange: (e)=>{
193
+ changeEnumOtherValue(e.target.value);
194
+ }
195
+ })
196
+ })
197
+ ]
198
+ }),
199
+ checked && /*#__PURE__*/ jsxs(Row, {
200
+ className: "other-row",
201
+ align: "middle",
202
+ children: [
203
+ /*#__PURE__*/ jsx(Col, {
204
+ span: 4,
205
+ className: "other-label",
206
+ children: /*#__PURE__*/ jsx("span", {
207
+ children: LocalProvider('enum_desc')
208
+ })
209
+ }),
210
+ /*#__PURE__*/ jsx(Col, {
211
+ span: 20,
212
+ children: /*#__PURE__*/ jsx(TextArea, {
213
+ value: data.enumDesc,
214
+ disabled: !checked,
215
+ placeholder: LocalProvider('enum_desc_msg'),
216
+ autoSize: {
217
+ minRows: 2,
218
+ maxRows: 6
219
+ },
220
+ onChange: (e)=>{
221
+ changeEnumDescOtherValue(e.target.value);
222
+ }
223
+ })
224
+ })
225
+ ]
226
+ }),
227
+ /*#__PURE__*/ jsxs(Row, {
228
+ className: "other-row",
229
+ align: "middle",
230
+ children: [
231
+ /*#__PURE__*/ jsx(Col, {
232
+ span: 4,
233
+ className: "other-label",
234
+ children: /*#__PURE__*/ jsx("span", {
235
+ children: "format :"
236
+ })
237
+ }),
238
+ /*#__PURE__*/ jsx(Col, {
239
+ span: 20,
240
+ children: /*#__PURE__*/ jsx(Select, {
241
+ showSearch: true,
242
+ style: {
243
+ width: 150
244
+ },
245
+ value: data.format,
246
+ dropdownClassName: "json-schema-react-editor-adv-modal-select",
247
+ placeholder: "Select a format",
248
+ optionFilterProp: "children",
249
+ optionLabelProp: "value",
250
+ onChange: (e)=>handleChangeOtherValue(e, 'format'),
251
+ filterOption: (input, option)=>option?.value?.toLowerCase().indexOf(input.toLowerCase()) >= 0,
252
+ children: format.map((item)=>/*#__PURE__*/ jsxs(Option, {
253
+ value: item.name,
254
+ children: [
255
+ item.name,
256
+ ' ',
257
+ /*#__PURE__*/ jsx("span", {
258
+ className: "format-items-title",
259
+ children: item.title
260
+ })
261
+ ]
262
+ }, item.name))
263
+ })
264
+ })
265
+ ]
266
+ })
267
+ ]
268
+ });
269
+ };
270
+ const SchemaNumber = ({ data, changeCustomValue })=>{
271
+ const LocalProvider = useLocalProvider();
272
+ const [checked, setChecked] = useState(!isNil(data.enum));
273
+ const [enumValue, setEnumValue] = useState(isNil(data.enum) ? '' : data.enum.join('\n'));
274
+ useEffect(()=>{
275
+ const nextEnumStr = isNil(data.enum) ? '' : data.enum.join('\n');
276
+ setEnumValue(nextEnumStr);
277
+ }, [
278
+ data.enum
279
+ ]);
280
+ const onChangeCheckBox = (checked)=>{
281
+ setChecked(checked);
282
+ if (!checked) {
283
+ delete data.enum;
284
+ setEnumValue('');
285
+ changeCustomValue(data);
286
+ }
287
+ };
288
+ const changeEnumOtherValue = (value)=>{
289
+ setEnumValue(value);
290
+ const arr = value.split('\n');
291
+ if (0 !== arr.length && (1 !== arr.length || arr[0])) {
292
+ data.enum = arr.map((item)=>+item);
293
+ changeCustomValue(data);
294
+ } else {
295
+ delete data.enum;
296
+ changeCustomValue(data);
297
+ }
298
+ };
299
+ const changeEnumDescOtherValue = (value)=>{
300
+ data.enumDesc = value;
301
+ changeCustomValue(data);
302
+ };
303
+ return /*#__PURE__*/ jsxs("div", {
304
+ children: [
305
+ /*#__PURE__*/ jsx("div", {
306
+ className: "default-setting",
307
+ children: LocalProvider('base_setting')
308
+ }),
309
+ /*#__PURE__*/ jsxs(Row, {
310
+ className: "other-row",
311
+ align: "middle",
312
+ children: [
313
+ /*#__PURE__*/ jsxs(Col, {
314
+ span: 4,
315
+ className: "other-label",
316
+ children: [
317
+ LocalProvider('default'),
318
+ ":"
319
+ ]
320
+ }),
321
+ /*#__PURE__*/ jsx(Col, {
322
+ span: 20,
323
+ children: /*#__PURE__*/ jsx(Input, {
324
+ value: data.default,
325
+ placeholder: LocalProvider('default'),
326
+ onChange: (e)=>changeOtherValue(e.target.value, 'default', data, changeCustomValue),
327
+ "data-testid": null
328
+ })
329
+ })
330
+ ]
331
+ }),
332
+ /*#__PURE__*/ jsxs(Row, {
333
+ className: "other-row",
334
+ align: "middle",
335
+ children: [
336
+ /*#__PURE__*/ jsx(Col, {
337
+ span: 12,
338
+ children: /*#__PURE__*/ jsxs(Row, {
339
+ align: "middle",
340
+ children: [
341
+ /*#__PURE__*/ jsx(Col, {
342
+ span: 13,
343
+ className: "other-label",
344
+ children: /*#__PURE__*/ jsxs("span", {
345
+ children: [
346
+ "exclusiveMinimum\xa0",
347
+ /*#__PURE__*/ jsx(Tooltip, {
348
+ title: LocalProvider('exclusiveMinimum'),
349
+ children: /*#__PURE__*/ jsx(QuestionCircleOutlined, {
350
+ type: "question-circle-o",
351
+ style: {
352
+ width: '10px'
353
+ }
354
+ })
355
+ }),
356
+ "\xa0 :"
357
+ ]
358
+ })
359
+ }),
360
+ /*#__PURE__*/ jsx(Col, {
361
+ span: 11,
362
+ children: /*#__PURE__*/ jsx(Switch, {
363
+ checked: data.exclusiveMinimum,
364
+ onChange: (e)=>changeOtherValue(e, 'exclusiveMinimum', data, changeCustomValue),
365
+ "data-testid": null
366
+ })
367
+ })
368
+ ]
369
+ })
370
+ }),
371
+ /*#__PURE__*/ jsx(Col, {
372
+ span: 12,
373
+ children: /*#__PURE__*/ jsxs(Row, {
374
+ align: "middle",
375
+ children: [
376
+ /*#__PURE__*/ jsx(Col, {
377
+ span: 13,
378
+ className: "other-label",
379
+ children: /*#__PURE__*/ jsxs("span", {
380
+ children: [
381
+ "exclusiveMaximum\xa0",
382
+ /*#__PURE__*/ jsx(Tooltip, {
383
+ title: LocalProvider('exclusiveMaximum'),
384
+ children: /*#__PURE__*/ jsx(QuestionCircleOutlined, {
385
+ type: "question-circle-o",
386
+ style: {
387
+ width: '10px'
388
+ }
389
+ })
390
+ }),
391
+ "\xa0 :"
392
+ ]
393
+ })
394
+ }),
395
+ /*#__PURE__*/ jsx(Col, {
396
+ span: 11,
397
+ children: /*#__PURE__*/ jsx(Switch, {
398
+ checked: data.exclusiveMaximum,
399
+ onChange: (e)=>changeOtherValue(e, 'exclusiveMaximum', data, changeCustomValue),
400
+ "data-testid": null
401
+ })
402
+ })
403
+ ]
404
+ })
405
+ })
406
+ ]
407
+ }),
408
+ /*#__PURE__*/ jsxs(Row, {
409
+ className: "other-row",
410
+ align: "middle",
411
+ children: [
412
+ /*#__PURE__*/ jsx(Col, {
413
+ span: 12,
414
+ children: /*#__PURE__*/ jsxs(Row, {
415
+ align: "middle",
416
+ children: [
417
+ /*#__PURE__*/ jsxs(Col, {
418
+ span: 8,
419
+ className: "other-label",
420
+ children: [
421
+ LocalProvider('minimum'),
422
+ ":"
423
+ ]
424
+ }),
425
+ /*#__PURE__*/ jsx(Col, {
426
+ span: 16,
427
+ children: /*#__PURE__*/ jsx(InputNumber, {
428
+ value: data.minimum,
429
+ placeholder: LocalProvider('minimum'),
430
+ onChange: (e)=>changeOtherValue(e, 'minimum', data, changeCustomValue),
431
+ "data-testid": null
432
+ })
433
+ })
434
+ ]
435
+ })
436
+ }),
437
+ /*#__PURE__*/ jsx(Col, {
438
+ span: 12,
439
+ children: /*#__PURE__*/ jsxs(Row, {
440
+ align: "middle",
441
+ children: [
442
+ /*#__PURE__*/ jsxs(Col, {
443
+ span: 8,
444
+ className: "other-label",
445
+ children: [
446
+ LocalProvider('maximum'),
447
+ ":"
448
+ ]
449
+ }),
450
+ /*#__PURE__*/ jsx(Col, {
451
+ span: 16,
452
+ children: /*#__PURE__*/ jsx(InputNumber, {
453
+ value: data.maximum,
454
+ placeholder: LocalProvider('maximum'),
455
+ onChange: (e)=>changeOtherValue(e, 'maximum', data, changeCustomValue),
456
+ "data-testid": null
457
+ })
458
+ })
459
+ ]
460
+ })
461
+ })
462
+ ]
463
+ }),
464
+ /*#__PURE__*/ jsxs(Row, {
465
+ className: "other-row",
466
+ align: "middle",
467
+ children: [
468
+ /*#__PURE__*/ jsx(Col, {
469
+ span: 4,
470
+ className: "other-label",
471
+ children: /*#__PURE__*/ jsxs("span", {
472
+ children: [
473
+ LocalProvider('enum'),
474
+ /*#__PURE__*/ jsx(Checkbox, {
475
+ checked: checked,
476
+ onChange: (e)=>onChangeCheckBox(e.target.checked),
477
+ "data-testid": null
478
+ }),
479
+ ' ',
480
+ ":"
481
+ ]
482
+ })
483
+ }),
484
+ /*#__PURE__*/ jsx(Col, {
485
+ span: 20,
486
+ children: /*#__PURE__*/ jsx(TextArea, {
487
+ value: enumValue,
488
+ disabled: !checked,
489
+ placeholder: LocalProvider('enum_msg'),
490
+ autoSize: {
491
+ minRows: 2,
492
+ maxRows: 6
493
+ },
494
+ onChange: (e)=>{
495
+ changeEnumOtherValue(e.target.value);
496
+ },
497
+ "data-testid": null
498
+ })
499
+ })
500
+ ]
501
+ }),
502
+ checked && /*#__PURE__*/ jsxs(Row, {
503
+ className: "other-row",
504
+ align: "middle",
505
+ children: [
506
+ /*#__PURE__*/ jsx(Col, {
507
+ span: 4,
508
+ className: "other-label",
509
+ children: /*#__PURE__*/ jsxs("span", {
510
+ children: [
511
+ LocalProvider('enum_desc'),
512
+ " :"
513
+ ]
514
+ })
515
+ }),
516
+ /*#__PURE__*/ jsx(Col, {
517
+ span: 20,
518
+ children: /*#__PURE__*/ jsx(TextArea, {
519
+ value: data.enumDesc,
520
+ disabled: !checked,
521
+ placeholder: LocalProvider('enum_desc_msg'),
522
+ autoSize: {
523
+ minRows: 2,
524
+ maxRows: 6
525
+ },
526
+ onChange: (e)=>{
527
+ changeEnumDescOtherValue(e.target.value);
528
+ },
529
+ "data-testid": null
530
+ })
531
+ })
532
+ ]
533
+ })
534
+ ]
535
+ });
536
+ };
537
+ const SchemaBoolean = ({ data, changeCustomValue })=>{
538
+ const LocalProvider = useLocalProvider();
539
+ const value = isNil(data.default) ? '' : data.default ? 'true' : 'false';
540
+ return /*#__PURE__*/ jsxs("div", {
541
+ children: [
542
+ /*#__PURE__*/ jsx("div", {
543
+ className: "default-setting",
544
+ children: LocalProvider('base_setting')
545
+ }),
546
+ /*#__PURE__*/ jsxs(Row, {
547
+ className: "other-row",
548
+ align: "middle",
549
+ children: [
550
+ /*#__PURE__*/ jsxs(Col, {
551
+ span: 4,
552
+ className: "other-label",
553
+ children: [
554
+ LocalProvider('default'),
555
+ ":"
556
+ ]
557
+ }),
558
+ /*#__PURE__*/ jsx(Col, {
559
+ span: 20,
560
+ children: /*#__PURE__*/ jsxs(Select, {
561
+ value: value,
562
+ onChange: (e)=>changeOtherValue('true' === e, 'default', data, changeCustomValue),
563
+ style: {
564
+ width: 200
565
+ },
566
+ "data-testid": null,
567
+ children: [
568
+ /*#__PURE__*/ jsx(Option, {
569
+ value: "true",
570
+ children: "true"
571
+ }),
572
+ /*#__PURE__*/ jsx(Option, {
573
+ value: "false",
574
+ children: "false"
575
+ })
576
+ ]
577
+ })
578
+ })
579
+ ]
580
+ })
581
+ ]
582
+ });
583
+ };
584
+ const SchemaArray = ({ data, changeCustomValue })=>{
585
+ const LocalProvider = useLocalProvider();
586
+ return /*#__PURE__*/ jsxs("div", {
587
+ children: [
588
+ /*#__PURE__*/ jsx("div", {
589
+ className: "default-setting",
590
+ children: LocalProvider('base_setting')
591
+ }),
592
+ /*#__PURE__*/ jsxs(Row, {
593
+ className: "other-row",
594
+ align: "middle",
595
+ children: [
596
+ /*#__PURE__*/ jsx(Col, {
597
+ span: 6,
598
+ className: "other-label",
599
+ children: /*#__PURE__*/ jsxs("span", {
600
+ children: [
601
+ "uniqueItems\xa0",
602
+ /*#__PURE__*/ jsx(Tooltip, {
603
+ title: LocalProvider('unique_items'),
604
+ children: /*#__PURE__*/ jsx(QuestionCircleOutlined, {
605
+ type: "question-circle-o",
606
+ style: {
607
+ width: '10px'
608
+ }
609
+ })
610
+ }),
611
+ "\xa0 :"
612
+ ]
613
+ })
614
+ }),
615
+ /*#__PURE__*/ jsx(Col, {
616
+ span: 18,
617
+ children: /*#__PURE__*/ jsx(Switch, {
618
+ checked: data.uniqueItems,
619
+ onChange: (e)=>changeOtherValue(e, 'uniqueItems', data, changeCustomValue),
620
+ "data-testid": null
621
+ })
622
+ })
623
+ ]
624
+ }),
625
+ /*#__PURE__*/ jsxs(Row, {
626
+ className: "other-row",
627
+ align: "middle",
628
+ children: [
629
+ /*#__PURE__*/ jsx(Col, {
630
+ span: 12,
631
+ children: /*#__PURE__*/ jsxs(Row, {
632
+ align: "middle",
633
+ children: [
634
+ /*#__PURE__*/ jsxs(Col, {
635
+ span: 12,
636
+ className: "other-label",
637
+ children: [
638
+ LocalProvider('min_items'),
639
+ ":"
640
+ ]
641
+ }),
642
+ /*#__PURE__*/ jsx(Col, {
643
+ span: 12,
644
+ children: /*#__PURE__*/ jsx(InputNumber, {
645
+ value: data.minItems,
646
+ placeholder: "minItems",
647
+ onChange: (e)=>changeOtherValue(e, 'minItems', data, changeCustomValue),
648
+ "data-testid": null
649
+ })
650
+ })
651
+ ]
652
+ })
653
+ }),
654
+ /*#__PURE__*/ jsx(Col, {
655
+ span: 12,
656
+ children: /*#__PURE__*/ jsxs(Row, {
657
+ align: "middle",
658
+ children: [
659
+ /*#__PURE__*/ jsxs(Col, {
660
+ span: 12,
661
+ className: "other-label",
662
+ children: [
663
+ LocalProvider('max_items'),
664
+ ":"
665
+ ]
666
+ }),
667
+ /*#__PURE__*/ jsx(Col, {
668
+ span: 12,
669
+ children: /*#__PURE__*/ jsx(InputNumber, {
670
+ value: data.maxItems,
671
+ placeholder: "maxItems",
672
+ onChange: (e)=>changeOtherValue(e, 'maxItems', data, changeCustomValue),
673
+ "data-testid": null
674
+ })
675
+ })
676
+ ]
677
+ })
678
+ })
679
+ ]
680
+ })
681
+ ]
682
+ });
683
+ };
684
+ const mapping = (data, changeCustomValue, format)=>{
685
+ const map = {
686
+ string: /*#__PURE__*/ jsx(SchemaString, {
687
+ data: data,
688
+ changeCustomValue: changeCustomValue,
689
+ format: format
690
+ }),
691
+ number: /*#__PURE__*/ jsx(SchemaNumber, {
692
+ data: data,
693
+ changeCustomValue: changeCustomValue
694
+ }),
695
+ boolean: /*#__PURE__*/ jsx(SchemaBoolean, {
696
+ data: data,
697
+ changeCustomValue: changeCustomValue
698
+ }),
699
+ integer: /*#__PURE__*/ jsx(SchemaNumber, {
700
+ data: data,
701
+ changeCustomValue: changeCustomValue
702
+ }),
703
+ array: /*#__PURE__*/ jsx(SchemaArray, {
704
+ data: data,
705
+ changeCustomValue: changeCustomValue
706
+ })
707
+ };
708
+ return map[data.type];
709
+ };
710
+ const handleInputEditor = (e, change)=>{
711
+ if (!e.text || !e.jsonData) return;
712
+ change(e.jsonData);
713
+ };
714
+ function CustomItem({ data, changeCustomValue, format }) {
715
+ const LocalProvider = useLocalProvider();
716
+ const parsed = JSON.parse(data);
717
+ const optionForm = mapping(parsed, changeCustomValue, format);
718
+ return /*#__PURE__*/ jsxs("div", {
719
+ children: [
720
+ /*#__PURE__*/ jsx("div", {
721
+ children: optionForm
722
+ }),
723
+ /*#__PURE__*/ jsx("div", {
724
+ className: "default-setting",
725
+ children: LocalProvider('all_setting')
726
+ }),
727
+ /*#__PURE__*/ jsx(MonacoEditor, {
728
+ data: data,
729
+ mode: "json",
730
+ onChange: (e)=>handleInputEditor(e, changeCustomValue)
731
+ })
732
+ ]
733
+ });
734
+ }
735
+ export default CustomItem;