@expcat/tigercat-vue 2.2.0 → 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.
@@ -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
+ };
@@ -232,10 +232,10 @@ declare const CommentThread: vue.DefineComponent<vue.ExtractPropTypes<{
232
232
  };
233
233
  }>> & Readonly<{
234
234
  "onUpdate:expandedKeys"?: ((...args: any[]) => any) | undefined;
235
+ onAction?: ((...args: any[]) => any) | undefined;
235
236
  onLike?: ((...args: any[]) => any) | undefined;
236
237
  onReply?: ((...args: any[]) => any) | undefined;
237
238
  onMore?: ((...args: any[]) => any) | undefined;
238
- onAction?: ((...args: any[]) => any) | undefined;
239
239
  "onLoad-more"?: ((...args: any[]) => any) | undefined;
240
240
  "onUser-click"?: ((...args: any[]) => any) | undefined;
241
241
  }>, {
@@ -181,9 +181,9 @@ declare const FormWizard: vue.DefineComponent<vue.ExtractPropTypes<{
181
181
  simple: boolean;
182
182
  bordered: boolean;
183
183
  defaultCurrent: number;
184
+ showActions: boolean;
184
185
  clickable: boolean;
185
186
  showSteps: boolean;
186
- showActions: boolean;
187
187
  beforeNext: FormWizardValidator;
188
188
  autoSave: (current: number, step: WizardStep) => void | Promise<void>;
189
189
  }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
@@ -0,0 +1,150 @@
1
+ import * as vue from 'vue';
2
+ import { PropType } from 'vue';
3
+ import { WorkflowActionBarProps as WorkflowActionBarProps$1, WorkflowTimelineProps as WorkflowTimelineProps$1, WorkflowActionBarItem, WorkflowTimelineStep, TimelineMode } from '@expcat/tigercat-core';
4
+
5
+ interface VueWorkflowActionBarProps extends WorkflowActionBarProps$1 {
6
+ style?: Record<string, unknown>;
7
+ }
8
+ interface VueWorkflowTimelineProps extends WorkflowTimelineProps$1 {
9
+ style?: Record<string, unknown>;
10
+ }
11
+ type WorkflowActionBarProps = VueWorkflowActionBarProps;
12
+ type WorkflowTimelineProps = VueWorkflowTimelineProps;
13
+ declare const WorkflowActionBar: vue.DefineComponent<vue.ExtractPropTypes<{
14
+ items: {
15
+ type: PropType<WorkflowActionBarItem[]>;
16
+ default: undefined;
17
+ };
18
+ disabled: BooleanConstructor;
19
+ ariaLabel: {
20
+ type: StringConstructor;
21
+ default: undefined;
22
+ };
23
+ className: {
24
+ type: StringConstructor;
25
+ default: undefined;
26
+ };
27
+ style: {
28
+ type: PropType<Record<string, unknown>>;
29
+ default: undefined;
30
+ };
31
+ }>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
32
+ [key: string]: any;
33
+ }>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, "action"[], "action", vue.PublicProps, Readonly<vue.ExtractPropTypes<{
34
+ items: {
35
+ type: PropType<WorkflowActionBarItem[]>;
36
+ default: undefined;
37
+ };
38
+ disabled: BooleanConstructor;
39
+ ariaLabel: {
40
+ type: StringConstructor;
41
+ default: undefined;
42
+ };
43
+ className: {
44
+ type: StringConstructor;
45
+ default: undefined;
46
+ };
47
+ style: {
48
+ type: PropType<Record<string, unknown>>;
49
+ default: undefined;
50
+ };
51
+ }>> & Readonly<{
52
+ onAction?: ((...args: any[]) => any) | undefined;
53
+ }>, {
54
+ style: Record<string, unknown>;
55
+ ariaLabel: string;
56
+ className: string;
57
+ disabled: boolean;
58
+ items: WorkflowActionBarItem[];
59
+ }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
60
+ declare const WorkflowTimeline: vue.DefineComponent<vue.ExtractPropTypes<{
61
+ steps: {
62
+ type: PropType<WorkflowTimelineStep[]>;
63
+ default: undefined;
64
+ };
65
+ actions: {
66
+ type: PropType<WorkflowActionBarItem[]>;
67
+ default: undefined;
68
+ };
69
+ showActions: {
70
+ type: BooleanConstructor;
71
+ default: undefined;
72
+ };
73
+ mode: {
74
+ type: PropType<TimelineMode>;
75
+ default: TimelineMode;
76
+ };
77
+ pending: {
78
+ type: BooleanConstructor;
79
+ default: boolean;
80
+ };
81
+ pendingDot: {
82
+ type: PropType<unknown>;
83
+ default: undefined;
84
+ };
85
+ reverse: {
86
+ type: BooleanConstructor;
87
+ default: boolean;
88
+ };
89
+ className: {
90
+ type: StringConstructor;
91
+ default: undefined;
92
+ };
93
+ style: {
94
+ type: PropType<Record<string, unknown>>;
95
+ default: undefined;
96
+ };
97
+ }>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
98
+ [key: string]: any;
99
+ }>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, "action"[], "action", vue.PublicProps, Readonly<vue.ExtractPropTypes<{
100
+ steps: {
101
+ type: PropType<WorkflowTimelineStep[]>;
102
+ default: undefined;
103
+ };
104
+ actions: {
105
+ type: PropType<WorkflowActionBarItem[]>;
106
+ default: undefined;
107
+ };
108
+ showActions: {
109
+ type: BooleanConstructor;
110
+ default: undefined;
111
+ };
112
+ mode: {
113
+ type: PropType<TimelineMode>;
114
+ default: TimelineMode;
115
+ };
116
+ pending: {
117
+ type: BooleanConstructor;
118
+ default: boolean;
119
+ };
120
+ pendingDot: {
121
+ type: PropType<unknown>;
122
+ default: undefined;
123
+ };
124
+ reverse: {
125
+ type: BooleanConstructor;
126
+ default: boolean;
127
+ };
128
+ className: {
129
+ type: StringConstructor;
130
+ default: undefined;
131
+ };
132
+ style: {
133
+ type: PropType<Record<string, unknown>>;
134
+ default: undefined;
135
+ };
136
+ }>> & Readonly<{
137
+ onAction?: ((...args: any[]) => any) | undefined;
138
+ }>, {
139
+ steps: WorkflowTimelineStep[];
140
+ reverse: boolean;
141
+ mode: TimelineMode;
142
+ style: Record<string, unknown>;
143
+ className: string;
144
+ pending: boolean;
145
+ actions: WorkflowActionBarItem[];
146
+ pendingDot: undefined;
147
+ showActions: boolean;
148
+ }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
149
+
150
+ export { type VueWorkflowActionBarProps, type VueWorkflowTimelineProps, WorkflowActionBar, type WorkflowActionBarProps, WorkflowTimeline, type WorkflowTimelineProps, WorkflowTimeline as default };
@@ -0,0 +1,15 @@
1
+ import {
2
+ WorkflowActionBar,
3
+ WorkflowTimeline,
4
+ WorkflowTimeline_default
5
+ } from "../chunk-2WUDJQT7.mjs";
6
+ import "../chunk-K46SNCCE.mjs";
7
+ import "../chunk-7PLYHGMY.mjs";
8
+ import "../chunk-4KIZXFFG.mjs";
9
+ import "../chunk-4QMHNTUU.mjs";
10
+ import "../chunk-4GOTWNOO.mjs";
11
+ export {
12
+ WorkflowActionBar,
13
+ WorkflowTimeline,
14
+ WorkflowTimeline_default as default
15
+ };
package/dist/index.d.mts CHANGED
@@ -63,6 +63,7 @@ export { ImageAnnotation, VueImageAnnotationProps } from './components/ImageAnno
63
63
  export { List, ListProps, VueListProps } from './components/List.mjs';
