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.
Files changed (87) hide show
  1. package/dist/.metadata/index.d.ts +23 -0
  2. package/dist/.metadata/index.d.ts.map +1 -1
  3. package/dist/bean/bean.resourceProviders.d.ts +8 -0
  4. package/dist/bean/bean.resourceProviders.d.ts.map +1 -0
  5. package/dist/bean/sys.sdk.d.ts.map +1 -1
  6. package/dist/config/config.d.ts +2 -3
  7. package/dist/config/config.d.ts.map +1 -1
  8. package/dist/index.js +53 -47
  9. package/dist/index.js.map +1 -1
  10. package/dist/lib/schema.d.ts +1 -1
  11. package/dist/lib/schema.d.ts.map +1 -1
  12. package/dist/model/sdk.d.ts +2 -2
  13. package/dist/model/sdk.d.ts.map +1 -1
  14. package/dist/monkey.d.ts.map +1 -1
  15. package/dist/types/action.d.ts +17 -4
  16. package/dist/types/action.d.ts.map +1 -1
  17. package/dist/types/actions.d.ts +49 -13
  18. package/dist/types/actions.d.ts.map +1 -1
  19. package/dist/types/blocks.d.ts +13 -0
  20. package/dist/types/blocks.d.ts.map +1 -0
  21. package/dist/types/fieldLayout.d.ts +3 -0
  22. package/dist/types/fieldLayout.d.ts.map +1 -0
  23. package/dist/types/formField.d.ts +9 -0
  24. package/dist/types/formField.d.ts.map +1 -0
  25. package/dist/types/formMeta.d.ts +9 -0
  26. package/dist/types/formMeta.d.ts.map +1 -0
  27. package/dist/types/index.d.ts +8 -8
  28. package/dist/types/index.d.ts.map +1 -1
  29. package/dist/types/jsx.d.ts +3 -3
  30. package/dist/types/jsx.d.ts.map +1 -1
  31. package/dist/types/performAction.d.ts +14 -0
  32. package/dist/types/performAction.d.ts.map +1 -0
  33. package/dist/types/permissions.d.ts +3 -7
  34. package/dist/types/permissions.d.ts.map +1 -1
  35. package/dist/types/resourceProviders.d.ts +54 -0
  36. package/dist/types/resourceProviders.d.ts.map +1 -0
  37. package/dist/types/rest.d.ts +33 -29
  38. package/dist/types/rest.d.ts.map +1 -1
  39. package/dist/types/schema.d.ts.map +1 -1
  40. package/dist/types/sdk.d.ts +0 -2
  41. package/dist/types/sdk.d.ts.map +1 -1
  42. package/dist/types/tableCell.d.ts +13 -0
  43. package/dist/types/tableCell.d.ts.map +1 -0
  44. package/package.json +6 -5
  45. package/src/.metadata/index.ts +31 -0
  46. package/src/bean/bean.resourceProviders.ts +34 -0
  47. package/src/bean/sys.sdk.ts +11 -2
  48. package/src/config/config.ts +2 -33
  49. package/src/lib/schema.ts +11 -6
  50. package/src/model/sdk.ts +5 -8
  51. package/src/monkey.ts +5 -1
  52. package/src/types/action.ts +24 -4
  53. package/src/types/actions.ts +60 -13
  54. package/src/types/blocks.ts +14 -0
  55. package/src/types/fieldLayout.ts +1 -0
  56. package/src/types/formField.ts +9 -0
  57. package/src/types/formMeta.ts +9 -0
  58. package/src/types/index.ts +8 -8
  59. package/src/types/jsx.ts +4 -4
  60. package/src/types/performAction.ts +15 -0
  61. package/src/types/permissions.ts +4 -7
  62. package/src/types/resourceProviders.ts +65 -0
  63. package/src/types/rest.ts +64 -53
  64. package/src/types/schema.ts +3 -1
  65. package/src/types/sdk.ts +0 -2
  66. package/src/types/tableCell.ts +14 -0
  67. package/dist/types/captcha.d.ts +0 -15
  68. package/dist/types/captcha.d.ts.map +0 -1
  69. package/dist/types/date.d.ts +0 -5
  70. package/dist/types/date.d.ts.map +0 -1
  71. package/dist/types/resourceMeta.d.ts +0 -32
  72. package/dist/types/resourceMeta.d.ts.map +0 -1
  73. package/dist/types/resourcePicker.d.ts +0 -10
  74. package/dist/types/resourcePicker.d.ts.map +0 -1
  75. package/dist/types/select.d.ts +0 -16
  76. package/dist/types/select.d.ts.map +0 -1
  77. package/dist/types/textarea.d.ts +0 -11
  78. package/dist/types/textarea.d.ts.map +0 -1
  79. package/dist/types/toggle.d.ts +0 -4
  80. package/dist/types/toggle.d.ts.map +0 -1
  81. package/src/types/captcha.ts +0 -16
  82. package/src/types/date.ts +0 -25
  83. package/src/types/resourceMeta.ts +0 -37
  84. package/src/types/resourcePicker.ts +0 -10
  85. package/src/types/select.ts +0 -16
  86. package/src/types/textarea.ts +0 -10
  87. 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
