@deot/vc-components 1.0.43 → 1.0.44
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/index.cjs +207 -15
- package/dist/index.d.ts +306 -188
- package/dist/index.iife.js +444 -264
- package/dist/index.js +207 -17
- package/dist/index.style.css +2 -2
- package/dist/index.umd.cjs +444 -264
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { reactive, defineComponent, createVNode, ref, watch, getCurrentInstance,
|
|
1
|
+
import { reactive, defineComponent, createVNode, inject, shallowRef, ref, computed, onMounted, onBeforeUnmount, watch, getCurrentInstance, TransitionGroup, Transition as Transition$1, h, provide, nextTick, mergeProps, withModifiers, createApp, Fragment as Fragment$1, Teleport, onUnmounted, withDirectives, vShow, isVNode, onBeforeMount, createTextVNode, toRaw, onUpdated, resolveComponent, useAttrs as useAttrs$1 } from 'vue';
|
|
2
|
+
import * as $ from '@deot/helper-dom';
|
|
3
|
+
import { getScroller, composedPath, scrollIntoView, prefixStyle, getStyle, removeClass, addClass, hasClass } from '@deot/helper-dom';
|
|
2
4
|
import * as Utils from '@deot/helper-utils';
|
|
3
5
|
import { raf, getUid, preZero, getPropByPath, throttle as throttle$1, hasOwn } from '@deot/helper-utils';
|
|
4
6
|
import { debounce, cloneDeep, pick, isEqualWith, startCase, throttle, concat, max, merge, isEmpty as isEmpty$1, kebabCase, difference } from 'lodash-es';
|
|
5
7
|
import { useAttrs, useScrollbar, getInstance } from '@deot/vc-hooks';
|
|
6
|
-
import * as $ from '@deot/helper-dom';
|
|
7
|
-
import { composedPath, scrollIntoView, prefixStyle, getStyle, removeClass, addClass, hasClass } from '@deot/helper-dom';
|
|
8
8
|
import { Resize } from '@deot/helper-resize';
|
|
9
9
|
import { Utils as Utils$1, IS_SERVER as IS_SERVER$1 } from '@deot/vc-shared';
|
|
10
10
|
import { Wheel } from '@deot/helper-wheel';
|
|
@@ -79,7 +79,7 @@ class Instance {
|
|
|
79
79
|
}
|
|
80
80
|
const VcInstance = new Instance();
|
|
81
81
|
|
|
82
|
-
const props$
|
|
82
|
+
const props$1t = {
|
|
83
83
|
tag: {
|
|
84
84
|
type: String,
|
|
85
85
|
default: "div"
|
|
@@ -88,10 +88,10 @@ const props$1s = {
|
|
|
88
88
|
|
|
89
89
|
/** @jsxImportSource vue */
|
|
90
90
|
|
|
91
|
-
const COMPONENT_NAME$
|
|
91
|
+
const COMPONENT_NAME$28 = 'vc-action-sheet';
|
|
92
92
|
const ActionSheet = /* @__PURE__ */ defineComponent({
|
|
93
|
-
name: COMPONENT_NAME$
|
|
94
|
-
props: props$
|
|
93
|
+
name: COMPONENT_NAME$28,
|
|
94
|
+
props: props$1t,
|
|
95
95
|
setup(props, {
|
|
96
96
|
slots
|
|
97
97
|
}) {
|
|
@@ -105,6 +105,182 @@ const ActionSheet = /* @__PURE__ */ defineComponent({
|
|
|
105
105
|
|
|
106
106
|
const MActionSheet = ActionSheet;
|
|
107
107
|
|
|
108
|
+
const props$1s = {
|
|
109
|
+
zIndex: {
|
|
110
|
+
type: [Number, String],
|
|
111
|
+
default: 1
|
|
112
|
+
},
|
|
113
|
+
// TODO: left/right
|
|
114
|
+
placement: {
|
|
115
|
+
type: String,
|
|
116
|
+
default: "top"
|
|
117
|
+
},
|
|
118
|
+
disabled: {
|
|
119
|
+
type: Boolean,
|
|
120
|
+
default: false
|
|
121
|
+
},
|
|
122
|
+
fixed: {
|
|
123
|
+
type: Boolean,
|
|
124
|
+
default: true
|
|
125
|
+
},
|
|
126
|
+
offset: {
|
|
127
|
+
type: Number,
|
|
128
|
+
default: 0
|
|
129
|
+
},
|
|
130
|
+
// -> 固钉始终保持在容器内, 超过范围则隐藏(请注意容器避免出现滚动条) 仅fixed为true有效
|
|
131
|
+
target: {
|
|
132
|
+
type: String
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
/** @jsxImportSource vue */
|
|
137
|
+
|
|
138
|
+
const COMPONENT_NAME$27 = 'vc-affix';
|
|
139
|
+
const SCROLLER_WHEEL_REG = /vc-scroller-wheel/;
|
|
140
|
+
const Affix = /* @__PURE__ */ defineComponent({
|
|
141
|
+
name: COMPONENT_NAME$27,
|
|
142
|
+
props: props$1s,
|
|
143
|
+
setup(props, {
|
|
144
|
+
slots,
|
|
145
|
+
expose
|
|
146
|
+
}) {
|
|
147
|
+
const scrollerInstance = inject('vc-scroller', null);
|
|
148
|
+
const scroller = shallowRef(); // 当前元素所在的滚动容器
|
|
149
|
+
const base = shallowRef(); // 当前元素(props.tagret)的参考容器
|
|
150
|
+
const current = shallowRef(); // 当前元素
|
|
151
|
+
|
|
152
|
+
const currentRect = reactive({
|
|
153
|
+
top: 0,
|
|
154
|
+
bottom: 0,
|
|
155
|
+
width: 0,
|
|
156
|
+
height: 0
|
|
157
|
+
});
|
|
158
|
+
const isActive = ref(false);
|
|
159
|
+
const transformY = ref(0);
|
|
160
|
+
const windowHeight = ref(window.innerHeight);
|
|
161
|
+
const isVcScrollerWheel = computed(() => {
|
|
162
|
+
return SCROLLER_WHEEL_REG.test(scroller.value?.className || '');
|
|
163
|
+
});
|
|
164
|
+
const currentStyle = computed(() => {
|
|
165
|
+
if (!isActive.value) return {};
|
|
166
|
+
return {
|
|
167
|
+
height: `${currentRect.height}px`,
|
|
168
|
+
width: `${currentRect.width}px`
|
|
169
|
+
};
|
|
170
|
+
});
|
|
171
|
+
const contentStyle = computed(() => {
|
|
172
|
+
if (!isActive.value) return {};
|
|
173
|
+
const offset = `${props.offset}px`;
|
|
174
|
+
return {
|
|
175
|
+
height: `${currentRect.height}px`,
|
|
176
|
+
width: `${currentRect.width}px`,
|
|
177
|
+
top: props.placement === 'top' ? offset : '',
|
|
178
|
+
bottom: props.placement === 'bottom' ? offset : '',
|
|
179
|
+
zIndex: props.zIndex,
|
|
180
|
+
transform: transformY.value ? `translateY(${transformY.value}px)` : ''
|
|
181
|
+
};
|
|
182
|
+
});
|
|
183
|
+
const setCurrentRect = () => {
|
|
184
|
+
const rect = current.value.getBoundingClientRect();
|
|
185
|
+
Object.assign(currentRect, {
|
|
186
|
+
top: rect.top,
|
|
187
|
+
bottom: rect.bottom,
|
|
188
|
+
width: rect.width,
|
|
189
|
+
height: rect.height
|
|
190
|
+
});
|
|
191
|
+
};
|
|
192
|
+
const setAbsoluteStatus = () => {
|
|
193
|
+
const {
|
|
194
|
+
placement,
|
|
195
|
+
offset
|
|
196
|
+
} = props;
|
|
197
|
+
const currentHeightOffset = offset + currentRect.height;
|
|
198
|
+
const containerRect = scroller.value.getBoundingClientRect();
|
|
199
|
+
let transformOffsetY = 0;
|
|
200
|
+
|
|
201
|
+
// scroller-wheel滚动条偏移
|
|
202
|
+
if (scrollerInstance && isVcScrollerWheel.value) {
|
|
203
|
+
const maxMoveY = scrollerInstance.scrollHeight - scrollerInstance.clientHeight;
|
|
204
|
+
transformOffsetY = scrollerInstance.scrollTop >= maxMoveY ? maxMoveY : scrollerInstance.scrollTop;
|
|
205
|
+
}
|
|
206
|
+
if (placement === 'top') {
|
|
207
|
+
isActive.value = currentRect.top - containerRect.top <= props.offset;
|
|
208
|
+
transformY.value = Math.min(containerRect.bottom - currentHeightOffset, 0) + transformOffsetY;
|
|
209
|
+
} else {
|
|
210
|
+
isActive.value = currentRect.bottom - containerRect.top >= containerRect.height - props.offset;
|
|
211
|
+
transformY.value = Math.max(containerRect.height - containerRect.top - currentHeightOffset, 0) + transformOffsetY;
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
const setFixedStatus = () => {
|
|
215
|
+
const {
|
|
216
|
+
placement,
|
|
217
|
+
target,
|
|
218
|
+
offset
|
|
219
|
+
} = props;
|
|
220
|
+
const currentHeightOffset = offset + currentRect.height;
|
|
221
|
+
const containerRect = target && base.value.getBoundingClientRect();
|
|
222
|
+
if (placement === 'top') {
|
|
223
|
+
if (target) {
|
|
224
|
+
isActive.value = offset > currentRect.top && containerRect.bottom > 0;
|
|
225
|
+
transformY.value = Math.min(containerRect.bottom - currentHeightOffset, 0);
|
|
226
|
+
} else {
|
|
227
|
+
isActive.value = offset > currentRect.top;
|
|
228
|
+
}
|
|
229
|
+
} else {
|
|
230
|
+
if (target) {
|
|
231
|
+
isActive.value = windowHeight.value - offset < currentRect.bottom && windowHeight.value > containerRect.top;
|
|
232
|
+
transformY.value = -Math.min(windowHeight.value - containerRect.top - currentHeightOffset, 0);
|
|
233
|
+
} else {
|
|
234
|
+
isActive.value = windowHeight.value - offset < currentRect.bottom;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
const refresh = () => {
|
|
239
|
+
setCurrentRect();
|
|
240
|
+
scroller.value instanceof Window || props.fixed ? setFixedStatus() : setAbsoluteStatus();
|
|
241
|
+
};
|
|
242
|
+
onMounted(() => {
|
|
243
|
+
if (typeof props.target === 'string') {
|
|
244
|
+
base.value = document.querySelector(props.target) ?? void 0;
|
|
245
|
+
}
|
|
246
|
+
!base.value && (base.value = document.documentElement);
|
|
247
|
+
scroller.value = getScroller(current.value, {
|
|
248
|
+
className: SCROLLER_WHEEL_REG
|
|
249
|
+
});
|
|
250
|
+
if (isVcScrollerWheel.value) {
|
|
251
|
+
scrollerInstance?.on(refresh);
|
|
252
|
+
} else {
|
|
253
|
+
scroller.value?.addEventListener('scroll', refresh);
|
|
254
|
+
}
|
|
255
|
+
refresh();
|
|
256
|
+
});
|
|
257
|
+
onBeforeUnmount(() => {
|
|
258
|
+
if (isVcScrollerWheel.value) {
|
|
259
|
+
scrollerInstance?.off(refresh);
|
|
260
|
+
} else {
|
|
261
|
+
scroller.value?.removeEventListener('scroll', refresh);
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
expose({
|
|
265
|
+
refresh
|
|
266
|
+
});
|
|
267
|
+
return () => {
|
|
268
|
+
return createVNode("div", {
|
|
269
|
+
"ref": current,
|
|
270
|
+
"class": "vc-affix",
|
|
271
|
+
"style": currentStyle.value
|
|
272
|
+
}, [createVNode("div", {
|
|
273
|
+
"class": {
|
|
274
|
+
[`vc-affix__${props.fixed ? 'fixed' : 'absolute'}`]: isActive.value
|
|
275
|
+
},
|
|
276
|
+
"style": contentStyle.value
|
|
277
|
+
}, [slots?.default?.()])]);
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
const MAffix = Affix;
|
|
283
|
+
|
|
108
284
|
const props$1r = {
|
|
109
285
|
modelValue: {
|
|
110
286
|
type: Boolean,
|
|
@@ -791,7 +967,7 @@ const COMPONENT_NAME$1$ = 'vc-alert';
|
|
|
791
967
|
|
|
792
968
|
// [color, borderColor, backgroundColor], -> CSS
|
|
793
969
|
const THEME_MAP = {
|
|
794
|
-
info: ['#
|
|
970
|
+
info: ['#456CF6', '#91d5ff', '#e6f7ff'],
|
|
795
971
|
success: ['#52c41a', '#b7eb8f', '#f6ffed'],
|
|
796
972
|
error: ['#ed4014', '#ffb08f', '#fbe9e9'],
|
|
797
973
|
warning: ['#ffbf00', '#ffe58f', '#fffbe6']
|
|
@@ -9128,6 +9304,7 @@ const useScroller = (expose) => {
|
|
|
9128
9304
|
refreshSize();
|
|
9129
9305
|
refreshPosition(options);
|
|
9130
9306
|
};
|
|
9307
|
+
const listeners = [];
|
|
9131
9308
|
const triggerScrollDelegate = (options) => {
|
|
9132
9309
|
const delegates = {
|
|
9133
9310
|
scrollLeft: (options && options.x) ?? scrollX.value,
|
|
@@ -9135,12 +9312,15 @@ const useScroller = (expose) => {
|
|
|
9135
9312
|
clientWidth: wrapperW.value,
|
|
9136
9313
|
clientHeight: wrapperH.value,
|
|
9137
9314
|
scrollWidth: contentW.value,
|
|
9138
|
-
scrollHeight: contentH.value
|
|
9315
|
+
scrollHeight: contentH.value,
|
|
9316
|
+
getBoundingClientRect: () => wrapper.value?.getBoundingClientRect()
|
|
9139
9317
|
};
|
|
9140
|
-
|
|
9318
|
+
const e = {
|
|
9141
9319
|
target: delegates,
|
|
9142
9320
|
currentTarget: delegates
|
|
9143
|
-
}
|
|
9321
|
+
};
|
|
9322
|
+
instance.emit("scroll", e);
|
|
9323
|
+
listeners.forEach((listener) => listener(e));
|
|
9144
9324
|
};
|
|
9145
9325
|
const scrollTo = (options) => {
|
|
9146
9326
|
refreshPosition(options);
|
|
@@ -9167,8 +9347,9 @@ const useScroller = (expose) => {
|
|
|
9167
9347
|
Resize.off(wrapper.value, refresh);
|
|
9168
9348
|
Resize.off(content.value, refresh);
|
|
9169
9349
|
}
|
|
9350
|
+
listeners.splice(0, listeners.length);
|
|
9170
9351
|
});
|
|
9171
|
-
|
|
9352
|
+
const exposed = {
|
|
9172
9353
|
wrapper,
|
|
9173
9354
|
content,
|
|
9174
9355
|
scrollTo,
|
|
@@ -9184,8 +9365,16 @@ const useScroller = (expose) => {
|
|
|
9184
9365
|
},
|
|
9185
9366
|
setScrollLeft: (value) => {
|
|
9186
9367
|
scrollTo({ x: value });
|
|
9368
|
+
},
|
|
9369
|
+
on: (listener) => {
|
|
9370
|
+
listeners.push(listener);
|
|
9371
|
+
},
|
|
9372
|
+
off: (listener) => {
|
|
9373
|
+
listeners.splice(listeners.indexOf(listener), 1);
|
|
9187
9374
|
}
|
|
9188
|
-
}
|
|
9375
|
+
};
|
|
9376
|
+
expose(exposed);
|
|
9377
|
+
provide("vc-scroller", reactive(exposed));
|
|
9189
9378
|
return {
|
|
9190
9379
|
bar,
|
|
9191
9380
|
wrapper,
|
|
@@ -14842,7 +15031,7 @@ const props$n = {
|
|
|
14842
15031
|
color: {
|
|
14843
15032
|
type: [Object, String],
|
|
14844
15033
|
default: () => ({
|
|
14845
|
-
normal: "#
|
|
15034
|
+
normal: "#456CF6",
|
|
14846
15035
|
success: "#52c41a",
|
|
14847
15036
|
error: "#f5222d"
|
|
14848
15037
|
})
|
|
@@ -20042,7 +20231,8 @@ const Tabs = /* @__PURE__ */ defineComponent({
|
|
|
20042
20231
|
|
|
20043
20232
|
const props$b = {
|
|
20044
20233
|
value: {
|
|
20045
|
-
type: [String, Number, Boolean]
|
|
20234
|
+
type: [String, Number, Boolean],
|
|
20235
|
+
default: void 0
|
|
20046
20236
|
},
|
|
20047
20237
|
label: {
|
|
20048
20238
|
type: [String, Function],
|
|
@@ -20390,7 +20580,7 @@ const MTabs = /* @__PURE__ */ defineComponent({
|
|
|
20390
20580
|
"class": [{
|
|
20391
20581
|
'is-fixed': isFixed
|
|
20392
20582
|
}, 'vcm-tabs__bar']
|
|
20393
|
-
}, [createVNode("slot", {
|
|
20583
|
+
}, [createVNode(resolveComponent("slot"), {
|
|
20394
20584
|
"name": "prepend"
|
|
20395
20585
|
}, null), slots.prepend?.(), props.showStep && tabs.scrollable.value && createVNode("div", {
|
|
20396
20586
|
"class": "vcm-tabs__step is-left",
|
|
@@ -23517,4 +23707,4 @@ const UploadPicker = /* @__PURE__ */ defineComponent({
|
|
|
23517
23707
|
|
|
23518
23708
|
const MUploadPicker = UploadPicker;
|
|
23519
23709
|
|
|
23520
|
-
export { ActionSheet, Alert, Artboard, Button, ButtonGroup, Calendar, Card, Carousel, Cascader, Chart, Checkbox, CheckboxGroup, Clipboard, Collapse, CollapseItem, ColorPicker, Countdown, Customer, DatePicker, Debounce, Divider, Drawer, DrawerView, Dropdown, DropdownItem, DropdownMenu, Editor, EditorView, Expand$1 as Expand, Form, FormItem, Fragment, HTMLToImage, Icon, IconManager, Image$1 as Image, ImageCrop, ImagePreview, ImageProcessing, Input, InputNumber, InputSearch, MList as List, MListItem as ListItem, MActionSheet, MAlert, MArtboard, MButton, MButtonGroup, MCalendar, MCard, MCarousel, MCascader, MChart, MCheckbox, MCheckboxGroup, MClipboard, MCollapse, MCollapseItem, MColorPicker, MCountdown, MCustomer, MDatePicker, Debounce as MDebounce, MDivider, MDrawer, MDrawerView, MDropdown, MDropdownItem, MDropdownMenu, MEditor, MExpand, MForm, MFormItem, MFragment, MHTMLToImage, MIcon, MImage, MImageCrop, MImagePreview, MImageProcessing, MInput, MInputNumber, MInputSearch, MList, MListItem, MMarquee, MMessage, modal as MModal, MModalView, MNotice, MOption, MPagination, MPicker, MPopconfirm, MPopover, MPopup, MPortal, MPrint, MProgress, MRadio, MRadioGroup, MRate, MRecycleList, MResizer, MScroller, MSelect, MSlider, MSortList, MSpin, MSteps, MSwitch, MTable, MTableColumn, MTabs, MTabsPane, MTag, MText, MTextarea, MTimePicker, MTimeline, MToast, MToastView, MTouch, MTransition, MTransitionCollapse, MTransitionFade, MTransitionScale, MTransitionSlide, MTransitionZoom, MTree, MTreeSelect, MUpload, MUploadPicker, Marquee, Message, MessageView, Modal, ModalView, Notice, NoticeView, Option$1 as Option, Pagination, Picker, Popconfirm, Popover, Popup, Portal, PortalView, Print, Progress, Radio, RadioGroup, Rate, RecycleList, Resizer, Scroller, ScrollerWheel, Select, Slider, SortList, Spin, Steps, Switch, Table, TableColumn, Tabs, TabsPane, Tag, Text, Textarea, Theme, ThemeImage, ThemeText, ThemeView, TimePicker, Timeline, Toast, ToastView, Touch, Transition, TransitionCollapse, TransitionFade, TransitionScale, TransitionSlide, TransitionZoom, Tree, TreeSelect, Upload, UploadPicker, VcError, VcInstance };
|
|
23710
|
+
export { ActionSheet, Affix, Alert, Artboard, Button, ButtonGroup, Calendar, Card, Carousel, Cascader, Chart, Checkbox, CheckboxGroup, Clipboard, Collapse, CollapseItem, ColorPicker, Countdown, Customer, DatePicker, Debounce, Divider, Drawer, DrawerView, Dropdown, DropdownItem, DropdownMenu, Editor, EditorView, Expand$1 as Expand, Form, FormItem, Fragment, HTMLToImage, Icon, IconManager, Image$1 as Image, ImageCrop, ImagePreview, ImageProcessing, Input, InputNumber, InputSearch, MList as List, MListItem as ListItem, MActionSheet, MAffix, MAlert, MArtboard, MButton, MButtonGroup, MCalendar, MCard, MCarousel, MCascader, MChart, MCheckbox, MCheckboxGroup, MClipboard, MCollapse, MCollapseItem, MColorPicker, MCountdown, MCustomer, MDatePicker, Debounce as MDebounce, MDivider, MDrawer, MDrawerView, MDropdown, MDropdownItem, MDropdownMenu, MEditor, MExpand, MForm, MFormItem, MFragment, MHTMLToImage, MIcon, MImage, MImageCrop, MImagePreview, MImageProcessing, MInput, MInputNumber, MInputSearch, MList, MListItem, MMarquee, MMessage, modal as MModal, MModalView, MNotice, MOption, MPagination, MPicker, MPopconfirm, MPopover, MPopup, MPortal, MPrint, MProgress, MRadio, MRadioGroup, MRate, MRecycleList, MResizer, MScroller, MSelect, MSlider, MSortList, MSpin, MSteps, MSwitch, MTable, MTableColumn, MTabs, MTabsPane, MTag, MText, MTextarea, MTimePicker, MTimeline, MToast, MToastView, MTouch, MTransition, MTransitionCollapse, MTransitionFade, MTransitionScale, MTransitionSlide, MTransitionZoom, MTree, MTreeSelect, MUpload, MUploadPicker, Marquee, Message, MessageView, Modal, ModalView, Notice, NoticeView, Option$1 as Option, Pagination, Picker, Popconfirm, Popover, Popup, Portal, PortalView, Print, Progress, Radio, RadioGroup, Rate, RecycleList, Resizer, Scroller, ScrollerWheel, Select, Slider, SortList, Spin, Steps, Switch, Table, TableColumn, Tabs, TabsPane, Tag, Text, Textarea, Theme, ThemeImage, ThemeText, ThemeView, TimePicker, Timeline, Toast, ToastView, Touch, Transition, TransitionCollapse, TransitionFade, TransitionScale, TransitionSlide, TransitionZoom, Tree, TreeSelect, Upload, UploadPicker, VcError, VcInstance };
|