@ghentcdh/json-forms-vue 0.6.9 → 0.7.0

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.
@@ -1,15 +1,30 @@
1
- import { JsonFormsLayout } from '../../../core/src/index.ts';
2
- import { FormEventListener } from '../state/form.state';
1
+ import { SizeType } from '../../../core/src/index.ts';
2
+ import { FormEventPayload } from '../composables/useFormEvents';
3
+ /** Props for the `FormModal` component. */
3
4
  export type FormModalProps = {
5
+ /** Title displayed in the modal header. */
4
6
  modalTitle: string;
7
+ /** Label for the save button. */
5
8
  saveLabel?: string;
9
+ /** Label for the cancel button. */
6
10
  cancelLabel?: string;
7
- formSchema: JsonFormsLayout;
8
- eventListener?: FormEventListener;
11
+ /** JSON schema describing the shape of the form data. */
12
+ schema: any;
13
+ /** UI schema describing the layout and controls. */
14
+ uiSchema: any;
15
+ /** Modal width (`'xs'`, `'sm'`, `'lg'`, `'xl'`). */
16
+ modalSize?: SizeType;
17
+ /** Callback invoked when the modal closes (with result or `null` on cancel). */
9
18
  onClose: (result: any) => void;
19
+ /** Callback for form events dispatched by custom renderers (e.g. "create"). */
20
+ onEvents?: (payload: FormEventPayload) => void;
21
+ /** Initial form data to populate the form with. */
10
22
  data: any;
11
23
  };
24
+ /** Result payload returned when the modal is submitted. */
12
25
  export type FormModalResult<DATA = any> = {
26
+ /** The form data at the time of submission. */
13
27
  data: DATA;
28
+ /** Whether the form passed validation. */
14
29
  valid: boolean;
15
30
  };
@@ -1,10 +1,15 @@
1
- import { JsonFormsLayout } from '../../../core/src/index.ts';
1
+ import { SizeType } from '../../../core/src/index.ts';
2
2
  import { FormModalResult } from './index';
