@evoke-platform/ui-components 1.1.0-testing.10 → 1.1.0-testing.11

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.
@@ -445,7 +445,7 @@ export function Form(props) {
445
445
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
446
446
  , {
447
447
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
448
- onChange: (e) => setFormData(e.data), key: closeModal ? undefined : formKey, form: {
448
+ onChange: (e) => !isEqual(e.data, formData) && setFormData(e.data), key: closeModal ? undefined : formKey, form: {
449
449
  display: 'form',
450
450
  components: componentProps,
451
451
  }, formReady: handleFormReady })) : (React.createElement(Box, null,
@@ -21,11 +21,10 @@ type ButtonProps = {
21
21
  };
22
22
  export declare class ButtonComponent extends ReactComponent {
23
23
  [x: string]: any;
24
- component: ButtonComponentProps;
25
24
  componentRoot?: Root;
26
25
  constructor(component: ButtonComponentProps, options: any, data: any);
27
26
  setError(error?: Record<string, unknown>): void;
28
- getButton: (buttonAction: 'cancel' | 'submit' | 'save-draft') => Button | undefined;
27
+ getButton: (buttonAction: 'cancel' | 'submit' | 'save-draft') => any;
29
28
  handleCancel: (event: any) => void;
30
29
  handleSaveDraft: (setSubmitting: (value: boolean) => void) => void;
31
30
  handleSubmit: (setSubmitting: (value: boolean) => void) => void;
@@ -1,10 +1,9 @@
1
1
  import { ReactComponent } from '@formio/react';
2
2
  import { Root } from 'react-dom/client';
3
- import { BaseFormComponentProps, SavedDocumentReference } from '../../types';
3
+ import { SavedDocumentReference } from '../../types';
4
4
  export declare class DocumentComponent extends ReactComponent {
5
5
  [x: string]: any;
6
6
  static schema: any;
7
- component: BaseFormComponentProps;
8
7
  errorDetails: any;
9
8
  componentRoot?: Root;
10
9
  constructor(component: any, options: any, data: any);
@@ -15,7 +15,6 @@ type FormFieldComponentProps = Omit<BaseFormComponentProps, 'property'> & {
15
15
  export declare class FormFieldComponent extends ReactComponent {
16
16
  [x: string]: any;
17
17
  static schema: any;
18
- component: FormFieldComponentProps;
19
18
  errorDetails: any;
20
19
  /**
21
20
  * Called when the component has been instantiated. This is useful to define
@@ -4,9 +4,6 @@ import { BaseFormComponentProps } from '../../types';
4
4
  export declare class ImageComponent extends ReactComponent {
5
5
  [x: string]: any;
6
6
  static schema: any;
7
- component: BaseFormComponentProps & {
8
- initialValue?: string;
9
- };
10
7
  errorDetails: any;
11
8
  componentRoot?: Root;
12
9
  constructor(component: BaseFormComponentProps, options: any, data: any);
@@ -12,7 +12,6 @@ export declare class ObjectComponent extends ReactComponent {
12
12
  relatedObject?: Obj;
13
13
  [x: string]: any;
14
14
  static schema: any;
15
- component: ObjectComponentProps;
16
15
  errorDetails: any;
17
16
  componentRoot?: Root;
18
17
  criteria?: Record<string, unknown>;
@@ -10,7 +10,6 @@ type RepeatableFieldComponentProps = BaseFormComponentProps & {
10
10
  export declare class RepeatableFieldComponent extends ReactComponent {
11
11
  [x: string]: any;
12
12
  static schema: any;
13
- component: RepeatableFieldComponentProps;
14
13
  criteria: Record<string, any> | undefined;
15
14
  updatedCriteria: Record<string, any>;
16
15
  constructor(component: RepeatableFieldComponentProps, options: any, data: any);
@@ -6,9 +6,6 @@ export declare class UserComponent extends ReactComponent {
6
6
  [x: string]: any;
7
7
  static schema: any;
8
8
  errorDetails: any;
9
- component: BaseFormComponentProps & {
10
- initialValue?: string;
11
- };
12
9
  componentRoot?: Root;
13
10
  criteria: Record<string, unknown> | undefined;
14
11
  updatedCriteria: Record<string, unknown>;
@@ -0,0 +1,6 @@
1
+ import { ComponentMeta, ComponentStory } from '@storybook/react';
2
+ import { Form } from '../index';
3
+ declare const _default: ComponentMeta<typeof Form>;
4
+ export default _default;
5
+ export declare const FormWithButtons: ComponentStory<typeof Form>;
6
+ export declare const FormWithNoButtons: ComponentStory<typeof Form>;
@@ -0,0 +1,82 @@
1
+ import React from 'react';
2
+ import { Button, Form } from '../index';
3
+ export default {
4
+ title: 'Input/Form',
5
+ component: Form,
6
+ };
7
+ const object = {
8
+ id: 'test',
9
+ name: 'Test',
10
+ properties: [
11
+ {
12
+ id: 'name',
13
+ name: 'Name',
14
+ type: 'string',
15
+ required: true,
16
+ },
17
+ {
18
+ id: 'decimal',
19
+ name: 'Decimal',
20
+ type: 'number',
21
+ },
22
+ {
23
+ id: 'integer',
24
+ name: 'Integer',
25
+ type: 'integer',
26
+ },
27
+ ],
28
+ actions: [
29
+ {
30
+ id: '_create',
31
+ name: 'Create Test',
32
+ type: 'create',
33
+ outputEvent: 'Test Created',
34
+ },
35
+ {
36
+ id: '_update',
37
+ name: 'Update Test',
38
+ type: 'update',
39
+ outputEvent: 'Test Updated',
40
+ },
41
+ {
42
+ id: '_delete',
43
+ name: 'Delete Test',
44
+ type: 'delete',
45
+ inputProperties: [],
46
+ outputEvent: 'Test Deleted',
47
+ },
48
+ ],
49
+ };
50
+ const FormWithButtonsTemplate = (args) => {
51
+ return React.createElement(Form, { ...args });
52
+ };
53
+ export const FormWithButtons = FormWithButtonsTemplate.bind({});
54
+ FormWithButtons.args = {
55
+ actionId: '_update',
56
+ actionType: 'update',
57
+ object: object,
58
+ instance: { id: 'id', objectId: 'test', name: 'test', integer: 12, decimal: 12.5 },
59
+ };
60
+ const FormWithNoButtonsTemplate = (args) => {
61
+ return (React.createElement("div", null,
62
+ React.createElement(Form, { ...args }),
63
+ React.createElement(Button, { onClick: () => {
64
+ console.log(args.formRef?.current?.data);
65
+ args.formRef?.current?.data &&
66
+ args.formRef.current.submit({ data: args.formRef.current.data }, 'submit', (error) => {
67
+ console.log(error);
68
+ });
69
+ } },
70
+ ' ',
71
+ "Submit",
72
+ ' ')));
73
+ };
74
+ export const FormWithNoButtons = FormWithNoButtonsTemplate.bind({});
75
+ FormWithNoButtons.args = {
76
+ actionId: '_update',
77
+ actionType: 'update',
78
+ object: object,
79
+ instance: { id: 'id', objectId: 'test', name: 'test', integer: 12, decimal: 12.5 },
80
+ hideButtons: true,
81
+ formRef: { current: {} },
82
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evoke-platform/ui-components",
3
- "version": "1.1.0-testing.10",
3
+ "version": "1.1.0-testing.11",
4
4
  "description": "",
5
5
  "main": "dist/published/index.js",
6
6
  "module": "dist/published/index.js",