@gct-paas/word 0.1.63-beta.4 → 0.1.63-beta.5
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.
|
@@ -40,8 +40,6 @@ export interface ApiRule {
|
|
|
40
40
|
type: 'api';
|
|
41
41
|
/** 请求函数 key */
|
|
42
42
|
fetcher: 'ref' | 'rdo2ref';
|
|
43
|
-
/** 仅主模型字段可发起请求 */
|
|
44
|
-
onlyMainModelFieldsCanRequest: boolean;
|
|
45
43
|
/** 失败时的默认 label */
|
|
46
44
|
fallback?: string;
|
|
47
45
|
}
|
|
@@ -78,6 +76,10 @@ export interface FieldComputedConfig {
|
|
|
78
76
|
propRules?: Record<string, ComputedRule>;
|
|
79
77
|
/** 写入 dataManager 的派生规则 */
|
|
80
78
|
defaultValueRule?: ComputedRule;
|
|
79
|
+
/** 仅主模型字段可赋运行时默认值,子模型字段跳过默认值注入 */
|
|
80
|
+
onlyMainModelCanDefault?: boolean;
|
|
81
|
+
/** 作为对象子字段时,跳过运行时默认值解析 */
|
|
82
|
+
skipDefaultWhenBelongingObject?: boolean;
|
|
81
83
|
/** 填报值变化后的 enrich(超链接 _href_、展示标签 _lb_、批次 _id_) */
|
|
82
84
|
onValueChangeRule?: ValueChangeRule | ValueChangeRule[];
|
|
83
85
|
}
|
package/dist/index.es.js
CHANGED
|
@@ -80842,17 +80842,24 @@ async function resolveFieldDefaults(params) {
|
|
|
80842
80842
|
const manifest2 = ctx.getFieldManifest(field.fieldType);
|
|
80843
80843
|
if (!manifest2?.computed) return;
|
|
80844
80844
|
const { defaultValueRule } = manifest2.computed;
|
|
80845
|
+
const skipRuntimeDefaultEnrichment = shouldSkipRuntimeDefaultEnrichment(field, manifest2.computed);
|
|
80845
80846
|
let defaults2 = applyDefaultValue(props, {
|
|
80846
80847
|
rule: defaultValueRule,
|
|
80847
80848
|
valuePath: field.valuePath,
|
|
80848
80849
|
fieldType: field.fieldType
|
|
80849
80850
|
});
|
|
80850
80851
|
if (defaultValueRule?.type === "api" || defaultValueRule?.type === "resolve" && defaultValueRule.isRenderSideRequest) {
|
|
80851
|
-
defaults2 = enrichApiDefaultValues(defaults2, defaultValueRule, field.valuePath, field, context
|
|
80852
|
+
defaults2 = enrichApiDefaultValues(defaults2, defaultValueRule, field.valuePath, field, context, {
|
|
80853
|
+
skipRuntimeDefaultEnrichment
|
|
80854
|
+
});
|
|
80852
80855
|
} else if (field.fieldType === FIELD_TYPE.E_SOP_VERSION && props.sopId) {
|
|
80853
|
-
|
|
80856
|
+
if (!skipRuntimeDefaultEnrichment) {
|
|
80857
|
+
defaults2 = await enrichESopVersionDefaultValues(defaults2, field.valuePath, props, context);
|
|
80858
|
+
}
|
|
80854
80859
|
} else {
|
|
80855
|
-
defaults2 = enrichContextDefaultValues(defaults2, field.valuePath, field.fieldType, context
|
|
80860
|
+
defaults2 = enrichContextDefaultValues(defaults2, field.valuePath, field.fieldType, context, {
|
|
80861
|
+
skipRuntimeDefaultEnrichment
|
|
80862
|
+
});
|
|
80856
80863
|
}
|
|
80857
80864
|
const autofillDefaultValues = await loadDefaultValueByAutofillRules(
|
|
80858
80865
|
instances,
|
|
@@ -80876,8 +80883,6 @@ async function loadDefaultValuesByFields(instances, ctx, context, masterSlaveLis
|
|
|
80876
80883
|
const promises = instances.map(async (instance2) => {
|
|
80877
80884
|
const { field, props } = instance2.widgetMeta;
|
|
80878
80885
|
if (!field || !props) return;
|
|
80879
|
-
const isSpecialMaterialConsumeObjField = !!field.belongingObject && [FIELD_TYPE.PRODUCT, FIELD_TYPE.MATERIAL_NO].includes(field.fieldType);
|
|
80880
|
-
if (isSpecialMaterialConsumeObjField) return;
|
|
80881
80886
|
mergeDefaultsIntoMap(
|
|
80882
80887
|
defaultDataMap,
|
|
80883
80888
|
await resolveFieldDefaults({ props, field, ctx, context, instances })
|
|
@@ -84262,6 +84267,15 @@ function applyDefaultValue(props, payload) {
|
|
|
84262
84267
|
function buildFieldValueUpdate(valuePath, value) {
|
|
84263
84268
|
return { [valuePath]: value };
|
|
84264
84269
|
}
|
|
84270
|
+
function shouldSkipRuntimeDefaultEnrichment(fieldMeta, computed2) {
|
|
84271
|
+
if (computed2?.onlyMainModelCanDefault && fieldMeta.subFieldKey) {
|
|
84272
|
+
return true;
|
|
84273
|
+
}
|
|
84274
|
+
if (computed2?.skipDefaultWhenBelongingObject && fieldMeta.belongingObject) {
|
|
84275
|
+
return true;
|
|
84276
|
+
}
|
|
84277
|
+
return false;
|
|
84278
|
+
}
|
|
84265
84279
|
function enrichApiDefaultValues(defaults2, rule, valuePath, fieldMeta, context, options) {
|
|
84266
84280
|
if (!rule || !("fetcher" in rule)) {
|
|
84267
84281
|
return defaults2;
|
|
@@ -84275,8 +84289,7 @@ function enrichApiDefaultValues(defaults2, rule, valuePath, fieldMeta, context,
|
|
|
84275
84289
|
return defaults2;
|
|
84276
84290
|
}
|
|
84277
84291
|
} else if (rule.type === "api") {
|
|
84278
|
-
|
|
84279
|
-
if (apiRule.onlyMainModelFieldsCanRequest && fieldMeta.subFieldKey && true) {
|
|
84292
|
+
if (options?.skipRuntimeDefaultEnrichment) {
|
|
84280
84293
|
return defaults2;
|
|
84281
84294
|
}
|
|
84282
84295
|
} else {
|
|
@@ -84284,7 +84297,10 @@ function enrichApiDefaultValues(defaults2, rule, valuePath, fieldMeta, context,
|
|
|
84284
84297
|
}
|
|
84285
84298
|
return { ...defaults2, [valuePath]: id };
|
|
84286
84299
|
}
|
|
84287
|
-
function enrichContextDefaultValues(defaults2, valuePath, fieldType, context) {
|
|
84300
|
+
function enrichContextDefaultValues(defaults2, valuePath, fieldType, context, options) {
|
|
84301
|
+
if (options?.skipRuntimeDefaultEnrichment) {
|
|
84302
|
+
return defaults2;
|
|
84303
|
+
}
|
|
84288
84304
|
const contextValue = context[fieldType];
|
|
84289
84305
|
if (isEmptyValue$1(contextValue)) {
|
|
84290
84306
|
return defaults2;
|
|
@@ -123155,10 +123171,10 @@ const manifest$X = {
|
|
|
123155
123171
|
...autofillFieldDefaultProps
|
|
123156
123172
|
},
|
|
123157
123173
|
computed: {
|
|
123174
|
+
onlyMainModelCanDefault: true,
|
|
123158
123175
|
defaultValueRule: {
|
|
123159
123176
|
type: "api",
|
|
123160
|
-
fetcher: "ref"
|
|
123161
|
-
onlyMainModelFieldsCanRequest: true
|
|
123177
|
+
fetcher: "ref"
|
|
123162
123178
|
},
|
|
123163
123179
|
onValueChangeRule: labelOnValueChangeRule
|
|
123164
123180
|
}
|
|
@@ -123204,10 +123220,10 @@ const manifest$V = {
|
|
|
123204
123220
|
...autofillFieldDefaultProps
|
|
123205
123221
|
},
|
|
123206
123222
|
computed: {
|
|
123223
|
+
onlyMainModelCanDefault: true,
|
|
123207
123224
|
defaultValueRule: {
|
|
123208
123225
|
type: "api",
|
|
123209
|
-
fetcher: "ref"
|
|
123210
|
-
onlyMainModelFieldsCanRequest: true
|
|
123226
|
+
fetcher: "ref"
|
|
123211
123227
|
},
|
|
123212
123228
|
onValueChangeRule: labelOnValueChangeRule
|
|
123213
123229
|
}
|
|
@@ -123366,10 +123382,10 @@ const manifest$O = {
|
|
|
123366
123382
|
...autofillFieldDefaultProps
|
|
123367
123383
|
},
|
|
123368
123384
|
computed: {
|
|
123385
|
+
onlyMainModelCanDefault: true,
|
|
123369
123386
|
defaultValueRule: {
|
|
123370
123387
|
type: "api",
|
|
123371
|
-
fetcher: "ref"
|
|
123372
|
-
onlyMainModelFieldsCanRequest: true
|
|
123388
|
+
fetcher: "ref"
|
|
123373
123389
|
},
|
|
123374
123390
|
onValueChangeRule: labelOnValueChangeRule
|
|
123375
123391
|
}
|
|
@@ -123393,10 +123409,10 @@ const manifest$N = {
|
|
|
123393
123409
|
...autofillFieldDefaultProps
|
|
123394
123410
|
},
|
|
123395
123411
|
computed: {
|
|
123412
|
+
onlyMainModelCanDefault: true,
|
|
123396
123413
|
defaultValueRule: {
|
|
123397
123414
|
type: "api",
|
|
123398
|
-
fetcher: "ref"
|
|
123399
|
-
onlyMainModelFieldsCanRequest: true
|
|
123415
|
+
fetcher: "ref"
|
|
123400
123416
|
},
|
|
123401
123417
|
onValueChangeRule: labelOnValueChangeRule
|
|
123402
123418
|
}
|
|
@@ -123420,10 +123436,10 @@ const manifest$M = {
|
|
|
123420
123436
|
...autofillFieldDefaultProps
|
|
123421
123437
|
},
|
|
123422
123438
|
computed: {
|
|
123439
|
+
onlyMainModelCanDefault: true,
|
|
123423
123440
|
defaultValueRule: {
|
|
123424
123441
|
type: "api",
|
|
123425
|
-
fetcher: "rdo2ref"
|
|
123426
|
-
onlyMainModelFieldsCanRequest: true
|
|
123442
|
+
fetcher: "rdo2ref"
|
|
123427
123443
|
},
|
|
123428
123444
|
onValueChangeRule: labelOnValueChangeRule
|
|
123429
123445
|
}
|
|
@@ -123490,10 +123506,10 @@ const manifest$J = {
|
|
|
123490
123506
|
...autofillFieldDefaultProps
|
|
123491
123507
|
},
|
|
123492
123508
|
computed: {
|
|
123509
|
+
onlyMainModelCanDefault: true,
|
|
123493
123510
|
defaultValueRule: {
|
|
123494
123511
|
type: "api",
|
|
123495
|
-
fetcher: "ref"
|
|
123496
|
-
onlyMainModelFieldsCanRequest: true
|
|
123512
|
+
fetcher: "ref"
|
|
123497
123513
|
},
|
|
123498
123514
|
onValueChangeRule: labelOnValueChangeRule
|
|
123499
123515
|
}
|
|
@@ -123566,8 +123582,7 @@ const manifest$G = {
|
|
|
123566
123582
|
computed: {
|
|
123567
123583
|
defaultValueRule: {
|
|
123568
123584
|
type: "api",
|
|
123569
|
-
fetcher: "rdo2ref"
|
|
123570
|
-
onlyMainModelFieldsCanRequest: false
|
|
123585
|
+
fetcher: "rdo2ref"
|
|
123571
123586
|
},
|
|
123572
123587
|
onValueChangeRule: labelOnValueChangeRule
|
|
123573
123588
|
}
|
|
@@ -123749,8 +123764,7 @@ const manifest$z = {
|
|
|
123749
123764
|
computed: {
|
|
123750
123765
|
defaultValueRule: {
|
|
123751
123766
|
type: "api",
|
|
123752
|
-
fetcher: "ref"
|
|
123753
|
-
onlyMainModelFieldsCanRequest: false
|
|
123767
|
+
fetcher: "ref"
|
|
123754
123768
|
},
|
|
123755
123769
|
onValueChangeRule: labelOnValueChangeRule
|
|
123756
123770
|
}
|
|
@@ -123852,8 +123866,7 @@ const manifest$v = {
|
|
|
123852
123866
|
computed: {
|
|
123853
123867
|
defaultValueRule: {
|
|
123854
123868
|
type: "api",
|
|
123855
|
-
fetcher: "ref"
|
|
123856
|
-
onlyMainModelFieldsCanRequest: false
|
|
123869
|
+
fetcher: "ref"
|
|
123857
123870
|
},
|
|
123858
123871
|
onValueChangeRule: labelOnValueChangeRule
|
|
123859
123872
|
}
|
|
@@ -123929,8 +123942,7 @@ const manifest$s = {
|
|
|
123929
123942
|
computed: {
|
|
123930
123943
|
defaultValueRule: {
|
|
123931
123944
|
type: "api",
|
|
123932
|
-
fetcher: "ref"
|
|
123933
|
-
onlyMainModelFieldsCanRequest: false
|
|
123945
|
+
fetcher: "ref"
|
|
123934
123946
|
},
|
|
123935
123947
|
onValueChangeRule: labelOnValueChangeRule
|
|
123936
123948
|
}
|
|
@@ -124082,10 +124094,10 @@ const manifest$l = {
|
|
|
124082
124094
|
}
|
|
124083
124095
|
},
|
|
124084
124096
|
computed: {
|
|
124097
|
+
onlyMainModelCanDefault: true,
|
|
124085
124098
|
defaultValueRule: {
|
|
124086
124099
|
type: "api",
|
|
124087
|
-
fetcher: "ref"
|
|
124088
|
-
onlyMainModelFieldsCanRequest: true
|
|
124100
|
+
fetcher: "ref"
|
|
124089
124101
|
},
|
|
124090
124102
|
onValueChangeRule: labelOnValueChangeRule
|
|
124091
124103
|
}
|
|
@@ -124147,6 +124159,8 @@ const manifest$i = {
|
|
|
124147
124159
|
...commonDefaultProps
|
|
124148
124160
|
},
|
|
124149
124161
|
computed: {
|
|
124162
|
+
onlyMainModelCanDefault: true,
|
|
124163
|
+
skipDefaultWhenBelongingObject: true,
|
|
124150
124164
|
onValueChangeRule: [...hyperlinkAndIdOnValueChangeRules]
|
|
124151
124165
|
}
|
|
124152
124166
|
};
|
|
@@ -124169,10 +124183,10 @@ const manifest$h = {
|
|
|
124169
124183
|
...autofillFieldDefaultProps
|
|
124170
124184
|
},
|
|
124171
124185
|
computed: {
|
|
124186
|
+
onlyMainModelCanDefault: true,
|
|
124172
124187
|
defaultValueRule: {
|
|
124173
124188
|
type: "api",
|
|
124174
|
-
fetcher: "ref"
|
|
124175
|
-
onlyMainModelFieldsCanRequest: true
|
|
124189
|
+
fetcher: "ref"
|
|
124176
124190
|
},
|
|
124177
124191
|
onValueChangeRule: labelOnValueChangeRule
|
|
124178
124192
|
}
|
|
@@ -124218,10 +124232,11 @@ const manifest$f = {
|
|
|
124218
124232
|
}
|
|
124219
124233
|
},
|
|
124220
124234
|
computed: {
|
|
124235
|
+
onlyMainModelCanDefault: true,
|
|
124236
|
+
skipDefaultWhenBelongingObject: true,
|
|
124221
124237
|
defaultValueRule: {
|
|
124222
124238
|
type: "api",
|
|
124223
|
-
fetcher: "rdo2ref"
|
|
124224
|
-
onlyMainModelFieldsCanRequest: true
|
|
124239
|
+
fetcher: "rdo2ref"
|
|
124225
124240
|
},
|
|
124226
124241
|
onValueChangeRule: labelOnValueChangeRule
|
|
124227
124242
|
}
|
|
@@ -124251,10 +124266,10 @@ const manifest$e = {
|
|
|
124251
124266
|
}
|
|
124252
124267
|
},
|
|
124253
124268
|
computed: {
|
|
124269
|
+
onlyMainModelCanDefault: true,
|
|
124254
124270
|
defaultValueRule: {
|
|
124255
124271
|
type: "api",
|
|
124256
|
-
fetcher: "ref"
|
|
124257
|
-
onlyMainModelFieldsCanRequest: true
|
|
124272
|
+
fetcher: "ref"
|
|
124258
124273
|
},
|
|
124259
124274
|
onValueChangeRule: labelOnValueChangeRule
|
|
124260
124275
|
}
|
|
@@ -124284,10 +124299,10 @@ const manifest$d = {
|
|
|
124284
124299
|
}
|
|
124285
124300
|
},
|
|
124286
124301
|
computed: {
|
|
124302
|
+
onlyMainModelCanDefault: true,
|
|
124287
124303
|
defaultValueRule: {
|
|
124288
124304
|
type: "api",
|
|
124289
|
-
fetcher: "ref"
|
|
124290
|
-
onlyMainModelFieldsCanRequest: true
|
|
124305
|
+
fetcher: "ref"
|
|
124291
124306
|
},
|
|
124292
124307
|
onValueChangeRule: labelOnValueChangeRule
|
|
124293
124308
|
}
|
|
@@ -124328,6 +124343,7 @@ const manifest$b = {
|
|
|
124328
124343
|
...commonDefaultProps
|
|
124329
124344
|
},
|
|
124330
124345
|
computed: {
|
|
124346
|
+
onlyMainModelCanDefault: true,
|
|
124331
124347
|
onValueChangeRule: [...hyperlinkAndIdOnValueChangeRules]
|
|
124332
124348
|
}
|
|
124333
124349
|
};
|
|
@@ -124356,10 +124372,10 @@ const manifest$a = {
|
|
|
124356
124372
|
}
|
|
124357
124373
|
},
|
|
124358
124374
|
computed: {
|
|
124375
|
+
onlyMainModelCanDefault: true,
|
|
124359
124376
|
defaultValueRule: {
|
|
124360
124377
|
type: "api",
|
|
124361
|
-
fetcher: "ref"
|
|
124362
|
-
onlyMainModelFieldsCanRequest: true
|
|
124378
|
+
fetcher: "ref"
|
|
124363
124379
|
},
|
|
124364
124380
|
onValueChangeRule: labelOnValueChangeRule
|
|
124365
124381
|
}
|
|
@@ -124382,6 +124398,7 @@ const manifest$9 = {
|
|
|
124382
124398
|
...commonDefaultProps
|
|
124383
124399
|
},
|
|
124384
124400
|
computed: {
|
|
124401
|
+
onlyMainModelCanDefault: true,
|
|
124385
124402
|
onValueChangeRule: idOnValueChangeRule
|
|
124386
124403
|
}
|
|
124387
124404
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FIELD_TYPE } from '../../domain/field/field-type';
|
|
2
2
|
import { Doc } from '../../core';
|
|
3
|
-
import { ComputedRule } from '../../domain/field/field-props-schema-type';
|
|
3
|
+
import { ComputedRule, FieldComputedConfig } from '../../domain/field/field-props-schema-type';
|
|
4
4
|
import { FieldDataBindingMeta } from '../../core/widget';
|
|
5
5
|
export declare const RUNTIME_DATE_DEFAULT_PREFIX = "runtimeValue:date:";
|
|
6
6
|
export declare function resolveComputedRule(rule: ComputedRule, props: any, fieldType?: FIELD_TYPE): any;
|
|
@@ -14,17 +14,21 @@ export declare function applyDefaultValue(props: any, payload: {
|
|
|
14
14
|
} | undefined;
|
|
15
15
|
/** 单字段 value 写入片段 */
|
|
16
16
|
export declare function buildFieldValueUpdate(valuePath: string, value: unknown): Record<string, unknown>;
|
|
17
|
+
/** 是否应跳过 context / api 运行时默认值注入 */
|
|
18
|
+
export declare function shouldSkipRuntimeDefaultEnrichment(fieldMeta: FieldDataBindingMeta, computed?: FieldComputedConfig): boolean;
|
|
17
19
|
/**
|
|
18
20
|
* 渲染端:用 context 里的真实 id 覆盖设计态占位默认值
|
|
19
21
|
*/
|
|
20
22
|
export declare function enrichApiDefaultValues(defaults: Record<string, any> | undefined, rule: ComputedRule, valuePath: string, fieldMeta: FieldDataBindingMeta, context: Record<string, unknown>, options?: {
|
|
21
|
-
|
|
23
|
+
skipRuntimeDefaultEnrichment?: boolean;
|
|
22
24
|
}): Record<string, any> | undefined;
|
|
23
25
|
/**
|
|
24
26
|
* 渲染端:用 context[fieldType] 补全默认值(设计态 defaultValue 优先,仅空值时填充)
|
|
25
27
|
* 适用于文本等非 api 类型字段从 paramsConfig 注入默认值
|
|
26
28
|
*/
|
|
27
|
-
export declare function enrichContextDefaultValues(defaults: Record<string, any> | undefined, valuePath: string, fieldType: FIELD_TYPE, context: Record<string, unknown
|
|
29
|
+
export declare function enrichContextDefaultValues(defaults: Record<string, any> | undefined, valuePath: string, fieldType: FIELD_TYPE, context: Record<string, unknown>, options?: {
|
|
30
|
+
skipRuntimeDefaultEnrichment?: boolean;
|
|
31
|
+
}): Record<string, any> | undefined;
|
|
28
32
|
/**
|
|
29
33
|
* E-SOP 版本字段:配置了 SOP 后的默认值补全
|
|
30
34
|
* 优先级:设计态 defaultValue > paramsConfig.sopList > 接口 default_ 版本
|