vue-devui 1.0.0-rc.1 → 1.0.0-rc.12
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 +70 -121
- package/alert/index.es.js +46 -15
- package/alert/index.umd.js +1 -1
- package/alert/style.css +1 -1
- package/auto-complete/index.es.js +8204 -296
- package/auto-complete/index.umd.js +29 -1
- package/auto-complete/style.css +1 -1
- package/avatar/index.es.js +153 -146
- package/avatar/index.umd.js +1 -1
- package/avatar/style.css +1 -1
- package/badge/index.es.js +36 -5
- package/badge/index.umd.js +1 -1
- package/badge/style.css +1 -1
- package/button/index.es.js +5727 -111
- package/button/index.umd.js +27 -1
- package/button/style.css +1 -1
- package/card/index.es.js +63 -35
- package/card/index.umd.js +1 -1
- package/card/style.css +1 -1
- package/checkbox/index.es.js +8068 -255
- package/checkbox/index.umd.js +27 -1
- package/checkbox/style.css +1 -1
- package/{accordion → collapse}/index.d.ts +0 -0
- package/collapse/index.es.js +213 -0
- package/collapse/index.umd.js +1 -0
- package/{anchor → collapse}/package.json +1 -1
- package/collapse/style.css +1 -0
- package/countdown/index.es.js +59 -19
- package/countdown/index.umd.js +1 -1
- package/{anchor → date-picker-pro}/index.d.ts +0 -0
- package/date-picker-pro/index.es.js +10856 -0
- package/date-picker-pro/index.umd.js +27 -0
- package/{breadcrumb → date-picker-pro}/package.json +1 -1
- package/date-picker-pro/style.css +1 -0
- package/drawer/index.es.js +31 -4
- package/drawer/index.umd.js +1 -1
- package/drawer/style.css +1 -1
- package/dropdown/index.es.js +210 -149
- package/dropdown/index.umd.js +1 -1
- package/dropdown/style.css +1 -1
- package/editable-select/index.es.js +569 -159
- package/editable-select/index.umd.js +1 -1
- package/editable-select/style.css +1 -1
- package/form/index.es.js +1048 -1187
- package/form/index.umd.js +15 -15
- package/form/style.css +1 -1
- package/fullscreen/index.es.js +29 -5
- package/fullscreen/index.umd.js +1 -1
- package/fullscreen/style.css +1 -1
- package/grid/index.es.js +101 -86
- package/grid/index.umd.js +1 -1
- package/grid/style.css +1 -1
- package/icon/index.es.js +183 -23
- package/icon/index.umd.js +1 -1
- package/icon/style.css +1 -0
- package/image-preview/index.es.js +53 -30
- package/image-preview/index.umd.js +1 -1
- package/image-preview/style.css +1 -1
- package/input/index.es.js +8101 -144
- package/input/index.umd.js +27 -1
- package/input/style.css +1 -1
- package/input-number/index.es.js +274 -177
- package/input-number/index.umd.js +1 -1
- package/input-number/style.css +1 -1
- package/layout/index.es.js +40 -25
- package/layout/index.umd.js +1 -1
- package/layout/style.css +1 -1
- package/loading/index.es.js +74 -35
- package/loading/index.umd.js +1 -1
- package/loading/style.css +1 -1
- package/modal/index.es.js +375 -171
- package/modal/index.umd.js +1 -1
- package/modal/style.css +1 -1
- package/notification/index.es.js +293 -40
- package/notification/index.umd.js +1 -1
- package/notification/style.css +1 -1
- package/nuxt/components/ButtonGroup.js +3 -0
- package/nuxt/components/CheckboxButton.js +3 -0
- package/nuxt/components/CheckboxGroup.js +3 -0
- package/nuxt/components/Collapse.js +3 -0
- package/nuxt/components/CollapseItem.js +3 -0
- package/nuxt/components/DRangeDatePickerPro.js +3 -0
- package/nuxt/components/DatePickerPro.js +3 -0
- package/nuxt/components/DropdownPropsKey.js +3 -0
- package/nuxt/components/FORM_ITEM_TOKEN.js +3 -0
- package/nuxt/components/FORM_TOKEN.js +3 -0
- package/nuxt/components/Icon.js +1 -0
- package/nuxt/components/IconGroup.js +3 -0
- package/nuxt/components/LABEL_DATA.js +3 -0
- package/nuxt/components/LoadingOptions.js +3 -0
- package/nuxt/components/Option.js +3 -0
- package/nuxt/components/OptionGroup.js +3 -0
- package/nuxt/components/RadioButton.js +3 -0
- package/nuxt/components/Step.js +3 -0
- package/nuxt/components/Steps.js +3 -0
- package/nuxt/components/TABLE_TOKEN.js +3 -0
- package/nuxt/components/Tab.js +3 -0
- package/nuxt/components/TimeSelect.js +3 -0
- package/nuxt/components/autoCompleteProps.js +3 -0
- package/nuxt/components/avatarProps.js +3 -0
- package/nuxt/components/buttonGroupInjectionKey.js +3 -0
- package/nuxt/components/buttonGroupProps.js +3 -0
- package/nuxt/components/cardProps.js +3 -0
- package/nuxt/components/checkboxGroupInjectionKey.js +3 -0
- package/nuxt/components/checkboxGroupProps.js +3 -0
- package/nuxt/components/checkboxProps.js +3 -0
- package/nuxt/components/colProps.js +3 -0
- package/nuxt/components/colPropsBaseClass.js +3 -0
- package/nuxt/components/colPropsBaseStyle.js +3 -0
- package/nuxt/components/collapseItemProps.js +3 -0
- package/nuxt/components/collapseProps.js +3 -0
- package/nuxt/components/countdownProps.js +3 -0
- package/nuxt/components/datePickerProCommonProps.js +3 -0
- package/nuxt/components/datePickerProPanelProps.js +3 -0
- package/nuxt/components/datePickerProProps.js +3 -0
- package/nuxt/components/editableSelectProps.js +3 -0
- package/nuxt/components/formItemProps.js +3 -0
- package/nuxt/components/formProps.js +3 -0
- package/nuxt/components/iconProps.js +1 -0
- package/nuxt/components/imagePreviewProps.js +3 -0
- package/nuxt/components/inputProps.js +3 -0
- package/nuxt/components/loadingProps.js +3 -0
- package/nuxt/components/modalProps.js +3 -0
- package/nuxt/components/progressProps.js +3 -0
- package/nuxt/components/rateProps.js +3 -0
- package/nuxt/components/resultProps.js +3 -0
- package/nuxt/components/rowProps.js +3 -0
- package/nuxt/components/screenSizes.js +3 -0
- package/nuxt/components/skeletonProps.js +3 -0
- package/nuxt/components/sliderProps.js +3 -0
- package/nuxt/components/splitterProps.js +3 -0
- package/nuxt/components/statisticProps.js +3 -0
- package/nuxt/components/stepProps.js +3 -0
- package/nuxt/components/stepsProps.js +3 -0
- package/nuxt/components/svgIconProps.js +3 -0
- package/nuxt/components/switchProps.js +3 -0
- package/nuxt/components/tableProps.js +3 -0
- package/nuxt/components/tabsProps.js +3 -0
- package/nuxt/components/tagProps.js +3 -0
- package/nuxt/components/textareaProps.js +3 -0
- package/nuxt/components/timeAxisProps.js +3 -0
- package/nuxt/components/timerPickerPanelProps.js +3 -0
- package/nuxt/components/treeProps.js +3 -0
- package/overlay/index.es.js +104 -133
- package/overlay/index.umd.js +1 -1
- package/overlay/style.css +1 -1
- package/package.json +4 -2
- package/pagination/index.es.js +171 -141
- package/pagination/index.umd.js +1 -1
- package/pagination/style.css +1 -1
- package/panel/style.css +1 -1
- package/popover/index.es.js +294 -230
- package/popover/index.umd.js +15 -15
- package/popover/style.css +1 -1
- package/progress/index.es.js +110 -56
- package/progress/index.umd.js +3 -3
- package/progress/style.css +1 -1
- package/radio/index.es.js +7967 -146
- package/radio/index.umd.js +27 -1
- package/radio/style.css +1 -1
- package/rate/index.es.js +77 -55
- package/rate/index.umd.js +1 -1
- package/rate/style.css +1 -1
- package/result/index.es.js +170 -27
- package/result/index.umd.js +1 -1
- package/result/style.css +1 -1
- package/ripple/index.es.js +43 -42
- package/ripple/index.umd.js +1 -1
- package/search/index.es.js +3660 -1097
- package/search/index.umd.js +18 -18
- package/search/style.css +1 -1
- package/select/index.es.js +8998 -487
- package/select/index.umd.js +27 -1
- package/select/style.css +1 -1
- package/skeleton/index.es.js +46 -24
- package/skeleton/index.umd.js +1 -1
- package/skeleton/style.css +1 -1
- package/slider/index.es.js +144 -138
- package/slider/index.umd.js +1 -1
- package/slider/style.css +1 -1
- package/splitter/index.es.js +468 -340
- package/splitter/index.umd.js +16 -16
- package/splitter/style.css +1 -1
- package/statistic/index.es.js +41 -34
- package/statistic/index.umd.js +1 -1
- package/statistic/style.css +1 -1
- package/status/index.es.js +26 -2
- package/status/index.umd.js +1 -1
- package/status/style.css +1 -1
- package/{back-top → steps}/index.d.ts +0 -0
- package/steps/index.es.js +385 -0
- package/steps/index.umd.js +1 -0
- package/{gantt → steps}/package.json +1 -1
- package/steps/style.css +1 -0
- package/style.css +1 -1
- package/switch/index.es.js +7802 -64
- package/switch/index.umd.js +27 -1
- package/switch/style.css +1 -1
- package/table/index.es.js +10315 -1147
- package/table/index.umd.js +27 -1
- package/table/style.css +1 -1
- package/tabs/index.es.js +345 -142
- package/tabs/index.umd.js +1 -1
- package/tabs/style.css +1 -1
- package/tag/index.es.js +47 -23
- package/tag/index.umd.js +1 -1
- package/tag/style.css +1 -1
- package/textarea/index.es.js +7921 -83
- package/textarea/index.umd.js +35 -1
- package/textarea/style.css +1 -1
- package/time-picker/index.es.js +8704 -559
- package/time-picker/index.umd.js +27 -1
- package/time-picker/style.css +1 -1
- package/{breadcrumb → time-select}/index.d.ts +0 -0
- package/{color-picker → time-select}/index.es.js +4116 -2914
- package/time-select/index.umd.js +27 -0
- package/{back-top → time-select}/package.json +1 -1
- package/time-select/style.css +1 -0
- package/timeline/index.es.js +177 -37
- package/timeline/index.umd.js +1 -1
- package/timeline/style.css +1 -1
- package/tooltip/index.es.js +286 -221
- package/tooltip/index.umd.js +15 -15
- package/tooltip/style.css +1 -1
- package/tree/index.es.js +5325 -1855
- package/tree/index.umd.js +18 -18
- package/tree/style.css +1 -1
- package/upload/index.es.js +456 -133
- package/upload/index.umd.js +1 -1
- package/upload/style.css +1 -1
- package/vue-devui.es.js +14986 -16343
- package/vue-devui.umd.js +30 -20
- package/accordion/index.es.js +0 -723
- package/accordion/index.umd.js +0 -1
- package/accordion/package.json +0 -7
- package/accordion/style.css +0 -1
- package/anchor/index.es.js +0 -263
- package/anchor/index.umd.js +0 -1
- package/anchor/style.css +0 -1
- package/back-top/index.es.js +0 -130
- package/back-top/index.umd.js +0 -1
- package/back-top/style.css +0 -1
- package/breadcrumb/index.es.js +0 -128
- package/breadcrumb/index.umd.js +0 -1
- package/breadcrumb/style.css +0 -1
- package/carousel/index.d.ts +0 -7
- package/carousel/index.es.js +0 -314
- package/carousel/index.umd.js +0 -1
- package/carousel/package.json +0 -7
- package/carousel/style.css +0 -1
- package/cascader/index.d.ts +0 -7
- package/cascader/index.es.js +0 -5971
- package/cascader/index.umd.js +0 -27
- package/cascader/package.json +0 -7
- package/cascader/style.css +0 -1
- package/color-picker/index.d.ts +0 -7
- package/color-picker/index.umd.js +0 -27
- package/color-picker/package.json +0 -7
- package/color-picker/style.css +0 -1
- package/comment/index.d.ts +0 -7
- package/comment/index.es.js +0 -86
- package/comment/index.umd.js +0 -1
- package/comment/package.json +0 -7
- package/comment/style.css +0 -1
- package/date-picker/index.d.ts +0 -7
- package/date-picker/index.es.js +0 -1154
- package/date-picker/index.umd.js +0 -1
- package/date-picker/package.json +0 -7
- package/date-picker/style.css +0 -1
- package/dragdrop/index.d.ts +0 -7
- package/dragdrop/index.es.js +0 -157
- package/dragdrop/index.umd.js +0 -1
- package/dragdrop/package.json +0 -7
- package/gantt/index.d.ts +0 -7
- package/gantt/index.es.js +0 -523
- package/gantt/index.umd.js +0 -1
- package/gantt/style.css +0 -1
- package/input-icon/index.d.ts +0 -7
- package/input-icon/index.es.js +0 -332
- package/input-icon/index.umd.js +0 -1
- package/input-icon/package.json +0 -7
- package/input-icon/style.css +0 -1
- package/list/index.d.ts +0 -7
- package/list/index.es.js +0 -39
- package/list/index.umd.js +0 -1
- package/list/package.json +0 -7
- package/list/style.css +0 -1
- package/nav-sprite/index.d.ts +0 -7
- package/nav-sprite/index.es.js +0 -68
- package/nav-sprite/index.umd.js +0 -1
- package/nav-sprite/package.json +0 -7
- package/nuxt/components/Accordion.js +0 -3
- package/nuxt/components/Anchor.js +0 -3
- package/nuxt/components/BackTop.js +0 -3
- package/nuxt/components/Breadcrumb.js +0 -3
- package/nuxt/components/Carousel.js +0 -3
- package/nuxt/components/CarouselItem.js +0 -3
- package/nuxt/components/Cascader.js +0 -3
- package/nuxt/components/ColorPicker.js +0 -3
- package/nuxt/components/Comment.js +0 -3
- package/nuxt/components/DatePicker.js +0 -3
- package/nuxt/components/FormControl.js +0 -3
- package/nuxt/components/FormLabel.js +0 -3
- package/nuxt/components/Gantt.js +0 -3
- package/nuxt/components/InputIcon.js +0 -3
- package/nuxt/components/List.js +0 -3
- package/nuxt/components/ListItem.js +0 -3
- package/nuxt/components/NavSprite.js +0 -2
- package/nuxt/components/QuadrantDiagram.js +0 -3
- package/nuxt/components/ReadTip.js +0 -3
- package/nuxt/components/StepsGuide.js +0 -3
- package/nuxt/components/StickSlider.js +0 -3
- package/nuxt/components/Sticky.js +0 -2
- package/nuxt/components/TagInput.js +0 -3
- package/nuxt/components/Transfer.js +0 -3
- package/nuxt/components/TreeSelect.js +0 -3
- package/nuxt/components/overlayEmits.js +0 -3
- package/nuxt/components/overlayProps.js +0 -3
- package/quadrant-diagram/index.d.ts +0 -7
- package/quadrant-diagram/index.es.js +0 -5728
- package/quadrant-diagram/index.umd.js +0 -27
- package/quadrant-diagram/package.json +0 -7
- package/quadrant-diagram/style.css +0 -1
- package/read-tip/index.d.ts +0 -7
- package/read-tip/index.es.js +0 -261
- package/read-tip/index.umd.js +0 -1
- package/read-tip/package.json +0 -7
- package/read-tip/style.css +0 -1
- package/steps-guide/index.d.ts +0 -7
- package/steps-guide/index.es.js +0 -242
- package/steps-guide/index.umd.js +0 -1
- package/steps-guide/package.json +0 -7
- package/steps-guide/style.css +0 -1
- package/sticky/index.d.ts +0 -7
- package/sticky/index.es.js +0 -197
- package/sticky/index.umd.js +0 -1
- package/sticky/package.json +0 -7
- package/tag-input/index.d.ts +0 -7
- package/tag-input/index.es.js +0 -331
- package/tag-input/index.umd.js +0 -1
- package/tag-input/package.json +0 -7
- package/tag-input/style.css +0 -1
- package/transfer/index.d.ts +0 -7
- package/transfer/index.es.js +0 -7615
- package/transfer/index.umd.js +0 -27
- package/transfer/package.json +0 -7
- package/transfer/style.css +0 -1
- package/tree-select/index.d.ts +0 -7
- package/tree-select/index.es.js +0 -627
- package/tree-select/index.umd.js +0 -1
- package/tree-select/package.json +0 -7
- package/tree-select/style.css +0 -1
package/steps-guide/index.es.js
DELETED
|
@@ -1,242 +0,0 @@
|
|
|
1
|
-
import { reactive, ref, nextTick, computed, defineComponent, onMounted, createVNode, Teleport } from "vue";
|
|
2
|
-
var stepsGuide = "";
|
|
3
|
-
const stepsGuideProps = {
|
|
4
|
-
steps: Array,
|
|
5
|
-
stepIndex: {
|
|
6
|
-
type: Number,
|
|
7
|
-
default: void 0
|
|
8
|
-
},
|
|
9
|
-
showClose: {
|
|
10
|
-
type: Boolean,
|
|
11
|
-
default: true
|
|
12
|
-
},
|
|
13
|
-
showDots: {
|
|
14
|
-
type: Boolean,
|
|
15
|
-
default: true
|
|
16
|
-
},
|
|
17
|
-
scrollToTargetSwitch: {
|
|
18
|
-
type: Boolean,
|
|
19
|
-
default: true
|
|
20
|
-
},
|
|
21
|
-
zIndex: {
|
|
22
|
-
type: Number,
|
|
23
|
-
default: 1100
|
|
24
|
-
},
|
|
25
|
-
stepChange: {
|
|
26
|
-
type: Function,
|
|
27
|
-
default() {
|
|
28
|
-
return true;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
function useStepsGuidePosition(props, currentStep) {
|
|
33
|
-
const guideClassList = reactive(["devui-steps-guide"]);
|
|
34
|
-
const stepsRef = ref(null);
|
|
35
|
-
const guidePosition = reactive({
|
|
36
|
-
left: "",
|
|
37
|
-
top: "",
|
|
38
|
-
zIndex: props.zIndex
|
|
39
|
-
});
|
|
40
|
-
const updateGuidePosition = () => {
|
|
41
|
-
if (!currentStep.value || !stepsRef.value) {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
const baseTop = window.pageYOffset - document.documentElement.clientTop;
|
|
45
|
-
const baseLeft = window.pageXOffset - document.documentElement.clientLeft;
|
|
46
|
-
const currentStepPosition = currentStep.value.position;
|
|
47
|
-
const stepGuideElement = stepsRef.value;
|
|
48
|
-
let _left, _top;
|
|
49
|
-
if (typeof currentStepPosition !== "string") {
|
|
50
|
-
const { top = 0, left = 0, type = "top" } = currentStepPosition;
|
|
51
|
-
guideClassList.splice(1, 1, type);
|
|
52
|
-
_left = left;
|
|
53
|
-
_top = top;
|
|
54
|
-
} else {
|
|
55
|
-
guideClassList.splice(1, 1, currentStepPosition);
|
|
56
|
-
const triggerSelector = currentStep.value.target || currentStep.value.trigger;
|
|
57
|
-
const triggerElement = document.querySelector(triggerSelector);
|
|
58
|
-
if (!triggerElement) {
|
|
59
|
-
console.warn(`${triggerSelector} \u4E0D\u5B58\u5728!`);
|
|
60
|
-
return false;
|
|
61
|
-
}
|
|
62
|
-
const targetRect = triggerElement.getBoundingClientRect();
|
|
63
|
-
_left = targetRect.left + triggerElement.clientWidth / 2 - stepGuideElement.clientWidth / 2 + baseLeft;
|
|
64
|
-
_top = targetRect.top + triggerElement.clientHeight / 2 - stepGuideElement.clientHeight / 2 + baseTop;
|
|
65
|
-
const positionTypes = currentStepPosition.split("-");
|
|
66
|
-
switch (positionTypes[0]) {
|
|
67
|
-
case "top":
|
|
68
|
-
_top += -stepGuideElement.clientHeight / 2 - triggerElement.clientHeight;
|
|
69
|
-
break;
|
|
70
|
-
case "bottom":
|
|
71
|
-
_top += stepGuideElement.clientHeight / 2 + triggerElement.clientHeight;
|
|
72
|
-
break;
|
|
73
|
-
case "left":
|
|
74
|
-
_top += stepGuideElement.clientHeight / 2 - triggerElement.clientHeight;
|
|
75
|
-
_left += -stepGuideElement.clientWidth / 2 - triggerElement.clientWidth / 2;
|
|
76
|
-
break;
|
|
77
|
-
case "right":
|
|
78
|
-
_top += stepGuideElement.clientHeight / 2 - triggerElement.clientHeight;
|
|
79
|
-
_left += stepGuideElement.clientWidth / 2 + triggerElement.clientWidth / 2;
|
|
80
|
-
break;
|
|
81
|
-
}
|
|
82
|
-
switch (positionTypes[1]) {
|
|
83
|
-
case "left":
|
|
84
|
-
_left += stepGuideElement.clientWidth / 2 - triggerElement.clientWidth / 2;
|
|
85
|
-
break;
|
|
86
|
-
case "right":
|
|
87
|
-
_left += -stepGuideElement.clientWidth / 2 + triggerElement.clientWidth / 2;
|
|
88
|
-
break;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
guidePosition.left = _left + "px";
|
|
92
|
-
guidePosition.top = _top + "px";
|
|
93
|
-
if (props.scrollToTargetSwitch && typeof stepGuideElement.scrollIntoView === "function") {
|
|
94
|
-
nextTick(() => {
|
|
95
|
-
stepGuideElement.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" });
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
return {
|
|
100
|
-
stepsRef,
|
|
101
|
-
guidePosition,
|
|
102
|
-
guideClassList,
|
|
103
|
-
updateGuidePosition
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
function useStepsGuideCtrl(props, ctx, updateGuidePosition, stepIndex) {
|
|
107
|
-
const stepsCount = computed(() => props.steps.length);
|
|
108
|
-
const closeGuide = () => {
|
|
109
|
-
const _index = stepIndex.value;
|
|
110
|
-
stepIndex.value = -1;
|
|
111
|
-
nextTick(() => {
|
|
112
|
-
ctx.emit("guide-close", _index);
|
|
113
|
-
});
|
|
114
|
-
};
|
|
115
|
-
const setCurrentIndex = (index2) => {
|
|
116
|
-
if (index2 !== -1 && props.stepChange()) {
|
|
117
|
-
if (index2 > -1 && index2 < stepsCount.value) {
|
|
118
|
-
stepIndex.value = index2;
|
|
119
|
-
nextTick(() => {
|
|
120
|
-
updateGuidePosition();
|
|
121
|
-
});
|
|
122
|
-
} else {
|
|
123
|
-
console.error(`stepIndex is not within the value range`);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
if (index2 === -1) {
|
|
127
|
-
closeGuide();
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
return {
|
|
131
|
-
stepsCount,
|
|
132
|
-
closeGuide,
|
|
133
|
-
setCurrentIndex
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
var StepsGuide = defineComponent({
|
|
137
|
-
name: "DStepsGuide",
|
|
138
|
-
props: stepsGuideProps,
|
|
139
|
-
emits: ["guide-close", "update:stepIndex"],
|
|
140
|
-
setup(props, ctx) {
|
|
141
|
-
var _a;
|
|
142
|
-
const stepIndexData = ref((_a = props.stepIndex) != null ? _a : 0);
|
|
143
|
-
const stepIndex = computed({
|
|
144
|
-
set: (val) => {
|
|
145
|
-
if (props.stepIndex != null) {
|
|
146
|
-
ctx.emit("update:stepIndex", val);
|
|
147
|
-
}
|
|
148
|
-
stepIndexData.value = val;
|
|
149
|
-
},
|
|
150
|
-
get: () => stepIndexData.value
|
|
151
|
-
});
|
|
152
|
-
const currentStep = computed(() => {
|
|
153
|
-
const _step = props.steps[stepIndex.value];
|
|
154
|
-
if (_step) {
|
|
155
|
-
_step.position = _step.position || "top";
|
|
156
|
-
}
|
|
157
|
-
return _step;
|
|
158
|
-
});
|
|
159
|
-
const {
|
|
160
|
-
stepsRef,
|
|
161
|
-
guidePosition,
|
|
162
|
-
guideClassList,
|
|
163
|
-
updateGuidePosition
|
|
164
|
-
} = useStepsGuidePosition(props, currentStep);
|
|
165
|
-
const {
|
|
166
|
-
stepsCount,
|
|
167
|
-
closeGuide,
|
|
168
|
-
setCurrentIndex
|
|
169
|
-
} = useStepsGuideCtrl(props, ctx, updateGuidePosition, stepIndex);
|
|
170
|
-
onMounted(() => {
|
|
171
|
-
updateGuidePosition();
|
|
172
|
-
});
|
|
173
|
-
ctx.expose({
|
|
174
|
-
closeGuide,
|
|
175
|
-
setCurrentIndex
|
|
176
|
-
});
|
|
177
|
-
return () => stepIndex.value > -1 && stepsCount.value > 0 ? createVNode(Teleport, {
|
|
178
|
-
"to": "body"
|
|
179
|
-
}, {
|
|
180
|
-
default: () => [createVNode("div", {
|
|
181
|
-
"style": guidePosition,
|
|
182
|
-
"class": guideClassList,
|
|
183
|
-
"ref": stepsRef
|
|
184
|
-
}, [createVNode("div", {
|
|
185
|
-
"class": "devui-shining-dot"
|
|
186
|
-
}, null), createVNode("div", {
|
|
187
|
-
"class": "devui-shining-plus"
|
|
188
|
-
}, null), createVNode("div", {
|
|
189
|
-
"class": "devui-arrow"
|
|
190
|
-
}, null), createVNode("div", {
|
|
191
|
-
"class": "devui-guide-container"
|
|
192
|
-
}, [createVNode("p", {
|
|
193
|
-
"class": "devui-title"
|
|
194
|
-
}, [currentStep.value.title]), props.showClose ? createVNode("div", {
|
|
195
|
-
"class": "icon icon-close",
|
|
196
|
-
"onClick": closeGuide
|
|
197
|
-
}, null) : null, createVNode("div", {
|
|
198
|
-
"class": "devui-content"
|
|
199
|
-
}, [currentStep.value.content]), createVNode("div", {
|
|
200
|
-
"class": "devui-ctrl"
|
|
201
|
-
}, [props.showDots ? createVNode("div", {
|
|
202
|
-
"class": "devui-dots"
|
|
203
|
-
}, [props.steps.map((step, index2) => {
|
|
204
|
-
return createVNode("em", {
|
|
205
|
-
"class": ["icon icon-dot-status", currentStep.value === step ? "devui-active" : ""],
|
|
206
|
-
"key": index2
|
|
207
|
-
}, null);
|
|
208
|
-
})]) : null, createVNode("div", {
|
|
209
|
-
"class": "devui-guide-btn"
|
|
210
|
-
}, [stepIndex.value > 0 ? createVNode("div", {
|
|
211
|
-
"class": "devui-prev-step",
|
|
212
|
-
"onClick": () => setCurrentIndex(stepIndex.value - 1)
|
|
213
|
-
}, ["\u4E0A\u4E00\u6B65"]) : null, stepIndex.value === stepsCount.value - 1 ? createVNode("div", {
|
|
214
|
-
"onClick": closeGuide
|
|
215
|
-
}, ["\u6211\u77E5\u9053\u5566"]) : createVNode("div", {
|
|
216
|
-
"class": "devui-next-step",
|
|
217
|
-
"onClick": () => {
|
|
218
|
-
setCurrentIndex(stepIndex.value + 1);
|
|
219
|
-
}
|
|
220
|
-
}, ["\u6211\u77E5\u9053\u5566,\u7EE7\u7EED"])])])])])]
|
|
221
|
-
}) : null;
|
|
222
|
-
}
|
|
223
|
-
});
|
|
224
|
-
var StepsGuideDirective = {
|
|
225
|
-
mounted(el, binding, vNode) {
|
|
226
|
-
},
|
|
227
|
-
updated(el, binding) {
|
|
228
|
-
}
|
|
229
|
-
};
|
|
230
|
-
StepsGuide.install = function(app) {
|
|
231
|
-
app.component(StepsGuide.name, StepsGuide);
|
|
232
|
-
};
|
|
233
|
-
var index = {
|
|
234
|
-
title: "StepsGuide \u64CD\u4F5C\u6307\u5F15",
|
|
235
|
-
category: "\u5BFC\u822A",
|
|
236
|
-
status: "80%",
|
|
237
|
-
install(app) {
|
|
238
|
-
app.use(StepsGuide);
|
|
239
|
-
app.directive("StepsGuide", StepsGuideDirective);
|
|
240
|
-
}
|
|
241
|
-
};
|
|
242
|
-
export { StepsGuide, index as default };
|
package/steps-guide/index.umd.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(function(a,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(a=typeof globalThis!="undefined"?globalThis:a||self,e(a.index={},a.Vue))})(this,function(a,e){"use strict";var x="";const y={steps:Array,stepIndex:{type:Number,default:void 0},showClose:{type:Boolean,default:!0},showDots:{type:Boolean,default:!0},scrollToTargetSwitch:{type:Boolean,default:!0},zIndex:{type:Number,default:1100},stepChange:{type:Function,default(){return!0}}};function b(i,o){const r=e.reactive(["devui-steps-guide"]),n=e.ref(null),l=e.reactive({left:"",top:"",zIndex:i.zIndex});return{stepsRef:n,guidePosition:l,guideClassList:r,updateGuidePosition:()=>{if(!o.value||!n.value)return;const m=window.pageYOffset-document.documentElement.clientTop,c=window.pageXOffset-document.documentElement.clientLeft,p=o.value.position,s=n.value;let d,u;if(typeof p!="string"){const{top:f=0,left:t=0,type:g="top"}=p;r.splice(1,1,g),d=t,u=f}else{r.splice(1,1,p);const f=o.value.target||o.value.trigger,t=document.querySelector(f);if(!t)return console.warn(`${f} \u4E0D\u5B58\u5728!`),!1;const g=t.getBoundingClientRect();d=g.left+t.clientWidth/2-s.clientWidth/2+c,u=g.top+t.clientHeight/2-s.clientHeight/2+m;const C=p.split("-");switch(C[0]){case"top":u+=-s.clientHeight/2-t.clientHeight;break;case"bottom":u+=s.clientHeight/2+t.clientHeight;break;case"left":u+=s.clientHeight/2-t.clientHeight,d+=-s.clientWidth/2-t.clientWidth/2;break;case"right":u+=s.clientHeight/2-t.clientHeight,d+=s.clientWidth/2+t.clientWidth/2;break}switch(C[1]){case"left":d+=s.clientWidth/2-t.clientWidth/2;break;case"right":d+=-s.clientWidth/2+t.clientWidth/2;break}}l.left=d+"px",l.top=u+"px",i.scrollToTargetSwitch&&typeof s.scrollIntoView=="function"&&e.nextTick(()=>{s.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})})}}}function N(i,o,r,n){const l=e.computed(()=>i.steps.length),v=()=>{const c=n.value;n.value=-1,e.nextTick(()=>{o.emit("guide-close",c)})};return{stepsCount:l,closeGuide:v,setCurrentIndex:c=>{c!==-1&&i.stepChange()&&(c>-1&&c<l.value?(n.value=c,e.nextTick(()=>{r()})):console.error("stepIndex is not within the value range")),c===-1&&v()}}}var h=e.defineComponent({name:"DStepsGuide",props:y,emits:["guide-close","update:stepIndex"],setup(i,o){var f;const r=e.ref((f=i.stepIndex)!=null?f:0),n=e.computed({set:t=>{i.stepIndex!=null&&o.emit("update:stepIndex",t),r.value=t},get:()=>r.value}),l=e.computed(()=>{const t=i.steps[n.value];return t&&(t.position=t.position||"top"),t}),{stepsRef:v,guidePosition:m,guideClassList:c,updateGuidePosition:p}=b(i,l),{stepsCount:s,closeGuide:d,setCurrentIndex:u}=N(i,o,p,n);return e.onMounted(()=>{p()}),o.expose({closeGuide:d,setCurrentIndex:u}),()=>n.value>-1&&s.value>0?e.createVNode(e.Teleport,{to:"body"},{default:()=>[e.createVNode("div",{style:m,class:c,ref:v},[e.createVNode("div",{class:"devui-shining-dot"},null),e.createVNode("div",{class:"devui-shining-plus"},null),e.createVNode("div",{class:"devui-arrow"},null),e.createVNode("div",{class:"devui-guide-container"},[e.createVNode("p",{class:"devui-title"},[l.value.title]),i.showClose?e.createVNode("div",{class:"icon icon-close",onClick:d},null):null,e.createVNode("div",{class:"devui-content"},[l.value.content]),e.createVNode("div",{class:"devui-ctrl"},[i.showDots?e.createVNode("div",{class:"devui-dots"},[i.steps.map((t,g)=>e.createVNode("em",{class:["icon icon-dot-status",l.value===t?"devui-active":""],key:g},null))]):null,e.createVNode("div",{class:"devui-guide-btn"},[n.value>0?e.createVNode("div",{class:"devui-prev-step",onClick:()=>u(n.value-1)},["\u4E0A\u4E00\u6B65"]):null,n.value===s.value-1?e.createVNode("div",{onClick:d},["\u6211\u77E5\u9053\u5566"]):e.createVNode("div",{class:"devui-next-step",onClick:()=>{u(n.value+1)}},["\u6211\u77E5\u9053\u5566,\u7EE7\u7EED"])])])])])]}):null}}),V={mounted(i,o,r){},updated(i,o){}};h.install=function(i){i.component(h.name,h)};var w={title:"StepsGuide \u64CD\u4F5C\u6307\u5F15",category:"\u5BFC\u822A",status:"80%",install(i){i.use(h),i.directive("StepsGuide",V)}};a.StepsGuide=h,a.default=w,Object.defineProperty(a,"__esModule",{value:!0}),a[Symbol.toStringTag]="Module"});
|
package/steps-guide/package.json
DELETED
package/steps-guide/style.css
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@charset "UTF-8";.devui-steps-guide{width:400px;min-height:160px;background:#5e7ce0;box-shadow:var(--devui-shadow-length-feedback-overlay, 0 4px 16px 0) #5170ff4d;border-radius:var(--devui-border-radius-feedback, 4px);font-size:12px;color:#fff;padding:20px;position:absolute}.devui-steps-guide .devui-title{font-size:12px;opacity:1;margin:0 0 20px;padding:0}.devui-steps-guide>.devui-arrow,.devui-steps-guide>.devui-arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.devui-steps-guide>.devui-arrow{border-width:8px}.devui-steps-guide.left>.devui-arrow{top:23px;right:-6px;margin-top:-3px;border-right-width:0;transform:rotate(-135deg);border-left-color:#5e7ce0}.devui-steps-guide.top>.devui-arrow,.devui-steps-guide.top-left>.devui-arrow,.devui-steps-guide.top-right>.devui-arrow{bottom:-6px;border-bottom-width:0;border-top-color:#5e7ce0;transform:rotate(135deg)}.devui-steps-guide.top>.devui-arrow{left:calc(50% - 4px)}.devui-steps-guide.top-left>.devui-arrow{left:23px}.devui-steps-guide.top-right>.devui-arrow{right:23px;transform:rotate(-135deg)}.devui-steps-guide.right>.devui-arrow{top:23px;left:-6px;margin-top:-3px;border-left-width:0;transform:rotate(135deg);border-right-color:#5e7ce0}.devui-steps-guide.bottom>.devui-arrow,.devui-steps-guide.bottom-left>.devui-arrow,.devui-steps-guide.bottom-right>.devui-arrow{top:-6px;margin-left:3px;border-top-width:0;border-bottom-color:#5e7ce0}.devui-steps-guide.bottom>.devui-arrow{left:calc(50% - 4px);transform:rotate(-135deg)}.devui-steps-guide.bottom-right>.devui-arrow{right:23px;transform:rotate(135deg)}.devui-steps-guide.bottom-left>.devui-arrow{left:23px;transform:rotate(-135deg)}.devui-steps-guide>.devui-shining-dot,.devui-steps-guide .devui-shining-plus{position:absolute;background:#5e7ce0;width:6px;height:6px;border-radius:var(--devui-border-radius-feedback, 4px)}.devui-steps-guide.left>.devui-shining-dot,.devui-steps-guide.left>.devui-shining-plus{top:21px;right:-30px}.devui-steps-guide.right>.devui-shining-dot,.devui-steps-guide.right>.devui-shining-plus{top:21px;left:-30px}.devui-steps-guide.top>.devui-shining-dot,.devui-steps-guide.top>.devui-shining-plus{left:calc(50% - 3px);bottom:-30px}.devui-steps-guide.top-left>.devui-shining-dot,.devui-steps-guide.top-left>.devui-shining-plus{left:21px;bottom:-30px}.devui-steps-guide.top-right>.devui-shining-dot,.devui-steps-guide.top-right>.devui-shining-plus{right:21px;bottom:-30px}.devui-steps-guide.bottom>.devui-shining-dot,.devui-steps-guide.bottom>.devui-shining-plus{left:calc(50% - 3px);top:-30px}.devui-steps-guide.bottom-right>.devui-shining-dot,.devui-steps-guide.bottom-right>.devui-shining-plus{top:-30px;right:21px}.devui-steps-guide.bottom-left>.devui-shining-dot,.devui-steps-guide.bottom-left>.devui-shining-plus{top:-30px;left:21px}.devui-steps-guide .devui-shining-plus{animation:devui-glow 2s 0s infinite}.devui-steps-guide .devui-guide-container{position:relative}.devui-steps-guide .devui-guide-container>.icon-close{position:absolute;top:0;right:0;cursor:pointer}.devui-steps-guide .devui-guide-container .devui-ctrl{display:flex;flex-wrap:wrap}.devui-steps-guide .devui-guide-container .devui-ctrl .devui-dots{color:#fff;position:relative;top:25px;font-size:12px;height:30px}.devui-steps-guide .devui-guide-container .devui-ctrl .devui-dots>em{opacity:.2;margin:0 5px 0 2px}.devui-steps-guide .devui-guide-container .devui-ctrl .devui-dots>em.devui-active{opacity:1}.devui-steps-guide .devui-guide-container .devui-ctrl .devui-guide-btn{display:flex;flex-flow:row nowrap;flex-grow:1;justify-content:flex-end;padding:20px 0 0;white-space:nowrap}.devui-steps-guide .devui-guide-container .devui-ctrl .devui-guide-btn>div{color:#fff;background:rgba(255,255,255,.1);border-radius:4px;padding:5px 15px;cursor:pointer;margin-left:10px}.devui-steps-guide .devui-guide-container .devui-ctrl .devui-guide-btn>div.devui-prev-step{background:none;border:solid 1px rgba(255,255,255,.1)}@keyframes devui-glow{0%{transform:scale(1);opacity:.5}25%{transform:scale(2);opacity:.3}50%{transform:scale(3);opacity:.1}75%{transform:scale(2);opacity:.3}to{transform:scale(1);opacity:.5}}
|
package/sticky/index.d.ts
DELETED
package/sticky/index.es.js
DELETED
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
import { defineComponent, reactive, watch, onMounted, ref, createVNode } from "vue";
|
|
2
|
-
var Sticky = defineComponent({
|
|
3
|
-
name: "DSticky",
|
|
4
|
-
props: {
|
|
5
|
-
zIndex: {
|
|
6
|
-
type: Number
|
|
7
|
-
},
|
|
8
|
-
container: {
|
|
9
|
-
type: Object
|
|
10
|
-
},
|
|
11
|
-
view: {
|
|
12
|
-
type: Object,
|
|
13
|
-
default: () => {
|
|
14
|
-
return {
|
|
15
|
-
top: 0,
|
|
16
|
-
bottom: 0
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
scrollTarget: {
|
|
21
|
-
type: Object
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
emits: ["statusChange"],
|
|
25
|
-
setup(props, ctx) {
|
|
26
|
-
const {
|
|
27
|
-
slots
|
|
28
|
-
} = ctx;
|
|
29
|
-
let container;
|
|
30
|
-
let scrollTarget;
|
|
31
|
-
let scrollTimer;
|
|
32
|
-
let scrollPreStart;
|
|
33
|
-
const THROTTLE_DELAY = 16;
|
|
34
|
-
const THROTTLE_TRIGGER = 100;
|
|
35
|
-
let parentNode;
|
|
36
|
-
let containerLeft = 0;
|
|
37
|
-
const state = reactive({
|
|
38
|
-
status: "normal"
|
|
39
|
-
});
|
|
40
|
-
watch(() => props.zIndex, () => {
|
|
41
|
-
init();
|
|
42
|
-
});
|
|
43
|
-
watch(() => props.container, () => {
|
|
44
|
-
init();
|
|
45
|
-
});
|
|
46
|
-
watch(() => props.scrollTarget, () => {
|
|
47
|
-
init();
|
|
48
|
-
});
|
|
49
|
-
watch(() => state.status, () => {
|
|
50
|
-
ctx.emit("statusChange", state.status);
|
|
51
|
-
}, {
|
|
52
|
-
immediate: true
|
|
53
|
-
});
|
|
54
|
-
const init = () => {
|
|
55
|
-
parentNode = stickyRef.value.parentElement;
|
|
56
|
-
if (!props.container) {
|
|
57
|
-
container = parentNode;
|
|
58
|
-
} else {
|
|
59
|
-
container = props.container;
|
|
60
|
-
}
|
|
61
|
-
stickyRef.value.style.zIndex = props.zIndex;
|
|
62
|
-
scrollTarget = props.scrollTarget || window;
|
|
63
|
-
scrollTarget.addEventListener("scroll", throttle);
|
|
64
|
-
initScrollStatus(scrollTarget);
|
|
65
|
-
};
|
|
66
|
-
const initScrollStatus = (target) => {
|
|
67
|
-
const scrollTargets = target === window ? [document.documentElement, document.body] : [target];
|
|
68
|
-
let flag = false;
|
|
69
|
-
scrollTargets.forEach((scrollTarget2) => {
|
|
70
|
-
if (scrollTarget2.scrollTop && scrollTarget2.scrollTop > 0) {
|
|
71
|
-
flag = true;
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
if (flag) {
|
|
75
|
-
setTimeout(scrollHandler);
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
const statusProcess = (status) => {
|
|
79
|
-
const wrapper = stickyRef.value || document.createElement("div");
|
|
80
|
-
switch (status) {
|
|
81
|
-
case "normal":
|
|
82
|
-
wrapper.style.top = "auto";
|
|
83
|
-
wrapper.style.left = "auto";
|
|
84
|
-
wrapper.style.position = "static";
|
|
85
|
-
break;
|
|
86
|
-
case "follow":
|
|
87
|
-
const scrollTargetElement = scrollTarget;
|
|
88
|
-
const viewOffset = scrollTarget && scrollTarget !== window ? scrollTargetElement.getBoundingClientRect().top : 0;
|
|
89
|
-
wrapper.style.top = +viewOffset + (props.view && props.view.top || 0) + "px";
|
|
90
|
-
wrapper.style.left = wrapper.getBoundingClientRect().left + "px";
|
|
91
|
-
wrapper.style.position = "fixed";
|
|
92
|
-
break;
|
|
93
|
-
case "stay":
|
|
94
|
-
wrapper.style.top = calculateRelativePosition(wrapper, parentNode, "top") + "px";
|
|
95
|
-
wrapper.style.left = "auto";
|
|
96
|
-
wrapper.style.position = "relative";
|
|
97
|
-
break;
|
|
98
|
-
case "remain":
|
|
99
|
-
if (wrapper.style.position !== "fixed" && wrapper.style.position !== "absolute") {
|
|
100
|
-
wrapper.style.top = calculateRelativePosition(wrapper, parentNode, "top") + "px";
|
|
101
|
-
wrapper.style.left = "auto";
|
|
102
|
-
wrapper.style.position = "absolute";
|
|
103
|
-
}
|
|
104
|
-
wrapper.style.top = calculateRemainPosition(wrapper, parentNode, container) + "px";
|
|
105
|
-
wrapper.style.left = calculateRelativePosition(wrapper, parentNode, "left") + "px";
|
|
106
|
-
wrapper.style.position = "relative";
|
|
107
|
-
break;
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
const throttle = () => {
|
|
111
|
-
const fn = scrollAndResizeHock;
|
|
112
|
-
const time = Date.now();
|
|
113
|
-
if (scrollTimer) {
|
|
114
|
-
clearTimeout(scrollTimer);
|
|
115
|
-
}
|
|
116
|
-
if (!scrollPreStart) {
|
|
117
|
-
scrollPreStart = time;
|
|
118
|
-
}
|
|
119
|
-
if (time - scrollPreStart > THROTTLE_TRIGGER) {
|
|
120
|
-
fn();
|
|
121
|
-
scrollPreStart = null;
|
|
122
|
-
scrollTimer = null;
|
|
123
|
-
} else {
|
|
124
|
-
scrollTimer = setTimeout(() => {
|
|
125
|
-
fn();
|
|
126
|
-
scrollPreStart = null;
|
|
127
|
-
scrollTimer = null;
|
|
128
|
-
}, THROTTLE_DELAY);
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
const scrollAndResizeHock = () => {
|
|
132
|
-
if (container.getBoundingClientRect().left - (containerLeft || 0) !== 0) {
|
|
133
|
-
state.status = "stay";
|
|
134
|
-
containerLeft = container.getBoundingClientRect().left;
|
|
135
|
-
} else {
|
|
136
|
-
scrollHandler();
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
const scrollHandler = () => {
|
|
140
|
-
const scrollTargetElement = scrollTarget;
|
|
141
|
-
const wrapper = stickyRef.value || document.createElement("div");
|
|
142
|
-
const viewOffsetTop = scrollTarget && scrollTarget !== window ? scrollTargetElement.getBoundingClientRect().top : 0;
|
|
143
|
-
const computedStyle = window.getComputedStyle(container);
|
|
144
|
-
if (parentNode.getBoundingClientRect().top - viewOffsetTop > (props.view && props.view.top || 0)) {
|
|
145
|
-
state.status = "normal";
|
|
146
|
-
statusProcess(state.status);
|
|
147
|
-
} else if (container.getBoundingClientRect().top + parseInt(computedStyle.paddingTop, 10) + parseInt(computedStyle.borderTopWidth, 10) - viewOffsetTop >= (props.view && props.view.top || 0)) {
|
|
148
|
-
state.status = "normal";
|
|
149
|
-
statusProcess(state.status);
|
|
150
|
-
} else if (container.getBoundingClientRect().bottom - parseInt(computedStyle.paddingBottom, 10) - parseInt(computedStyle.borderBottomWidth, 10) < viewOffsetTop + (props.view && props.view.top || 0) + wrapper.getBoundingClientRect().height + (props.view && props.view.bottom || 0)) {
|
|
151
|
-
state.status = "remain";
|
|
152
|
-
statusProcess(state.status);
|
|
153
|
-
} else if (container.getBoundingClientRect().top + parseInt(computedStyle.paddingTop, 10) - viewOffsetTop < (props.view && props.view.top || 0)) {
|
|
154
|
-
state.status = "follow";
|
|
155
|
-
statusProcess(state.status);
|
|
156
|
-
}
|
|
157
|
-
};
|
|
158
|
-
const calculateRelativePosition = (element, relativeElement, direction) => {
|
|
159
|
-
const key = {
|
|
160
|
-
left: ["left", "Left"],
|
|
161
|
-
top: ["top", "Top"]
|
|
162
|
-
};
|
|
163
|
-
if (window && window.getComputedStyle) {
|
|
164
|
-
const computedStyle = window.getComputedStyle(relativeElement);
|
|
165
|
-
return element.getBoundingClientRect()[key[direction][0]] - relativeElement.getBoundingClientRect()[key[direction][0]] - parseInt(computedStyle[direction === "left" ? "paddingLeft" : "paddingTop"], 10) - parseInt(computedStyle[direction === "left" ? "borderLeftWidth" : "borderTopWidth"], 10);
|
|
166
|
-
}
|
|
167
|
-
};
|
|
168
|
-
const calculateRemainPosition = (element, relativeElement, container2) => {
|
|
169
|
-
if (window && window.getComputedStyle) {
|
|
170
|
-
const computedStyle = window.getComputedStyle(container2);
|
|
171
|
-
const result = container2.getBoundingClientRect().height - element.getBoundingClientRect().height + container2.getBoundingClientRect().top - relativeElement.getBoundingClientRect().top - parseInt(computedStyle["paddingTop"], 10) - parseInt(computedStyle["borderTopWidth"], 10) - parseInt(computedStyle["paddingBottom"], 10) - parseInt(computedStyle["borderBottomWidth"], 10);
|
|
172
|
-
return result < 0 ? 0 : result;
|
|
173
|
-
}
|
|
174
|
-
};
|
|
175
|
-
onMounted(() => {
|
|
176
|
-
init();
|
|
177
|
-
});
|
|
178
|
-
const stickyRef = ref();
|
|
179
|
-
return () => {
|
|
180
|
-
return createVNode("div", {
|
|
181
|
-
"ref": stickyRef
|
|
182
|
-
}, [slots.default ? slots.default() : ""]);
|
|
183
|
-
};
|
|
184
|
-
}
|
|
185
|
-
});
|
|
186
|
-
Sticky.install = function(app) {
|
|
187
|
-
app.component(Sticky.name, Sticky);
|
|
188
|
-
};
|
|
189
|
-
var index = {
|
|
190
|
-
title: "Sticky \u4FBF\u8D34",
|
|
191
|
-
category: "\u901A\u7528",
|
|
192
|
-
status: "50%",
|
|
193
|
-
install(app) {
|
|
194
|
-
app.use(Sticky);
|
|
195
|
-
}
|
|
196
|
-
};
|
|
197
|
-
export { Sticky, index as default };
|
package/sticky/index.umd.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(function(a,i){typeof exports=="object"&&typeof module!="undefined"?i(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],i):(a=typeof globalThis!="undefined"?globalThis:a||self,i(a.index={},a.Vue))})(this,function(a,i){"use strict";var r=i.defineComponent({name:"DSticky",props:{zIndex:{type:Number},container:{type:Object},view:{type:Object,default:()=>({top:0,bottom:0})},scrollTarget:{type:Object}},emits:["statusChange"],setup(e,h){const{slots:C}=h;let c,d,f,g;const B=16,S=100;let u,R=0;const s=i.reactive({status:"normal"});i.watch(()=>e.zIndex,()=>{w()}),i.watch(()=>e.container,()=>{w()}),i.watch(()=>e.scrollTarget,()=>{w()}),i.watch(()=>s.status,()=>{h.emit("statusChange",s.status)},{immediate:!0});const w=()=>{u=p.value.parentElement,e.container?c=e.container:c=u,p.value.style.zIndex=e.zIndex,d=e.scrollTarget||window,d.addEventListener("scroll",x),I(d)},I=l=>{const t=l===window?[document.documentElement,document.body]:[l];let o=!1;t.forEach(n=>{n.scrollTop&&n.scrollTop>0&&(o=!0)}),o&&setTimeout(v)},y=l=>{const t=p.value||document.createElement("div");switch(l){case"normal":t.style.top="auto",t.style.left="auto",t.style.position="static";break;case"follow":const n=d&&d!==window?d.getBoundingClientRect().top:0;t.style.top=+n+(e.view&&e.view.top||0)+"px",t.style.left=t.getBoundingClientRect().left+"px",t.style.position="fixed";break;case"stay":t.style.top=T(t,u,"top")+"px",t.style.left="auto",t.style.position="relative";break;case"remain":t.style.position!=="fixed"&&t.style.position!=="absolute"&&(t.style.top=T(t,u,"top")+"px",t.style.left="auto",t.style.position="absolute"),t.style.top=k(t,u,c)+"px",t.style.left=T(t,u,"left")+"px",t.style.position="relative";break}},x=()=>{const l=E,t=Date.now();f&&clearTimeout(f),g||(g=t),t-g>S?(l(),g=null,f=null):f=setTimeout(()=>{l(),g=null,f=null},B)},E=()=>{c.getBoundingClientRect().left-(R||0)!==0?(s.status="stay",R=c.getBoundingClientRect().left):v()},v=()=>{const l=d,t=p.value||document.createElement("div"),o=d&&d!==window?l.getBoundingClientRect().top:0,n=window.getComputedStyle(c);u.getBoundingClientRect().top-o>(e.view&&e.view.top||0)||c.getBoundingClientRect().top+parseInt(n.paddingTop,10)+parseInt(n.borderTopWidth,10)-o>=(e.view&&e.view.top||0)?(s.status="normal",y(s.status)):c.getBoundingClientRect().bottom-parseInt(n.paddingBottom,10)-parseInt(n.borderBottomWidth,10)<o+(e.view&&e.view.top||0)+t.getBoundingClientRect().height+(e.view&&e.view.bottom||0)?(s.status="remain",y(s.status)):c.getBoundingClientRect().top+parseInt(n.paddingTop,10)-o<(e.view&&e.view.top||0)&&(s.status="follow",y(s.status))},T=(l,t,o)=>{const n={left:["left","Left"],top:["top","Top"]};if(window&&window.getComputedStyle){const m=window.getComputedStyle(t);return l.getBoundingClientRect()[n[o][0]]-t.getBoundingClientRect()[n[o][0]]-parseInt(m[o==="left"?"paddingLeft":"paddingTop"],10)-parseInt(m[o==="left"?"borderLeftWidth":"borderTopWidth"],10)}},k=(l,t,o)=>{if(window&&window.getComputedStyle){const n=window.getComputedStyle(o),m=o.getBoundingClientRect().height-l.getBoundingClientRect().height+o.getBoundingClientRect().top-t.getBoundingClientRect().top-parseInt(n.paddingTop,10)-parseInt(n.borderTopWidth,10)-parseInt(n.paddingBottom,10)-parseInt(n.borderBottomWidth,10);return m<0?0:m}};i.onMounted(()=>{w()});const p=i.ref();return()=>i.createVNode("div",{ref:p},[C.default?C.default():""])}});r.install=function(e){e.component(r.name,r)};var b={title:"Sticky \u4FBF\u8D34",category:"\u901A\u7528",status:"50%",install(e){e.use(r)}};a.Sticky=r,a.default=b,Object.defineProperty(a,"__esModule",{value:!0}),a[Symbol.toStringTag]="Module"});
|
package/sticky/package.json
DELETED