zova-module-a-openapi 5.1.10 → 5.1.12
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/.metadata/index.d.ts +23 -0
- package/dist/.metadata/index.d.ts.map +1 -1
- package/dist/bean/bean.resourceProviders.d.ts +8 -0
- package/dist/bean/bean.resourceProviders.d.ts.map +1 -0
- package/dist/bean/sys.sdk.d.ts.map +1 -1
- package/dist/config/config.d.ts +2 -3
- package/dist/config/config.d.ts.map +1 -1
- package/dist/index.js +53 -47
- package/dist/index.js.map +1 -1
- package/dist/lib/schema.d.ts +1 -1
- package/dist/lib/schema.d.ts.map +1 -1
- package/dist/model/sdk.d.ts +2 -2
- package/dist/model/sdk.d.ts.map +1 -1
- package/dist/monkey.d.ts.map +1 -1
- package/dist/types/action.d.ts +17 -4
- package/dist/types/action.d.ts.map +1 -1
- package/dist/types/actions.d.ts +49 -13
- package/dist/types/actions.d.ts.map +1 -1
- package/dist/types/blocks.d.ts +13 -0
- package/dist/types/blocks.d.ts.map +1 -0
- package/dist/types/fieldLayout.d.ts +3 -0
- package/dist/types/fieldLayout.d.ts.map +1 -0
- package/dist/types/formField.d.ts +9 -0
- package/dist/types/formField.d.ts.map +1 -0
- package/dist/types/formMeta.d.ts +9 -0
- package/dist/types/formMeta.d.ts.map +1 -0
- package/dist/types/index.d.ts +8 -8
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/jsx.d.ts +3 -3
- package/dist/types/jsx.d.ts.map +1 -1
- package/dist/types/performAction.d.ts +14 -0
- package/dist/types/performAction.d.ts.map +1 -0
- package/dist/types/permissions.d.ts +3 -7
- package/dist/types/permissions.d.ts.map +1 -1
- package/dist/types/resourceProviders.d.ts +54 -0
- package/dist/types/resourceProviders.d.ts.map +1 -0
- package/dist/types/rest.d.ts +33 -29
- package/dist/types/rest.d.ts.map +1 -1
- package/dist/types/schema.d.ts.map +1 -1
- package/dist/types/sdk.d.ts +0 -2
- package/dist/types/sdk.d.ts.map +1 -1
- package/dist/types/tableCell.d.ts +13 -0
- package/dist/types/tableCell.d.ts.map +1 -0
- package/package.json +6 -5
- package/src/.metadata/index.ts +31 -0
- package/src/bean/bean.resourceProviders.ts +34 -0
- package/src/bean/sys.sdk.ts +11 -2
- package/src/config/config.ts +2 -33
- package/src/lib/schema.ts +11 -6
- package/src/model/sdk.ts +5 -8
- package/src/monkey.ts +5 -1
- package/src/types/action.ts +24 -4
- package/src/types/actions.ts +60 -13
- package/src/types/blocks.ts +14 -0
- package/src/types/fieldLayout.ts +1 -0
- package/src/types/formField.ts +9 -0
- package/src/types/formMeta.ts +9 -0
- package/src/types/index.ts +8 -8
- package/src/types/jsx.ts +4 -4
- package/src/types/performAction.ts +15 -0
- package/src/types/permissions.ts +4 -7
- package/src/types/resourceProviders.ts +65 -0
- package/src/types/rest.ts +64 -53
- package/src/types/schema.ts +3 -1
- package/src/types/sdk.ts +0 -2
- package/src/types/tableCell.ts +14 -0
- package/dist/types/captcha.d.ts +0 -15
- package/dist/types/captcha.d.ts.map +0 -1
- package/dist/types/date.d.ts +0 -5
- package/dist/types/date.d.ts.map +0 -1
- package/dist/types/resourceMeta.d.ts +0 -32
- package/dist/types/resourceMeta.d.ts.map +0 -1
- package/dist/types/resourcePicker.d.ts +0 -10
- package/dist/types/resourcePicker.d.ts.map +0 -1
- package/dist/types/select.d.ts +0 -16
- package/dist/types/select.d.ts.map +0 -1
- package/dist/types/textarea.d.ts +0 -11
- package/dist/types/textarea.d.ts.map +0 -1
- package/dist/types/toggle.d.ts +0 -4
- package/dist/types/toggle.d.ts.map +0 -1
- package/src/types/captcha.ts +0 -16
- package/src/types/date.ts +0 -25
- package/src/types/resourceMeta.ts +0 -37
- package/src/types/resourcePicker.ts +0 -10
- package/src/types/select.ts +0 -16
- package/src/types/textarea.ts +0 -10
- package/src/types/toggle.ts +0 -3
package/src/lib/schema.ts
CHANGED
|
@@ -15,7 +15,7 @@ const __FilterColumnsIgnore = ['columns', 'where', 'orders', 'pageNo', 'pageSize
|
|
|
15
15
|
export function loadSchemaProperties(
|
|
16
16
|
schema: SchemaObject | undefined,
|
|
17
17
|
onGetSchema: (schemaName: string) => SchemaObject | undefined,
|
|
18
|
-
|
|
18
|
+
schemaScene?: TypeSchemaScene,
|
|
19
19
|
): SchemaObject[] | undefined {
|
|
20
20
|
if (!schema) return;
|
|
21
21
|
const properties = schema.properties!;
|
|
@@ -27,15 +27,20 @@ export function loadSchemaProperties(
|
|
|
27
27
|
property = onGetSchema(property.$ref)!;
|
|
28
28
|
}
|
|
29
29
|
if (!property) continue;
|
|
30
|
-
const
|
|
31
|
-
if (
|
|
32
|
-
const parts =
|
|
30
|
+
const fieldSource = property.rest?.fieldSource;
|
|
31
|
+
if (fieldSource) {
|
|
32
|
+
const parts = fieldSource.split('.');
|
|
33
33
|
const propertyParent: any = parts[0] === key ? property : result.find(item => item.key === parts[0]);
|
|
34
34
|
property = propertyParent?.properties[parts[1]];
|
|
35
|
-
key =
|
|
35
|
+
key = fieldSource;
|
|
36
36
|
}
|
|
37
37
|
if (!property) continue;
|
|
38
|
-
property = deepExtend(
|
|
38
|
+
property = deepExtend(
|
|
39
|
+
{ key },
|
|
40
|
+
property,
|
|
41
|
+
schemaScene && ['form-view', 'form-create', 'filter'].includes(schemaScene) ? { rest: property.rest?.['form'] ?? {} } : undefined,
|
|
42
|
+
schemaScene ? { rest: property.rest?.[schemaScene] ?? {} } : undefined,
|
|
43
|
+
);
|
|
39
44
|
result.push(property);
|
|
40
45
|
}
|
|
41
46
|
// sort
|
package/src/model/sdk.ts
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
loadSchemaProperties,
|
|
15
15
|
schemaToZodSchema,
|
|
16
16
|
} from '../lib/schema.js';
|
|
17
|
-
import { TypeOpenapiPermissions } from '../types/
|
|
17
|
+
import { TypeOpenapiPermissions } from '../types/permissions.js';
|
|
18
18
|
import { TypeSchemaScene } from '../types/rest.js';
|
|
19
19
|
import { IOpenapiSchemas, TypeOpenapiSchemasSdk } from '../types/schema.js';
|
|
20
20
|
import { TypeRequestMethod } from '../types/sdk.js';
|
|
@@ -73,11 +73,7 @@ export class ModelSdk extends BeanModelBase {
|
|
|
73
73
|
return this.$useStateData({
|
|
74
74
|
queryKey: ['permissions', resource],
|
|
75
75
|
queryFn: async () => {
|
|
76
|
-
|
|
77
|
-
const bootstrap = await this.$$sysSdk.loadBootstrap(this.$fetch, resource);
|
|
78
|
-
let permissions = bootstrap.resourceMeta.permissions;
|
|
79
|
-
if (!isNil(permissions)) return permissions;
|
|
80
|
-
permissions = (await this.$fetch.get(
|
|
76
|
+
const permissions = (await this.$fetch.get(
|
|
81
77
|
this.sys.util.apiActionPathTranslate(this.scope.config.api.permissions, { resource }),
|
|
82
78
|
this.sys.util.apiActionConfigPrepare(),
|
|
83
79
|
)) as TypeOpenapiPermissions;
|
|
@@ -153,6 +149,7 @@ export class ModelSdk extends BeanModelBase {
|
|
|
153
149
|
}
|
|
154
150
|
|
|
155
151
|
public createApiSchemas(api: string, apiMethod?: TypeRequestMethod, apiOptions?: IApiSchemaOptions): IOpenapiSchemas {
|
|
152
|
+
// eslint-disable-next-line
|
|
156
153
|
const self = this;
|
|
157
154
|
const sdk = this.getSdk(api, apiMethod, apiOptions);
|
|
158
155
|
return {
|
|
@@ -217,8 +214,8 @@ export class ModelSdk extends BeanModelBase {
|
|
|
217
214
|
};
|
|
218
215
|
}
|
|
219
216
|
|
|
220
|
-
public loadSchemaProperties(schema: SchemaObject | undefined,
|
|
221
|
-
return loadSchemaProperties(schema, schemaName => this.getSchema(schemaName).data,
|
|
217
|
+
public loadSchemaProperties(schema: SchemaObject | undefined, schemaScene?: TypeSchemaScene): SchemaObject[] | undefined {
|
|
218
|
+
return loadSchemaProperties(schema, schemaName => this.getSchema(schemaName).data, schemaScene);
|
|
222
219
|
}
|
|
223
220
|
|
|
224
221
|
public schemaToZodSchema<T extends z.ZodType = z.ZodType>(schema: SchemaObject): T {
|
package/src/monkey.ts
CHANGED
|
@@ -47,6 +47,10 @@ export class Monkey extends BeanSimple implements IMonkeyModule, IMonkeyBeanInit
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
private async _loadSdk() {
|
|
50
|
-
this._modelSdk.value = await this.app.bean._getBeanSelector(
|
|
50
|
+
this._modelSdk.value = await this.app.bean._getBeanSelector(
|
|
51
|
+
'a-openapi.model.sdk',
|
|
52
|
+
true,
|
|
53
|
+
this.app.meta.locale.current,
|
|
54
|
+
);
|
|
51
55
|
}
|
|
52
56
|
}
|
package/src/types/action.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { BeanBase, ZovaApplication, ZovaContext } from 'zova';
|
|
2
2
|
import type { ZovaJsx } from 'zova-jsx';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
import { TableIdentity } from 'table-identity';
|
|
5
|
+
|
|
6
|
+
import { TypeOpenapiPermissions } from './permissions.js';
|
|
4
7
|
|
|
5
8
|
export interface IJsxRenderContextBase {
|
|
6
9
|
app: ZovaApplication;
|
|
@@ -11,10 +14,19 @@ export interface IJsxRenderContextBase {
|
|
|
11
14
|
$jsx: ZovaJsx;
|
|
12
15
|
}
|
|
13
16
|
|
|
17
|
+
export interface IJsxRenderContextPageEntry extends IJsxRenderContextBase {
|
|
18
|
+
$celScope: IPageEntryScope;
|
|
19
|
+
// $$pageEntry: ControllerRestPageEntry<TData>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface IPageEntryScope {
|
|
23
|
+
resource?: string;
|
|
24
|
+
id: TableIdentity | null;
|
|
25
|
+
permissions?: TypeOpenapiPermissions;
|
|
26
|
+
}
|
|
27
|
+
|
|
14
28
|
export interface IJsxRenderSceneRecord {
|
|
15
|
-
pageWrapper: never;
|
|
16
29
|
page: never;
|
|
17
|
-
pageEntryWrapper: never;
|
|
18
30
|
pageEntry: never;
|
|
19
31
|
// table: never;
|
|
20
32
|
tableColumn: never;
|
|
@@ -23,4 +35,12 @@ export interface IJsxRenderSceneRecord {
|
|
|
23
35
|
formField: never;
|
|
24
36
|
}
|
|
25
37
|
|
|
26
|
-
export
|
|
38
|
+
export interface IPageScope {
|
|
39
|
+
resource?: string;
|
|
40
|
+
permissions?: TypeOpenapiPermissions;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface IJsxRenderContextPage extends IJsxRenderContextBase {
|
|
44
|
+
$celScope: IPageScope;
|
|
45
|
+
// $$page: ControllerRestPage<TData>;
|
|
46
|
+
}
|
package/src/types/actions.ts
CHANGED
|
@@ -1,18 +1,65 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { TableIdentity } from 'table-identity';
|
|
2
|
+
import { types } from 'typestyle';
|
|
3
|
+
import { TypeRenderComponentJsx } from 'zova-jsx';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import type { TypeFormScene } from './formMeta.ts';
|
|
6
|
+
|
|
7
|
+
export type IResourceActionBulkRecord = {
|
|
8
|
+
[KEY in keyof IResourceComponentActionBulkRecord as KEY extends `Action${infer Rest}`
|
|
9
|
+
? Uncapitalize<Rest>
|
|
10
|
+
: KEY]: IResourceComponentActionBulkRecord[KEY];
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type IResourceActionRowRecord = {
|
|
14
|
+
[KEY in keyof IResourceComponentActionRowRecord as KEY extends `Action${infer Rest}`
|
|
15
|
+
? Uncapitalize<Rest>
|
|
16
|
+
: KEY]: IResourceComponentActionRowRecord[KEY];
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export interface IResourceActionTableRecord extends IResourceActionBulkRecord, IResourceActionRowRecord {}
|
|
20
|
+
|
|
21
|
+
export interface IResourceComponentActionBulkRecord {}
|
|
22
|
+
|
|
23
|
+
export interface IResourceComponentActionRowRecord {}
|
|
24
|
+
|
|
25
|
+
export interface IResourceComponentActionTableRecord extends IResourceComponentActionBulkRecord, IResourceComponentActionRowRecord {}
|
|
26
|
+
|
|
27
|
+
export interface IPermissionHint {
|
|
28
|
+
action?: string;
|
|
29
|
+
public?: boolean;
|
|
30
|
+
formScene?: TypeFormScene | TypeFormScene[];
|
|
7
31
|
}
|
|
8
32
|
|
|
9
|
-
export interface
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
33
|
+
export interface IResourceActionBulkOptionsBase {
|
|
34
|
+
class?: any;
|
|
35
|
+
style?: types.NestedCSSProperties;
|
|
36
|
+
resource?: string;
|
|
37
|
+
permission?: {
|
|
38
|
+
action?: keyof IResourceActionBulkRecord;
|
|
39
|
+
public?: boolean;
|
|
40
|
+
};
|
|
14
41
|
}
|
|
15
42
|
|
|
16
|
-
export
|
|
17
|
-
|
|
18
|
-
|
|
43
|
+
export interface IResourceActionRowOptionsBase {
|
|
44
|
+
class?: any;
|
|
45
|
+
style?: types.NestedCSSProperties;
|
|
46
|
+
resource?: string;
|
|
47
|
+
id?: TableIdentity;
|
|
48
|
+
permission?: {
|
|
49
|
+
action?: keyof IResourceActionRowRecord;
|
|
50
|
+
public?: boolean;
|
|
51
|
+
formScene?: TypeFormScene | TypeFormScene[];
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface IResourceComponentActionBulkOptionsAction {
|
|
56
|
+
name: keyof IResourceActionBulkRecord; // not omit operationsBulk
|
|
57
|
+
render?: keyof IResourceComponentActionBulkRecord | TypeRenderComponentJsx;
|
|
58
|
+
options?: IResourceActionBulkOptionsBase;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface IResourceComponentActionRowOptionsAction {
|
|
62
|
+
name: keyof IResourceActionRowRecord; // not omit operationsBulk
|
|
63
|
+
render?: keyof IResourceComponentActionRowRecord | TypeRenderComponentJsx;
|
|
64
|
+
options?: IResourceActionRowOptionsBase;
|
|
65
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { types } from 'typestyle';
|
|
2
|
+
import { TypeRenderComponentJsx } from 'zova-jsx';
|
|
3
|
+
|
|
4
|
+
export interface IResourceComponentBlockRecord {}
|
|
5
|
+
|
|
6
|
+
export interface IResourceBlockOptionsBase {
|
|
7
|
+
class?: any;
|
|
8
|
+
style?: types.NestedCSSProperties;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface IResourceComponentBlockOptionsBlock {
|
|
12
|
+
render?: keyof IResourceComponentBlockRecord | TypeRenderComponentJsx;
|
|
13
|
+
options?: IResourceBlockOptionsBase;
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export interface ISchemaRenderComponentLayoutOptions {}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type TypeFormMode = 'view' | 'edit';
|
|
2
|
+
export type TypeEditMode = 'create' | 'update';
|
|
3
|
+
export type TypeFormScene = 'view' | 'create' | 'edit';
|
|
4
|
+
|
|
5
|
+
export interface IFormMeta {
|
|
6
|
+
formMode: TypeFormMode;
|
|
7
|
+
editMode?: TypeEditMode;
|
|
8
|
+
formScene?: TypeFormScene;
|
|
9
|
+
}
|
package/src/types/index.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
export * from './action.js';
|
|
2
|
-
export * from './actions.js';
|
|
3
|
-
export * from './captcha.js';
|
|
4
2
|
export * from './database.js';
|
|
5
|
-
export * from './date.js';
|
|
6
3
|
export * from './jsx.js';
|
|
7
4
|
export * from './permissions.js';
|
|
8
|
-
export * from './resourceMeta.js';
|
|
9
|
-
export * from './resourcePicker.js';
|
|
10
5
|
export * from './rest.js';
|
|
11
6
|
export * from './schema.js';
|
|
12
7
|
export * from './sdk.js';
|
|
13
|
-
export * from './select.js';
|
|
14
8
|
export * from './table.js';
|
|
15
|
-
export * from './
|
|
16
|
-
export * from './
|
|
9
|
+
export * from './actions.js';
|
|
10
|
+
export * from './fieldLayout.js';
|
|
11
|
+
export * from './formMeta.js';
|
|
12
|
+
export * from './blocks.js';
|
|
13
|
+
export * from './tableCell.js';
|
|
14
|
+
export * from './formField.js';
|
|
15
|
+
export * from './performAction.js';
|
|
16
|
+
export * from './resourceProviders.js';
|
package/src/types/jsx.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { IActionsRecord } from 'zova-module-a-action';
|
|
2
|
-
|
|
3
|
-
import type { TypeActionProvider } from './action.js';
|
|
4
1
|
import 'zova-jsx';
|
|
2
|
+
import { IActionRecord } from 'zova-module-a-action';
|
|
3
|
+
|
|
4
|
+
import { IPerformActionRecord } from './performAction.js';
|
|
5
5
|
|
|
6
6
|
declare module 'zova-jsx' {
|
|
7
7
|
export interface ZovaJsx {
|
|
8
|
-
normalizeAction(type: keyof
|
|
8
|
+
normalizeAction(type: keyof IPerformActionRecord): keyof IActionRecord;
|
|
9
9
|
}
|
|
10
10
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TableIdentity } from 'table-identity';
|
|
2
|
+
import { IDecoratorActionOptions } from 'zova-module-a-action';
|
|
3
|
+
|
|
4
|
+
export interface IPerformActionRecord {}
|
|
5
|
+
|
|
6
|
+
export interface IPerformActionOptionsBase<Result = any> extends IDecoratorActionOptions<Result> {}
|
|
7
|
+
|
|
8
|
+
export interface IPerformActionRowOptionsBase<Result = any> extends IDecoratorActionOptions<Result> {
|
|
9
|
+
resource?: string;
|
|
10
|
+
id?: TableIdentity;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface IPerformActionBulkOptionsBase<Result = any> extends IDecoratorActionOptions<Result> {
|
|
14
|
+
resource?: string;
|
|
15
|
+
}
|
package/src/types/permissions.ts
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import type { TableIdentity } from 'table-identity';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
create: boolean;
|
|
5
|
-
view: boolean;
|
|
6
|
-
update: boolean;
|
|
7
|
-
delete: boolean;
|
|
8
|
-
}
|
|
3
|
+
import { IResourceActionTableRecord } from './actions.js';
|
|
9
4
|
|
|
10
5
|
export type IOpenapiPermissionModeActionActions = {
|
|
11
|
-
[K in keyof
|
|
6
|
+
[K in keyof IResourceActionTableRecord]?: IResourceActionTableRecord[K];
|
|
12
7
|
};
|
|
13
8
|
|
|
14
9
|
export interface IOpenapiPermissions {
|
|
@@ -16,3 +11,5 @@ export interface IOpenapiPermissions {
|
|
|
16
11
|
roleNames?: string[];
|
|
17
12
|
actions?: IOpenapiPermissionModeActionActions;
|
|
18
13
|
}
|
|
14
|
+
|
|
15
|
+
export type TypeOpenapiPermissions = IOpenapiPermissions | boolean;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { TypeBeanRecordGeneralSelector, TypeComponentRecordSelectorKeys } from 'zova';
|
|
2
|
+
import { IActionRecord } from 'zova-module-a-action';
|
|
3
|
+
import { IFormProviderBehaviors } from 'zova-module-a-form';
|
|
4
|
+
|
|
5
|
+
import { IResourceComponentActionBulkRecord, IResourceComponentActionRowRecord } from './actions.js';
|
|
6
|
+
import { IResourceComponentBlockRecord } from './blocks.js';
|
|
7
|
+
import { IResourceComponentFormFieldRecord } from './formField.js';
|
|
8
|
+
import { IPerformActionRecord } from './performAction.js';
|
|
9
|
+
import { IResourceComponentTableCellRecord } from './tableCell.js';
|
|
10
|
+
|
|
11
|
+
export type IResourceProvidersBlocks = {
|
|
12
|
+
[KEY in keyof IResourceComponentBlockRecord]?: TypeComponentRecordSelectorKeys<'block'>;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type IResourceProvidersFormFields = {
|
|
16
|
+
[KEY in keyof IResourceComponentFormFieldRecord]?: TypeComponentRecordSelectorKeys<'formField'>;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type IResourceProvidersTableCells = {
|
|
20
|
+
[KEY in keyof IResourceComponentTableCellRecord]?: keyof TypeBeanRecordGeneralSelector<'tableCell'>;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export type IResourceProvidersPerformActions = {
|
|
24
|
+
[KEY in keyof IPerformActionRecord]?: keyof IActionRecord;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export type IResourceProvidersTableActionsBulk = {
|
|
28
|
+
[KEY in keyof IResourceComponentActionBulkRecord]?: TypeComponentRecordSelectorKeys<'action'>;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export type IResourceProvidersTableActionsRow = {
|
|
32
|
+
[KEY in keyof IResourceComponentActionRowRecord]?: keyof TypeBeanRecordGeneralSelector<'tableCell'>;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export type IResourceProvidersFormActionsRow = {
|
|
36
|
+
[KEY in keyof IResourceComponentActionRowRecord]?: TypeComponentRecordSelectorKeys<'action'>;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export type IResourceProvidersBehaviors = IFormProviderBehaviors;
|
|
40
|
+
|
|
41
|
+
export interface IResourceProviders {
|
|
42
|
+
blocks?: IResourceProvidersBlocks;
|
|
43
|
+
formFields?: IResourceProvidersFormFields;
|
|
44
|
+
tableCells?: IResourceProvidersTableCells;
|
|
45
|
+
performActions?: IResourceProvidersPerformActions;
|
|
46
|
+
behaviors?: IResourceProvidersBehaviors;
|
|
47
|
+
table?: {
|
|
48
|
+
actionsBulk?: IResourceProvidersTableActionsBulk;
|
|
49
|
+
actionsRow?: IResourceProvidersTableActionsRow;
|
|
50
|
+
};
|
|
51
|
+
form?: {
|
|
52
|
+
actionsRow?: IResourceProvidersFormActionsRow;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface IFormProvider {
|
|
57
|
+
components?: IResourceProvidersFormFields & IResourceProvidersFormActionsRow;
|
|
58
|
+
actions?: IResourceProvidersPerformActions;
|
|
59
|
+
behaviors?: IResourceProvidersBehaviors;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface ITableProvider {
|
|
63
|
+
components?: IResourceProvidersTableCells & IResourceProvidersTableActionsRow;
|
|
64
|
+
actions?: IResourceProvidersPerformActions;
|
|
65
|
+
}
|
package/src/types/rest.ts
CHANGED
|
@@ -1,34 +1,45 @@
|
|
|
1
|
-
import type { CurrencyOptions } from '@zhennann/currency';
|
|
2
1
|
import type { ComponentPublicInstance } from 'vue';
|
|
3
2
|
import type { Constructable, IComponentRecord, TypeBeanRecordGeneralSelector } from 'zova';
|
|
4
3
|
import type { TypeRenderComponentJsx } from 'zova-jsx';
|
|
5
4
|
|
|
6
|
-
import type { TypeResourceActionRowRecordRender } from './actions.js';
|
|
7
|
-
import type { ICaptchaOptions } from './captcha.js';
|
|
8
|
-
import type { TypeDateFormat } from './date.js';
|
|
9
|
-
import type { IResourcePickerOptions } from './resourcePicker.js';
|
|
10
|
-
import type { ISelectOptions } from './select.js';
|
|
11
|
-
import type { ITextareaOptions } from './textarea.js';
|
|
12
|
-
import type { IToggleOptions } from './toggle.js';
|
|
13
5
|
import 'openapi3-ts/oas30';
|
|
14
6
|
import 'openapi3-ts/oas31';
|
|
7
|
+
import { IResourceComponentBlockOptionsBlock } from './blocks.js';
|
|
8
|
+
import { IResourceComponentFormFieldRecord } from './formField.js';
|
|
9
|
+
import { IResourceProvidersTableActionsRow, IResourceProvidersTableCells } from './resourceProviders.js';
|
|
15
10
|
|
|
16
|
-
export interface
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
textarea?: ITextareaOptions;
|
|
24
|
-
resourcePicker?: IResourcePickerOptions;
|
|
25
|
-
customKey?: string;
|
|
11
|
+
export interface ISchemaRenderComponentPresetRecord extends IResourceComponentFormFieldRecord {}
|
|
12
|
+
|
|
13
|
+
export interface ISchemaObjectExtensionFieldRestTable {
|
|
14
|
+
//
|
|
15
|
+
preset?: ISchemaRenderComponentPresetRecord;
|
|
16
|
+
//
|
|
17
|
+
fieldSource?: string;
|
|
26
18
|
visible?: boolean;
|
|
27
|
-
displayValue?: any;
|
|
28
19
|
order?: number;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
20
|
+
disableNotifyChanged?: boolean;
|
|
21
|
+
readonly?: boolean;
|
|
22
|
+
//
|
|
23
|
+
render?: TypeTableCellRenderComponentNormal;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface ISchemaObjectExtensionFieldRest {
|
|
27
|
+
//
|
|
28
|
+
'preset'?: ISchemaRenderComponentPresetRecord;
|
|
29
|
+
'blocks'?: IResourceComponentBlockOptionsBlock[];
|
|
30
|
+
//
|
|
31
|
+
'fieldSource'?: string;
|
|
32
|
+
'visible'?: boolean;
|
|
33
|
+
'order'?: number;
|
|
34
|
+
'disableNotifyChanged'?: boolean;
|
|
35
|
+
'readonly'?: boolean;
|
|
36
|
+
//
|
|
37
|
+
'render'?: TypeFormFieldRenderComponentNormal | TypeTableCellRenderComponentNormal;
|
|
38
|
+
'table'?: Omit<ISchemaObjectExtensionFieldRest, TypeSchemaScene>;
|
|
39
|
+
'form'?: Omit<ISchemaObjectExtensionFieldRest, TypeSchemaScene>;
|
|
40
|
+
'form-view'?: Omit<ISchemaObjectExtensionFieldRest, TypeSchemaScene>;
|
|
41
|
+
'form-create'?: Omit<ISchemaObjectExtensionFieldRest, TypeSchemaScene>;
|
|
42
|
+
'filter'?: Omit<ISchemaObjectExtensionFieldRest, TypeSchemaScene>;
|
|
32
43
|
}
|
|
33
44
|
|
|
34
45
|
export interface ISchemaObjectExtensionFieldFilterCapabilities {
|
|
@@ -56,41 +67,40 @@ declare module 'openapi3-ts/oas31' {
|
|
|
56
67
|
export interface SchemaObject extends ISchemaObjectExtensionField {}
|
|
57
68
|
}
|
|
58
69
|
|
|
59
|
-
export type TypeSchemaScene = 'table' |
|
|
60
|
-
export type TypeFormSchemaScene = 'form' | 'filter';
|
|
70
|
+
export type TypeSchemaScene = 'table' | TypeFormSchemaScene;
|
|
71
|
+
export type TypeFormSchemaScene = 'form' | 'form-view' | 'form-create' | 'filter';
|
|
61
72
|
|
|
62
|
-
export const renderFormFieldTopPropsSystem = ['order', 'table', 'form', 'filter'];
|
|
63
|
-
export const renderTableColumnTopPropsSystem = ['order', 'table', 'form', '
|
|
73
|
+
export const renderFormFieldTopPropsSystem = ['order', 'table', 'form', 'form-view', 'form-create', 'filter'];
|
|
74
|
+
export const renderTableColumnTopPropsSystem = ['order', 'table', 'form', 'form-view', 'form-create', 'filter'];
|
|
64
75
|
|
|
65
|
-
export type TypeRenderComponentPreset =
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
76
|
+
export type TypeRenderComponentPreset = keyof ISchemaRenderComponentPresetRecord;
|
|
77
|
+
// | 'text'
|
|
78
|
+
// | 'captcha'
|
|
79
|
+
// | 'currency'
|
|
80
|
+
// | 'date'
|
|
81
|
+
// | 'dateRange'
|
|
82
|
+
// | 'toggle'
|
|
83
|
+
// | 'select'
|
|
84
|
+
// | 'textarea'
|
|
85
|
+
// | 'resourcePicker';
|
|
86
|
+
// | 'checkbox';
|
|
87
|
+
// | 'radio'
|
|
88
|
+
// | 'switch';
|
|
89
|
+
// | 'image'
|
|
90
|
+
// | 'file'
|
|
91
|
+
// | 'color'
|
|
92
|
+
// | 'password'
|
|
93
|
+
// | 'email'
|
|
94
|
+
// | 'url';
|
|
83
95
|
|
|
84
96
|
// form
|
|
85
97
|
export type TypeFormFieldRenderComponentNormal = Constructable<ComponentPublicInstance> | keyof IComponentRecord | TypeRenderComponentPreset;
|
|
86
98
|
export type TypeFormFieldRenderComponent = TypeFormFieldRenderComponentNormal | TypeRenderComponentJsx;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
| 'textarea'
|
|
93
|
-
| 'select';
|
|
99
|
+
// should use input for config.ts of a-openapi
|
|
100
|
+
export type TypeFormFieldRenderComponentProvider = Constructable | Constructable<ComponentPublicInstance> | keyof IComponentRecord | 'input';
|
|
101
|
+
// | 'input'
|
|
102
|
+
// | 'textarea'
|
|
103
|
+
// | 'select';
|
|
94
104
|
|
|
95
105
|
// table
|
|
96
106
|
export type TypeTableCellRenderComponentNormal =
|
|
@@ -98,10 +108,11 @@ export type TypeTableCellRenderComponentNormal =
|
|
|
98
108
|
| keyof IComponentRecord
|
|
99
109
|
| keyof TypeBeanRecordGeneralSelector<'tableCell'>
|
|
100
110
|
| TypeRenderComponentPreset;
|
|
101
|
-
export type TypeTableCellRenderComponent =
|
|
111
|
+
export type TypeTableCellRenderComponent = keyof (IResourceProvidersTableCells & IResourceProvidersTableActionsRow) | TypeRenderComponentJsx;
|
|
102
112
|
export type TypeTableCellRenderComponentProvider =
|
|
103
113
|
| Constructable<ComponentPublicInstance>
|
|
114
|
+
| TypeRenderComponentJsx
|
|
104
115
|
| keyof IComponentRecord
|
|
105
116
|
| keyof TypeBeanRecordGeneralSelector<'tableCell'>
|
|
106
117
|
| 'text';
|
|
107
|
-
export type
|
|
118
|
+
export type TypeTableBulkRenderComponentProvider = Constructable<ComponentPublicInstance> | keyof IComponentRecord | TypeRenderComponentJsx;
|
package/src/types/schema.ts
CHANGED
|
@@ -11,7 +11,9 @@ export interface IOpenapiSchema {
|
|
|
11
11
|
|
|
12
12
|
export interface IOpenapiSchemaMeta {}
|
|
13
13
|
|
|
14
|
-
export type TypeOpenapiSchemasSdk = UnwrapNestedRefs<
|
|
14
|
+
export type TypeOpenapiSchemasSdk = UnwrapNestedRefs<
|
|
15
|
+
UseQueryReturnType<IOpenapiSdkItem, DefaultError>
|
|
16
|
+
>;
|
|
15
17
|
|
|
16
18
|
export interface IOpenapiSchemas {
|
|
17
19
|
sdk: TypeOpenapiSchemasSdk;
|
package/src/types/sdk.ts
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import type { OperationObject } from 'openapi3-ts/oas31';
|
|
2
2
|
|
|
3
3
|
import type { ModelSdk } from '../model/sdk.js';
|
|
4
|
-
import type { IOpenapiOptionsResourceMeta } from './resourceMeta.js';
|
|
5
4
|
import type { IOpenapiSchemaMeta } from './schema.js';
|
|
6
5
|
|
|
7
6
|
export const SymbolOpenapiSchemaName = '__schemaName__';
|
|
8
7
|
|
|
9
8
|
export interface IOpenapiSdkBootstrap {
|
|
10
9
|
apiPath: string;
|
|
11
|
-
resourceMeta: IOpenapiOptionsResourceMeta;
|
|
12
10
|
}
|
|
13
11
|
|
|
14
12
|
export interface IOpenapiSdkItem {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { types } from 'typestyle';
|
|
2
|
+
import { TypeRenderComponentJsx } from 'zova-jsx';
|
|
3
|
+
|
|
4
|
+
export interface IResourceComponentTableCellRecord {}
|
|
5
|
+
|
|
6
|
+
export interface IResourceTableCellOptionsBase {
|
|
7
|
+
class?: any;
|
|
8
|
+
style?: types.NestedCSSProperties;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface IResourceComponentTableCellOptionsCell {
|
|
12
|
+
render?: keyof IResourceComponentTableCellRecord | TypeRenderComponentJsx;
|
|
13
|
+
options?: IResourceTableCellOptionsBase;
|
|
14
|
+
}
|
package/dist/types/captcha.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export interface ICaptchaSceneRecord {
|
|
2
|
-
'captcha-simple:simple': never;
|
|
3
|
-
}
|
|
4
|
-
export interface ICaptchaProviderRecord {
|
|
5
|
-
}
|
|
6
|
-
export interface ICaptchaOptions {
|
|
7
|
-
scene?: keyof ICaptchaSceneRecord;
|
|
8
|
-
}
|
|
9
|
-
export interface ICaptchaData {
|
|
10
|
-
id: string;
|
|
11
|
-
provider: keyof ICaptchaProviderRecord | string;
|
|
12
|
-
token?: unknown;
|
|
13
|
-
payload?: unknown;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=captcha.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"captcha.d.ts","sourceRoot":"","sources":["../../src/types/captcha.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,uBAAuB,EAAE,KAAK,CAAC;CAChC;AAED,MAAM,WAAW,sBAAsB;CAAG;AAE1C,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,MAAM,mBAAmB,CAAC;CACnC;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,sBAAsB,GAAG,MAAM,CAAC;IAChD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB"}
|
package/dist/types/date.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export type TypeDateFormatPreset = 'DATE_SHORT' | 'DATE_MED' | 'DATE_MED_WITH_WEEKDAY' | 'DATE_FULL' | 'DATE_HUGE' | 'TIME_SIMPLE' | 'TIME_WITH_SECONDS' | 'TIME_WITH_SHORT_OFFSET' | 'TIME_WITH_LONG_OFFSET' | 'TIME_24_SIMPLE' | 'TIME_24_WITH_SECONDS' | 'TIME_24_WITH_SHORT_OFFSET' | 'TIME_24_WITH_LONG_OFFSET' | 'DATETIME_SHORT' | 'DATETIME_MED' | 'DATETIME_MED_WITH_WEEKDAY' | 'DATETIME_FULL' | 'DATETIME_HUGE' | 'DATETIME_SHORT_WITH_SECONDS' | 'DATETIME_MED_WITH_SECONDS' | 'DATETIME_FULL_WITH_SECONDS' | 'DATETIME_HUGE_WITH_SECONDS';
|
|
2
|
-
export type TypeDateFormat = {
|
|
3
|
-
preset: TypeDateFormatPreset;
|
|
4
|
-
} | string;
|
|
5
|
-
//# sourceMappingURL=date.d.ts.map
|
package/dist/types/date.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../../src/types/date.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,oBAAoB,GAC5B,YAAY,GACZ,UAAU,GACV,uBAAuB,GACvB,WAAW,GACX,WAAW,GACX,aAAa,GACb,mBAAmB,GACnB,wBAAwB,GACxB,uBAAuB,GACvB,gBAAgB,GAChB,sBAAsB,GACtB,2BAA2B,GAC3B,0BAA0B,GAC1B,gBAAgB,GAChB,cAAc,GACd,2BAA2B,GAC3B,eAAe,GACf,eAAe,GACf,6BAA6B,GAC7B,2BAA2B,GAC3B,4BAA4B,GAC5B,4BAA4B,CAAC;AAEjC,MAAM,MAAM,cAAc,GAAG;IAAE,MAAM,EAAE,oBAAoB,CAAA;CAAE,GAAG,MAAM,CAAC"}
|