@next-bricks/form 0.19.5 → 0.19.7

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 (32) hide show
  1. package/dist/bricks.json +1 -1
  2. package/dist/chunks/4669.a00bb57c.js +2 -0
  3. package/dist/chunks/4669.a00bb57c.js.map +1 -0
  4. package/dist/chunks/eo-dynamic-form-item.5d8fb85d.js +3 -0
  5. package/dist/chunks/eo-dynamic-form-item.5d8fb85d.js.map +1 -0
  6. package/dist/chunks/eo-form-item.41b211ab.js +3 -0
  7. package/dist/chunks/{eo-form-item.ad9d5047.js.map → eo-form-item.41b211ab.js.map} +1 -1
  8. package/dist/chunks/eo-select.1dcade3f.js +3 -0
  9. package/dist/chunks/{eo-select.98fd26e3.js.map → eo-select.1dcade3f.js.map} +1 -1
  10. package/dist/chunks/eo-switch.e52b6438.js +3 -0
  11. package/dist/chunks/eo-switch.e52b6438.js.LICENSE.txt +5 -0
  12. package/dist/chunks/{eo-switch.0382aa2c.js.map → eo-switch.e52b6438.js.map} +1 -1
  13. package/dist/chunks/{main.3fa8c5bf.js → main.6be2248c.js} +2 -2
  14. package/dist/chunks/{main.3fa8c5bf.js.map → main.6be2248c.js.map} +1 -1
  15. package/dist/examples.json +1 -1
  16. package/dist/{index.867bf6b1.js → index.bf9c6698.js} +2 -2
  17. package/dist/{index.867bf6b1.js.map → index.bf9c6698.js.map} +1 -1
  18. package/dist/manifest.json +44 -0
  19. package/dist/types.json +310 -0
  20. package/dist-types/dynamic-form-item/index.d.ts +31 -0
  21. package/docs/eo-dynamic-form-item.md +34 -0
  22. package/package.json +2 -2
  23. package/dist/chunks/4669.23a6cf2e.js +0 -2
  24. package/dist/chunks/4669.23a6cf2e.js.map +0 -1
  25. package/dist/chunks/eo-dynamic-form-item.5b7b57a3.js +0 -2
  26. package/dist/chunks/eo-dynamic-form-item.5b7b57a3.js.map +0 -1
  27. package/dist/chunks/eo-form-item.ad9d5047.js +0 -3
  28. package/dist/chunks/eo-select.98fd26e3.js +0 -3
  29. package/dist/chunks/eo-switch.0382aa2c.js +0 -3
  30. /package/dist/chunks/{eo-form-item.ad9d5047.js.LICENSE.txt → eo-dynamic-form-item.5d8fb85d.js.LICENSE.txt} +0 -0
  31. /package/dist/chunks/{eo-select.98fd26e3.js.LICENSE.txt → eo-form-item.41b211ab.js.LICENSE.txt} +0 -0
  32. /package/dist/chunks/{eo-switch.0382aa2c.js.LICENSE.txt → eo-select.1dcade3f.js.LICENSE.txt} +0 -0
package/dist/types.json CHANGED
@@ -2632,6 +2632,243 @@
2632
2632
  }
2633
2633
  }
2634
2634
  },
