sprintify-ui 0.0.191 → 0.0.193
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 +4807 -4796
- package/dist/style.css +1 -1
- package/dist/tailwindcss/index.js +35 -35
- package/dist/types/src/components/BaseDataIterator.vue.d.ts +2 -1
- package/dist/types/src/components/BaseDataTable.vue.d.ts +2 -1
- package/dist/types/src/components/BaseMenu.vue.d.ts +9 -0
- package/package.json +1 -1
- package/src/assets/main.css +11 -5
- package/src/components/BaseDataIterator.vue +2 -0
- package/src/components/BaseDataTable.stories.js +10 -2
- package/src/components/BaseDataTable.vue +25 -12
- package/src/components/BaseMenu.vue +6 -2
package/src/assets/main.css
CHANGED
|
@@ -11,19 +11,25 @@
|
|
|
11
11
|
justify-content: center;
|
|
12
12
|
margin: 0 -0.5rem;
|
|
13
13
|
|
|
14
|
-
&
|
|
14
|
+
& > *:not(:first-child) .btn,
|
|
15
|
+
& > .btn:not(:first-child) {
|
|
16
|
+
margin-left: -1px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
& > *:first-child:not(:last-child) .btn,
|
|
20
|
+
& > .btn:first-child:not(:last-child) {
|
|
15
21
|
border-bottom-right-radius: 0;
|
|
16
22
|
border-top-right-radius: 0;
|
|
17
23
|
}
|
|
18
24
|
|
|
19
|
-
&
|
|
25
|
+
& > *:last-child:not(:first-child) .btn,
|
|
26
|
+
& > .btn:last-child:not(:first-child) {
|
|
20
27
|
border-bottom-left-radius: 0;
|
|
21
28
|
border-top-left-radius: 0;
|
|
22
|
-
border-left: 0;
|
|
23
29
|
}
|
|
24
30
|
|
|
25
|
-
&
|
|
31
|
+
& > *:not(:first-child):not(:last-child) .btn,
|
|
32
|
+
& > .btn:not(:first-child):not(:last-child) {
|
|
26
33
|
border-radius: 0;
|
|
27
|
-
border-left: 0;
|
|
28
34
|
}
|
|
29
35
|
}
|
|
@@ -287,6 +287,7 @@ const emit = defineEmits([
|
|
|
287
287
|
'check',
|
|
288
288
|
'update:query',
|
|
289
289
|
'will-scroll-top',
|
|
290
|
+
'fetch',
|
|
290
291
|
]);
|
|
291
292
|
|
|
292
293
|
const dataIteratorNode = ref<null | HTMLElement>(null);
|
|
@@ -593,6 +594,7 @@ function fetch(force = false, showLoading = true) {
|
|
|
593
594
|
loading.value = false;
|
|
594
595
|
error.value = false;
|
|
595
596
|
firstLoad.value = true;
|
|
597
|
+
emit('fetch', data.value);
|
|
596
598
|
})
|
|
597
599
|
.catch(() => {
|
|
598
600
|
data.value = null;
|
|
@@ -38,7 +38,9 @@ const templateComponents = {
|
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
const template = `
|
|
41
|
-
<
|
|
41
|
+
<div>Last fetch: {{ lastFetch?.getTime() }} (should update on each fetch)</div>
|
|
42
|
+
<br/>
|
|
43
|
+
<BaseDataTable v-bind="args" @cell-click="onCellClick" @fetch="onFetch">
|
|
42
44
|
<BaseTableColumn
|
|
43
45
|
v-slot="{ row }"
|
|
44
46
|
label="Titre"
|
|
@@ -181,7 +183,13 @@ const templateSetup = (args) => {
|
|
|
181
183
|
alert('cell click!');
|
|
182
184
|
}
|
|
183
185
|
|
|
184
|
-
|
|
186
|
+
const lastFetch = ref(null);
|
|
187
|
+
|
|
188
|
+
function onFetch() {
|
|
189
|
+
lastFetch.value = new Date();
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
return { args, onCellClick, ownerIsVisible: true, onFetch, lastFetch };
|
|
185
193
|
};
|
|
186
194
|
|
|
187
195
|
const Template = (args) => ({
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
:layout="layout"
|
|
11
11
|
:sections="sectionsInternal"
|
|
12
12
|
:scroll-top-on-fetch="maxHeight ? false : scrollTopOnFetch"
|
|
13
|
+
@fetch="onFetch"
|
|
13
14
|
@will-scroll-top="onWillScrollTop"
|
|
14
15
|
>
|
|
15
16
|
<template
|
|
@@ -107,18 +108,10 @@
|
|
|
107
108
|
v-if="showRowActionMenu"
|
|
108
109
|
:items="rowActionMenuItems(row)"
|
|
109
110
|
size="sm"
|
|
111
|
+
button-class="btn flex h-8 w-8 p-0 items-center justify-center"
|
|
110
112
|
>
|
|
111
|
-
<template #button
|
|
112
|
-
<
|
|
113
|
-
class="flex h-8 w-8 items-center justify-center rounded-r border border-l-0 border-slate-300 bg-white duration-150 hover:bg-slate-50"
|
|
114
|
-
:class="[
|
|
115
|
-
open
|
|
116
|
-
? 'ring-2 ring-primary-500 ring-offset-2'
|
|
117
|
-
: false,
|
|
118
|
-
]"
|
|
119
|
-
>
|
|
120
|
-
<BaseIcon icon="heroicons-solid:dots-vertical" />
|
|
121
|
-
</div>
|
|
113
|
+
<template #button>
|
|
114
|
+
<BaseIcon icon="heroicons-solid:dots-vertical" />
|
|
122
115
|
</template>
|
|
123
116
|
</BaseMenu>
|
|
124
117
|
</div>
|
|
@@ -200,10 +193,13 @@
|
|
|
200
193
|
<script lang="ts" setup>
|
|
201
194
|
import { PropType } from 'vue';
|
|
202
195
|
import {
|
|
196
|
+
Collection,
|
|
203
197
|
CollectionItem,
|
|
204
198
|
DataIteratorSection,
|
|
205
199
|
DataTableQuery,
|
|
206
200
|
MenuItemInterface,
|
|
201
|
+
PaginatedCollection,
|
|
202
|
+
ResourceCollection,
|
|
207
203
|
RowAction,
|
|
208
204
|
} from '@/types';
|
|
209
205
|
import { useDialogsStore } from '@/stores/dialogs';
|
|
@@ -427,7 +423,12 @@ const props = defineProps({
|
|
|
427
423
|
},
|
|
428
424
|
});
|
|
429
425
|
|
|
430
|
-
const emit = defineEmits([
|
|
426
|
+
const emit = defineEmits([
|
|
427
|
+
'cell-click',
|
|
428
|
+
'delete',
|
|
429
|
+
'update:checked-rows',
|
|
430
|
+
'fetch',
|
|
431
|
+
]);
|
|
431
432
|
|
|
432
433
|
const dataIterator = ref<null | InstanceType<typeof BaseDataIterator>>(null);
|
|
433
434
|
|
|
@@ -679,6 +680,18 @@ function onWillScrollTop() {
|
|
|
679
680
|
}
|
|
680
681
|
}
|
|
681
682
|
|
|
683
|
+
/*
|
|
684
|
+
|--------------------------------------------------------------------------
|
|
685
|
+
| On fetch
|
|
686
|
+
|--------------------------------------------------------------------------
|
|
687
|
+
*/
|
|
688
|
+
|
|
689
|
+
function onFetch(
|
|
690
|
+
payload: null | ResourceCollection | PaginatedCollection | Collection
|
|
691
|
+
) {
|
|
692
|
+
emit('fetch', payload);
|
|
693
|
+
}
|
|
694
|
+
|
|
682
695
|
/*
|
|
683
696
|
|--------------------------------------------------------------------------
|
|
684
697
|
| Exposed functions
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
:class="[position == 'custom' ? 'static' : 'relative']"
|
|
7
7
|
>
|
|
8
8
|
<div>
|
|
9
|
-
<MenuButton class="
|
|
9
|
+
<MenuButton :class="buttonClass">
|
|
10
10
|
<slot name="button" :open="open" />
|
|
11
11
|
</MenuButton>
|
|
12
12
|
</div>
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
>
|
|
22
22
|
<MenuItems
|
|
23
23
|
:class="[menuClass, menuPositionClass]"
|
|
24
|
-
class="absolute z-menu mt-2 rounded-md bg-white p-1 shadow-lg ring-1 ring-black ring-opacity-10 focus:outline-none"
|
|
24
|
+
class="absolute z-menu mt-2 rounded-md bg-white p-1 shadow-lg outline-none ring-1 ring-black ring-opacity-10 focus:outline-none"
|
|
25
25
|
>
|
|
26
26
|
<slot name="items" :items="items">
|
|
27
27
|
<template v-for="item in items" :key="item.label + 'link'">
|
|
@@ -119,6 +119,10 @@ const props = defineProps({
|
|
|
119
119
|
default: 'sm',
|
|
120
120
|
type: String as PropType<'xs' | 'sm' | 'md'>,
|
|
121
121
|
},
|
|
122
|
+
buttonClass: {
|
|
123
|
+
default: 'flex',
|
|
124
|
+
type: [String, Array, Object],
|
|
125
|
+
},
|
|
122
126
|
});
|
|
123
127
|
|
|
124
128
|
const menuPositionClass = computed(() => {
|