sprintify-ui 0.0.186 → 0.0.187
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/sprintify-ui.es.js +8533 -8451
- package/dist/types/src/components/BaseFileUploader.vue.d.ts +3 -3
- package/dist/types/src/composables/breakpoints.d.ts +27 -12
- package/dist/types/src/composables/mediaQuery.d.ts +2 -0
- package/dist/types/src/index.d.ts +12 -8
- package/package.json +2 -2
- package/src/components/BaseDataIterator.vue +32 -14
- package/src/components/BaseFileUploader.vue +9 -5
- package/src/composables/breakpoints.ts +92 -4
- package/src/composables/mediaQuery.ts +42 -0
- package/src/lang/en.json +3 -2
- package/src/lang/fr.json +3 -2
|
@@ -9,7 +9,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
9
9
|
maxSize?: number | undefined;
|
|
10
10
|
accept?: string | undefined;
|
|
11
11
|
acceptedExtensions?: string[] | undefined;
|
|
12
|
-
cropper?: boolean | BaseCropperConfig | null | undefined;
|
|
12
|
+
cropper?: boolean | Record<string, any> | BaseCropperConfig | null | undefined;
|
|
13
13
|
}>, {
|
|
14
14
|
component: string;
|
|
15
15
|
url: undefined;
|
|
@@ -31,7 +31,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
31
31
|
maxSize?: number | undefined;
|
|
32
32
|
accept?: string | undefined;
|
|
33
33
|
acceptedExtensions?: string[] | undefined;
|
|
34
|
-
cropper?: boolean | BaseCropperConfig | null | undefined;
|
|
34
|
+
cropper?: boolean | Record<string, any> | BaseCropperConfig | null | undefined;
|
|
35
35
|
}>, {
|
|
36
36
|
component: string;
|
|
37
37
|
url: undefined;
|
|
@@ -50,7 +50,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
50
50
|
"onUpload:end"?: ((...args: any[]) => any) | undefined;
|
|
51
51
|
}, {
|
|
52
52
|
disabled: boolean;
|
|
53
|
-
cropper: BaseCropperConfig | boolean | null;
|
|
53
|
+
cropper: BaseCropperConfig | Record<string, any> | boolean | null;
|
|
54
54
|
loading: boolean;
|
|
55
55
|
accept: string;
|
|
56
56
|
url: string;
|
|
@@ -1,12 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import type { Ref } from 'vue';
|
|
2
|
+
export * from './breakpoints';
|
|
3
|
+
export type Breakpoints<K extends string = string> = Record<K, number | string>;
|
|
4
|
+
export declare function useBreakpoints<K extends string>(breakpoints?: Breakpoints<K>): {
|
|
5
|
+
greater(k: K): Ref<boolean>;
|
|
6
|
+
greaterOrEqual: (k: K) => Ref<boolean>;
|
|
7
|
+
smaller(k: K): Ref<boolean>;
|
|
8
|
+
smallerOrEqual(k: K): Ref<boolean>;
|
|
9
|
+
between(a: K, b: K): Ref<boolean>;
|
|
10
|
+
isGreater(k: K): boolean;
|
|
11
|
+
isGreaterOrEqual(k: K): boolean;
|
|
12
|
+
isSmaller(k: K): boolean;
|
|
13
|
+
isSmallerOrEqual(k: K): boolean;
|
|
14
|
+
isInBetween(a: K, b: K): boolean;
|
|
15
|
+
} & Record<K, Ref<boolean>>;
|
|
16
|
+
export type UseBreakpointsReturn<K extends string = string> = {
|
|
17
|
+
greater: (k: K) => Ref<boolean>;
|
|
18
|
+
greaterOrEqual: (k: K) => Ref<boolean>;
|
|
19
|
+
smaller(k: K): Ref<boolean>;
|
|
20
|
+
smallerOrEqual: (k: K) => Ref<boolean>;
|
|
21
|
+
between(a: K, b: K): Ref<boolean>;
|
|
22
|
+
isGreater(k: K): boolean;
|
|
23
|
+
isGreaterOrEqual(k: K): boolean;
|
|
24
|
+
isSmaller(k: K): boolean;
|
|
25
|
+
isSmallerOrEqual(k: K): boolean;
|
|
26
|
+
isInBetween(a: K, b: K): boolean;
|
|
27
|
+
} & Record<K, Ref<boolean>>;
|
|
@@ -42,8 +42,8 @@ declare const messages: {
|
|
|
42
42
|
file_must_be_of_type: string;
|
|
43
43
|
filters: string;
|
|
44
44
|
go_to_page: string;
|
|
45
|
-
just_now: string;
|
|
46
45
|
invalid_value: string;
|
|
46
|
+
just_now: string;
|
|
47
47
|
maximum_x_decimal_places: string;
|
|
48
48
|
min_x_characters: string;
|
|
49
49
|
month: string;
|
|
@@ -55,7 +55,8 @@ declare const messages: {
|
|
|
55
55
|
of: string;
|
|
56
56
|
or: string;
|
|
57
57
|
page: string;
|
|
58
|
-
|
|
58
|
+
pagination_detail_1: string;
|
|
59
|
+
pagination_detail_2: string;
|
|
59
60
|
postal_code_zip_code: string;
|
|
60
61
|
previous: string;
|
|
61
62
|
previous_month: string;
|
|
@@ -125,8 +126,8 @@ declare const messages: {
|
|
|
125
126
|
file_must_be_of_type: string;
|
|
126
127
|
filters: string;
|
|
127
128
|
go_to_page: string;
|
|
128
|
-
just_now: string;
|
|
129
129
|
invalid_value: string;
|
|
130
|
+
just_now: string;
|
|
130
131
|
maximum_x_decimal_places: string;
|
|
131
132
|
min_x_characters: string;
|
|
132
133
|
month: string;
|
|
@@ -138,7 +139,8 @@ declare const messages: {
|
|
|
138
139
|
of: string;
|
|
139
140
|
or: string;
|
|
140
141
|
page: string;
|
|
141
|
-
|
|
142
|
+
pagination_detail_1: string;
|
|
143
|
+
pagination_detail_2: string;
|
|
142
144
|
postal_code_zip_code: string;
|
|
143
145
|
previous: string;
|
|
144
146
|
previous_month: string;
|
|
@@ -225,8 +227,8 @@ declare const config: {
|
|
|
225
227
|
file_must_be_of_type: string;
|
|
226
228
|
filters: string;
|
|
227
229
|
go_to_page: string;
|
|
228
|
-
just_now: string;
|
|
229
230
|
invalid_value: string;
|
|
231
|
+
just_now: string;
|
|
230
232
|
maximum_x_decimal_places: string;
|
|
231
233
|
min_x_characters: string;
|
|
232
234
|
month: string;
|
|
@@ -238,7 +240,8 @@ declare const config: {
|
|
|
238
240
|
of: string;
|
|
239
241
|
or: string;
|
|
240
242
|
page: string;
|
|
241
|
-
|
|
243
|
+
pagination_detail_1: string;
|
|
244
|
+
pagination_detail_2: string;
|
|
242
245
|
postal_code_zip_code: string;
|
|
243
246
|
previous: string;
|
|
244
247
|
previous_month: string;
|
|
@@ -308,8 +311,8 @@ declare const config: {
|
|
|
308
311
|
file_must_be_of_type: string;
|
|
309
312
|
filters: string;
|
|
310
313
|
go_to_page: string;
|
|
311
|
-
just_now: string;
|
|
312
314
|
invalid_value: string;
|
|
315
|
+
just_now: string;
|
|
313
316
|
maximum_x_decimal_places: string;
|
|
314
317
|
min_x_characters: string;
|
|
315
318
|
month: string;
|
|
@@ -321,7 +324,8 @@ declare const config: {
|
|
|
321
324
|
of: string;
|
|
322
325
|
or: string;
|
|
323
326
|
page: string;
|
|
324
|
-
|
|
327
|
+
pagination_detail_1: string;
|
|
328
|
+
pagination_detail_2: string;
|
|
325
329
|
postal_code_zip_code: string;
|
|
326
330
|
previous: string;
|
|
327
331
|
previous_month: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sprintify-ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.187",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "rimraf dist && vue-tsc && vite build",
|
|
6
6
|
"build-fast": "rimraf dist && vite build",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"@vitejs/plugin-vue": "^4.0.0",
|
|
65
65
|
"@vue/eslint-config-typescript": "^11.0.2",
|
|
66
66
|
"@vueup/vue-quill": "^1.1.0",
|
|
67
|
-
"@vueuse/core": "^9.
|
|
67
|
+
"@vueuse/core": "^9.13.0",
|
|
68
68
|
"autoprefixer": "^10.4.13",
|
|
69
69
|
"axios": "^0.26.1",
|
|
70
70
|
"babel-loader": "^8.3.0",
|
|
@@ -101,20 +101,15 @@
|
|
|
101
101
|
<div v-if="paginationMetadata" class="mt-4">
|
|
102
102
|
<p
|
|
103
103
|
class="text-center text-sm text-slate-500 sm:text-right [&>b]:font-medium [&>b]:text-slate-600"
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
),
|
|
114
|
-
total: paginationMetadata.total,
|
|
115
|
-
})
|
|
116
|
-
"
|
|
117
|
-
></p>
|
|
104
|
+
>
|
|
105
|
+
{{ $t('sui.pagination_detail_1') }}
|
|
106
|
+
|
|
107
|
+
<b>{{ paginationStart }}</b> - <b>{{ paginationEnd }}</b>
|
|
108
|
+
|
|
109
|
+
{{ $t('sui.pagination_detail_2') }}
|
|
110
|
+
|
|
111
|
+
<b>{{ paginationMetadata.total }}</b>
|
|
112
|
+
</p>
|
|
118
113
|
</div>
|
|
119
114
|
|
|
120
115
|
<div v-if="paginationMetadata" class="mt-4">
|
|
@@ -673,6 +668,29 @@ function updateSearchInput() {
|
|
|
673
668
|
searchQuery.value = searchKeywords.value;
|
|
674
669
|
}
|
|
675
670
|
|
|
671
|
+
const paginationStart = computed(() => {
|
|
672
|
+
if (paginationMetadata.value == null) {
|
|
673
|
+
return '';
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
return (
|
|
677
|
+
paginationMetadata.value.per_page *
|
|
678
|
+
(paginationMetadata.value.current_page - 1) +
|
|
679
|
+
1
|
|
680
|
+
);
|
|
681
|
+
});
|
|
682
|
+
|
|
683
|
+
const paginationEnd = computed(() => {
|
|
684
|
+
if (paginationMetadata.value == null) {
|
|
685
|
+
return '';
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
return Math.min(
|
|
689
|
+
paginationMetadata.value.current_page * paginationMetadata.value.per_page,
|
|
690
|
+
paginationMetadata.value.total
|
|
691
|
+
);
|
|
692
|
+
});
|
|
693
|
+
|
|
676
694
|
/*
|
|
677
695
|
|--------------------------------------------------------------------------
|
|
678
696
|
| Created
|
|
@@ -53,7 +53,7 @@ const props = withDefaults(
|
|
|
53
53
|
maxSize?: number;
|
|
54
54
|
accept?: string;
|
|
55
55
|
acceptedExtensions?: string[];
|
|
56
|
-
cropper?: BaseCropperConfig | boolean | null;
|
|
56
|
+
cropper?: BaseCropperConfig | Record<string, any> | boolean | null;
|
|
57
57
|
}>(),
|
|
58
58
|
{
|
|
59
59
|
component: 'BaseFilePicker',
|
|
@@ -86,15 +86,19 @@ const componentInternal = computed(() => {
|
|
|
86
86
|
});
|
|
87
87
|
|
|
88
88
|
const pickerProps = computed(() => {
|
|
89
|
-
|
|
89
|
+
const pickerProps = {
|
|
90
90
|
disabled: props.disabled || props.loading || uploading.value,
|
|
91
91
|
buttonClass: props.buttonClass,
|
|
92
92
|
maxSize: props.maxSize,
|
|
93
93
|
accept: props.component == 'BaseFilePickerCrop' ? undefined : props.accept,
|
|
94
94
|
acceptedExtensions: props.acceptedExtensions,
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
} as Record<string, any>;
|
|
96
|
+
|
|
97
|
+
if (props.component == 'BaseFilePickerCrop') {
|
|
98
|
+
pickerProps.cropper = props.cropper;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return pickerProps;
|
|
98
102
|
});
|
|
99
103
|
|
|
100
104
|
const uploading = ref(false);
|
|
@@ -1,6 +1,94 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import type { Ref } from 'vue';
|
|
2
|
+
import { increaseWithUnit } from '@vueuse/shared';
|
|
3
|
+
import { useMediaQuery } from './mediaQuery';
|
|
4
|
+
import defaultBreakpoints from '../../config/breakpoints.json';
|
|
5
|
+
export * from './breakpoints';
|
|
3
6
|
|
|
4
|
-
export
|
|
5
|
-
|
|
7
|
+
export type Breakpoints<K extends string = string> = Record<K, number | string>;
|
|
8
|
+
|
|
9
|
+
export function useBreakpoints<K extends string>(breakpoints?: Breakpoints<K>) {
|
|
10
|
+
const breakpointsInternal = computed(() => {
|
|
11
|
+
if (breakpoints) return breakpoints;
|
|
12
|
+
return defaultBreakpoints as Breakpoints<K>;
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
function getValue(k: K, delta?: number) {
|
|
16
|
+
let v = breakpointsInternal.value[k];
|
|
17
|
+
|
|
18
|
+
if (delta != null) v = increaseWithUnit(v, delta);
|
|
19
|
+
|
|
20
|
+
if (typeof v === 'number') v = `${v}px`;
|
|
21
|
+
|
|
22
|
+
return v;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function match(query: string): boolean {
|
|
26
|
+
if (!window) return false;
|
|
27
|
+
return window.matchMedia(query).matches;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const greaterOrEqual = (k: K) => {
|
|
31
|
+
return useMediaQuery(`(min-width: ${getValue(k)})`);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const shortcutMethods = Object.keys(breakpointsInternal.value).reduce(
|
|
35
|
+
(shortcuts, k) => {
|
|
36
|
+
Object.defineProperty(shortcuts, k, {
|
|
37
|
+
get: () => greaterOrEqual(k as K),
|
|
38
|
+
enumerable: true,
|
|
39
|
+
configurable: true,
|
|
40
|
+
});
|
|
41
|
+
return shortcuts;
|
|
42
|
+
},
|
|
43
|
+
{} as Record<K, Ref<boolean>>
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
greater(k: K) {
|
|
48
|
+
return useMediaQuery(`(min-width: ${getValue(k, 0.1)})`);
|
|
49
|
+
},
|
|
50
|
+
greaterOrEqual,
|
|
51
|
+
smaller(k: K) {
|
|
52
|
+
return useMediaQuery(`(max-width: ${getValue(k, -0.1)})`);
|
|
53
|
+
},
|
|
54
|
+
smallerOrEqual(k: K) {
|
|
55
|
+
return useMediaQuery(`(max-width: ${getValue(k)})`);
|
|
56
|
+
},
|
|
57
|
+
between(a: K, b: K) {
|
|
58
|
+
return useMediaQuery(
|
|
59
|
+
`(min-width: ${getValue(a)}) and (max-width: ${getValue(b, -0.1)})`
|
|
60
|
+
);
|
|
61
|
+
},
|
|
62
|
+
isGreater(k: K) {
|
|
63
|
+
return match(`(min-width: ${getValue(k, 0.1)})`);
|
|
64
|
+
},
|
|
65
|
+
isGreaterOrEqual(k: K) {
|
|
66
|
+
return match(`(min-width: ${getValue(k)})`);
|
|
67
|
+
},
|
|
68
|
+
isSmaller(k: K) {
|
|
69
|
+
return match(`(max-width: ${getValue(k, -0.1)})`);
|
|
70
|
+
},
|
|
71
|
+
isSmallerOrEqual(k: K) {
|
|
72
|
+
return match(`(max-width: ${getValue(k)})`);
|
|
73
|
+
},
|
|
74
|
+
isInBetween(a: K, b: K) {
|
|
75
|
+
return match(
|
|
76
|
+
`(min-width: ${getValue(a)}) and (max-width: ${getValue(b, -0.1)})`
|
|
77
|
+
);
|
|
78
|
+
},
|
|
79
|
+
...shortcutMethods,
|
|
80
|
+
};
|
|
6
81
|
}
|
|
82
|
+
|
|
83
|
+
export type UseBreakpointsReturn<K extends string = string> = {
|
|
84
|
+
greater: (k: K) => Ref<boolean>;
|
|
85
|
+
greaterOrEqual: (k: K) => Ref<boolean>;
|
|
86
|
+
smaller(k: K): Ref<boolean>;
|
|
87
|
+
smallerOrEqual: (k: K) => Ref<boolean>;
|
|
88
|
+
between(a: K, b: K): Ref<boolean>;
|
|
89
|
+
isGreater(k: K): boolean;
|
|
90
|
+
isGreaterOrEqual(k: K): boolean;
|
|
91
|
+
isSmaller(k: K): boolean;
|
|
92
|
+
isSmallerOrEqual(k: K): boolean;
|
|
93
|
+
isInBetween(a: K, b: K): boolean;
|
|
94
|
+
} & Record<K, Ref<boolean>>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ref, watchEffect } from 'vue';
|
|
2
|
+
import type { MaybeComputedRef } from '@vueuse/shared';
|
|
3
|
+
import { resolveRef, tryOnScopeDispose } from '@vueuse/shared';
|
|
4
|
+
|
|
5
|
+
export function useMediaQuery(query: MaybeComputedRef<string>) {
|
|
6
|
+
const isSupported = () =>
|
|
7
|
+
window && 'matchMedia' in window && typeof window.matchMedia === 'function';
|
|
8
|
+
|
|
9
|
+
let mediaQuery: MediaQueryList | undefined;
|
|
10
|
+
const matches = ref(false);
|
|
11
|
+
|
|
12
|
+
const cleanup = () => {
|
|
13
|
+
if (!mediaQuery) return;
|
|
14
|
+
if ('removeEventListener' in mediaQuery)
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
16
|
+
mediaQuery.removeEventListener('change', update);
|
|
17
|
+
// @ts-expect-error deprecated API
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
19
|
+
else mediaQuery.removeListener(update);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const update = () => {
|
|
23
|
+
if (!isSupported()) return;
|
|
24
|
+
|
|
25
|
+
cleanup();
|
|
26
|
+
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
28
|
+
mediaQuery = window.matchMedia(resolveRef(query).value) as MediaQueryList;
|
|
29
|
+
matches.value = mediaQuery.matches;
|
|
30
|
+
|
|
31
|
+
if ('addEventListener' in mediaQuery)
|
|
32
|
+
mediaQuery.addEventListener('change', update);
|
|
33
|
+
// @ts-expect-error deprecated API
|
|
34
|
+
else mediaQuery.addListener(update);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
watchEffect(update);
|
|
38
|
+
|
|
39
|
+
tryOnScopeDispose(() => cleanup());
|
|
40
|
+
|
|
41
|
+
return matches;
|
|
42
|
+
}
|
package/src/lang/en.json
CHANGED
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"file_must_be_of_type": "The file must be of type",
|
|
34
34
|
"filters": "Filters",
|
|
35
35
|
"go_to_page": "Go to ",
|
|
36
|
-
"just_now": "Just now",
|
|
37
36
|
"invalid_value": "Invalid value",
|
|
37
|
+
"just_now": "Just now",
|
|
38
38
|
"maximum_x_decimal_places": "Maximum 1 decimal place|Maximum {count} decimal places",
|
|
39
39
|
"min_x_characters": "{x} characters minimum",
|
|
40
40
|
"month": "Month",
|
|
@@ -46,7 +46,8 @@
|
|
|
46
46
|
"of": "of",
|
|
47
47
|
"or": "or",
|
|
48
48
|
"page": "Page",
|
|
49
|
-
"
|
|
49
|
+
"pagination_detail_1": "Viewing",
|
|
50
|
+
"pagination_detail_2": "of",
|
|
50
51
|
"postal_code_zip_code": "Postal Code / Zip Code",
|
|
51
52
|
"previous": "Previous",
|
|
52
53
|
"previous_month": "Previous month",
|
package/src/lang/fr.json
CHANGED
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"file_must_be_of_type": "Le fichier doit être de type",
|
|
34
34
|
"filters": "Filtres",
|
|
35
35
|
"go_to_page": "Page",
|
|
36
|
-
"just_now": "à l’instant",
|
|
37
36
|
"invalid_value": "Valeur invalide",
|
|
37
|
+
"just_now": "à l’instant",
|
|
38
38
|
"maximum_x_decimal_places": "Maximum 1 décimale|Maximum {count} décimales",
|
|
39
39
|
"min_x_characters": "{x} caractères minimum",
|
|
40
40
|
"month": "Mois",
|
|
@@ -46,7 +46,8 @@
|
|
|
46
46
|
"of": "de",
|
|
47
47
|
"or": "ou",
|
|
48
48
|
"page": "Page",
|
|
49
|
-
"
|
|
49
|
+
"pagination_detail_1": "Affichage de",
|
|
50
|
+
"pagination_detail_2": "de",
|
|
50
51
|
"postal_code_zip_code": "Code postal",
|
|
51
52
|
"previous": "Précédent",
|
|
52
53
|
"previous_month": "Mois précédent",
|