sprintify-ui 0.6.41 → 0.6.43
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 +973 -949
- package/dist/types/src/components/BaseHeader.vue.d.ts +7 -15
- package/dist/types/src/components/BaseMenuItem.vue.d.ts +9 -0
- package/dist/types/src/types/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/BaseDataTable.stories.js +8 -2
- package/src/components/BaseDataTable.vue +1 -0
- package/src/components/BaseDataTableRowAction.vue +24 -3
- package/src/components/BaseHeader.vue +7 -4
- package/src/components/BaseMenu.vue +8 -4
- package/src/components/BaseMenuItem.vue +10 -2
- package/src/types/index.ts +1 -0
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { Breadcrumb, ActionItem } from '@/types';
|
|
2
|
+
import BaseBadge from './BaseBadge.vue';
|
|
3
|
+
type BaseBadgeProps = InstanceType<typeof BaseBadge>["$props"] & {
|
|
4
|
+
label: string;
|
|
5
|
+
};
|
|
2
6
|
declare const _default: import("vue").DefineComponent<{
|
|
3
7
|
title: {
|
|
4
8
|
type: import("vue").PropType<string>;
|
|
@@ -28,11 +32,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
28
32
|
default: undefined;
|
|
29
33
|
};
|
|
30
34
|
badge: {
|
|
31
|
-
type: import("vue").PropType<
|
|
32
|
-
icon: string;
|
|
33
|
-
label: string;
|
|
34
|
-
color: string;
|
|
35
|
-
}>;
|
|
35
|
+
type: import("vue").PropType<BaseBadgeProps>;
|
|
36
36
|
default: undefined;
|
|
37
37
|
};
|
|
38
38
|
maxActions: {
|
|
@@ -68,11 +68,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
68
68
|
default: undefined;
|
|
69
69
|
};
|
|
70
70
|
badge: {
|
|
71
|
-
type: import("vue").PropType<
|
|
72
|
-
icon: string;
|
|
73
|
-
label: string;
|
|
74
|
-
color: string;
|
|
75
|
-
}>;
|
|
71
|
+
type: import("vue").PropType<BaseBadgeProps>;
|
|
76
72
|
default: undefined;
|
|
77
73
|
};
|
|
78
74
|
maxActions: {
|
|
@@ -88,11 +84,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
88
84
|
label: string;
|
|
89
85
|
}[];
|
|
90
86
|
subtitle: string;
|
|
91
|
-
badge:
|
|
92
|
-
icon: string;
|
|
93
|
-
label: string;
|
|
94
|
-
color: string;
|
|
95
|
-
};
|
|
87
|
+
badge: BaseBadgeProps;
|
|
96
88
|
maxActions: number;
|
|
97
89
|
}, {}>;
|
|
98
90
|
export default _default;
|
|
@@ -21,6 +21,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
21
21
|
default: undefined;
|
|
22
22
|
type: NumberConstructor;
|
|
23
23
|
};
|
|
24
|
+
disabled: {
|
|
25
|
+
default: boolean;
|
|
26
|
+
type: BooleanConstructor;
|
|
27
|
+
};
|
|
24
28
|
color: {
|
|
25
29
|
default: string;
|
|
26
30
|
type: PropType<ActionColors>;
|
|
@@ -50,6 +54,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
50
54
|
default: undefined;
|
|
51
55
|
type: NumberConstructor;
|
|
52
56
|
};
|
|
57
|
+
disabled: {
|
|
58
|
+
default: boolean;
|
|
59
|
+
type: BooleanConstructor;
|
|
60
|
+
};
|
|
53
61
|
color: {
|
|
54
62
|
default: string;
|
|
55
63
|
type: PropType<ActionColors>;
|
|
@@ -65,6 +73,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
65
73
|
icon: string;
|
|
66
74
|
size: "xs" | "sm" | "md";
|
|
67
75
|
description: string;
|
|
76
|
+
disabled: boolean;
|
|
68
77
|
count: number;
|
|
69
78
|
}, {}>;
|
|
70
79
|
export default _default;
|
|
@@ -180,6 +180,7 @@ export interface RowAction {
|
|
|
180
180
|
icon: string;
|
|
181
181
|
action?: (row: CollectionItem) => Promise<void> | void;
|
|
182
182
|
to?: (row: CollectionItem) => RouteLocationRaw;
|
|
183
|
+
href?: (row: CollectionItem) => string;
|
|
183
184
|
disabled?: (row: CollectionItem) => boolean;
|
|
184
185
|
}
|
|
185
186
|
export interface CropperConfig {
|
package/package.json
CHANGED
|
@@ -116,12 +116,18 @@ Demo.args = {
|
|
|
116
116
|
],
|
|
117
117
|
rowActions: [
|
|
118
118
|
{
|
|
119
|
-
label: '
|
|
120
|
-
icon: 'heroicons:link',
|
|
119
|
+
label: 'Href',
|
|
120
|
+
icon: 'heroicons:link-20-solid',
|
|
121
|
+
href: () => 'https://google.com',
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
label: 'Action',
|
|
125
|
+
icon: 'heroicons:arrow-right-20-solid',
|
|
121
126
|
action() {
|
|
122
127
|
alert('hit');
|
|
123
128
|
},
|
|
124
129
|
},
|
|
130
|
+
|
|
125
131
|
],
|
|
126
132
|
sections: [
|
|
127
133
|
{
|
|
@@ -18,14 +18,35 @@
|
|
|
18
18
|
}"
|
|
19
19
|
/>
|
|
20
20
|
</button>
|
|
21
|
-
<
|
|
21
|
+
<component
|
|
22
|
+
:is="(rowAction.disabled && rowAction.disabled(row)) ? 'span' : 'a'"
|
|
23
|
+
v-else-if="rowAction.href"
|
|
24
|
+
:href="rowAction.href(row)"
|
|
25
|
+
class="btn btn-white border border-slate-300 shadow-sm"
|
|
26
|
+
:class="{
|
|
27
|
+
'btn-xs px-1.5 py-1': size === 'sm',
|
|
28
|
+
'btn-sm px-2 py-1.5': size === 'md',
|
|
29
|
+
'opacity-50 cursor-not-allowed': rowAction.disabled && rowAction.disabled(row),
|
|
30
|
+
}"
|
|
31
|
+
:disabled="rowAction.disabled && rowAction.disabled(row)"
|
|
32
|
+
>
|
|
33
|
+
<BaseIcon
|
|
34
|
+
:icon="rowAction.icon"
|
|
35
|
+
class="text-slate-500"
|
|
36
|
+
:class="{
|
|
37
|
+
'h-3 w-3': size === 'sm',
|
|
38
|
+
}"
|
|
39
|
+
/>
|
|
40
|
+
</component>
|
|
41
|
+
<component
|
|
42
|
+
:is="(rowAction.disabled && rowAction.disabled(row)) ? 'span' : 'router-link'"
|
|
22
43
|
v-else-if="rowAction.to"
|
|
23
44
|
:to="rowAction.to(row)"
|
|
24
|
-
:disabled="rowAction.disabled && rowAction.disabled(row)"
|
|
25
45
|
class="btn btn-white border border-slate-300 shadow-sm hover:bg-slate-100"
|
|
26
46
|
:class="{
|
|
27
47
|
'btn-xs px-1.5 py-1': size === 'sm',
|
|
28
48
|
'btn-sm px-2 py-1.5': size === 'md',
|
|
49
|
+
'opacity-50 cursor-not-allowed': rowAction.disabled && rowAction.disabled(row),
|
|
29
50
|
}"
|
|
30
51
|
>
|
|
31
52
|
<BaseIcon
|
|
@@ -35,7 +56,7 @@
|
|
|
35
56
|
'h-3 w-3': size === 'sm',
|
|
36
57
|
}"
|
|
37
58
|
/>
|
|
38
|
-
</
|
|
59
|
+
</component>
|
|
39
60
|
</template>
|
|
40
61
|
|
|
41
62
|
<script lang="ts" setup>
|
|
@@ -18,11 +18,10 @@
|
|
|
18
18
|
class="order-1 mb-1 xs:order-2 xs:mb-0"
|
|
19
19
|
>
|
|
20
20
|
<BaseBadge
|
|
21
|
-
|
|
22
|
-
:icon="badge.icon"
|
|
21
|
+
v-bind="badge"
|
|
23
22
|
class="relative xs:-bottom-[2px]"
|
|
24
23
|
>
|
|
25
|
-
{{ badge
|
|
24
|
+
{{ badge?.label }}
|
|
26
25
|
</BaseBadge>
|
|
27
26
|
</div>
|
|
28
27
|
</div>
|
|
@@ -106,13 +105,17 @@ import BaseBadge from './BaseBadge.vue';
|
|
|
106
105
|
import BaseMenu from './BaseMenu.vue';
|
|
107
106
|
import { cloneDeep } from 'lodash';
|
|
108
107
|
|
|
108
|
+
type BaseBadgeProps = InstanceType<typeof BaseBadge>["$props"] & {
|
|
109
|
+
label: string;
|
|
110
|
+
};
|
|
111
|
+
|
|
109
112
|
const props = withDefaults(
|
|
110
113
|
defineProps<{
|
|
111
114
|
title: string;
|
|
112
115
|
subtitle?: string;
|
|
113
116
|
attributes?: { icon: string; label: string }[];
|
|
114
117
|
actions?: ActionItem[];
|
|
115
|
-
badge?:
|
|
118
|
+
badge?: BaseBadgeProps;
|
|
116
119
|
layout?: 'default' | 'compact';
|
|
117
120
|
breadcrumbs?: Breadcrumb[];
|
|
118
121
|
maxActions?: number;
|
|
@@ -53,7 +53,8 @@
|
|
|
53
53
|
v-else-if="item.to"
|
|
54
54
|
v-slot="{ active, close }"
|
|
55
55
|
>
|
|
56
|
-
<
|
|
56
|
+
<component
|
|
57
|
+
:is="item.disabled ? 'span' : 'router-link'"
|
|
57
58
|
:to="item.to"
|
|
58
59
|
@mouseup="close"
|
|
59
60
|
>
|
|
@@ -66,17 +67,18 @@
|
|
|
66
67
|
:count="item.count"
|
|
67
68
|
:icon="item.icon"
|
|
68
69
|
:color="item.color"
|
|
70
|
+
:disabled="item.disabled"
|
|
69
71
|
:active="active"
|
|
70
72
|
:size="size"
|
|
71
73
|
/>
|
|
72
74
|
</slot>
|
|
73
|
-
</
|
|
75
|
+
</component>
|
|
74
76
|
</MenuItem>
|
|
75
77
|
|
|
76
78
|
<MenuItem
|
|
77
79
|
v-else-if="item.href"
|
|
78
80
|
v-slot="{ active }"
|
|
79
|
-
as="a"
|
|
81
|
+
:as="item.disabled ? 'span' : 'a'"
|
|
80
82
|
:href="item.href"
|
|
81
83
|
>
|
|
82
84
|
<slot
|
|
@@ -88,6 +90,7 @@
|
|
|
88
90
|
:count="item.count"
|
|
89
91
|
:icon="item.icon"
|
|
90
92
|
:color="item.color"
|
|
93
|
+
:disabled="item.disabled"
|
|
91
94
|
:active="active"
|
|
92
95
|
:size="size"
|
|
93
96
|
/>
|
|
@@ -100,7 +103,7 @@
|
|
|
100
103
|
as="button"
|
|
101
104
|
type="button"
|
|
102
105
|
class="w-full"
|
|
103
|
-
@click="item.action"
|
|
106
|
+
@click="item.disabled ? false : item.action()"
|
|
104
107
|
>
|
|
105
108
|
<slot
|
|
106
109
|
name="item"
|
|
@@ -112,6 +115,7 @@
|
|
|
112
115
|
:count="item.count"
|
|
113
116
|
:icon="item.icon"
|
|
114
117
|
:color="item.color"
|
|
118
|
+
:disabled="item.disabled"
|
|
115
119
|
:active="active"
|
|
116
120
|
:size="size"
|
|
117
121
|
/>
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
3
|
:style="buttonStyles"
|
|
4
|
-
class="rounded leading-tight
|
|
5
|
-
:class="[
|
|
4
|
+
class="rounded leading-tight "
|
|
5
|
+
:class="[
|
|
6
|
+
!disabled ? 'hover:bg-slate-100' : '',
|
|
7
|
+
active && !disabled ? 'bg-slate-100' : 'bg-white',
|
|
8
|
+
disabled ? 'opacity-50 cursor-not-allowed' : ''
|
|
9
|
+
]"
|
|
6
10
|
>
|
|
7
11
|
<div
|
|
8
12
|
class="flex"
|
|
@@ -66,6 +70,10 @@ const props = defineProps({
|
|
|
66
70
|
default: undefined,
|
|
67
71
|
type: Number,
|
|
68
72
|
},
|
|
73
|
+
disabled: {
|
|
74
|
+
default: false,
|
|
75
|
+
type: Boolean,
|
|
76
|
+
},
|
|
69
77
|
color: {
|
|
70
78
|
default: 'dark',
|
|
71
79
|
type: String as PropType<ActionColors>,
|
package/src/types/index.ts
CHANGED
|
@@ -224,6 +224,7 @@ export interface RowAction {
|
|
|
224
224
|
icon: string;
|
|
225
225
|
action?: (row: CollectionItem) => Promise<void> | void;
|
|
226
226
|
to?: (row: CollectionItem) => RouteLocationRaw;
|
|
227
|
+
href?: (row: CollectionItem) => string;
|
|
227
228
|
disabled?: (row: CollectionItem) => boolean;
|
|
228
229
|
}
|
|
229
230
|
|