openyida 2026.11.12 → 2026.11.15-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/lib/app/create-form.js +22 -0
- package/lib/core/locales/en.js +8 -0
- package/lib/core/locales/zh.js +8 -0
- package/lib/integration/integration-api.js +29 -0
- package/lib/integration/integration-create.js +3 -0
- package/lib/integration/integration-update.js +2 -0
- package/lib/process/configure-process.js +2 -0
- package/lib/process/services/process-service.js +110 -0
- package/package.json +1 -1
- package/yida-skills/skills/yida-create-form-page/references/serial-number-field.md +2 -0
- package/yida-skills/skills/yida-flow-node-config/SKILL.md +1 -1
- package/yida-skills/skills/yida-flow-node-config/references/control.md +9 -14
- package/yida-skills/skills/yida-integration/SKILL.md +5 -2
- package/yida-skills/skills/yida-integration/references/cli-options.md +1 -1
- package/yida-skills/skills/yida-plugin-frontend-deploy/SKILL.md +2 -1
- package/yida-skills/skills/yida-plugin-frontend-deploy/references/form-component-development.md +222 -0
- package/yida-skills/skills/yida-plugin-frontend-deploy/references/frontend-contract.md +11 -3
- package/yida-skills/skills/yida-plugin-frontend-deploy/references/frontend-hosting.md +5 -0
- package/yida-skills/skills/yida-plugin-lifecycle/SKILL.md +4 -0
package/lib/app/create-form.js
CHANGED
|
@@ -2888,6 +2888,7 @@ function applySchemaPatchOperations(schema, operations) {
|
|
|
2888
2888
|
}
|
|
2889
2889
|
found.field.props = found.field.props || {};
|
|
2890
2890
|
deepMerge(found.field.props, operation.props || {});
|
|
2891
|
+
removeSerialNumberRequiredValidation(found.field);
|
|
2891
2892
|
applied.push({
|
|
2892
2893
|
action: 'field-props',
|
|
2893
2894
|
field: fieldKey,
|
|
@@ -4275,6 +4276,20 @@ function cleanupLegacySmartValidationArtifacts(schema, root, formContainer) {
|
|
|
4275
4276
|
return cleanup;
|
|
4276
4277
|
}
|
|
4277
4278
|
|
|
4279
|
+
function isRequiredValidationRule(rule) {
|
|
4280
|
+
const type = normalizeValidationType(typeof rule === 'string' ? rule
|
|
4281
|
+
: rule && (rule.type || rule.validator || rule.kind));
|
|
4282
|
+
return type === 'required' || type === 'conditionalRequired';
|
|
4283
|
+
}
|
|
4284
|
+
|
|
4285
|
+
function removeSerialNumberRequiredValidation(component) {
|
|
4286
|
+
if (component.componentName !== 'SerialNumberField' || !component.props) { return; }
|
|
4287
|
+
// Serial numbers are assigned on submission, so frontend input is optional.
|
|
4288
|
+
const rules = Array.isArray(component.props.validation) ? component.props.validation : [];
|
|
4289
|
+
component.props.validation = rules.filter(rule => !isRequiredValidationRule(rule));
|
|
4290
|
+
delete component.props.required;
|
|
4291
|
+
}
|
|
4292
|
+
|
|
4278
4293
|
function applySmartValidations(schema, rawRules) {
|
|
4279
4294
|
if (!schema.pages || !Array.isArray(schema.pages) || schema.pages.length === 0) {
|
|
4280
4295
|
throw new Error('Schema 为空,无法配置智能校验');
|
|
@@ -4299,6 +4314,11 @@ function applySmartValidations(schema, rawRules) {
|
|
|
4299
4314
|
return;
|
|
4300
4315
|
}
|
|
4301
4316
|
found.field.props = found.field.props || {};
|
|
4317
|
+
removeSerialNumberRequiredValidation(found.field);
|
|
4318
|
+
if (found.field.componentName === 'SerialNumberField' && isRequiredValidationRule(rule)) {
|
|
4319
|
+
skippedRules.push(rule);
|
|
4320
|
+
return;
|
|
4321
|
+
}
|
|
4302
4322
|
resetGeneratedTextFieldValidationType(found.field);
|
|
4303
4323
|
const existingValidation = cleanupLegacyGeneratedValidationRules(found.field.props.validation, designerRule);
|
|
4304
4324
|
found.field.props.validation = dedupeValidationRules(existingValidation.concat([designerRule]));
|
|
@@ -4332,6 +4352,7 @@ function collectSmartValidationRulesFromFields(fields, schema) {
|
|
|
4332
4352
|
const reference = matches.length === 1 && matches[0].componentName === identity.componentName
|
|
4333
4353
|
? matches[0].fieldId : field.label;
|
|
4334
4354
|
collectInputValidationRules(field, { includeAdvanced: true }).forEach(function (rule) {
|
|
4355
|
+
if (identity.componentName === 'SerialNumberField' && isRequiredValidationRule(rule)) { return; }
|
|
4335
4356
|
if (rule.type === 'required' && !field.required && !field.validation && !field.validations) {
|
|
4336
4357
|
return;
|
|
4337
4358
|
}
|
|
@@ -4487,6 +4508,7 @@ function applyFieldChanges(component, changes) {
|
|
|
4487
4508
|
}
|
|
4488
4509
|
});
|
|
4489
4510
|
applyFieldFormula(props, changes, component.componentName);
|
|
4511
|
+
removeSerialNumberRequiredValidation(component);
|
|
4490
4512
|
}
|
|
4491
4513
|
|
|
4492
4514
|
function ensureComponentsMap(schema, componentName) {
|
package/lib/core/locales/en.js
CHANGED
|
@@ -4,6 +4,14 @@
|
|
|
4
4
|
'use strict';
|
|
5
5
|
|
|
6
6
|
module.exports = {
|
|
7
|
+
workflow_cycle: {
|
|
8
|
+
invalid: 'The loop definition is incomplete or exceeds the limit of one loop and five counted nodes per automation.',
|
|
9
|
+
node_unavailable: 'OpenYida does not support {0} inside this loop. Move it outside the loop or check available nodes in the YiDA designer.',
|
|
10
|
+
unavailable: 'Loop containers are unavailable in this YiDA scenario. Check availability in the target app designer.',
|
|
11
|
+
unverified: 'Could not verify loop access or node configuration for this organization. Check the signed-in organization and try again.',
|
|
12
|
+
entitlement_required: 'This organization lacks access to loop containers. Ask an organization administrator to review plans and upgrade on the official YiDA site: {0}',
|
|
13
|
+
published_unverified: 'Could not verify the published automation. Check its publication status in the YiDA designer and try again.',
|
|
14
|
+
},
|
|
7
15
|
issue_fixes: {
|
|
8
16
|
invalid_api_key: 'API Key configuration requires a valid name and header/query location; inspect the connector definition first.',
|
|
9
17
|
repair_required: 'Legacy API Key configuration lacks type/in/location. Add --repair-api-key-scheme to explicitly repair the connector and create a new account.',
|
package/lib/core/locales/zh.js
CHANGED
|
@@ -4,6 +4,14 @@
|
|
|
4
4
|
'use strict';
|
|
5
5
|
|
|
6
6
|
module.exports = {
|
|
7
|
+
workflow_cycle: {
|
|
8
|
+
invalid: '循环配置不完整或超出限制。每条自动化可配置一个循环,循环体最多包含五个计数节点。',
|
|
9
|
+
node_unavailable: 'OpenYida 在此循环场景不支持节点 {0}。请将它移到循环外,或在宜搭设计器查看适用的节点。',
|
|
10
|
+
unavailable: '当前宜搭场景未开放循环容器。请在目标应用的设计器确认可用能力。',
|
|
11
|
+
unverified: '无法确认当前组织的循环权益或节点配置。请核对登录组织后重试。',
|
|
12
|
+
entitlement_required: '当前组织缺少循环容器权益。请联系组织管理员到宜搭官方页面查看适用版本并升级:{0}',
|
|
13
|
+
published_unverified: '无法确认自动化的已发布定义。请在宜搭设计器检查发布状态后重试。',
|
|
14
|
+
},
|
|
7
15
|
issue_fixes: {
|
|
8
16
|
invalid_api_key: 'API Key 配置必须包含有效的 name 和 header/query 位置;请先检查连接器定义。',
|
|
9
17
|
repair_required: '旧 API Key 配置缺少 type/in/location;确认后加 --repair-api-key-scheme 修补连接器并创建新账号。',
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
const { createYidaClient } = require('../core/yida-client');
|
|
4
4
|
const { t } = require('../core/i18n');
|
|
5
|
+
const { CliError } = require('../core/cli-error');
|
|
6
|
+
const { assertAutomationCycle, queryProcessVersions, getProcessById } = require('../process/services/process-service');
|
|
7
|
+
const { extractPlatformView } = require('../process/services/process-view-verifier');
|
|
5
8
|
|
|
6
9
|
/**
|
|
7
10
|
* integration-api.js - 集成&自动化相关宜搭 API 调用封装
|
|
@@ -349,6 +352,27 @@ async function listLogicflowDetailLogs(authRef, params) {
|
|
|
349
352
|
return content;
|
|
350
353
|
}
|
|
351
354
|
|
|
355
|
+
/** Read the published version that enabling a flow will activate. */
|
|
356
|
+
async function readPublishedAutomationView(authRef, target) {
|
|
357
|
+
try {
|
|
358
|
+
const result = await queryProcessVersions(authRef, target.appType, target.processCode, 'PUBLISHED', { pageSize: 1 });
|
|
359
|
+
const content = typeof result?.content === 'string' ? JSON.parse(result.content) : result?.content;
|
|
360
|
+
const version = content?.data?.[0];
|
|
361
|
+
const processId = version?.processId ?? version?.id;
|
|
362
|
+
if (result?.success !== true || !processId || (version.version ?? '') === '') {
|
|
363
|
+
throw new Error('published version missing');
|
|
364
|
+
}
|
|
365
|
+
const response = await getProcessById(authRef, { ...target, processId, processVersion: version.version });
|
|
366
|
+
const view = extractPlatformView(response);
|
|
367
|
+
if (view.schema.children.length === 0) { throw new Error('published definition missing'); }
|
|
368
|
+
return view;
|
|
369
|
+
} catch {
|
|
370
|
+
throw new CliError(t('workflow_cycle.published_unverified'), {
|
|
371
|
+
code: 'WORKFLOW_CYCLE_PUBLISHED_UNVERIFIED', details: { remoteWrites: 0 },
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
|
|
352
376
|
/**
|
|
353
377
|
* 开启或关闭逻辑流(自动化)
|
|
354
378
|
* 接口地址:POST /alibaba/web/{appType}/query/formLogicflowBinding/switchflow.json
|
|
@@ -358,6 +382,11 @@ async function switchLogicflow(authRef, params) {
|
|
|
358
382
|
const flow = await require('./integration-manage').binding(authRef, appType, formUuid, processCode);
|
|
359
383
|
const type = String(flow.eventType || flow.flowType || flow.type || '');
|
|
360
384
|
if (!['1', '2', '3', '5', '6'].includes(type)) { throw new Error('Unknown automation binding type'); }
|
|
385
|
+
if (enable) {
|
|
386
|
+
const target = { appType, formUuid, processCode };
|
|
387
|
+
const viewJson = await readPublishedAutomationView(authRef, target);
|
|
388
|
+
await assertAutomationCycle(authRef, { ...target, viewJson });
|
|
389
|
+
}
|
|
361
390
|
const response = await createYidaClient({ authRef }).postForm(
|
|
362
391
|
(function buildPath() {
|
|
363
392
|
const stamp = Date.now();
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
const { loadAuthData, triggerLogin, resolveBaseUrl } = require('../core/utils');
|
|
4
4
|
const { generateNodeId } = require('./integration-node-ids');
|
|
5
5
|
const { getFormSchema, createLogicflow, saveProcess } = require('./integration-api');
|
|
6
|
+
const { assertAutomationCycle } = require('../process/services/process-service');
|
|
6
7
|
const {
|
|
7
8
|
mapEventTypes,
|
|
8
9
|
buildProcessJson,
|
|
@@ -1163,6 +1164,8 @@ async function run(args) {
|
|
|
1163
1164
|
require('./integration-triggers').validateTriggerSpec(integrationSpec, triggerFields);
|
|
1164
1165
|
}
|
|
1165
1166
|
|
|
1167
|
+
await assertAutomationCycle(authRef, { appType, processCode, processJson, viewJson });
|
|
1168
|
+
|
|
1166
1169
|
// 所有参数、目标资源、Schema 与双 JSON 均已成功预检,至此才允许首个远端写入。
|
|
1167
1170
|
if (!processCodeInput) {
|
|
1168
1171
|
step(t('integration.create_step_new_flow'));
|
|
@@ -4,6 +4,7 @@ const fs = require('fs');
|
|
|
4
4
|
const path = require('path');
|
|
5
5
|
const { createAuthRef } = require('../core/yida-client');
|
|
6
6
|
const { saveProcess } = require('./integration-api');
|
|
7
|
+
const { assertAutomationCycle } = require('../process/services/process-service');
|
|
7
8
|
const baseline = require('./integration-baseline');
|
|
8
9
|
const { parse } = require('./integration-manage');
|
|
9
10
|
const { t } = require('../core/i18n');
|
|
@@ -84,6 +85,7 @@ async function run(args) {
|
|
|
84
85
|
}
|
|
85
86
|
// Existing active flows must first be disabled: update cannot accidentally activate a draft.
|
|
86
87
|
if (state.binding.status !== 'n') { baseline.fail('disable the flow before applying a patch'); }
|
|
88
|
+
await assertAutomationCycle(auth, { ...target, processJson: next.processJson, viewJson: next.viewJson });
|
|
87
89
|
const journal = path.join(path.dirname(baseline.location(auth, target)),
|
|
88
90
|
'journal-' + Date.now() + '-' + processCode.replace(/[^a-zA-Z0-9_-]/g, '_') + '.json');
|
|
89
91
|
baseline.writePrivate(journal, { target, before: record, after: next, state: 'prepared' }, true);
|
|
@@ -23,6 +23,7 @@ const { hasFieldReferences, resolveProcessFieldReferences } = require('./service
|
|
|
23
23
|
const { collectFormMemberIds, assertFormMemberFields } = require('./services/process-dynamic-actors');
|
|
24
24
|
const { completeSubtablePermissions } = require('./services/process-field-permissions');
|
|
25
25
|
const {
|
|
26
|
+
assertApprovalCycleSupported,
|
|
26
27
|
getProcessById,
|
|
27
28
|
getProcessCodeFromAppParam,
|
|
28
29
|
getProcessCodeFromSchema,
|
|
@@ -385,6 +386,7 @@ async function run(args, options) {
|
|
|
385
386
|
}
|
|
386
387
|
);
|
|
387
388
|
}
|
|
389
|
+
assertApprovalCycleSupported(compiled.viewJson, compiled.processJson);
|
|
388
390
|
stageTracker.complete('build_definition');
|
|
389
391
|
|
|
390
392
|
try {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const { createYidaClient } = require('../../core/yida-client');
|
|
4
|
+
const { CliError } = require('../../core/cli-error');
|
|
5
|
+
const { t } = require('../../core/i18n');
|
|
4
6
|
const {
|
|
5
7
|
getProcessCodeFromAppParam,
|
|
6
8
|
switchFormType,
|
|
@@ -110,7 +112,115 @@ function getProcessById(authRef, input, options = {}) {
|
|
|
110
112
|
}));
|
|
111
113
|
}
|
|
112
114
|
|
|
115
|
+
const PRICING_URL = 'https://www.aliwork.com/pricing';
|
|
116
|
+
// Require known node contracts in addition to the target application's designer allowlist.
|
|
117
|
+
const CYCLE_NODE_TYPES = new Map([
|
|
118
|
+
['CycleContainer', 'foreach'],
|
|
119
|
+
['ConditionContainer', 'route'],
|
|
120
|
+
['ConditionNode', 'condition'],
|
|
121
|
+
['ParallelNode', 'condition'],
|
|
122
|
+
['SendMessageNode', 'sendMessage'],
|
|
123
|
+
['SendEmailNode', 'sendEmail'],
|
|
124
|
+
['InitiateApprovalNode', 'initiateApproval'],
|
|
125
|
+
]);
|
|
126
|
+
|
|
127
|
+
function failCycle(reason, nodeType) {
|
|
128
|
+
const upgradeUrl = reason === 'entitlement_required' ? PRICING_URL : undefined;
|
|
129
|
+
throw new CliError(t('workflow_cycle.' + reason, nodeType || upgradeUrl), {
|
|
130
|
+
code: 'WORKFLOW_CYCLE_' + reason.toUpperCase(),
|
|
131
|
+
details: { ...(nodeType && { nodeType }), ...(upgradeUrl && { upgradeUrl }), remoteWrites: 0 },
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function findCycles(nodes = [], typeKey, childKey, cycleType) {
|
|
136
|
+
return nodes.flatMap(node => [
|
|
137
|
+
...(node[typeKey] === cycleType ? [node] : []),
|
|
138
|
+
...findCycles(node[childKey], typeKey, childKey, cycleType),
|
|
139
|
+
]);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/** Validate the canvas and, when writing a definition, its corresponding runtime loop. */
|
|
143
|
+
function inspectCycle(viewJson, processJson) {
|
|
144
|
+
const view = findCycles(viewJson?.schema?.children, 'componentName', 'children', 'CycleContainer');
|
|
145
|
+
const runtime = processJson && findCycles(processJson.nodes, 'type', 'childNodes', 'foreach');
|
|
146
|
+
if (view.length > 1 || runtime && (runtime.length !== view.length || runtime[0]?.nodeId !== view[0]?.id)) {
|
|
147
|
+
failCycle('invalid');
|
|
148
|
+
}
|
|
149
|
+
return { view: view[0], runtime: runtime?.[0] };
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function inspectNodes(nodes, nodeTypes, count, runtimeNodes) {
|
|
153
|
+
if (!Array.isArray(nodes) || runtimeNodes && (!Array.isArray(runtimeNodes) || runtimeNodes.length !== nodes.length)) {
|
|
154
|
+
failCycle('invalid');
|
|
155
|
+
}
|
|
156
|
+
for (const [index, node] of nodes.entries()) {
|
|
157
|
+
const component = node.componentName;
|
|
158
|
+
if (!CYCLE_NODE_TYPES.has(component) || component === 'CycleContainer') { failCycle('node_unavailable', component); }
|
|
159
|
+
if (runtimeNodes && (runtimeNodes[index]?.nodeId !== node.id
|
|
160
|
+
|| runtimeNodes[index]?.type !== CYCLE_NODE_TYPES.get(component))) { failCycle('invalid'); }
|
|
161
|
+
if (component !== 'ConditionContainer') { nodeTypes.add(component); }
|
|
162
|
+
if (component !== 'ConditionNode' && component !== 'ParallelNode') { count += 1; }
|
|
163
|
+
if (node.children?.length || runtimeNodes?.[index]?.childNodes?.length) {
|
|
164
|
+
count = inspectNodes(node.children || [], nodeTypes, count, runtimeNodes && (runtimeNodes[index].childNodes || []));
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return count;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
async function readContent(client, path, query) {
|
|
171
|
+
try {
|
|
172
|
+
const response = await client.getOnce(path, query, { silentStatus: true });
|
|
173
|
+
if (response?.success !== true) { return undefined; }
|
|
174
|
+
return typeof response.content === 'string' ? JSON.parse(response.content) : response.content;
|
|
175
|
+
} catch {
|
|
176
|
+
failCycle('unverified');
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/** Check the target organization's current platform settings before an automation write. */
|
|
181
|
+
async function assertAutomationCycle(authRef, { appType, processCode, viewJson, processJson }) {
|
|
182
|
+
const { view, runtime } = inspectCycle(viewJson, processJson);
|
|
183
|
+
if (!view) { return; }
|
|
184
|
+
const nodeTypes = new Set();
|
|
185
|
+
const count = inspectNodes(view.children, nodeTypes, 0, runtime && (runtime.childNodes || []));
|
|
186
|
+
if (count < 1 || count > 5 || !view.props?.cycleContainerRules?.sourceId) { failCycle('invalid'); }
|
|
187
|
+
|
|
188
|
+
const client = createYidaClient({ authRef });
|
|
189
|
+
const [assets, auth, rollout] = await Promise.all([
|
|
190
|
+
readContent(client, `/alibaba/web/${appType}/query/simpleProcess/getConfig.json`, {
|
|
191
|
+
isLogic: 'true', ...(processCode && { processCode }),
|
|
192
|
+
}),
|
|
193
|
+
readContent(client, '/query/auth/list.json', { type: 'WORKFLOW' }),
|
|
194
|
+
readContent(client, '/query/compromiseDing/orgInGray.json', { grayKey: 'V20221215_foreach_service' }),
|
|
195
|
+
]);
|
|
196
|
+
if (!Array.isArray(assets?.componentsList) || !Array.isArray(auth?.feature) || typeof rollout !== 'boolean') {
|
|
197
|
+
failCycle('unverified');
|
|
198
|
+
}
|
|
199
|
+
const available = new Map(assets.componentsList.map(item => [item?.componentName, item]));
|
|
200
|
+
const cycle = available.get('CycleContainer');
|
|
201
|
+
if (!cycle) { failCycle('unavailable'); }
|
|
202
|
+
if (!Array.isArray(assets.cycleValidComponents)) { failCycle('unverified'); }
|
|
203
|
+
for (const component of nodeTypes) {
|
|
204
|
+
if (!available.has(component) || !assets.cycleValidComponents.includes(component)) {
|
|
205
|
+
failCycle('node_unavailable', component);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
const requiresAdvanced = cycle.isAdvance === true
|
|
209
|
+
|| [...nodeTypes].some(component => available.get(component).isAdvance === true);
|
|
210
|
+
if (!auth.feature.includes('LOOP_NODE') || (requiresAdvanced && !auth.feature.includes('ADVANCE_PROC'))) {
|
|
211
|
+
failCycle('entitlement_required');
|
|
212
|
+
}
|
|
213
|
+
if (!rollout) { failCycle('unavailable'); }
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/** Approval form authoring has no loop container in the supported designer scenario. */
|
|
217
|
+
function assertApprovalCycleSupported(viewJson, processJson) {
|
|
218
|
+
if (inspectCycle(viewJson, processJson).view) { failCycle('unavailable'); }
|
|
219
|
+
}
|
|
220
|
+
|
|
113
221
|
module.exports = {
|
|
222
|
+
assertApprovalCycleSupported,
|
|
223
|
+
assertAutomationCycle,
|
|
114
224
|
getProcessById,
|
|
115
225
|
getProcessCodeFromAppParam,
|
|
116
226
|
getProcessCodeFromSchema,
|
package/package.json
CHANGED
|
@@ -32,7 +32,7 @@ description: 配置流程和自动化里的处理步骤,包括审批、办理
|
|
|
32
32
|
|
|
33
33
|
配置人工节点的处理人和字段权限时,只读人工处理、人员选择、字段权限。需要加签或外部动作时,再加载对应说明。
|
|
34
34
|
|
|
35
|
-
复杂配置直接从对应完整示例改起:[审批/办理/抄送条件选人](references/actors.md#审批办理抄送的完整配置)、[多规则同时选人](references/actors.md#多条条件同时命中时收集人员)、[自动化并行](references/control.md#自动化并行示例)、[
|
|
35
|
+
复杂配置直接从对应完整示例改起:[审批/办理/抄送条件选人](references/actors.md#审批办理抄送的完整配置)、[多规则同时选人](references/actors.md#多条条件同时命中时收集人员)、[自动化并行](references/control.md#自动化并行示例)、[循环逐条通知](references/control.md#循环逐条通知示例)、[取数时字段比较](references/conditions-variables.md)。只替换查询到的真实 ID、字段类型和业务值,按示例的预期结果验收。
|
|
36
36
|
|
|
37
37
|
## 分清配置能力
|
|
38
38
|
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
| --- | --- | --- |
|
|
11
11
|
| 条件分支 | 可直接生成:`route.conditions[]`,分支内用 `rules/childNodes` | 可直接生成:`route.branches[]`,分支内用 `conditions/nodes` |
|
|
12
12
|
| 并行分支 | 可直接生成:`parallel.branches[]`,分支内用 `rules/childNodes` | 可直接生成:`parallel.branches[]`,分支内用 `conditions/nodes` |
|
|
13
|
-
| 循环容器 |
|
|
13
|
+
| 循环容器 | 审批流程使用宜搭设计器查看可用节点 | 支持单层循环 `cycle.source/nodes` |
|
|
14
14
|
| 拒绝后跳转 | 人工节点的 `routeRules` | 不适用,不是自动化分支 |
|
|
15
15
|
|
|
16
16
|
比较规则和变量来源只读 [条件与变量](conditions-variables.md)。流程分支按数组顺序生成优先级;自动化指定至多一个 `default: true` 兜底分支。不要手写底层连线或 `conditionNode`。
|
|
@@ -190,11 +190,11 @@
|
|
|
190
190
|
|
|
191
191
|
有条件的分支使用 `conditions`;`default:true` 是没有条件命中时的兜底,最多一条。每次都执行的分支用上例的 `all:true`。并行中避免多个分支同时覆盖同一业务字段。
|
|
192
192
|
|
|
193
|
-
###
|
|
193
|
+
### 循环逐条通知示例
|
|
194
194
|
|
|
195
|
-
|
|
195
|
+
循环仅用于集成自动化的编排。审批完成后需要循环时,使用审批事件触发集成自动化。循环体可配置消息通知、发起审批和条件或并行分支,可用节点以目标应用为准。读取多条数据放在循环前。批量复制使用[批量数据节点](../../yida-integration/references/batch-data.md)。
|
|
196
196
|
|
|
197
|
-
|
|
197
|
+
循环的 `source` 指向上游批量取数节点,`blockType` 可设为 `continue`(异常后跳过本条)或 `break`(退出循环)。每条自动化可配置一个循环,循环体最多五个计数节点。条件项和并行项本身不计数,分支内的动作仍计数。当前行字段使用 `${循环别名}.字段ID`。
|
|
198
198
|
|
|
199
199
|
```json
|
|
200
200
|
{
|
|
@@ -209,11 +209,10 @@
|
|
|
209
209
|
"id": "loop", "type": "cycle", "source": "rows", "blockType": "continue",
|
|
210
210
|
"nodes": [
|
|
211
211
|
{
|
|
212
|
-
"id": "
|
|
213
|
-
"
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
]
|
|
212
|
+
"id": "notify", "type": "sendMessage",
|
|
213
|
+
"receivers": ["<真实测试接收人ID>"],
|
|
214
|
+
"title": "记录提醒",
|
|
215
|
+
"content": "请查看记录 ${loop}.<真实编号字段ID>"
|
|
217
216
|
}
|
|
218
217
|
]
|
|
219
218
|
}
|
|
@@ -221,16 +220,12 @@
|
|
|
221
220
|
}
|
|
222
221
|
```
|
|
223
222
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
预期:若本次取到 A/5、B/15、C/25,目标表新增这 3 条对应记录。核对目标记录数量和每列值;`quantity:3` 表示最多取 3 条,来源表超过 3 条时,本例只处理本次取到的记录。
|
|
223
|
+
保存草稿并回读后,用测试接收人核对每轮通知和当前行字段。取到三条来源记录时,预期对应三条通知。
|
|
227
224
|
|
|
228
|
-
先保存草稿及回读,再以空数组、单条、多条和中途异常验证业务结果。配置保存不能证明并行汇合或循环执行正确。
|
|
229
225
|
|
|
230
226
|
## 特有限制
|
|
231
227
|
|
|
232
228
|
- 流程嵌套分支不超过 3 层;超过时必须拆分结构。默认“其他情况”由 CLI 生成;排查底层结构时核对最后一个条件为 `conditionType: else`,不猜测或省略兜底。
|
|
233
229
|
- 并行分支可能同时执行;不能用多个按优先级选择的条件分支假装并行。
|
|
234
230
|
- 节点别名只能引用当前分支的上游。某条分支内查询出的数据不能在无关分支中使用。
|
|
235
|
-
- 流程循环容器的范围、当前项、退出条件与子节点必须来自真实配置,不能只写空 `cycleContainerRules`。
|
|
236
231
|
- 批量取数再逐行新增不需要额外循环节点,见 [数据](data.md)。
|
|
@@ -85,7 +85,7 @@ openyida integration diagnose --file <异常文件> [--json]
|
|
|
85
85
|
| --- | --- | --- |
|
|
86
86
|
| 发起/触发 | 表单事件、流程完成或节点事件、定时 | 定时使用 spec schedule;不设置发起页字段权限;当前不创建应用或卡片触发 |
|
|
87
87
|
| 人工处理 | 无审批、办理、抄送人工节点 | 需要审批时用 `initiateApproval` 发起目标流程,在目标流程中配置审批人 |
|
|
88
|
-
| 流转控制 | `route/parallel/cycle` |
|
|
88
|
+
| 流转控制 | `route/parallel/cycle` | 循环为单层,格式见 [流转控制](../yida-flow-node-config/references/control.md) |
|
|
89
89
|
| 数据操作 | `getSelf/dataRetrieve/dataCreate/dataUpdate`,含批量取数/新增 | 当前 spec 不支持删除;流程表单新增用发起审批 |
|
|
90
90
|
| 通知 | `sendMessage`,成员/角色/成员字段 | 当前 spec 不支持邮件或卡片 |
|
|
91
91
|
| 扩展执行 | `connector/initiateApproval` | 连接器需发现真实 action schema;当前 spec 不支持代码或 AI |
|
|
@@ -148,6 +148,8 @@ openyida integration create APP_XXX FORM_XXX "替换已有自动化" --process-c
|
|
|
148
148
|
|
|
149
149
|
## 验证与异常
|
|
150
150
|
|
|
151
|
+
循环自动化按正常配置流程提交,由 CLI 自动校验。成功时直接报告保存或启用结果,校验结果影响任务时再说明原因和下一步。
|
|
152
|
+
|
|
151
153
|
发布成功要求列表中 `formUuid + processCode` 唯一匹配、状态为 `y`,且详情非空;返回 `verificationLevel=PLATFORM_LIST_EXACT_DETAIL_PRESENT`。角色、批量节点、赋值等已启用的投影校验也必须通过。此等级不证明完整运行图已回读,不能据此解锁 `integration update`。
|
|
152
154
|
|
|
153
155
|
| 结果 | 处理 |
|
|
@@ -160,7 +162,8 @@ openyida integration create APP_XXX FORM_XXX "替换已有自动化" --process-c
|
|
|
160
162
|
| 参数缺失、节点结构错误 | 停止,展示错误详情;从已有查询补齐真实参数,无法确定时询问用户,不猜测 |
|
|
161
163
|
| 登录态失效或权限不足 | 停止,运行 `openyida auth status` 核对;刷新失败时按 CLI 提示重新登录 |
|
|
162
164
|
| 未知错误 | 保留完整错误与资源 ID,停止;先只读核对是否已写入,再决定后续处理 |
|
|
163
|
-
|
|
|
165
|
+
| CLI 明确返回权益不足 | 说明当前操作受阻,按返回结果告知所需权益或官方升级入口。 |
|
|
166
|
+
| 循环配置不可用或校验结果无法确认 | 根据错误核对节点、目标应用或登录组织,再处理受阻的操作。 |
|
|
164
167
|
|
|
165
168
|
安全更新、保存顺序、输出口径和运行验收限制见 [spec 编排的保存与验证规则](references/spec-authoring.md#保存与验证规则)。`PLATFORM_PROBE_REQUIRED` 时必须保持 `remoteWrites=0`,保留 probe artifact 和 blocker;仅有列表或详情存在性不足以解锁更新,也不得降级为通用 JSON Patch。
|
|
166
169
|
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
| `--approval-node-ids <nodeId,...>` | 空 | 当 `--events activityTask` 时必填;审批节点 ID,多个用逗号分隔 |
|
|
27
27
|
| `--trigger-condition <fieldId:fieldName:opCode:value[:componentType[:valueType]]>` | 空 | 触发过滤条件,可多次传入;固定值用 `literal`(默认),右侧为另一个字段时用 `processVar`,见 [字段比较示例](../../yida-flow-node-config/references/conditions-variables.md) |
|
|
28
28
|
| `--trigger-recursively` | 关闭 | 允许自动触发,对应设计器里的“允许自动触发” |
|
|
29
|
-
| `--spec <file.json>` | 不启用 | 使用结构化编排文件创建复杂自动化,支持 `getSelf`、`dataRetrieve`、`dataCreate`、`dataUpdate`、`route`、`parallel`、`cycle`、`sendMessage`、`connector`、`initiateApproval
|
|
29
|
+
| `--spec <file.json>` | 不启用 | 使用结构化编排文件创建复杂自动化,支持 `getSelf`、`dataRetrieve`、`dataCreate`、`dataUpdate`、`route`、`parallel`、`cycle`、`sendMessage`、`connector`、`initiateApproval`。循环体用法见 [流转控制](../../yida-flow-node-config/references/control.md#循环逐条通知示例) |
|
|
30
30
|
| `--get-self` | 关闭 | 自动插入“获取自身”节点:流程表单运行态查询字段为 `pid`、设计器字段为 `proc_inst_id`;普通表单两侧使用 `form_inst_id`,均等于触发事件字段 `__masterdata_form_inst_id` |
|
|
31
31
|
| `--get-self-field <field>` | `__masterdata_form_inst_id` | 覆盖右侧触发事件系统字段;仅在确认环境变量名不同后使用 |
|
|
32
32
|
| `--get-self-query-field <field>` | 自动按来源表单类型选择 | 覆盖左侧查询系统字段;流程表单运行态使用 `pid` / `流程实例ID`、设计器使用 `proc_inst_id`,普通表单两侧使用 `form_inst_id` / `表单实例ID`;仅在确认平台字段名不同后使用 |
|
|
@@ -19,7 +19,7 @@ description: 宜搭平台插件前端资源的构建、托管与加载排查;
|
|
|
19
19
|
1. 确认已有插件 ID/版本、目标宿主/扩展点、源码项目及本次执行范围;缺少插件或版本时交回生命周期技能,不凭展示名编造 ID。
|
|
20
20
|
2. 核实集团/非集团开发环境、企业静态资源服务器、HTTPS 域名及发布权限。身份以用户说明与已核实权限为准,不能只凭宜搭域名、内网可达或本地仓库推断。
|
|
21
21
|
3. 读取[创建与部署引导](./references/frontend-hosting.md),复用现有企业渠道;没有现成渠道时国内推荐码云 + 阿里云 OSS,GitHub Actions + Pages 作为备选。逐步给出入口、填写项和完成后需要提供的信息。
|
|
22
|
-
4. 读取[前端构建与加载契约](./references/frontend-contract.md),检查真实项目的 Module Federation 配置、容器名、扩展点导出、publicPath
|
|
22
|
+
4. 读取[前端构建与加载契约](./references/frontend-contract.md),检查真实项目的 Module Federation 配置、容器名、扩展点导出、publicPath 和依赖。所有前端组件扩展点按[组件标识一致性](./references/frontend-contract.md#组件标识一致性)核对注册、视图、Schema 和版本配置。表单组件按[基础表单组件开发规范](./references/form-component-development.md)核对字段元数据、拖拽片段、附件回填和旧字段迁移。获准执行后才安装依赖、构建、上传完整产物;仅编译成功不能宣称宿主可加载。
|
|
23
23
|
5. 获得真实稳定 HTTPS 入口后,通过 `use_skill("yida-plugin-lifecycle", "保存插件开发版本配置")` 交接,基于版本回读保留三段配置、摘要和备份,再保存核对;资源部署不自动发布到组织。
|
|
24
24
|
6. 用户授权验收后,通过 `use_skill("yida-plugin-lifecycle", "核对插件可用性的四层证据")` 分别记录持久化、资源可达、注册候选和真实消费。加载失败按契约排查;没有执行的层级明确标为未验证。
|
|
25
25
|
|
|
@@ -36,3 +36,4 @@ description: 宜搭平台插件前端资源的构建、托管与加载排查;
|
|
|
36
36
|
|---|---|
|
|
37
37
|
| [创建与部署引导](./references/frontend-hosting.md) | 选择渠道、指导创建仓库/OSS、企业发布或 GitHub 备选 |
|
|
38
38
|
| [前端构建与加载契约](./references/frontend-contract.md) | 构建配置、SDK 证据、CLI probe 字段及宿主懒加载排查 |
|
|
39
|
+
| [基础表单组件开发规范](./references/form-component-development.md) | 普通表单、流程表单的组件命名、注册、字段元数据和按场景配置 |
|
package/yida-skills/skills/yida-plugin-frontend-deploy/references/form-component-development.md
ADDED
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
# 宜搭基础表单组件开发规范
|
|
2
|
+
|
|
3
|
+
普通表单和流程表单使用基础表单组件扩展。先确定组件是展示已有数据、复用原生字段的存值能力,还是用多个字段组合采集数据。需要同时出现在自定义页面时,另行注册自定义页面的设计态和运行态扩展。
|
|
4
|
+
|
|
5
|
+
## 开发前检查
|
|
6
|
+
|
|
7
|
+
- 将 `renderControl` 中的输入控件拆成独立组件,由宿主通过 `value` 和 `onChange` 接入。筛选器、流程 setter 和集成自动化直接复用控件,避免嵌套完整表单字段导致白屏。只读渲染较复杂时,将 `renderView` 也拆成独立视图。
|
|
8
|
+
- 展示文本与存值结构不同时,抽出共用的文本格式化函数。只读视图、表格和关联展示可复用它,`associationView.getViewText` 返回字符串。
|
|
9
|
+
- 按消费场景启用对应开关,配置前先验证控件、回调和值结构。筛选、流程和关联的字段匹配从自身类型开始,验证后再扩大范围。复合字段按下文的 `CC_` 命名规则注册。
|
|
10
|
+
- 级联和多控件组件需要实测半屏子表单、筛选器及流程面板。空间不足时采用纵向布局或弹层,检查弹层能否打开、选择和关闭。
|
|
11
|
+
|
|
12
|
+
复杂组件可以按以下结构组织源码。按实际需要创建目录,构建时将各入口映射到相应的 Module Federation 暴露路径。
|
|
13
|
+
|
|
14
|
+
```text
|
|
15
|
+
app/
|
|
16
|
+
form/index.tsx 表单运行态注册
|
|
17
|
+
custom-page/index.tsx 自定义页面运行态注册
|
|
18
|
+
designer/
|
|
19
|
+
form/index.tsx 表单设计态注册
|
|
20
|
+
custom-page/index.tsx 自定义页面设计态注册
|
|
21
|
+
controls/ 可复用的输入控件
|
|
22
|
+
views/ 复杂只读视图
|
|
23
|
+
fields/ 对接宿主存值和提交的字段包装层
|
|
24
|
+
setters/ 设计器或流程面板的设置器
|
|
25
|
+
components/ 通用组件
|
|
26
|
+
utils/ 值转换和文本格式化
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## 组件标识与字段 Schema
|
|
30
|
+
|
|
31
|
+
- 命名与注册遵循[组件标识一致性](./frontend-contract.md#组件标识一致性)。表单设计态、运行态和移动端共用同一个组件标识。
|
|
32
|
+
- 使用业务前缀避开官方组件和同一组织中已安装的组件,例如 `SmartFinCurrencyField`。复合表单组件用 `CC_` 开头并保留业务前缀,例如 `CC_SmartFinInvoiceField`,配置 `isCompositeFormField: true`。数据字段推荐以 `Field` 结尾,部分筛选器和流程字段工具按这个后缀识别字段。字段类型和提交能力由实际元数据及宿主支持决定。
|
|
33
|
+
- 独立组件的拖拽片段用注册标识作 `schema.componentName`。复用原生字段时,`targetMetaDataFieldName` 和 `schema.componentName` 用实际原生类型,`schema.props.__viewName__` 用插件视图标识。例如原生 `NumberField` 的自定义视图使用 `SmartFinCurrencyField`。
|
|
34
|
+
- 已使用的组件保留 Schema 引用的标识。升级时如确需改名,先盘点旧表单引用,再提供兼容注册或迁移。迁移后验证字段 ID、配置和历史数据。
|
|
35
|
+
|
|
36
|
+
## 表单注册和发布配置
|
|
37
|
+
|
|
38
|
+
下例展示复用数值字段的注册关系。`CurrencyView` 是插件实现的视图,按宿主字段契约处理值、编辑与只读状态。两段注册分别放入各自入口的 `run`,与视图共用组件标识常量。
|
|
39
|
+
|
|
40
|
+
```js
|
|
41
|
+
// shared/component-name.js
|
|
42
|
+
export const COMPONENT_NAME = "SmartFinCurrencyField";
|
|
43
|
+
|
|
44
|
+
// 视图模块
|
|
45
|
+
CurrencyView.displayName = COMPONENT_NAME;
|
|
46
|
+
|
|
47
|
+
// ./designer/form 的 run
|
|
48
|
+
Yida.designer.form.addBasicComponent({
|
|
49
|
+
componentName: COMPONENT_NAME,
|
|
50
|
+
targetMetaDataFieldName: "NumberField",
|
|
51
|
+
title: "财务金额",
|
|
52
|
+
designerView: CurrencyView,
|
|
53
|
+
snippets: [{
|
|
54
|
+
label: "财务金额",
|
|
55
|
+
schema: {
|
|
56
|
+
componentName: "NumberField",
|
|
57
|
+
props: { __viewName__: COMPONENT_NAME },
|
|
58
|
+
},
|
|
59
|
+
}],
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
// ./app/form 的 run
|
|
63
|
+
Yida.app.form.addBasicComponent({
|
|
64
|
+
componentName: COMPONENT_NAME,
|
|
65
|
+
view: CurrencyView,
|
|
66
|
+
dataView: {
|
|
67
|
+
icon: "success",
|
|
68
|
+
meta: { type: COMPONENT_NAME, typeName: "财务金额" },
|
|
69
|
+
gridFormatter: ({ value }) =>
|
|
70
|
+
value == null || value === "" ? "—" : String(value),
|
|
71
|
+
enableBatchEdit: false,
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
下面是 `frontEndDevInfo` 的表单配置示例。先用 `openyida plugin extensions --json` 核对目标环境的扩展点,再将真实入口及配置合入 `version-get` 回读的配置。
|
|
77
|
+
|
|
78
|
+
```json
|
|
79
|
+
{
|
|
80
|
+
"cdnEntry": "https://static.example.com/smart-fin/1.0.0/remoteEntry.js",
|
|
81
|
+
"extensions": [
|
|
82
|
+
{ "extensionId": "yida.designer.form.basic-component" },
|
|
83
|
+
{
|
|
84
|
+
"extensionId": "yida.app.form.basic-component",
|
|
85
|
+
"config": { "componentNameList": ["SmartFinCurrencyField"] }
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
自定义页面增加 `yida.designer.custom-page.component` 和 `yida.app.custom-page.component`,分别暴露 `./designer/custom-page` 和 `./app/custom-page`,调用 `Yida.designer.customPage.addComponent` 和 `Yida.app.customPage.addComponent`。在自定义页面的运行态扩展配置中列出该场域的注册名。同一组件在两个宿主中使用同一个标识。需要独立注册表单字段与自定义页面展示组件时,可以共享内部控件,并分别使用 `SmartFinCurrencyField` 和 `SmartFinCurrencyView`。
|
|
92
|
+
|
|
93
|
+
## 多场域和移动端的实现
|
|
94
|
+
|
|
95
|
+
- 每个场域的设计态和运行态都用独立的 `run` 入口。设计态入口注册拖拽片段、预览视图和 setter,运行态入口注册实际视图和消费场景配置。共用的控件和值转换放在独立模块里。按 `isMobile` 选择运行视图,设计器有移动端画布时一并配置 `designerMobileView`。
|
|
96
|
+
- 表单视图通过宿主字段契约收集数据,自定义页面、筛选器和流程 setter 通过各自传入的 `value` 和 `onChange` 复用控件。让控件只处理当前输入,表单包装层负责字段状态和提交。设计器和只读视图渲染时保持已保存值,默认值通过 Schema 或宿主允许的初始化逻辑设置。
|
|
97
|
+
- 结构化字段在读入时统一处理对象、JSON 字符串和空值。保存时保留字段约定的值结构。只读视图、表格列和关联展示共用格式化函数,关联字段需要文本时返回字符串。普通值、空值和旧版本保存的值都要经过同一套读入逻辑。
|
|
98
|
+
- 使用 `configure` 提供业务属性和默认值。拖拽片段、属性面板和控件的默认值保持一致。标题、说明等界面文案按项目的国际化契约配置,流程操作符使用宿主定义的标识。
|
|
99
|
+
|
|
100
|
+
## 使用宜搭原生组件
|
|
101
|
+
|
|
102
|
+
- 原生附件、子表单和数值需要随表单提交时,在表单 Schema 中保留真实的 `AttachmentField`、`TableField` 和 `NumberField`。插件要作为一个完整组件拖入时,用 `isContainer: true` 注册布局容器,将原生字段放进 `snippets[].schema.children`,设计态和运行态都渲染宿主传入的 `children`。例如「发票分析」容器的两个直接子节点是附件和子表,子表下才放多行文本、数值。容器本身无需新增 Dictionary 字段。
|
|
103
|
+
- 容器内读写字段时,从当前容器的 Schema 子树解析宿主生成的字段 ID;仅当插件消费独立存在的字段时,才通过插件属性配置外部字段 ID。运行态通过 `window.Yida.utils.getRuntimeContextFromComponentProps(props)` 获取当前表单上下文,再使用 `ctx.$(fieldId).getValue()` 或 `setValue()` 读写。保留宿主传入的上下文 props,写入前核对目标字段可编辑。测试同一表单插入两个容器时,每个实例只操作自己的子节点,并核对实际存值字段能在数据管理视图中选择。
|
|
104
|
+
- 插件内部需要直接渲染原生控件时,沿用 Canvas 的探测思路,从当前页面的 `window.Deep`、`window.DeepYida` 或存在时的 `window.YidaNativeComponents` 查找宿主暴露的可渲染组件。按目标设计态、运行态和设备核实组件名、属性及值结构。确认所需的 React 和宿主全局对象后再声明 externals。缺少必需的原生组件时给出具体提示,保留原生字段的提交路径。
|
|
105
|
+
- 插件视图本身可以用宿主提供的 `window.Deep.FormHelper` 接入字段状态。展示层嵌入的控件由插件负责绑定值,提交数据通过真实字段或宿主的字段回调保存。配置原生附件和子表单时,先验证上传后的附件值,再用真实子字段 ID 组装行对象。金额用数值字段并配置业务所需小数位。
|
|
106
|
+
|
|
107
|
+
## 原生子表单列与附件回填
|
|
108
|
+
|
|
109
|
+
- 在拖拽片段里显式配置多行文本列为 `componentName: "TextareaField"` 和 `props.htmlType: "textarea"`。缺少 `htmlType` 时,底层文本控件默认按单行模式渲染。沿用目标设计器的原生子表单列元数据,原生列由宿主渲染。需要自定义视图时才配置 `__viewName__`。
|
|
110
|
+
- 附件回填从上传成功且附件值可用时触发。在填写态展示处理状态,按当前附件去重,丢弃附件移除或替换前发起的过期结果,保留已有手工行和编辑值。按实际子字段 ID 写入行对象,多行文本存可读明细,金额存数字。处理失败时保留已上传的附件和原有行,给用户可见的反馈。
|
|
111
|
+
- 接入解析前用目标服务验证实际支持的输入和输出。`openyida ai text` 调用的 `txtFromAI` 接收文本 prompt。PDF 解析需要验证能接收附件的服务,或先提取 PDF 文本再调用文本生成。只验收上传、处理状态和回填链路时,可以用标明为模拟的固定结果,上传成功后自动回填。
|
|
112
|
+
- 迁移已有表单时先回读字段 Schema 和数据管理配置。若字段已经是 `TextareaField`,补齐 `htmlType` 并清理旧视图覆盖即可,保留字段 ID 及数据管理列的绑定。仅补字段属性时,按字段 ID 使用 [`create-form update`](../../yida-create-form-page/SKILL.md#update-模式)。按需另行处理历史记录中保存的 JSON 字符串。下线旧插件组件时,先清理普通表单、流程表单及其视图中的引用,再移除相应的注册和版本配置项。
|
|
113
|
+
|
|
114
|
+
## 数据管理与数据管理视图
|
|
115
|
+
|
|
116
|
+
普通表单和流程表单的插件开发,默认把数据管理页和数据管理视图纳入配置与验收。
|
|
117
|
+
|
|
118
|
+
1. **插件运行态配置。** 在 `Yida.app.form.addBasicComponent` 中提供 `dataView`,用 `meta.type` 对齐组件标识,配置列标题图标和 `gridFormatter`。同一格式化函数可以处理管理端 `admin` 和用户端 `app`。两端展示有差异时按 `scenarioCode` 处理。只读列也提供格式化结果,核对空值、零值和实际业务值。
|
|
119
|
+
2. **表单数据管理配置。** 在目标表单的数据管理页配置默认展示列。已有视图先读取真实配置,再将插件字段或实际承载数据的原生字段加入目标视图。配置步骤见[数据管理视图技能](../../yida-form-view/SKILL.md)。
|
|
120
|
+
3. **视图验收。** 提交测试记录后打开数据管理列表和目标视图,确认字段可选、列标题正确、单元格能渲染。需要行内编辑时实现 `gridEditor` 并核对保存值,完成批量编辑验收后再开启 `enableBatchEdit`。
|
|
121
|
+
|
|
122
|
+
只读展示组件通过绑定读取其他字段时,使用实际存值字段配置数据管理列。例如票据详情组件读取子表单时,按业务需要展示子表单字段或主表汇总字段。
|
|
123
|
+
|
|
124
|
+
## 按实际使用场景配置
|
|
125
|
+
|
|
126
|
+
组件自身存值时,按宿主契约传递 `value` 和 `onChange`。需要把结果写入其他原生字段时,从运行时上下文定位目标字段,按表单实际字段 ID 和值结构配置映射。上传票据并填充子表单时,上传、解析和写回由录入组件或业务流程完成,详情视图通过绑定读取已保存的明细。
|
|
127
|
+
|
|
128
|
+
| 使用场景 | 相关配置与检查 |
|
|
129
|
+
| --- | --- |
|
|
130
|
+
| 表单存值与字段匹配 | 按需配置 `targetMetaDataFieldName` 或 `isCompositeFormField`。使用 `matchedFields` 声明已验证的匹配类型,初期只匹配自身。 |
|
|
131
|
+
| 数据管理列表和视图 | 配置 `dataView`,并把实际存值字段加入目标视图。用已提交的记录核对列渲染,按需验收行内和批量编辑。 |
|
|
132
|
+
| 表单、数据管理及流程筛选 | 按目标宿主支持的注册入口配置 `filterView` 和 `supportedOperators`,在各实际使用的场景验证操作符、值类型和校验。级联字段按操作符选择条件视图。 |
|
|
133
|
+
| 公式 | 用 `formulaView` 声明 `valueTypes`、`fieldTagMap`,需要转换时实现 `parseValue`。在实际编辑器中验证字段选择、返回值和计算。 |
|
|
134
|
+
| 流程设计器与集成自动化 | 用 `flowSetterView` 配置面板视图。根据需求逐项验证后开启 `enableUpdate`、`enableCondition`、`enablePermission`、`enableMatch` 等能力。流程匹配、过滤和数据节点分别核对 `operatorMapConfig` 的 `flowMatch`、`flowFilter` 和 `flowDataNode`。流程表单填写页的组件渲染与流程节点配置分别验收。 |
|
|
135
|
+
| 关联、导入导出、消息与历史 | 分别按需配置 `associationView`、`importExport`、`messageView`、`modifyHistoryView`。关联填充核对 `fillableFields`,关联展示的 `getViewText` 返回字符串。仅开启已实现的能力。 |
|
|
136
|
+
|
|
137
|
+
历史场域可能还使用组件类型清单或专有映射。组件未出现在某个场域时,先核对该扩展是否加载、能力开关是否生效,再确认宿主支持的字段匹配和操作符。
|
|
138
|
+
|
|
139
|
+
## 基础表单组件配置项
|
|
140
|
+
|
|
141
|
+
以下字段用于 `Yida.designer.form.addBasicComponent` 或 `Yida.app.form.addBasicComponent` 的注册对象。先实现视图、回调和值转换,再启用目标场景的开关。
|
|
142
|
+
|
|
143
|
+
### 基础配置
|
|
144
|
+
|
|
145
|
+
| 配置项 | 类型 | 用途 |
|
|
146
|
+
| --- | --- | --- |
|
|
147
|
+
| `componentName` | `string` | 组件标识,与视图的 `displayName`、Schema 引用及运行态配置对应。 |
|
|
148
|
+
| `targetMetaDataFieldName` | 组件类型名 | 复用原生字段的元数据与存值类型。 |
|
|
149
|
+
| `isCompositeFormField` | `boolean` | 声明复合字段,组件名以 `CC_` 开头。 |
|
|
150
|
+
| `matchedFields` | `string[]` | 允许在筛选等场景匹配的字段类型,初期可只声明自身类型。 |
|
|
151
|
+
| `supportedOperators` | `string[]` 或操作符对象数组 | 声明宿主识别的操作符。对象以 `value` 标识操作符,`label` 用于展示。 |
|
|
152
|
+
| `view`、`designerView`、`designerMobileView` | `ComponentType`,部分宿主接受 `ReactNode` | 分别用于运行态、设计态和移动设计态。移动运行态可按宿主支持配置 `mobileView`。 |
|
|
153
|
+
|
|
154
|
+
流程的匹配、条件过滤、数据节点可分别使用 `operatorMapConfig.flowMatch`、`flowFilter`、`flowDataNode`。各项取字符串数组或操作符对象数组。核对宿主实际接受的操作符值,特别是使用历史中文标识的流程节点。
|
|
155
|
+
|
|
156
|
+
### 数据管理和修改历史
|
|
157
|
+
|
|
158
|
+
| 配置项 | 类型 | 用途 |
|
|
159
|
+
| --- | --- | --- |
|
|
160
|
+
| `dataView.icon` | `string` | 数据管理表头图标。 |
|
|
161
|
+
| `dataView.meta` | `{ type, typeName }` | `type` 对齐 `componentName`,`typeName` 为类型展示名。 |
|
|
162
|
+
| `dataView.gridFormatter` | `({ value, scenarioCode }) => ReactNode` | 渲染列值。用 `admin` 或 `app` 区分管理端与用户端,验证空值、零值和只读展示。 |
|
|
163
|
+
| `dataView.gridEditor` | `(props, ref) => ReactNode` | 行内编辑器。宿主传入 `value`、`inputRef`、`onChange`、`options`。验证编辑后的实际存值。 |
|
|
164
|
+
| `dataView.enableBatchEdit` | `boolean` | 批量编辑开关。完成批量保存与回读验证后再开启。 |
|
|
165
|
+
| `modifyHistoryView.view` | `ReactNode` | 渲染实例详情中的字段变更历史。 |
|
|
166
|
+
|
|
167
|
+
将实际存值字段加入目标数据管理视图后,再验证表格和详情。关联查询依赖 `dataView`,在设计态和运行态都加载相关配置。
|
|
168
|
+
|
|
169
|
+
### 筛选和关联
|
|
170
|
+
|
|
171
|
+
| 配置项 | 类型 | 用途 |
|
|
172
|
+
| --- | --- | --- |
|
|
173
|
+
| `filterView.view` | `ReactNode` | 筛选条件的输入视图。 |
|
|
174
|
+
| `filterView.conditionView` | 操作符到视图的映射 | 为特定操作符指定渲染视图。键使用宿主的操作符标识。 |
|
|
175
|
+
| `filterView.getExtraProps` | `(props) => object` | 补充筛选视图所需的属性。 |
|
|
176
|
+
| `filterView.validateValue` | `(value) => boolean` | 校验筛选条件值。 |
|
|
177
|
+
| `filterView.isCascade` | `boolean` | 声明级联字段,以便筛选器按级联值结构处理。 |
|
|
178
|
+
| `associationView.enable` | `boolean` | 开启关联表单支持。 |
|
|
179
|
+
| `associationView.enableAssociationQuery` | `boolean` | 开启关联查询支持。 |
|
|
180
|
+
| `associationView.fillableFields` | `string[]` | 允许关联填充的组件类型。 |
|
|
181
|
+
| `associationView.getViewText` | `({ value, options }) => string` | 返回关联展示的纯文本。 |
|
|
182
|
+
|
|
183
|
+
筛选器在设计态和运行态都可能使用,两个入口均注册 `filterView`。流程设计器优先使用 `flowSetterView`,再回退到 `filterView` 或组件视图。使用独立控件复用输入能力,避免在流程 setter 中嵌套完整表单字段。
|
|
184
|
+
|
|
185
|
+
### 流程面板 `flowSetterView`
|
|
186
|
+
|
|
187
|
+
| 属性 | 类型 | 对应能力 |
|
|
188
|
+
| --- | --- | --- |
|
|
189
|
+
| `view` | `ReactNode` 或 `ComponentType` | 流程设置面板的输入视图。 |
|
|
190
|
+
| `enableUpdate` | `boolean` | 允许更新字段值。 |
|
|
191
|
+
| `enableCondition` | `boolean` | 允许作为条件项。 |
|
|
192
|
+
| `enablePermission` | `boolean` | 允许配置字段权限。 |
|
|
193
|
+
| `enableService` | `boolean` | 允许用于第三方服务配置。 |
|
|
194
|
+
| `enableMessage` | `boolean` | 允许用于流程消息内容配置。 |
|
|
195
|
+
| `enableMatch` | `boolean` | 允许用于字段匹配。 |
|
|
196
|
+
| `updateMatchFields` | `string[]` | 允许在更新场景中匹配的字段类型。 |
|
|
197
|
+
| `enableFilter` | `boolean` | 允许用于流程筛选。 |
|
|
198
|
+
| `enableLiteral` | `boolean` | 允许配置字面量值。 |
|
|
199
|
+
|
|
200
|
+
更新字段的运行时键为 `enableUpdate`。部分 SDK 类型和旧文档表格拼写为 `enableUpate`,以目标消费者实际读取的键为准。按本次业务需要开启开关,在流程或集成自动化中配置并执行一条对应规则。
|
|
201
|
+
|
|
202
|
+
### 公式、消息和导入导出
|
|
203
|
+
|
|
204
|
+
| 配置项 | 类型 | 用途 |
|
|
205
|
+
| --- | --- | --- |
|
|
206
|
+
| `formulaView.fieldTagMap` | `string` 或 `{ style, text }` | 定义公式编辑器中的字段标签。 |
|
|
207
|
+
| `formulaView.valueTypes` | `string[]` | 声明该字段支持的公式返回类型。 |
|
|
208
|
+
| `formulaView.parseValue` | `(value) => value` | 将公式结果转换为字段约定的值。 |
|
|
209
|
+
| `messageView.enable` | `boolean` | 开启消息通知和消息卡片支持。 |
|
|
210
|
+
| `importExport.view` | `ReactNode` | 导入导出场景的视图。 |
|
|
211
|
+
| `importExport.enable` | `boolean` | 开启导入导出支持。 |
|
|
212
|
+
|
|
213
|
+
组件在目标场景未出现时,检查设计态和运行态的注册、对应能力开关、字段匹配及操作符,再用实际记录验证渲染、写入和回读。
|
|
214
|
+
|
|
215
|
+
## 验收与排查
|
|
216
|
+
|
|
217
|
+
1. 构建前核对共享标识和字段 Schema。构建后确认入口暴露目标模块,所有分包可访问,压缩产物中的 `displayName` 与注册及版本配置一致。
|
|
218
|
+
2. 组织发布并启用后,在目标设计器拖入组件,检查画布、属性面板、保存和重开。组件库可见而画布提示「组件未找到」时,对照保存节点的 `componentName` 或 `__viewName__` 与实际注册的 `designerView.displayName`。
|
|
219
|
+
3. 在真实普通表单和流程表单的填写页验证自动渲染、交互和只读状态。涉及数据写入时,提交测试记录并重新打开核对存值。附件回填还要实测上传、处理状态、子表单列的渲染和回填值。分别验收设计器中新拖入的组件、已有表单以及记录详情。自定义页面及启用的其他场域逐一验收。
|
|
220
|
+
4. 在数据管理列表和目标数据管理视图中分别检查测试记录的列和值。插件字段显示异常时,核对运行态注册中的 `dataView.meta.type` 和 `gridFormatter`,以及表单视图使用的字段 ID。
|
|
221
|
+
5. 运行态缺少组件时核对启用版本、实际入口和分包请求、运行态 `componentNameList` 以及 `view.displayName`。同一组织有多个第三方插件使用同一资源主机时,如果其中一个没有发出脚本请求,检查目标宿主是否按相同运行时标识覆盖了插件。确认冲突后为各插件使用独立资源主机。
|
|
222
|
+
6. 有移动端要求时,分别在移动设计器和移动填写页检查组件是否显示、弹层是否可操作、保存后值是否一致。启用筛选、流程 setter 或关联填充时,实际配置一条规则并验证结果。
|
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
适用于已明确的宜搭平台插件。托管渠道与创建步骤见[部署引导](./frontend-hosting.md),配置保存和组织级操作见[生命周期技能](../../yida-plugin-lifecycle/SKILL.md#开发与版本配置)。
|
|
4
4
|
|
|
5
|
+
## 组件标识一致性
|
|
6
|
+
|
|
7
|
+
凡宜搭插件注册前端组件,普通表单、流程表单、自定义页面和其他组件扩展点均遵循同一规则。为同一个组件定义一个共享的业务标识,所有用于注册或查找该组件的位置逐字一致,包含大小写。
|
|
8
|
+
|
|
9
|
+
- Yida API 的 `componentName` 与组件视图的 `displayName` 一致。设计态、运行态及移动端注册同一个组件时都沿用该标识。
|
|
10
|
+
- 拖拽片段和已保存 Schema 引用同一个组件标识。复用原生字段并覆盖视图时,`schema.componentName` 仍是原生字段类型,`schema.props.__viewName__` 才是插件组件标识。具体写法见[基础表单组件开发规范](./form-component-development.md)。
|
|
11
|
+
- 扩展点支持 `config.componentNameList` 时,清单填写该扩展点实际注册的组件标识。一个插件注册多个独立组件时,每个组件分别核对;同一组件跨场域复用时沿用原标识。
|
|
12
|
+
|
|
13
|
+
构建后核对压缩产物中的 `displayName` 和 API 注册参数。保存配置及页面后,回读版本配置和 Schema,再到各目标宿主验证设计态和运行态。
|
|
14
|
+
|
|
5
15
|
## 第三方前端配置与构建契约
|
|
6
16
|
|
|
7
17
|
开发字段为 `frontEndDevInfo.cdnEntry`,运行时为 `cdnUrl`。以下地址、组件名需替换;后端和参数配置保留真实回读,不能照抄空对象:
|
|
@@ -22,11 +32,9 @@
|
|
|
22
32
|
|
|
23
33
|
同时配置设计态、运行态扩展;`config.componentNameList` 匹配 `addComponent` 注册名(日历 `OpenYidaCalendarView`,时间线 `OpenYidaStickyTimeline`)。发布后核对运行时 config 和真实页面。
|
|
24
34
|
|
|
25
|
-
显式设置同名 `displayName`,如 `StickyTimeline.displayName = "OpenYidaStickyTimeline"`;检查压缩后设计器日志和组件面板。
|
|
26
|
-
|
|
27
35
|
本地 `yida-plugin-sdk`(`b2277ef`)的实现证据,线上版本须另核:
|
|
28
36
|
|
|
29
|
-
- `src/utils/plugin.helper.ts` 的 `isOfficialPlugin`
|
|
37
|
+
- `src/utils/plugin.helper.ts` 的 `isOfficialPlugin` 检查完整运行态 `cdnUrl` 是否包含 `yida-components` 或 `teambition-fe`。第三方托管域名和路径应避开这两个字符串。第三方新仓库和资源项目的命名见[托管命名建议](./frontend-hosting.md#开发环境与渠道)。
|
|
30
38
|
- `src/plugin/runtime/plugin.ts` 的 `_generateRemoteConfigFromPlugin`:官方入口按宿主 CDN/group/id/version 拼接;第三方保留完整 `plugin.cdnUrl`,容器名为 `plugin.uuid.split("-")[1]`,与资产目录分开配置。
|
|
31
39
|
- `src/plugin/runtime/plugin.executor.ts` 的 `_getContainerId`:自定义页面导出 `./app/custom-page`、`./designer/custom-page`;其他扩展点核对实际场景。
|
|
32
40
|
- 本地 `yida-single-app` 的 `OpenPluginFacadeImpl` 将 `cdnEntry` 赋给 `cdnUrl`;不能凭编辑器前缀推断运行时拼官方 CDN。
|
|
@@ -8,6 +8,7 @@ GitHub Pages 已在吸顶时间线示例中完成宜搭真实加载验收,仅
|
|
|
8
8
|
|
|
9
9
|
- **集团开发环境**:优先已授权的内网仓库和团队 DEF/云构建流程,资产 group、项目和版本取实际发布配置,不编造固定命名空间。内网构建不等于产物仅限内网访问,目标组织用户的浏览器仍须能加载。渠道未开通时联系团队发布管理员或插件接入负责人。
|
|
10
10
|
- **非集团开发环境**:有企业静态资源服务器就沿用;没有时国内推荐码云存源码、OSS 托管产物,CDN 按需添加,已有仓库无需迁移。所选渠道需在目标宿主验收。
|
|
11
|
+
- **第三方命名**:新建仓库和资源项目时,使用企业或业务前缀,例如 `smart-fin-invoice-plugin`,避开官方示例常用的 `yida-plugin-` 前缀。资源路径同样使用业务命名。
|
|
11
12
|
|
|
12
13
|
## 先确认当前缺什么
|
|
13
14
|
|
|
@@ -26,6 +27,10 @@ GitHub Pages 已在吸顶时间线示例中完成宜搭真实加载验收,仅
|
|
|
26
27
|
3. 获准后按项目真实构建命令生成并发布整个产物目录,包含 `remoteEntry.js`、chunks、CSS 和所需媒体;不要只上传入口文件,也不要覆盖其他插件或旧版本资源。
|
|
27
28
|
4. 请发布负责人给出稳定的完整 HTTPS 入口。需要登录门户、短期签名或 VPN 的地址不能未经确认就作为所有目标用户可加载的资源。
|
|
28
29
|
|
|
30
|
+
### 企业发布流程的资源核对
|
|
31
|
+
|
|
32
|
+
使用 O2 等企业发布流程时,先核对源码仓库、静态资产应用、迭代、分支与目标环境的绑定。读取部署任务返回的入口和分包地址,确认实际版本目录及当前发布的提交。若获准在已有测试迭代内重部署,可逐个比对目标 CDN 上的入口和本次分包,随后在目标表单检查浏览器实际加载的资源及组件交互。单独回读宜搭插件的版本配置和组织安装状态。
|
|
33
|
+
|
|
29
34
|
## 没有现成资源:码云 + 阿里云 OSS
|
|
30
35
|
|
|
31
36
|
### 1. 创建或复用代码仓库
|
|
@@ -9,6 +9,10 @@ description: 管理宜搭平台“插件管理”中的开发插件、版本配
|
|
|
9
9
|
|
|
10
10
|
连接类组件的服务、输入输出映射、参数与鉴权设计,先读[宜搭插件开发规范](./references/development-guide.md)。前端构建、托管或加载排查时,通过 `use_skill("yida-plugin-frontend-deploy", "构建、托管或排查插件前端资源")` 加载部署技能;本技能接收其真实资源地址并负责平台配置保存。CLI 生命周期接口不能替代官方编辑器中的组件设计和组织内真实测试。
|
|
11
11
|
|
|
12
|
+
插件注册前端组件时,先按[组件标识一致性](../yida-plugin-frontend-deploy/references/frontend-contract.md#组件标识一致性)确定组件名,再编写源码或保存版本配置。
|
|
13
|
+
|
|
14
|
+
开发普通表单或流程表单里的基础表单组件时,先读[基础表单组件开发规范](../yida-plugin-frontend-deploy/references/form-component-development.md),确定字段元数据和使用场景。基础表单组件和自定义页面组件属于前端扩展,创建时使用 `--type other`。
|
|
15
|
+
|
|
12
16
|
## 没有开发插件权限时
|
|
13
17
|
|
|
14
18
|
- 当前组织没有“开发插件”入口,或操作明确提示未开通插件开发权限时,先核对登录账号与目标组织;空列表或登录失效不能直接判定为没有权限。
|