@itfin/components 2.0.21 → 2.0.23
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/package.json
CHANGED
|
@@ -36,6 +36,16 @@
|
|
|
36
36
|
@input="onFilterChange({ value: $event })"
|
|
37
37
|
/>
|
|
38
38
|
</template>
|
|
39
|
+
<template v-else-if="type === 'month'">
|
|
40
|
+
<itf-date-picker-inline
|
|
41
|
+
style="margin: -.5rem"
|
|
42
|
+
start-view="months"
|
|
43
|
+
min-view="months"
|
|
44
|
+
:value="value.value"
|
|
45
|
+
only-calendar
|
|
46
|
+
@input="onFilterChange({ value: $event })"
|
|
47
|
+
/>
|
|
48
|
+
</template>
|
|
39
49
|
<template v-else-if="type === 'date'">
|
|
40
50
|
<itf-date-picker-inline
|
|
41
51
|
style="margin: -.5rem"
|
|
@@ -365,7 +365,11 @@ class FilterPanel extends Vue {
|
|
|
365
365
|
}
|
|
366
366
|
} else if (facet.type === 'date') {
|
|
367
367
|
const date = DateTime.fromISO(value.value);
|
|
368
|
-
value.label = (date.isValid ?
|
|
368
|
+
value.label = (date.isValid ? date : DateTime.fromISO(facet.options.defaultValue.value)).toFormat('dd MMM yyyy');
|
|
369
|
+
value.isDefault = facet.options.defaultValue ? value.value === facet.options.defaultValue.value : false;
|
|
370
|
+
} else if (facet.type === 'month') {
|
|
371
|
+
const date = DateTime.fromISO(value.value);
|
|
372
|
+
value.label = capitalizeFirstLetter((date.isValid ? date : DateTime.fromISO(facet.options.defaultValue.value)).toFormat('LLLL yyyy'));
|
|
369
373
|
value.isDefault = facet.options.defaultValue ? value.value === facet.options.defaultValue.value : false;
|
|
370
374
|
} else if (facet.type === 'facets-list') {
|
|
371
375
|
const firstItem = facet.options.items.find(item => item.value === (Array.isArray(value.value) ? value.value[0] : value.value));
|
|
@@ -404,6 +408,10 @@ class FilterPanel extends Vue {
|
|
|
404
408
|
}
|
|
405
409
|
value.hidden = facet.options?.hidden ?? false;
|
|
406
410
|
return value;
|
|
411
|
+
|
|
412
|
+
function capitalizeFirstLetter(string) {
|
|
413
|
+
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
414
|
+
}
|
|
407
415
|
}
|
|
408
416
|
}
|
|
409
417
|
</script>
|
|
@@ -183,7 +183,7 @@ export function dateSameOrBeforeValidation (dateCompare, message) {
|
|
|
183
183
|
};
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
-
export function
|
|
186
|
+
export function passwordValidation(message) {
|
|
187
187
|
return (v, $t) => {
|
|
188
188
|
return !isEmpty(v) && PASSWORD_REGEX.test(v.trim() + '') || (message || $t('components.passwordValidation'));
|
|
189
189
|
};
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
dateAfterValidation,
|
|
8
8
|
dateSameOrAfterValidation,
|
|
9
9
|
dateSameOrBeforeValidation,
|
|
10
|
-
|
|
10
|
+
passwordValidation,
|
|
11
11
|
} from './validators';
|
|
12
12
|
|
|
13
13
|
describe('Validators', () => {
|
|
@@ -84,15 +84,15 @@ describe('Validators', () => {
|
|
|
84
84
|
});
|
|
85
85
|
|
|
86
86
|
|
|
87
|
-
test('
|
|
88
|
-
expect(
|
|
89
|
-
expect(
|
|
90
|
-
expect(
|
|
91
|
-
expect(
|
|
92
|
-
expect(
|
|
93
|
-
expect(
|
|
94
|
-
expect(
|
|
95
|
-
expect(
|
|
96
|
-
expect(
|
|
87
|
+
test('passwordValidation', () => {
|
|
88
|
+
expect(passwordValidation()('', $t)).toEqual('components.passwordValidation');
|
|
89
|
+
expect(passwordValidation()(' ', $t)).toEqual('components.passwordValidation');
|
|
90
|
+
expect(passwordValidation()(null, $t)).toEqual('components.passwordValidation');
|
|
91
|
+
expect(passwordValidation()(undefined, $t)).toEqual('components.passwordValidation');
|
|
92
|
+
expect(passwordValidation()(' тесттест ', $t)).toEqual('components.passwordValidation');
|
|
93
|
+
expect(passwordValidation()(' ТЕСТТЕСТ ', $t)).toEqual('components.passwordValidation');
|
|
94
|
+
expect(passwordValidation()(' ТестТест ', $t)).toEqual('components.passwordValidation');
|
|
95
|
+
expect(passwordValidation()(' ТестТест1 ', $t)).toEqual('components.passwordValidation');
|
|
96
|
+
expect(passwordValidation()(' ТестТест1@ ', $t)).toEqual(true);
|
|
97
97
|
});
|
|
98
98
|
});
|