@expcat/tigercat-vue 2.1.4 → 2.3.0
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/chunk-2WUDJQT7.mjs +219 -0
- package/dist/{chunk-4KFAGTGA.mjs → chunk-3GNK4XIP.mjs} +1 -1
- package/dist/{chunk-MWYNO42Z.mjs → chunk-5IVN54XY.mjs} +1 -1
- package/dist/{chunk-BFIYTA3E.mjs → chunk-72XR5ZIW.mjs} +6 -2
- package/dist/{chunk-XCIQNTJN.mjs → chunk-77L52YWC.mjs} +37 -5
- package/dist/chunk-7L5MXXHC.mjs +85 -0
- package/dist/{chunk-FZQAYEIU.mjs → chunk-AIONRIMJ.mjs} +1 -1
- package/dist/{chunk-ETJ4QD6U.mjs → chunk-AYCK22RG.mjs} +1 -1
- package/dist/{chunk-35JLHFUT.mjs → chunk-ETW3MBHS.mjs} +22 -1
- package/dist/{chunk-ZHAIO7DA.mjs → chunk-GAIFRCYZ.mjs} +6 -3
- package/dist/chunk-GFSZU7EJ.mjs +98 -0
- package/dist/{chunk-TQEN6GDE.mjs → chunk-IKM3NBMK.mjs} +5 -6
- package/dist/chunk-JUSJUVFQ.mjs +76 -0
- package/dist/chunk-OEHI4BZZ.mjs +168 -0
- package/dist/{chunk-ZW2VXGO3.mjs → chunk-RBST5GCI.mjs} +6 -3
- package/dist/{chunk-HSKBYNCP.mjs → chunk-ZMSGID63.mjs} +7 -5
- package/dist/components/ActivityFeed.mjs +2 -2
- package/dist/components/Anchor.mjs +1 -1
- package/dist/components/BackTop.mjs +1 -1
- package/dist/components/Calendar.d.mts +12 -3
- package/dist/components/Calendar.mjs +1 -1
- package/dist/components/Code.d.mts +19 -1
- package/dist/components/Code.mjs +1 -1
- package/dist/components/CodeEditor.d.mts +2 -2
- package/dist/components/CommentThread.d.mts +1 -1
- package/dist/components/CommentThread.mjs +2 -2
- package/dist/components/DataTableWithToolbar.mjs +1 -1
- package/dist/components/DatePicker.mjs +2 -2
- package/dist/components/Drag.d.mts +62 -0
- package/dist/components/Drag.mjs +9 -0
- package/dist/components/Footer.d.mts +10 -0
- package/dist/components/Footer.mjs +1 -1
- package/dist/components/FormWizard.d.mts +1 -1
- package/dist/components/FullscreenButton.d.mts +58 -0
- package/dist/components/FullscreenButton.mjs +10 -0
- package/dist/components/Icon.d.mts +3 -3
- package/dist/components/Loading.d.mts +1 -1
- package/dist/components/Menu.d.mts +4 -4
- package/dist/components/Menu.mjs +1 -1
- package/dist/components/NotificationCenter.mjs +2 -2
- package/dist/components/ScrollSpy.mjs +1 -1
- package/dist/components/Text.d.mts +23 -73
- package/dist/components/Text.mjs +2 -1
- package/dist/components/WorkflowTimeline.d.mts +150 -0
- package/dist/components/WorkflowTimeline.mjs +15 -0
- package/dist/composables/useFullscreen.d.mts +14 -0
- package/dist/composables/useFullscreen.mjs +6 -0
- package/dist/index.d.mts +6 -2
- package/dist/index.mjs +64 -0
- package/package.json +27 -2
- package/dist/chunk-I77GUQV4.mjs +0 -93
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Timeline
|
|
3
|
+
} from "./chunk-K46SNCCE.mjs";
|
|
4
|
+
import {
|
|
5
|
+
Tag
|
|
6
|
+
} from "./chunk-7PLYHGMY.mjs";
|
|
7
|
+
import {
|
|
8
|
+
Button
|
|
9
|
+
} from "./chunk-4KIZXFFG.mjs";
|
|
10
|
+
|
|
11
|
+
// src/components/WorkflowTimeline.ts
|
|
12
|
+
import { computed, defineComponent, h } from "vue";
|
|
13
|
+
import {
|
|
14
|
+
classNames,
|
|
15
|
+
coerceClassValue,
|
|
16
|
+
mergeStyleValues,
|
|
17
|
+
resolveWorkflowActionButtonProps,
|
|
18
|
+
shouldShowWorkflowActions,
|
|
19
|
+
timelineDescriptionClasses,
|
|
20
|
+
timelineLabelClasses,
|
|
21
|
+
workflowStepsToTimelineItems,
|
|
22
|
+
workflowStepStatusLabel,
|
|
23
|
+
workflowStepStatusTagVariant
|
|
24
|
+
} from "@expcat/tigercat-core";
|
|
25
|
+
var workflowTimelineRootClasses = "flex flex-col gap-4";
|
|
26
|
+
var workflowActionBarClasses = "flex flex-wrap items-center gap-2";
|
|
27
|
+
var workflowStepHeaderClasses = "flex flex-wrap items-center gap-2";
|
|
28
|
+
var workflowStepActorClasses = "text-sm text-[var(--tiger-text-muted,#6b7280)]";
|
|
29
|
+
var workflowStepCommentClasses = "text-sm text-[var(--tiger-text-secondary,#4b5563)] mt-1";
|
|
30
|
+
function isWorkflowTimelineItem(item) {
|
|
31
|
+
return typeof item === "object" && item != null && "step" in item && "status" in item && typeof item.status === "string";
|
|
32
|
+
}
|
|
33
|
+
function renderStepContent(item) {
|
|
34
|
+
const step = item.step;
|
|
35
|
+
const title = step.title ?? step.label;
|
|
36
|
+
const statusLabel = workflowStepStatusLabel(item.status);
|
|
37
|
+
return h("div", { class: "min-w-0" }, [
|
|
38
|
+
step.time ? h("div", { class: timelineLabelClasses }, step.time) : null,
|
|
39
|
+
h("div", { class: workflowStepHeaderClasses }, [
|
|
40
|
+
title ? h("div", { class: timelineDescriptionClasses }, title) : null,
|
|
41
|
+
h(
|
|
42
|
+
Tag,
|
|
43
|
+
{
|
|
44
|
+
variant: workflowStepStatusTagVariant(item.status),
|
|
45
|
+
size: "sm",
|
|
46
|
+
pill: true
|
|
47
|
+
},
|
|
48
|
+
{ default: () => statusLabel }
|
|
49
|
+
)
|
|
50
|
+
]),
|
|
51
|
+
step.actor?.name ? h("div", { class: workflowStepActorClasses }, step.actor.name) : null,
|
|
52
|
+
step.comment ? h("div", { class: workflowStepCommentClasses }, step.comment) : null
|
|
53
|
+
]);
|
|
54
|
+
}
|
|
55
|
+
var WorkflowActionBar = defineComponent({
|
|
56
|
+
name: "TigerWorkflowActionBar",
|
|
57
|
+
inheritAttrs: false,
|
|
58
|
+
props: {
|
|
59
|
+
items: {
|
|
60
|
+
type: Array,
|
|
61
|
+
default: void 0
|
|
62
|
+
},
|
|
63
|
+
disabled: Boolean,
|
|
64
|
+
ariaLabel: {
|
|
65
|
+
type: String,
|
|
66
|
+
default: void 0
|
|
67
|
+
},
|
|
68
|
+
className: {
|
|
69
|
+
type: String,
|
|
70
|
+
default: void 0
|
|
71
|
+
},
|
|
72
|
+
style: {
|
|
73
|
+
type: Object,
|
|
74
|
+
default: void 0
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
emits: ["action"],
|
|
78
|
+
setup(props, { emit, attrs }) {
|
|
79
|
+
const toolbarClasses = computed(
|
|
80
|
+
() => classNames(workflowActionBarClasses, props.className, coerceClassValue(attrs.class))
|
|
81
|
+
);
|
|
82
|
+
const toolbarStyle = computed(() => mergeStyleValues(attrs.style, props.style));
|
|
83
|
+
return () => {
|
|
84
|
+
const items = props.items ?? [];
|
|
85
|
+
return h(
|
|
86
|
+
"div",
|
|
87
|
+
{
|
|
88
|
+
...attrs,
|
|
89
|
+
class: toolbarClasses.value,
|
|
90
|
+
style: toolbarStyle.value,
|
|
91
|
+
role: "toolbar",
|
|
92
|
+
"aria-label": props.ariaLabel ?? attrs["aria-label"] ?? "Workflow actions"
|
|
93
|
+
},
|
|
94
|
+
items.map((item) => {
|
|
95
|
+
const buttonProps = resolveWorkflowActionButtonProps(item);
|
|
96
|
+
const disabled = Boolean(props.disabled || item.disabled);
|
|
97
|
+
return h(
|
|
98
|
+
Button,
|
|
99
|
+
{
|
|
100
|
+
key: item.key,
|
|
101
|
+
size: "sm",
|
|
102
|
+
variant: buttonProps.variant,
|
|
103
|
+
danger: buttonProps.danger,
|
|
104
|
+
disabled,
|
|
105
|
+
onClick: () => {
|
|
106
|
+
if (disabled) return;
|
|
107
|
+
emit("action", item);
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
{ default: () => item.label }
|
|
111
|
+
);
|
|
112
|
+
})
|
|
113
|
+
);
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
var WorkflowTimeline = defineComponent({
|
|
118
|
+
name: "TigerWorkflowTimeline",
|
|
119
|
+
inheritAttrs: false,
|
|
120
|
+
props: {
|
|
121
|
+
steps: {
|
|
122
|
+
type: Array,
|
|
123
|
+
default: void 0
|
|
124
|
+
},
|
|
125
|
+
actions: {
|
|
126
|
+
type: Array,
|
|
127
|
+
default: void 0
|
|
128
|
+
},
|
|
129
|
+
showActions: {
|
|
130
|
+
type: Boolean,
|
|
131
|
+
default: void 0
|
|
132
|
+
},
|
|
133
|
+
mode: {
|
|
134
|
+
type: String,
|
|
135
|
+
default: "left"
|
|
136
|
+
},
|
|
137
|
+
pending: {
|
|
138
|
+
type: Boolean,
|
|
139
|
+
default: false
|
|
140
|
+
},
|
|
141
|
+
pendingDot: {
|
|
142
|
+
type: [String, Object],
|
|
143
|
+
default: void 0
|
|
144
|
+
},
|
|
145
|
+
reverse: {
|
|
146
|
+
type: Boolean,
|
|
147
|
+
default: false
|
|
148
|
+
},
|
|
149
|
+
className: {
|
|
150
|
+
type: String,
|
|
151
|
+
default: void 0
|
|
152
|
+
},
|
|
153
|
+
style: {
|
|
154
|
+
type: Object,
|
|
155
|
+
default: void 0
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
emits: ["action"],
|
|
159
|
+
setup(props, { emit, slots, attrs }) {
|
|
160
|
+
const timelineItems = computed(() => workflowStepsToTimelineItems(props.steps));
|
|
161
|
+
const showActionBar = computed(
|
|
162
|
+
() => shouldShowWorkflowActions(props.steps, props.actions, props.showActions)
|
|
163
|
+
);
|
|
164
|
+
const rootClasses = computed(
|
|
165
|
+
() => classNames(workflowTimelineRootClasses, props.className, coerceClassValue(attrs.class))
|
|
166
|
+
);
|
|
167
|
+
const rootStyle = computed(() => mergeStyleValues(attrs.style, props.style));
|
|
168
|
+
return () => {
|
|
169
|
+
const timelineSlots = {};
|
|
170
|
+
if (slots.dot) timelineSlots.dot = slots.dot;
|
|
171
|
+
if (slots.pending) timelineSlots.pending = slots.pending;
|
|
172
|
+
timelineSlots.item = (slotProps) => {
|
|
173
|
+
if (slots.item) return slots.item(slotProps);
|
|
174
|
+
if (isWorkflowTimelineItem(slotProps.item)) return renderStepContent(slotProps.item);
|
|
175
|
+
return null;
|
|
176
|
+
};
|
|
177
|
+
const actionBar = showActionBar.value && props.actions ? slots.actions ? slots.actions({ actions: props.actions }) : h(WorkflowActionBar, {
|
|
178
|
+
items: props.actions,
|
|
179
|
+
onAction: (item) => emit("action", item)
|
|
180
|
+
}) : null;
|
|
181
|
+
const {
|
|
182
|
+
class: _class,
|
|
183
|
+
style: _style,
|
|
184
|
+
"aria-label": ariaLabel,
|
|
185
|
+
...restAttrs
|
|
186
|
+
} = attrs;
|
|
187
|
+
return h(
|
|
188
|
+
"div",
|
|
189
|
+
{
|
|
190
|
+
...restAttrs,
|
|
191
|
+
class: rootClasses.value,
|
|
192
|
+
style: rootStyle.value
|
|
193
|
+
},
|
|
194
|
+
[
|
|
195
|
+
h(
|
|
196
|
+
Timeline,
|
|
197
|
+
{
|
|
198
|
+
items: timelineItems.value,
|
|
199
|
+
mode: props.mode,
|
|
200
|
+
pending: props.pending,
|
|
201
|
+
pendingDot: props.pendingDot,
|
|
202
|
+
reverse: props.reverse,
|
|
203
|
+
"aria-label": (typeof ariaLabel === "string" ? ariaLabel : void 0) ?? "Workflow timeline"
|
|
204
|
+
},
|
|
205
|
+
timelineSlots
|
|
206
|
+
),
|
|
207
|
+
actionBar
|
|
208
|
+
]
|
|
209
|
+
);
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
var WorkflowTimeline_default = WorkflowTimeline;
|
|
214
|
+
|
|
215
|
+
export {
|
|
216
|
+
WorkflowActionBar,
|
|
217
|
+
WorkflowTimeline,
|
|
218
|
+
WorkflowTimeline_default
|
|
219
|
+
};
|
|
@@ -3,8 +3,8 @@ import { defineComponent, h, computed } from "vue";
|
|
|
3
3
|
import {
|
|
4
4
|
classNames,
|
|
5
5
|
coerceClassValue,
|
|
6
|
+
getLayoutFooterClasses,
|
|
6
7
|
injectLayoutGridStyles,
|
|
7
|
-
layoutFooterClasses,
|
|
8
8
|
mergeStyleValues
|
|
9
9
|
} from "@expcat/tigercat-core";
|
|
10
10
|
var Footer = defineComponent({
|
|
@@ -23,6 +23,10 @@ var Footer = defineComponent({
|
|
|
23
23
|
type: String,
|
|
24
24
|
default: void 0
|
|
25
25
|
},
|
|
26
|
+
size: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: "default"
|
|
29
|
+
},
|
|
26
30
|
style: {
|
|
27
31
|
type: Object,
|
|
28
32
|
default: void 0
|
|
@@ -32,7 +36,7 @@ var Footer = defineComponent({
|
|
|
32
36
|
injectLayoutGridStyles();
|
|
33
37
|
const footerClasses = computed(
|
|
34
38
|
() => classNames(
|
|
35
|
-
|
|
39
|
+
getLayoutFooterClasses(props.size),
|
|
36
40
|
props.className,
|
|
37
41
|
coerceClassValue(attrs.class)
|
|
38
42
|
)
|
|
@@ -15,6 +15,10 @@ import {
|
|
|
15
15
|
} from "vue";
|
|
16
16
|
import { classNames, coerceClassValue } from "@expcat/tigercat-core";
|
|
17
17
|
import {
|
|
18
|
+
appendCalendarEventCountLabel,
|
|
19
|
+
buildCalendarDateCellExtra,
|
|
20
|
+
calendarDateCellDotClasses,
|
|
21
|
+
calendarDateCellExtraClasses,
|
|
18
22
|
calendarGridClasses,
|
|
19
23
|
calendarHeaderClasses,
|
|
20
24
|
calendarNavButtonClasses,
|
|
@@ -25,6 +29,7 @@ import {
|
|
|
25
29
|
followCalendarValue,
|
|
26
30
|
formatCalendarDayLabel,
|
|
27
31
|
formatCalendarDayNumber,
|
|
32
|
+
getCalendarEventDotStyle,
|
|
28
33
|
formatMonthYear,
|
|
29
34
|
getCalendarContainerClasses,
|
|
30
35
|
getCalendarDayClasses,
|
|
@@ -78,10 +83,11 @@ var Calendar = defineComponent({
|
|
|
78
83
|
default: void 0
|
|
79
84
|
},
|
|
80
85
|
locale: { type: Object, default: void 0 },
|
|
81
|
-
className: { type: String, default: void 0 }
|
|
86
|
+
className: { type: String, default: void 0 },
|
|
87
|
+
events: { type: Array, default: void 0 }
|
|
82
88
|
},
|
|
83
89
|
emits: ["update:modelValue", "update:mode", "change", "panel-change"],
|
|
84
|
-
setup(props, { emit, attrs, expose }) {
|
|
90
|
+
setup(props, { emit, attrs, expose, slots }) {
|
|
85
91
|
const config = useTigerConfig();
|
|
86
92
|
const mergedLocale = computed(() => mergeTigerLocale(config.value.locale, props.locale));
|
|
87
93
|
const localeCode = computed(() => mergedLocale.value?.locale);
|
|
@@ -351,6 +357,27 @@ var Calendar = defineComponent({
|
|
|
351
357
|
);
|
|
352
358
|
const isTodayDate = today.value ? isSameDay(date, today.value) : false;
|
|
353
359
|
const isDisabled = isCalendarDateDisabled(date, props.disabledDate);
|
|
360
|
+
const extra = buildCalendarDateCellExtra({
|
|
361
|
+
date,
|
|
362
|
+
events: props.events,
|
|
363
|
+
inCurrentMonth: isCurrentMonth,
|
|
364
|
+
today: isTodayDate,
|
|
365
|
+
selected: isSelected,
|
|
366
|
+
disabled: isDisabled
|
|
367
|
+
});
|
|
368
|
+
const customCell = slots.dateCell?.({ date, events: extra.events, extra });
|
|
369
|
+
const hasExtra = Boolean(customCell) || extra.events.length > 0;
|
|
370
|
+
const defaultDots = !customCell && extra.events.length > 0 ? h(
|
|
371
|
+
"span",
|
|
372
|
+
{ class: calendarDateCellExtraClasses, "aria-hidden": "true" },
|
|
373
|
+
extra.events.map(
|
|
374
|
+
(event, index) => h("span", {
|
|
375
|
+
key: event.key ?? `${extra.iso}-${index}`,
|
|
376
|
+
class: calendarDateCellDotClasses,
|
|
377
|
+
style: getCalendarEventDotStyle(event.color)
|
|
378
|
+
})
|
|
379
|
+
)
|
|
380
|
+
) : null;
|
|
354
381
|
return h(
|
|
355
382
|
"button",
|
|
356
383
|
{
|
|
@@ -358,7 +385,11 @@ var Calendar = defineComponent({
|
|
|
358
385
|
type: "button",
|
|
359
386
|
role: "gridcell",
|
|
360
387
|
"data-date": iso,
|
|
361
|
-
"aria-label":
|
|
388
|
+
"aria-label": appendCalendarEventCountLabel(
|
|
389
|
+
formatCalendarDayLabel(date, localeCode.value),
|
|
390
|
+
extra.events.length,
|
|
391
|
+
labels.value.eventCountText
|
|
392
|
+
),
|
|
362
393
|
"aria-selected": isSelected || isRangeStart || isRangeEnd,
|
|
363
394
|
"aria-current": isTodayDate ? "date" : void 0,
|
|
364
395
|
disabled: isDisabled,
|
|
@@ -371,12 +402,13 @@ var Calendar = defineComponent({
|
|
|
371
402
|
isActive: activeIso.value === iso,
|
|
372
403
|
isInRange,
|
|
373
404
|
isRangeStart,
|
|
374
|
-
isRangeEnd
|
|
405
|
+
isRangeEnd,
|
|
406
|
+
hasExtra
|
|
375
407
|
}),
|
|
376
408
|
onClick: () => selectDay(date),
|
|
377
409
|
onFocus: () => activeIso.value = iso
|
|
378
410
|
},
|
|
379
|
-
formatCalendarDayNumber(date, localeCode.value)
|
|
411
|
+
[formatCalendarDayNumber(date, localeCode.value), customCell ?? defaultDots]
|
|
380
412
|
);
|
|
381
413
|
})
|
|
382
414
|
)
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useDrag
|
|
3
|
+
} from "./chunk-DXL3YHRP.mjs";
|
|
4
|
+
|
|
5
|
+
// src/components/Drag.ts
|
|
6
|
+
import { computed, defineComponent, h } from "vue";
|
|
7
|
+
import {
|
|
8
|
+
classNames,
|
|
9
|
+
coerceClassValue,
|
|
10
|
+
reorderSequence
|
|
11
|
+
} from "@expcat/tigercat-core";
|
|
12
|
+
var Drag = defineComponent({
|
|
13
|
+
name: "TigerDrag",
|
|
14
|
+
inheritAttrs: false,
|
|
15
|
+
props: {
|
|
16
|
+
items: {
|
|
17
|
+
type: Array,
|
|
18
|
+
default: () => []
|
|
19
|
+
},
|
|
20
|
+
config: {
|
|
21
|
+
type: Object,
|
|
22
|
+
default: void 0
|
|
23
|
+
},
|
|
24
|
+
containerId: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: void 0
|
|
27
|
+
},
|
|
28
|
+
className: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: void 0
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
emits: ["update:items", "items-change", "drag-start", "drag-over", "drop", "drag-end"],
|
|
34
|
+
setup(props, { emit, slots, attrs }) {
|
|
35
|
+
const drag = useDrag(() => ({
|
|
36
|
+
config: props.config,
|
|
37
|
+
containerId: props.containerId,
|
|
38
|
+
onDragStart: (event) => emit("drag-start", event),
|
|
39
|
+
onDragOver: (event) => emit("drag-over", event),
|
|
40
|
+
onDragEnd: (event) => emit("drag-end", event),
|
|
41
|
+
onDrop: (event) => {
|
|
42
|
+
emit("drop", event);
|
|
43
|
+
if (event.fromIndex === event.toIndex) return;
|
|
44
|
+
const next = reorderSequence(props.items, event.fromIndex, event.toIndex).map(
|
|
45
|
+
(item, index) => ({ ...item, index })
|
|
46
|
+
);
|
|
47
|
+
emit("update:items", next);
|
|
48
|
+
emit("items-change", next);
|
|
49
|
+
}
|
|
50
|
+
}));
|
|
51
|
+
const rootClass = computed(
|
|
52
|
+
() => classNames(
|
|
53
|
+
"m-0 list-none p-0",
|
|
54
|
+
props.className,
|
|
55
|
+
coerceClassValue(attrs.class)
|
|
56
|
+
)
|
|
57
|
+
);
|
|
58
|
+
return () => {
|
|
59
|
+
const zone = drag.getDropZoneAttrs();
|
|
60
|
+
return h(
|
|
61
|
+
"ul",
|
|
62
|
+
{
|
|
63
|
+
...attrs,
|
|
64
|
+
...zone,
|
|
65
|
+
class: rootClass.value,
|
|
66
|
+
"data-tiger-drag": "",
|
|
67
|
+
role: "list"
|
|
68
|
+
},
|
|
69
|
+
props.items.map((item) => {
|
|
70
|
+
const itemAttrs = drag.getDragItemAttrs(item);
|
|
71
|
+
const isDragging = drag.draggedItem.value?.id === item.id;
|
|
72
|
+
const custom = slots.item?.({ item, attrs: itemAttrs, isDragging });
|
|
73
|
+
if (custom) return custom;
|
|
74
|
+
return h("li", { ...itemAttrs, key: item.id, role: "listitem" }, String(item.id));
|
|
75
|
+
})
|
|
76
|
+
);
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
var Drag_default = Drag;
|
|
81
|
+
|
|
82
|
+
export {
|
|
83
|
+
Drag,
|
|
84
|
+
Drag_default
|
|
85
|
+
};
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
getCodeLabels,
|
|
16
16
|
mergeStyleValues,
|
|
17
17
|
mergeTigerLocale,
|
|
18
|
+
renderCodeHighlightHtml,
|
|
18
19
|
resolveLocaleText
|
|
19
20
|
} from "@expcat/tigercat-core";
|
|
20
21
|
var Code = defineComponent({
|
|
@@ -29,6 +30,14 @@ var Code = defineComponent({
|
|
|
29
30
|
type: Boolean,
|
|
30
31
|
default: true
|
|
31
32
|
},
|
|
33
|
+
language: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: void 0
|
|
36
|
+
},
|
|
37
|
+
highlighter: {
|
|
38
|
+
type: Object,
|
|
39
|
+
default: void 0
|
|
40
|
+
},
|
|
32
41
|
copyLabel: {
|
|
33
42
|
type: String,
|
|
34
43
|
default: void 0
|
|
@@ -110,7 +119,19 @@ var Code = defineComponent({
|
|
|
110
119
|
style: mergeStyleValues(attrs.style, props.style)
|
|
111
120
|
},
|
|
112
121
|
[
|
|
113
|
-
h("pre", { class: codeBlockPreClasses }, [
|
|
122
|
+
h("pre", { class: codeBlockPreClasses }, [
|
|
123
|
+
(() => {
|
|
124
|
+
const highlighted = renderCodeHighlightHtml(
|
|
125
|
+
props.code,
|
|
126
|
+
props.language,
|
|
127
|
+
props.highlighter
|
|
128
|
+
);
|
|
129
|
+
return highlighted == null ? h("code", { class: "block" }, props.code) : h("code", {
|
|
130
|
+
class: "block",
|
|
131
|
+
innerHTML: highlighted
|
|
132
|
+
});
|
|
133
|
+
})()
|
|
134
|
+
]),
|
|
114
135
|
props.copyable ? h(
|
|
115
136
|
"button",
|
|
116
137
|
{
|
|
@@ -60,6 +60,8 @@ import {
|
|
|
60
60
|
mergeStyleValues,
|
|
61
61
|
mergeTigerLocale,
|
|
62
62
|
moveFocusInMenu,
|
|
63
|
+
resolveMenuSearchQuery,
|
|
64
|
+
shouldShowMenuSearch,
|
|
63
65
|
nextOpenKeys,
|
|
64
66
|
nextSelectedKeys,
|
|
65
67
|
reconcileSearchOpenKeys,
|
|
@@ -161,7 +163,7 @@ var Menu = defineComponent({
|
|
|
161
163
|
popupPortal: { type: Boolean, default: true },
|
|
162
164
|
className: { type: String, default: void 0 },
|
|
163
165
|
style: { type: Object, default: void 0 },
|
|
164
|
-
searchable: { type: Boolean, default: false },
|
|
166
|
+
searchable: { type: [Boolean, String], default: false },
|
|
165
167
|
searchValue: { type: String, default: void 0 },
|
|
166
168
|
defaultSearchValue: { type: String, default: "" },
|
|
167
169
|
searchPlaceholder: { type: String, default: void 0 },
|
|
@@ -225,10 +227,11 @@ var Menu = defineComponent({
|
|
|
225
227
|
emit("update:searchValue", value);
|
|
226
228
|
emit("search", value);
|
|
227
229
|
};
|
|
230
|
+
const showSearch = computed(() => shouldShowMenuSearch(props.searchable, collapsed.value));
|
|
228
231
|
const searchResult = computed(
|
|
229
232
|
() => resolveSearchFilter({
|
|
230
233
|
items: props.items,
|
|
231
|
-
query: currentSearchValue.value,
|
|
234
|
+
query: resolveMenuSearchQuery(props.searchable, collapsed.value, currentSearchValue.value),
|
|
232
235
|
filterMode: props.filterMode
|
|
233
236
|
})
|
|
234
237
|
);
|
|
@@ -348,7 +351,7 @@ var Menu = defineComponent({
|
|
|
348
351
|
...passthroughAttrs.value
|
|
349
352
|
},
|
|
350
353
|
[
|
|
351
|
-
|
|
354
|
+
showSearch.value ? h("div", { class: menuSearchFieldClasses }, [
|
|
352
355
|
h("input", {
|
|
353
356
|
type: "search",
|
|
354
357
|
value: currentSearchValue.value,
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useFullscreen
|
|
3
|
+
} from "./chunk-JUSJUVFQ.mjs";
|
|
4
|
+
import {
|
|
5
|
+
useTigerConfig
|
|
6
|
+
} from "./chunk-4GOTWNOO.mjs";
|
|
7
|
+
|
|
8
|
+
// src/components/FullscreenButton.ts
|
|
9
|
+
import { computed, defineComponent, h } from "vue";
|
|
10
|
+
import {
|
|
11
|
+
classNames,
|
|
12
|
+
coerceClassValue,
|
|
13
|
+
fullscreenButtonClasses,
|
|
14
|
+
getFullscreenLabels,
|
|
15
|
+
getIconDefinition,
|
|
16
|
+
mergeTigerLocale
|
|
17
|
+
} from "@expcat/tigercat-core";
|
|
18
|
+
function renderGlyph(name) {
|
|
19
|
+
const definition = getIconDefinition(name);
|
|
20
|
+
if (!definition) return void 0;
|
|
21
|
+
return h(
|
|
22
|
+
"svg",
|
|
23
|
+
{
|
|
24
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
25
|
+
viewBox: definition.viewBox,
|
|
26
|
+
fill: "none",
|
|
27
|
+
stroke: "currentColor",
|
|
28
|
+
"stroke-width": "1.5",
|
|
29
|
+
"stroke-linecap": "round",
|
|
30
|
+
"stroke-linejoin": "round",
|
|
31
|
+
class: "h-5 w-5",
|
|
32
|
+
"aria-hidden": "true"
|
|
33
|
+
},
|
|
34
|
+
definition.paths.map((d) => h("path", { d }))
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
var FullscreenButton = defineComponent({
|
|
38
|
+
name: "TigerFullscreenButton",
|
|
39
|
+
inheritAttrs: false,
|
|
40
|
+
props: {
|
|
41
|
+
target: {
|
|
42
|
+
type: [Object, Function],
|
|
43
|
+
default: void 0
|
|
44
|
+
},
|
|
45
|
+
locale: {
|
|
46
|
+
type: Object,
|
|
47
|
+
default: void 0
|
|
48
|
+
},
|
|
49
|
+
labels: {
|
|
50
|
+
type: Object,
|
|
51
|
+
default: void 0
|
|
52
|
+
},
|
|
53
|
+
className: {
|
|
54
|
+
type: String,
|
|
55
|
+
default: void 0
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
emits: ["change", "error"],
|
|
59
|
+
setup(props, { emit, attrs }) {
|
|
60
|
+
const config = useTigerConfig();
|
|
61
|
+
const labelSet = computed(
|
|
62
|
+
() => getFullscreenLabels(mergeTigerLocale(config.value.locale, props.locale), props.labels)
|
|
63
|
+
);
|
|
64
|
+
const fullscreen = useFullscreen(() => ({
|
|
65
|
+
target: props.target,
|
|
66
|
+
onChange: (next) => emit("change", next),
|
|
67
|
+
onError: (error) => emit("error", error)
|
|
68
|
+
}));
|
|
69
|
+
return () => {
|
|
70
|
+
const label = fullscreen.isFullscreen.value ? labelSet.value.exitAriaLabel : labelSet.value.enterAriaLabel;
|
|
71
|
+
return h(
|
|
72
|
+
"button",
|
|
73
|
+
{
|
|
74
|
+
...attrs,
|
|
75
|
+
type: "button",
|
|
76
|
+
class: classNames(
|
|
77
|
+
fullscreenButtonClasses,
|
|
78
|
+
props.className,
|
|
79
|
+
coerceClassValue(attrs.class)
|
|
80
|
+
),
|
|
81
|
+
"aria-label": label,
|
|
82
|
+
"aria-pressed": fullscreen.isFullscreen.value,
|
|
83
|
+
disabled: !fullscreen.supported,
|
|
84
|
+
onClick: () => {
|
|
85
|
+
void fullscreen.toggle();
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
renderGlyph(fullscreen.isFullscreen.value ? "fullscreen-exit" : "fullscreen")
|
|
89
|
+
);
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
var FullscreenButton_default = FullscreenButton;
|
|
94
|
+
|
|
95
|
+
export {
|
|
96
|
+
FullscreenButton,
|
|
97
|
+
FullscreenButton_default
|
|
98
|
+
};
|
|
@@ -187,9 +187,8 @@ var Anchor = defineComponent({
|
|
|
187
187
|
const config = useTigerConfig();
|
|
188
188
|
const mergedLocale = computed(() => mergeTigerLocale(config.value.locale, props.locale));
|
|
189
189
|
const labelSet = computed(() => getAnchorLabels(mergedLocale.value, props.labels));
|
|
190
|
-
const
|
|
191
|
-
|
|
192
|
-
);
|
|
190
|
+
const resolveContainer = () => resolveAnchorScrollContainer(props.getContainer, anchorRef.value);
|
|
191
|
+
const scrollLock = createProgrammaticScrollLock(() => resolveContainer());
|
|
193
192
|
const scrollOffset = computed(() => props.targetOffset ?? props.offsetTop);
|
|
194
193
|
const links = computed(() => sortAnchorHrefsByDocumentOrder(linkEntries.value));
|
|
195
194
|
const registerLink = (href, node) => {
|
|
@@ -217,7 +216,7 @@ var Anchor = defineComponent({
|
|
|
217
216
|
let stopObserver = null;
|
|
218
217
|
const setupObserver = () => {
|
|
219
218
|
stopObserver?.();
|
|
220
|
-
const container =
|
|
219
|
+
const container = resolveContainer();
|
|
221
220
|
const root = container === window ? null : container;
|
|
222
221
|
stopObserver = createAnchorObserver(links.value, {
|
|
223
222
|
offsetTop: scrollOffset.value,
|
|
@@ -230,7 +229,7 @@ var Anchor = defineComponent({
|
|
|
230
229
|
});
|
|
231
230
|
};
|
|
232
231
|
const scrollTo = (href) => {
|
|
233
|
-
scrollToAnchor(href,
|
|
232
|
+
scrollToAnchor(href, resolveContainer(), scrollOffset.value);
|
|
234
233
|
};
|
|
235
234
|
const handleLinkClick = (href, event, targetAttr) => {
|
|
236
235
|
const hasTargetElement = Boolean(getAnchorTargetElement(href));
|
|
@@ -263,7 +262,7 @@ var Anchor = defineComponent({
|
|
|
263
262
|
inkRef.value.style.width = next.width;
|
|
264
263
|
};
|
|
265
264
|
const resolvedKey = computed(() => {
|
|
266
|
-
const resolved = resolveScrollRoot(props.getContainer);
|
|
265
|
+
const resolved = resolveScrollRoot(props.getContainer, { from: anchorRef.value });
|
|
267
266
|
return resolved.isWindow ? "window" : resolved.target;
|
|
268
267
|
});
|
|
269
268
|
watch(activeLink, () => {
|