This commit is contained in:
2023-08-11 10:45:20 +08:00
commit 161ca982f3
31850 changed files with 2706500 additions and 0 deletions

1
node_modules/vant/lib/stepper/index.css generated vendored Normal file
View File

@ -0,0 +1 @@
.van-stepper{font-size:0;-webkit-user-select:none;user-select:none}.van-stepper__minus,.van-stepper__plus{position:relative;box-sizing:border-box;width:28px;height:28px;margin:0;padding:0;color:#323233;vertical-align:middle;background-color:#f2f3f5;border:0;cursor:pointer}.van-stepper__minus::before,.van-stepper__plus::before{width:50%;height:1px}.van-stepper__minus::after,.van-stepper__plus::after{width:1px;height:50%}.van-stepper__minus::after,.van-stepper__minus::before,.van-stepper__plus::after,.van-stepper__plus::before{position:absolute;top:50%;left:50%;background-color:currentColor;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);content:''}.van-stepper__minus:active,.van-stepper__plus:active{background-color:#e8e8e8}.van-stepper__minus--disabled,.van-stepper__plus--disabled{color:#c8c9cc;background-color:#f7f8fa;cursor:not-allowed}.van-stepper__minus--disabled:active,.van-stepper__plus--disabled:active{background-color:#f7f8fa}.van-stepper__minus{border-radius:4px 0 0 4px}.van-stepper__minus::after{display:none}.van-stepper__plus{border-radius:0 4px 4px 0}.van-stepper__input{box-sizing:border-box;width:32px;height:28px;margin:0 2px;padding:0;color:#323233;font-size:14px;line-height:normal;text-align:center;vertical-align:middle;background-color:#f2f3f5;border:0;border-width:1px 0;border-radius:0;-webkit-appearance:none}.van-stepper__input:disabled{color:#c8c9cc;background-color:#f2f3f5;-webkit-text-fill-color:#c8c9cc;opacity:1}.van-stepper__input:read-only{cursor:default}.van-stepper--round .van-stepper__input{background-color:transparent}.van-stepper--round .van-stepper__minus,.van-stepper--round .van-stepper__plus{border-radius:100%}.van-stepper--round .van-stepper__minus:active,.van-stepper--round .van-stepper__plus:active{opacity:.7}.van-stepper--round .van-stepper__minus--disabled,.van-stepper--round .van-stepper__minus--disabled:active,.van-stepper--round .van-stepper__plus--disabled,.van-stepper--round .van-stepper__plus--disabled:active{opacity:.3}.van-stepper--round .van-stepper__plus{color:#fff;background-color:#ee0a24}.van-stepper--round .van-stepper__minus{color:#ee0a24;background-color:#fff;border:1px solid #ee0a24}

363
node_modules/vant/lib/stepper/index.js generated vendored Normal file
View File

@ -0,0 +1,363 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.default = void 0;
var _babelHelperVueJsxMergeProps = _interopRequireDefault(require("@vue/babel-helper-vue-jsx-merge-props"));
var _utils = require("../utils");
var _resetScroll = require("../utils/dom/reset-scroll");
var _event = require("../utils/dom/event");
var _number = require("../utils/format/number");
var _number2 = require("../utils/validate/number");
var _field = require("../mixins/field");
var _createNamespace = (0, _utils.createNamespace)('stepper'),
createComponent = _createNamespace[0],
bem = _createNamespace[1];
var LONG_PRESS_START_TIME = 600;
var LONG_PRESS_INTERVAL = 200;
function equal(value1, value2) {
return String(value1) === String(value2);
}
var _default = createComponent({
mixins: [_field.FieldMixin],
props: {
value: null,
theme: String,
integer: Boolean,
disabled: Boolean,
allowEmpty: Boolean,
inputWidth: [Number, String],
buttonSize: [Number, String],
asyncChange: Boolean,
placeholder: String,
disablePlus: Boolean,
disableMinus: Boolean,
disableInput: Boolean,
decimalLength: [Number, String],
name: {
type: [Number, String],
default: ''
},
min: {
type: [Number, String],
default: 1
},
max: {
type: [Number, String],
default: Infinity
},
step: {
type: [Number, String],
default: 1
},
defaultValue: {
type: [Number, String],
default: 1
},
showPlus: {
type: Boolean,
default: true
},
showMinus: {
type: Boolean,
default: true
},
showInput: {
type: Boolean,
default: true
},
longPress: {
type: Boolean,
default: true
}
},
data: function data() {
var _this$value;
var defaultValue = (_this$value = this.value) != null ? _this$value : this.defaultValue;
var value = this.format(defaultValue);
if (!equal(value, this.value)) {
this.$emit('input', value);
}
return {
currentValue: value
};
},
computed: {
minusDisabled: function minusDisabled() {
return this.disabled || this.disableMinus || this.currentValue <= +this.min;
},
plusDisabled: function plusDisabled() {
return this.disabled || this.disablePlus || this.currentValue >= +this.max;
},
inputStyle: function inputStyle() {
var style = {};
if (this.inputWidth) {
style.width = (0, _utils.addUnit)(this.inputWidth);
}
if (this.buttonSize) {
style.height = (0, _utils.addUnit)(this.buttonSize);
}
return style;
},
buttonStyle: function buttonStyle() {
if (this.buttonSize) {
var size = (0, _utils.addUnit)(this.buttonSize);
return {
width: size,
height: size
};
}
}
},
watch: {
max: 'check',
min: 'check',
integer: 'check',
decimalLength: 'check',
value: function value(val) {
if (!equal(val, this.currentValue)) {
this.currentValue = this.format(val);
}
},
currentValue: function currentValue(val) {
this.$emit('input', val);
this.$emit('change', val, {
name: this.name
});
}
},
methods: {
check: function check() {
var val = this.format(this.currentValue);
if (!equal(val, this.currentValue)) {
this.currentValue = val;
}
},
// formatNumber illegal characters
formatNumber: function formatNumber(value) {
return (0, _number.formatNumber)(String(value), !this.integer);
},
format: function format(value) {
if (this.allowEmpty && value === '') {
return value;
}
value = this.formatNumber(value); // format range
value = value === '' ? 0 : +value;
value = (0, _number2.isNaN)(value) ? this.min : value;
value = Math.max(Math.min(this.max, value), this.min); // format decimal
if ((0, _utils.isDef)(this.decimalLength)) {
value = value.toFixed(this.decimalLength);
}
return value;
},
onInput: function onInput(event) {
var value = event.target.value;
var formatted = this.formatNumber(value); // limit max decimal length
if ((0, _utils.isDef)(this.decimalLength) && formatted.indexOf('.') !== -1) {
var pair = formatted.split('.');
formatted = pair[0] + "." + pair[1].slice(0, this.decimalLength);
}
if (!equal(value, formatted)) {
event.target.value = formatted;
} // prefer number type
if (formatted === String(+formatted)) {
formatted = +formatted;
}
this.emitChange(formatted);
},
emitChange: function emitChange(value) {
if (this.asyncChange) {
this.$emit('input', value);
this.$emit('change', value, {
name: this.name
});
} else {
this.currentValue = value;
}
},
onChange: function onChange() {
var type = this.type;
if (this[type + "Disabled"]) {
this.$emit('overlimit', type);
return;
}
var diff = type === 'minus' ? -this.step : +this.step;
var value = this.format((0, _number.addNumber)(+this.currentValue, diff));
this.emitChange(value);
this.$emit(type);
},
onFocus: function onFocus(event) {
// readonly not work in legacy mobile safari
if (this.disableInput && this.$refs.input) {
this.$refs.input.blur();
} else {
this.$emit('focus', event);
}
},
onBlur: function onBlur(event) {
var value = this.format(event.target.value);
event.target.value = value;
this.emitChange(value);
this.$emit('blur', event);
(0, _resetScroll.resetScroll)();
},
longPressStep: function longPressStep() {
var _this = this;
this.longPressTimer = setTimeout(function () {
_this.onChange();
_this.longPressStep(_this.type);
}, LONG_PRESS_INTERVAL);
},
onTouchStart: function onTouchStart() {
var _this2 = this;
if (!this.longPress) {
return;
}
clearTimeout(this.longPressTimer);
this.isLongPress = false;
this.longPressTimer = setTimeout(function () {
_this2.isLongPress = true;
_this2.onChange();
_this2.longPressStep();
}, LONG_PRESS_START_TIME);
},
onTouchEnd: function onTouchEnd(event) {
if (!this.longPress) {
return;
}
clearTimeout(this.longPressTimer);
if (this.isLongPress) {
(0, _event.preventDefault)(event);
}
},
onMousedown: function onMousedown(event) {
// fix mobile safari page scroll down issue
// see: https://github.com/vant-ui/vant/issues/7690
if (this.disableInput) {
event.preventDefault();
}
}
},
render: function render() {
var _this3 = this;
var h = arguments[0];
var createListeners = function createListeners(type) {
return {
on: {
click: function click(e) {
// disable double tap scrolling on mobile safari
e.preventDefault();
_this3.type = type;
_this3.onChange();
},
touchstart: function touchstart() {
_this3.type = type;
_this3.onTouchStart();
},
touchend: _this3.onTouchEnd,
touchcancel: _this3.onTouchEnd
}
};
};
return h("div", {
"class": bem([this.theme])
}, [h("button", (0, _babelHelperVueJsxMergeProps.default)([{
"directives": [{
name: "show",
value: this.showMinus
}],
"attrs": {
"type": "button"
},
"style": this.buttonStyle,
"class": bem('minus', {
disabled: this.minusDisabled
})
}, createListeners('minus')])), h("input", {
"directives": [{
name: "show",
value: this.showInput
}],
"ref": "input",
"attrs": {
"type": this.integer ? 'tel' : 'text',
"role": "spinbutton",
"disabled": this.disabled,
"readonly": this.disableInput,
"inputmode": this.integer ? 'numeric' : 'decimal',
"placeholder": this.placeholder,
"aria-valuemax": this.max,
"aria-valuemin": this.min,
"aria-valuenow": this.currentValue
},
"class": bem('input'),
"domProps": {
"value": this.currentValue
},
"style": this.inputStyle,
"on": {
"input": this.onInput,
"focus": this.onFocus,
"blur": this.onBlur,
"mousedown": this.onMousedown
}
}), h("button", (0, _babelHelperVueJsxMergeProps.default)([{
"directives": [{
name: "show",
value: this.showPlus
}],
"attrs": {
"type": "button"
},
"style": this.buttonStyle,
"class": bem('plus', {
disabled: this.plusDisabled
})
}, createListeners('plus')]))]);
}
});
exports.default = _default;

130
node_modules/vant/lib/stepper/index.less generated vendored Normal file
View File

@ -0,0 +1,130 @@
@import '../style/var';
.van-stepper {
font-size: 0;
user-select: none;
&__minus,
&__plus {
position: relative;
box-sizing: border-box;
width: @stepper-input-height;
height: @stepper-input-height;
margin: 0;
padding: 0;
color: @stepper-button-icon-color;
vertical-align: middle;
background-color: @stepper-background-color;
border: 0;
cursor: pointer;
&::before {
width: 50%;
height: 1px;
}
&::after {
width: 1px;
height: 50%;
}
&::before,
&::after {
position: absolute;
top: 50%;
left: 50%;
background-color: currentColor;
transform: translate(-50%, -50%);
content: '';
}
&:active {
background-color: @stepper-active-color;
}
&--disabled {
color: @stepper-button-disabled-icon-color;
background-color: @stepper-button-disabled-color;
cursor: not-allowed;
&:active {
background-color: @stepper-button-disabled-color;
}
}
}
&__minus {
border-radius: @stepper-border-radius 0 0 @stepper-border-radius;
&::after {
display: none;
}
}
&__plus {
border-radius: 0 @stepper-border-radius @stepper-border-radius 0;
}
&__input {
box-sizing: border-box;
width: @stepper-input-width;
height: @stepper-input-height;
margin: 0 2px;
padding: 0;
color: @stepper-input-text-color;
font-size: @stepper-input-font-size;
line-height: @stepper-input-line-height;
text-align: center;
vertical-align: middle;
background-color: @stepper-background-color;
border: 0;
border-width: 1px 0;
border-radius: 0;
-webkit-appearance: none;
&:disabled {
color: @stepper-input-disabled-text-color;
background-color: @stepper-input-disabled-background-color;
// fix disabled color in iOSF
-webkit-text-fill-color: @stepper-input-disabled-text-color;
opacity: 1;
}
&:read-only {
cursor: default;
}
}
&--round {
.van-stepper__input {
background-color: transparent;
}
.van-stepper__plus,
.van-stepper__minus {
border-radius: 100%;
&:active {
opacity: @active-opacity;
}
&--disabled {
&,
&:active {
opacity: 0.3;
}
}
}
.van-stepper__plus {
color: @white;
background-color: @stepper-button-round-theme-color;
}
.van-stepper__minus {
color: @stepper-button-round-theme-color;
background-color: @white;
border: 1px solid @stepper-button-round-theme-color;
}
}
}

2
node_modules/vant/lib/stepper/style/index.js generated vendored Normal file
View File

@ -0,0 +1,2 @@
require('../../style/base.css');
require('../index.css');

2
node_modules/vant/lib/stepper/style/less.js generated vendored Normal file
View File

@ -0,0 +1,2 @@
require('../../style/base.less');
require('../index.less');