3
+ import { FormEventPayload } from '../composables/useFormEvents';
3
4
  export declare class FormModalService {
4
- static openModal<DATA = any>({ initialData, modalTitle, formSchema, onClose, }: {
5
+ static openModal<DATA = any>({ initialData, modalTitle, schema, uiSchema, modalSize, onClose, onEvents, }: {
5
6
  initialData?: DATA;
6
- formSchema: JsonFormsLayout;
7
+ schema: any;
8
+ uiSchema: any;
9
+ modalSize?: SizeType;
7
10
  modalTitle: string;
8
11
  onClose: (result: FormModalResult) => void;
12
+ /** Callback for form events dispatched by custom renderers inside the modal. */
13
+ onEvents?: (payload: FormEventPayload) => void;
9
14
  }): void;
10
15
  }
@@ -15,13 +15,16 @@ declare function __VLS_template(): {
15
15
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
16
16
  declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
17
17
  closeModal: (...args: any[]) => void;
18
+ events: (...args: any[]) => void;
18
19
  "update:modelValue": (value: any) => void;
19
20
  }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
20
21
  onCloseModal?: ((...args: any[]) => any) | undefined;
21
22
  "onUpdate:modelValue"?: ((value: any) => any) | undefined;
23
+ onEvents?: ((...args: any[]) => any) | undefined;
22
24
  }>, {
23
25
  cancelLabel: string;
24
26
  saveLabel: string;
27
+ modalSize: import('../../../core/src/index.ts').SizeType;
25
28
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDialogElement>;
26
29
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
27
30
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ghentcdh/json-forms-vue",
3
- "version": "0.6.9",
3
+ "version": "0.7.0",
4
4
  "main": "./index.js",
5
5
  "module": "./index.mjs",
6
6
  "types": "./index.d.ts",
@@ -0,0 +1,73 @@
1
+ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
2
+ schema: {
3
+ required: true;
4
+ type: import('vue').PropType<import('@jsonforms/core').JsonSchema>;
5
+ };
6
+ uischema: {
7
+ required: true;
8
+ type: import('vue').PropType<import('@jsonforms/core').UISchemaElement>;
9
+ };
10
+ path: {
11
+ required: true;
12
+ type: StringConstructor;
13
+ };
14
+ enabled: {
15
+ required: false;
16
+ type: BooleanConstructor;
17
+ default: undefined;
18
+ };
19
+ renderers: {
20
+ required: boolean;
21
+ type: import('vue').PropType<import('@jsonforms/core').JsonFormsRendererRegistryEntry[]>;
22
+ default: undefined;
23
+ };
24
+ cells: {
25
+ required: boolean;
26
+ type: import('vue').PropType<import('@jsonforms/core').JsonFormsCellRendererRegistryEntry[]>;
27
+ default: undefined;
28
+ };
29
+ config: {
30
+ required: boolean;
31
+ type: ObjectConstructor;
32
+ default: undefined;
33
+ };
34
+ }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
35
+ schema: {
36
+ required: true;
37
+ type: import('vue').PropType<import('@jsonforms/core').JsonSchema>;
38
+ };
39
+ uischema: {
40
+ required: true;
41
+ type: import('vue').PropType<import('@jsonforms/core').UISchemaElement>;
42
+ };
43
+ path: {
44
+ required: true;
45
+ type: StringConstructor;
46
+ };
47
+ enabled: {
48
+ required: false;
49
+ type: BooleanConstructor;
50
+ default: undefined;
51
+ };
52
+ renderers: {
53
+ required: boolean;
54
+ type: import('vue').PropType<import('@jsonforms/core').JsonFormsRendererRegistryEntry[]>;
55
+ default: undefined;
56
+ };
57
+ cells: {
58
+ required: boolean;
59
+ type: import('vue').PropType<import('@jsonforms/core').JsonFormsCellRendererRegistryEntry[]>;
60
+ default: undefined;
61
+ };
62
+ config: {
63
+ required: boolean;
64
+ type: ObjectConstructor;
65
+ default: undefined;
66
+ };
67
+ }>> & Readonly<{}>, {
68
+ enabled: boolean;
69
+ renderers: import('@jsonforms/core').JsonFormsRendererRegistryEntry[];
70
+ cells: import('@jsonforms/core').JsonFormsCellRendererRegistryEntry[];
71
+ config: Record<string, any>;
72
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
73
+ export default _default;
@@ -6,3 +6,4 @@ export declare const isArrayRenderer: import('@jsonforms/core/src/testers/tester
6
6
  export declare const isCustomControl: (customType: string) => import('@jsonforms/core/src/testers/testers').Tester;
7
7
  export declare const isMultiselectControl: import('@jsonforms/core/src/testers/testers').Tester;
8
8
  export declare const isSelectControl: import('@jsonforms/core/src/testers/testers').Tester;
9
+ export declare const isBooleanControl: import('@jsonforms/core/src/testers/testers').Tester;
@@ -1,5 +1,4 @@
1
1
  import { AxiosRequestInterceptorUse } from 'axios';
2
- import { FormSchemaModel } from '../../../core/src/index.ts';
3
2
  type RequestOptions = {
4
3
  skipAuth?: boolean;
5
4
  queryParams?: Record<string, any>;
@@ -21,7 +20,9 @@ type RepositoryOptions = {
21
20
  };
22
21
  export declare const createRepository: <T extends {
23
22
  id?: string;
24
- }>(formSchemaModel: Pick<FormSchemaModel, "uri">, httpRequest: HttpRequest<T>, options?: RepositoryOptions) => {
23
+ }>(formSchemaModel: {
24
+ uri: string;
25
+ }, httpRequest: HttpRequest<T>, options?: RepositoryOptions) => {
25
26
  create: (object: T, options?: RequestOptions) => any;
26
27
  patch: (id: string, object: T, options?: RequestOptions) => any;
27
28
  createMulti: (objects: T[], options?: RequestOptions) => Promise<any>;
package/table/index.d.ts CHANGED
@@ -1 +1,2 @@
1
1
  export { default as TableComponent } from './table.component.vue';
2
+ export * from './table.component.properties';
@@ -0,0 +1,34 @@
1
+ import { JsonSchema, Layout } from '@jsonforms/core';
2
+ import { PropType } from 'vue';
3
+ import { TableAction } from '../../../../ui/src/index.ts';
4
+ export declare const TableComponentProperties: {
5
+ id: {
6
+ type: StringConstructor;
7
+ required: true;
8
+ };
9
+ uiSchema: {
10
+ type: PropType<Layout>;
11
+ required: true;
12
+ };
13
+ schema: {
14
+ type: PropType<JsonSchema>;
15
+ required: true;
16
+ };
17
+ filterUiSchema: {
18
+ type: PropType<Layout>;
19
+ };
20
+ filterSchema: {
21
+ type: PropType<JsonSchema>;
22
+ };
23
+ uri: {
24
+ type: StringConstructor;
25
+ required: true;
26
+ };
27
+ reload: {
28
+ type: NumberConstructor;
29
+ };
30
+ actions: {
31
+ type: PropType<TableAction[]>;
32
+ };
33
+ };
34
+ export declare const TableComponentEmits: string[];
@@ -1,18 +1,60 @@
1
- import { JsonFormsLayout } from '../../../core/src/index.ts';
2
- import { TableAction } from '../../../../ui/src/index.ts';
3
- type __VLS_Props = {
4
- id: string;
5
- layout: JsonFormsLayout;
6
- filterLayout?: JsonFormsLayout;
7
- uri: string;
8
- reload?: number;
9
- actions?: TableAction[];
10
- };
11
- declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
12
- edit: (...args: any[]) => void;
13
- delete: (...args: any[]) => void;
14
- }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
15
- onEdit?: ((...args: any[]) => any) | undefined;
16
- onDelete?: ((...args: any[]) => any) | undefined;
17
- }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
1
+ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
2
+ id: {
3
+ type: StringConstructor;
4
+ required: true;
5
+ };
6
+ uiSchema: {
7
+ type: import('vue').PropType<import('@jsonforms/core').Layout>;
8
+ required: true;
9
+ };
10
+ schema: {
11
+ type: import('vue').PropType<import('@jsonforms/core').JsonSchema>;
12
+ required: true;
13
+ };
14
+ filterUiSchema: {
15
+ type: import('vue').PropType<import('@jsonforms/core').Layout>;
16
+ };
17
+ filterSchema: {
18
+ type: import('vue').PropType<import('@jsonforms/core').JsonSchema>;
19
+ };
20
+ uri: {
21
+ type: StringConstructor;
22
+ required: true;
23
+ };
24
+ reload: {
25
+ type: NumberConstructor;
26
+ };
27
+ actions: {
28
+ type: import('vue').PropType<import('../../../../ui/src/index.ts').TableAction[]>;
29
+ };
30
+ }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
31
+ id: {
32
+ type: StringConstructor;
33
+ required: true;
34
+ };
35
+ uiSchema: {
36
+ type: import('vue').PropType<import('@jsonforms/core').Layout>;
37
+ required: true;
38
+ };
39
+ schema: {
40
+ type: import('vue').PropType<import('@jsonforms/core').JsonSchema>;
41
+ required: true;
42
+ };
43
+ filterUiSchema: {
44
+ type: import('vue').PropType<import('@jsonforms/core').Layout>;
45
+ };
46
+ filterSchema: {
47
+ type: import('vue').PropType<import('@jsonforms/core').JsonSchema>;
48
+ };
49
+ uri: {
50
+ type: StringConstructor;
51
+ required: true;
52
+ };
53
+ reload: {
54
+ type: NumberConstructor;
55
+ };
56
+ actions: {
57
+ type: import('vue').PropType<import('../../../../ui/src/index.ts').TableAction[]>;
58
+ };
59
+ }>> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
18
60
  export default _default;