2635
+ {
2636
+ "name": "message",
2637
+ "annotation": {
2638
+ "type": "reference",
2639
+ "typeName": {
2640
+ "type": "identifier",
2641
+ "name": "Record"
2642
+ },
2643
+ "typeParameters": {
2644
+ "type": "typeParameterInstantiation",
2645
+ "params": [
2646
+ {
2647
+ "type": "keyword",
2648
+ "value": "string"
2649
+ },
2650
+ {
2651
+ "type": "keyword",
2652
+ "value": "string"
2653
+ }
2654
+ ]
2655
+ }
2656
+ }
2657
+ },
2658
+ {
2659
+ "name": "hideRemoveButton",
2660
+ "annotation": {
2661
+ "type": "union",
2662
+ "types": [
2663
+ {
2664
+ "type": "keyword",
2665
+ "value": "boolean"
2666
+ },
2667
+ {
2668
+ "type": "parenthesizedType",
2669
+ "annotation": {
2670
+ "type": "function",
2671
+ "parameters": [
2672
+ {
2673
+ "type": "identifier",
2674
+ "name": "row",
2675
+ "annotation": {
2676
+ "type": "reference",
2677
+ "typeName": {
2678
+ "type": "identifier",
2679
+ "name": "Record"
2680
+ },
2681
+ "typeParameters": {
2682
+ "type": "typeParameterInstantiation",
2683
+ "params": [
2684
+ {
2685
+ "type": "keyword",
2686
+ "value": "string"
2687
+ },
2688
+ {
2689
+ "type": "keyword",
2690
+ "value": "any"
2691
+ }
2692
+ ]
2693
+ }
2694
+ }
2695
+ },
2696
+ {
2697
+ "type": "identifier",
2698
+ "name": "index",
2699
+ "annotation": {
2700
+ "type": "keyword",
2701
+ "value": "number"
2702
+ }
2703
+ }
2704
+ ],
2705
+ "annotation": {
2706
+ "type": "keyword",
2707
+ "value": "boolean"
2708
+ }
2709
+ }
2710
+ }
2711
+ ]
2712
+ }
2713
+ },
2714
+ {
2715
+ "name": "disabledRemoveButton",
2716
+ "annotation": {
2717
+ "type": "union",
2718
+ "types": [
2719
+ {
2720
+ "type": "keyword",
2721
+ "value": "boolean"
2722
+ },
2723
+ {
2724
+ "type": "parenthesizedType",
2725
+ "annotation": {
2726
+ "type": "function",
2727
+ "parameters": [
2728
+ {
2729
+ "type": "identifier",
2730
+ "name": "row",
2731
+ "annotation": {
2732
+ "type": "reference",
2733
+ "typeName": {
2734
+ "type": "identifier",
2735
+ "name": "Record"
2736
+ },
2737
+ "typeParameters": {
2738
+ "type": "typeParameterInstantiation",
2739
+ "params": [
2740
+ {
2741
+ "type": "keyword",
2742
+ "value": "string"
2743
+ },
2744
+ {
2745
+ "type": "keyword",
2746
+ "value": "any"
2747
+ }
2748
+ ]
2749
+ }
2750
+ }
2751
+ },
2752
+ {
2753
+ "type": "identifier",
2754
+ "name": "index",
2755
+ "annotation": {
2756
+ "type": "keyword",
2757
+ "value": "number"
2758
+ }
2759
+ }
2760
+ ],
2761
+ "annotation": {
2762
+ "type": "keyword",
2763
+ "value": "boolean"
2764
+ }
2765
+ }
2766
+ }
2767
+ ]
2768
+ }
2769
+ },
2770
+ {
2771
+ "name": "hideAddButton",
2772
+ "annotation": {
2773
+ "type": "union",
2774
+ "types": [
2775
+ {
2776
+ "type": "keyword",
2777
+ "value": "boolean"
2778
+ },
2779
+ {
2780
+ "type": "parenthesizedType",
2781
+ "annotation": {
2782
+ "type": "function",
2783
+ "parameters": [
2784
+ {
2785
+ "type": "identifier",
2786
+ "name": "value",
2787
+ "annotation": {
2788
+ "type": "array",
2789
+ "elementType": {
2790
+ "type": "reference",
2791
+ "typeName": {
2792
+ "type": "identifier",
2793
+ "name": "Record"
2794
+ },
2795
+ "typeParameters": {
2796
+ "type": "typeParameterInstantiation",
2797
+ "params": [
2798
+ {
2799
+ "type": "keyword",
2800
+ "value": "string"
2801
+ },
2802
+ {
2803
+ "type": "keyword",
2804
+ "value": "any"
2805
+ }
2806
+ ]
2807
+ }
2808
+ }
2809
+ }
2810
+ }
2811
+ ],
2812
+ "annotation": {
2813
+ "type": "keyword",
2814
+ "value": "boolean"
2815
+ }
2816
+ }
2817
+ }
2818
+ ]
2819
+ }
2820
+ },
2821
+ {
2822
+ "name": "disabledAddButton",
2823
+ "annotation": {
2824
+ "type": "union",
2825
+ "types": [
2826
+ {
2827
+ "type": "keyword",
2828
+ "value": "boolean"
2829
+ },
2830
+ {
2831
+ "type": "parenthesizedType",
2832
+ "annotation": {
2833
+ "type": "function",
2834
+ "parameters": [
2835
+ {
2836
+ "type": "identifier",
2837
+ "name": "value",
2838
+ "annotation": {
2839
+ "type": "array",
2840
+ "elementType": {
2841
+ "type": "reference",
2842
+ "typeName": {
2843
+ "type": "identifier",
2844
+ "name": "Record"
2845
+ },
2846
+ "typeParameters": {
2847
+ "type": "typeParameterInstantiation",
2848
+ "params": [
2849
+ {
2850
+ "type": "keyword",
2851
+ "value": "string"
2852
+ },
2853
+ {
2854
+ "type": "keyword",
2855
+ "value": "any"
2856
+ }
2857
+ ]
2858
+ }
2859
+ }
2860
+ }
2861
+ }
2862
+ ],
2863
+ "annotation": {
2864
+ "type": "keyword",
2865
+ "value": "boolean"
2866
+ }
2867
+ }
2868
+ }
2869
+ ]
2870
+ }
2871
+ },
2635
2872
  {
2636
2873
  "name": "useBrick",
2637
2874
  "annotation": {
@@ -2658,6 +2895,30 @@
2658
2895
  }
2659
2896
  }
