vona-module-a-openapi 5.0.66 → 5.0.68

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.js CHANGED
@@ -84,7 +84,6 @@ BeanOpenapi = __decorate([Bean(), BeanInfo({
84
84
  })], BeanOpenapi);
85
85
 
86
86
  const __ArgumentTypes = ['param', 'query', 'body', 'headers', 'fields', 'field', 'files', 'file'];
87
- const symbolJsxRenderTranslated = Symbol('symbolJsxRenderTranslated');
88
87
  let ServiceOpenapi = class ServiceOpenapi extends BeanBase {
89
88
  async clearAllCaches() {
90
89
  const cacheOpenapiSchema = this.bean.summer.cache(beanFullNameFromOnionName('a-openapi:json', 'summerCache'));
@@ -148,8 +147,6 @@ let ServiceOpenapi = class ServiceOpenapi extends BeanBase {
148
147
  }
149
148
  // errorMessage
150
149
  this._translateErrorMessages(schema);
151
- // jsxRender
152
- this._translateJsxRenders(schema);
153
150
  // properties
154
151
  const properties = cast(schema).properties;
155
152
  if (properties && typeof properties === 'object') {
@@ -185,38 +182,6 @@ let ServiceOpenapi = class ServiceOpenapi extends BeanBase {
185
182
  }, error, scope);
186
183
  }
187
184
  }
