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

168
node_modules/vant/lib/toast/Toast.js generated vendored Normal file
View File

@ -0,0 +1,168 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.default = void 0;
var _utils = require("../utils");
var _lockClick = require("./lock-click");
var _popup = require("../mixins/popup");
var _icon = _interopRequireDefault(require("../icon"));
var _loading = _interopRequireDefault(require("../loading"));
// Utils
// Mixins
// Components
var _createNamespace = (0, _utils.createNamespace)('toast'),
createComponent = _createNamespace[0],
bem = _createNamespace[1];
var _default = createComponent({
mixins: [(0, _popup.PopupMixin)()],
props: {
icon: String,
className: null,
iconPrefix: String,
loadingType: String,
forbidClick: Boolean,
closeOnClick: Boolean,
message: [Number, String],
type: {
type: String,
default: 'text'
},
position: {
type: String,
default: 'middle'
},
transition: {
type: String,
default: 'van-fade'
},
lockScroll: {
type: Boolean,
default: false
}
},
data: function data() {
return {
clickable: false
};
},
mounted: function mounted() {
this.toggleClickable();
},
destroyed: function destroyed() {
this.toggleClickable();
},
watch: {
value: 'toggleClickable',
forbidClick: 'toggleClickable'
},
methods: {
onClick: function onClick() {
if (this.closeOnClick) {
this.close();
}
},
toggleClickable: function toggleClickable() {
var clickable = this.value && this.forbidClick;
if (this.clickable !== clickable) {
this.clickable = clickable;
(0, _lockClick.lockClick)(clickable);
}
},
/* istanbul ignore next */
onAfterEnter: function onAfterEnter() {
this.$emit('opened');
if (this.onOpened) {
this.onOpened();
}
},
onAfterLeave: function onAfterLeave() {
this.$emit('closed');
},
genIcon: function genIcon() {
var h = this.$createElement;
var icon = this.icon,
type = this.type,
iconPrefix = this.iconPrefix,
loadingType = this.loadingType;
var hasIcon = icon || type === 'success' || type === 'fail';
if (hasIcon) {
return h(_icon.default, {
"class": bem('icon'),
"attrs": {
"classPrefix": iconPrefix,
"name": icon || type
}
});
}
if (type === 'loading') {
return h(_loading.default, {
"class": bem('loading'),
"attrs": {
"type": loadingType
}
});
}
},
genMessage: function genMessage() {
var h = this.$createElement;
var type = this.type,
message = this.message;
if (!(0, _utils.isDef)(message) || message === '') {
return;
}
if (type === 'html') {
return h("div", {
"class": bem('text'),
"domProps": {
"innerHTML": message
}
});
}
return h("div", {
"class": bem('text')
}, [message]);
}
},
render: function render() {
var _ref;
var h = arguments[0];
return h("transition", {
"attrs": {
"name": this.transition
},
"on": {
"afterEnter": this.onAfterEnter,
"afterLeave": this.onAfterLeave
}
}, [h("div", {
"directives": [{
name: "show",
value: this.value
}],
"class": [bem([this.position, (_ref = {}, _ref[this.type] = !this.icon, _ref)]), this.className],
"on": {
"click": this.onClick
}
}, [this.genIcon(), this.genMessage()])]);
}
});
exports.default = _default;

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

