feat: 重构文件上传部分逻辑,实现分片上传以及取消上传等功能

This commit is contained in:
Pan Qiancheng 2025-12-26 12:16:22 +08:00
parent ffcac7f843
commit d5a09546dd
236 changed files with 3433 additions and 525 deletions

View File

@ -739,5 +739,12 @@ export type AspectDict<ED extends EntityDict> = {
setUserAvatarFromWechat: (params: {
avatar: string;
}, context: BackendRuntimeContext<ED>) => Promise<void>;
/**
*
* @param extraFileId extraFile的id
*/
mergeChunkedUpload: (params: {
extraFileId: string;
}, context: BackendRuntimeContext<ED>) => Promise<void>;
};
export default AspectDict;

View File

@ -16,3 +16,9 @@ export declare function uploadExtraFile<ED extends EntityDict>(params: {
context: BRC<ED>): Promise<{
success: boolean;
}>;
/**
*
*/
export declare function mergeChunkedUpload<ED extends EntityDict>(params: {
extraFileId: string;
}, context: BRC<ED>): Promise<void>;

View File

@ -3,7 +3,8 @@ import { generateNewIdAsync } from 'oak-domain/lib/utils/uuid';
import fs from 'fs';
import { assert } from 'oak-domain/lib/utils/assert';
import { cloneDeep } from 'oak-domain/lib/utils/lodash';
import { applicationProjection } from '../types/Projection';
import { applicationProjection, extraFileProjection } from '../types/Projection';
import { getCosBackend } from '../utils/cos/index.backend';
// 请求链接获取标题,发布时间,图片等信息
export async function getInfoByUrl(params) {
const { url } = params;
@ -49,3 +50,52 @@ context) {
success: true,
};
}
/**
* 合并分片上传的文件
*/
export async function mergeChunkedUpload(params, context) {
const { extraFileId } = params;
assert(extraFileId, 'extraFileId不能为空');
const [extrafile] = await context.select('extraFile', {
data: {
...extraFileProjection,
application: {
...applicationProjection,
}
},
filter: {
id: extraFileId,
}
}, { dontCollect: true });
assert(extrafile, `找不到id为${extraFileId}的extraFile记录`);
assert(extrafile.enableChunkedUpload, `extraFile ${extraFileId} 未启用分片上传功能`);
assert(extrafile.chunkInfo, `extraFile ${extraFileId} 的chunkInfo信息缺失`);
assert(!extrafile.chunkInfo.merged, `extraFile ${extraFileId} 已经合并过分片,无需重复合并`);
// 必须保证所有分片都有上传完成
const allPartsDone = extrafile.chunkInfo.parts.every(part => part.etag);
assert(allPartsDone, `extraFile ${extraFileId} 存在未上传完成的分片,无法合并`);
const cos = getCosBackend(extrafile.origin);
await cos.mergeChunkedUpload(extrafile.application, extrafile, context);
// 更新chunkInfo状态
const closeRootMode = context.openRootMode();
try {
await context.operate('extraFile', {
id: await generateNewIdAsync(),
action: 'update',
data: {
chunkInfo: {
...extrafile.chunkInfo,
merged: true,
},
},
filter: {
id: extraFileId,
},
}, {});
closeRootMode();
}
catch (err) {
closeRootMode();
throw err;
}
}

View File

@ -1,5 +1,5 @@
import { bindByEmail, bindByMobile, loginByAccount, loginByEmail, loginByMobile, loginWechat, loginWechatMp, loginWechatNative, syncUserInfoWechatMp, sendCaptchaByMobile, sendCaptchaByEmail, switchTo, refreshWechatPublicUserInfo, getWechatMpUserPhoneNumber, logout, loginByWechat, wakeupParasite, refreshToken, verifyPassword, loginWebByMpToken, setUserAvatarFromWechat } from './token';
import { getInfoByUrl } from './extraFile';
import { getInfoByUrl, mergeChunkedUpload } from './extraFile';
import { getApplication, signatureJsSDK, uploadWechatMedia, batchGetArticle, getArticle, batchGetMaterialList, getMaterial, deleteMaterial } from './application';
import { updateConfig, updateApplicationConfig, updateStyle } from './config';
import { syncWechatTemplate, getMessageType } from './template';
@ -86,6 +86,7 @@ declare const aspectDict: {
createOAuthState: typeof createOAuthState;
authorize: typeof authorize;
setUserAvatarFromWechat: typeof setUserAvatarFromWechat;
mergeChunkedUpload: typeof mergeChunkedUpload;
};
export default aspectDict;
export { AspectDict } from './AspectDict';

View File

@ -1,5 +1,5 @@
import { bindByEmail, bindByMobile, loginByAccount, loginByEmail, loginByMobile, loginWechat, loginWechatMp, loginWechatNative, syncUserInfoWechatMp, sendCaptchaByMobile, sendCaptchaByEmail, switchTo, refreshWechatPublicUserInfo, getWechatMpUserPhoneNumber, logout, loginByWechat, wakeupParasite, refreshToken, verifyPassword, loginWebByMpToken, setUserAvatarFromWechat, } from './token';
import { getInfoByUrl } from './extraFile';
import { getInfoByUrl, mergeChunkedUpload } from './extraFile';
import { getApplication, signatureJsSDK, uploadWechatMedia, batchGetArticle, getArticle, batchGetMaterialList, getMaterial, deleteMaterial, } from './application';
import { updateConfig, updateApplicationConfig, updateStyle } from './config';
import { syncWechatTemplate, getMessageType } from './template';
@ -87,5 +87,6 @@ const aspectDict = {
createOAuthState,
authorize,
setUserAvatarFromWechat,
mergeChunkedUpload,
};
export default aspectDict;

View File

@ -19,6 +19,6 @@ export declare function syncWechatTemplate<ED extends EntityDict>(params: {
example: string;
keywordEnumValueList: {
keywordCode: string;
enumValueList: string[];
enumValueList: Array<string>;
}[];
}[]>;

View File

@ -2562,8 +2562,8 @@ export async function refreshToken(params, context) {
// 只有server模式去刷新token
// 'development' | 'production' | 'staging'
const intervals = {
development: 7200 * 1000,
staging: 600 * 1000,
development: 7200 * 1000, // 2小时
staging: 600 * 1000, // 十分钟
production: 600 * 1000, // 十分钟
};
let applicationId = token.applicationId;

View File

@ -1,3 +1,2 @@
/// <reference types="wechat-miniprogram" />
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, "address", true, WechatMiniprogram.Component.DataOption>) => React.ReactElement;
export default _default;

View File

@ -1,3 +1,2 @@
/// <reference types="wechat-miniprogram" />
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, "address", false, WechatMiniprogram.Component.DataOption>) => React.ReactElement;
export default _default;

View File