2660
2897
  }
2898
+ },
2899
+ {
2900
+ "name": "row.add",
2901
+ "detail": {
2902
+ "annotation": {
2903
+ "type": "reference",
2904
+ "typeName": {
2905
+ "type": "identifier",
2906
+ "name": "rowDataType"
2907
+ }
2908
+ }
2909
+ }
2910
+ },
2911
+ {
2912
+ "name": "row.remove",
2913
+ "detail": {
2914
+ "annotation": {
2915
+ "type": "reference",
2916
+ "typeName": {
2917
+ "type": "identifier",
2918
+ "name": "rowDataType"
2919
+ }
2920
+ }
2921
+ }
2661
2922
  }
2662
2923
  ],
2663
2924
  "methods": [],
@@ -2685,6 +2946,55 @@
2685
2946
  ]
2686
2947
  }
2687
2948
  }
2949
+ },
2950
+ {
2951
+ "type": "typeAlias",
2952
+ "name": "rowDataType",
2953
+ "annotation": {
2954
+ "type": "typeLiteral",
2955
+ "members": [
2956
+ {
2957
+ "type": "propertySignature",
2958
+ "key": {
2959
+ "type": "identifier",
2960
+ "name": "detail"
2961
+ },
2962
+ "annotation": {
2963
+ "type": "reference",
2964
+ "typeName": {
2965
+ "type": "identifier",
2966
+ "name": "Record"
2967
+ },
2968
+ "typeParameters": {
2969
+ "type": "typeParameterInstantiation",
2970
+ "params": [
2971
+ {
2972
+ "type": "keyword",
2973
+ "value": "string"
2974
+ },
2975
+ {
2976
+ "type": "keyword",
2977
+ "value": "any"
2978
+ }
2979
+ ]
2980
+ }
2981
+ },
2982
+ "computed": false
2983
+ },
2984
+ {
2985
+ "type": "propertySignature",
2986
+ "key": {
2987
+ "type": "identifier",
2988
+ "name": "index"
2989
+ },
2990
+ "annotation": {
2991
+ "type": "keyword",
2992
+ "value": "number"
2993
+ },
2994
+ "computed": false
2995
+ }
2996
+ ]
2997
+ }
2688
2998
  }
2689
2999
  ]
2690
3000
  },
