onekijs-ui 0.19.25 → 0.19.26
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/components/accordion/typings.d.ts +111 -4
- package/dist/components/field/typings.d.ts +140 -0
- package/dist/components/icon/util.d.ts +6 -6
- package/dist/components/input/FormInput.d.ts +17 -0
- package/dist/components/input/typings.d.ts +48 -0
- package/dist/components/select/SelectService.d.ts +3 -3
- package/dist/components/table/typings.d.ts +2 -2
- package/dist/index.js +47 -8
- package/dist/index.js.map +1 -1
- package/dist/index.module.js +47 -8
- package/dist/index.module.js.map +1 -1
- package/dist/styles/border.d.ts +1 -1
- package/dist/styles/size.d.ts +6 -6
- package/dist/styles/typography.d.ts +1 -1
- package/package.json +3 -3
- package/src/components/accordion/typings.ts +111 -4
- package/src/components/field/typings.ts +141 -0
- package/src/components/input/FormInput.tsx +17 -0
- package/src/components/input/typings.ts +48 -0
- package/src/components/select/components/SelectTokensComponent.tsx +10 -7
- package/src/components/table/components/ArrayTableComponent.tsx +24 -2
- package/src/components/table/typings.ts +2 -2
|
@@ -1,57 +1,164 @@
|
|
|
1
1
|
import { AnonymousObject, AnyFunction, FCC } from 'onekijs-framework';
|
|
2
|
+
/**
|
|
3
|
+
* @group Accordion
|
|
4
|
+
* @category types
|
|
5
|
+
*/
|
|
2
6
|
export type AccordionPanelProps<T = string> = {
|
|
7
|
+
/**
|
|
8
|
+
* Indicates if the panel is active. This value cannot be changed afterwards since it's managed by the accordion
|
|
9
|
+
* Active and expand are similar if it's "single-expand" accordion. For a multi-expand accordion, the active panel is the last expanded one
|
|
10
|
+
* Only one panel can be active at the same time
|
|
11
|
+
*
|
|
12
|
+
* @defaultValue false
|
|
13
|
+
*/
|
|
3
14
|
initialActive?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Indicates if the panel is expanded. This value cannot be changed afterwards since it's managed by the accordion
|
|
17
|
+
*
|
|
18
|
+
* @defaultValue false
|
|
19
|
+
*/
|
|
4
20
|
initialExpand?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* The title of the panel. This value is rendered by the property Component
|
|
23
|
+
*
|
|
24
|
+
* @remarks #important#
|
|
25
|
+
*/
|
|
5
26
|
title: T;
|
|
27
|
+
/**
|
|
28
|
+
* The component used to render the title
|
|
29
|
+
*
|
|
30
|
+
* @defaultValue AccordionPanelTitle
|
|
31
|
+
*/
|
|
6
32
|
Component?: FCC<AccordionPanelTitleProps<T>>;
|
|
33
|
+
/**
|
|
34
|
+
* Used to redirect the user to an URL instead of expanding a content
|
|
35
|
+
*
|
|
36
|
+
* @example /users
|
|
37
|
+
*/
|
|
7
38
|
link?: string;
|
|
8
39
|
};
|
|
40
|
+
/**
|
|
41
|
+
* @group Accordion
|
|
42
|
+
* @category types
|
|
43
|
+
*/
|
|
9
44
|
export type AccordionPanelTitleProps<T = string> = {
|
|
45
|
+
/**
|
|
46
|
+
* The title that must be rendered by the Component
|
|
47
|
+
*/
|
|
10
48
|
title: T;
|
|
49
|
+
/**
|
|
50
|
+
* Indicates that the panel is the active one
|
|
51
|
+
*/
|
|
11
52
|
active: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Listener that is called when the user clicks on the title
|
|
55
|
+
*/
|
|
12
56
|
onClick: AnyFunction;
|
|
57
|
+
/**
|
|
58
|
+
* Indicates that a click on the title should redirect the user to an URL instead of expanding a content
|
|
59
|
+
*/
|
|
13
60
|
link?: string;
|
|
14
61
|
};
|
|
62
|
+
/**
|
|
63
|
+
* Defines the state of an accordion panel
|
|
64
|
+
*
|
|
65
|
+
* @group Accordion
|
|
66
|
+
* @category types
|
|
67
|
+
*/
|
|
15
68
|
export type AccordionPanelState = {
|
|
69
|
+
/**
|
|
70
|
+
* Indicates if the panel is active.
|
|
71
|
+
* Active and expand are similar if it's "single-expand" accordion. For a multi-expand accordion, the active panel is the last expanded one
|
|
72
|
+
* Only one panel can be active at the same time
|
|
73
|
+
*/
|
|
16
74
|
active: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* a unique id auto-generated for each panel
|
|
77
|
+
*/
|
|
17
78
|
uid: string;
|
|
79
|
+
/**
|
|
80
|
+
* Indicates if the panel is collapsing (only useful when there are some animations)
|
|
81
|
+
*/
|
|
18
82
|
collapsing?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Indicates if the panel is expanding (only useful when there are some animations)
|
|
85
|
+
*/
|
|
19
86
|
expanding?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Indicates whether the panel is expanded or collapsed
|
|
89
|
+
*/
|
|
20
90
|
expanded?: boolean;
|
|
21
91
|
};
|
|
22
92
|
/**
|
|
93
|
+
* Defines the props of an Accordion
|
|
94
|
+
*
|
|
23
95
|
* @group Accordion
|
|
24
96
|
* @category types
|
|
25
97
|
*/
|
|
26
98
|
export type AccordionProps = {
|
|
27
99
|
/**
|
|
28
|
-
* a flag to indicate
|
|
100
|
+
* a flag to indicate whether the border of the accordion is visible or not
|
|
29
101
|
*
|
|
30
|
-
* @example false
|
|
31
102
|
* @defaultValue true
|
|
32
103
|
*/
|
|
33
104
|
border?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* The unstyled component that is used to render the accordion
|
|
107
|
+
*
|
|
108
|
+
* @defaultValue AccordionComponent
|
|
109
|
+
*/
|
|
34
110
|
Component?: FCC<Omit<AccordionProps, 'Component'>>;
|
|
111
|
+
/**
|
|
112
|
+
* A CSS class name that is attached to the accordion root element
|
|
113
|
+
* Multiple class names must be separated by commas
|
|
114
|
+
*
|
|
115
|
+
*/
|
|
35
116
|
className?: string;
|
|
36
117
|
/**
|
|
118
|
+
* Indicates if multiple panels can be expanded at the same time
|
|
119
|
+
*
|
|
37
120
|
* @defaultValue false
|
|
38
121
|
*/
|
|
39
122
|
multiExpand?: boolean;
|
|
40
123
|
/**
|
|
124
|
+
* The animation duration when a panel is expanded or collapse
|
|
125
|
+
* A value of 0 disables the animation
|
|
126
|
+
*
|
|
41
127
|
* @defaultValue 150
|
|
42
128
|
*/
|
|
43
129
|
animate?: number;
|
|
44
130
|
/**
|
|
45
|
-
* push means that the height of
|
|
46
|
-
* pushToBottom means that the height of the accordion panel is the remaining space given by the accordion's container after removing the space taken by the other accordion panel titles (
|
|
131
|
+
* `push` means that the height of an accordion panel is derived from the height of its content
|
|
132
|
+
* `pushToBottom` means that the height of the accordion panel is the remaining space given by the accordion's container after removing the space taken by the other accordion panel titles (does not work if multiExpand is true)
|
|
47
133
|
*
|
|
48
134
|
* @defaultValue push
|
|
49
135
|
*/
|
|
50
136
|
mode?: 'push' | 'pushToBottom';
|
|
51
137
|
};
|
|
138
|
+
/**
|
|
139
|
+
* Defines the state of an Accordion.
|
|
140
|
+
* Used internally by the AccordionService
|
|
141
|
+
*
|
|
142
|
+
* @group Accordion
|
|
143
|
+
* @category types
|
|
144
|
+
*/
|
|
52
145
|
export type AccordionState = {
|
|
146
|
+
/**
|
|
147
|
+
* The state of each panel member of the Accordion
|
|
148
|
+
*/
|
|
53
149
|
panels: AnonymousObject<AccordionPanelState>;
|
|
150
|
+
/**
|
|
151
|
+
* Indicates if multiple panels can be expanded at the same time
|
|
152
|
+
*/
|
|
54
153
|
multiExpand?: boolean;
|
|
154
|
+
/**
|
|
155
|
+
* The animation duration when a panel is expanded or collapse
|
|
156
|
+
* A value of 0 disables the animation
|
|
157
|
+
*/
|
|
55
158
|
animate: number;
|
|
159
|
+
/**
|
|
160
|
+
* `push` means that the height of an accordion panel is derived from the height of its content
|
|
161
|
+
* `pushToBottom` means that the height of the accordion panel is the remaining space given by the accordion's container after removing the space taken by the other accordion panel titles (does not work if multiExpand is true)
|
|
162
|
+
*/
|
|
56
163
|
mode?: 'push' | 'pushToBottom';
|
|
57
164
|
};
|
|
@@ -34,25 +34,165 @@ export type FieldHelpProps = {
|
|
|
34
34
|
layout?: FormLayout;
|
|
35
35
|
};
|
|
36
36
|
export type FieldLayoutProps = {
|
|
37
|
+
/**
|
|
38
|
+
* A CSS class name to be added to the field's root element
|
|
39
|
+
* Each internal element is generally associated with a class name to let you can easily style it via CSS
|
|
40
|
+
*
|
|
41
|
+
* Multiple classNames must be separated by commas
|
|
42
|
+
*/
|
|
37
43
|
className?: string;
|
|
44
|
+
/**
|
|
45
|
+
* A quick description of the field (should not be too long)
|
|
46
|
+
* This message is rendered below the field
|
|
47
|
+
*
|
|
48
|
+
* @remarks #important#
|
|
49
|
+
*/
|
|
38
50
|
description?: ReactNode;
|
|
51
|
+
/**
|
|
52
|
+
* Indicates if the field is disabled.
|
|
53
|
+
* If the field is managed by a form, changing this value will have no effect, and this property should only be used to set the initial value.
|
|
54
|
+
* If the field is container
|
|
55
|
+
* * if it's disabled, any field inside the container will also be disabled
|
|
56
|
+
* * if it's enabled, any field inside the container will be disabled or enabled depending on their own disabled property
|
|
57
|
+
*
|
|
58
|
+
* @defaultValue false
|
|
59
|
+
* @remarks #important#
|
|
60
|
+
*/
|
|
39
61
|
disabled?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Replace the default component used to display the description
|
|
64
|
+
*
|
|
65
|
+
* @defaultValue FieldDescription
|
|
66
|
+
*/
|
|
40
67
|
DescriptionComponent?: React.FC<FieldDescriptionProps>;
|
|
68
|
+
/**
|
|
69
|
+
* A message describing the field.
|
|
70
|
+
* It can be a long message since the content is displayed in a tooltip
|
|
71
|
+
*
|
|
72
|
+
* @remarks #important#
|
|
73
|
+
*/
|
|
41
74
|
help?: ReactNode;
|
|
75
|
+
/**
|
|
76
|
+
* Replace the default component used to display the help message
|
|
77
|
+
*
|
|
78
|
+
* @defaultValue FieldHelp
|
|
79
|
+
*/
|
|
42
80
|
HelpComponent?: React.FC<FieldHelpProps>;
|
|
81
|
+
/**
|
|
82
|
+
* The id of the field. Must be unique within the app
|
|
83
|
+
* This id is attached to the HTML object and can be used to manipulate the field via standard JS methods
|
|
84
|
+
*
|
|
85
|
+
*/
|
|
43
86
|
id?: string | number;
|
|
87
|
+
/**
|
|
88
|
+
* The label is placed in front of the field (if the layout is horizontal) or above the field (if the layout is vertical).
|
|
89
|
+
* It should describe in one word the value expected by the field
|
|
90
|
+
* The label is not rendered if the noLabel option is active. If the noLabel option is not active, an empty label always takes up space in the form (to maintain alignment).
|
|
91
|
+
*
|
|
92
|
+
* @example First Name
|
|
93
|
+
* @remarks #important#
|
|
94
|
+
*/
|
|
44
95
|
label?: string;
|
|
96
|
+
/**
|
|
97
|
+
* Replace the default component used to display the label
|
|
98
|
+
*
|
|
99
|
+
* @defaultValue Label
|
|
100
|
+
*/
|
|
45
101
|
LabelComponent?: React.FC<LabelProps>;
|
|
102
|
+
/**
|
|
103
|
+
* The width reserved for the label. It only makes sense if the layout is horizontal.
|
|
104
|
+
* The expected value is between 1 and 12 (see the grid component)
|
|
105
|
+
* The "width" value can be replaced by a breakpoint width (used to specify a different "width" value for a smartphone or desktop computer, for example).
|
|
106
|
+
*
|
|
107
|
+
* Note that the labelWidth can be defined at the form level (every field inside the form will inherit the value) or in the settings file (for every form)
|
|
108
|
+
*
|
|
109
|
+
* @defaultValue 3
|
|
110
|
+
*/
|
|
46
111
|
labelWidth?: GridSize;
|
|
112
|
+
/**
|
|
113
|
+
* The width reserved for the label for extra small screen. It only makes sense if the layout is horizontal.
|
|
114
|
+
* The expected value is between 1 and 12 (see the grid component)
|
|
115
|
+
* If it's not defined, the labelWidth is used for extra small screen
|
|
116
|
+
* By default, the breakpoint for very small screens is 576px, but this can be modified by a custom theme.
|
|
117
|
+
*
|
|
118
|
+
* Note that the xsLabelWidth can be defined at the form level (every field inside the form will inherit the value) or in the settings file (for every form)
|
|
119
|
+
*/
|
|
47
120
|
xsLabelWidth?: GridSize;
|
|
121
|
+
/**
|
|
122
|
+
* The width reserved for the label for small screens. It only makes sense if the layout is horizontal.
|
|
123
|
+
* The expected value is between 1 and 12 (see the grid component)
|
|
124
|
+
* If it's not defined, the labelWidth is used for small screens
|
|
125
|
+
* By default, the breakpoint for small screens is 768px, but this can be modified by a custom theme.
|
|
126
|
+
*
|
|
127
|
+
* Note that the smLabelWidth can be defined at the form level (every field inside the form will inherit the value) or in the settings file (for every form)
|
|
128
|
+
*/
|
|
48
129
|
smLabelWidth?: GridSize;
|
|
130
|
+
/**
|
|
131
|
+
* The width reserved for the label for medium screens. It only makes sense if the layout is horizontal.
|
|
132
|
+
* The expected value is between 1 and 12 (see the grid component)
|
|
133
|
+
* If it's not defined, the labelWidth is used for medium screens
|
|
134
|
+
* By default, the breakpoint for medium screens is 992px, but this can be modified by a custom theme.
|
|
135
|
+
*
|
|
136
|
+
* Note that the mdLabelWidth can be defined at the form level (every field inside the form will inherit the value) or in the settings file (for every form)
|
|
137
|
+
*/
|
|
49
138
|
mdLabelWidth?: GridSize;
|
|
139
|
+
/**
|
|
140
|
+
* The width reserved for the label for large screens. It only makes sense if the layout is horizontal.
|
|
141
|
+
* The expected value is between 1 and 12 (see the grid component)
|
|
142
|
+
* If it's not defined, the labelWidth is used for large screens
|
|
143
|
+
* By default, the breakpoint for large screens is 1200px, but this can be modified by a custom theme.
|
|
144
|
+
*
|
|
145
|
+
* Note that the lgLabelWidth can be defined at the form level (every field inside the form will inherit the value) or in the settings file (for every form)
|
|
146
|
+
*/
|
|
50
147
|
lgLabelWidth?: GridSize;
|
|
148
|
+
/**
|
|
149
|
+
* The width reserved for the label for extra large screens. It only makes sense if the layout is horizontal.
|
|
150
|
+
* The expected value is between 1 and 12 (see the grid component)
|
|
151
|
+
* If it's not defined, the labelWidth is used for extra large screens
|
|
152
|
+
* By default, the breakpoint for extra large screens is 1850px, but this can be modified by a custom theme.
|
|
153
|
+
*
|
|
154
|
+
* Note that the lgLabelWidth can be defined at the form level (every field inside the form will inherit the value) or in the settings file (for every form)
|
|
155
|
+
*/
|
|
51
156
|
xlLabelWidth?: GridSize;
|
|
157
|
+
/**
|
|
158
|
+
* The layout of the field. Can be vertical or horizontal
|
|
159
|
+
* If the layout is horizontal, the label is displayed in front of the field
|
|
160
|
+
* If the layout is vertical, the label is diplayed above the field
|
|
161
|
+
*
|
|
162
|
+
* Note that the layout can be defined at the form level (every field inside the form will inherit the value) or in the settings file (for every form)
|
|
163
|
+
*/
|
|
52
164
|
layout?: FormLayout;
|
|
165
|
+
/**
|
|
166
|
+
* Indicates if the field is mandatory
|
|
167
|
+
* If a field is mandatory, a small red star will be visible next to the label.
|
|
168
|
+
* If a field is disabled, the required property is automatically removed
|
|
169
|
+
*
|
|
170
|
+
* @remarks #important#
|
|
171
|
+
*/
|
|
53
172
|
required?: boolean;
|
|
173
|
+
/**
|
|
174
|
+
* The size of the field
|
|
175
|
+
* Valid values are:
|
|
176
|
+
* * small
|
|
177
|
+
* * medium
|
|
178
|
+
* * large
|
|
179
|
+
* * xlarge
|
|
180
|
+
*
|
|
181
|
+
* @defaultValue medium
|
|
182
|
+
*/
|
|
54
183
|
size?: TshirtSize;
|
|
184
|
+
/**
|
|
185
|
+
* The status of the validation of the field
|
|
186
|
+
* If the field is managed by a form, this property is ignored (since everything is controlled by the form)
|
|
187
|
+
*/
|
|
55
188
|
validation?: FieldValidation | ContainerValidation;
|
|
189
|
+
/**
|
|
190
|
+
* The visibility of the field
|
|
191
|
+
* If the field is managed by a form, changing this value will have no effect, and this property should only be used to set the initial visibility.
|
|
192
|
+
*
|
|
193
|
+
* @defaultValue true
|
|
194
|
+
* @remarks #important#
|
|
195
|
+
*/
|
|
56
196
|
visible?: boolean;
|
|
57
197
|
};
|
|
58
198
|
export type UseFieldLayoutProps<T extends AnonymousObject> = T & FormFieldProps & FieldLayoutProps & {
|
|
@@ -9,7 +9,7 @@ export declare const getIconDivProps: (props: IconProps) => {
|
|
|
9
9
|
checked?: boolean | undefined;
|
|
10
10
|
crossOrigin?: "" | "anonymous" | "use-credentials" | undefined;
|
|
11
11
|
disabled?: boolean | undefined;
|
|
12
|
-
enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "
|
|
12
|
+
enterKeyHint?: "search" | "enter" | "done" | "go" | "next" | "previous" | "send" | undefined;
|
|
13
13
|
form?: string | undefined;
|
|
14
14
|
formAction?: string | undefined;
|
|
15
15
|
formEncType?: string | undefined;
|
|
@@ -80,7 +80,7 @@ export declare const getIconDivProps: (props: IconProps) => {
|
|
|
80
80
|
results?: number | undefined;
|
|
81
81
|
security?: string | undefined;
|
|
82
82
|
unselectable?: "on" | "off" | undefined;
|
|
83
|
-
inputMode?: "
|
|
83
|
+
inputMode?: "search" | "text" | "email" | "tel" | "url" | "none" | "numeric" | "decimal" | undefined;
|
|
84
84
|
is?: string | undefined;
|
|
85
85
|
'aria-activedescendant'?: string | undefined;
|
|
86
86
|
'aria-atomic'?: (boolean | "true" | "false") | undefined;
|
|
@@ -94,17 +94,17 @@ export declare const getIconDivProps: (props: IconProps) => {
|
|
|
94
94
|
'aria-colindextext'?: string | undefined;
|
|
95
95
|
'aria-colspan'?: number | undefined;
|
|
96
96
|
'aria-controls'?: string | undefined;
|
|
97
|
-
'aria-current'?: boolean | "
|
|
97
|
+
'aria-current'?: boolean | "time" | "step" | "date" | "true" | "false" | "page" | "location" | undefined;
|
|
98
98
|
'aria-describedby'?: string | undefined;
|
|
99
99
|
'aria-description'?: string | undefined;
|
|
100
100
|
'aria-details'?: string | undefined;
|
|
101
101
|
'aria-disabled'?: (boolean | "true" | "false") | undefined;
|
|
102
|
-
'aria-dropeffect'?: "
|
|
102
|
+
'aria-dropeffect'?: "link" | "none" | "copy" | "move" | "execute" | "popup" | undefined;
|
|
103
103
|
'aria-errormessage'?: string | undefined;
|
|
104
104
|
'aria-expanded'?: (boolean | "true" | "false") | undefined;
|
|
105
105
|
'aria-flowto'?: string | undefined;
|
|
106
106
|
'aria-grabbed'?: (boolean | "true" | "false") | undefined;
|
|
107
|
-
'aria-haspopup'?: boolean | "
|
|
107
|
+
'aria-haspopup'?: boolean | "dialog" | "menu" | "true" | "false" | "grid" | "listbox" | "tree" | undefined;
|
|
108
108
|
'aria-hidden'?: (boolean | "true" | "false") | undefined;
|
|
109
109
|
'aria-invalid'?: boolean | "true" | "false" | "grammar" | "spelling" | undefined;
|
|
110
110
|
'aria-keyshortcuts'?: string | undefined;
|
|
@@ -121,7 +121,7 @@ export declare const getIconDivProps: (props: IconProps) => {
|
|
|
121
121
|
'aria-posinset'?: number | undefined;
|
|
122
122
|
'aria-pressed'?: boolean | "true" | "false" | "mixed" | undefined;
|
|
123
123
|
'aria-readonly'?: (boolean | "true" | "false") | undefined;
|
|
124
|
-
'aria-relevant'?: "text" | "
|
|
124
|
+
'aria-relevant'?: "text" | "all" | "additions" | "additions removals" | "additions text" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals" | undefined;
|
|
125
125
|
'aria-required'?: (boolean | "true" | "false") | undefined;
|
|
126
126
|
'aria-roledescription'?: string | undefined;
|
|
127
127
|
'aria-rowcount'?: number | undefined;
|
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { FormInputProps } from './typings';
|
|
3
|
+
/**
|
|
4
|
+
* `<FormInput/>` is a Input component designed to be managed by a Form.
|
|
5
|
+
* It must therefore be a nested component of a Form
|
|
6
|
+
*
|
|
7
|
+
* This component displays standard HTML input (and therefore supports all the HTML properties of an input component), but some properties are handled entirely by a form controller.
|
|
8
|
+
* * value
|
|
9
|
+
* * onChange
|
|
10
|
+
* * onFocus
|
|
11
|
+
* * onBlur
|
|
12
|
+
* * validations
|
|
13
|
+
* * visibility
|
|
14
|
+
* * disabled
|
|
15
|
+
* The value is synchronized in both directions (it can be modified manually by the user or by the controller).
|
|
16
|
+
*
|
|
17
|
+
* @group Form
|
|
18
|
+
* @category Components
|
|
19
|
+
*/
|
|
3
20
|
declare const FormInput: FC<FormInputProps>;
|
|
4
21
|
export default FormInput;
|
|
@@ -3,13 +3,61 @@ import { TshirtSize } from '../../styles/typings';
|
|
|
3
3
|
import { FieldDisplayerProps, FieldLayoutProps } from '../field/typings';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
export type InputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'> & {
|
|
6
|
+
/**
|
|
7
|
+
* A component rendered in front of the input component (actually inside the border of the input component)
|
|
8
|
+
*/
|
|
6
9
|
PrefixComponent?: React.FC<InputProps>;
|
|
10
|
+
/**
|
|
11
|
+
* A component rendered in after the input component (actually inside the border of the input component)
|
|
12
|
+
*/
|
|
7
13
|
SuffixComponent?: React.FC<InputProps>;
|
|
14
|
+
/**
|
|
15
|
+
* The status of the input
|
|
16
|
+
* Valid values are:
|
|
17
|
+
* * ValidationStatus.Loading
|
|
18
|
+
* * ValidationStatus.Error
|
|
19
|
+
* * ValidationStatus.Warning
|
|
20
|
+
* * ValidationStatus.OK
|
|
21
|
+
* * ValidationStatus.None
|
|
22
|
+
* If the input is used in a form, the status is controlled by the form and this prop is ignored
|
|
23
|
+
*
|
|
24
|
+
* @defaultValue ValidationStatus.None
|
|
25
|
+
*/
|
|
8
26
|
status?: ValidationStatus;
|
|
27
|
+
/**
|
|
28
|
+
* The size of the input
|
|
29
|
+
* Valid values are:
|
|
30
|
+
* * small
|
|
31
|
+
* * medium
|
|
32
|
+
* * large
|
|
33
|
+
* * xlarge
|
|
34
|
+
*
|
|
35
|
+
* @defaultValue medium
|
|
36
|
+
*/
|
|
9
37
|
size?: TshirtSize;
|
|
10
38
|
};
|
|
11
39
|
export type FormInputProps = InputProps & FormFieldProps & FieldLayoutProps & {
|
|
40
|
+
/**
|
|
41
|
+
* The default value of the field if no specific value has been specified
|
|
42
|
+
* A value can be passed to field
|
|
43
|
+
* * either manually by the user filling the form
|
|
44
|
+
* * via the setValue of the form controller (if the field is inside a <Form> component)
|
|
45
|
+
* * via an initial value transmitted to the form
|
|
46
|
+
*
|
|
47
|
+
* @remarks #important#
|
|
48
|
+
*/
|
|
12
49
|
defaultValue?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Replace the default component that display the input
|
|
52
|
+
*
|
|
53
|
+
* @defaultValue Input
|
|
54
|
+
*/
|
|
13
55
|
FieldComponent?: React.FC<InputProps>;
|
|
56
|
+
/**
|
|
57
|
+
* There are three components used to display the value of an FormInput in the summary step
|
|
58
|
+
* * Displayer: display (label + value)
|
|
59
|
+
* * FieldDisplayer: extract the value from the field and display it
|
|
60
|
+
* * ValueDisplayer: customize how the value is displayed
|
|
61
|
+
*/
|
|
14
62
|
FieldDisplayer?: React.FC<FieldDisplayerProps>;
|
|
15
63
|
};
|
|
@@ -5,15 +5,15 @@ declare class SelectService<T = any, I extends SelectItem<T> = SelectItem<T>, S
|
|
|
5
5
|
protected lastCheckQuery: Query | undefined;
|
|
6
6
|
get defaultValue(): T | T[] | null | undefined;
|
|
7
7
|
get defaultValueLoading(): boolean | undefined;
|
|
8
|
-
check(): Generator<void | import("redux-saga/effects").AllEffect<import("redux-saga/effects").CallEffect<Generator<I[] | Generator<void | import("redux-saga/effects").
|
|
8
|
+
check(): Generator<void | import("redux-saga/effects").AllEffect<import("redux-saga/effects").CallEffect<Generator<I[] | Generator<void | import("redux-saga/effects").CancelEffect | import("redux-saga/effects").ForkEffect<Generator<void | import("redux-saga/effects").CallEffect<true>, void, unknown>> | CollectionFetcherResult<T> | Promise<CollectionFetcherResult<T> | undefined>, CollectionFetcherResult<T>, (import("redux-saga").Task<any> | null) & CollectionFetcherResult<T> & (CollectionFetcherResult<T> | undefined)>, I | undefined, I[] & CollectionFetcherResult<T>>>> | import("redux-saga/effects").AllEffect<Generator<I[] | Generator<void | import("redux-saga/effects").CancelEffect | import("redux-saga/effects").ForkEffect<Generator<void | import("redux-saga/effects").CallEffect<true>, void, unknown>> | CollectionFetcherResult<T> | Promise<CollectionFetcherResult<T> | undefined>, CollectionFetcherResult<T>, (import("redux-saga").Task<any> | null) & CollectionFetcherResult<T> & (CollectionFetcherResult<T> | undefined)>, I | undefined, I[] & CollectionFetcherResult<T>>> | import("redux-saga/effects").CallEffect<void>, void, (I | undefined)[]>;
|
|
9
9
|
setData(data: T[], query?: Query): void;
|
|
10
|
-
setDefaultValue(value: T | T[] | null | undefined): Generator<void | Generator<void | import("redux-saga/effects").AllEffect<import("redux-saga/effects").CallEffect<Generator<I[] | Generator<void | import("redux-saga/effects").
|
|
10
|
+
setDefaultValue(value: T | T[] | null | undefined): Generator<void | Generator<void | import("redux-saga/effects").AllEffect<import("redux-saga/effects").CallEffect<Generator<I[] | Generator<void | import("redux-saga/effects").CancelEffect | import("redux-saga/effects").ForkEffect<Generator<void | import("redux-saga/effects").CallEffect<true>, void, unknown>> | CollectionFetcherResult<T> | Promise<CollectionFetcherResult<T> | undefined>, CollectionFetcherResult<T>, (import("redux-saga").Task<any> | null) & CollectionFetcherResult<T> & (CollectionFetcherResult<T> | undefined)>, I | undefined, I[] & CollectionFetcherResult<T>>>> | import("redux-saga/effects").AllEffect<Generator<I[] | Generator<void | import("redux-saga/effects").CancelEffect | import("redux-saga/effects").ForkEffect<Generator<void | import("redux-saga/effects").CallEffect<true>, void, unknown>> | CollectionFetcherResult<T> | Promise<CollectionFetcherResult<T> | undefined>, CollectionFetcherResult<T>, (import("redux-saga").Task<any> | null) & CollectionFetcherResult<T> & (CollectionFetcherResult<T> | undefined)>, I | undefined, I[] & CollectionFetcherResult<T>>> | import("redux-saga/effects").CallEffect<void>, void, (I | undefined)[]>, void, unknown>;
|
|
11
11
|
setDefaultValueLoading(loading: boolean): void;
|
|
12
12
|
setItemWidth(_item: I, value: number): void;
|
|
13
13
|
setValue(value: null | T | T[]): void;
|
|
14
14
|
setUrl(url: string, query?: Query): void;
|
|
15
15
|
_buildItem(data: T | null | undefined, adaptee: unknown, context?: AnonymousObject): I;
|
|
16
|
-
_filterItem(item: I | undefined, query: Query, valid: boolean): Generator<I[] | Generator<void | import("redux-saga/effects").
|
|
16
|
+
_filterItem(item: I | undefined, query: Query, valid: boolean): Generator<I[] | Generator<void | import("redux-saga/effects").CancelEffect | import("redux-saga/effects").ForkEffect<Generator<void | import("redux-saga/effects").CallEffect<true>, void, unknown>> | CollectionFetcherResult<T> | Promise<CollectionFetcherResult<T> | undefined>, CollectionFetcherResult<T>, (import("redux-saga").Task<any> | null) & CollectionFetcherResult<T> & (CollectionFetcherResult<T> | undefined)>, I | undefined, I[] & CollectionFetcherResult<T>>;
|
|
17
17
|
_compareItem(a: I | undefined, b: I | undefined): boolean;
|
|
18
18
|
_setDefaultValue(value: T | T[] | null | undefined): void;
|
|
19
19
|
_setValidDefaultValue(value: T | T[] | null): void;
|
|
@@ -11,7 +11,7 @@ import TableService from './TableService';
|
|
|
11
11
|
export type ArrayTableProps<T = any, I extends TableItem<T> = TableItem<T>> = TableConfig<T, I> & {
|
|
12
12
|
adapter?: TableItemAdapter<T>;
|
|
13
13
|
columns?: TableColumn<T, I>[];
|
|
14
|
-
dataSource?: string | T[];
|
|
14
|
+
dataSource?: string | T[] | (() => T[] | Promise<T[]>);
|
|
15
15
|
fetchOnce?: boolean;
|
|
16
16
|
selected?: T[];
|
|
17
17
|
};
|
|
@@ -252,7 +252,7 @@ export type TableProps<T = any, I extends TableItem<T> = TableItem<T>, S extends
|
|
|
252
252
|
adapter?: TableItemAdapter<T>;
|
|
253
253
|
controller?: CollectionProxy<T, I, S, C>;
|
|
254
254
|
columns?: TableColumn<T, I>[];
|
|
255
|
-
dataSource?: string | T[];
|
|
255
|
+
dataSource?: string | T[] | (() => T[] | Promise<T[]>);
|
|
256
256
|
fetchOnce?: boolean;
|
|
257
257
|
selected?: T[];
|
|
258
258
|
};
|
package/dist/index.js
CHANGED
|
@@ -4401,6 +4401,23 @@ const Password = styled(PasswordComponent$1) `
|
|
|
4401
4401
|
const FormInputValueDisplayer = ({ value }) => {
|
|
4402
4402
|
return React.createElement("span", { className: "o-input-displayer-value" }, value ?? '');
|
|
4403
4403
|
};
|
|
4404
|
+
/**
|
|
4405
|
+
* `<FormInput/>` is a Input component designed to be managed by a Form.
|
|
4406
|
+
* It must therefore be a nested component of a Form
|
|
4407
|
+
*
|
|
4408
|
+
* This component displays standard HTML input (and therefore supports all the HTML properties of an input component), but some properties are handled entirely by a form controller.
|
|
4409
|
+
* * value
|
|
4410
|
+
* * onChange
|
|
4411
|
+
* * onFocus
|
|
4412
|
+
* * onBlur
|
|
4413
|
+
* * validations
|
|
4414
|
+
* * visibility
|
|
4415
|
+
* * disabled
|
|
4416
|
+
* The value is synchronized in both directions (it can be modified manually by the user or by the controller).
|
|
4417
|
+
*
|
|
4418
|
+
* @group Form
|
|
4419
|
+
* @category Components
|
|
4420
|
+
*/
|
|
4404
4421
|
const FormInput = React.memo((props) => {
|
|
4405
4422
|
const [fieldLayoutProps, fieldComponentProps] = useFieldLayout(Object.assign({}, props, {
|
|
4406
4423
|
defaultValue: props.defaultValue === undefined ? '' : props.defaultValue,
|
|
@@ -6630,13 +6647,15 @@ const SelectTokensComponent = ({ tokens, onRemove, maxDisplayTokens, }) => {
|
|
|
6630
6647
|
};
|
|
6631
6648
|
const onEntering = (node) => {
|
|
6632
6649
|
const width = node.getBoundingClientRect().width;
|
|
6633
|
-
|
|
6634
|
-
|
|
6635
|
-
|
|
6636
|
-
|
|
6637
|
-
|
|
6638
|
-
|
|
6639
|
-
|
|
6650
|
+
if (width) {
|
|
6651
|
+
node.style.width = '0px';
|
|
6652
|
+
node.style.opacity = '0';
|
|
6653
|
+
node.style.transition = 'all 150ms';
|
|
6654
|
+
setTimeout(() => {
|
|
6655
|
+
node.style.width = `${width}px`;
|
|
6656
|
+
node.style.opacity = '1';
|
|
6657
|
+
}, 0);
|
|
6658
|
+
}
|
|
6640
6659
|
};
|
|
6641
6660
|
if (tokens !== undefined) {
|
|
6642
6661
|
if (!maxDisplayTokens || tokens.length <= maxDisplayTokens) {
|
|
@@ -10461,10 +10480,30 @@ const ControllerTableComponent = ({ autoRefresh, controller, className, bodyClas
|
|
|
10461
10480
|
ControllerTableComponent.displayName = 'Table';
|
|
10462
10481
|
|
|
10463
10482
|
const ArrayTableComponent = (props) => {
|
|
10464
|
-
|
|
10483
|
+
let dataSource = undefined;
|
|
10484
|
+
if (props.dataSource && !(typeof props.dataSource === 'string') && !Array.isArray(props.dataSource)) {
|
|
10485
|
+
// dataSource is an async function
|
|
10486
|
+
// we force it to be undefined and we are going to load the dataSource asynchronously
|
|
10487
|
+
dataSource = undefined;
|
|
10488
|
+
}
|
|
10489
|
+
else {
|
|
10490
|
+
dataSource = props.dataSource;
|
|
10491
|
+
}
|
|
10492
|
+
const controller = useTableController(dataSource, props.columns, {
|
|
10465
10493
|
adapter: props.adapter,
|
|
10466
10494
|
fetchOnce: props.fetchOnce,
|
|
10467
10495
|
});
|
|
10496
|
+
React.useEffect(() => {
|
|
10497
|
+
const loadDataSource = (async () => {
|
|
10498
|
+
if (props.dataSource && !(typeof props.dataSource === 'string') && !Array.isArray(props.dataSource)) {
|
|
10499
|
+
const data = await props.dataSource();
|
|
10500
|
+
controller.setData(data);
|
|
10501
|
+
}
|
|
10502
|
+
});
|
|
10503
|
+
if (dataSource === undefined && props.dataSource !== undefined) {
|
|
10504
|
+
loadDataSource();
|
|
10505
|
+
}
|
|
10506
|
+
}, []);
|
|
10468
10507
|
return React.createElement(ControllerTableComponent, { ...props, controller: controller });
|
|
10469
10508
|
};
|
|
10470
10509
|
|