@ -1,4 +1,3 @@
/// <reference types="@uiw/react-amap-types" />
import React from 'react';
export type PositionProps = {
loadUI: boolean;

View File

@ -1,4 +1,3 @@
/// <reference types="@uiw/react-amap-types" />
import React from 'react';
import { ModalProps } from 'antd';
import { GeolocationProps } from '@uiw/react-amap';

View File

@ -1,4 +1,3 @@
/// <reference types="@uiw/react-amap-types" />
import React from 'react';
import { MapProps, APILoaderConfig } from '@uiw/react-amap';
import './index.less';

View File

@ -2,7 +2,7 @@ import React from 'react';
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../oak-app-domain';
declare const Cos: (props: WebComponentProps<EntityDict, keyof EntityDict, false, {
currentConfig: EntityDict['application']['OpSchema']['config'];
currentConfig: EntityDict["application"]["OpSchema"]["config"];
dirty: boolean;
entity: string;
name: string;

View File

@ -1,3 +1,2 @@
/// <reference types="wechat-miniprogram" />
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, "application", false, WechatMiniprogram.Component.DataOption>) => React.ReactElement;
export default _default;

View File

@ -1,3 +1,2 @@
/// <reference types="wechat-miniprogram" />
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, "application", false, WechatMiniprogram.Component.DataOption>) => React.ReactElement;
export default _default;

View File

@ -1,4 +1,3 @@
/// <reference types="wechat-miniprogram" />
import { EntityDict } from '../../../oak-app-domain';
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<EntityDict, "application", false, WechatMiniprogram.Component.DataOption>) => React.ReactElement;
export default _default;

View File

@ -1,3 +1,2 @@
/// <reference types="wechat-miniprogram" />
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, "article", false, WechatMiniprogram.Component.DataOption>) => React.ReactElement;
export default _default;

View File