@@ -14,7 +14,18 @@ interface DynamicFormItemProps extends FormItemProps {
14
14
  needValidate?: boolean;
15
15
  onChange?: (value: DynamicFormValuesItem[]) => void;
16
16
  onValuesChange?: (values: DynamicFormValuesItem[]) => void;
17
+ onAdd?: (value: rowDataType) => void;
18
+ onRemove?: (value: rowDataType) => void;
19
+ hideRemoveButton?: boolean | ((row: Record<string, any>, index: number) => boolean);
20
+ disabledRemoveButton?: boolean | ((row: Record<string, any>, index: number) => boolean);
21
+ hideAddButton?: boolean | ((value: Record<string, any>[]) => boolean);
22
+ disabledAddButton?: boolean | ((value: Record<string, any>[]) => boolean);
17
23
  }
24
+ type rowDataType = {
25
+ detail: Record<string, any>;
26
+ index: number;
27
+ };
28
+ export declare const getRealValue: (property: boolean | ((...args: any[]) => boolean), args: any[]) => boolean;
18
29
  /**
19
30
  * 动态表单
20
31
  * @author sailor
@@ -37,6 +48,26 @@ declare class DynamicFormItem extends FormItemElementBase {
37
48
  * 值
38
49
  */
39
50
  accessor value: DynamicFormValuesItem[] | undefined;
51
+ /**
52
+ * 校验文本
53
+ */
54
+ accessor message: Record<string, string> | undefined;
55
+ /**
56
+ * 是否隐藏每一行删除的按钮
57
+ */
58
+ accessor hideRemoveButton: boolean | ((row: Record<string, any>, index: number) => boolean) | undefined;
59
+ /**
60
+ * 是否禁止每一行删除的按钮
61
+ */
62
+ accessor disabledRemoveButton: boolean | ((row: Record<string, any>, index: number) => boolean) | undefined;
63
+ /**
64
+ * 是否隐藏添加的按钮
65
+ */
66
+ accessor hideAddButton: boolean | ((value: Record<string, any>[]) => boolean) | undefined;
67
+ /**
68
+ * 是否禁止添加的按钮
69
+ */
70
+ accessor disabledAddButton: boolean | ((value: Record<string, any>[]) => boolean) | undefined;
40
71
  /**
41
72
  * 动态表单子项构件列表
42
73
  */
@@ -93,6 +93,36 @@
93
93
  - Shenzhen
94
94
  ```
95
95
 
96
+ ### hideRemoveButton、disabledRemoveButton;hideAddButton、disabledAddButton
97
+
98
+ ```yaml preview
99
+ - brick: eo-dynamic-form-item
100
+ properties:
101
+ hideAddButton: <% (value)=>value.length===5 %>
102
+ disabledAddButton: <% (value)=>value.length===4 %>
103
+ hideRemoveButton: <% (value,row)=>row===1 %>
104
+ disabledRemoveButton: <% (value,row)=>row===0 %>
105
+ value:
106
+ - input: hello1
107
+ select: abc1
108
+ - input: hello2
109
+ select: abc2
110
+ - input: hello3
111
+ select: abc3
112
+ useBrick:
113
+ - brick: eo-input
114
+ properties:
115
+ name: input
116
+ - brick: eo-select
117
+ properties:
118
+ name: select
119
+ options:
120
+ - abc1
121
+ - abc2
122
+ - abc2
123
+ - abc4
124
+ ```
125
+
96
126
  ### Event
97
127
 
98
128
  ```yaml preview
@@ -112,6 +142,10 @@
112
142
  - Guangzhou
113
143
  - Shenzhen
114
144
  events:
145
+ row.remove:
146
+ action: console.log
147
+ row.add:
148
+ action: console.log
115
149
  change:
116
150
  - action: message.success
117
151
  args:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@next-bricks/form",
3
- "version": "0.19.5",
3
+ "version": "0.19.7",
4
4
  "homepage": "https://github.com/easyops-cn/next-bricks/tree/master/bricks/form",
5
5
  "repository": {
6
6
  "type": "git",
@@ -37,5 +37,5 @@
37
37
  "@next-core/build-next-bricks": "^1.14.2",
38
38
  "@next-core/test-next": "^1.0.10"
39
39
  },
40
- "gitHead": "6bb93b55108ae2a4a415b6d26306c4f01434d659"
40
+ "gitHead": "33762e2226a9d9eeec324dbd9532a0a2dd417495"
41
41
  }