sprintify-ui 0.11.6 → 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,31 +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
|
-
|
|
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
|
|
24262
24268
|
}, {
|
|
24263
24269
|
default: J(() => [
|
|
24264
|
-
|
|
24270
|
+
a.icon ? (x(), oe(g(Je), {
|
|
24265
24271
|
key: 0,
|
|
24266
|
-
icon:
|
|
24272
|
+
icon: a.icon,
|
|
24267
24273
|
class: "h-4 w-4 shrink-0 text-slate-600",
|
|
24268
24274
|
"aria-hidden": "true"
|
|
24269
24275
|
}, null, 8, ["icon"])) : Z("", !0),
|
|
24270
|
-
I("span", eO, se(
|
|
24276
|
+
I("span", eO, se(a.label), 1)
|
|
24271
24277
|
]),
|
|
24272
24278
|
_: 2
|
|
24273
|
-
}, 1032, ["to", "href"]))
|
|
24279
|
+
}, 1032, ["to", "href", "type", "target", "onClick"]))
|
|
24274
24280
|
]),
|
|
24275
24281
|
_: 2
|
|
24276
24282
|
}, 1032, ["visible", "text"]))), 128))
|
|
@@ -1,19 +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
|
-
}[];
|
|
19
|
+
attributes?: HeaderAttribute[];
|
|
17
20
|
actions?: ActionItem[];
|
|
18
21
|
badge?: BaseBadgeProps;
|
|
19
22
|
layout?: 'default' | 'compact';
|
|
@@ -25,13 +28,7 @@ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {
|
|
|
25
28
|
maxActions: number;
|
|
26
29
|
breadcrumbs: Breadcrumb[];
|
|
27
30
|
layout: "default" | "compact";
|
|
28
|
-
attributes:
|
|
29
|
-
icon?: string;
|
|
30
|
-
label: string;
|
|
31
|
-
tooltip?: string;
|
|
32
|
-
to?: RouteRecordRaw;
|
|
33
|
-
href?: string;
|
|
34
|
-
}[];
|
|
31
|
+
attributes: HeaderAttribute[];
|
|
35
32
|
subtitle: string;
|
|
36
33
|
badge: BaseBadgeProps;
|
|
37
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,10 +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"
|
|
58
|
+
:target="attribute.target ?? undefined"
|
|
57
59
|
class="flex items-center gap-1.5"
|
|
60
|
+
@click="attribute.action && !attribute.to && !attribute.href ? onAttributeClick(attribute.action) : undefined"
|
|
58
61
|
>
|
|
59
62
|
<BaseIcon
|
|
60
63
|
v-if="attribute.icon"
|
|
@@ -97,17 +100,27 @@ import { BaseBreadcrumbs, BaseIcon } from '..';
|
|
|
97
100
|
import BaseBadge from './BaseBadge.vue';
|
|
98
101
|
import BaseTooltip from './BaseTooltip.vue';
|
|
99
102
|
import BaseActionButtons from './BaseActionButtons.vue';
|
|
100
|
-
import {
|
|
103
|
+
import { RouteLocationRaw } from 'vue-router';
|
|
101
104
|
|
|
102
105
|
type BaseBadgeProps = InstanceType<typeof BaseBadge>["$props"] & {
|
|
103
106
|
label: string;
|
|
104
107
|
};
|
|
105
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
|
+
|
|
106
119
|
const props = withDefaults(
|
|
107
120
|
defineProps<{
|
|
108
121
|
title: string;
|
|
109
122
|
subtitle?: string;
|
|
110
|
-
attributes?:
|
|
123
|
+
attributes?: HeaderAttribute[];
|
|
111
124
|
actions?: ActionItem[];
|
|
112
125
|
badge?: BaseBadgeProps;
|
|
113
126
|
layout?: 'default' | 'compact';
|
|
@@ -139,4 +152,8 @@ const compactLayout = computed(() => {
|
|
|
139
152
|
return width.value < 500;
|
|
140
153
|
});
|
|
141
154
|
|
|
155
|
+
async function onAttributeClick(action: () => Promise<void> | void) {
|
|
156
|
+
await action();
|
|
157
|
+
}
|
|
158
|
+
|
|
142
159
|
</script>
|