openxiangda 1.0.140 → 1.0.142
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/README.md +52 -2
- package/lib/cli.js +89 -0
- package/lib/design-gates.js +29 -0
- package/openxiangda-skills/SKILL.md +3 -1
- package/package.json +1 -1
- package/packages/sdk/dist/{ProcessPreview-CZJP8n3e.d.mts → ProcessPreview-CUQFUDvw.d.mts} +5 -2
- package/packages/sdk/dist/{ProcessPreview-CZJP8n3e.d.ts → ProcessPreview-CUQFUDvw.d.ts} +5 -2
- package/packages/sdk/dist/components/index.cjs +139 -30
- package/packages/sdk/dist/components/index.cjs.map +1 -1
- package/packages/sdk/dist/components/index.d.mts +6 -136
- package/packages/sdk/dist/components/index.d.ts +6 -136
- package/packages/sdk/dist/components/index.mjs +139 -30
- package/packages/sdk/dist/components/index.mjs.map +1 -1
- package/packages/sdk/dist/dataManagementApi-CwBEmnXg.d.ts +141 -0
- package/packages/sdk/dist/dataManagementApi-DQKInwWS.d.mts +141 -0
- package/packages/sdk/dist/runtime/index.cjs +157 -87
- package/packages/sdk/dist/runtime/index.cjs.map +1 -1
- package/packages/sdk/dist/runtime/index.d.mts +4 -4
- package/packages/sdk/dist/runtime/index.d.ts +4 -4
- package/packages/sdk/dist/runtime/index.mjs +157 -87
- package/packages/sdk/dist/runtime/index.mjs.map +1 -1
- package/packages/sdk/dist/runtime/react.cjs +16 -1
- package/packages/sdk/dist/runtime/react.cjs.map +1 -1
- package/packages/sdk/dist/runtime/react.d.mts +17 -2
- package/packages/sdk/dist/runtime/react.d.ts +17 -2
- package/packages/sdk/dist/runtime/react.mjs +16 -1
- package/packages/sdk/dist/runtime/react.mjs.map +1 -1
- package/templates/openxiangda-react-spa/src/pages/defaults/FormRoutePage.tsx +9 -0
|
@@ -6161,6 +6161,12 @@ var OpenXiangdaProvider = ({
|
|
|
6161
6161
|
() => createAuthorizedFetch(resolvedFetch, accessToken),
|
|
6162
6162
|
[accessToken, resolvedFetch]
|
|
6163
6163
|
);
|
|
6164
|
+
const getAuthHeaders = (0, import_react14.useCallback)(() => {
|
|
6165
|
+
const state2 = accessTokenRef.current;
|
|
6166
|
+
if (!state2) return {};
|
|
6167
|
+
const token = resolveAccessTokenForCurrentRoute(state2);
|
|
6168
|
+
return token ? { authorization: `Bearer ${token}` } : {};
|
|
6169
|
+
}, []);
|
|
6164
6170
|
const [state, setState] = (0, import_react14.useState)({
|
|
6165
6171
|
data: null,
|
|
6166
6172
|
loading: true,
|
|
@@ -6230,10 +6236,19 @@ var OpenXiangdaProvider = ({
|
|
|
6230
6236
|
servicePrefix,
|
|
6231
6237
|
fetchImpl: authorizedFetch,
|
|
6232
6238
|
baseFetchImpl: resolvedFetch,
|
|
6239
|
+
getAuthHeaders,
|
|
6233
6240
|
reload,
|
|
6234
6241
|
setAccessToken
|
|
6235
6242
|
}),
|
|
6236
|
-
[
|
|
6243
|
+
[
|
|
6244
|
+
authorizedFetch,
|
|
6245
|
+
getAuthHeaders,
|
|
6246
|
+
reload,
|
|
6247
|
+
resolvedAppType,
|
|
6248
|
+
resolvedFetch,
|
|
6249
|
+
servicePrefix,
|
|
6250
|
+
state
|
|
6251
|
+
]
|
|
6237
6252
|
);
|
|
6238
6253
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(OpenXiangdaRuntimeContext.Provider, { value, children });
|
|
6239
6254
|
};
|
|
@@ -7189,7 +7204,31 @@ var parseResponse = async (response) => {
|
|
|
7189
7204
|
message: response.statusText
|
|
7190
7205
|
};
|
|
7191
7206
|
};
|
|
7192
|
-
var
|
|
7207
|
+
var applyAuthHeaders = (headers, getAuthHeaders) => {
|
|
7208
|
+
const authHeaders = getAuthHeaders?.();
|
|
7209
|
+
if (authHeaders) {
|
|
7210
|
+
new Headers(authHeaders).forEach((value, key) => {
|
|
7211
|
+
if (!headers.has(key)) headers.set(key, value);
|
|
7212
|
+
});
|
|
7213
|
+
}
|
|
7214
|
+
const token = typeof window !== "undefined" ? window.localStorage?.getItem("token") : void 0;
|
|
7215
|
+
if (token && !headers.has("authorization")) {
|
|
7216
|
+
headers.set("authorization", token);
|
|
7217
|
+
}
|
|
7218
|
+
};
|
|
7219
|
+
var applyXhrAuthHeaders = (xhr, getAuthHeaders) => {
|
|
7220
|
+
let hasAuthorization = false;
|
|
7221
|
+
const authHeaders = getAuthHeaders?.();
|
|
7222
|
+
if (authHeaders) {
|
|
7223
|
+
new Headers(authHeaders).forEach((value, key) => {
|
|
7224
|
+
if (key.toLowerCase() === "authorization") hasAuthorization = true;
|
|
7225
|
+
xhr.setRequestHeader(key, value);
|
|
7226
|
+
});
|
|
7227
|
+
}
|
|
7228
|
+
const token = typeof window !== "undefined" ? window.localStorage?.getItem("token") : void 0;
|
|
7229
|
+
if (token && !hasAuthorization) xhr.setRequestHeader("authorization", token);
|
|
7230
|
+
};
|
|
7231
|
+
var createDefaultRequest = (baseUrl, fetchImpl = fetch, getAuthHeaders) => async (config) => {
|
|
7193
7232
|
const method = config.method ?? "get";
|
|
7194
7233
|
const url = appendQuery2(joinUrl(baseUrl, config.url), config.params);
|
|
7195
7234
|
const headers = new Headers(config.headers);
|
|
@@ -7202,11 +7241,8 @@ var createDefaultRequest = (baseUrl) => async (config) => {
|
|
|
7202
7241
|
body = JSON.stringify(config.data);
|
|
7203
7242
|
}
|
|
7204
7243
|
}
|
|
7205
|
-
|
|
7206
|
-
|
|
7207
|
-
headers.set("authorization", token);
|
|
7208
|
-
}
|
|
7209
|
-
const response = await fetch(url, {
|
|
7244
|
+
applyAuthHeaders(headers, getAuthHeaders);
|
|
7245
|
+
const response = await fetchImpl(url, {
|
|
7210
7246
|
method,
|
|
7211
7247
|
headers,
|
|
7212
7248
|
body,
|
|
@@ -7274,7 +7310,7 @@ var normalizeUploadData = (data, file, bucketName, baseUrl = "") => {
|
|
|
7274
7310
|
variants
|
|
7275
7311
|
};
|
|
7276
7312
|
};
|
|
7277
|
-
var uploadWithXhr = (baseUrl, file, bucketName, onProgress, options = {}) => new Promise((resolve, reject) => {
|
|
7313
|
+
var uploadWithXhr = (baseUrl, file, bucketName, onProgress, options = {}, getAuthHeaders) => new Promise((resolve, reject) => {
|
|
7278
7314
|
if (globalThis.process?.env?.VITEST) {
|
|
7279
7315
|
onProgress?.(100);
|
|
7280
7316
|
resolve({
|
|
@@ -7304,8 +7340,7 @@ var uploadWithXhr = (baseUrl, file, bucketName, onProgress, options = {}) => new
|
|
|
7304
7340
|
)
|
|
7305
7341
|
);
|
|
7306
7342
|
xhr.withCredentials = true;
|
|
7307
|
-
|
|
7308
|
-
if (token) xhr.setRequestHeader("authorization", token);
|
|
7343
|
+
applyXhrAuthHeaders(xhr, getAuthHeaders);
|
|
7309
7344
|
xhr.upload.onprogress = (event) => {
|
|
7310
7345
|
if (event.lengthComputable) {
|
|
7311
7346
|
onProgress?.(Math.round(event.loaded / event.total * 100));
|
|
@@ -7409,7 +7444,8 @@ async function uploadChunkedFile(request, file, bucketName, baseUrl, onProgress,
|
|
|
7409
7444
|
fileSize: file.size,
|
|
7410
7445
|
chunkSize: DEFAULT_CHUNK_SIZE,
|
|
7411
7446
|
bucketName,
|
|
7412
|
-
visibility: options.visibility
|
|
7447
|
+
visibility: options.visibility,
|
|
7448
|
+
contentType: file.type || void 0
|
|
7413
7449
|
}
|
|
7414
7450
|
});
|
|
7415
7451
|
const uploadInfo = initiate.data || initiate.result;
|
|
@@ -7468,7 +7504,7 @@ var createSegmentProgress = (onProgress, start, end) => (percent) => {
|
|
|
7468
7504
|
onProgress?.(Math.round(next));
|
|
7469
7505
|
};
|
|
7470
7506
|
var getAttachmentUrl = (item) => item.publicUrl || item.previewUrl || item.downloadUrl || item.url || "";
|
|
7471
|
-
async function uploadSingleRuntimeFile(request, baseUrl, file, bucketName, onProgress, options) {
|
|
7507
|
+
async function uploadSingleRuntimeFile(request, baseUrl, file, bucketName, onProgress, options, getAuthHeaders) {
|
|
7472
7508
|
const singleOptions = stripImageCompressionOptions(options);
|
|
7473
7509
|
if (singleOptions.uploadProvider === "builtin-oss") {
|
|
7474
7510
|
return uploadBuiltinOssFile(request, file, bucketName, onProgress, singleOptions);
|
|
@@ -7479,7 +7515,7 @@ async function uploadSingleRuntimeFile(request, baseUrl, file, bucketName, onPro
|
|
|
7479
7515
|
if (file.size > CHUNK_UPLOAD_THRESHOLD) {
|
|
7480
7516
|
return uploadChunkedFile(request, file, bucketName, baseUrl, onProgress);
|
|
7481
7517
|
}
|
|
7482
|
-
return uploadWithXhr(baseUrl, file, bucketName, onProgress);
|
|
7518
|
+
return uploadWithXhr(baseUrl, file, bucketName, onProgress, {}, getAuthHeaders);
|
|
7483
7519
|
}
|
|
7484
7520
|
function toImageVariantMetadata(uploaded, variant) {
|
|
7485
7521
|
return {
|
|
@@ -7493,7 +7529,7 @@ function toImageVariantMetadata(uploaded, variant) {
|
|
|
7493
7529
|
quality: variant.quality
|
|
7494
7530
|
};
|
|
7495
7531
|
}
|
|
7496
|
-
async function uploadFileWithImageVariants(request, baseUrl, file, bucketName, onProgress, options) {
|
|
7532
|
+
async function uploadFileWithImageVariants(request, baseUrl, file, bucketName, onProgress, options, getAuthHeaders) {
|
|
7497
7533
|
let variants = [];
|
|
7498
7534
|
try {
|
|
7499
7535
|
variants = await createCompressedImageVariants(file, options.imageCompression);
|
|
@@ -7501,7 +7537,15 @@ async function uploadFileWithImageVariants(request, baseUrl, file, bucketName, o
|
|
|
7501
7537
|
variants = [];
|
|
7502
7538
|
}
|
|
7503
7539
|
if (variants.length === 0) {
|
|
7504
|
-
return uploadSingleRuntimeFile(
|
|
7540
|
+
return uploadSingleRuntimeFile(
|
|
7541
|
+
request,
|
|
7542
|
+
baseUrl,
|
|
7543
|
+
file,
|
|
7544
|
+
bucketName,
|
|
7545
|
+
onProgress,
|
|
7546
|
+
options,
|
|
7547
|
+
getAuthHeaders
|
|
7548
|
+
);
|
|
7505
7549
|
}
|
|
7506
7550
|
const originalProgressEnd = 70;
|
|
7507
7551
|
const uploaded = await uploadSingleRuntimeFile(
|
|
@@ -7510,7 +7554,8 @@ async function uploadFileWithImageVariants(request, baseUrl, file, bucketName, o
|
|
|
7510
7554
|
file,
|
|
7511
7555
|
bucketName,
|
|
7512
7556
|
createSegmentProgress(onProgress, 0, originalProgressEnd),
|
|
7513
|
-
options
|
|
7557
|
+
options,
|
|
7558
|
+
getAuthHeaders
|
|
7514
7559
|
);
|
|
7515
7560
|
const imageVariants = { ...uploaded.variants || {} };
|
|
7516
7561
|
const variantProgressStep = (100 - originalProgressEnd) / variants.length;
|
|
@@ -7525,7 +7570,8 @@ async function uploadFileWithImageVariants(request, baseUrl, file, bucketName, o
|
|
|
7525
7570
|
variant.file,
|
|
7526
7571
|
bucketName,
|
|
7527
7572
|
createSegmentProgress(onProgress, start, end),
|
|
7528
|
-
options
|
|
7573
|
+
options,
|
|
7574
|
+
getAuthHeaders
|
|
7529
7575
|
);
|
|
7530
7576
|
imageVariants[variant.kind] = toImageVariantMetadata(variantUpload, variant);
|
|
7531
7577
|
} catch {
|
|
@@ -7542,11 +7588,20 @@ async function uploadFileWithImageVariants(request, baseUrl, file, bucketName, o
|
|
|
7542
7588
|
}
|
|
7543
7589
|
function createFormRuntimeApi(config) {
|
|
7544
7590
|
const { baseUrl = getDefaultBaseUrl(), ...overrides } = config ?? {};
|
|
7545
|
-
const
|
|
7591
|
+
const { fetchImpl, getAuthHeaders } = overrides;
|
|
7592
|
+
const request = overrides.request ?? createDefaultRequest(baseUrl, fetchImpl, getAuthHeaders);
|
|
7546
7593
|
const defaults = {
|
|
7547
7594
|
request,
|
|
7548
7595
|
uploadFile: async (file, bucketName = "files", onProgress, options = {}) => {
|
|
7549
|
-
return uploadFileWithImageVariants(
|
|
7596
|
+
return uploadFileWithImageVariants(
|
|
7597
|
+
request,
|
|
7598
|
+
baseUrl,
|
|
7599
|
+
file,
|
|
7600
|
+
bucketName,
|
|
7601
|
+
onProgress,
|
|
7602
|
+
options,
|
|
7603
|
+
getAuthHeaders
|
|
7604
|
+
);
|
|
7550
7605
|
},
|
|
7551
7606
|
uploadPublicFile: async (file, bucketName = DEFAULT_PUBLIC_FILE_BUCKET, onProgress) => {
|
|
7552
7607
|
if (file.size > CHUNK_UPLOAD_THRESHOLD) {
|
|
@@ -7556,7 +7611,7 @@ function createFormRuntimeApi(config) {
|
|
|
7556
7611
|
}
|
|
7557
7612
|
return uploadWithXhr(baseUrl, file, bucketName, onProgress, {
|
|
7558
7613
|
visibility: "public"
|
|
7559
|
-
});
|
|
7614
|
+
}, getAuthHeaders);
|
|
7560
7615
|
},
|
|
7561
7616
|
deleteFile: async (objectName, bucketName = "files", options = {}) => {
|
|
7562
7617
|
if (options.uploadProvider === "builtin-oss" || options.storageScope === "platform") {
|
|
@@ -21494,6 +21549,60 @@ var unwrap = (response) => {
|
|
|
21494
21549
|
return response;
|
|
21495
21550
|
};
|
|
21496
21551
|
var pickData = (value) => value?.data ?? value?.result ?? value;
|
|
21552
|
+
var normalizePlatformComponentName = (componentName) => {
|
|
21553
|
+
const value = String(componentName || "").trim();
|
|
21554
|
+
return value || "TextField";
|
|
21555
|
+
};
|
|
21556
|
+
var extractSlotNodes = (value) => {
|
|
21557
|
+
if (!value) return [];
|
|
21558
|
+
if (Array.isArray(value)) {
|
|
21559
|
+
return value.flatMap((item) => extractSlotNodes(item));
|
|
21560
|
+
}
|
|
21561
|
+
if (typeof value !== "object") return [];
|
|
21562
|
+
if (value.type === "JSSlot" && value.value) {
|
|
21563
|
+
return extractSlotNodes(value.value);
|
|
21564
|
+
}
|
|
21565
|
+
if (value.componentName || Array.isArray(value.children)) {
|
|
21566
|
+
return [value];
|
|
21567
|
+
}
|
|
21568
|
+
return Object.values(value).flatMap((item) => extractSlotNodes(item));
|
|
21569
|
+
};
|
|
21570
|
+
var extractFieldsFromComponentsTree = (componentsTree) => {
|
|
21571
|
+
const roots = Array.isArray(componentsTree) ? componentsTree : [componentsTree];
|
|
21572
|
+
const fields = [];
|
|
21573
|
+
const seen = /* @__PURE__ */ new Set();
|
|
21574
|
+
const walk = (components) => {
|
|
21575
|
+
if (!Array.isArray(components)) return;
|
|
21576
|
+
components.forEach((component) => {
|
|
21577
|
+
if (!component || typeof component !== "object") return;
|
|
21578
|
+
const props = component.props || {};
|
|
21579
|
+
const fieldId = String(props.fieldId || component.fieldId || component.id || "").trim();
|
|
21580
|
+
if (props.isFormComponent === true && fieldId && !seen.has(fieldId)) {
|
|
21581
|
+
seen.add(fieldId);
|
|
21582
|
+
fields.push({
|
|
21583
|
+
...props,
|
|
21584
|
+
id: props.id || component.id || fieldId,
|
|
21585
|
+
fieldId,
|
|
21586
|
+
componentName: normalizePlatformComponentName(
|
|
21587
|
+
props.componentName || component.componentName
|
|
21588
|
+
),
|
|
21589
|
+
label: props.label || component.title || props.title || fieldId,
|
|
21590
|
+
title: props.title || component.title || props.label || fieldId,
|
|
21591
|
+
required: props.required ?? component.required
|
|
21592
|
+
});
|
|
21593
|
+
}
|
|
21594
|
+
if (component.componentName === "SubFormField") return;
|
|
21595
|
+
if (Array.isArray(component.children)) {
|
|
21596
|
+
walk(component.children);
|
|
21597
|
+
}
|
|
21598
|
+
Object.values(props).forEach((propValue) => {
|
|
21599
|
+
walk(extractSlotNodes(propValue));
|
|
21600
|
+
});
|
|
21601
|
+
});
|
|
21602
|
+
};
|
|
21603
|
+
walk(roots);
|
|
21604
|
+
return fields;
|
|
21605
|
+
};
|
|
21497
21606
|
var normalizeActionSummary = (value) => {
|
|
21498
21607
|
const raw = pickData(value) || {};
|
|
21499
21608
|
const actions = Array.from(
|
|
@@ -21522,6 +21631,11 @@ var normalizeField = (key, field, system = false) => ({
|
|
|
21522
21631
|
width: field?.width,
|
|
21523
21632
|
system
|
|
21524
21633
|
});
|
|
21634
|
+
var createDefaultLayout = (fields) => fields.map((field) => ({
|
|
21635
|
+
id: `layout_${field.fieldId}`,
|
|
21636
|
+
type: "field",
|
|
21637
|
+
fieldId: field.fieldId
|
|
21638
|
+
}));
|
|
21525
21639
|
var SYSTEM_VALUE_ALIASES = {
|
|
21526
21640
|
formInstanceId: ["formInstanceId", "formInstId", "form_instance_id", "processInstanceId"],
|
|
21527
21641
|
instanceTitle: ["instanceTitle", "instance_title", "processInstanceTitle", "title"],
|
|
@@ -21635,20 +21749,25 @@ var BASE_SYSTEM_FIELDS = [
|
|
|
21635
21749
|
)
|
|
21636
21750
|
];
|
|
21637
21751
|
var getSystemFieldsForFormType = (formType) => formType === "process" ? [...BASE_SYSTEM_FIELDS, ...PROCESS_SYSTEM_FIELDS] : BASE_SYSTEM_FIELDS;
|
|
21638
|
-
var normalizeDataManagementFields = (payload) => {
|
|
21752
|
+
var normalizeDataManagementFields = (payload, options = {}) => {
|
|
21639
21753
|
const data = pickData(payload);
|
|
21640
21754
|
const rawSchema = data?.schema || data?.formSchema || data?.publishedSchema || data;
|
|
21641
|
-
const schemaAppType = rawSchema?.formMeta?.appType || data?.appType;
|
|
21642
|
-
const schemaFormUuid = rawSchema?.formMeta?.formUuid || data?.formUuid;
|
|
21643
|
-
const schemaTitle = rawSchema?.formMeta?.title || data?.title || data?.name || data?.formName || schemaFormUuid;
|
|
21644
|
-
const formType = data?.formType || data?.schema?.formType || data?.schema?.template?.formType || rawSchema?.template?.formType || data?.type;
|
|
21645
|
-
const rawFields = data?.formFields || data?.schema?.formFields || data?.fields || data?.schema?.fields || data?.formSchema?.fields || [];
|
|
21646
|
-
const
|
|
21755
|
+
const schemaAppType = rawSchema?.formMeta?.appType || rawSchema?.appType || data?.appType || options.appType;
|
|
21756
|
+
const schemaFormUuid = rawSchema?.formMeta?.formUuid || rawSchema?.formUuid || data?.formUuid || options.formUuid;
|
|
21757
|
+
const schemaTitle = rawSchema?.formMeta?.title || rawSchema?.title || data?.title || data?.name || data?.formName || schemaFormUuid;
|
|
21758
|
+
const formType = data?.formType || data?.schema?.formType || data?.schema?.template?.formType || rawSchema?.formType || rawSchema?.template?.formType || data?.type;
|
|
21759
|
+
const rawFields = data?.formFields || data?.schema?.formFields || rawSchema?.formFields || data?.fields || data?.schema?.fields || data?.formSchema?.fields || rawSchema?.fields || [];
|
|
21760
|
+
const extractedFields = Array.isArray(rawFields) && rawFields.length === 0 && rawSchema?.componentsTree ? extractFieldsFromComponentsTree(rawSchema.componentsTree) : rawFields;
|
|
21761
|
+
const fields = (Array.isArray(extractedFields) ? extractedFields.map((field) => normalizeField(field?.fieldId || field?.id, field)) : Object.entries(extractedFields).map(([key, field]) => normalizeField(key, field))).filter((field) => field.componentName !== "PageSection");
|
|
21762
|
+
const schemaFields = Array.isArray(rawSchema?.fields) ? rawSchema.fields : fields;
|
|
21763
|
+
const hasSchemaFields = Array.isArray(rawSchema?.fields) || fields.length > 0;
|
|
21647
21764
|
return {
|
|
21648
|
-
fields
|
|
21765
|
+
fields,
|
|
21649
21766
|
formType,
|
|
21650
|
-
schema: rawSchema &&
|
|
21767
|
+
schema: rawSchema && hasSchemaFields && schemaAppType && schemaFormUuid ? {
|
|
21651
21768
|
...rawSchema,
|
|
21769
|
+
fields: schemaFields,
|
|
21770
|
+
layout: rawSchema.layout || createDefaultLayout(fields),
|
|
21652
21771
|
formMeta: {
|
|
21653
21772
|
formUuid: schemaFormUuid,
|
|
21654
21773
|
appType: schemaAppType,
|
|
@@ -21739,7 +21858,7 @@ async function getDataManagementSchema(request, params) {
|
|
|
21739
21858
|
method: "get",
|
|
21740
21859
|
params
|
|
21741
21860
|
});
|
|
21742
|
-
const result = normalizeDataManagementFields(response);
|
|
21861
|
+
const result = normalizeDataManagementFields(response, params);
|
|
21743
21862
|
if (result.schema) {
|
|
21744
21863
|
result.schema = {
|
|
21745
21864
|
...result.schema,
|
|
@@ -22823,6 +22942,7 @@ var DataManagementList = ({
|
|
|
22823
22942
|
title,
|
|
22824
22943
|
formTitle,
|
|
22825
22944
|
formType: propFormType,
|
|
22945
|
+
schema: providedSchema,
|
|
22826
22946
|
forcedConfig,
|
|
22827
22947
|
showForcedConfig = true,
|
|
22828
22948
|
detailRenderer,
|
|
@@ -23040,7 +23160,10 @@ var DataManagementList = ({
|
|
|
23040
23160
|
setTotal(0);
|
|
23041
23161
|
setSelectedRowKeys([]);
|
|
23042
23162
|
try {
|
|
23043
|
-
const schemaResult =
|
|
23163
|
+
const schemaResult = providedSchema ? normalizeDataManagementFields(
|
|
23164
|
+
{ appType, formUuid, schema: providedSchema },
|
|
23165
|
+
{ appType, formUuid }
|
|
23166
|
+
) : await getDataManagementSchema(request, { appType, formUuid });
|
|
23044
23167
|
if (!mounted) return;
|
|
23045
23168
|
const allFields = uniqueFields([
|
|
23046
23169
|
...schemaResult.fields,
|
|
@@ -23116,6 +23239,7 @@ var DataManagementList = ({
|
|
|
23116
23239
|
loadData,
|
|
23117
23240
|
menuFormUuid,
|
|
23118
23241
|
propFormType,
|
|
23242
|
+
providedSchema,
|
|
23119
23243
|
request,
|
|
23120
23244
|
title
|
|
23121
23245
|
]);
|
|
@@ -24062,61 +24186,7 @@ var DataManagementList = ({
|
|
|
24062
24186
|
};
|
|
24063
24187
|
|
|
24064
24188
|
// packages/sdk/src/runtime/host/formSchema.ts
|
|
24065
|
-
var
|
|
24066
|
-
const value = String(componentName || "").trim();
|
|
24067
|
-
return value || "TextField";
|
|
24068
|
-
};
|
|
24069
|
-
var extractSlotNodes = (value) => {
|
|
24070
|
-
if (!value) return [];
|
|
24071
|
-
if (Array.isArray(value)) {
|
|
24072
|
-
return value.flatMap((item) => extractSlotNodes(item));
|
|
24073
|
-
}
|
|
24074
|
-
if (typeof value !== "object") return [];
|
|
24075
|
-
if (value.type === "JSSlot" && value.value) {
|
|
24076
|
-
return extractSlotNodes(value.value);
|
|
24077
|
-
}
|
|
24078
|
-
if (value.componentName || Array.isArray(value.children)) {
|
|
24079
|
-
return [value];
|
|
24080
|
-
}
|
|
24081
|
-
return Object.values(value).flatMap((item) => extractSlotNodes(item));
|
|
24082
|
-
};
|
|
24083
|
-
var extractFieldsFromComponentsTree = (componentsTree) => {
|
|
24084
|
-
const roots = Array.isArray(componentsTree) ? componentsTree : [componentsTree];
|
|
24085
|
-
const fields = [];
|
|
24086
|
-
const seen = /* @__PURE__ */ new Set();
|
|
24087
|
-
const walk = (components) => {
|
|
24088
|
-
if (!Array.isArray(components)) return;
|
|
24089
|
-
components.forEach((component) => {
|
|
24090
|
-
if (!component || typeof component !== "object") return;
|
|
24091
|
-
const props = component.props || {};
|
|
24092
|
-
const fieldId = String(props.fieldId || component.fieldId || component.id || "").trim();
|
|
24093
|
-
if (props.isFormComponent === true && fieldId && !seen.has(fieldId)) {
|
|
24094
|
-
seen.add(fieldId);
|
|
24095
|
-
fields.push({
|
|
24096
|
-
...props,
|
|
24097
|
-
id: props.id || component.id || fieldId,
|
|
24098
|
-
fieldId,
|
|
24099
|
-
componentName: normalizePlatformComponentName(
|
|
24100
|
-
props.componentName || component.componentName
|
|
24101
|
-
),
|
|
24102
|
-
label: props.label || component.title || props.title || fieldId,
|
|
24103
|
-
title: props.title || component.title || props.label || fieldId,
|
|
24104
|
-
required: props.required ?? component.required
|
|
24105
|
-
});
|
|
24106
|
-
}
|
|
24107
|
-
if (component.componentName === "SubFormField") return;
|
|
24108
|
-
if (Array.isArray(component.children)) {
|
|
24109
|
-
walk(component.children);
|
|
24110
|
-
}
|
|
24111
|
-
Object.values(props).forEach((propValue) => {
|
|
24112
|
-
walk(extractSlotNodes(propValue));
|
|
24113
|
-
});
|
|
24114
|
-
});
|
|
24115
|
-
};
|
|
24116
|
-
walk(roots);
|
|
24117
|
-
return fields;
|
|
24118
|
-
};
|
|
24119
|
-
var createDefaultLayout = (fields) => fields.map((field) => ({
|
|
24189
|
+
var createDefaultLayout2 = (fields) => fields.map((field) => ({
|
|
24120
24190
|
id: `layout_${field.fieldId}`,
|
|
24121
24191
|
type: "field",
|
|
24122
24192
|
fieldId: field.fieldId
|
|
@@ -24132,7 +24202,7 @@ var normalizeRuntimeFormSchema = (payload, options) => {
|
|
|
24132
24202
|
return {
|
|
24133
24203
|
...rawSchema,
|
|
24134
24204
|
fields,
|
|
24135
|
-
layout: rawSchema.layout ||
|
|
24205
|
+
layout: rawSchema.layout || createDefaultLayout2(fields),
|
|
24136
24206
|
formMeta: {
|
|
24137
24207
|
appType: options.appType,
|
|
24138
24208
|
formUuid: options.formUuid,
|