- scene?: TypeSchemaScene,
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 customKey = property.rest?.customKey;
31
- if (customKey) {
32
- const parts = customKey.split('.');
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 = customKey;
35
+ key = fieldSource;
36
36
  }
37
37
  if (!property) continue;
38
- property = deepExtend({ key }, property, scene ? { rest: property.rest?.[scene] ?? {} } : undefined);
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/resourceMeta.js';
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
- // should not use this.getBootstrap(resource);
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, scene?: TypeSchemaScene): SchemaObject[] | undefined {
221
- return loadSchemaProperties(schema, schemaName => this.getSchema(schemaName).data, scene);
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('a-openapi.model.sdk', true, this.app.meta.locale.current);
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
  }
@@ -1,6 +1,9 @@
1
1
  import type { BeanBase, ZovaApplication, ZovaContext } from 'zova';
2
2
  import type { ZovaJsx } from 'zova-jsx';
3
- import type { IActionRecord } from 'zova-module-a-action';
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 type TypeActionProvider = keyof IActionRecord;
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
+ }
@@ -1,18 +1,65 @@
1
- export interface IResourceActionTableOptions {}
2
- export interface IResourceActionRowOptions {}
1
+ import { TableIdentity } from 'table-identity';
2
+ import { types } from 'typestyle';
3
+ import { TypeRenderComponentJsx } from 'zova-jsx';
3
4
 
4
- export interface TypeResourceActionTableRecord {
5
- create: IResourceActionTableOptions;
6
- operationsTable: IResourceActionTableOptions;
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 TypeResourceActionRowRecord {
10
- view: IResourceActionRowOptions;
11
- update: IResourceActionRowOptions;
12
- delete: IResourceActionRowOptions;
13
- operationsRow: IResourceActionRowOptions;
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 type TypeResourceActionRowRecordRender = {
17
- [key in keyof TypeResourceActionRowRecord as `action${Capitalize<key>}`]: TypeResourceActionRowRecord[key];
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
+ import { types } from 'typestyle';
2
+
3
+ export interface IResourceComponentFormFieldRecord {}
4
+
5
+ export interface IResourceFormFieldOptionsBase {
6
+ class?: any;
7
+ style?: types.NestedCSSProperties;
8
+ readonly?: boolean;
9
+ }
@@ -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
+ }
@@ -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 './textarea.js';
16
- export * from './toggle.js';
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 IActionsRecord): TypeActionProvider;
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
+ }
@@ -1,14 +1,9 @@
1
1
  import type { TableIdentity } from 'table-identity';
2
2
 
3
- export interface IOpenapiActionRecord {
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 IOpenapiActionRecord]?: IOpenapiActionRecord[K];
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 ISchemaObjectExtensionFieldRest {
17
- render?: TypeFormFieldRenderComponentNormal | TypeTableCellRenderComponentNormal;
18
- captcha?: ICaptchaOptions;
19
- currency?: CurrencyOptions;
20
- dateFormat?: TypeDateFormat;
21
- toggle?: IToggleOptions;
22
- select?: ISelectOptions;
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
- table?: Omit<ISchemaObjectExtensionFieldRest, TypeSchemaScene>;
30
- form?: Omit<ISchemaObjectExtensionFieldRest, TypeSchemaScene>;
31
- filter?: Omit<ISchemaObjectExtensionFieldRest, TypeSchemaScene>;
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' | 'form' | 'filter';
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', 'filter', 'displayValue'];
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
- | keyof TypeResourceActionRowRecordRender
67
- | 'text'
68
- | 'captcha'
69
- | 'currency'
70
- | 'date'
71
- | 'dateRange'
72
- | 'textarea'
73
- | 'select'
74
- | 'checkbox'
75
- | 'radio'
76
- | 'switch'
77
- | 'image'
78
- | 'file'
79
- | 'color'
80
- | 'password'
81
- | 'email'
82
- | 'url';
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
- export type TypeFormFieldRenderComponentProvider =
88
- | Constructable
89
- | Constructable<ComponentPublicInstance>
90
- | keyof IComponentRecord
91
- | 'input'
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 = TypeTableCellRenderComponentNormal | TypeRenderComponentJsx;
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 TypeTableRenderComponentProvider = Constructable<ComponentPublicInstance> | keyof IComponentRecord | TypeRenderComponentJsx;
118
+ export type TypeTableBulkRenderComponentProvider = Constructable<ComponentPublicInstance> | keyof IComponentRecord | TypeRenderComponentJsx;
@@ -11,7 +11,9 @@ export interface IOpenapiSchema {
11
11
 
12
12
  export interface IOpenapiSchemaMeta {}
13
13
 
14
- export type TypeOpenapiSchemasSdk = UnwrapNestedRefs<UseQueryReturnType<IOpenapiSdkItem, DefaultError>>;
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
+ }
@@ -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"}
@@ -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
@@ -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"}