@gct-paas/word 0.1.74-beta.10 → 0.1.74-beta.11
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.
|
@@ -46,8 +46,15 @@ export declare class LinkageEngine {
|
|
|
46
46
|
* 1.当前行同名字段 → 2.context 隐式字段 → 3.主表映射字段 → 4.主表顶层同名字段(配置允许时)
|
|
47
47
|
*/
|
|
48
48
|
private resolveLinkFieldValue;
|
|
49
|
-
/**
|
|
50
|
-
|
|
49
|
+
/**
|
|
50
|
+
* 解析实际生效的上游字段:
|
|
51
|
+
* 1. 首选 linkFieldKey(requireLinkWidget=false 或不要求控件 / 控件已拖入)
|
|
52
|
+
* 2. 否则若配置了 fallbackLinkFieldKey,且回退上游可用 → 用回退上游
|
|
53
|
+
* 3. 都不可用 → null(不启用联动)
|
|
54
|
+
*/
|
|
55
|
+
private resolveActiveLinkFieldKey;
|
|
56
|
+
/** 判断某个上游字段当前是否可作为联动来源 */
|
|
57
|
+
private isLinkFieldAvailable;
|
|
51
58
|
/**
|
|
52
59
|
* 级联变更需清空的字段:
|
|
53
60
|
* - 显式配置了 clearOnLinkChange(含空数组)→ 使用配置值
|
|
@@ -374,6 +374,11 @@ export interface LinkQueryContext extends RuleContext {
|
|
|
374
374
|
export interface SelectBehaviorDef {
|
|
375
375
|
/** 上游字段 key 可与本字段同处一行 也可在子表外但需配合 implicitFields */
|
|
376
376
|
linkFieldKey: string;
|
|
377
|
+
/**
|
|
378
|
+
* 首选上游控件未拖入时的回退上游字段。
|
|
379
|
+
* 例:库位优先按库区联动;未拖库区时回退按仓库联动。
|
|
380
|
+
*/
|
|
381
|
+
fallbackLinkFieldKey?: string;
|
|
377
382
|
/**
|
|
378
383
|
* 是否要求上游字段拖入子表表单才启用联动
|
|
379
384
|
*
|
|
@@ -385,6 +390,7 @@ export interface SelectBehaviorDef {
|
|
|
385
390
|
* | `false` | 不要求拖上游控件;行内无值时回退读主表 `$.{linkFieldKey}`,进行联动
|
|
386
391
|
*
|
|
387
392
|
* 与 `implicitFields` 配合:主表上游建议同时写 implicitFields(主表变更时刷新所有行 + 清空下游)。
|
|
393
|
+
* 若配置了 `fallbackLinkFieldKey`:首选上游未拖入时,对回退上游同样按本开关判断。
|
|
388
394
|
*/
|
|
389
395
|
requireLinkWidget?: boolean;
|
|
390
396
|
/** 构建下拉查询参数 */
|
package/dist/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @gct-paas/word v0.1.74-beta.
|
|
1
|
+
/*! @gct-paas/word v0.1.74-beta.11 */
|
|
2
2
|
import { Fragment, Suspense, Teleport, Transition, TransitionGroup, cloneVNode, computed, createApp, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createStaticVNode, createTextVNode, createVNode, defineAsyncComponent, defineComponent, getCurrentInstance, getCurrentScope, guardReactiveProps, h, inject, isRef, isVNode, markRaw, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onBeforeMount, onBeforeUnmount, onMounted, onScopeDispose, onUnmounted, openBlock, provide, reactive, readonly, ref, render, renderList, renderSlot, resolveComponent, resolveDynamicComponent, shallowRef, toDisplayString, toRaw, toRef, toValue, unref, useCssVars, useModel, useSlots, vModelText, vShow, watch, watchEffect, withCtx, withDirectives, withKeys, withModifiers } from "vue";
|
|
3
3
|
import FloatingVue, { PopperWrapper } from "floating-vue";
|
|
4
4
|
import VueKonva from "vue-konva";
|
|
@@ -97564,8 +97564,14 @@ var init_fields$11 = __esmMin((() => {
|
|
|
97564
97564
|
match: { fieldKey: F$11.location },
|
|
97565
97565
|
select: {
|
|
97566
97566
|
linkFieldKey: F$11.storageZone,
|
|
97567
|
+
fallbackLinkFieldKey: F$11.warehouse,
|
|
97567
97568
|
requireLinkWidget: true,
|
|
97568
|
-
buildLinkQuery: ({ linkValue }) =>
|
|
97569
|
+
buildLinkQuery: ({ linkFieldKey, linkValue }) => {
|
|
97570
|
+
if (!linkValue) return {};
|
|
97571
|
+
if (linkFieldKey === F$11.storageZone) return { "storage_zone_id_.eq": linkValue };
|
|
97572
|
+
if (linkFieldKey === F$11.warehouse) return { "warehouse_id_.eq": linkValue };
|
|
97573
|
+
return {};
|
|
97574
|
+
}
|
|
97569
97575
|
}
|
|
97570
97576
|
}
|
|
97571
97577
|
];
|
|
@@ -99043,8 +99049,9 @@ var init_linkage_engine = __esmMin((() => {
|
|
|
99043
99049
|
const updates = {};
|
|
99044
99050
|
for (const fieldProfile of ctx.profile.fields ?? []) {
|
|
99045
99051
|
const select = fieldProfile.select;
|
|
99046
|
-
if (!select
|
|
99047
|
-
|
|
99052
|
+
if (!select) continue;
|
|
99053
|
+
const activeLinkFieldKey = this.resolveActiveLinkFieldKey(ctx, select);
|
|
99054
|
+
if (!activeLinkFieldKey || activeLinkFieldKey !== changedFieldKey) continue;
|
|
99048
99055
|
const fieldKey = resolveFieldKeyFromMatch(fieldProfile);
|
|
99049
99056
|
if (!fieldKey) continue;
|
|
99050
99057
|
Object.assign(updates, buildClearUpdates(ruleCtx.rowPath, this.getDownstreamClearFieldKeys(select, fieldKey), { clearValue: void 0 }));
|
|
@@ -99058,18 +99065,18 @@ var init_linkage_engine = __esmMin((() => {
|
|
|
99058
99065
|
var _ctx$findFieldProfile;
|
|
99059
99066
|
const select = (_ctx$findFieldProfile = ctx.findFieldProfile(fieldKey)) === null || _ctx$findFieldProfile === void 0 ? void 0 : _ctx$findFieldProfile.select;
|
|
99060
99067
|
if (!select) return null;
|
|
99061
|
-
|
|
99068
|
+
const activeLinkFieldKey = this.resolveActiveLinkFieldKey(ctx, select);
|
|
99069
|
+
if (!activeLinkFieldKey) return {
|
|
99062
99070
|
enabled: false,
|
|
99063
99071
|
linkFieldKey: select.linkFieldKey
|
|
99064
99072
|
};
|
|
99065
99073
|
const parsed = runtimeValuePath ? parseSubtableFieldPath(runtimeValuePath) : null;
|
|
99066
99074
|
const rowIndex = (parsed === null || parsed === void 0 ? void 0 : parsed.rowIndex) ?? 0;
|
|
99067
99075
|
const ruleCtx = ctx.buildRuleContext(rowIndex);
|
|
99068
|
-
const linkValue = this.resolveLinkFieldValue(ctx, ruleCtx, select.linkFieldKey, select);
|
|
99069
99076
|
return {
|
|
99070
99077
|
enabled: true,
|
|
99071
|
-
linkFieldKey:
|
|
99072
|
-
linkValue,
|
|
99078
|
+
linkFieldKey: activeLinkFieldKey,
|
|
99079
|
+
linkValue: this.resolveLinkFieldValue(ctx, ruleCtx, activeLinkFieldKey, select),
|
|
99073
99080
|
requireLinkValue: select.requireLinkValue
|
|
99074
99081
|
};
|
|
99075
99082
|
}
|
|
@@ -99103,14 +99110,15 @@ var init_linkage_engine = __esmMin((() => {
|
|
|
99103
99110
|
const fieldKey = resolveFieldKeyFromMatch(fieldProfile);
|
|
99104
99111
|
const select = fieldProfile.select;
|
|
99105
99112
|
if (!fieldKey || !select) return;
|
|
99106
|
-
if (!this.shouldEnableSelectLinkage(ctx, select)) return;
|
|
99107
99113
|
if (!select.buildLinkQuery) return;
|
|
99108
|
-
const
|
|
99114
|
+
const activeLinkFieldKey = this.resolveActiveLinkFieldKey(ctx, select);
|
|
99115
|
+
if (!activeLinkFieldKey) return;
|
|
99116
|
+
const linkValue = this.resolveLinkFieldValue(ctx, ruleCtx, activeLinkFieldKey, select);
|
|
99109
99117
|
const fieldValuePath = `${ruleCtx.rowPath}.${fieldKey}`;
|
|
99110
99118
|
const linkCtx = {
|
|
99111
99119
|
...ruleCtx,
|
|
99112
99120
|
fieldKey,
|
|
99113
|
-
linkFieldKey:
|
|
99121
|
+
linkFieldKey: activeLinkFieldKey,
|
|
99114
99122
|
linkValue
|
|
99115
99123
|
};
|
|
99116
99124
|
const queryParams = select.buildLinkQuery(linkCtx);
|
|
@@ -99140,10 +99148,21 @@ var init_linkage_engine = __esmMin((() => {
|
|
|
99140
99148
|
}
|
|
99141
99149
|
return rowValue;
|
|
99142
99150
|
}
|
|
99143
|
-
/**
|
|
99144
|
-
|
|
99151
|
+
/**
|
|
99152
|
+
* 解析实际生效的上游字段:
|
|
99153
|
+
* 1. 首选 linkFieldKey(requireLinkWidget=false 或不要求控件 / 控件已拖入)
|
|
99154
|
+
* 2. 否则若配置了 fallbackLinkFieldKey,且回退上游可用 → 用回退上游
|
|
99155
|
+
* 3. 都不可用 → null(不启用联动)
|
|
99156
|
+
*/
|
|
99157
|
+
resolveActiveLinkFieldKey(ctx, select) {
|
|
99158
|
+
if (this.isLinkFieldAvailable(ctx, select.linkFieldKey, select)) return select.linkFieldKey;
|
|
99159
|
+
if (select.fallbackLinkFieldKey && this.isLinkFieldAvailable(ctx, select.fallbackLinkFieldKey, select)) return select.fallbackLinkFieldKey;
|
|
99160
|
+
return null;
|
|
99161
|
+
}
|
|
99162
|
+
/** 判断某个上游字段当前是否可作为联动来源 */
|
|
99163
|
+
isLinkFieldAvailable(ctx, linkFieldKey, select) {
|
|
99145
99164
|
if (select.requireLinkWidget === false) return true;
|
|
99146
|
-
return ctx.hasFieldWidget(
|
|
99165
|
+
return ctx.hasFieldWidget(linkFieldKey);
|
|
99147
99166
|
}
|
|
99148
99167
|
/**
|
|
99149
99168
|
* 级联变更需清空的字段:
|