fix: 修复管理端前端 lint 与构建问题

- 收敛 easyflow-ui-admin 的 lint、格式和类型问题

- 修正 demo 页面与管理端前端构建失败点

- 验证 pnpm lint 与 pnpm build 均已通过
This commit is contained in:
2026-04-05 21:39:13 +08:00
parent bb72e19c84
commit 7e7c236c2a
240 changed files with 5151 additions and 4701 deletions

View File

@@ -3,9 +3,11 @@ import type {
ManagedDatasetOption,
ManagedDatasetSourceOption,
} from './datasetOptions';
import huaweiIcon from '#/assets/datacenter/huawei-icon.svg';
import mysqlIcon from '#/assets/datacenter/mysql-icon.svg';
import postgresqlIcon from '#/assets/datacenter/postgresql-icon.svg';
import {
groupManagedDatasetOptions,
loadManagedDatasetOptions,
@@ -24,15 +26,15 @@ const SOURCE_LOGO_MAP: Record<string, string> = {
};
type NodeLike = {
id: string;
data?: Record<string, any>;
id: string;
};
type UpdateNodeData = (
nodeId: string,
data:
| Record<string, any>
| ((node: Record<string, any>) => Record<string, any>),
| ((node: Record<string, any>) => Record<string, any>)
| Record<string, any>,
) => void;
type FlowInstance = {
@@ -42,10 +44,10 @@ type FlowInstance = {
type RenderContext = FlowInstance | undefined;
type RendererState = {
pickerOpen: boolean;
loadingOptions: boolean;
optionsLoaded: boolean;
options: ManagedDatasetOption[];
optionsLoaded: boolean;
pickerOpen: boolean;
sources: ManagedDatasetSourceOption[];
tableSearchText: string;
updateNodeData?: UpdateNodeData;
@@ -75,11 +77,13 @@ function getUpdateNodeData(parent: HTMLElement, flowInstance?: RenderContext) {
}
function getDatasetKey(datasetRef?: DatasetRefPayload | null) {
return datasetRef?.tableId == null ? '' : String(datasetRef.tableId);
const tableId = datasetRef?.tableId;
return tableId === null || tableId === undefined ? '' : String(tableId);
}
function getSourceKey(datasetRef?: DatasetRefPayload | null) {
return datasetRef?.sourceId == null ? '' : String(datasetRef.sourceId);
const sourceId = datasetRef?.sourceId;
return sourceId === null || sourceId === undefined ? '' : String(sourceId);
}
function createSourceOnlyDatasetRef(
@@ -95,7 +99,7 @@ function createSourceOnlyDatasetRef(
};
}
function escapeHtml(value?: string | number | null) {
function escapeHtml(value?: null | number | string) {
return String(value ?? '')
.replaceAll('&', '&amp;')
.replaceAll('<', '&lt;')
@@ -410,7 +414,7 @@ function buildSourceList(
activeKey: string,
emptyText: string,
) {
if (!options.length) {
if (options.length === 0) {
return `<div class="dataset-node-empty">${emptyText}</div>`;
}
return options
@@ -432,7 +436,7 @@ function buildTableList(
activeKey: string,
emptyText: string,
) {
if (!options.length) {
if (options.length === 0) {
return `<div class="dataset-node-empty">${emptyText}</div>`;
}
return options
@@ -465,8 +469,10 @@ function bindInteractiveElements(parent: HTMLElement) {
parent
.querySelectorAll<HTMLElement>('button, input, select, textarea')
.forEach((element) => {
element.onpointerdown = (event) => event.stopPropagation();
element.onmousedown = (event) => event.stopPropagation();
element.addEventListener('pointerdown', (event) =>
event.stopPropagation(),
);
element.addEventListener('mousedown', (event) => event.stopPropagation());
});
}
@@ -539,7 +545,7 @@ export function rerenderSearchNode(
state.pickerOpen = false;
const nextDatasetRef = createSourceOnlyDatasetRef(source);
node.data = {
...(node.data || {}),
...node.data,
datasetRef: nextDatasetRef,
sourceName: source.sourceName,
sourceType: source.sourceType,
@@ -606,7 +612,7 @@ export function rerenderSaveNode(
return;
}
node.data = {
...(node.data || {}),
...node.data,
datasetRef: option.datasetRef,
sourceName: option.sourceName,
sourceType: option.sourceType,