@skbkontur/react-ui-validations 1.5.4 → 1.6.0-beta.1
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/CHANGELOG.md +30 -0
- package/README.md +3 -3
- package/index.d.ts +256 -263
- package/index.js +104 -56
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,36 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.5.7](https://github.com/skbkontur/retail-ui/tree/master/packages/react-ui-validations/compare/react-ui-validations@1.5.6...react-ui-validations@1.5.7) (2021-10-25)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package react-ui-validations
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [1.5.6](https://github.com/skbkontur/retail-ui/tree/master/packages/react-ui-validations/compare/react-ui-validations@1.5.5...react-ui-validations@1.5.6) (2021-10-06)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* **validations:** update package name ([b5e4741](https://github.com/skbkontur/retail-ui/tree/master/packages/react-ui-validations/commit/b5e4741b157c2ab6f37188b356376f0fddf1e7cf))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## [1.5.5](https://github.com/skbkontur/retail-ui/tree/master/packages/react-ui-validations/compare/react-ui-validations@1.5.4...react-ui-validations@1.5.5) (2021-09-16)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Bug Fixes
|
|
29
|
+
|
|
30
|
+
* **validation:** hide error on editing combobox ([66c747d](https://github.com/skbkontur/retail-ui/tree/master/packages/react-ui-validations/commit/66c747d97766459fc7fb1fb322cad72636a55e56))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
6
36
|
## [1.5.4](https://github.com/skbkontur/retail-ui/tree/master/packages/react-ui-validations/compare/react-ui-validations@1.5.3...react-ui-validations@1.5.4) (2021-08-10)
|
|
7
37
|
|
|
8
38
|
**Note:** Version bump only for package react-ui-validations
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# React UI validations
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/react-ui-validations)
|
|
4
4
|
|
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
|
|
7
7
|
## Документация
|
|
8
8
|
|
|
9
|
-
- [Docs & Demos](
|
|
9
|
+
- [Docs & Demos](https://tech.skbkontur.ru/react-ui-validations/)
|
|
10
10
|
- [Validation guides](https://guides.kontur.ru/principles/validation/)
|
|
11
11
|
|
|
12
12
|
## Использование
|
|
13
13
|
|
|
14
14
|
```shell
|
|
15
|
-
npm install --save react-ui-validations
|
|
15
|
+
npm install --save @skbkontur/react-ui-validations
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
```jsx
|
package/index.d.ts
CHANGED
|
@@ -1,263 +1,256 @@
|
|
|
1
|
-
// Generated by dts-bundle v0.7.3
|
|
2
|
-
// Dependencies for this module:
|
|
3
|
-
// ../../react
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
export function
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
import
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
static
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
export
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
declare module '@skbkontur/react-ui-validations/src/
|
|
110
|
-
import
|
|
111
|
-
import
|
|
112
|
-
import {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
export
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
declare module '@skbkontur/react-ui-validations/
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
export
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
export
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
getReader(tokens: PathTokensCache): ValidationReader<T>;
|
|
258
|
-
set(validation: ValidationInfo): void;
|
|
259
|
-
isValidated(): boolean;
|
|
260
|
-
getNode<TChild>(path: string[]): ValidationWriter<TChild>;
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
|
|
1
|
+
// Generated by dts-bundle v0.7.3
|
|
2
|
+
// Dependencies for this module:
|
|
3
|
+
// ../../react
|
|
4
|
+
|
|
5
|
+
declare module '@skbkontur/react-ui-validations' {
|
|
6
|
+
import { text, tooltip } from '@skbkontur/react-ui-validations/src/ErrorRenderer';
|
|
7
|
+
import { ValidationContainer, ValidationContainerProps } from '@skbkontur/react-ui-validations/src/ValidationContainer';
|
|
8
|
+
import { TooltipPosition, ValidationTooltip, ValidationTooltipProps } from '@skbkontur/react-ui-validations/src/ValidationTooltip';
|
|
9
|
+
import { RenderErrorMessage, Validation, ValidationBehaviour } from '@skbkontur/react-ui-validations/src/ValidationWrapperInternal';
|
|
10
|
+
import { ValidationWrapper, ValidationInfo, ValidationWrapperProps } from '@skbkontur/react-ui-validations/src/ValidationWrapper';
|
|
11
|
+
import { ValidationContext, ValidationContextType, ValidationContextWrapper, ValidationContextWrapperProps } from '@skbkontur/react-ui-validations/src/ValidationContextWrapper';
|
|
12
|
+
export { ValidationContainer, ValidationContainerProps, ValidationContext, ValidationContextType, ValidationContextWrapper, ValidationContextWrapperProps, ValidationWrapper as ValidationWrapperV1, ValidationWrapperProps as ValidationWrapperV1Props, RenderErrorMessage, ValidationBehaviour, Validation, ValidationWrapper, ValidationWrapperProps, ValidationInfo, ValidationTooltip, ValidationTooltipProps, TooltipPosition, tooltip, text, };
|
|
13
|
+
export * from '@skbkontur/react-ui-validations/src/Validations';
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
declare module '@skbkontur/react-ui-validations/src/ErrorRenderer' {
|
|
17
|
+
import { TooltipPosition } from '@skbkontur/react-ui-validations/src/ValidationTooltip';
|
|
18
|
+
import { RenderErrorMessage } from '@skbkontur/react-ui-validations/src/ValidationWrapperInternal';
|
|
19
|
+
export function tooltip(pos: TooltipPosition): RenderErrorMessage;
|
|
20
|
+
export function text(pos?: 'bottom' | 'right'): RenderErrorMessage;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
declare module '@skbkontur/react-ui-validations/src/ValidationContainer' {
|
|
24
|
+
import React from 'react';
|
|
25
|
+
import { Nullable } from '@skbkontur/react-ui-validations/typings/Types';
|
|
26
|
+
export interface ScrollOffset {
|
|
27
|
+
top?: number;
|
|
28
|
+
bottom?: number;
|
|
29
|
+
}
|
|
30
|
+
export interface ValidationContainerProps {
|
|
31
|
+
children?: React.ReactNode;
|
|
32
|
+
onValidationUpdated?: (isValid?: Nullable<boolean>) => void;
|
|
33
|
+
scrollOffset?: number | ScrollOffset;
|
|
34
|
+
disableSmoothScroll: boolean;
|
|
35
|
+
}
|
|
36
|
+
export class ValidationContainer extends React.Component<ValidationContainerProps> {
|
|
37
|
+
static __KONTUR_REACT_UI__: string;
|
|
38
|
+
static defaultProps: {
|
|
39
|
+
disableSmoothScroll: boolean;
|
|
40
|
+
};
|
|
41
|
+
static propTypes: {
|
|
42
|
+
scrollOffset(props: ValidationContainerProps, propName: keyof ValidationContainerProps, componentName: string): Error | undefined;
|
|
43
|
+
};
|
|
44
|
+
submit(withoutFocus?: boolean): Promise<void>;
|
|
45
|
+
validate(withoutFocus?: boolean): Promise<boolean>;
|
|
46
|
+
render(): JSX.Element;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
declare module '@skbkontur/react-ui-validations/src/ValidationTooltip' {
|
|
51
|
+
import React from 'react';
|
|
52
|
+
export type TooltipPosition = 'top left' | 'top center' | 'top right' | 'bottom left' | 'bottom center' | 'bottom right' | 'left top' | 'left middle' | 'left bottom' | 'right top' | 'right middle' | 'right bottom';
|
|
53
|
+
export interface ValidationTooltipProps {
|
|
54
|
+
children: React.ReactElement<any>;
|
|
55
|
+
error: boolean;
|
|
56
|
+
pos?: TooltipPosition;
|
|
57
|
+
render?: () => React.ReactNode;
|
|
58
|
+
}
|
|
59
|
+
export class ValidationTooltip extends React.Component<ValidationTooltipProps> {
|
|
60
|
+
render(): JSX.Element;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
declare module '@skbkontur/react-ui-validations/src/ValidationWrapperInternal' {
|
|
65
|
+
import React from 'react';
|
|
66
|
+
import { Nullable } from '@skbkontur/react-ui-validations/typings/Types';
|
|
67
|
+
import { ValidationContextType } from '@skbkontur/react-ui-validations/src/ValidationContextWrapper';
|
|
68
|
+
export type ValidationBehaviour = 'immediate' | 'lostfocus' | 'submit';
|
|
69
|
+
export type ValidationLevel = 'error' | 'warning';
|
|
70
|
+
export interface Validation {
|
|
71
|
+
level: ValidationLevel;
|
|
72
|
+
behaviour: ValidationBehaviour;
|
|
73
|
+
message: React.ReactNode;
|
|
74
|
+
independent: boolean;
|
|
75
|
+
}
|
|
76
|
+
export type RenderErrorMessage = (control: React.ReactElement<any>, hasError: boolean, validation: Nullable<Validation>) => React.ReactElement<any>;
|
|
77
|
+
export interface ValidationWrapperInternalProps {
|
|
78
|
+
children?: React.ReactElement<any>;
|
|
79
|
+
validation: Nullable<Validation>;
|
|
80
|
+
errorMessage: RenderErrorMessage;
|
|
81
|
+
}
|
|
82
|
+
interface ValidationWrapperInternalState {
|
|
83
|
+
validation: Nullable<Validation>;
|
|
84
|
+
}
|
|
85
|
+
interface Point {
|
|
86
|
+
x: number;
|
|
87
|
+
y: number;
|
|
88
|
+
}
|
|
89
|
+
export class ValidationWrapperInternal extends React.Component<ValidationWrapperInternalProps, ValidationWrapperInternalState> {
|
|
90
|
+
state: ValidationWrapperInternalState;
|
|
91
|
+
isChanging: boolean;
|
|
92
|
+
static contextType: React.Context<ValidationContextType>;
|
|
93
|
+
context: ValidationContextType;
|
|
94
|
+
componentDidMount(): void;
|
|
95
|
+
componentWillUnmount(): void;
|
|
96
|
+
componentDidUpdate(): void;
|
|
97
|
+
focus(): Promise<void>;
|
|
98
|
+
render(): React.ReactElement<any, string | ((props: any) => React.ReactElement<any, any> | null) | (new (props: any) => React.Component<any, any, any>)>;
|
|
99
|
+
getRootNode: () => Nullable<HTMLElement>;
|
|
100
|
+
getControlPosition(): Nullable<Point>;
|
|
101
|
+
processBlur(): Promise<void>;
|
|
102
|
+
processSubmit(): Promise<void>;
|
|
103
|
+
hasError(): boolean;
|
|
104
|
+
isIndependent(): boolean;
|
|
105
|
+
}
|
|
106
|
+
export {};
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
declare module '@skbkontur/react-ui-validations/src/ValidationWrapper' {
|
|
110
|
+
import React from 'react';
|
|
111
|
+
import { Nullable } from '@skbkontur/react-ui-validations/typings/Types';
|
|
112
|
+
import { RenderErrorMessage, ValidationBehaviour, ValidationLevel } from '@skbkontur/react-ui-validations/src/ValidationWrapperInternal';
|
|
113
|
+
export interface ValidationInfo {
|
|
114
|
+
type?: Nullable<ValidationBehaviour>;
|
|
115
|
+
level?: Nullable<ValidationLevel>;
|
|
116
|
+
message: React.ReactNode;
|
|
117
|
+
independent?: boolean;
|
|
118
|
+
}
|
|
119
|
+
export interface ValidationWrapperProps {
|
|
120
|
+
children?: React.ReactElement<any>;
|
|
121
|
+
validationInfo: Nullable<ValidationInfo>;
|
|
122
|
+
renderMessage?: Nullable<RenderErrorMessage>;
|
|
123
|
+
}
|
|
124
|
+
export class ValidationWrapper extends React.Component<ValidationWrapperProps> {
|
|
125
|
+
static __KONTUR_REACT_UI__: string;
|
|
126
|
+
render(): JSX.Element;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
declare module '@skbkontur/react-ui-validations/src/ValidationContextWrapper' {
|
|
131
|
+
import React from 'react';
|
|
132
|
+
import { ValidationWrapperInternal } from '@skbkontur/react-ui-validations/src/ValidationWrapperInternal';
|
|
133
|
+
import { ScrollOffset } from '@skbkontur/react-ui-validations/src/ValidationContainer';
|
|
134
|
+
export interface ValidationContextSettings {
|
|
135
|
+
scrollOffset: ScrollOffset;
|
|
136
|
+
disableSmoothScroll: boolean;
|
|
137
|
+
}
|
|
138
|
+
export interface ValidationContextWrapperProps {
|
|
139
|
+
children?: React.ReactNode;
|
|
140
|
+
onValidationUpdated?: (isValid?: boolean) => void;
|
|
141
|
+
scrollOffset?: number | ScrollOffset;
|
|
142
|
+
disableSmoothScroll: boolean;
|
|
143
|
+
}
|
|
144
|
+
export interface ValidationContextType {
|
|
145
|
+
register: (wrapper: ValidationWrapperInternal) => void;
|
|
146
|
+
unregister: (wrapper: ValidationWrapperInternal) => void;
|
|
147
|
+
instanceProcessBlur: (wrapper: ValidationWrapperInternal) => void;
|
|
148
|
+
onValidationUpdated: (wrapper: ValidationWrapperInternal, isValid: boolean) => void;
|
|
149
|
+
getSettings: () => ValidationContextSettings;
|
|
150
|
+
isAnyWrapperInChangingMode: () => boolean;
|
|
151
|
+
}
|
|
152
|
+
export const ValidationContext: React.Context<ValidationContextType>;
|
|
153
|
+
export class ValidationContextWrapper extends React.Component<ValidationContextWrapperProps> {
|
|
154
|
+
childWrappers: ValidationWrapperInternal[];
|
|
155
|
+
getSettings(): ValidationContextSettings;
|
|
156
|
+
register(wrapper: ValidationWrapperInternal): void;
|
|
157
|
+
unregister(wrapper: ValidationWrapperInternal): void;
|
|
158
|
+
instanceProcessBlur(instance: ValidationWrapperInternal): void;
|
|
159
|
+
onValidationUpdated(wrapper: ValidationWrapperInternal, isValid?: boolean): void;
|
|
160
|
+
isAnyWrapperInChangingMode(): boolean;
|
|
161
|
+
onValidationRemoved(): void;
|
|
162
|
+
getChildWrappersSortedByPosition(): ValidationWrapperInternal[];
|
|
163
|
+
validate(withoutFocus: boolean): Promise<boolean>;
|
|
164
|
+
render(): JSX.Element;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
declare module '@skbkontur/react-ui-validations/src/Validations' {
|
|
169
|
+
import { ValidationBuilder } from '@skbkontur/react-ui-validations/src/Validations/ValidationBuilder';
|
|
170
|
+
import { RootValidationRule, ValidationRule, ItemValidationRule } from '@skbkontur/react-ui-validations/src/Validations/Types';
|
|
171
|
+
import { ValidationReader } from '@skbkontur/react-ui-validations/src/Validations/ValidationReader';
|
|
172
|
+
export type Validator<T> = (value: T) => ValidationReader<T>;
|
|
173
|
+
export function createValidator<T>(rule: RootValidationRule<T>): Validator<T>;
|
|
174
|
+
export { ValidationReader, ValidationBuilder, RootValidationRule, ValidationRule, ItemValidationRule };
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
declare module '@skbkontur/react-ui-validations/typings/Types' {
|
|
178
|
+
export type Nullable<T> = T | null | undefined;
|
|
179
|
+
export type Omit<T extends object, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
|
180
|
+
export type ExtractItem<T> = T extends Array<infer TItem> ? TItem : never;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
declare module '@skbkontur/react-ui-validations/src/Validations/ValidationBuilder' {
|
|
184
|
+
import React from 'react';
|
|
185
|
+
import { ValidationBehaviour, ValidationLevel } from '@skbkontur/react-ui-validations/src/ValidationWrapperInternal';
|
|
186
|
+
import { ValidationInfo } from '@skbkontur/react-ui-validations/src/ValidationWrapper';
|
|
187
|
+
import { LambdaPath, PathTokensCache } from '@skbkontur/react-ui-validations/src/Validations/PathHelper';
|
|
188
|
+
import { ValidationWriter } from '@skbkontur/react-ui-validations/src/Validations/ValidationWriter';
|
|
189
|
+
import { ItemValidationRule, ValidationRule } from '@skbkontur/react-ui-validations/src/Validations/Types';
|
|
190
|
+
export class ValidationBuilder<TRoot, T> {
|
|
191
|
+
constructor(writer: ValidationWriter<TRoot>, tokens: PathTokensCache, path: string[], data: T);
|
|
192
|
+
prop<TChild>(lambdaPath: LambdaPath<T, TChild>, rule: ValidationRule<TRoot, TChild>): void;
|
|
193
|
+
array<TChild>(lambdaPath: LambdaPath<T, TChild[]>, rule: ItemValidationRule<TRoot, TChild>): void;
|
|
194
|
+
invalid(isInvalid: (value: T) => boolean, validationInfo: ValidationInfo): void;
|
|
195
|
+
invalid(isInvalid: (value: T) => boolean, message: React.ReactNode, type?: ValidationBehaviour, level?: ValidationLevel, independent?: boolean): void;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
declare module '@skbkontur/react-ui-validations/src/Validations/Types' {
|
|
200
|
+
import { Nullable } from '@skbkontur/react-ui-validations/typings/Types';
|
|
201
|
+
import { ValidationInfo } from '@skbkontur/react-ui-validations/src/ValidationWrapper';
|
|
202
|
+
import { ValidationBuilder } from '@skbkontur/react-ui-validations/src/Validations/ValidationBuilder';
|
|
203
|
+
export interface ValidationNode<T> {
|
|
204
|
+
validation: Nullable<ValidationInfo>;
|
|
205
|
+
children: Nullable<{
|
|
206
|
+
[K in keyof T]: ValidationNode<T[K]>;
|
|
207
|
+
}>;
|
|
208
|
+
}
|
|
209
|
+
export type ValidationRule<TRoot, T> = (builder: ValidationBuilder<TRoot, T>, value: T) => void;
|
|
210
|
+
export type ItemValidationRule<TRoot, T> = (builder: ValidationBuilder<TRoot, T>, value: T, index: number, array: T[]) => void;
|
|
211
|
+
export type RootValidationRule<T> = ValidationRule<T, T>;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
declare module '@skbkontur/react-ui-validations/src/Validations/ValidationReader' {
|
|
215
|
+
import { ValidationInfo } from '@skbkontur/react-ui-validations/src/ValidationWrapper';
|
|
216
|
+
import { ExtractItem, Nullable } from '@skbkontur/react-ui-validations/typings/Types';
|
|
217
|
+
import { ValidationNode } from '@skbkontur/react-ui-validations/src/Validations/Types';
|
|
218
|
+
import { LambdaPath, PathTokensCache } from '@skbkontur/react-ui-validations/src/Validations/PathHelper';
|
|
219
|
+
export class ValidationReader<T> {
|
|
220
|
+
constructor(node: Nullable<ValidationNode<T>>, tokens: PathTokensCache);
|
|
221
|
+
getNode<TChild>(lambdaPath: LambdaPath<T, TChild>): ValidationReader<TChild>;
|
|
222
|
+
getNodeByIndex(index: number): ValidationReader<ExtractItem<T>>;
|
|
223
|
+
getNodeByKey<TKey extends keyof T>(key: TKey): ValidationReader<T[TKey]>;
|
|
224
|
+
get(): Nullable<ValidationInfo>;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
declare module '@skbkontur/react-ui-validations/src/Validations/PathHelper' {
|
|
229
|
+
type NonNullableRecursive<T> = {
|
|
230
|
+
[K in keyof T]: T[K] extends object ? NonNullable<NonNullableRecursive<T[K]>> : NonNullable<T[K]>;
|
|
231
|
+
};
|
|
232
|
+
export type LambdaPath<T, TChild> = (x: NonNullable<NonNullableRecursive<T>>) => TChild;
|
|
233
|
+
export function extractPath(lambda: string): string;
|
|
234
|
+
export function extractTokens(path: string): string[];
|
|
235
|
+
export class PathTokensCache {
|
|
236
|
+
getOrAdd<T, TChild>(lambdaPath: LambdaPath<T, TChild>): string[];
|
|
237
|
+
has<T, TChild>(lambdaPath: LambdaPath<T, TChild>): boolean;
|
|
238
|
+
get size(): number;
|
|
239
|
+
}
|
|
240
|
+
export {};
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
declare module '@skbkontur/react-ui-validations/src/Validations/ValidationWriter' {
|
|
244
|
+
import { ValidationInfo } from '@skbkontur/react-ui-validations/src/ValidationWrapper';
|
|
245
|
+
import { ValidationNode } from '@skbkontur/react-ui-validations/src/Validations/Types';
|
|
246
|
+
import { ValidationReader } from '@skbkontur/react-ui-validations/src/Validations/ValidationReader';
|
|
247
|
+
import { PathTokensCache } from '@skbkontur/react-ui-validations/src/Validations/PathHelper';
|
|
248
|
+
export class ValidationWriter<T> {
|
|
249
|
+
constructor(node?: ValidationNode<T>);
|
|
250
|
+
getReader(tokens: PathTokensCache): ValidationReader<T>;
|
|
251
|
+
set(validation: ValidationInfo): void;
|
|
252
|
+
isValidated(): boolean;
|
|
253
|
+
getNode<TChild>(path: string[]): ValidationWriter<TChild>;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
package/index.js
CHANGED
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
|
-
var PropTypes = require('prop-types');
|
|
7
|
-
var ReactDom = require('react-dom');
|
|
8
6
|
var warning = require('warning');
|
|
9
7
|
|
|
10
8
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -124,6 +122,10 @@ var ReactUiDetection = /** @class */ (function () {
|
|
|
124
122
|
var _a;
|
|
125
123
|
return childrenArray != null && ((_a = childrenArray.type) === null || _a === void 0 ? void 0 : _a.__KONTUR_REACT_UI__) === 'Switcher';
|
|
126
124
|
};
|
|
125
|
+
ReactUiDetection.isComboBox = function (childrenArray) {
|
|
126
|
+
var _a;
|
|
127
|
+
return childrenArray != null && ((_a = childrenArray.type) === null || _a === void 0 ? void 0 : _a.__KONTUR_REACT_UI__) === 'ComboBox';
|
|
128
|
+
};
|
|
127
129
|
return ReactUiDetection;
|
|
128
130
|
}());
|
|
129
131
|
|
|
@@ -188,19 +190,26 @@ var isReactUITestEnv = Boolean(REACT_UI_TEST) || // for cases when NODE_ENV is n
|
|
|
188
190
|
var isTestEnv = NODE_ENV === 'test' || isReactUITestEnv;
|
|
189
191
|
var isBrowser = typeof window !== 'undefined';
|
|
190
192
|
|
|
191
|
-
var ValidationContext =
|
|
192
|
-
|
|
193
|
-
function
|
|
193
|
+
var ValidationContext = React__default['default'].createContext({
|
|
194
|
+
register: function () { return undefined; },
|
|
195
|
+
unregister: function () { return undefined; },
|
|
196
|
+
instanceProcessBlur: function () { return undefined; },
|
|
197
|
+
onValidationUpdated: function () { return undefined; },
|
|
198
|
+
getSettings: function () { return ({
|
|
199
|
+
scrollOffset: {},
|
|
200
|
+
disableSmoothScroll: false,
|
|
201
|
+
}); },
|
|
202
|
+
isAnyWrapperInChangingMode: function () { return false; },
|
|
203
|
+
});
|
|
204
|
+
ValidationContext.displayName = 'ValidationContext';
|
|
205
|
+
var ValidationContextWrapper = /** @class */ (function (_super) {
|
|
206
|
+
__extends(ValidationContextWrapper, _super);
|
|
207
|
+
function ValidationContextWrapper() {
|
|
194
208
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
195
209
|
_this.childWrappers = [];
|
|
196
210
|
return _this;
|
|
197
211
|
}
|
|
198
|
-
|
|
199
|
-
return {
|
|
200
|
-
validationContext: this,
|
|
201
|
-
};
|
|
202
|
-
};
|
|
203
|
-
ValidationContext.prototype.getSettings = function () {
|
|
212
|
+
ValidationContextWrapper.prototype.getSettings = function () {
|
|
204
213
|
var scrollOffset = {};
|
|
205
214
|
if (typeof this.props.scrollOffset === 'number') {
|
|
206
215
|
scrollOffset = { top: this.props.scrollOffset };
|
|
@@ -217,20 +226,20 @@ var ValidationContext = /** @class */ (function (_super) {
|
|
|
217
226
|
disableSmoothScroll: this.props.disableSmoothScroll,
|
|
218
227
|
};
|
|
219
228
|
};
|
|
220
|
-
|
|
229
|
+
ValidationContextWrapper.prototype.register = function (wrapper) {
|
|
221
230
|
this.childWrappers.push(wrapper);
|
|
222
231
|
};
|
|
223
|
-
|
|
232
|
+
ValidationContextWrapper.prototype.unregister = function (wrapper) {
|
|
224
233
|
this.childWrappers.splice(this.childWrappers.indexOf(wrapper), 1);
|
|
225
234
|
this.onValidationRemoved();
|
|
226
235
|
};
|
|
227
|
-
|
|
228
|
-
for (var _i = 0, _a = this.childWrappers.filter(function (x) { return x !== instance; }); _i < _a.length; _i++) {
|
|
236
|
+
ValidationContextWrapper.prototype.instanceProcessBlur = function (instance) {
|
|
237
|
+
for (var _i = 0, _a = this.childWrappers.filter(function (x) { return x !== instance && !x.isIndependent(); }); _i < _a.length; _i++) {
|
|
229
238
|
var wrapper = _a[_i];
|
|
230
239
|
wrapper.processBlur();
|
|
231
240
|
}
|
|
232
241
|
};
|
|
233
|
-
|
|
242
|
+
ValidationContextWrapper.prototype.onValidationUpdated = function (wrapper, isValid) {
|
|
234
243
|
var onValidationUpdated = this.props.onValidationUpdated;
|
|
235
244
|
if (onValidationUpdated) {
|
|
236
245
|
var isValidResult = !this.childWrappers.find(function (x) {
|
|
@@ -242,17 +251,17 @@ var ValidationContext = /** @class */ (function (_super) {
|
|
|
242
251
|
onValidationUpdated(isValidResult);
|
|
243
252
|
}
|
|
244
253
|
};
|
|
245
|
-
|
|
254
|
+
ValidationContextWrapper.prototype.isAnyWrapperInChangingMode = function () {
|
|
246
255
|
return this.childWrappers.some(function (x) { return x.isChanging; });
|
|
247
256
|
};
|
|
248
|
-
|
|
257
|
+
ValidationContextWrapper.prototype.onValidationRemoved = function () {
|
|
249
258
|
var onValidationUpdated = this.props.onValidationUpdated;
|
|
250
259
|
if (onValidationUpdated) {
|
|
251
260
|
var isValidResult = !this.childWrappers.find(function (x) { return x.hasError(); });
|
|
252
261
|
onValidationUpdated(isValidResult);
|
|
253
262
|
}
|
|
254
263
|
};
|
|
255
|
-
|
|
264
|
+
ValidationContextWrapper.prototype.getChildWrappersSortedByPosition = function () {
|
|
256
265
|
var wrappersWithPosition = __spreadArrays(this.childWrappers).map(function (x) { return ({
|
|
257
266
|
target: x,
|
|
258
267
|
position: x.getControlPosition(),
|
|
@@ -276,7 +285,7 @@ var ValidationContext = /** @class */ (function (_super) {
|
|
|
276
285
|
});
|
|
277
286
|
return wrappersWithPosition.map(function (x) { return x.target; });
|
|
278
287
|
};
|
|
279
|
-
|
|
288
|
+
ValidationContextWrapper.prototype.validate = function (withoutFocus) {
|
|
280
289
|
return __awaiter(this, void 0, void 0, function () {
|
|
281
290
|
var firstInvalid;
|
|
282
291
|
return __generator(this, function (_a) {
|
|
@@ -298,13 +307,11 @@ var ValidationContext = /** @class */ (function (_super) {
|
|
|
298
307
|
});
|
|
299
308
|
});
|
|
300
309
|
};
|
|
301
|
-
|
|
302
|
-
return React__default['default'].createElement(
|
|
303
|
-
|
|
304
|
-
ValidationContext.childContextTypes = {
|
|
305
|
-
validationContext: PropTypes.any,
|
|
310
|
+
ValidationContextWrapper.prototype.render = function () {
|
|
311
|
+
return (React__default['default'].createElement(ValidationContext.Provider, { value: this },
|
|
312
|
+
React__default['default'].createElement("span", null, this.props.children)));
|
|
306
313
|
};
|
|
307
|
-
return
|
|
314
|
+
return ValidationContextWrapper;
|
|
308
315
|
}(React__default['default'].Component));
|
|
309
316
|
|
|
310
317
|
var ValidationContainer = /** @class */ (function (_super) {
|
|
@@ -340,7 +347,7 @@ var ValidationContainer = /** @class */ (function (_super) {
|
|
|
340
347
|
return this.childContext.validate(withoutFocus);
|
|
341
348
|
};
|
|
342
349
|
ValidationContainer.prototype.render = function () {
|
|
343
|
-
return (React__default['default'].createElement(
|
|
350
|
+
return (React__default['default'].createElement(ValidationContextWrapper, { ref: this.refChildContext, scrollOffset: this.props.scrollOffset, disableSmoothScroll: this.props.disableSmoothScroll, onValidationUpdated: this.props.onValidationUpdated }, this.props.children));
|
|
344
351
|
};
|
|
345
352
|
ValidationContainer.__KONTUR_REACT_UI__ = 'ValidationContainer';
|
|
346
353
|
ValidationContainer.defaultProps = {
|
|
@@ -519,11 +526,19 @@ function getType(validation) {
|
|
|
519
526
|
function getLevel(validation) {
|
|
520
527
|
return validation ? validation.level : null;
|
|
521
528
|
}
|
|
529
|
+
function getIndependent(validation) {
|
|
530
|
+
return validation ? validation.independent : null;
|
|
531
|
+
}
|
|
522
532
|
function isEqual(a, b) {
|
|
523
533
|
if (a === b) {
|
|
524
534
|
return true;
|
|
525
535
|
}
|
|
526
|
-
return !!a &&
|
|
536
|
+
return (!!a &&
|
|
537
|
+
!!b &&
|
|
538
|
+
a.behaviour === b.behaviour &&
|
|
539
|
+
a.level === a.level &&
|
|
540
|
+
a.message === b.message &&
|
|
541
|
+
a.independent === b.independent);
|
|
527
542
|
}
|
|
528
543
|
|
|
529
544
|
if (isBrowser && typeof HTMLElement === 'undefined') {
|
|
@@ -538,25 +553,26 @@ var ValidationWrapperInternal = /** @class */ (function (_super) {
|
|
|
538
553
|
validation: null,
|
|
539
554
|
};
|
|
540
555
|
_this.isChanging = false;
|
|
556
|
+
_this.context = _this.context;
|
|
557
|
+
_this.setRootNode = function (element) {
|
|
558
|
+
_this.rootNode = element;
|
|
559
|
+
};
|
|
560
|
+
_this.getRootNode = function () {
|
|
561
|
+
return _this.rootNode;
|
|
562
|
+
};
|
|
541
563
|
return _this;
|
|
542
564
|
}
|
|
543
|
-
ValidationWrapperInternal.prototype.UNSAFE_componentWillMount = function () {
|
|
544
|
-
this.applyValidation(this.props.validation);
|
|
545
|
-
};
|
|
546
565
|
ValidationWrapperInternal.prototype.componentDidMount = function () {
|
|
547
|
-
warning__default['default'](this.context
|
|
548
|
-
'
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
}
|
|
566
|
+
warning__default['default'](this.context, 'ValidationWrapper should appears as child of ValidationContainer.\n' +
|
|
567
|
+
'https://tech.skbkontur.ru/react-ui-validations/#/getting-started');
|
|
568
|
+
this.context.register(this);
|
|
569
|
+
this.applyValidation(this.props.validation);
|
|
552
570
|
};
|
|
553
571
|
ValidationWrapperInternal.prototype.componentWillUnmount = function () {
|
|
554
|
-
|
|
555
|
-
this.context.validationContext.unregister(this);
|
|
556
|
-
}
|
|
572
|
+
this.context.unregister(this);
|
|
557
573
|
};
|
|
558
|
-
ValidationWrapperInternal.prototype.
|
|
559
|
-
this.applyValidation(
|
|
574
|
+
ValidationWrapperInternal.prototype.componentDidUpdate = function () {
|
|
575
|
+
this.applyValidation(this.props.validation);
|
|
560
576
|
};
|
|
561
577
|
ValidationWrapperInternal.prototype.focus = function () {
|
|
562
578
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -564,9 +580,9 @@ var ValidationWrapperInternal = /** @class */ (function (_super) {
|
|
|
564
580
|
return __generator(this, function (_b) {
|
|
565
581
|
switch (_b.label) {
|
|
566
582
|
case 0:
|
|
567
|
-
htmlElement =
|
|
583
|
+
htmlElement = this.getRootNode();
|
|
568
584
|
if (!(htmlElement instanceof HTMLElement)) return [3 /*break*/, 3];
|
|
569
|
-
_a = this.context.
|
|
585
|
+
_a = this.context.getSettings(), disableSmoothScroll = _a.disableSmoothScroll, scrollOffset = _a.scrollOffset;
|
|
570
586
|
if (!!disableSmoothScroll) return [3 /*break*/, 2];
|
|
571
587
|
return [4 /*yield*/, smoothScrollIntoView(htmlElement, scrollOffset)];
|
|
572
588
|
case 1:
|
|
@@ -637,10 +653,26 @@ var ValidationWrapperInternal = /** @class */ (function (_super) {
|
|
|
637
653
|
}
|
|
638
654
|
},
|
|
639
655
|
})) : (React__default['default'].createElement("span", null));
|
|
640
|
-
|
|
656
|
+
if (ReactUiDetection.isComboBox(clonedChild)) {
|
|
657
|
+
clonedChild = React__default['default'].cloneElement(clonedChild, {
|
|
658
|
+
onInputValueChange: function () {
|
|
659
|
+
var _a;
|
|
660
|
+
var args = [];
|
|
661
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
662
|
+
args[_i] = arguments[_i];
|
|
663
|
+
}
|
|
664
|
+
_this.isChanging = true;
|
|
665
|
+
_this.forceUpdate();
|
|
666
|
+
if (children && children.props && children.props.onInputValueChange) {
|
|
667
|
+
(_a = children.props).onInputValueChange.apply(_a, args);
|
|
668
|
+
}
|
|
669
|
+
},
|
|
670
|
+
});
|
|
671
|
+
}
|
|
672
|
+
return this.props.errorMessage(React__default['default'].createElement("span", { ref: this.setRootNode }, clonedChild), !!validation, validation);
|
|
641
673
|
};
|
|
642
674
|
ValidationWrapperInternal.prototype.getControlPosition = function () {
|
|
643
|
-
var htmlElement =
|
|
675
|
+
var htmlElement = this.getRootNode();
|
|
644
676
|
if (htmlElement instanceof HTMLElement) {
|
|
645
677
|
var rect = htmlElement.getBoundingClientRect();
|
|
646
678
|
return { x: rect.top, y: rect.left };
|
|
@@ -664,10 +696,18 @@ var ValidationWrapperInternal = /** @class */ (function (_super) {
|
|
|
664
696
|
ValidationWrapperInternal.prototype.hasError = function () {
|
|
665
697
|
return getLevel(this.state.validation) === 'error';
|
|
666
698
|
};
|
|
699
|
+
ValidationWrapperInternal.prototype.isIndependent = function () {
|
|
700
|
+
return getIndependent(this.state.validation || this.props.validation) === true;
|
|
701
|
+
};
|
|
667
702
|
ValidationWrapperInternal.prototype.handleBlur = function () {
|
|
668
|
-
this
|
|
669
|
-
|
|
670
|
-
|
|
703
|
+
var _this = this;
|
|
704
|
+
setTimeout(function () {
|
|
705
|
+
_this.processBlur();
|
|
706
|
+
if (!_this.isIndependent()) {
|
|
707
|
+
_this.context.instanceProcessBlur(_this);
|
|
708
|
+
}
|
|
709
|
+
_this.setState({});
|
|
710
|
+
});
|
|
671
711
|
};
|
|
672
712
|
ValidationWrapperInternal.prototype.applyValidation = function (actual) {
|
|
673
713
|
var visible = this.getVisibleValidation(actual);
|
|
@@ -682,7 +722,7 @@ var ValidationWrapperInternal = /** @class */ (function (_super) {
|
|
|
682
722
|
return new Promise(function (resolve) {
|
|
683
723
|
_this.setState({ validation: validation }, resolve);
|
|
684
724
|
if (Boolean(current) !== Boolean(validation)) {
|
|
685
|
-
_this.context.
|
|
725
|
+
_this.context.onValidationUpdated(_this, !validation);
|
|
686
726
|
}
|
|
687
727
|
});
|
|
688
728
|
};
|
|
@@ -699,12 +739,10 @@ var ValidationWrapperInternal = /** @class */ (function (_super) {
|
|
|
699
739
|
if (isEqual(visible, actual)) {
|
|
700
740
|
return visible;
|
|
701
741
|
}
|
|
702
|
-
var changing = this.context.
|
|
742
|
+
var changing = this.context.isAnyWrapperInChangingMode();
|
|
703
743
|
return getVisibleValidation(visible, actual, changing);
|
|
704
744
|
};
|
|
705
|
-
ValidationWrapperInternal.
|
|
706
|
-
validationContext: PropTypes.any,
|
|
707
|
-
};
|
|
745
|
+
ValidationWrapperInternal.contextType = ValidationContext;
|
|
708
746
|
return ValidationWrapperInternal;
|
|
709
747
|
}(React__default['default'].Component));
|
|
710
748
|
|
|
@@ -720,6 +758,7 @@ var ValidationWrapper = /** @class */ (function (_super) {
|
|
|
720
758
|
level: validationInfo.level || 'error',
|
|
721
759
|
behaviour: validationInfo.type || 'lostfocus',
|
|
722
760
|
message: validationInfo.message,
|
|
761
|
+
independent: validationInfo.independent || false,
|
|
723
762
|
}
|
|
724
763
|
: null;
|
|
725
764
|
return (React__default['default'].createElement(ValidationWrapperInternal, { errorMessage: renderMessage || tooltip('right top'), validation: validation }, children));
|
|
@@ -755,7 +794,7 @@ var ValidationBuilder = /** @class */ (function () {
|
|
|
755
794
|
rule(builder, builder.data, i, array);
|
|
756
795
|
}
|
|
757
796
|
};
|
|
758
|
-
ValidationBuilder.prototype.invalid = function (isInvalid,
|
|
797
|
+
ValidationBuilder.prototype.invalid = function (isInvalid, messageOrValidationInfo, type, level, independent) {
|
|
759
798
|
var validationWriter = this.writer.getNode(this.path);
|
|
760
799
|
if (validationWriter.isValidated()) {
|
|
761
800
|
return;
|
|
@@ -764,7 +803,12 @@ var ValidationBuilder = /** @class */ (function () {
|
|
|
764
803
|
if (!invalid) {
|
|
765
804
|
return;
|
|
766
805
|
}
|
|
767
|
-
|
|
806
|
+
if (isValidationInfo(messageOrValidationInfo)) {
|
|
807
|
+
validationWriter.set(messageOrValidationInfo);
|
|
808
|
+
}
|
|
809
|
+
else {
|
|
810
|
+
validationWriter.set({ message: messageOrValidationInfo, type: type, level: level, independent: independent });
|
|
811
|
+
}
|
|
768
812
|
};
|
|
769
813
|
ValidationBuilder.prototype.getPathInfo = function (lambdaPath) {
|
|
770
814
|
var path = this.tokens.getOrAdd(lambdaPath);
|
|
@@ -779,7 +823,10 @@ var ValidationBuilder = /** @class */ (function () {
|
|
|
779
823
|
return { data: data, path: __spreadArrays(this.path, path) };
|
|
780
824
|
};
|
|
781
825
|
return ValidationBuilder;
|
|
782
|
-
}());
|
|
826
|
+
}());
|
|
827
|
+
var isValidationInfo = function (argument) {
|
|
828
|
+
return typeof argument === 'object' && Object.prototype.hasOwnProperty.call(argument, 'message');
|
|
829
|
+
};
|
|
783
830
|
|
|
784
831
|
var ValidationReader = /** @class */ (function () {
|
|
785
832
|
function ValidationReader(node, tokens) {
|
|
@@ -909,6 +956,7 @@ function createValidator(rule) {
|
|
|
909
956
|
exports.ValidationBuilder = ValidationBuilder;
|
|
910
957
|
exports.ValidationContainer = ValidationContainer;
|
|
911
958
|
exports.ValidationContext = ValidationContext;
|
|
959
|
+
exports.ValidationContextWrapper = ValidationContextWrapper;
|
|
912
960
|
exports.ValidationReader = ValidationReader;
|
|
913
961
|
exports.ValidationTooltip = ValidationTooltip;
|
|
914
962
|
exports.ValidationWrapper = ValidationWrapper;
|