@deot/vc-components 1.0.43 → 1.0.45
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 +218 -16
- package/dist/index.d.ts +336 -188
- package/dist/index.iife.js +455 -265
- package/dist/index.js +218 -18
- package/dist/index.style.css +2 -2
- package/dist/index.umd.cjs +455 -265
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
5
|
const vue = require('vue');
|
|
6
|
+
const $ = require('@deot/helper-dom');
|
|
6
7
|
const Utils = require('@deot/helper-utils');
|
|
7
8
|
const lodashEs = require('lodash-es');
|
|
8
9
|
const vcHooks = require('@deot/vc-hooks');
|
|
9
|
-
const $ = require('@deot/helper-dom');
|
|
10
10
|
const helperResize = require('@deot/helper-resize');
|
|
11
11
|
const vcShared = require('@deot/vc-shared');
|
|
12
12
|
const helperWheel = require('@deot/helper-wheel');
|
|
@@ -34,8 +34,8 @@ function _interopNamespaceDefault(e) {
|
|
|
34
34
|
return Object.freeze(n);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
const Utils__namespace = /*#__PURE__*/_interopNamespaceDefault(Utils);
|
|
38
37
|
const $__namespace = /*#__PURE__*/_interopNamespaceDefault($);
|
|
38
|
+
const Utils__namespace = /*#__PURE__*/_interopNamespaceDefault(Utils);
|
|
39
39
|
const Load__namespace = /*#__PURE__*/_interopNamespaceDefault(Load);
|
|
40
40
|
|
|
41
41
|
class VcError {
|
|
@@ -101,7 +101,7 @@ class Instance {
|
|
|
101
101
|
}
|
|
102
102
|
const VcInstance = new Instance();
|
|
103
103
|
|
|
104
|
-
const props$
|
|
104
|
+
const props$1t = {
|
|
105
105
|
tag: {
|
|
106
106
|
type: String,
|
|
107
107
|
default: "div"
|
|
@@ -110,10 +110,10 @@ const props$1s = {
|
|
|
110
110
|
|
|
111
111
|
/** @jsxImportSource vue */
|
|
112
112
|
|
|
113
|
-
const COMPONENT_NAME$
|
|
113
|
+
const COMPONENT_NAME$28 = 'vc-action-sheet';
|
|
114
114
|
const ActionSheet = /* @__PURE__ */ vue.defineComponent({
|
|
115
|
-
name: COMPONENT_NAME$
|
|
116
|
-
props: props$
|
|
115
|
+
name: COMPONENT_NAME$28,
|
|
116
|
+
props: props$1t,
|
|
117
117
|
setup(props, {
|
|
118
118
|
slots
|
|
119
119
|
}) {
|
|
@@ -127,6 +127,184 @@ const ActionSheet = /* @__PURE__ */ vue.defineComponent({
|
|
|
127
127
|
|
|
128
128
|
const MActionSheet = ActionSheet;
|
|
129
129
|
|
|
130
|
+
const props$1s = {
|
|
131
|
+
zIndex: {
|
|
132
|
+
type: [Number, String],
|
|
133
|
+
default: 1
|
|
134
|
+
},
|
|
135
|
+
// TODO: left/right
|
|
136
|
+
placement: {
|
|
137
|
+
type: String,
|
|
138
|
+
default: "top"
|
|
139
|
+
},
|
|
140
|
+
disabled: {
|
|
141
|
+
type: Boolean,
|
|
142
|
+
default: false
|
|
143
|
+
},
|
|
144
|
+
fixed: {
|
|
145
|
+
type: Boolean,
|
|
146
|
+
default: true
|
|
147
|
+
},
|
|
148
|
+
offset: {
|
|
149
|
+
type: Number,
|
|
150
|
+
default: 0
|
|
151
|
+
},
|
|
152
|
+
// -> 固钉始终保持在容器内, 超过范围则隐藏(请注意容器避免出现滚动条) 仅fixed为true有效
|
|
153
|
+
target: {
|
|
154
|
+
type: String
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
/** @jsxImportSource vue */
|
|
159
|
+
|
|
160
|
+
const COMPONENT_NAME$27 = 'vc-affix';
|
|
161
|
+
const SCROLLER_WHEEL_REG = /vc-scroller-wheel/;
|
|
162
|
+
const Affix = /* @__PURE__ */ vue.defineComponent({
|
|
163
|
+
name: COMPONENT_NAME$27,
|
|
164
|
+
props: props$1s,
|
|
165
|
+
setup(props, {
|
|
166
|
+
slots,
|
|
167
|
+
expose
|
|
168
|
+
}) {
|
|
169
|
+
const scrollerInstance = vue.inject('vc-scroller', null);
|
|
170
|
+
const scroller = vue.shallowRef(); // 当前元素所在的滚动容器
|
|
171
|
+
const base = vue.shallowRef(); // 当前元素(props.tagret)的参考容器
|
|
172
|
+
const current = vue.shallowRef(); // 当前元素
|
|
173
|
+
|
|
174
|
+
const currentRect = vue.reactive({
|
|
175
|
+
top: 0,
|
|
176
|
+
bottom: 0,
|
|
177
|
+
width: 0,
|
|
178
|
+
height: 0
|
|
179
|
+
});
|
|
180
|
+
const isActive = vue.ref(false);
|
|
181
|
+
const transformY = vue.ref(0);
|
|
182
|
+
const windowHeight = vue.ref(window.innerHeight);
|
|
183
|
+
const isVcScrollerWheel = vue.computed(() => {
|
|
184
|
+
return SCROLLER_WHEEL_REG.test(scroller.value?.className || '');
|
|
185
|
+
});
|
|
186
|
+
const currentStyle = vue.computed(() => {
|
|
187
|
+
if (!isActive.value) return {};
|
|
188
|
+
return {
|
|
189
|
+
height: `${currentRect.height}px`,
|
|
190
|
+
width: `${currentRect.width}px`
|
|
191
|
+
};
|
|
192
|
+
});
|
|
193
|
+
const contentStyle = vue.computed(() => {
|
|
194
|
+
if (!isActive.value) return {};
|
|
195
|
+
const offset = `${props.offset}px`;
|
|
196
|
+
return {
|
|
197
|
+
height: `${currentRect.height}px`,
|
|
198
|
+
width: `${currentRect.width}px`,
|
|
199
|
+
top: props.placement === 'top' ? offset : '',
|
|
200
|
+
bottom: props.placement === 'bottom' ? offset : '',
|
|
201
|
+
zIndex: props.zIndex,
|
|
202
|
+
transform: transformY.value ? `translateY(${transformY.value}px)` : ''
|
|
203
|
+
};
|
|
204
|
+
});
|
|
205
|
+
const setCurrentRect = () => {
|
|
206
|
+
const rect = current.value.getBoundingClientRect();
|
|
207
|
+
Object.assign(currentRect, {
|
|
208
|
+
top: rect.top,
|
|
209
|
+
bottom: rect.bottom,
|
|
210
|
+
width: rect.width,
|
|
211
|
+
height: rect.height
|
|
212
|
+
});
|
|
213
|
+
};
|
|
214
|
+
const setAbsoluteStatus = () => {
|
|
215
|
+
const {
|
|
216
|
+
placement,
|
|
217
|
+
offset
|
|
218
|
+
} = props;
|
|
219
|
+
const currentHeightOffset = offset + currentRect.height;
|
|
220
|
+
const containerRect = scroller.value.getBoundingClientRect();
|
|
221
|
+
let transformOffsetY = 0;
|
|
222
|
+
|
|
223
|
+
// scroller-wheel滚动条偏移
|
|
224
|
+
if (scrollerInstance && isVcScrollerWheel.value) {
|
|
225
|
+
const maxMoveY = scrollerInstance.scrollHeight - scrollerInstance.clientHeight;
|
|
226
|
+
transformOffsetY = scrollerInstance.scrollTop >= maxMoveY ? maxMoveY : scrollerInstance.scrollTop;
|
|
227
|
+
}
|
|
228
|
+
if (placement === 'top') {
|
|
229
|
+
isActive.value = currentRect.top - containerRect.top <= props.offset;
|
|
230
|
+
transformY.value = Math.min(containerRect.bottom - currentHeightOffset, 0) + transformOffsetY;
|
|
231
|
+
} else {
|
|
232
|
+
isActive.value = currentRect.bottom - containerRect.top >= containerRect.height - props.offset;
|
|
233
|
+
transformY.value = Math.max(containerRect.height - containerRect.top - currentHeightOffset, 0) + transformOffsetY;
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
const setFixedStatus = () => {
|
|
237
|
+
const {
|
|
238
|
+
placement,
|
|
239
|
+
target,
|
|
240
|
+
offset
|
|
241
|
+
} = props;
|
|
242
|
+
const currentHeightOffset = offset + currentRect.height;
|
|
243
|
+
const containerRect = target && base.value.getBoundingClientRect();
|
|
244
|
+
if (placement === 'top') {
|
|
245
|
+
if (target) {
|
|
246
|
+
isActive.value = offset > currentRect.top && containerRect.bottom > 0;
|
|
247
|
+
transformY.value = Math.min(containerRect.bottom - currentHeightOffset, 0);
|
|
248
|
+
} else {
|
|
249
|
+
isActive.value = offset > currentRect.top;
|
|
250
|
+
}
|
|
251
|
+
} else {
|
|
252
|
+
if (target) {
|
|
253
|
+
isActive.value = windowHeight.value - offset < currentRect.bottom && windowHeight.value > containerRect.top;
|
|
254
|
+
transformY.value = -Math.min(windowHeight.value - containerRect.top - currentHeightOffset, 0);
|
|
255
|
+
} else {
|
|
256
|
+
isActive.value = windowHeight.value - offset < currentRect.bottom;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
const refresh = () => {
|
|
261
|
+
setCurrentRect();
|
|
262
|
+
scroller.value instanceof Window || props.fixed ? setFixedStatus() : setAbsoluteStatus();
|
|
263
|
+
};
|
|
264
|
+
vue.onMounted(() => {
|
|
265
|
+
if (typeof props.target === 'string') {
|
|
266
|
+
base.value = document.querySelector(props.target) ?? void 0;
|
|
267
|
+
}
|
|
268
|
+
!base.value && (base.value = document.documentElement);
|
|
269
|
+
scroller.value = $.getScroller(current.value, {
|
|
270
|
+
className: SCROLLER_WHEEL_REG
|
|
271
|
+
});
|
|
272
|
+
if (isVcScrollerWheel.value) {
|
|
273
|
+
scrollerInstance?.on(refresh);
|
|
274
|
+
} else {
|
|
275
|
+
scroller.value?.addEventListener('scroll', refresh);
|
|
276
|
+
}
|
|
277
|
+
refresh();
|
|
278
|
+
});
|
|
279
|
+
vue.onBeforeUnmount(() => {
|
|
280
|
+
if (isVcScrollerWheel.value) {
|
|
281
|
+
scrollerInstance?.off(refresh);
|
|
282
|
+
} else {
|
|
283
|
+
scroller.value?.removeEventListener('scroll', refresh);
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
expose({
|
|
287
|
+
refresh
|
|
288
|
+
});
|
|
289
|
+
return () => {
|
|
290
|
+
return vue.createVNode("div", {
|
|
291
|
+
"ref": current,
|
|
292
|
+
"class": "vc-affix",
|
|
293
|
+
"style": currentStyle.value
|
|
294
|
+
}, [vue.createVNode("div", {
|
|
295
|
+
"class": {
|
|
296
|
+
[`vc-affix__${props.fixed ? 'fixed' : 'absolute'}`]: isActive.value
|
|
297
|
+
},
|
|
298
|
+
"style": contentStyle.value
|
|
299
|
+
}, [slots?.default?.({
|
|
300
|
+
active: isActive.value
|
|
301
|
+
})])]);
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
const MAffix = Affix;
|
|
307
|
+
|
|
130
308
|
const props$1r = {
|
|
131
309
|
modelValue: {
|
|
132
310
|
type: Boolean,
|
|
@@ -813,7 +991,7 @@ const COMPONENT_NAME$1$ = 'vc-alert';
|
|
|
813
991
|
|
|
814
992
|
// [color, borderColor, backgroundColor], -> CSS
|
|
815
993
|
const THEME_MAP = {
|
|
816
|
-
info: ['#
|
|
994
|
+
info: ['#456CF6', '#91d5ff', '#e6f7ff'],
|
|
817
995
|
success: ['#52c41a', '#b7eb8f', '#f6ffed'],
|
|
818
996
|
error: ['#ed4014', '#ffb08f', '#fbe9e9'],
|
|
819
997
|
warning: ['#ffbf00', '#ffe58f', '#fffbe6']
|
|
@@ -9150,6 +9328,7 @@ const useScroller = (expose) => {
|
|
|
9150
9328
|
refreshSize();
|
|
9151
9329
|
refreshPosition(options);
|
|
9152
9330
|
};
|
|
9331
|
+
const listeners = [];
|
|
9153
9332
|
const triggerScrollDelegate = (options) => {
|
|
9154
9333
|
const delegates = {
|
|
9155
9334
|
scrollLeft: (options && options.x) ?? scrollX.value,
|
|
@@ -9157,12 +9336,15 @@ const useScroller = (expose) => {
|
|
|
9157
9336
|
clientWidth: wrapperW.value,
|
|
9158
9337
|
clientHeight: wrapperH.value,
|
|
9159
9338
|
scrollWidth: contentW.value,
|
|
9160
|
-
scrollHeight: contentH.value
|
|
9339
|
+
scrollHeight: contentH.value,
|
|
9340
|
+
getBoundingClientRect: () => wrapper.value?.getBoundingClientRect()
|
|
9161
9341
|
};
|
|
9162
|
-
|
|
9342
|
+
const e = {
|
|
9163
9343
|
target: delegates,
|
|
9164
9344
|
currentTarget: delegates
|
|
9165
|
-
}
|
|
9345
|
+
};
|
|
9346
|
+
instance.emit("scroll", e);
|
|
9347
|
+
listeners.forEach((listener) => listener(e));
|
|
9166
9348
|
};
|
|
9167
9349
|
const scrollTo = (options) => {
|
|
9168
9350
|
refreshPosition(options);
|
|
@@ -9189,8 +9371,9 @@ const useScroller = (expose) => {
|
|
|
9189
9371
|
helperResize.Resize.off(wrapper.value, refresh);
|
|
9190
9372
|
helperResize.Resize.off(content.value, refresh);
|
|
9191
9373
|
}
|
|
9374
|
+
listeners.splice(0, listeners.length);
|
|
9192
9375
|
});
|
|
9193
|
-
|
|
9376
|
+
const exposed = {
|
|
9194
9377
|
wrapper,
|
|
9195
9378
|
content,
|
|
9196
9379
|
scrollTo,
|
|
@@ -9206,8 +9389,16 @@ const useScroller = (expose) => {
|
|
|
9206
9389
|
},
|
|
9207
9390
|
setScrollLeft: (value) => {
|
|
9208
9391
|
scrollTo({ x: value });
|
|
9392
|
+
},
|
|
9393
|
+
on: (listener) => {
|
|
9394
|
+
listeners.push(listener);
|
|
9395
|
+
},
|
|
9396
|
+
off: (listener) => {
|
|
9397
|
+
listeners.splice(listeners.indexOf(listener), 1);
|
|
9209
9398
|
}
|
|
9210
|
-
}
|
|
9399
|
+
};
|
|
9400
|
+
expose(exposed);
|
|
9401
|
+
vue.provide("vc-scroller", vue.reactive(exposed));
|
|
9211
9402
|
return {
|
|
9212
9403
|
bar,
|
|
9213
9404
|
wrapper,
|
|
@@ -14864,7 +15055,7 @@ const props$n = {
|
|
|
14864
15055
|
color: {
|
|
14865
15056
|
type: [Object, String],
|
|
14866
15057
|
default: () => ({
|
|
14867
|
-
normal: "#
|
|
15058
|
+
normal: "#456CF6",
|
|
14868
15059
|
success: "#52c41a",
|
|
14869
15060
|
error: "#f5222d"
|
|
14870
15061
|
})
|
|
@@ -19812,6 +20003,7 @@ const useTabs = (options = {}) => {
|
|
|
19812
20003
|
emit("update:modelValue", currentValue.value);
|
|
19813
20004
|
emit("change", currentValue.value);
|
|
19814
20005
|
emit("click", currentValue.value);
|
|
20006
|
+
nav.anchor && document.querySelector(nav.anchor)?.scrollIntoView?.({ behavior: "smooth" });
|
|
19815
20007
|
};
|
|
19816
20008
|
const handleResize = () => {
|
|
19817
20009
|
if (instance.isUnmounted) return;
|
|
@@ -20064,12 +20256,16 @@ const Tabs = /* @__PURE__ */ vue.defineComponent({
|
|
|
20064
20256
|
|
|
20065
20257
|
const props$b = {
|
|
20066
20258
|
value: {
|
|
20067
|
-
type: [String, Number, Boolean]
|
|
20259
|
+
type: [String, Number, Boolean],
|
|
20260
|
+
default: void 0
|
|
20068
20261
|
},
|
|
20069
20262
|
label: {
|
|
20070
20263
|
type: [String, Function],
|
|
20071
20264
|
default: ""
|
|
20072
20265
|
},
|
|
20266
|
+
anchor: {
|
|
20267
|
+
type: String
|
|
20268
|
+
},
|
|
20073
20269
|
/**
|
|
20074
20270
|
* 服务端渲染时,lazy设置为false,可以把内容渲染出来;
|
|
20075
20271
|
* 不能设置为!IS_SERVER, 会影响客服端激活,不一样会存在问题
|
|
@@ -20412,7 +20608,7 @@ const MTabs = /* @__PURE__ */ vue.defineComponent({
|
|
|
20412
20608
|
"class": [{
|
|
20413
20609
|
'is-fixed': isFixed
|
|
20414
20610
|
}, 'vcm-tabs__bar']
|
|
20415
|
-
}, [vue.createVNode("slot", {
|
|
20611
|
+
}, [vue.createVNode(vue.resolveComponent("slot"), {
|
|
20416
20612
|
"name": "prepend"
|
|
20417
20613
|
}, null), slots.prepend?.(), props.showStep && tabs.scrollable.value && vue.createVNode("div", {
|
|
20418
20614
|
"class": "vcm-tabs__step is-left",
|
|
@@ -20526,6 +20722,10 @@ const props$9 = {
|
|
|
20526
20722
|
default: (props$) => {
|
|
20527
20723
|
return props$.value;
|
|
20528
20724
|
}
|
|
20725
|
+
},
|
|
20726
|
+
theme: {
|
|
20727
|
+
type: String,
|
|
20728
|
+
default: "dark"
|
|
20529
20729
|
}
|
|
20530
20730
|
};
|
|
20531
20731
|
|
|
@@ -20578,7 +20778,7 @@ const Text = /* @__PURE__ */ vue.defineComponent({
|
|
|
20578
20778
|
// 确保不重复创建
|
|
20579
20779
|
triggerEl: e.target,
|
|
20580
20780
|
hover: true,
|
|
20581
|
-
theme:
|
|
20781
|
+
theme: props.theme,
|
|
20582
20782
|
placement: props.placement,
|
|
20583
20783
|
portalClass: props.portalClass,
|
|
20584
20784
|
portalStyle: [props.portalStyle || `width: ${e.target.clientWidth}px`, 'word-break: break-all'],
|
|
@@ -23540,6 +23740,7 @@ const UploadPicker = /* @__PURE__ */ vue.defineComponent({
|
|
|
23540
23740
|
const MUploadPicker = UploadPicker;
|
|
23541
23741
|
|
|
23542
23742
|
exports.ActionSheet = ActionSheet;
|
|
23743
|
+
exports.Affix = Affix;
|
|
23543
23744
|
exports.Alert = Alert;
|
|
23544
23745
|
exports.Artboard = Artboard;
|
|
23545
23746
|
exports.Button = Button;
|
|
@@ -23584,6 +23785,7 @@ exports.InputSearch = InputSearch;
|
|
|
23584
23785
|
exports.List = MList;
|
|
23585
23786
|
exports.ListItem = MListItem;
|
|
23586
23787
|
exports.MActionSheet = MActionSheet;
|
|
23788
|
+
exports.MAffix = MAffix;
|
|
23587
23789
|
exports.MAlert = MAlert;
|
|
23588
23790
|
exports.MArtboard = MArtboard;
|
|
23589
23791
|
exports.MButton = MButton;
|