@deot/vc 1.0.47 → 1.0.49
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.d.ts +158 -98
- package/dist/index.iife.js +177 -93
- package/dist/index.umd.cjs +177 -93
- package/package.json +4 -4
package/dist/index.iife.js
CHANGED
|
@@ -221,7 +221,7 @@ var Vc = (function (exports, vue) {
|
|
|
221
221
|
return !!(overflow.match(/(scroll|auto)/) || className?.test(el.className));
|
|
222
222
|
};
|
|
223
223
|
|
|
224
|
-
const getScroller = (el, options) => {
|
|
224
|
+
const getScroller$1 = (el, options) => {
|
|
225
225
|
if (IS_SERVER$2 || !el) return null;
|
|
226
226
|
let parent = el;
|
|
227
227
|
while (parent) {
|
|
@@ -9150,6 +9150,10 @@ var Vc = (function (exports, vue) {
|
|
|
9150
9150
|
});
|
|
9151
9151
|
const MActionSheet = ActionSheet;
|
|
9152
9152
|
const props$1s = {
|
|
9153
|
+
modelValue: {
|
|
9154
|
+
type: Boolean,
|
|
9155
|
+
default: false
|
|
9156
|
+
},
|
|
9153
9157
|
zIndex: {
|
|
9154
9158
|
type: [Number, String],
|
|
9155
9159
|
default: 1
|
|
@@ -9176,14 +9180,42 @@ var Vc = (function (exports, vue) {
|
|
|
9176
9180
|
type: String
|
|
9177
9181
|
}
|
|
9178
9182
|
};
|
|
9179
|
-
|
|
9183
|
+
let scrollBarWidth;
|
|
9184
|
+
const getScrollBarWidth = () => {
|
|
9185
|
+
if (scrollBarWidth !== void 0) return scrollBarWidth;
|
|
9186
|
+
const outer = document.createElement("div");
|
|
9187
|
+
outer.className = "vc-scrollbar__wrap";
|
|
9188
|
+
outer.style.visibility = "hidden";
|
|
9189
|
+
outer.style.width = "100px";
|
|
9190
|
+
outer.style.position = "absolute";
|
|
9191
|
+
outer.style.top = "-9999px";
|
|
9192
|
+
document.body.appendChild(outer);
|
|
9193
|
+
const widthNoScroll = outer.offsetWidth;
|
|
9194
|
+
outer.style.overflow = "scroll";
|
|
9195
|
+
const inner = document.createElement("div");
|
|
9196
|
+
inner.style.width = "100%";
|
|
9197
|
+
outer.appendChild(inner);
|
|
9198
|
+
const widthWithScroll = inner.offsetWidth;
|
|
9199
|
+
outer.parentNode?.removeChild?.(outer);
|
|
9200
|
+
scrollBarWidth = widthNoScroll - widthWithScroll;
|
|
9201
|
+
return scrollBarWidth;
|
|
9202
|
+
};
|
|
9180
9203
|
const SCROLLER_WHEEL_REG = /vc-scroller-wheel/;
|
|
9204
|
+
const getScroller = (el2) => {
|
|
9205
|
+
return getScroller$1(el2, { className: SCROLLER_WHEEL_REG });
|
|
9206
|
+
};
|
|
9207
|
+
const isWheel = (el2) => {
|
|
9208
|
+
return SCROLLER_WHEEL_REG.test(el2?.className || "");
|
|
9209
|
+
};
|
|
9210
|
+
const COMPONENT_NAME$27 = "vc-affix";
|
|
9181
9211
|
const Affix = /* @__PURE__ */ vue.defineComponent({
|
|
9182
9212
|
name: COMPONENT_NAME$27,
|
|
9213
|
+
emits: ["update:modelValue"],
|
|
9183
9214
|
props: props$1s,
|
|
9184
9215
|
setup(props2, {
|
|
9185
9216
|
slots,
|
|
9186
|
-
expose
|
|
9217
|
+
expose,
|
|
9218
|
+
emit
|
|
9187
9219
|
}) {
|
|
9188
9220
|
const scrollerInstance = vue.inject("vc-scroller", null);
|
|
9189
9221
|
const scroller = vue.shallowRef();
|
|
@@ -9198,9 +9230,7 @@ var Vc = (function (exports, vue) {
|
|
|
9198
9230
|
const isActive = vue.ref(false);
|
|
9199
9231
|
const transformY = vue.ref(0);
|
|
9200
9232
|
const windowHeight = vue.ref(window.innerHeight);
|
|
9201
|
-
const isVcScrollerWheel = vue.computed(() =>
|
|
9202
|
-
return SCROLLER_WHEEL_REG.test(scroller.value?.className || "");
|
|
9203
|
-
});
|
|
9233
|
+
const isVcScrollerWheel = vue.computed(() => isWheel(scroller.value));
|
|
9204
9234
|
const currentStyle = vue.computed(() => {
|
|
9205
9235
|
if (!isActive.value) return {};
|
|
9206
9236
|
return {
|
|
@@ -9221,7 +9251,8 @@ var Vc = (function (exports, vue) {
|
|
|
9221
9251
|
};
|
|
9222
9252
|
});
|
|
9223
9253
|
const setCurrentRect = () => {
|
|
9224
|
-
const rect = current.value
|
|
9254
|
+
const rect = current.value?.getBoundingClientRect?.();
|
|
9255
|
+
if (!rect) return;
|
|
9225
9256
|
Object.assign(currentRect, {
|
|
9226
9257
|
top: rect.top,
|
|
9227
9258
|
bottom: rect.bottom,
|
|
@@ -9246,7 +9277,7 @@ var Vc = (function (exports, vue) {
|
|
|
9246
9277
|
transformY.value = Math.min(containerRect.bottom - currentHeightOffset, 0) + transformOffsetY;
|
|
9247
9278
|
} else {
|
|
9248
9279
|
isActive.value = currentRect.bottom - containerRect.top >= containerRect.height - props2.offset;
|
|
9249
|
-
transformY.value =
|
|
9280
|
+
transformY.value = transformOffsetY;
|
|
9250
9281
|
}
|
|
9251
9282
|
};
|
|
9252
9283
|
const setFixedStatus = () => {
|
|
@@ -9273,36 +9304,57 @@ var Vc = (function (exports, vue) {
|
|
|
9273
9304
|
}
|
|
9274
9305
|
}
|
|
9275
9306
|
};
|
|
9307
|
+
const offScroll = (handler) => {
|
|
9308
|
+
if (isVcScrollerWheel.value) {
|
|
9309
|
+
scrollerInstance?.off(handler);
|
|
9310
|
+
} else {
|
|
9311
|
+
scroller.value?.removeEventListener("scroll", handler);
|
|
9312
|
+
}
|
|
9313
|
+
};
|
|
9314
|
+
const onScroll = (handler, options) => {
|
|
9315
|
+
vue.nextTick(() => {
|
|
9316
|
+
if (isVcScrollerWheel.value) {
|
|
9317
|
+
scrollerInstance?.on(handler);
|
|
9318
|
+
} else {
|
|
9319
|
+
scroller.value?.addEventListener("scroll", handler);
|
|
9320
|
+
}
|
|
9321
|
+
options?.first && handler();
|
|
9322
|
+
});
|
|
9323
|
+
return () => offScroll(handler);
|
|
9324
|
+
};
|
|
9276
9325
|
const refresh = () => {
|
|
9326
|
+
if (props2.disabled) return;
|
|
9277
9327
|
setCurrentRect();
|
|
9278
9328
|
scroller.value instanceof Window || props2.fixed ? setFixedStatus() : setAbsoluteStatus();
|
|
9329
|
+
emit("update:modelValue", isActive.value);
|
|
9279
9330
|
};
|
|
9280
9331
|
vue.onMounted(() => {
|
|
9281
9332
|
if (typeof props2.target === "string") {
|
|
9282
9333
|
base.value = document.querySelector(props2.target) ?? void 0;
|
|
9283
9334
|
}
|
|
9284
9335
|
!base.value && (base.value = document.documentElement);
|
|
9285
|
-
scroller.value = getScroller(current.value
|
|
9286
|
-
|
|
9336
|
+
scroller.value = getScroller(current.value);
|
|
9337
|
+
onScroll(refresh, {
|
|
9338
|
+
first: true
|
|
9287
9339
|
});
|
|
9288
|
-
if (isVcScrollerWheel.value) {
|
|
9289
|
-
scrollerInstance?.on(refresh);
|
|
9290
|
-
} else {
|
|
9291
|
-
scroller.value?.addEventListener("scroll", refresh);
|
|
9292
|
-
}
|
|
9293
|
-
refresh();
|
|
9294
|
-
});
|
|
9295
|
-
vue.onBeforeUnmount(() => {
|
|
9296
|
-
if (isVcScrollerWheel.value) {
|
|
9297
|
-
scrollerInstance?.off(refresh);
|
|
9298
|
-
} else {
|
|
9299
|
-
scroller.value?.removeEventListener("scroll", refresh);
|
|
9300
|
-
}
|
|
9301
9340
|
});
|
|
9341
|
+
vue.onBeforeUnmount(() => offScroll(refresh));
|
|
9302
9342
|
expose({
|
|
9303
|
-
refresh
|
|
9343
|
+
refresh,
|
|
9344
|
+
onScroll,
|
|
9345
|
+
offScroll
|
|
9346
|
+
});
|
|
9347
|
+
vue.provide("vc-affix", {
|
|
9348
|
+
props: props2,
|
|
9349
|
+
isActive,
|
|
9350
|
+
refresh,
|
|
9351
|
+
onScroll,
|
|
9352
|
+
offScroll
|
|
9304
9353
|
});
|
|
9305
9354
|
return () => {
|
|
9355
|
+
if (props2.disabled) return slots?.default?.({
|
|
9356
|
+
active: false
|
|
9357
|
+
});
|
|
9306
9358
|
return vue.createVNode("div", {
|
|
9307
9359
|
"ref": current,
|
|
9308
9360
|
"class": "vc-affix",
|
|
@@ -17453,26 +17505,6 @@ var Vc = (function (exports, vue) {
|
|
|
17453
17505
|
default: () => [0, 0]
|
|
17454
17506
|
}
|
|
17455
17507
|
};
|
|
17456
|
-
let scrollBarWidth;
|
|
17457
|
-
const getScrollBarWidth = () => {
|
|
17458
|
-
if (scrollBarWidth !== void 0) return scrollBarWidth;
|
|
17459
|
-
const outer = document.createElement("div");
|
|
17460
|
-
outer.className = "vc-scrollbar__wrap";
|
|
17461
|
-
outer.style.visibility = "hidden";
|
|
17462
|
-
outer.style.width = "100px";
|
|
17463
|
-
outer.style.position = "absolute";
|
|
17464
|
-
outer.style.top = "-9999px";
|
|
17465
|
-
document.body.appendChild(outer);
|
|
17466
|
-
const widthNoScroll = outer.offsetWidth;
|
|
17467
|
-
outer.style.overflow = "scroll";
|
|
17468
|
-
const inner = document.createElement("div");
|
|
17469
|
-
inner.style.width = "100%";
|
|
17470
|
-
outer.appendChild(inner);
|
|
17471
|
-
const widthWithScroll = inner.offsetWidth;
|
|
17472
|
-
outer.parentNode?.removeChild?.(outer);
|
|
17473
|
-
scrollBarWidth = widthNoScroll - widthWithScroll;
|
|
17474
|
-
return scrollBarWidth;
|
|
17475
|
-
};
|
|
17476
17508
|
const barKeys$1 = [
|
|
17477
17509
|
"always",
|
|
17478
17510
|
"thumbMinSize",
|
|
@@ -19897,7 +19929,14 @@ var Vc = (function (exports, vue) {
|
|
|
19897
19929
|
labelStyle: [Object, String],
|
|
19898
19930
|
labelClass: [Object, String],
|
|
19899
19931
|
errorStyle: [Object, String],
|
|
19900
|
-
errorClass: [Object, String]
|
|
19932
|
+
errorClass: [Object, String],
|
|
19933
|
+
// 给nestFormItem统一注入
|
|
19934
|
+
nestedContentStyle: [Object, String],
|
|
19935
|
+
nestedContentClass: [Object, String],
|
|
19936
|
+
nestedLabelStyle: [Object, String],
|
|
19937
|
+
nestedLabelClass: [Object, String],
|
|
19938
|
+
nestedErrorStyle: [Object, String],
|
|
19939
|
+
nestedErrorClass: [Object, String]
|
|
19901
19940
|
};
|
|
19902
19941
|
const useForm = (expose, options = {}) => {
|
|
19903
19942
|
const instance = vue.getCurrentInstance();
|
|
@@ -20113,31 +20152,32 @@ var Vc = (function (exports, vue) {
|
|
|
20113
20152
|
});
|
|
20114
20153
|
const classes = vue.computed(() => {
|
|
20115
20154
|
return {
|
|
20116
|
-
"is-
|
|
20155
|
+
"is-required": isRequired.value && props2.asterisk,
|
|
20117
20156
|
"is-error": validateState.value === "error",
|
|
20118
20157
|
"is-validating": validateState.value === "validating",
|
|
20119
20158
|
"is-inline": form.props.inline,
|
|
20120
|
-
"is-
|
|
20159
|
+
"is-nested": isNested.value,
|
|
20121
20160
|
"is-alone": !props2.showMessage,
|
|
20122
20161
|
// 用于单独去除form-item的默认margin_bottom
|
|
20123
20162
|
[`is-${labelPosition.value}`]: true
|
|
20124
20163
|
};
|
|
20125
20164
|
});
|
|
20126
|
-
const
|
|
20165
|
+
const isNested = vue.computed(() => {
|
|
20127
20166
|
return !!formItem.change;
|
|
20128
20167
|
});
|
|
20129
|
-
const
|
|
20168
|
+
const isNestedLast = vue.ref(false);
|
|
20130
20169
|
const hasLabel = vue.computed(() => {
|
|
20131
20170
|
return !!props2.label || slots.label;
|
|
20132
20171
|
});
|
|
20133
20172
|
const labelStyle = vue.computed(() => {
|
|
20134
|
-
const labelWidth = props2.labelWidth === 0 || props2.labelWidth ? props2.labelWidth :
|
|
20173
|
+
const labelWidth = props2.labelWidth === 0 || props2.labelWidth ? props2.labelWidth : isNested.value ? 0 : form.props.labelWidth;
|
|
20135
20174
|
return [
|
|
20136
20175
|
{
|
|
20137
20176
|
width: labelPosition.value !== "top" && labelWidth && labelWidth > 0 ? `${labelWidth}px` : "auto",
|
|
20138
20177
|
textAlign: labelPosition.value === "top" ? "left" : labelPosition.value
|
|
20139
20178
|
},
|
|
20140
20179
|
form.props.labelStyle,
|
|
20180
|
+
isNested.value && form.props.nestedLabelStyle,
|
|
20141
20181
|
props2.labelStyle
|
|
20142
20182
|
];
|
|
20143
20183
|
});
|
|
@@ -20145,24 +20185,25 @@ var Vc = (function (exports, vue) {
|
|
|
20145
20185
|
const labelWidth = props2.labelWidth === 0 || props2.labelWidth ? props2.labelWidth : form.props.labelWidth;
|
|
20146
20186
|
return [
|
|
20147
20187
|
{
|
|
20148
|
-
marginLeft: !hasLabel.value &&
|
|
20149
|
-
marginBottom:
|
|
20188
|
+
marginLeft: labelPosition.value === "top" || !hasLabel.value && isNested.value ? 0 : labelWidth && labelWidth > 0 ? `${labelWidth}px` : "unset",
|
|
20189
|
+
marginBottom: isNested.value && !isNestedLast.value ? `20px` : 0
|
|
20150
20190
|
},
|
|
20151
20191
|
form.props.contentStyle,
|
|
20192
|
+
isNested.value && form.props.nestedContentStyle,
|
|
20152
20193
|
props2.contentStyle
|
|
20153
20194
|
];
|
|
20154
20195
|
});
|
|
20155
20196
|
const errorStyle = vue.computed(() => {
|
|
20156
|
-
return [form.props.errorStyle, props2.errorStyle];
|
|
20197
|
+
return [form.props.errorStyle, isNested.value && form.props.nestedErrorStyle, props2.errorStyle];
|
|
20157
20198
|
});
|
|
20158
20199
|
const labelClass = vue.computed(() => {
|
|
20159
|
-
return [form.props.labelClass, props2.labelClass];
|
|
20200
|
+
return [form.props.labelClass, isNested.value && form.props.nestedLabelClass, props2.labelClass];
|
|
20160
20201
|
});
|
|
20161
20202
|
const contentClass = vue.computed(() => {
|
|
20162
|
-
return [form.props.contentClass, props2.contentClass];
|
|
20203
|
+
return [form.props.contentClass, isNested.value && form.props.nestedContentClass, props2.contentClass];
|
|
20163
20204
|
});
|
|
20164
20205
|
const errorClass = vue.computed(() => {
|
|
20165
|
-
return [form.props.errorClass, props2.errorClass];
|
|
20206
|
+
return [form.props.errorClass, isNested.value && form.props.nestedErrorClass, props2.errorClass];
|
|
20166
20207
|
});
|
|
20167
20208
|
const isStyleless = vue.computed(() => {
|
|
20168
20209
|
return props2.styleless || form.props.styleless;
|
|
@@ -20299,7 +20340,7 @@ var Vc = (function (exports, vue) {
|
|
|
20299
20340
|
vue.watch(
|
|
20300
20341
|
() => formItem.fields?.length,
|
|
20301
20342
|
async (v) => {
|
|
20302
|
-
if (!
|
|
20343
|
+
if (!isNested.value || !v) return isNestedLast.value = false;
|
|
20303
20344
|
const fields$ = [...vue.toRaw(formItem.fields)];
|
|
20304
20345
|
const positions = await Promise.all(fields$.map((item) => item.exposed.getPosition()));
|
|
20305
20346
|
const sortFields = fields$.toSorted((a, b) => {
|
|
@@ -20310,7 +20351,7 @@ var Vc = (function (exports, vue) {
|
|
|
20310
20351
|
if (aPosition.top != bPosition.top) return aPosition.top - bPosition.top;
|
|
20311
20352
|
return aPosition.left - bPosition.left;
|
|
20312
20353
|
});
|
|
20313
|
-
|
|
20354
|
+
isNestedLast.value = sortFields[sortFields.length - 1] === instance;
|
|
20314
20355
|
}
|
|
20315
20356
|
);
|
|
20316
20357
|
expose({
|
|
@@ -20319,9 +20360,9 @@ var Vc = (function (exports, vue) {
|
|
|
20319
20360
|
getPosition
|
|
20320
20361
|
});
|
|
20321
20362
|
return {
|
|
20322
|
-
|
|
20363
|
+
isNested,
|
|
20323
20364
|
isStyleless,
|
|
20324
|
-
|
|
20365
|
+
isNestedLast,
|
|
20325
20366
|
validateMessage,
|
|
20326
20367
|
classes,
|
|
20327
20368
|
labelStyle,
|
|
@@ -20345,7 +20386,7 @@ var Vc = (function (exports, vue) {
|
|
|
20345
20386
|
const it = useFormItem(expose);
|
|
20346
20387
|
const {
|
|
20347
20388
|
isStyleless,
|
|
20348
|
-
|
|
20389
|
+
isNested,
|
|
20349
20390
|
classes,
|
|
20350
20391
|
labelStyle,
|
|
20351
20392
|
contentStyle,
|
|
@@ -20356,39 +20397,35 @@ var Vc = (function (exports, vue) {
|
|
|
20356
20397
|
showError,
|
|
20357
20398
|
validateMessage
|
|
20358
20399
|
} = it;
|
|
20359
|
-
const {
|
|
20360
|
-
label,
|
|
20361
|
-
labelFor
|
|
20362
|
-
} = props2;
|
|
20363
20400
|
const errorColorClass = "vc-form-item__error";
|
|
20364
20401
|
return () => {
|
|
20365
20402
|
if (isStyleless.value) return [slots.default?.(), slots.error?.({
|
|
20366
20403
|
show: showError.value,
|
|
20367
|
-
|
|
20404
|
+
nested: isNested.value,
|
|
20368
20405
|
message: validateMessage.value,
|
|
20369
20406
|
class: [errorColorClass, ...errorClass.value],
|
|
20370
20407
|
style: errorStyle.value
|
|
20371
20408
|
})];
|
|
20372
20409
|
return vue.createVNode("div", {
|
|
20373
20410
|
"class": ["vc-form-item", classes.value]
|
|
20374
|
-
}, [(label || slots.label) && vue.createVNode("div", {
|
|
20411
|
+
}, [(props2.label || slots.label) && vue.createVNode("div", {
|
|
20375
20412
|
"style": labelStyle.value,
|
|
20376
20413
|
"class": ["vc-form-item__label", ...labelClass.value],
|
|
20377
|
-
"for": labelFor
|
|
20378
|
-
}, [vue.createVNode("label", null, [label || slots.label?.()])]), vue.createVNode("div", {
|
|
20414
|
+
"for": props2.labelFor
|
|
20415
|
+
}, [vue.createVNode("label", null, [props2.label || slots.label?.()])]), vue.createVNode("div", {
|
|
20379
20416
|
"class": "vc-form-item__wrapper"
|
|
20380
20417
|
}, [vue.createVNode("div", {
|
|
20381
20418
|
"class": ["vc-form-item__content", ...contentClass.value],
|
|
20382
20419
|
"style": contentStyle.value
|
|
20383
20420
|
}, [slots.default?.(), slots.error ? slots.error({
|
|
20384
20421
|
show: showError.value,
|
|
20385
|
-
nest:
|
|
20422
|
+
nest: isNested.value,
|
|
20386
20423
|
message: validateMessage.value,
|
|
20387
20424
|
class: [errorColorClass, ...errorClass.value],
|
|
20388
20425
|
style: errorStyle.value
|
|
20389
20426
|
}) : vue.createVNode(TransitionFade, null, {
|
|
20390
20427
|
default: () => [vue.withDirectives(vue.createVNode("div", {
|
|
20391
|
-
"class": ["vc-form-item__tip",
|
|
20428
|
+
"class": ["vc-form-item__tip", isNested.value ? "is-nested" : "", errorColorClass, ...errorClass.value],
|
|
20392
20429
|
"style": [errorStyle.value]
|
|
20393
20430
|
}, [validateMessage.value]), [[vue.vShow, showError.value]])]
|
|
20394
20431
|
})])])]);
|
|
@@ -20453,41 +20490,36 @@ var Vc = (function (exports, vue) {
|
|
|
20453
20490
|
labelClass,
|
|
20454
20491
|
contentClass,
|
|
20455
20492
|
errorClass,
|
|
20456
|
-
|
|
20493
|
+
isNested,
|
|
20457
20494
|
showError,
|
|
20458
20495
|
validateMessage
|
|
20459
20496
|
} = it;
|
|
20460
|
-
const {
|
|
20461
|
-
label,
|
|
20462
|
-
labelFor,
|
|
20463
|
-
showMessage
|
|
20464
|
-
} = props2;
|
|
20465
20497
|
const errorColorClass = "vcm-form-item__error";
|
|
20466
20498
|
return () => {
|
|
20467
20499
|
if (isStyleless.value) return [slots.default?.(), slots.error?.({
|
|
20468
20500
|
show: showError.value,
|
|
20469
|
-
|
|
20501
|
+
nested: isNested.value,
|
|
20470
20502
|
message: validateMessage.value,
|
|
20471
20503
|
class: [errorColorClass, ...errorClass.value],
|
|
20472
20504
|
style: errorStyle.value
|
|
20473
20505
|
})];
|
|
20474
20506
|
return vue.createVNode("div", {
|
|
20475
20507
|
"style": {
|
|
20476
|
-
paddingLeft: `${
|
|
20508
|
+
paddingLeft: `${isNested.value ? 0 : props2.indent}px`
|
|
20477
20509
|
},
|
|
20478
20510
|
"class": [classes.value, "vcm-form-item"]
|
|
20479
20511
|
}, [vue.createVNode("div", {
|
|
20480
20512
|
"class": "vcm-form-item__wrapper"
|
|
20481
20513
|
}, [(props2.label || slots.label) && vue.createVNode("label", {
|
|
20482
|
-
"for": labelFor,
|
|
20514
|
+
"for": props2.labelFor,
|
|
20483
20515
|
"style": labelStyle.value,
|
|
20484
20516
|
"class": ["vcm-form-item__label", ...labelClass.value]
|
|
20485
|
-
}, [label || slots.label?.()]), vue.createVNode("div", {
|
|
20517
|
+
}, [props2.label || slots.label?.()]), vue.createVNode("div", {
|
|
20486
20518
|
"style": contentStyle.value,
|
|
20487
20519
|
"class": ["vcm-form-item__content", ...contentClass.value]
|
|
20488
|
-
}, [slots.default?.(), showMessage && showError.value && vue.createVNode("div", {
|
|
20520
|
+
}, [slots.default?.(), props2.showMessage && showError.value && vue.createVNode("div", {
|
|
20489
20521
|
"class": [{
|
|
20490
|
-
"is-
|
|
20522
|
+
"is-nested": isNested.value
|
|
20491
20523
|
}, errorColorClass, ...errorClass.value],
|
|
20492
20524
|
"style": errorStyle.value
|
|
20493
20525
|
}, [slots.error ? slots.error({
|
|
@@ -20627,7 +20659,7 @@ var Vc = (function (exports, vue) {
|
|
|
20627
20659
|
} else if (typeof wrapper === "string") {
|
|
20628
20660
|
scroller.value = document.querySelector(wrapper);
|
|
20629
20661
|
} else {
|
|
20630
|
-
scroller.value = getScroller(instance.vnode.el);
|
|
20662
|
+
scroller.value = getScroller$1(instance.vnode.el);
|
|
20631
20663
|
}
|
|
20632
20664
|
};
|
|
20633
20665
|
const initPlaceholder = () => {
|
|
@@ -22609,13 +22641,13 @@ var Vc = (function (exports, vue) {
|
|
|
22609
22641
|
"readonly": true,
|
|
22610
22642
|
"placeholder": its.value.attrs?.placeholder || "请选择"
|
|
22611
22643
|
}, {
|
|
22612
|
-
prepend: () => {
|
|
22613
|
-
|
|
22614
|
-
|
|
22615
|
-
|
|
22644
|
+
prepend: slots.prepend || props2.label ? () => {
|
|
22645
|
+
slots.prepend ? slots.prepend() : vue.createVNode("div", {
|
|
22646
|
+
"class": "vc-select__prepend"
|
|
22647
|
+
}, [vue.createVNode("span", {
|
|
22616
22648
|
"class": "vc-select__label"
|
|
22617
|
-
}, [props2.label]);
|
|
22618
|
-
},
|
|
22649
|
+
}, [props2.label])]);
|
|
22650
|
+
} : null,
|
|
22619
22651
|
content: multiple.value && currentValue.value && currentValue.value.length > 0 ? () => {
|
|
22620
22652
|
return vue.createVNode("div", {
|
|
22621
22653
|
"class": [classes.value, "vc-select__tags"]
|
|
@@ -27985,9 +28017,12 @@ var Vc = (function (exports, vue) {
|
|
|
27985
28017
|
barStyle: [Object, String],
|
|
27986
28018
|
contentStyle: [Object, String],
|
|
27987
28019
|
barClass: [Object, String],
|
|
27988
|
-
contentClass: [Object, String]
|
|
28020
|
+
contentClass: [Object, String],
|
|
28021
|
+
affixable: Boolean,
|
|
28022
|
+
affixOptions: Object
|
|
27989
28023
|
};
|
|
27990
28024
|
const useTabs = (options = {}) => {
|
|
28025
|
+
const affix = vue.inject("vc-affix", null);
|
|
27991
28026
|
const instance = vue.getCurrentInstance();
|
|
27992
28027
|
const { props: props2, emit } = instance;
|
|
27993
28028
|
const tabsId = vue.ref(getUid("tabs"));
|
|
@@ -28029,10 +28064,56 @@ var Vc = (function (exports, vue) {
|
|
|
28029
28064
|
[`is-${props2.theme}`]: !!props2.theme
|
|
28030
28065
|
};
|
|
28031
28066
|
});
|
|
28067
|
+
const hasAnchor = vue.computed(() => {
|
|
28068
|
+
return list.value.some((item) => !!item.anchor);
|
|
28069
|
+
});
|
|
28032
28070
|
const refresh = () => {
|
|
28033
28071
|
options?.refreshAfloat?.();
|
|
28034
28072
|
};
|
|
28035
|
-
|
|
28073
|
+
let scrollToAnchorTimer;
|
|
28074
|
+
const scrollToAnchor = (anchor) => {
|
|
28075
|
+
if (!anchor) return;
|
|
28076
|
+
const el2 = document.querySelector(anchor);
|
|
28077
|
+
if (!el2) return;
|
|
28078
|
+
const scroller = getScroller(instance.vnode.el);
|
|
28079
|
+
scrollIntoView(scroller, {
|
|
28080
|
+
duration: 250,
|
|
28081
|
+
from: scroller.scrollTop,
|
|
28082
|
+
to: scroller.scrollTop + el2.getBoundingClientRect().top - scroller.getBoundingClientRect().top - (!affix || affix.props.placement !== "bottom" ? instance.vnode.el.offsetHeight : 0) - (affix && affix.props.placement !== "bottom" ? affix.props.offset : 0)
|
|
28083
|
+
});
|
|
28084
|
+
scrollToAnchorTimer && clearTimeout(scrollToAnchorTimer);
|
|
28085
|
+
scrollToAnchorTimer = setTimeout(() => scrollToAnchorTimer = null, 300);
|
|
28086
|
+
};
|
|
28087
|
+
const handleAffixScroll = () => {
|
|
28088
|
+
if (!hasAnchor.value || scrollToAnchorTimer) return;
|
|
28089
|
+
const scroller = getScroller(instance.vnode.el);
|
|
28090
|
+
const scrollTop = scroller?.scrollTop;
|
|
28091
|
+
if (typeof scrollTop !== "number") return;
|
|
28092
|
+
for (let i = 0; i < list.value.length; i++) {
|
|
28093
|
+
const nav = list.value[i];
|
|
28094
|
+
const anchor = nav.anchor;
|
|
28095
|
+
if (!anchor) continue;
|
|
28096
|
+
const el2 = document.querySelector(anchor);
|
|
28097
|
+
if (!el2) continue;
|
|
28098
|
+
const elTop = el2.getBoundingClientRect().top - scroller.getBoundingClientRect().top + scroller.scrollTop;
|
|
28099
|
+
const nextNav = list.value[i + 1];
|
|
28100
|
+
let nextElTop;
|
|
28101
|
+
if (nextNav && nextNav.anchor) {
|
|
28102
|
+
const nextEl = document.querySelector(nextNav.anchor);
|
|
28103
|
+
if (nextEl) {
|
|
28104
|
+
nextElTop = nextEl.getBoundingClientRect().top - scroller.getBoundingClientRect().top + scroller.scrollTop;
|
|
28105
|
+
}
|
|
28106
|
+
}
|
|
28107
|
+
const allowDistance = 2;
|
|
28108
|
+
if (scrollTop >= elTop - allowDistance && (typeof nextElTop === "undefined" || scrollTop < nextElTop - allowDistance)) {
|
|
28109
|
+
if (getTabIndex(currentValue.value) !== i) {
|
|
28110
|
+
handleChange(i, false);
|
|
28111
|
+
}
|
|
28112
|
+
break;
|
|
28113
|
+
}
|
|
28114
|
+
}
|
|
28115
|
+
};
|
|
28116
|
+
const handleChange = (index, scrollTo = true) => {
|
|
28036
28117
|
if (timer.value) return;
|
|
28037
28118
|
timer.value = setTimeout(() => timer.value = null, 300);
|
|
28038
28119
|
const nav = list.value[index];
|
|
@@ -28041,7 +28122,7 @@ var Vc = (function (exports, vue) {
|
|
|
28041
28122
|
emit("update:modelValue", currentValue.value);
|
|
28042
28123
|
emit("change", currentValue.value);
|
|
28043
28124
|
emit("click", currentValue.value);
|
|
28044
|
-
|
|
28125
|
+
scrollTo && scrollToAnchor(nav.anchor);
|
|
28045
28126
|
};
|
|
28046
28127
|
const handleResize = () => {
|
|
28047
28128
|
if (instance.isUnmounted) return;
|
|
@@ -28051,10 +28132,13 @@ var Vc = (function (exports, vue) {
|
|
|
28051
28132
|
vue.onMounted(() => {
|
|
28052
28133
|
Resize.on(options.wrapper.value, handleResize);
|
|
28053
28134
|
options.scrollToActive && vue.nextTick(options.scrollToActive);
|
|
28135
|
+
affix?.onScroll?.(handleAffixScroll);
|
|
28054
28136
|
});
|
|
28055
28137
|
vue.onBeforeUnmount(() => {
|
|
28056
28138
|
Resize.off(options.wrapper.value, handleResize);
|
|
28057
28139
|
timer.value && clearTimeout(timer.value);
|
|
28140
|
+
affix?.offScroll?.(handleAffixScroll);
|
|
28141
|
+
scrollToAnchorTimer && clearTimeout(scrollToAnchorTimer);
|
|
28058
28142
|
});
|
|
28059
28143
|
const add = (item, setValue) => {
|
|
28060
28144
|
if (!item) return;
|