64
64
  export { Descriptions, DescriptionsProps, VueDescriptionsProps } from './components/Descriptions.mjs';
65
65
  export { Timeline, TimelineProps, VueTimelineProps } from './components/Timeline.mjs';
66
+ export { VueWorkflowActionBarProps, VueWorkflowTimelineProps, WorkflowActionBar, WorkflowActionBarProps, WorkflowTimeline, WorkflowTimelineProps } from './components/WorkflowTimeline.mjs';
66
67
  export { Countdown, CountdownProps, VueCountdownProps } from './components/Countdown.mjs';
67
68
  export { Tree, TreeProps, VueTreeProps } from './components/Tree.mjs';
68
69
  export { Skeleton, VueSkeletonProps } from './components/Skeleton.mjs';
@@ -171,6 +172,6 @@ import 'vue';
171
172
  * Vue 3 components for Tigercat UI library
172
173
  */
173
174
 
174
- declare const version = "2.2.0";
175
+ declare const version = "2.3.0";
175
176
 
176
177
  export { version };
package/dist/index.mjs CHANGED
@@ -136,6 +136,8 @@ export {
136
136
  EMPTY_TREE_KEYS,
137
137
  EMPTY_VIRTUAL_TABLE_COLUMNS,
138
138
  EMPTY_VIRTUAL_TABLE_ROWS,
139
+ EMPTY_WORKFLOW_ACTION_BAR_ITEMS,
140
+ EMPTY_WORKFLOW_TIMELINE_STEPS,
139
141
  EN_US_DATEPICKER_LOCALE,
140
142
  FORM_VALIDATION_PRESETS,
141
143
  FormValidationCancelledError,
@@ -265,6 +267,11 @@ export {
265
267
  VIEW_TRANSITION_CSS,
266
268
  VIRTUAL_TABLE_HEADER_ROW_HEIGHT,
267
269
  WATERMARK_DEFAULT_INK,
270
+ WORKFLOW_STEP_STATUSES,
271
+ WORKFLOW_STEP_STATUS_COLORS,
272
+ WORKFLOW_STEP_STATUS_LABELS,
273
+ WORKFLOW_STEP_STATUS_TAG_VARIANTS,
274
+ WORKFLOW_TERMINAL_STEP_STATUSES,
268
275
  activateScrollSpyClick,
269
276
  activeOpacityClasses,
270
277
  activePressClasses,
@@ -743,6 +750,7 @@ export {
743
750
  countDecimalPlaces,
744
751
  countLines,
745
752
  countMaskTokens,
753
+ countWorkflowStepsByStatus,
746
754
  countdownBaseClasses,
747
755
  countdownPrefixClasses,
748
756
  countdownSuffixClasses,
@@ -1001,6 +1009,7 @@ export {
1001
1009
  filterHiddenColumns,
1002
1010
  filterHiddenFiles,
1003
1011
  filterMentionOptions,
1012
+ filterMenuByPermission,
1004
1013
  filterMenuItems,
1005
1014
  filterOptions,
1006
1015
  filterTableData,
@@ -1343,6 +1352,7 @@ export {
1343
1352
  getCropperHandleStyle,
1344
1353
  getCurrentActiveTourStep,
1345
1354
  getCurrentTime,
1355
+ getCurrentWorkflowStep,
1346
1356
  getCyclicIndex,
1347
1357
  getDataExportCellValue,
1348
1358
  getDataExportFormatLabel,
@@ -2314,6 +2324,11 @@ export {
2314
2324
  isValidUrl,
2315
2325
  isVirtualTableCellControlTarget,
2316
2326
  isWipExceeded,
2327
+ isWorkflowStepActive,
2328
+ isWorkflowStepPending,
2329
+ isWorkflowStepTerminal,
2330
+ isWorkflowTimelineStepStatus,
2331
+ isWorkflowTimelineTerminal,
2317
2332
  kanbanAddColumnClasses,
2318
2333
  kanbanCardCountClasses,
2319
2334
  kanbanFilterHighlightClasses,
@@ -2457,6 +2472,7 @@ export {
2457
2472
  menuKeyId,
2458
2473
  menuLightThemeClasses,
2459
2474
  menuModeClasses,
2475
+ menuSchemaToMenuItems,
2460
2476
  menuSearchEmptyClasses,
2461
2477
  menuSearchFieldClasses,
2462
2478
  menuSearchInputClasses,
@@ -2564,6 +2580,7 @@ export {
2564
2580
  normalizeSvgAttrs,
2565
2581
  normalizeTabKey,
2566
2582
  normalizeTreeSelectValue,
2583
+ normalizeWorkflowTimelineSteps,
2567
2584
  notificationActionButtonClasses,
2568
2585
  notificationActionButtonTypeClasses,
2569
2586
  notificationActionsClasses,
@@ -3034,6 +3051,8 @@ export {
3034
3051
  resolveVirtualTableWidth,
3035
3052
  resolveVisibleResizeHandles,
3036
3053
  resolveWatermarkFont,
3054
+ resolveWorkflowActionButtonProps,
3055
+ resolveWorkflowStepStatus,
3037
3056
  restoreFocus,
3038
3057
  resultBaseClasses,
3039
3058
  resultExtraClasses,
@@ -3169,6 +3188,7 @@ export {
3169
3188
  shouldShowMenuSearch,
3170
3189
  shouldShowSelectClear,
3171
3190
  shouldShowTreeSelectClear,
3191
+ shouldShowWorkflowActions,
3172
3192
  shouldSkipNavigationMenuOpenDelay,
3173
3193
  shouldSkipTableLocalProcessing,
3174
3194
  shouldTrackChartPointer,
@@ -3223,6 +3243,7 @@ export {
3223
3243
  sortDescendingIcon,
3224
3244
  sortFileItems,
3225
3245
  sortNotificationGroups,
3246
+ sortWorkflowTimelineSteps,
3226
3247
  sparklesIcon,
3227
3248
  splitButtonDropdownClasses,
3228
3249
  splitButtonPrimaryBlockClasses,
@@ -3565,6 +3586,11 @@ export {
3565
3586
  watermarkWrapperClasses,
3566
3587
  wifiIcon,
3567
3588
  withCropFile,
3589
+ workflowStepHighlight,
3590
+ workflowStepStatusColor,
3591
+ workflowStepStatusLabel,
3592
+ workflowStepStatusTagVariant,
3593
+ workflowStepsToTimelineItems,
3568
3594
  writeCommentLikeOverlay,
3569
3595
  yieldDataExportFrame,
3570
3596
  zoomInIcon,
@@ -3635,6 +3661,7 @@ export { ImageAnnotation } from './components/ImageAnnotation.mjs';
3635
3661
  export { List } from './components/List.mjs';
3636
3662
  export { Descriptions } from './components/Descriptions.mjs';
3637
3663
  export { Timeline } from './components/Timeline.mjs';
3664
+ export { WorkflowTimeline, WorkflowActionBar } from './components/WorkflowTimeline.mjs';
3638
3665
  export { Countdown } from './components/Countdown.mjs';
3639
3666
  export { Tree } from './components/Tree.mjs';
3640
3667
  export { Skeleton } from './components/Skeleton.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expcat/tigercat-vue",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "description": "Vue 3 components for Tigercat UI library",
5
5
  "license": "MIT",
6
6
  "author": "Yizhe Wang",
@@ -905,6 +905,16 @@
905
905
  "import": "./dist/components/Watermark.mjs",
906
906
  "default": "./dist/components/Watermark.mjs"
907
907
  },
908
+ "./WorkflowActionBar": {
909
+ "types": "./dist/components/WorkflowTimeline.d.mts",
910
+ "import": "./dist/components/WorkflowTimeline.mjs",
911
+ "default": "./dist/components/WorkflowTimeline.mjs"
912
+ },
913
+ "./WorkflowTimeline": {
914
+ "types": "./dist/components/WorkflowTimeline.d.mts",
915
+ "import": "./dist/components/WorkflowTimeline.mjs",
916
+ "default": "./dist/components/WorkflowTimeline.mjs"
917
+ },
908
918
  "./useDrag": {
909
919
  "types": "./dist/composables/useDrag.d.mts",
910
920
  "import": "./dist/composables/useDrag.mjs",
@@ -923,7 +933,7 @@
923
933
  "access": "public"
924
934
  },
925
935
  "dependencies": {
926
- "@expcat/tigercat-core": "2.2.0"
936
+ "@expcat/tigercat-core": "2.3.0"
927
937
  },
928
938
  "devDependencies": {
929
939
  "@types/node": "^26.1.1",