package/demo/owner.d.ts DELETED
@@ -1,55 +0,0 @@
1
- export declare const OwnerWithRelationsFormDetail: {
2
- type: string;
3
- properties: {
4
- id: {
5
- type: string;
6
- };
7
- createdAt: {
8
- type: string;
9
- format: string;
10
- };
11
- name: {
12
- type: string;
13
- };
14
- firstname: {
15
- type: string;
16
- };
17
- age: {
18
- type: string;
19
- };
20
- total: {
21
- type: string;
22
- };
23
- boolean: {
24
- type: string;
25
- };
26
- comment: {
27
- type: string;
28
- };
29
- autocomplete: {
30
- type: string;
31
- };
32
- emails: {
33
- type: string;
34
- items: {
35
- type: string;
36
- properties: {
37
- id: {
38
- type: string;
39
- };
40
- createdAt: {
41
- type: string;
42
- format: string;
43
- };
44
- email: {
45
- type: string;
46
- };
47
- };
48
- required: string[];
49
- additionalProperties: boolean;
50
- };
51
- };
52
- };
53
- required: string[];
54
- additionalProperties: boolean;
55
- };
@@ -1,9 +0,0 @@
1
- import { Router } from 'vue-router';
2
- import { ArrayAction } from '../../../../core/src/index.ts';
3
- import { IconEnum } from '../../../../../ui/src/index.ts';
4
- export type Action = {
5
- label: string;
6
- icon: IconEnum;
7
- show: (element: any) => boolean;
8
- };
9
- export declare const mapArrayActions: (router: Router, actions: ArrayAction[]) => Action[];
@@ -1,12 +0,0 @@
1
- export type FormEventType = any;
2
- export type FormEventListener = (type: FormEventType, data: any) => void;
3
- declare class FormState {
4
- static instance: FormState;
5
- private readonly events;
6
- private constructor();
7
- static getInstance(): FormState;
8
- registerEventListener(formName: string, callback: FormEventListener): void;
9
- dispatchEvent(formName: string, event: FormEventType, data: any): void;
10
- }
11
- export declare const useFormState: (form: any) => FormState;
12
- export {};