openxiangda 1.0.46 → 1.0.48
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/package.json +1 -1
- package/packages/sdk/dist/components/index.cjs +5 -0
- package/packages/sdk/dist/components/index.cjs.map +1 -1
- package/packages/sdk/dist/components/index.mjs +5 -0
- package/packages/sdk/dist/components/index.mjs.map +1 -1
- package/packages/sdk/dist/runtime/index.cjs +69 -1
- package/packages/sdk/dist/runtime/index.cjs.map +1 -1
- package/packages/sdk/dist/runtime/index.mjs +69 -1
- package/packages/sdk/dist/runtime/index.mjs.map +1 -1
|
@@ -43947,6 +43947,11 @@ var normalizeBasePath = (basePath) => {
|
|
|
43947
43947
|
var inferBasePath = (appType) => {
|
|
43948
43948
|
if (typeof window === "undefined") return "";
|
|
43949
43949
|
const pathname = window.location?.pathname || "";
|
|
43950
|
+
const submitMarker = `/submit/${appType}/`;
|
|
43951
|
+
const submitMarkerIndex = pathname.indexOf(submitMarker);
|
|
43952
|
+
if (submitMarkerIndex > 0) {
|
|
43953
|
+
return pathname.slice(0, submitMarkerIndex);
|
|
43954
|
+
}
|
|
43950
43955
|
const marker = `/${appType}/`;
|
|
43951
43956
|
const markerIndex = pathname.indexOf(marker);
|
|
43952
43957
|
if (markerIndex <= 0) return "";
|
|
@@ -49036,14 +49041,77 @@ var isProcessKind = (kind, formType) => {
|
|
|
49036
49041
|
const raw = String(formType || "").toLowerCase();
|
|
49037
49042
|
return kind === "process-submit" || kind === "process-detail" || raw === "process" || raw === "flow";
|
|
49038
49043
|
};
|
|
49044
|
+
var normalizePlatformComponentName = (componentName) => {
|
|
49045
|
+
const value = String(componentName || "").trim();
|
|
49046
|
+
return value || "TextField";
|
|
49047
|
+
};
|
|
49048
|
+
var extractSlotNodes = (value) => {
|
|
49049
|
+
if (!value) return [];
|
|
49050
|
+
if (Array.isArray(value)) {
|
|
49051
|
+
return value.flatMap((item) => extractSlotNodes(item));
|
|
49052
|
+
}
|
|
49053
|
+
if (typeof value !== "object") return [];
|
|
49054
|
+
if (value.type === "JSSlot" && value.value) {
|
|
49055
|
+
return extractSlotNodes(value.value);
|
|
49056
|
+
}
|
|
49057
|
+
if (value.componentName || Array.isArray(value.children)) {
|
|
49058
|
+
return [value];
|
|
49059
|
+
}
|
|
49060
|
+
return Object.values(value).flatMap((item) => extractSlotNodes(item));
|
|
49061
|
+
};
|
|
49062
|
+
var extractFieldsFromComponentsTree = (componentsTree) => {
|
|
49063
|
+
const roots = Array.isArray(componentsTree) ? componentsTree : [componentsTree];
|
|
49064
|
+
const fields = [];
|
|
49065
|
+
const seen = /* @__PURE__ */ new Set();
|
|
49066
|
+
const walk = (components) => {
|
|
49067
|
+
if (!Array.isArray(components)) return;
|
|
49068
|
+
components.forEach((component) => {
|
|
49069
|
+
if (!component || typeof component !== "object") return;
|
|
49070
|
+
const props = component.props || {};
|
|
49071
|
+
const fieldId = String(props.fieldId || component.fieldId || component.id || "").trim();
|
|
49072
|
+
if (props.isFormComponent === true && fieldId && !seen.has(fieldId)) {
|
|
49073
|
+
seen.add(fieldId);
|
|
49074
|
+
fields.push({
|
|
49075
|
+
...props,
|
|
49076
|
+
id: props.id || component.id || fieldId,
|
|
49077
|
+
fieldId,
|
|
49078
|
+
componentName: normalizePlatformComponentName(
|
|
49079
|
+
props.componentName || component.componentName
|
|
49080
|
+
),
|
|
49081
|
+
label: props.label || component.title || props.title || fieldId,
|
|
49082
|
+
title: props.title || component.title || props.label || fieldId,
|
|
49083
|
+
required: props.required ?? component.required
|
|
49084
|
+
});
|
|
49085
|
+
}
|
|
49086
|
+
if (component.componentName === "SubFormField") return;
|
|
49087
|
+
if (Array.isArray(component.children)) {
|
|
49088
|
+
walk(component.children);
|
|
49089
|
+
}
|
|
49090
|
+
Object.values(props).forEach((propValue) => {
|
|
49091
|
+
walk(extractSlotNodes(propValue));
|
|
49092
|
+
});
|
|
49093
|
+
});
|
|
49094
|
+
};
|
|
49095
|
+
walk(roots);
|
|
49096
|
+
return fields;
|
|
49097
|
+
};
|
|
49098
|
+
var createDefaultLayout = (fields) => fields.map((field) => ({
|
|
49099
|
+
id: `layout_${field.fieldId}`,
|
|
49100
|
+
type: "field",
|
|
49101
|
+
fieldId: field.fieldId
|
|
49102
|
+
}));
|
|
49039
49103
|
var normalizeSchema = (payload, appType, formUuid) => {
|
|
49040
49104
|
const normalized = normalizeDataManagementFields(payload);
|
|
49041
49105
|
if (normalized.schema) return normalized.schema;
|
|
49042
49106
|
const body = payload?.data ?? payload?.result ?? payload;
|
|
49043
49107
|
const rawSchema = body?.schema || body?.formSchema || body?.publishedSchema || body;
|
|
49044
|
-
if (!rawSchema
|
|
49108
|
+
if (!rawSchema) return void 0;
|
|
49109
|
+
const fields = Array.isArray(rawSchema.fields) ? rawSchema.fields : extractFieldsFromComponentsTree(rawSchema.componentsTree);
|
|
49110
|
+
if (!Array.isArray(fields) || fields.length === 0) return void 0;
|
|
49045
49111
|
return {
|
|
49046
49112
|
...rawSchema,
|
|
49113
|
+
fields,
|
|
49114
|
+
layout: rawSchema.layout || createDefaultLayout(fields),
|
|
49047
49115
|
formMeta: {
|
|
49048
49116
|
appType,
|
|
49049
49117
|
formUuid,
|