@cloudbase/weda-ui 3.19.0 → 3.20.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/dist/configs/components/wd-form.d.ts +2 -2
- package/dist/configs/components/wd-form.js +2 -2
- package/dist/configs/components/wd-table.d.ts +3 -3
- package/dist/configs/index.d.ts +6 -6
- package/dist/configs/type-utils/type-form.d.ts +2 -2
- package/dist/style/weda-ui.min.css +1 -1
- package/dist/web/components/form-input-hooks/index.d.ts +3 -1
- package/dist/web/components/form-input-hooks/index.js +93 -54
- package/dist/web/components/form-rich-text/index.d.ts +3 -3
- package/dist/web/components/form-rich-text/index.js +8 -4
- package/dist/web/components/formdetail/index.d.ts +1 -1
- package/dist/web/components/formdetail/index.js +28 -42
- package/dist/web/components/richText/index.js +9 -3
- package/dist/web/components/wd-form/contexts/form-field-arr-context.d.ts +21 -0
- package/dist/web/components/wd-form/contexts/form-field-arr-context.js +10 -0
- package/dist/web/components/wd-form/contexts/form-field-context.d.ts +19 -0
- package/dist/web/components/wd-form/contexts/form-field-context.js +10 -0
- package/dist/web/components/wd-form/contexts/form-field-obj-context.d.ts +13 -0
- package/dist/web/components/wd-form/contexts/form-field-obj-context.js +10 -0
- package/dist/web/components/wd-form/index.d.ts +4 -4
- package/dist/web/components/wd-form/index.js +142 -191
- package/dist/web/components/wd-form-item/wd-form-item.d.ts +2 -2
- package/dist/web/components/wd-form-item/wd-form-item.js +96 -14
- package/dist/web/components/wd-form-obj/base-form-obj.js +66 -197
- package/dist/web/components/wd-input/wd-input.js +1 -1
- package/dist/web/components/wd-input-number/wd-input-number.js +43 -17
- package/dist/web/components/wd-rich-text/wd-rich-text.d.ts +1 -1
- package/dist/web/components/wd-rich-text/wd-rich-text.js +7 -3
- package/dist/web/components/wd-select/select/selectUI.js +9 -2
- package/dist/web/utils/widget-api/index.d.ts +0 -14
- package/dist/web/utils/widget-api/index.js +0 -7
- package/package.json +1 -1
|
@@ -43,7 +43,7 @@ declare const data: import("@sinclair/typebox").TObject<{
|
|
|
43
43
|
isDisabledSubmit: import("@sinclair/typebox").TBoolean;
|
|
44
44
|
formType: import("@sinclair/typebox").TUnsafe<"create" | "edit" | "read">;
|
|
45
45
|
formType_bind: import("@sinclair/typebox").TBoolean;
|
|
46
|
-
datasourceType: import("@sinclair/typebox").TUnsafe<"connector" | "
|
|
46
|
+
datasourceType: import("@sinclair/typebox").TUnsafe<"connector" | "custom-connector" | "model" | "expression">;
|
|
47
47
|
dataSourceName: import("@sinclair/typebox").TString;
|
|
48
48
|
value: import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TAny>;
|
|
49
49
|
_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
@@ -85,7 +85,7 @@ declare const _default: {
|
|
|
85
85
|
isDisabledSubmit: import("@sinclair/typebox").TBoolean;
|
|
86
86
|
formType: import("@sinclair/typebox").TUnsafe<"create" | "edit" | "read">;
|
|
87
87
|
formType_bind: import("@sinclair/typebox").TBoolean;
|
|
88
|
-
datasourceType: import("@sinclair/typebox").TUnsafe<"connector" | "
|
|
88
|
+
datasourceType: import("@sinclair/typebox").TUnsafe<"connector" | "custom-connector" | "model" | "expression">;
|
|
89
89
|
dataSourceName: import("@sinclair/typebox").TString;
|
|
90
90
|
value: import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TAny>;
|
|
91
91
|
_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
@@ -530,9 +530,9 @@ const data = Type.Object({
|
|
|
530
530
|
title: '表单初始值',
|
|
531
531
|
default: {},
|
|
532
532
|
display: false,
|
|
533
|
-
'x-index':
|
|
533
|
+
'x-index': 43,
|
|
534
534
|
'x-group': '数据',
|
|
535
|
-
description: '
|
|
535
|
+
description: '可以用于设置表单的初始值。 在编辑器中仅初次渲染能查看到效果, 后续配置变动无效果.',
|
|
536
536
|
'x-component': 'jsontext',
|
|
537
537
|
}),
|
|
538
538
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Static } from '../type-utils';
|
|
2
2
|
import type { Simplify } from 'type-fest';
|
|
3
3
|
declare const data: import("@sinclair/typebox").TObject<{
|
|
4
|
-
dataSourceType: import("@sinclair/typebox").TUnsafe<"
|
|
4
|
+
dataSourceType: import("@sinclair/typebox").TUnsafe<"custom-connector" | "expression" | "data-model">;
|
|
5
5
|
bindMetadata: import("@sinclair/typebox").TObject<{
|
|
6
6
|
datasource: import("@sinclair/typebox").TObject<{
|
|
7
7
|
title: import("@sinclair/typebox").TString;
|
|
@@ -99,7 +99,7 @@ export type DataType = Simplify<Static<typeof data>>;
|
|
|
99
99
|
declare const config: {
|
|
100
100
|
readonly $schema: "https://comp-public-replace-1303824488-cos.weda.tencent.com/schema/lcds_component.json";
|
|
101
101
|
readonly data: import("@sinclair/typebox").TObject<{
|
|
102
|
-
dataSourceType: import("@sinclair/typebox").TUnsafe<"
|
|
102
|
+
dataSourceType: import("@sinclair/typebox").TUnsafe<"custom-connector" | "expression" | "data-model">;
|
|
103
103
|
bindMetadata: import("@sinclair/typebox").TObject<{
|
|
104
104
|
datasource: import("@sinclair/typebox").TObject<{
|
|
105
105
|
title: import("@sinclair/typebox").TString;
|
|
@@ -203,7 +203,7 @@ declare const config: {
|
|
|
203
203
|
filter: import("@sinclair/typebox").TAny;
|
|
204
204
|
sort: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{}>>;
|
|
205
205
|
pageNo: import("@sinclair/typebox").TNumber;
|
|
206
|
-
dataSourceType: import("@sinclair/typebox").TUnsafe<"
|
|
206
|
+
dataSourceType: import("@sinclair/typebox").TUnsafe<"custom-connector" | "expression" | "data-model">;
|
|
207
207
|
pageSize: import("@sinclair/typebox").TNumber;
|
|
208
208
|
records: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{}>>;
|
|
209
209
|
total: import("@sinclair/typebox").TNumber;
|
package/dist/configs/index.d.ts
CHANGED
|
@@ -4089,7 +4089,7 @@ export declare const components: {
|
|
|
4089
4089
|
isDisabledSubmit: import("@sinclair/typebox").TBoolean;
|
|
4090
4090
|
formType: import("@sinclair/typebox").TUnsafe<"create" | "edit" | "read">;
|
|
4091
4091
|
formType_bind: import("@sinclair/typebox").TBoolean;
|
|
4092
|
-
datasourceType: import("@sinclair/typebox").TUnsafe<"connector" | "
|
|
4092
|
+
datasourceType: import("@sinclair/typebox").TUnsafe<"connector" | "custom-connector" | "model" | "expression">;
|
|
4093
4093
|
dataSourceName: import("@sinclair/typebox").TString;
|
|
4094
4094
|
value: import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TAny>;
|
|
4095
4095
|
_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
@@ -11511,7 +11511,7 @@ export declare const components: {
|
|
|
11511
11511
|
WdTable: {
|
|
11512
11512
|
readonly $schema: "https://comp-public-replace-1303824488-cos.weda.tencent.com/schema/lcds_component.json";
|
|
11513
11513
|
readonly data: import("@sinclair/typebox").TObject<{
|
|
11514
|
-
dataSourceType: import("@sinclair/typebox").TUnsafe<"
|
|
11514
|
+
dataSourceType: import("@sinclair/typebox").TUnsafe<"custom-connector" | "expression" | "data-model">;
|
|
11515
11515
|
bindMetadata: import("@sinclair/typebox").TObject<{
|
|
11516
11516
|
datasource: import("@sinclair/typebox").TObject<{
|
|
11517
11517
|
title: import("@sinclair/typebox").TString;
|
|
@@ -11615,7 +11615,7 @@ export declare const components: {
|
|
|
11615
11615
|
filter: import("@sinclair/typebox").TAny;
|
|
11616
11616
|
sort: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{}>>;
|
|
11617
11617
|
pageNo: import("@sinclair/typebox").TNumber;
|
|
11618
|
-
dataSourceType: import("@sinclair/typebox").TUnsafe<"
|
|
11618
|
+
dataSourceType: import("@sinclair/typebox").TUnsafe<"custom-connector" | "expression" | "data-model">;
|
|
11619
11619
|
pageSize: import("@sinclair/typebox").TNumber;
|
|
11620
11620
|
records: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{}>>;
|
|
11621
11621
|
total: import("@sinclair/typebox").TNumber;
|
|
@@ -23630,7 +23630,7 @@ declare const _default: {
|
|
|
23630
23630
|
isDisabledSubmit: import("@sinclair/typebox").TBoolean;
|
|
23631
23631
|
formType: import("@sinclair/typebox").TUnsafe<"create" | "edit" | "read">;
|
|
23632
23632
|
formType_bind: import("@sinclair/typebox").TBoolean;
|
|
23633
|
-
datasourceType: import("@sinclair/typebox").TUnsafe<"connector" | "
|
|
23633
|
+
datasourceType: import("@sinclair/typebox").TUnsafe<"connector" | "custom-connector" | "model" | "expression">;
|
|
23634
23634
|
dataSourceName: import("@sinclair/typebox").TString;
|
|
23635
23635
|
value: import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TAny>;
|
|
23636
23636
|
_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
@@ -31052,7 +31052,7 @@ declare const _default: {
|
|
|
31052
31052
|
WdTable: {
|
|
31053
31053
|
readonly $schema: "https://comp-public-replace-1303824488-cos.weda.tencent.com/schema/lcds_component.json";
|
|
31054
31054
|
readonly data: import("@sinclair/typebox").TObject<{
|
|
31055
|
-
dataSourceType: import("@sinclair/typebox").TUnsafe<"
|
|
31055
|
+
dataSourceType: import("@sinclair/typebox").TUnsafe<"custom-connector" | "expression" | "data-model">;
|
|
31056
31056
|
bindMetadata: import("@sinclair/typebox").TObject<{
|
|
31057
31057
|
datasource: import("@sinclair/typebox").TObject<{
|
|
31058
31058
|
title: import("@sinclair/typebox").TString;
|
|
@@ -31156,7 +31156,7 @@ declare const _default: {
|
|
|
31156
31156
|
filter: import("@sinclair/typebox").TAny;
|
|
31157
31157
|
sort: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{}>>;
|
|
31158
31158
|
pageNo: import("@sinclair/typebox").TNumber;
|
|
31159
|
-
dataSourceType: import("@sinclair/typebox").TUnsafe<"
|
|
31159
|
+
dataSourceType: import("@sinclair/typebox").TUnsafe<"custom-connector" | "expression" | "data-model">;
|
|
31160
31160
|
pageSize: import("@sinclair/typebox").TNumber;
|
|
31161
31161
|
records: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{}>>;
|
|
31162
31162
|
total: import("@sinclair/typebox").TNumber;
|
|
@@ -641,8 +641,8 @@ export interface WdFormItemProps extends CommonPropsType, Pick<ItemDataType, 'la
|
|
|
641
641
|
isWdFormDetail?: boolean;
|
|
642
642
|
/** 只读时是否包含前后缀 */
|
|
643
643
|
readBeforeAfter?: boolean;
|
|
644
|
-
/**
|
|
645
|
-
|
|
644
|
+
/** 是否存在标题容器 */
|
|
645
|
+
hasLabelContainer?: boolean;
|
|
646
646
|
/** 是否为根元素 */
|
|
647
647
|
isRoot?: boolean;
|
|
648
648
|
/** 标题后缀 */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
@cloudbase/weda-ui v3.
|
|
2
|
+
@cloudbase/weda-ui v3.20.1
|
|
3
3
|
*/
|
|
4
4
|
@charset "UTF-8";@media (min-width:1024px){.weda-ui .weui-cells{font-size:1em}.weui .weui-cell_active:active{background-color:unset!important}}@font-face{font-family:lcap-icon;font-weight:400;font-style:normal;src:url(data:application/font-woff2;charset=utf-8;base64,d09GMgABAAAAAAkMAA0AAAAAFZgAAAi1AAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP0ZGVE0cGh4GYACCXhEICpxYlmoLTgABNgIkA1gEIAWDMweDBRtzEVGUTVKf7GdCpjLGY/HIYGvbDpn6q7Qdj3xvUaZJUNFads3M7geYVSSiCgsZJYFkhEfn2DjU9//jpn8D1QTqVBQqSrtAVZAq1bwkpTOo0Hbz2tnYfkP3ZzAxpv6ZiSFf3OHh8/b+/oqzxIt4QmFX5ImmIe0SWAOEOJL2n9ZSO5PcCwErnTjzLxOYud0Az24IS8AOXSWgBtyL2lbFtkKxMAhSoPNdlrMFak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WLTXTaNPBSmt1Z6faC6hmaq+/j+gGT66PrtpKxquCKzUqTFI36xjltiipsN34AAhYK30U0Si9PDd4Qrlx5gXZbykCAdhWAj3p+F8DA+WBim/aNhq9g86DAocD+KIj0VJtIEzs137fvNcn+Zf8+xChp637Q/Eo/0gLUBkjiCckExRp4iSCSMhV8TToMmywXB/GhkcF5ziw45OB87l85aUMFg0NLu2/zrqV/BH9vE5gRJkaL8IilGuqC03JjHIZdlQAzgqTSpcqAx7mVejwNSGWWs4aGlmhqdGjnCFPBYAqTFrMVhmw/tErzDrt1E1nqkx9Os0wHbxR48t8+rYA9icsgyFzkc5s8Ne9hwCEXWH8WM82YAhjUzGZLCR46/+MZFkk2djoLT1IzKCbi3WV1hnUrcvSm+MZtRSpiYWanQU+67DN62G7tnPGP8h5DgBGvMgjgCILl0eQyJQoo5wKKqmimhpqqSOQIIIJQUQoYYQTQSRRRBNDLHGIkRBPAonZMHXOzF6Z99D0PpIk80xVIUlCBjmykYNc5CEfBShEJaqggBIqjzpSRkIGObKRg1zkIR8FKEQlqqCAEiqPulNOAgAA) format('woff2')}.wd-form--vertical-left .wedatea2td-form .weda-formcells__pc.horizontal,.wd-form--vertical-right .wedatea2td-form .weda-formcells__pc.horizontal,.wedatea2td-form--vertical .wd-form--horizontal-left .wd-form-item-wrap,.wedatea2td-form--vertical .wd-form--horizontal-right .wd-form-item-wrap,.wedatea2td-form--vertical .wd-form-item.wd-form-item--horizontal-left .wd-form-item-wrap,.wedatea2td-form--vertical .wd-form-item.wd-form-item--horizontal-right .wd-form-item-wrap,.wedatea2td-form--vertical .wedatea2td-form .weda-formcells__pc.horizontal{flex-direction:column}.g-swiper-item>div>*{max-width:100%;max-height:100%;object-fit:cover;max-width:100%;object-fit:cover;max-width:100%;max-height:100%;object-fit:cover;width:100%;height:auto;max-width:100%;object-fit:cover}.form-detail-wrap .form-detail-content-wrap .form-detail-group-header-container{display:flex;align-items:center;justify-content:space-between}.weda-graphic-card .weda-graphic-card__col .weda-graphic-card__title{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.weda-graphic-card .weda-graphic-card__col .weda-graphic-card__desc{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.weda-menu .wedatea2td-menu--light .wedatea2td-menu__list li.is-selected>.wedatea2td-menu__item:hover,.wedatea2td-drawer .wedatea2td-menu--light .wedatea2td-menu__list li .wedatea2td-menu__item:hover{background-color:var(--weda-navigation-menu-hover-color)}.weda-menu-mobile .weda-menu__wrapper{display:flex;align-items:center;justify-content:space-between;box-shadow:0 2px 2px rgba(0,0,0,.05)}.weda-menu .wedatea2td-menu__text .menu-text,.weda-menu__drawer .wedatea2td-menu__text .menu-text{display:flex;justify-content:center;align-items:center}@media (max-width:1024px){.g-swiper .g-swiper__turn-next,.g-swiper .g-swiper__turn-pre{display:none}.modal-table-delete .wedatea2td-dialog__inner,.model-relation-selector-modal .wedatea2td-dialog__inner,.wedatea2td-dialog__inner{min-width:0;width:90%;margin:10px 0}.wedatea2td-form.model-form{width:100%}}.markdown-body .octicon{fill:currentColor}.markdown-body pre{word-wrap:normal}.wd-form-item.wd-pc-rich-text-root .ExEditor-basic,.wd-form-item.wd-pc-rich-text-root .exeditor-toolbar{background-color:inherit}.wd-add-relation-button-wrap{display:flex;align-items:center;color:var(--wd-color-brand,#0052d9);white-space:pre-wrap}.weda-import-csv-file-modal .file-json-map-wrap{display:flex;flex-direction:column;box-sizing:border-box}.weda-import-csv-file-modal .import-file-result-wrap .error-container{display:flex;flex-direction:column}.weda-import-csv-file-modal .import-file-result-wrap .error-content{flex:1}.wd-table-wrap-filter .wedatea2td-input:focus,.wd-table-wrap-filter .wedatea2td-input:hover,.wd-table-wrap-filter .wedatea2td-textarea-group:focus,.wd-table-wrap-filter .wedatea2td-textarea-group:hover,.wd-table-wrap-filter .wedatea2td-textarea:focus,.wd-table-wrap-filter .wedatea2td-textarea:hover,.wedatea2td-overlay .wedatea2td-checkbox:focus,.wedatea2td-overlay .wedatea2td-checkbox:hover,.wedatea2td-overlay input[type=checkbox]:focus,.wedatea2td-overlay input[type=checkbox]:hover{border-color:var(--wd-color-brand,#0052d9)}.weda-ui_mapChoose_search_input_clear{display:flex;justify-content:center}.form-select-map .wedatea2td-dialog__inner{box-shadow:none;min-width:100vw!important}.weda-ui-custom-calendar-op__end,.weda-ui-custom-calendar-op__start{display:flex;align-items:center}.weui-tag span{word-wrap:break-word;word-break:break-word}.weda-ui-user-select-container-list__start .depart-tree .wedatea2td-tree__node.is-selected>.wedatea2td-tree__node-content,.weda-ui-user-select-container-list__start .depart-tree .wedatea2td-tree__node.is-selected>.wedatea2td-tree__node-content .wedatea2td-tree__label,.weda-ui-user-select-container-list__start .wedatea2td-tree.wedatea2td-tree--checkbox-separate .wedatea2td-tree__node.is-selected>.wedatea2td-tree__node-content .wedatea2td-tree__label .wedatea2td-tree__label-title{background-color:var(--wd-color-brand-light,#d4e3fc)}.weda-select-user-dept-breadcrumb{display:flex;align-items:center}.form-location-con_disabled{opacity:.4}body{font-size:var(--wd-font-base)}@font-face{font-family:wd-lcap-icon;font-weight:400;font-style:normal;src:url(data:application/font-woff2;charset=utf-8;base64,d09GMgABAAAAAAkMAA0AAAAAFZgAAAi1AAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP0ZGVE0cGh4GYACCXhEICpxYlmoLTgABNgIkA1gEIAWDMweDBRtzEVGUTVKf7GdCpjLGY/HIYGvbDpn6q7Qdj3xvUaZJUNFads3M7geYVSSiCgsZJYFkhEfn2DjU9//jpn8D1QTqVBQqSrtAVZAq1bwkpTOo0Hbz2tnYfkP3ZzAxpv6ZiSFf3OHh8/b+/oqzxIt4QmFX5ImmIe0SWAOEOJL2n9ZSO5PcCwErnTjzLxOYud0Az24IS8AOXSWgBtyL2lbFtkKxMAhSoPNdlrMFakJqTjuamX+3E3teqiTm6/UpPkH213oLGNahKuAtpQ0wbERrXcnzO1bBpK388B4D6I5fCT9kh69EbSy65RKsi/26+7qKtJv2oREq98FIbnbJ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A+WBim/aNhq9g86DAocD+KIj0VJtIEzs137fvNcn+Zf8+xChp637Q/Eo/0gLUBkjiCckExRp4iSCSMhV8TToMmywXB/GhkcF5ziw45OB87l85aUMFg0NLu2/zrqV/BH9vE5gRJkaL8IilGuqC03JjHIZdlQAzgqTSpcqAx7mVejwNSGWWs4aGlmhqdGjnCFPBYAqTFrMVhmw/tErzDrt1E1nqkx9Os0wHbxR48t8+rYA9icsgyFzkc5s8Ne9hwCEXWH8WM82YAhjUzGZLCR46/+MZFkk2djoLT1IzKCbi3WV1hnUrcvSm+MZtRSpiYWanQU+67DN62G7tnPGP8h5DgBGvMgjgCILl0eQyJQoo5wKKqmimhpqqSOQIIIJQUQoYYQTQSRRRBNDLHGIkRBPAonZMHXOzF6Z99D0PpIk80xVIUlCBjmykYNc5CEfBShEJaqggBIqjzpSRkIGObKRg1zkIR8FKEQlqqCAEiqPulNOAgAA) format("woff2")}.t-icon{speak:none;text-transform:none;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.wd-space-align-items--flex-start{align-items:flex-start;align-items:center;align-items:flex-end}.wd-space-justify-content--flex-start{justify-content:flex-start;justify-content:center;justify-content:flex-end}.wd-btn{--wd-btn-sm-padding:0.0625rem calc(var(--wd-space-base) * 2);--wd-btn-md-padding:0.25rem calc(var(--wd-space-base) * 4);--wd-btn-lg-padding:0.4375rem calc(var(--wd-space-base) * 6);--wd-btn-margin-top:0;--wd-btn-margin-top:0;--wd-btn-font-size-sm:var(--wd-font-size-2);--wd-btn-line-height-sm:1.5;--wd-btn-min-height-sm:24px;--wd-btn-font-size-md:var(--wd-font-size-3);--wd-btn-line-height-md:1.5;--wd-btn-min-height-md:32px;--wd-btn-font-size-lg:var(--wd-font-size-4);--wd-btn-line-height-lg:1.5;--wd-btn-min-height-lg:40px;--wd-btn-icon-space-sm:var(--wd-space-base);--wd-btn-icon-space-md:calc(var(--wd-space-base) * 2);--wd-btn-icon-space-lg:calc(var(--wd-space-base) * 3);--wd-btn-icon-size-sm:calc(var(--wd-btn-font-size-sm) + 0.125rem);--wd-btn-icon-size-md:calc(var(--wd-btn-font-size-md) + 0.125rem);--wd-btn-icon-size-lg:calc(var(--wd-btn-font-size-lg) + 0.25rem);--wd-btn-border-radius:var(--wd-border-radius);--wd-btn-color-text:var(--wd-color-text-default);--wd-btn-color-text-inverse:var(--wd-color-text-inverse);--wd-btn-color-text-hover:var(--wd-color-text-default);--wd-btn-color-text-active:var(--wd-color-text-default);--wd-btn-color-text-focus:var(--wd-color-text-default);--wd-btn-color-text-disabled:var(--wd-color-text-disabled);--wd-btn-color-brand:var(--wd-color-brand);--wd-btn-color-brand-hover:var(--wd-color-brand-hover);--wd-btn-color-brand-active:var(--wd-color-brand-active);--wd-btn-color-brand-focus:var(--wd-color-brand-focus);--wd-btn-color-brand-disabled:var(--wd-color-brand-disabled);--wd-btn-color-warning:var(--wd-color-warning);--wd-btn-color-warning-hover:var(--wd-color-warning-hover);--wd-btn-color-warning-active:var(--wd-color-warning-active);--wd-btn-color-warning-focus:var(--wd-color-warning-focus);--wd-btn-color-warning-disabled:var(--wd-color-warning-disabled);--wd-btn-color-error:var(--wd-color-error);--wd-btn-color-error-hover:var(--wd-color-error-hover);--wd-btn-color-error-active:var(--wd-color-error-active);--wd-btn-color-error-focus:var(--wd-color-error-focus);--wd-btn-color-error-disabled:var(--wd-color-error-disabled);--wd-btn-color-gray:var(
|
|
5
5
|
--wd-color-gray-1
|
|
@@ -30,9 +30,10 @@ export type FormInputTraitParams<Value> = {
|
|
|
30
30
|
after?: string;
|
|
31
31
|
} & Pick<CommonPropsType, '$widget' | '$node'>;
|
|
32
32
|
export declare function useFormInputTrait<Value = unknown>(inputParams: FormInputTraitParams<Value>): {
|
|
33
|
+
namePath: any;
|
|
33
34
|
visible: boolean;
|
|
34
35
|
onChange: (value: Value) => void;
|
|
35
|
-
value:
|
|
36
|
+
value: any;
|
|
36
37
|
disabled: boolean;
|
|
37
38
|
readOnly: boolean;
|
|
38
39
|
required: boolean;
|
|
@@ -44,5 +45,6 @@ export declare function useFormInputTrait<Value = unknown>(inputParams: FormInpu
|
|
|
44
45
|
*/
|
|
45
46
|
layout: "vertical" | "horizontal";
|
|
46
47
|
initValidate: (validateState: any, validateErrorMsg: any) => void;
|
|
48
|
+
isInformContainer: boolean;
|
|
47
49
|
};
|
|
48
50
|
export {};
|
|
@@ -6,48 +6,80 @@ import { debug } from '../../utils/console';
|
|
|
6
6
|
import { useSyncValue } from '../../utils/hooks/useSyncValue';
|
|
7
7
|
import isObjectEqual from '../../utils/isObjectEqual';
|
|
8
8
|
import { isNil } from '../../utils/lodash';
|
|
9
|
-
import {
|
|
9
|
+
import { useFormDetailContext } from '../../utils/widget-api';
|
|
10
10
|
import { validType } from './validator';
|
|
11
11
|
import { emptyArray, noop } from '../../utils/constant';
|
|
12
|
-
import {
|
|
12
|
+
import { useUnmountEffect, useDeepCompareEffect } from '@react-hookz/web';
|
|
13
13
|
import { useStatus, convertMethodParam } from '../../utils/hooks/useFormLegacy';
|
|
14
14
|
import { X_RUNTIME_DEFAULT } from '../../../configs/type-utils/x-runtime-default';
|
|
15
15
|
import { useFormType } from '../wd-form/contexts/form-type-context';
|
|
16
16
|
import { useFormLayout } from '../wd-form/contexts/form-layout-context';
|
|
17
17
|
import { useFormWidget } from '../wd-form/contexts/form-widget-context';
|
|
18
18
|
import { useSetWidgetApi } from '../../utils/widget-api/use-set-widget-api';
|
|
19
|
+
import { useFormField } from '../wd-form/contexts/form-field-context';
|
|
20
|
+
import { useFormFieldObj } from '../wd-form/contexts/form-field-obj-context';
|
|
19
21
|
import { errorHandler } from '../../utils/error';
|
|
22
|
+
import useDebouncedCallback from '../../utils/hooks/use-debounced-callback';
|
|
20
23
|
const logger = debug('wd-form-item');
|
|
24
|
+
const SET_VALUE_DEBOUNCE_TIMEOUT = 250;
|
|
21
25
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
22
26
|
export function useParentForm(widgetIgnored) {
|
|
23
27
|
return useFormWidget();
|
|
24
28
|
}
|
|
29
|
+
// 转换路径
|
|
30
|
+
const convertPathToArray = (path) => {
|
|
31
|
+
return path
|
|
32
|
+
.replace(/\[(\d+)\]/g, '.$1')
|
|
33
|
+
.split('.')
|
|
34
|
+
.filter(Boolean);
|
|
35
|
+
};
|
|
25
36
|
export function useFormInputTrait(inputParams) {
|
|
26
37
|
var _a;
|
|
27
|
-
const { value, $widget, inputRef, required = X_RUNTIME_DEFAULT.required, requiredMsg = '该项为必填项', rules = emptyArray, layout: currentLayout, setInnerHandle = noop, onChange: outerOnChange = noop,
|
|
38
|
+
const { value, $widget, inputRef, required = X_RUNTIME_DEFAULT.required, requiredMsg = '该项为必填项', rules = emptyArray, layout: currentLayout, setInnerHandle = noop, onChange: outerOnChange = noop, before, after, name: _name, $node, } = inputParams;
|
|
28
39
|
const label = inputParams.label;
|
|
29
40
|
if (isNil($widget)) {
|
|
30
41
|
throw new Error('$widget 没传入');
|
|
31
42
|
}
|
|
32
|
-
|
|
33
|
-
const [
|
|
43
|
+
// 初始值
|
|
44
|
+
const [initialValue] = useState(value);
|
|
45
|
+
const [variableValue] = useSyncValue(value);
|
|
46
|
+
const formFieldContext = useFormField();
|
|
47
|
+
const formFieldObjsContext = useFormFieldObj();
|
|
48
|
+
const [isChange, setIsChange] = useState(false);
|
|
49
|
+
const name = useMemo(() => {
|
|
50
|
+
if (isNil(_name) || (typeof _name === 'string' && _name.length === 0)) {
|
|
51
|
+
// name 没设置或为空串的时候不受表单容器控制
|
|
52
|
+
console.warn(`组件 ${$widget.id} 表单key(表单输入类组件 name 属性)没设置或为空串的时候不受表单容器控制`);
|
|
53
|
+
}
|
|
54
|
+
return String(_name);
|
|
55
|
+
}, [$widget.id, _name]);
|
|
56
|
+
// namePath 用于标识表单项的属性路径,用于容器通过lodash.set/get管理表单项的值
|
|
57
|
+
const namePath = useMemo(() => {
|
|
58
|
+
if (formFieldObjsContext === null || formFieldObjsContext === void 0 ? void 0 : formFieldObjsContext.objType) {
|
|
59
|
+
return formFieldObjsContext === null || formFieldObjsContext === void 0 ? void 0 : formFieldObjsContext.namePath.concat(name);
|
|
60
|
+
}
|
|
61
|
+
else if (name.includes('].')) {
|
|
62
|
+
// 兼容 formDetail 中 的 name 写法
|
|
63
|
+
return convertPathToArray(name);
|
|
64
|
+
}
|
|
65
|
+
return [name];
|
|
66
|
+
}, [formFieldObjsContext === null || formFieldObjsContext === void 0 ? void 0 : formFieldObjsContext.namePath, formFieldObjsContext === null || formFieldObjsContext === void 0 ? void 0 : formFieldObjsContext.objType, name]);
|
|
34
67
|
const formType = useFormType();
|
|
35
68
|
const statusParams = useStatus(inputParams);
|
|
36
69
|
const formDetailStatus = useFormDetailContext();
|
|
37
70
|
const [disabled, setDisabled] = useSyncValue(((_a = statusParams.disabled) !== null && _a !== void 0 ? _a : false) ||
|
|
38
71
|
formType === 'read' ||
|
|
39
72
|
formDetailStatus === 'disabled' ||
|
|
40
|
-
(
|
|
73
|
+
(formFieldObjsContext === null || formFieldObjsContext === void 0 ? void 0 : formFieldObjsContext.status) === 'disabled');
|
|
41
74
|
const [readOnly, setReadOnly] = useSyncValue(statusParams.readOnly ||
|
|
42
75
|
formType === 'read' ||
|
|
43
76
|
formDetailStatus === 'readOnly' ||
|
|
44
|
-
(
|
|
77
|
+
(formFieldObjsContext === null || formFieldObjsContext === void 0 ? void 0 : formFieldObjsContext.status) === 'readOnly');
|
|
45
78
|
const [validateState, setValidateState] = useState(inputParams.validateStatus);
|
|
46
79
|
const [validateErrorMsg, setValidateErrorMsg] = useState('');
|
|
47
80
|
const [visible, setVisible] = useState(true);
|
|
48
|
-
const forceUpdate = useRerender();
|
|
81
|
+
// const forceUpdate = useRerender();
|
|
49
82
|
const form = useParentForm($widget);
|
|
50
|
-
logger.debug('WdFormItem', form, name, inputParams);
|
|
51
83
|
const layoutInForm = useFormLayout();
|
|
52
84
|
const layout = useMemo(() => {
|
|
53
85
|
let finalLayout;
|
|
@@ -59,44 +91,70 @@ export function useFormInputTrait(inputParams) {
|
|
|
59
91
|
}
|
|
60
92
|
return finalLayout;
|
|
61
93
|
}, [currentLayout, layoutInForm]);
|
|
94
|
+
const _value = useMemo(() => {
|
|
95
|
+
let val = null;
|
|
96
|
+
if (isNil(_name) || (typeof _name === 'string' && _name.length === 0)) {
|
|
97
|
+
// name 没设置或为空串的时候不受表单容器控制
|
|
98
|
+
val = value;
|
|
99
|
+
}
|
|
100
|
+
else if (formFieldContext === null || formFieldContext === void 0 ? void 0 : formFieldContext.isInformContainer) {
|
|
101
|
+
// 在表单容器内,输入框的值受表单容器管理
|
|
102
|
+
// 在嵌套数组容器内,不在表单容器内,输入框的值受嵌套表单容器管理
|
|
103
|
+
// 在嵌套表单容器内,不在表单容器内,输入框的值受嵌套表单容器管理
|
|
104
|
+
val = formFieldContext === null || formFieldContext === void 0 ? void 0 : formFieldContext.getFieldValue({ namePath, initialValue });
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
val = value;
|
|
108
|
+
}
|
|
109
|
+
return val;
|
|
110
|
+
}, [_name, formFieldContext, value, namePath, initialValue]);
|
|
62
111
|
const [syncValue, _setSyncedValue,
|
|
63
112
|
// 只在暴露方法的闭包内用,别的地方别用
|
|
64
|
-
valueRef,] = useSyncValue(
|
|
113
|
+
valueRef,] = useSyncValue(_value, isObjectEqual);
|
|
65
114
|
const setSyncedValue = useCallback((newVal) => {
|
|
66
|
-
|
|
67
|
-
logger.debug('updateFormContext', newVal);
|
|
115
|
+
// 这里主动更新表单项的值,一是不在表单容器内的情况,二是表单容器内的值展示渲染优化减少异步值生效的视觉滞后,
|
|
68
116
|
_setSyncedValue(newVal);
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const f = form !== null && form !== void 0 ? form : getParentForm($widget);
|
|
78
|
-
(_a = f === null || f === void 0 ? void 0 : f.updateFormContext) === null || _a === void 0 ? void 0 : _a.call(f, name, syncValue);
|
|
79
|
-
}, [name, syncValue]);
|
|
80
|
-
useEffect(() => {
|
|
81
|
-
logger.debug('Form', form, name);
|
|
82
|
-
}, [form, name]);
|
|
117
|
+
setIsChange(true);
|
|
118
|
+
if (formFieldContext === null || formFieldContext === void 0 ? void 0 : formFieldContext.isInformContainer) {
|
|
119
|
+
// 在表单容器内,更新表单容器值,由表单容器管理值
|
|
120
|
+
// 在嵌套数组容器内,更新表单容器值,由表单容器管理值
|
|
121
|
+
// 在嵌套对象表单容器内,不在表单容器内,更新嵌套表单容器值,由嵌套表单容器管理值
|
|
122
|
+
formFieldContext.setFieldValue({ namePath, value: newVal });
|
|
123
|
+
}
|
|
124
|
+
}, [_setSyncedValue, formFieldContext, namePath]);
|
|
83
125
|
useEffect(() => {
|
|
84
126
|
// 未匹配任何规则时,清空错误提示
|
|
85
127
|
if (!rules)
|
|
86
128
|
setValidateErrorMsg('');
|
|
87
129
|
}, [rules]);
|
|
130
|
+
// 延迟比表单容器的api长一点,以满足响应$w.form.value变化,跟随变化的计算场景
|
|
131
|
+
const setSyncedVariableValue = useDebouncedCallback(setSyncedValue, SET_VALUE_DEBOUNCE_TIMEOUT, {
|
|
132
|
+
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
133
|
+
maxWait: SET_VALUE_DEBOUNCE_TIMEOUT * 2,
|
|
134
|
+
trailing: true,
|
|
135
|
+
});
|
|
136
|
+
useDeepCompareEffect(() => {
|
|
137
|
+
// value响应变量绑定,首次值为初始值
|
|
138
|
+
if (!isChange && isObjectEqual(variableValue, initialValue)) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
if (isObjectEqual(variableValue, _value)) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
if (formFieldContext === null || formFieldContext === void 0 ? void 0 : formFieldContext.isInformContainer) {
|
|
145
|
+
setSyncedVariableValue(variableValue);
|
|
146
|
+
}
|
|
147
|
+
}, [variableValue, initialValue]);
|
|
88
148
|
useEffect(() => {
|
|
89
149
|
var _a, _b;
|
|
90
150
|
const removeFormItem = (_b = (_a = $widget
|
|
91
|
-
.closest((w) => { var _a, _b; return ((_b = (_a = w.getConfig) === null || _a === void 0 ? void 0 : _a.call(w)) === null || _b === void 0 ? void 0 : _b.componentType) === 'form'; })) === null || _a === void 0 ? void 0 : _a.addFormItem) === null || _b === void 0 ? void 0 : _b.call(_a, name, $widget);
|
|
92
|
-
const removeFormObjItem = formObjContext === null || formObjContext === void 0 ? void 0 : formObjContext.addFormItem(name, $widget);
|
|
151
|
+
.closest((w) => { var _a, _b; return ((_b = (_a = w.getConfig) === null || _a === void 0 ? void 0 : _a.call(w)) === null || _b === void 0 ? void 0 : _b.componentType) === 'form'; })) === null || _a === void 0 ? void 0 : _a.addFormItem) === null || _b === void 0 ? void 0 : _b.call(_a, name, $widget, { initialValue, namePath });
|
|
93
152
|
logger.debug('addFormItem', name);
|
|
94
153
|
return () => {
|
|
95
154
|
logger.debug('removeFormItem', name);
|
|
96
155
|
removeFormItem === null || removeFormItem === void 0 ? void 0 : removeFormItem();
|
|
97
|
-
removeFormObjItem === null || removeFormObjItem === void 0 ? void 0 : removeFormObjItem();
|
|
98
156
|
};
|
|
99
|
-
}, [$widget, name, form,
|
|
157
|
+
}, [$widget, name, form, namePath, initialValue]);
|
|
100
158
|
const clearValidate = useCallback(() => {
|
|
101
159
|
setValidateErrorMsg('');
|
|
102
160
|
setValidateState(undefined);
|
|
@@ -189,8 +247,7 @@ export function useFormInputTrait(inputParams) {
|
|
|
189
247
|
let reg;
|
|
190
248
|
if (typeof item.pattern === 'string') {
|
|
191
249
|
const m = item.pattern.match(/(\/?)(.+)\1([a-z]*)/i);
|
|
192
|
-
if (m[3] &&
|
|
193
|
-
!/^(?!.*?(.).*?\1)[gmixXsuUAJ]+$/.test(m[3])) {
|
|
250
|
+
if (m[3] && !/^(?!.*?(.).*?\1)[gmixXsuUAJ]+$/.test(m[3])) {
|
|
194
251
|
reg = RegExp(item.pattern);
|
|
195
252
|
}
|
|
196
253
|
else {
|
|
@@ -257,7 +314,6 @@ export function useFormInputTrait(inputParams) {
|
|
|
257
314
|
return valueRef.current;
|
|
258
315
|
},
|
|
259
316
|
name,
|
|
260
|
-
forceUpdate,
|
|
261
317
|
value: syncValue,
|
|
262
318
|
clearValidate,
|
|
263
319
|
label,
|
|
@@ -273,10 +329,9 @@ export function useFormInputTrait(inputParams) {
|
|
|
273
329
|
return result;
|
|
274
330
|
}, [
|
|
275
331
|
name,
|
|
276
|
-
valueRef,
|
|
332
|
+
valueRef === null || valueRef === void 0 ? void 0 : valueRef.current,
|
|
277
333
|
statusParams.disabled,
|
|
278
334
|
statusParams.readOnly,
|
|
279
|
-
forceUpdate,
|
|
280
335
|
syncValue,
|
|
281
336
|
clearValidate,
|
|
282
337
|
label,
|
|
@@ -323,29 +378,11 @@ export function useFormInputTrait(inputParams) {
|
|
|
323
378
|
else if (fieldPermission === 'n') {
|
|
324
379
|
setVisible(false);
|
|
325
380
|
}
|
|
326
|
-
}, [
|
|
327
|
-
disabled,
|
|
328
|
-
fieldPermission,
|
|
329
|
-
fieldPermissionError,
|
|
330
|
-
fieldPermissionLoading,
|
|
331
|
-
setDisabled,
|
|
332
|
-
]);
|
|
381
|
+
}, [disabled, fieldPermission, fieldPermissionError, fieldPermissionLoading, setDisabled]);
|
|
333
382
|
useUnmountEffect(() => {
|
|
334
383
|
var _a;
|
|
335
384
|
(_a = form === null || form === void 0 ? void 0 : form.updateFormContext) === null || _a === void 0 ? void 0 : _a.call(form, name, undefined);
|
|
336
385
|
});
|
|
337
|
-
// const runOnceRef = useRef(false);
|
|
338
|
-
// useEffect(() => {
|
|
339
|
-
// // 双保险,向上取 initialValues
|
|
340
|
-
// if (runOnceRef.current) {
|
|
341
|
-
// return;
|
|
342
|
-
// }
|
|
343
|
-
// if (!form) return;
|
|
344
|
-
// if (!value && !isNil(lodashGet(form.initialValues, name))) {
|
|
345
|
-
// setSyncedValue(lodashGet(form.initialValues, name));
|
|
346
|
-
// runOnceRef.current = true;
|
|
347
|
-
// }
|
|
348
|
-
// }, [form, name, setSyncedValue, value]);
|
|
349
386
|
const onChange = useCallback((value) => {
|
|
350
387
|
var _a;
|
|
351
388
|
setSyncedValue(value);
|
|
@@ -362,6 +399,7 @@ export function useFormInputTrait(inputParams) {
|
|
|
362
399
|
setValidateErrorMsg(validateErrorMsg);
|
|
363
400
|
}, [setValidateState, setValidateErrorMsg]);
|
|
364
401
|
return {
|
|
402
|
+
namePath,
|
|
365
403
|
visible,
|
|
366
404
|
onChange,
|
|
367
405
|
value: syncValue,
|
|
@@ -376,5 +414,6 @@ export function useFormInputTrait(inputParams) {
|
|
|
376
414
|
*/
|
|
377
415
|
layout,
|
|
378
416
|
initValidate,
|
|
417
|
+
isInformContainer: formFieldContext === null || formFieldContext === void 0 ? void 0 : formFieldContext.isInformContainer,
|
|
379
418
|
};
|
|
380
419
|
}
|
|
@@ -6,7 +6,7 @@ export type FormRichTextProps = CommonPropsType & DataType & {
|
|
|
6
6
|
disabled: boolean;
|
|
7
7
|
readOnly: boolean;
|
|
8
8
|
} & EventsType;
|
|
9
|
-
declare const
|
|
9
|
+
declare const FormRichText: React.ForwardRefExoticComponent<CommonPropsType & {
|
|
10
10
|
name: string;
|
|
11
11
|
title: string;
|
|
12
12
|
value: string;
|
|
@@ -27,5 +27,5 @@ declare const FromRichText: React.ForwardRefExoticComponent<CommonPropsType & {
|
|
|
27
27
|
events: {
|
|
28
28
|
change: (eventDetail: unknown, ...args: unknown[]) => unknown;
|
|
29
29
|
};
|
|
30
|
-
} & React.RefAttributes<
|
|
31
|
-
export default
|
|
30
|
+
} & React.RefAttributes<unknown>>;
|
|
31
|
+
export default FormRichText;
|
|
@@ -4,18 +4,22 @@ import { useFormInputTrait } from '../form-input-hooks';
|
|
|
4
4
|
import Tips from '../form/tips';
|
|
5
5
|
import RichText from '../richText';
|
|
6
6
|
import { FormItemWrapper } from '../common/form-item-wrapper';
|
|
7
|
-
const
|
|
7
|
+
const FormRichText = React.forwardRef(function FormRichText(props, inputRef) {
|
|
8
8
|
const { className, id, style, events, title, titleVisible, maxSize, acceptTypes, required, requiredFlag, ...restProps } = props;
|
|
9
|
-
const { value, name,
|
|
9
|
+
const { value, name, disabled, layout, validateErrorMsg, validateState, readOnly, visible } = useFormInputTrait({
|
|
10
10
|
name: restProps.name,
|
|
11
11
|
inputRef,
|
|
12
12
|
required,
|
|
13
13
|
label: title,
|
|
14
14
|
...restProps,
|
|
15
15
|
});
|
|
16
|
+
const onChange = (value) => {
|
|
17
|
+
var _a;
|
|
18
|
+
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.setValue(value);
|
|
19
|
+
};
|
|
16
20
|
if (!visible) {
|
|
17
21
|
return null;
|
|
18
22
|
}
|
|
19
|
-
return (_jsxs(FormItemWrapper, { children: [_jsx(RichText, { id: id, style: style, className: className, events: events, onChange: onChange, acceptTypes: acceptTypes, label: title, labelVisible: titleVisible, disabled: disabled, layout: layout, maxSize: maxSize, name: name, readOnly: readOnly, requiredFlag: required && requiredFlag, value: value }), (validateState === 'error' || validateState === 'warn') &&
|
|
23
|
+
return (_jsxs(FormItemWrapper, { children: [_jsx(RichText, { id: id, style: style, className: className, events: events, onChange: onChange, acceptTypes: acceptTypes, label: title, labelVisible: titleVisible, disabled: disabled, layout: layout, maxSize: maxSize, name: name, readOnly: readOnly, requiredFlag: required && requiredFlag, value: value }), (validateState === 'error' || validateState === 'warn') && _jsx(Tips, { tips: validateErrorMsg, type: "warn" })] }));
|
|
20
24
|
});
|
|
21
|
-
export default
|
|
25
|
+
export default FormRichText;
|
|
@@ -20,7 +20,7 @@ export declare const newContextItem: (childFormItem: any, name: any, isPureArray
|
|
|
20
20
|
index: number;
|
|
21
21
|
_id: string;
|
|
22
22
|
};
|
|
23
|
-
export declare const changeHandle: ({ type, name, data, childFormItem, isPureArray, params, parent
|
|
23
|
+
export declare const changeHandle: ({ type, name, data, childFormItem, isPureArray, params, parent }: {
|
|
24
24
|
type: any;
|
|
25
25
|
name: any;
|
|
26
26
|
data: any;
|