szld-libs 0.3.49 → 0.3.51

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.
@@ -23,7 +23,7 @@ const MyCheckbox = (props) => {
23
23
  const [val, setVal] = useState(value || []);
24
24
  useEffect(() => {
25
25
  handleLoadOptions();
26
- }, [item.inputType, item.classify, item.data, item.options]);
26
+ }, [item.inputType, item.classify, item.data, item.options, langConfig]);
27
27
  const handleLoadOptions = async () => {
28
28
  const list2 = await handleSelectOptions({
29
29
  commonRequestWidthParams,
@@ -21,7 +21,7 @@ const MyRadio = (props) => {
21
21
  const [list, setList] = useState([]);
22
22
  useEffect(() => {
23
23
  handleLoadOptions();
24
- }, [item.inputType, item.classify, item.data, item.options]);
24
+ }, [item.inputType, item.classify, item.data, item.options, langConfig]);
25
25
  const handleLoadOptions = async () => {
26
26
  const list2 = await handleSelectOptions({
27
27
  commonRequestWidthParams,
@@ -21,7 +21,7 @@ const MySelect = ({
21
21
  const [loading, setLoading] = useState(false);
22
22
  useEffect(() => {
23
23
  handleLoadOptions();
24
- }, [item.inputType, item.classify, item.data, item.options]);
24
+ }, [item.inputType, item.classify, item.data, item.options, langConfig]);
25
25
  const handleLoadOptions = async () => {
26
26
  setLoading(true);
27
27
  const list = await handleSelectOptions({
@@ -397,7 +397,7 @@ function useDynamicForm(props) {
397
397
  }
398
398
  return null;
399
399
  },
400
- [handleDealInstruction, handleSetFormItemInitialValue, handleSetFormItemProps, renderNestedFormList]
400
+ [handleDealInstruction, handleSetFormItemInitialValue, handleSetFormItemProps, renderNestedFormList, langConfig]
401
401
  );
402
402
  const handleOnRemove = async (file) => {
403
403
  var _a;
@@ -422,297 +422,300 @@ function useDynamicForm(props) {
422
422
  return false;
423
423
  }
424
424
  };
425
- const handleRenderItemInputMode = ({
426
- item,
427
- readonly = false,
428
- formItemStyle = [],
429
- radioAlign = "horizontal",
430
- relatedid,
431
- form,
432
- defaultWidth = 358,
433
- customWidth = {}
434
- }) => {
435
- var _a, _b, _c, _d, _e, _f;
436
- const mode = item.json.input || "text";
437
- const format = ((_a = item.json) == null ? void 0 : _a.format) || "";
438
- const attrid = item.attrid;
439
- const formatValue = handleSetFormItemInitialValue(item);
440
- const message2 = getTitle(langConfig, (_b = item.json) == null ? void 0 : _b["default-prompt"]) || "";
441
- const disableDateGoover = ((_c = item.json) == null ? void 0 : _c["disable-date-goover"]) || false;
442
- const placeholder = handleGetPlaceholder(item, langId);
443
- const params = item.json.length && {
444
- maxLength: item.json.length
445
- } || {};
446
- const itemStyle = formItemStyle.find((v) => v.type === mode);
447
- let inputWidth = (_d = item.json) == null ? void 0 : _d["input-width"];
448
- if (inputWidth) {
449
- inputWidth = formShowType === "table" ? Number(inputWidth) - 32 : inputWidth;
450
- }
451
- const width = inputWidth || defaultWidth;
452
- switch (mode) {
453
- case "label":
454
- return /* @__PURE__ */ jsx(
455
- Input,
456
- {
457
- disabled: true,
458
- value: ((_e = item.json) == null ? void 0 : _e["label-value"]) || item.attrvalue || ((_f = item.json) == null ? void 0 : _f.default) || "-",
459
- style: { width, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth }
460
- }
461
- );
462
- case "text":
463
- return /* @__PURE__ */ jsx(
464
- Input,
465
- {
466
- placeholder: message2 || placeholder,
467
- ...params,
468
- disabled: readonly,
469
- allowClear: true,
470
- style: { width, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth }
471
- }
472
- );
473
- case "password":
474
- return /* @__PURE__ */ jsx(
475
- Input.Password,
476
- {
477
- placeholder: message2 || placeholder,
478
- ...params,
479
- disabled: readonly,
480
- allowClear: true,
481
- style: { width, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth }
482
- }
483
- );
484
- case "textarea":
485
- return /* @__PURE__ */ jsx(
486
- Input.TextArea,
487
- {
488
- allowClear: true,
489
- placeholder: message2 || placeholder,
490
- rows: 5,
491
- ...params,
492
- disabled: readonly,
493
- style: { width, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth }
494
- }
495
- );
496
- case "number":
497
- return /* @__PURE__ */ jsx(
498
- InputNumber,
499
- {
500
- controls: false,
501
- placeholder: message2 || placeholder,
502
- ...params,
503
- disabled: readonly,
504
- style: { width, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth }
505
- }
506
- );
507
- case "select":
508
- case "mult-select": {
509
- return /* @__PURE__ */ jsx(
510
- MySelect,
511
- {
512
- item: item.json,
513
- readonly,
514
- style: { width, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth },
515
- commonRequestWidthParams,
516
- commonRequest,
517
- value: formatValue,
518
- interfaceTypeDict,
519
- interfaceTypeSysDict,
520
- actionUrlKey,
521
- actionUrlExtraParams,
522
- langId,
523
- langConfig,
524
- onChange: (val) => {
525
- form.setFieldValue(item.attrid, val);
526
- }
527
- }
528
- );
529
- }
530
- case "modal-mult-select":
531
- case "modal-select": {
532
- return /* @__PURE__ */ jsx(
533
- SelectModel,
534
- {
535
- style: { width, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth },
536
- item: item.json,
537
- value: item.attrvalue || item.json.default || "",
538
- commonRequestWidthParams,
539
- commonRequest,
540
- onSure: async (value) => {
541
- form.setFieldValue(item.attrid, value);
542
- },
543
- disabled: readonly,
544
- langId,
545
- CustomModalComponent
546
- }
547
- );
548
- }
549
- case "mul-field-modal-select": {
550
- return /* @__PURE__ */ jsx(
551
- SelectModelBackfillFormItem,
552
- {
553
- style: { width, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth },
554
- item: item.json,
555
- form,
556
- attrid,
557
- value: item.attrvalue || item.json.default || "",
558
- commonRequestWidthParams,
559
- commonRequest,
560
- onSure: async (value) => {
561
- form.setFieldsValue(value);
562
- },
563
- disabled: readonly,
564
- CustomModalComponent,
565
- langId
566
- }
567
- );
425
+ const handleRenderItemInputMode = useCallback(
426
+ ({
427
+ item,
428
+ readonly = false,
429
+ formItemStyle = [],
430
+ radioAlign = "horizontal",
431
+ relatedid,
432
+ form,
433
+ defaultWidth = 358,
434
+ customWidth = {}
435
+ }) => {
436
+ var _a, _b, _c, _d, _e, _f;
437
+ const mode = item.json.input || "text";
438
+ const format = ((_a = item.json) == null ? void 0 : _a.format) || "";
439
+ const attrid = item.attrid;
440
+ const formatValue = handleSetFormItemInitialValue(item);
441
+ const message2 = getTitle(langConfig, (_b = item.json) == null ? void 0 : _b["default-prompt"]) || "";
442
+ const disableDateGoover = ((_c = item.json) == null ? void 0 : _c["disable-date-goover"]) || false;
443
+ const placeholder = handleGetPlaceholder(item, langId);
444
+ const params = item.json.length && {
445
+ maxLength: item.json.length
446
+ } || {};
447
+ const itemStyle = formItemStyle.find((v) => v.type === mode);
448
+ let inputWidth = (_d = item.json) == null ? void 0 : _d["input-width"];
449
+ if (inputWidth) {
450
+ inputWidth = formShowType === "table" ? Number(inputWidth) - 32 : inputWidth;
568
451
  }
569
- case "date-picker":
570
- case "time-picker":
571
- case "week-picker":
572
- case "month-picker":
573
- case "quarter-picker":
574
- case "year-picker":
575
- case "second-picker": {
576
- const pickerObj = {
577
- "date-picker": "date",
578
- "time-picker": "date",
579
- "week-picker": "week",
580
- "month-picker": "month",
581
- "quarter-picker": "quarter",
582
- "year-picker": "year",
583
- "second-picker": "time"
584
- };
585
- let disabledDateFunc = void 0;
586
- if (mode === "date-picker") {
587
- disabledDateFunc = disableDateGoover ? disabledDate : void 0;
452
+ const width = inputWidth || defaultWidth;
453
+ switch (mode) {
454
+ case "label":
455
+ return /* @__PURE__ */ jsx(
456
+ Input,
457
+ {
458
+ disabled: true,
459
+ value: ((_e = item.json) == null ? void 0 : _e["label-value"]) || item.attrvalue || ((_f = item.json) == null ? void 0 : _f.default) || "-",
460
+ style: { width, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth }
461
+ }
462
+ );
463
+ case "text":
464
+ return /* @__PURE__ */ jsx(
465
+ Input,
466
+ {
467
+ placeholder: message2 || placeholder,
468
+ ...params,
469
+ disabled: readonly,
470
+ allowClear: true,
471
+ style: { width, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth }
472
+ }
473
+ );
474
+ case "password":
475
+ return /* @__PURE__ */ jsx(
476
+ Input.Password,
477
+ {
478
+ placeholder: message2 || placeholder,
479
+ ...params,
480
+ disabled: readonly,
481
+ allowClear: true,
482
+ style: { width, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth }
483
+ }
484
+ );
485
+ case "textarea":
486
+ return /* @__PURE__ */ jsx(
487
+ Input.TextArea,
488
+ {
489
+ allowClear: true,
490
+ placeholder: message2 || placeholder,
491
+ rows: 5,
492
+ ...params,
493
+ disabled: readonly,
494
+ style: { width, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth }
495
+ }
496
+ );
497
+ case "number":
498
+ return /* @__PURE__ */ jsx(
499
+ InputNumber,
500
+ {
501
+ controls: false,
502
+ placeholder: message2 || placeholder,
503
+ ...params,
504
+ disabled: readonly,
505
+ style: { width, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth }
506
+ }
507
+ );
508
+ case "select":
509
+ case "mult-select": {
510
+ return /* @__PURE__ */ jsx(
511
+ MySelect,
512
+ {
513
+ item: item.json,
514
+ readonly,
515
+ style: { width, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth },
516
+ commonRequestWidthParams,
517
+ commonRequest,
518
+ value: formatValue,
519
+ interfaceTypeDict,
520
+ interfaceTypeSysDict,
521
+ actionUrlKey,
522
+ actionUrlExtraParams,
523
+ langId,
524
+ langConfig,
525
+ onChange: (val) => {
526
+ form.setFieldValue(item.attrid, val);
527
+ }
528
+ }
529
+ );
588
530
  }
589
- return /* @__PURE__ */ jsx(
590
- DatePicker,
591
- {
592
- showTime: mode === "time-picker",
593
- format: format ? format : void 0,
594
- picker: pickerObj[mode] || "date",
595
- disabled: readonly,
596
- disabledDate: disabledDateFunc,
597
- placement: "bottomLeft",
598
- style: { width, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth }
599
- }
600
- );
601
- }
602
- case "range-picker":
603
- return /* @__PURE__ */ jsx(
604
- DatePicker.RangePicker,
605
- {
606
- disabledDate: disableDateGoover ? disabledDate : void 0,
607
- disabled: readonly,
608
- style: { width, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth }
609
- }
610
- );
611
- case "multiple-date-picker":
612
- return /* @__PURE__ */ jsx(DatePicker, { multiple: true, disabled: readonly, style: { width, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth } });
613
- case "radio":
614
- return /* @__PURE__ */ jsx(
615
- MyRadio,
616
- {
617
- radioAlign,
618
- commonRequest,
619
- commonRequestWidthParams,
620
- item: item.json,
621
- readonly,
622
- options: params,
623
- handleUrlOptions,
624
- value: formatValue,
625
- interfaceTypeDict,
626
- interfaceTypeSysDict,
627
- actionUrlKey,
628
- actionUrlExtraParams,
629
- langConfig,
630
- onChange: (e) => {
631
- form.setFieldValue(item.attrid, e.target.value);
531
+ case "modal-mult-select":
532
+ case "modal-select": {
533
+ return /* @__PURE__ */ jsx(
534
+ SelectModel,
535
+ {
536
+ style: { width, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth },
537
+ item: item.json,
538
+ value: item.attrvalue || item.json.default || "",
539
+ commonRequestWidthParams,
540
+ commonRequest,
541
+ onSure: async (value) => {
542
+ form.setFieldValue(item.attrid, value);
543
+ },
544
+ disabled: readonly,
545
+ langId,
546
+ CustomModalComponent
632
547
  }
633
- }
634
- );
635
- case "checkbox":
636
- return /* @__PURE__ */ jsx(
637
- MyCheckbox,
638
- {
639
- radioAlign,
640
- commonRequest,
641
- commonRequestWidthParams,
642
- item: item.json,
643
- readonly,
644
- options: params,
645
- value: formatValue,
646
- handleUrlOptions,
647
- interfaceTypeDict,
648
- interfaceTypeSysDict,
649
- actionUrlKey,
650
- actionUrlExtraParams,
651
- onChange: (val) => {
652
- form.setFieldValue(item.attrid, val.join(","));
548
+ );
549
+ }
550
+ case "mul-field-modal-select": {
551
+ return /* @__PURE__ */ jsx(
552
+ SelectModelBackfillFormItem,
553
+ {
554
+ style: { width, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth },
555
+ item: item.json,
556
+ form,
557
+ attrid,
558
+ value: item.attrvalue || item.json.default || "",
559
+ commonRequestWidthParams,
560
+ commonRequest,
561
+ onSure: async (value) => {
562
+ form.setFieldsValue(value);
563
+ },
564
+ disabled: readonly,
565
+ CustomModalComponent,
566
+ langId
653
567
  }
568
+ );
569
+ }
570
+ case "date-picker":
571
+ case "time-picker":
572
+ case "week-picker":
573
+ case "month-picker":
574
+ case "quarter-picker":
575
+ case "year-picker":
576
+ case "second-picker": {
577
+ const pickerObj = {
578
+ "date-picker": "date",
579
+ "time-picker": "date",
580
+ "week-picker": "week",
581
+ "month-picker": "month",
582
+ "quarter-picker": "quarter",
583
+ "year-picker": "year",
584
+ "second-picker": "time"
585
+ };
586
+ let disabledDateFunc = void 0;
587
+ if (mode === "date-picker") {
588
+ disabledDateFunc = disableDateGoover ? disabledDate : void 0;
654
589
  }
655
- );
656
- case "audio":
657
- case "file":
658
- case "image":
659
- case "video":
660
- return /* @__PURE__ */ jsx(
661
- MyUpload,
662
- {
663
- action: uploadAction && uploadAction("initializationfile"),
664
- item: item.json,
665
- uploadType: mode,
666
- langId,
667
- list: formatValue,
668
- readonly,
669
- relatedid,
670
- relatedidKey,
671
- onRemove: (file) => handleOnRemove(file)
672
- }
673
- );
674
- case "cascader":
675
- return /* @__PURE__ */ jsx(
676
- MyCascader,
677
- {
678
- commonRequestWidthParams,
679
- commonRequest,
680
- item: item.json,
681
- value: item.attrvalue,
682
- style: { width, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth },
683
- interfaceTypeDict,
684
- interfaceTypeSysDict,
685
- actionUrlKey,
686
- actionUrlExtraParams,
687
- langId
688
- }
689
- );
690
- case "radio-card":
691
- return /* @__PURE__ */ jsx(
692
- RadioCard,
693
- {
694
- item: item.json,
695
- readonly,
696
- onChange: (value) => {
697
- form.setFieldValue(item.attrid, value);
698
- },
699
- langId,
700
- commonRequestWidthParams
701
- }
702
- );
703
- default:
704
- return /* @__PURE__ */ jsx(
705
- Input,
706
- {
707
- placeholder: message2 || placeholder,
708
- ...params,
709
- showCount: true,
710
- disabled: readonly,
711
- style: { width, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth }
712
- }
713
- );
714
- }
715
- };
590
+ return /* @__PURE__ */ jsx(
591
+ DatePicker,
592
+ {
593
+ showTime: mode === "time-picker",
594
+ format: format ? format : void 0,
595
+ picker: pickerObj[mode] || "date",
596
+ disabled: readonly,
597
+ disabledDate: disabledDateFunc,
598
+ placement: "bottomLeft",
599
+ style: { width, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth }
600
+ }
601
+ );
602
+ }
603
+ case "range-picker":
604
+ return /* @__PURE__ */ jsx(
605
+ DatePicker.RangePicker,
606
+ {
607
+ disabledDate: disableDateGoover ? disabledDate : void 0,
608
+ disabled: readonly,
609
+ style: { width, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth }
610
+ }
611
+ );
612
+ case "multiple-date-picker":
613
+ return /* @__PURE__ */ jsx(DatePicker, { multiple: true, disabled: readonly, style: { width, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth } });
614
+ case "radio":
615
+ return /* @__PURE__ */ jsx(
616
+ MyRadio,
617
+ {
618
+ radioAlign,
619
+ commonRequest,
620
+ commonRequestWidthParams,
621
+ item: item.json,
622
+ readonly,
623
+ options: params,
624
+ handleUrlOptions,
625
+ value: formatValue,
626
+ interfaceTypeDict,
627
+ interfaceTypeSysDict,
628
+ actionUrlKey,
629
+ actionUrlExtraParams,
630
+ langConfig,
631
+ onChange: (e) => {
632
+ form.setFieldValue(item.attrid, e.target.value);
633
+ }
634
+ }
635
+ );
636
+ case "checkbox":
637
+ return /* @__PURE__ */ jsx(
638
+ MyCheckbox,
639
+ {
640
+ radioAlign,
641
+ commonRequest,
642
+ commonRequestWidthParams,
643
+ item: item.json,
644
+ readonly,
645
+ options: params,
646
+ value: formatValue,
647
+ handleUrlOptions,
648
+ interfaceTypeDict,
649
+ interfaceTypeSysDict,
650
+ actionUrlKey,
651
+ actionUrlExtraParams,
652
+ onChange: (val) => {
653
+ form.setFieldValue(item.attrid, val.join(","));
654
+ }
655
+ }
656
+ );
657
+ case "audio":
658
+ case "file":
659
+ case "image":
660
+ case "video":
661
+ return /* @__PURE__ */ jsx(
662
+ MyUpload,
663
+ {
664
+ action: uploadAction && uploadAction("initializationfile"),
665
+ item: item.json,
666
+ uploadType: mode,
667
+ langId,
668
+ list: formatValue,
669
+ readonly,
670
+ relatedid,
671
+ relatedidKey,
672
+ onRemove: (file) => handleOnRemove(file)
673
+ }
674
+ );
675
+ case "cascader":
676
+ return /* @__PURE__ */ jsx(
677
+ MyCascader,
678
+ {
679
+ commonRequestWidthParams,
680
+ commonRequest,
681
+ item: item.json,
682
+ value: item.attrvalue,
683
+ style: { width, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth },
684
+ interfaceTypeDict,
685
+ interfaceTypeSysDict,
686
+ actionUrlKey,
687
+ actionUrlExtraParams,
688
+ langId
689
+ }
690
+ );
691
+ case "radio-card":
692
+ return /* @__PURE__ */ jsx(
693
+ RadioCard,
694
+ {
695
+ item: item.json,
696
+ readonly,
697
+ onChange: (value) => {
698
+ form.setFieldValue(item.attrid, value);
699
+ },
700
+ langId,
701
+ commonRequestWidthParams
702
+ }
703
+ );
704
+ default:
705
+ return /* @__PURE__ */ jsx(
706
+ Input,
707
+ {
708
+ placeholder: message2 || placeholder,
709
+ ...params,
710
+ showCount: true,
711
+ disabled: readonly,
712
+ style: { width, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth }
713
+ }
714
+ );
715
+ }
716
+ },
717
+ [langId, langConfig]
718
+ );
716
719
  const handleRenderItem = ({
717
720
  item,
718
721
  readonly = false,