@xiaou66/picture-plugin 0.0.8 → 0.0.9
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/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +24 -9
- package/dist/index.es.js.map +1 -1
- package/dist/storage/StoragePlugIn.d.ts +19 -38
- package/dist/storage/StoragePlugInConfig.d.ts +1 -1
- package/dist/storage/StoragePlugInType.d.ts +46 -0
- package/dist/storage/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function r(
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function r(t){return{...t,plugInType:"storage"}}class l{constructor(){}readConfig(e){const o=`storageSource/${e}`;return utools.dbCryptoStorage.getItem(o)}init(){this.doInit()}destroy(){this.doDestroy()}async uploadFile(e){return await this.doUploadFile(e)}deleteFile(e){return this.doDeleteFile(e)}doDeleteFile(e){return Promise.resolve(!1)}}exports.StoragePlugIn=l;exports.createStoragePlugInConfig=r;
|
|
2
2
|
//# sourceMappingURL=index.cjs.js.map
|
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../src/storage/StoragePlugInConfig.ts","../src/storage/StoragePlugIn.ts"],"sourcesContent":["export interface StorageUIFormElement {\n type: 'input';\n\n formItem: {\n rules?: Record<string, any>;\n field: string;\n label: string;\n },\n\n /**\n * 元素属性值\n */\n elementProperty: Record<string, any>;\n}\n\nexport interface StorageUIConfig {\n /**\n * 提示\n */\n tips: string,\n\n /**\n * 表单\n */\n forms: StorageUIFormElement[];\n}\n\nexport interface StoragePlugInConfig {\n /**\n * 插件 code 全局唯一\n */\n pluginCode: string;\n /**\n * 插件名称\n */\n pluginName: string;\n\n /**\n * 插件版本\n */\n pluginVersion: string;\n\n /**\n * 插件作者\n */\n pluginAuthor: string;\n\n /**\n * 插件描述\n */\n pluginDesc: string;\n\n /**\n * 插件类型\n */\n plugInType: 'storage';\n\n /**\n * 插件 logo\n */\n plugInLogo: string;\n\n /**\n * 配置 ui\n */\n uiConfig?: StorageUIConfig;\n}\n\n/**\n * 场景插件配置\n * @param config\n */\nexport function createStoragePlugInConfig(config: Omit<StoragePlugInConfig, 'plugInType'>): StoragePlugInConfig {\n return {\n ...config,\n plugInType: 'storage',\n };\n}\n","
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../src/storage/StoragePlugInConfig.ts","../src/storage/StoragePlugIn.ts"],"sourcesContent":["export interface StorageUIFormElement {\n type: 'input' | 'input-format';\n\n formItem: {\n rules?: Record<string, any>;\n field: string;\n label: string;\n },\n\n /**\n * 元素属性值\n */\n elementProperty: Record<string, any>;\n}\n\nexport interface StorageUIConfig {\n /**\n * 提示\n */\n tips: string,\n\n /**\n * 表单\n */\n forms: StorageUIFormElement[];\n}\n\nexport interface StoragePlugInConfig {\n /**\n * 插件 code 全局唯一\n */\n pluginCode: string;\n /**\n * 插件名称\n */\n pluginName: string;\n\n /**\n * 插件版本\n */\n pluginVersion: string;\n\n /**\n * 插件作者\n */\n pluginAuthor: string;\n\n /**\n * 插件描述\n */\n pluginDesc: string;\n\n /**\n * 插件类型\n */\n plugInType: 'storage';\n\n /**\n * 插件 logo\n */\n plugInLogo: string;\n\n /**\n * 配置 ui\n */\n uiConfig?: StorageUIConfig;\n}\n\n/**\n * 场景插件配置\n * @param config\n */\nexport function createStoragePlugInConfig(config: Omit<StoragePlugInConfig, 'plugInType'>): StoragePlugInConfig {\n return {\n ...config,\n plugInType: 'storage',\n };\n}\n","import { IDeleteFileParams, IUploadFileParams, IUploadFileResult } from './StoragePlugInType'\n\n\n/**\n * 插件接口\n */\ninterface IStoragePlugIn<C = any, E = any> {\n\n /**\n * 插件初始化调用\n */\n init(): void;\n\n /**\n * 读取配置\n * @param storageId\n */\n readConfig(storageId: string): C;\n\n /**\n * 上传文件\n * @param params 参数\n */\n uploadFile(params: IUploadFileParams): Promise<IUploadFileResult>;\n\n /**\n * 删除文件\n * @param params 参数\n */\n deleteFile(params: IDeleteFileParams): Promise<boolean>;\n\n /**\n * 插件销毁调用\n */\n destroy(): void;\n}\n\n\n/**\n * 存储插件\n */\nexport abstract class StoragePlugIn<C = any> implements IStoragePlugIn<C> {\n constructor() {}\n\n readConfig(storageId: string): C {\n const key = `storageSource/${storageId}`\n return utools.dbCryptoStorage.getItem(key)\n }\n\n init() {\n this.doInit()\n }\n\n /**\n * 初始化使用 <br/>\n * constructor 方法之后调用, 在第一次使用前调用\n * @protected\n */\n protected abstract doInit(): void\n\n destroy() {\n this.doDestroy()\n }\n\n /**\n * 插件销毁调用, 用于销毁资源\n * @protected\n */\n protected abstract doDestroy(): void\n\n /**\n * 上传文件\n * @param params 参数\n */\n async uploadFile(params: IUploadFileParams): Promise<IUploadFileResult> {\n return await this.doUploadFile(params)\n }\n\n /**\n * 上传文件\n * @param params 参数\n */\n protected abstract doUploadFile(params: IUploadFileParams): Promise<IUploadFileResult>\n\n /**\n * 删除文件\n * @param params\n */\n deleteFile(params: IDeleteFileParams): Promise<boolean> {\n return this.doDeleteFile(params);\n }\n\n /**\n * 删除文件 <br/>\n * 如果要实现删除文件请实现这个接口\n * @param params 参数\n */\n protected doDeleteFile(params: IDeleteFileParams): Promise<boolean> {\n return Promise.resolve(false);\n }\n}\n"],"names":["createStoragePlugInConfig","config","StoragePlugIn","storageId","key","params"],"mappings":"gFAwEO,SAASA,EAA0BC,EAAsE,CACvG,MAAA,CACL,GAAGA,EACH,WAAY,SACd,CACF,CCpCO,MAAeC,CAAoD,CACxE,aAAc,CAAA,CAEd,WAAWC,EAAsB,CACzB,MAAAC,EAAM,iBAAiBD,CAAS,GAC/B,OAAA,OAAO,gBAAgB,QAAQC,CAAG,CAAA,CAG3C,MAAO,CACL,KAAK,OAAO,CAAA,CAUd,SAAU,CACR,KAAK,UAAU,CAAA,CAajB,MAAM,WAAWC,EAAuD,CAC/D,OAAA,MAAM,KAAK,aAAaA,CAAM,CAAA,CAavC,WAAWA,EAA6C,CAC/C,OAAA,KAAK,aAAaA,CAAM,CAAA,CAQvB,aAAaA,EAA6C,CAC3D,OAAA,QAAQ,QAAQ,EAAK,CAAA,CAEhC"}
|
package/dist/index.es.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
function r(
|
|
1
|
+
function r(t) {
|
|
2
2
|
return {
|
|
3
|
-
...
|
|
3
|
+
...t,
|
|
4
4
|
plugInType: "storage"
|
|
5
5
|
};
|
|
6
6
|
}
|
|
7
|
-
class
|
|
7
|
+
class s {
|
|
8
8
|
constructor() {
|
|
9
9
|
}
|
|
10
|
-
readConfig(
|
|
11
|
-
const
|
|
12
|
-
return utools.dbCryptoStorage.getItem(
|
|
10
|
+
readConfig(e) {
|
|
11
|
+
const o = `storageSource/${e}`;
|
|
12
|
+
return utools.dbCryptoStorage.getItem(o);
|
|
13
13
|
}
|
|
14
14
|
init() {
|
|
15
15
|
this.doInit();
|
|
@@ -21,12 +21,27 @@ class n {
|
|
|
21
21
|
* 上传文件
|
|
22
22
|
* @param params 参数
|
|
23
23
|
*/
|
|
24
|
-
async uploadFile(
|
|
25
|
-
return await this.doUploadFile(
|
|
24
|
+
async uploadFile(e) {
|
|
25
|
+
return await this.doUploadFile(e);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* 删除文件
|
|
29
|
+
* @param params
|
|
30
|
+
*/
|
|
31
|
+
deleteFile(e) {
|
|
32
|
+
return this.doDeleteFile(e);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* 删除文件 <br/>
|
|
36
|
+
* 如果要实现删除文件请实现这个接口
|
|
37
|
+
* @param params 参数
|
|
38
|
+
*/
|
|
39
|
+
doDeleteFile(e) {
|
|
40
|
+
return Promise.resolve(!1);
|
|
26
41
|
}
|
|
27
42
|
}
|
|
28
43
|
export {
|
|
29
|
-
|
|
44
|
+
s as StoragePlugIn,
|
|
30
45
|
r as createStoragePlugInConfig
|
|
31
46
|
};
|
|
32
47
|
//# sourceMappingURL=index.es.js.map
|
package/dist/index.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es.js","sources":["../src/storage/StoragePlugInConfig.ts","../src/storage/StoragePlugIn.ts"],"sourcesContent":["export interface StorageUIFormElement {\n type: 'input';\n\n formItem: {\n rules?: Record<string, any>;\n field: string;\n label: string;\n },\n\n /**\n * 元素属性值\n */\n elementProperty: Record<string, any>;\n}\n\nexport interface StorageUIConfig {\n /**\n * 提示\n */\n tips: string,\n\n /**\n * 表单\n */\n forms: StorageUIFormElement[];\n}\n\nexport interface StoragePlugInConfig {\n /**\n * 插件 code 全局唯一\n */\n pluginCode: string;\n /**\n * 插件名称\n */\n pluginName: string;\n\n /**\n * 插件版本\n */\n pluginVersion: string;\n\n /**\n * 插件作者\n */\n pluginAuthor: string;\n\n /**\n * 插件描述\n */\n pluginDesc: string;\n\n /**\n * 插件类型\n */\n plugInType: 'storage';\n\n /**\n * 插件 logo\n */\n plugInLogo: string;\n\n /**\n * 配置 ui\n */\n uiConfig?: StorageUIConfig;\n}\n\n/**\n * 场景插件配置\n * @param config\n */\nexport function createStoragePlugInConfig(config: Omit<StoragePlugInConfig, 'plugInType'>): StoragePlugInConfig {\n return {\n ...config,\n plugInType: 'storage',\n };\n}\n","
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":["../src/storage/StoragePlugInConfig.ts","../src/storage/StoragePlugIn.ts"],"sourcesContent":["export interface StorageUIFormElement {\n type: 'input' | 'input-format';\n\n formItem: {\n rules?: Record<string, any>;\n field: string;\n label: string;\n },\n\n /**\n * 元素属性值\n */\n elementProperty: Record<string, any>;\n}\n\nexport interface StorageUIConfig {\n /**\n * 提示\n */\n tips: string,\n\n /**\n * 表单\n */\n forms: StorageUIFormElement[];\n}\n\nexport interface StoragePlugInConfig {\n /**\n * 插件 code 全局唯一\n */\n pluginCode: string;\n /**\n * 插件名称\n */\n pluginName: string;\n\n /**\n * 插件版本\n */\n pluginVersion: string;\n\n /**\n * 插件作者\n */\n pluginAuthor: string;\n\n /**\n * 插件描述\n */\n pluginDesc: string;\n\n /**\n * 插件类型\n */\n plugInType: 'storage';\n\n /**\n * 插件 logo\n */\n plugInLogo: string;\n\n /**\n * 配置 ui\n */\n uiConfig?: StorageUIConfig;\n}\n\n/**\n * 场景插件配置\n * @param config\n */\nexport function createStoragePlugInConfig(config: Omit<StoragePlugInConfig, 'plugInType'>): StoragePlugInConfig {\n return {\n ...config,\n plugInType: 'storage',\n };\n}\n","import { IDeleteFileParams, IUploadFileParams, IUploadFileResult } from './StoragePlugInType'\n\n\n/**\n * 插件接口\n */\ninterface IStoragePlugIn<C = any, E = any> {\n\n /**\n * 插件初始化调用\n */\n init(): void;\n\n /**\n * 读取配置\n * @param storageId\n */\n readConfig(storageId: string): C;\n\n /**\n * 上传文件\n * @param params 参数\n */\n uploadFile(params: IUploadFileParams): Promise<IUploadFileResult>;\n\n /**\n * 删除文件\n * @param params 参数\n */\n deleteFile(params: IDeleteFileParams): Promise<boolean>;\n\n /**\n * 插件销毁调用\n */\n destroy(): void;\n}\n\n\n/**\n * 存储插件\n */\nexport abstract class StoragePlugIn<C = any> implements IStoragePlugIn<C> {\n constructor() {}\n\n readConfig(storageId: string): C {\n const key = `storageSource/${storageId}`\n return utools.dbCryptoStorage.getItem(key)\n }\n\n init() {\n this.doInit()\n }\n\n /**\n * 初始化使用 <br/>\n * constructor 方法之后调用, 在第一次使用前调用\n * @protected\n */\n protected abstract doInit(): void\n\n destroy() {\n this.doDestroy()\n }\n\n /**\n * 插件销毁调用, 用于销毁资源\n * @protected\n */\n protected abstract doDestroy(): void\n\n /**\n * 上传文件\n * @param params 参数\n */\n async uploadFile(params: IUploadFileParams): Promise<IUploadFileResult> {\n return await this.doUploadFile(params)\n }\n\n /**\n * 上传文件\n * @param params 参数\n */\n protected abstract doUploadFile(params: IUploadFileParams): Promise<IUploadFileResult>\n\n /**\n * 删除文件\n * @param params\n */\n deleteFile(params: IDeleteFileParams): Promise<boolean> {\n return this.doDeleteFile(params);\n }\n\n /**\n * 删除文件 <br/>\n * 如果要实现删除文件请实现这个接口\n * @param params 参数\n */\n protected doDeleteFile(params: IDeleteFileParams): Promise<boolean> {\n return Promise.resolve(false);\n }\n}\n"],"names":["createStoragePlugInConfig","config","StoragePlugIn","storageId","key","params"],"mappings":"AAwEO,SAASA,EAA0BC,GAAsE;AACvG,SAAA;AAAA,IACL,GAAGA;AAAA,IACH,YAAY;AAAA,EACd;AACF;ACpCO,MAAeC,EAAoD;AAAA,EACxE,cAAc;AAAA,EAAA;AAAA,EAEd,WAAWC,GAAsB;AACzB,UAAAC,IAAM,iBAAiBD,CAAS;AAC/B,WAAA,OAAO,gBAAgB,QAAQC,CAAG;AAAA,EAAA;AAAA,EAG3C,OAAO;AACL,SAAK,OAAO;AAAA,EAAA;AAAA,EAUd,UAAU;AACR,SAAK,UAAU;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAajB,MAAM,WAAWC,GAAuD;AAC/D,WAAA,MAAM,KAAK,aAAaA,CAAM;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAavC,WAAWA,GAA6C;AAC/C,WAAA,KAAK,aAAaA,CAAM;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQvB,aAAaA,GAA6C;AAC3D,WAAA,QAAQ,QAAQ,EAAK;AAAA,EAAA;AAEhC;"}
|
|
@@ -1,43 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* 上传后文件访问地址
|
|
4
|
-
*/
|
|
5
|
-
url: string;
|
|
6
|
-
/**
|
|
7
|
-
* 额外数据
|
|
8
|
-
*/
|
|
9
|
-
extra: any;
|
|
10
|
-
}
|
|
11
|
-
export interface IUploadFileParams {
|
|
12
|
-
/**
|
|
13
|
-
* 上传 id
|
|
14
|
-
*/
|
|
15
|
-
readonly id: string;
|
|
16
|
-
/**
|
|
17
|
-
* 配置 id
|
|
18
|
-
*/
|
|
19
|
-
readonly storageId: string;
|
|
20
|
-
/**
|
|
21
|
-
* 文件路径
|
|
22
|
-
*/
|
|
23
|
-
readonly filePath: string;
|
|
24
|
-
/**
|
|
25
|
-
* 文件名称
|
|
26
|
-
*/
|
|
27
|
-
readonly fileName: string;
|
|
28
|
-
/**
|
|
29
|
-
* 文件大小
|
|
30
|
-
*/
|
|
31
|
-
readonly fileSize: number;
|
|
32
|
-
/**
|
|
33
|
-
* 文件
|
|
34
|
-
*/
|
|
35
|
-
readonly file: File;
|
|
36
|
-
}
|
|
1
|
+
import { IDeleteFileParams, IUploadFileParams, IUploadFileResult } from './StoragePlugInType';
|
|
37
2
|
/**
|
|
38
3
|
* 插件接口
|
|
39
4
|
*/
|
|
40
|
-
interface IStoragePlugIn<C = any> {
|
|
5
|
+
interface IStoragePlugIn<C = any, E = any> {
|
|
41
6
|
/**
|
|
42
7
|
* 插件初始化调用
|
|
43
8
|
*/
|
|
@@ -52,6 +17,11 @@ interface IStoragePlugIn<C = any> {
|
|
|
52
17
|
* @param params 参数
|
|
53
18
|
*/
|
|
54
19
|
uploadFile(params: IUploadFileParams): Promise<IUploadFileResult>;
|
|
20
|
+
/**
|
|
21
|
+
* 删除文件
|
|
22
|
+
* @param params 参数
|
|
23
|
+
*/
|
|
24
|
+
deleteFile(params: IDeleteFileParams): Promise<boolean>;
|
|
55
25
|
/**
|
|
56
26
|
* 插件销毁调用
|
|
57
27
|
*/
|
|
@@ -85,6 +55,17 @@ export declare abstract class StoragePlugIn<C = any> implements IStoragePlugIn<C
|
|
|
85
55
|
* 上传文件
|
|
86
56
|
* @param params 参数
|
|
87
57
|
*/
|
|
88
|
-
abstract doUploadFile(params: IUploadFileParams): Promise<IUploadFileResult>;
|
|
58
|
+
protected abstract doUploadFile(params: IUploadFileParams): Promise<IUploadFileResult>;
|
|
59
|
+
/**
|
|
60
|
+
* 删除文件
|
|
61
|
+
* @param params
|
|
62
|
+
*/
|
|
63
|
+
deleteFile(params: IDeleteFileParams): Promise<boolean>;
|
|
64
|
+
/**
|
|
65
|
+
* 删除文件 <br/>
|
|
66
|
+
* 如果要实现删除文件请实现这个接口
|
|
67
|
+
* @param params 参数
|
|
68
|
+
*/
|
|
69
|
+
protected doDeleteFile(params: IDeleteFileParams): Promise<boolean>;
|
|
89
70
|
}
|
|
90
71
|
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export interface IUploadFileResult<E = any> {
|
|
2
|
+
/**
|
|
3
|
+
* 上传后文件访问地址
|
|
4
|
+
*/
|
|
5
|
+
url: string;
|
|
6
|
+
/**
|
|
7
|
+
* 额外数据
|
|
8
|
+
*/
|
|
9
|
+
extra?: E;
|
|
10
|
+
}
|
|
11
|
+
export interface IUploadFileParams {
|
|
12
|
+
/**
|
|
13
|
+
* 上传 id
|
|
14
|
+
*/
|
|
15
|
+
readonly id: string;
|
|
16
|
+
/**
|
|
17
|
+
* 配置 id
|
|
18
|
+
*/
|
|
19
|
+
readonly storageId: string;
|
|
20
|
+
/**
|
|
21
|
+
* 文件路径
|
|
22
|
+
*/
|
|
23
|
+
readonly filePath: string;
|
|
24
|
+
/**
|
|
25
|
+
* 文件名称
|
|
26
|
+
*/
|
|
27
|
+
readonly fileName: string;
|
|
28
|
+
/**
|
|
29
|
+
* 文件大小
|
|
30
|
+
*/
|
|
31
|
+
readonly fileSize: number;
|
|
32
|
+
/**
|
|
33
|
+
* 文件
|
|
34
|
+
*/
|
|
35
|
+
readonly file: File;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* 删除参数
|
|
39
|
+
*/
|
|
40
|
+
export interface IDeleteFileParams<E = any> {
|
|
41
|
+
storageId: string;
|
|
42
|
+
/**
|
|
43
|
+
* 额外数据
|
|
44
|
+
*/
|
|
45
|
+
extra?: E;
|
|
46
|
+
}
|
package/dist/storage/index.d.ts
CHANGED