@expcat/tigercat-vue 0.3.69 → 0.4.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-53M2BTB5.mjs +22 -0
- package/dist/chunk-7AFJ7TKW.js +266 -0
- package/dist/chunk-GNKXBRXH.js +189 -0
- package/dist/chunk-HFBRO2IF.mjs +440 -0
- package/dist/chunk-HTMTOXUO.mjs +186 -0
- package/dist/chunk-K2U3FEL7.js +373 -0
- package/dist/chunk-K6HDRMPN.js +197 -0
- package/dist/chunk-LDCTSE6Y.mjs +60 -0
- package/dist/chunk-LNWRZKX2.js +64 -0
- package/dist/chunk-MB7W46IY.mjs +193 -0
- package/dist/chunk-MMQ34S5M.mjs +263 -0
- package/dist/chunk-PNKVD2UK.js +26 -0
- package/dist/chunk-T77L326M.mjs +370 -0
- package/dist/chunk-YQGKXFV5.js +443 -0
- package/dist/components/ActivityFeed.d.mts +1 -1
- package/dist/components/ActivityFeed.d.ts +1 -1
- package/dist/components/ActivityFeed.js +5 -4
- package/dist/components/ActivityFeed.mjs +3 -2
- package/dist/components/Alert.d.mts +1 -1
- package/dist/components/Alert.d.ts +1 -1
- package/dist/components/Alert.js +1 -0
- package/dist/components/Alert.mjs +1 -0
- package/dist/components/Anchor.d.mts +5 -5
- package/dist/components/Anchor.d.ts +5 -5
- package/dist/components/Anchor.js +1 -0
- package/dist/components/Anchor.mjs +1 -0
- package/dist/components/AnchorLink.d.mts +1 -1
- package/dist/components/AnchorLink.d.ts +1 -1
- package/dist/components/AnchorLink.js +1 -0
- package/dist/components/AnchorLink.mjs +1 -0
- package/dist/components/AreaChart.js +1 -0
- package/dist/components/AreaChart.mjs +1 -0
- package/dist/components/Avatar.d.mts +2 -2
- package/dist/components/Avatar.d.ts +2 -2
- package/dist/components/Avatar.js +1 -0
- package/dist/components/Avatar.mjs +1 -0
- package/dist/components/BackTop.d.mts +1 -1
- package/dist/components/BackTop.d.ts +1 -1
- package/dist/components/BackTop.js +1 -0
- package/dist/components/BackTop.mjs +1 -0
- package/dist/components/Badge.d.mts +1 -1
- package/dist/components/Badge.d.ts +1 -1
- package/dist/components/Badge.js +1 -0
- package/dist/components/Badge.mjs +1 -0
- package/dist/components/BarChart.js +1 -0
- package/dist/components/BarChart.mjs +1 -0
- package/dist/components/Breadcrumb.d.mts +1 -1
- package/dist/components/Breadcrumb.d.ts +1 -1
- package/dist/components/Breadcrumb.js +1 -0
- package/dist/components/Breadcrumb.mjs +1 -0
- package/dist/components/BreadcrumbItem.d.mts +1 -1
- package/dist/components/BreadcrumbItem.d.ts +1 -1
- package/dist/components/BreadcrumbItem.js +1 -0
- package/dist/components/BreadcrumbItem.mjs +1 -0
- package/dist/components/Button.d.mts +2 -2
- package/dist/components/Button.d.ts +2 -2
- package/dist/components/Button.js +1 -0
- package/dist/components/Button.mjs +1 -0
- package/dist/components/Card.d.mts +1 -1
- package/dist/components/Card.d.ts +1 -1
- package/dist/components/Card.js +1 -0
- package/dist/components/Card.mjs +1 -0
- package/dist/components/Carousel.d.mts +2 -2
- package/dist/components/Carousel.d.ts +2 -2
- package/dist/components/Carousel.js +1 -0
- package/dist/components/Carousel.mjs +1 -0
- package/dist/components/ChartAxis.d.mts +1 -1
- package/dist/components/ChartAxis.d.ts +1 -1
- package/dist/components/ChartAxis.js +1 -0
- package/dist/components/ChartAxis.mjs +1 -0
- package/dist/components/ChartCanvas.js +1 -0
- package/dist/components/ChartCanvas.mjs +1 -0
- package/dist/components/ChartGrid.d.mts +2 -2
- package/dist/components/ChartGrid.d.ts +2 -2
- package/dist/components/ChartGrid.js +1 -0
- package/dist/components/ChartGrid.mjs +1 -0
- package/dist/components/ChartLegend.js +1 -0
- package/dist/components/ChartLegend.mjs +1 -0
- package/dist/components/ChartSeries.js +1 -0
- package/dist/components/ChartSeries.mjs +1 -0
- package/dist/components/ChartTooltip.d.mts +1 -1
- package/dist/components/ChartTooltip.d.ts +1 -1
- package/dist/components/ChartTooltip.js +1 -0
- package/dist/components/ChartTooltip.mjs +1 -0
- package/dist/components/ChatWindow.d.mts +1 -1
- package/dist/components/ChatWindow.d.ts +1 -1
- package/dist/components/ChatWindow.js +1 -0
- package/dist/components/ChatWindow.mjs +1 -0
- package/dist/components/Checkbox.js +1 -0
- package/dist/components/Checkbox.mjs +1 -0
- package/dist/components/CheckboxGroup.js +1 -0
- package/dist/components/CheckboxGroup.mjs +1 -0
- package/dist/components/Code.d.mts +1 -1
- package/dist/components/Code.d.ts +1 -1
- package/dist/components/Code.js +1 -0
- package/dist/components/Code.mjs +1 -0
- package/dist/components/Col.js +1 -0
- package/dist/components/Col.mjs +1 -0
- package/dist/components/Collapse.d.mts +2 -2
- package/dist/components/Collapse.d.ts +2 -2
- package/dist/components/Collapse.js +1 -0
- package/dist/components/Collapse.mjs +1 -0
- package/dist/components/CollapsePanel.d.mts +2 -2
- package/dist/components/CollapsePanel.d.ts +2 -2
- package/dist/components/CollapsePanel.js +1 -0
- package/dist/components/CollapsePanel.mjs +1 -0
- package/dist/components/CommentThread.d.mts +1 -1
- package/dist/components/CommentThread.d.ts +1 -1
- package/dist/components/CommentThread.js +1 -0
- package/dist/components/CommentThread.mjs +1 -0
- package/dist/components/ConfigProvider.js +1 -0
- package/dist/components/ConfigProvider.mjs +1 -0
- package/dist/components/Container.js +1 -0
- package/dist/components/Container.mjs +1 -0
- package/dist/components/Content.d.mts +1 -1
- package/dist/components/Content.d.ts +1 -1
- package/dist/components/Content.js +1 -0
- package/dist/components/Content.mjs +1 -0
- package/dist/components/CropUpload.d.mts +97 -0
- package/dist/components/CropUpload.d.ts +97 -0
- package/dist/components/CropUpload.js +20 -0
- package/dist/components/CropUpload.mjs +5 -0
- package/dist/components/DataTableWithToolbar.d.mts +3 -3
- package/dist/components/DataTableWithToolbar.d.ts +3 -3
- package/dist/components/DataTableWithToolbar.js +1 -0
- package/dist/components/DataTableWithToolbar.mjs +1 -0
- package/dist/components/DatePicker.d.mts +1 -1
- package/dist/components/DatePicker.d.ts +1 -1
- package/dist/components/DatePicker.js +1 -0
- package/dist/components/DatePicker.mjs +1 -0
- package/dist/components/Descriptions.d.mts +1 -1
- package/dist/components/Descriptions.d.ts +1 -1
- package/dist/components/Descriptions.js +1 -0
- package/dist/components/Descriptions.mjs +1 -0
- package/dist/components/Divider.js +1 -0
- package/dist/components/Divider.mjs +1 -0
- package/dist/components/DonutChart.js +1 -0
- package/dist/components/DonutChart.mjs +1 -0
- package/dist/components/Drawer.d.mts +5 -5
- package/dist/components/Drawer.d.ts +5 -5
- package/dist/components/Drawer.js +1 -0
- package/dist/components/Drawer.mjs +1 -0
- package/dist/components/Dropdown.d.mts +1 -1
- package/dist/components/Dropdown.d.ts +1 -1
- package/dist/components/Dropdown.js +1 -0
- package/dist/components/Dropdown.mjs +1 -0
- package/dist/components/DropdownItem.d.mts +1 -1
- package/dist/components/DropdownItem.d.ts +1 -1
- package/dist/components/DropdownItem.js +1 -0
- package/dist/components/DropdownItem.mjs +1 -0
- package/dist/components/DropdownMenu.d.mts +1 -1
- package/dist/components/DropdownMenu.d.ts +1 -1
- package/dist/components/DropdownMenu.js +1 -0
- package/dist/components/DropdownMenu.mjs +1 -0
- package/dist/components/Footer.d.mts +1 -1
- package/dist/components/Footer.d.ts +1 -1
- package/dist/components/Footer.js +1 -0
- package/dist/components/Footer.mjs +1 -0
- package/dist/components/Form.js +1 -0
- package/dist/components/Form.mjs +1 -0
- package/dist/components/FormItem.js +1 -0
- package/dist/components/FormItem.mjs +1 -0
- package/dist/components/FormWizard.d.mts +3 -3
- package/dist/components/FormWizard.d.ts +3 -3
- package/dist/components/FormWizard.js +1 -0
- package/dist/components/FormWizard.mjs +1 -0
- package/dist/components/Header.d.mts +1 -1
- package/dist/components/Header.d.ts +1 -1
- package/dist/components/Header.js +1 -0
- package/dist/components/Header.mjs +1 -0
- package/dist/components/Icon.js +1 -0
- package/dist/components/Icon.mjs +1 -0
- package/dist/components/Image.d.mts +119 -0
- package/dist/components/Image.d.ts +119 -0
- package/dist/components/Image.js +22 -0
- package/dist/components/Image.mjs +3 -0
- package/dist/components/ImageCropper.d.mts +105 -0
- package/dist/components/ImageCropper.d.ts +105 -0
- package/dist/components/ImageCropper.js +17 -0
- package/dist/components/ImageCropper.mjs +2 -0
- package/dist/components/ImageGroup.d.mts +30 -0
- package/dist/components/ImageGroup.d.ts +30 -0
- package/dist/components/ImageGroup.js +22 -0
- package/dist/components/ImageGroup.mjs +3 -0
- package/dist/components/ImagePreview.d.mts +97 -0
- package/dist/components/ImagePreview.d.ts +97 -0
- package/dist/components/ImagePreview.js +17 -0
- package/dist/components/ImagePreview.mjs +5 -0
- package/dist/components/Input.d.mts +1 -1
- package/dist/components/Input.d.ts +1 -1
- package/dist/components/Input.js +1 -0
- package/dist/components/Input.mjs +1 -0
- package/dist/components/Layout.d.mts +1 -1
- package/dist/components/Layout.d.ts +1 -1
- package/dist/components/Layout.js +1 -0
- package/dist/components/Layout.mjs +1 -0
- package/dist/components/LineChart.js +1 -0
- package/dist/components/LineChart.mjs +1 -0
- package/dist/components/Link.js +1 -0
- package/dist/components/Link.mjs +1 -0
- package/dist/components/List.d.mts +2 -2
- package/dist/components/List.d.ts +2 -2
- package/dist/components/List.js +1 -0
- package/dist/components/List.mjs +1 -0
- package/dist/components/Loading.d.mts +2 -2
- package/dist/components/Loading.d.ts +2 -2
- package/dist/components/Loading.js +1 -0
- package/dist/components/Loading.mjs +1 -0
- package/dist/components/Menu.d.mts +1 -1
- package/dist/components/Menu.d.ts +1 -1
- package/dist/components/Menu.js +1 -0
- package/dist/components/Menu.mjs +1 -0
- package/dist/components/MenuItem.d.mts +1 -1
- package/dist/components/MenuItem.d.ts +1 -1
- package/dist/components/MenuItem.js +1 -0
- package/dist/components/MenuItem.mjs +1 -0
- package/dist/components/MenuItemGroup.d.mts +1 -1
- package/dist/components/MenuItemGroup.d.ts +1 -1
- package/dist/components/MenuItemGroup.js +1 -0
- package/dist/components/MenuItemGroup.mjs +1 -0
- package/dist/components/Message.js +1 -0
- package/dist/components/Message.mjs +1 -0
- package/dist/components/Modal.d.mts +5 -5
- package/dist/components/Modal.d.ts +5 -5
- package/dist/components/Modal.js +1 -0
- package/dist/components/Modal.mjs +1 -0
- package/dist/components/Notification.js +1 -0
- package/dist/components/Notification.mjs +1 -0
- package/dist/components/NotificationCenter.d.mts +1 -1
- package/dist/components/NotificationCenter.d.ts +1 -1
- package/dist/components/NotificationCenter.js +1 -0
- package/dist/components/NotificationCenter.mjs +1 -0
- package/dist/components/Pagination.d.mts +2 -2
- package/dist/components/Pagination.d.ts +2 -2
- package/dist/components/Pagination.js +1 -0
- package/dist/components/Pagination.mjs +1 -0
- package/dist/components/PieChart.js +1 -0
- package/dist/components/PieChart.mjs +1 -0
- package/dist/components/Popconfirm.d.mts +1 -1
- package/dist/components/Popconfirm.d.ts +1 -1
- package/dist/components/Popconfirm.js +1 -0
- package/dist/components/Popconfirm.mjs +1 -0
- package/dist/components/Popover.d.mts +3 -3
- package/dist/components/Popover.d.ts +3 -3
- package/dist/components/Popover.js +1 -0
- package/dist/components/Popover.mjs +1 -0
- package/dist/components/Progress.d.mts +4 -4
- package/dist/components/Progress.d.ts +4 -4
- package/dist/components/Progress.js +1 -0
- package/dist/components/Progress.mjs +1 -0
- package/dist/components/RadarChart.js +1 -0
- package/dist/components/RadarChart.mjs +1 -0
- package/dist/components/Radio.js +1 -0
- package/dist/components/Radio.mjs +1 -0
- package/dist/components/RadioGroup.js +1 -0
- package/dist/components/RadioGroup.mjs +1 -0
- package/dist/components/Row.js +1 -0
- package/dist/components/Row.mjs +1 -0
- package/dist/components/ScatterChart.js +1 -0
- package/dist/components/ScatterChart.mjs +1 -0
- package/dist/components/Select.d.mts +1 -1
- package/dist/components/Select.d.ts +1 -1
- package/dist/components/Select.js +1 -0
- package/dist/components/Select.mjs +1 -0
- package/dist/components/Sidebar.d.mts +1 -1
- package/dist/components/Sidebar.d.ts +1 -1
- package/dist/components/Sidebar.js +1 -0
- package/dist/components/Sidebar.mjs +1 -0
- package/dist/components/Skeleton.d.mts +1 -1
- package/dist/components/Skeleton.d.ts +1 -1
- package/dist/components/Skeleton.js +1 -0
- package/dist/components/Skeleton.mjs +1 -0
- package/dist/components/Slider.d.mts +1 -1
- package/dist/components/Slider.d.ts +1 -1
- package/dist/components/Slider.js +1 -0
- package/dist/components/Slider.mjs +1 -0
- package/dist/components/Space.d.mts +1 -1
- package/dist/components/Space.d.ts +1 -1
- package/dist/components/Space.js +1 -0
- package/dist/components/Space.mjs +1 -0
- package/dist/components/Steps.d.mts +2 -2
- package/dist/components/Steps.d.ts +2 -2
- package/dist/components/Steps.js +1 -0
- package/dist/components/Steps.mjs +1 -0
- package/dist/components/StepsItem.d.mts +1 -1
- package/dist/components/StepsItem.d.ts +1 -1
- package/dist/components/StepsItem.js +1 -0
- package/dist/components/StepsItem.mjs +1 -0
- package/dist/components/SubMenu.d.mts +1 -1
- package/dist/components/SubMenu.d.ts +1 -1
- package/dist/components/SubMenu.js +1 -0
- package/dist/components/SubMenu.mjs +1 -0
- package/dist/components/Switch.js +1 -0
- package/dist/components/Switch.mjs +1 -0
- package/dist/components/TabPane.d.mts +1 -1
- package/dist/components/TabPane.d.ts +1 -1
- package/dist/components/TabPane.js +1 -0
- package/dist/components/TabPane.mjs +1 -0
- package/dist/components/Table.js +1 -0
- package/dist/components/Table.mjs +1 -0
- package/dist/components/Tabs.d.mts +1 -1
- package/dist/components/Tabs.d.ts +1 -1
- package/dist/components/Tabs.js +1 -0
- package/dist/components/Tabs.mjs +1 -0
- package/dist/components/Tag.d.mts +1 -1
- package/dist/components/Tag.d.ts +1 -1
- package/dist/components/Tag.js +1 -0
- package/dist/components/Tag.mjs +1 -0
- package/dist/components/TaskBoard.d.mts +129 -0
- package/dist/components/TaskBoard.d.ts +129 -0
- package/dist/components/TaskBoard.js +18 -0
- package/dist/components/TaskBoard.mjs +3 -0
- package/dist/components/Text.js +1 -0
- package/dist/components/Text.mjs +1 -0
- package/dist/components/Textarea.d.mts +1 -1
- package/dist/components/Textarea.d.ts +1 -1
- package/dist/components/Textarea.js +1 -0
- package/dist/components/Textarea.mjs +1 -0
- package/dist/components/TimePicker.d.mts +2 -2
- package/dist/components/TimePicker.d.ts +2 -2
- package/dist/components/TimePicker.js +1 -0
- package/dist/components/TimePicker.mjs +1 -0
- package/dist/components/Timeline.d.mts +2 -2
- package/dist/components/Timeline.d.ts +2 -2
- package/dist/components/Timeline.js +1 -0
- package/dist/components/Timeline.mjs +1 -0
- package/dist/components/Tooltip.d.mts +1 -1
- package/dist/components/Tooltip.d.ts +1 -1
- package/dist/components/Tooltip.js +1 -0
- package/dist/components/Tooltip.mjs +1 -0
- package/dist/components/Tree.js +1 -0
- package/dist/components/Tree.mjs +1 -0
- package/dist/components/Upload.d.mts +3 -3
- package/dist/components/Upload.d.ts +3 -3
- package/dist/components/Upload.js +1 -0
- package/dist/components/Upload.mjs +1 -0
- package/dist/index.d.mts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +103 -70
- package/dist/index.mjs +27 -17
- package/package.json +2 -2
- package/dist/{chunk-RVEEEDJQ.mjs → chunk-D7VMY6WX.mjs} +1 -1
- package/dist/{chunk-EBTLMVDJ.js → chunk-NGW5UMAN.js} +1 -1
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
import { useTigerConfig } from './chunk-TRDG56CB.mjs';
|
|
2
|
+
import { defineComponent, computed, ref, watch, onMounted, onBeforeUnmount, h } from 'vue';
|
|
3
|
+
import { mergeTigerLocale, getTaskBoardLabels, classNames, taskBoardBaseClasses, coerceClassValue, mergeStyleValues, resolveLocaleText, createTouchDragTracker, isWipExceeded, taskBoardColumnClasses, taskBoardColumnDropTargetClasses, taskBoardColumnDraggingClasses, taskBoardWipExceededClasses, taskBoardColumnHeaderClasses, taskBoardDropIndicatorClasses, taskBoardEmptyClasses, taskBoardColumnBodyClasses, taskBoardAddCardClasses, getColumnDropIndex, setDragData, createColumnDragData, taskBoardCardClasses, taskBoardCardDraggingClasses, parseDragData, getDropIndex, reorderColumns, findColumnFromPoint, createCardDragData, moveCard } from '@expcat/tigercat-core';
|
|
4
|
+
|
|
5
|
+
var TaskBoard = defineComponent({
|
|
6
|
+
name: "TigerTaskBoard",
|
|
7
|
+
inheritAttrs: false,
|
|
8
|
+
props: {
|
|
9
|
+
columns: {
|
|
10
|
+
type: Array,
|
|
11
|
+
default: void 0
|
|
12
|
+
},
|
|
13
|
+
defaultColumns: {
|
|
14
|
+
type: Array,
|
|
15
|
+
default: () => []
|
|
16
|
+
},
|
|
17
|
+
draggable: {
|
|
18
|
+
type: Boolean,
|
|
19
|
+
default: true
|
|
20
|
+
},
|
|
21
|
+
columnDraggable: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: true
|
|
24
|
+
},
|
|
25
|
+
enforceWipLimit: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
default: false
|
|
28
|
+
},
|
|
29
|
+
beforeCardMove: {
|
|
30
|
+
type: Function,
|
|
31
|
+
default: void 0
|
|
32
|
+
},
|
|
33
|
+
beforeColumnMove: {
|
|
34
|
+
type: Function,
|
|
35
|
+
default: void 0
|
|
36
|
+
},
|
|
37
|
+
onCardAdd: {
|
|
38
|
+
type: Function,
|
|
39
|
+
default: void 0
|
|
40
|
+
},
|
|
41
|
+
locale: {
|
|
42
|
+
type: Object,
|
|
43
|
+
default: void 0
|
|
44
|
+
},
|
|
45
|
+
className: {
|
|
46
|
+
type: String,
|
|
47
|
+
default: void 0
|
|
48
|
+
},
|
|
49
|
+
style: {
|
|
50
|
+
type: Object,
|
|
51
|
+
default: void 0
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
emits: ["card-move", "column-move", "card-add", "update:columns"],
|
|
55
|
+
setup(props, { slots, attrs, emit }) {
|
|
56
|
+
const config = useTigerConfig();
|
|
57
|
+
const mergedLocale = computed(() => mergeTigerLocale(config.value.locale, props.locale));
|
|
58
|
+
const labels = computed(() => getTaskBoardLabels(mergedLocale.value));
|
|
59
|
+
const innerColumns = ref(props.columns ?? props.defaultColumns ?? []);
|
|
60
|
+
watch(
|
|
61
|
+
() => props.columns,
|
|
62
|
+
(value) => {
|
|
63
|
+
if (value !== void 0) innerColumns.value = value;
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
watch(
|
|
67
|
+
() => props.defaultColumns,
|
|
68
|
+
(value) => {
|
|
69
|
+
if (props.columns === void 0 && value !== void 0) {
|
|
70
|
+
innerColumns.value = value;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
const currentColumns = computed(() => props.columns ?? innerColumns.value);
|
|
75
|
+
const updateColumns = (next) => {
|
|
76
|
+
innerColumns.value = next;
|
|
77
|
+
emit("update:columns", next);
|
|
78
|
+
};
|
|
79
|
+
const dragState = ref(null);
|
|
80
|
+
const dropTargetColumnId = ref(null);
|
|
81
|
+
const dropIndex = ref(-1);
|
|
82
|
+
const boardRef = ref(null);
|
|
83
|
+
let touchTracker = null;
|
|
84
|
+
let touchRaf = 0;
|
|
85
|
+
const isTouchDevice = () => typeof window !== "undefined" && ("ontouchstart" in window || navigator.maxTouchPoints > 0);
|
|
86
|
+
const applyCardMove = async (cardId, fromColumnId, toColumnId, toIdx) => {
|
|
87
|
+
const result = moveCard(currentColumns.value, cardId, fromColumnId, toColumnId, toIdx, {
|
|
88
|
+
enforceWipLimit: props.enforceWipLimit
|
|
89
|
+
});
|
|
90
|
+
if (!result) return;
|
|
91
|
+
if (props.beforeCardMove) {
|
|
92
|
+
const ok = await props.beforeCardMove(result.event);
|
|
93
|
+
if (!ok) return;
|
|
94
|
+
}
|
|
95
|
+
updateColumns(result.columns);
|
|
96
|
+
emit("card-move", result.event);
|
|
97
|
+
};
|
|
98
|
+
const applyColumnMove = async (fromIdx, toIdx) => {
|
|
99
|
+
const result = reorderColumns(
|
|
100
|
+
currentColumns.value,
|
|
101
|
+
fromIdx,
|
|
102
|
+
Math.min(toIdx, currentColumns.value.length - 1)
|
|
103
|
+
);
|
|
104
|
+
if (!result) return;
|
|
105
|
+
if (props.beforeColumnMove) {
|
|
106
|
+
const ok = await props.beforeColumnMove(result.event);
|
|
107
|
+
if (!ok) return;
|
|
108
|
+
}
|
|
109
|
+
updateColumns(result.columns);
|
|
110
|
+
emit("column-move", result.event);
|
|
111
|
+
};
|
|
112
|
+
const handleCardDragStart = (e, card, column) => {
|
|
113
|
+
if (!props.draggable || !e.dataTransfer) return;
|
|
114
|
+
const idx = column.cards.findIndex((c) => c.id === card.id);
|
|
115
|
+
setDragData(e.dataTransfer, createCardDragData(card.id, column.id, idx));
|
|
116
|
+
dragState.value = { type: "card", id: card.id, fromColumnId: column.id, fromIndex: idx };
|
|
117
|
+
};
|
|
118
|
+
const handleCardDragOver = (e, column) => {
|
|
119
|
+
e.preventDefault();
|
|
120
|
+
if (!dragState.value || dragState.value.type !== "card") return;
|
|
121
|
+
dropTargetColumnId.value = column.id;
|
|
122
|
+
const target = e.currentTarget;
|
|
123
|
+
const cardEls = target.querySelectorAll("[data-tiger-taskboard-card]");
|
|
124
|
+
const rects = [];
|
|
125
|
+
cardEls.forEach((el) => rects.push(el.getBoundingClientRect()));
|
|
126
|
+
dropIndex.value = getDropIndex(e.clientY, rects);
|
|
127
|
+
};
|
|
128
|
+
const handleCardDrop = (e, column) => {
|
|
129
|
+
e.preventDefault();
|
|
130
|
+
if (!e.dataTransfer) return;
|
|
131
|
+
const data = parseDragData(e.dataTransfer);
|
|
132
|
+
if (!data || data.type !== "card") return;
|
|
133
|
+
applyCardMove(
|
|
134
|
+
data.cardId,
|
|
135
|
+
data.columnId,
|
|
136
|
+
column.id,
|
|
137
|
+
dropIndex.value >= 0 ? dropIndex.value : column.cards.length
|
|
138
|
+
);
|
|
139
|
+
resetDragState();
|
|
140
|
+
};
|
|
141
|
+
const handleColumnDragStart = (e, column, index) => {
|
|
142
|
+
if (!props.columnDraggable || !e.dataTransfer) return;
|
|
143
|
+
setDragData(e.dataTransfer, createColumnDragData(column.id, index));
|
|
144
|
+
dragState.value = { type: "column", id: column.id, fromIndex: index };
|
|
145
|
+
};
|
|
146
|
+
const handleColumnDragOver = (e) => {
|
|
147
|
+
if (!dragState.value || dragState.value.type !== "column") return;
|
|
148
|
+
e.preventDefault();
|
|
149
|
+
};
|
|
150
|
+
const handleColumnDrop = (e) => {
|
|
151
|
+
e.preventDefault();
|
|
152
|
+
if (!e.dataTransfer) return;
|
|
153
|
+
const data = parseDragData(e.dataTransfer);
|
|
154
|
+
if (!data || data.type !== "column") return;
|
|
155
|
+
const colEls = boardRef.value?.querySelectorAll("[data-tiger-taskboard-column]");
|
|
156
|
+
if (!colEls) return;
|
|
157
|
+
const rects = [];
|
|
158
|
+
colEls.forEach((el) => rects.push(el.getBoundingClientRect()));
|
|
159
|
+
const toIdx = getColumnDropIndex(e.clientX, rects);
|
|
160
|
+
applyColumnMove(data.index, toIdx);
|
|
161
|
+
resetDragState();
|
|
162
|
+
};
|
|
163
|
+
const handleDragEnd = () => {
|
|
164
|
+
resetDragState();
|
|
165
|
+
};
|
|
166
|
+
const handleDragLeave = (e) => {
|
|
167
|
+
const related = e.relatedTarget;
|
|
168
|
+
if (!related || !e.currentTarget.contains(related)) {
|
|
169
|
+
if (dragState.value?.type === "card") {
|
|
170
|
+
dropTargetColumnId.value = null;
|
|
171
|
+
dropIndex.value = -1;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
const resetDragState = () => {
|
|
176
|
+
dragState.value = null;
|
|
177
|
+
dropTargetColumnId.value = null;
|
|
178
|
+
dropIndex.value = -1;
|
|
179
|
+
};
|
|
180
|
+
const setupTouch = () => {
|
|
181
|
+
if (!isTouchDevice()) return;
|
|
182
|
+
touchTracker = createTouchDragTracker();
|
|
183
|
+
};
|
|
184
|
+
const handleTouchStart = (e, card, column) => {
|
|
185
|
+
if (!props.draggable || !touchTracker) return;
|
|
186
|
+
const idx = column.cards.findIndex((c) => c.id === card.id);
|
|
187
|
+
touchTracker.onTouchStart(e, e.currentTarget);
|
|
188
|
+
dragState.value = { type: "card", id: card.id, fromColumnId: column.id, fromIndex: idx };
|
|
189
|
+
};
|
|
190
|
+
const handleTouchMove = (e) => {
|
|
191
|
+
if (!touchTracker || !dragState.value) return;
|
|
192
|
+
touchTracker.onTouchMove(e);
|
|
193
|
+
cancelAnimationFrame(touchRaf);
|
|
194
|
+
touchRaf = requestAnimationFrame(() => {
|
|
195
|
+
const st = touchTracker.getState();
|
|
196
|
+
if (dragState.value?.type === "card") {
|
|
197
|
+
const colEl = findColumnFromPoint(st.currentX, st.currentY, boardRef.value);
|
|
198
|
+
if (colEl) {
|
|
199
|
+
const colId = colEl.getAttribute("data-tiger-taskboard-column-id");
|
|
200
|
+
dropTargetColumnId.value = colId ?? null;
|
|
201
|
+
const cardEls = colEl.querySelectorAll("[data-tiger-taskboard-card]");
|
|
202
|
+
const rects = [];
|
|
203
|
+
cardEls.forEach((el) => rects.push(el.getBoundingClientRect()));
|
|
204
|
+
dropIndex.value = getDropIndex(st.currentY, rects);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
};
|
|
209
|
+
const handleTouchEnd = () => {
|
|
210
|
+
if (!touchTracker || !dragState.value) return;
|
|
211
|
+
touchTracker.onTouchEnd();
|
|
212
|
+
if (dragState.value.type === "card" && dropTargetColumnId.value != null) {
|
|
213
|
+
applyCardMove(
|
|
214
|
+
dragState.value.id,
|
|
215
|
+
dragState.value.fromColumnId,
|
|
216
|
+
dropTargetColumnId.value,
|
|
217
|
+
dropIndex.value >= 0 ? dropIndex.value : 0
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
resetDragState();
|
|
221
|
+
};
|
|
222
|
+
const handleColumnTouchStart = (e, column, index) => {
|
|
223
|
+
if (!props.columnDraggable || !touchTracker) return;
|
|
224
|
+
touchTracker.onTouchStart(e, e.currentTarget);
|
|
225
|
+
dragState.value = { type: "column", id: column.id, fromIndex: index };
|
|
226
|
+
};
|
|
227
|
+
const handleColumnTouchMove = (e) => {
|
|
228
|
+
if (!touchTracker || !dragState.value || dragState.value.type !== "column") return;
|
|
229
|
+
touchTracker.onTouchMove(e);
|
|
230
|
+
};
|
|
231
|
+
const handleColumnTouchEnd = () => {
|
|
232
|
+
if (!touchTracker || !dragState.value || dragState.value.type !== "column") return;
|
|
233
|
+
const st = touchTracker.onTouchEnd();
|
|
234
|
+
const colEls = boardRef.value?.querySelectorAll("[data-tiger-taskboard-column]");
|
|
235
|
+
if (!colEls) {
|
|
236
|
+
resetDragState();
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
const rects = [];
|
|
240
|
+
colEls.forEach((el) => rects.push(el.getBoundingClientRect()));
|
|
241
|
+
const toIdx = getColumnDropIndex(st.currentX, rects);
|
|
242
|
+
applyColumnMove(dragState.value.fromIndex, Math.min(toIdx, currentColumns.value.length - 1));
|
|
243
|
+
resetDragState();
|
|
244
|
+
};
|
|
245
|
+
const kbDragState = ref(null);
|
|
246
|
+
const handleCardKeyDown = (e, card, column) => {
|
|
247
|
+
if (!props.draggable) return;
|
|
248
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
249
|
+
e.preventDefault();
|
|
250
|
+
if (!kbDragState.value) {
|
|
251
|
+
const idx = column.cards.findIndex((c) => c.id === card.id);
|
|
252
|
+
kbDragState.value = { type: "card", id: card.id, fromColumnId: column.id, fromIndex: idx };
|
|
253
|
+
} else {
|
|
254
|
+
const cardIdx = column.cards.findIndex((c) => c.id === card.id);
|
|
255
|
+
if (kbDragState.value.fromColumnId !== void 0) {
|
|
256
|
+
applyCardMove(kbDragState.value.id, kbDragState.value.fromColumnId, column.id, cardIdx);
|
|
257
|
+
}
|
|
258
|
+
kbDragState.value = null;
|
|
259
|
+
}
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
if (e.key === "Escape" && kbDragState.value) {
|
|
263
|
+
e.preventDefault();
|
|
264
|
+
kbDragState.value = null;
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
onMounted(() => {
|
|
268
|
+
setupTouch();
|
|
269
|
+
});
|
|
270
|
+
onBeforeUnmount(() => {
|
|
271
|
+
cancelAnimationFrame(touchRaf);
|
|
272
|
+
});
|
|
273
|
+
const wrapperClasses = computed(
|
|
274
|
+
() => classNames(
|
|
275
|
+
taskBoardBaseClasses,
|
|
276
|
+
props.className,
|
|
277
|
+
coerceClassValue(attrs.class)
|
|
278
|
+
)
|
|
279
|
+
);
|
|
280
|
+
const wrapperStyle = computed(
|
|
281
|
+
() => mergeStyleValues(attrs.style, props.style)
|
|
282
|
+
);
|
|
283
|
+
const renderCard = (card, column) => {
|
|
284
|
+
const isDragging = dragState.value?.type === "card" && dragState.value.id === card.id;
|
|
285
|
+
const isKbGrabbed = kbDragState.value?.id === card.id;
|
|
286
|
+
const cardClasses = classNames(
|
|
287
|
+
taskBoardCardClasses,
|
|
288
|
+
isDragging && taskBoardCardDraggingClasses,
|
|
289
|
+
isKbGrabbed && "ring-2 ring-[var(--tiger-primary,#2563eb)]"
|
|
290
|
+
);
|
|
291
|
+
const cardAttrs = {
|
|
292
|
+
key: String(card.id),
|
|
293
|
+
class: cardClasses,
|
|
294
|
+
draggable: props.draggable,
|
|
295
|
+
tabindex: 0,
|
|
296
|
+
role: "listitem",
|
|
297
|
+
"aria-roledescription": labels.value.dragHintText,
|
|
298
|
+
"aria-grabbed": isKbGrabbed ? "true" : void 0,
|
|
299
|
+
"data-tiger-taskboard-card": "",
|
|
300
|
+
"data-tiger-taskboard-card-id": String(card.id),
|
|
301
|
+
onDragstart: (e) => handleCardDragStart(e, card, column),
|
|
302
|
+
onDragend: handleDragEnd,
|
|
303
|
+
onTouchstart: (e) => handleTouchStart(e, card, column),
|
|
304
|
+
onTouchmove: handleTouchMove,
|
|
305
|
+
onTouchend: handleTouchEnd,
|
|
306
|
+
onKeydown: (e) => handleCardKeyDown(e, card, column)
|
|
307
|
+
};
|
|
308
|
+
if (slots.card) {
|
|
309
|
+
return h("div", cardAttrs, slots.card({ card, column, isDragging }));
|
|
310
|
+
}
|
|
311
|
+
return h("div", cardAttrs, [
|
|
312
|
+
h("div", { class: "font-medium text-sm text-[var(--tiger-text,#1f2937)]" }, card.title),
|
|
313
|
+
card.description ? h(
|
|
314
|
+
"div",
|
|
315
|
+
{ class: "mt-1 text-xs text-[var(--tiger-text-muted,#6b7280)] line-clamp-2" },
|
|
316
|
+
card.description
|
|
317
|
+
) : null
|
|
318
|
+
]);
|
|
319
|
+
};
|
|
320
|
+
const renderColumnNode = (column, colIndex) => {
|
|
321
|
+
const isDropTarget = dragState.value?.type === "card" && dropTargetColumnId.value === column.id;
|
|
322
|
+
const isColDragging = dragState.value?.type === "column" && dragState.value.id === column.id;
|
|
323
|
+
const wipOver = isWipExceeded(column);
|
|
324
|
+
const colClasses = classNames(
|
|
325
|
+
taskBoardColumnClasses,
|
|
326
|
+
isDropTarget && taskBoardColumnDropTargetClasses,
|
|
327
|
+
isColDragging && taskBoardColumnDraggingClasses
|
|
328
|
+
);
|
|
329
|
+
const headerContent = slots["column-header"] ? slots["column-header"]({ column }) : [
|
|
330
|
+
h("span", { class: wipOver ? taskBoardWipExceededClasses : void 0 }, [
|
|
331
|
+
column.title,
|
|
332
|
+
column.wipLimit != null ? h(
|
|
333
|
+
"span",
|
|
334
|
+
{
|
|
335
|
+
class: "ml-2 text-xs font-normal opacity-70",
|
|
336
|
+
title: resolveLocaleText(
|
|
337
|
+
labels.value.wipLimitText.replace("{limit}", String(column.wipLimit))
|
|
338
|
+
)
|
|
339
|
+
},
|
|
340
|
+
`(${column.cards.length}/${column.wipLimit})`
|
|
341
|
+
) : h(
|
|
342
|
+
"span",
|
|
343
|
+
{ class: "ml-2 text-xs font-normal opacity-50" },
|
|
344
|
+
String(column.cards.length)
|
|
345
|
+
)
|
|
346
|
+
]),
|
|
347
|
+
column.description ? h(
|
|
348
|
+
"span",
|
|
349
|
+
{
|
|
350
|
+
class: "text-xs font-normal text-[var(--tiger-text-muted,#6b7280)] truncate max-w-[120px]"
|
|
351
|
+
},
|
|
352
|
+
column.description
|
|
353
|
+
) : null
|
|
354
|
+
];
|
|
355
|
+
const header = h(
|
|
356
|
+
"div",
|
|
357
|
+
{
|
|
358
|
+
class: taskBoardColumnHeaderClasses,
|
|
359
|
+
draggable: props.columnDraggable,
|
|
360
|
+
onDragstart: (e) => handleColumnDragStart(e, column, colIndex),
|
|
361
|
+
onDragend: handleDragEnd,
|
|
362
|
+
onTouchstart: (e) => handleColumnTouchStart(e, column, colIndex),
|
|
363
|
+
onTouchmove: handleColumnTouchMove,
|
|
364
|
+
onTouchend: handleColumnTouchEnd,
|
|
365
|
+
style: props.columnDraggable ? "cursor: grab" : void 0
|
|
366
|
+
},
|
|
367
|
+
headerContent
|
|
368
|
+
);
|
|
369
|
+
const cards = column.cards.length > 0 ? column.cards.flatMap((card, i) => {
|
|
370
|
+
const nodes = [];
|
|
371
|
+
if (isDropTarget && dropIndex.value === i) {
|
|
372
|
+
nodes.push(h("div", { key: `drop-${i}`, class: taskBoardDropIndicatorClasses }));
|
|
373
|
+
}
|
|
374
|
+
nodes.push(renderCard(card, column));
|
|
375
|
+
return nodes;
|
|
376
|
+
}).concat(
|
|
377
|
+
isDropTarget && dropIndex.value >= column.cards.length ? [h("div", { key: "drop-end", class: taskBoardDropIndicatorClasses })] : []
|
|
378
|
+
) : [
|
|
379
|
+
isDropTarget ? h("div", { key: "drop-empty", class: taskBoardDropIndicatorClasses }) : slots["empty-column"] ? slots["empty-column"]({ column }) : h(
|
|
380
|
+
"div",
|
|
381
|
+
{ class: taskBoardEmptyClasses },
|
|
382
|
+
resolveLocaleText(labels.value.emptyColumnText)
|
|
383
|
+
)
|
|
384
|
+
];
|
|
385
|
+
const body = h(
|
|
386
|
+
"div",
|
|
387
|
+
{
|
|
388
|
+
class: taskBoardColumnBodyClasses,
|
|
389
|
+
role: "list",
|
|
390
|
+
"aria-label": column.title,
|
|
391
|
+
onDragover: (e) => handleCardDragOver(e, column),
|
|
392
|
+
onDrop: (e) => handleCardDrop(e, column),
|
|
393
|
+
onDragleave: handleDragLeave
|
|
394
|
+
},
|
|
395
|
+
cards
|
|
396
|
+
);
|
|
397
|
+
const footer = slots["column-footer"] ? slots["column-footer"]({ column }) : props.onCardAdd ? h(
|
|
398
|
+
"div",
|
|
399
|
+
{
|
|
400
|
+
class: classNames(
|
|
401
|
+
"border-t border-[var(--tiger-border,#e5e7eb)]",
|
|
402
|
+
taskBoardAddCardClasses
|
|
403
|
+
),
|
|
404
|
+
onClick: () => {
|
|
405
|
+
emit("card-add", column.id);
|
|
406
|
+
}
|
|
407
|
+
},
|
|
408
|
+
[h("span", null, "+"), h("span", null, resolveLocaleText(labels.value.addCardText))]
|
|
409
|
+
) : null;
|
|
410
|
+
return h(
|
|
411
|
+
"div",
|
|
412
|
+
{
|
|
413
|
+
key: String(column.id),
|
|
414
|
+
class: colClasses,
|
|
415
|
+
"data-tiger-taskboard-column": "",
|
|
416
|
+
"data-tiger-taskboard-column-id": String(column.id),
|
|
417
|
+
onDragover: dragState.value?.type === "column" ? handleColumnDragOver : void 0,
|
|
418
|
+
onDrop: dragState.value?.type === "column" ? handleColumnDrop : void 0
|
|
419
|
+
},
|
|
420
|
+
[header, body, footer]
|
|
421
|
+
);
|
|
422
|
+
};
|
|
423
|
+
return () => h(
|
|
424
|
+
"div",
|
|
425
|
+
{
|
|
426
|
+
...attrs,
|
|
427
|
+
ref: boardRef,
|
|
428
|
+
class: wrapperClasses.value,
|
|
429
|
+
style: wrapperStyle.value,
|
|
430
|
+
role: "region",
|
|
431
|
+
"aria-label": resolveLocaleText(labels.value.boardAriaLabel),
|
|
432
|
+
"data-tiger-task-board": ""
|
|
433
|
+
},
|
|
434
|
+
currentColumns.value.map((col, i) => renderColumnNode(col, i))
|
|
435
|
+
);
|
|
436
|
+
}
|
|
437
|
+
});
|
|
438
|
+
var TaskBoard_default = TaskBoard;
|
|
439
|
+
|
|
440
|
+
export { TaskBoard, TaskBoard_default };
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { Modal } from './chunk-P47EXOAW.mjs';
|
|
2
|
+
import { ImageCropper } from './chunk-T77L326M.mjs';
|
|
3
|
+
import { Button } from './chunk-D6MR5YRE.mjs';
|
|
4
|
+
import { defineComponent, ref, computed, h } from 'vue';
|
|
5
|
+
import { classNames, cropUploadTriggerDisabledClasses, cropUploadTriggerClasses, coerceClassValue, mergeStyleValues, uploadPlusIconPath, modalFooterClasses } from '@expcat/tigercat-core';
|
|
6
|
+
|
|
7
|
+
var CropUpload = defineComponent({
|
|
8
|
+
name: "TigerCropUpload",
|
|
9
|
+
inheritAttrs: false,
|
|
10
|
+
props: {
|
|
11
|
+
accept: { type: String, default: "image/*" },
|
|
12
|
+
disabled: { type: Boolean, default: false },
|
|
13
|
+
maxSize: { type: Number, default: void 0 },
|
|
14
|
+
cropperProps: {
|
|
15
|
+
type: Object,
|
|
16
|
+
default: void 0
|
|
17
|
+
},
|
|
18
|
+
modalTitle: { type: String, default: "\u88C1\u526A\u56FE\u7247" },
|
|
19
|
+
modalWidth: { type: Number, default: 520 },
|
|
20
|
+
className: { type: String, default: void 0 },
|
|
21
|
+
style: {
|
|
22
|
+
type: Object,
|
|
23
|
+
default: void 0
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
emits: ["crop-complete", "error"],
|
|
27
|
+
setup(props, { slots, emit, attrs }) {
|
|
28
|
+
const fileInputRef = ref(null);
|
|
29
|
+
const modalVisible = ref(false);
|
|
30
|
+
const imageSrc = ref("");
|
|
31
|
+
const cropperRef = ref(null);
|
|
32
|
+
const cropping = ref(false);
|
|
33
|
+
const handleTriggerClick = () => {
|
|
34
|
+
if (props.disabled) return;
|
|
35
|
+
fileInputRef.value?.click();
|
|
36
|
+
};
|
|
37
|
+
const handleFileChange = (e) => {
|
|
38
|
+
const input = e.target;
|
|
39
|
+
const file = input.files?.[0];
|
|
40
|
+
if (!file) return;
|
|
41
|
+
if (props.maxSize && file.size > props.maxSize) {
|
|
42
|
+
emit("error", new Error(`File size exceeds maximum of ${props.maxSize} bytes`));
|
|
43
|
+
input.value = "";
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const reader = new FileReader();
|
|
47
|
+
reader.onload = (ev) => {
|
|
48
|
+
imageSrc.value = ev.target?.result;
|
|
49
|
+
modalVisible.value = true;
|
|
50
|
+
};
|
|
51
|
+
reader.readAsDataURL(file);
|
|
52
|
+
input.value = "";
|
|
53
|
+
};
|
|
54
|
+
const handleConfirm = async () => {
|
|
55
|
+
if (!cropperRef.value) return;
|
|
56
|
+
cropping.value = true;
|
|
57
|
+
try {
|
|
58
|
+
const result = await cropperRef.value.getCropResult();
|
|
59
|
+
emit("crop-complete", result);
|
|
60
|
+
modalVisible.value = false;
|
|
61
|
+
} catch (err) {
|
|
62
|
+
emit("error", err);
|
|
63
|
+
} finally {
|
|
64
|
+
cropping.value = false;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
const handleCancel = () => {
|
|
68
|
+
modalVisible.value = false;
|
|
69
|
+
imageSrc.value = "";
|
|
70
|
+
};
|
|
71
|
+
const triggerClasses = computed(
|
|
72
|
+
() => classNames(
|
|
73
|
+
props.disabled ? cropUploadTriggerDisabledClasses : cropUploadTriggerClasses,
|
|
74
|
+
props.className,
|
|
75
|
+
coerceClassValue(attrs.class)
|
|
76
|
+
)
|
|
77
|
+
);
|
|
78
|
+
const triggerStyle = computed(
|
|
79
|
+
() => mergeStyleValues(attrs.style, props.style)
|
|
80
|
+
);
|
|
81
|
+
return () => {
|
|
82
|
+
const forwardedAttrs = Object.fromEntries(
|
|
83
|
+
Object.entries(attrs).filter(([key]) => key !== "class" && key !== "style")
|
|
84
|
+
);
|
|
85
|
+
const fileInput = h("input", {
|
|
86
|
+
ref: fileInputRef,
|
|
87
|
+
type: "file",
|
|
88
|
+
accept: props.accept,
|
|
89
|
+
style: { display: "none" },
|
|
90
|
+
onChange: handleFileChange
|
|
91
|
+
});
|
|
92
|
+
const trigger = slots.default ? h(
|
|
93
|
+
"div",
|
|
94
|
+
{
|
|
95
|
+
...forwardedAttrs,
|
|
96
|
+
class: triggerClasses.value,
|
|
97
|
+
style: triggerStyle.value,
|
|
98
|
+
onClick: handleTriggerClick,
|
|
99
|
+
role: "button",
|
|
100
|
+
tabindex: props.disabled ? -1 : 0,
|
|
101
|
+
"aria-label": "Select image to crop and upload",
|
|
102
|
+
"aria-disabled": props.disabled ? "true" : void 0,
|
|
103
|
+
onKeydown: (e) => {
|
|
104
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
105
|
+
e.preventDefault();
|
|
106
|
+
handleTriggerClick();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
slots.default()
|
|
111
|
+
) : h(
|
|
112
|
+
"div",
|
|
113
|
+
{
|
|
114
|
+
...forwardedAttrs,
|
|
115
|
+
class: triggerClasses.value,
|
|
116
|
+
style: triggerStyle.value,
|
|
117
|
+
onClick: handleTriggerClick,
|
|
118
|
+
role: "button",
|
|
119
|
+
tabindex: props.disabled ? -1 : 0,
|
|
120
|
+
"aria-label": "Select image to crop and upload",
|
|
121
|
+
"aria-disabled": props.disabled ? "true" : void 0,
|
|
122
|
+
onKeydown: (e) => {
|
|
123
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
124
|
+
e.preventDefault();
|
|
125
|
+
handleTriggerClick();
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
[
|
|
130
|
+
h(
|
|
131
|
+
"svg",
|
|
132
|
+
{
|
|
133
|
+
class: "w-5 h-5",
|
|
134
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
135
|
+
fill: "none",
|
|
136
|
+
viewBox: "0 0 24 24",
|
|
137
|
+
stroke: "currentColor"
|
|
138
|
+
},
|
|
139
|
+
[
|
|
140
|
+
h("path", {
|
|
141
|
+
"stroke-linecap": "round",
|
|
142
|
+
"stroke-linejoin": "round",
|
|
143
|
+
"stroke-width": "2",
|
|
144
|
+
d: uploadPlusIconPath
|
|
145
|
+
})
|
|
146
|
+
]
|
|
147
|
+
),
|
|
148
|
+
h("span", null, "\u9009\u62E9\u56FE\u7247")
|
|
149
|
+
]
|
|
150
|
+
);
|
|
151
|
+
const modal = h(
|
|
152
|
+
Modal,
|
|
153
|
+
{
|
|
154
|
+
visible: modalVisible.value,
|
|
155
|
+
size: "lg",
|
|
156
|
+
title: props.modalTitle,
|
|
157
|
+
closable: true,
|
|
158
|
+
maskClosable: false,
|
|
159
|
+
showDefaultFooter: false,
|
|
160
|
+
"onUpdate:visible": (val) => {
|
|
161
|
+
if (!val) handleCancel();
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
default: () => imageSrc.value ? h(ImageCropper, {
|
|
166
|
+
ref: cropperRef,
|
|
167
|
+
src: imageSrc.value,
|
|
168
|
+
...props.cropperProps
|
|
169
|
+
}) : null,
|
|
170
|
+
footer: ({ cancel }) => h("div", { class: modalFooterClasses }, [
|
|
171
|
+
h(Button, { variant: "secondary", onClick: handleCancel }, { default: () => "\u53D6\u6D88" }),
|
|
172
|
+
h(
|
|
173
|
+
Button,
|
|
174
|
+
{ onClick: handleConfirm, loading: cropping.value },
|
|
175
|
+
{ default: () => "\u786E\u8BA4\u88C1\u526A" }
|
|
176
|
+
)
|
|
177
|
+
])
|
|
178
|
+
}
|
|
179
|
+
);
|
|
180
|
+
return h("div", { class: "tiger-crop-upload inline-block" }, [fileInput, trigger, modal]);
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
var CropUpload_default = CropUpload;
|
|
185
|
+
|
|
186
|
+
export { CropUpload, CropUpload_default };
|