@ -5,7 +5,7 @@ declare const _default: (props: import("oak-frontend-base").ReactComponentProps<
tocPosition: "none" | "left" | "right";
highlightBgColor: string;
onArticlePreview: (content?: string, title?: string) => void;
origin: import("../../../types/Config").CosOrigin | null;
origin: null | EntityDict["extraFile"]["Schema"]["origin"];
scrollId: string;
height: number | "auto";
activeColor: string | undefined;

View File

@ -79,7 +79,10 @@ export default OakComponent({
},
methods: {
async uploadFile(extraFile, file) {
const result = await this.features.extraFile.autoUpload(extraFile, file);
const result = await this.features.extraFile.autoUpload({
extraFile: extraFile,
file: file
});
return result;
},
setEditor(editor) {

View File

@ -1,10 +1,9 @@
/// <reference types="react" />
import { GenerateUrlFn } from "../../../types/Article";
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, "article", true, {
entityId: string;
articleMenuId: string | undefined;
generateUrl: GenerateUrlFn;
empty: import("react").ReactNode;
empty: React.ReactNode | undefined;
menuCheck: (isArticle: boolean) => void;
}>) => React.ReactElement;
export default _default;

View File

@ -1,7 +1,7 @@
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, "article", true, {
articleMenuId: string | undefined;
onChildEditArticleChange: (data: string) => void;
show: "preview" | "doc" | "edit";
show: "edit" | "doc" | "preview";
getBreadcrumbItemsByParent: (breadcrumbItems: string[]) => void;
breadcrumbItems: string[];
drawerOpen: boolean;

View File

@ -5,7 +5,7 @@ declare const _default: (props: import("oak-frontend-base").ReactComponentProps<
tocPosition: "none" | "left" | "right";
highlightBgColor: string;
onArticlePreview: (content?: string, title?: string) => void;
origin: import("../../../types/Config").CosOrigin | null;
origin: EntityDict["extraFile"]["Schema"]["origin"] | null;
scrollId: string;
height: number | "auto";
activeColor: string | undefined;

View File

@ -25,11 +25,11 @@ export default OakComponent({
properties: {
articleMenuId: '',
changeIsEdit: () => undefined,
tocPosition: 'none',
highlightBgColor: 'none',
onArticlePreview: (content, title) => undefined,
origin: null,
scrollId: '',
tocPosition: 'none', //目录显示位置none为不显示目录
highlightBgColor: 'none', //点击目录时标题高亮背景色none为不显示高亮背景色
onArticlePreview: (content, title) => undefined, //预览文章
origin: null, // 默认为七牛云
scrollId: '', // 滚动条所在容器id不传默认页面编辑器容器id
height: 600,
activeColor: undefined,
},
@ -75,7 +75,10 @@ export default OakComponent({
},
methods: {
async uploadFile(extraFile, file) {
const result = await this.features.extraFile.autoUpload(extraFile, file);
const result = await this.features.extraFile.autoUpload({
extraFile: extraFile,
file: file
});
return result;
},
setEditor(editor) {

View File

@ -1,13 +1,12 @@
/// <reference types="react" />
import { EntityDict } from "../../../oak-app-domain";
import { GenerateUrlFn } from "../../../types/Article";
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<EntityDict, keyof EntityDict, false, {
entity: string;
entityId: string;
title: string;
origin: import("../../../types/Config").CosOrigin | null;
menuEmpty: import("react").ReactNode;
articleEmpty: import("react").ReactNode;
origin: null | EntityDict["extraFile"]["Schema"]["origin"];
menuEmpty: React.ReactNode | undefined;
articleEmpty: React.ReactNode | undefined;
generateUrl: GenerateUrlFn;
}>) => React.ReactElement;
export default _default;

View File

@ -7,7 +7,7 @@ export default OakComponent({
entity: '',
entityId: '',
title: '',
origin: null,
origin: null, // cos origin默认由系统决定
menuEmpty: undefined,
articleEmpty: undefined,
generateUrl: ((mode, type, id) => { }), //构造文章显示路由
@ -20,7 +20,7 @@ export default OakComponent({
showAddArticle: false,
showAddMenu: true,
parentId: '',
articleMenuId: '',
articleMenuId: '', //非空时展示atricle表格
unsub: undefined,
},
listeners: {

View File

@ -1,14 +1,13 @@
/// <reference types="react" />
import { GenerateUrlFn } from "../../../types/Article";
import { EntityDict } from "../../../oak-app-domain";
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<EntityDict, "articleMenu", true, {
entity: string;
entityId: string;
parentId: string | undefined;
origin: import("../../../types/Config").CosOrigin | null;
origin: EntityDict["extraFile"]["Schema"]["origin"] | null;
onMenuClick: (menuId: string, menuName: string, isArticle: boolean) => void;
onArticleClick: (atricleId: string) => void;
empty: import("react").ReactNode;
empty: React.ReactNode | undefined;
changeAddArticle: (show: boolean) => void;
generateUrl: GenerateUrlFn;
}>) => React.ReactElement;

View File

@ -3,7 +3,7 @@ declare const _default: (props: import("oak-frontend-base").ReactComponentProps<
onRemove: () => void;
onUpdateName: (name: string) => Promise<void>;
onChildEditArticleChange: (data: string) => void;
show: "preview" | "doc" | "edit";
show: "edit" | "doc" | "preview";
getBreadcrumbItemsByParent: (breadcrumbItems: string[]) => void;
breadItems: string[];
drawerOpen: boolean;
@ -25,6 +25,6 @@ declare const _default: (props: import("oak-frontend-base").ReactComponentProps<
setCurrentArticle: (id: string) => void;
onMenuViewById: (articleMenuId: string) => void;
setCopyArticleUrl: (id: string) => string;
origin: import("../../../types/Config").CosOrigin | null;
origin: null | EntityDict["extraFile"]["Schema"]["origin"];
}>) => React.ReactElement;
export default _default;

View File

@ -4,7 +4,7 @@ declare const _default: (props: import("oak-frontend-base").ReactComponentProps<
entityId: string;
parentId: string | undefined;
onGrandChildEditArticleChange: (data: string) => void;
show: "preview" | "doc" | "edit";
show: "edit" | "doc" | "preview";
articleMenuId: string;
articleId: string;
getBreadcrumbItems: (breadcrumbItems: string[]) => void;
@ -31,6 +31,6 @@ declare const _default: (props: import("oak-frontend-base").ReactComponentProps<
setCurrentArticle: (id: string) => void;
onMenuViewById: (articleMenuId: string) => void;
setCopyArticleUrl: (id: string) => string;
origin: import("../../../types/Config").CosOrigin | null;
origin: null | EntityDict["extraFile"]["Schema"]["origin"];
}>) => React.ReactElement;
export default _default;

View File

@ -2,7 +2,7 @@ import { EntityDict } from "../../../oak-app-domain/EntityDict";
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<EntityDict, "articleMenu", true, {
entity: string;
entityId: string;
show: "preview" | "doc" | "edit";
show: "edit" | "doc" | "preview";
articleMenuId: string;
articleId: string;
tocPosition: "none" | "left" | "right";
@ -13,7 +13,7 @@ declare const _default: (props: import("oak-frontend-base").ReactComponentProps<
onArticlePreview: (content?: string, title?: string) => void;
onArticleEdit: (articleId: string) => void;
setCopyArticleUrl: (articleId: string) => string;
origin: import("../../../types/Config").CosOrigin | null;
origin: EntityDict["extraFile"]["Schema"]["origin"] | null;
scrollId: string;
activeColor: string | undefined;
}>) => React.ReactElement;

View File

@ -1,3 +1,2 @@
/// <reference types="wechat-miniprogram" />
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, "user", false, WechatMiniprogram.Component.DataOption>) => React.ReactElement;
export default _default;

View File

@ -1,3 +1,2 @@
/// <reference types="wechat-miniprogram" />
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, "user", false, WechatMiniprogram.Component.DataOption>) => React.ReactElement;
export default _default;

View File

@ -1,4 +1,3 @@
/// <reference types="node" />
import * as React from 'react';
type IDownloadProps = {
children?: React.ReactNode;
@ -9,9 +8,9 @@ type IDownloadProps = {
};
declare function Download(props: IDownloadProps): React.JSX.Element;
declare namespace Download {
var onDownload: (data: ArrayBuffer | ReadableStream<any>, filename: string) => Promise<void>;
var onDownload: (data: ArrayBuffer | ReadableStream, filename: string) => Promise<void>;
var base64ToBlob: (base64String: string) => Blob;
var arrayBufferToBase64: (buffer: Buffer) => string;
var base64ToArrayBuffer: (base64String: string) => ArrayBufferLike;
var base64ToArrayBuffer: (base64String: string) => ArrayBuffer;
}
export default Download;

View File

@ -4,8 +4,8 @@ import { ReactComponentProps } from 'oak-frontend-base';
import { ECode } from '../../../types/ErrorPage';
declare const _default: <ED2 extends EntityDict & BaseEntityDict, T2 extends keyof ED2>(props: ReactComponentProps<ED2, T2, false, {
code: ECode;
title?: string | undefined;
desc?: string | undefined;
title?: string;
desc?: string;
children?: React.ReactNode;
icon?: React.ReactNode;
}>) => React.ReactElement;

View File

@ -37,7 +37,7 @@ export default OakComponent({
code: '',
title: '',
desc: '',
icon: '',
icon: '', //web独有
imagePath: '', //小程序独有
},
lifetimes: {

View File

@ -2,21 +2,21 @@ import { EntityDict } from '../../../oak-app-domain';
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/types/Entity';
import { ReactComponentProps } from 'oak-frontend-base';
declare const _default: <ED2 extends EntityDict & BaseEntityDict, T2 extends keyof ED2>(props: ReactComponentProps<ED2, T2, false, {
filename?: string | undefined;
expiresAt?: number | undefined;
filename?: string;
expiresAt?: number;
tips?: React.ReactNode;
onDownload?: ((qrCodeImage: string, filename?: string) => void) | undefined;
onRefresh?: (() => void) | undefined;
size?: number | undefined;
onDownload?: (qrCodeImage: string, filename?: string) => void;
onRefresh?: () => void;
size?: number;
url: string;
loading?: boolean | undefined;
disableDownload?: boolean | undefined;
loading?: boolean;
disableDownload?: boolean;
disabled: boolean;
color: string;
bgColor: string;
maskColor: string;
maskTextColor: string;
maskText: string;
mode: 'simple' | 'default';
mode: "simple" | "default";
}>) => React.ReactElement;
export default _default;

View File

@ -43,9 +43,9 @@ export default OakComponent({
return;
}
const qrCodeURL = qrcode.drawImg(url, {
typeNumber: 4,
errorCorrectLevel: 'L',
size: size,
typeNumber: 4, // 密度
errorCorrectLevel: 'L', // 纠错等级
size: size, // 白色边框
color,
bgColor
});
@ -77,8 +77,8 @@ export default OakComponent({
// 注意写入前需确保Base64数据已经去掉了数据URL前缀如"data:image/png;base64,"
fs.writeFile({
filePath: filePath,
data: base64Data,
encoding: 'base64',
data: base64Data, // 传入纯Base64字符串
encoding: 'base64', // 指定编码格式
success(res) {
// 文件写入成功后,检查并保存到相册
that.checkAuthAndSave(filePath);

View File

@ -6,11 +6,11 @@ declare const _default: (props: import("oak-frontend-base").ReactComponentProps<
redDot: boolean;
text: string;
pagePath: string;
iconName?: string | undefined;
selectedIconName?: string | undefined;
iconPath?: string | undefined;
selectedIconPath?: string | undefined;
iconSize?: string | undefined;
iconName?: string;
selectedIconName?: string;
iconPath?: string;
selectedIconPath?: string;
iconSize?: string;
}[];
color: string;
selectedColor: string;

View File

@ -1,7 +1,7 @@
import { Style } from '../../../../types/Style';
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../../oak-app-domain").EntityDict, keyof import("../../../../oak-app-domain").EntityDict, false, {
style: Style;
entity: "platform" | "application" | "system";
entity: "system" | "platform" | "application";
entityId: string;
name: string;
}>) => React.ReactElement;

View File

@ -347,6 +347,25 @@ function AliAccount(props) {
<Input placeholder="请输入endpoint" type="text" value={ele.smsEndpoint} onChange={(e) => setValue(`${idx}.smsEndpoint`, e.target.value)}/>
</>
</Form.Item>
<Form.Item label="STS endpoint"
//name="stsEndpoint"
tooltip="STS 访问的域名sts.cn-hangzhou.aliyuncs.com">
<>
<Input placeholder="请输入endpoint" type="text" value={ele.stsEndpoint} onChange={(e) => setValue(`${idx}.stsEndpoint`, e.target.value)}/>
</>
</Form.Item>
{/* roleArn */}
<Form.Item label="角色ARN">
<>
<Input placeholder="请输入角色ARN" type="text" value={ele.roleArn} onChange={(e) => setValue(`${idx}.roleArn`, e.target.value)}/>
</>
</Form.Item>
{/* roleSessionName */}
<Form.Item label="角色会话名称">
<>
<Input placeholder="请输入角色会话名称" type="text" value={ele.roleSessionName} onChange={(e) => setValue(`${idx}.roleSessionName`, e.target.value)}/>
</>
</Form.Item>
</Form>),
}))
: [
@ -388,6 +407,25 @@ function AliAccount(props) {
<Input placeholder="请输入endpoint" type="text" value="" onChange={(e) => setValue(`0.smsEndpoint`, e.target.value)}/>
</>
</Form.Item>
<Form.Item label="STS endpoint"
//name="stsEndpoint"
tooltip="STS 访问的域名sts.cn-hangzhou.aliyuncs.com">
<>
<Input placeholder="请输入endpoint" type="text" value='' onChange={(e) => setValue(`0.stsEndpoint`, e.target.value)}/>
</>
</Form.Item>
{/* roleArn */}
<Form.Item label="角色ARN">
<>
<Input placeholder="请输入角色ARN" type="text" value='' onChange={(e) => setValue(`0.roleArn`, e.target.value)}/>
</>
</Form.Item>
{/* roleSessionName */}
<Form.Item label="角色会话名称">
<>
<Input placeholder="请输入角色会话名称" type="text" value='' onChange={(e) => setValue(`0.roleSessionName`, e.target.value)}/>
</>
</Form.Item>
</Form>),
},
]}></Tabs>

View File

@ -1,7 +1,7 @@
import { Config } from '../../../types/Config';
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, keyof import("../../../oak-app-domain").EntityDict, false, {
config: Config;
entity: "platform" | "system";
entity: "system" | "platform";
name: string;
entityId: string;
}>) => React.ReactElement;

View File

@ -1,3 +1,2 @@
/// <reference types="wechat-miniprogram" />
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, "domain", false, WechatMiniprogram.Component.DataOption>) => React.ReactElement;
export default _default;

View File

@ -1,3 +1,2 @@
/// <reference types="wechat-miniprogram" />
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, "domain", false, WechatMiniprogram.Component.DataOption>) => React.ReactElement;
export default _default;

View File

@ -12,6 +12,6 @@ declare const _default: (props: import("oak-frontend-base").ReactComponentProps<
entityId: string;
tag1: string;
tag2: string;
origin: import("../../types/Config").CosOrigin | null;
origin: EntityDict["extraFile"]["Schema"]["origin"] | null;
}>) => React.ReactElement;
export default _default;

View File

@ -85,7 +85,10 @@ export default OakComponent({
id: generateNewId(),
uploadState: 'uploading'
};
const url = await this.features.extraFile.autoUpload(extraFile, tempFilePath);
const url = await this.features.extraFile.autoUpload({
extraFile: extraFile,
file: tempFilePath
});
this.editorCtx.insertImage({
src: url,
});

View File

@ -4,6 +4,6 @@ declare const _default: (props: import("oak-frontend-base").ReactComponentProps<
entity: keyof EntityDict;
entityId: string;
autoUpload: boolean;
origin: import("../../../types/Config").CosOrigin | null;
origin: EntityDict["extraFile"]["Schema"]["origin"] | null;
}>) => React.ReactElement;
export default _default;

View File

@ -128,7 +128,10 @@ export default OakComponent({
};
// 如果autoUpload
if (autoUpload) {
await this.features.extraFile.autoUpload(updateData, extra1);
await this.features.extraFile.autoUpload({
extraFile: updateData,
file: extra1
});
if (avatar) {
this.removeItem(avatar.id);
this.execute();

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../oak-app-domain';
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/types/Entity';
import { ReactComponentProps } from 'oak-frontend-base/lib/types/Page';
@ -9,31 +8,14 @@ type AfterCommit = (() => void) | undefined;
type BeforeCommit = (() => boolean | undefined | Promise<boolean | undefined>) | undefined;
declare const _default: <ED2 extends EntityDict & BaseEntityDict, T2 extends keyof ED2>(props: ReactComponentProps<ED2, T2, true, {
entity: keyof ED2;
action?: string | undefined;
size?: ButtonProps['size'] | AmButtonProps['size'];
block?: boolean | undefined;
type?: ButtonProps['type'] | AmButtonProps['type'];
executeText?: string | undefined;
buttonProps?: (ButtonProps & {
color?: "success" | "default" | "warning" | "primary" | "danger" | undefined;
fill?: "none" | "solid" | "outline" | undefined;
size?: "small" | "middle" | "large" | "mini" | undefined;
block?: boolean | undefined;
loading?: boolean | "auto" | undefined;
loadingText?: string | undefined;
loadingIcon?: import("react").ReactNode;
disabled?: boolean | undefined;
onClick?: ((event: import("react").MouseEvent<HTMLButtonElement, MouseEvent>) => unknown) | undefined;
type?: "reset" | "submit" | "button" | undefined;
shape?: "default" | "rounded" | "rectangular" | undefined;
children?: import("react").ReactNode;
} & Pick<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement>, "id" | "onMouseDown" | "onMouseUp" | "onTouchEnd" | "onTouchStart"> & {
className?: string | undefined;
style?: (import("react").CSSProperties & Partial<Record<"--text-color" | "--background-color" | "--border-radius" | "--border-width" | "--border-style" | "--border-color", string>>) | undefined;
tabIndex?: number | undefined;
} & import("react").AriaAttributes) | undefined;
action?: string;
size?: ButtonProps["size"] | AmButtonProps["size"];
block?: boolean;
type?: ButtonProps["type"] | AmButtonProps["type"];
executeText?: string;
buttonProps?: ButtonProps & AmButtonProps;
afterCommit?: AfterCommit;
beforeCommit?: BeforeCommit;
messageProps?: boolean | MessageProps | undefined;
messageProps?: MessageProps | boolean;
}>) => React.ReactElement;
export default _default;

View File

@ -20,7 +20,7 @@ declare const _default: <ED2 extends EntityDict & BaseEntityDict, T2 extends key
extension: string[];
selectCount: number;
sourceType: SourceType[];
mediaType: ('image' | 'video')[];
mediaType: ("image" | "video")[];
mode: ImageMode;
size: number;
showUploadList: boolean;
@ -52,7 +52,7 @@ declare const _default: <ED2 extends EntityDict & BaseEntityDict, T2 extends key
aspect: number;
minZoom: number;
maxZoom: number;
cropShape: 'rect' | 'round';
cropShape: "rect" | "round";
cropperProps: object;
modalTitle: string;
modalWidth: string;
@ -67,7 +67,7 @@ declare const _default: <ED2 extends EntityDict & BaseEntityDict, T2 extends key
minHeight: number;
compressWidth: number;
compressHeight: number;
resize: 'contain' | 'cover' | 'none';
resize: "contain" | "cover" | "none";
compressQuality: number;
mimeType: string;
convertTypes: string[];

View File

@ -50,19 +50,19 @@ export default OakComponent({
bucket: '',
autoUpload: false,
maxNumber: 20,
extension: [],
selectCount: 1,
sourceType: ['album', 'camera'],
mediaType: ['image'],
mode: 'aspectFit',
size: 3,
showUploadList: true,
showUploadProgress: false,
accept: 'image/*',
disablePreview: false,
disableDelete: false,
disableAdd: false,
disableDownload: false,
extension: [], //小程序独有 chooseMessageFile
selectCount: 1, // 每次打开图片时,可选中的数量 小程序独有
sourceType: ['album', 'camera'], // 小程序独有 chooseMedia
mediaType: ['image'], // 小程序独有 chooseMedia
mode: 'aspectFit', // 图片显示模式
size: 3, // 每行可显示的个数 小程序独有
showUploadList: true, //web独有
showUploadProgress: false, // web独有
accept: 'image/*', // web独有
disablePreview: false, // 图片是否可预览
disableDelete: false, // 图片是否可删除
disableAdd: false, // 上传按钮隐藏
disableDownload: false, // 下载按钮隐藏
type: 'image',
origin: null,
tag1: '',
@ -70,40 +70,40 @@ export default OakComponent({
entity: '',
entityId: '',
theme: 'image',
enableCrop: false,
enableCompross: false,
enableCrop: false, //启用裁剪
enableCompross: false, //启用压缩
//图片裁剪
cropQuality: 1,
showRest: false,
showGrid: false,
fillColor: 'white',
rotationSlider: false,
aspectSlider: false,
zoomSlider: true,
resetText: '重置',
aspect: 1 / 1,
minZoom: 1,
maxZoom: 3,
cropShape: 'rect',
cropperProps: {},
modalTitle: '编辑图片',
modalWidth: '40vw',
modalOk: '确定',
modalCancel: '取消',
cropQuality: 1, //图片裁剪质量范围0 ~ 1
showRest: false, //显示重置按钮,重置缩放及旋转
showGrid: false, //显示裁切区域网格(九宫格)
fillColor: 'white', //裁切图像填充色
rotationSlider: false, //图片旋转控制
aspectSlider: false, //裁切比率控制
zoomSlider: true, //图片缩放控制
resetText: '重置', //重置按钮文字
aspect: 1 / 1, //裁切区域宽高比width / height
minZoom: 1, //最小缩放倍数
maxZoom: 3, //最大缩放倍数
cropShape: 'rect', //裁切区域形状,'rect' 或 'round'
cropperProps: {}, //recat-easy-crop的props
modalTitle: '编辑图片', //弹窗标题
modalWidth: '40vw', //弹窗宽度
modalOk: '确定', //确定按钮文字
modalCancel: '取消', //取消按钮的文字
//图片压缩
strict: true,
checkOrientation: true,
retainExif: false,
maxWidth: Infinity,
maxHeight: Infinity,
minWidth: 0,
minHeight: 0,
compressWidth: undefined,
compressHeight: undefined,
resize: 'none',
compressQuality: 0.8,
mimeType: 'auto',
convertTypes: ['image/png'],
strict: true, //当压缩后的图片尺寸大于原图尺寸时输出原图
checkOrientation: true, //读取图像的Exif方向值并自动旋转或翻转图像仅限 JPEG 图像)
retainExif: false, //压缩后保留图片的Exif信息
maxWidth: Infinity, //输出图片的最大宽度值需大于0
maxHeight: Infinity, //输出图片的最大高度值需大于0
minWidth: 0, //输出图片的最小宽度值需大于0且不应大于maxWidth
minHeight: 0, //输出图片的最小高度。值需大于0且不应大于maxHeight
compressWidth: undefined, //输出图像的宽度。如果未指定则将使用原始图像的宽度若设置了height则宽度将根据自然纵横比自动计算。
compressHeight: undefined, //输出图像的高度。如果未指定则将使用原始图像的高度若设置了width则高度将根据自然纵横比自动计算。
resize: 'none', //仅在同时指定了width和height时生效
compressQuality: 0.8, //输出图像的质量。范围0 ~ 1
mimeType: 'auto', //输出图片的 MIME 类型。默认情况下,将使用源图片文件的原始 MIME 类型。
convertTypes: ['image/png'], //文件类型包含在其中且文件大小超过该convertSize值的文件将被转换为 JPEG。
convertSize: Infinity, //文件类型包含在convertTypes中且文件大小超过此值的文件将转换为 JPEGInfinity表示禁用该功能
},
features: ['extraFile'],

View File

@ -13,7 +13,7 @@ export default function render(props) {
};
return (<>
{enableCrop ? (<ImgCrop showReset={showRest} showGrid={showGrid} fillColor={fillColor} rotationSlider={rotationSlider} aspectSlider={aspectSlider} zoomSlider={zoomSlider} resetText={resetText} aspect={aspect} minZoom={minZoom} maxZoom={maxZoom} cropShape={cropShape} quality={cropQuality} cropperProps={{
restrictPosition: false,
restrictPosition: false, //允许移动图片位置
...cropperProps,
}} modalTitle={modalTitle} modalWidth={modalWidth} modalOk={modalOk} modalCancel={modalCancel}>
<ExtrafileUpload oakPath={oakFullpath} bucket={bucket} autoUpload={autoUpload} maxNumber={maxNumber} mode={mode} showUploadList={showUploadList} showUploadProgress={showUploadProgress} accept={accept} disablePreview={disablePreview} disableDelete={disableDelete} disableAdd={disableAdd} disableDownload={disableDownload} disabled={disabled} type={type} origin={origin} tag1={tag1} tag2={tag2} entity={entity} entityId={entityId} theme={theme} children={children} beforeUpload={async (file) => {

View File

@ -11,6 +11,6 @@ declare const _default: <ED2 extends EntityDict & BaseEntityDict, T2 extends key
tag2: string;
entity: keyof ED2;
entityId: string;
style?: string | undefined;
style?: string;
}>) => React.ReactElement;
export default _default;

View File

@ -70,10 +70,10 @@ export default OakComponent({
},
],
properties: {
mode: 'aspectFit',
size: 3,
disablePreview: false,
disableDownload: false,
mode: 'aspectFit', // 图片显示模式
size: 3, // 每行可显示的个数 小程序独有
disablePreview: false, // 图片是否可预览
disableDownload: false, // 下载按钮隐藏
tag1: '',
tag2: '',
entity: '',

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../oak-app-domain';
import { FileState } from '../../../features/extraFile';
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/types/Entity';
@ -21,7 +20,7 @@ declare const _default: <ED2 extends EntityDict & BaseEntityDict, T2 extends key
extension: string[];
selectCount: number;
sourceType: SourceType[];
mediaType: ('image' | 'video')[];
mediaType: ("image" | "video")[];
mode: ImageMode;
size: number;
showUploadList: boolean;
@ -41,8 +40,8 @@ declare const _default: <ED2 extends EntityDict & BaseEntityDict, T2 extends key
entityId: string;
theme: Theme;
children?: React.ReactNode;
style?: import("react").CSSProperties | undefined;
className?: string | undefined;
style?: React.CSSProperties;
className?: string;
beforeUpload: (file: File) => Promise<string>;
}>) => React.ReactElement;
export default _default;

View File

@ -75,6 +75,18 @@ export default OakComponent({
theme: 'image',
style: '', // 各渠道图片样式
},
lifetimes: {
async detached() {
// 组件卸载时,若还有正在上传的文件,则中止上传
const { files } = this.state;
const uploadingFiles = files.filter((ele) => ele.uploadState === 'uploading');
if (uploadingFiles.length > 0) {
uploadingFiles.forEach((file) => {
this.features.extraFile.abortUpload(file.id);
});
}
}
},
listeners: {
maxNumber(prev, next) {
if (this.state.oakFullpath) {
@ -134,6 +146,10 @@ export default OakComponent({
onRemove(file) {
this.removeItem(file.id);
this.features.extraFile.removeLocalFiles([file.id]);
// 如果已经在上传,则中止上传
if (file.uploadState === 'uploading') {
this.features.extraFile.abortUpload(file.id);
}
},
async addExtraFileInner(options, file) {
const { type, origin, // 默认由系统决定
@ -164,7 +180,22 @@ export default OakComponent({
// autoUpload设置为true直接上传
if (autoUpload) {
assert(entityId, 'autoUpload设置为trueentityId必须存在');
await this.features.extraFile.autoUpload(updateData, file);
await this.features.extraFile.autoUpload({
extraFile: updateData,
file: file,
chunkOptions: {
chunkSize: 100 * 1024 * 1024, // 100MB
},
getPercent: (percentage) => {
const currentFiles = this.state.files;
const index = currentFiles.findIndex((ele) => ele.objectId ===
updateData.objectId);
if (index !== -1) {
currentFiles[index].percentage = percentage;
this.setState({ files: currentFiles });
}
},
});
}
else {
const id = this.addItem(updateData);

View File

@ -8,23 +8,23 @@ export interface UploadHandle {
}
declare const _default: React.ForwardRefExoticComponent<WebComponentProps<EntityDict, "extraFile", true, {
files: EnhancedExtraFile[];
accept?: string | undefined;
maxNumber?: number | undefined;
multiple?: boolean | undefined;
draggable?: boolean | undefined;
theme?: Theme | undefined;
beforeUpload?: ((file: File) => Promise<boolean> | boolean) | undefined;
style?: React.CSSProperties | undefined;
className?: string | undefined;
directory?: boolean | undefined;
onPreview?: ((file: UploadFile<any>) => void) | undefined;
onDownload?: ((file: UploadFile<any>) => void) | undefined;
showUploadList?: boolean | undefined;
children?: JSX.Element | undefined;
disableInsert?: boolean | undefined;
disableDownload?: boolean | undefined;
disableDelete?: boolean | undefined;
disablePreview?: boolean | undefined;
accept?: string;
maxNumber?: number;
multiple?: boolean;
draggable?: boolean;
theme?: Theme;
beforeUpload?: (file: File) => Promise<boolean> | boolean;
style?: React.CSSProperties;
className?: string;
directory?: boolean;
onPreview?: (file: UploadFile<any>) => void;
onDownload?: (file: UploadFile<any>) => void;
showUploadList?: boolean;
children?: JSX.Element;
disableInsert?: boolean;
disableDownload?: boolean;
disableDelete?: boolean;
disablePreview?: boolean;
}, {
onRemove: (file: UploadFile) => void;
addFileByWeb: (file: UploadFile) => void;

View File

@ -5,13 +5,13 @@ declare const Authorize: (props: WebComponentProps<EntityDict, keyof EntityDict,
loading: boolean;
hasError: boolean;
errorMsg: string;
userInfo: EntityDict['token']['Schema']['user'] | null;
userInfo: EntityDict["token"]["Schema"]["user"] | null;
response_type: string;
client_id: string;
redirect_uri: string;
scope: string;
state: string;
clientInfo: EntityDict['oauthApplication']['Schema'] | null;
clientInfo: EntityDict["oauthApplication"]["Schema"] | null;
name: string;
nickname: string;
mobile: string;

View File

@ -1,3 +1,2 @@
/// <reference types="wechat-miniprogram" />
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, keyof import("../../../oak-app-domain").EntityDict, boolean, WechatMiniprogram.Component.DataOption>) => React.ReactElement;
export default _default;

View File

@ -1,3 +1,2 @@
/// <reference types="wechat-miniprogram" />
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, "message", false, WechatMiniprogram.Component.DataOption>) => React.ReactElement;
export default _default;

View File

@ -1,3 +1,2 @@
/// <reference types="wechat-miniprogram" />
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, "message", true, WechatMiniprogram.Component.DataOption>) => React.ReactElement;
export default _default;

View File

@ -1,6 +1,6 @@
import { EntityDict } from '../../../oak-app-domain';
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<EntityDict, "messageTypeSmsTemplate", true, {
systemId: string;
origin: import("../../../oak-app-domain/SmsTemplate/_baseSchema").Origin;
origin: EntityDict["smsTemplate"]["Schema"]["origin"];
}>) => React.ReactElement;
export default _default;

View File

@ -2,6 +2,6 @@ declare const _default: (props: import("oak-frontend-base").ReactComponentProps<
onlyCaptcha: boolean;
onlyPassword: boolean;
eventLoggedIn: string;
callback: (() => void) | undefined;
callback: ((() => void) | undefined);
}>) => React.ReactElement;
export default _default;

View File

@ -1,3 +1,2 @@
/// <reference types="wechat-miniprogram" />
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, "mobile", true, WechatMiniprogram.Component.DataOption>) => React.ReactElement;
export default _default;

View File

@ -1,6 +1,6 @@
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, keyof import("../../../oak-app-domain").EntityDict, false, {
shape: string;
size: string | number;
size: number | string;
iconColor: string;
iconName: string;
}>) => React.ReactElement;

View File

@ -1,3 +1,2 @@
/// <reference types="wechat-miniprogram" />
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, keyof import("../../../oak-app-domain").EntityDict, false, WechatMiniprogram.Component.DataOption>) => React.ReactElement;
export default _default;

View File

@ -2,7 +2,7 @@ import React from 'react';
import { RowWithActions, WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../../../oak-app-domain';
declare const Upsert: (props: WebComponentProps<EntityDict, "oauthApplication", false, {
item: RowWithActions<EntityDict, 'oauthApplication'>;
item: RowWithActions<EntityDict, "oauthApplication">;
clientSecret: string;
isCreation: boolean;
open: boolean;

View File

@ -1,8 +1,8 @@
import React from 'react';
import { RowWithActions, WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../../oak-app-domain';
declare const OauthProvider: (props: WebComponentProps<EntityDict, 'oauthApplication', true, {
list: RowWithActions<EntityDict, 'oauthApplication'>[];
declare const OauthProvider: (props: WebComponentProps<EntityDict, "oauthApplication", true, {
list: RowWithActions<EntityDict, "oauthApplication">[];
systemId: string;
}>) => React.JSX.Element;
export default OauthProvider;

View File

@ -2,7 +2,7 @@ import React from 'react';
import { RowWithActions, WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../../../oak-app-domain';
declare const Upsert: (props: WebComponentProps<EntityDict, "oauthProvider", false, {
item: RowWithActions<EntityDict, 'oauthProvider'>;
item: RowWithActions<EntityDict, "oauthProvider">;
open: boolean;
onCancel: () => void;
onOk: () => void;

View File

@ -1,8 +1,8 @@
import React from 'react';
import { RowWithActions, WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../../oak-app-domain';
declare const OauthProvider: (props: WebComponentProps<EntityDict, 'oauthProvider', true, {
list: RowWithActions<EntityDict, 'oauthProvider'>[];
declare const OauthProvider: (props: WebComponentProps<EntityDict, "oauthProvider", true, {
list: RowWithActions<EntityDict, "oauthProvider">[];
systemId: string;
}>) => React.JSX.Element;
export default OauthProvider;

View File

@ -2,8 +2,8 @@ import React from 'react';
import { RowWithActions, WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../oak-app-domain';
declare const Records: (props: WebComponentProps<EntityDict, "oauthUserAuthorization", true, {
list: RowWithActions<EntityDict, 'oauthUserAuthorization'>[];
list: RowWithActions<EntityDict, "oauthUserAuthorization">[];
}, {
revoke: (item: RowWithActions<EntityDict, 'oauthUserAuthorization'>) => void;
revoke: (item: RowWithActions<EntityDict, "oauthUserAuthorization">) => void;
}>) => React.JSX.Element;
export default Records;

View File

@ -1,4 +1,3 @@
/// <reference types="wechat-miniprogram" />
import { EntityDict } from '../../../oak-app-domain';
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<EntityDict, keyof EntityDict, false, WechatMiniprogram.Component.DataOption>) => React.ReactElement;
export default _default;

View File

@ -5,7 +5,7 @@ declare const _default: <ED2 extends EntityDict & BaseEntityDict, T2 extends key
entity: keyof ED2;
entityId: string;
relation: string;
redirectTo: EntityDict['parasite']['Schema']['redirectTo'];
redirectTo: EntityDict["parasite"]["Schema"]["redirectTo"];
multiple: boolean;
nameLabel: string;
nameRequired: boolean;

View File

@ -1,3 +1,2 @@
/// <reference types="wechat-miniprogram" />
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, "platform", false, WechatMiniprogram.Component.DataOption>) => React.ReactElement;
export default _default;

View File

@ -1,3 +1,2 @@
/// <reference types="wechat-miniprogram" />
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, "platform", false, WechatMiniprogram.Component.DataOption>) => React.ReactElement;
export default _default;

View File

@ -1,7 +1,7 @@
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, keyof import("../../../oak-app-domain").EntityDict, false, {
sessionId: string;
isEntity: boolean;
entityDisplay: (data: any) => any[];
entityDisplay: (data: any) => Array<any>;
entityProjection: any;
}>) => React.ReactElement;
export default _default;

View File

@ -1,3 +1,2 @@
/// <reference types="wechat-miniprogram" />
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, keyof import("../../../oak-app-domain").EntityDict, false, WechatMiniprogram.Component.DataOption>) => React.ReactElement;
export default _default;

View File

@ -4,10 +4,10 @@ declare const _default: (props: import("oak-frontend-base").ReactComponentProps<
entity: string;
entityFilter: any;
entityFilterSubStr: string;
entityDisplay: (data: EntityDict['session']['Schema'][] | RowWithActions<EntityDict, 'session'>[]) => any[];
entityDisplay: (data: EntityDict["session"]["Schema"][] | RowWithActions<EntityDict, "session">[]) => Array<any>;
entityProjection: any;
sessionId: string;
dialog: boolean;
onItemClick: ((sessionId: string) => {}) | null | undefined;
onItemClick: ((sessionId: string) => {}) | undefined | null;
}>) => React.ReactElement;
export default _default;

View File

@ -140,12 +140,12 @@ export default OakComponent({
unSub: undefined,
},
properties: {
entity: '',
entityFilter: null,
entity: '', // entity端指示相应的entity
entityFilter: null, // entity端指示相应的entity查询条件
entityFilterSubStr: '',
entityDisplay: (data) => [],
entityProjection: null,
sessionId: '',
entityDisplay: (data) => [], // user端指示如何显示entity对象名称
entityProjection: null, // user端指示需要取哪些entity的属性来显示entityDisplay
sessionId: '', // 指示需要打开的默认session
dialog: false,
onItemClick: null,
},

View File

@ -6,7 +6,7 @@ declare const _default: (props: import("oak-frontend-base").ReactComponentProps<
dialog: boolean;
entity: string;
entityId: string;
entityDisplay: (data: EntityDict['session']['Schema'][] | RowWithActions<EntityDict, 'session'>[]) => any[];
entityDisplay: (data: EntityDict["session"]["Schema"][] | RowWithActions<EntityDict, "session">[]) => Array<any>;
entityProjection: any;
}>) => React.ReactElement;
export default _default;

View File

@ -102,7 +102,7 @@ export default OakComponent({
dialog: false,
entity: '',
entityId: '',
entityDisplay: (data) => [],
entityDisplay: (data) => [], // user端指示如何显示entity对象名称
entityProjection: null, // user端指示需要取哪些entity的属性来显示entityDisplay
},
filters: [
@ -281,7 +281,10 @@ export default OakComponent({
entity: 'sessionMessage',
entityId: sessionMessageId,
};
await this.features.extraFile.autoUpload(extraFile, originFileObj);
await this.features.extraFile.autoUpload({
extraFile: extraFile,
file: originFileObj
});
try {
this.updateItem({
createTime: Date.now(),

View File

@ -1,3 +1,2 @@
/// <reference types="wechat-miniprogram" />
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../../oak-app-domain").EntityDict, "subscription", false, WechatMiniprogram.Component.DataOption>) => React.ReactElement;
export default _default;

View File

@ -1,3 +1,2 @@
/// <reference types="wechat-miniprogram" />
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, "subscription", false, WechatMiniprogram.Component.DataOption>) => React.ReactElement;
export default _default;

View File

@ -1,5 +1,5 @@
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, keyof import("../../../oak-app-domain").EntityDict, true, {
areaId: string | null | undefined;
areaId: string | undefined | null;
onCancel: (() => void) | undefined;
onConfirm: ((stationIds: string[]) => void) | undefined;
selectIds: string[] | undefined;

View File

@ -1,3 +1,2 @@
/// <reference types="wechat-miniprogram" />
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, "system", false, WechatMiniprogram.Component.DataOption>) => React.ReactElement;
export default _default;

View File

@ -1,3 +1,2 @@
/// <reference types="wechat-miniprogram" />
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, "system", false, WechatMiniprogram.Component.DataOption>) => React.ReactElement;
export default _default;

View File

@ -1,3 +1,2 @@
/// <reference types="wechat-miniprogram" />
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../../oak-app-domain").EntityDict, keyof import("../../../../oak-app-domain").EntityDict, boolean, WechatMiniprogram.Component.DataOption>) => React.ReactElement;
export default _default;

View File

@ -1,9 +1,8 @@
/// <reference types="react" />
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, "token", true, {
onMyInfoClicked: () => void;
myInfoUrl: string;
manageUserUrl: string;
loginUrl: string;
Body: import("react").ReactNode;
Body: React.ReactNode | undefined;
}>) => React.ReactElement;
export default _default;

View File

@ -1,6 +1,6 @@
import { EntityDict } from '../../../../oak-app-domain';
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<EntityDict, "extraFile", true, {
origin: import("../../../../types/Config").CosOrigin | null;
origin: EntityDict["extraFile"]["Schema"]["origin"] | null;
idCardType: string;
entityId: string;
entity: string;

View File

@ -118,7 +118,10 @@ export default OakComponent({
const _file = this.state[tag2]; //取出file1、file2
// 如果autoUpload
if (autoUpload) {
await this.features.extraFile.autoUpload(updateData, extra1);
await this.features.extraFile.autoUpload({
extraFile: updateData,
file: extra1
});
if (_file) {
this.removeItem(_file.id);
await this.execute();

View File

@ -1,6 +1,6 @@
import { EntityDict } from '../../../oak-app-domain';
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<EntityDict, "user", false, {
origin: import("../../../types/Config").CosOrigin | null;
origin: EntityDict["extraFile"]["Schema"]["origin"] | null;
autoUpload: boolean;
onFinish: (() => void) | undefined;
needUploadPhotos: boolean;

View File

@ -1,4 +1,4 @@
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../../oak-app-domain").EntityDict, keyof import("../../../../oak-app-domain").EntityDict, boolean, {
onVerified: (() => void) | undefined;
onVerified: undefined | (() => void);
}>) => React.ReactElement;
export default _default;

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from "oak-frontend-base";
import { EntityDict } from "../../../../oak-app-domain";
export default function Render(props: WebComponentProps<EntityDict, 'user', false, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from "oak-frontend-base";
import { EntityDict } from "../../../../oak-app-domain";
export default function Render(props: WebComponentProps<EntityDict, 'user', false, {

View File

@ -1,20 +1,20 @@
import { EntityDict } from '../../../oak-app-domain';
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<EntityDict, "userEntityGrant", false, {
picker: ((props: {
disabled?: boolean | undefined;
disabled?: boolean;
entity: keyof EntityDict;
entityFilter: object;
relationIds: string[];
rule: EntityDict['userEntityGrant']['OpSchema']['rule'];
ruleOnRow: EntityDict['userEntityGrant']['OpSchema']['ruleOnRow'];
rule: EntityDict["userEntityGrant"]["OpSchema"]["rule"];
ruleOnRow: EntityDict["userEntityGrant"]["OpSchema"]["ruleOnRow"];
onPickRelations: (ids: string[]) => void;
onPickRows: (ids: string[]) => void;
pickedRowIds?: string[] | undefined;
pickedRelationIds?: string[] | undefined;
pickedRowIds?: string[];
pickedRelationIds?: string[];
oakPath: string;
}) => React.ReactElement) | undefined;
hideInfo: boolean;
hideTip: boolean;
afterClaim: ((ueg: EntityDict['userEntityGrant']['OpSchema']) => void) | undefined;
afterClaim: ((ueg: EntityDict["userEntityGrant"]["OpSchema"]) => void) | undefined;
}>) => React.ReactElement;
export default _default;

View File

@ -4,8 +4,8 @@ declare const _default: (props: import("oak-frontend-base").ReactComponentProps<
entity: keyof EntityDict;
entityFilter: any;
relationIds: string[];
rule: "single" | "all" | "free";
ruleOnRow: "single" | "all" | "free";
rule: EntityDict["userEntityGrant"]["OpSchema"]["rule"];
ruleOnRow: EntityDict["userEntityGrant"]["OpSchema"]["ruleOnRow"];
onPickRelations: (ids: string[]) => void;
onPickRows: (ids: string[]) => void;
pickedRowIds: string[] | undefined;

View File

@ -6,12 +6,12 @@ declare const _default: (props: import("oak-frontend-base").ReactComponentProps<
relationEntity: string;
relationEntityFilter: any;
relationIds: string[];
type: "grant" | "transfer";
redirectToAfterConfirm: import("../../../oak-app-domain/UserEntityGrant/_baseSchema").RedirectToProps | null | undefined;
type: EntityDict["userEntityGrant"]["Schema"]["type"];
redirectToAfterConfirm: EntityDict["userEntityGrant"]["Schema"]["redirectTo"];
claimUrl: string;
qrCodeType: QrCodeType;
multiple: boolean;
rule: "single" | "all" | "free";
ruleOnRow: "single" | "all" | "free";
rule: EntityDict["userEntityGrant"]["OpSchema"]["rule"];
ruleOnRow: EntityDict["userEntityGrant"]["OpSchema"]["ruleOnRow"];
}>) => React.ReactElement;
export default _default;

View File

@ -4,9 +4,9 @@ import { EntityDict as BaseEntityDict } from 'oak-domain/lib/types/Entity';
declare const _default: <ED2 extends EntityDict & BaseEntityDict, T2 extends keyof ED2>(props: ReactComponentProps<ED2, T2, true, {
entity: keyof ED2;
entityId: string;
relations: EntityDict['relation']['OpSchema'][];
passwordRequired?: boolean | undefined;
allowUpdateName?: boolean | undefined;
allowUpdateNickname?: boolean | undefined;
relations: EntityDict["relation"]["OpSchema"][];
passwordRequired?: boolean;
allowUpdateName?: boolean;
allowUpdateNickname?: boolean;
}>) => React.ReactElement;
export default _default;

View File

@ -4,7 +4,7 @@ import { EntityDict as BaseEntityDict } from 'oak-domain/lib/types/Entity';
declare const _default: <ED2 extends EntityDict & BaseEntityDict, T2 extends keyof ED2>(props: ReactComponentProps<ED2, T2, true, {
entity: keyof ED2;
entityId: string;
allowUpdateName?: boolean | undefined;
allowUpdateNickname?: boolean | undefined;
allowUpdateName?: boolean;
allowUpdateNickname?: boolean;
}>) => React.ReactElement;
export default _default;

View File

@ -7,12 +7,12 @@ declare const _default: <ED2 extends EntityDict & BaseEntityDict, T2 extends key
entityId: string;
redirectToAfterConfirm: ED2["userEntityGrant"]["Schema"]["redirectTo"];
qrCodeType: QrCodeType;
type: EntityDict['userEntityGrant']['Schema']['type'];
relations: EntityDict['relation']['OpSchema'][];
type: EntityDict["userEntityGrant"]["Schema"]["type"];
relations: EntityDict["relation"]["OpSchema"][];
claimUrl: string;
multiple: boolean;
rule: EntityDict['userEntityGrant']['Schema']['rule'];
ruleOnRow: EntityDict['userEntityGrant']['OpSchema']['ruleOnRow'];
onUserEntityGrantCreated?: ((id: string) => void) | undefined;
rule: EntityDict["userEntityGrant"]["Schema"]["rule"];
ruleOnRow: EntityDict["userEntityGrant"]["OpSchema"]["ruleOnRow"];
onUserEntityGrantCreated?: (id: string) => void;
}>) => React.ReactElement;
export default _default;

View File

@ -7,8 +7,8 @@ declare const _default: <ED2 extends EntityDict & BaseEntityDict, T2 extends key
redirectToAfterConfirm: ED2["userEntityGrant"]["Schema"]["redirectTo"];
claimUrl: string;
qrCodeType: string;
passwordRequired?: boolean | undefined;
disabledMethods: Array<'email' | 'mobile' | 'userEntityGrant'>;
mode: 'byMobile' | 'byUserEntityGrant' | 'byEmail';
passwordRequired?: boolean;
disabledMethods: Array<"email" | "mobile" | "userEntityGrant">;
mode: "byMobile" | "byUserEntityGrant" | "byEmail";
}>) => React.ReactElement;
export default _default;

View File

@ -2,7 +2,7 @@ import { EntityDict } from '../../../../oak-app-domain';
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<EntityDict, "user", false, {
entity: keyof EntityDict;
entityId: string;
relations: import("../../../../oak-app-domain/Relation/_baseSchema").OpSchema[];
relations: EntityDict["relation"]["OpSchema"][];
mobile: string;
setPasswordConfirm: (value: boolean) => void;
passwordRequired: boolean;

Some files were not shown because too many files have changed in this diff Show More