188
- _translateJsxRenders(obj) {
189
- this._translateJsxRendersInner(obj.rest);
190
- this._translateJsxRendersInner(obj.rest?.table);
191
- this._translateJsxRendersInner(obj.rest?.form);
192
- }
193
- _translateJsxRendersInner(obj) {
194
- if (!obj) return;
195
- for (const key in obj) {
196
- obj[key] = this._translateJsxRender(obj[key]);
197
- }
198
- }
199
- _translateJsxRender(component) {
200
- if (typeof component !== 'object' || !component.$$typeof) return component;
201
- if (component[symbolJsxRenderTranslated] === true) return component;
202
- const componentNew = {};
203
- componentNew[symbolJsxRenderTranslated] = true;
204
- componentNew.$$typeof = 'zova-jsx';
205
- componentNew.type = typeof component.type === 'function' ? component.type() : component.type;
206
- componentNew.key = component.key;
207
- componentNew.props = {
208
- ...component.props
209
- };
210
- const children = componentNew.props.children;
211
- if (children) {
212
- if (Array.isArray(children)) {
213
- componentNew.props.children = children.map(item => this._translateJsxRender(item));
214
- } else if (typeof children === 'object' && !children.toJSON) {
215
- componentNew.props.children = this._translateJsxRender(children);
216
- }
217
- }
218
- return componentNew;
219
- }
220
185
  collectRegistry() {
221
186
  const registry = new OpenAPIRegistry();
222
187
  // securitySchemes
@@ -9,9 +9,6 @@ export declare class ServiceOpenapi extends BeanBase {
9
9
  translate(apiObj: OpenAPIObject30 | OpenAPIObject31, generateJsonScene: TypeGenerateJsonScene): void;
10
10
  private _translateSchema;
11
11
  private _translateErrorMessages;
12
- private _translateJsxRenders;
13
- private _translateJsxRendersInner;
14
- private _translateJsxRender;
15
12
  collectRegistry(): OpenAPIRegistry;
16
13
  collectController(registry: OpenAPIRegistry, moduleName: string, controller: Constructable, actionKey?: string): void;
17
14
  private _registerControllerAction;
@@ -1,5 +1,7 @@
1
1
  export interface IComponentRecord {
2
2
  }
3
+ export interface ITableCellComponentRecord {
4
+ }
3
5
  export type TypeComponentRecordSelector<PREFIX extends string> = {
4
6
  [K in keyof IComponentRecord as K extends `${string}:${PREFIX}${string}` ? K : never]: IComponentRecord[K];
5
7
  };
@@ -0,0 +1,4 @@
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;
@@ -3,5 +3,6 @@ export * from './actions.ts';
3
3
  export * from './behavior.ts';
4
4
  export * from './captcha.ts';
5
5
  export * from './component.ts';
6
+ export * from './date.ts';
6
7
  export * from './decorator.ts';
7
8
  export * from './rest.ts';
@@ -1,13 +1,17 @@
1
1
  import type { ZodOpenAPIMetadata } from '@cabloy/zod-to-openapi';
2
+ import type { CurrencyOptions } from '@zhennann/currency';
2
3
  import type { ILocaleMagic } from 'vona';
3
4
  import type { IOpenApiOptions } from 'vona-module-a-openapiutils';
4
5
  import type { z } from 'zod';
5
6
  import type { TypeResourceActionRowRecordRender } from './actions.ts';
6
7
  import type { ISchemaObjectExtensionFieldCaptcha } from './captcha.ts';
7
- import type { IComponentRecord } from './component.ts';
8
+ import type { IComponentRecord, ITableCellComponentRecord } from './component.ts';
9
+ import type { TypeDateFormat } from './date.ts';
8
10
  import 'openapi3-ts/oas30';
9
11
  import 'openapi3-ts/oas31';
10
12
  export type HTMLInputElementType = 'text' | 'password' | 'number' | 'file' | 'hidden' | 'tel' | 'email';
13
+ export type TypeFormFieldOnDisplayValueUpdate = (value: any) => any;
14
+ export type TypeFormFieldOnhandleDisplayValueUpdateMode = 'input' | 'change';
11
15
  export interface ISchemaObjectExtensionFieldRestProps {
12
16
  visible?: boolean;
13
17
  order?: number;
@@ -21,15 +25,20 @@ export interface ISchemaObjectExtensionFieldRestProps {
21
25
  header?: TypeRenderComponentJsx | string;
22
26
  footer?: TypeRenderComponentJsx | string;
23
27
  displayValue?: any;
28
+ onDisplayValueUpdate?: TypeFormFieldOnDisplayValueUpdate;
29
+ handleDisplayValueUpdateMode?: TypeFormFieldOnhandleDisplayValueUpdateMode;
24
30
  class?: any;
25
31
  placeholder?: string;
26
32
  readonly?: boolean;
27
33
  inputType?: HTMLInputElementType;
34
+ currency?: CurrencyOptions;
35
+ dateFormat?: TypeDateFormat;
28
36
  }
29
37
  export interface ISchemaObjectExtensionFieldRest extends ISchemaObjectExtensionFieldRestProps {
30
38
  render?: TypeRenderComponentPreset;
31
39
  table?: ISchemaObjectExtensionFieldRestScene;
32
40
  form?: ISchemaObjectExtensionFieldRestScene;
41
+ filter?: ISchemaObjectExtensionFieldRestScene;
33
42
  }
34
43
  export interface ISchemaObjectExtensionFieldRestScene extends ISchemaObjectExtensionFieldRestProps {
35
44
  render?: TypeRenderComponent;
@@ -59,10 +68,11 @@ export interface TypeRenderComponentJsx {
59
68
  key?: string | null;
60
69
  props?: TypeRenderComponentJsxProps;
61
70
  }
62
- export type TypeRenderComponentPreset = keyof TypeResourceActionRowRecordRender | 'text' | 'currency' | 'textarea' | 'select' | 'checkbox' | 'radio' | 'switch' | 'image' | 'file' | 'color' | 'password' | 'email' | 'url';
71
+ export type TypeSchemaScene = 'table' | 'form' | 'filter';
72
+ export type TypeRenderComponentPreset = keyof TypeResourceActionRowRecordRender | 'text' | 'currency' | 'date' | 'dateRange' | 'textarea' | 'select' | 'checkbox' | 'radio' | 'switch' | 'image' | 'file' | 'color' | 'password' | 'email' | 'url';
63
73
  export type TypeRenderComponent = TypeRenderComponentPreset | TypeRenderComponentJsx;
64
- export type TypeRenderComponentProvider = (keyof IComponentRecord) | 'input' | 'textarea' | 'select';
65
- export type TypeSchemaScene = 'table' | 'form';
74
+ export type TypeFormFieldRenderComponentProvider = (keyof IComponentRecord) | 'input' | 'textarea' | 'select';
75
+ export type TypeTableCellRenderComponentProvider = (keyof IComponentRecord) | (keyof ITableCellComponentRecord) | 'text';
66
76
  export type TypeOpenapiMetadata<T extends z.ZodType = z.ZodType> = Omit<Partial<ZodOpenAPIMetadata<z.input<T>>>, 'title' | 'description'> & {
67
77
  title?: string | ILocaleMagic;
68
78
  description?: string | ILocaleMagic;
package/package.json CHANGED
@@ -1,13 +1,15 @@
1
1
  {
2
2
  "name": "vona-module-a-openapi",
3
3
  "type": "module",
4
- "version": "5.0.66",
4
+ "version": "5.0.68",
5
5
  "title": "a-openapi",
6
6
  "vonaModule": {
7
7
  "capabilities": {
8
8
  "preload": true
9
9
  },
10
- "dependencies": {},
10
+ "dependencies": {
11
+ "a-openapiutils": "5.0.0"
12
+ },
11
13
  "globalDependencies": {
12
14
  "@cabloy/zod-openapi": true,
13
15
  "@cabloy/zod-to-openapi": true,