@gct-paas/word 0.1.63-beta.4 → 0.1.63-beta.6

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
- defaults2 = await enrichESopVersionDefaultValues(defaults2, field.valuePath, props, context);
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
- const apiRule = rule;
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;
@@ -89111,7 +89127,8 @@ const fields$1 = [
89111
89127
  optionMapping: { value: "id_", label: "name_" },
89112
89128
  searchFields: ["name_"],
89113
89129
  baseQuery: {
89114
- "production_identification_type_.in": ["LOT", "SN"]
89130
+ "production_identification_type_.in": ["LOT", "SN"],
89131
+ is_rework_: 0
89115
89132
  }
89116
89133
  },
89117
89134
  defaultProps: {},
@@ -89526,7 +89543,8 @@ const fields = [
89526
89543
  optionMapping: { value: "id_", label: "name_" },
89527
89544
  searchFields: ["name_"],
89528
89545
  baseQuery: {
89529
- "production_identification_type_.in": ["LOT", "SN"]
89546
+ "production_identification_type_.in": ["LOT", "SN"],
89547
+ is_rework_: 0
89530
89548
  }
89531
89549
  },
89532
89550
  defaultProps: {},
@@ -89679,10 +89697,17 @@ async function openEntrustSterilBatchListScan(options) {
89679
89697
  GctMessage.error("扫描的物料批次不存在");
89680
89698
  return;
89681
89699
  }
