sprintify-ui 0.11.7 → 0.11.8
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
CHANGED
|
@@ -24207,11 +24207,14 @@ const wI = ["onClick"], xI = ["onClick"], kI = { class: "px-1 py-1 h-full flex i
|
|
|
24207
24207
|
setup(n) {
|
|
24208
24208
|
const t = n, e = P(null), r = P(800);
|
|
24209
24209
|
il(e, () => {
|
|
24210
|
-
var
|
|
24211
|
-
r.value = ((
|
|
24210
|
+
var s;
|
|
24211
|
+
r.value = ((s = e.value) == null ? void 0 : s.clientWidth) ?? 800;
|
|
24212
24212
|
});
|
|
24213
24213
|
const o = S(() => t.layout === "compact" ? !0 : r.value < 500);
|
|
24214
|
-
|
|
24214
|
+
async function i(s) {
|
|
24215
|
+
await s();
|
|
24216
|
+
}
|
|
24217
|
+
return (s, l) => (x(), $("div", {
|
|
24215
24218
|
ref_key: "baseHeaderRef",
|
|
24216
24219
|
ref: e
|
|
24217
24220
|
}, [
|
|
@@ -24227,9 +24230,9 @@ const wI = ["onClick"], xI = ["onClick"], kI = { class: "px-1 py-1 h-full flex i
|
|
|
24227
24230
|
n.badge ? (x(), $("div", ZI, [
|
|
24228
24231
|
ee(Vf, _t(n.badge, { class: "relative xs:-bottom-[2px]" }), {
|
|
24229
24232
|
default: J(() => {
|
|
24230
|
-
var
|
|
24233
|
+
var a;
|
|
24231
24234
|
return [
|
|
24232
|
-
Gt(se((
|
|
24235
|
+
Gt(se((a = n.badge) == null ? void 0 : a.label), 1)
|
|
24233
24236
|
];
|
|
24234
24237
|
}),
|
|
24235
24238
|
_: 1
|
|
@@ -24246,32 +24249,34 @@ const wI = ["onClick"], xI = ["onClick"], kI = { class: "px-1 py-1 h-full flex i
|
|
|
24246
24249
|
g(o) ? "mt-2 flex-col" : "mt-2 flex-row flex-wrap space-x-4"
|
|
24247
24250
|
]])
|
|
24248
24251
|
}, [
|
|
24249
|
-
(x(!0), $(Re, null, Ge(n.attributes, (
|
|
24250
|
-
key:
|
|
24252
|
+
(x(!0), $(Re, null, Ge(n.attributes, (a) => (x(), oe(Ji, {
|
|
24253
|
+
key: a.label + a.icon,
|
|
24251
24254
|
class: "flex items-center gap-1.5",
|
|
24252
|
-
visible: !!
|
|
24253
|
-
text:
|
|
24255
|
+
visible: !!a.tooltip,
|
|
24256
|
+
text: a.tooltip,
|
|
24254
24257
|
dark: "",
|
|
24255
24258
|
delay: 400
|
|
24256
24259
|
}, {
|
|
24257
24260
|
default: J(() => [
|
|
24258
|
-
(x(), oe(Wn(
|
|
24259
|
-
to:
|
|
24260
|
-
href:
|
|
24261
|
-
|
|
24262
|
-
|
|
24261
|
+
(x(), oe(Wn(a.to ? "router-link" : a.href ? "a" : a.action ? "button" : "div"), {
|
|
24262
|
+
to: a.to,
|
|
24263
|
+
href: a.href,
|
|
24264
|
+
type: a.action && !a.to && !a.href ? "button" : void 0,
|
|
24265
|
+
target: a.target ?? void 0,
|
|
24266
|
+
class: "flex items-center gap-1.5",
|
|
24267
|
+
onClick: (u) => a.action && !a.to && !a.href ? i(a.action) : void 0
|
|
24263
24268
|
}, {
|
|
24264
24269
|
default: J(() => [
|
|
24265
|
-
|
|
24270
|
+
a.icon ? (x(), oe(g(Je), {
|
|
24266
24271
|
key: 0,
|
|
24267
|
-
icon:
|
|
24272
|
+
icon: a.icon,
|
|
24268
24273
|
class: "h-4 w-4 shrink-0 text-slate-600",
|
|
24269
24274
|
"aria-hidden": "true"
|
|
24270
24275
|
}, null, 8, ["icon"])) : Z("", !0),
|
|
24271
|
-
I("span", eO, se(
|
|
24276
|
+
I("span", eO, se(a.label), 1)
|
|
24272
24277
|
]),
|
|
24273
24278
|
_: 2
|
|
24274
|
-
}, 1032, ["to", "href", "target"]))
|
|
24279
|
+
}, 1032, ["to", "href", "type", "target", "onClick"]))
|
|
24275
24280
|
]),
|
|
24276
24281
|
_: 2
|
|
24277
24282
|
}, 1032, ["visible", "text"]))), 128))
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import { Breadcrumb, ActionItem } from '@/types';
|
|
2
2
|
import BaseBadge from './BaseBadge.vue';
|
|
3
|
-
import {
|
|
3
|
+
import { RouteLocationRaw } from 'vue-router';
|
|
4
4
|
type BaseBadgeProps = InstanceType<typeof BaseBadge>["$props"] & {
|
|
5
5
|
label: string;
|
|
6
6
|
};
|
|
7
|
+
interface HeaderAttribute {
|
|
8
|
+
icon?: string;
|
|
9
|
+
label: string;
|
|
10
|
+
tooltip?: string;
|
|
11
|
+
to?: RouteLocationRaw;
|
|
12
|
+
href?: string;
|
|
13
|
+
action?: () => Promise<void> | void;
|
|
14
|
+
target?: string;
|
|
15
|
+
}
|
|
7
16
|
type __VLS_Props = {
|
|
8
17
|
title: string;
|
|
9
18
|
subtitle?: string;
|
|
10
|
-
attributes?:
|
|
11
|
-
icon?: string;
|
|
12
|
-
label: string;
|
|
13
|
-
tooltip?: string;
|
|
14
|
-
to?: RouteRecordRaw;
|
|
15
|
-
href?: string;
|
|
16
|
-
target?: string;
|
|
17
|
-
}[];
|
|
19
|
+
attributes?: HeaderAttribute[];
|
|
18
20
|
actions?: ActionItem[];
|
|
19
21
|
badge?: BaseBadgeProps;
|
|
20
22
|
layout?: 'default' | 'compact';
|
|
@@ -26,14 +28,7 @@ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {
|
|
|
26
28
|
maxActions: number;
|
|
27
29
|
breadcrumbs: Breadcrumb[];
|
|
28
30
|
layout: "default" | "compact";
|
|
29
|
-
attributes:
|
|
30
|
-
icon?: string;
|
|
31
|
-
label: string;
|
|
32
|
-
tooltip?: string;
|
|
33
|
-
to?: RouteRecordRaw;
|
|
34
|
-
href?: string;
|
|
35
|
-
target?: string;
|
|
36
|
-
}[];
|
|
31
|
+
attributes: HeaderAttribute[];
|
|
37
32
|
subtitle: string;
|
|
38
33
|
badge: BaseBadgeProps;
|
|
39
34
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
package/package.json
CHANGED
|
@@ -42,6 +42,25 @@ const attributes = [
|
|
|
42
42
|
tooltip: "Anywhere",
|
|
43
43
|
to: '/articles'
|
|
44
44
|
},
|
|
45
|
+
{
|
|
46
|
+
label: 'URL',
|
|
47
|
+
icon: 'heroicons:link-solid',
|
|
48
|
+
href: 'https://example.com'
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
label: 'URL (new tab)',
|
|
52
|
+
icon: 'heroicons:link-solid',
|
|
53
|
+
href: 'https://example.com',
|
|
54
|
+
target: '_blank'
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
label: 'Action',
|
|
58
|
+
icon: 'heroicons:play-solid',
|
|
59
|
+
tooltip: 'Run action',
|
|
60
|
+
action() {
|
|
61
|
+
alert('Action');
|
|
62
|
+
}
|
|
63
|
+
}
|
|
45
64
|
];
|
|
46
65
|
|
|
47
66
|
const actions = [
|
|
@@ -51,11 +51,13 @@
|
|
|
51
51
|
:delay="400"
|
|
52
52
|
>
|
|
53
53
|
<component
|
|
54
|
-
:is="attribute.to ? 'router-link' : (attribute.href ? 'a' : 'div')"
|
|
54
|
+
:is="attribute.to ? 'router-link' : (attribute.href ? 'a' : (attribute.action ? 'button' : 'div'))"
|
|
55
55
|
:to="attribute.to"
|
|
56
56
|
:href="attribute.href"
|
|
57
|
+
:type="attribute.action && !attribute.to && !attribute.href ? 'button' : undefined"
|
|
57
58
|
:target="attribute.target ?? undefined"
|
|
58
59
|
class="flex items-center gap-1.5"
|
|
60
|
+
@click="attribute.action && !attribute.to && !attribute.href ? onAttributeClick(attribute.action) : undefined"
|
|
59
61
|
>
|
|
60
62
|
<BaseIcon
|
|
61
63
|
v-if="attribute.icon"
|
|
@@ -98,17 +100,27 @@ import { BaseBreadcrumbs, BaseIcon } from '..';
|
|
|
98
100
|
import BaseBadge from './BaseBadge.vue';
|
|
99
101
|
import BaseTooltip from './BaseTooltip.vue';
|
|
100
102
|
import BaseActionButtons from './BaseActionButtons.vue';
|
|
101
|
-
import {
|
|
103
|
+
import { RouteLocationRaw } from 'vue-router';
|
|
102
104
|
|
|
103
105
|
type BaseBadgeProps = InstanceType<typeof BaseBadge>["$props"] & {
|
|
104
106
|
label: string;
|
|
105
107
|
};
|
|
106
108
|
|
|
109
|
+
interface HeaderAttribute {
|
|
110
|
+
icon?: string;
|
|
111
|
+
label: string;
|
|
112
|
+
tooltip?: string;
|
|
113
|
+
to?: RouteLocationRaw;
|
|
114
|
+
href?: string;
|
|
115
|
+
action?: () => Promise<void> | void;
|
|
116
|
+
target?: string;
|
|
117
|
+
}
|
|
118
|
+
|
|
107
119
|
const props = withDefaults(
|
|
108
120
|
defineProps<{
|
|
109
121
|
title: string;
|
|
110
122
|
subtitle?: string;
|
|
111
|
-
attributes?:
|
|
123
|
+
attributes?: HeaderAttribute[];
|
|
112
124
|
actions?: ActionItem[];
|
|
113
125
|
badge?: BaseBadgeProps;
|
|
114
126
|
layout?: 'default' | 'compact';
|
|
@@ -140,4 +152,8 @@ const compactLayout = computed(() => {
|
|
|
140
152
|
return width.value < 500;
|
|
141
153
|
});
|
|
142
154
|
|
|
155
|
+
async function onAttributeClick(action: () => Promise<void> | void) {
|
|
156
|
+
await action();
|
|
157
|
+
}
|
|
158
|
+
|
|
143
159
|
</script>
|