sprintify-ui 0.2.23 → 0.2.24
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 +2023 -1901
- package/dist/style.css +1 -1
- package/dist/types/src/components/BaseBadge.vue.d.ts +6 -0
- package/dist/types/src/components/BaseDataIterator.vue.d.ts +15 -0
- package/dist/types/src/components/BaseDataIteratorSectionButton.vue.d.ts +8 -0
- package/dist/types/src/components/BaseDataIteratorSectionColumns.vue.d.ts +20 -0
- package/dist/types/src/components/BaseDataTable.vue.d.ts +21 -0
- package/dist/types/src/components/BaseDataTableRowAction.vue.d.ts +11 -1
- package/dist/types/src/components/BaseTable.vue.d.ts +9 -0
- package/dist/types/src/components/BaseTableColumn.vue.d.ts +1 -1
- package/dist/types/src/index.d.ts +2 -0
- package/package.json +1 -1
- package/src/components/BaseBadge.vue +10 -1
- package/src/components/BaseDataIterator.vue +49 -12
- package/src/components/BaseDataIteratorSectionButton.vue +16 -5
- package/src/components/BaseDataTable.stories.js +65 -35
- package/src/components/BaseDataTable.vue +38 -6
- package/src/components/BaseDataTableRowAction.vue +23 -4
- package/src/components/BaseMenu.stories.js +4 -0
- package/src/components/BaseMenuItem.vue +44 -17
- package/src/components/BaseTable.vue +34 -16
- package/src/components/BaseTableColumn.vue +1 -1
- package/src/index.ts +4 -1
- package/src/lang/en.json +2 -1
- package/src/lang/fr.json +2 -1
- package/src/utils/colors.ts +1 -1
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
2
|
+
<div
|
|
3
|
+
:style="buttonStyles"
|
|
4
|
+
class="rounded leading-tight"
|
|
5
|
+
:class="[active ? 'bg-slate-100' : 'bg-white']"
|
|
6
|
+
>
|
|
3
7
|
<div class="flex items-center">
|
|
4
8
|
<BaseIcon
|
|
5
9
|
v-if="icon"
|
|
6
10
|
:icon="icon"
|
|
7
|
-
:class="iconClasses"
|
|
11
|
+
:class="[iconClasses]"
|
|
8
12
|
/>
|
|
9
|
-
<span :class="
|
|
13
|
+
<span :class="[textClasses, textColor]">{{ label }}</span>
|
|
10
14
|
</div>
|
|
11
15
|
<div
|
|
12
16
|
v-if="count"
|
|
@@ -16,13 +20,14 @@
|
|
|
16
20
|
:count="count"
|
|
17
21
|
:max-digit="2"
|
|
18
22
|
:color="color"
|
|
23
|
+
:size="size"
|
|
19
24
|
/>
|
|
20
25
|
</div>
|
|
21
26
|
</div>
|
|
22
27
|
</template>
|
|
23
28
|
|
|
24
29
|
<script lang="ts" setup>
|
|
25
|
-
import { PropType } from 'vue';
|
|
30
|
+
import { PropType, StyleValue } from 'vue';
|
|
26
31
|
import BaseCounter from './BaseCounter.vue';
|
|
27
32
|
import { ActionColors } from '@/types';
|
|
28
33
|
|
|
@@ -73,7 +78,7 @@ const textColor = computed((): string => {
|
|
|
73
78
|
return '';
|
|
74
79
|
});
|
|
75
80
|
|
|
76
|
-
const
|
|
81
|
+
const textClasses = computed((): string => {
|
|
77
82
|
if (props.size == 'xs') {
|
|
78
83
|
return 'text-xs';
|
|
79
84
|
} else if (props.size == 'sm') {
|
|
@@ -85,25 +90,47 @@ const textSize = computed((): string => {
|
|
|
85
90
|
return '';
|
|
86
91
|
});
|
|
87
92
|
|
|
88
|
-
const
|
|
89
|
-
let baseClasses =
|
|
90
|
-
'flex items-center justify-between w-full leading-tight py-2 text-sm text-left rounded';
|
|
93
|
+
const buttonStyles = computed((): StyleValue => {
|
|
91
94
|
|
|
92
|
-
|
|
95
|
+
let paddingY = 0.5;
|
|
96
|
+
let paddingLeft = 1;
|
|
97
|
+
let paddingRight = 1;
|
|
93
98
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
99
|
+
const baseStyles = {
|
|
100
|
+
display: 'flex',
|
|
101
|
+
alignItems: 'center',
|
|
102
|
+
justifyContent: 'space-between',
|
|
103
|
+
width: '100%',
|
|
104
|
+
lineHeight: '1.25rem',
|
|
105
|
+
text: 'left',
|
|
106
|
+
paddingTop: '',
|
|
107
|
+
paddingBottom: '',
|
|
108
|
+
paddingLeft: '',
|
|
109
|
+
paddingRight: '',
|
|
98
110
|
}
|
|
99
111
|
|
|
100
112
|
if (props.icon) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
baseClasses += ' px-4';
|
|
113
|
+
paddingLeft = 0.5;
|
|
114
|
+
paddingRight = 1;
|
|
104
115
|
}
|
|
105
116
|
|
|
106
|
-
|
|
117
|
+
if (props.size == 'xs') {
|
|
118
|
+
paddingY = 0.3;
|
|
119
|
+
if (props.icon) {
|
|
120
|
+
paddingRight = 0.75;
|
|
121
|
+
}
|
|
122
|
+
} else if (props.size == 'sm') {
|
|
123
|
+
paddingY = 0.5;
|
|
124
|
+
} else if (props.size == 'md') {
|
|
125
|
+
paddingY = 0.5;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
baseStyles.paddingLeft = paddingLeft + 'rem';
|
|
129
|
+
baseStyles.paddingRight = paddingRight + 'rem';
|
|
130
|
+
baseStyles.paddingTop = paddingY + 'rem';
|
|
131
|
+
baseStyles.paddingBottom = paddingY + 'rem';
|
|
132
|
+
|
|
133
|
+
return baseStyles;
|
|
107
134
|
});
|
|
108
135
|
|
|
109
136
|
const iconClasses = computed((): string => {
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
column.style,
|
|
56
56
|
index == 0 ? firstColStyles(true) : {},
|
|
57
57
|
]"
|
|
58
|
-
class="th group
|
|
58
|
+
class="th group text-left px-3 py-2"
|
|
59
59
|
:class="{
|
|
60
60
|
'cursor-pointer': column.sortable,
|
|
61
61
|
}"
|
|
@@ -69,7 +69,13 @@
|
|
|
69
69
|
column.sortable && currentSortColumn === column,
|
|
70
70
|
}"
|
|
71
71
|
>
|
|
72
|
-
<span
|
|
72
|
+
<span
|
|
73
|
+
class="whitespace-nowrap text-slate-600"
|
|
74
|
+
:class="{
|
|
75
|
+
'text-[12px]': size == 'sm',
|
|
76
|
+
'text-xs': size == 'md',
|
|
77
|
+
}"
|
|
78
|
+
>
|
|
73
79
|
{{ column.label }}
|
|
74
80
|
</span>
|
|
75
81
|
<div
|
|
@@ -90,14 +96,14 @@
|
|
|
90
96
|
:opacity="!isAsc ? '0.5' : '1'"
|
|
91
97
|
fill="currentColor"
|
|
92
98
|
d="M8.71 12.29L11.3 9.7a.996.996 0 0 1 1.41 0l2.59 2.59c.63.63.18 1.71-.71 1.71H9.41c-.89 0-1.33-1.08-.7-1.71z"
|
|
93
|
-
|
|
99
|
+
></path>
|
|
94
100
|
</g>
|
|
95
101
|
<g transform="translate(0 3)">
|
|
96
102
|
<path
|
|
97
103
|
:opacity="isAsc ? '0.5' : '1'"
|
|
98
104
|
fill="currentColor"
|
|
99
105
|
d="m8.71 11.71l2.59 2.59c.39.39 1.02.39 1.41 0l2.59-2.59c.63-.63.18-1.71-.71-1.71H9.41c-.89 0-1.33 1.08-.7 1.71z"
|
|
100
|
-
|
|
106
|
+
></path>
|
|
101
107
|
</g>
|
|
102
108
|
</svg>
|
|
103
109
|
</div>
|
|
@@ -151,8 +157,8 @@
|
|
|
151
157
|
<td
|
|
152
158
|
v-if="checkable && checkboxPosition === 'left'"
|
|
153
159
|
class="group z-[1] cursor-pointer bg-white pl-3"
|
|
154
|
-
:style="checkStyles(false)"
|
|
155
160
|
:class="borderBottomClasses(index, row)"
|
|
161
|
+
:style="checkStyles(false)"
|
|
156
162
|
@click="checkRow(row, index, $event as MouseEvent)"
|
|
157
163
|
>
|
|
158
164
|
<div class="flex items-center">
|
|
@@ -174,26 +180,34 @@
|
|
|
174
180
|
scoped
|
|
175
181
|
name="default"
|
|
176
182
|
tag="td"
|
|
177
|
-
class="bg-white
|
|
178
|
-
:style="[
|
|
179
|
-
column.style,
|
|
180
|
-
colindex === 0 ? firstColStyles(false) : {},
|
|
181
|
-
]"
|
|
183
|
+
class="bg-white text-sm"
|
|
182
184
|
:class="[
|
|
183
185
|
borderBottomClasses(index, row),
|
|
184
186
|
column.clickable ? 'cursor-pointer' : '',
|
|
187
|
+
{
|
|
188
|
+
'py-0.5 px-3': size == 'sm',
|
|
189
|
+
'py-2 px-3': size == 'md',
|
|
190
|
+
}
|
|
191
|
+
]"
|
|
192
|
+
:style="[
|
|
193
|
+
column.style,
|
|
194
|
+
colindex === 0 ? firstColStyles(false) : {}
|
|
185
195
|
]"
|
|
186
196
|
:data-label="column.label"
|
|
187
197
|
:props="{ row, column, index, colindex, toggleDetails }"
|
|
188
|
-
@click="
|
|
189
|
-
onColumnClick(row, column, index, colindex, $event)
|
|
190
|
-
"
|
|
198
|
+
@click="onColumnClick(row, column, index, colindex, $event)"
|
|
191
199
|
/>
|
|
192
200
|
|
|
193
201
|
<td
|
|
194
202
|
v-if="checkable && checkboxPosition === 'right'"
|
|
195
|
-
class="group cursor-pointer
|
|
196
|
-
:class="
|
|
203
|
+
class="group cursor-pointer"
|
|
204
|
+
:class="[
|
|
205
|
+
borderBottomClasses(index, row),
|
|
206
|
+
{
|
|
207
|
+
'px-3 py-1': size == 'sm',
|
|
208
|
+
'p-3': size == 'md',
|
|
209
|
+
}
|
|
210
|
+
]"
|
|
197
211
|
align="right"
|
|
198
212
|
@click="checkRow(row, index, $event as MouseEvent)"
|
|
199
213
|
>
|
|
@@ -214,7 +228,6 @@
|
|
|
214
228
|
>
|
|
215
229
|
<td
|
|
216
230
|
:colspan="columnCount"
|
|
217
|
-
class="td"
|
|
218
231
|
:class="borderBottomDetailClasses(index)"
|
|
219
232
|
>
|
|
220
233
|
<slot
|
|
@@ -361,6 +374,10 @@ const props = defineProps({
|
|
|
361
374
|
default: undefined,
|
|
362
375
|
type: Number,
|
|
363
376
|
},
|
|
377
|
+
size: {
|
|
378
|
+
type: String as PropType<'sm' | 'md'>,
|
|
379
|
+
default: 'md',
|
|
380
|
+
},
|
|
364
381
|
});
|
|
365
382
|
|
|
366
383
|
const emit = defineEmits([
|
|
@@ -375,6 +392,7 @@ const emit = defineEmits([
|
|
|
375
392
|
]);
|
|
376
393
|
|
|
377
394
|
const visibleDetailRows = ref<Row[]>([]);
|
|
395
|
+
// eslint-disable-next-line vue/no-setup-props-destructure
|
|
378
396
|
const newCheckedRows = ref<Row[]>([...props.checkedRows]);
|
|
379
397
|
const lastCheckedRowIndex = ref<number | null>(null);
|
|
380
398
|
const currentSortColumn = ref<BaseTableColumn | null>(null);
|
package/src/index.ts
CHANGED
|
@@ -19,11 +19,12 @@ import { Region } from './types/Region';
|
|
|
19
19
|
import { useI18nStore } from './stores/i18n';
|
|
20
20
|
|
|
21
21
|
export interface Options {
|
|
22
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
23
22
|
http?: AxiosInstance;
|
|
24
23
|
upload_url?: string;
|
|
25
24
|
locales?: Locales;
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
26
26
|
formatQueryString?: (params: Record<string, any>) => string;
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
27
28
|
parseQueryString?: (params: string) => Record<string, any>;
|
|
28
29
|
countries?: Country[];
|
|
29
30
|
regions?: Region[];
|
|
@@ -36,12 +37,14 @@ const config = {
|
|
|
36
37
|
fr: 'Français',
|
|
37
38
|
} as Locales,
|
|
38
39
|
upload_url: '/api/upload',
|
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
39
41
|
formatQueryString(params: Record<string, any>) {
|
|
40
42
|
return QueryString.stringify(params, {
|
|
41
43
|
arrayFormat: 'comma',
|
|
42
44
|
encode: import.meta.env.PROD ? true : false,
|
|
43
45
|
});
|
|
44
46
|
},
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
45
48
|
parseQueryString(params: string): Record<string, any> {
|
|
46
49
|
return QueryString.parse(params);
|
|
47
50
|
},
|
package/src/lang/en.json
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"apply_filters": "Apply filters",
|
|
13
13
|
"authentication_code": "Authentication code",
|
|
14
14
|
"autocomplete_placeholder": "Type to start your search",
|
|
15
|
+
"bulk_actions": "Bulk actions",
|
|
15
16
|
"cancel": "Cancel",
|
|
16
17
|
"city": "City",
|
|
17
18
|
"clear": "Clear",
|
|
@@ -85,4 +86,4 @@
|
|
|
85
86
|
"you_can_upload_up_to_n_files": "You can upload one file at most|You can upload up to {count} files",
|
|
86
87
|
"you_cannot_select_more_than_x_items": "You can't select more than one item|You can't select more than {count} items"
|
|
87
88
|
}
|
|
88
|
-
}
|
|
89
|
+
}
|
package/src/lang/fr.json
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"apply_filters": "Appliquer les filtres",
|
|
13
13
|
"authentication_code": "Code d'authentification",
|
|
14
14
|
"autocomplete_placeholder": "Taper pour lancer votre recherche",
|
|
15
|
+
"bulk_actions": "Actions en lot",
|
|
15
16
|
"cancel": "Annuler",
|
|
16
17
|
"city": "Ville",
|
|
17
18
|
"clear": "Effacer",
|
|
@@ -85,4 +86,4 @@
|
|
|
85
86
|
"you_can_upload_up_to_n_files": "Vous pouvez télécharger un fichier au maximum|Vous pouvez télécharger jusqu'à {count} fichiers",
|
|
86
87
|
"you_cannot_select_more_than_x_items": "Vous ne pouvez pas sélectionner plus de un élément|Vous ne pouvez pas sélectionner plus de {count} éléments"
|
|
87
88
|
}
|
|
88
|
-
}
|
|
89
|
+
}
|
package/src/utils/colors.ts
CHANGED