@ -0,0 +1 @@
.van-toast{position:fixed;top:50%;left:50%;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;flex-direction:column;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;box-sizing:content-box;width:88px;max-width:70%;min-height:88px;padding:16px;color:#fff;font-size:14px;line-height:20px;white-space:pre-wrap;text-align:center;word-break:break-all;background-color:rgba(0,0,0,.7);border-radius:8px;-webkit-transform:translate3d(-50%,-50%,0);transform:translate3d(-50%,-50%,0)}.van-toast--unclickable{overflow:hidden}.van-toast--unclickable *{pointer-events:none}.van-toast--html,.van-toast--text{width:-webkit-fit-content;width:fit-content;min-width:96px;min-height:0;padding:8px 12px}.van-toast--html .van-toast__text,.van-toast--text .van-toast__text{margin-top:0}.van-toast--top{top:20%}.van-toast--bottom{top:auto;bottom:20%}.van-toast__icon{font-size:36px}.van-toast__loading{padding:4px;color:#fff}.van-toast__text{margin-top:8px}

200
node_modules/vant/lib/toast/index.js generated vendored Normal file
View File

@ -0,0 +1,200 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.default = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _vue = _interopRequireDefault(require("vue"));
var _Toast = _interopRequireDefault(require("./Toast"));
var _utils = require("../utils");
var _node = require("../utils/dom/node");
var defaultOptions = {
icon: '',
type: 'text',
// @deprecated
mask: false,
value: true,
message: '',
className: '',
overlay: false,
onClose: null,
onOpened: null,
duration: 2000,
iconPrefix: undefined,
position: 'middle',
transition: 'van-fade',
forbidClick: false,
loadingType: undefined,
getContainer: 'body',
overlayStyle: null,
closeOnClick: false,
closeOnClickOverlay: false
}; // default options of specific type
var defaultOptionsMap = {};
var queue = [];
var multiple = false;
var currentOptions = (0, _extends2.default)({}, defaultOptions);
function parseOptions(message) {
if ((0, _utils.isObject)(message)) {
return message;
}
return {
message: message
};
}
function isInDocument(element) {
return document.body.contains(element);
}
function createInstance() {
/* istanbul ignore if */
if (_utils.isServer) {
return {};
}
queue = queue.filter(function (item) {
return !item.$el.parentNode || isInDocument(item.$el);
});
if (!queue.length || multiple) {
var toast = new (_vue.default.extend(_Toast.default))({
el: document.createElement('div')
});
toast.$on('input', function (value) {
toast.value = value;
});
queue.push(toast);
}
return queue[queue.length - 1];
} // transform toast options to popup props
function transformOptions(options) {
return (0, _extends2.default)({}, options, {
overlay: options.mask || options.overlay,
mask: undefined,
duration: undefined
});
}
function Toast(options) {
if (options === void 0) {
options = {};
}
var toast = createInstance(); // should add z-index if previous toast has not disappeared
if (toast.value) {
toast.updateZIndex();
}
options = parseOptions(options);
options = (0, _extends2.default)({}, currentOptions, defaultOptionsMap[options.type || currentOptions.type], options);
if (process.env.NODE_ENV === 'development' && options.mask) {
console.warn('[Vant] Toast: "mask" option is deprecated, use "overlay" option instead.');
}
options.clear = function () {
toast.value = false;
if (options.onClose) {
options.onClose();
options.onClose = null;
}
if (multiple && !_utils.isServer) {
toast.$on('closed', function () {
clearTimeout(toast.timer);
queue = queue.filter(function (item) {
return item !== toast;
});
(0, _node.removeNode)(toast.$el);
toast.$destroy();
});
}
};
(0, _extends2.default)(toast, transformOptions(options));
clearTimeout(toast.timer);
if (options.duration > 0) {
toast.timer = setTimeout(function () {
toast.clear();
}, options.duration);
}
return toast;
}
var createMethod = function createMethod(type) {
return function (options) {
return Toast((0, _extends2.default)({
type: type
}, parseOptions(options)));
};
};
['loading', 'success', 'fail'].forEach(function (method) {
Toast[method] = createMethod(method);
});
Toast.clear = function (all) {
if (queue.length) {
if (all) {
queue.forEach(function (toast) {
toast.clear();
});
queue = [];
} else if (!multiple) {
queue[0].clear();
} else {
queue.shift().clear();
}
}
};
Toast.setDefaultOptions = function (type, options) {
if (typeof type === 'string') {
defaultOptionsMap[type] = options;
} else {
(0, _extends2.default)(currentOptions, type);
}
};
Toast.resetDefaultOptions = function (type) {
if (typeof type === 'string') {
defaultOptionsMap[type] = null;
} else {
currentOptions = (0, _extends2.default)({}, defaultOptions);
defaultOptionsMap = {};
}
};
Toast.allowMultiple = function (value) {
if (value === void 0) {
value = true;
}
multiple = value;
};
Toast.install = function () {
_vue.default.use(_Toast.default);
};
_vue.default.prototype.$toast = Toast;
var _default = Toast;
exports.default = _default;

75
node_modules/vant/lib/toast/index.less generated vendored Normal file
View File

@ -0,0 +1,75 @@
@import '../style/var';
.van-toast {
position: fixed;
top: 50%;
left: 50%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
box-sizing: content-box;
// hack for avoid max-width when use left & fixed
width: @toast-default-width;
max-width: @toast-max-width;
min-height: @toast-default-min-height;
padding: @toast-default-padding;
color: @toast-text-color;
font-size: @toast-font-size;
line-height: @toast-line-height;
// allow newline character
white-space: pre-wrap;
text-align: center;
// https://github.com/vant-ui/vant/issues/8959
word-break: break-all;
background-color: @toast-background-color;
border-radius: @toast-border-radius;
transform: translate3d(-50%, -50%, 0);
&--unclickable {
// lock scroll
overflow: hidden;
// should not add pointer-events: none directly to body tag
// that will cause unexpected tap-highlight-color in mobile safari
* {
pointer-events: none;
}
}
&--text,
&--html {
width: fit-content;
min-width: @toast-text-min-width;
min-height: 0;
padding: @toast-text-padding;
.van-toast__text {
margin-top: 0;
}
}
&--top {
top: @toast-position-top-distance;
}
&--bottom {
top: auto;
bottom: @toast-position-bottom-distance;
}
&__icon {
font-size: @toast-icon-size;
}
&__loading {
padding: @padding-base;
color: @toast-loading-icon-color;
}
&__text {
margin-top: @padding-xs;
}
}

21
node_modules/vant/lib/toast/lock-click.js generated vendored Normal file
View File

@ -0,0 +1,21 @@
"use strict";
exports.__esModule = true;
exports.lockClick = lockClick;
var lockCount = 0;
function lockClick(lock) {
if (lock) {
if (!lockCount) {
document.body.classList.add('van-toast--unclickable');
}
lockCount++;
} else {
lockCount--;
if (!lockCount) {
document.body.classList.remove('van-toast--unclickable');
}
}
}

7
node_modules/vant/lib/toast/style/index.js generated vendored Normal file
View File

@ -0,0 +1,7 @@
require('../../style/base.css');
require('../../overlay/index.css');
require('../../info/index.css');
require('../../icon/index.css');
require('../../popup/index.css');
require('../../loading/index.css');
require('../index.css');

7
node_modules/vant/lib/toast/style/less.js generated vendored Normal file
View File

@ -0,0 +1,7 @@
require('../../style/base.less');
require('../../overlay/index.less');
require('../../info/index.less');
require('../../icon/index.less');
require('../../popup/index.less');
require('../../loading/index.less');
require('../index.less');