@kizmann/nano-ui 1.1.3 → 1.1.4
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/nano-ui.js +1 -1
- package/dist/nano-ui.js.map +1 -1
- package/dist/themes/default.css +1 -1
- package/dist/themes/webservy.css +1 -1
- package/package.json +1 -1
- package/src/config/src/config/config-next.jsx +0 -2
- package/src/form/src/form/form-rules.mjs +59 -28
- package/src/select/src/select/select.jsx +2 -4
- package/src/table/src/table-cell/types/table-cell-string.jsx +3 -1
- package/themes/default/alert/src/alert/alert.scss +1 -1
- package/themes/default/confirm/src/confirm/confirm.scss +1 -1
- package/themes/default/drawer/src/drawer/drawer.scss +1 -1
- package/themes/default/modal/src/modal/modal.scss +1 -1
- package/themes/webservy/alert/src/alert/alert.scss +1 -1
|
@@ -2,11 +2,13 @@ import { Any, Arr, Locale, Obj } from "@kizmann/pico-js";
|
|
|
2
2
|
|
|
3
3
|
export const FormMessage = {
|
|
4
4
|
|
|
5
|
-
required(field, value)
|
|
5
|
+
required(field, value)
|
|
6
|
+
{
|
|
6
7
|
return Locale.trans('Field is required');
|
|
7
8
|
},
|
|
8
9
|
|
|
9
|
-
required_if(field, value, key = '')
|
|
10
|
+
required_if(field, value, key = '')
|
|
11
|
+
{
|
|
10
12
|
|
|
11
13
|
let label = Arr.find(this.elements, (item) => {
|
|
12
14
|
return item.prop === key;
|
|
@@ -17,7 +19,8 @@ export const FormMessage = {
|
|
|
17
19
|
});
|
|
18
20
|
},
|
|
19
21
|
|
|
20
|
-
required_unless(field, value, key = '')
|
|
22
|
+
required_unless(field, value, key = '')
|
|
23
|
+
{
|
|
21
24
|
|
|
22
25
|
let label = Arr.find(this.elements, (item) => {
|
|
23
26
|
return item.prop === key;
|
|
@@ -50,27 +53,33 @@ export const FormMessage = {
|
|
|
50
53
|
});
|
|
51
54
|
},
|
|
52
55
|
|
|
53
|
-
value(field, value, val = 'foobar')
|
|
56
|
+
value(field, value, val = 'foobar')
|
|
57
|
+
{
|
|
54
58
|
return Locale.trans('Must be exact value :val', { val });
|
|
55
59
|
},
|
|
56
60
|
|
|
57
|
-
min(field, value, min = Number.MIN_VALUE)
|
|
61
|
+
min(field, value, min = Number.MIN_VALUE)
|
|
62
|
+
{
|
|
58
63
|
return Locale.trans('Must be greather than :min', { min });
|
|
59
64
|
},
|
|
60
65
|
|
|
61
|
-
max(field, value, max = Number.MAX_VALUE)
|
|
66
|
+
max(field, value, max = Number.MAX_VALUE)
|
|
67
|
+
{
|
|
62
68
|
return Locale.trans('Must be lesser than :max', { max });
|
|
63
69
|
},
|
|
64
70
|
|
|
65
|
-
minlength(field, value, min = Number.MIN_VALUE)
|
|
71
|
+
minlength(field, value, min = Number.MIN_VALUE)
|
|
72
|
+
{
|
|
66
73
|
return Locale.trans('Length must be greater than :min', { min });
|
|
67
74
|
},
|
|
68
75
|
|
|
69
|
-
maxlength(field, value, max = Number.MAX_VALUE)
|
|
76
|
+
maxlength(field, value, max = Number.MAX_VALUE)
|
|
77
|
+
{
|
|
70
78
|
return Locale.trans('Length must be lesser than :max', { max });
|
|
71
79
|
},
|
|
72
80
|
|
|
73
|
-
email(field, value)
|
|
81
|
+
email(field, value)
|
|
82
|
+
{
|
|
74
83
|
return Locale.trans('Must be a valid email');
|
|
75
84
|
}
|
|
76
85
|
|
|
@@ -78,17 +87,17 @@ export const FormMessage = {
|
|
|
78
87
|
|
|
79
88
|
export const FormRules = {
|
|
80
89
|
|
|
81
|
-
required(field, value)
|
|
82
|
-
|
|
90
|
+
required(field, value)
|
|
91
|
+
{
|
|
83
92
|
if ( Any.isBool(value) ) {
|
|
84
93
|
return value === true;
|
|
85
94
|
}
|
|
86
95
|
|
|
87
|
-
return !
|
|
96
|
+
return !Any.isEmpty(value);
|
|
88
97
|
},
|
|
89
98
|
|
|
90
|
-
required_if(field, value, key = '')
|
|
91
|
-
|
|
99
|
+
required_if(field, value, key = '')
|
|
100
|
+
{
|
|
92
101
|
let target = Obj.get(this.form, key);
|
|
93
102
|
|
|
94
103
|
if ( Any.isEmpty(target) ) {
|
|
@@ -99,14 +108,14 @@ export const FormRules = {
|
|
|
99
108
|
return value === true;
|
|
100
109
|
}
|
|
101
110
|
|
|
102
|
-
return !
|
|
111
|
+
return !Any.isEmpty(value);
|
|
103
112
|
},
|
|
104
113
|
|
|
105
|
-
required_unless(field, value, key = '')
|
|
106
|
-
|
|
114
|
+
required_unless(field, value, key = '')
|
|
115
|
+
{
|
|
107
116
|
let target = Obj.get(this.form, key);
|
|
108
117
|
|
|
109
|
-
if ( !
|
|
118
|
+
if ( !Any.isEmpty(target) ) {
|
|
110
119
|
return true;
|
|
111
120
|
}
|
|
112
121
|
|
|
@@ -114,19 +123,21 @@ export const FormRules = {
|
|
|
114
123
|
return value === true;
|
|
115
124
|
}
|
|
116
125
|
|
|
117
|
-
return !
|
|
126
|
+
return !Any.isEmpty(value);
|
|
118
127
|
},
|
|
119
128
|
|
|
120
|
-
same(field, value, key = '')
|
|
129
|
+
same(field, value, key = '')
|
|
130
|
+
{
|
|
121
131
|
return value === Obj.get(this.form, key);
|
|
122
132
|
},
|
|
123
133
|
|
|
124
|
-
diffrent(field, value, key = '')
|
|
134
|
+
diffrent(field, value, key = '')
|
|
135
|
+
{
|
|
125
136
|
return value !== Obj.get(this.form, key);
|
|
126
137
|
},
|
|
127
138
|
|
|
128
|
-
value(field, value, val = 'foobar')
|
|
129
|
-
|
|
139
|
+
value(field, value, val = 'foobar')
|
|
140
|
+
{
|
|
130
141
|
if ( Any.isString(value) ) {
|
|
131
142
|
return value === val;
|
|
132
143
|
}
|
|
@@ -134,7 +145,11 @@ export const FormRules = {
|
|
|
134
145
|
return false;
|
|
135
146
|
},
|
|
136
147
|
|
|
137
|
-
min(field, value, min = Number.MIN_VALUE)
|
|
148
|
+
min(field, value, min = Number.MIN_VALUE)
|
|
149
|
+
{
|
|
150
|
+
if ( Any.isEmpty(value) ) {
|
|
151
|
+
return true;
|
|
152
|
+
}
|
|
138
153
|
|
|
139
154
|
if ( Any.isNumber(value) ) {
|
|
140
155
|
return value >= min;
|
|
@@ -143,7 +158,11 @@ export const FormRules = {
|
|
|
143
158
|
return false;
|
|
144
159
|
},
|
|
145
160
|
|
|
146
|
-
max(field, value, max = Number.MAX_VALUE)
|
|
161
|
+
max(field, value, max = Number.MAX_VALUE)
|
|
162
|
+
{
|
|
163
|
+
if ( Any.isEmpty(value) ) {
|
|
164
|
+
return true;
|
|
165
|
+
}
|
|
147
166
|
|
|
148
167
|
if ( Any.isNumber(value) ) {
|
|
149
168
|
return value <= max;
|
|
@@ -152,7 +171,11 @@ export const FormRules = {
|
|
|
152
171
|
return false;
|
|
153
172
|
},
|
|
154
173
|
|
|
155
|
-
minlength(field, value, min = Number.MIN_VALUE)
|
|
174
|
+
minlength(field, value, min = Number.MIN_VALUE)
|
|
175
|
+
{
|
|
176
|
+
if ( Any.isEmpty(value) ) {
|
|
177
|
+
return true;
|
|
178
|
+
}
|
|
156
179
|
|
|
157
180
|
if ( Any.isString(value) || Any.isArray(value) ) {
|
|
158
181
|
return value.length > min;
|
|
@@ -161,7 +184,11 @@ export const FormRules = {
|
|
|
161
184
|
return false;
|
|
162
185
|
},
|
|
163
186
|
|
|
164
|
-
maxlength(field, value, max = Number.MAX_VALUE)
|
|
187
|
+
maxlength(field, value, max = Number.MAX_VALUE)
|
|
188
|
+
{
|
|
189
|
+
if ( Any.isEmpty(value) ) {
|
|
190
|
+
return true;
|
|
191
|
+
}
|
|
165
192
|
|
|
166
193
|
if ( Any.isString(value) || Any.isArray(value) ) {
|
|
167
194
|
return value.length < max;
|
|
@@ -170,7 +197,11 @@ export const FormRules = {
|
|
|
170
197
|
return false;
|
|
171
198
|
},
|
|
172
199
|
|
|
173
|
-
email(field, value)
|
|
200
|
+
email(field, value)
|
|
201
|
+
{
|
|
202
|
+
if ( Any.isEmpty(value) ) {
|
|
203
|
+
return true;
|
|
204
|
+
}
|
|
174
205
|
|
|
175
206
|
if ( Any.isString(value) ) {
|
|
176
207
|
return value.match(/^.*?@.*?\.[a-z]{2,}$/);
|
|
@@ -218,7 +218,7 @@ export default {
|
|
|
218
218
|
|
|
219
219
|
beforeMount()
|
|
220
220
|
{
|
|
221
|
-
if ( this.lazy
|
|
221
|
+
if ( this.lazy || ! this.$slots.default ) {
|
|
222
222
|
this.generateOptions();
|
|
223
223
|
}
|
|
224
224
|
|
|
@@ -304,8 +304,6 @@ export default {
|
|
|
304
304
|
tempLabel: option.label, tempValue: option.value
|
|
305
305
|
});
|
|
306
306
|
});
|
|
307
|
-
|
|
308
|
-
this.searchOptions();
|
|
309
307
|
},
|
|
310
308
|
|
|
311
309
|
addOption(option)
|
|
@@ -768,7 +766,7 @@ export default {
|
|
|
768
766
|
return emptyHtml;
|
|
769
767
|
}
|
|
770
768
|
|
|
771
|
-
if ( this.lazy ) {
|
|
769
|
+
if ( this.lazy || ! this.$slots.default ) {
|
|
772
770
|
return this.ctor('renderLazyItems')();
|
|
773
771
|
}
|
|
774
772
|
|
|
@@ -19,9 +19,11 @@ export default {
|
|
|
19
19
|
);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
let input = this.input.replace(/<[^>]*>?/gm, '');
|
|
23
|
+
|
|
22
24
|
return (
|
|
23
25
|
<div>
|
|
24
|
-
<span>{ Any.convertString(
|
|
26
|
+
<span>{ Any.convertString(input, this.column.emptyText) }</span>
|
|
25
27
|
</div>
|
|
26
28
|
);
|
|
27
29
|
}
|