cx 23.4.0 → 23.4.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/dist/manifest.js +471 -471
- package/dist/widgets.js +4 -2
- package/package.json +1 -1
- package/src/data/StructuredSelector.d.ts +4 -2
- package/src/widgets/form/ValidationError.js +20 -13
- package/src/widgets/form/Validator.js +3 -2
package/dist/widgets.js
CHANGED
|
@@ -7392,6 +7392,7 @@ var ValidationError = /*#__PURE__*/ (function(_Widget) {
|
|
|
7392
7392
|
{
|
|
7393
7393
|
className: data.classNames,
|
|
7394
7394
|
htmlFor: data.fieldId,
|
|
7395
|
+
style: data.style,
|
|
7395
7396
|
children: data.errorMessage
|
|
7396
7397
|
},
|
|
7397
7398
|
key
|
|
@@ -17046,8 +17047,9 @@ var Validator = /*#__PURE__*/ (function(_Field) {
|
|
|
17046
17047
|
return false;
|
|
17047
17048
|
};
|
|
17048
17049
|
|
|
17049
|
-
_proto.render = function render() {
|
|
17050
|
-
return
|
|
17050
|
+
_proto.render = function render(context, instance, key) {
|
|
17051
|
+
if (!instance.state.visited || !instance.data.error) return;
|
|
17052
|
+
return this.renderChildren(context, instance, key);
|
|
17051
17053
|
};
|
|
17052
17054
|
|
|
17053
17055
|
return Validator;
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StructuredProp, Record,
|
|
1
|
+
import { StructuredProp, Record, Selector } from "../core";
|
|
2
2
|
import { View } from "./View";
|
|
3
3
|
|
|
4
4
|
interface StructuredSelectorConfig {
|
|
@@ -11,5 +11,7 @@ export class StructuredSelector {
|
|
|
11
11
|
|
|
12
12
|
init(store: View);
|
|
13
13
|
|
|
14
|
-
create(memoize?: bool = true):
|
|
14
|
+
create(memoize?: bool = true): Selector<Record>;
|
|
15
|
+
|
|
16
|
+
createStoreSelector(): (store: View) => Record;
|
|
15
17
|
}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import {Widget, VDOM} from
|
|
1
|
+
import { Widget, VDOM } from "../../ui/Widget";
|
|
2
2
|
|
|
3
3
|
export class ValidationError extends Widget {
|
|
4
|
-
|
|
5
4
|
checkVisible(context, instance, data) {
|
|
6
|
-
if (
|
|
7
|
-
|
|
5
|
+
if (
|
|
6
|
+
data.visible &&
|
|
7
|
+
context.lastFieldId &&
|
|
8
|
+
context.validation &&
|
|
9
|
+
context.validation.errors &&
|
|
10
|
+
context.validation.errors.length > 0
|
|
11
|
+
) {
|
|
12
|
+
var lastError = (instance.lastError = context.validation.errors[context.validation.errors.length - 1]);
|
|
8
13
|
return lastError.fieldId == context.lastFieldId && lastError.visited;
|
|
9
14
|
}
|
|
10
15
|
|
|
@@ -12,9 +17,9 @@ export class ValidationError extends Widget {
|
|
|
12
17
|
}
|
|
13
18
|
|
|
14
19
|
explore(context, instance) {
|
|
15
|
-
var {data, lastError} = instance;
|
|
16
|
-
let c1 = instance.cache(
|
|
17
|
-
let c2 = instance.cache(
|
|
20
|
+
var { data, lastError } = instance;
|
|
21
|
+
let c1 = instance.cache("lastErrorMessage", lastError.message);
|
|
22
|
+
let c2 = instance.cache("lastErrorFieldId", lastError.fieldId);
|
|
18
23
|
if (c1 || c2) {
|
|
19
24
|
data.errorMessage = lastError.message;
|
|
20
25
|
data.fieldId = lastError.fieldId;
|
|
@@ -24,14 +29,16 @@ export class ValidationError extends Widget {
|
|
|
24
29
|
}
|
|
25
30
|
|
|
26
31
|
render(context, instance, key) {
|
|
27
|
-
var {data} = instance;
|
|
28
|
-
return
|
|
29
|
-
{data.
|
|
30
|
-
|
|
32
|
+
var { data } = instance;
|
|
33
|
+
return (
|
|
34
|
+
<label key={key} className={data.classNames} htmlFor={data.fieldId} style={data.style}>
|
|
35
|
+
{data.errorMessage}
|
|
36
|
+
</label>
|
|
37
|
+
);
|
|
31
38
|
}
|
|
32
39
|
}
|
|
33
40
|
|
|
34
|
-
ValidationError.prototype.baseClass =
|
|
41
|
+
ValidationError.prototype.baseClass = "validationerror";
|
|
35
42
|
ValidationError.prototype.styled = true;
|
|
36
43
|
|
|
37
|
-
Widget.alias(
|
|
44
|
+
Widget.alias("validation-error", ValidationError);
|
|
@@ -14,7 +14,8 @@ export class Validator extends Field {
|
|
|
14
14
|
return false;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
render() {
|
|
18
|
-
return
|
|
17
|
+
render(context, instance, key) {
|
|
18
|
+
if (!instance.state.visited || !instance.data.error) return;
|
|
19
|
+
return this.renderChildren(context, instance, key);
|
|
19
20
|
}
|
|
20
21
|
}
|