@socotra/ec-react-components 2.2.2 → 2.2.3-alpha.2
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.d.ts +74 -19
- package/dist/index.es.js +6346 -6341
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +22 -22
- package/dist/index.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +15 -6
package/dist/index.d.ts
CHANGED
|
@@ -2,39 +2,45 @@ import { AccountConfigRecord } from '@socotra/ec-react-schemas';
|
|
|
2
2
|
import { AccountRequest } from '@socotra/ec-react-schemas';
|
|
3
3
|
import { AccountResponse } from '@socotra/ec-react-schemas';
|
|
4
4
|
import { DataTypeConfigRecord } from '@socotra/ec-react-schemas';
|
|
5
|
+
import { ElementConfig } from '@socotra/ec-react-schemas';
|
|
6
|
+
import { ElementRequest } from '@socotra/ec-react-schemas';
|
|
7
|
+
import { ElementResponse } from '@socotra/ec-react-schemas';
|
|
5
8
|
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
6
|
-
import {
|
|
9
|
+
import { ProductConfig } from '@socotra/ec-react-schemas';
|
|
7
10
|
import { QuoteRequest } from '@socotra/ec-react-schemas';
|
|
8
11
|
import { QuoteResponse } from '@socotra/ec-react-schemas';
|
|
9
12
|
|
|
10
13
|
/**
|
|
11
|
-
* AccountForm is a form for creating or updating an account. It
|
|
14
|
+
* AccountForm is a form for creating or updating an account. It required a resolved data model, custom data types, and an optional account object to put the form in update mode.
|
|
12
15
|
*/
|
|
13
16
|
export declare const AccountForm: {
|
|
14
|
-
({ accountsModel, accountType, dataTypes, disabled, handleSubmit, isSubmitting, preventFormResetOnDisabled, hideSubmitButton, account, submitButtonText, id, }: Props): JSX_2.Element;
|
|
17
|
+
({ accountsModel, accountType, dataTypes, disabled, handleSubmit, isSubmitting, preventFormResetOnDisabled, hideSubmitButton, validateOnSubmit, account, submitButtonText, id, }: Props): JSX_2.Element;
|
|
15
18
|
displayName: string;
|
|
16
19
|
};
|
|
17
20
|
|
|
18
21
|
/**
|
|
19
|
-
* ElementForm is a form for updating a
|
|
22
|
+
* ElementForm is a form for creating or updating an element of a Quote. It required the element's data model, custom data types, and an element response object.
|
|
20
23
|
*/
|
|
21
|
-
export declare const ElementForm:
|
|
24
|
+
export declare const ElementForm: {
|
|
25
|
+
({ elementModel, dataTypes, disabled, handleSubmit, isSubmitting, preventFormResetOnDisabled, hideSubmitButton, element, validateOnSubmit, submitButtonText, id, }: Props_3): JSX_2.Element;
|
|
26
|
+
displayName: string;
|
|
27
|
+
};
|
|
22
28
|
|
|
23
29
|
declare type Props = {
|
|
24
30
|
/**
|
|
25
|
-
* The resolved data model for accounts retrieved from the data model response
|
|
31
|
+
* The resolved data model for **all** accounts retrieved from the data model response
|
|
26
32
|
*/
|
|
27
33
|
accountsModel: AccountConfigRecord;
|
|
28
34
|
/**
|
|
29
|
-
* The account type to use for the form
|
|
35
|
+
* The account type to use for the form, used to pick the correct data model from the accountsModel
|
|
30
36
|
*/
|
|
31
37
|
accountType: keyof AccountConfigRecord;
|
|
32
38
|
/**
|
|
33
|
-
* The custom data types for the configuration that may be referenced by the
|
|
39
|
+
* The custom data types for the configuration that may be referenced by the account's data model
|
|
34
40
|
*/
|
|
35
41
|
dataTypes: DataTypeConfigRecord;
|
|
36
42
|
/**
|
|
37
|
-
* The function to call when the form is submitted. It will create an
|
|
43
|
+
* The function to call when the form is submitted. It will create an AccountRequest from the form data.
|
|
38
44
|
*/
|
|
39
45
|
handleSubmit: (data: AccountRequest) => void;
|
|
40
46
|
/**
|
|
@@ -62,6 +68,10 @@ declare type Props = {
|
|
|
62
68
|
* The text to display on the submit button
|
|
63
69
|
*/
|
|
64
70
|
submitButtonText?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Whether to validate the form on submit
|
|
73
|
+
*/
|
|
74
|
+
validateOnSubmit?: boolean;
|
|
65
75
|
/**
|
|
66
76
|
* ID for the form wrapper
|
|
67
77
|
* */
|
|
@@ -74,19 +84,15 @@ declare type Props_2 = {
|
|
|
74
84
|
*/
|
|
75
85
|
quote: QuoteResponse;
|
|
76
86
|
/**
|
|
77
|
-
* The resolved data model for
|
|
87
|
+
* The resolved data model for quote retrieved from the data model response
|
|
78
88
|
*/
|
|
79
|
-
|
|
89
|
+
productModel: ProductConfig;
|
|
80
90
|
/**
|
|
81
|
-
* The
|
|
82
|
-
*/
|
|
83
|
-
productType: keyof ProductConfigRecord;
|
|
84
|
-
/**
|
|
85
|
-
* The custom data types for the configuration that may be referenced by the DataModel
|
|
91
|
+
* The custom data types for the configuration that may be referenced by the elementModel
|
|
86
92
|
*/
|
|
87
93
|
dataTypes: DataTypeConfigRecord;
|
|
88
94
|
/**
|
|
89
|
-
* The function to call when the form is submitted. It will create an
|
|
95
|
+
* The function to call when the form is submitted. It will create an QuoteRequest from the form data.
|
|
90
96
|
*/
|
|
91
97
|
handleSubmit: (data: QuoteRequest) => void;
|
|
92
98
|
/**
|
|
@@ -123,11 +129,60 @@ declare type Props_2 = {
|
|
|
123
129
|
id?: string;
|
|
124
130
|
};
|
|
125
131
|
|
|
132
|
+
declare type Props_3 = {
|
|
133
|
+
/**
|
|
134
|
+
* The resolved data model for the element retrieved from the data model response
|
|
135
|
+
*/
|
|
136
|
+
elementModel: ElementConfig;
|
|
137
|
+
/**
|
|
138
|
+
* The custom data types for the configuration that may be referenced by the elementModel
|
|
139
|
+
*/
|
|
140
|
+
dataTypes: DataTypeConfigRecord;
|
|
141
|
+
/**
|
|
142
|
+
* The function to call when the form is submitted. It will create an ElementUpdateRequest.
|
|
143
|
+
*/
|
|
144
|
+
handleSubmit: (data: ElementRequest) => void;
|
|
145
|
+
/**
|
|
146
|
+
* Set to true when the form is submitting to set fields to readonly and disable the submit button
|
|
147
|
+
*/
|
|
148
|
+
isSubmitting?: boolean;
|
|
149
|
+
/**
|
|
150
|
+
* Disables the form
|
|
151
|
+
*/
|
|
152
|
+
disabled?: boolean;
|
|
153
|
+
/**
|
|
154
|
+
* Prevents the form from resetting when disabled
|
|
155
|
+
* default is true
|
|
156
|
+
*/
|
|
157
|
+
preventFormResetOnDisabled?: boolean;
|
|
158
|
+
/**
|
|
159
|
+
* The element object from the quote
|
|
160
|
+
*/
|
|
161
|
+
element: ElementResponse;
|
|
162
|
+
/**
|
|
163
|
+
* Hides the submit button
|
|
164
|
+
*/
|
|
165
|
+
hideSubmitButton?: boolean;
|
|
166
|
+
/**
|
|
167
|
+
* Whether to validate the form on submit
|
|
168
|
+
*/
|
|
169
|
+
validateOnSubmit?: boolean;
|
|
170
|
+
/**
|
|
171
|
+
/**
|
|
172
|
+
* The text to display on the submit button
|
|
173
|
+
*/
|
|
174
|
+
submitButtonText?: string;
|
|
175
|
+
/**
|
|
176
|
+
* ID for the form wrapper
|
|
177
|
+
* */
|
|
178
|
+
id?: string;
|
|
179
|
+
};
|
|
180
|
+
|
|
126
181
|
/**
|
|
127
|
-
* QuoteForm is a form for
|
|
182
|
+
* QuoteForm is a form for updating a quote. It required a product data model, custom data types, and quote object to render the form.
|
|
128
183
|
*/
|
|
129
184
|
export declare const QuoteForm: {
|
|
130
|
-
({ quote,
|
|
185
|
+
({ quote, productModel, dataTypes, disabled, handleSubmit, isSubmitting, preventFormResetOnDisabled, validateOnSubmit, hideSubmitButton, submitButtonText, id, }: Props_2): JSX_2.Element;
|
|
131
186
|
displayName: string;
|
|
132
187
|
};
|
|
133
188
|
|