@expcat/tigercat-vue 2.0.19 → 2.1.1
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/README.md +20 -10
- package/dist/chunk-26QCTL2E.mjs +180 -0
- package/dist/{chunk-7W3NALIL.mjs → chunk-3FPS7XVB.mjs} +26 -27
- package/dist/{chunk-2OI6GWOT.mjs → chunk-3KAHJF7D.mjs} +12 -11
- package/dist/chunk-3OCHBGPF.mjs +835 -0
- package/dist/chunk-3ONCXHE5.mjs +184 -0
- package/dist/{chunk-4HUYX5WW.mjs → chunk-4PQZMDBK.mjs} +29 -8
- package/dist/{chunk-DI6RRAGQ.mjs → chunk-562Z32GR.mjs} +3 -3
- package/dist/{chunk-OQVGB7X6.mjs → chunk-626VUZ2Q.mjs} +1 -1
- package/dist/{chunk-WUQMFKQ6.mjs → chunk-67VS6QHJ.mjs} +29 -15
- package/dist/chunk-6GR3XC5V.mjs +281 -0
- package/dist/chunk-6GR5U4UB.mjs +225 -0
- package/dist/{chunk-KFJIZED5.mjs → chunk-6JAAXPBW.mjs} +7 -6
- package/dist/{chunk-XGXZF27U.mjs → chunk-6NYC7EY2.mjs} +32 -18
- package/dist/{chunk-6BDDX2R4.mjs → chunk-73Z7N7VG.mjs} +1 -4
- package/dist/chunk-7C7SG3SS.mjs +269 -0
- package/dist/{chunk-NNC75I7F.mjs → chunk-7TJE7OYH.mjs} +7 -6
- package/dist/{chunk-AU6IC6K7.mjs → chunk-ABNS4B5V.mjs} +35 -15
- package/dist/chunk-AECXFT7D.mjs +121 -0
- package/dist/chunk-AOLRZG4E.mjs +347 -0
- package/dist/chunk-AY7CGLMO.mjs +368 -0
- package/dist/chunk-BBNCP55O.mjs +156 -0
- package/dist/{chunk-EGIMTTZA.mjs → chunk-BOHE5URZ.mjs} +18 -3
- package/dist/{chunk-5RIHHZF6.mjs → chunk-BQK7LH2L.mjs} +4 -1
- package/dist/{chunk-E6EZHSGY.mjs → chunk-BSOLH6R5.mjs} +0 -1
- package/dist/{chunk-RSM6FOWX.mjs → chunk-CCC3S6LK.mjs} +6 -3
- package/dist/{chunk-U75YXWSA.mjs → chunk-CLTRADS7.mjs} +17 -5
- package/dist/{chunk-BEIPGX74.mjs → chunk-DRLQCY7R.mjs} +162 -7
- package/dist/{chunk-KBJANUZZ.mjs → chunk-E523VGZP.mjs} +1 -1
- package/dist/{chunk-D3U2NJ32.mjs → chunk-FEQ7PZXI.mjs} +8 -2
- package/dist/{chunk-PE5OA4YG.mjs → chunk-FHUGOSEY.mjs} +8 -2
- package/dist/{chunk-OAPIT53X.mjs → chunk-FIEECAJV.mjs} +7 -10
- package/dist/{chunk-7SFB77JR.mjs → chunk-GBPMQJJJ.mjs} +8 -1
- package/dist/{chunk-KOG3HKOF.mjs → chunk-GQOPDD44.mjs} +2 -5
- package/dist/{chunk-5RXYJWNA.mjs → chunk-H4DEIGEG.mjs} +77 -25
- package/dist/{chunk-ZGA66PSG.mjs → chunk-IK2WHKDA.mjs} +32 -18
- package/dist/{chunk-HGXD57QM.mjs → chunk-JBS3AESR.mjs} +65 -23
- package/dist/{chunk-PYRKFQ6J.mjs → chunk-JIU5UEOU.mjs} +70 -26
- package/dist/{chunk-JALHMWKW.mjs → chunk-K5MHUMKR.mjs} +2 -2
- package/dist/{chunk-5E4LINDO.mjs → chunk-LH2V2JMZ.mjs} +26 -10
- package/dist/{chunk-PQBKN2NH.mjs → chunk-LRFKHJDU.mjs} +14 -5
- package/dist/{chunk-OTHJIFDV.mjs → chunk-M4FWWEMX.mjs} +18 -9
- package/dist/{chunk-NGAA73CV.mjs → chunk-N2XV37BL.mjs} +40 -44
- package/dist/{chunk-2LIIMWBR.mjs → chunk-OYU47A57.mjs} +1 -2
- package/dist/{chunk-KU2Q5V3L.mjs → chunk-P62TYR3M.mjs} +18 -2
- package/dist/chunk-P6FMU4AT.mjs +54 -0
- package/dist/{chunk-P5FDKBXG.mjs → chunk-P7X46BAW.mjs} +70 -3
- package/dist/chunk-PFIV5MXD.mjs +48 -0
- package/dist/{chunk-KROVW4AW.mjs → chunk-PJQTRDIG.mjs} +13 -3
- package/dist/{chunk-26OI3TEA.mjs → chunk-PMQSXEMT.mjs} +42 -6
- package/dist/{chunk-XLNK3Z2P.mjs → chunk-POWDTOMF.mjs} +88 -79
- package/dist/{chunk-AXDBME5A.mjs → chunk-PSGVG4TN.mjs} +38 -21
- package/dist/chunk-PWWWACHC.mjs +302 -0
- package/dist/{chunk-UUWTKCMY.mjs → chunk-QWLD5FMJ.mjs} +1 -1
- package/dist/{chunk-ALIUAGJO.mjs → chunk-QZLOF36M.mjs} +7 -13
- package/dist/{chunk-WLYQHKLZ.mjs → chunk-QZRSFGZZ.mjs} +50 -11
- package/dist/{chunk-MAKOSWR6.mjs → chunk-RHQWQJ4I.mjs} +7 -6
- package/dist/{chunk-GS4SV2HK.mjs → chunk-RRLE7QRH.mjs} +43 -22
- package/dist/{chunk-RID7A5V7.mjs → chunk-RRNQL6MJ.mjs} +23 -6
- package/dist/{chunk-VJ6YM2EW.mjs → chunk-S4BKVFQ7.mjs} +1 -1
- package/dist/{chunk-LPZBXTJ6.mjs → chunk-SAC4PAG3.mjs} +4 -4
- package/dist/{chunk-W5RZPTFD.mjs → chunk-SNNT64HK.mjs} +13 -2
- package/dist/{chunk-N3C6YI7I.mjs → chunk-SWMYIORV.mjs} +22 -7
- package/dist/{chunk-2XCXK3NQ.mjs → chunk-SX3NAN4M.mjs} +1 -1
- package/dist/chunk-TBOXTAIA.mjs +94 -0
- package/dist/{chunk-JL3CN4UK.mjs → chunk-TDBMAKTJ.mjs} +10 -3
- package/dist/{chunk-EDBMWZKH.mjs → chunk-TPESRDUG.mjs} +5 -1
- package/dist/chunk-UEGNXN5B.mjs +28 -0
- package/dist/{chunk-NEEGXKJW.mjs → chunk-UGHLEKEZ.mjs} +22 -3
- package/dist/{chunk-HKYRRQS7.mjs → chunk-UNQO7EVG.mjs} +1 -1
- package/dist/chunk-UR5F74ZB.mjs +601 -0
- package/dist/{chunk-VCCK4CDT.mjs → chunk-URPXBKK4.mjs} +23 -5
- package/dist/chunk-UUWPSRNV.mjs +337 -0
- package/dist/chunk-UXJRH72H.mjs +834 -0
- package/dist/chunk-VFS5XAZ3.mjs +602 -0
- package/dist/{chunk-7KCOF5US.mjs → chunk-VY6FVIOZ.mjs} +10 -8
- package/dist/{chunk-KICZSLOX.mjs → chunk-W2ICYZVU.mjs} +1 -1
- package/dist/{chunk-FIVVKBBF.mjs → chunk-W3QOMJKQ.mjs} +8 -6
- package/dist/{chunk-DCMRB3HR.mjs → chunk-WV25G4M3.mjs} +4 -3
- package/dist/{chunk-3KITFMBJ.mjs → chunk-X5LJT76O.mjs} +52 -35
- package/dist/{chunk-BNYA5IUB.mjs → chunk-YNXP34KO.mjs} +39 -38
- package/dist/{chunk-2T2NEZRZ.mjs → chunk-YVDTXHQ6.mjs} +1 -1
- package/dist/{chunk-AUMTHL6N.mjs → chunk-ZOP7PEKY.mjs} +2 -1
- package/dist/components/ActivityFeed.d.mts +29 -11
- package/dist/components/ActivityFeed.mjs +3 -3
- package/dist/components/Affix.d.mts +4 -4
- package/dist/components/Affix.mjs +1 -1
- package/dist/components/Alert.d.mts +4 -4
- package/dist/components/Anchor.d.mts +2 -2
- package/dist/components/Anchor.mjs +1 -1
- package/dist/components/AreaChart.d.mts +3 -3
- package/dist/components/AreaChart.mjs +5 -4
- package/dist/components/AspectRatio.d.mts +44 -0
- package/dist/components/AspectRatio.mjs +8 -0
- package/dist/components/AutoComplete.d.mts +3 -3
- package/dist/components/AutoComplete.mjs +1 -1
- package/dist/components/Avatar.d.mts +2 -2
- package/dist/components/AvatarGroup.d.mts +2 -2
- package/dist/components/BackTop.d.mts +2 -2
- package/dist/components/Badge.d.mts +5 -5
- package/dist/components/BarChart.d.mts +2 -2
- package/dist/components/BarChart.mjs +5 -4
- package/dist/components/Breadcrumb.d.mts +2 -2
- package/dist/components/Button.d.mts +5 -5
- package/dist/components/ButtonGroup.d.mts +1 -1
- package/dist/components/Calendar.d.mts +2 -2
- package/dist/components/Calendar.mjs +1 -1
- package/dist/components/Card.d.mts +3 -3
- package/dist/components/Carousel.d.mts +3 -3
- package/dist/components/Cascader.d.mts +37 -3
- package/dist/components/Cascader.mjs +1 -1
- package/dist/components/ChartCanvas.d.mts +8 -4
- package/dist/components/ChartCanvas.mjs +1 -1
- package/dist/components/ChartGrid.d.mts +1 -1
- package/dist/components/ChartLegend.d.mts +2 -2
- package/dist/components/ChartTooltip.d.mts +1 -1
- package/dist/components/ChatWindow.d.mts +29 -11
- package/dist/components/ChatWindow.mjs +4 -4
- package/dist/components/Checkbox.d.mts +1 -1
- package/dist/components/Code.d.mts +33 -6
- package/dist/components/Code.mjs +3 -1
- package/dist/components/CodeEditor.d.mts +1 -1
- package/dist/components/CodeEditor.mjs +1 -1
- package/dist/components/Collapse.d.mts +1 -1
- package/dist/components/CollapsePanel.mjs +1 -1
- package/dist/components/ColorPicker.mjs +1 -1
- package/dist/components/ColorSwatch.d.mts +8 -2
- package/dist/components/ColorSwatch.mjs +1 -1
- package/dist/components/CommentThread.d.mts +63 -27
- package/dist/components/CommentThread.mjs +2 -2
- package/dist/components/Container.d.mts +1 -1
- package/dist/components/ContextMenu.d.mts +234 -0
- package/dist/components/ContextMenu.mjs +17 -0
- package/dist/components/Countdown.d.mts +1 -1
- package/dist/components/CronEditor.d.mts +3 -3
- package/dist/components/CropUpload.d.mts +1 -1
- package/dist/components/DataExport.d.mts +1 -1
- package/dist/components/DataExport.mjs +2 -2
- package/dist/components/DataTableWithToolbar.d.mts +11 -11
- package/dist/components/DataTableWithToolbar.mjs +8 -8
- package/dist/components/DatePicker.d.mts +5 -5
- package/dist/components/Descriptions.d.mts +3 -3
- package/dist/components/DonutChart.d.mts +3 -3
- package/dist/components/DonutChart.mjs +5 -5
- package/dist/components/Drawer.d.mts +6 -6
- package/dist/components/Dropdown.d.mts +21 -2
- package/dist/components/Dropdown.mjs +1 -1
- package/dist/components/Empty.d.mts +1 -1
- package/dist/components/FileManager.d.mts +10 -4
- package/dist/components/FileManager.mjs +1 -1
- package/dist/components/FloatButton.d.mts +37 -7
- package/dist/components/FloatButton.mjs +1 -1
- package/dist/components/Form.d.mts +2 -2
- package/dist/components/FormWizard.d.mts +4 -4
- package/dist/components/FormWizard.mjs +1 -1
- package/dist/components/FunnelChart.d.mts +4 -4
- package/dist/components/FunnelChart.mjs +4 -4
- package/dist/components/Gantt.d.mts +6 -4
- package/dist/components/Gantt.mjs +2 -2
- package/dist/components/GaugeChart.d.mts +4 -4
- package/dist/components/GaugeChart.mjs +2 -2
- package/dist/components/Header.d.mts +1 -1
- package/dist/components/HeatmapChart.d.mts +3 -3
- package/dist/components/HeatmapChart.mjs +3 -3
- package/dist/components/Highlight.d.mts +146 -0
- package/dist/components/Highlight.mjs +8 -0
- package/dist/components/Icon.d.mts +2 -2
- package/dist/components/Image.d.mts +2 -2
- package/dist/components/Image.mjs +3 -3
- package/dist/components/ImageAnnotation.d.mts +4 -4
- package/dist/components/ImageCompare.d.mts +284 -0
- package/dist/components/ImageCompare.mjs +8 -0
- package/dist/components/ImageCropper.d.mts +1 -1
- package/dist/components/ImageGroup.mjs +2 -2
- package/dist/components/ImagePreview.d.mts +1 -1
- package/dist/components/ImagePreview.mjs +1 -1
- package/dist/components/ImageViewer.d.mts +1 -1
- package/dist/components/InfiniteScroll.d.mts +4 -4
- package/dist/components/Input.d.mts +7 -7
- package/dist/components/Input.mjs +1 -1
- package/dist/components/InputGroup.d.mts +2 -2
- package/dist/components/InputNumber.d.mts +3 -3
- package/dist/components/InputNumber.mjs +1 -1
- package/dist/components/InputOTP.d.mts +261 -0
- package/dist/components/InputOTP.mjs +11 -0
- package/dist/components/Kanban.d.mts +1 -1
- package/dist/components/Kanban.mjs +2 -2
- package/dist/components/Kbd.d.mts +118 -0
- package/dist/components/Kbd.mjs +8 -0
- package/dist/components/LineChart.d.mts +2 -2
- package/dist/components/LineChart.mjs +5 -4
- package/dist/components/Link.d.mts +1 -1
- package/dist/components/List.d.mts +7 -7
- package/dist/components/List.mjs +2 -2
- package/dist/components/Loading.d.mts +7 -7
- package/dist/components/Loading.mjs +1 -1
- package/dist/components/LoadingBar.d.mts +8 -0
- package/dist/components/LoadingBar.mjs +114 -0
- package/dist/components/LoadingBarContainer.d.mts +78 -0
- package/dist/components/LoadingBarContainer.mjs +8 -0
- package/dist/components/LoadingBarRoot.d.mts +6 -0
- package/dist/components/LoadingBarRoot.mjs +6 -0
- package/dist/components/MarkdownEditor.d.mts +4 -4
- package/dist/components/Marquee.d.mts +158 -0
- package/dist/components/Marquee.mjs +8 -0
- package/dist/components/MaskInput.d.mts +207 -0
- package/dist/components/MaskInput.mjs +11 -0
- package/dist/components/Masonry.d.mts +66 -0
- package/dist/components/Masonry.mjs +8 -0
- package/dist/components/Mentions.d.mts +1 -1
- package/dist/components/Menu.d.mts +4 -4
- package/dist/components/Modal.d.mts +7 -7
- package/dist/components/NavigationMenu.d.mts +411 -0
- package/dist/components/NavigationMenu.mjs +25 -0
- package/dist/components/NotificationCenter.d.mts +48 -30
- package/dist/components/NotificationCenter.mjs +4 -4
- package/dist/components/NumberKeyboard.d.mts +4 -4
- package/dist/components/OrgChart.d.mts +4 -4
- package/dist/components/OrgChart.mjs +2 -2
- package/dist/components/PageHeader.d.mts +140 -0
- package/dist/components/PageHeader.mjs +11 -0
- package/dist/components/Pagination.d.mts +5 -5
- package/dist/components/Pagination.mjs +1 -1
- package/dist/components/PieChart.d.mts +3 -3
- package/dist/components/PieChart.mjs +4 -4
- package/dist/components/Popconfirm.d.mts +4 -4
- package/dist/components/Popconfirm.mjs +2 -2
- package/dist/components/Popover.d.mts +5 -5
- package/dist/components/Popover.mjs +2 -2
- package/dist/components/Progress.d.mts +7 -7
- package/dist/components/QRCode.d.mts +4 -13
- package/dist/components/QRCode.mjs +1 -1
- package/dist/components/RadarChart.d.mts +3 -3
- package/dist/components/RadarChart.mjs +4 -4
- package/dist/components/Radio.d.mts +1 -1
- package/dist/components/Radio.mjs +1 -1
- package/dist/components/Rate.d.mts +1 -1
- package/dist/components/Rate.mjs +1 -1
- package/dist/components/Result.d.mts +1 -1
- package/dist/components/RichTextEditor.d.mts +4 -4
- package/dist/components/Row.d.mts +1 -1
- package/dist/components/ScatterChart.d.mts +3 -3
- package/dist/components/ScatterChart.mjs +5 -4
- package/dist/components/ScrollArea.d.mts +136 -0
- package/dist/components/ScrollArea.mjs +8 -0
- package/dist/components/ScrollSpy.d.mts +2 -2
- package/dist/components/ScrollSpy.mjs +1 -1
- package/dist/components/Segmented.d.mts +2 -2
- package/dist/components/Select.d.mts +3 -3
- package/dist/components/Signature.d.mts +6 -6
- package/dist/components/Signature.mjs +1 -1
- package/dist/components/Skeleton.d.mts +2 -2
- package/dist/components/Slider.d.mts +19 -1
- package/dist/components/Slider.mjs +1 -1
- package/dist/components/Space.d.mts +2 -2
- package/dist/components/SplitButton.d.mts +286 -0
- package/dist/components/SplitButton.mjs +12 -0
- package/dist/components/Splitter.d.mts +4 -4
- package/dist/components/Splitter.mjs +1 -1
- package/dist/components/Spotlight.d.mts +6 -6
- package/dist/components/Statistic.d.mts +1 -1
- package/dist/components/Stepper.d.mts +7 -1
- package/dist/components/Stepper.mjs +1 -1
- package/dist/components/Steps.d.mts +1 -1
- package/dist/components/SunburstChart.d.mts +2 -2
- package/dist/components/SunburstChart.mjs +4 -4
- package/dist/components/Switch.d.mts +22 -6
- package/dist/components/Switch.mjs +1 -1
- package/dist/components/Table.d.mts +9 -9
- package/dist/components/Table.mjs +3 -3
- package/dist/components/Tabs.d.mts +5 -5
- package/dist/components/Tag.d.mts +3 -3
- package/dist/components/TagsInput.d.mts +214 -0
- package/dist/components/TagsInput.mjs +12 -0
- package/dist/components/TaskBoard.d.mts +2 -2
- package/dist/components/TaskBoard.mjs +1 -1
- package/dist/components/Text.d.mts +3 -3
- package/dist/components/Textarea.d.mts +4 -4
- package/dist/components/Textarea.mjs +1 -1
- package/dist/components/TimePicker.d.mts +6 -6
- package/dist/components/Timeline.d.mts +2 -2
- package/dist/components/Tooltip.d.mts +2 -2
- package/dist/components/Tooltip.mjs +2 -2
- package/dist/components/Tour.d.mts +4 -4
- package/dist/components/Tour.mjs +1 -1
- package/dist/components/Transfer.d.mts +5 -4
- package/dist/components/Transfer.mjs +1 -1
- package/dist/components/Tree.d.mts +6 -6
- package/dist/components/TreeMapChart.d.mts +3 -3
- package/dist/components/TreeMapChart.mjs +4 -4
- package/dist/components/TreeSelect.d.mts +54 -3
- package/dist/components/TreeSelect.mjs +2 -1
- package/dist/components/Upload.d.mts +4 -4
- package/dist/components/Upload.mjs +1 -1
- package/dist/components/VirtualTable.d.mts +5 -5
- package/dist/components/Watermark.d.mts +6 -6
- package/dist/composables/useChartInteraction.d.mts +5 -0
- package/dist/composables/useChartInteraction.mjs +1 -1
- package/dist/index.d.mts +17 -1
- package/dist/index.mjs +406 -0
- package/package.json +117 -2
- package/dist/chunk-OTGGPXDT.mjs +0 -433
- package/dist/chunk-WC5MKASU.mjs +0 -393
|
@@ -10,7 +10,7 @@ import { defineComponent, computed, ref, watch, h, inject, getCurrentInstance }
|
|
|
10
10
|
import {
|
|
11
11
|
classNames,
|
|
12
12
|
coerceClassValue,
|
|
13
|
-
|
|
13
|
+
getInputFieldClasses,
|
|
14
14
|
getInputWrapperClasses,
|
|
15
15
|
getInputAffixClasses,
|
|
16
16
|
getInputErrorClasses,
|
|
@@ -177,14 +177,18 @@ var Input = defineComponent({
|
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
);
|
|
180
|
-
watch(
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
180
|
+
watch(
|
|
181
|
+
[effectiveStatus, effectiveShakeTrigger],
|
|
182
|
+
([newStatus]) => {
|
|
183
|
+
if (newStatus === "error" && wrapperRef.value) {
|
|
184
|
+
const el = wrapperRef.value;
|
|
185
|
+
el.classList.remove(SHAKE_CLASS);
|
|
186
|
+
void el.offsetWidth;
|
|
187
|
+
el.classList.add(SHAKE_CLASS);
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
{ flush: "post" }
|
|
191
|
+
);
|
|
188
192
|
const handleAnimationEnd = () => {
|
|
189
193
|
wrapperRef.value?.classList.remove(SHAKE_CLASS);
|
|
190
194
|
};
|
|
@@ -195,14 +199,6 @@ var Input = defineComponent({
|
|
|
195
199
|
const activeError = computed(
|
|
196
200
|
() => effectiveStatus.value === "error" && !!effectiveErrorMessage.value
|
|
197
201
|
);
|
|
198
|
-
const inputClasses = computed(
|
|
199
|
-
() => getInputClasses({
|
|
200
|
-
size: effectiveSize.value,
|
|
201
|
-
status: effectiveStatus.value,
|
|
202
|
-
hasPrefix: hasPrefix.value,
|
|
203
|
-
hasSuffix: hasSuffix.value
|
|
204
|
-
})
|
|
205
|
-
);
|
|
206
202
|
const effectiveType = computed(() => {
|
|
207
203
|
if (props.showPassword && props.type === "password") {
|
|
208
204
|
return passwordVisible.value ? "text" : "password";
|
|
@@ -233,55 +229,56 @@ var Input = defineComponent({
|
|
|
233
229
|
const currentValStr = String(localValue.value);
|
|
234
230
|
const showClear = props.clearable && !props.disabled && !props.readonly && currentValStr.length > 0;
|
|
235
231
|
const showPasswordToggle = props.showPassword && props.type === "password" && !props.disabled;
|
|
232
|
+
const dualSuffix = showClear && showPasswordToggle;
|
|
233
|
+
const inputClasses = getInputFieldClasses({
|
|
234
|
+
size: effectiveSize.value,
|
|
235
|
+
status: effectiveStatus.value,
|
|
236
|
+
hasPrefix: hasPrefix.value,
|
|
237
|
+
hasSuffix: hasSuffix.value,
|
|
238
|
+
hasDualSuffix: dualSuffix
|
|
239
|
+
});
|
|
236
240
|
const suffixNodes = [];
|
|
237
|
-
if (
|
|
241
|
+
if (showClear) {
|
|
242
|
+
suffixNodes.push(
|
|
243
|
+
h(
|
|
244
|
+
"button",
|
|
245
|
+
{
|
|
246
|
+
type: "button",
|
|
247
|
+
class: getInputClearButtonClasses(
|
|
248
|
+
effectiveSize.value,
|
|
249
|
+
dualSuffix ? { offset: true } : void 0
|
|
250
|
+
),
|
|
251
|
+
onClick: handleClear,
|
|
252
|
+
"aria-label": "Clear input",
|
|
253
|
+
tabindex: -1
|
|
254
|
+
},
|
|
255
|
+
"\u2715"
|
|
256
|
+
)
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
if (showPasswordToggle) {
|
|
260
|
+
suffixNodes.push(
|
|
261
|
+
h(
|
|
262
|
+
"button",
|
|
263
|
+
{
|
|
264
|
+
type: "button",
|
|
265
|
+
class: getInputPasswordToggleClasses(effectiveSize.value),
|
|
266
|
+
onClick: togglePasswordVisibility,
|
|
267
|
+
"aria-label": passwordVisible.value ? "Hide password" : "Show password",
|
|
268
|
+
tabindex: -1
|
|
269
|
+
},
|
|
270
|
+
passwordVisible.value ? "\u{1F648}" : "\u{1F441}"
|
|
271
|
+
)
|
|
272
|
+
);
|
|
273
|
+
}
|
|
274
|
+
if (!showClear && !showPasswordToggle && hasSuffix.value) {
|
|
238
275
|
suffixNodes.push(
|
|
239
276
|
h(
|
|
240
277
|
"div",
|
|
241
|
-
{
|
|
242
|
-
|
|
278
|
+
{ class: getInputAffixClasses("suffix", effectiveSize.value) },
|
|
279
|
+
slots.suffix ? slots.suffix() : props.suffix
|
|
243
280
|
)
|
|
244
281
|
);
|
|
245
|
-
} else {
|
|
246
|
-
if (showClear) {
|
|
247
|
-
suffixNodes.push(
|
|
248
|
-
h(
|
|
249
|
-
"button",
|
|
250
|
-
{
|
|
251
|
-
type: "button",
|
|
252
|
-
class: getInputClearButtonClasses(effectiveSize.value),
|
|
253
|
-
onClick: handleClear,
|
|
254
|
-
"aria-label": "Clear input",
|
|
255
|
-
tabindex: -1
|
|
256
|
-
},
|
|
257
|
-
"\u2715"
|
|
258
|
-
)
|
|
259
|
-
);
|
|
260
|
-
}
|
|
261
|
-
if (showPasswordToggle) {
|
|
262
|
-
suffixNodes.push(
|
|
263
|
-
h(
|
|
264
|
-
"button",
|
|
265
|
-
{
|
|
266
|
-
type: "button",
|
|
267
|
-
class: getInputPasswordToggleClasses(effectiveSize.value),
|
|
268
|
-
onClick: togglePasswordVisibility,
|
|
269
|
-
"aria-label": passwordVisible.value ? "Hide password" : "Show password",
|
|
270
|
-
tabindex: -1
|
|
271
|
-
},
|
|
272
|
-
passwordVisible.value ? "\u{1F648}" : "\u{1F441}"
|
|
273
|
-
)
|
|
274
|
-
);
|
|
275
|
-
}
|
|
276
|
-
if (!showClear && !showPasswordToggle && hasSuffix.value) {
|
|
277
|
-
suffixNodes.push(
|
|
278
|
-
h(
|
|
279
|
-
"div",
|
|
280
|
-
{ class: getInputAffixClasses("suffix", effectiveSize.value) },
|
|
281
|
-
slots.suffix ? slots.suffix() : props.suffix
|
|
282
|
-
)
|
|
283
|
-
);
|
|
284
|
-
}
|
|
285
282
|
}
|
|
286
283
|
const wrapperChildren = [
|
|
287
284
|
hasPrefix.value && h(
|
|
@@ -292,7 +289,7 @@ var Input = defineComponent({
|
|
|
292
289
|
h("input", {
|
|
293
290
|
...restAttrs,
|
|
294
291
|
ref: inputRef,
|
|
295
|
-
class: inputClasses
|
|
292
|
+
class: inputClasses,
|
|
296
293
|
type: effectiveType.value,
|
|
297
294
|
value: localValue.value,
|
|
298
295
|
placeholder: props.placeholder,
|
|
@@ -314,29 +311,41 @@ var Input = defineComponent({
|
|
|
314
311
|
}),
|
|
315
312
|
...suffixNodes
|
|
316
313
|
];
|
|
317
|
-
const
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
314
|
+
const chromeNode = h(
|
|
315
|
+
"div",
|
|
316
|
+
{
|
|
317
|
+
ref: wrapperRef,
|
|
318
|
+
class: classNames(
|
|
319
|
+
getInputWrapperClasses(effectiveStatus.value),
|
|
320
|
+
props.className,
|
|
321
|
+
coerceClassValue(attrClass)
|
|
322
|
+
),
|
|
323
|
+
style: [attrStyle, props.style],
|
|
324
|
+
onAnimationend: handleAnimationEnd
|
|
325
|
+
},
|
|
326
|
+
wrapperChildren
|
|
327
|
+
);
|
|
328
|
+
const extras = [];
|
|
329
|
+
if (activeError.value) {
|
|
330
|
+
extras.push(
|
|
331
|
+
h(
|
|
332
|
+
"div",
|
|
333
|
+
{
|
|
334
|
+
id: errorMsgId,
|
|
335
|
+
class: getInputErrorClasses(effectiveSize.value),
|
|
336
|
+
"aria-live": "polite"
|
|
337
|
+
},
|
|
338
|
+
effectiveErrorMessage.value
|
|
339
|
+
)
|
|
340
|
+
);
|
|
341
|
+
}
|
|
333
342
|
if (props.showCount) {
|
|
334
343
|
const count = currentValStr.length;
|
|
335
344
|
const isOver = props.maxLength !== void 0 && count > props.maxLength;
|
|
336
345
|
const countText = props.maxLength !== void 0 ? `${count} / ${props.maxLength}` : `${count}`;
|
|
337
|
-
|
|
346
|
+
extras.push(h("div", { class: getInputCountClasses(isOver) }, countText));
|
|
338
347
|
}
|
|
339
|
-
return
|
|
348
|
+
return extras.length === 0 ? chromeNode : h("div", { class: "w-full" }, [chromeNode, ...extras]);
|
|
340
349
|
};
|
|
341
350
|
}
|
|
342
351
|
});
|
|
@@ -5,9 +5,11 @@ import {
|
|
|
5
5
|
coerceClassValue,
|
|
6
6
|
getSplitterContainerClasses,
|
|
7
7
|
getSplitterGutterClasses,
|
|
8
|
+
getSplitterGutterCssVars,
|
|
8
9
|
getSplitterGutterHandleClasses,
|
|
9
10
|
getPaneStyle,
|
|
10
11
|
resizePanes,
|
|
12
|
+
resolveInitialPaneSizes,
|
|
11
13
|
createDocumentDragSession
|
|
12
14
|
} from "@expcat/tigercat-core";
|
|
13
15
|
var Splitter = defineComponent({
|
|
@@ -54,29 +56,41 @@ var Splitter = defineComponent({
|
|
|
54
56
|
const startPos = ref(0);
|
|
55
57
|
const startSizes = ref([]);
|
|
56
58
|
let dragSession = null;
|
|
57
|
-
|
|
58
|
-
()
|
|
59
|
-
(newSizes) => {
|
|
60
|
-
if (newSizes) paneSizes.value = [...newSizes];
|
|
61
|
-
},
|
|
62
|
-
{ immediate: true }
|
|
63
|
-
);
|
|
64
|
-
const initSizes = () => {
|
|
65
|
-
if (props.sizes && props.sizes.length > 0) {
|
|
66
|
-
paneSizes.value = [...props.sizes];
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
59
|
+
const getPaneCount = () => {
|
|
60
|
+
if (props.sizes && props.sizes.length > 0) return props.sizes.length;
|
|
69
61
|
const el = containerRef.value;
|
|
70
|
-
if (!el) return;
|
|
71
|
-
|
|
72
|
-
|
|
62
|
+
if (!el) return 0;
|
|
63
|
+
let n = 0;
|
|
64
|
+
for (let i = 0; i < el.children.length; i++) {
|
|
65
|
+
if (el.children[i].classList.contains("tiger-splitter-pane")) n++;
|
|
66
|
+
}
|
|
67
|
+
return n;
|
|
68
|
+
};
|
|
69
|
+
const resolveAndApplySizes = () => {
|
|
70
|
+
const paneCount = getPaneCount();
|
|
73
71
|
if (paneCount === 0) return;
|
|
74
|
-
const
|
|
75
|
-
const
|
|
76
|
-
const
|
|
77
|
-
|
|
72
|
+
const el = containerRef.value;
|
|
73
|
+
const containerSize = el ? props.direction === "horizontal" ? el.clientWidth : el.clientHeight : 0;
|
|
74
|
+
const resolved = resolveInitialPaneSizes(
|
|
75
|
+
paneCount,
|
|
76
|
+
containerSize,
|
|
77
|
+
props.gutterSize,
|
|
78
|
+
props.sizes,
|
|
79
|
+
props.min,
|
|
80
|
+
props.max
|
|
81
|
+
);
|
|
82
|
+
if (resolved) {
|
|
83
|
+
paneSizes.value = resolved;
|
|
84
|
+
}
|
|
78
85
|
};
|
|
79
|
-
|
|
86
|
+
watch(
|
|
87
|
+
() => [props.sizes, props.min, props.max, props.gutterSize, props.direction],
|
|
88
|
+
() => {
|
|
89
|
+
resolveAndApplySizes();
|
|
90
|
+
},
|
|
91
|
+
{ immediate: true, deep: true }
|
|
92
|
+
);
|
|
93
|
+
onMounted(resolveAndApplySizes);
|
|
80
94
|
const containerClasses = computed(
|
|
81
95
|
() => classNames(
|
|
82
96
|
getSplitterContainerClasses(props.direction, props.className),
|
|
@@ -196,7 +210,10 @@ var Splitter = defineComponent({
|
|
|
196
210
|
{
|
|
197
211
|
ref: containerRef,
|
|
198
212
|
class: containerClasses.value,
|
|
199
|
-
style:
|
|
213
|
+
style: {
|
|
214
|
+
...props.style,
|
|
215
|
+
...getSplitterGutterCssVars(props.gutterSize)
|
|
216
|
+
},
|
|
200
217
|
"data-direction": props.direction
|
|
201
218
|
},
|
|
202
219
|
nodes
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Dropdown,
|
|
3
|
+
DropdownItem,
|
|
4
|
+
DropdownMenu
|
|
5
|
+
} from "./chunk-PJQTRDIG.mjs";
|
|
6
|
+
import {
|
|
7
|
+
Button
|
|
8
|
+
} from "./chunk-YZBQ6IR7.mjs";
|
|
9
|
+
import {
|
|
10
|
+
ButtonGroup
|
|
11
|
+
} from "./chunk-Z2ZECCGD.mjs";
|
|
12
|
+
|
|
13
|
+
// src/components/SplitButton.ts
|
|
14
|
+
import { Comment, Fragment, defineComponent, h } from "vue";
|
|
15
|
+
import {
|
|
16
|
+
DROPDOWN_CHEVRON_PATH,
|
|
17
|
+
composeComponentClasses,
|
|
18
|
+
getDropdownChevronClasses,
|
|
19
|
+
getSplitButtonPrimaryClasses,
|
|
20
|
+
getSplitButtonRootClasses,
|
|
21
|
+
getSplitButtonTriggerClasses,
|
|
22
|
+
mergeStyleValues,
|
|
23
|
+
resolveSplitButtonSize,
|
|
24
|
+
resolveSplitButtonTriggerAriaLabel,
|
|
25
|
+
resolveSplitButtonVariant
|
|
26
|
+
} from "@expcat/tigercat-core";
|
|
27
|
+
function flattenVNodes(nodes) {
|
|
28
|
+
const out = [];
|
|
29
|
+
for (const node of nodes ?? []) {
|
|
30
|
+
if (!node || node.type === Comment) continue;
|
|
31
|
+
if (node.type === Fragment && Array.isArray(node.children)) {
|
|
32
|
+
out.push(...flattenVNodes(node.children));
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
out.push(node);
|
|
36
|
+
}
|
|
37
|
+
return out;
|
|
38
|
+
}
|
|
39
|
+
function wrapMenu(nodes) {
|
|
40
|
+
const flattened = flattenVNodes(nodes);
|
|
41
|
+
if (flattened.length === 0) return null;
|
|
42
|
+
const existing = flattened.find((node) => node.type === DropdownMenu);
|
|
43
|
+
if (existing) return existing;
|
|
44
|
+
return h(DropdownMenu, null, { default: () => flattened });
|
|
45
|
+
}
|
|
46
|
+
function partitionDefaultSlot(nodes) {
|
|
47
|
+
const primary = [];
|
|
48
|
+
const menuItems = [];
|
|
49
|
+
let menu = null;
|
|
50
|
+
for (const node of flattenVNodes(nodes)) {
|
|
51
|
+
if (node.type === DropdownMenu) {
|
|
52
|
+
menu = node;
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
if (node.type === DropdownItem) {
|
|
56
|
+
menuItems.push(node);
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
primary.push(node);
|
|
60
|
+
}
|
|
61
|
+
if (!menu && menuItems.length > 0) {
|
|
62
|
+
menu = h(DropdownMenu, null, { default: () => menuItems });
|
|
63
|
+
}
|
|
64
|
+
return { primary, menu };
|
|
65
|
+
}
|
|
66
|
+
function createChevron(open) {
|
|
67
|
+
return h(
|
|
68
|
+
"svg",
|
|
69
|
+
{
|
|
70
|
+
class: getDropdownChevronClasses(open),
|
|
71
|
+
viewBox: "0 0 24 24",
|
|
72
|
+
fill: "none",
|
|
73
|
+
stroke: "currentColor",
|
|
74
|
+
"stroke-width": "2",
|
|
75
|
+
"stroke-linecap": "round",
|
|
76
|
+
"stroke-linejoin": "round",
|
|
77
|
+
"aria-hidden": "true",
|
|
78
|
+
focusable: "false"
|
|
79
|
+
},
|
|
80
|
+
[h("path", { d: DROPDOWN_CHEVRON_PATH })]
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
var SplitButton = defineComponent({
|
|
84
|
+
name: "TigerSplitButton",
|
|
85
|
+
inheritAttrs: false,
|
|
86
|
+
props: {
|
|
87
|
+
/**
|
|
88
|
+
* Visual variant applied to the primary action and the menu trigger
|
|
89
|
+
* @default 'primary'
|
|
90
|
+
*/
|
|
91
|
+
variant: {
|
|
92
|
+
type: String,
|
|
93
|
+
default: "primary"
|
|
94
|
+
},
|
|
95
|
+
/**
|
|
96
|
+
* Size applied to the primary action and the menu trigger
|
|
97
|
+
* @default 'md'
|
|
98
|
+
*/
|
|
99
|
+
size: {
|
|
100
|
+
type: String,
|
|
101
|
+
default: "md"
|
|
102
|
+
},
|
|
103
|
+
/**
|
|
104
|
+
* Whether both the primary action and the menu trigger are disabled
|
|
105
|
+
*/
|
|
106
|
+
disabled: Boolean,
|
|
107
|
+
/**
|
|
108
|
+
* Whether the primary action is in a loading state. Also disables the menu trigger.
|
|
109
|
+
*/
|
|
110
|
+
loading: Boolean,
|
|
111
|
+
/**
|
|
112
|
+
* Whether to apply danger/destructive styling to both buttons
|
|
113
|
+
*/
|
|
114
|
+
danger: Boolean,
|
|
115
|
+
/**
|
|
116
|
+
* Whether the split control should take the full width of its parent
|
|
117
|
+
*/
|
|
118
|
+
block: Boolean,
|
|
119
|
+
/**
|
|
120
|
+
* HTML button type for the primary action
|
|
121
|
+
* @default 'button'
|
|
122
|
+
*/
|
|
123
|
+
htmlType: {
|
|
124
|
+
type: String,
|
|
125
|
+
default: "button"
|
|
126
|
+
},
|
|
127
|
+
/**
|
|
128
|
+
* Position of the icon relative to the primary action text
|
|
129
|
+
* @default 'left'
|
|
130
|
+
*/
|
|
131
|
+
iconPosition: {
|
|
132
|
+
type: String,
|
|
133
|
+
default: "left"
|
|
134
|
+
},
|
|
135
|
+
/**
|
|
136
|
+
* Whether the menu is open (controlled mode)
|
|
137
|
+
*/
|
|
138
|
+
open: {
|
|
139
|
+
type: Boolean,
|
|
140
|
+
default: void 0
|
|
141
|
+
},
|
|
142
|
+
/**
|
|
143
|
+
* Default open state (uncontrolled mode)
|
|
144
|
+
* @default false
|
|
145
|
+
*/
|
|
146
|
+
defaultOpen: {
|
|
147
|
+
type: Boolean,
|
|
148
|
+
default: false
|
|
149
|
+
},
|
|
150
|
+
/**
|
|
151
|
+
* Whether to close the menu when a menu item is clicked
|
|
152
|
+
* @default true
|
|
153
|
+
*/
|
|
154
|
+
closeOnClick: {
|
|
155
|
+
type: Boolean,
|
|
156
|
+
default: true
|
|
157
|
+
},
|
|
158
|
+
/**
|
|
159
|
+
* Render the menu into document.body (Teleport)
|
|
160
|
+
* @default true
|
|
161
|
+
*/
|
|
162
|
+
portal: {
|
|
163
|
+
type: Boolean,
|
|
164
|
+
default: true
|
|
165
|
+
},
|
|
166
|
+
/**
|
|
167
|
+
* Accessible name for the chevron menu trigger
|
|
168
|
+
* @default 'More options'
|
|
169
|
+
*/
|
|
170
|
+
triggerAriaLabel: {
|
|
171
|
+
type: String,
|
|
172
|
+
default: void 0
|
|
173
|
+
},
|
|
174
|
+
/**
|
|
175
|
+
* Dropdown placement relative to the chevron trigger
|
|
176
|
+
* @default 'bottom-end'
|
|
177
|
+
*/
|
|
178
|
+
placement: {
|
|
179
|
+
type: String,
|
|
180
|
+
default: "bottom-end"
|
|
181
|
+
},
|
|
182
|
+
/**
|
|
183
|
+
* Offset distance from the chevron trigger
|
|
184
|
+
* @default 4
|
|
185
|
+
*/
|
|
186
|
+
offset: {
|
|
187
|
+
type: Number,
|
|
188
|
+
default: 4
|
|
189
|
+
},
|
|
190
|
+
/**
|
|
191
|
+
* Additional CSS classes
|
|
192
|
+
*/
|
|
193
|
+
className: {
|
|
194
|
+
type: String,
|
|
195
|
+
default: void 0
|
|
196
|
+
},
|
|
197
|
+
/**
|
|
198
|
+
* Inline styles
|
|
199
|
+
*/
|
|
200
|
+
style: {
|
|
201
|
+
type: Object,
|
|
202
|
+
default: void 0
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
emits: ["click", "update:open", "open-change"],
|
|
206
|
+
setup(props, { slots, emit, attrs }) {
|
|
207
|
+
return () => {
|
|
208
|
+
const attrsRecord = attrs;
|
|
209
|
+
const {
|
|
210
|
+
class: _class,
|
|
211
|
+
style: _style,
|
|
212
|
+
...restAttrs
|
|
213
|
+
} = attrsRecord;
|
|
214
|
+
const variant = resolveSplitButtonVariant(props.variant);
|
|
215
|
+
const size = resolveSplitButtonSize(props.size);
|
|
216
|
+
const isDisabled = props.disabled || props.loading;
|
|
217
|
+
const triggerLabel = resolveSplitButtonTriggerAriaLabel(props.triggerAriaLabel);
|
|
218
|
+
const partitioned = partitionDefaultSlot(slots.default?.());
|
|
219
|
+
const menuNode = wrapMenu(slots.menu?.()) ?? partitioned.menu;
|
|
220
|
+
const primaryButton = h(
|
|
221
|
+
Button,
|
|
222
|
+
{
|
|
223
|
+
variant,
|
|
224
|
+
size,
|
|
225
|
+
disabled: props.disabled,
|
|
226
|
+
loading: props.loading,
|
|
227
|
+
danger: props.danger,
|
|
228
|
+
htmlType: props.htmlType,
|
|
229
|
+
iconPosition: props.iconPosition,
|
|
230
|
+
className: getSplitButtonPrimaryClasses({ block: props.block }),
|
|
231
|
+
"data-split-button-primary": "",
|
|
232
|
+
onClick: (event) => emit("click", event)
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
default: () => partitioned.primary,
|
|
236
|
+
icon: slots.icon,
|
|
237
|
+
"loading-icon": slots["loading-icon"]
|
|
238
|
+
}
|
|
239
|
+
);
|
|
240
|
+
const dropdown = h(
|
|
241
|
+
Dropdown,
|
|
242
|
+
{
|
|
243
|
+
trigger: "click",
|
|
244
|
+
showArrow: false,
|
|
245
|
+
disabled: isDisabled,
|
|
246
|
+
open: props.open,
|
|
247
|
+
defaultOpen: props.defaultOpen,
|
|
248
|
+
closeOnClick: props.closeOnClick,
|
|
249
|
+
portal: props.portal,
|
|
250
|
+
placement: props.placement,
|
|
251
|
+
offset: props.offset,
|
|
252
|
+
"onUpdate:open": (visible) => emit("update:open", visible),
|
|
253
|
+
onOpenChange: (visible) => emit("open-change", visible)
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
trigger: ({ open }) => h(
|
|
257
|
+
Button,
|
|
258
|
+
{
|
|
259
|
+
variant,
|
|
260
|
+
size,
|
|
261
|
+
disabled: isDisabled,
|
|
262
|
+
danger: props.danger,
|
|
263
|
+
htmlType: "button",
|
|
264
|
+
className: getSplitButtonTriggerClasses({ size }),
|
|
265
|
+
"aria-label": triggerLabel,
|
|
266
|
+
"aria-haspopup": "menu",
|
|
267
|
+
"aria-expanded": open,
|
|
268
|
+
"data-split-button-trigger": ""
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
default: () => slots.trigger?.({ open }) ?? createChevron(open)
|
|
272
|
+
}
|
|
273
|
+
),
|
|
274
|
+
default: () => menuNode
|
|
275
|
+
}
|
|
276
|
+
);
|
|
277
|
+
return h(
|
|
278
|
+
ButtonGroup,
|
|
279
|
+
{
|
|
280
|
+
...restAttrs,
|
|
281
|
+
size,
|
|
282
|
+
className: composeComponentClasses(
|
|
283
|
+
getSplitButtonRootClasses({
|
|
284
|
+
block: props.block,
|
|
285
|
+
className: props.className
|
|
286
|
+
}),
|
|
287
|
+
attrsRecord.class
|
|
288
|
+
),
|
|
289
|
+
style: mergeStyleValues(attrsRecord.style, props.style),
|
|
290
|
+
"data-split-button": ""
|
|
291
|
+
},
|
|
292
|
+
{ default: () => [primaryButton, dropdown] }
|
|
293
|
+
);
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
var SplitButton_default = SplitButton;
|
|
298
|
+
|
|
299
|
+
export {
|
|
300
|
+
SplitButton,
|
|
301
|
+
SplitButton_default
|
|
302
|
+
};
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
getAnchorLinkClasses,
|
|
23
23
|
getAnchorLinkListClasses,
|
|
24
24
|
createAnchorObserver,
|
|
25
|
+
createProgrammaticScrollLock,
|
|
25
26
|
scrollToAnchor
|
|
26
27
|
} from "@expcat/tigercat-core";
|
|
27
28
|
var AnchorContextKey = /* @__PURE__ */ Symbol("AnchorContext");
|
|
@@ -200,9 +201,8 @@ var Anchor = defineComponent({
|
|
|
200
201
|
const links = ref([]);
|
|
201
202
|
const anchorRef = ref(null);
|
|
202
203
|
const inkRef = ref(null);
|
|
203
|
-
const isScrolling = ref(false);
|
|
204
|
-
let scrollTimeoutId = null;
|
|
205
204
|
const getContainer = () => props.getContainer();
|
|
205
|
+
const scrollLock = createProgrammaticScrollLock(getContainer);
|
|
206
206
|
const scrollOffset = computed(() => props.targetOffset ?? props.offsetTop);
|
|
207
207
|
const registerLink = (href) => {
|
|
208
208
|
if (href && !links.value.includes(href)) {
|
|
@@ -219,9 +219,10 @@ var Anchor = defineComponent({
|
|
|
219
219
|
const root = container === window ? null : container;
|
|
220
220
|
stopObserver = createAnchorObserver(links.value, {
|
|
221
221
|
offsetTop: scrollOffset.value,
|
|
222
|
+
bounds: props.bounds,
|
|
222
223
|
root,
|
|
223
224
|
onChange: (newActiveLink) => {
|
|
224
|
-
if (
|
|
225
|
+
if (scrollLock.isLocked()) return;
|
|
225
226
|
const finalActiveLink = props.getCurrentAnchor ? props.getCurrentAnchor(newActiveLink) : newActiveLink;
|
|
226
227
|
if (finalActiveLink !== activeLink.value) {
|
|
227
228
|
activeLink.value = finalActiveLink;
|
|
@@ -235,14 +236,9 @@ var Anchor = defineComponent({
|
|
|
235
236
|
};
|
|
236
237
|
const handleLinkClick = (href, event) => {
|
|
237
238
|
emit("click", event, href);
|
|
238
|
-
|
|
239
|
+
scrollLock.lock();
|
|
239
240
|
activeLink.value = href;
|
|
240
241
|
scrollTo(href);
|
|
241
|
-
if (scrollTimeoutId !== null) clearTimeout(scrollTimeoutId);
|
|
242
|
-
scrollTimeoutId = setTimeout(() => {
|
|
243
|
-
isScrolling.value = false;
|
|
244
|
-
scrollTimeoutId = null;
|
|
245
|
-
}, 500);
|
|
246
242
|
};
|
|
247
243
|
const updateInkPosition = () => {
|
|
248
244
|
if (!inkRef.value || !anchorRef.value || !activeLink.value) {
|
|
@@ -274,14 +270,12 @@ var Anchor = defineComponent({
|
|
|
274
270
|
setTimeout(updateInkPosition, 0);
|
|
275
271
|
});
|
|
276
272
|
});
|
|
277
|
-
watch([links, scrollOffset, () => props.getContainer], () => {
|
|
273
|
+
watch([links, scrollOffset, () => props.getContainer, () => props.bounds], () => {
|
|
278
274
|
nextTick(() => setupObserver());
|
|
279
275
|
});
|
|
280
276
|
onBeforeUnmount(() => {
|
|
281
277
|
stopObserver?.();
|
|
282
|
-
|
|
283
|
-
clearTimeout(scrollTimeoutId);
|
|
284
|
-
}
|
|
278
|
+
scrollLock.dispose();
|
|
285
279
|
});
|
|
286
280
|
const wrapperClasses = computed(() => {
|
|
287
281
|
return classNames(
|