@deot/vc 1.0.1 → 1.0.2
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 +1 -2
- package/dist/index.d.ts +199 -49
- package/dist/index.iife.js +1239 -1110
- package/dist/index.js +1 -2
- package/dist/index.umd.cjs +1239 -1110
- package/package.json +4 -4
package/dist/index.iife.js
CHANGED
|
@@ -4964,48 +4964,32 @@ var Vc = (function (exports, vue) {
|
|
|
4964
4964
|
});
|
|
4965
4965
|
const MActionSheet = ActionSheet;
|
|
4966
4966
|
const props$1f = {
|
|
4967
|
-
|
|
4967
|
+
modelValue: {
|
|
4968
|
+
type: Boolean,
|
|
4969
|
+
default: true
|
|
4970
|
+
},
|
|
4971
|
+
type: {
|
|
4968
4972
|
type: String,
|
|
4969
|
-
default: "
|
|
4970
|
-
}
|
|
4971
|
-
|
|
4972
|
-
const COMPONENT_NAME$1v = "vc-alert";
|
|
4973
|
-
const Alert = /* @__PURE__ */ vue.defineComponent({
|
|
4974
|
-
name: COMPONENT_NAME$1v,
|
|
4975
|
-
props: props$1f,
|
|
4976
|
-
setup(props2, {
|
|
4977
|
-
slots
|
|
4978
|
-
}) {
|
|
4979
|
-
return () => {
|
|
4980
|
-
return vue.createVNode("div", {
|
|
4981
|
-
"class": "vc-alert"
|
|
4982
|
-
}, [slots?.default?.()]);
|
|
4983
|
-
};
|
|
4984
|
-
}
|
|
4985
|
-
});
|
|
4986
|
-
const MAlert = Alert;
|
|
4987
|
-
const props$1e = {
|
|
4988
|
-
tag: {
|
|
4973
|
+
default: "info"
|
|
4974
|
+
},
|
|
4975
|
+
title: {
|
|
4989
4976
|
type: String,
|
|
4990
|
-
default: "
|
|
4977
|
+
default: ""
|
|
4978
|
+
},
|
|
4979
|
+
desc: {
|
|
4980
|
+
type: String,
|
|
4981
|
+
default: ""
|
|
4982
|
+
},
|
|
4983
|
+
icon: {
|
|
4984
|
+
type: [String, Boolean],
|
|
4985
|
+
default: true
|
|
4986
|
+
},
|
|
4987
|
+
closable: {
|
|
4988
|
+
type: Boolean,
|
|
4989
|
+
default: false
|
|
4991
4990
|
}
|
|
4992
4991
|
};
|
|
4993
|
-
const
|
|
4994
|
-
const Artboard = /* @__PURE__ */ vue.defineComponent({
|
|
4995
|
-
name: COMPONENT_NAME$1u,
|
|
4996
|
-
props: props$1e,
|
|
4997
|
-
setup(props2, {
|
|
4998
|
-
slots
|
|
4999
|
-
}) {
|
|
5000
|
-
return () => {
|
|
5001
|
-
return vue.createVNode("div", {
|
|
5002
|
-
"class": "vc-artboard"
|
|
5003
|
-
}, [slots?.default?.()]);
|
|
5004
|
-
};
|
|
5005
|
-
}
|
|
5006
|
-
});
|
|
5007
|
-
const MArtboard = Artboard;
|
|
5008
|
-
const props$1d = {
|
|
4992
|
+
const props$1e = {
|
|
5009
4993
|
type: String,
|
|
5010
4994
|
inherit: {
|
|
5011
4995
|
type: Boolean,
|
|
@@ -5146,10 +5130,10 @@ var Vc = (function (exports, vue) {
|
|
|
5146
5130
|
}
|
|
5147
5131
|
}
|
|
5148
5132
|
const IconManager = new Manager();
|
|
5149
|
-
const COMPONENT_NAME$
|
|
5133
|
+
const COMPONENT_NAME$1v = "vc-icon";
|
|
5150
5134
|
const Icon = /* @__PURE__ */ vue.defineComponent({
|
|
5151
|
-
name: COMPONENT_NAME$
|
|
5152
|
-
props: props$
|
|
5135
|
+
name: COMPONENT_NAME$1v,
|
|
5136
|
+
props: props$1e,
|
|
5153
5137
|
setup(props2) {
|
|
5154
5138
|
const viewBox = vue.ref("0 0 1024 1024");
|
|
5155
5139
|
const path = vue.ref([]);
|
|
@@ -5181,184 +5165,764 @@ var Vc = (function (exports, vue) {
|
|
|
5181
5165
|
};
|
|
5182
5166
|
}
|
|
5183
5167
|
});
|
|
5184
|
-
const props$
|
|
5185
|
-
size: {
|
|
5186
|
-
type: Number,
|
|
5187
|
-
default: 28
|
|
5188
|
-
},
|
|
5189
|
-
foreground: {
|
|
5190
|
-
type: String,
|
|
5191
|
-
default: "#ccc"
|
|
5192
|
-
},
|
|
5193
|
-
background: {
|
|
5194
|
-
type: String,
|
|
5195
|
-
default: "var(--vc-color-primary)"
|
|
5196
|
-
},
|
|
5168
|
+
const props$1d = {
|
|
5197
5169
|
/**
|
|
5198
|
-
*
|
|
5170
|
+
* 进入/离开持续时间
|
|
5171
|
+
* {enter: 300, leave: 300}
|
|
5199
5172
|
*/
|
|
5200
|
-
|
|
5201
|
-
type:
|
|
5202
|
-
default:
|
|
5203
|
-
}
|
|
5204
|
-
};
|
|
5205
|
-
const COMPONENT_NAME$1s = "vc-spin";
|
|
5206
|
-
const Spin = /* @__PURE__ */ vue.defineComponent({
|
|
5207
|
-
name: COMPONENT_NAME$1s,
|
|
5208
|
-
props: props$1c,
|
|
5209
|
-
setup(props2, {
|
|
5210
|
-
slots
|
|
5211
|
-
}) {
|
|
5212
|
-
return () => {
|
|
5213
|
-
return vue.createVNode("div", {
|
|
5214
|
-
"class": "vc-spin"
|
|
5215
|
-
}, [vue.createVNode("span", {
|
|
5216
|
-
"style": {
|
|
5217
|
-
fontSize: `${props2.size}px`
|
|
5218
|
-
}
|
|
5219
|
-
}, [slots?.loading?.() || vue.createVNode("svg", {
|
|
5220
|
-
"xmlns": "http://www.w3.org/2000/svg",
|
|
5221
|
-
"version": "1.1",
|
|
5222
|
-
"viewBox": "0 0 32 32",
|
|
5223
|
-
"width": "100%",
|
|
5224
|
-
"height": "100%"
|
|
5225
|
-
}, [vue.createVNode("path", {
|
|
5226
|
-
"stroke": props2.foreground,
|
|
5227
|
-
"d": "M 16 2 A 14 14 0 1 0 30 15",
|
|
5228
|
-
"fill": "none",
|
|
5229
|
-
"stroke-width": "2",
|
|
5230
|
-
"stroke-linecap": "round"
|
|
5231
|
-
}, null), vue.createVNode("path", {
|
|
5232
|
-
"stroke": props2.background,
|
|
5233
|
-
"d": "M 16 2 A 14 14 0 0 1 30 15",
|
|
5234
|
-
"fill": "none",
|
|
5235
|
-
"stroke-width": "2",
|
|
5236
|
-
"stroke-linecap": "round"
|
|
5237
|
-
}, null)])]), slots?.default?.()]);
|
|
5238
|
-
};
|
|
5239
|
-
}
|
|
5240
|
-
});
|
|
5241
|
-
const props$1b = {
|
|
5242
|
-
wait: {
|
|
5243
|
-
type: Number,
|
|
5244
|
-
default: 250
|
|
5245
|
-
},
|
|
5246
|
-
tag: {
|
|
5247
|
-
type: [String, Object],
|
|
5248
|
-
default: "div"
|
|
5173
|
+
duration: {
|
|
5174
|
+
type: [Number, Object],
|
|
5175
|
+
default: 300
|
|
5249
5176
|
},
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
|
|
5177
|
+
/**
|
|
5178
|
+
* 进入/离开延迟时间
|
|
5179
|
+
*/
|
|
5180
|
+
delay: {
|
|
5181
|
+
type: [Number, Object],
|
|
5182
|
+
default: 0
|
|
5253
5183
|
},
|
|
5254
|
-
exclude: RegExp
|
|
5255
|
-
};
|
|
5256
|
-
const COMPONENT_NAME$1r = "vc-debounce";
|
|
5257
|
-
const Debounce = vue.defineComponent({
|
|
5258
|
-
name: COMPONENT_NAME$1r,
|
|
5259
|
-
props: props$1b,
|
|
5260
5184
|
/**
|
|
5261
|
-
*
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
|
|
5185
|
+
* `transition-group` component.
|
|
5186
|
+
*/
|
|
5187
|
+
group: Boolean,
|
|
5188
|
+
/**
|
|
5189
|
+
* `transition-group` tag, v3版本默认值无
|
|
5265
5190
|
*/
|
|
5266
|
-
inheritAttrs: false,
|
|
5267
|
-
setup(props2, { slots, attrs }) {
|
|
5268
|
-
const listener = vue.ref({});
|
|
5269
|
-
vue.watch(
|
|
5270
|
-
[() => props2.wait, () => props2.exclude, () => props2.include],
|
|
5271
|
-
() => {
|
|
5272
|
-
const { wait, exclude, include } = props2;
|
|
5273
|
-
const ons = Object.entries(attrs).reduce((pre, [key, callback]) => {
|
|
5274
|
-
/* istanbul ignore else -- @preserve */
|
|
5275
|
-
if ((!exclude || !exclude.test(key)) && (!include || include.test(key)) && typeof callback === "function") {
|
|
5276
|
-
pre[key] = debounce$1(callback, wait, {
|
|
5277
|
-
leading: true,
|
|
5278
|
-
trailing: false
|
|
5279
|
-
});
|
|
5280
|
-
}
|
|
5281
|
-
return pre;
|
|
5282
|
-
}, {});
|
|
5283
|
-
if (Object.keys(listener.value).length !== Object.keys(ons).length) {
|
|
5284
|
-
listener.value = ons;
|
|
5285
|
-
}
|
|
5286
|
-
},
|
|
5287
|
-
{
|
|
5288
|
-
immediate: true
|
|
5289
|
-
}
|
|
5290
|
-
);
|
|
5291
|
-
return () => {
|
|
5292
|
-
return vue.h(props2.tag, {
|
|
5293
|
-
...attrs,
|
|
5294
|
-
...listener.value
|
|
5295
|
-
}, slots.default?.());
|
|
5296
|
-
};
|
|
5297
|
-
}
|
|
5298
|
-
});
|
|
5299
|
-
const props$1a = {
|
|
5300
5191
|
tag: {
|
|
5301
5192
|
type: String,
|
|
5302
|
-
default:
|
|
5193
|
+
default: void 0
|
|
5303
5194
|
},
|
|
5304
|
-
|
|
5195
|
+
/**
|
|
5196
|
+
* 变换的初始位置, 可以用style代替, 更短~~
|
|
5197
|
+
*/
|
|
5198
|
+
origin: {
|
|
5305
5199
|
type: String,
|
|
5306
|
-
default: "
|
|
5200
|
+
default: ""
|
|
5307
5201
|
},
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5202
|
+
/**
|
|
5203
|
+
* 在转换期间应用的元素样式。这些样式应用于@beforeEnter和@beforeLeave钩子
|
|
5204
|
+
* inheritAttrs必须是false
|
|
5205
|
+
*/
|
|
5206
|
+
style: {
|
|
5207
|
+
type: Object,
|
|
5208
|
+
default: () => {
|
|
5209
|
+
return {
|
|
5210
|
+
animationFillMode: "both",
|
|
5211
|
+
animationTimingFunction: "ease-out"
|
|
5212
|
+
};
|
|
5213
|
+
}
|
|
5311
5214
|
},
|
|
5312
|
-
|
|
5313
|
-
type:
|
|
5314
|
-
default:
|
|
5215
|
+
prefix: {
|
|
5216
|
+
type: String,
|
|
5217
|
+
default: "vc-transition"
|
|
5315
5218
|
},
|
|
5316
|
-
|
|
5317
|
-
disabled: Boolean,
|
|
5318
|
-
circle: Boolean,
|
|
5319
|
-
round: Boolean,
|
|
5320
|
-
long: Boolean,
|
|
5321
|
-
htmlType: {
|
|
5219
|
+
mode: {
|
|
5322
5220
|
type: String,
|
|
5323
|
-
default: "
|
|
5221
|
+
default: "none"
|
|
5324
5222
|
}
|
|
5325
5223
|
};
|
|
5326
|
-
const
|
|
5327
|
-
const
|
|
5328
|
-
|
|
5329
|
-
|
|
5330
|
-
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
})
|
|
5334
|
-
|
|
5335
|
-
const
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
|
|
5345
|
-
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
|
|
5354
|
-
|
|
5355
|
-
|
|
5356
|
-
|
|
5357
|
-
|
|
5358
|
-
|
|
5359
|
-
|
|
5360
|
-
|
|
5361
|
-
|
|
5224
|
+
const trim = (str) => str.trim().replace(/\s+/g, " ");
|
|
5225
|
+
const useTransition = () => {
|
|
5226
|
+
const instance = vue.getCurrentInstance();
|
|
5227
|
+
const attrs = instance.attrs;
|
|
5228
|
+
const props2 = instance.props;
|
|
5229
|
+
const Wrapper = vue.computed(() => {
|
|
5230
|
+
return props2.group ? vue.TransitionGroup : vue.Transition;
|
|
5231
|
+
});
|
|
5232
|
+
const classes = vue.computed(() => {
|
|
5233
|
+
const modeClass = props2.mode !== "none" ? `is-${props2.mode.replace(/-/g, " is-")}` : "";
|
|
5234
|
+
return {
|
|
5235
|
+
enterActiveClass: trim(`${attrs.enterActiveClass || ""} ${props2.prefix} ${modeClass} is-in`),
|
|
5236
|
+
leaveActiveClass: trim(`${attrs.leaveActiveClass || ""} ${props2.prefix} ${modeClass} is-out`),
|
|
5237
|
+
moveClass: props2.group ? trim(`${attrs.moveClass || ""} ${props2.prefix} ${modeClass} is-move`) : void 0
|
|
5238
|
+
};
|
|
5239
|
+
});
|
|
5240
|
+
const clearStyles = (el2) => {
|
|
5241
|
+
Object.keys(props2.style).forEach((key) => {
|
|
5242
|
+
const v = props2.style[key];
|
|
5243
|
+
v && el2.style.removeProperty(
|
|
5244
|
+
key.replace(/([A-Z])/g, "-$1").toLowerCase()
|
|
5245
|
+
);
|
|
5246
|
+
});
|
|
5247
|
+
el2.style.removeProperty("animation-duration");
|
|
5248
|
+
el2.style.removeProperty("animation-delay");
|
|
5249
|
+
};
|
|
5250
|
+
const resetAbsolute = (el2) => {
|
|
5251
|
+
props2.group && (el2.style.position = "absolute");
|
|
5252
|
+
};
|
|
5253
|
+
const resetOrigin = (el2) => {
|
|
5254
|
+
props2.origin && (el2.style.transformOrigin = props2.origin);
|
|
5255
|
+
};
|
|
5256
|
+
const resetStyles = (el2) => {
|
|
5257
|
+
resetOrigin(el2);
|
|
5258
|
+
Object.keys(props2.style).forEach((key) => {
|
|
5259
|
+
const v = props2.style[key];
|
|
5260
|
+
v && (el2.style[key] = v);
|
|
5261
|
+
});
|
|
5262
|
+
};
|
|
5263
|
+
const handleBeforeEnter = (el2) => {
|
|
5264
|
+
const duration = props2.duration.enter || props2.duration;
|
|
5265
|
+
el2.style.animationDuration = `${duration}ms`;
|
|
5266
|
+
const delay = props2.delay.enter || props2.delay;
|
|
5267
|
+
el2.style.animationDelay = `${delay}ms`;
|
|
5268
|
+
resetStyles(el2);
|
|
5269
|
+
attrs.onBeforeEnter?.(el2);
|
|
5270
|
+
};
|
|
5271
|
+
const createNext = (callback, duration) => {
|
|
5272
|
+
let hasDone = false;
|
|
5273
|
+
return (immediate = true) => {
|
|
5274
|
+
if (hasDone) return;
|
|
5275
|
+
hasDone = true;
|
|
5276
|
+
const done = () => callback?.();
|
|
5277
|
+
immediate ? done() : setTimeout(done, duration);
|
|
5278
|
+
};
|
|
5279
|
+
};
|
|
5280
|
+
const handleEnter = async (el2, done) => {
|
|
5281
|
+
const duration = props2.duration.enter || props2.duration;
|
|
5282
|
+
const next = createNext(done, duration);
|
|
5283
|
+
try {
|
|
5284
|
+
await attrs.onEnter?.(el2, next);
|
|
5285
|
+
} finally {
|
|
5286
|
+
next(false);
|
|
5287
|
+
}
|
|
5288
|
+
};
|
|
5289
|
+
const handleAfterEnter = (el2) => {
|
|
5290
|
+
clearStyles(el2);
|
|
5291
|
+
attrs.onAfterEnter?.(el2);
|
|
5292
|
+
};
|
|
5293
|
+
const handleBeforeLeave = (el2) => {
|
|
5294
|
+
const duration = props2.duration.leave || props2.duration;
|
|
5295
|
+
el2.style.animationDuration = `${duration}ms`;
|
|
5296
|
+
const delay = props2.delay.leave || props2.delay;
|
|
5297
|
+
el2.style.animationDelay = `${delay}ms`;
|
|
5298
|
+
resetStyles(el2);
|
|
5299
|
+
attrs.onBeforeLeave?.(el2);
|
|
5300
|
+
};
|
|
5301
|
+
const handleLeave = async (el2, done) => {
|
|
5302
|
+
const duration = props2.duration.leave || props2.duration;
|
|
5303
|
+
const next = createNext(done, duration);
|
|
5304
|
+
try {
|
|
5305
|
+
resetAbsolute(el2);
|
|
5306
|
+
await attrs.onLeave?.(el2, next);
|
|
5307
|
+
} finally {
|
|
5308
|
+
next(props2.group ? true : false);
|
|
5309
|
+
}
|
|
5310
|
+
};
|
|
5311
|
+
const handleAfterLeave = (el2) => {
|
|
5312
|
+
clearStyles(el2);
|
|
5313
|
+
attrs.onAfterLeave?.(el2);
|
|
5314
|
+
};
|
|
5315
|
+
return {
|
|
5316
|
+
Wrapper,
|
|
5317
|
+
resetStyles,
|
|
5318
|
+
resetAbsolute,
|
|
5319
|
+
classes,
|
|
5320
|
+
createNext,
|
|
5321
|
+
listeners: {
|
|
5322
|
+
onBeforeEnter: handleBeforeEnter,
|
|
5323
|
+
onEnter: handleEnter,
|
|
5324
|
+
onAfterEnter: handleAfterEnter,
|
|
5325
|
+
onBeforeLeave: handleBeforeLeave,
|
|
5326
|
+
onLeave: handleLeave,
|
|
5327
|
+
onAfterLeave: handleAfterLeave
|
|
5328
|
+
}
|
|
5329
|
+
};
|
|
5330
|
+
};
|
|
5331
|
+
const COMPONENT_NAME$1u = "vc-transition";
|
|
5332
|
+
const Transition = vue.defineComponent({
|
|
5333
|
+
name: COMPONENT_NAME$1u,
|
|
5334
|
+
props: props$1d,
|
|
5335
|
+
// 当不声明emits的情况下,事件存在于attrs中
|
|
5336
|
+
inheritAttrs: false,
|
|
5337
|
+
setup(props2, { slots, attrs }) {
|
|
5338
|
+
const { Wrapper, listeners, classes } = useTransition();
|
|
5339
|
+
return () => {
|
|
5340
|
+
return vue.h(
|
|
5341
|
+
Wrapper.value,
|
|
5342
|
+
{
|
|
5343
|
+
...attrs,
|
|
5344
|
+
...listeners,
|
|
5345
|
+
...classes.value,
|
|
5346
|
+
tag: props2.tag
|
|
5347
|
+
},
|
|
5348
|
+
slots
|
|
5349
|
+
);
|
|
5350
|
+
};
|
|
5351
|
+
}
|
|
5352
|
+
});
|
|
5353
|
+
const COMPONENT_NAME$1t = "vc-transition-collapse";
|
|
5354
|
+
const TransitionCollapse = vue.defineComponent({
|
|
5355
|
+
name: COMPONENT_NAME$1t,
|
|
5356
|
+
props: props$1d,
|
|
5357
|
+
// 当不声明emits的情况下,事件存在于attrs中
|
|
5358
|
+
inheritAttrs: false,
|
|
5359
|
+
setup(props2, { slots, attrs: _attrs }) {
|
|
5360
|
+
const attrs = _attrs;
|
|
5361
|
+
const { Wrapper, resetStyles, resetAbsolute, createNext } = useTransition();
|
|
5362
|
+
const getTransitionStyle = (duration) => {
|
|
5363
|
+
const style = `
|
|
5364
|
+
${duration}ms height ease-in-out,
|
|
5365
|
+
${duration}ms padding-top ease-in-out,
|
|
5366
|
+
${duration}ms padding-bottom ease-in-out
|
|
5367
|
+
`;
|
|
5368
|
+
return style;
|
|
5369
|
+
};
|
|
5370
|
+
const handleBeforeEnter = (el2) => {
|
|
5371
|
+
const duration = props2.duration.enter || props2.duration;
|
|
5372
|
+
el2.style.transition = getTransitionStyle(duration);
|
|
5373
|
+
/* istanbul ignore next -- @preserve */
|
|
5374
|
+
if (!el2.dataset) {
|
|
5375
|
+
el2.dataset = {};
|
|
5376
|
+
}
|
|
5377
|
+
el2.dataset.oldPaddingTop = el2.style.paddingTop;
|
|
5378
|
+
el2.dataset.oldPaddingBottom = el2.style.paddingBottom;
|
|
5379
|
+
el2.style.height = "0px";
|
|
5380
|
+
el2.style.paddingTop = "0px";
|
|
5381
|
+
el2.style.paddingBottom = "0px";
|
|
5382
|
+
resetStyles(el2);
|
|
5383
|
+
attrs.onBeforeEnter?.(el2);
|
|
5384
|
+
};
|
|
5385
|
+
const handleEnter = async (el2, done) => {
|
|
5386
|
+
const duration = props2.duration.enter || props2.duration;
|
|
5387
|
+
const next = createNext(done, duration);
|
|
5388
|
+
try {
|
|
5389
|
+
el2.dataset.oldOverflow = el2.style.overflow;
|
|
5390
|
+
/* istanbul ignore next -- @preserve */
|
|
5391
|
+
if (el2.scrollHeight !== 0) {
|
|
5392
|
+
el2.style.height = el2.scrollHeight + "px";
|
|
5393
|
+
el2.style.paddingTop = el2.dataset.oldPaddingTop + "px";
|
|
5394
|
+
el2.style.paddingBottom = el2.dataset.oldPaddingBottom + "px";
|
|
5395
|
+
} else {
|
|
5396
|
+
el2.style.height = "";
|
|
5397
|
+
el2.style.paddingTop = el2.dataset.oldPaddingTop + "px";
|
|
5398
|
+
el2.style.paddingBottom = el2.dataset.oldPaddingBottom + "px";
|
|
5399
|
+
}
|
|
5400
|
+
el2.style.overflow = "hidden";
|
|
5401
|
+
attrs.onEnter?.(el2);
|
|
5402
|
+
} finally {
|
|
5403
|
+
next(false);
|
|
5404
|
+
}
|
|
5405
|
+
};
|
|
5406
|
+
const handleAfterEnter = (el2) => {
|
|
5407
|
+
el2.style.transition = "";
|
|
5408
|
+
el2.style.height = "";
|
|
5409
|
+
el2.style.overflow = el2.dataset.oldOverflow || "";
|
|
5410
|
+
attrs.onAfterEnter?.(el2);
|
|
5411
|
+
};
|
|
5412
|
+
const handleBeforeLeave = (el2) => {
|
|
5413
|
+
/* istanbul ignore next -- @preserve */
|
|
5414
|
+
if (!el2.dataset) {
|
|
5415
|
+
el2.dataset = {};
|
|
5416
|
+
}
|
|
5417
|
+
el2.dataset.oldPaddingTop = el2.style.paddingTop;
|
|
5418
|
+
el2.dataset.oldPaddingBottom = el2.style.paddingBottom;
|
|
5419
|
+
el2.dataset.oldOverflow = el2.style.overflow;
|
|
5420
|
+
el2.style.height = el2.scrollHeight + "px";
|
|
5421
|
+
el2.style.overflow = "hidden";
|
|
5422
|
+
resetStyles(el2);
|
|
5423
|
+
attrs.onBeforeLeave?.(el2);
|
|
5424
|
+
};
|
|
5425
|
+
const handleLeave = (el2, done) => {
|
|
5426
|
+
const duration = props2.duration.leave || props2.duration;
|
|
5427
|
+
const next = createNext(done, duration);
|
|
5428
|
+
try {
|
|
5429
|
+
const leaveDuration = props2.duration.leave || props2.duration;
|
|
5430
|
+
/* istanbul ignore next -- @preserve */
|
|
5431
|
+
if (el2.scrollHeight !== 0) {
|
|
5432
|
+
el2.style.transition = getTransitionStyle(leaveDuration);
|
|
5433
|
+
el2.style.height = "0px";
|
|
5434
|
+
el2.style.paddingTop = "0px";
|
|
5435
|
+
el2.style.paddingBottom = "0px";
|
|
5436
|
+
}
|
|
5437
|
+
resetAbsolute(el2);
|
|
5438
|
+
attrs.onLeave?.(el2);
|
|
5439
|
+
} finally {
|
|
5440
|
+
next(props2.group ? true : false);
|
|
5441
|
+
}
|
|
5442
|
+
};
|
|
5443
|
+
const handleAfterLeave = (el2) => {
|
|
5444
|
+
el2.style.transition = "";
|
|
5445
|
+
el2.style.height = "";
|
|
5446
|
+
el2.style.overflow = el2.dataset.oldOverflow || "";
|
|
5447
|
+
el2.style.paddingTop = el2.dataset.oldPaddingTop || "";
|
|
5448
|
+
el2.style.paddingBottom = el2.dataset.oldPaddingBottom || "";
|
|
5449
|
+
attrs.onAfterLeave?.(el2);
|
|
5450
|
+
};
|
|
5451
|
+
const listeners = {
|
|
5452
|
+
onBeforeEnter: handleBeforeEnter,
|
|
5453
|
+
onEnter: handleEnter,
|
|
5454
|
+
onAfterEnter: handleAfterEnter,
|
|
5455
|
+
onBeforeLeave: handleBeforeLeave,
|
|
5456
|
+
onLeave: handleLeave,
|
|
5457
|
+
onAfterLeave: handleAfterLeave
|
|
5458
|
+
};
|
|
5459
|
+
return () => {
|
|
5460
|
+
return vue.h(
|
|
5461
|
+
Wrapper.value,
|
|
5462
|
+
{
|
|
5463
|
+
...attrs,
|
|
5464
|
+
...listeners,
|
|
5465
|
+
tag: props2.tag,
|
|
5466
|
+
moveClass: props2.group ? `${attrs.moveClass || ""} vc-transition-collapse is-move` : void 0
|
|
5467
|
+
},
|
|
5468
|
+
slots
|
|
5469
|
+
);
|
|
5470
|
+
};
|
|
5471
|
+
}
|
|
5472
|
+
});
|
|
5473
|
+
const COMPONENT_NAME$1s = "vc-transition-fade";
|
|
5474
|
+
const TransitionFade = vue.defineComponent({
|
|
5475
|
+
name: COMPONENT_NAME$1s,
|
|
5476
|
+
props: {
|
|
5477
|
+
...props$1d,
|
|
5478
|
+
// inheritAttrs必须是false
|
|
5479
|
+
style: {
|
|
5480
|
+
type: Object,
|
|
5481
|
+
default: () => ({
|
|
5482
|
+
animationFillMode: "both",
|
|
5483
|
+
animationTimingFunction: void 0
|
|
5484
|
+
})
|
|
5485
|
+
},
|
|
5486
|
+
prefix: {
|
|
5487
|
+
type: String,
|
|
5488
|
+
default: "vc-transition-fade"
|
|
5489
|
+
}
|
|
5490
|
+
},
|
|
5491
|
+
// 当不声明emits的情况下,事件存在于attrs中
|
|
5492
|
+
inheritAttrs: false,
|
|
5493
|
+
setup(props2, { slots, attrs }) {
|
|
5494
|
+
const { Wrapper, listeners, classes } = useTransition();
|
|
5495
|
+
return () => {
|
|
5496
|
+
return vue.h(
|
|
5497
|
+
Wrapper.value,
|
|
5498
|
+
{
|
|
5499
|
+
...attrs,
|
|
5500
|
+
...listeners,
|
|
5501
|
+
...classes.value,
|
|
5502
|
+
tag: props2.tag
|
|
5503
|
+
},
|
|
5504
|
+
slots
|
|
5505
|
+
);
|
|
5506
|
+
};
|
|
5507
|
+
}
|
|
5508
|
+
});
|
|
5509
|
+
const COMPONENT_NAME$1r = "vc-transition-scale";
|
|
5510
|
+
const TransitionScale = vue.defineComponent({
|
|
5511
|
+
name: COMPONENT_NAME$1r,
|
|
5512
|
+
props: {
|
|
5513
|
+
...props$1d,
|
|
5514
|
+
mode: {
|
|
5515
|
+
type: String,
|
|
5516
|
+
default: "both",
|
|
5517
|
+
validator: (v) => /(part|both|y|x|none)/.test(v)
|
|
5518
|
+
},
|
|
5519
|
+
// inheritAttrs必须是false
|
|
5520
|
+
style: {
|
|
5521
|
+
type: Object,
|
|
5522
|
+
default: () => ({
|
|
5523
|
+
animationFillMode: "both",
|
|
5524
|
+
animationTimingFunction: void 0
|
|
5525
|
+
})
|
|
5526
|
+
},
|
|
5527
|
+
prefix: {
|
|
5528
|
+
type: String,
|
|
5529
|
+
default: "vc-transition-scale"
|
|
5530
|
+
}
|
|
5531
|
+
},
|
|
5532
|
+
// 当不声明emits的情况下,事件存在于attrs中
|
|
5533
|
+
inheritAttrs: false,
|
|
5534
|
+
setup(props2, { slots, attrs }) {
|
|
5535
|
+
const { Wrapper, listeners, classes } = useTransition();
|
|
5536
|
+
return () => {
|
|
5537
|
+
return vue.h(
|
|
5538
|
+
Wrapper.value,
|
|
5539
|
+
{
|
|
5540
|
+
...attrs,
|
|
5541
|
+
...listeners,
|
|
5542
|
+
...classes.value,
|
|
5543
|
+
tag: props2.tag
|
|
5544
|
+
},
|
|
5545
|
+
slots
|
|
5546
|
+
);
|
|
5547
|
+
};
|
|
5548
|
+
}
|
|
5549
|
+
});
|
|
5550
|
+
const COMPONENT_NAME$1q = "vc-transition-slide";
|
|
5551
|
+
const TransitionSlide = vue.defineComponent({
|
|
5552
|
+
name: COMPONENT_NAME$1q,
|
|
5553
|
+
props: {
|
|
5554
|
+
...props$1d,
|
|
5555
|
+
mode: {
|
|
5556
|
+
type: String,
|
|
5557
|
+
default: "left",
|
|
5558
|
+
validator: (v) => /^(left|right|down|up|none)(|-part)$/.test(v)
|
|
5559
|
+
},
|
|
5560
|
+
// inheritAttrs必须是false
|
|
5561
|
+
style: {
|
|
5562
|
+
type: Object,
|
|
5563
|
+
default: () => ({
|
|
5564
|
+
animationFillMode: "both",
|
|
5565
|
+
animationTimingFunction: void 0
|
|
5566
|
+
})
|
|
5567
|
+
},
|
|
5568
|
+
prefix: {
|
|
5569
|
+
type: String,
|
|
5570
|
+
default: "vc-transition-slide"
|
|
5571
|
+
}
|
|
5572
|
+
},
|
|
5573
|
+
// 当不声明emits的情况下,事件存在于attrs中
|
|
5574
|
+
inheritAttrs: false,
|
|
5575
|
+
setup(props2, { slots, attrs }) {
|
|
5576
|
+
const { Wrapper, listeners, classes } = useTransition();
|
|
5577
|
+
return () => {
|
|
5578
|
+
return vue.h(
|
|
5579
|
+
Wrapper.value,
|
|
5580
|
+
{
|
|
5581
|
+
...attrs,
|
|
5582
|
+
...listeners,
|
|
5583
|
+
...classes.value,
|
|
5584
|
+
tag: props2.tag
|
|
5585
|
+
},
|
|
5586
|
+
slots
|
|
5587
|
+
);
|
|
5588
|
+
};
|
|
5589
|
+
}
|
|
5590
|
+
});
|
|
5591
|
+
const COMPONENT_NAME$1p = "vc-transition-zoom";
|
|
5592
|
+
const TransitionZoom = vue.defineComponent({
|
|
5593
|
+
name: COMPONENT_NAME$1p,
|
|
5594
|
+
props: {
|
|
5595
|
+
...props$1d,
|
|
5596
|
+
mode: {
|
|
5597
|
+
type: String,
|
|
5598
|
+
default: "x",
|
|
5599
|
+
validator: (v) => /^(x|y|center|none)$/.test(v)
|
|
5600
|
+
},
|
|
5601
|
+
// inheritAttrs必须是false
|
|
5602
|
+
style: {
|
|
5603
|
+
type: Object,
|
|
5604
|
+
default: () => ({
|
|
5605
|
+
animationFillMode: "both",
|
|
5606
|
+
animationTimingFunction: void 0
|
|
5607
|
+
})
|
|
5608
|
+
},
|
|
5609
|
+
prefix: {
|
|
5610
|
+
type: String,
|
|
5611
|
+
default: "vc-transition-zoom"
|
|
5612
|
+
}
|
|
5613
|
+
},
|
|
5614
|
+
// 当不声明emits的情况下,事件存在于attrs中
|
|
5615
|
+
inheritAttrs: false,
|
|
5616
|
+
setup(props2, { slots, attrs }) {
|
|
5617
|
+
const { Wrapper, listeners, classes } = useTransition();
|
|
5618
|
+
return () => {
|
|
5619
|
+
return vue.h(
|
|
5620
|
+
Wrapper.value,
|
|
5621
|
+
{
|
|
5622
|
+
...attrs,
|
|
5623
|
+
...listeners,
|
|
5624
|
+
...classes.value,
|
|
5625
|
+
tag: props2.tag
|
|
5626
|
+
},
|
|
5627
|
+
slots
|
|
5628
|
+
);
|
|
5629
|
+
};
|
|
5630
|
+
}
|
|
5631
|
+
});
|
|
5632
|
+
const COMPONENT_NAME$1o = "vc-alert";
|
|
5633
|
+
const THEME_MAP = {
|
|
5634
|
+
info: ["#5495f6", "#91d5ff", "#e6f7ff"],
|
|
5635
|
+
success: ["#52c41a", "#b7eb8f", "#f6ffed"],
|
|
5636
|
+
error: ["#ed4014", "#ffb08f", "#fbe9e9"],
|
|
5637
|
+
warning: ["#ffbf00", "#ffe58f", "#fffbe6"]
|
|
5638
|
+
};
|
|
5639
|
+
const Alert = /* @__PURE__ */ vue.defineComponent({
|
|
5640
|
+
name: COMPONENT_NAME$1o,
|
|
5641
|
+
props: props$1f,
|
|
5642
|
+
setup(props2, {
|
|
5643
|
+
slots,
|
|
5644
|
+
emit
|
|
5645
|
+
}) {
|
|
5646
|
+
const isActive = vue.ref(false);
|
|
5647
|
+
const showIcon = vue.computed(() => props2.icon !== false);
|
|
5648
|
+
const containerStyle = vue.computed(() => {
|
|
5649
|
+
const [_, borderColor, backgroundColor] = THEME_MAP[props2.type];
|
|
5650
|
+
return {
|
|
5651
|
+
borderColor,
|
|
5652
|
+
backgroundColor
|
|
5653
|
+
};
|
|
5654
|
+
});
|
|
5655
|
+
const iconStyle = vue.computed(() => {
|
|
5656
|
+
const [color] = THEME_MAP[props2.type];
|
|
5657
|
+
return {
|
|
5658
|
+
color
|
|
5659
|
+
};
|
|
5660
|
+
});
|
|
5661
|
+
const titleStyle = vue.computed(() => {
|
|
5662
|
+
const [color] = THEME_MAP[props2.type];
|
|
5663
|
+
return props2.desc || slots.desc ? {
|
|
5664
|
+
marginBottom: "5px",
|
|
5665
|
+
fontSize: "14px",
|
|
5666
|
+
color
|
|
5667
|
+
} : {};
|
|
5668
|
+
});
|
|
5669
|
+
const descStyle = vue.computed(() => {
|
|
5670
|
+
const [color] = THEME_MAP[props2.type];
|
|
5671
|
+
return {
|
|
5672
|
+
color,
|
|
5673
|
+
opacity: ".7"
|
|
5674
|
+
};
|
|
5675
|
+
});
|
|
5676
|
+
const iconType = vue.computed(() => {
|
|
5677
|
+
return typeof props2.icon === "string" && props2.icon ? props2.icon : props2.type;
|
|
5678
|
+
});
|
|
5679
|
+
const handleClose = () => {
|
|
5680
|
+
isActive.value = false;
|
|
5681
|
+
emit("close");
|
|
5682
|
+
emit("update:modelValue", false);
|
|
5683
|
+
emit("visible-change", false);
|
|
5684
|
+
};
|
|
5685
|
+
vue.watch(() => props2.modelValue, (v) => {
|
|
5686
|
+
isActive.value = v;
|
|
5687
|
+
}, {
|
|
5688
|
+
immediate: true
|
|
5689
|
+
});
|
|
5690
|
+
return () => {
|
|
5691
|
+
return vue.createVNode(TransitionFade, null, {
|
|
5692
|
+
default: () => [isActive.value && vue.createVNode("div", {
|
|
5693
|
+
"class": [`is-${props2.type}`, {
|
|
5694
|
+
"has-icon": showIcon.value,
|
|
5695
|
+
"has-desc": props2.desc || slots.desc
|
|
5696
|
+
}, "vc-alert"],
|
|
5697
|
+
"style": containerStyle.value
|
|
5698
|
+
}, [showIcon.value && vue.createVNode(Icon, {
|
|
5699
|
+
"type": iconType.value,
|
|
5700
|
+
"style": iconStyle.value,
|
|
5701
|
+
"class": "vc-alert__icon"
|
|
5702
|
+
}, null), vue.createVNode("div", {
|
|
5703
|
+
"class": "vc-alert__content"
|
|
5704
|
+
}, [vue.createVNode("div", {
|
|
5705
|
+
"class": "vc-alert__message"
|
|
5706
|
+
}, [props2.title ? vue.createVNode("div", {
|
|
5707
|
+
"style": titleStyle.value,
|
|
5708
|
+
"innerHTML": props2.title
|
|
5709
|
+
}, null) : vue.createVNode("div", {
|
|
5710
|
+
"style": titleStyle.value
|
|
5711
|
+
}, [slots?.default?.()]), props2.desc ? vue.createVNode("div", {
|
|
5712
|
+
"style": descStyle.value,
|
|
5713
|
+
"innerHTML": props2.desc
|
|
5714
|
+
}, null) : slots.desc && vue.createVNode("div", {
|
|
5715
|
+
"style": descStyle.value
|
|
5716
|
+
}, [slots.desc?.()])]), props2.closable && vue.createVNode("div", {
|
|
5717
|
+
"class": "vc-alert__close",
|
|
5718
|
+
"onClick": handleClose
|
|
5719
|
+
}, [slots.close ? slots.close() : vue.createVNode(Icon, {
|
|
5720
|
+
"type": "close"
|
|
5721
|
+
}, null)])])])]
|
|
5722
|
+
});
|
|
5723
|
+
};
|
|
5724
|
+
}
|
|
5725
|
+
});
|
|
5726
|
+
const MAlert = Alert;
|
|
5727
|
+
const props$1c = {
|
|
5728
|
+
tag: {
|
|
5729
|
+
type: String,
|
|
5730
|
+
default: "div"
|
|
5731
|
+
}
|
|
5732
|
+
};
|
|
5733
|
+
const COMPONENT_NAME$1n = "vc-artboard";
|
|
5734
|
+
const Artboard = /* @__PURE__ */ vue.defineComponent({
|
|
5735
|
+
name: COMPONENT_NAME$1n,
|
|
5736
|
+
props: props$1c,
|
|
5737
|
+
setup(props2, {
|
|
5738
|
+
slots
|
|
5739
|
+
}) {
|
|
5740
|
+
return () => {
|
|
5741
|
+
return vue.createVNode("div", {
|
|
5742
|
+
"class": "vc-artboard"
|
|
5743
|
+
}, [slots?.default?.()]);
|
|
5744
|
+
};
|
|
5745
|
+
}
|
|
5746
|
+
});
|
|
5747
|
+
const MArtboard = Artboard;
|
|
5748
|
+
const props$1b = {
|
|
5749
|
+
size: {
|
|
5750
|
+
type: Number,
|
|
5751
|
+
default: 28
|
|
5752
|
+
},
|
|
5753
|
+
foreground: {
|
|
5754
|
+
type: String,
|
|
5755
|
+
default: "#ccc"
|
|
5756
|
+
},
|
|
5757
|
+
background: {
|
|
5758
|
+
type: String,
|
|
5759
|
+
default: "var(--vc-color-primary)"
|
|
5760
|
+
},
|
|
5761
|
+
/**
|
|
5762
|
+
* 待开发
|
|
5763
|
+
*/
|
|
5764
|
+
fixed: {
|
|
5765
|
+
type: Boolean,
|
|
5766
|
+
default: false
|
|
5767
|
+
}
|
|
5768
|
+
};
|
|
5769
|
+
const COMPONENT_NAME$1m = "vc-spin";
|
|
5770
|
+
const Spin = /* @__PURE__ */ vue.defineComponent({
|
|
5771
|
+
name: COMPONENT_NAME$1m,
|
|
5772
|
+
props: props$1b,
|
|
5773
|
+
setup(props2, {
|
|
5774
|
+
slots
|
|
5775
|
+
}) {
|
|
5776
|
+
return () => {
|
|
5777
|
+
return vue.createVNode("div", {
|
|
5778
|
+
"class": "vc-spin"
|
|
5779
|
+
}, [vue.createVNode("span", {
|
|
5780
|
+
"style": {
|
|
5781
|
+
fontSize: `${props2.size}px`
|
|
5782
|
+
}
|
|
5783
|
+
}, [slots?.loading?.() || vue.createVNode("svg", {
|
|
5784
|
+
"xmlns": "http://www.w3.org/2000/svg",
|
|
5785
|
+
"version": "1.1",
|
|
5786
|
+
"viewBox": "0 0 32 32",
|
|
5787
|
+
"width": "100%",
|
|
5788
|
+
"height": "100%"
|
|
5789
|
+
}, [vue.createVNode("path", {
|
|
5790
|
+
"stroke": props2.foreground,
|
|
5791
|
+
"d": "M 16 2 A 14 14 0 1 0 30 15",
|
|
5792
|
+
"fill": "none",
|
|
5793
|
+
"stroke-width": "2",
|
|
5794
|
+
"stroke-linecap": "round"
|
|
5795
|
+
}, null), vue.createVNode("path", {
|
|
5796
|
+
"stroke": props2.background,
|
|
5797
|
+
"d": "M 16 2 A 14 14 0 0 1 30 15",
|
|
5798
|
+
"fill": "none",
|
|
5799
|
+
"stroke-width": "2",
|
|
5800
|
+
"stroke-linecap": "round"
|
|
5801
|
+
}, null)])]), slots?.default?.()]);
|
|
5802
|
+
};
|
|
5803
|
+
}
|
|
5804
|
+
});
|
|
5805
|
+
const props$1a = {
|
|
5806
|
+
wait: {
|
|
5807
|
+
type: Number,
|
|
5808
|
+
default: 250
|
|
5809
|
+
},
|
|
5810
|
+
tag: {
|
|
5811
|
+
type: [String, Object],
|
|
5812
|
+
default: "div"
|
|
5813
|
+
},
|
|
5814
|
+
include: {
|
|
5815
|
+
type: RegExp,
|
|
5816
|
+
default: () => /^on([A-Z])/
|
|
5817
|
+
},
|
|
5818
|
+
exclude: RegExp
|
|
5819
|
+
};
|
|
5820
|
+
const COMPONENT_NAME$1l = "vc-debounce";
|
|
5821
|
+
const Debounce = vue.defineComponent({
|
|
5822
|
+
name: COMPONENT_NAME$1l,
|
|
5823
|
+
props: props$1a,
|
|
5824
|
+
/**
|
|
5825
|
+
* 不声明emits使得事件被透传放入attrs中, 这样可以让所有的事件透传
|
|
5826
|
+
* 如事件onClick
|
|
5827
|
+
* 当inheritAttrs为true时:因为emits为声明onClick会覆盖到`props.tag`上,使得我们重写的onClick无效
|
|
5828
|
+
* 当inheritAttrs为false时: 透传的onClick不会被重载,这样我们就可以重写onClick
|
|
5829
|
+
*/
|
|
5830
|
+
inheritAttrs: false,
|
|
5831
|
+
setup(props2, { slots, attrs }) {
|
|
5832
|
+
const listener = vue.ref({});
|
|
5833
|
+
vue.watch(
|
|
5834
|
+
[() => props2.wait, () => props2.exclude, () => props2.include],
|
|
5835
|
+
() => {
|
|
5836
|
+
const { wait, exclude, include } = props2;
|
|
5837
|
+
const ons = Object.entries(attrs).reduce((pre, [key, callback]) => {
|
|
5838
|
+
/* istanbul ignore else -- @preserve */
|
|
5839
|
+
if ((!exclude || !exclude.test(key)) && (!include || include.test(key)) && typeof callback === "function") {
|
|
5840
|
+
pre[key] = debounce$1(callback, wait, {
|
|
5841
|
+
leading: true,
|
|
5842
|
+
trailing: false
|
|
5843
|
+
});
|
|
5844
|
+
}
|
|
5845
|
+
return pre;
|
|
5846
|
+
}, {});
|
|
5847
|
+
if (Object.keys(listener.value).length !== Object.keys(ons).length) {
|
|
5848
|
+
listener.value = ons;
|
|
5849
|
+
}
|
|
5850
|
+
},
|
|
5851
|
+
{
|
|
5852
|
+
immediate: true
|
|
5853
|
+
}
|
|
5854
|
+
);
|
|
5855
|
+
return () => {
|
|
5856
|
+
return vue.h(props2.tag, {
|
|
5857
|
+
...attrs,
|
|
5858
|
+
...listener.value
|
|
5859
|
+
}, slots.default?.());
|
|
5860
|
+
};
|
|
5861
|
+
}
|
|
5862
|
+
});
|
|
5863
|
+
const props$19 = {
|
|
5864
|
+
tag: {
|
|
5865
|
+
type: String,
|
|
5866
|
+
default: "button"
|
|
5867
|
+
},
|
|
5868
|
+
type: {
|
|
5869
|
+
type: String,
|
|
5870
|
+
default: "default"
|
|
5871
|
+
},
|
|
5872
|
+
size: {
|
|
5873
|
+
type: String,
|
|
5874
|
+
default: "medium"
|
|
5875
|
+
},
|
|
5876
|
+
wait: {
|
|
5877
|
+
type: Number,
|
|
5878
|
+
default: 250
|
|
5879
|
+
},
|
|
5880
|
+
icon: String,
|
|
5881
|
+
disabled: Boolean,
|
|
5882
|
+
circle: Boolean,
|
|
5883
|
+
round: Boolean,
|
|
5884
|
+
long: Boolean,
|
|
5885
|
+
htmlType: {
|
|
5886
|
+
type: String,
|
|
5887
|
+
default: "button"
|
|
5888
|
+
}
|
|
5889
|
+
};
|
|
5890
|
+
const COMPONENT_NAME$1k = "vc-button";
|
|
5891
|
+
const Button = /* @__PURE__ */ vue.defineComponent({
|
|
5892
|
+
name: COMPONENT_NAME$1k,
|
|
5893
|
+
emits: ["click"],
|
|
5894
|
+
props: props$19,
|
|
5895
|
+
setup(props2, {
|
|
5896
|
+
slots
|
|
5897
|
+
}) {
|
|
5898
|
+
const vm = vue.getCurrentInstance();
|
|
5899
|
+
const hasSlot = vue.ref(true);
|
|
5900
|
+
const isLoading = vue.ref(false);
|
|
5901
|
+
const group = vue.inject("button-group", {
|
|
5902
|
+
size: "medium",
|
|
5903
|
+
vertical: false,
|
|
5904
|
+
circle: false
|
|
5905
|
+
});
|
|
5906
|
+
const classes = vue.computed(() => ({
|
|
5907
|
+
"is-circle": props2.circle || group.circle,
|
|
5908
|
+
"is-alone": !hasSlot.value,
|
|
5909
|
+
"is-round": props2.round,
|
|
5910
|
+
"is-long": props2.long,
|
|
5911
|
+
"is-disabled": props2.disabled,
|
|
5912
|
+
[`is-${props2.size}`]: true,
|
|
5913
|
+
[`is-${props2.type}`]: true
|
|
5914
|
+
}));
|
|
5915
|
+
const handleClick = (...args) => {
|
|
5916
|
+
const fn = vm.vnode.props?.["onClick"]?.(...args);
|
|
5917
|
+
if (fn && fn.then) {
|
|
5918
|
+
isLoading.value = true;
|
|
5919
|
+
fn.finally(() => {
|
|
5920
|
+
isLoading.value = false;
|
|
5921
|
+
});
|
|
5922
|
+
}
|
|
5923
|
+
};
|
|
5924
|
+
vue.onMounted(() => {
|
|
5925
|
+
hasSlot.value = slots.default !== void 0;
|
|
5362
5926
|
});
|
|
5363
5927
|
return () => {
|
|
5364
5928
|
return vue.createVNode(Debounce, {
|
|
@@ -5383,7 +5947,7 @@ var Vc = (function (exports, vue) {
|
|
|
5383
5947
|
};
|
|
5384
5948
|
}
|
|
5385
5949
|
});
|
|
5386
|
-
const props$
|
|
5950
|
+
const props$18 = {
|
|
5387
5951
|
vertical: {
|
|
5388
5952
|
type: Boolean,
|
|
5389
5953
|
default: false
|
|
@@ -5401,10 +5965,10 @@ var Vc = (function (exports, vue) {
|
|
|
5401
5965
|
default: false
|
|
5402
5966
|
}
|
|
5403
5967
|
};
|
|
5404
|
-
const COMPONENT_NAME$
|
|
5968
|
+
const COMPONENT_NAME$1j = "vc-button-group";
|
|
5405
5969
|
const ButtonGroup = /* @__PURE__ */ vue.defineComponent({
|
|
5406
|
-
name: COMPONENT_NAME$
|
|
5407
|
-
props: props$
|
|
5970
|
+
name: COMPONENT_NAME$1j,
|
|
5971
|
+
props: props$18,
|
|
5408
5972
|
setup(props2, {
|
|
5409
5973
|
slots
|
|
5410
5974
|
}) {
|
|
@@ -5426,16 +5990,16 @@ var Vc = (function (exports, vue) {
|
|
|
5426
5990
|
});
|
|
5427
5991
|
const MButton = Button;
|
|
5428
5992
|
const MButtonGroup = ButtonGroup;
|
|
5429
|
-
const props$
|
|
5993
|
+
const props$17 = {
|
|
5430
5994
|
tag: {
|
|
5431
5995
|
type: String,
|
|
5432
5996
|
default: "div"
|
|
5433
5997
|
}
|
|
5434
5998
|
};
|
|
5435
|
-
const COMPONENT_NAME$
|
|
5999
|
+
const COMPONENT_NAME$1i = "vc-calendar";
|
|
5436
6000
|
const Calendar = /* @__PURE__ */ vue.defineComponent({
|
|
5437
|
-
name: COMPONENT_NAME$
|
|
5438
|
-
props: props$
|
|
6001
|
+
name: COMPONENT_NAME$1i,
|
|
6002
|
+
props: props$17,
|
|
5439
6003
|
setup(props2, {
|
|
5440
6004
|
slots
|
|
5441
6005
|
}) {
|
|
@@ -5447,37 +6011,63 @@ var Vc = (function (exports, vue) {
|
|
|
5447
6011
|
}
|
|
5448
6012
|
});
|
|
5449
6013
|
const MCalendar = Calendar;
|
|
5450
|
-
const props$
|
|
5451
|
-
|
|
5452
|
-
type:
|
|
5453
|
-
default:
|
|
6014
|
+
const props$16 = {
|
|
6015
|
+
border: {
|
|
6016
|
+
type: Boolean,
|
|
6017
|
+
default: true
|
|
6018
|
+
},
|
|
6019
|
+
shadow: {
|
|
6020
|
+
type: Boolean,
|
|
6021
|
+
default: false
|
|
6022
|
+
},
|
|
6023
|
+
padding: {
|
|
6024
|
+
type: Number,
|
|
6025
|
+
default: 16
|
|
6026
|
+
},
|
|
6027
|
+
title: {
|
|
6028
|
+
type: String
|
|
6029
|
+
},
|
|
6030
|
+
icon: {
|
|
6031
|
+
type: String
|
|
5454
6032
|
}
|
|
5455
6033
|
};
|
|
5456
|
-
const COMPONENT_NAME$
|
|
6034
|
+
const COMPONENT_NAME$1h = "vc-card";
|
|
5457
6035
|
const Card = /* @__PURE__ */ vue.defineComponent({
|
|
5458
|
-
name: COMPONENT_NAME$
|
|
5459
|
-
props: props$
|
|
6036
|
+
name: COMPONENT_NAME$1h,
|
|
6037
|
+
props: props$16,
|
|
5460
6038
|
setup(props2, {
|
|
5461
6039
|
slots
|
|
5462
6040
|
}) {
|
|
5463
6041
|
return () => {
|
|
5464
6042
|
return vue.createVNode("div", {
|
|
5465
|
-
"class":
|
|
5466
|
-
|
|
6043
|
+
"class": [{
|
|
6044
|
+
"is-border": props2.border,
|
|
6045
|
+
"is-shadow": props2.shadow
|
|
6046
|
+
}, "vc-card"]
|
|
6047
|
+
}, [(props2.title || slots.title) && vue.createVNode("div", {
|
|
6048
|
+
"class": "vc-card__header"
|
|
6049
|
+
}, [slots.title ? slots.title?.() : props2.title && vue.createVNode("p", null, [props2.icon && vue.createVNode(Icon, {
|
|
6050
|
+
"type": props2.icon
|
|
6051
|
+
}, null), vue.createVNode("span", null, [props2.title])])]), slots.extra && vue.createVNode("div", {
|
|
6052
|
+
"class": "vc-card__extra"
|
|
6053
|
+
}, [slots.extra?.()]), vue.createVNode("div", {
|
|
6054
|
+
"style": `padding: ${props2.padding}px`,
|
|
6055
|
+
"class": "vc-card__body"
|
|
6056
|
+
}, [slots.default?.()])]);
|
|
5467
6057
|
};
|
|
5468
6058
|
}
|
|
5469
6059
|
});
|
|
5470
6060
|
const MCard = Card;
|
|
5471
|
-
const props$
|
|
6061
|
+
const props$15 = {
|
|
5472
6062
|
tag: {
|
|
5473
6063
|
type: String,
|
|
5474
6064
|
default: "div"
|
|
5475
6065
|
}
|
|
5476
6066
|
};
|
|
5477
|
-
const COMPONENT_NAME$
|
|
6067
|
+
const COMPONENT_NAME$1g = "vc-carousel";
|
|
5478
6068
|
const Carousel = /* @__PURE__ */ vue.defineComponent({
|
|
5479
|
-
name: COMPONENT_NAME$
|
|
5480
|
-
props: props$
|
|
6069
|
+
name: COMPONENT_NAME$1g,
|
|
6070
|
+
props: props$15,
|
|
5481
6071
|
setup(props2, {
|
|
5482
6072
|
slots
|
|
5483
6073
|
}) {
|
|
@@ -5489,16 +6079,16 @@ var Vc = (function (exports, vue) {
|
|
|
5489
6079
|
}
|
|
5490
6080
|
});
|
|
5491
6081
|
const MCarousel = Carousel;
|
|
5492
|
-
const props$
|
|
6082
|
+
const props$14 = {
|
|
5493
6083
|
tag: {
|
|
5494
6084
|
type: String,
|
|
5495
6085
|
default: "div"
|
|
5496
6086
|
}
|
|
5497
6087
|
};
|
|
5498
|
-
const COMPONENT_NAME$
|
|
6088
|
+
const COMPONENT_NAME$1f = "vc-cascader";
|
|
5499
6089
|
const Cascader = /* @__PURE__ */ vue.defineComponent({
|
|
5500
|
-
name: COMPONENT_NAME$
|
|
5501
|
-
props: props$
|
|
6090
|
+
name: COMPONENT_NAME$1f,
|
|
6091
|
+
props: props$14,
|
|
5502
6092
|
setup(props2, {
|
|
5503
6093
|
slots
|
|
5504
6094
|
}) {
|
|
@@ -5510,16 +6100,16 @@ var Vc = (function (exports, vue) {
|
|
|
5510
6100
|
}
|
|
5511
6101
|
});
|
|
5512
6102
|
const MCascader = Cascader;
|
|
5513
|
-
const props$
|
|
6103
|
+
const props$13 = {
|
|
5514
6104
|
tag: {
|
|
5515
6105
|
type: String,
|
|
5516
6106
|
default: "div"
|
|
5517
6107
|
}
|
|
5518
6108
|
};
|
|
5519
|
-
const COMPONENT_NAME$
|
|
6109
|
+
const COMPONENT_NAME$1e = "vc-chart";
|
|
5520
6110
|
const Chart = /* @__PURE__ */ vue.defineComponent({
|
|
5521
|
-
name: COMPONENT_NAME$
|
|
5522
|
-
props: props$
|
|
6111
|
+
name: COMPONENT_NAME$1e,
|
|
6112
|
+
props: props$13,
|
|
5523
6113
|
setup(props2, {
|
|
5524
6114
|
slots
|
|
5525
6115
|
}) {
|
|
@@ -5531,16 +6121,16 @@ var Vc = (function (exports, vue) {
|
|
|
5531
6121
|
}
|
|
5532
6122
|
});
|
|
5533
6123
|
const MChart = Chart;
|
|
5534
|
-
const props$
|
|
6124
|
+
const props$12 = {
|
|
5535
6125
|
tag: {
|
|
5536
6126
|
type: String,
|
|
5537
6127
|
default: "div"
|
|
5538
6128
|
}
|
|
5539
6129
|
};
|
|
5540
|
-
const COMPONENT_NAME$
|
|
6130
|
+
const COMPONENT_NAME$1d = "vc-checkbox";
|
|
5541
6131
|
const Checkbox = /* @__PURE__ */ vue.defineComponent({
|
|
5542
|
-
name: COMPONENT_NAME$
|
|
5543
|
-
props: props$
|
|
6132
|
+
name: COMPONENT_NAME$1d,
|
|
6133
|
+
props: props$12,
|
|
5544
6134
|
setup(props2, {
|
|
5545
6135
|
slots
|
|
5546
6136
|
}) {
|
|
@@ -5552,16 +6142,16 @@ var Vc = (function (exports, vue) {
|
|
|
5552
6142
|
}
|
|
5553
6143
|
});
|
|
5554
6144
|
const MCheckbox = Checkbox;
|
|
5555
|
-
const props$
|
|
6145
|
+
const props$11 = {
|
|
5556
6146
|
tag: {
|
|
5557
6147
|
type: String,
|
|
5558
6148
|
default: "div"
|
|
5559
6149
|
}
|
|
5560
6150
|
};
|
|
5561
|
-
const COMPONENT_NAME$
|
|
6151
|
+
const COMPONENT_NAME$1c = "vc-clipboard";
|
|
5562
6152
|
const Clipboard = /* @__PURE__ */ vue.defineComponent({
|
|
5563
|
-
name: COMPONENT_NAME$
|
|
5564
|
-
props: props$
|
|
6153
|
+
name: COMPONENT_NAME$1c,
|
|
6154
|
+
props: props$11,
|
|
5565
6155
|
setup(props2, {
|
|
5566
6156
|
slots
|
|
5567
6157
|
}) {
|
|
@@ -5573,16 +6163,16 @@ var Vc = (function (exports, vue) {
|
|
|
5573
6163
|
}
|
|
5574
6164
|
});
|
|
5575
6165
|
const MClipboard = Clipboard;
|
|
5576
|
-
const props$
|
|
6166
|
+
const props$10 = {
|
|
5577
6167
|
tag: {
|
|
5578
6168
|
type: String,
|
|
5579
6169
|
default: "div"
|
|
5580
6170
|
}
|
|
5581
6171
|
};
|
|
5582
|
-
const COMPONENT_NAME$
|
|
6172
|
+
const COMPONENT_NAME$1b = "vc-collapse";
|
|
5583
6173
|
const Collapse = /* @__PURE__ */ vue.defineComponent({
|
|
5584
|
-
name: COMPONENT_NAME$
|
|
5585
|
-
props: props$
|
|
6174
|
+
name: COMPONENT_NAME$1b,
|
|
6175
|
+
props: props$10,
|
|
5586
6176
|
setup(props2, {
|
|
5587
6177
|
slots
|
|
5588
6178
|
}) {
|
|
@@ -5594,16 +6184,16 @@ var Vc = (function (exports, vue) {
|
|
|
5594
6184
|
}
|
|
5595
6185
|
});
|
|
5596
6186
|
const MCollapse = Collapse;
|
|
5597
|
-
const props
|
|
6187
|
+
const props$$ = {
|
|
5598
6188
|
tag: {
|
|
5599
6189
|
type: String,
|
|
5600
6190
|
default: "div"
|
|
5601
6191
|
}
|
|
5602
6192
|
};
|
|
5603
|
-
const COMPONENT_NAME$
|
|
6193
|
+
const COMPONENT_NAME$1a = "vc-color-picker";
|
|
5604
6194
|
const ColorPicker = /* @__PURE__ */ vue.defineComponent({
|
|
5605
|
-
name: COMPONENT_NAME$
|
|
5606
|
-
props: props
|
|
6195
|
+
name: COMPONENT_NAME$1a,
|
|
6196
|
+
props: props$$,
|
|
5607
6197
|
setup(props2, {
|
|
5608
6198
|
slots
|
|
5609
6199
|
}) {
|
|
@@ -5615,16 +6205,16 @@ var Vc = (function (exports, vue) {
|
|
|
5615
6205
|
}
|
|
5616
6206
|
});
|
|
5617
6207
|
const MColorPicker = ColorPicker;
|
|
5618
|
-
const props
|
|
6208
|
+
const props$_ = {
|
|
5619
6209
|
tag: {
|
|
5620
6210
|
type: String,
|
|
5621
6211
|
default: "div"
|
|
5622
6212
|
}
|
|
5623
6213
|
};
|
|
5624
|
-
const COMPONENT_NAME$
|
|
6214
|
+
const COMPONENT_NAME$19 = "vc-countdown";
|
|
5625
6215
|
const Countdown = /* @__PURE__ */ vue.defineComponent({
|
|
5626
|
-
name: COMPONENT_NAME$
|
|
5627
|
-
props: props
|
|
6216
|
+
name: COMPONENT_NAME$19,
|
|
6217
|
+
props: props$_,
|
|
5628
6218
|
setup(props2, {
|
|
5629
6219
|
slots
|
|
5630
6220
|
}) {
|
|
@@ -5636,16 +6226,16 @@ var Vc = (function (exports, vue) {
|
|
|
5636
6226
|
}
|
|
5637
6227
|
});
|
|
5638
6228
|
const MCountdown = Countdown;
|
|
5639
|
-
const props$
|
|
6229
|
+
const props$Z = {
|
|
5640
6230
|
render: {
|
|
5641
6231
|
type: Function,
|
|
5642
6232
|
default: () => null
|
|
5643
6233
|
}
|
|
5644
6234
|
};
|
|
5645
|
-
const COMPONENT_NAME$
|
|
6235
|
+
const COMPONENT_NAME$18 = "vc-customer";
|
|
5646
6236
|
const Customer = vue.defineComponent({
|
|
5647
|
-
name: COMPONENT_NAME$
|
|
5648
|
-
props: props$
|
|
6237
|
+
name: COMPONENT_NAME$18,
|
|
6238
|
+
props: props$Z,
|
|
5649
6239
|
setup(props2, context) {
|
|
5650
6240
|
return () => vue.h(() => {
|
|
5651
6241
|
return props2.render(context.attrs, context);
|
|
@@ -5653,16 +6243,16 @@ var Vc = (function (exports, vue) {
|
|
|
5653
6243
|
}
|
|
5654
6244
|
});
|
|
5655
6245
|
const MCustomer = Customer;
|
|
5656
|
-
const props$
|
|
6246
|
+
const props$Y = {
|
|
5657
6247
|
tag: {
|
|
5658
6248
|
type: String,
|
|
5659
6249
|
default: "div"
|
|
5660
6250
|
}
|
|
5661
6251
|
};
|
|
5662
|
-
const COMPONENT_NAME$
|
|
6252
|
+
const COMPONENT_NAME$17 = "vc-date-picker";
|
|
5663
6253
|
const DatePicker = /* @__PURE__ */ vue.defineComponent({
|
|
5664
|
-
name: COMPONENT_NAME$
|
|
5665
|
-
props: props$
|
|
6254
|
+
name: COMPONENT_NAME$17,
|
|
6255
|
+
props: props$Y,
|
|
5666
6256
|
setup(props2, {
|
|
5667
6257
|
slots
|
|
5668
6258
|
}) {
|
|
@@ -5674,16 +6264,16 @@ var Vc = (function (exports, vue) {
|
|
|
5674
6264
|
}
|
|
5675
6265
|
});
|
|
5676
6266
|
const MDatePicker = DatePicker;
|
|
5677
|
-
const props$
|
|
6267
|
+
const props$X = {
|
|
5678
6268
|
tag: {
|
|
5679
6269
|
type: String,
|
|
5680
6270
|
default: "div"
|
|
5681
6271
|
}
|
|
5682
6272
|
};
|
|
5683
|
-
const COMPONENT_NAME$
|
|
6273
|
+
const COMPONENT_NAME$16 = "vc-divider";
|
|
5684
6274
|
const Divider = /* @__PURE__ */ vue.defineComponent({
|
|
5685
|
-
name: COMPONENT_NAME$
|
|
5686
|
-
props: props$
|
|
6275
|
+
name: COMPONENT_NAME$16,
|
|
6276
|
+
props: props$X,
|
|
5687
6277
|
setup(props2, {
|
|
5688
6278
|
slots
|
|
5689
6279
|
}) {
|
|
@@ -5695,16 +6285,16 @@ var Vc = (function (exports, vue) {
|
|
|
5695
6285
|
}
|
|
5696
6286
|
});
|
|
5697
6287
|
const MDivider = Divider;
|
|
5698
|
-
const props$
|
|
6288
|
+
const props$W = {
|
|
5699
6289
|
tag: {
|
|
5700
6290
|
type: String,
|
|
5701
6291
|
default: "div"
|
|
5702
6292
|
}
|
|
5703
6293
|
};
|
|
5704
|
-
const COMPONENT_NAME$
|
|
6294
|
+
const COMPONENT_NAME$15 = "vc-drawer";
|
|
5705
6295
|
const Drawer = /* @__PURE__ */ vue.defineComponent({
|
|
5706
|
-
name: COMPONENT_NAME$
|
|
5707
|
-
props: props$
|
|
6296
|
+
name: COMPONENT_NAME$15,
|
|
6297
|
+
props: props$W,
|
|
5708
6298
|
setup(props2, {
|
|
5709
6299
|
slots
|
|
5710
6300
|
}) {
|
|
@@ -5716,16 +6306,16 @@ var Vc = (function (exports, vue) {
|
|
|
5716
6306
|
}
|
|
5717
6307
|
});
|
|
5718
6308
|
const MDrawer = Drawer;
|
|
5719
|
-
const props$
|
|
6309
|
+
const props$V = {
|
|
5720
6310
|
tag: {
|
|
5721
6311
|
type: String,
|
|
5722
6312
|
default: "div"
|
|
5723
6313
|
}
|
|
5724
6314
|
};
|
|
5725
|
-
const COMPONENT_NAME$
|
|
6315
|
+
const COMPONENT_NAME$14 = "vc-dropdown";
|
|
5726
6316
|
const Dropdown = /* @__PURE__ */ vue.defineComponent({
|
|
5727
|
-
name: COMPONENT_NAME$
|
|
5728
|
-
props: props$
|
|
6317
|
+
name: COMPONENT_NAME$14,
|
|
6318
|
+
props: props$V,
|
|
5729
6319
|
setup(props2, {
|
|
5730
6320
|
slots
|
|
5731
6321
|
}) {
|
|
@@ -5737,16 +6327,16 @@ var Vc = (function (exports, vue) {
|
|
|
5737
6327
|
}
|
|
5738
6328
|
});
|
|
5739
6329
|
const MDropdown = Dropdown;
|
|
5740
|
-
const props$
|
|
6330
|
+
const props$U = {
|
|
5741
6331
|
tag: {
|
|
5742
6332
|
type: String,
|
|
5743
6333
|
default: "div"
|
|
5744
6334
|
}
|
|
5745
6335
|
};
|
|
5746
|
-
const COMPONENT_NAME$
|
|
6336
|
+
const COMPONENT_NAME$13 = "vc-editor";
|
|
5747
6337
|
const Editor = /* @__PURE__ */ vue.defineComponent({
|
|
5748
|
-
name: COMPONENT_NAME$
|
|
5749
|
-
props: props$
|
|
6338
|
+
name: COMPONENT_NAME$13,
|
|
6339
|
+
props: props$U,
|
|
5750
6340
|
setup(props2, {
|
|
5751
6341
|
slots
|
|
5752
6342
|
}) {
|
|
@@ -5758,16 +6348,16 @@ var Vc = (function (exports, vue) {
|
|
|
5758
6348
|
}
|
|
5759
6349
|
});
|
|
5760
6350
|
const MEditor = Editor;
|
|
5761
|
-
const props$
|
|
6351
|
+
const props$T = {
|
|
5762
6352
|
tag: {
|
|
5763
6353
|
type: String,
|
|
5764
6354
|
default: "div"
|
|
5765
6355
|
}
|
|
5766
6356
|
};
|
|
5767
|
-
const COMPONENT_NAME$
|
|
6357
|
+
const COMPONENT_NAME$12 = "vc-expand";
|
|
5768
6358
|
const Expand = /* @__PURE__ */ vue.defineComponent({
|
|
5769
|
-
name: COMPONENT_NAME$
|
|
5770
|
-
props: props$
|
|
6359
|
+
name: COMPONENT_NAME$12,
|
|
6360
|
+
props: props$T,
|
|
5771
6361
|
setup(props2, {
|
|
5772
6362
|
slots
|
|
5773
6363
|
}) {
|
|
@@ -5779,7 +6369,7 @@ var Vc = (function (exports, vue) {
|
|
|
5779
6369
|
}
|
|
5780
6370
|
});
|
|
5781
6371
|
const MExpand = Expand;
|
|
5782
|
-
const props$
|
|
6372
|
+
const props$S = {
|
|
5783
6373
|
tag: {
|
|
5784
6374
|
type: String,
|
|
5785
6375
|
default: "form"
|
|
@@ -5805,885 +6395,421 @@ var Vc = (function (exports, vue) {
|
|
|
5805
6395
|
type: String,
|
|
5806
6396
|
default: "right"
|
|
5807
6397
|
},
|
|
5808
|
-
autocomplete: {
|
|
5809
|
-
type: String,
|
|
5810
|
-
default: "off"
|
|
5811
|
-
},
|
|
5812
|
-
styleless: {
|
|
5813
|
-
type: Boolean,
|
|
5814
|
-
default: false
|
|
5815
|
-
}
|
|
5816
|
-
};
|
|
5817
|
-
const useForm = (expose, options = {}) => {
|
|
5818
|
-
const instance = vue.getCurrentInstance();
|
|
5819
|
-
const props2 = instance.props;
|
|
5820
|
-
const fields = [];
|
|
5821
|
-
vue.provide("form", {
|
|
5822
|
-
props: props2,
|
|
5823
|
-
add: (field) => {
|
|
5824
|
-
field && fields.push(field);
|
|
5825
|
-
},
|
|
5826
|
-
remove: (field) => {
|
|
5827
|
-
field && fields.splice(fields.indexOf(field), 1);
|
|
5828
|
-
}
|
|
5829
|
-
});
|
|
5830
|
-
const filterFields = (fields$) => {
|
|
5831
|
-
return !fields$ ? fields : fields.filter((item) => fields$.includes(item.props.prop));
|
|
5832
|
-
};
|
|
5833
|
-
const getField = (prop) => {
|
|
5834
|
-
const field = fields.find((item) => item.props.prop === prop);
|
|
5835
|
-
if (!field) throw new VcError("form", "请选择有用的prop值");
|
|
5836
|
-
return field;
|
|
5837
|
-
};
|
|
5838
|
-
const showToast = (msg) => {
|
|
5839
|
-
props2.showMessage && options.throwToast?.(msg);
|
|
5840
|
-
};
|
|
5841
|
-
const sortErrors = async (errors) => {
|
|
5842
|
-
const positions = await Promise.all(fields.map((item) => item.exposed.getPosition()));
|
|
5843
|
-
try {
|
|
5844
|
-
return [...errors].toSorted((a, b) => {
|
|
5845
|
-
const aIndex = fields.findIndex((i) => i.props.prop === a.prop);
|
|
5846
|
-
const bIndex = fields.findIndex((i) => i.props.prop === b.prop);
|
|
5847
|
-
const aPosition = positions[aIndex];
|
|
5848
|
-
const bPosition = positions[bIndex];
|
|
5849
|
-
if (aPosition.top != bPosition.top) return aPosition.top - bPosition.top;
|
|
5850
|
-
return aPosition.left - bPosition.left;
|
|
5851
|
-
});
|
|
5852
|
-
} catch (e) {
|
|
5853
|
-
return errors;
|
|
5854
|
-
}
|
|
5855
|
-
};
|
|
5856
|
-
const scrollIntoView = (prop) => {
|
|
5857
|
-
const field = getField(prop);
|
|
5858
|
-
field.vnode?.el?.scrollIntoView?.({
|
|
5859
|
-
behavior: "smooth",
|
|
5860
|
-
block: "center"
|
|
5861
|
-
});
|
|
5862
|
-
};
|
|
5863
|
-
const reset = (options$ = {}) => {
|
|
5864
|
-
const { fields: fields$, original = {} } = options$;
|
|
5865
|
-
filterFields(fields$).forEach((field) => {
|
|
5866
|
-
let v;
|
|
5867
|
-
try {
|
|
5868
|
-
v = getPropByPath(original, field.props.prop).v;
|
|
5869
|
-
} catch (e) {
|
|
5870
|
-
}
|
|
5871
|
-
field.exposed.reset(v);
|
|
5872
|
-
});
|
|
5873
|
-
};
|
|
5874
|
-
const validate = async (options$ = {}) => {
|
|
5875
|
-
const { scroll = true, fields: fields$ } = options$;
|
|
5876
|
-
if (!fields.length) {
|
|
5877
|
-
return;
|
|
5878
|
-
}
|
|
5879
|
-
const results = await Promise.allSettled(
|
|
5880
|
-
filterFields(fields$).map((item) => item.exposed.validate(""))
|
|
5881
|
-
);
|
|
5882
|
-
const originErrors = results.filter((i) => i.status === "rejected").map((i) => i.reason);
|
|
5883
|
-
if (!originErrors.length) return;
|
|
5884
|
-
const errors = await sortErrors(originErrors);
|
|
5885
|
-
showToast(errors[0].msg || errors[0].message);
|
|
5886
|
-
scroll && scrollIntoView(errors[0].prop);
|
|
5887
|
-
throw errors;
|
|
5888
|
-
};
|
|
5889
|
-
const validateField = async (prop, options$ = {}) => {
|
|
5890
|
-
try {
|
|
5891
|
-
await validate({
|
|
5892
|
-
...options$,
|
|
5893
|
-
fields: [prop]
|
|
5894
|
-
});
|
|
5895
|
-
} catch (e) {
|
|
5896
|
-
throw e[0];
|
|
5897
|
-
}
|
|
5898
|
-
};
|
|
5899
|
-
expose({
|
|
5900
|
-
reset,
|
|
5901
|
-
validate,
|
|
5902
|
-
// 单个操作
|
|
5903
|
-
getField,
|
|
5904
|
-
validateField
|
|
5905
|
-
});
|
|
5906
|
-
};
|
|
5907
|
-
const COMPONENT_NAME$17 = "vc-form";
|
|
5908
|
-
const Form = vue.defineComponent({
|
|
5909
|
-
name: COMPONENT_NAME$17,
|
|
5910
|
-
props: props$T,
|
|
5911
|
-
setup(props2, { slots, expose }) {
|
|
5912
|
-
useForm(expose);
|
|
5913
|
-
return () => {
|
|
5914
|
-
return vue.h(
|
|
5915
|
-
props2.tag,
|
|
5916
|
-
{
|
|
5917
|
-
class: "vc-form",
|
|
5918
|
-
autocomplete: props2.autocomplete
|
|
5919
|
-
},
|
|
5920
|
-
slots
|
|
5921
|
-
);
|
|
5922
|
-
};
|
|
5923
|
-
}
|
|
5924
|
-
});
|
|
5925
|
-
const props$S = {
|
|
5926
|
-
label: {
|
|
5927
|
-
type: String,
|
|
5928
|
-
default: ""
|
|
5929
|
-
},
|
|
5930
|
-
labelWidth: {
|
|
5931
|
-
type: Number
|
|
5932
|
-
},
|
|
5933
|
-
prop: {
|
|
5934
|
-
type: String
|
|
5935
|
-
},
|
|
5936
|
-
required: {
|
|
5937
|
-
type: [Boolean, String],
|
|
5938
|
-
default: false
|
|
5939
|
-
},
|
|
5940
|
-
error: {
|
|
5941
|
-
type: String
|
|
5942
|
-
},
|
|
5943
|
-
rules: {
|
|
5944
|
-
type: [Array, Object]
|
|
5945
|
-
},
|
|
5946
|
-
resetByRulesChanged: {
|
|
5947
|
-
type: Boolean,
|
|
5948
|
-
default: false
|
|
5949
|
-
},
|
|
5950
|
-
showMessage: {
|
|
5951
|
-
type: Boolean,
|
|
5952
|
-
default: true
|
|
5953
|
-
},
|
|
5954
|
-
labelFor: {
|
|
5955
|
-
type: String
|
|
5956
|
-
},
|
|
5957
|
-
styleless: {
|
|
5958
|
-
type: Boolean,
|
|
5959
|
-
default: false
|
|
5960
|
-
},
|
|
5961
|
-
labelPosition: {
|
|
5962
|
-
type: String,
|
|
5963
|
-
default: "right"
|
|
5964
|
-
},
|
|
5965
|
-
contentStyle: String
|
|
5966
|
-
};
|
|
5967
|
-
const filterEmpty = (val) => {
|
|
5968
|
-
if (val instanceof Array) {
|
|
5969
|
-
val = val.filter((i) => i !== "");
|
|
6398
|
+
autocomplete: {
|
|
6399
|
+
type: String,
|
|
6400
|
+
default: "off"
|
|
6401
|
+
},
|
|
6402
|
+
styleless: {
|
|
6403
|
+
type: Boolean,
|
|
6404
|
+
default: false
|
|
5970
6405
|
}
|
|
5971
|
-
return val;
|
|
5972
|
-
};
|
|
5973
|
-
const toRules = (rules) => {
|
|
5974
|
-
return rules instanceof Array ? rules : rules ? [rules] : [];
|
|
5975
6406
|
};
|
|
5976
|
-
const
|
|
5977
|
-
const form = vue.inject("form");
|
|
6407
|
+
const useForm = (expose, options = {}) => {
|
|
5978
6408
|
const instance = vue.getCurrentInstance();
|
|
5979
6409
|
const props2 = instance.props;
|
|
5980
|
-
const
|
|
5981
|
-
|
|
5982
|
-
|
|
5983
|
-
|
|
5984
|
-
|
|
5985
|
-
|
|
5986
|
-
|
|
5987
|
-
|
|
5988
|
-
let initialValue;
|
|
5989
|
-
const currentRules = vue.computed(() => {
|
|
5990
|
-
const formRules = form.props.rules;
|
|
5991
|
-
const formItemBindRules = toRules(props2.rules);
|
|
5992
|
-
let formItemRules = formItemBindRules;
|
|
5993
|
-
if (!formItemRules.length && formRules && props2.prop) {
|
|
5994
|
-
try {
|
|
5995
|
-
const key = props2.prop.replace(/\.[0-9]+\./g, ".");
|
|
5996
|
-
const { v } = getPropByPath(formRules, key);
|
|
5997
|
-
formItemRules = toRules(v);
|
|
5998
|
-
} catch {
|
|
5999
|
-
const rules = formRules[props2.prop];
|
|
6000
|
-
formItemRules = toRules(rules);
|
|
6001
|
-
}
|
|
6002
|
-
}
|
|
6003
|
-
return formItemRules;
|
|
6004
|
-
});
|
|
6005
|
-
const isRequired = vue.computed(() => {
|
|
6006
|
-
if (!currentRules.value.length) {
|
|
6007
|
-
return !!props2.required;
|
|
6008
|
-
}
|
|
6009
|
-
let required = false;
|
|
6010
|
-
for (let i = 0; i < currentRules.value.length; i++) {
|
|
6011
|
-
const rule = currentRules.value[i];
|
|
6012
|
-
required = !!rule.required;
|
|
6013
|
-
if (required) break;
|
|
6014
|
-
}
|
|
6015
|
-
return required;
|
|
6016
|
-
});
|
|
6017
|
-
const labelPosition = vue.computed(() => {
|
|
6018
|
-
return props2.labelPosition || form.props.labelPosition;
|
|
6019
|
-
});
|
|
6020
|
-
const classes = vue.computed(() => {
|
|
6021
|
-
return {
|
|
6022
|
-
"is-require": isRequired.value,
|
|
6023
|
-
"is-error": validateState.value === "error",
|
|
6024
|
-
"is-validating": validateState.value === "validating",
|
|
6025
|
-
"is-inline": form.props.inline,
|
|
6026
|
-
"is-nest": isNest.value,
|
|
6027
|
-
[`is-${labelPosition.value}`]: true
|
|
6028
|
-
};
|
|
6029
|
-
});
|
|
6030
|
-
const isNest = vue.computed(() => {
|
|
6031
|
-
return !!formItem.change;
|
|
6032
|
-
});
|
|
6033
|
-
const isNestLast = vue.ref(false);
|
|
6034
|
-
const hasLabel = vue.computed(() => {
|
|
6035
|
-
return !!props2.label || slots.label;
|
|
6036
|
-
});
|
|
6037
|
-
const labelStyle = vue.computed(() => {
|
|
6038
|
-
const labelWidth = props2.labelWidth === 0 || props2.labelWidth ? props2.labelWidth : isNest.value ? 0 : form.props.labelWidth;
|
|
6039
|
-
return {
|
|
6040
|
-
width: labelPosition.value !== "top" && labelWidth && labelWidth > 0 ? `${labelWidth}px` : "auto",
|
|
6041
|
-
textAlign: labelPosition.value === "top" ? "left" : labelPosition.value
|
|
6042
|
-
};
|
|
6043
|
-
});
|
|
6044
|
-
const contentStyle = vue.computed(() => {
|
|
6045
|
-
const labelWidth = props2.labelWidth === 0 || props2.labelWidth ? props2.labelWidth : form.props.labelWidth;
|
|
6046
|
-
return [
|
|
6047
|
-
{
|
|
6048
|
-
marginLeft: !hasLabel.value && isNest.value ? 0 : labelWidth && labelWidth > 0 ? `${labelWidth}px` : "unset",
|
|
6049
|
-
marginBottom: isNest.value && !isNestLast.value ? `20px` : 0
|
|
6050
|
-
},
|
|
6051
|
-
props2.contentStyle
|
|
6052
|
-
];
|
|
6053
|
-
});
|
|
6054
|
-
const isStyleless = vue.computed(() => {
|
|
6055
|
-
return props2.styleless || form.props.styleless;
|
|
6056
|
-
});
|
|
6057
|
-
const fieldValue = vue.computed(() => {
|
|
6058
|
-
const model = form.props.model;
|
|
6059
|
-
if (!model || !props2.prop) {
|
|
6060
|
-
return;
|
|
6061
|
-
}
|
|
6062
|
-
let path = props2.prop;
|
|
6063
|
-
if (path.includes(":")) {
|
|
6064
|
-
path = path.replace(/:/, ".");
|
|
6410
|
+
const fields = [];
|
|
6411
|
+
vue.provide("form", {
|
|
6412
|
+
props: props2,
|
|
6413
|
+
add: (field) => {
|
|
6414
|
+
field && fields.push(field);
|
|
6415
|
+
},
|
|
6416
|
+
remove: (field) => {
|
|
6417
|
+
field && fields.splice(fields.indexOf(field), 1);
|
|
6065
6418
|
}
|
|
6066
|
-
return getPropByPath(model, path).v;
|
|
6067
|
-
});
|
|
6068
|
-
const showError = vue.computed(() => {
|
|
6069
|
-
return validateState.value === "error" && props2.showMessage && form.props.showMessage;
|
|
6070
6419
|
});
|
|
6071
|
-
|
|
6072
|
-
() =>
|
|
6073
|
-
(v) => {
|
|
6074
|
-
validateMessage.value = v || "";
|
|
6075
|
-
validateState.value = v === "" ? "" : "error";
|
|
6076
|
-
}
|
|
6077
|
-
);
|
|
6078
|
-
const reset = (v) => {
|
|
6079
|
-
validateState.value = "";
|
|
6080
|
-
validateMessage.value = "";
|
|
6081
|
-
const model = form.props.model;
|
|
6082
|
-
if (!props2.prop) return;
|
|
6083
|
-
const { o, k } = getPropByPath(model, props2.prop);
|
|
6084
|
-
if (!k) return;
|
|
6085
|
-
validateDisabled = true;
|
|
6086
|
-
o[k] = v !== null && v !== void 0 ? v : Array.isArray(fieldValue.value) ? [].concat(initialValue) : initialValue;
|
|
6087
|
-
};
|
|
6088
|
-
const validate = async (trigger) => {
|
|
6089
|
-
if (!props2.prop) return;
|
|
6090
|
-
let rules = currentRules.value.filter((rule) => !rule.trigger || rule.trigger.includes(trigger));
|
|
6091
|
-
if (!rules.length) {
|
|
6092
|
-
if (!props2.required) {
|
|
6093
|
-
return;
|
|
6094
|
-
} else {
|
|
6095
|
-
rules = [{
|
|
6096
|
-
required: true,
|
|
6097
|
-
message: typeof props2.required === "string" ? props2.required : void 0
|
|
6098
|
-
}];
|
|
6099
|
-
}
|
|
6100
|
-
}
|
|
6101
|
-
validateState.value = "validating";
|
|
6102
|
-
const descriptor = {};
|
|
6103
|
-
descriptor[props2.prop] = rules;
|
|
6104
|
-
const validator = new Validator(descriptor);
|
|
6105
|
-
const model = {};
|
|
6106
|
-
model[props2.prop] = filterEmpty(fieldValue.value);
|
|
6107
|
-
try {
|
|
6108
|
-
await validator.validate(model, { first: false });
|
|
6109
|
-
validateState.value = "success";
|
|
6110
|
-
validateMessage.value = "";
|
|
6111
|
-
} catch (errors) {
|
|
6112
|
-
validateState.value = "error";
|
|
6113
|
-
validateMessage.value = errors[0].message;
|
|
6114
|
-
throw {
|
|
6115
|
-
prop: props2.prop,
|
|
6116
|
-
message: validateMessage.value
|
|
6117
|
-
};
|
|
6118
|
-
}
|
|
6119
|
-
validateDisabled = false;
|
|
6420
|
+
const filterFields = (fields$) => {
|
|
6421
|
+
return !fields$ ? fields : fields.filter((item) => fields$.includes(item.props.prop));
|
|
6120
6422
|
};
|
|
6121
|
-
const
|
|
6122
|
-
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
}
|
|
6126
|
-
validate("blur");
|
|
6423
|
+
const getField = (prop) => {
|
|
6424
|
+
const field = fields.find((item) => item.props.prop === prop);
|
|
6425
|
+
if (!field) throw new VcError("form", "请选择有用的prop值");
|
|
6426
|
+
return field;
|
|
6127
6427
|
};
|
|
6128
|
-
const
|
|
6129
|
-
|
|
6130
|
-
formItem.change?.();
|
|
6131
|
-
return;
|
|
6132
|
-
}
|
|
6133
|
-
if (validateDisabled) {
|
|
6134
|
-
validateDisabled = false;
|
|
6135
|
-
return;
|
|
6136
|
-
}
|
|
6137
|
-
validate("change");
|
|
6428
|
+
const showToast = (msg) => {
|
|
6429
|
+
props2.showMessage && options.throwToast?.(msg);
|
|
6138
6430
|
};
|
|
6139
|
-
const
|
|
6140
|
-
|
|
6431
|
+
const sortErrors = async (errors) => {
|
|
6432
|
+
const positions = await Promise.all(fields.map((item) => item.exposed.getPosition()));
|
|
6141
6433
|
try {
|
|
6142
|
-
|
|
6143
|
-
|
|
6144
|
-
|
|
6145
|
-
|
|
6146
|
-
|
|
6147
|
-
|
|
6148
|
-
|
|
6149
|
-
|
|
6150
|
-
};
|
|
6434
|
+
return [...errors].toSorted((a, b) => {
|
|
6435
|
+
const aIndex = fields.findIndex((i) => i.props.prop === a.prop);
|
|
6436
|
+
const bIndex = fields.findIndex((i) => i.props.prop === b.prop);
|
|
6437
|
+
const aPosition = positions[aIndex];
|
|
6438
|
+
const bPosition = positions[bIndex];
|
|
6439
|
+
if (aPosition.top != bPosition.top) return aPosition.top - bPosition.top;
|
|
6440
|
+
return aPosition.left - bPosition.left;
|
|
6441
|
+
});
|
|
6151
6442
|
} catch (e) {
|
|
6152
|
-
|
|
6443
|
+
return errors;
|
|
6153
6444
|
}
|
|
6154
6445
|
};
|
|
6155
|
-
const
|
|
6156
|
-
|
|
6157
|
-
|
|
6158
|
-
|
|
6159
|
-
|
|
6160
|
-
|
|
6161
|
-
|
|
6162
|
-
|
|
6163
|
-
}
|
|
6164
|
-
|
|
6165
|
-
|
|
6166
|
-
|
|
6167
|
-
|
|
6168
|
-
|
|
6169
|
-
|
|
6170
|
-
|
|
6171
|
-
|
|
6172
|
-
|
|
6173
|
-
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
|
|
6177
|
-
formItem.remove?.(instance);
|
|
6178
|
-
});
|
|
6179
|
-
vue.watch(
|
|
6180
|
-
() => props2.rules,
|
|
6181
|
-
() => {
|
|
6182
|
-
props2.resetByRulesChanged && reset();
|
|
6446
|
+
const scrollIntoView = (prop) => {
|
|
6447
|
+
const field = getField(prop);
|
|
6448
|
+
field.vnode?.el?.scrollIntoView?.({
|
|
6449
|
+
behavior: "smooth",
|
|
6450
|
+
block: "center"
|
|
6451
|
+
});
|
|
6452
|
+
};
|
|
6453
|
+
const reset = (options$ = {}) => {
|
|
6454
|
+
const { fields: fields$, original = {} } = options$;
|
|
6455
|
+
filterFields(fields$).forEach((field) => {
|
|
6456
|
+
let v;
|
|
6457
|
+
try {
|
|
6458
|
+
v = getPropByPath(original, field.props.prop).v;
|
|
6459
|
+
} catch (e) {
|
|
6460
|
+
}
|
|
6461
|
+
field.exposed.reset(v);
|
|
6462
|
+
});
|
|
6463
|
+
};
|
|
6464
|
+
const validate = async (options$ = {}) => {
|
|
6465
|
+
const { scroll = true, fields: fields$ } = options$;
|
|
6466
|
+
if (!fields.length) {
|
|
6467
|
+
return;
|
|
6183
6468
|
}
|
|
6184
|
-
|
|
6185
|
-
|
|
6186
|
-
|
|
6187
|
-
|
|
6188
|
-
|
|
6189
|
-
|
|
6190
|
-
|
|
6191
|
-
|
|
6192
|
-
|
|
6193
|
-
|
|
6194
|
-
|
|
6195
|
-
|
|
6196
|
-
|
|
6197
|
-
|
|
6469
|
+
const results = await Promise.allSettled(
|
|
6470
|
+
filterFields(fields$).map((item) => item.exposed.validate(""))
|
|
6471
|
+
);
|
|
6472
|
+
const originErrors = results.filter((i) => i.status === "rejected").map((i) => i.reason);
|
|
6473
|
+
if (!originErrors.length) return;
|
|
6474
|
+
const errors = await sortErrors(originErrors);
|
|
6475
|
+
showToast(errors[0].msg || errors[0].message);
|
|
6476
|
+
scroll && scrollIntoView(errors[0].prop);
|
|
6477
|
+
throw errors;
|
|
6478
|
+
};
|
|
6479
|
+
const validateField = async (prop, options$ = {}) => {
|
|
6480
|
+
try {
|
|
6481
|
+
await validate({
|
|
6482
|
+
...options$,
|
|
6483
|
+
fields: [prop]
|
|
6198
6484
|
});
|
|
6199
|
-
|
|
6485
|
+
} catch (e) {
|
|
6486
|
+
throw e[0];
|
|
6200
6487
|
}
|
|
6201
|
-
|
|
6488
|
+
};
|
|
6202
6489
|
expose({
|
|
6203
|
-
validate,
|
|
6204
6490
|
reset,
|
|
6205
|
-
|
|
6491
|
+
validate,
|
|
6492
|
+
// 单个操作
|
|
6493
|
+
getField,
|
|
6494
|
+
validateField
|
|
6206
6495
|
});
|
|
6207
|
-
return {
|
|
6208
|
-
isNest,
|
|
6209
|
-
isStyleless,
|
|
6210
|
-
isNestLast,
|
|
6211
|
-
validateMessage,
|
|
6212
|
-
classes,
|
|
6213
|
-
labelStyle,
|
|
6214
|
-
contentStyle,
|
|
6215
|
-
showError,
|
|
6216
|
-
labelPosition
|
|
6217
|
-
};
|
|
6218
6496
|
};
|
|
6497
|
+
const COMPONENT_NAME$11 = "vc-form";
|
|
6498
|
+
const Form = vue.defineComponent({
|
|
6499
|
+
name: COMPONENT_NAME$11,
|
|
6500
|
+
props: props$S,
|
|
6501
|
+
setup(props2, { slots, expose }) {
|
|
6502
|
+
useForm(expose);
|
|
6503
|
+
return () => {
|
|
6504
|
+
return vue.h(
|
|
6505
|
+
props2.tag,
|
|
6506
|
+
{
|
|
6507
|
+
class: "vc-form",
|
|
6508
|
+
autocomplete: props2.autocomplete
|
|
6509
|
+
},
|
|
6510
|
+
slots
|
|
6511
|
+
);
|
|
6512
|
+
};
|
|
6513
|
+
}
|
|
6514
|
+
});
|
|
6219
6515
|
const props$R = {
|
|
6220
|
-
|
|
6221
|
-
|
|
6222
|
-
|
|
6223
|
-
*/
|
|
6224
|
-
duration: {
|
|
6225
|
-
type: [Number, Object],
|
|
6226
|
-
default: 300
|
|
6516
|
+
label: {
|
|
6517
|
+
type: String,
|
|
6518
|
+
default: ""
|
|
6227
6519
|
},
|
|
6228
|
-
|
|
6229
|
-
|
|
6230
|
-
*/
|
|
6231
|
-
delay: {
|
|
6232
|
-
type: [Number, Object],
|
|
6233
|
-
default: 0
|
|
6520
|
+
labelWidth: {
|
|
6521
|
+
type: Number
|
|
6234
6522
|
},
|
|
6235
|
-
|
|
6236
|
-
|
|
6237
|
-
*/
|
|
6238
|
-
group: Boolean,
|
|
6239
|
-
/**
|
|
6240
|
-
* `transition-group` tag, v3版本默认值无
|
|
6241
|
-
*/
|
|
6242
|
-
tag: {
|
|
6243
|
-
type: String,
|
|
6244
|
-
default: void 0
|
|
6523
|
+
prop: {
|
|
6524
|
+
type: String
|
|
6245
6525
|
},
|
|
6246
|
-
|
|
6247
|
-
|
|
6248
|
-
|
|
6249
|
-
origin: {
|
|
6250
|
-
type: String,
|
|
6251
|
-
default: ""
|
|
6526
|
+
required: {
|
|
6527
|
+
type: [Boolean, String],
|
|
6528
|
+
default: false
|
|
6252
6529
|
},
|
|
6253
|
-
|
|
6254
|
-
|
|
6255
|
-
* inheritAttrs必须是false
|
|
6256
|
-
*/
|
|
6257
|
-
style: {
|
|
6258
|
-
type: Object,
|
|
6259
|
-
default: () => {
|
|
6260
|
-
return {
|
|
6261
|
-
animationFillMode: "both",
|
|
6262
|
-
animationTimingFunction: "ease-out"
|
|
6263
|
-
};
|
|
6264
|
-
}
|
|
6530
|
+
error: {
|
|
6531
|
+
type: String
|
|
6265
6532
|
},
|
|
6266
|
-
|
|
6267
|
-
type:
|
|
6268
|
-
default: "vc-transition"
|
|
6533
|
+
rules: {
|
|
6534
|
+
type: [Array, Object]
|
|
6269
6535
|
},
|
|
6270
|
-
|
|
6536
|
+
resetByRulesChanged: {
|
|
6537
|
+
type: Boolean,
|
|
6538
|
+
default: false
|
|
6539
|
+
},
|
|
6540
|
+
showMessage: {
|
|
6541
|
+
type: Boolean,
|
|
6542
|
+
default: true
|
|
6543
|
+
},
|
|
6544
|
+
labelFor: {
|
|
6545
|
+
type: String
|
|
6546
|
+
},
|
|
6547
|
+
styleless: {
|
|
6548
|
+
type: Boolean,
|
|
6549
|
+
default: false
|
|
6550
|
+
},
|
|
6551
|
+
labelPosition: {
|
|
6271
6552
|
type: String,
|
|
6272
|
-
default: "
|
|
6553
|
+
default: "right"
|
|
6554
|
+
},
|
|
6555
|
+
contentStyle: String
|
|
6556
|
+
};
|
|
6557
|
+
const filterEmpty = (val) => {
|
|
6558
|
+
if (val instanceof Array) {
|
|
6559
|
+
val = val.filter((i) => i !== "");
|
|
6273
6560
|
}
|
|
6561
|
+
return val;
|
|
6274
6562
|
};
|
|
6275
|
-
const
|
|
6276
|
-
|
|
6563
|
+
const toRules = (rules) => {
|
|
6564
|
+
return rules instanceof Array ? rules : rules ? [rules] : [];
|
|
6565
|
+
};
|
|
6566
|
+
const useFormItem = (expose) => {
|
|
6567
|
+
const form = vue.inject("form");
|
|
6277
6568
|
const instance = vue.getCurrentInstance();
|
|
6278
|
-
const attrs = instance.attrs;
|
|
6279
6569
|
const props2 = instance.props;
|
|
6280
|
-
const
|
|
6281
|
-
|
|
6570
|
+
const { slots } = instance;
|
|
6571
|
+
if (!form?.props) {
|
|
6572
|
+
throw new VcError("form-item", "form-item需要在form内使用");
|
|
6573
|
+
}
|
|
6574
|
+
const formItem = vue.inject("form-item", {});
|
|
6575
|
+
const validateState = vue.ref("");
|
|
6576
|
+
const validateMessage = vue.ref("");
|
|
6577
|
+
let validateDisabled = false;
|
|
6578
|
+
let initialValue;
|
|
6579
|
+
const currentRules = vue.computed(() => {
|
|
6580
|
+
const formRules = form.props.rules;
|
|
6581
|
+
const formItemBindRules = toRules(props2.rules);
|
|
6582
|
+
let formItemRules = formItemBindRules;
|
|
6583
|
+
if (!formItemRules.length && formRules && props2.prop) {
|
|
6584
|
+
try {
|
|
6585
|
+
const key = props2.prop.replace(/\.[0-9]+\./g, ".");
|
|
6586
|
+
const { v } = getPropByPath(formRules, key);
|
|
6587
|
+
formItemRules = toRules(v);
|
|
6588
|
+
} catch {
|
|
6589
|
+
const rules = formRules[props2.prop];
|
|
6590
|
+
formItemRules = toRules(rules);
|
|
6591
|
+
}
|
|
6592
|
+
}
|
|
6593
|
+
return formItemRules;
|
|
6594
|
+
});
|
|
6595
|
+
const isRequired = vue.computed(() => {
|
|
6596
|
+
if (!currentRules.value.length) {
|
|
6597
|
+
return !!props2.required;
|
|
6598
|
+
}
|
|
6599
|
+
let required = false;
|
|
6600
|
+
for (let i = 0; i < currentRules.value.length; i++) {
|
|
6601
|
+
const rule = currentRules.value[i];
|
|
6602
|
+
required = !!rule.required;
|
|
6603
|
+
if (required) break;
|
|
6604
|
+
}
|
|
6605
|
+
return required;
|
|
6606
|
+
});
|
|
6607
|
+
const labelPosition = vue.computed(() => {
|
|
6608
|
+
return props2.labelPosition || form.props.labelPosition;
|
|
6282
6609
|
});
|
|
6283
6610
|
const classes = vue.computed(() => {
|
|
6284
|
-
const modeClass = props2.mode !== "none" ? `is-${props2.mode.replace(/-/g, " is-")}` : "";
|
|
6285
6611
|
return {
|
|
6286
|
-
|
|
6287
|
-
|
|
6288
|
-
|
|
6612
|
+
"is-require": isRequired.value,
|
|
6613
|
+
"is-error": validateState.value === "error",
|
|
6614
|
+
"is-validating": validateState.value === "validating",
|
|
6615
|
+
"is-inline": form.props.inline,
|
|
6616
|
+
"is-nest": isNest.value,
|
|
6617
|
+
[`is-${labelPosition.value}`]: true
|
|
6289
6618
|
};
|
|
6290
6619
|
});
|
|
6291
|
-
const
|
|
6292
|
-
|
|
6293
|
-
|
|
6294
|
-
|
|
6295
|
-
|
|
6296
|
-
|
|
6297
|
-
|
|
6298
|
-
|
|
6299
|
-
|
|
6300
|
-
|
|
6301
|
-
|
|
6302
|
-
|
|
6303
|
-
};
|
|
6304
|
-
const resetOrigin = (el2) => {
|
|
6305
|
-
props2.origin && (el2.style.transformOrigin = props2.origin);
|
|
6306
|
-
};
|
|
6307
|
-
const resetStyles = (el2) => {
|
|
6308
|
-
resetOrigin(el2);
|
|
6309
|
-
Object.keys(props2.style).forEach((key) => {
|
|
6310
|
-
const v = props2.style[key];
|
|
6311
|
-
v && (el2.style[key] = v);
|
|
6312
|
-
});
|
|
6313
|
-
};
|
|
6314
|
-
const handleBeforeEnter = (el2) => {
|
|
6315
|
-
const duration = props2.duration.enter || props2.duration;
|
|
6316
|
-
el2.style.animationDuration = `${duration}ms`;
|
|
6317
|
-
const delay = props2.delay.enter || props2.delay;
|
|
6318
|
-
el2.style.animationDelay = `${delay}ms`;
|
|
6319
|
-
resetStyles(el2);
|
|
6320
|
-
attrs.onBeforeEnter?.(el2);
|
|
6321
|
-
};
|
|
6322
|
-
const createNext = (callback, duration) => {
|
|
6323
|
-
let hasDone = false;
|
|
6324
|
-
return (immediate = true) => {
|
|
6325
|
-
if (hasDone) return;
|
|
6326
|
-
hasDone = true;
|
|
6327
|
-
const done = () => callback?.();
|
|
6328
|
-
immediate ? done() : setTimeout(done, duration);
|
|
6620
|
+
const isNest = vue.computed(() => {
|
|
6621
|
+
return !!formItem.change;
|
|
6622
|
+
});
|
|
6623
|
+
const isNestLast = vue.ref(false);
|
|
6624
|
+
const hasLabel = vue.computed(() => {
|
|
6625
|
+
return !!props2.label || slots.label;
|
|
6626
|
+
});
|
|
6627
|
+
const labelStyle = vue.computed(() => {
|
|
6628
|
+
const labelWidth = props2.labelWidth === 0 || props2.labelWidth ? props2.labelWidth : isNest.value ? 0 : form.props.labelWidth;
|
|
6629
|
+
return {
|
|
6630
|
+
width: labelPosition.value !== "top" && labelWidth && labelWidth > 0 ? `${labelWidth}px` : "auto",
|
|
6631
|
+
textAlign: labelPosition.value === "top" ? "left" : labelPosition.value
|
|
6329
6632
|
};
|
|
6330
|
-
};
|
|
6331
|
-
const
|
|
6332
|
-
const
|
|
6333
|
-
|
|
6334
|
-
|
|
6335
|
-
|
|
6336
|
-
|
|
6337
|
-
|
|
6633
|
+
});
|
|
6634
|
+
const contentStyle = vue.computed(() => {
|
|
6635
|
+
const labelWidth = props2.labelWidth === 0 || props2.labelWidth ? props2.labelWidth : form.props.labelWidth;
|
|
6636
|
+
return [
|
|
6637
|
+
{
|
|
6638
|
+
marginLeft: !hasLabel.value && isNest.value ? 0 : labelWidth && labelWidth > 0 ? `${labelWidth}px` : "unset",
|
|
6639
|
+
marginBottom: isNest.value && !isNestLast.value ? `20px` : 0
|
|
6640
|
+
},
|
|
6641
|
+
props2.contentStyle
|
|
6642
|
+
];
|
|
6643
|
+
});
|
|
6644
|
+
const isStyleless = vue.computed(() => {
|
|
6645
|
+
return props2.styleless || form.props.styleless;
|
|
6646
|
+
});
|
|
6647
|
+
const fieldValue = vue.computed(() => {
|
|
6648
|
+
const model = form.props.model;
|
|
6649
|
+
if (!model || !props2.prop) {
|
|
6650
|
+
return;
|
|
6338
6651
|
}
|
|
6652
|
+
let path = props2.prop;
|
|
6653
|
+
if (path.includes(":")) {
|
|
6654
|
+
path = path.replace(/:/, ".");
|
|
6655
|
+
}
|
|
6656
|
+
return getPropByPath(model, path).v;
|
|
6657
|
+
});
|
|
6658
|
+
const showError = vue.computed(() => {
|
|
6659
|
+
return validateState.value === "error" && props2.showMessage && form.props.showMessage;
|
|
6660
|
+
});
|
|
6661
|
+
vue.watch(
|
|
6662
|
+
() => props2.error,
|
|
6663
|
+
(v) => {
|
|
6664
|
+
validateMessage.value = v || "";
|
|
6665
|
+
validateState.value = v === "" ? "" : "error";
|
|
6666
|
+
}
|
|
6667
|
+
);
|
|
6668
|
+
const reset = (v) => {
|
|
6669
|
+
validateState.value = "";
|
|
6670
|
+
validateMessage.value = "";
|
|
6671
|
+
const model = form.props.model;
|
|
6672
|
+
if (!props2.prop) return;
|
|
6673
|
+
const { o, k } = getPropByPath(model, props2.prop);
|
|
6674
|
+
if (!k) return;
|
|
6675
|
+
validateDisabled = true;
|
|
6676
|
+
o[k] = v !== null && v !== void 0 ? v : Array.isArray(fieldValue.value) ? [].concat(initialValue) : initialValue;
|
|
6339
6677
|
};
|
|
6340
|
-
const
|
|
6341
|
-
|
|
6342
|
-
|
|
6343
|
-
|
|
6344
|
-
|
|
6345
|
-
|
|
6346
|
-
|
|
6347
|
-
|
|
6348
|
-
|
|
6349
|
-
|
|
6350
|
-
|
|
6351
|
-
|
|
6352
|
-
|
|
6353
|
-
|
|
6354
|
-
const
|
|
6678
|
+
const validate = async (trigger) => {
|
|
6679
|
+
if (!props2.prop) return;
|
|
6680
|
+
let rules = currentRules.value.filter((rule) => !rule.trigger || rule.trigger.includes(trigger));
|
|
6681
|
+
if (!rules.length) {
|
|
6682
|
+
if (!props2.required) {
|
|
6683
|
+
return;
|
|
6684
|
+
} else {
|
|
6685
|
+
rules = [{
|
|
6686
|
+
required: true,
|
|
6687
|
+
message: typeof props2.required === "string" ? props2.required : void 0
|
|
6688
|
+
}];
|
|
6689
|
+
}
|
|
6690
|
+
}
|
|
6691
|
+
validateState.value = "validating";
|
|
6692
|
+
const descriptor = {};
|
|
6693
|
+
descriptor[props2.prop] = rules;
|
|
6694
|
+
const validator = new Validator(descriptor);
|
|
6695
|
+
const model = {};
|
|
6696
|
+
model[props2.prop] = filterEmpty(fieldValue.value);
|
|
6355
6697
|
try {
|
|
6356
|
-
|
|
6357
|
-
|
|
6358
|
-
|
|
6359
|
-
|
|
6698
|
+
await validator.validate(model, { first: false });
|
|
6699
|
+
validateState.value = "success";
|
|
6700
|
+
validateMessage.value = "";
|
|
6701
|
+
} catch (errors) {
|
|
6702
|
+
validateState.value = "error";
|
|
6703
|
+
validateMessage.value = errors[0].message;
|
|
6704
|
+
throw {
|
|
6705
|
+
prop: props2.prop,
|
|
6706
|
+
message: validateMessage.value
|
|
6707
|
+
};
|
|
6360
6708
|
}
|
|
6709
|
+
validateDisabled = false;
|
|
6361
6710
|
};
|
|
6362
|
-
const
|
|
6363
|
-
|
|
6364
|
-
|
|
6711
|
+
const handleFieldBlur = () => {
|
|
6712
|
+
if (!props2.prop) {
|
|
6713
|
+
formItem.blur?.();
|
|
6714
|
+
return;
|
|
6715
|
+
}
|
|
6716
|
+
validate("blur");
|
|
6365
6717
|
};
|
|
6366
|
-
|
|
6367
|
-
|
|
6368
|
-
|
|
6369
|
-
|
|
6370
|
-
|
|
6371
|
-
|
|
6372
|
-
|
|
6373
|
-
|
|
6374
|
-
onEnter: handleEnter,
|
|
6375
|
-
onAfterEnter: handleAfterEnter,
|
|
6376
|
-
onBeforeLeave: handleBeforeLeave,
|
|
6377
|
-
onLeave: handleLeave,
|
|
6378
|
-
onAfterLeave: handleAfterLeave
|
|
6718
|
+
const handleFieldChange = () => {
|
|
6719
|
+
if (!props2.prop) {
|
|
6720
|
+
formItem.change?.();
|
|
6721
|
+
return;
|
|
6722
|
+
}
|
|
6723
|
+
if (validateDisabled) {
|
|
6724
|
+
validateDisabled = false;
|
|
6725
|
+
return;
|
|
6379
6726
|
}
|
|
6727
|
+
validate("change");
|
|
6380
6728
|
};
|
|
6381
|
-
|
|
6382
|
-
|
|
6383
|
-
|
|
6384
|
-
|
|
6385
|
-
|
|
6386
|
-
// 当不声明emits的情况下,事件存在于attrs中
|
|
6387
|
-
inheritAttrs: false,
|
|
6388
|
-
setup(props2, { slots, attrs }) {
|
|
6389
|
-
const { Wrapper, listeners, classes } = useTransition();
|
|
6390
|
-
return () => {
|
|
6391
|
-
return vue.h(
|
|
6392
|
-
Wrapper.value,
|
|
6393
|
-
{
|
|
6394
|
-
...attrs,
|
|
6395
|
-
...listeners,
|
|
6396
|
-
...classes.value,
|
|
6397
|
-
tag: props2.tag
|
|
6398
|
-
},
|
|
6399
|
-
slots
|
|
6400
|
-
);
|
|
6401
|
-
};
|
|
6402
|
-
}
|
|
6403
|
-
});
|
|
6404
|
-
const COMPONENT_NAME$15 = "vc-transition-collapse";
|
|
6405
|
-
const TransitionCollapse = vue.defineComponent({
|
|
6406
|
-
name: COMPONENT_NAME$15,
|
|
6407
|
-
props: props$R,
|
|
6408
|
-
// 当不声明emits的情况下,事件存在于attrs中
|
|
6409
|
-
inheritAttrs: false,
|
|
6410
|
-
setup(props2, { slots, attrs: _attrs }) {
|
|
6411
|
-
const attrs = _attrs;
|
|
6412
|
-
const { Wrapper, resetStyles, resetAbsolute, createNext } = useTransition();
|
|
6413
|
-
const getTransitionStyle = (duration) => {
|
|
6414
|
-
const style = `
|
|
6415
|
-
${duration}ms height ease-in-out,
|
|
6416
|
-
${duration}ms padding-top ease-in-out,
|
|
6417
|
-
${duration}ms padding-bottom ease-in-out
|
|
6418
|
-
`;
|
|
6419
|
-
return style;
|
|
6420
|
-
};
|
|
6421
|
-
const handleBeforeEnter = (el2) => {
|
|
6422
|
-
const duration = props2.duration.enter || props2.duration;
|
|
6423
|
-
el2.style.transition = getTransitionStyle(duration);
|
|
6424
|
-
/* istanbul ignore next -- @preserve */
|
|
6425
|
-
if (!el2.dataset) {
|
|
6426
|
-
el2.dataset = {};
|
|
6427
|
-
}
|
|
6428
|
-
el2.dataset.oldPaddingTop = el2.style.paddingTop;
|
|
6429
|
-
el2.dataset.oldPaddingBottom = el2.style.paddingBottom;
|
|
6430
|
-
el2.style.height = "0px";
|
|
6431
|
-
el2.style.paddingTop = "0px";
|
|
6432
|
-
el2.style.paddingBottom = "0px";
|
|
6433
|
-
resetStyles(el2);
|
|
6434
|
-
attrs.onBeforeEnter?.(el2);
|
|
6435
|
-
};
|
|
6436
|
-
const handleEnter = async (el2, done) => {
|
|
6437
|
-
const duration = props2.duration.enter || props2.duration;
|
|
6438
|
-
const next = createNext(done, duration);
|
|
6439
|
-
try {
|
|
6440
|
-
el2.dataset.oldOverflow = el2.style.overflow;
|
|
6441
|
-
/* istanbul ignore next -- @preserve */
|
|
6442
|
-
if (el2.scrollHeight !== 0) {
|
|
6443
|
-
el2.style.height = el2.scrollHeight + "px";
|
|
6444
|
-
el2.style.paddingTop = el2.dataset.oldPaddingTop + "px";
|
|
6445
|
-
el2.style.paddingBottom = el2.dataset.oldPaddingBottom + "px";
|
|
6446
|
-
} else {
|
|
6447
|
-
el2.style.height = "";
|
|
6448
|
-
el2.style.paddingTop = el2.dataset.oldPaddingTop + "px";
|
|
6449
|
-
el2.style.paddingBottom = el2.dataset.oldPaddingBottom + "px";
|
|
6450
|
-
}
|
|
6451
|
-
el2.style.overflow = "hidden";
|
|
6452
|
-
attrs.onEnter?.(el2);
|
|
6453
|
-
} finally {
|
|
6454
|
-
next(false);
|
|
6455
|
-
}
|
|
6456
|
-
};
|
|
6457
|
-
const handleAfterEnter = (el2) => {
|
|
6458
|
-
el2.style.transition = "";
|
|
6459
|
-
el2.style.height = "";
|
|
6460
|
-
el2.style.overflow = el2.dataset.oldOverflow || "";
|
|
6461
|
-
attrs.onAfterEnter?.(el2);
|
|
6462
|
-
};
|
|
6463
|
-
const handleBeforeLeave = (el2) => {
|
|
6464
|
-
/* istanbul ignore next -- @preserve */
|
|
6465
|
-
if (!el2.dataset) {
|
|
6466
|
-
el2.dataset = {};
|
|
6467
|
-
}
|
|
6468
|
-
el2.dataset.oldPaddingTop = el2.style.paddingTop;
|
|
6469
|
-
el2.dataset.oldPaddingBottom = el2.style.paddingBottom;
|
|
6470
|
-
el2.dataset.oldOverflow = el2.style.overflow;
|
|
6471
|
-
el2.style.height = el2.scrollHeight + "px";
|
|
6472
|
-
el2.style.overflow = "hidden";
|
|
6473
|
-
resetStyles(el2);
|
|
6474
|
-
attrs.onBeforeLeave?.(el2);
|
|
6475
|
-
};
|
|
6476
|
-
const handleLeave = (el2, done) => {
|
|
6477
|
-
const duration = props2.duration.leave || props2.duration;
|
|
6478
|
-
const next = createNext(done, duration);
|
|
6479
|
-
try {
|
|
6480
|
-
const leaveDuration = props2.duration.leave || props2.duration;
|
|
6481
|
-
/* istanbul ignore next -- @preserve */
|
|
6482
|
-
if (el2.scrollHeight !== 0) {
|
|
6483
|
-
el2.style.transition = getTransitionStyle(leaveDuration);
|
|
6484
|
-
el2.style.height = "0px";
|
|
6485
|
-
el2.style.paddingTop = "0px";
|
|
6486
|
-
el2.style.paddingBottom = "0px";
|
|
6487
|
-
}
|
|
6488
|
-
resetAbsolute(el2);
|
|
6489
|
-
attrs.onLeave?.(el2);
|
|
6490
|
-
} finally {
|
|
6491
|
-
next(props2.group ? true : false);
|
|
6729
|
+
const getPosition = async () => {
|
|
6730
|
+
let el2 = instance.vnode.el;
|
|
6731
|
+
try {
|
|
6732
|
+
while (el2 && !el2.getBoundingClientRect) {
|
|
6733
|
+
el2 = el2.nextSibling;
|
|
6492
6734
|
}
|
|
6493
|
-
|
|
6494
|
-
|
|
6495
|
-
|
|
6496
|
-
|
|
6497
|
-
|
|
6498
|
-
|
|
6499
|
-
|
|
6500
|
-
|
|
6501
|
-
};
|
|
6502
|
-
const listeners = {
|
|
6503
|
-
onBeforeEnter: handleBeforeEnter,
|
|
6504
|
-
onEnter: handleEnter,
|
|
6505
|
-
onAfterEnter: handleAfterEnter,
|
|
6506
|
-
onBeforeLeave: handleBeforeLeave,
|
|
6507
|
-
onLeave: handleLeave,
|
|
6508
|
-
onAfterLeave: handleAfterLeave
|
|
6509
|
-
};
|
|
6510
|
-
return () => {
|
|
6511
|
-
return vue.h(
|
|
6512
|
-
Wrapper.value,
|
|
6513
|
-
{
|
|
6514
|
-
...attrs,
|
|
6515
|
-
...listeners,
|
|
6516
|
-
tag: props2.tag,
|
|
6517
|
-
moveClass: props2.group ? `${attrs.moveClass || ""} vc-transition-collapse is-move` : void 0
|
|
6518
|
-
},
|
|
6519
|
-
slots
|
|
6520
|
-
);
|
|
6521
|
-
};
|
|
6522
|
-
}
|
|
6523
|
-
});
|
|
6524
|
-
const COMPONENT_NAME$14 = "vc-transition-fade";
|
|
6525
|
-
const TransitionFade = vue.defineComponent({
|
|
6526
|
-
name: COMPONENT_NAME$14,
|
|
6527
|
-
props: {
|
|
6528
|
-
...props$R,
|
|
6529
|
-
// inheritAttrs必须是false
|
|
6530
|
-
style: {
|
|
6531
|
-
type: Object,
|
|
6532
|
-
default: () => ({
|
|
6533
|
-
animationFillMode: "both",
|
|
6534
|
-
animationTimingFunction: void 0
|
|
6535
|
-
})
|
|
6536
|
-
},
|
|
6537
|
-
prefix: {
|
|
6538
|
-
type: String,
|
|
6539
|
-
default: "vc-transition-fade"
|
|
6735
|
+
;
|
|
6736
|
+
const rect = el2.getBoundingClientRect();
|
|
6737
|
+
return {
|
|
6738
|
+
top: rect.top,
|
|
6739
|
+
left: rect.left
|
|
6740
|
+
};
|
|
6741
|
+
} catch (e) {
|
|
6742
|
+
throw new VcError("form-item", "form-item位置计算错误");
|
|
6540
6743
|
}
|
|
6541
|
-
}
|
|
6542
|
-
|
|
6543
|
-
|
|
6544
|
-
|
|
6545
|
-
|
|
6546
|
-
|
|
6547
|
-
|
|
6548
|
-
|
|
6549
|
-
|
|
6550
|
-
...attrs,
|
|
6551
|
-
...listeners,
|
|
6552
|
-
...classes.value,
|
|
6553
|
-
tag: props2.tag
|
|
6554
|
-
},
|
|
6555
|
-
slots
|
|
6556
|
-
);
|
|
6557
|
-
};
|
|
6558
|
-
}
|
|
6559
|
-
});
|
|
6560
|
-
const COMPONENT_NAME$13 = "vc-transition-scale";
|
|
6561
|
-
const TransitionScale = vue.defineComponent({
|
|
6562
|
-
name: COMPONENT_NAME$13,
|
|
6563
|
-
props: {
|
|
6564
|
-
...props$R,
|
|
6565
|
-
mode: {
|
|
6566
|
-
type: String,
|
|
6567
|
-
default: "both",
|
|
6568
|
-
validator: (v) => /(part|both|y|x|none)/.test(v)
|
|
6569
|
-
},
|
|
6570
|
-
// inheritAttrs必须是false
|
|
6571
|
-
style: {
|
|
6572
|
-
type: Object,
|
|
6573
|
-
default: () => ({
|
|
6574
|
-
animationFillMode: "both",
|
|
6575
|
-
animationTimingFunction: void 0
|
|
6576
|
-
})
|
|
6744
|
+
};
|
|
6745
|
+
const fields = vue.reactive([]);
|
|
6746
|
+
vue.provide("form-item", {
|
|
6747
|
+
fields,
|
|
6748
|
+
blur: handleFieldBlur,
|
|
6749
|
+
change: handleFieldChange,
|
|
6750
|
+
message: validateMessage,
|
|
6751
|
+
add: (field) => {
|
|
6752
|
+
field && fields.push(field);
|
|
6577
6753
|
},
|
|
6578
|
-
|
|
6579
|
-
|
|
6580
|
-
default: "vc-transition-scale"
|
|
6754
|
+
remove: (field) => {
|
|
6755
|
+
field && fields.splice(fields.indexOf(field), 1);
|
|
6581
6756
|
}
|
|
6582
|
-
}
|
|
6583
|
-
|
|
6584
|
-
|
|
6585
|
-
|
|
6586
|
-
|
|
6587
|
-
return () => {
|
|
6588
|
-
return vue.h(
|
|
6589
|
-
Wrapper.value,
|
|
6590
|
-
{
|
|
6591
|
-
...attrs,
|
|
6592
|
-
...listeners,
|
|
6593
|
-
...classes.value,
|
|
6594
|
-
tag: props2.tag
|
|
6595
|
-
},
|
|
6596
|
-
slots
|
|
6597
|
-
);
|
|
6598
|
-
};
|
|
6599
|
-
}
|
|
6600
|
-
});
|
|
6601
|
-
const COMPONENT_NAME$12 = "vc-transition-slide";
|
|
6602
|
-
const TransitionSlide = vue.defineComponent({
|
|
6603
|
-
name: COMPONENT_NAME$12,
|
|
6604
|
-
props: {
|
|
6605
|
-
...props$R,
|
|
6606
|
-
mode: {
|
|
6607
|
-
type: String,
|
|
6608
|
-
default: "left",
|
|
6609
|
-
validator: (v) => /^(left|right|down|up|none)(|-part)$/.test(v)
|
|
6610
|
-
},
|
|
6611
|
-
// inheritAttrs必须是false
|
|
6612
|
-
style: {
|
|
6613
|
-
type: Object,
|
|
6614
|
-
default: () => ({
|
|
6615
|
-
animationFillMode: "both",
|
|
6616
|
-
animationTimingFunction: void 0
|
|
6617
|
-
})
|
|
6618
|
-
},
|
|
6619
|
-
prefix: {
|
|
6620
|
-
type: String,
|
|
6621
|
-
default: "vc-transition-slide"
|
|
6757
|
+
});
|
|
6758
|
+
vue.onMounted(() => {
|
|
6759
|
+
if (props2.prop) {
|
|
6760
|
+
form.add?.(instance);
|
|
6761
|
+
initialValue = cloneDeep(fieldValue.value);
|
|
6622
6762
|
}
|
|
6623
|
-
|
|
6624
|
-
|
|
6625
|
-
|
|
6626
|
-
|
|
6627
|
-
|
|
6628
|
-
|
|
6629
|
-
|
|
6630
|
-
|
|
6631
|
-
|
|
6632
|
-
|
|
6633
|
-
...listeners,
|
|
6634
|
-
...classes.value,
|
|
6635
|
-
tag: props2.tag
|
|
6636
|
-
},
|
|
6637
|
-
slots
|
|
6638
|
-
);
|
|
6639
|
-
};
|
|
6640
|
-
}
|
|
6641
|
-
});
|
|
6642
|
-
const COMPONENT_NAME$11 = "vc-transition-zoom";
|
|
6643
|
-
const TransitionZoom = vue.defineComponent({
|
|
6644
|
-
name: COMPONENT_NAME$11,
|
|
6645
|
-
props: {
|
|
6646
|
-
...props$R,
|
|
6647
|
-
mode: {
|
|
6648
|
-
type: String,
|
|
6649
|
-
default: "x",
|
|
6650
|
-
validator: (v) => /^(x|y|center|none)$/.test(v)
|
|
6651
|
-
},
|
|
6652
|
-
// inheritAttrs必须是false
|
|
6653
|
-
style: {
|
|
6654
|
-
type: Object,
|
|
6655
|
-
default: () => ({
|
|
6656
|
-
animationFillMode: "both",
|
|
6657
|
-
animationTimingFunction: void 0
|
|
6658
|
-
})
|
|
6659
|
-
},
|
|
6660
|
-
prefix: {
|
|
6661
|
-
type: String,
|
|
6662
|
-
default: "vc-transition-zoom"
|
|
6763
|
+
formItem.add?.(instance);
|
|
6764
|
+
});
|
|
6765
|
+
vue.onBeforeUnmount(() => {
|
|
6766
|
+
form.remove?.(instance);
|
|
6767
|
+
formItem.remove?.(instance);
|
|
6768
|
+
});
|
|
6769
|
+
vue.watch(
|
|
6770
|
+
() => props2.rules,
|
|
6771
|
+
() => {
|
|
6772
|
+
props2.resetByRulesChanged && reset();
|
|
6663
6773
|
}
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
|
|
6667
|
-
|
|
6668
|
-
|
|
6669
|
-
|
|
6670
|
-
|
|
6671
|
-
|
|
6672
|
-
|
|
6673
|
-
|
|
6674
|
-
|
|
6675
|
-
|
|
6676
|
-
|
|
6677
|
-
|
|
6678
|
-
|
|
6679
|
-
|
|
6680
|
-
}
|
|
6681
|
-
|
|
6682
|
-
|
|
6774
|
+
);
|
|
6775
|
+
vue.watch(
|
|
6776
|
+
() => formItem.fields?.length,
|
|
6777
|
+
async (v) => {
|
|
6778
|
+
if (!isNest.value || !v) return isNestLast.value = false;
|
|
6779
|
+
const fields$ = [...vue.toRaw(formItem.fields)];
|
|
6780
|
+
const positions = await Promise.all(fields$.map((item) => item.exposed.getPosition()));
|
|
6781
|
+
const sortFields = fields$.toSorted((a, b) => {
|
|
6782
|
+
const aIndex = fields$.findIndex((i) => i === a);
|
|
6783
|
+
const bIndex = fields$.findIndex((i) => i === b);
|
|
6784
|
+
const aPosition = positions[aIndex];
|
|
6785
|
+
const bPosition = positions[bIndex];
|
|
6786
|
+
if (aPosition.top != bPosition.top) return aPosition.top - bPosition.top;
|
|
6787
|
+
return aPosition.left - bPosition.left;
|
|
6788
|
+
});
|
|
6789
|
+
isNestLast.value = sortFields[sortFields.length - 1] === instance;
|
|
6790
|
+
}
|
|
6791
|
+
);
|
|
6792
|
+
expose({
|
|
6793
|
+
validate,
|
|
6794
|
+
reset,
|
|
6795
|
+
getPosition
|
|
6796
|
+
});
|
|
6797
|
+
return {
|
|
6798
|
+
isNest,
|
|
6799
|
+
isStyleless,
|
|
6800
|
+
isNestLast,
|
|
6801
|
+
validateMessage,
|
|
6802
|
+
classes,
|
|
6803
|
+
labelStyle,
|
|
6804
|
+
contentStyle,
|
|
6805
|
+
showError,
|
|
6806
|
+
labelPosition
|
|
6807
|
+
};
|
|
6808
|
+
};
|
|
6683
6809
|
const COMPONENT_NAME$10 = "vc-form-item";
|
|
6684
6810
|
const FormItem = /* @__PURE__ */ vue.defineComponent({
|
|
6685
6811
|
name: COMPONENT_NAME$10,
|
|
6686
|
-
props: props$
|
|
6812
|
+
props: props$R,
|
|
6687
6813
|
setup(props2, {
|
|
6688
6814
|
slots,
|
|
6689
6815
|
expose
|
|
@@ -6735,7 +6861,7 @@ var Vc = (function (exports, vue) {
|
|
|
6735
6861
|
}
|
|
6736
6862
|
});
|
|
6737
6863
|
const props$Q = {
|
|
6738
|
-
...props$
|
|
6864
|
+
...props$S,
|
|
6739
6865
|
showToast: {
|
|
6740
6866
|
type: Boolean,
|
|
6741
6867
|
default: false
|
|
@@ -7213,7 +7339,7 @@ var Vc = (function (exports, vue) {
|
|
|
7213
7339
|
}
|
|
7214
7340
|
});
|
|
7215
7341
|
const props$N = {
|
|
7216
|
-
...props$
|
|
7342
|
+
...props$R,
|
|
7217
7343
|
indent: {
|
|
7218
7344
|
type: Number,
|
|
7219
7345
|
default: 12
|
|
@@ -9744,7 +9870,8 @@ var Vc = (function (exports, vue) {
|
|
|
9744
9870
|
emits: ["portal-fulfilled", "close"],
|
|
9745
9871
|
setup(props2, {
|
|
9746
9872
|
emit,
|
|
9747
|
-
slots
|
|
9873
|
+
slots,
|
|
9874
|
+
expose
|
|
9748
9875
|
}) {
|
|
9749
9876
|
const {
|
|
9750
9877
|
getPopupStyle,
|
|
@@ -9917,6 +10044,9 @@ var Vc = (function (exports, vue) {
|
|
|
9917
10044
|
Resize.off(vnode.el, handleWrapperResize);
|
|
9918
10045
|
props2.alone && props2.hover && removeEvents();
|
|
9919
10046
|
});
|
|
10047
|
+
expose({
|
|
10048
|
+
isActive
|
|
10049
|
+
});
|
|
9920
10050
|
return () => {
|
|
9921
10051
|
let _slot;
|
|
9922
10052
|
return vue.createVNode(TransitionScale, {
|
|
@@ -12454,8 +12584,7 @@ var Vc = (function (exports, vue) {
|
|
|
12454
12584
|
install: (app) => {
|
|
12455
12585
|
app.config.globalProperties.$vc = VcInstance.configure(options);
|
|
12456
12586
|
Object.keys(Components).forEach((key) => {
|
|
12457
|
-
|
|
12458
|
-
app.component(key, Components[key]);
|
|
12587
|
+
app.component(transfromComponentKey(key) || key, Components[key]);
|
|
12459
12588
|
});
|
|
12460
12589
|
}
|
|
12461
12590
|
};
|