iglooform 2.5.47 → 2.5.48
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/es/confirmation/index.js +1 -1
- package/es/types.d.ts +1 -1
- package/es/utils/form-utils.js +44 -0
- package/lib/confirmation/index.js +1 -1
- package/lib/types.d.ts +1 -1
- package/lib/utils/form-utils.js +44 -0
- package/package.json +1 -1
package/es/confirmation/index.js
CHANGED
package/es/types.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ export interface FormBasicConfig {
|
|
|
35
35
|
export declare type FormItemAssert = {
|
|
36
36
|
field: NamePath;
|
|
37
37
|
value?: any;
|
|
38
|
-
operation?: 'eq' | 'ne' | 'in' | 'ni' | 'lt' | 'le' | 'gt' | 'ge' | 'co' | 'nc' | 'filled' | 'unfilled';
|
|
38
|
+
operation?: 'eq' | 'ne' | 'in' | 'ni' | 'lt' | 'le' | 'gt' | 'ge' | 'co' | 'nc' | 'filled' | 'unfilled' | 'co-some' | 'co-every' | 'some-in' | 'every-in';
|
|
39
39
|
};
|
|
40
40
|
export declare type FormItemCopyValue = {
|
|
41
41
|
assert: FormItemAssert;
|
package/es/utils/form-utils.js
CHANGED
|
@@ -99,6 +99,50 @@ export var testAssert = function testAssert(form, assert) {
|
|
|
99
99
|
case 'eq':
|
|
100
100
|
return v === value;
|
|
101
101
|
|
|
102
|
+
case 'co-every':
|
|
103
|
+
{
|
|
104
|
+
if (!Array.isArray(v) || !Array.isArray(value)) {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return value.every(function (i) {
|
|
109
|
+
return v.includes(i);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
case 'co-some':
|
|
114
|
+
{
|
|
115
|
+
if (!Array.isArray(v) || !Array.isArray(value)) {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return value.some(function (i) {
|
|
120
|
+
return v.includes(i);
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
case 'every-in':
|
|
125
|
+
{
|
|
126
|
+
if (!Array.isArray(v) || !Array.isArray(value)) {
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return v.every(function (i) {
|
|
131
|
+
return value.includes(i);
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
case 'some-in':
|
|
136
|
+
{
|
|
137
|
+
if (!Array.isArray(v) || !Array.isArray(value)) {
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return v.some(function (i) {
|
|
142
|
+
return value.includes(i);
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
|
|
102
146
|
default:
|
|
103
147
|
if (value !== undefined) return v === value;
|
|
104
148
|
return v !== undefined;
|
package/lib/types.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ export interface FormBasicConfig {
|
|
|
35
35
|
export declare type FormItemAssert = {
|
|
36
36
|
field: NamePath;
|
|
37
37
|
value?: any;
|
|
38
|
-
operation?: 'eq' | 'ne' | 'in' | 'ni' | 'lt' | 'le' | 'gt' | 'ge' | 'co' | 'nc' | 'filled' | 'unfilled';
|
|
38
|
+
operation?: 'eq' | 'ne' | 'in' | 'ni' | 'lt' | 'le' | 'gt' | 'ge' | 'co' | 'nc' | 'filled' | 'unfilled' | 'co-some' | 'co-every' | 'some-in' | 'every-in';
|
|
39
39
|
};
|
|
40
40
|
export declare type FormItemCopyValue = {
|
|
41
41
|
assert: FormItemAssert;
|
package/lib/utils/form-utils.js
CHANGED
|
@@ -116,6 +116,50 @@ var testAssert = function testAssert(form, assert) {
|
|
|
116
116
|
case 'eq':
|
|
117
117
|
return v === value;
|
|
118
118
|
|
|
119
|
+
case 'co-every':
|
|
120
|
+
{
|
|
121
|
+
if (!Array.isArray(v) || !Array.isArray(value)) {
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return value.every(function (i) {
|
|
126
|
+
return v.includes(i);
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
case 'co-some':
|
|
131
|
+
{
|
|
132
|
+
if (!Array.isArray(v) || !Array.isArray(value)) {
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return value.some(function (i) {
|
|
137
|
+
return v.includes(i);
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
case 'every-in':
|
|
142
|
+
{
|
|
143
|
+
if (!Array.isArray(v) || !Array.isArray(value)) {
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
return v.every(function (i) {
|
|
148
|
+
return value.includes(i);
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
case 'some-in':
|
|
153
|
+
{
|
|
154
|
+
if (!Array.isArray(v) || !Array.isArray(value)) {
|
|
155
|
+
return false;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return v.some(function (i) {
|
|
159
|
+
return value.includes(i);
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
|
|
119
163
|
default:
|
|
120
164
|
if (value !== undefined) return v === value;
|
|
121
165
|
return v !== undefined;
|