89682
- const { queryData, exp } = buildLikeQuery([], "", {
89700
+ const { queryData: typeQueryData, exp: typeExp } = buildLikeQuery([], "", {
89683
89701
  "production_identification_type_.in": ["LOT", "SN"],
89684
- ...requestBody
89702
+ is_rework_: 0
89685
89703
  });
89704
+ const queryData = {
89705
+ ...typeQueryData,
89706
+ ...requestBody
89707
+ };
89708
+ const nameKeys = Object.keys(requestBody);
89709
+ const nameExp = nameKeys.length <= 1 ? nameKeys[0] ?? "" : `AND(${nameKeys.join(",")})`;
89710
+ const exp = typeExp && nameExp ? `AND(${nameExp},${typeExp})` : nameExp || typeExp;
89686
89711
  const result = await callBizService(remoteSync.api, {
89687
89712
  query: queryData,
89688
89713
  exp
@@ -123155,10 +123180,10 @@ const manifest$X = {
123155
123180
  ...autofillFieldDefaultProps
123156
123181
  },
123157
123182
  computed: {
123183
+ onlyMainModelCanDefault: true,
123158
123184
  defaultValueRule: {
123159
123185
  type: "api",
123160
- fetcher: "ref",
123161
- onlyMainModelFieldsCanRequest: true
123186
+ fetcher: "ref"
123162
123187
  },
123163
123188
  onValueChangeRule: labelOnValueChangeRule
123164
123189
  }
@@ -123204,10 +123229,10 @@ const manifest$V = {
123204
123229
  ...autofillFieldDefaultProps
123205
123230
  },
123206
123231
  computed: {
123232
+ onlyMainModelCanDefault: true,
123207
123233
  defaultValueRule: {
123208
123234
  type: "api",
123209
- fetcher: "ref",
123210
- onlyMainModelFieldsCanRequest: true
123235
+ fetcher: "ref"
123211
123236
  },
123212
123237
  onValueChangeRule: labelOnValueChangeRule
123213
123238
  }
@@ -123366,10 +123391,10 @@ const manifest$O = {
123366
123391
  ...autofillFieldDefaultProps
123367
123392
  },
123368
123393
  computed: {
123394
+ onlyMainModelCanDefault: true,
123369
123395
  defaultValueRule: {
123370
123396
  type: "api",
123371
- fetcher: "ref",
123372
- onlyMainModelFieldsCanRequest: true
123397
+ fetcher: "ref"
123373
123398
  },
123374
123399
  onValueChangeRule: labelOnValueChangeRule
123375
123400
  }
@@ -123393,10 +123418,10 @@ const manifest$N = {
123393
123418
  ...autofillFieldDefaultProps
123394
123419
  },
123395
123420
  computed: {
123421
+ onlyMainModelCanDefault: true,
123396
123422
  defaultValueRule: {
123397
123423
  type: "api",
123398
- fetcher: "ref",
123399
- onlyMainModelFieldsCanRequest: true
123424
+ fetcher: "ref"
123400
123425
  },
123401
123426
  onValueChangeRule: labelOnValueChangeRule
123402
123427
  }
@@ -123420,10 +123445,10 @@ const manifest$M = {
123420
123445
  ...autofillFieldDefaultProps
123421
123446
  },
123422
123447
  computed: {
123448
+ onlyMainModelCanDefault: true,
123423
123449
  defaultValueRule: {
123424
123450
  type: "api",
123425
- fetcher: "rdo2ref",
123426
- onlyMainModelFieldsCanRequest: true
123451
+ fetcher: "rdo2ref"
123427
123452
  },
123428
123453
  onValueChangeRule: labelOnValueChangeRule
123429
123454
  }
@@ -123490,10 +123515,10 @@ const manifest$J = {
123490
123515
  ...autofillFieldDefaultProps
123491
123516
  },
123492
123517
  computed: {
123518
+ onlyMainModelCanDefault: true,
123493
123519
  defaultValueRule: {
123494
123520
  type: "api",
123495
- fetcher: "ref",
123496
- onlyMainModelFieldsCanRequest: true
123521
+ fetcher: "ref"
123497
123522
  },
123498
123523
  onValueChangeRule: labelOnValueChangeRule
123499
123524
  }
@@ -123566,8 +123591,7 @@ const manifest$G = {
123566
123591
  computed: {
123567
123592
  defaultValueRule: {
123568
123593
  type: "api",
123569
- fetcher: "rdo2ref",
123570
- onlyMainModelFieldsCanRequest: false
123594
+ fetcher: "rdo2ref"
123571
123595
  },
123572
123596
  onValueChangeRule: labelOnValueChangeRule
123573
123597
  }
@@ -123749,8 +123773,7 @@ const manifest$z = {
123749
123773
  computed: {
123750
123774
  defaultValueRule: {
123751
123775
  type: "api",
123752
- fetcher: "ref",
123753
- onlyMainModelFieldsCanRequest: false
123776
+ fetcher: "ref"
123754
123777
  },
123755
123778
  onValueChangeRule: labelOnValueChangeRule
123756
123779
  }
@@ -123852,8 +123875,7 @@ const manifest$v = {
123852
123875
  computed: {
123853
123876
  defaultValueRule: {
123854
123877
  type: "api",
123855
- fetcher: "ref",
123856
- onlyMainModelFieldsCanRequest: false
123878
+ fetcher: "ref"
123857
123879
  },
123858
123880
  onValueChangeRule: labelOnValueChangeRule
123859
123881
  }
@@ -123929,8 +123951,7 @@ const manifest$s = {
123929
123951
  computed: {
123930
123952
  defaultValueRule: {
123931
123953
  type: "api",
123932
- fetcher: "ref",
123933
- onlyMainModelFieldsCanRequest: false
123954
+ fetcher: "ref"
123934
123955
  },
123935
123956
  onValueChangeRule: labelOnValueChangeRule
123936
123957
  }
@@ -124082,10 +124103,10 @@ const manifest$l = {
124082
124103
  }
124083
124104
  },
124084
124105
  computed: {
124106
+ onlyMainModelCanDefault: true,
124085
124107
  defaultValueRule: {
124086
124108
  type: "api",
124087
- fetcher: "ref",
124088
- onlyMainModelFieldsCanRequest: true
124109
+ fetcher: "ref"
124089
124110
  },
124090
124111
  onValueChangeRule: labelOnValueChangeRule
124091
124112
  }
@@ -124147,6 +124168,8 @@ const manifest$i = {
124147
124168
  ...commonDefaultProps
124148
124169
  },
124149
124170
  computed: {
124171
+ onlyMainModelCanDefault: true,
124172
+ skipDefaultWhenBelongingObject: true,
124150
124173
  onValueChangeRule: [...hyperlinkAndIdOnValueChangeRules]
124151
124174
  }
124152
124175
  };
@@ -124169,10 +124192,10 @@ const manifest$h = {
124169
124192
  ...autofillFieldDefaultProps
124170
124193
  },
124171
124194
  computed: {
124195
+ onlyMainModelCanDefault: true,
124172
124196
  defaultValueRule: {
124173
124197
  type: "api",
124174
- fetcher: "ref",
124175
- onlyMainModelFieldsCanRequest: true
124198
+ fetcher: "ref"
124176
124199
  },
124177
124200
  onValueChangeRule: labelOnValueChangeRule
124178
124201
  }
@@ -124218,10 +124241,11 @@ const manifest$f = {
124218
124241
  }
124219
124242
  },
124220
124243
  computed: {
124244
+ onlyMainModelCanDefault: true,
124245
+ skipDefaultWhenBelongingObject: true,
124221
124246
  defaultValueRule: {
124222
124247
  type: "api",
124223
- fetcher: "rdo2ref",
124224
- onlyMainModelFieldsCanRequest: true
124248
+ fetcher: "rdo2ref"
124225
124249
  },
124226
124250
  onValueChangeRule: labelOnValueChangeRule
124227
124251
  }
@@ -124251,10 +124275,10 @@ const manifest$e = {
124251
124275
  }
124252
124276
  },
124253
124277
  computed: {
124278
+ onlyMainModelCanDefault: true,
124254
124279
  defaultValueRule: {
124255
124280
  type: "api",
124256
- fetcher: "ref",
124257
- onlyMainModelFieldsCanRequest: true
124281
+ fetcher: "ref"
124258
124282
  },
124259
124283
  onValueChangeRule: labelOnValueChangeRule
124260
124284
  }
@@ -124284,10 +124308,10 @@ const manifest$d = {
124284
124308
  }
124285
124309
  },
124286
124310
  computed: {
124311
+ onlyMainModelCanDefault: true,
124287
124312
  defaultValueRule: {
124288
124313
  type: "api",
124289
- fetcher: "ref",
124290
- onlyMainModelFieldsCanRequest: true
124314
+ fetcher: "ref"
124291
124315
  },
124292
124316
  onValueChangeRule: labelOnValueChangeRule
124293
124317
  }
@@ -124328,6 +124352,7 @@ const manifest$b = {
124328
124352
  ...commonDefaultProps
124329
124353
  },
124330
124354
  computed: {
124355
+ onlyMainModelCanDefault: true,
124331
124356
  onValueChangeRule: [...hyperlinkAndIdOnValueChangeRules]
124332
124357
  }
124333
124358
  };
@@ -124356,10 +124381,10 @@ const manifest$a = {
124356
124381
  }
124357
124382
  },
124358
124383
  computed: {
124384
+ onlyMainModelCanDefault: true,
124359
124385
  defaultValueRule: {
124360
124386
  type: "api",
124361
- fetcher: "ref",
124362
- onlyMainModelFieldsCanRequest: true
124387
+ fetcher: "ref"
124363
124388
  },
124364
124389
  onValueChangeRule: labelOnValueChangeRule
124365
124390
  }
@@ -124382,7 +124407,8 @@ const manifest$9 = {
124382
124407
  ...commonDefaultProps
124383
124408
  },
124384
124409
  computed: {
124385
- onValueChangeRule: idOnValueChangeRule
124410
+ onlyMainModelCanDefault: true,
124411
+ onValueChangeRule: [...hyperlinkAndIdOnValueChangeRules]
124386
124412
  }
124387
124413
  };
124388
124414
  const __vite_glob_0_63 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
@@ -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
- allowSubModelRequest?: boolean;
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>): Record<string, any> | undefined;
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_ 版本
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gct-paas/word",
3
- "version": "0.1.63-beta.4",
3
+ "version": "0.1.63-beta.6",
4
4
  "description": "GCT 在线 word",
5
5
  "keywords": [
6
6
  "vue",