choo-taro-ui-vue3
Version:
Taro UI Rewritten in Vue 3.0
11,736 lines • 411 kB
JavaScript
import { computed, defineComponent, warn, ref, reactive, watch, toRefs, resolveComponent, normalizeClass, normalizeStyle, openBlock, createBlock, createCommentVNode, toDisplayString, createTextVNode, withCtx, createVNode, renderSlot, mergeProps, renderList, Fragment, createElementBlock, toRef, onMounted, nextTick, onUnmounted, onBeforeMount, h, Transition } from 'vue';
import Taro from '@tarojs/taro';
function propsFactory(props) {
return (defaults) => {
if (!defaults) {
return props;
} else {
return Object.keys(props).reduce((obj, prop) => {
const definition = props[prop];
if (prop in defaults) {
if (typeof definition === "object" && definition != null && !Array.isArray(definition)) {
obj[prop] = {
...definition,
default: defaults[prop]
};
} else {
obj[prop] = { type: props[prop], default: defaults[prop] };
}
} else {
obj[prop] = definition;
}
return obj;
}, {});
}
};
}
const { getEnv, ENV_TYPE } = Taro;
const ENV$2 = Taro.getEnv();
const getEnvs = () => {
const env = getEnv();
return {
isWEAPP: env === ENV_TYPE.WEAPP,
isALIPAY: env === ENV_TYPE.ALIPAY,
isWEB: env === ENV_TYPE.WEB
};
};
function pxTransform(size, designWidth) {
if (!size)
return "";
if (!designWidth) {
designWidth = 750;
}
return Taro.pxTransform(size, designWidth);
}
function delay(delayTime = 500) {
return new Promise((resolve) => {
setTimeout(() => {
resolve();
}, delayTime);
});
}
function delayQuerySelector(_, selectorStr, delayTime = 500) {
const selector = Taro.createSelectorQuery();
return new Promise((resolve) => {
delay(delayTime).then(() => {
selector.select(selectorStr).boundingClientRect().exec((res) => {
resolve(res);
});
});
});
}
function cssStringToObject(css) {
const o = {};
const r = /(?<=^|;)\s*([^:]+)\s*:\s*([^;]+)\s*/g;
css.replace(r, (m, p, v) => o[p.replace(/-(.)/g, (m2, p2) => p2.toUpperCase())] = v);
return o;
}
let scrollTop = 0;
function handleTouchScroll(flag) {
if (ENV$2 !== Taro.ENV_TYPE.WEB) {
return;
}
if (flag) {
scrollTop = document.documentElement.scrollTop;
document.body.classList.add("at-frozen");
document.body.style.top = `${-scrollTop}px`;
} else {
document.body.style.top = "";
document.body.classList.remove("at-frozen");
document.documentElement.scrollTop = scrollTop;
}
}
function uuid(len = 8, radix = 16) {
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");
const value = [];
let i = 0;
radix = radix || chars.length;
if (len) {
for (i = 0; i < len; i++)
value[i] = chars[0 | Math.random() * radix];
} else {
let r;
value[8] = value[13] = value[18] = value[23] = "-";
value[14] = "4";
for (i = 0; i < 36; i++) {
if (!value[i]) {
r = 0 | Math.random() * 16;
value[i] = chars[i === 19 ? r & 3 | 8 : r];
}
}
}
return value.join("");
}
function getEventDetail(event) {
let detail;
switch (ENV$2) {
case Taro.ENV_TYPE.WEB:
detail = {
pageX: event.pageX,
pageY: event.pageY,
clientX: event.clientX,
clientY: event.clientY,
offsetX: event.offsetX,
offsetY: event.offsetY,
x: event.x,
y: event.y
};
break;
case Taro.ENV_TYPE.WEAPP:
detail = {
pageX: event.touches[0].pageX,
pageY: event.touches[0].pageY,
clientX: event.touches[0].clientX,
clientY: event.touches[0].clientY,
offsetX: event.target.offsetLeft,
offsetY: event.target.offsetTop,
x: event.target.x,
y: event.target.y
};
break;
case Taro.ENV_TYPE.ALIPAY:
detail = {
pageX: event.target.pageX,
pageY: event.target.pageY,
clientX: event.target.clientX,
clientY: event.target.clientY,
offsetX: event.target.offsetLeft,
offsetY: event.target.offsetTop,
x: event.target.x,
y: event.target.y
};
break;
case Taro.ENV_TYPE.SWAN:
detail = {
pageX: event.changedTouches[0].pageX,
pageY: event.changedTouches[0].pageY,
clientX: event.target.clientX,
clientY: event.target.clientY,
offsetX: event.target.offsetLeft,
offsetY: event.target.offsetTop,
x: event.detail.x,
y: event.detail.y
};
break;
default:
detail = {
pageX: 0,
pageY: 0,
clientX: 0,
clientY: 0,
offsetX: 0,
offsetY: 0,
x: 0,
y: 0
};
console.warn("getEventDetail\u6682\u672A\u652F\u6301\u8BE5\u73AF\u5883");
break;
}
return detail;
}
function delayGetScrollOffset({ delayTime = 500 }) {
return new Promise((resolve) => {
delay(delayTime).then(() => {
Taro.createSelectorQuery().selectViewport().scrollOffset().exec((res) => {
resolve(res);
});
});
});
}
function delayGetClientRect({ selectorStr, delayTime = 500 }) {
const selector = Taro.createSelectorQuery();
return new Promise((resolve) => {
delay(delayTime).then(() => {
selector.select(selectorStr).boundingClientRect().exec((res) => {
resolve(res);
});
});
});
}
function convertToUnit(str, unit = "px") {
if (str == null || str === "") {
return void 0;
} else if (isNaN(+str)) {
return String(str);
} else {
return `${Number(str)}${unit}`;
}
}
const allDimensionsProps = {
height: {
type: [Number, String]
},
maxHeight: {
type: [Number, String]
},
maxWidth: {
type: [Number, String]
},
minHeight: {
type: [Number, String]
},
minWidth: {
type: [Number, String]
},
width: {
type: [Number, String]
}
};
function dimensionsFactory(...possibleProps) {
const selectedProps = possibleProps.length ? possibleProps : Object.keys(allDimensionsProps);
const makeDimensionsProps = propsFactory(selectedProps.reduce((obj, prop) => {
obj[prop] = allDimensionsProps[prop];
return obj;
}, {}));
const useDimensions = (props) => {
const dimensions = computed(() => {
return selectedProps.reduce((obj, key) => {
const value = props[key];
if (value) {
obj.style[key] = convertToUnit(value);
}
return obj;
}, { style: {} });
});
return { dimensions };
};
return {
makeDimensionsProps,
useDimensions
};
}
const makeElevationProps = propsFactory({
elevation: {
type: [Number, String],
validator(v) {
const value = parseInt(v);
return !isNaN(value) && value >= 0 && value <= 24;
}
},
flat: Boolean
});
function useElevationClasses(props) {
const elevationClasses = computed(() => {
const { elevation = props.flat ? 0 : void 0 } = props;
return elevation != null && elevation !== "" ? { [`elevation-${elevation}`]: true } : {};
});
return { elevationClasses };
}
function useIconClasses(icon, allowPrefixClass) {
const iconClasses = computed(() => {
if (allowPrefixClass) {
return {
[`${icon?.prefixClass || "at-icon"}`]: Boolean(icon),
[`${icon?.prefixClass || "at-icon"}-${icon?.value}`]: Boolean(icon && icon.value),
[`${icon?.class}`]: Boolean(icon?.class)
};
}
return {
"at-icon": Boolean(icon),
[`at-icon-${icon?.value}`]: Boolean(icon && icon.value),
[`${icon?.class}`]: Boolean(icon?.class)
};
});
return {
iconClasses
};
}
function useIconStyle(icon, defaultColor = "", defaultSize, pxTransform) {
const iconStyle = computed(() => {
let size;
if (Boolean(icon && icon.size)) {
size = pxTransform ? pxTransform(icon.size) : `${icon.size}px`;
} else {
size = Boolean(defaultSize) ? `${defaultSize}px` : "";
}
const style = Boolean(icon?.style) ? typeof icon.style === "string" ? cssStringToObject(icon.style) : icon.style : {};
return {
color: Boolean(icon && icon.color) ? icon.color : defaultColor,
fontSize: size,
...style
};
});
return {
iconStyle
};
}
function useModelValue(props, emit, name = "modelValue") {
return computed({
get: () => props[name],
set: (value) => emit(`update:${name}`, value)
});
}
const AtAccordion = defineComponent({
name: "AtAccordion",
emits: {
click: (open) => {
if (typeof open === "boolean") {
return true;
} else {
warn("click payload should be type boolean");
return false;
}
}
},
props: {
open: Boolean,
title: {
type: String,
default: ""
},
icon: {
type: Object,
default: () => ({ value: "" })
},
hasBorder: {
type: Boolean,
default: true
},
isAnimation: {
type: Boolean,
default: true
},
note: {
type: String,
default: ""
}
},
setup(props, { emit }) {
const startOpen = ref(false);
const isCompleted = ref(true);
const contentID = ref("content");
const state = reactive({
wrapperHeight: "unset"
});
const { iconStyle } = useIconStyle(props.icon);
const { iconClasses } = useIconClasses(props.icon, true);
const contentStyle = computed(() => ({
height: isCompleted.value ? "" : state.wrapperHeight === "unset" ? state.wrapperHeight : `${state.wrapperHeight}px`
}));
watch(() => props.open, (open) => {
startOpen.value = !!open && !!props.isAnimation;
toggleWithAnimation();
});
function handleClick() {
if (!isCompleted.value)
return;
contentID.value = "content_" + uuid();
emit("click", !props.open);
}
function toggleWithAnimation() {
if (!isCompleted.value || !props.isAnimation)
return;
isCompleted.value = false;
delayQuerySelector(this, `#${contentID.value}.at-accordion__body`, 30).then((rect) => {
const height = parseInt(rect[0].height.toString());
const startHeight = props.open ? 0 : height;
const endHeight = props.open ? height : 0;
startOpen.value = false;
state.wrapperHeight = startHeight;
setTimeout(() => {
state.wrapperHeight = endHeight;
}, 100);
setTimeout(() => {
isCompleted.value = true;
}, 700);
});
}
return {
...toRefs(props),
contentID,
startOpen,
isCompleted,
iconClasses,
iconStyle,
contentStyle,
handleClick
};
}
});
// Binding optimization for webpack code-split
const _resolveComponent$$ = resolveComponent, _normalizeClass$o = normalizeClass, _normalizeStyle$o = normalizeStyle, _openBlock$$ = openBlock, _createBlock$$ = createBlock, _createCommentVNode$w = createCommentVNode, _toDisplayString$A = toDisplayString, _createTextVNode$A = createTextVNode, _withCtx$_ = withCtx, _createVNode$I = createVNode, _renderSlot$v = renderSlot, _mergeProps$S = mergeProps;
function _sfc_render$$(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_text = _resolveComponent$$("taro-text");
const _component_taro_view = _resolveComponent$$("taro-view");
return (_openBlock$$(), _createBlock$$(_component_taro_view, _mergeProps$S(_ctx.$attrs, { class: "at-accordion" }), {
default: _withCtx$_(() => [
_createVNode$I(_component_taro_view, {
class: _normalizeClass$o(['at-accordion__header', {
'at-accordion__header--noborder': !_ctx.hasBorder
}]),
onTap: _ctx.handleClick
}, {
default: _withCtx$_(() => [
(Boolean(_ctx.icon && _ctx.icon.value))
? (_openBlock$$(), _createBlock$$(_component_taro_text, {
key: 0,
class: _normalizeClass$o(['at-accordion__icon', _ctx.iconClasses]),
style: _normalizeStyle$o(_ctx.iconStyle)
}, null, 8 /* PROPS */, ["class", "style"]))
: _createCommentVNode$w("v-if", true),
_createVNode$I(_component_taro_view, { class: "at-accordion__info" }, {
default: _withCtx$_(() => [
_createVNode$I(_component_taro_view, { class: "at-accordion__info__title" }, {
default: _withCtx$_(() => [
_createTextVNode$A(_toDisplayString$A(_ctx.title), 1 /* TEXT */)
]),
_: 1 /* STABLE */
}),
_createVNode$I(_component_taro_view, { class: "at-accordion__info__note" }, {
default: _withCtx$_(() => [
_createTextVNode$A(_toDisplayString$A(_ctx.note), 1 /* TEXT */)
]),
_: 1 /* STABLE */
})
]),
_: 1 /* STABLE */
}),
_createVNode$I(_component_taro_view, {
class: _normalizeClass$o(['at-accordion__arrow', {
'at-accordion__arrow--folded': !!_ctx.open
}])
}, {
default: _withCtx$_(() => [
_createVNode$I(_component_taro_text, { class: "at-icon at-icon-chevron-down" })
]),
_: 1 /* STABLE */
}, 8 /* PROPS */, ["class"])
]),
_: 1 /* STABLE */
}, 8 /* PROPS */, ["class", "onTap"]),
_createVNode$I(_component_taro_view, {
class: _normalizeClass$o([
'at-accordion__content',
{
'at-accordion__content--inactive': (!_ctx.open && _ctx.isCompleted) || _ctx.startOpen
}
]),
style: _normalizeStyle$o(_ctx.contentStyle)
}, {
default: _withCtx$_(() => [
_createVNode$I(_component_taro_view, {
id: _ctx.contentID,
class: "at-accordion__body"
}, {
default: _withCtx$_(() => [
_renderSlot$v(_ctx.$slots, "default")
]),
_: 3 /* FORWARDED */
}, 8 /* PROPS */, ["id"])
]),
_: 3 /* FORWARDED */
}, 8 /* PROPS */, ["class", "style"])
]),
_: 3 /* FORWARDED */
}, 16 /* FULL_PROPS */))
}
AtAccordion.render = _sfc_render$$;
const AtActionSheetHeader = defineComponent({
name: "AtActionSheetHeader"
});
// Binding optimization for webpack code-split
const _renderSlot$u = renderSlot, _resolveComponent$_ = resolveComponent, _withCtx$Z = withCtx, _openBlock$_ = openBlock, _createBlock$_ = createBlock;
function _sfc_render$_(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_view = _resolveComponent$_("taro-view");
return (_openBlock$_(), _createBlock$_(_component_taro_view, { class: "at-action-sheet__header" }, {
default: _withCtx$Z(() => [
_renderSlot$u(_ctx.$slots, "default")
]),
_: 3 /* FORWARDED */
}))
}
AtActionSheetHeader.render = _sfc_render$_;
const AtActionSheetBody = defineComponent({
name: "AtActionSheetBody"
});
// Binding optimization for webpack code-split
const _renderSlot$t = renderSlot, _resolveComponent$Z = resolveComponent, _withCtx$Y = withCtx, _openBlock$Z = openBlock, _createBlock$Z = createBlock;
function _sfc_render$Z(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_view = _resolveComponent$Z("taro-view");
return (_openBlock$Z(), _createBlock$Z(_component_taro_view, { class: "at-action-sheet__body" }, {
default: _withCtx$Y(() => [
_renderSlot$t(_ctx.$slots, "default")
]),
_: 3 /* FORWARDED */
}))
}
AtActionSheetBody.render = _sfc_render$Z;
const AtActionSheetFooter = defineComponent({
name: "AtActionSheetFooter",
emits: ["click"],
setup(_, { emit }) {
function handleClick(...args) {
emit("click", ...args);
}
return {
handleClick
};
}
});
// Binding optimization for webpack code-split
const _renderSlot$s = renderSlot, _resolveComponent$Y = resolveComponent, _withCtx$X = withCtx, _openBlock$Y = openBlock, _createBlock$Y = createBlock;
function _sfc_render$Y(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_view = _resolveComponent$Y("taro-view");
return (_openBlock$Y(), _createBlock$Y(_component_taro_view, {
class: "at-action-sheet__footer",
onTap: _ctx.handleClick
}, {
default: _withCtx$X(() => [
_renderSlot$s(_ctx.$slots, "default")
]),
_: 3 /* FORWARDED */
}, 8 /* PROPS */, ["onTap"]))
}
AtActionSheetFooter.render = _sfc_render$Y;
const AtActionSheet = defineComponent({
name: "AtActionSheet",
components: {
AtActionSheetHeader,
AtActionSheetBody,
AtActionSheetFooter
},
emits: ["close", "cancel"],
props: {
isOpened: Boolean,
title: {
type: String,
default: ""
},
cancelText: {
type: String,
default: ""
}
},
setup(props, { emit }) {
const opened = ref(props.isOpened);
watch(() => props.isOpened, (isOpened) => {
if (isOpened !== opened.value) {
opened.value = isOpened;
}
!isOpened && handleClose();
});
function handleClose() {
emit("close");
}
function handleCancel() {
emit("cancel");
close();
}
function close() {
opened.value = false;
handleClose();
}
function handleTouchmove(e) {
e.stopPropagation();
e.preventDefault();
}
return {
...toRefs(props),
opened,
close,
handleCancel,
handleTouchmove
};
}
});
// Binding optimization for webpack code-split
const _resolveComponent$X = resolveComponent, _createVNode$H = createVNode, _toDisplayString$z = toDisplayString, _createTextVNode$z = createTextVNode, _withCtx$W = withCtx, _openBlock$X = openBlock, _createBlock$X = createBlock, _createCommentVNode$v = createCommentVNode, _renderSlot$r = renderSlot, _mergeProps$R = mergeProps;
function _sfc_render$X(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_view = _resolveComponent$X("taro-view");
const _component_at_action_sheet_header = _resolveComponent$X("at-action-sheet-header");
const _component_at_action_sheet_body = _resolveComponent$X("at-action-sheet-body");
const _component_at_action_sheet_footer = _resolveComponent$X("at-action-sheet-footer");
return (_openBlock$X(), _createBlock$X(_component_taro_view, _mergeProps$R(_ctx.$attrs, {
class: ['at-action-sheet', {
'at-action-sheet--active': _ctx.opened,
}],
catchMove: true,
onTouchmove: _ctx.handleTouchmove
}), {
default: _withCtx$W(() => [
_createVNode$H(_component_taro_view, {
class: "at-action-sheet__overlay",
onTap: _ctx.close
}, null, 8 /* PROPS */, ["onTap"]),
_createVNode$H(_component_taro_view, { class: "at-action-sheet__container" }, {
default: _withCtx$W(() => [
(_ctx.title)
? (_openBlock$X(), _createBlock$X(_component_at_action_sheet_header, { key: 0 }, {
default: _withCtx$W(() => [
_createTextVNode$z(_toDisplayString$z(_ctx.title), 1 /* TEXT */)
]),
_: 1 /* STABLE */
}))
: _createCommentVNode$v("v-if", true),
_createVNode$H(_component_at_action_sheet_body, null, {
default: _withCtx$W(() => [
_renderSlot$r(_ctx.$slots, "default")
]),
_: 3 /* FORWARDED */
}),
(_ctx.cancelText)
? (_openBlock$X(), _createBlock$X(_component_at_action_sheet_footer, {
key: 1,
onClick: _ctx.handleCancel
}, {
default: _withCtx$W(() => [
_createTextVNode$z(_toDisplayString$z(_ctx.cancelText), 1 /* TEXT */)
]),
_: 1 /* STABLE */
}, 8 /* PROPS */, ["onClick"]))
: _createCommentVNode$v("v-if", true)
]),
_: 3 /* FORWARDED */
})
]),
_: 3 /* FORWARDED */
}, 16 /* FULL_PROPS */, ["class", "onTouchmove"]))
}
AtActionSheet.render = _sfc_render$X;
const AtActionSheetItem = defineComponent({
name: "AtActionSheetItem",
emits: ["click"],
setup(_, { emit }) {
function handleClick(e) {
emit("click", e);
}
return {
handleClick
};
}
});
// Binding optimization for webpack code-split
const _renderSlot$q = renderSlot, _resolveComponent$W = resolveComponent, _mergeProps$Q = mergeProps, _withCtx$V = withCtx, _openBlock$W = openBlock, _createBlock$W = createBlock;
function _sfc_render$W(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_view = _resolveComponent$W("taro-view");
return (_openBlock$W(), _createBlock$W(_component_taro_view, _mergeProps$Q(_ctx.$attrs, {
class: "at-action-sheet__item",
onTap: _ctx.handleClick
}), {
default: _withCtx$V(() => [
_renderSlot$q(_ctx.$slots, "default")
]),
_: 3 /* FORWARDED */
}, 16 /* FULL_PROPS */, ["onTap"]))
}
AtActionSheetItem.render = _sfc_render$W;
const AtLoading = defineComponent({
name: "AtLoading",
props: {
size: { type: [String, Number], default: 0 },
color: [String, Number]
},
setup(props) {
const loadingSize = computed(() => {
return pxTransform(parseInt(`${props.size}`));
});
const sizeStyle = computed(() => ({
width: loadingSize.value,
height: loadingSize.value
}));
const ringStyle = computed(() => ({
...sizeStyle.value,
border: props.color ? `1px solid ${props.color}` : "",
"border-color": props.color ? `${props.color} transparent transparent transparent` : ""
}));
return {
sizeStyle,
ringStyle
};
}
});
// Binding optimization for webpack code-split
const _renderList$i = renderList, _Fragment$i = Fragment, _openBlock$V = openBlock, _createElementBlock$i = createElementBlock, _resolveComponent$V = resolveComponent, _normalizeStyle$n = normalizeStyle, _createVNode$G = createVNode, _mergeProps$P = mergeProps, _withCtx$U = withCtx, _createBlock$V = createBlock;
function _sfc_render$V(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_view = _resolveComponent$V("taro-view");
return (_openBlock$V(), _createBlock$V(_component_taro_view, _mergeProps$P(_ctx.$attrs, {
class: "at-loading",
style: _ctx.sizeStyle
}), {
default: _withCtx$U(() => [
(_openBlock$V(), _createElementBlock$i(_Fragment$i, null, _renderList$i(3, (n) => {
return _createVNode$G(_component_taro_view, {
key: n,
style: _normalizeStyle$n(_ctx.ringStyle),
class: "at-loading__ring"
}, null, 8 /* PROPS */, ["style"])
}), 64 /* STABLE_FRAGMENT */))
]),
_: 1 /* STABLE */
}, 16 /* FULL_PROPS */, ["style"]))
}
AtLoading.render = _sfc_render$V;
const AtActivityIndicator = defineComponent({
name: "AtActivityIndicator",
components: {
AtLoading
},
props: {
size: {
type: Number,
default: 48
},
mode: {
type: String,
default: "normal"
},
color: {
type: String,
default: "#6190E8"
},
content: {
type: String,
default: ""
},
isOpened: {
type: Boolean,
default: true
}
},
setup(props) {
return { ...toRefs(props) };
}
});
// Binding optimization for webpack code-split
const _resolveComponent$U = resolveComponent, _createVNode$F = createVNode, _withCtx$T = withCtx, _toDisplayString$y = toDisplayString, _createTextVNode$y = createTextVNode, _openBlock$U = openBlock, _createBlock$U = createBlock, _createCommentVNode$u = createCommentVNode, _mergeProps$O = mergeProps;
function _sfc_render$U(_ctx, _cache, $props, $setup, $data, $options) {
const _component_at_loading = _resolveComponent$U("at-loading");
const _component_taro_view = _resolveComponent$U("taro-view");
const _component_taro_text = _resolveComponent$U("taro-text");
return (_openBlock$U(), _createBlock$U(_component_taro_view, _mergeProps$O(_ctx.$attrs, {
class: ['at-activity-indicator', {
'at-activity-indicator--center': _ctx.mode === 'center',
'at-activity-indicator--isopened': _ctx.isOpened
}]
}), {
default: _withCtx$T(() => [
_createVNode$F(_component_taro_view, { class: "at-activity-indicator__body" }, {
default: _withCtx$T(() => [
_createVNode$F(_component_at_loading, {
size: _ctx.size,
color: _ctx.color
}, null, 8 /* PROPS */, ["size", "color"])
]),
_: 1 /* STABLE */
}),
(_ctx.content)
? (_openBlock$U(), _createBlock$U(_component_taro_text, {
key: 0,
class: "at-activity-indicator__content"
}, {
default: _withCtx$T(() => [
_createTextVNode$y(_toDisplayString$y(_ctx.content), 1 /* TEXT */)
]),
_: 1 /* STABLE */
}))
: _createCommentVNode$u("v-if", true)
]),
_: 1 /* STABLE */
}, 16 /* FULL_PROPS */, ["class"]))
}
AtActivityIndicator.render = _sfc_render$U;
const SIZE_CLASS$2 = {
large: "large",
normal: "normal",
small: "small"
};
const AtAvatar = defineComponent({
name: "AtAvatar",
props: {
size: {
type: String,
default: "normal",
validator: (prop) => ["large", "normal", "small"].includes(prop)
},
circle: Boolean,
text: String,
image: String,
openData: Object
},
setup(props) {
const { isWEAPP } = getEnvs();
const letter = computed(() => {
return Boolean(props.text) ? String(props.text)[0] : "";
});
const iconSize = computed(() => {
let size = SIZE_CLASS$2[props.size];
if (!size) {
warn("Prop `size` must be one of <'large' | 'normal' | 'small'>", "\nActual: '", props.size, "', now use 'normal' instead!");
size = "normal";
}
return size;
});
return {
...toRefs(props),
isWEAPP,
letter,
iconSize
};
}
});
// Binding optimization for webpack code-split
const _resolveComponent$T = resolveComponent, _openBlock$T = openBlock, _createBlock$T = createBlock, _toDisplayString$x = toDisplayString, _createTextVNode$x = createTextVNode, _withCtx$S = withCtx, _mergeProps$N = mergeProps;
function _sfc_render$T(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_open_data = _resolveComponent$T("taro-open-data");
const _component_taro_image = _resolveComponent$T("taro-image");
const _component_taro_text = _resolveComponent$T("taro-text");
const _component_taro_view = _resolveComponent$T("taro-view");
return (_openBlock$T(), _createBlock$T(_component_taro_view, _mergeProps$N(_ctx.$attrs, {
class: ['at-avatar', {
'at-avatar--circle': _ctx.circle,
[`at-avatar--${_ctx.iconSize}`]: _ctx.iconSize,
}]
}), {
default: _withCtx$S(() => [
(_ctx.isWEAPP && _ctx.openData && _ctx.openData.type === 'userAvatarUrl')
? (_openBlock$T(), _createBlock$T(_component_taro_open_data, {
key: 0,
type: _ctx.openData.type
}, null, 8 /* PROPS */, ["type"]))
: (_ctx.image)
? (_openBlock$T(), _createBlock$T(_component_taro_image, {
key: 1,
class: "at-avatar__img",
src: _ctx.image
}, null, 8 /* PROPS */, ["src"]))
: (_openBlock$T(), _createBlock$T(_component_taro_text, {
key: 2,
class: "at-avatar__text"
}, {
default: _withCtx$S(() => [
_createTextVNode$x(_toDisplayString$x(_ctx.letter), 1 /* TEXT */)
]),
_: 1 /* STABLE */
}))
]),
_: 1 /* STABLE */
}, 16 /* FULL_PROPS */, ["class"]))
}
AtAvatar.render = _sfc_render$T;
const AtBadge = defineComponent({
name: "AtBadge",
props: {
dot: Boolean,
value: {
type: [String, Number],
default: ""
},
maxValue: {
type: Number,
default: 99
}
},
setup(props) {
const formatedValue = computed(() => formatValue(props.value, props.maxValue));
function formatValue(value, maxValue) {
if (!Boolean(value))
return "";
const numValue = +value;
if (Number.isNaN(numValue)) {
return value;
}
return numValue > maxValue ? `${maxValue}+` : numValue;
}
return {
dot: toRef(props, "dot"),
formatedValue
};
}
});
// Binding optimization for webpack code-split
const _renderSlot$p = renderSlot, _resolveComponent$S = resolveComponent, _openBlock$S = openBlock, _createBlock$S = createBlock, _createCommentVNode$t = createCommentVNode, _toDisplayString$w = toDisplayString, _createTextVNode$w = createTextVNode, _withCtx$R = withCtx, _mergeProps$M = mergeProps;
function _sfc_render$S(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_view = _resolveComponent$S("taro-view");
return (_openBlock$S(), _createBlock$S(_component_taro_view, _mergeProps$M(_ctx.$attrs, { class: "at-badge" }), {
default: _withCtx$R(() => [
_renderSlot$p(_ctx.$slots, "default"),
(_ctx.dot)
? (_openBlock$S(), _createBlock$S(_component_taro_view, {
key: 0,
class: "at-badge__dot"
}))
: (_ctx.formatedValue !== '')
? (_openBlock$S(), _createBlock$S(_component_taro_view, {
key: 1,
class: "at-badge__num"
}, {
default: _withCtx$R(() => [
_createTextVNode$w(_toDisplayString$w(_ctx.formatedValue), 1 /* TEXT */)
]),
_: 1 /* STABLE */
}))
: _createCommentVNode$t("v-if", true)
]),
_: 3 /* FORWARDED */
}, 16 /* FULL_PROPS */))
}
AtBadge.render = _sfc_render$S;
const SIZE_CLASS$1 = {
normal: "normal",
small: "small"
};
const TYPE_CLASS$1 = {
primary: "primary",
secondary: "secondary"
};
const AtButton = defineComponent({
name: "AtButton",
components: {
AtLoading
},
emits: [
"click",
"getUserInfo",
"getAuthorize",
"contact",
"getPhoneNumber",
"error",
"openSetting",
"launchapp"
],
props: {
size: {
type: String,
default: "normal",
validator: (prop) => ["normal", "small"].includes(prop)
},
type: {
type: String,
default: "",
validator: (prop) => ["primary", "secondary", ""].includes(prop)
},
circle: Boolean,
full: Boolean,
loading: Boolean,
disabled: Boolean,
formType: {
type: String,
default: "",
validator: (prop) => ["submit", "reset", ""].includes(prop)
},
openType: {
type: String,
validator: (prop) => [
"contact",
"contactShare",
"share",
"getAuthorize",
"getPhoneNumber",
"getUserInfo",
"lifestyle",
"launchApp",
"openSetting",
"feedback"
].includes(prop)
},
lang: {
type: String,
default: "en"
},
sessionFrom: String,
sendMessageTitle: String,
sendMessagePath: String,
sendMessageImg: String,
showMessageCard: Boolean,
appParameter: String,
scope: String
},
setup(props, { attrs, emit }) {
const { isWEAPP, isALIPAY, isWEB } = getEnvs();
const rootClasses = computed(() => ["at-button", {
[`at-button--${Object.keys(SIZE_CLASS$1).includes(props.size) ? props.size : "normal"}`]: Boolean(props.size),
[`at-button--${Object.keys(TYPE_CLASS$1).includes(props.type) ? props.type : "primary"}`]: Boolean(props.type),
"at-button--circle": props.circle,
"at-button--disabled": props.disabled,
"at-button--full": props.full,
"at-button--icon": props.loading
}]);
const loadingColor = computed(() => props.type === "primary" ? "#fff" : "");
const loadingSize = computed(() => props.size === "small" ? "30" : "0");
function handleClick(event) {
if (Boolean(attrs["onTap"])) {
warn("AtButton \u7ED1\u5B9A\u7684\u70B9\u51FB\u4E8B\u4EF6\u5E94\u4E3A `click`\uFF0C \u800C\u975E `tap`\u3002", '\u6B63\u786E\u793A\u4F8B\uFF1A`<at-button @click="eventHandler"/>`');
}
if (!props.disabled) {
emit("click", event);
}
}
function handleGetUserInfo(event) {
warn("2021 \u5E74 4 \u6708 13 \u65E5\u540E\u53D1\u5E03\u7684\u65B0\u7248\u672C\u5C0F\u7A0B\u5E8F\uFF0C", '\u5F00\u53D1\u8005\u8C03\u7528 `wx.getUserInfo` \u6216 `<button open-type="getUserInfo"/>` \u5C06\u4E0D\u518D\u5F39\u51FA\u5F39\u7A97\uFF0C', "\u76F4\u63A5\u8FD4\u56DE\u533F\u540D\u7684\u7528\u6237\u4E2A\u4EBA\u4FE1\u606F\u3002", "\u8BE6\u60C5\u89C1\uFF1Ahttps://developers.weixin.qq.com/community/develop/doc/000cacfa20ce88df04cb468bc52801?idescene=6&page=10,", "\u8BF7\u4F7F\u7528 `getUserProfile` \u8FDB\u884C\u9002\u914D\u3002");
emit("getUserInfo", event);
}
function handleGetPhoneNumber(event) {
emit("getPhoneNumber", event);
}
function handleOpenSetting(event) {
emit("openSetting", event);
}
function handleError(event) {
if (isWEAPP && props.openType !== "launchApp")
return;
emit("error", event);
}
function handleContact(event) {
emit("contact", event);
}
function handleLaunchapp(event) {
emit("launchapp", event);
}
function handleGetAuthorize(event) {
emit("getAuthorize", event);
}
function handleSubmit(event) {
if (isWEAPP || isWEB) {
Taro.eventCenter.trigger("submit", event.detail, {
bubbles: true,
composed: true
});
}
}
function handleReset(event) {
if (isWEAPP || isWEB) {
Taro.eventCenter.trigger("reset", event.detail, {
bubbles: true,
composed: true
});
}
}
function genMiniAppButtonEvents() {
if (!props.openType)
return {};
const miniAppButtonEvents = {
onError: handleError
};
switch (props.openType) {
case "contact":
miniAppButtonEvents.onContact = handleContact;
break;
case "openSetting":
miniAppButtonEvents.onOpensetting = handleOpenSetting;
break;
case "getPhoneNumber":
miniAppButtonEvents.onGetphonenumber = handleGetPhoneNumber;
break;
case "getUserInfo":
miniAppButtonEvents.onGetuserinfo = handleGetUserInfo;
break;
case "getAuthorize":
if (isALIPAY) {
miniAppButtonEvents.onGetauthorize = handleGetAuthorize;
}
break;
case "launchApp":
miniAppButtonEvents.onLaunchapp = handleLaunchapp;
break;
}
return miniAppButtonEvents;
}
return {
...toRefs(props),
isWEB,
isWEAPP,
isALIPAY,
rootClasses,
loadingSize,
loadingColor,
handleClick,
handleReset,
handleSubmit,
genMiniAppButtonEvents
};
}
});
// Binding optimization for webpack code-split
const _resolveComponent$R = resolveComponent, _openBlock$R = openBlock, _createBlock$R = createBlock, _createCommentVNode$s = createCommentVNode, _mergeProps$L = mergeProps, _createVNode$E = createVNode, _withCtx$Q = withCtx, _renderSlot$o = renderSlot;
function _sfc_render$R(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_button = _resolveComponent$R("taro-button");
const _component_taro_form = _resolveComponent$R("taro-form");
const _component_at_loading = _resolveComponent$R("at-loading");
const _component_taro_view = _resolveComponent$R("taro-view");
return (_openBlock$R(), _createBlock$R(_component_taro_view, _mergeProps$L(_ctx.$attrs, {
class: _ctx.rootClasses,
onTap: _ctx.handleClick
}), {
default: _withCtx$Q(() => [
(_ctx.isWEB && !_ctx.disabled)
? (_openBlock$R(), _createBlock$R(_component_taro_button, {
key: 0,
class: "at-button__wxbutton",
lang: "lang",
formType: _ctx.formType === 'submit' || _ctx.formType === 'reset' ? _ctx.formType : undefined
}, null, 8 /* PROPS */, ["formType"]))
: _createCommentVNode$s("v-if", true),
(_ctx.isWEAPP && !_ctx.disabled)
? (_openBlock$R(), _createBlock$R(_component_taro_form, {
key: 1,
onSubmit: _ctx.handleSubmit,
onReset: _ctx.handleReset
}, {
default: _withCtx$Q(() => [
_createVNode$E(_component_taro_button, _mergeProps$L({
class: "at-button__wxbutton",
lang: _ctx.lang,
formType: _ctx.formType,
openType: _ctx.openType,
sessionFrom: _ctx.sessionFrom,
appParameter: _ctx.appParameter,
sendMessageImg: _ctx.sendMessageImg,
showMessageCard: _ctx.showMessageCard,
sendMessagePath: _ctx.sendMessagePath,
sendMessageTitle: _ctx.sendMessageTitle
}, _ctx.genMiniAppButtonEvents()), null, 16 /* FULL_PROPS */, ["lang", "formType", "openType", "sessionFrom", "appParameter", "sendMessageImg", "showMessageCard", "sendMessagePath", "sendMessageTitle"])
]),
_: 1 /* STABLE */
}, 8 /* PROPS */, ["onSubmit", "onReset"]))
: _createCommentVNode$s("v-if", true),
(_ctx.isALIPAY && !_ctx.disabled)
? (_openBlock$R(), _createBlock$R(_component_taro_button, _mergeProps$L({
key: 2,
class: "at-button__wxbutton",
lang: _ctx.lang,
scope: _ctx.scope,
formType: _ctx.formType,
openType: _ctx.openType
}, _ctx.genMiniAppButtonEvents()), null, 16 /* FULL_PROPS */, ["lang", "scope", "formType", "openType"]))
: _createCommentVNode$s("v-if", true),
(_ctx.loading)
? (_openBlock$R(), _createBlock$R(_component_taro_view, {
key: 3,
class: "at-button__icon"
}, {
default: _withCtx$Q(() => [
_createVNode$E(_component_at_loading, {
size: _ctx.loadingSize,
color: _ctx.loadingColor
}, null, 8 /* PROPS */, ["size", "color"])
]),
_: 1 /* STABLE */
}))
: _createCommentVNode$s("v-if", true),
_createVNode$E(_component_taro_view, { class: "at-button__text" }, {
default: _withCtx$Q(() => [
_renderSlot$o(_ctx.$slots, "default")
]),
_: 3 /* FORWARDED */
})
]),
_: 3 /* FORWARDED */
}, 16 /* FULL_PROPS */, ["class", "onTap"]))
}
AtButton.render = _sfc_render$R;
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
var dayjs_min = {exports: {}};
(function (module, exports) {
!function(t,e){module.exports=e();}(commonjsGlobal,function(){var t="millisecond",e="second",n="minute",r="hour",i="day",s="week",u="month",a="quarter",o="year",f="date",h=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[^0-9]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,c=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,d={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_")},$=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},l={s:$,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+$(r,2,"0")+":"+$(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,u),s=n-i<0,a=e.clone().add(r+(s?-1:1),u);return +(-(r+(n-i)/(s?i-a:a-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(h){return {M:u,y:o,w:s,d:i,D:f,h:r,m:n,s:e,ms:t,Q:a}[h]||String(h||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},y="en",M={};M[y]=d;var m=function(t){return t instanceof S},D=function(t,e,n){var r;if(!t)return y;if("string"==typeof t)M[t]&&(r=t),e&&(M[t]=e,r=t);else {var i=t.name;M[i]=t,r=i;}return !n&&r&&(y=r),r||!n&&y},v=function(t,e){if(m(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new S(n)},g=l;g.l=D,g.i=m,g.w=function(t,e){return v(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var S=function(){function d(t){this.$L=D(t.locale,null,!0),this.parse(t);}var $=d.prototype;return $.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(g.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match(h);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.$x=t.x||{},this.init();},$.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},$.$utils=function(){return g},$.isValid=function(){return !("Invalid Date"===this.$d.toString())},$.isSame=function(t,e){var n=v(t);return this.startOf(e)<=n&&n<=this.endOf(e)},$.isAfter=function(t,e){return v(t)<this.startOf(e)},$.isBefore=function(t,e){return this.endOf(e)<v(t)},$.$g=function(t,e,n){return g.u(t)?this[e]:this.set(n,t)},$.unix=function(){return Math.floor(this.valueOf()/1e3)},$.valueOf=function(){return this.$d.getTime()},$.startOf=function(t,a){var h=this,c=!!g.u(a)||a,d=g.p(t),$=function(t,e){var n=g.w(h.$u?Date.UTC(h.$y,e,t):new Date(h.$y,e,t),h);return c?n:n.endOf(i)},l=function(t,e){return g.w(h.toDate()[t].apply(h.toDate("s"),(c?[0,0,0,0]:[23,59,59,999]).slice(e)),h)},y=this.$W,M=this.$M,m=this.$D,D="set"+(this.$u?"UTC":"");switch(d){case o:return c?$(1,0):$(31,11);case u:return c?$(1,M):$(0,M+1);case s:var v=this.$locale().weekStart||0,S=(y<v?y+7:y)-v;return $(c?m-S:m+(6-S),M);case i:case f:return l(D+"Hours",0);case r:return l(D+"Minutes",1);case n:return l(D+"Seconds",2);case e:return l(D+"Milliseconds",3);default:return this.clone()}},$.endOf=function(t){return this.startOf(t,!1)},$.$set=function(s,a){var h,c=g.p(s),d="set"+(this.$u?"UTC":""),$=(h={},h[i]=d+"Date",h[f]=d+"Date",h[u]=d+"Month",h[o]=d+"FullYear",h[r]=d+"Hours",h[n]=d+"Minutes",h[e]=d+"Seconds",h[t]=d+"Milliseconds",h)[c],l=c===i?this.$D+(a-this.$W):a;if(c===u||c===o){var y=this.clone().set(f,1);y.$d[$](l),y.init(),this.$d=y.set(f,Math.min(this.$D,y.daysInMonth())).$d;}else $&&this.$d[$](l);return this.init(),this},$.set=function(t,e){return this.clone().$set(t,e)},$.get=function(t){return this[g.p(t)]()},$.add=function(t,a){var f,h=this;t=Number(t);var c=g.p(a),d=function(e){var n=v(h);return g.w(n.date(n.date()+Math.round(e*t)),h)};if(c===u)return this.set(u,this.$M+t);if(c===o)return this.set(o,this.$y+t);if(c===i)return d(1);if(c===s)return d(7);var $=(f={},f[n]=6e4,f[r]=36e5,f[e]=1e3,f)[c]||1,l=this.$d.getTime()+t*$;return g.w(l,this)},$.subtract=function(t,e){return this.add(-1*t,e)},$.format=function(t){var e=this;if(!this.isValid())return "Invalid Date";var n=t||"YYYY-MM-DDTHH:mm:ssZ",r=g.z(this),i=this.$locale(),s=this.$H,u=this.$m,a=this.$M,o=i.weekdays,f=i.months,h=function(t,r,i,s){return t&&(t[r]||t(e,n))||i[r].substr(0,s)},d=function(t){return g.s(s%12||12,t,"0")},$=i.meridiem||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r},l={YY:String(this.$y).slice(-2),YYYY:this.$y,M:a+1,MM:g.s(a+1,2,"0"),MMM:h(i.monthsShort,a,f,3),MMMM:h(f,a),D:this.$D,DD:g.s(this.$D,2,"0"),d:String(this.$W),dd:h(i.weekdaysMin,this.$W,o,2),ddd:h(i.weekdaysShort,this.$W,o,3),dddd:o[this.$W],H:String(s),HH:g.s(s,2,"0"),h:d(1),hh:d(2),a:$(s,u,!0),A:$(s,u,!1),m:String(u),mm:g.s(u,2,"0"),s:String(this.$s),ss:g.s(this.$s,2,"0"),SSS:g.s(this.$ms,3,"0"),Z:r};return n.replace(c,function(t,e){return e||l[t]||r.replace(":","")})},$.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},$.diff=function(t,f,h){var c,d=g.p(f),$=v(t),l=6e4*($.utcOffset()-this.utcOffset()),y=this-$,M=g.m(this,$);return M=(c={},c[o]=M/12,c[u]=M,c[a]=M/3,c[s]=(y-l)/6048e5,c[i]=(y-l)/864e5,c[r]=y/36e5,c[n]=y/6e4,c[e]=y/1e3,c)[d]||y,h?M:g.a(M)},$.daysInMonth=function(){return this.endOf(u).$D},$.$locale=function(){return M[this.$L]},$.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=D(t,e,!0);return r&&(n.$L=r),n},$.clone=function(){return g.w(this.$d,this)},$.toDate=function(){return new Date(this.valueOf())},$.toJSON=function(){return this.isValid()?this.toISOString():null},$.toISOString=function(){return this.$d.toISOString()},$.toString=function(){return this.$d.toUTCString()},d}(),p=S.prototype;return v.prototype=p,[["$ms",t],["$s",e],["$m",n],["$H",r],["$W",i],["$M",u],["$y",o],["$D",f]].forEach(function(t){p[t[1]]=function(e){return this.$g(e,t[0],t[1])};}),v.extend=function(t,e){return t.$i||(t(e,S,v),t.$i=!0),v},v.locale=D,v.isDayjs=m,v.unix=function(t){return v(1e3*t)},v.en=M[y],v.Ls=M,v.p={},v});
}(dayjs_min));
var dayjs$1 = dayjs_min.exports;
var SECONDS_A_MINUTE = 60;
var SECONDS_A_HOUR = SECONDS_A_MINUTE * 60;
var SECONDS_A_DAY = SECONDS_A_HOUR * 24;
var SECONDS_A_WEEK = SECONDS_A_DAY * 7;
var MILLISECONDS_A_SECOND = 1e3;
var MILLISECONDS_A_MINUTE = SECONDS_A_MINUTE * MILLISECONDS_A_SECOND;
var MILLISECONDS_A_HOUR = SECONDS_A_HOUR * MILLISECONDS_A_SECOND;
var MILLISECONDS_A_DAY = SECONDS_A_DAY * MILLISECONDS_A_SECOND;
var MILLISECONDS_A_WEEK = SECONDS_A_WEEK * MILLISECONDS_A_SECOND; // English locales
var MS = 'millisecond';
var S = 'second';
var MIN = 'minute';
var H = 'hour';
var D = 'day';
var W = 'week';
var M = 'month';
var Q = 'quarter';
var Y = 'year';
var DATE = 'date';
var FORMAT_DEFAULT = 'YYYY-MM-DDTHH:mm:ssZ';
var INVALID_DATE_STRING = 'Invalid Date'; // regex
var REGEX_PARSE = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[^0-9]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/;
var REGEX_FORMAT = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g;
// English [en]
// We don't need weekdaysShort, weekdaysMin, monthsShort in en.js locale
var en = {
name: 'en',
weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'),
months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_')
};
var padStart = function padStart(string, length, pad) {
var s = String(string);
if (!s || s.length >= length) return string;
return "" + Array(length + 1 - s.length).join(pad) + string;
};
var padZoneStr = function padZoneStr(instance) {
var negMinutes = -instance.utcOffset();
var minutes = Math.abs(negMinutes);
var hourOffset = Math.floor(minutes / 60);
var minuteOffset = minutes % 60;
return "" + (negMinutes <= 0 ? '+' : '-') + padStart(hourOffset, 2, '0') + ":" + padStart(minuteOffset, 2, '0');
};
var monthDiff = function monthDiff(a, b) {
// function from moment.js in order to keep the same result
if (a.date() < b.date()) return -monthDiff(b, a);
var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month());
var anchor = a.clone().add(wholeMonthDiff, M);
var c = b - anchor < 0;
var anchor2 = a.clone().add(wholeMonthDiff + (c ? -1 : 1), M);
return +(-(wholeMonthDiff + (b - anchor) / (c ? anchor - anchor2 : anchor2 - anchor)) || 0);
};
var absFloor = function absFloor(n) {
return n < 0 ? Math.ceil(n) || 0 : Math.floor(n);
};
var prettyUnit = function prettyUnit(u) {
var special = {
M: M,
y: Y,
w: W,
d: D,
D: DATE,
h: H,
m: MIN,
s: S,
ms: MS,
Q: Q
};
return special[u] || String(u || '').toLowerCase().replace(/s$/, '');
};
var isUndefined = function isUndefined(s) {
return s === undefined;
};
var U = {
s: padStart,
z: padZoneStr,
m: monthDiff,
a: absFloor,
p: prettyUnit,
u: isUndefined
};
var L = 'en'; // global locale
var Ls = {}; // global loaded locale
Ls[L] = en;
var isDayjs = function isDayjs(d) {
return d instanceof Dayjs;
}; // eslint-disable-line no-use-before-define
var parseLocale = function parseLocale(preset, object, isLocal) {
var l;
if (!preset) return L;
if (typeof preset === 'string') {
if (Ls[preset]) {
l = preset;
}
if (object) {
Ls[preset] = object;
l = preset;
}
} else {
var name = preset.name;
Ls[name] = preset;
l = name;
}
if (!isLocal && l) L = l;
return l || !isLocal && L;
};
var dayjs = function dayjs(date, c) {
if (isDayjs(date)) {
return date.clone();
} // eslint-disable-next-line no-nested-ternary
var cfg = typeof c === 'object' ? c : {};
cfg.date = date;
cfg.args = arguments; // eslint-disable-line prefer-rest-params
return new Dayjs(cfg); // eslint-disable-line no-use-before-define
};
var wrapper = function wrapper(date, instance) {
return dayjs(date, {
locale: instance.$L,
utc: instance.$u,
x: instance.$x,
$offset: instance.$offset // todo: refactor; do not use this.$offset in you code
});
};
var Utils = U; // for plugin use
Utils.l = parseLocale;
Utils.i = isDayjs;
Utils.w = wrapper;
var parseDate = function parseDate(cfg) {
var date = cfg.date,
utc = cfg.utc;
if (date === null) return new Date(NaN); // null is invalid
if (Utils.u(date)) return new Date(); // today
if (date instanceof Date) return new Date(date);
if (typeof date === 'string' && !/Z$/i.test(date)) {
var d = date.match(REGEX_PARSE);
if (d) {
var m = d[2] - 1 || 0;
var ms = (d[7] || '0').substring(0, 3);
if (utc) {
return new Date(Date.UTC(d[1], m, d[3] || 1, d[4] || 0, d[5] || 0, d[6] || 0, ms));
}
return new Date(d[1], m, d[3] || 1, d[4] || 0, d[5] || 0, d[6] || 0, ms);
}
}
return new Date(date); // everything else
};
var Dayjs = /*#__PURE__*/function () {
function Dayjs(cfg) {
this.$L = parseLocale(cfg.locale, null, true);
this.parse(cfg); // for plugin
}
var _proto = Dayjs.prototype;
_proto.parse = function parse(cfg) {
this.$d = parseDate(cfg);
this.$x = cfg.x || {};
this.init();
};
_proto.init = function init() {
var $d = this.$d;
this.$y = $d.getFullYear();
this.$M = $d.getMonth();
this.$D = $d.getDate();
this.$W = $d.getDay();
this.$H = $d.getHours();
this.$m = $d.getMinutes();
this.$s = $d.getSeconds();
this.$ms = $d.getMilliseconds();
} // eslint-disable-next-line class-methods-use-this
;
_proto.$utils = function $utils() {
return Utils;
};
_proto.isValid = function isValid() {
return !(this.$d.toString() === INVALID_DATE_STRING);
};
_proto.isSame = function isSame(that, units) {
var other = dayjs(that);
return this.startOf(units) <= other && other <= this.endOf(units);
};
_proto.isAfter = function isAfter(that, units) {
return dayjs(that) < this.startOf(units);
};
_proto.isBefore = function isBefore(that, units) {
return this.endOf(units) < dayjs(that);
};
_proto.$g = function $g(input, get, set) {
if (Utils.u(input)) return this[get];
return this.set(set, input);
};
_proto.unix = function unix() {
return Math.floor(this.valueOf() / 1000);
};
_proto.valueOf = function valueOf() {
// timezone(hour) * 60 * 60 * 1000 => ms
return this.$d.getTime();
};
_proto.startOf = function startOf(units, _startOf) {
var _this = this;
// startOf -> endOf
var isStartOf = !Utils.u(_startOf) ? _startOf : true;
var unit = Utils.p(units);
var instanceFactory = function instanceFactory(d, m) {
var ins = Utils.w(_this.$u ? Date.UTC(_this.$y, m, d) : new Date(_this.$y, m, d), _this);
return isStartOf ? ins : ins.endOf(D);
};
var instanceFactorySet = function instanceFactorySet(method, slice) {
var argumentStart = [0, 0, 0, 0];
var argumentEnd = [23, 59, 59, 999];
return Utils.w(_this.toDate()[method].apply( // eslint-disable-line prefer-spread
_this.toDate('s'), (isStartOf ? argumentStart : argumentEnd).slice(slice)), _this);
};
var $W = this.$W,
$M = this.$M,
$D = this.$D;
var utcPad = "set" + (this.$u ? 'UTC' : '');
switch (unit) {
case Y:
return isStartOf ? instanceFactory(1, 0) : instanceFactory(31, 11);
case M:
return isStartOf ? instanceFactory(1, $M) : instanceFactory(0, $M + 1);
case W:
{
var weekStart = this.$locale().weekStart || 0;
var gap = ($W < weekStart ? $W + 7 : $W) - weekStart;
return instanceFactory(isStartOf ? $D - gap : $D + (6 - gap), $M);
}
case D:
case DATE:
return instanceFactorySet(utcPad + "Hours", 0);
case H:
return instanceFactorySet(utcPad + "Minutes", 1);
case MIN:
return instanceFactorySet(utcPad + "Seconds", 2);
case S:
return instanceFactorySet(utcPad + "Milliseconds", 3);
default:
return this.clone();
}
};
_proto.endOf = function endOf(arg) {
return this.startOf(arg, false);
};
_proto.$set = function $set(units, _int) {
var _C$D$C$DATE$C$M$C$Y$C;
// private set
var unit = Utils.p(units);
var utcPad = "set" + (this.$u ? 'UTC' : '');
var name = (_C$D$C$DATE$C$M$C$Y$C = {}, _C$D$C$DATE$C$M$C$Y$C[D] = utcPad + "Date", _C$D$C$DATE$C$M$C$Y$C[DATE] = utcPad + "Date", _C$D$C$DATE$C$M$C$Y$C[M] = utcPad + "Month", _C$D$C$DATE$C$M$C$Y$C[Y] = utcPad + "FullYear", _C$D$C$DATE$C$M$C$Y$C[H] = utcPad + "Hours", _C$D$C$DATE$C$M$C$Y$C[MIN] = utcPad + "Minutes", _C$D$C$DATE$C$M$C$Y$C[S] = utcPad + "Seconds", _C$D$C$DATE$C$M$C$Y$C[MS] = utcPad + "Milliseconds", _C$D$C$DATE$C$M$C$Y$C)[unit];
var arg = unit === D ? this.$D + (_int - this.$W) : _int;
if (unit === M || unit === Y) {
// clone is for badMutable plugin
var date = this.clone().set(DATE, 1);
date.$d[name](arg);
date.init();
this.$d = date.set(DATE, Math.min(this.$D, date.daysInMonth())).$d;
} else if (name) this.$d[name](arg);
this.init();
return this;
};
_proto.set = function set(string, _int2) {
return this.clone().$set(string, _int2);
};
_proto.get = function get(unit) {
return this[Utils.p(unit)]();
};
_proto.add = function add(number, units) {
var _this2 = this,
_C$MIN$C$H$C$S$unit;
number = Number(number); // eslint-disable-line no-param-reassign
var unit = Utils.p(units);
var instanceFactorySet = function instanceFactorySet(n) {
var d = dayjs(_this2);
return Utils.w(d.date(d.date() + Math.round(n * number)), _this2);
};
if (unit === M) {
return this.set(M, this.$M + number);
}
if (unit === Y) {
return this.set(Y, this.$y + number);
}
if (unit === D) {
return instanceFactorySet(1);
}
if (unit === W) {
return instanceFactorySet(7);
}
var step = (_C$MIN$C$H$C$S$unit = {}, _C$MIN$C$H$C$S$unit[MIN] = MILLISECONDS_A_MINUTE, _C$MIN$C$H$C$S$unit[H] = MILLISECONDS_A_HOUR, _C$MIN$C$H$C$S$unit[S] = MILLISECONDS_A_SECOND, _C$MIN$C$H$C$S$unit)[unit] || 1; // ms
var nextTimeStamp = this.$d.getTime() + number * step;
return Utils.w(nextTimeStamp, this);
};
_proto.subtract = function subtract(number, string) {
return this.add(number * -1, string);
};
_proto.format = function format(formatStr) {
var _this3 = this;
if (!this.isValid()) return INVALID_DATE_STRING;
var str = formatStr || FORMAT_DEFAULT;
var zoneStr = Utils.z(this);
var locale = this.$locale();
var $H = this.$H,
$m = this.$m,
$M = this.$M;
var weekdays = locale.weekdays,
months = locale.months,
meridiem = locale.meridiem;
var getShort = function getShort(arr, index, full, length) {
return arr && (arr[index] || arr(_this3, str)) || full[index].substr(0, length);
};
var get$H = function get$H(num) {
return Utils.s($H % 12 || 12, num, '0');
};
var meridiemFunc = meridiem || function (hour, minute, isLowercase) {
var m = hour < 12 ? 'AM' : 'PM';
return isLowercase ? m.toLowerCase() : m;
};
var matches = {
YY: String(this.$y).slice(-2),
YYYY: this.$y,
M: $M + 1,
MM: Utils.s($M + 1, 2, '0'),
MMM: getShort(locale.monthsShort, $M, months, 3),
MMMM: getShort(months, $M),
D: this.$D,
DD: Utils.s(this.$D, 2, '0'),
d: String(this.$W),
dd: getShort(locale.weekdaysMin, this.$W, weekdays, 2),
ddd: getShort(locale.weekdaysShort, this.$W, weekdays, 3),
dddd: weekdays[this.$W],
H: String($H),
HH: Utils.s($H, 2, '0'),
h: get$H(1),
hh: get$H(2),
a: meridiemFunc($H, $m, true),
A: meridiemFunc($H, $m, false),
m: String($m),
mm: Utils.s($m, 2, '0'),
s: String(this.$s),
ss: Utils.s(this.$s, 2, '0'),
SSS: Utils.s(this.$ms, 3, '0'),
Z: zoneStr // 'ZZ' logic below
};
return str.replace(REGEX_FORMAT, function (match, $1) {
return $1 || matches[match] || zoneStr.replace(':', '');
}); // 'ZZ'
};
_proto.utcOffset = function utcOffset() {
// Because a bug at FF24, we're rounding the timezone offset around 15 minutes
// https://github.com/moment/moment/pull/1871
return -Math.round(this.$d.getTimezoneOffset() / 15) * 15;
};
_proto.diff = function diff(input, units, _float) {
var _C$Y$C$M$C$Q$C$W$C$D$;
var unit = Utils.p(units);
var that = dayjs(input);
var zoneDelta = (that.utcOffset() - this.utcOffset()) * MILLISECONDS_A_MINUTE;
var diff = this - that;
var result = Utils.m(this, that);
result = (_C$Y$C$M$C$Q$C$W$C$D$ = {}, _C$Y$C$M$C$Q$C$W$C$D$[Y] = result / 12, _C$Y$C$M$C$Q$C$W$C$D$[M] = result, _C$Y$C$M$C$Q$C$W$C$D$[Q] = result / 3, _C$Y$C$M$C$Q$C$W$C$D$[W] = (diff - zoneDelta) / MILLISECONDS_A_WEEK, _C$Y$C$M$C$Q$C$W$C$D$[D] = (diff - zoneDelta) / MILLISECONDS_A_DAY, _C$Y$C$M$C$Q$C$W$C$D$[H] = diff / MILLISECONDS_A_HOUR, _C$Y$C$M$C$Q$C$W$C$D$[MIN] = diff / MILLISECONDS_A_MINUTE, _C$Y$C$M$C$Q$C$W$C$D$[S] = diff / MILLISECONDS_A_SECOND, _C$Y$C$M$C$Q$C$W$C$D$)[unit] || diff; // milliseconds
return _float ? result : Utils.a(result);
};
_proto.daysInMonth = function daysInMonth() {
return this.endOf(M).$D;
};
_proto.$locale = function $locale() {
// get locale object
return Ls[this.$L];
};
_proto.locale = function locale(preset, object) {
if (!preset) return this.$L;
var that = this.clone();
var nextLocaleName = parseLocale(preset, object, true);
if (nextLocaleName) that.$L = nextLocaleName;
return that;
};
_proto.clone = function clone() {
return Utils.w(this.$d, this);
};
_proto.toDate = function toDate() {
return new Date(this.valueOf());
};
_proto.toJSON = function toJSON() {
return this.isValid() ? this.toISOString() : null;
};
_proto.toISOString = function toISOString() {
// ie 8 return
// new Dayjs(this.valueOf() + this.$d.getTimezoneOffset() * 60000)
// .format('YYYY-MM-DDTHH:mm:ss.SSS[Z]')
return this.$d.toISOString();
};
_proto.toString = function toString() {
return this.$d.toUTCString();
};
return Dayjs;
}();
var proto = Dayjs.prototype;
dayjs.prototype = proto;
[['$ms', MS], ['$s', S], ['$m', MIN], ['$H', H], ['$W', D], ['$M', M], ['$y', Y], ['$D', DATE]].forEach(function (g) {
proto[g[1]] = function (input) {
return this.$g(input, g[0], g[1]);
};
});
dayjs.extend = function (plugin, option) {
if (!plugin.$i) {
// install plugin only once
plugin(option, Dayjs, dayjs);
plugin.$i = true;
}
return dayjs;
};
dayjs.locale = parseLocale;
dayjs.isDayjs = isDayjs;
dayjs.unix = function (timestamp) {
return dayjs(timestamp * 1e3);
};
dayjs.en = Ls[L];
dayjs.Ls = Ls;
dayjs.p = {};
/**
* Checks if `value` is the
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
* @example
*
* _.isObject({});
* // => true
*
* _.isObject([1, 2, 3]);
* // => true
*
* _.isObject(_.noop);
* // => true
*
* _.isObject(null);
* // => false
*/
function isObject$4(value) {
var type = typeof value;
return value != null && (type == 'object' || type == 'function');
}
/** Built-in value references. */
var objectCreate = Object.create;
/**
* The base implementation of `_.create` without support for assigning
* properties to the created object.
*
* @private
* @param {Object} proto The object to inherit from.
* @returns {Object} Returns the new object.
*/
var baseCreate = (function() {
function object() {}
return function(proto) {
if (!isObject$4(proto)) {
return {};
}
if (objectCreate) {
return objectCreate(proto);
}
object.prototype = proto;
var result = new object;
object.prototype = undefined;
return result;
};
}());
/**
* The function whose prototype chain sequence wrappers inherit from.
*
* @private
*/
function baseLodash() {
// No operation performed.
}
/**
* The base constructor for creating `lodash` wrapper objects.
*
* @private
* @param {*} value The value to wrap.
* @param {boolean} [chainAll] Enable explicit method chain sequences.
*/
function LodashWrapper(value, chainAll) {
this.__wrapped__ = value;
this.__actions__ = [];
this.__chain__ = !!chainAll;
this.__index__ = 0;
this.__values__ = undefined;
}
LodashWrapper.prototype = baseCreate(baseLodash.prototype);
LodashWrapper.prototype.constructor = LodashWrapper;
/**
* Appends the elements of `values` to `array`.
*
* @private
* @param {Array} array The array to modify.
* @param {Array} values The values to append.
* @returns {Array} Returns `array`.
*/
function arrayPush(array, values) {
var index = -1,
length = values.length,
offset = array.length;
while (++index < length) {
array[offset + index] = values[index];
}
return array;
}
/** Detect free variable `global` from Node.js. */
var freeGlobal$2 = typeof global == 'object' && global && global.Object === Object && global;
/** Detect free variable `self`. */
var freeSelf$1 = typeof self == 'object' && self && self.Object === Object && self;
/** Used as a reference to the global object. */
var root$2 = freeGlobal$2 || freeSelf$1 || Function('return this')();
/** Built-in value references. */
var Symbol$4 = root$2.Symbol;
/** Used for built-in method references. */
var objectProto$a = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$7 = objectProto$a.hasOwnProperty;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var nativeObjectToString$3 = objectProto$a.toString;
/** Built-in value references. */
var symToStringTag$3 = Symbol$4 ? Symbol$4.toStringTag : undefined;
/**
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the raw `toStringTag`.
*/
function getRawTag$2(value) {
var isOwn = hasOwnProperty$7.call(value, symToStringTag$3),
tag = value[symToStringTag$3];
try {
value[symToStringTag$3] = undefined;
var unmasked = true;
} catch (e) {}
var result = nativeObjectToString$3.call(value);
if (unmasked) {
if (isOwn) {
value[symToStringTag$3] = tag;
} else {
delete value[symToStringTag$3];
}
}
return result;
}
/** Used for built-in method references. */
var objectProto$9 = Object.prototype;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var nativeObjectToString$2 = objectProto$9.toString;
/**
* Converts `value` to a string using `Object.prototype.toString`.
*
* @private
* @param {*} value The value to convert.
* @returns {string} Returns the converted string.
*/
function objectToString$2(value) {
return nativeObjectToString$2.call(value);
}
/** `Object#toString` result references. */
var nullTag$1 = '[object Null]',
undefinedTag$1 = '[object Undefined]';
/** Built-in value references. */
var symToStringTag$2 = Symbol$4 ? Symbol$4.toStringTag : undefined;
/**
* The base implementation of `getTag` without fallbacks for buggy environments.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
function baseGetTag$3(value) {
if (value == null) {
return value === undefined ? undefinedTag$1 : nullTag$1;
}
return (symToStringTag$2 && symToStringTag$2 in Object(value))
? getRawTag$2(value)
: objectToString$2(value);
}
/**
* Checks if `value` is object-like. A value is object-like if it's not `null`
* and has a `typeof` result of "object".
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
* @example
*
* _.isObjectLike({});
* // => true
*
* _.isObjectLike([1, 2, 3]);
* // => true
*
* _.isObjectLike(_.noop);
* // => false
*
* _.isObjectLike(null);
* // => false
*/
function isObjectLike$2(value) {
return value != null && typeof value == 'object';
}
/** `Object#toString` result references. */
var argsTag$1 = '[object Arguments]';
/**
* The base implementation of `_.isArguments`.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
*/
function baseIsArguments(value) {
return isObjectLike$2(value) && baseGetTag$3(value) == argsTag$1;
}
/** Used for built-in method references. */
var objectProto$8 = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$6 = objectProto$8.hasOwnProperty;
/** Built-in value references. */
var propertyIsEnumerable = objectProto$8.propertyIsEnumerable;
/**
* Checks if `value` is likely an `arguments` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
* else `false`.
* @example
*
* _.isArguments(function() { return arguments; }());
* // => true
*
* _.isArguments([1, 2, 3]);
* // => false
*/
var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
return isObjectLike$2(value) && hasOwnProperty$6.call(value, 'callee') &&
!propertyIsEnumerable.call(value, 'callee');
};
/**
* Checks if `value` is classified as an `Array` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
* @example
*
* _.isArray([1, 2, 3]);
* // => true
*
* _.isArray(document.body.children);
* // => false
*
* _.isArray('abc');
* // => false
*
* _.isArray(_.noop);
* // => false
*/
var isArray = Array.isArray;
/** Built-in value references. */
var spreadableSymbol = Symbol$4 ? Symbol$4.isConcatSpreadable : undefined;
/**
* Checks if `value` is a flattenable `arguments` object or array.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
*/
function isFlattenable(value) {
return isArray(value) || isArguments(value) ||
!!(spreadableSymbol && value && value[spreadableSymbol]);
}
/**
* The base implementation of `_.flatten` with support for restricting flattening.
*
* @private
* @param {Array} array The array to flatten.
* @param {number} depth The maximum recursion depth.
* @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
* @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
* @param {Array} [result=[]] The initial result value.
* @returns {Array} Returns the new flattened array.
*/
function baseFlatten(array, depth, predicate, isStrict, result) {
var index = -1,
length = array.length;
predicate || (predicate = isFlattenable);
result || (result = []);
while (++index < length) {
var value = array[index];
if (depth > 0 && predicate(value)) {
if (depth > 1) {
// Recursively flatten arrays (susceptible to call stack limits).
baseFlatten(value, depth - 1, predicate, isStrict, result);
} else {
arrayPush(result, value);
}
} else if (!isStrict) {
result[result.length] = value;
}
}
return result;
}
/**
* Flattens `array` a single level deep.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Array
* @param {Array} array The array to flatten.
* @returns {Array} Returns the new flattened array.
* @example
*
* _.flatten([1, [2, [3, [4]], 5]]);
* // => [1, 2, [3, [4]], 5]
*/
function flatten(array) {
var length = array == null ? 0 : array.length;
return length ? baseFlatten(array, 1) : [];
}
/**
* A faster alternative to `Function#apply`, this function invokes `func`
* with the `this` binding of `thisArg` and the arguments of `args`.
*
* @private
* @param {Function} func The function to invoke.
* @param {*} thisArg The `this` binding of `func`.
* @param {Array} args The arguments to invoke `func` with.
* @returns {*} Returns the result of `func`.
*/
function apply(func, thisArg, args) {
switch (args.length) {
case 0: return func.call(thisArg);
case 1: return func.call(thisArg, args[0]);
case 2: return func.call(thisArg, args[0], args[1]);
case 3: return func.call(thisArg, args[0], args[1], args[2]);
}
return func.apply(thisArg, args);
}
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMax$2 = Math.max;
/**
* A specialized version of `baseRest` which transforms the rest array.
*
* @private
* @param {Function} func The function to apply a rest parameter to.
* @param {number} [start=func.length-1] The start position of the rest parameter.
* @param {Function} transform The rest array transform.
* @returns {Function} Returns the new function.
*/
function overRest(func, start, transform) {
start = nativeMax$2(start === undefined ? (func.length - 1) : start, 0);
return function() {
var args = arguments,
index = -1,
length = nativeMax$2(args.length - start, 0),
array = Array(length);
while (++index < length) {
array[index] = args[start + index];
}
index = -1;
var otherArgs = Array(start + 1);
while (++index < start) {
otherArgs[index] = args[index];
}
otherArgs[start] = transform(array);
return apply(func, this, otherArgs);
};
}
/**
* Creates a function that returns `value`.
*
* @static
* @memberOf _
* @since 2.4.0
* @category Util
* @param {*} value The value to return from the new function.
* @returns {Function} Returns the new constant function.
* @example
*
* var objects = _.times(2, _.constant({ 'a': 1 }));
*
* console.log(objects);
* // => [{ 'a': 1 }, { 'a': 1 }]
*
* console.log(objects[0] === objects[1]);
* // => true
*/
function constant(value) {
return function() {
return value;
};
}
/** `Object#toString` result references. */
var asyncTag$1 = '[object AsyncFunction]',
funcTag$2 = '[object Function]',
genTag$1 = '[object GeneratorFunction]',
proxyTag$1 = '[object Proxy]';
/**
* Checks if `value` is classified as a `Function` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
* @example
*
* _.isFunction(_);
* // => true
*
* _.isFunction(/abc/);
* // => false
*/
function isFunction$2(value) {
if (!isObject$4(value)) {
return false;
}
// The use of `Object#toString` avoids issues with the `typeof` operator
// in Safari 9 which returns 'object' for typed arrays and other constructors.
var tag = baseGetTag$3(value);
return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag$1 || tag == proxyTag$1;
}
/** Used to detect overreaching core-js shims. */
var coreJsData = root$2['__core-js_shared__'];
/** Used to detect methods masquerading as native. */
var maskSrcKey = (function() {
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
return uid ? ('Symbol(src)_1.' + uid) : '';
}());
/**
* Checks if `func` has its source masked.
*
* @private
* @param {Function} func The function to check.
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
*/
function isMasked(func) {
return !!maskSrcKey && (maskSrcKey in func);
}
/** Used for built-in method references. */
var funcProto$1 = Function.prototype;
/** Used to resolve the decompiled source of functions. */
var funcToString$1 = funcProto$1.toString;
/**
* Converts `func` to its source code.
*
* @private
* @param {Function} func The function to convert.
* @returns {string} Returns the source code.
*/
function toSource(func) {
if (func != null) {
try {
return funcToString$1.call(func);
} catch (e) {}
try {
return (func + '');
} catch (e) {}
}
return '';
}
/**
* Used to match `RegExp`
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
*/
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
/** Used to detect host constructors (Safari). */
var reIsHostCtor = /^\[object .+?Constructor\]$/;
/** Used for built-in method references. */
var funcProto = Function.prototype,
objectProto$7 = Object.prototype;
/** Used to resolve the decompiled source of functions. */
var funcToString = funcProto.toString;
/** Used to check objects for own properties. */
var hasOwnProperty$5 = objectProto$7.hasOwnProperty;
/** Used to detect if a method is native. */
var reIsNative = RegExp('^' +
funcToString.call(hasOwnProperty$5).replace(reRegExpChar, '\\$&')
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
);
/**
* The base implementation of `_.isNative` without bad shim checks.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a native function,
* else `false`.
*/
function baseIsNative(value) {
if (!isObject$4(value) || isMasked(value)) {
return false;
}
var pattern = isFunction$2(value) ? reIsNative : reIsHostCtor;
return pattern.test(toSource(value));
}
/**
* Gets the value at `key` of `object`.
*
* @private
* @param {Object} [object] The object to query.
* @param {string} key The key of the property to get.
* @returns {*} Returns the property value.
*/
function getValue(object, key) {
return object == null ? undefined : object[key];
}
/**
* Gets the native function at `key` of `object`.
*
* @private
* @param {Object} object The object to query.
* @param {string} key The key of the method to get.
* @returns {*} Returns the function if it's native, else `undefined`.
*/
function getNative(object, key) {
var value = getValue(object, key);
return baseIsNative(value) ? value : undefined;
}
var defineProperty = (function() {
try {
var func = getNative(Object, 'defineProperty');
func({}, '', {});
return func;
} catch (e) {}
}());
/**
* This method returns the first argument it receives.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Util
* @param {*} value Any value.
* @returns {*} Returns `value`.
* @example
*
* var object = { 'a': 1 };
*
* console.log(_.identity(object) === object);
* // => true
*/
function identity(value) {
return value;
}
/**
* The base implementation of `setToString` without support for hot loop shorting.
*
* @private
* @param {Function} func The function to modify.
* @param {Function} string The `toString` result.
* @returns {Function} Returns `func`.
*/
var baseSetToString = !defineProperty ? identity : function(func, string) {
return defineProperty(func, 'toString', {
'configurable': true,
'enumerable': false,
'value': constant(string),
'writable': true
});
};
/** Used to detect hot functions by number of calls within a span of milliseconds. */
var HOT_COUNT = 800,
HOT_SPAN = 16;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeNow = Date.now;
/**
* Creates a function that'll short out and invoke `identity` instead
* of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
* milliseconds.
*
* @private
* @param {Function} func The function to restrict.
* @returns {Function} Returns the new shortable function.
*/
function shortOut(func) {
var count = 0,
lastCalled = 0;
return function() {
var stamp = nativeNow(),
remaining = HOT_SPAN - (stamp - lastCalled);
lastCalled = stamp;
if (remaining > 0) {
if (++count >= HOT_COUNT) {
return arguments[0];
}
} else {
count = 0;
}
return func.apply(undefined, arguments);
};
}
/**
* Sets the `toString` method of `func` to return `string`.
*
* @private
* @param {Function} func The function to modify.
* @param {Function} string The `toString` result.
* @returns {Function} Returns `func`.
*/
var setToString = shortOut(baseSetToString);
/**
* A specialized version of `baseRest` which flattens the rest array.
*
* @private
* @param {Function} func The function to apply a rest parameter to.
* @returns {Function} Returns the new function.
*/
function flatRest(func) {
return setToString(overRest(func, undefined, flatten), func + '');
}
/* Built-in method references that are verified to be native. */
var WeakMap = getNative(root$2, 'WeakMap');
/** Used to store function metadata. */
var metaMap = WeakMap && new WeakMap;
/**
* This method returns `undefined`.
*
* @static
* @memberOf _
* @since 2.3.0
* @category Util
* @example
*
* _.times(2, _.noop);
* // => [undefined, undefined]
*/
function noop() {
// No operation performed.
}
/**
* Gets metadata for `func`.
*
* @private
* @param {Function} func The function to query.
* @returns {*} Returns the metadata for `func`.
*/
var getData = !metaMap ? noop : function(func) {
return metaMap.get(func);
};
/** Used to lookup unminified function names. */
var realNames = {};
/** Used for built-in method references. */
var objectProto$6 = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$4 = objectProto$6.hasOwnProperty;
/**
* Gets the name of `func`.
*
* @private
* @param {Function} func The function to query.
* @returns {string} Returns the function name.
*/
function getFuncName(func) {
var result = (func.name + ''),
array = realNames[result],
length = hasOwnProperty$4.call(realNames, result) ? array.length : 0;
while (length--) {
var data = array[length],
otherFunc = data.func;
if (otherFunc == null || otherFunc == func) {
return data.name;
}
}
return result;
}
/** Used as references for the maximum length and index of an array. */
var MAX_ARRAY_LENGTH = 4294967295;
/**
* Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
*
* @private
* @constructor
* @param {*} value The value to wrap.
*/
function LazyWrapper(value) {
this.__wrapped__ = value;
this.__actions__ = [];
this.__dir__ = 1;
this.__filtered__ = false;
this.__iteratees__ = [];
this.__takeCount__ = MAX_ARRAY_LENGTH;
this.__views__ = [];
}
// Ensure `LazyWrapper` is an instance of `baseLodash`.
LazyWrapper.prototype = baseCreate(baseLodash.prototype);
LazyWrapper.prototype.constructor = LazyWrapper;
/**
* Copies the values of `source` to `array`.
*
* @private
* @param {Array} source The array to copy values from.
* @param {Array} [array=[]] The array to copy values to.
* @returns {Array} Returns `array`.
*/
function copyArray(source, array) {
var index = -1,
length = source.length;
array || (array = Array(length));
while (++index < length) {
array[index] = source[index];
}
return array;
}
/**
* Creates a clone of `wrapper`.
*
* @private
* @param {Object} wrapper The wrapper to clone.
* @returns {Object} Returns the cloned wrapper.
*/
function wrapperClone(wrapper) {
if (wrapper instanceof LazyWrapper) {
return wrapper.clone();
}
var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
result.__actions__ = copyArray(wrapper.__actions__);
result.__index__ = wrapper.__index__;
result.__values__ = wrapper.__values__;
return result;
}
/** Used for built-in method references. */
var objectProto$5 = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$3 = objectProto$5.hasOwnProperty;
/**
* Creates a `lodash` object which wraps `value` to enable implicit method
* chain sequences. Methods that operate on and return arrays, collections,
* and functions can be chained together. Methods that retrieve a single value
* or may return a primitive value will automatically end the chain sequence
* and return the unwrapped value. Otherwise, the value must be unwrapped
* with `_#value`.
*
* Explicit chain sequences, which must be unwrapped with `_#value`, may be
* enabled using `_.chain`.
*
* The execution of chained methods is lazy, that is, it's deferred until
* `_#value` is implicitly or explicitly called.
*
* Lazy evaluation allows several methods to support shortcut fusion.
* Shortcut fusion is an optimization to merge iteratee calls; this avoids
* the creation of intermediate arrays and can greatly reduce the number of
* iteratee executions. Sections of a chain sequence qualify for shortcut
* fusion if the section is applied to an array and iteratees accept only
* one argument. The heuristic for whether a section qualifies for shortcut
* fusion is subject to change.
*
* Chaining is supported in custom builds as long as the `_#value` method is
* directly or indirectly included in the build.
*
* In addition to lodash methods, wrappers have `Array` and `String` methods.
*
* The wrapper `Array` methods are:
* `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
*
* The wrapper `String` methods are:
* `replace` and `split`
*
* The wrapper methods that support shortcut fusion are:
* `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
* `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
* `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
*
* The chainable wrapper methods are:
* `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
* `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
* `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
* `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
* `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
* `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
* `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
* `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
* `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
* `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
* `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
* `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
* `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
* `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
* `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
* `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
* `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
* `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
* `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
* `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
* `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
* `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
* `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
* `zipObject`, `zipObjectDeep`, and `zipWith`
*
* The wrapper methods that are **not** chainable by default are:
* `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
* `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
* `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
* `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
* `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
* `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
* `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
* `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
* `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
* `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
* `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
* `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
* `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
* `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
* `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
* `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
* `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
* `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
* `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
* `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
* `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
* `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
* `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
* `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
* `upperFirst`, `value`, and `words`
*
* @name _
* @constructor
* @category Seq
* @param {*} value The value to wrap in a `lodash` instance.
* @returns {Object} Returns the new `lodash` wrapper instance.
* @example
*
* function square(n) {
* return n * n;
* }
*
* var wrapped = _([1, 2, 3]);
*
* // Returns an unwrapped value.
* wrapped.reduce(_.add);
* // => 6
*
* // Returns a wrapped value.
* var squares = wrapped.map(square);
*
* _.isArray(squares);
* // => false
*
* _.isArray(squares.value());
* // => true
*/
function lodash(value) {
if (isObjectLike$2(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
if (value instanceof LodashWrapper) {
return value;
}
if (hasOwnProperty$3.call(value, '__wrapped__')) {
return wrapperClone(value);
}
}
return new LodashWrapper(value);
}
// Ensure wrappers are instances of `baseLodash`.
lodash.prototype = baseLodash.prototype;
lodash.prototype.constructor = lodash;
/**
* Checks if `func` has a lazy counterpart.
*
* @private
* @param {Function} func The function to check.
* @returns {boolean} Returns `true` if `func` has a lazy counterpart,
* else `false`.
*/
function isLaziable(func) {
var funcName = getFuncName(func),
other = lodash[funcName];
if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
return false;
}
if (func === other) {
return true;
}
var data = getData(other);
return !!data && func === data[0];
}
/** Error message constants. */
var FUNC_ERROR_TEXT = 'Expected a function';
/** Used to compose bitmasks for function metadata. */
var WRAP_CURRY_FLAG = 8,
WRAP_PARTIAL_FLAG = 32,
WRAP_ARY_FLAG = 128,
WRAP_REARG_FLAG = 256;
/**
* Creates a `_.flow` or `_.flowRight` function.
*
* @private
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Function} Returns the new flow function.
*/
function createFlow(fromRight) {
return flatRest(function(funcs) {
var length = funcs.length,
index = length,
prereq = LodashWrapper.prototype.thru;
if (fromRight) {
funcs.reverse();
}
while (index--) {
var func = funcs[index];
if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
var wrapper = new LodashWrapper([], true);
}
}
index = wrapper ? index : length;
while (++index < length) {
func = funcs[index];
var funcName = getFuncName(func),
data = funcName == 'wrapper' ? getData(func) : undefined;
if (data && isLaziable(data[0]) &&
data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
!data[4].length && data[9] == 1
) {
wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
} else {
wrapper = (func.length == 1 && isLaziable(func))
? wrapper[funcName]()
: wrapper.thru(func);
}
}
return function() {
var args = arguments,
value = args[0];
if (wrapper && args.length == 1 && isArray(value)) {
return wrapper.plant(value).value();
}
var index = 0,
result = length ? funcs[index].apply(this, args) : value;
while (++index < length) {
result = funcs[index].call(this, result);
}
return result;
};
});
}
/**
* Creates a function that returns the result of invoking the given functions
* with the `this` binding of the created function, where each successive
* invocation is supplied the return value of the previous.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Util
* @param {...(Function|Function[])} [funcs] The functions to invoke.
* @returns {Function} Returns the new composite function.
* @see _.flowRight
* @example
*
* function square(n) {
* return n * n;
* }
*
* var addSquare = _.flow([_.add, square]);
* addSquare(1, 2);
* // => 9
*/
var flow = createFlow();
const TYPE_PRE_MONTH = -1;
const TYPE_NOW_MONTH = 0;
const TYPE_NEXT_MONTH = 1;
/** Used for built-in method references. */
var objectProto$4 = Object.prototype;
/**
* Checks if `value` is likely a prototype object.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
*/
function isPrototype(value) {
var Ctor = value && value.constructor,
proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$4;
return value === proto;
}
/**
* Creates a unary function that invokes `func` with its argument transformed.
*
* @private
* @param {Function} func The function to wrap.
* @param {Function} transform The argument transform.
* @returns {Function} Returns the new function.
*/
function overArg(func, transform) {
return function(arg) {
return func(transform(arg));
};
}
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeKeys = overArg(Object.keys, Object);
/** Used for built-in method references. */
var objectProto$3 = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$2 = objectProto$3.hasOwnProperty;
/**
* The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
*/
function baseKeys(object) {
if (!isPrototype(object)) {
return nativeKeys(object);
}
var result = [];
for (var key in Object(object)) {
if (hasOwnProperty$2.call(object, key) && key != 'constructor') {
result.push(key);
}
}
return result;
}
/* Built-in method references that are verified to be native. */
var DataView = getNative(root$2, 'DataView');
/* Built-in method references that are verified to be native. */
var Map = getNative(root$2, 'Map');
/* Built-in method references that are verified to be native. */
var Promise$1 = getNative(root$2, 'Promise');
/* Built-in method references that are verified to be native. */
var Set$1 = getNative(root$2, 'Set');
/** `Object#toString` result references. */
var mapTag$2 = '[object Map]',
objectTag$1 = '[object Object]',
promiseTag = '[object Promise]',
setTag$2 = '[object Set]',
weakMapTag$1 = '[object WeakMap]';
var dataViewTag$1 = '[object DataView]';
/** Used to detect maps, sets, and weakmaps. */
var dataViewCtorString = toSource(DataView),
mapCtorString = toSource(Map),
promiseCtorString = toSource(Promise$1),
setCtorString = toSource(Set$1),
weakMapCtorString = toSource(WeakMap);
/**
* Gets the `toStringTag` of `value`.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
var getTag = baseGetTag$3;
// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag$1) ||
(Map && getTag(new Map) != mapTag$2) ||
(Promise$1 && getTag(Promise$1.resolve()) != promiseTag) ||
(Set$1 && getTag(new Set$1) != setTag$2) ||
(WeakMap && getTag(new WeakMap) != weakMapTag$1)) {
getTag = function(value) {
var result = baseGetTag$3(value),
Ctor = result == objectTag$1 ? value.constructor : undefined,
ctorString = Ctor ? toSource(Ctor) : '';
if (ctorString) {
switch (ctorString) {
case dataViewCtorString: return dataViewTag$1;
case mapCtorString: return mapTag$2;
case promiseCtorString: return promiseTag;
case setCtorString: return setTag$2;
case weakMapCtorString: return weakMapTag$1;
}
}
return result;
};
}
var getTag$1 = getTag;
/** Used as references for various `Number` constants. */
var MAX_SAFE_INTEGER$2 = 9007199254740991;
/**
* Checks if `value` is a valid array-like length.
*
* **Note:** This method is loosely based on
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
* @example
*
* _.isLength(3);
* // => true
*
* _.isLength(Number.MIN_VALUE);
* // => false
*
* _.isLength(Infinity);
* // => false
*
* _.isLength('3');
* // => false
*/
function isLength$2(value) {
return typeof value == 'number' &&
value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER$2;
}
/**
* Checks if `value` is array-like. A value is considered array-like if it's
* not a function and has a `value.length` that's an integer greater than or
* equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
* @example
*
* _.isArrayLike([1, 2, 3]);
* // => true
*
* _.isArrayLike(document.body.children);
* // => true
*
* _.isArrayLike('abc');
* // => true
*
* _.isArrayLike(_.noop);
* // => false
*/
function isArrayLike$2(value) {
return value != null && isLength$2(value.length) && !isFunction$2(value);
}
/**
* This method returns `false`.
*
* @static
* @memberOf _
* @since 4.13.0
* @category Util
* @returns {boolean} Returns `false`.
* @example
*
* _.times(2, _.stubFalse);
* // => [false, false]
*/
function stubFalse() {
return false;
}
/** Detect free variable `exports`. */
var freeExports$1 = typeof exports == 'object' && exports && !exports.nodeType && exports;
/** Detect free variable `module`. */
var freeModule$1 = freeExports$1 && typeof module == 'object' && module && !module.nodeType && module;
/** Detect the popular CommonJS extension `module.exports`. */
var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
/** Built-in value references. */
var Buffer = moduleExports$1 ? root$2.Buffer : undefined;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
/**
* Checks if `value` is a buffer.
*
* @static
* @memberOf _
* @since 4.3.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
* @example
*
* _.isBuffer(new Buffer(2));
* // => true
*
* _.isBuffer(new Uint8Array(2));
* // => false
*/
var isBuffer = nativeIsBuffer || stubFalse;
/** `Object#toString` result references. */
var argsTag = '[object Arguments]',
arrayTag = '[object Array]',
boolTag = '[object Boolean]',
dateTag = '[object Date]',
errorTag = '[object Error]',
funcTag$1 = '[object Function]',
mapTag$1 = '[object Map]',
numberTag = '[object Number]',
objectTag = '[object Object]',
regexpTag = '[object RegExp]',
setTag$1 = '[object Set]',
stringTag = '[object String]',
weakMapTag = '[object WeakMap]';
var arrayBufferTag = '[object ArrayBuffer]',
dataViewTag = '[object DataView]',
float32Tag = '[object Float32Array]',
float64Tag = '[object Float64Array]',
int8Tag = '[object Int8Array]',
int16Tag = '[object Int16Array]',
int32Tag = '[object Int32Array]',
uint8Tag = '[object Uint8Array]',
uint8ClampedTag = '[object Uint8ClampedArray]',
uint16Tag = '[object Uint16Array]',
uint32Tag = '[object Uint32Array]';
/** Used to identify `toStringTag` values of typed arrays. */
var typedArrayTags = {};
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
typedArrayTags[uint32Tag] = true;
typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
typedArrayTags[errorTag] = typedArrayTags[funcTag$1] =
typedArrayTags[mapTag$1] = typedArrayTags[numberTag] =
typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
typedArrayTags[setTag$1] = typedArrayTags[stringTag] =
typedArrayTags[weakMapTag] = false;
/**
* The base implementation of `_.isTypedArray` without Node.js optimizations.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
*/
function baseIsTypedArray(value) {
return isObjectLike$2(value) &&
isLength$2(value.length) && !!typedArrayTags[baseGetTag$3(value)];
}
/**
* The base implementation of `_.unary` without support for storing metadata.
*
* @private
* @param {Function} func The function to cap arguments for.
* @returns {Function} Returns the new capped function.
*/
function baseUnary(func) {
return function(value) {
return func(value);
};
}
/** Detect free variable `exports`. */
var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
/** Detect free variable `module`. */
var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
/** Detect the popular CommonJS extension `module.exports`. */
var moduleExports = freeModule && freeModule.exports === freeExports;
/** Detect free variable `process` from Node.js. */
var freeProcess = moduleExports && freeGlobal$2.process;
/** Used to access faster Node.js helpers. */
var nodeUtil = (function() {
try {
// Use `util.types` for Node.js 10+.
var types = freeModule && freeModule.require && freeModule.require('util').types;
if (types) {
return types;
}
// Legacy `process.binding('util')` for Node.js < 10.
return freeProcess && freeProcess.binding && freeProcess.binding('util');
} catch (e) {}
}());
/* Node.js helper references. */
var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
/**
* Checks if `value` is classified as a typed array.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
* @example
*
* _.isTypedArray(new Uint8Array);
* // => true
*
* _.isTypedArray([]);
* // => false
*/
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
/** `Object#toString` result references. */
var mapTag = '[object Map]',
setTag = '[object Set]';
/** Used for built-in method references. */
var objectProto$2 = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$1 = objectProto$2.hasOwnProperty;
/**
* Checks if `value` is an empty object, collection, map, or set.
*
* Objects are considered empty if they have no own enumerable string keyed
* properties.
*
* Array-like values such as `arguments` objects, arrays, buffers, strings, or
* jQuery-like collections are considered empty if they have a `length` of `0`.
* Similarly, maps and sets are considered empty if they have a `size` of `0`.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is empty, else `false`.
* @example
*
* _.isEmpty(null);
* // => true
*
* _.isEmpty(true);
* // => true
*
* _.isEmpty(1);
* // => true
*
* _.isEmpty([1, 2, 3]);
* // => false
*
* _.isEmpty({ 'a': 1 });
* // => false
*/
function isEmpty(value) {
if (value == null) {
return true;
}
if (isArrayLike$2(value) &&
(isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
isBuffer(value) || isTypedArray(value) || isArguments(value))) {
return !value.length;
}
var tag = getTag$1(value);
if (tag == mapTag || tag == setTag) {
return !value.size;
}
if (isPrototype(value)) {
return !baseKeys(value).length;
}
for (var key in value) {
if (hasOwnProperty$1.call(value, key)) {
return false;
}
}
return true;
}
function handleActive(args, item) {
const { selectedDate } = args;
const { _value } = item;
const { start, end } = selectedDate;
const dayjsEnd = dayjs(end);
const dayjsStart = start ? dayjs(start) : dayjsEnd;
item.isSelected = _value.isSame(dayjsEnd) || _value.isSame(dayjsStart) || _value.isAfter(dayjsStart) && _value.isBefore(dayjsEnd);
item.isSelectedHead = _value.isSame(dayjsStart);
item.isSelectedTail = _value.isSame(dayjsEnd);
item.isToday = _value.diff(dayjs(Date.now()).startOf("day"), "day") === 0;
return item;
}
function handleMarks(args, item) {
const { options } = args;
const { _value } = item;
const { marks } = options;
const markList = marks.filter((mark) => dayjs(mark.value).startOf("day").isSame(_value));
item.marks = markList.slice(0, 1);
return item;
}
function handleDisabled(args, item) {
const { options } = args;
const { _value } = item;
const { minDate, maxDate } = options;
const dayjsMinDate = dayjs(minDate);
const dayjsMaxDate = dayjs(maxDate);
item.isDisabled = !!(minDate && _value.isBefore(dayjsMinDate)) || !!(maxDate && _value.isAfter(dayjsMaxDate));
return item;
}
function handleValid(args, item) {
const { options } = args;
const { _value } = item;
const { validDates } = options;
if (!isEmpty(validDates)) {
const isInclude = validDates.some((date) => dayjs(date.value).startOf("day").isSame(_value));
item.isDisabled = !isInclude;
}
delete item._value;
return item;
}
var plugins = [handleActive, handleMarks, handleDisabled, handleValid];
const TOTAL = 7 * 6;
function getFullItem(item, options, selectedDate, isShowStatus) {
if (options.marks.find((x) => x.value === item.value)) {
item.marks = [{
value: item.value
}];
}
if (!isShowStatus)
return item;
const bindedPlugins = plugins.map((fn) => fn.bind(null, {
options,
selectedDate
}));
return flow(bindedPlugins)(item);
}
function generateCalendarGroup(options) {
return function(generateDate, selectedDate, isShowStatus) {
const date = dayjs(generateDate);
const { format } = options;
const firstDate = date.startOf("month");
const lastDate = date.endOf("month");
const preMonthDate = date.subtract(1, "month");
const list = [];
const nowMonthDays = date.daysInMonth();
const preMonthLastDay = preMonthDate.endOf("month").day();
for (let i2 = 1; i2 <= preMonthLastDay + 1; i2++) {
const thisDate = firstDate.subtract(i2, "day").startOf("day");
let item = {
marks: [],
_value: thisDate,
text: thisDate.date(),
type: TYPE_PRE_MONTH,
value: thisDate.format(format)
};
item = getFullItem(item, options, selectedDate, isShowStatus);
list.push(item);
}
list.reverse();
for (let i2 = 0; i2 < nowMonthDays; i2++) {
const thisDate = firstDate.add(i2, "day").startOf("day");
let item = {
marks: [],
_value: thisDate,
text: thisDate.date(),
type: TYPE_NOW_MONTH,
value: thisDate.format(format)
};
item = getFullItem(item, options, selectedDate, isShowStatus);
list.push(item);
}
let i = 1;
while (list.length < TOTAL) {
const thisDate = lastDate.add(i++, "day").startOf("day");
let item = {
marks: [],
_value: thisDate,
text: thisDate.date(),
type: TYPE_NEXT_MONTH,
value: thisDate.format(format)
};
item = getFullItem(item, options, selectedDate, isShowStatus);
list.push(item);
}
return {
list,
value: generateDate
};
};
}
const MAP = {
[TYPE_PRE_MONTH]: "pre",
[TYPE_NOW_MONTH]: "now",
[TYPE_NEXT_MONTH]: "next"
};
const AtCalendarList = defineComponent({
name: "AtCalendarList",
data: () => ({ addGlobalClass: true }),
emits: {
"click"(item) {
return !!(item && typeof item === "object");
},
"long-click"(item) {
return !!(item && typeof item === "object");
}
},
props: {
list: Array
},
setup(props, { emit }) {
const genFlexItemClasses = computed(() => (item) => [
"flex__item",
{
[`flex__item--${MAP[item.type]}`]: Boolean(MAP[item.type]),
"flex__item--today": item.isToday,
"flex__item--active": item.isActive,
"flex__item--selected": item.isSelected,
"flex__item--selected-head": item.isSelectedHead,
"flex__item--selected-tail": item.isSelectedTail,
"flex__item--blur": item.isDisabled || item.type === TYPE_PRE_MONTH || item.type === TYPE_NEXT_MONTH
}
]);
function handleClick(item) {
emit("click", item);
}
function handleLongClick(item) {
emit("long-click", item);
}
return {
...toRefs(props),
handleClick,
handleLongClick,
genFlexItemClasses
};
}
});
// Binding optimization for webpack code-split
const _renderList$h = renderList, _Fragment$h = Fragment, _openBlock$Q = openBlock, _createElementBlock$h = createElementBlock, _toDisplayString$v = toDisplayString, _createTextVNode$v = createTextVNode, _resolveComponent$Q = resolveComponent, _withCtx$P = withCtx, _createVNode$D = createVNode, _createBlock$Q = createBlock, _createCommentVNode$r = createCommentVNode, _normalizeClass$n = normalizeClass;
function _sfc_render$Q(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_view = _resolveComponent$Q("taro-view");
const _component_taro_text = _resolveComponent$Q("taro-text");
return (_ctx.list && _ctx.list.length > 0)
? (_openBlock$Q(), _createBlock$Q(_component_taro_view, {
key: 0,
class: "at-calendar__list flex"
}, {
default: _withCtx$P(() => [
(_openBlock$Q(true), _createElementBlock$h(_Fragment$h, null, _renderList$h(_ctx.list, (item, index) => {
return (_openBlock$Q(), _createBlock$Q(_component_taro_view, {
key: `list-item-${item.value}-${index}`,
class: _normalizeClass$n(_ctx.genFlexItemClasses(item)),
onTap: $event => (_ctx.handleClick(item)),
onLongpress: $event => (_ctx.handleLongClick(item))
}, {
default: _withCtx$P(() => [
_createVNode$D(_component_taro_view, { class: "flex__item-container" }, {
default: _withCtx$P(() => [
_createVNode$D(_component_taro_view, { class: "container-text" }, {
default: _withCtx$P(() => [
_createTextVNode$v(_toDisplayString$v(item.text), 1 /* TEXT */)
]),
_: 2 /* DYNAMIC */
}, 1024 /* DYNAMIC_SLOTS */)
]),
_: 2 /* DYNAMIC */
}, 1024 /* DYNAMIC_SLOTS */),
_createVNode$D(_component_taro_view, { class: "flex__item-extra extra" }, {
default: _withCtx$P(() => [
(item.marks && item.marks.length > 0)
? (_openBlock$Q(), _createBlock$Q(_component_taro_view, {
key: 0,
class: "extra-marks"
}, {
default: _withCtx$P(() => [
(_openBlock$Q(true), _createElementBlock$h(_Fragment$h, null, _renderList$h(item.marks, (mark, key) => {
return (_openBlock$Q(), _createBlock$Q(_component_taro_text, {
key: key,
class: "mark"
}, {
default: _withCtx$P(() => [
_createTextVNode$v(_toDisplayString$v(mark.value), 1 /* TEXT */)
]),
_: 2 /* DYNAMIC */
}, 1024 /* DYNAMIC_SLOTS */))
}), 128 /* KEYED_FRAGMENT */))
]),
_: 2 /* DYNAMIC */
}, 1024 /* DYNAMIC_SLOTS */))
: _createCommentVNode$r("v-if", true)
]),
_: 2 /* DYNAMIC */
}, 1024 /* DYNAMIC_SLOTS */)
]),
_: 2 /* DYNAMIC */
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["class", "onTap", "onLongpress"]))
}), 128 /* KEYED_FRAGMENT */))
]),
_: 1 /* STABLE */
}))
: _createCommentVNode$r("v-if", true)
}
AtCalendarList.render = _sfc_render$Q;
const AtCalendarHeader = defineComponent({
name: "AtCalendarHeader",
data: () => ({
addGlobalClass: true,
days: ["\u65E5", "\u4E00", "\u4E8C", "\u4E09", "\u56DB", "\u4E94", "\u516D"]
})
});
// Binding optimization for webpack code-split
const _renderList$g = renderList, _Fragment$g = Fragment, _openBlock$P = openBlock, _createElementBlock$g = createElementBlock, _toDisplayString$u = toDisplayString, _createTextVNode$u = createTextVNode, _resolveComponent$P = resolveComponent, _withCtx$O = withCtx, _createBlock$P = createBlock, _createVNode$C = createVNode;
function _sfc_render$P(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_view = _resolveComponent$P("taro-view");
return (_openBlock$P(), _createBlock$P(_component_taro_view, { class: "header at-calendar__header" }, {
default: _withCtx$O(() => [
_createVNode$C(_component_taro_view, { class: "header__flex" }, {
default: _withCtx$O(() => [
(_openBlock$P(true), _createElementBlock$g(_Fragment$g, null, _renderList$g(_ctx.days, (day, index) => {
return (_openBlock$P(), _createBlock$P(_component_taro_view, {
key: index,
class: "header__flex-item"
}, {
default: _withCtx$O(() => [
_createTextVNode$u(_toDisplayString$u(day), 1 /* TEXT */)
]),
_: 2 /* DYNAMIC */
}, 1024 /* DYNAMIC_SLOTS */))
}), 128 /* KEYED_FRAGMENT */))
]),
_: 1 /* STABLE */
})
]),
_: 1 /* STABLE */
}))
}
AtCalendarHeader.render = _sfc_render$P;
const ANIMATE_DURATION = 300;
const AtCalendarBody = defineComponent({
name: "AtCalendarBody",
components: {
AtCalendarDayList: AtCalendarHeader,
AtCalendarDateList: AtCalendarList
},
emits: {
"day-click"(item) {
return !!(item && typeof item === "object");
},
"long-click"(item) {
return !!(item && typeof item === "object");
},
"swipe-month"(vectorCount) {
return !!(vectorCount && typeof vectorCount === "number");
}
},
data: () => ({ addGlobalClass: true }),
props: {
format: {
type: String,
default: "YYYY-MM-DD"
},
validDates: {
type: Array,
default: () => []
},
marks: {
type: Array,
default: () => []
},
minDate: [String, Number, Date],
maxDate: [String, Number, Date],
isSwiper: {
type: Boolean,
default: true
},
isVertical: Boolean,
generateDate: {
type: [Number, String],
default: Date.now()
},
selectedDate: {
type: Object,
default: () => ({ end: Date.now(), start: Date.now() })
},
selectedDates: {
type: Array,
default: () => []
}
},
setup(props, { emit }) {
const startX = ref(0);
const maxWidth = ref(0);
const changeCount = ref(0);
const swipeStartPoint = ref(0);
const currentSwiperIndex = ref(1);
const isPreMonth = ref(false);
const isWeb = ref(Taro.getEnv() === Taro.ENV_TYPE.WEB);
let generateFunc = generateCalendarGroup({
validDates: props.validDates,
format: props.format,
minDate: props.minDate,
maxDate: props.maxDate,
marks: props.marks,
selectedDates: props.selectedDates
});
const state = reactive({
listGroup: getGroups(props.generateDate, props.selectedDate),
offsetSize: 0,
isAnimate: false
});
const h5MainBodyStyle = computed(() => {
let style = {};
const transformStyle = props.isVertical ? `translateY(-100%) translate3d(0,${state.offsetSize}px,0)` : `translateX(-100%) translate3d(${state.offsetSize}px,0,0)`;
if (props.isSwiper) {
style.transform = transformStyle;
style.WebkitTransform = transformStyle;
if (props.isVertical) {
style.flexDirection = "column";
}
}
return style;
});
watch(() => [
props.validDates,
props.marks,
props.format,
props.minDate,
props.maxDate,
props.selectedDates,
props.generateDate,
props.selectedDate
], ([
validDates,
marks,
format,
minDate,
maxDate,
selectedDates,
generateDate,
selectedDate
]) => {
const options = {
validDates,
marks,
format,
selectedDates,
minDate,
maxDate
};
generateFunc = generateCalendarGroup(options);
state.offsetSize = 0;
state.listGroup = getGroups(generateDate, selectedDate);
});
function getGroups(generateDate, selectedDate) {
const dayjsDate = dayjs(generateDate);
const arr = [];
const preList = generateFunc(dayjsDate.subtract(1, "month").valueOf(), selectedDate);
const nowList = generateFunc(generateDate, selectedDate, true);
const nextList = generateFunc(dayjsDate.add(1, "month").valueOf(), selectedDate);
const preListIndex = currentSwiperIndex.value === 0 ? 2 : currentSwiperIndex.value - 1;
const nextListIndex = currentSwiperIndex.value === 2 ? 0 : currentSwiperIndex.value + 1;
arr[preListIndex] = preList;
arr[nextListIndex] = nextList;
arr[currentSwiperIndex.value] = nowList;
return arr;
}
function handleTouchStart(e) {
startX.value = props.isVertical ? e.touches[0].clientY : e.touches[0].clientX;
}
function handleTouchMove(e) {
const clientXorY = props.isVertical ? e.touches[0].clientY : e.touches[0].clientX;
state.offsetSize = clientXorY - startX.value;
e.preventDefault();
e.stopPropagation();
}
function animateMoveSlide(offset, callback) {
state.isAnimate = true;
nextTick(() => {
state.offsetSize = offset;
setTimeout(() => {
state.isAnimate = false;
nextTick(() => {
callback && callback();
});
}, ANIMATE_DURATION);
});
}
function handleTouchEnd() {
const isRight = state.offsetSize > 0;
const breakpoint = maxWidth.value / 2;
const absOffsetSize = Math.abs(state.offsetSize);
if (absOffsetSize > breakpoint) {
const res = isRight ? maxWidth.value : -maxWidth.value;
return animateMoveSlide(res, () => {
emit("swipe-month", isRight ? -1 : 1);
});
}
animateMoveSlide(0);
}
function handleChange(e) {
const { current, source } = e.detail;
if (source === "touch") {
currentSwiperIndex.value = current;
changeCount.value += 1;
}
}
function handleAnimationFinish() {
if (changeCount.value > 0) {
emit("swipe-month", isPreMonth.value ? -changeCount.value : changeCount.value);
changeCount.value = 0;
}
}
function handleSwipeTouchStart(e) {
const { clientX, clientY } = e.changedTouches[0];
swipeStartPoint.value = props.isVertical ? clientY : clientX;
}
function handleSwipeTouchEnd(e) {
const { clientX, clientY } = e.changedTouches[0];
isPreMonth.value = props.isVertical ? clientY - swipeStartPoint.value > 0 : clientX - swipeStartPoint.value > 0;
}
function handleSwipeTouchMove(e) {
e.preventDefault();
e.stopPropagation();
return;
}
onMounted(() => {
delayQuerySelector(this, ".at-calendar-slider__main", 100).then((res) => {
maxWidth.value = props.isVertical ? res[0].height : res[0].width;
});
});
return {
...toRefs(state),
isSwiper: toRef(props, "isSwiper"),
isWeb,
h5MainBodyStyle,
currentSwiperIndex,
handleChange,
handleTouchEnd,
handleTouchMove,
handleTouchStart,
handleAnimationFinish,
handleSwipeTouchEnd,
handleSwipeTouchMove,
handleSwipeTouchStart
};
}
});
// Binding optimization for webpack code-split
const _resolveComponent$O = resolveComponent, _createVNode$B = createVNode, _withCtx$N = withCtx, _openBlock$O = openBlock, _createBlock$O = createBlock, _createCommentVNode$q = createCommentVNode, _normalizeClass$m = normalizeClass, _normalizeStyle$m = normalizeStyle, _renderList$f = renderList, _Fragment$f = Fragment, _createElementBlock$f = createElementBlock;
function _sfc_render$O(_ctx, _cache, $props, $setup, $data, $options) {
const _component_at_calendar_day_list = _resolveComponent$O("at-calendar-day-list");
const _component_at_calendar_date_list = _resolveComponent$O("at-calendar-date-list");
const _component_taro_view = _resolveComponent$O("taro-view");
const _component_taro_swiper_item = _resolveComponent$O("taro-swiper-item");
const _component_taro_swiper = _resolveComponent$O("taro-swiper");
return (!_ctx.isSwiper)
? (_openBlock$O(), _createBlock$O(_component_taro_view, {
key: 0,
class: "main at-calendar-slider__main"
}, {
default: _withCtx$N(() => [
_createVNode$B(_component_at_calendar_day_list),
_createVNode$B(_component_taro_view, { class: "main__body body" }, {
default: _withCtx$N(() => [
_createVNode$B(_component_taro_view, { class: "body__slider body__slider--now" }, {
default: _withCtx$N(() => [
_createVNode$B(_component_at_calendar_date_list, {
list: _ctx.listGroup[1].list,
onClick: _cache[0] || (_cache[0] = $event => (_ctx.$emit('day-click', $event))),
onLongClick: _cache[1] || (_cache[1] = $event => (_ctx.$emit('long-click', $event)))
}, null, 8 /* PROPS */, ["list"])
]),
_: 1 /* STABLE */
})
]),
_: 1 /* STABLE */
})
]),
_: 1 /* STABLE */
}))
: (_ctx.isWeb)
? (_openBlock$O(), _createBlock$O(_component_taro_view, {
key: 1,
class: "main at-calendar-slider__main",
onTouchend: _ctx.handleTouchEnd,
onTouchmove: _ctx.handleTouchMove,
onTouchstart: _ctx.handleTouchStart
}, {
default: _withCtx$N(() => [
_createVNode$B(_component_at_calendar_day_list),
_createVNode$B(_component_taro_view, {
class: _normalizeClass$m(['body', 'main__body', {
'main__body--slider': _ctx.isSwiper,
'main__body--animate': _ctx.isAnimate
}]),
style: _normalizeStyle$m(_ctx.h5MainBodyStyle)
}, {
default: _withCtx$N(() => [
_createVNode$B(_component_taro_view, { class: "body__slider body__slider--pre" }, {
default: _withCtx$N(() => [
_createVNode$B(_component_at_calendar_date_list, {
list: _ctx.listGroup[0].list
}, null, 8 /* PROPS */, ["list"])
]),
_: 1 /* STABLE */
}),
_createVNode$B(_component_taro_view, { class: "body__slider body__slider--now" }, {
default: _withCtx$N(() => [
_createVNode$B(_component_at_calendar_date_list, {
list: _ctx.listGroup[1].list,
onClick: _cache[2] || (_cache[2] = $event => (_ctx.$emit('day-click', $event))),
onLongClick: _cache[3] || (_cache[3] = $event => (_ctx.$emit('long-click', $event)))
}, null, 8 /* PROPS */, ["list"])
]),
_: 1 /* STABLE */
}),
_createVNode$B(_component_taro_view, { class: "body__slider body__slider--next" }, {
default: _withCtx$N(() => [
_createVNode$B(_component_at_calendar_date_list, {
list: _ctx.listGroup[2].list
}, null, 8 /* PROPS */, ["list"])
]),
_: 1 /* STABLE */
})
]),
_: 1 /* STABLE */
}, 8 /* PROPS */, ["class", "style"])
]),
_: 1 /* STABLE */
}, 8 /* PROPS */, ["onTouchend", "onTouchmove", "onTouchstart"]))
: (_ctx.isSwiper && !_ctx.isWeb)
? (_openBlock$O(), _createBlock$O(_component_taro_view, {
key: 2,
class: "main at-calendar-slider__main"
}, {
default: _withCtx$N(() => [
_createVNode$B(_component_at_calendar_day_list),
_createVNode$B(_component_taro_swiper, {
class: "main__body",
circular: true,
skipHiddenItemLayout: true,
catchMove: true,
vertical: _ctx.isVertical,
current: _ctx.currentSwiperIndex,
onChange: _ctx.handleChange,
onTouchend: _ctx.handleSwipeTouchEnd,
onTouchmove: _ctx.handleSwipeTouchMove,
onTouchstart: _ctx.handleSwipeTouchStart,
onAnimationfinish: _ctx.handleAnimationFinish
}, {
default: _withCtx$N(() => [
(_openBlock$O(true), _createElementBlock$f(_Fragment$f, null, _renderList$f(_ctx.listGroup, (item, key) => {
return (_openBlock$O(), _createBlock$O(_component_taro_swiper_item, {
key: key.toString(),
itemId: key.toString()
}, {
default: _withCtx$N(() => [
_createVNode$B(_component_at_calendar_date_list, {
list: item.list,
onClick: _cache[4] || (_cache[4] = $event => (_ctx.$emit('day-click', $event))),
onLongClick: _cache[5] || (_cache[5] = $event => (_ctx.$emit('long-click', $event)))
}, null, 8 /* PROPS */, ["list"])
]),
_: 2 /* DYNAMIC */
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["itemId"]))
}), 128 /* KEYED_FRAGMENT */))
]),
_: 1 /* STABLE */
}, 8 /* PROPS */, ["vertical", "current", "onChange", "onTouchend", "onTouchmove", "onTouchstart", "onAnimationfinish"])
]),
_: 1 /* STABLE */
}))
: _createCommentVNode$q("v-if", true)
}
AtCalendarBody.render = _sfc_render$O;
const AtCalendarController = defineComponent({
name: "AtCalendarController",
data: () => ({ addGlobalClass: true }),
emits: [
"pre-month",
"next-month",
"select-date"
],
props: {
generateDate: {
type: [String, Number, Date],
default: Date.now()
},
minDate: [String, Number, Date],
maxDate: [String, Number, Date],
hideArrow: Boolean,
monthFormat: {
type: String,
default: "YYYY \u5E74 MM \u6708"
}
},
setup(props) {
const dayjsDate = computed(() => dayjs(props.generateDate));
const dayjsMinDate = computed(() => !!props.minDate && dayjs(props.minDate));
const dayjsMaxDate = computed(() => !!props.maxDate && dayjs(props.maxDate));
const isMinMonth = computed(() => {
return dayjsMinDate.value && dayjsMinDate.value.startOf("month").isSame(dayjsDate.value);
});
const isMaxMonth = computed(() => {
return dayjsMaxDate.value && dayjsMaxDate.value.startOf("month").isSame(dayjsDate.value);
});
const minDateValue = computed(() => dayjsMinDate.value ? dayjsMinDate.value.format("YYYY-MM") : "");
const maxDateValue = computed(() => dayjsMaxDate.value ? dayjsMaxDate.value.format("YYYY-MM") : "");
const genArrowClasses = (direction, disabled) => ["controller__arrow", {
[`controller__arrow--${direction}`]: true,
"controller__arrow--disabled": disabled
}];
return {
...toRefs(props),
dayjsDate,
isMinMonth,
isMaxMonth,
minDateValue,
maxDateValue,
genArrowClasses
};
}
});
// Binding optimization for webpack code-split
const _resolveComponent$N = resolveComponent, _normalizeClass$l = normalizeClass, _openBlock$N = openBlock, _createBlock$N = createBlock, _createCommentVNode$p = createCommentVNode, _toDisplayString$t = toDisplayString, _createTextVNode$t = createTextVNode, _withCtx$M = withCtx, _createVNode$A = createVNode;
function _sfc_render$N(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_view = _resolveComponent$N("taro-view");
const _component_taro_text = _resolveComponent$N("taro-text");
const _component_taro_picker = _resolveComponent$N("taro-picker");
return (_openBlock$N(), _createBlock$N(_component_taro_view, { class: "at-calendar__controller controller" }, {
default: _withCtx$M(() => [
(!_ctx.hideArrow)
? (_openBlock$N(), _createBlock$N(_component_taro_view, {
key: 0,
class: _normalizeClass$l(_ctx.genArrowClasses('left', _ctx.isMinMonth)),
onTap: _cache[0] || (_cache[0] = $event => (_ctx.$emit('pre-month', _ctx.isMinMonth)))
}, null, 8 /* PROPS */, ["class"]))
: _createCommentVNode$p("v-if", true),
_createVNode$A(_component_taro_picker, {
mode: "date",
fields: "month",
end: _ctx.maxDateValue,
start: _ctx.minDateValue,
value: _ctx.dayjsDate.format('YYYY-MM'),
onChange: _cache[1] || (_cache[1] = $event => (_ctx.$emit('select-date', $event)))
}, {
default: _withCtx$M(() => [
_createVNode$A(_component_taro_text, { class: "controller__info" }, {
default: _withCtx$M(() => [
_createTextVNode$t(_toDisplayString$t(_ctx.dayjsDate.format(_ctx.monthFormat)), 1 /* TEXT */)
]),
_: 1 /* STABLE */
})
]),
_: 1 /* STABLE */
}, 8 /* PROPS */, ["end", "start", "value"]),
(!_ctx.hideArrow)
? (_openBlock$N(), _createBlock$N(_component_taro_view, {
key: 1,
class: _normalizeClass$l(_ctx.genArrowClasses('right', _ctx.isMaxMonth)),
onTap: _cache[2] || (_cache[2] = $event => (_ctx.$emit('next-month', _ctx.isMaxMonth)))
}, null, 8 /* PROPS */, ["class"]))
: _createCommentVNode$p("v-if", true)
]),
_: 1 /* STABLE */
}))
}
AtCalendarController.render = _sfc_render$N;
const AtCalendar = defineComponent({
name: "AtCalendar",
components: {
AtCalendarBody,
AtCalendarController
},
emits: {
"click-pre-month": null,
"click-next-month": null,
"select-date"(item) {
return !!(item && item.value);
},
"day-click"(item) {
return !!(item && item.value);
},
"day-long-click"(item) {
return !!(item && item.value);
},
"month-change"(value) {
return !!(value && typeof value === "string");
}
},
data: () => ({ addGlobalClass: true }),
props: {
currentDate: {
type: [Number, String, Date, Object],
default: Date.now()
},
minDate: {
type: [String, Number, Date],
default: () => ""
},
maxDate: {
type: [String, Number, Date],
default: () => ""
},
isSwiper: {
type: Boolean,
default: true
},
marks: {
type: Array,
default: () => []
},
validDates: {
type: Array,
default: () => []
},
format: {
type: String,
default: "YYYY-MM-DD"
},
monthFormat: {
type: String,
default: "YYYY \u5E74 MM \u6708"
},
hideArrow: Boolean,
isVertical: Boolean,
isMultiSelect: Boolean,
selectedDates: {
type: Array,
default: () => []
}
},
setup(props, { emit }) {
const { currentDate, isMultiSelect } = toRefs(props);
let { generateDate, selectedDate } = getInitializedState(currentDate.value, isMultiSelect.value);
const state = reactive({
generateDate,
selectedDate
});
watch(() => [
props.currentDate,
props.isMultiSelect
], ([currentDate2, isMultiSelect2], [preCurrentDate, preIsMultiSelect]) => {
if (!currentDate2 || currentDate2 === preCurrentDate)
return;
if (isMultiSelect2 && preIsMultiSelect) {
const { start, end } = currentDate2;
const { start: preStart, end: preEnd } = preCurrentDate;
if (start === preStart && preEnd === end) {
return;
}
}
const stateValue = getInitializedState(currentDate2, isMultiSelect2);
Object.assign(state, stateValue);
});
function getSingleSelectedState(value) {
const stateValue = {
selectedDate: getSelectedDate(value.valueOf())
};
const dayjsGenerateDate = value.startOf("month");
const generateDateValue = dayjsGenerateDate.valueOf();
if (generateDateValue !== state.generateDate) {
triggerChangeDate(dayjsGenerateDate);
stateValue.generateDate = generateDateValue;
}
return stateValue;
}
function getMultiSelectedState(value) {
const { end, start } = state.selectedDate;
const valueUnix = value.valueOf();
const stateValue = {
selectedDate: state.selectedDate
};
if (end) {
stateValue.selectedDate = getSelectedDate(valueUnix, 0);
} else {
stateValue.selectedDate.end = Math.max(valueUnix, +start);
stateValue.selectedDate.start = Math.min(valueUnix, +start);
}
return stateValue;
}
function getInitializedState(currentDate2, isMultiSelect2) {
let end;
let start;
let generateDateValue;
if (!currentDate2) {
const dayjsStart = dayjs$1();
start = dayjsStart.startOf("day").valueOf();
generateDateValue = dayjsStart.startOf("month").valueOf();
return {
generateDate: generateDateValue,
selectedDate: {
start: ""
}
};
}
if (isMultiSelect2) {
const { start: cStart, end: cEnd } = currentDate2;
const dayjsStart = dayjs$1(cStart);
start = dayjsStart.startOf("day").valueOf();
generateDateValue = dayjsStart.startOf("month").valueOf();
end = cEnd ? dayjs$1(cEnd).startOf("day").valueOf() : start;
} else {
const dayjsStart = dayjs$1(currentDate2);
start = dayjsStart.startOf("day").valueOf();
generateDateValue = dayjsStart.startOf("month").valueOf();
end = start;
}
return {
generateDate: generateDateValue,
selectedDate: getSelectedDate(start, end)
};
}
function getSelectedDate(start, end) {
const stateValue = {
start,
end: start
};
if (typeof end !== "undefined") {
stateValue.end = end;
}
return stateValue;
}
function triggerChangeDate(value) {
emit("month-change", value.format(props.format));
}
function setMonth(vectorCount) {
const _generateDate = dayjs$1(state.generateDate).add(vectorCount, "month");
state.generateDate = _generateDate.valueOf();
if (vectorCount) {
emit("month-change", _generateDate.format(props.format));
}
}
function handleClickPreMonth(isMinMonth) {
if (isMinMonth === true)
return;
setMonth(-1);
emit("click-pre-month");
}
function handleClickNextMonth(isMaxMonth) {
if (isMaxMonth === true)
return;
setMonth(1);
emit("click-next-month");
}
function handleSelectDate(e) {
const { value } = e.detail;
const _generateDate = dayjs$1(value);
const _generateDateValue = _generateDate.valueOf();
if (state.generateDate === _generateDateValue)
return;
triggerChangeDate(_generateDate);
state.generateDate = _generateDateValue;
}
function handleDayClick(item) {
const { isDisabled, value } = item;
if (isDisabled)
return;
const dayjsDate = dayjs$1(value);
let stateValue = {};
stateValue = props.isMultiSelect ? getMultiSelectedState(dayjsDate) : getSingleSelectedState(dayjsDate);
Object.assign(state, stateValue);
nextTick(() => {
handleSelectedDate();
});
emit("day-click", { value: item.value });
}
function handleSelectedDate() {
const info = {
start: dayjs$1(state.selectedDate.start).format(props.format)
};
if (state.selectedDate.end) {
info.end = dayjs$1(state.selectedDate.end).format(props.format);
}
emit("select-date", { value: info });
}
function handleDayLongClick(item) {
emit("day-long-click", { value: item.value });
}
return {
...toRefs(state),
...toRefs(props),
setMonth,
handleDayClick,
handleSelectDate,
handleDayLongClick,
handleSelectedDate,
handleClickPreMonth,
handleClickNextMonth
};
}
});
// Binding optimization for webpack code-split
const _resolveComponent$M = resolveComponent, _createVNode$z = createVNode, _mergeProps$K = mergeProps, _withCtx$L = withCtx, _openBlock$M = openBlock, _createBlock$M = createBlock;
function _sfc_render$M(_ctx, _cache, $props, $setup, $data, $options) {
const _component_at_calendar_controller = _resolveComponent$M("at-calendar-controller");
const _component_at_calendar_body = _resolveComponent$M("at-calendar-body");
const _component_taro_view = _resolveComponent$M("taro-view");
return (_openBlock$M(), _createBlock$M(_component_taro_view, _mergeProps$K(_ctx.$attrs, { class: "at-calendar" }), {
default: _withCtx$L(() => [
_createVNode$z(_component_at_calendar_controller, {
minDate: _ctx.minDate,
maxDate: _ctx.maxDate,
hideArrow: _ctx.hideArrow,
monthFormat: _ctx.monthFormat,
generateDate: _ctx.generateDate,
onSelectDate: _ctx.handleSelectDate,
onPreMonth: _ctx.handleClickPreMonth,
onNextMonth: _ctx.handleClickNextMonth
}, null, 8 /* PROPS */, ["minDate", "maxDate", "hideArrow", "monthFormat", "generateDate", "onSelectDate", "onPreMonth", "onNextMonth"]),
_createVNode$z(_component_at_calendar_body, {
marks: _ctx.marks,
format: _ctx.format,
minDate: _ctx.minDate,
maxDate: _ctx.maxDate,
isSwiper: _ctx.isSwiper,
isVertical: _ctx.isVertical,
validDates: _ctx.validDates,
selectedDate: _ctx.selectedDate,
selectedDates: _ctx.selectedDates,
generateDate: _ctx.generateDate,
onSwipeMonth: _ctx.setMonth,
onDayClick: _ctx.handleDayClick,
onLongClick: _ctx.handleDayLongClick
}, null, 8 /* PROPS */, ["marks", "format", "minDate", "maxDate", "isSwiper", "isVertical", "validDates", "selectedDate", "selectedDates", "generateDate", "onSwipeMonth", "onDayClick", "onLongClick"])
]),
_: 1 /* STABLE */
}, 16 /* FULL_PROPS */))
}
AtCalendar.render = _sfc_render$M;
const AtCard = defineComponent({
name: "AtCard",
emits: ["click"],
props: {
isFull: Boolean,
note: String,
thumb: String,
title: String,
extra: String,
extraStyle: Object,
icon: Object
},
setup(props, { emit }) {
const { iconClasses } = useIconClasses(props.icon);
const { iconStyle } = useIconStyle(props.icon);
function handleClick(args) {
emit("click", args);
}
return {
...toRefs(props),
iconClasses,
iconStyle,
handleClick
};
}
});
// Binding optimization for webpack code-split
const _resolveComponent$L = resolveComponent, _createVNode$y = createVNode, _withCtx$K = withCtx, _openBlock$L = openBlock, _createBlock$L = createBlock, _createCommentVNode$o = createCommentVNode, _renderSlot$n = renderSlot, _normalizeClass$k = normalizeClass, _normalizeStyle$l = normalizeStyle, _toDisplayString$s = toDisplayString, _createTextVNode$s = createTextVNode, _mergeProps$J = mergeProps;
function _sfc_render$L(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_image = _resolveComponent$L("taro-image");
const _component_taro_view = _resolveComponent$L("taro-view");
const _component_taro_text = _resolveComponent$L("taro-text");
return (_openBlock$L(), _createBlock$L(_component_taro_view, _mergeProps$J(_ctx.$attrs, {
class: ['at-card', { 'at-card--full': _ctx.isFull }],
onTap: _ctx.handleClick
}), {
default: _withCtx$K(() => [
_createVNode$y(_component_taro_view, { class: "at-card__header" }, {
default: _withCtx$K(() => [
(_ctx.thumb)
? (_openBlock$L(), _createBlock$L(_component_taro_view, {
key: 0,
class: "at-card__header-thumb"
}, {
default: _withCtx$K(() => [
_createVNode$y(_component_taro_image, {
class: "at-card__header-thumb-info",
mode: "scaleToFill",
src: _ctx.thumb
}, null, 8 /* PROPS */, ["src"])
]),
_: 1 /* STABLE */
}))
: (_ctx.$slots.renderIcon)
? _renderSlot$n(_ctx.$slots, "renderIcon", { key: 1 })
: (_ctx.icon && _ctx.icon.value)
? (_openBlock$L(), _createBlock$L(_component_taro_text, {
key: 2,
class: _normalizeClass$k(['at-card__header-icon', _ctx.iconClasses ]),
style: _normalizeStyle$l(_ctx.iconStyle)
}, null, 8 /* PROPS */, ["class", "style"]))
: _createCommentVNode$o("v-if", true),
(_ctx.title)
? (_openBlock$L(), _createBlock$L(_component_taro_text, {
key: 3,
class: "at-card__header-title"
}, {
default: _withCtx$K(() => [
_createTextVNode$s(_toDisplayString$s(_ctx.title), 1 /* TEXT */)
]),
_: 1 /* STABLE */
}))
: _createCommentVNode$o("v-if", true),
(_ctx.extra)
? (_openBlock$L(), _createBlock$L(_component_taro_text, {
key: 4,
class: "at-card__header-extra",
style: _normalizeStyle$l({ ...(_ctx.extraStyle || {}) })
}, {
default: _withCtx$K(() => [
_createTextVNode$s(_toDisplayString$s(_ctx.extra), 1 /* TEXT */)
]),
_: 1 /* STABLE */
}, 8 /* PROPS */, ["style"]))
: _createCommentVNode$o("v-if", true)
]),
_: 3 /* FORWARDED */
}),
_createVNode$y(_component_taro_view, { class: "at-card__content" }, {
default: _withCtx$K(() => [
_createVNode$y(_component_taro_view, { class: "at-card__content-info" }, {
default: _withCtx$K(() => [
_renderSlot$n(_ctx.$slots, "default")
]),
_: 3 /* FORWARDED */
}),
(_ctx.note)
? (_openBlock$L(), _createBlock$L(_component_taro_view, {
key: 0,
class: "at-card__content-note"
}, {
default: _withCtx$K(() => [
_createTextVNode$s(_toDisplayString$s(_ctx.note), 1 /* TEXT */)
]),
_: 1 /* STABLE */
}))
: _createCommentVNode$o("v-if", true)
]),
_: 3 /* FORWARDED */
})
]),
_: 3 /* FORWARDED */
}, 16 /* FULL_PROPS */, ["class", "onTap"]))
}
AtCard.render = _sfc_render$L;
const AtCheckbox = defineComponent({
name: "AtCheckbox",
emits: {
"update:selectedList"(selectedList) {
return !!(selectedList && Array.isArray(selectedList));
}
},
props: {
options: {
type: Array,
required: true
},
selectedList: {
type: Array,
default: () => []
}
},
setup(props, { emit }) {
const selectedList = useModelValue(props, emit, "selectedList");
const genOptionClasses = (option) => ({
"at-checkbox__option": true,
"at-checkbox__option--disabled": option.disabled,
"at-checkbox__option--selected": props.selectedList.includes(option.value)
});
function handleClick(idx) {
const option = props.options[idx];
const { disabled, value } = option;
if (disabled)
return;
const selectedSet = new Set(props.selectedList);
if (!selectedSet.has(value)) {
selectedSet.add(value);
} else {
selectedSet.delete(value);
}
selectedList.value = Array.from(selectedSet);
}
return {
options: toRef(props, "options"),
genOptionClasses,
handleClick
};
}
});
// Binding optimization for webpack code-split
const _renderList$e = renderList, _Fragment$e = Fragment, _openBlock$K = openBlock, _createElementBlock$e = createElementBlock, _resolveComponent$K = resolveComponent, _createVNode$x = createVNode, _withCtx$J = withCtx, _toDisplayString$r = toDisplayString, _createTextVNode$r = createTextVNode, _createBlock$K = createBlock, _createCommentVNode$n = createCommentVNode, _normalizeClass$j = normalizeClass, _mergeProps$I = mergeProps;
function _sfc_render$K(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_text = _resolveComponent$K("taro-text");
const _component_taro_view = _resolveComponent$K("taro-view");
return (_openBlock$K(), _createBlock$K(_component_taro_view, _mergeProps$I(_ctx.$attrs, { class: "at-checkbox" }), {
default: _withCtx$J(() => [
(_openBlock$K(true), _createElementBlock$e(_Fragment$e, null, _renderList$e(_ctx.options, (option, idx) => {
return (_openBlock$K(), _createBlock$K(_component_taro_view, {
key: option.value,
class: _normalizeClass$j(_ctx.genOptionClasses(option)),
onTap: $event => (_ctx.handleClick(idx))
}, {
default: _withCtx$J(() => [
_createVNode$x(_component_taro_view, { class: "at-checkbox__option-wrap" }, {
default: _withCtx$J(() => [
_createVNode$x(_component_taro_view, { class: "at-checkbox__option-cnt" }, {
default: _withCtx$J(() => [
_createVNode$x(_component_taro_view, { class: "at-checkbox__icon-cnt" }, {
default: _withCtx$J(() => [
_createVNode$x(_component_taro_text, { class: "at-icon at-icon-check" })
]),
_: 1 /* STABLE */
}),
_createVNode$x(_component_taro_view, { class: "at-checkbox__title" }, {
default: _withCtx$J(() => [
_createTextVNode$r(_toDisplayString$r(option.label), 1 /* TEXT */)
]),
_: 2 /* DYNAMIC */
}, 1024 /* DYNAMIC_SLOTS */)
]),
_: 2 /* DYNAMIC */
}, 1024 /* DYNAMIC_SLOTS */),
(option.desc)
? (_openBlock$K(), _createBlock$K(_component_taro_view, {
key: 0,
class: "at-checkbox__desc"
}, {
default: _withCtx$J(() => [
_createTextVNode$r(_toDisplayString$r(option.desc), 1 /* TEXT */)
]),
_: 2 /* DYNAMIC */
}, 1024 /* DYNAMIC_SLOTS */))
: _createCommentVNode$n("v-if", true)
]),
_: 2 /* DYNAMIC */
}, 1024 /* DYNAMIC_SLOTS */)
]),
_: 2 /* DYNAMIC */
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["class", "onTap"]))
}), 128 /* KEYED_FRAGMENT */))
]),
_: 1 /* STABLE */
}, 16 /* FULL_PROPS */))
}
AtCheckbox.render = _sfc_render$K;
const AtCountdownItem = defineComponent({
name: "AtCountdownItem",
props: {
num: {
type: Number,
default: 0
},
separator: {
type: String,
default: ":"
}
},
setup(props) {
function formatNum(num) {
return num <= 9 ? `0${num}` : `${num}`;
}
return {
...toRefs(props),
formatNum
};
}
});
// Binding optimization for webpack code-split
const _toDisplayString$q = toDisplayString, _createTextVNode$q = createTextVNode, _resolveComponent$J = resolveComponent, _withCtx$I = withCtx, _createVNode$w = createVNode, _openBlock$J = openBlock, _createBlock$J = createBlock;
function _sfc_render$J(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_text = _resolveComponent$J("taro-text");
const _component_taro_view = _resolveComponent$J("taro-view");
return (_openBlock$J(), _createBlock$J(_component_taro_view, { class: "at-countdown__item" }, {
default: _withCtx$I(() => [
_createVNode$w(_component_taro_view, { class: "at-countdown__time-box" }, {
default: _withCtx$I(() => [
_createVNode$w(_component_taro_text, { class: "at-countdown__time" }, {
default: _withCtx$I(() => [
_createTextVNode$q(_toDisplayString$q(_ctx.formatNum(_ctx.num)), 1 /* TEXT */)
]),
_: 1 /* STABLE */
})
]),
_: 1 /* STABLE */
}),
_createVNode$w(_component_taro_text, { class: "at-countdown__separator" }, {
default: _withCtx$I(() => [
_createTextVNode$q(_toDisplayString$q(_ctx.separator), 1 /* TEXT */)
]),
_: 1 /* STABLE */
})
]),
_: 1 /* STABLE */
}))
}
AtCountdownItem.render = _sfc_render$J;
const toSeconds = (day, hours, minutes, seconds) => day * 60 * 60 * 24 + hours * 60 * 60 + minutes * 60 + seconds;
const AtCountdown = defineComponent({
name: "AtCountdown",
components: {
AtCountdownItem
},
emits: ["time-up"],
props: {
isCard: Boolean,
isShowDay: Boolean,
isShowHour: { type: Boolean, default: true },
format: {
type: Object,
default: () => ({
day: "\u5929",
hours: "\u65F6",
minutes: "\u5206",
seconds: "\u79D2"
})
},
day: {
type: Number,
default: 0
},
hours: {
type: Number,
default: 0
},
minutes: {
type: Number,
default: 0
},
seconds: {
type: Number,
default: 0
}
},
onShow() {
this.setTimer();
},
onHide() {
this.clearTimer();
},
setup(props, { emit }) {
const { format, isCard, isShowDay, isShowHour } = toRefs(props);
const timer = ref(null);
const secondsRef = ref(toSeconds(props.day, props.hours, props.minutes, props.seconds));
const state = reactive(calculateTime());
watch(() => [
props.day,
props.hours,
props.minutes,
props.seconds
], ([
day,
hours,
minutes,
seconds
]) => {
secondsRef.value = toSeconds(day, hours, minutes, seconds);
clearTimer();
setTimer();
});
function setTimer() {
if (!timer.value)
countdown();
}
function clearTimer() {
if (timer.value) {
clearTimeout(timer.value);
}
}
function calculateTime() {
let [day_, hours_, minutes_, seconds_] = [0, 0, 0, 0];
if (secondsRef.value > 0) {
day_ = props.isShowDay ? Math.floor(secondsRef.value / (60 * 60 * 24)) : 0;
hours_ = Math.floor(secondsRef.value / (60 * 60)) - day_ * 24;
minutes_ = Math.floor(secondsRef.value / 60) - day_ * 24 * 60 - hours_ * 60;
seconds_ = Math.floor(secondsRef.value) - day_ * 24 * 60 * 60 - hours_ * 60 * 60 - minutes_ * 60;
}
return {
day_,
hours_,
minutes_,
seconds_
};
}
function countdown() {
Object.assign(state, calculateTime());
secondsRef.value--;
if (secondsRef.value < 0) {
clearTimer();
emit("time-up");
return;
}
timer.value = setTimeout(() => {
countdown();
}, 1e3);
}
onMounted(() => {
setTimer();
});
onUnmounted(() => {
clearTimer();
});
return {
...toRefs(state),
format,
isCard,
isShowDay,
isShowHour
};
}
});
// Binding optimization for webpack code-split
const _resolveComponent$I = resolveComponent, _openBlock$I = openBlock, _createBlock$I = createBlock, _createCommentVNode$m = createCommentVNode, _createVNode$v = createVNode, _mergeProps$H = mergeProps, _withCtx$H = withCtx;
function _sfc_render$I(_ctx, _cache, $props, $setup, $data, $options) {
const _component_at_countdown_item = _resolveComponent$I("at-countdown-item");
const _component_taro_view = _resolveComponent$I("taro-view");
return (_openBlock$I(), _createBlock$I(_component_taro_view, _mergeProps$H(_ctx.$attrs, {
class: ['at-countdown', {'at-countdown--card': _ctx.isCard }]
}), {
default: _withCtx$H(() => [
(_ctx.isShowDay)
? (_openBlock$I(), _createBlock$I(_component_at_countdown_item, {
key: 0,
num: _ctx.day_,
separator: _ctx.format?.day
}, null, 8 /* PROPS */, ["num", "separator"]))
: _createCommentVNode$m("v-if", true),
(_ctx.isShowHour)
? (_openBlock$I(), _createBlock$I(_component_at_countdown_item, {
key: 1,
num: _ctx.hours_,
separator: _ctx.format?.hours
}, null, 8 /* PROPS */, ["num", "separator"]))
: _createCommentVNode$m("v-if", true),
_createVNode$v(_component_at_countdown_item, {
num: _ctx.minutes_,
separator: _ctx.format?.minutes
}, null, 8 /* PROPS */, ["num", "separator"]),
_createVNode$v(_component_at_countdown_item, {
num: _ctx.seconds_,
separator: _ctx.format?.seconds
}, null, 8 /* PROPS */, ["num", "separator"])
]),
_: 1 /* STABLE */
}, 16 /* FULL_PROPS */, ["class"]))
}
AtCountdown.render = _sfc_render$I;
const AtCurtain = defineComponent({
name: "AtCurtain",
emits: ["close"],
props: {
isOpened: Boolean,
closeBtnPosition: {
type: String,
default: "bottom",
validator: (pos) => [
"top",
"top-left",
"top-right",
"bottom",
"bottom-left",
"bottom-right"
].includes(pos)
}
},
setup(props, { emit }) {
const closeBtnClasses = computed(() => {
const pos = [
"top",
"top-left",
"top-right",
"bottom",
"bottom-left",
"bottom-right"
].includes(props.closeBtnPosition) ? props.closeBtnPosition : "top-right";
return {
[`at-curtain__btn-close--${pos}`]: Boolean(props.closeBtnPosition)
};
});
function handleClose(e) {
e.stopPropagation();
emit("close", e);
}
return {
isOpened: toRef(props, "isOpened"),
handleClose,
closeBtnClasses
};
}
});
// Binding optimization for webpack code-split
const _renderSlot$m = renderSlot, _resolveComponent$H = resolveComponent, _normalizeClass$i = normalizeClass, _createVNode$u = createVNode, _withCtx$G = withCtx, _mergeProps$G = mergeProps, _openBlock$H = openBlock, _createBlock$H = createBlock;
function _sfc_render$H(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_view = _resolveComponent$H("taro-view");
return (_openBlock$H(), _createBlock$H(_component_taro_view, _mergeProps$G(_ctx.$attrs, {
class: ['at-curtain', { 'at-curtain--closed': !_ctx.isOpened }],
onTap: _cache[0] || (_cache[0] = (e) => { e.stopPropagation(); })
}), {
default: _withCtx$G(() => [
_createVNode$u(_component_taro_view, { class: "at-curtain__container" }, {
default: _withCtx$G(() => [
_createVNode$u(_component_taro_view, { class: "at-curtain__body" }, {
default: _withCtx$G(() => [
_renderSlot$m(_ctx.$slots, "default"),
_createVNode$u(_component_taro_view, {
class: _normalizeClass$i(['at-curtain__btn-close', _ctx.closeBtnClasses]),
onTap: _ctx.handleClose
}, null, 8 /* PROPS */, ["class", "onTap"])
]),
_: 3 /* FORWARDED */
})
]),
_: 3 /* FORWARDED */
})
]),
_: 3 /* FORWARDED */
}, 16 /* FULL_PROPS */, ["class"]))
}
AtCurtain.render = _sfc_render$H;
const AtDivider = defineComponent({
name: "AtDivider",
props: {
content: String,
height: {
type: [Number, String],
default: 0
},
fontColor: {
type: String,
default: ""
},
fontSize: {
type: [Number, String],
default: 0
},
lineColor: {
type: String,
default: ""
}
},
setup(props) {
const rootStyle = computed(() => ({
height: props.height ? `${pxTransform(Number(props.height))}` : ""
}));
const fontStyle = computed(() => ({
color: props.fontColor,
fontSize: props.fontSize ? `${pxTransform(Number(props.fontSize))}` : ""
}));
const lineStyle = computed(() => ({
backgroundColor: props.lineColor
}));
return {
content: toRef(props, "content"),
rootStyle,
fontStyle,
lineStyle
};
}
});
// Binding optimization for webpack code-split
const _toDisplayString$p = toDisplayString, _createTextVNode$p = createTextVNode, _resolveComponent$G = resolveComponent, _withCtx$F = withCtx, _openBlock$G = openBlock, _createBlock$G = createBlock, _renderSlot$l = renderSlot, _normalizeStyle$k = normalizeStyle, _createVNode$t = createVNode, _mergeProps$F = mergeProps;
function _sfc_render$G(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_view = _resolveComponent$G("taro-view");
return (_openBlock$G(), _createBlock$G(_component_taro_view, _mergeProps$F(_ctx.$attrs, {
class: "at-divider",
style: _ctx.rootStyle
}), {
default: _withCtx$F(() => [
_createVNode$t(_component_taro_view, {
class: "at-divider__content",
style: _normalizeStyle$k(_ctx.fontStyle)
}, {
default: _withCtx$F(() => [
(_ctx.content)
? (_openBlock$G(), _createBlock$G(_component_taro_view, { key: 0 }, {
default: _withCtx$F(() => [
_createTextVNode$p(_toDisplayString$p(_ctx.content), 1 /* TEXT */)
]),
_: 1 /* STABLE */
}))
: _renderSlot$l(_ctx.$slots, "default", { key: 1 })
]),
_: 3 /* FORWARDED */
}, 8 /* PROPS */, ["style"]),
_createVNode$t(_component_taro_view, {
class: "at-divider__line",
style: _normalizeStyle$k(_ctx.lineStyle)
}, null, 8 /* PROPS */, ["style"])
]),
_: 3 /* FORWARDED */
}, 16 /* FULL_PROPS */, ["style"]))
}
AtDivider.render = _sfc_render$G;
const AtList = defineComponent({
name: "AtList",
props: {
hasBorder: { type: Boolean, default: true }
},
setup(props) {
return {
...toRefs(props)
};
}
});
// Binding optimization for webpack code-split
const _renderSlot$k = renderSlot, _resolveComponent$F = resolveComponent, _mergeProps$E = mergeProps, _withCtx$E = withCtx, _openBlock$F = openBlock, _createBlock$F = createBlock;
function _sfc_render$F(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_view = _resolveComponent$F("taro-view");
return (_openBlock$F(), _createBlock$F(_component_taro_view, _mergeProps$E(_ctx.$attrs, {
class: ['at-list', {
'at-list--no-border': !_ctx.hasBorder
}]
}), {
default: _withCtx$E(() => [
_renderSlot$k(_ctx.$slots, "default")
]),
_: 3 /* FORWARDED */
}, 16 /* FULL_PROPS */, ["class"]))
}
AtList.render = _sfc_render$F;
const AtListItem = defineComponent({
name: "AtListItem",
emits: ["click", "switch-change"],
props: {
note: String,
title: { type: String, default: "" },
thumb: String,
extraText: String,
extraThumb: String,
switchColor: { type: String, default: "#6190E8" },
disabled: Boolean,
isSwitch: Boolean,
switchChecked: Boolean,
hasBorder: Boolean,
iconInfo: Object,
arrow: {
type: String,
validator: (prop) => ["up", "down", "right"].includes(prop)
}
},
setup(props, { emit }) {
const rootClasses = computed(() => ["at-list__item", {
"at-list__item--thumb": props.thumb,
"at-list__item--multiple": props.note,
"at-list__item--disabled": props.disabled,
"at-list__item--no-border": !props.hasBorder
}]);
const { iconStyle } = useIconStyle(props.iconInfo, "", 24);
const { iconClasses } = useIconClasses(props.iconInfo, true);
const arrowClasses = computed(() => {
if (!props.arrow)
return {};
let arrow = "right";
if (["up", "down"].includes(props.arrow)) {
arrow = props.arrow;
}
return {
[`at-icon-chevron-${arrow}`]: Boolean(props.arrow)
};
});
function handleClick(e) {
if (!props.disabled) {
emit("click", e);
}
}
function handleSwitchClick(e) {
e.stopPropagation();
}
function handleSwitchChange(e) {
if (!props.disabled) {
emit("switch-change", e);
}
}
return {
...toRefs(props),
rootClasses,
iconStyle,
iconClasses,
arrowClasses,
handleClick,
handleSwitchClick,
handleSwitchChange
};
}
});
// Binding optimization for webpack code-split
const _resolveComponent$E = resolveComponent, _createVNode$s = createVNode, _withCtx$D = withCtx, _openBlock$E = openBlock, _createBlock$E = createBlock, _createCommentVNode$l = createCommentVNode, _normalizeClass$h = normalizeClass, _normalizeStyle$j = normalizeStyle, _toDisplayString$o = toDisplayString, _createTextVNode$o = createTextVNode, _mergeProps$D = mergeProps;
function _sfc_render$E(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_image = _resolveComponent$E("taro-image");
const _component_taro_view = _resolveComponent$E("taro-view");
const _component_taro_switch = _resolveComponent$E("taro-switch");
return (_openBlock$E(), _createBlock$E(_component_taro_view, _mergeProps$D(_ctx.$attrs, {
class: _ctx.rootClasses,
onTap: _ctx.handleClick
}), {
default: _withCtx$D(() => [
_createVNode$s(_component_taro_view, { class: "at-list__item-container" }, {
default: _withCtx$D(() => [
(_ctx.thumb)
? (_openBlock$E(), _createBlock$E(_component_taro_view, {
key: 0,
class: "item-thumb at-list__item-thumb"
}, {
default: _withCtx$D(() => [
_createVNode$s(_component_taro_image, {
class: "item-thumb__info",
mode: "scaleToFill",
src: _ctx.thumb
}, null, 8 /* PROPS */, ["src"])
]),
_: 1 /* STABLE */
}))
: _createCommentVNode$l("v-if", true),
(_ctx.iconInfo && _ctx.iconInfo.value)
? (_openBlock$E(), _createBlock$E(_component_taro_view, {
key: 1,
class: "item-icon at-list__item-icon"
}, {
default: _withCtx$D(() => [
_createVNode$s(_component_taro_view, {
class: _normalizeClass$h(_ctx.iconClasses),
style: _normalizeStyle$j(_ctx.iconStyle)
}, null, 8 /* PROPS */, ["class", "style"])
]),
_: 1 /* STABLE */
}))
: _createCommentVNode$l("v-if", true),
_createVNode$s(_component_taro_view, { class: "item-content at-list__item-content" }, {
default: _withCtx$D(() => [
_createVNode$s(_component_taro_view, { class: "item-content__info" }, {
default: _withCtx$D(() => [
_createVNode$s(_component_taro_view, { class: "item-content__info-title" }, {
default: _withCtx$D(() => [
_createTextVNode$o(_toDisplayString$o(_ctx.title), 1 /* TEXT */)
]),
_: 1 /* STABLE */
}),
(_ctx.note)
? (_openBlock$E(), _createBlock$E(_component_taro_view, {
key: 0,
class: "item-content__info-note"
}, {
default: _withCtx$D(() => [
_createTextVNode$o(_toDisplayString$o(_ctx.note), 1 /* TEXT */)
]),
_: 1 /* STABLE */
}))
: _createCommentVNode$l("v-if", true)
]),
_: 1 /* STABLE */
})
]),
_: 1 /* STABLE */
}),
_createVNode$s(_component_taro_view, { class: "item-extra at-list__item-extra" }, {
default: _withCtx$D(() => [
(_ctx.extraText)
? (_openBlock$E(), _createBlock$E(_component_taro_view, {
key: 0,
class: "item-extra__info"
}, {
default: _withCtx$D(() => [
_createTextVNode$o(_toDisplayString$o(_ctx.extraText), 1 /* TEXT */)
]),
_: 1 /* STABLE */
}))
: _createCommentVNode$l("v-if", true),
(_ctx.extraThumb && !_ctx.extraText)
? (_openBlock$E(), _createBlock$E(_component_taro_view, {
key: 1,
class: "item-extra__image"
}, {
default: _withCtx$D(() => [
_createVNode$s(_component_taro_image, {
class: "item-extra__image-info",
mode: "aspectFit",
src: _ctx.extraThumb
}, null, 8 /* PROPS */, ["src"])
]),
_: 1 /* STABLE */
}))
: _createCommentVNode$l("v-if", true),
(_ctx.isSwitch && !_ctx.extraThumb && !_ctx.extraText)
? (_openBlock$E(), _createBlock$E(_component_taro_view, {
key: 2,
class: "item-extra__switch",
onTap: _cache[0] || (_cache[0] = e => _ctx.handleSwitchClick(e))
}, {
default: _withCtx$D(() => [
_createVNode$s(_component_taro_switch, {
color: _ctx.switchColor,
disabled: _ctx.disabled,
checked: _ctx.switchChecked,
onChange: _ctx.handleSwitchChange
}, null, 8 /* PROPS */, ["color", "disabled", "checked", "onChange"])
]),
_: 1 /* STABLE */
}))
: _createCommentVNode$l("v-if", true),
(_ctx.arrow)
? (_openBlock$E(), _createBlock$E(_component_taro_view, {
key: 3,
class: "item-extra__icon"
}, {
default: _withCtx$D(() => [
_createVNode$s(_component_taro_view, {
class: _normalizeClass$h(['at-icon', 'item-extra__icon-arrow', _ctx.arrowClasses])
}, null, 8 /* PROPS */, ["class"])
]),
_: 1 /* STABLE */
}))
: _createCommentVNode$l("v-if", true)
]),
_: 1 /* STABLE */
})
]),
_: 1 /* STABLE */
})
]),
_: 1 /* STABLE */
}, 16 /* FULL_PROPS */, ["class", "onTap"]))
}
AtListItem.render = _sfc_render$E;
const AtDrawer = defineComponent({
name: "AtDrawer",
components: {
AtList,
AtListItem
},
emits: {
"close": null,
"item-click"(index) {
return !!(typeof index === "number");
}
},
props: {
show: Boolean,
right: Boolean,
mask: {
type: Boolean,
default: true
},
width: {
type: String,
default: "230px"
},
items: Array
},
setup(props, { emit }) {
const state = reactive({
animShow: false,
_show: props.show
});
const rootClasses = computed(() => ({
"at-drawer--show": state.animShow,
"at-drawer--right": props.right,
"at-drawer--left": !props.right
}));
const maskStyle = computed(() => ({
display: props.mask ? "block" : "none",
opacity: state.animShow ? 1 : 0
}));
const listStyle = computed(() => ({
width: props.width,
transition: state.animShow ? "all 225ms cubic-bezier(0, 0, 0.2, 1)" : "all 195ms cubic-bezier(0.4, 0, 0.6, 1)"
}));
watch(() => props.show, (val) => {
if (val !== state._show) {
val ? showAnimation() : hideAnimation();
}
});
onMounted(() => {
if (state._show) {
showAnimation();
}
});
function handleItemClick(index) {
emit("item-click", index);
hideAnimation();
}
function onHide() {
state._show = false;
nextTick(() => {
emit("close");
});
}
function hideAnimation() {
state.animShow = false;
setTimeout(() => {
onHide();
}, 300);
}
function showAnimation() {
state._show = true;
setTimeout(() => {
state.animShow = true;
}, 200);
}
function handleMaskClick() {
hideAnimation();
}
return {
show: toRef(state, "_show"),
items: toRef(props, "items"),
rootClasses,
maskStyle,
listStyle,
handleMaskClick,
handleItemClick
};
}
});
// Binding optimization for webpack code-split
const _resolveComponent$D = resolveComponent, _normalizeStyle$i = normalizeStyle, _createVNode$r = createVNode, _renderList$d = renderList, _Fragment$d = Fragment, _openBlock$D = openBlock, _createElementBlock$d = createElementBlock, _createBlock$D = createBlock, _withCtx$C = withCtx, _createCommentVNode$k = createCommentVNode, _renderSlot$j = renderSlot, _mergeProps$C = mergeProps;
function _sfc_render$D(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_view = _resolveComponent$D("taro-view");
const _component_at_list_item = _resolveComponent$D("at-list-item");
const _component_at_list = _resolveComponent$D("at-list");
return (_ctx.show)
? (_openBlock$D(), _createBlock$D(_component_taro_view, _mergeProps$C({ key: 0 }, _ctx.$attrs, {
class: ['at-drawer', _ctx.rootClasses]
}), {
default: _withCtx$C(() => [
_createVNode$r(_component_taro_view, {
class: "at-drawer__mask",
style: _normalizeStyle$i(_ctx.maskStyle),
onTap: _ctx.handleMaskClick
}, null, 8 /* PROPS */, ["style", "onTap"]),
_createVNode$r(_component_taro_view, {
class: "at-drawer__content",
style: _normalizeStyle$i(_ctx.listStyle)
}, {
default: _withCtx$C(() => [
(!!_ctx.items && _ctx.items.length)
? (_openBlock$D(), _createBlock$D(_component_at_list, { key: 0 }, {
default: _withCtx$C(() => [
(_openBlock$D(true), _createElementBlock$d(_Fragment$d, null, _renderList$d(_ctx.items, (name, index) => {
return (_openBlock$D(), _createBlock$D(_component_at_list_item, {
key: `${name}-${index}`,
dataIndex: index,
title: name,
arrow: "right",
onClick: $event => (_ctx.handleItemClick(index))
}, null, 8 /* PROPS */, ["dataIndex", "title", "onClick"]))
}), 128 /* KEYED_FRAGMENT */))
]),
_: 1 /* STABLE */
}))
: _renderSlot$j(_ctx.$slots, "default", { key: 1 })
]),
_: 3 /* FORWARDED */
}, 8 /* PROPS */, ["style"])
]),
_: 3 /* FORWARDED */
}, 16 /* FULL_PROPS */, ["class"]))
: _createCommentVNode$k("v-if", true)
}
AtDrawer.render = _sfc_render$D;
const AtFab = defineComponent({
name: "AtFab",
emits: ["click"],
props: {
size: {
type: String,
default: "normal",
validator: (prop) => ["normal", "small"].includes(prop)
}
},
setup(props, { emit }) {
function handleClick(e) {
emit("click", e);
}
return {
...toRefs(props),
handleClick
};
}
});
// Binding optimization for webpack code-split
const _renderSlot$i = renderSlot, _resolveComponent$C = resolveComponent, _mergeProps$B = mergeProps, _withCtx$B = withCtx, _openBlock$C = openBlock, _createBlock$C = createBlock;
function _sfc_render$C(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_view = _resolveComponent$C("taro-view");
return (_openBlock$C(), _createBlock$C(_component_taro_view, _mergeProps$B(_ctx.$attrs, {
class: ['at-fab', { [`at-fab--${_ctx.size}`]: _ctx.size } ],
onTap: _ctx.handleClick
}), {
default: _withCtx$B(() => [
_renderSlot$i(_ctx.$slots, "default")
]),
_: 3 /* FORWARDED */
}, 16 /* FULL_PROPS */, ["class", "onTap"]))
}
AtFab.render = _sfc_render$C;
const AtFlex = defineComponent({
name: "AtFlex",
props: {
wrap: {
type: String
},
align: {
type: String
},
justify: {
type: String
},
direction: {
type: String
},
alignContent: {
type: String
}
},
setup(props) {
const rootClasses = computed(() => ({
"at-row": true,
[`at-row--${props.wrap}`]: Boolean(props.wrap),
[`at-row__align--${props.align}`]: Boolean(props.align),
[`at-row__justify--${props.justify}`]: Boolean(props.justify),
[`at-row__direction--${props.direction}`]: Boolean(props.direction),
[`at-row__align-content--${props.alignContent}`]: Boolean(props.alignContent)
}));
return {
rootClasses
};
}
});
// Binding optimization for webpack code-split
const _renderSlot$h = renderSlot, _resolveComponent$B = resolveComponent, _mergeProps$A = mergeProps, _withCtx$A = withCtx, _openBlock$B = openBlock, _createBlock$B = createBlock;
function _sfc_render$B(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_view = _resolveComponent$B("taro-view");
return (_openBlock$B(), _createBlock$B(_component_taro_view, _mergeProps$A(_ctx.$attrs, { class: _ctx.rootClasses }), {
default: _withCtx$A(() => [
_renderSlot$h(_ctx.$slots, "default")
]),
_: 3 /* FORWARDED */
}, 16 /* FULL_PROPS */, ["class"]))
}
AtFlex.render = _sfc_render$B;
const AtFlexItem = defineComponent({
name: "AtFlexItem",
props: {
isAuto: Boolean,
isWrap: Boolean,
align: {
type: String
},
size: {
type: Number,
default: 0
},
offset: {
type: Number,
default: 0
}
},
setup(props) {
const rootClasses = computed(() => ({
[`at-col-${props.size}`]: Boolean(props.size),
[`at-col__align--${props.align}`]: Boolean(props.align),
[`at-col__offset-${props.offset}`]: Boolean(props.offset),
"at-col--auto": Boolean(props.isAuto),
"at-col--wrap": Boolean(props.isWrap),
"at-col": true
}));
return {
rootClasses
};
}
});
// Binding optimization for webpack code-split
const _renderSlot$g = renderSlot, _resolveComponent$A = resolveComponent, _mergeProps$z = mergeProps, _withCtx$z = withCtx, _openBlock$A = openBlock, _createBlock$A = createBlock;
function _sfc_render$A(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_view = _resolveComponent$A("taro-view");
return (_openBlock$A(), _createBlock$A(_component_taro_view, _mergeProps$z(_ctx.$attrs, { class: _ctx.rootClasses }), {
default: _withCtx$z(() => [
_renderSlot$g(_ctx.$slots, "default")
]),
_: 3 /* FORWARDED */
}, 16 /* FULL_PROPS */, ["class"]))
}
AtFlexItem.render = _sfc_render$A;
const AtFloatLayout = defineComponent({
name: "AtFloatLayout",
emits: {
"close": null,
"scroll"(e) {
return !!(e && typeof e === "object");
},
"scroll-to-upper"(e) {
return !!(e && typeof e === "object");
},
"scroll-to-lower"(e) {
return !!(e && typeof e === "object");
}
},
props: {
title: String,
scrollWithAnimation: Boolean,
isOpened: Boolean,
scrollX: Boolean,
scrollY: {
type: Boolean,
default: true
},
scrollTop: Number,
scrollLeft: Number,
upperThreshold: Number,
lowerThreshold: Number
},
setup(props, { emit }) {
const _isOpened = ref(props.isOpened);
const rootClasses = computed(() => ["at-float-layout", {
"at-float-layout--active": _isOpened.value
}]);
const disableScroll = process.env.TARO_ENV === "alipay" ? { disableScroll: true } : {};
const trapScroll = process.env.TARO_ENV === "alipay" ? { trapScroll: true } : {};
watch(() => props.isOpened, (val, oldVal) => {
if (val === oldVal) {
handleTouchScroll(val);
}
if (val !== _isOpened.value) {
_isOpened.value = val;
}
});
function handleClose() {
_isOpened.value = false;
nextTick(() => {
emit("close");
});
}
function handleTouchMove(e) {
e.stopPropagation();
}
return {
...toRefs(props),
rootClasses,
trapScroll,
disableScroll,
handleClose,
handleTouchMove
};
}
});
// Binding optimization for webpack code-split
const _resolveComponent$z = resolveComponent, _mergeProps$y = mergeProps, _createVNode$q = createVNode, _toDisplayString$n = toDisplayString, _createTextVNode$n = createTextVNode, _withCtx$y = withCtx, _openBlock$z = openBlock, _createBlock$z = createBlock, _createCommentVNode$j = createCommentVNode, _renderSlot$f = renderSlot;
function _sfc_render$z(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_view = _resolveComponent$z("taro-view");
const _component_taro_text = _resolveComponent$z("taro-text");
const _component_taro_scroll_view = _resolveComponent$z("taro-scroll-view");
return (_openBlock$z(), _createBlock$z(_component_taro_view, _mergeProps$y(_ctx.$attrs, {
class: _ctx.rootClasses,
catchMove: true,
onTouchmove: _ctx.handleTouchMove
}), {
default: _withCtx$y(() => [
_createVNode$q(_component_taro_view, _mergeProps$y({ class: "at-float-layout__overlay" }, _ctx.disableScroll, { onTap: _ctx.handleClose }), null, 16 /* FULL_PROPS */, ["onTap"]),
_createVNode$q(_component_taro_view, { class: "at-float-layout__container layout" }, {
default: _withCtx$y(() => [
(_ctx.title)
? (_openBlock$z(), _createBlock$z(_component_taro_view, {
key: 0,
class: "layout-header"
}, {
default: _withCtx$y(() => [
_createVNode$q(_component_taro_text, { class: "layout-header__title" }, {
default: _withCtx$y(() => [
_createTextVNode$n(_toDisplayString$n(_ctx.title), 1 /* TEXT */)
]),
_: 1 /* STABLE */
}),
_createVNode$q(_component_taro_view, {
class: "layout-header__btn-close",
onTap: _ctx.handleClose
}, null, 8 /* PROPS */, ["onTap"])
]),
_: 1 /* STABLE */
}))
: _createCommentVNode$j("v-if", true),
_createVNode$q(_component_taro_view, { class: "layout-body" }, {
default: _withCtx$y(() => [
_createVNode$q(_component_taro_scroll_view, _mergeProps$y({ class: "layout-body__content" }, _ctx.trapScroll, {
scrollX: _ctx.scrollX,
scrollY: _ctx.scrollY,
scrollTop: _ctx.scrollTop,
scrollLeft: _ctx.scrollLeft,
upperThreshold: _ctx.upperThreshold,
lowerThreshold: _ctx.lowerThreshold,
scrollWithAnimation: _ctx.scrollWithAnimation,
onScroll: _cache[0] || (_cache[0] = (e) => _ctx.$emit('scroll', e)),
onScrolltolower: _cache[1] || (_cache[1] = (e) => _ctx.$emit('scroll-to-lower', e)),
onScrolltoupper: _cache[2] || (_cache[2] = (e) => _ctx.$emit('scroll-to-upper', e))
}), {
default: _withCtx$y(() => [
_renderSlot$f(_ctx.$slots, "default")
]),
_: 3 /* FORWARDED */
}, 16 /* FULL_PROPS */, ["scrollX", "scrollY", "scrollTop", "scrollLeft", "upperThreshold", "lowerThreshold", "scrollWithAnimation"])
]),
_: 3 /* FORWARDED */
})
]),
_: 3 /* FORWARDED */
})
]),
_: 3 /* FORWARDED */
}, 16 /* FULL_PROPS */, ["class", "onTouchmove"]))
}
AtFloatLayout.render = _sfc_render$z;
const AtForm = defineComponent({
name: "AtForm",
emits: {
"submit"(e) {
return !!(e && typeof e === "object");
},
"reset"(e) {
return !!(e && typeof e === "object");
}
},
props: {
reportSubmit: Boolean
}
});
// Binding optimization for webpack code-split
const _renderSlot$e = renderSlot, _resolveComponent$y = resolveComponent, _mergeProps$x = mergeProps, _withCtx$x = withCtx, _openBlock$y = openBlock, _createBlock$y = createBlock;
function _sfc_render$y(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_form = _resolveComponent$y("taro-form");
return (_openBlock$y(), _createBlock$y(_component_taro_form, _mergeProps$x(_ctx.$attrs, {
class: "at-form",
reportSubmit: this.reportSubmit,
onSubmit: _cache[0] || (_cache[0] = (e) => _ctx.$emit('submit', e)),
onReset: _cache[1] || (_cache[1] = (e) => _ctx.$emit('reset', e))
}), {
default: _withCtx$x(() => [
_renderSlot$e(_ctx.$slots, "default")
]),
_: 3 /* FORWARDED */
}, 16 /* FULL_PROPS */, ["reportSubmit"]))
}
AtForm.render = _sfc_render$y;
/**
* The base implementation of `_.slice` without an iteratee call guard.
*
* @private
* @param {Array} array The array to slice.
* @param {number} [start=0] The start position.
* @param {number} [end=array.length] The end position.
* @returns {Array} Returns the slice of `array`.
*/
function baseSlice$1(array, start, end) {
var index = -1,
length = array.length;
if (start < 0) {
start = -start > length ? 0 : (length + start);
}
end = end > length ? length : end;
if (end < 0) {
end += length;
}
length = start > end ? 0 : ((end - start) >>> 0);
start >>>= 0;
var result = Array(length);
while (++index < length) {
result[index] = array[index + start];
}
return result;
}
var _baseSlice = baseSlice$1;
/**
* Performs a
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* comparison between two values to determine if they are equivalent.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
* @example
*
* var object = { 'a': 1 };
* var other = { 'a': 1 };
*
* _.eq(object, object);
* // => true
*
* _.eq(object, other);
* // => false
*
* _.eq('a', 'a');
* // => true
*
* _.eq('a', Object('a'));
* // => false
*
* _.eq(NaN, NaN);
* // => true
*/
function eq$1(value, other) {
return value === other || (value !== value && other !== other);
}
var eq_1 = eq$1;
/** Detect free variable `global` from Node.js. */
var freeGlobal$1 = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
var _freeGlobal = freeGlobal$1;
var freeGlobal = _freeGlobal;
/** Detect free variable `self`. */
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
/** Used as a reference to the global object. */
var root$1 = freeGlobal || freeSelf || Function('return this')();
var _root = root$1;
var root = _root;
/** Built-in value references. */
var Symbol$3 = root.Symbol;
var _Symbol = Symbol$3;
var Symbol$2 = _Symbol;
/** Used for built-in method references. */
var objectProto$1 = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto$1.hasOwnProperty;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var nativeObjectToString$1 = objectProto$1.toString;
/** Built-in value references. */
var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : undefined;
/**
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the raw `toStringTag`.
*/
function getRawTag$1(value) {
var isOwn = hasOwnProperty.call(value, symToStringTag$1),
tag = value[symToStringTag$1];
try {
value[symToStringTag$1] = undefined;
var unmasked = true;
} catch (e) {}
var result = nativeObjectToString$1.call(value);
if (unmasked) {
if (isOwn) {
value[symToStringTag$1] = tag;
} else {
delete value[symToStringTag$1];
}
}
return result;
}
var _getRawTag = getRawTag$1;
/** Used for built-in method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var nativeObjectToString = objectProto.toString;
/**
* Converts `value` to a string using `Object.prototype.toString`.
*
* @private
* @param {*} value The value to convert.
* @returns {string} Returns the converted string.
*/
function objectToString$1(value) {
return nativeObjectToString.call(value);
}
var _objectToString = objectToString$1;
var Symbol$1 = _Symbol,
getRawTag = _getRawTag,
objectToString = _objectToString;
/** `Object#toString` result references. */
var nullTag = '[object Null]',
undefinedTag = '[object Undefined]';
/** Built-in value references. */
var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : undefined;
/**
* The base implementation of `getTag` without fallbacks for buggy environments.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
function baseGetTag$2(value) {
if (value == null) {
return value === undefined ? undefinedTag : nullTag;
}
return (symToStringTag && symToStringTag in Object(value))
? getRawTag(value)
: objectToString(value);
}
var _baseGetTag = baseGetTag$2;
/**
* Checks if `value` is the
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
* @example
*
* _.isObject({});
* // => true
*
* _.isObject([1, 2, 3]);
* // => true
*
* _.isObject(_.noop);
* // => true
*
* _.isObject(null);
* // => false
*/
function isObject$3(value) {
var type = typeof value;
return value != null && (type == 'object' || type == 'function');
}
var isObject_1 = isObject$3;
var baseGetTag$1 = _baseGetTag,
isObject$2 = isObject_1;
/** `Object#toString` result references. */
var asyncTag = '[object AsyncFunction]',
funcTag = '[object Function]',
genTag = '[object GeneratorFunction]',
proxyTag = '[object Proxy]';
/**
* Checks if `value` is classified as a `Function` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
* @example
*
* _.isFunction(_);
* // => true
*
* _.isFunction(/abc/);
* // => false
*/
function isFunction$1(value) {
if (!isObject$2(value)) {
return false;
}
// The use of `Object#toString` avoids issues with the `typeof` operator
// in Safari 9 which returns 'object' for typed arrays and other constructors.
var tag = baseGetTag$1(value);
return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
}
var isFunction_1 = isFunction$1;
/** Used as references for various `Number` constants. */
var MAX_SAFE_INTEGER$1 = 9007199254740991;
/**
* Checks if `value` is a valid array-like length.
*
* **Note:** This method is loosely based on
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
* @example
*
* _.isLength(3);
* // => true
*
* _.isLength(Number.MIN_VALUE);
* // => false
*
* _.isLength(Infinity);
* // => false
*
* _.isLength('3');
* // => false
*/
function isLength$1(value) {
return typeof value == 'number' &&
value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER$1;
}
var isLength_1 = isLength$1;
var isFunction = isFunction_1,
isLength = isLength_1;
/**
* Checks if `value` is array-like. A value is considered array-like if it's
* not a function and has a `value.length` that's an integer greater than or
* equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
* @example
*
* _.isArrayLike([1, 2, 3]);
* // => true
*
* _.isArrayLike(document.body.children);
* // => true
*
* _.isArrayLike('abc');
* // => true
*
* _.isArrayLike(_.noop);
* // => false
*/
function isArrayLike$1(value) {
return value != null && isLength(value.length) && !isFunction(value);
}
var isArrayLike_1 = isArrayLike$1;
/** Used as references for various `Number` constants. */
var MAX_SAFE_INTEGER = 9007199254740991;
/** Used to detect unsigned integer values. */
var reIsUint = /^(?:0|[1-9]\d*)$/;
/**
* Checks if `value` is a valid array-like index.
*
* @private
* @param {*} value The value to check.
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
*/
function isIndex$1(value, length) {
var type = typeof value;
length = length == null ? MAX_SAFE_INTEGER : length;
return !!length &&
(type == 'number' ||
(type != 'symbol' && reIsUint.test(value))) &&
(value > -1 && value % 1 == 0 && value < length);
}
var _isIndex = isIndex$1;
var eq = eq_1,
isArrayLike = isArrayLike_1,
isIndex = _isIndex,
isObject$1 = isObject_1;
/**
* Checks if the given arguments are from an iteratee call.
*
* @private
* @param {*} value The potential iteratee value argument.
* @param {*} index The potential iteratee index or key argument.
* @param {*} object The potential iteratee object argument.
* @returns {boolean} Returns `true` if the arguments are from an iteratee call,
* else `false`.
*/
function isIterateeCall$1(value, index, object) {
if (!isObject$1(object)) {
return false;
}
var type = typeof index;
if (type == 'number'
? (isArrayLike(object) && isIndex(index, object.length))
: (type == 'string' && index in object)
) {
return eq(object[index], value);
}
return false;
}
var _isIterateeCall = isIterateeCall$1;
/** Used to match a single whitespace character. */
var reWhitespace$1 = /\s/;
/**
* Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
* character of `string`.
*
* @private
* @param {string} string The string to inspect.
* @returns {number} Returns the index of the last non-whitespace character.
*/
function trimmedEndIndex$2(string) {
var index = string.length;
while (index-- && reWhitespace$1.test(string.charAt(index))) {}
return index;
}
var _trimmedEndIndex = trimmedEndIndex$2;
var trimmedEndIndex$1 = _trimmedEndIndex;
/** Used to match leading whitespace. */
var reTrimStart$1 = /^\s+/;
/**
* The base implementation of `_.trim`.
*
* @private
* @param {string} string The string to trim.
* @returns {string} Returns the trimmed string.
*/
function baseTrim$2(string) {
return string
? string.slice(0, trimmedEndIndex$1(string) + 1).replace(reTrimStart$1, '')
: string;
}
var _baseTrim = baseTrim$2;
/**
* Checks if `value` is object-like. A value is object-like if it's not `null`
* and has a `typeof` result of "object".
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
* @example
*
* _.isObjectLike({});
* // => true
*
* _.isObjectLike([1, 2, 3]);
* // => true
*
* _.isObjectLike(_.noop);
* // => false
*
* _.isObjectLike(null);
* // => false
*/
function isObjectLike$1(value) {
return value != null && typeof value == 'object';
}
var isObjectLike_1 = isObjectLike$1;
var baseGetTag = _baseGetTag,
isObjectLike = isObjectLike_1;
/** `Object#toString` result references. */
var symbolTag$1 = '[object Symbol]';
/**
* Checks if `value` is classified as a `Symbol` primitive or object.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
* @example
*
* _.isSymbol(Symbol.iterator);
* // => true
*
* _.isSymbol('abc');
* // => false
*/
function isSymbol$2(value) {
return typeof value == 'symbol' ||
(isObjectLike(value) && baseGetTag(value) == symbolTag$1);
}
var isSymbol_1 = isSymbol$2;
var baseTrim$1 = _baseTrim,
isObject = isObject_1,
isSymbol$1 = isSymbol_1;
/** Used as references for various `Number` constants. */
var NAN$1 = 0 / 0;
/** Used to detect bad signed hexadecimal string values. */
var reIsBadHex$1 = /^[-+]0x[0-9a-f]+$/i;
/** Used to detect binary string values. */
var reIsBinary$1 = /^0b[01]+$/i;
/** Used to detect octal string values. */
var reIsOctal$1 = /^0o[0-7]+$/i;
/** Built-in method references without a dependency on `root`. */
var freeParseInt$1 = parseInt;
/**
* Converts `value` to a number.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to process.
* @returns {number} Returns the number.
* @example
*
* _.toNumber(3.2);
* // => 3.2
*
* _.toNumber(Number.MIN_VALUE);
* // => 5e-324
*
* _.toNumber(Infinity);
* // => Infinity
*
* _.toNumber('3.2');
* // => 3.2
*/
function toNumber$2(value) {
if (typeof value == 'number') {
return value;
}
if (isSymbol$1(value)) {
return NAN$1;
}
if (isObject(value)) {
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
value = isObject(other) ? (other + '') : other;
}
if (typeof value != 'string') {
return value === 0 ? value : +value;
}
value = baseTrim$1(value);
var isBinary = reIsBinary$1.test(value);
return (isBinary || reIsOctal$1.test(value))
? freeParseInt$1(value.slice(2), isBinary ? 2 : 8)
: (reIsBadHex$1.test(value) ? NAN$1 : +value);
}
var toNumber_1 = toNumber$2;
var toNumber$1 = toNumber_1;
/** Used as references for various `Number` constants. */
var INFINITY$2 = 1 / 0,
MAX_INTEGER$1 = 1.7976931348623157e+308;
/**
* Converts `value` to a finite number.
*
* @static
* @memberOf _
* @since 4.12.0
* @category Lang
* @param {*} value The value to convert.
* @returns {number} Returns the converted number.
* @example
*
* _.toFinite(3.2);
* // => 3.2
*
* _.toFinite(Number.MIN_VALUE);
* // => 5e-324
*
* _.toFinite(Infinity);
* // => 1.7976931348623157e+308
*
* _.toFinite('3.2');
* // => 3.2
*/
function toFinite$2(value) {
if (!value) {
return value === 0 ? value : 0;
}
value = toNumber$1(value);
if (value === INFINITY$2 || value === -INFINITY$2) {
var sign = (value < 0 ? -1 : 1);
return sign * MAX_INTEGER$1;
}
return value === value ? value : 0;
}
var toFinite_1 = toFinite$2;
var toFinite$1 = toFinite_1;
/**
* Converts `value` to an integer.
*
* **Note:** This method is loosely based on
* [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to convert.
* @returns {number} Returns the converted integer.
* @example
*
* _.toInteger(3.2);
* // => 3
*
* _.toInteger(Number.MIN_VALUE);
* // => 0
*
* _.toInteger(Infinity);
* // => 1.7976931348623157e+308
*
* _.toInteger('3.2');
* // => 3
*/
function toInteger$1(value) {
var result = toFinite$1(value),
remainder = result % 1;
return result === result ? (remainder ? result - remainder : result) : 0;
}
var toInteger_1 = toInteger$1;
var baseSlice = _baseSlice,
isIterateeCall = _isIterateeCall,
toInteger = toInteger_1;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeCeil = Math.ceil,
nativeMax$1 = Math.max;
/**
* Creates an array of elements split into groups the length of `size`.
* If `array` can't be split evenly, the final chunk will be the remaining
* elements.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Array
* @param {Array} array The array to process.
* @param {number} [size=1] The length of each chunk
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {Array} Returns the new array of chunks.
* @example
*
* _.chunk(['a', 'b', 'c', 'd'], 2);
* // => [['a', 'b'], ['c', 'd']]
*
* _.chunk(['a', 'b', 'c', 'd'], 3);
* // => [['a', 'b', 'c'], ['d']]
*/
function chunk(array, size, guard) {
if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
size = 1;
} else {
size = nativeMax$1(toInteger(size), 0);
}
var length = array == null ? 0 : array.length;
if (!length || size < 1) {
return [];
}
var index = 0,
resIndex = 0,
result = Array(nativeCeil(length / size));
while (index < length) {
result[resIndex++] = baseSlice(array, index, (index += size));
}
return result;
}
var chunk_1 = chunk;
const AtGrid = defineComponent({
name: "AtGrid",
emits: {
"click"(item, clickedIndex) {
return !!(item && typeof item === "object" && typeof clickedIndex === "number");
}
},
props: {
data: {
type: Array,
required: true
},
columnNum: {
type: Number,
default: 3
},
hasBorder: {
type: Boolean,
default: true
},
mode: {
type: String,
default: "square",
validator: (m) => ["square", "rect"].includes(m)
}
},
setup(props, { emit }) {
const gridGroup = computed(() => chunk_1(props.data, props.columnNum));
const bodyClasses = computed(() => {
let mode = props.mode;
if (mode && !["square", "rect"].includes(mode)) {
mode = "square";
}
return [
"at-grid-item",
"at-grid__flex-item",
{
[`at-grid-item--${mode}`]: Boolean(mode),
"at-grid-item--no-border": !props.hasBorder
}
];
});
const genGridItemClasses = computed(() => (index) => [
...bodyClasses.value,
{
"at-grid-item--last": index === props.columnNum - 1
}
]);
const flexStyle = computed(() => ({
flex: `0 0 ${100 / props.columnNum}%`
}));
const genIconClasses = (item) => {
const { iconClasses } = useIconClasses(item.iconInfo, true);
return iconClasses.value;
};
const genIconStyle = (item) => {
const { iconStyle } = useIconStyle(item.iconInfo, "", 24);
return iconStyle.value;
};
function handleClick(item, index, row) {
const clickedIndex = row * props.columnNum + index;
emit("click", item, clickedIndex);
}
return {
...toRefs(props),
gridGroup,
flexStyle,
genIconStyle,
genIconClasses,
genGridItemClasses,
handleClick
};
}
});
// Binding optimization for webpack code-split
const _renderList$c = renderList, _Fragment$c = Fragment, _openBlock$x = openBlock, _createElementBlock$c = createElementBlock, _resolveComponent$x = resolveComponent, _createBlock$x = createBlock, _createCommentVNode$i = createCommentVNode, _normalizeClass$g = normalizeClass, _normalizeStyle$h = normalizeStyle, _withCtx$w = withCtx, _createVNode$p = createVNode, _toDisplayString$m = toDisplayString, _createTextVNode$m = createTextVNode, _mergeProps$w = mergeProps;
function _sfc_render$x(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_image = _resolveComponent$x("taro-image");
const _component_taro_text = _resolveComponent$x("taro-text");
const _component_taro_view = _resolveComponent$x("taro-view");
return (Array.isArray(_ctx.data) && _ctx.data.length > 0)
? (_openBlock$x(), _createBlock$x(_component_taro_view, _mergeProps$w({ key: 0 }, _ctx.$attrs, { class: "at-grid" }), {
default: _withCtx$w(() => [
(_openBlock$x(true), _createElementBlock$c(_Fragment$c, null, _renderList$c(_ctx.gridGroup, (items, row) => {
return (_openBlock$x(), _createBlock$x(_component_taro_view, {
key: `at-grid-group-${row}`,
class: "at-grid__flex"
}, {
default: _withCtx$w(() => [
(_openBlock$x(true), _createElementBlock$c(_Fragment$c, null, _renderList$c(items, (item, index) => {
return (_openBlock$x(), _createBlock$x(_component_taro_view, {
key: `at-grid-item-${index}`,
class: _normalizeClass$g(_ctx.genGridItemClasses(index)),
style: _normalizeStyle$h(_ctx.flexStyle),
onTap: $event => (_ctx.handleClick(item, index, row))
}, {
default: _withCtx$w(() => [
_createVNode$p(_component_taro_view, { class: "at-grid-item__content" }, {
default: _withCtx$w(() => [
_createVNode$p(_component_taro_view, { class: "at-grid-item__content-inner" }, {
default: _withCtx$w(() => [
_createVNode$p(_component_taro_view, { class: "content-inner__icon" }, {
default: _withCtx$w(() => [
(item.image)
? (_openBlock$x(), _createBlock$x(_component_taro_image, {
key: 0,
class: "content-inner__img",
mode: "scaleToFill",
src: item.image
}, null, 8 /* PROPS */, ["src"]))
: (item.iconInfo && item.iconInfo.value)
? (_openBlock$x(), _createBlock$x(_component_taro_text, {
key: 1,
class: _normalizeClass$g(_ctx.genIconClasses(item)),
style: _normalizeStyle$h(_ctx.genIconStyle(item))
}, null, 8 /* PROPS */, ["class", "style"]))
: _createCommentVNode$i("v-if", true)
]),
_: 2 /* DYNAMIC */
}, 1024 /* DYNAMIC_SLOTS */),
_createVNode$p(_component_taro_text, { class: "content-inner__text" }, {
default: _withCtx$w(() => [
_createTextVNode$m(_toDisplayString$m(item.value), 1 /* TEXT */)
]),
_: 2 /* DYNAMIC */
}, 1024 /* DYNAMIC_SLOTS */)
]),
_: 2 /* DYNAMIC */
}, 1024 /* DYNAMIC_SLOTS */)
]),
_: 2 /* DYNAMIC */
}, 1024 /* DYNAMIC_SLOTS */)
]),
_: 2 /* DYNAMIC */
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["class", "style", "onTap"]))
}), 128 /* KEYED_FRAGMENT */))
]),
_: 2 /* DYNAMIC */
}, 1024 /* DYNAMIC_SLOTS */))
}), 128 /* KEYED_FRAGMENT */))
]),
_: 1 /* STABLE */
}, 16 /* FULL_PROPS */))
: _createCommentVNode$i("v-if", true)
}
AtGrid.render = _sfc_render$x;
const AtIcon = defineComponent({
name: "AtIcon",
emits: {
"click"(e) {
return !!(e && typeof e === "object");
}
},
props: {
prefixClass: {
type: String,
default: "at-icon"
},
value: {
type: String,
required: true
},
color: {
type: String,
default: ""
},
size: {
type: [String, Number],
default: 24
}
},
setup(props, { emit }) {
const rootStyle = computed(() => ({
color: props.color,
fontSize: `${pxTransform(parseInt(String(props.size)) * 2)}`
}));
const rootClasses = computed(() => ({
[`${props.prefixClass}`]: true,
[`${props.prefixClass}-${props.value}`]: Boolean(props.value)
}));
function handleClick(e) {
emit("click", e);
}
return {
rootClasses,
rootStyle,
handleClick
};
}
});
// Binding optimization for webpack code-split
const _resolveComponent$w = resolveComponent, _mergeProps$v = mergeProps, _openBlock$w = openBlock, _createBlock$w = createBlock;
function _sfc_render$w(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_text = _resolveComponent$w("taro-text");
return (_openBlock$w(), _createBlock$w(_component_taro_text, _mergeProps$v(_ctx.$attrs, {
class: _ctx.rootClasses,
style: _ctx.rootStyle,
onTap: _ctx.handleClick
}), null, 16 /* FULL_PROPS */, ["class", "style", "onTap"]))
}
AtIcon.render = _sfc_render$w;
const generateMatrix = (files, col, showAddBtn) => {
const matrix = [];
const length = showAddBtn ? files.length + 1 : files.length;
const row = Math.ceil(length / col);
for (let i = 0; i < row; i++) {
if (i === row - 1) {
const lastArr = files.slice(i * col);
if (lastArr.length < col) {
if (showAddBtn) {
lastArr.push({ type: "btn", uuid: uuid() });
}
for (let j = lastArr.length; j < col; j++) {
lastArr.push({ type: "blank", uuid: uuid() });
}
}
matrix.push(lastArr);
} else {
matrix.push(files.slice(i * col, (i + 1) * col));
}
}
return matrix;
};
const ENV$1 = Taro.getEnv();
const modeOptions = [
"scaleToFill",
"aspectFit",
"aspectFill",
"widthFix",
"top",
"bottom",
"center",
"left",
"right",
"top left",
"top right",
"bottom left",
"bottom right"
];
const AtImagePicker = defineComponent({
name: "AtImagePicker",
components: { AtLoading },
emits: {
"change"(args) {
return !!(args.files && Array.isArray(args.files) && args.operationType && ["add", "remove"].includes(args.operationType) && ["undefined", "number"].includes(typeof args.index));
},
"image-click"(index, file) {
return !!(typeof index === "number" && file && typeof file === "object");
},
"fail"(message) {
return !!(message && typeof message === "string");
}
},
props: {
files: {
type: Array,
default: () => []
},
mode: {
type: String,
default: "aspectFill",
validator: (value) => modeOptions.includes(value)
},
showAddBtn: {
type: Boolean,
default: true
},
multiple: Boolean,
length: {
type: Number,
default: 4
},
count: Number,
sizeType: {
type: Array,
default: () => ["original", "compressed"]
},
sourceType: {
type: Array,
default: () => ["album", "camera"]
}
},
setup(props, { emit }) {
const rowLength = computed(() => props.length <= 0 ? 1 : props.length);
const genKey = computed(() => (item, row, col) => {
return item.url ? `preview-${row * props.length + col}` : `add-bar-${row * props.length + col}`;
});
const matrix = computed(() => generateMatrix(props.files, rowLength.value, props.showAddBtn));
function chooseFile() {
const params = {};
const filePathName = ENV$1 === Taro.ENV_TYPE.ALIPAY ? "apFilePaths" : "tempFiles";
if (props.multiple) {
params.count = 99;
}
if (props.count) {
params.count = props.count;
}
if (props.sizeType) {
params.sizeType = props.sizeType;
}
if (props.sourceType) {
params.sourceType = props.sourceType;
}
Taro.chooseImage(params).then((res) => {
const targetFiles = res.tempFilePaths.map((path, i) => ({
url: path,
file: res[filePathName][i]
}));
const newFiles = props.files.concat(targetFiles);
emit("change", { files: newFiles, operationType: "add" });
}).catch((err) => {
emit("fail", err.errMsg);
});
}
function handleImageClick(idx) {
emit("image-click", idx, props.files[idx]);
}
function handleRemoveImg(idx) {
if (ENV$1 === Taro.ENV_TYPE.WEB) {
window.URL.revokeObjectURL(props.files[idx].url);
}
const newFiles = props.files.filter((_, i) => i !== idx);
emit("change", { files: newFiles, operationType: "remove", index: idx });
}
return {
length: toRef(props, "length"),
mode: toRef(props, "mode"),
matrix,
genKey,
chooseFile,
handleRemoveImg,
handleImageClick
};
}
});
// Binding optimization for webpack code-split
const _renderList$b = renderList, _Fragment$b = Fragment, _openBlock$v = openBlock, _createElementBlock$b = createElementBlock, _resolveComponent$v = resolveComponent, _createVNode$o = createVNode, _createBlock$v = createBlock, _createCommentVNode$h = createCommentVNode, _toDisplayString$l = toDisplayString, _createTextVNode$l = createTextVNode, _normalizeClass$f = normalizeClass, _withCtx$v = withCtx, _mergeProps$u = mergeProps;
function _sfc_render$v(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_view = _resolveComponent$v("taro-view");
const _component_taro_image = _resolveComponent$v("taro-image");
const _component_at_loading = _resolveComponent$v("at-loading");
return (_openBlock$v(), _createBlock$v(_component_taro_view, _mergeProps$u(_ctx.$attrs, { class: "at-image-picker" }), {
default: _withCtx$v(() => [
(_openBlock$v(true), _createElementBlock$b(_Fragment$b, null, _renderList$b(_ctx.matrix, (row, i) => {
return (_openBlock$v(), _createBlock$v(_component_taro_view, {
key: i+1,
class: "at-image-picker__flex-box"
}, {
default: _withCtx$v(() => [
(_openBlock$v(true), _createElementBlock$b(_Fragment$b, null, _renderList$b(row, (item, j) => {
return (_openBlock$v(), _createBlock$v(_component_taro_view, {
key: _ctx.genKey(item, i, j),
class: "at-image-picker__flex-item"
}, {
default: _withCtx$v(() => [
(item.url)
? (_openBlock$v(), _createBlock$v(_component_taro_view, {
key: 0,
class: "at-image-picker__item"
}, {
default: _withCtx$v(() => [
_createVNode$o(_component_taro_view, {
class: "at-image-picker__remove-btn",
onTap: $event => (_ctx.handleRemoveImg(i * _ctx.length + j))
}, null, 8 /* PROPS */, ["onTap"]),
_createVNode$o(_component_taro_image, {
class: "at-image-picker__preview-img",
mode: _ctx.mode,
src: item.url,
onTap: $event => (_ctx.handleImageClick(i * _ctx.length + j))
}, null, 8 /* PROPS */, ["mode", "src", "onTap"]),
(item.status && item.status !== 'done')
? (_openBlock$v(), _createBlock$v(_component_taro_view, {
key: 0,
class: "at-image-picker__upload-status"
}, {
default: _withCtx$v(() => [
(item.status === 'uploading')
? (_openBlock$v(), _createBlock$v(_component_at_loading, {
key: 0,
color: "#fff"
}))
: (_openBlock$v(), _createBlock$v(_component_taro_view, {
key: 1,
class: "at-image-picker__status-icon at-image-picker__status-icon--failed"
})),
(item.message)
? (_openBlock$v(), _createBlock$v(_component_taro_view, {
key: 2,
class: _normalizeClass$f(['at-image-picker__status-message', {
'at-image-picker__status-message--uploading': item.status === 'uploading',
'at-image-picker__status-message--failed': item.status !== 'uploading',
}])
}, {
default: _withCtx$v(() => [
_createTextVNode$l(_toDisplayString$l(item.message), 1 /* TEXT */)
]),
_: 2 /* DYNAMIC */
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["class"]))
: _createCommentVNode$h("v-if", true)
]),
_: 2 /* DYNAMIC */
}, 1024 /* DYNAMIC_SLOTS */))
: _createCommentVNode$h("v-if", true)
]),
_: 2 /* DYNAMIC */
}, 1024 /* DYNAMIC_SLOTS */))
: (item.type === 'btn')
? (_openBlock$v(), _createBlock$v(_component_taro_view, {
key: 1,
class: "at-image-picker__item at-image-picker__choose-btn",
onTap: _ctx.chooseFile
}, {
default: _withCtx$v(() => [
(_openBlock$v(), _createElementBlock$b(_Fragment$b, null, _renderList$b([0, 1], (i) => {
return _createVNode$o(_component_taro_view, {
key: i,
class: "add-bar"
})
}), 64 /* STABLE_FRAGMENT */))
]),
_: 2 /* DYNAMIC */
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["onTap"]))
: _createCommentVNode$h("v-if", true)
]),
_: 2 /* DYNAMIC */
}, 1024 /* DYNAMIC_SLOTS */))
}), 128 /* KEYED_FRAGMENT */))
]),
_: 2 /* DYNAMIC */
}, 1024 /* DYNAMIC_SLOTS */))
}), 128 /* KEYED_FRAGMENT */))
]),
_: 1 /* STABLE */
}, 16 /* FULL_PROPS */))
}
AtImagePicker.render = _sfc_render$v;
const error = "data:image/png;base64,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";
const success = "data:image/png;base64,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";
const loading = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAMAAACahl6sAAAAn1BMVEUAAAD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////8Kd3m4AAAANHRSTlMA6AN+QRH69xUI7Z7x2sWzcWYvphvj4MxiXVIiGAuH08K9ibepmI+Oc2tKHQ+helY5NykfkF5N9AAABmhJREFUeNrdnWlT4kAQhjt3CARIwg1yH3Lpqv3/f9tabsYJMUGCsM6b56NVVjGV6WP6pLvTijTb8bS2X29U581BaBEmLY9T1LrVpukSGhFn06n2W4SExvn4q2ecL6PxeSbrPwRBxN/iG0NSHyHs55kGB1KdVqTxBTjLnU6qo1csdx+ag8CIujXOxe+pf5QEIzPYNDo5OnlbITD2/WObM9AeHwiOYbDMEB/PgHRiwo3GaWpbKFkR6LvI4RTdF4Lk0JtyihXk/Xrnbe2kRKVHoLjjlImphwSKZXicxH4iVB4eNU6ywPHy01SME1nRTIJluOAEtgFpU/4xaHOC2YhgeRjbJble9Dplid0nXHSDEzQJGFNjyZyAGc1YUgVWXqfXqwH3dsy7XnVUf/iD1oQ/mUCfxKonvgn07ao0EnKCLPGkVxO6i6AZl8SeEDVLYuNPToLsd53cLhvZF35HSrwG/D55R5daeAathKkiLaNB0FiTsohJS/sUE9wo0QcmCxaEjcEC3BjkB/rsU0xg48L/GH2KSZ2wkWICm3VIi4kH/V4k0qccsyJsXm2OAc0zfnWEu9g+Fz20OWZL2Aw4pgYu77QoiRtMQ0eoYMC6lWxj8kjYVDThz0PHHt95LIvievBEpRq4LSGjLL6jJepWfPRP8umo7AgbV9iSJYGzFvXC6lc+n+eNYwICR7ywpgROj2MQOgTOcXBK4gNTJEwJgbPjGJBOmlx04QOvCZyNKIkgcEKOAc8yyEa0ZwJnWZKgIwVlUcBDjsHqMc2gXY5yCKJjOaqGiPoiBkHg7EtjSUQ/I3gJAVGjHGVcRJuySLswiV0CxxQ5HwJnxDHoySsSoVPwkg6iLv9jQOBEZdG/Rjkqm4mCshgSkXRvEDhmSeq3KCzLa1c48u2PASxaBPvodUXGPR6J46GexBLVHMKiRIRJRWTgSBOfBhNd1M+SqKwDzVfLg4i8D2h5irxaHrZDL4Vdww6oSPUroo57gkQaRB/7iSVdlDp2iEs6jQ3st6J046vYJR3yYTXHrh+QT90mQztbMvgwwA46ynBQiB10lAE6i2MgW2CTIdMasiFJBrG7yPo3mVYQhmRDgCQTPU3kEFcy9WYip3iTyVCXcR350/R0B7cOIlkwIKX9SHDIEo7ksdoEx2lRTQu2Ejhd5uSjmsR04dkKtYMhXQr4zKBh03RxpsuYkZSv5bITTHfrawHzWtwtqEh2Rkn5H8jOq6wifx8xApHVdmEAdl5lNsIMARstZWtSVufVjGDIbhYLOOaNQMhp3zs4aN0xeQ2VS/F3kMyVbHHNU8pjgiC36Vj3oWZ0nGkD70HN6DjTmK93gGZ0nB2VsAWa0SGHV2DP6Pjmpz7CSIkc8HL+4jmKh1O+HbljgIxBlEOQ8pUzQtL9+7FUUnG1FVbBlwwK07sAjsr8ktFtLxxjv5KiXDhMb8UxU0UDKpeON7Q8xY3JxQMne8wqp6sLjACtqzxEu8hQ1tBWd4h2sTG5T+oO0S44uHihqpgUHSXtyiHaSpX+Fx/ubdoqLmG5Zty6oeASlqsG4Osz5ZawXLmSYKSptoSl8JIIKSZKOcLXr+3oK7WEJblIBXmdzM9+y5xVuV0/XTZ0VGNlXHL90/FKjafCyrhbLOSq1H9/ZdxtVqRZyZVxLSqKQkvrrPoPdpAqtUYweUO50Ipb1RY76sffWXGbXrV51G8SECt+vVRcftrkotdL1XW0fZsl01f6BoUXBJ98ZXv8QLmovrL5RO64PaAc1F+irRs2J1gMKQuIteYn14sdI0etAyyadxecRHtMiQrQ6v8nm5N4hkU3xTI8TmI/0Z0I63xCbezSzXDHNT6hHtL96Hl8grN+o5vwtnb4BK9Hd8VacYpZ70A/5NCbcYqVRffmpcspnGin09Xou8jhFN0X+g/o2xqn0TbhlWK30ThNbavT3ZHqJY22DIYFTV+wFKcoqAzvpPAl7WN/Txex7x/bLMk1T/ensu1wJp3GJjBHlMvIDDaNvP/dVuj/o/d8zqXWjYxgYIZ716roesVy96E5CIyoW+Nc/J5Ov4O+Wzp8I5zlTqdf5BBM+QZMAwXaC4aGzz/CN5SpdPuznvCVTNaKLatwn1c+F8RfPatZwd7qVzt8IZ1qX6nk9xdcs1kVOjZPM1ebpppf4itWOGjOq42639Y8x7YdT2v79UZ13hyEFt2Fv6Loy9OZgJFyAAAAAElFTkSuQmCC";
var statusImg = {
error: error,
success: success,
loading: loading
};
const AtToast = defineComponent({
name: "AtToast",
emits: ["click", "close"],
inheritAttrs: false,
props: {
isOpened: Boolean,
hasMask: Boolean,
text: String,
icon: String,
image: String,
duration: { type: Number, default: 3e3 },
status: {
type: String,
default: "",
validator: (val) => ["", "error", "loading", "success"].includes(val)
}
},
setup(props, { emit }) {
const state = reactive({
_timer: null,
_isOpened: props.isOpened
});
if (props.isOpened) {
makeTimer(props.duration || 0);
}
const useImg = computed(() => props.image || statusImg[props.status] || null);
const useIcon = computed(() => Boolean(props.icon && !useImg.value));
const bodyClasses = computed(() => ({
"toast-body--text": !props.icon && !useImg.value,
"at-toast__body--custom-image": props.image,
[`at-toast__body--${props.status}`]: !!props.status
}));
const iconClasses = computed(() => ["at-icon", {
[`at-icon-${props.icon}`]: props.icon
}]);
watch(() => [
props.isOpened,
props.duration
], ([isOpened, duration]) => {
if (!isOpened) {
close();
return;
}
if (!state._isOpened) {
state._isOpened = true;
} else {
clearTimer();
}
makeTimer(duration || 0);
});
function clearTimer() {
if (state._timer) {
clearTimeout(state._timer);
state._timer = null;
}
}
function makeTimer(duration) {
state._timer = setTimeout(() => {
close();
}, +duration);
}
function close() {
if (state._isOpened) {
state._isOpened = false;
nextTick(handleClose);
clearTimer();
}
}
function handleClose(e) {
emit("close", e);
}
function handleClick(e) {
if (props.status === "loading")
return;
emit("click", e);
close();
}
return {
isOpened: toRef(state, "_isOpened"),
hasMask: toRef(props, "hasMask"),
text: toRef(props, "text"),
bodyClasses,
iconClasses,
useImg,
useIcon,
handleClick
};
}
});
// Binding optimization for webpack code-split
const _resolveComponent$u = resolveComponent, _openBlock$u = openBlock, _createBlock$u = createBlock, _createCommentVNode$g = createCommentVNode, _createVNode$n = createVNode, _withCtx$u = withCtx, _normalizeClass$e = normalizeClass, _toDisplayString$k = toDisplayString, _createTextVNode$k = createTextVNode, _normalizeStyle$g = normalizeStyle;
function _sfc_render$u(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_view = _resolveComponent$u("taro-view");
const _component_taro_image = _resolveComponent$u("taro-image");
const _component_taro_text = _resolveComponent$u("taro-text");
return (_ctx.isOpened)
? (_openBlock$u(), _createBlock$u(_component_taro_view, {
key: 0,
class: _normalizeClass$e(['at-toast', Boolean(_ctx.$attrs.class) && _ctx.$attrs.class])
}, {
default: _withCtx$u(() => [
(_ctx.hasMask)
? (_openBlock$u(), _createBlock$u(_component_taro_view, {
key: 0,
class: "at-toast__overlay"
}))
: _createCommentVNode$g("v-if", true),
_createVNode$n(_component_taro_view, {
class: _normalizeClass$e(['toast-body', _ctx.bodyClasses]),
style: _normalizeStyle$g(Boolean(_ctx.$attrs.style) && _ctx.$attrs.style),
onTap: _ctx.handleClick
}, {
default: _withCtx$u(() => [
_createVNode$n(_component_taro_view, { class: "toast-body-content" }, {
default: _withCtx$u(() => [
(_ctx.useImg)
? (_openBlock$u(), _createBlock$u(_component_taro_view, {
key: 0,
class: "toast-body-content__img"
}, {
default: _withCtx$u(() => [
_createVNode$n(_component_taro_image, {
class: "toast-body-content__img-item",
mode: "scaleToFill",
src: _ctx.useImg
}, null, 8 /* PROPS */, ["src"])
]),
_: 1 /* STABLE */
}))
: (_ctx.useIcon)
? (_openBlock$u(), _createBlock$u(_component_taro_view, {
key: 1,
class: "toast-body-content__icon"
}, {
default: _withCtx$u(() => [
_createVNode$n(_component_taro_text, {
class: _normalizeClass$e(_ctx.iconClasses)
}, null, 8 /* PROPS */, ["class"])
]),
_: 1 /* STABLE */
}))
: _createCommentVNode$g("v-if", true),
(_ctx.text)
? (_openBlock$u(), _createBlock$u(_component_taro_view, {
key: 2,
class: "toast-body-content__info"
}, {
default: _withCtx$u(() => [
_createVNode$n(_component_taro_text, null, {
default: _withCtx$u(() => [
_createTextVNode$k(_toDisplayString$k(_ctx.text), 1 /* TEXT */)
]),
_: 1 /* STABLE */
})
]),
_: 1 /* STABLE */
}))
: _createCommentVNode$g("v-if", true)
]),
_: 1 /* STABLE */
})
]),
_: 1 /* STABLE */
}, 8 /* PROPS */, ["class", "style", "onTap"])
]),
_: 1 /* STABLE */
}, 8 /* PROPS */, ["class"]))
: _createCommentVNode$g("v-if", true)
}
AtToast.render = _sfc_render$u;
const AtIndexes = defineComponent({
name: "AtIndexes",
components: {
AtList,
AtListItem,
AtToast
},
emits: {
"click"(item) {
return !!(item && typeof item === "object");
},
"scroll-into-view"(fn) {
return !!(fn && typeof fn === "function");
}
},
props: {
animation: Boolean,
isVibrate: {
type: Boolean,
default: true
},
showToast: {
type: Boolean,
default: true
},
topKey: {
type: String,
default: "Top"
},
list: {
type: Array,
default: () => []
}
},
setup(props, { emit }) {
const menuHeight = ref(0);
const startTop = ref(0);
const itemHeight = ref(0);
const scrollItemHeights = ref([]);
const currentIndex = ref(0);
const timeoutTimer = ref(null);
const state = reactive({
scrollIntoView: "",
scrollTop: 0,
tipText: "",
showToast: false,
isWEB: Taro.getEnv() === Taro.ENV_TYPE.WEB
});
const toastStyle = computed(() => ({
minWidth: pxTransform(100)
}));
const genActiveIndexStyle = computed(() => (i) => {
return currentIndex.value === i ? {
color: "white",
backgroundColor: "rgba(97, 144, 232, 1)",
borderRadius: "40px"
} : {};
});
watch(() => props.list, (list, prevList) => {
if (list.length !== prevList.length) {
initData();
}
});
function handleClick(item) {
emit("click", item);
}
function handleTouchmove(e) {
e.stopPropagation();
e.preventDefault();
const pageY = e.touches[0].pageY;
const index = Math.floor((pageY - startTop.value) / itemHeight.value);
if (index >= 0 && index <= props.list.length && currentIndex.value !== index) {
currentIndex.value = index;
const key = index > 0 ? props.list[index - 1].key : "top";
const touchView = `at-indexes__list-${key}`;
jumpTarget(touchView, index);
}
}
function jumpTarget(scrollIntoView, idx) {
currentIndex.value = idx;
updateState({
scrollIntoView,
scrollTop: scrollItemHeights.value[idx],
tipText: idx === 0 ? props.topKey : props.list[idx - 1].key
});
}
function __jumpTarget(key) {
const index = props.list.findIndex((item) => item.key === key);
const targetView = `at-indexes__list-${key}`;
jumpTarget(targetView, index + 1);
}
function updateState(stateValue) {
const { scrollIntoView, tipText, scrollTop } = stateValue;
state.tipText = tipText;
state.scrollTop = scrollTop;
state.showToast = props.showToast;
state.scrollIntoView = scrollIntoView;
nextTick(() => {
clearTimeout(timeoutTimer.value);
timeoutTimer.value = setTimeout(() => {
state.tipText = "";
state.showToast = false;
}, 1e3);
});
if (props.isVibrate) {
Taro.vibrateShort();
}
}
async function initData() {
if (props.list.length > 0) {
await _getScrollListItemHeights(props.list).then((res) => {
scrollItemHeights.value = [...res];
});
delayQuerySelector(this, ".at-indexes__menu").then((rect) => {
const len = props.list.length;
menuHeight.value = rect[0].height;
startTop.value = rect[0].top;
itemHeight.value = Math.floor(menuHeight.value / (len + 1));
});
}
}
function _getHeight(selector, delay = 500) {
return new Promise((resolve) => {
delayQuerySelector(this, selector, delay).then((rect) => {
if (rect && rect[0]) {
resolve(rect[0].height);
}
});
});
}
function _getScrollListItemHeights(list) {
return new Promise((resolve) => {
if (list.length > 0) {
let rawHeights = [];
let itemHeights = [];
rawHeights.push(_getHeight(`#at-indexes__top`));
list.forEach((item) => {
rawHeights.push(_getHeight(`#at-indexes__list-${item.key}`));
});
Promise.all(rawHeights).then((res) => {
let height = 0;
itemHeights.push(height);
for (let i = 0; i < res.length; i++) {
height += res[i];
itemHeights.push(height);
}
resolve(itemHeights);
});
}
});
}
function handleScroll(e) {
if (e && e.detail) {
state.scrollIntoView = "";
for (let i = 0; i < scrollItemHeights.value.length - 1; i++) {
let h1 = Math.floor(scrollItemHeights.value[i]);
let h2 = Math.floor(scrollItemHeights.value[i + 1]);
if (e.detail.scrollTop >= h1 && e.detail.scrollTop < h2) {
currentIndex.value = i;
return;
}
}
}
}
onMounted(() => {
initData();
});
onBeforeMount(() => {
emit("scroll-into-view", __jumpTarget);
});
return {
...toRefs(props),
...toRefs(state),
toastStyle,
jumpTarget,
handleClick,
handleScroll,
handleTouchmove,
genActiveIndexStyle
};
}
});
// Binding optimization for webpack code-split
const _toDisplayString$j = toDisplayString, _createTextVNode$j = createTextVNode, _resolveComponent$t = resolveComponent, _normalizeStyle$f = normalizeStyle, _withCtx$t = withCtx, _createVNode$m = createVNode, _renderList$a = renderList, _Fragment$a = Fragment, _openBlock$t = openBlock, _createElementBlock$a = createElementBlock, _createBlock$t = createBlock, _renderSlot$d = renderSlot, _createCommentVNode$f = createCommentVNode, _mergeProps$t = mergeProps;
function _sfc_render$t(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_view = _resolveComponent$t("taro-view");
const _component_at_list_item = _resolveComponent$t("at-list-item");
const _component_at_list = _resolveComponent$t("at-list");
const _component_taro_scroll_view = _resolveComponent$t("taro-scroll-view");
const _component_at_toast = _resolveComponent$t("at-toast");
return (_openBlock$t(), _createBlock$t(_component_taro_view, _mergeProps$t(_ctx.$attrs, { class: "at-indexes" }), {
default: _withCtx$t(() => [
_createVNode$m(_component_taro_view, {
class: "at-indexes__menu",
onTouchmove: _ctx.handleTouchmove
}, {
default: _withCtx$t(() => [
_createVNode$m(_component_taro_view, {
class: "at-indexes__menu-item",
style: _normalizeStyle$f(_ctx.genActiveIndexStyle(0)),
onTap: _cache[0] || (_cache[0] = $event => (_ctx.jumpTarget('at-indexes__top', 0)))
}, {
default: _withCtx$t(() => [
_createTextVNode$j(_toDisplayString$j(_ctx.topKey), 1 /* TEXT */)
]),
_: 1 /* STABLE */
}, 8 /* PROPS */, ["style"]),
(_openBlock$t(true), _createElementBlock$a(_Fragment$a, null, _renderList$a(_ctx.list, (dataList, i) => {
return (_openBlock$t(), _createBlock$t(_component_taro_view, {
key: `${dataList.key}-${i+1}`,
class: "at-indexes__menu-item",
style: _normalizeStyle$f(_ctx.genActiveIndexStyle(i+1)),
onTap: $event => (_ctx.jumpTarget(`at-indexes__list-${dataList.key}`, i + 1))
}, {
default: _withCtx$t(() => [
_createTextVNode$j(_toDisplayString$j(dataList.key), 1 /* TEXT */)
]),
_: 2 /* DYNAMIC */
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["style", "onTap"]))
}), 128 /* KEYED_FRAGMENT */))
]),
_: 1 /* STABLE */
}, 8 /* PROPS */, ["onTouchmove"]),
_createVNode$m(_component_taro_scroll_view, {
class: "at-indexes__body",
scrollY: true,
enableBackToTop: true,
scrollTop: _ctx.scrollTop,
scrollIntoView: !_ctx.isWEB ? _ctx.scrollIntoView : '',
scrollWithAnimation: _ctx.animation,
onScroll: _ctx.handleScroll
}, {
default: _withCtx$t(() => [
_createVNode$m(_component_taro_view, {
id: "at-indexes__top",
class: "at-indexes__content"
}, {
default: _withCtx$t(() => [
_renderSlot$d(_ctx.$slots, "default")
]),
_: 3 /* FORWARDED */
}),
(_openBlock$t(true), _createElementBlock$a(_Fragment$a, null, _renderList$a(_ctx.list, (dataList) => {
return (_openBlock$t(), _createBlock$t(_component_taro_view, {
key: dataList.key,
id: `at-indexes__list-${dataList.key}`,
class: "at-indexes__list"
}, {
default: _withCtx$t(() => [
_createVNode$m(_component_taro_view, { class: "at-indexes__list-title" }, {
default: _withCtx$t(() => [
_createTextVNode$j(_toDisplayString$j(dataList.title), 1 /* TEXT */)
]),
_: 2 /* DYNAMIC */
}, 1024 /* DYNAMIC_SLOTS */),
(dataList.items && dataList.items.length > 0)
? (_openBlock$t(), _createBlock$t(_component_at_list, { key: 0 }, {
default: _withCtx$t(() => [
(_openBlock$t(true), _createElementBlock$a(_Fragment$a, null, _renderList$a(dataList.items, (item, i) => {
return (_openBlock$t(), _createBlock$t(_component_at_list_item, {
key: `${item.name}-${i}`,
title: item.name,
onClick: $event => (_ctx.handleClick(item))
}, null, 8 /* PROPS */, ["title", "onClick"]))
}), 128 /* KEYED_FRAGMENT */))
]),
_: 2 /* DYNAMIC */
}, 1024 /* DYNAMIC_SLOTS */))
: _createCommentVNode$f("v-if", true)
]),
_: 2 /* DYNAMIC */
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["id"]))
}), 128 /* KEYED_FRAGMENT */))
]),
_: 3 /* FORWARDED */
}, 8 /* PROPS */, ["scrollTop", "scrollIntoView", "scrollWithAnimation", "onScroll"]),
_createVNode$m(_component_at_toast, {
isOpened: _ctx.showToast,
text: _ctx.tipText,
duration: 1000,
style: _normalizeStyle$f(_ctx.toastStyle)
}, null, 8 /* PROPS */, ["isOpened", "text", "style"])
]),
_: 3 /* FORWARDED */
}, 16 /* FULL_PROPS */))
}
AtIndexes.render = _sfc_render$t;
function getInputProps(props) {
const actualProps = {
type: props.type,
maxLength: props.maxLength,
disabled: props.disabled,
password: false
};
switch (actualProps.type) {
case "phone":
actualProps.type = "number";
actualProps.maxLength = 11;
break;
case "password":
actualProps.type = "text";
actualProps.password = true;
break;
}
if (!props.disabled && !props.editable) {
actualProps.disabled = true;
}
return actualProps;
}
const AtInput = defineComponent({
name: "AtInput",
emits: [
"blur",
"focus",
"confirm",
"click",
"error-click",
"update:modelValue",
"keyboard-height-change"
],
props: {
name: {
type: String,
default: ""
},
title: String,
type: {
type: String,
default: "text",
validator: (val) => ["text", "number", "password", "phone", "idcard", "digit"].includes(val)
},
error: Boolean,
clear: Boolean,
disabled: Boolean,
border: {
type: Boolean,
default: true
},
modelValue: {
type: String,
default: ""
},
placeholder: {
type: String,
default: ""
},
placeholderStyle: {
type: String,
default: ""
},
placeholderClass: {
type: String,
default: ""
},
editable: {
type: Boolean,
default: true
},
focus: Boolean,
required: Boolean,
autoFocus: Boolean,
adjustPosition: Boolean,
cursorSpacing: {
type: Number,
default: 50
},
cursor: {
type: Number,
default: 0
},
selectionStart: {
type: Number,
default: -1
},
selectionEnd: {
type: Number,
default: -1
},
maxLength: {
type: Number,
default: 140
},
confirmType: {
type: String,
default: "done",
validator: (val) => ["done", "send", "search", "next", "go"].includes(val)
}
},
setup(props, { emit }) {
const inputID = ref("weui-input" + uuid());
const inputValue = useModelValue(props, emit, "modelValue");
const inputProps = computed(() => getInputProps(props));
const rootClasses = computed(() => ["at-input", {
"at-input--without-border": !props.border
}]);
const containerClasses = computed(() => ["at-input__container", {
"at-input--error": props.error,
"at-input--disabled": inputProps.value.disabled
}]);
const overlayClasses = computed(() => ["at-input__overlay", {
"at-input__overlay--hidden": !inputProps.value.disabled
}]);
const placeholderClasses = computed(() => Boolean(props.placeholderClass) ? `placeholder ${props.placeholderClass}` : "placeholder");
const titleClasses = computed(() => ["at-input__title", {
"at-input__title--required": props.required
}]);
function handleInput(e) {
if (!inputProps.value.disabled) {
inputValue.value = e.detail.value;
}
}
function handleFocus(e) {
if (!inputProps.value.disabled) {
emit("focus", e.detail.value);
if (process.env.TARO_ENV === "h5") {
inputID.value = "weui-input" + uuid(10, 32);
}
}
}
function handleBlur(e) {
if (!inputProps.value.disabled) {
emit("blur", e.detail.value);
}
}
function handleConfirm(e) {
if (!inputProps.value.disabled) {
emit("confirm", e.detail.value);
}
}
function handleClick(e) {
if (!props.editable) {
emit("click", e);
}
}
function handleClearValue() {
inputValue.value = "";
if (process.env.TARO_ENV === "h5") {
const inputNode = document.querySelector(`#${inputID.value} > .weui-input`);
inputNode.value = "";
}
}
function handleKeyboardHeightChange(e) {
if (!inputProps.value.disabled) {
emit("keyboard-height-change", e);
}
}
function handleErrorClick(e) {
emit("error-click", e);
}
return {
...toRefs(props),
inputID,
inputProps,
inputValue,
rootClasses,
titleClasses,
overlayClasses,
containerClasses,
placeholderClasses,
handleBlur,
handleClick,
handleFocus,
handleInput,
handleConfirm,
handleClearValue,
handleErrorClick,
handleKeyboardHeightChange
};
}
});
// Binding optimization for webpack code-split
const _resolveComponent$s = resolveComponent, _normalizeClass$d = normalizeClass, _createVNode$l = createVNode, _toDisplayString$i = toDisplayString, _createTextVNode$i = createTextVNode, _withCtx$s = withCtx, _openBlock$s = openBlock, _createBlock$s = createBlock, _createCommentVNode$e = createCommentVNode, _renderSlot$c = renderSlot, _mergeProps$s = mergeProps;
function _sfc_render$s(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_view = _resolveComponent$s("taro-view");
const _component_taro_label = _resolveComponent$s("taro-label");
const _component_taro_input = _resolveComponent$s("taro-input");
const _component_taro_text = _resolveComponent$s("taro-text");
return (_openBlock$s(), _createBlock$s(_component_taro_view, _mergeProps$s(_ctx.$attrs, { class: _ctx.rootClasses }), {
default: _withCtx$s(() => [
_createVNode$l(_component_taro_view, {
class: _normalizeClass$d(_ctx.containerClasses)
}, {
default: _withCtx$s(() => [
_createVNode$l(_component_taro_view, {
class: _normalizeClass$d(_ctx.overlayClasses),
onTap: _ctx.handleClick
}, null, 8 /* PROPS */, ["class", "onTap"]),
(_ctx.title)
? (_openBlock$s(), _createBlock$s(_component_taro_label, {
key: 0,
for: _ctx.name,
class: _normalizeClass$d(_ctx.titleClasses)
}, {
default: _withCtx$s(() => [
_createTextVNode$i(_toDisplayString$i(_ctx.title), 1 /* TEXT */)
]),
_: 1 /* STABLE */
}, 8 /* PROPS */, ["for", "class"]))
: _createCommentVNode$e("v-if", true),
_createVNode$l(_component_taro_input, {
class: "at-input__input",
id: _ctx.inputID,
name: _ctx.name,
value: _ctx.inputValue,
type: _ctx.inputProps.type,
password: _ctx.inputProps.password,
maxlength: _ctx.inputProps.maxLength,
placeholder: _ctx.placeholder,
placeholderStyle: _ctx.placeholderStyle,
placeholderClass: _ctx.placeholderClasses,
focus: _ctx.focus,
cursor: _ctx.cursor,
autoFocus: _ctx.autoFocus,
confirmType: _ctx.confirmType,
selectionEnd: _ctx.selectionEnd,
cursorSpacing: _ctx.cursorSpacing,
selectionStart: _ctx.selectionStart,
adjustPosition: _ctx.adjustPosition,
onInput: _ctx.handleInput,
onFocus: _ctx.handleFocus,
onBlur: _ctx.handleBlur,
onConfirm: _ctx.handleConfirm,
onKeyboardheightchange: _ctx.handleKeyboardHeightChange
}, null, 8 /* PROPS */, ["id", "name", "value", "type", "password", "maxlength", "placeholder", "placeholderStyle", "placeholderClass", "focus", "cursor", "autoFocus", "confirmType", "selectionEnd", "cursorSpacing", "selectionStart", "adjustPosition", "onInput", "onFocus", "onBlur", "onConfirm", "onKeyboardheightchange"]),
(_ctx.clear && String(_ctx.modelValue))
? (_openBlock$s(), _createBlock$s(_component_taro_view, {
key: 1,
class: "at-input__icon",
onTouchend: _ctx.handleClearValue
}, {
default: _withCtx$s(() => [
_createVNode$l(_component_taro_text, { class: "at-icon at-icon-close-circle at-input__icon-close" })
]),
_: 1 /* STABLE */
}, 8 /* PROPS */, ["onTouchend"]))
: _createCommentVNode$e("v-if", true),
(_ctx.error)
? (_openBlock$s(), _createBlock$s(_component_taro_view, {
key: 2,
class: "at-input__icon",
onTouchend: _ctx.handleErrorClick
}, {
default: _withCtx$s(() => [
_createVNode$l(_component_taro_text, { class: "at-icon at-icon-close-circle at-input__icon-alert" })
]),
_: 1 /* STABLE */
}, 8 /* PROPS */, ["onTouchend"]))
: _createCommentVNode$e("v-if", true),
(Boolean(_ctx.$slots.default))
? (_openBlock$s(), _createBlock$s(_component_taro_view, {
key: 3,
class: "at-input__children"
}, {
default: _withCtx$s(() => [
_renderSlot$c(_ctx.$slots, "default")
]),
_: 3 /* FORWARDED */
}))
: _createCommentVNode$e("v-if", true)
]),
_: 3 /* FORWARDED */
}, 8 /* PROPS */, ["class"])
]),
_: 3 /* FORWARDED */
}, 16 /* FULL_PROPS */, ["class"]))
}
AtInput.render = _sfc_render$s;
/**
* A specialized version of `_.map` for arrays without support for iteratee
* shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns the new mapped array.
*/
function arrayMap(array, iteratee) {
var index = -1,
length = array == null ? 0 : array.length,
result = Array(length);
while (++index < length) {
result[index] = iteratee(array[index], index, array);
}
return result;
}
/** `Object#toString` result references. */
var symbolTag = '[object Symbol]';
/**
* Checks if `value` is classified as a `Symbol` primitive or object.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
* @example
*
* _.isSymbol(Symbol.iterator);
* // => true
*
* _.isSymbol('abc');
* // => false
*/
function isSymbol(value) {
return typeof value == 'symbol' ||
(isObjectLike$2(value) && baseGetTag$3(value) == symbolTag);
}
/** Used as references for various `Number` constants. */
var INFINITY$1 = 1 / 0;
/** Used to convert symbols to primitives and strings. */
var symbolProto = Symbol$4 ? Symbol$4.prototype : undefined,
symbolToString = symbolProto ? symbolProto.toString : undefined;
/**
* The base implementation of `_.toString` which doesn't convert nullish
* values to empty strings.
*
* @private
* @param {*} value The value to process.
* @returns {string} Returns the string.
*/
function baseToString(value) {
// Exit early for strings to avoid a performance hit in some environments.
if (typeof value == 'string') {
return value;
}
if (isArray(value)) {
// Recursively convert values (susceptible to call stack limits).
return arrayMap(value, baseToString) + '';
}
if (isSymbol(value)) {
return symbolToString ? symbolToString.call(value) : '';
}
var result = (value + '');
return (result == '0' && (1 / value) == -INFINITY$1) ? '-0' : result;
}
/**
* Converts `value` to a string. An empty string is returned for `null`
* and `undefined` values. The sign of `-0` is preserved.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to convert.
* @returns {string} Returns the converted string.
* @example
*
* _.toString(null);
* // => ''
*
* _.toString(-0);
* // => '-0'
*
* _.toString([1, 2, 3]);
* // => '1,2,3'
*/
function toString(value) {
return value == null ? '' : baseToString(value);
}
function addNum(num1, num2) {
let sq1, sq2;
try {
sq1 = toString(num1).split(".")[1].length;
} catch (e) {
sq1 = 0;
}
try {
sq2 = toString(num2).split(".")[1].length;
} catch (e) {
sq2 = 0;
}
const m = Math.pow(10, Math.max(sq1, sq2));
return (Math.round(num1 * m) + Math.round(num2 * m)) / m;
}
function parseValue(num) {
if (num === "")
return "0";
const numStr = toString(num);
if (numStr.indexOf("0") === 0 && numStr.indexOf(".") === -1) {
return toString(parseFloat(num));
}
return toString(num);
}
const AtInputNumber = defineComponent({
name: "AtInputNumber",
emits: {
"blur": null,
"update:modelValue": null,
"error-input"(errCb) {
return !!(errCb && typeof errCb === "object" && ["OVER", "LOW", "DISABLED"].includes(errCb.type) && typeof errCb.errorValue === "number");
}
},
props: {
type: {
type: String,
default: "number"
},
modelValue: {
type: [Number, String],
default: 1
},
min: {
type: Number,
default: 0
},
max: {
type: Number,
default: 100
},
step: {
type: Number,
default: 1
},
size: {
type: String,
default: "normal"
},
width: {
type: Number,
default: 120
},
disabled: Boolean,
disabledInput: Boolean
},
setup(props, { emit }) {
const inputValue = computed({
get: () => Number(handleValue(props.modelValue)),
set: (value) => emit("update:modelValue", value)
});
const inputStyle = computed(() => ({
width: props.width ? `${pxTransform(props.width)}` : ""
}));
const rootClasses = computed(() => ({
"at-input-number": true,
"at-input-number--lg": props.size === "large"
}));
const minusBtnClasses = computed(() => ({
"at-input-number__btn": true,
"at-input-number--disabled": inputValue.value <= props.min || props.disabled
}));
const plusBtnClasses = computed(() => ({
"at-input-number__btn": true,
"at-input-number--disabled": inputValue.value >= props.max || props.disabled
}));
function handleClick(clickType, e) {
const belowMin = clickType === "minus" && inputValue.value <= props.min;
const overMax = clickType === "plus" && inputValue.value >= props.max;
if (belowMin || overMax || props.disabled) {
const deltaValue2 = clickType === "minus" ? -props.step : props.step;
const errorValue = addNum(inputValue.value, deltaValue2);
if (props.disabled) {
handleError({
type: "DISABLED",
errorValue
});
} else {
handleError({
type: belowMin ? "LOW" : "OVER",
errorValue
});
}
return;
}
const deltaValue = clickType === "minus" ? -props.step : props.step;
let newValue = addNum(inputValue.value, deltaValue);
newValue = Number(handleValue(newValue));
inputValue.value = newValue;
}
function handleValue(value) {
let resultValue = value === "" ? props.min : value;
if (resultValue > props.max) {
resultValue = props.max;
handleError({
type: "OVER",
errorValue: resultValue
});
}
if (resultValue < props.min) {
resultValue = props.min;
handleError({
type: "LOW",
errorValue: resultValue
});
}
if (resultValue && !Number(resultValue)) {
resultValue = parseFloat(String(resultValue)) || props.min;
handleError({
type: "OVER",
errorValue: resultValue
});
}
resultValue = parseValue(String(resultValue));
return resultValue;
}
function handleInput(e) {
if (props.disabled)
return;
const { value } = e.target;
const newValue = handleValue(value);
inputValue.value = Number(newValue);
}
function handleBlur(e) {
emit("blur", e);
}
function handleError(errorValue) {
emit("error-input", errorValue);
}
return {
type: toRef(props, "type"),
disabled: toRef(props, "disabled"),
disabledInput: toRef(props, "disabledInput"),
inputValue,
inputStyle,
rootClasses,
plusBtnClasses,
minusBtnClasses,
handleBlur,
handleInput,
handleClick
};
}
});
// Binding optimization for webpack code-split
const _resolveComponent$r = resolveComponent, _createVNode$k = createVNode, _normalizeClass$c = normalizeClass, _withCtx$r = withCtx, _normalizeStyle$e = normalizeStyle, _mergeProps$r = mergeProps, _openBlock$r = openBlock, _createBlock$r = createBlock;
function _sfc_render$r(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_text = _resolveComponent$r("taro-text");
const _component_taro_view = _resolveComponent$r("taro-view");
const _component_taro_input = _resolveComponent$r("taro-input");
return (_openBlock$r(), _createBlock$r(_component_taro_view, _mergeProps$r(_ctx.$attrs, { class: _ctx.rootClasses }), {
default: _withCtx$r(() => [
_createVNode$k(_component_taro_view, {
class: _normalizeClass$c(_ctx.minusBtnClasses),
onTap: _cache[0] || (_cache[0] = $event => (_ctx.handleClick('minus', $event)))
}, {
default: _withCtx$r(() => [
_createVNode$k(_component_taro_text, { class: "at-icon at-icon-subtract at-input-number__btn-subtract" })
]),
_: 1 /* STABLE */
}, 8 /* PROPS */, ["class"]),
_createVNode$k(_component_taro_input, {
class: "at-input-number__input",
style: _normalizeStyle$e(_ctx.inputStyle),
type: _ctx.type,
value: _ctx.inputValue,
disabled: _ctx.disabledInput || _ctx.disabled,
onBlur: _ctx.handleBlur,
onInput: _ctx.handleInput
}, null, 8 /* PROPS */, ["style", "type", "value", "disabled", "onBlur", "onInput"]),
_createVNode$k(_component_taro_view, {
class: _normalizeClass$c(_ctx.plusBtnClasses),
onTap: _cache[1] || (_cache[1] = $event => (_ctx.handleClick('plus', $event)))
}, {
default: _withCtx$r(() => [
_createVNode$k(_component_taro_text, { class: "at-icon at-icon-add at-input-number__btn-add" })
]),
_: 1 /* STABLE */
}, 8 /* PROPS */, ["class"])
]),
_: 1 /* STABLE */
}, 16 /* FULL_PROPS */, ["class"]))
}
AtInputNumber.render = _sfc_render$r;
const AtLoadMore = defineComponent({
name: "AtLoadMore",
components: {
AtButton,
AtActivityIndicator
},
emits: ["click"],
props: {
noMoreTextStyle: {
type: [String, Object],
default: ""
},
moreBtnStyle: {
type: [String, Object],
default: ""
},
status: {
type: String,
default: "more"
},
loadingText: {
type: String,
default: "\u52A0\u8F7D\u4E2D"
},
moreText: {
type: String,
default: "\u67E5\u770B\u66F4\u591A"
},
noMoreText: {
type: String,
default: "\u6CA1\u6709\u66F4\u591A"
}
},
setup(props, { emit }) {
function handleClick() {
emit("click", arguments);
}
return {
...toRefs(props),
handleClick
};
}
});
// Binding optimization for webpack code-split
const _resolveComponent$q = resolveComponent, _openBlock$q = openBlock, _createBlock$q = createBlock, _toDisplayString$h = toDisplayString, _createTextVNode$h = createTextVNode, _normalizeStyle$d = normalizeStyle, _withCtx$q = withCtx, _createVNode$j = createVNode, _mergeProps$q = mergeProps;
function _sfc_render$q(_ctx, _cache, $props, $setup, $data, $options) {
const _component_at_activity_indicator = _resolveComponent$q("at-activity-indicator");
const _component_at_button = _resolveComponent$q("at-button");
const _component_taro_view = _resolveComponent$q("taro-view");
const _component_taro_text = _resolveComponent$q("taro-text");
return (_openBlock$q(), _createBlock$q(_component_taro_view, _mergeProps$q(_ctx.$attrs, { class: "at-load-more" }), {
default: _withCtx$q(() => [
(_ctx.status === 'loading')
? (_openBlock$q(), _createBlock$q(_component_at_activity_indicator, {
key: 0,
mode: "center",
content: _ctx.loadingText
}, null, 8 /* PROPS */, ["content"]))
: (_ctx.status === 'more')
? (_openBlock$q(), _createBlock$q(_component_taro_view, {
key: 1,
class: "at-load-more__cnt"
}, {
default: _withCtx$q(() => [
_createVNode$j(_component_at_button, {
full: true,
style: _normalizeStyle$d(_ctx.moreBtnStyle),
onClick: _ctx.handleClick
}, {
default: _withCtx$q(() => [
_createTextVNode$h(_toDisplayString$h(_ctx.moreText), 1 /* TEXT */)
]),
_: 1 /* STABLE */
}, 8 /* PROPS */, ["style", "onClick"])
]),
_: 1 /* STABLE */
}))
: (_openBlock$q(), _createBlock$q(_component_taro_text, {
key: 2,
class: "at-load-more__tip",
style: _normalizeStyle$d(_ctx.noMoreTextStyle)
}, {
default: _withCtx$q(() => [
_createTextVNode$h(_toDisplayString$h(_ctx.noMoreText), 1 /* TEXT */)
]),
_: 1 /* STABLE */
}, 8 /* PROPS */, ["style"]))
]),
_: 1 /* STABLE */
}, 16 /* FULL_PROPS */))
}
AtLoadMore.render = _sfc_render$q;
const AtMessage = defineComponent({
name: "AtMessage",
onHide() {
Taro.eventCenter.off("atMessage");
},
onShow() {
this.bindMessageListener();
},
setup() {
const _timer = ref(null);
const state = reactive({
_isOpened: false,
_message: "",
_type: "info",
_duration: 3e3
});
const rootClasses = computed(() => ({
"at-message": true,
"at-message--show": state._isOpened,
"at-message--hidden": !state._isOpened,
[`at-message--${state._type}`]: true
}));
function bindMessageListener() {
Taro.eventCenter.on("atMessage", (options = {}) => {
const { message, type, duration } = options;
const newState = {
_isOpened: true,
_message: message,
_type: type,
_duration: duration || state._duration
};
Object.assign(state, newState);
nextTick(() => {
clearTimeout(_timer.value);
_timer.value = setTimeout(() => {
state._isOpened = false;
}, state._duration);
});
});
Taro.atMessage = Taro.eventCenter.trigger.bind(Taro.eventCenter, "atMessage");
}
onMounted(() => {
bindMessageListener();
});
onUnmounted(() => {
Taro.eventCenter.off("atMessage");
});
return {
message: toRef(state, "_message"),
rootClasses,
bindMessageListener
};
}
});
// Binding optimization for webpack code-split
const _toDisplayString$g = toDisplayString, _createTextVNode$g = createTextVNode, _resolveComponent$p = resolveComponent, _mergeProps$p = mergeProps, _withCtx$p = withCtx, _openBlock$p = openBlock, _createBlock$p = createBlock;
function _sfc_render$p(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_view = _resolveComponent$p("taro-view");
return (_openBlock$p(), _createBlock$p(_component_taro_view, _mergeProps$p(_ctx.$attrs, { class: _ctx.rootClasses }), {
default: _withCtx$p(() => [
_createTextVNode$g(_toDisplayString$g(_ctx.message), 1 /* TEXT */)
]),
_: 1 /* STABLE */
}, 16 /* FULL_PROPS */, ["class"]))
}
AtMessage.render = _sfc_render$p;
const AtModalAction = defineComponent({
name: "AtModalAction",
props: {
isSimple: Boolean
}
});
// Binding optimization for webpack code-split
const _renderSlot$b = renderSlot, _resolveComponent$o = resolveComponent, _withCtx$o = withCtx, _createVNode$i = createVNode, _mergeProps$o = mergeProps, _openBlock$o = openBlock, _createBlock$o = createBlock;
function _sfc_render$o(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_view = _resolveComponent$o("taro-view");
return (_openBlock$o(), _createBlock$o(_component_taro_view, _mergeProps$o(_ctx.$attrs, {
class: ['at-modal__footer', {
'at-modal__footer--simple': Boolean(_ctx.$props.isSimple)
}]
}), {
default: _withCtx$o(() => [
_createVNode$i(_component_taro_view, { class: "at-modal__action" }, {
default: _withCtx$o(() => [
_renderSlot$b(_ctx.$slots, "default")
]),
_: 3 /* FORWARDED */
})
]),
_: 3 /* FORWARDED */
}, 16 /* FULL_PROPS */, ["class"]))
}
AtModalAction.render = _sfc_render$o;
var _sfc_main$1 = defineComponent({
name: "AtModalContent"
});
// Binding optimization for webpack code-split
const _renderSlot$a = renderSlot, _resolveComponent$n = resolveComponent, _mergeProps$n = mergeProps, _withCtx$n = withCtx, _openBlock$n = openBlock, _createBlock$n = createBlock;
function _sfc_render$n(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_scroll_view = _resolveComponent$n("taro-scroll-view");
return (_openBlock$n(), _createBlock$n(_component_taro_scroll_view, _mergeProps$n(_ctx.$attrs, {
scrollY: true,
class: "at-modal__content"
}), {
default: _withCtx$n(() => [
_renderSlot$a(_ctx.$slots, "default")
]),
_: 3 /* FORWARDED */
}, 16 /* FULL_PROPS */))
}
_sfc_main$1.render = _sfc_render$n;
var _sfc_main = defineComponent({
name: "AtModalHeader"
});
// Binding optimization for webpack code-split
const _renderSlot$9 = renderSlot, _resolveComponent$m = resolveComponent, _mergeProps$m = mergeProps, _withCtx$m = withCtx, _openBlock$m = openBlock, _createBlock$m = createBlock;
function _sfc_render$m(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_view = _resolveComponent$m("taro-view");
return (_openBlock$m(), _createBlock$m(_component_taro_view, _mergeProps$m(_ctx.$attrs, { class: "at-modal__header" }), {
default: _withCtx$m(() => [
_renderSlot$9(_ctx.$slots, "default")
]),
_: 3 /* FORWARDED */
}, 16 /* FULL_PROPS */))
}
_sfc_main.render = _sfc_render$m;
const AtModal = defineComponent({
name: "AtModal",
components: {
AtModalHeader: _sfc_main,
AtModalAction,
AtModalContent: _sfc_main$1
},
emits: [
"close",
"cancel",
"confirm"
],
props: {
title: String,
isOpened: Boolean,
content: String,
closeOnClickOverlay: {
type: Boolean,
default: true
},
cancelText: String,
confirmText: String
},
setup(props, { attrs, emit }) {
const state = reactive({
_isOpened: props.isOpened,
isWEB: Taro.getEnv() === Taro.ENV_TYPE.WEB
});
const rootClasses = computed(() => ({
"at-modal--active": props.isOpened
}));
const disableScroll = process.env.TARO_ENV === "alipay" ? { disableScroll: true } : {};
const extendedAttrs = mergeProps(disableScroll, attrs);
const h5ButtonStyle = computed(() => {
return state.isWEB && "margin-top: 0px;";
});
watch(() => props.isOpened, (val, oldVal) => {
if (val !== oldVal) {
handleTouchScroll(val);
}
if (val !== state._isOpened) {
state._isOpened = val;
}
});
function handleClickOverlay() {
if (props.closeOnClickOverlay) {
state._isOpened = false;
nextTick((event) => handleClose(event));
}
}
function handleClose(event) {
emit("close", event);
}
function handleCancel(event) {
emit("cancel", event);
}
function handleConfirm(event) {
emit("confirm", event);
}
function handleTouchmove(e) {
e.stopPropagation();
}
return {
...toRefs(props),
isWEB: toRef(state, "isWEB"),
rootClasses,
extendedAttrs,
h5ButtonStyle,
handleCancel,
handleConfirm,
handleTouchmove,
handleClickOverlay
};
}
});
// Binding optimization for webpack code-split
const _resolveComponent$l = resolveComponent, _createVNode$h = createVNode, _toDisplayString$f = toDisplayString, _createTextVNode$f = createTextVNode, _withCtx$l = withCtx, _openBlock$l = openBlock, _createBlock$l = createBlock, _createCommentVNode$d = createCommentVNode, _normalizeStyle$c = normalizeStyle, _mergeProps$l = mergeProps, _renderSlot$8 = renderSlot;
function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_view = _resolveComponent$l("taro-view");
const _component_taro_text = _resolveComponent$l("taro-text");
const _component_at_modal_header = _resolveComponent$l("at-modal-header");
const _component_at_modal_content = _resolveComponent$l("at-modal-content");
const _component_taro_button = _resolveComponent$l("taro-button");
const _component_at_modal_action = _resolveComponent$l("at-modal-action");
return (Boolean(_ctx.title || _ctx.content))
? (_openBlock$l(), _createBlock$l(_component_taro_view, _mergeProps$l({ key: 0 }, _ctx.extendedAttrs, {
class: ['at-modal', _ctx.rootClasses],
catchMove: true,
onTouchmove: _ctx.handleTouchmove
}), {
default: _withCtx$l(() => [
_createVNode$h(_component_taro_view, {
class: "at-modal__overlay",
onTap: _ctx.handleClickOverlay
}, null, 8 /* PROPS */, ["onTap"]),
_createVNode$h(_component_taro_view, { class: "at-modal__container" }, {
default: _withCtx$l(() => [
(_ctx.title)
? (_openBlock$l(), _createBlock$l(_component_at_modal_header, { key: 0 }, {
default: _withCtx$l(() => [
_createVNode$h(_component_taro_text, null, {
default: _withCtx$l(() => [
_createTextVNode$f(_toDisplayString$f(_ctx.title), 1 /* TEXT */)
]),
_: 1 /* STABLE */
})
]),
_: 1 /* STABLE */
}))
: _createCommentVNode$d("v-if", true),
(_ctx.content)
? (_openBlock$l(), _createBlock$l(_component_at_modal_content, { key: 1 }, {
default: _withCtx$l(() => [
_createVNode$h(_component_taro_view, { class: "content-simple" }, {
default: _withCtx$l(() => [
(_ctx.isWEB)
? (_openBlock$l(), _createBlock$l(_component_taro_text, {
key: 0,
innerHTML: _ctx.content.replace(/\n/g, '<br])')
}, null, 8 /* PROPS */, ["innerHTML"]))
: (_openBlock$l(), _createBlock$l(_component_taro_text, { key: 1 }, {
default: _withCtx$l(() => [
_createTextVNode$f(_toDisplayString$f(_ctx.content), 1 /* TEXT */)
]),
_: 1 /* STABLE */
}))
]),
_: 1 /* STABLE */
})
]),
_: 1 /* STABLE */
}))
: _createCommentVNode$d("v-if", true),
(_ctx.cancelText || _ctx.confirmText)
? (_openBlock$l(), _createBlock$l(_component_at_modal_action, {
key: 2,
isSimple: true
}, {
default: _withCtx$l(() => [
(_ctx.cancelText)
? (_openBlock$l(), _createBlock$l(_component_taro_button, {
key: 0,
onTap: _ctx.handleCancel
}, {
default: _withCtx$l(() => [
_createTextVNode$f(_toDisplayString$f(_ctx.cancelText), 1 /* TEXT */)
]),
_: 1 /* STABLE */
}, 8 /* PROPS */, ["onTap"]))
: _createCommentVNode$d("v-if", true),
(_ctx.confirmText)
? (_openBlock$l(), _createBlock$l(_component_taro_button, {
key: 1,
style: _normalizeStyle$c(_ctx.h5ButtonStyle),
onTap: _ctx.handleConfirm
}, {
default: _withCtx$l(() => [
_createTextVNode$f(_toDisplayString$f(_ctx.confirmText), 1 /* TEXT */)
]),
_: 1 /* STABLE */
}, 8 /* PROPS */, ["style", "onTap"]))
: _createCommentVNode$d("v-if", true)
]),
_: 1 /* STABLE */
}))
: _createCommentVNode$d("v-if", true)
]),
_: 1 /* STABLE */
})
]),
_: 1 /* STABLE */
}, 16 /* FULL_PROPS */, ["class", "onTouchmove"]))
: (_openBlock$l(), _createBlock$l(_component_taro_view, _mergeProps$l({ key: 1 }, _ctx.extendedAttrs, {
class: ['at-modal', _ctx.rootClasses],
catchMove: true,
onTouchmove: _ctx.handleTouchmove
}), {
default: _withCtx$l(() => [
_createVNode$h(_component_taro_view, {
class: "at-modal__overlay",
onTap: _ctx.handleClickOverlay
}, null, 8 /* PROPS */, ["onTap"]),
_createVNode$h(_component_taro_view, { class: "at-modal__container" }, {
default: _withCtx$l(() => [
_renderSlot$8(_ctx.$slots, "default")
]),
_: 3 /* FORWARDED */
})
]),
_: 3 /* FORWARDED */
}, 16 /* FULL_PROPS */, ["class", "onTouchmove"]))
}
AtModal.render = _sfc_render$l;
const AtNavBar = defineComponent({
name: "AtNavBar",
emits: [
"click-left-icon",
"click-right-first-icon",
"click-right-second-icon"
],
props: {
title: {
type: String,
default: ""
},
fixed: Boolean,
border: {
type: Boolean,
default: true
},
color: {
type: String,
default: "#6190E8"
},
leftText: {
type: String,
default: ""
},
leftIconType: {
type: [String, Object],
default: "chevron-left"
},
rightFirstIconType: [String, Object],
rightSecondIconType: [String, Object]
},
setup(props, { emit }) {
const linkStyle = computed(() => ({ color: props.color }));
const rootClasses = computed(() => ({
"at-nav-bar": true,
"at-nav-bar--fixed": props.fixed,
"at-nav-bar--no-border": !props.border
}));
const genContainerClasses = computed(() => (iconType) => ({
"at-nav-bar__container": true,
"at-nav-bar__container--hide": !Boolean(iconType)
}));
const defaultIconInfo = {
prefixClass: "at-icon",
value: "",
color: "",
size: 24
};
const genIconInfo = (iconType) => {
const iconInfo = computed(() => iconType instanceof Object ? { ...defaultIconInfo, ...iconType } : { ...defaultIconInfo, value: iconType || "" });
if (iconInfo.value.size) {
iconInfo.value.size = parseInt(iconInfo.value.size.toString()) * 2;
}
return iconInfo;
};
const leftIconInfo = genIconInfo(props.leftIconType);
const rightFirstIconInfo = genIconInfo(props.rightFirstIconType);
const rightSecondIconInfo = genIconInfo(props.rightSecondIconType);
const {
iconClasses: leftIconClasses
} = useIconClasses(leftIconInfo.value, true);
const {
iconStyle: leftIconStyle
} = useIconStyle(leftIconInfo.value, void 0, void 0, pxTransform);
const {
iconClasses: rightFirstIconClasses
} = useIconClasses(rightFirstIconInfo.value, true);
const {
iconStyle: rightFirstIconStyle
} = useIconStyle(rightFirstIconInfo.value, void 0, void 0, pxTransform);
const {
iconClasses: rightSecondIconClasses
} = useIconClasses(rightSecondIconInfo.value, true);
const {
iconStyle: rightSecondIconStyle
} = useIconStyle(rightSecondIconInfo.value, void 0, void 0, pxTransform);
function handleClickLeftIcon(event) {
emit("click-left-icon", event);
}
function handleClickRightFirstIcon(event) {
emit("click-right-first-icon", event);
}
function handleClickRightSecondIcon(event) {
emit("click-right-second-icon", event);
}
return {
...toRefs(props),
linkStyle,
rootClasses,
genContainerClasses,
leftIconStyle,
leftIconClasses,
rightFirstIconStyle,
rightFirstIconClasses,
rightSecondIconStyle,
rightSecondIconClasses,
handleClickLeftIcon,
handleClickRightFirstIcon,
handleClickRightSecondIcon
};
}
});
// Binding optimization for webpack code-split
const _resolveComponent$k = resolveComponent, _normalizeClass$b = normalizeClass, _normalizeStyle$b = normalizeStyle, _openBlock$k = openBlock, _createBlock$k = createBlock, _createCommentVNode$c = createCommentVNode, _toDisplayString$e = toDisplayString, _createTextVNode$e = createTextVNode, _withCtx$k = withCtx, _createVNode$g = createVNode, _renderSlot$7 = renderSlot, _mergeProps$k = mergeProps;
function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_text = _resolveComponent$k("taro-text");
const _component_taro_view = _resolveComponent$k("taro-view");
return (_openBlock$k(), _createBlock$k(_component_taro_view, _mergeProps$k(_ctx.$attrs, { class: _ctx.rootClasses }), {
default: _withCtx$k(() => [
_createVNode$g(_component_taro_view, {
class: "at-nav-bar__left-view",
style: _normalizeStyle$b(_ctx.linkStyle),
onTap: _ctx.handleClickLeftIcon
}, {
default: _withCtx$k(() => [
(_ctx.leftIconType)
? (_openBlock$k(), _createBlock$k(_component_taro_text, {
key: 0,
class: _normalizeClass$b(_ctx.leftIconClasses),
style: _normalizeStyle$b(_ctx.leftIconStyle)
}, null, 8 /* PROPS */, ["class", "style"]))
: _createCommentVNode$c("v-if", true),
(_ctx.leftText)
? (_openBlock$k(), _createBlock$k(_component_taro_text, {
key: 1,
class: "at-nav-bar__text"
}, {
default: _withCtx$k(() => [
_createTextVNode$e(_toDisplayString$e(_ctx.leftText), 1 /* TEXT */)
]),
_: 1 /* STABLE */
}))
: _createCommentVNode$c("v-if", true)
]),
_: 1 /* STABLE */
}, 8 /* PROPS */, ["style", "onTap"]),
_createVNode$g(_component_taro_view, { class: "at-nav-bar__title" }, {
default: _withCtx$k(() => [
(_ctx.title)
? (_openBlock$k(), _createBlock$k(_component_taro_text, { key: 0 }, {
default: _withCtx$k(() => [
_createTextVNode$e(_toDisplayString$e(_ctx.title), 1 /* TEXT */)
]),
_: 1 /* STABLE */
}))
: _renderSlot$7(_ctx.$slots, "default", { key: 1 })
]),
_: 3 /* FORWARDED */
}),
_createVNode$g(_component_taro_view, { class: "at-nav-bar__right-view" }, {
default: _withCtx$k(() => [
_createVNode$g(_component_taro_view, {
class: _normalizeClass$b(_ctx.genContainerClasses(_ctx.rightSecondIconType)),
style: _normalizeStyle$b(_ctx.linkStyle),
onTap: _ctx.handleClickRightSecondIcon
}, {
default: _withCtx$k(() => [
(_ctx.rightSecondIconType)
? (_openBlock$k(), _createBlock$k(_component_taro_text, {
key: 0,
class: _normalizeClass$b(_ctx.rightSecondIconClasses),
style: _normalizeStyle$b(_ctx.rightSecondIconStyle)
}, null, 8 /* PROPS */, ["class", "style"]))
: _createCommentVNode$c("v-if", true)
]),
_: 1 /* STABLE */
}, 8 /* PROPS */, ["class", "style", "onTap"]),
_createVNode$g(_component_taro_view, {
class: _normalizeClass$b(_ctx.genContainerClasses(_ctx.rightFirstIconType)),
style: _normalizeStyle$b(_ctx.linkStyle),
onTap: _ctx.handleClickRightFirstIcon
}, {
default: _withCtx$k(() => [
(_ctx.rightFirstIconType)
? (_openBlock$k(), _createBlock$k(_component_taro_text, {
key: 0,
class: _normalizeClass$b(_ctx.rightFirstIconClasses),
style: _normalizeStyle$b(_ctx.rightFirstIconStyle)
}, null, 8 /* PROPS */, ["class", "style"]))
: _createCommentVNode$c("v-if", true)
]),
_: 1 /* STABLE */
}, 8 /* PROPS */, ["class", "style", "onTap"])
]),
_: 1 /* STABLE */
})
]),
_: 3 /* FORWARDED */
}, 16 /* FULL_PROPS */, ["class"]))
}
AtNavBar.render = _sfc_render$k;
const AtNoticebar = defineComponent({
name: "AtNoticebar",
emits: ["close", "goto-more"],
props: {
close: Boolean,
single: Boolean,
marquee: Boolean,
showMore: Boolean,
speed: {
type: Number,
default: 100
},
moreText: {
type: String,
default: "\u67E5\u770B\u8BE6\u60C5"
},
icon: String
},
setup(props, { emit }) {
const timeout = ref(null);
const interval = ref(null);
const state = reactive({
dura: 15,
show: true,
close_: props.marquee ? false : props.close,
showMore_: !props.single ? false : props.showMore,
animationElId: `J_${Math.ceil(Math.random() * 1e6).toString(36)}`,
animationData: { actions: [{}] },
isWEB: Taro.getEnv() === Taro.ENV_TYPE.WEB
});
const rootClasses = computed(() => ({
"at-noticebar": true,
"at-noticebar--marquee": props.marquee,
"at-noticebar--weapp": props.marquee && !state.isWEB,
"at-noticebar--single": !props.marquee && props.single
}));
const animationStyle = computed(() => {
const style = {};
if (props.marquee) {
style.animationDuration = `${state.dura}s`;
}
return style;
});
const innerContentClasses = computed(() => ({
"at-noticebar__content-inner": true,
[`${state.animationElId}`]: props.marquee
}));
const iconClasses = computed(() => ({
"at-icon": true,
[`at-icon-${props.icon}`]: Boolean(props.icon)
}));
function handleClose(event) {
state.show = false;
emit("close", event);
}
function onGotoMore(event) {
emit("goto-more", event);
}
function initWebAnimation() {
const elem = document.querySelector(`.${state.animationElId}`);
if (!elem)
return;
const width = elem.getBoundingClientRect().width;
state.dura = width / +props.speed;
}
function initMiniAppAnimation() {
const query = Taro.createSelectorQuery();
query.select(`.${state.animationElId}`).boundingClientRect().exec((res) => {
const queryRes = res[0];
if (!queryRes)
return;
const { width } = queryRes;
const dura = width / +props.speed;
const animation = Taro.createAnimation({
duration: dura * 1e3
});
const resetAnimation = Taro.createAnimation({
duration: 0
});
const resetOpacityAnimation = Taro.createAnimation({
duration: 0
});
const animateBody = () => {
resetOpacityAnimation.opacity(0).step();
state.animationData = resetOpacityAnimation.export();
setTimeout(() => {
resetAnimation.translateX(0).step();
state.animationData = resetAnimation.export();
}, 300);
setTimeout(() => {
resetOpacityAnimation.opacity(1).step();
state.animationData = resetOpacityAnimation.export();
}, 600);
setTimeout(() => {
animation.translateX(-width).step();
state.animationData = animation.export();
}, 900);
};
animateBody();
interval.value = setInterval(animateBody, dura * 1e3 + 1e3);
});
}
function initAnimation() {
timeout.value = setTimeout(() => {
timeout.value = null;
if (state.isWEB)
initWebAnimation();
else
initMiniAppAnimation();
}, 100);
}
onMounted(() => {
if (!props.marquee)
return;
initAnimation();
});
return {
...toRefs(state),
...toRefs(props),
rootClasses,
iconClasses,
innerContentClasses,
animationStyle,
handleClose,
onGotoMore
};
}
});
// Binding optimization for webpack code-split
const _resolveComponent$j = resolveComponent, _createVNode$f = createVNode, _withCtx$j = withCtx, _openBlock$j = openBlock, _createBlock$j = createBlock, _createCommentVNode$b = createCommentVNode, _normalizeClass$a = normalizeClass, _renderSlot$6 = renderSlot, _normalizeStyle$a = normalizeStyle, _toDisplayString$d = toDisplayString, _createTextVNode$d = createTextVNode, _mergeProps$j = mergeProps;
function _sfc_render$j(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_text = _resolveComponent$j("taro-text");
const _component_taro_view = _resolveComponent$j("taro-view");
return (_ctx.show)
? (_openBlock$j(), _createBlock$j(_component_taro_view, _mergeProps$j({ key: 0 }, _ctx.$attrs, { class: _ctx.rootClasses }), {
default: _withCtx$j(() => [
(_ctx.close_)
? (_openBlock$j(), _createBlock$j(_component_taro_view, {
key: 0,
class: "at-noticebar__close",
onTap: _ctx.handleClose
}, {
default: _withCtx$j(() => [
_createVNode$f(_component_taro_text, { class: "at-icon at-icon-close" })
]),
_: 1 /* STABLE */
}, 8 /* PROPS */, ["onTap"]))
: _createCommentVNode$b("v-if", true),
_createVNode$f(_component_taro_view, { class: "at-noticebar__content" }, {
default: _withCtx$j(() => [
(_ctx.icon)
? (_openBlock$j(), _createBlock$j(_component_taro_view, {
key: 0,
class: "at-noticebar__content-icon"
}, {
default: _withCtx$j(() => [
_createVNode$f(_component_taro_text, {
class: _normalizeClass$a(_ctx.iconClasses)
}, null, 8 /* PROPS */, ["class"])
]),
_: 1 /* STABLE */
}))
: _createCommentVNode$b("v-if", true),
_createVNode$f(_component_taro_view, { class: "at-noticebar__content-text" }, {
default: _withCtx$j(() => [
_createVNode$f(_component_taro_view, {
id: _ctx.animationElId,
animation: _ctx.animationData,
class: _normalizeClass$a(_ctx.innerContentClasses),
style: _normalizeStyle$a(_ctx.animationStyle)
}, {
default: _withCtx$j(() => [
_renderSlot$6(_ctx.$slots, "default")
]),
_: 3 /* FORWARDED */
}, 8 /* PROPS */, ["id", "animation", "class", "style"]),
(_ctx.showMore_)
? (_openBlock$j(), _createBlock$j(_component_taro_view, {
key: 0,
class: "at-noticebar__more",
onTap: _ctx.onGotoMore
}, {
default: _withCtx$j(() => [
_createVNode$f(_component_taro_text, { class: "text" }, {
default: _withCtx$j(() => [
_createTextVNode$d(_toDisplayString$d(_ctx.moreText), 1 /* TEXT */)
]),
_: 1 /* STABLE */
}),
_createVNode$f(_component_taro_view, { class: "at-noticebar__more-icon" }, {
default: _withCtx$j(() => [
_createVNode$f(_component_taro_text, { class: "at-icon at-icon-chevron-right" })
]),
_: 1 /* STABLE */
})
]),
_: 1 /* STABLE */
}, 8 /* PROPS */, ["onTap"]))
: _createCommentVNode$b("v-if", true)
]),
_: 3 /* FORWARDED */
})
]),
_: 3 /* FORWARDED */
})
]),
_: 3 /* FORWARDED */
}, 16 /* FULL_PROPS */, ["class"]))
: _createCommentVNode$b("v-if", true)
}
AtNoticebar.render = _sfc_render$j;
const MIN_MAXPAGE = 1;
const getMaxPage = (maxPage = 0) => {
if (maxPage <= 0)
return MIN_MAXPAGE;
return maxPage;
};
const createPickerRange = (max) => {
const range = new Array(max).fill(0).map((_val, index) => index + 1);
return range;
};
const AtPagination = defineComponent({
name: "AtPagination",
components: {
AtButton
},
emits: {
"page-change"(data) {
return !!(data && data.type && ["prev", "next"].includes(data.type) && typeof data.current === "number");
}
},
props: {
total: { type: Number, default: 0 },
current: { type: Number, default: 1 },
pageSize: { type: Number, default: 20 },
icon: Boolean
},
setup(props, { emit }) {
const maxPage = computed(() => getMaxPage(Math.ceil(props.total / props.pageSize)));
const state = reactive({
currentPage: props.current || 1,
maxPage: maxPage.value,
pickerRange: createPickerRange(maxPage.value)
});
const prevDisabled = computed(() => state.maxPage === MIN_MAXPAGE || state.currentPage === 1);
const nextDisabled = computed(() => state.maxPage === MIN_MAXPAGE || state.currentPage === state.maxPage);
const rootClasses = computed(() => ["at-pagination", {
"at-pagination--icon": props.icon
}]);
watch(() => [
props.total,
props.pageSize,
props.current
], ([total, pageSize, current]) => {
const maxPage2 = getMaxPage(Math.ceil(total / pageSize));
if (maxPage2 !== state.maxPage) {
state.maxPage = maxPage2;
state.pickerRange = createPickerRange(maxPage2);
}
if (typeof current === "number" && current !== state.currentPage) {
state.currentPage = current;
}
});
function onPrev() {
let { currentPage } = state;
const originCur = currentPage;
currentPage -= 1;
currentPage = Math.max(1, currentPage);
if (originCur === currentPage)
return;
emit("page-change", { type: "prev", current: currentPage });
state.currentPage = currentPage;
}
function onNext() {
let { currentPage } = state;
const originCur = currentPage;
const { maxPage: maxPage2 } = state;
currentPage += 1;
currentPage = Math.min(maxPage2, currentPage);
if (originCur === currentPage)
return;
emit("page-change", { type: "next", current: currentPage });
state.currentPage = currentPage;
}
return {
...toRefs(state),
icon: toRef(props, "icon"),
rootClasses,
prevDisabled,
nextDisabled,
onPrev,
onNext
};
}
});
// Binding optimization for webpack code-split
const _resolveComponent$i = resolveComponent, _createVNode$e = createVNode, _withCtx$i = withCtx, _openBlock$i = openBlock, _createBlock$i = createBlock, _createCommentVNode$a = createCommentVNode, _createTextVNode$c = createTextVNode, _toDisplayString$c = toDisplayString, _mergeProps$i = mergeProps;
const _hoisted_1 = /*#__PURE__*/_createTextVNode$c("上一页");
const _hoisted_2 = /*#__PURE__*/_createTextVNode$c("下一页");
function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_text = _resolveComponent$i("taro-text");
const _component_at_button = _resolveComponent$i("at-button");
const _component_taro_view = _resolveComponent$i("taro-view");
return (_openBlock$i(), _createBlock$i(_component_taro_view, _mergeProps$i(_ctx.$attrs, { class: _ctx.rootClasses }), {
default: _withCtx$i(() => [
_createVNode$e(_component_taro_view, { class: "at-pagination__btn-prev" }, {
default: _withCtx$i(() => [
(_ctx.icon)
? (_openBlock$i(), _createBlock$i(_component_at_button, {
key: 0,
size: "small",
disabled: _ctx.prevDisabled,
onClick: _ctx.onPrev
}, {
default: _withCtx$i(() => [
_createVNode$e(_component_taro_text, { class: "at-icon at-icon-chevron-left" })
]),
_: 1 /* STABLE */
}, 8 /* PROPS */, ["disabled", "onClick"]))
: _createCommentVNode$a("v-if", true),
(!_ctx.icon)
? (_openBlock$i(), _createBlock$i(_component_at_button, {
key: 1,
size: "small",
disabled: _ctx.prevDisabled,
onClick: _ctx.onPrev
}, {
default: _withCtx$i(() => [
_hoisted_1
]),
_: 1 /* STABLE */
}, 8 /* PROPS */, ["disabled", "onClick"]))
: _createCommentVNode$a("v-if", true)
]),
_: 1 /* STABLE */
}),
_createVNode$e(_component_taro_view, { class: "at-pagination__number" }, {
default: _withCtx$i(() => [
_createVNode$e(_component_taro_text, { class: "at-pagination__number-current" }, {
default: _withCtx$i(() => [
_createTextVNode$c(_toDisplayString$c(_ctx.currentPage), 1 /* TEXT */)
]),
_: 1 /* STABLE */
}),
_createVNode$e(_component_taro_text, null, {
default: _withCtx$i(() => [
_createTextVNode$c(_toDisplayString$c(`/${_ctx.maxPage}`), 1 /* TEXT */)
]),
_: 1 /* STABLE */
})
]),
_: 1 /* STABLE */
}),
_createVNode$e(_component_taro_view, { class: "at-pagination__btn-next" }, {
default: _withCtx$i(() => [
(_ctx.icon)
? (_openBlock$i(), _createBlock$i(_component_at_button, {
key: 0,
size: "small",
disabled: _ctx.nextDisabled,
onClick: _ctx.onNext
}, {
default: _withCtx$i(() => [
_createVNode$e(_component_taro_text, { class: "at-icon at-icon-chevron-right" })
]),
_: 1 /* STABLE */
}, 8 /* PROPS */, ["disabled", "onClick"]))
: _createCommentVNode$a("v-if", true),
(!_ctx.icon)
? (_openBlock$i(), _createBlock$i(_component_at_button, {
key: 1,
size: "small",
disabled: _ctx.nextDisabled,
onClick: _ctx.onNext
}, {
default: _withCtx$i(() => [
_hoisted_2
]),
_: 1 /* STABLE */
}, 8 /* PROPS */, ["disabled", "onClick"]))
: _createCommentVNode$a("v-if", true)
]),
_: 1 /* STABLE */
})
]),
_: 1 /* STABLE */
}, 16 /* FULL_PROPS */, ["class"]))
}
AtPagination.render = _sfc_render$i;
const AtProgress = defineComponent({
name: "AtProgress",
props: {
color: {
type: String,
default: ""
},
status: {
type: String,
validator: (val) => ["progress", "error", "success"].includes(val)
},
percent: {
type: Number,
default: 0
},
strokeWidth: {
type: Number,
default: 10
},
hidePercent: Boolean
},
setup(props) {
const percent = computed(() => {
let p = props.percent;
if (props.percent < 0) {
p = 0;
}
if (props.percent > 100) {
p = 100;
}
return p;
});
const rootClasses = computed(() => ["at-progress", {
[`at-progress--${props.status}`]: !!props.status
}]);
const iconClasses = computed(() => ["at-icon", {
"at-icon-close-circle": props.status === "error",
"at-icon-check-circle": props.status === "success"
}]);
const progressStyle = computed(() => ({
width: `${percent.value}%`,
height: props.strokeWidth && `${props.strokeWidth}px`,
backgroundColor: props.color
}));
return {
status: toRef(props, "status"),
hidePercent: toRef(props, "hidePercent"),
percent,
rootClasses,
iconClasses,
progressStyle
};
}
});
// Binding optimization for webpack code-split
const _resolveComponent$h = resolveComponent, _normalizeStyle$9 = normalizeStyle, _createVNode$d = createVNode, _withCtx$h = withCtx, _toDisplayString$b = toDisplayString, _createTextVNode$b = createTextVNode, _openBlock$h = openBlock, _createBlock$h = createBlock, _createCommentVNode$9 = createCommentVNode, _normalizeClass$9 = normalizeClass, _mergeProps$h = mergeProps;
function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_view = _resolveComponent$h("taro-view");
const _component_taro_text = _resolveComponent$h("taro-text");
return (_openBlock$h(), _createBlock$h(_component_taro_view, _mergeProps$h(_ctx.$attrs, { class: _ctx.rootClasses }), {
default: _withCtx$h(() => [
_createVNode$d(_component_taro_view, { class: "at-progress__outer" }, {
default: _withCtx$h(() => [
_createVNode$d(_component_taro_view, { class: "at-progress__outer-inner" }, {
default: _withCtx$h(() => [
_createVNode$d(_component_taro_view, {
class: "at-progress__outer-inner-background",
style: _normalizeStyle$9(_ctx.progressStyle)
}, null, 8 /* PROPS */, ["style"])
]),
_: 1 /* STABLE */
})
]),
_: 1 /* STABLE */
}),
(!_ctx.hidePercent)
? (_openBlock$h(), _createBlock$h(_component_taro_view, {
key: 0,
class: "at-progress__content"
}, {
default: _withCtx$h(() => [
(!_ctx.status || _ctx.status === 'progress')
? (_openBlock$h(), _createBlock$h(_component_taro_text, { key: 0 }, {
default: _withCtx$h(() => [
_createTextVNode$b(_toDisplayString$b(`${_ctx.percent}%`), 1 /* TEXT */)
]),
_: 1 /* STABLE */
}))
: (_openBlock$h(), _createBlock$h(_component_taro_text, {
key: 1,
class: _normalizeClass$9(_ctx.iconClasses)
}, null, 8 /* PROPS */, ["class"]))
]),
_: 1 /* STABLE */
}))
: _createCommentVNode$9("v-if", true)
]),
_: 1 /* STABLE */
}, 16 /* FULL_PROPS */, ["class"]))
}
AtProgress.render = _sfc_render$h;
const AtRadio = defineComponent({
name: "AtRadio",
emits: ["update:modelValue"],
props: {
modelValue: {
type: String,
default: ""
},
options: {
type: Array,
default: []
}
},
setup(props, { emit }) {
const radioModelValue = useModelValue(props, emit);
const genOptionClasses = computed(() => (option) => ({
"at-radio__option": true,
"at-radio__option--disabled": option.disabled
}));
const genIconClasses = computed(() => (option) => ({
"at-radio__icon": true,
"at-radio__icon--checked": props.modelValue === option.value
}));
function handleClick(option) {
if (option.disabled)
return;
radioModelValue.value = option.value;
}
return {
options: toRef(props, "options"),
genOptionClasses,
genIconClasses,
handleClick
};
}
});
// Binding optimization for webpack code-split
const _renderList$9 = renderList, _Fragment$9 = Fragment, _openBlock$g = openBlock, _createElementBlock$9 = createElementBlock, _toDisplayString$a = toDisplayString, _createTextVNode$a = createTextVNode, _resolveComponent$g = resolveComponent, _withCtx$g = withCtx, _createVNode$c = createVNode, _normalizeClass$8 = normalizeClass, _createBlock$g = createBlock, _createCommentVNode$8 = createCommentVNode, _mergeProps$g = mergeProps;
function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_view = _resolveComponent$g("taro-view");
const _component_taro_text = _resolveComponent$g("taro-text");
return (_openBlock$g(), _createBlock$g(_component_taro_view, _mergeProps$g(_ctx.$attrs, { class: "at-radio" }), {
default: _withCtx$g(() => [
(_openBlock$g(true), _createElementBlock$9(_Fragment$9, null, _renderList$9(_ctx.options, (option, index) => {
return (_openBlock$g(), _createBlock$g(_component_taro_view, {
key: index,
class: _normalizeClass$8(_ctx.genOptionClasses(option)),
onTap: $event => (_ctx.handleClick(option))
}, {
default: _withCtx$g(() => [
_createVNode$c(_component_taro_view, { class: "at-radio__option-wrap" }, {
default: _withCtx$g(() => [
_createVNode$c(_component_taro_view, { class: "at-radio__option-container" }, {
default: _withCtx$g(() => [
_createVNode$c(_component_taro_view, { class: "at-radio__title" }, {
default: _withCtx$g(() => [
_createTextVNode$a(_toDisplayString$a(option.label), 1 /* TEXT */)
]),
_: 2 /* DYNAMIC */
}, 1024 /* DYNAMIC_SLOTS */),
_createVNode$c(_component_taro_view, {
class: _normalizeClass$8(_ctx.genIconClasses(option))
}, {
default: _withCtx$g(() => [
_createVNode$c(_component_taro_text, { class: "at-icon at-icon-check" })
]),
_: 2 /* DYNAMIC */
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["class"])
]),
_: 2 /* DYNAMIC */
}, 1024 /* DYNAMIC_SLOTS */),
(option.desc)
? (_openBlock$g(), _createBlock$g(_component_taro_view, {
key: 0,
class: "at-radio__desc"
}, {
default: _withCtx$g(() => [
_createTextVNode$a(_toDisplayString$a(option.desc), 1 /* TEXT */)
]),
_: 2 /* DYNAMIC */
}, 1024 /* DYNAMIC_SLOTS */))
: _createCommentVNode$8("v-if", true)
]),
_: 2 /* DYNAMIC */
}, 1024 /* DYNAMIC_SLOTS */)
]),
_: 2 /* DYNAMIC */
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["class", "onTap"]))
}), 128 /* KEYED_FRAGMENT */))
]),
_: 1 /* STABLE */
}, 16 /* FULL_PROPS */))
}
AtRadio.render = _sfc_render$g;
const AtRate = defineComponent({
name: "AtRate",
emits: ["update:modelValue"],
props: {
size: {
type: [Number, String],
default: 20,
validator: (prop) => {
return typeof parseInt(`${prop}`) === "number";
}
},
modelValue: { type: Number, default: 0 },
max: {
type: [Number, String],
default: 5,
validator: (prop) => {
return typeof parseInt(`${prop}`) === "number";
}
},
margin: {
type: [Number, String],
default: 5,
validator: (prop) => {
return typeof parseInt(`${prop}`) === "number";
}
},
icon: {
type: String,
default: "star",
validator: (prop) => ["star", "heart"].includes(prop)
},
color: { type: String, default: "#FFCA3E" }
},
setup(props, { emit }) {
const modelValue = useModelValue(props, emit);
const iconMarginStyle = computed(() => ({
marginRight: pxTransform(parseInt(`${props.margin}`))
}));
const genIconStyle = computed(() => (cls) => ({
fontSize: convertToUnit(props.size),
color: cls.includes("at-rate__icon--on") ? props.color : ""
}));
const iconColorClasses = computed(() => {
const classNames = [];
const floorValue = Math.floor(props.modelValue);
const ceilValue = Math.ceil(props.modelValue);
for (let i = 0; i < parseInt(`${props.max}`); i++) {
if (floorValue > i) {
classNames.push("at-rate__icon at-rate__icon--on");
} else if (ceilValue - 1 === i) {
classNames.push("at-rate__icon at-rate__icon--half");
} else {
classNames.push("at-rate__icon at-rate__icon--off");
}
}
return classNames;
});
function handleClick(index) {
modelValue.value = index;
}
return {
genIconStyle,
iconMarginStyle,
iconColorClasses,
handleClick
};
}
});
// Binding optimization for webpack code-split
const _renderList$8 = renderList, _Fragment$8 = Fragment, _openBlock$f = openBlock, _createElementBlock$8 = createElementBlock, _resolveComponent$f = resolveComponent, _normalizeClass$7 = normalizeClass, _normalizeStyle$8 = normalizeStyle, _createVNode$b = createVNode, _withCtx$f = withCtx, _createBlock$f = createBlock, _mergeProps$f = mergeProps;
function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_text = _resolveComponent$f("taro-text");
const _component_taro_view = _resolveComponent$f("taro-view");
return (_openBlock$f(), _createBlock$f(_component_taro_view, _mergeProps$f(_ctx.$attrs, { class: "at-rate" }), {
default: _withCtx$f(() => [
(_openBlock$f(true), _createElementBlock$8(_Fragment$8, null, _renderList$8(_ctx.iconColorClasses, (className, i) => {
return (_openBlock$f(), _createBlock$f(_component_taro_view, {
key: `at-rate-star-${i}`,
class: _normalizeClass$7(className),
style: _normalizeStyle$8(_ctx.iconMarginStyle),
onTap: $event => (_ctx.handleClick(i + 1))
}, {
default: _withCtx$f(() => [
_createVNode$b(_component_taro_text, {
class: _normalizeClass$7(['at-icon', `at-icon-${_ctx.icon}-2`]),
style: _normalizeStyle$8(_ctx.genIconStyle(className))
}, null, 8 /* PROPS */, ["class", "style"]),
_createVNode$b(_component_taro_view, { class: "at-rate__left" }, {
default: _withCtx$f(() => [
_createVNode$b(_component_taro_text, {
class: _normalizeClass$7(['at-icon', `at-icon-${_ctx.icon}-2`]),
style: _normalizeStyle$8(_ctx.genIconStyle(className))
}, null, 8 /* PROPS */, ["class", "style"])
]),
_: 2 /* DYNAMIC */
}, 1024 /* DYNAMIC_SLOTS */)
]),
_: 2 /* DYNAMIC */
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["class", "style", "onTap"]))
}), 128 /* KEYED_FRAGMENT */))
]),
_: 1 /* STABLE */
}, 16 /* FULL_PROPS */))
}
AtRate.render = _sfc_render$f;
const AtRange = defineComponent({
name: "AtRange",
emits: {
"update:modelValue"(value) {
return !!(value && Array.isArray(value) && value.length === 2 && typeof value[0] === "number" && typeof value[1] === "number");
},
"after-change"(value) {
return !!(value && Array.isArray(value) && value.length === 2 && typeof value[0] === "number" && typeof value[1] === "number");
}
},
props: {
sliderStyle: {
type: [Object, String],
default: ""
},
railStyle: {
type: [Object, String],
default: ""
},
trackStyle: {
type: [Object, String],
default: ""
},
modelValue: {
type: Array,
default: [0, 0]
},
min: {
type: Number,
default: 0
},
max: {
type: Number,
default: 100
},
blockSize: {
type: Number,
default: 0
},
disabled: Boolean,
onAfterChange: Function
},
setup(props, { emit }) {
const left = ref(0);
const width = ref(0);
const currentSlider = ref("");
const rangeValue = useModelValue(props, emit);
const deltaValue = computed(() => props.max - props.min);
const state = reactive({
aX: 0,
bX: 0
});
const rootClasses = computed(() => ["at-range", {
"at-range--disabled": props.disabled
}]);
const containerStyle = computed(() => ({
height: props.blockSize ? `${props.blockSize}PX` : ""
}));
const sliderCommonStyle = computed(() => ({
width: props.blockSize ? `${props.blockSize}PX` : "",
height: props.blockSize ? `${props.blockSize}PX` : "",
marginLeft: props.blockSize ? `${-props.blockSize / 2}PX` : ""
}));
const sliderAStyle = computed(() => ({
...sliderCommonStyle.value,
...typeof props.sliderStyle === "string" ? cssStringToObject(props.sliderStyle) : props.sliderStyle,
left: `${state.aX}%`,
top: "0%"
}));
const sliderBStyle = computed(() => ({
...sliderCommonStyle.value,
...typeof props.sliderStyle === "string" ? cssStringToObject(props.sliderStyle) : props.sliderStyle,
left: `${state.bX}%`,
top: "0%"
}));
const atTrackStyle = computed(() => ({
...typeof props.trackStyle === "string" ? cssStringToObject(props.trackStyle) : props.trackStyle,
left: `${Math.min(state.aX, state.bX)}%`,
width: `${Math.abs(state.aX - state.bX)}%`
}));
function handleClick(event) {
if (currentSlider.value && !props.disabled) {
let sliderValue = 0;
const detail = getEventDetail(event);
sliderValue = detail.x - left.value;
setSliderValue(currentSlider.value, sliderValue, "onChange");
}
}
function handleTouchmove(sliderName, event) {
if (props.disabled)
return;
event.stopPropagation();
const clientX = event.touches[0].clientX;
setSliderValue(sliderName, clientX - left.value, "onChange");
}
function handleTouchend(sliderName) {
if (props.disabled)
return;
currentSlider.value = sliderName;
triggerEvent("onAfterChange");
}
function setSliderValue(sliderName, targetValue, funcName) {
const distance = Math.min(Math.max(targetValue, 0), width.value);
const sliderValue = Math.floor(distance / width.value * 100);
if (funcName) {
state[sliderName] = sliderValue;
nextTick(() => {
triggerEvent(funcName);
});
} else {
state[sliderName] = sliderValue;
}
}
function setValue(value) {
const aX = Math.round((value[0] - props.min) / deltaValue.value * 100);
const bX = Math.round((value[1] - props.min) / deltaValue.value * 100);
state.aX = aX;
state.bX = bX;
}
function triggerEvent(funcName) {
const { aX, bX } = state;
const a = Math.round(aX / 100 * deltaValue.value) + props.min;
const b = Math.round(bX / 100 * deltaValue.value) + props.min;
const result = [a, b].sort((x, y) => x - y);
if (funcName === "onChange") {
rangeValue.value = result;
} else if (funcName === "onAfterChange") {
emit("after-change", result);
}
}
function updatePos() {
delayQuerySelector(this, ".at-range__container", 10).then((rect) => {
width.value = Math.round(rect[0].width);
left.value = Math.round(rect[0].left);
});
}
watch(rangeValue, (value, prevValue) => {
updatePos();
if (prevValue[0] !== value[0] || prevValue[1] !== value[1]) {
setValue(value);
}
});
onMounted(() => {
updatePos();
setValue(rangeValue.value);
});
return {
railStyle: toRef(props, "railStyle"),
rootClasses,
sliderAStyle,
sliderBStyle,
atTrackStyle,
containerStyle,
handleClick,
handleTouchend,
handleTouchmove
};
}
});
// Binding optimization for webpack code-split
const _resolveComponent$e = resolveComponent, _normalizeStyle$7 = normalizeStyle, _createVNode$a = createVNode, _renderList$7 = renderList, _Fragment$7 = Fragment, _openBlock$e = openBlock, _createElementBlock$7 = createElementBlock, _withCtx$e = withCtx, _mergeProps$e = mergeProps, _createBlock$e = createBlock;
function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_view = _resolveComponent$e("taro-view");
return (_openBlock$e(), _createBlock$e(_component_taro_view, _mergeProps$e(_ctx.$attrs, {
class: _ctx.rootClasses,
onTap: _ctx.handleClick
}), {
default: _withCtx$e(() => [
_createVNode$a(_component_taro_view, {
class: "at-range__container",
style: _normalizeStyle$7(_ctx.containerStyle)
}, {
default: _withCtx$e(() => [
_createVNode$a(_component_taro_view, {
class: "at-range__rail",
style: _normalizeStyle$7(_ctx.railStyle)
}, {
default: _withCtx$e(() => [
_createVNode$a(_component_taro_view, {
class: "at-range__track",
style: _normalizeStyle$7(_ctx.atTrackStyle)
}, null, 8 /* PROPS */, ["style"]),
(_openBlock$e(), _createElementBlock$7(_Fragment$7, null, _renderList$7(['aX', 'bX'], (sliderName, index) => {
return _createVNode$a(_component_taro_view, {
key: `${sliderName} - ${index}`,
style: _normalizeStyle$7(sliderName === 'aX' ? _ctx.sliderAStyle : _ctx.sliderBStyle),
class: "at-range__slider",
onTouchend: $event => (_ctx.handleTouchend(sliderName)),
onTouchmove: $event => (_ctx.handleTouchmove(sliderName, $event))
}, null, 8 /* PROPS */, ["style", "onTouchend", "onTouchmove"])
}), 64 /* STABLE_FRAGMENT */))
]),
_: 1 /* STABLE */
}, 8 /* PROPS */, ["style"])
]),
_: 1 /* STABLE */
}, 8 /* PROPS */, ["style"])
]),
_: 1 /* STABLE */
}, 16 /* FULL_PROPS */, ["class", "onTap"]))
}
AtRange.render = _sfc_render$e;
const AtSearchBar = defineComponent({
name: "AtSearchBar",
emits: [
"blur",
"focus",
"confirm",
"action-click",
"update:modelValue"
],
props: {
modelValue: {
type: String,
default: ""
},
placeholder: {
type: String,
default: "\u641C\u7D22"
},
maxLength: {
type: Number,
default: 140
},
fixed: Boolean,
focus: Boolean,
disabled: Boolean,
showActionButton: Boolean,
actionName: {
type: String,
default: "\u641C\u7D22"
},
inputType: {
type: String,
default: "text"
},
onClear: Function
},
setup(props, { emit }) {
const state = reactive({
isFocus: !!props.focus
});
const fontSize = 14;
const inputID = ref("weui-input" + uuid());
const inputValue = useModelValue(props, emit);
const rootClasses = computed(() => ({
"at-search-bar": true,
"at-search-bar--fixed": props.fixed
}));
const placeholderWrapStyle = computed(() => {
const placeholderWrapStyle2 = {};
if (state.isFocus || !state.isFocus && inputValue.value) {
placeholderWrapStyle2.flexGrow = 0;
} else if (!state.isFocus && !inputValue.value) {
placeholderWrapStyle2.flexGrow = 1;
}
return placeholderWrapStyle2;
});
const actionStyle = computed(() => {
const actionStyle2 = {};
if (state.isFocus || !state.isFocus && inputValue.value) {
actionStyle2.opacity = 1;
actionStyle2.marginRight = `0`;
} else if (!state.isFocus && !inputValue.value) {
actionStyle2.opacity = 0;
actionStyle2.marginRight = `-${(props.actionName.length + 1) * fontSize + fontSize / 2 + 10}px`;
}
if (props.showActionButton) {
actionStyle2.opacity = 1;
actionStyle2.marginRight = `0`;
}
return actionStyle2;
});
const clearIconStyle = computed(() => ({
display: !inputValue.value.length ? "none" : "flex"
}));
const placeholderStyle = computed(() => ({
visibility: !inputValue.value.length ? "visible" : "hidden"
}));
function handleFocus(event) {
if (process.env.TARO_ENV === "h5") {
inputID.value = "weui-input" + uuid(10, 32);
}
state.isFocus = true;
emit("focus", event);
}
function handleBlur(event) {
state.isFocus = false;
emit("blur", event);
}
function handleInput(e) {
inputValue.value = e.detail.value;
if (process.env.TARO_ENV === "h5" && e.detail.value === "") {
clearInputNodeValue();
}
}
function clearInputNodeValue() {
const inputNode = document.querySelector(`#${inputID.value} > .weui-input`);
inputNode.value = "";
}
function handleClear(event) {
if (typeof props.onClear === "function") {
props.onClear(event);
} else {
inputValue.value = "";
}
if (process.env.TARO_ENV === "h5") {
clearInputNodeValue();
}
}
function handleConfirm(event) {
emit("confirm", event);
}
function handleActionClick(event) {
emit("action-click", event);
}
return {
...toRefs(props),
...toRefs(state),
inputID,
inputValue,
rootClasses,
actionStyle,
clearIconStyle,
placeholderStyle,
placeholderWrapStyle,
handleBlur,
handleClear,
handleFocus,
handleInput,
handleConfirm,
handleActionClick
};
}
});
// Binding optimization for webpack code-split
const _resolveComponent$d = resolveComponent, _createVNode$9 = createVNode, _toDisplayString$9 = toDisplayString, _createTextVNode$9 = createTextVNode, _normalizeStyle$6 = normalizeStyle, _withCtx$d = withCtx, _openBlock$d = openBlock, _createBlock$d = createBlock, _createCommentVNode$7 = createCommentVNode, _mergeProps$d = mergeProps;
function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_text = _resolveComponent$d("taro-text");
const _component_taro_view = _resolveComponent$d("taro-view");
const _component_taro_input = _resolveComponent$d("taro-input");
return (_openBlock$d(), _createBlock$d(_component_taro_view, _mergeProps$d(_ctx.$attrs, { class: _ctx.rootClasses }), {
default: _withCtx$d(() => [
_createVNode$9(_component_taro_view, { class: "at-search-bar__input-cnt" }, {
default: _withCtx$d(() => [
_createVNode$9(_component_taro_view, {
class: "at-search-bar__placeholder-wrap",
style: _normalizeStyle$6(_ctx.placeholderWrapStyle)
}, {
default: _withCtx$d(() => [
_createVNode$9(_component_taro_text, { class: "at-icon at-icon-search" }),
_createVNode$9(_component_taro_text, {
class: "at-search-bar__placeholder",
style: _normalizeStyle$6(_ctx.placeholderStyle)
}, {
default: _withCtx$d(() => [
_createTextVNode$9(_toDisplayString$9(_ctx.isFocus ? '' : _ctx.placeholder), 1 /* TEXT */)
]),
_: 1 /* STABLE */
}, 8 /* PROPS */, ["style"])
]),
_: 1 /* STABLE */
}, 8 /* PROPS */, ["style"]),
_createVNode$9(_component_taro_input, {
class: "at-search-bar__input",
id: _ctx.inputID,
type: _ctx.inputType,
focus: _ctx.isFocus,
disabled: _ctx.disabled,
maxlength: _ctx.maxLength,
value: _ctx.inputValue,
confirmType: "search",
onBlur: _ctx.handleBlur,
onInput: _ctx.handleInput,
onFocus: _ctx.handleFocus,
onConfirm: _ctx.handleConfirm
}, null, 8 /* PROPS */, ["id", "type", "focus", "disabled", "maxlength", "value", "onBlur", "onInput", "onFocus", "onConfirm"]),
(_ctx.inputValue)
? (_openBlock$d(), _createBlock$d(_component_taro_view, {
key: 0,
class: "at-search-bar__clear",
style: _normalizeStyle$6(_ctx.clearIconStyle),
onTouchstart: _ctx.handleClear
}, {
default: _withCtx$d(() => [
_createVNode$9(_component_taro_text, { class: "at-icon at-icon-close-circle" })
]),
_: 1 /* STABLE */
}, 8 /* PROPS */, ["style", "onTouchstart"]))
: _createCommentVNode$7("v-if", true)
]),
_: 1 /* STABLE */
}),
_createVNode$9(_component_taro_view, {
class: "at-search-bar__action",
style: _normalizeStyle$6(_ctx.actionStyle),
onTap: _ctx.handleActionClick
}, {
default: _withCtx$d(() => [
_createTextVNode$9(_toDisplayString$9(_ctx.actionName), 1 /* TEXT */)
]),
_: 1 /* STABLE */
}, 8 /* PROPS */, ["style", "onTap"])
]),
_: 1 /* STABLE */
}, 16 /* FULL_PROPS */, ["class"]))
}
AtSearchBar.render = _sfc_render$d;
const AtSegmentedControl = defineComponent({
name: "AtSegmentedControl",
emits: {
"click"(index) {
return !!(typeof index === "number");
}
},
props: {
current: {
type: Number,
default: 0
},
color: {
type: String,
default: "#fff"
},
selectedColor: {
type: String,
default: "#6190E8"
},
fontSize: {
type: Number,
default: 28
},
disabled: Boolean,
values: {
type: Array,
default: []
}
},
setup(props, { emit }) {
const rootClasses = computed(() => ({
"at-segmented-control": true,
"at-segmented-control--disabled": props.disabled
}));
const rootStyle = computed(() => ({
borderColor: props.selectedColor
}));
const genItemClasses = computed(() => (i) => ({
"at-segmented-control__item": true,
"at-segmented-control__item--active": props.current === i
}));
const itemStyle = computed(() => ({
color: props.selectedColor,
fontSize: pxTransform(parseInt(`${props.fontSize}`)),
borderColor: props.selectedColor,
backgroundColor: props.color
}));
const selectedItemStyle = computed(() => ({
color: props.color,
fontSize: pxTransform(parseInt(`${props.fontSize}`)),
borderColor: props.selectedColor,
backgroundColor: props.selectedColor
}));
function handleClick(index) {
if (props.disabled)
return;
emit("click", index);
}
return {
values: toRef(props, "values"),
rootStyle,
rootClasses,
genItemClasses,
itemStyle,
selectedItemStyle,
handleClick
};
}
});
// Binding optimization for webpack code-split
const _renderList$6 = renderList, _Fragment$6 = Fragment, _openBlock$c = openBlock, _createElementBlock$6 = createElementBlock, _toDisplayString$8 = toDisplayString, _createTextVNode$8 = createTextVNode, _resolveComponent$c = resolveComponent, _normalizeClass$6 = normalizeClass, _normalizeStyle$5 = normalizeStyle, _withCtx$c = withCtx, _createBlock$c = createBlock, _mergeProps$c = mergeProps;
function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_view = _resolveComponent$c("taro-view");
return (_openBlock$c(), _createBlock$c(_component_taro_view, _mergeProps$c(_ctx.$attrs, {
class: _ctx.rootClasses,
style: _ctx.rootStyle
}), {
default: _withCtx$c(() => [
(_openBlock$c(true), _createElementBlock$6(_Fragment$6, null, _renderList$6(_ctx.values, (value, i) => {
return (_openBlock$c(), _createBlock$c(_component_taro_view, {
key: i,
class: _normalizeClass$6(_ctx.genItemClasses(i)),
style: _normalizeStyle$5(_ctx.current === i ? _ctx.selectedItemStyle : _ctx.itemStyle),
onTap: $event => (_ctx.handleClick(i))
}, {
default: _withCtx$c(() => [
_createTextVNode$8(_toDisplayString$8(value), 1 /* TEXT */)
]),
_: 2 /* DYNAMIC */
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["class", "style", "onTap"]))
}), 128 /* KEYED_FRAGMENT */))
]),
_: 1 /* STABLE */
}, 16 /* FULL_PROPS */, ["class", "style"]))
}
AtSegmentedControl.render = _sfc_render$c;
const { makeDimensionsProps: makeDimensionsProps$1, useDimensions: useDimensions$1 } = dimensionsFactory();
const AtSkeleton = defineComponent({
name: "AtSkeleton",
props: {
...makeElevationProps(),
...makeDimensionsProps$1(),
tile: Boolean,
loading: Boolean,
boilerplate: Boolean,
transition: String,
type: String,
types: {
type: Object,
default: () => ({})
}
},
setup(props, { slots, attrs }) {
const { dimensions } = useDimensions$1(props);
const { elevationClasses } = useElevationClasses(props);
const isLoading = computed(() => {
return !("default" in slots) || props.loading;
});
const _attrs = computed(() => {
if (!isLoading.value)
return attrs;
return !props.boilerplate ? {
...attrs,
"aria-busy": true,
"aria-live": "polite",
role: "alert"
} : {};
});
const classes = computed(() => ({
...elevationClasses.value,
"at-skeleton--boilerplate": props.boilerplate,
"at-skeleton--is-loading": isLoading.value,
"at-skeleton--tile": props.tile,
"at-skeleton": true
}));
const rootTypes = computed(() => ({
...props.types,
actions: "button@2",
article: "heading, paragraph",
avatar: "avatar",
button: "button",
card: "image, card-heading",
"card-avatar": "image, list-item-avatar",
"card-heading": "heading",
chip: "chip",
"date-picker": "list-item, card-heading, divider, date-picker-options, date-picker-days, actions",
"date-picker-options": "text, avatar@2",
"date-picker-days": "avatar@28",
heading: "heading",
image: "image",
"list-item": "text",
"list-item-avatar": "avatar, text",
"list-item-two-line": "sentences",
"list-item-avatar-two-line": "avatar, sentences",
"list-item-three-line": "paragraph",
"list-item-avatar-three-line": "avatar, paragraph",
paragraph: "text@3",
sentences: "text@2",
table: "table-heading, table-thead, table-tbody, table-tfoot",
"table-heading": "heading, text",
"table-thead": "heading@6",
"table-tbody": "table-row-divider@6",
"table-row-divider": "table-row, divider",
"table-row": "table-cell@6",
"table-cell": "text",
"table-tfoot": "text@2, avatar@2",
text: "text"
}));
function genBone(text, children) {
const View = process.env.TARO_ENV === "h5" ? resolveComponent("taro-view") : "view";
return h(View, {
class: `at-skeleton__${text} at-skeleton__bone`
}, { default: () => children });
}
function genBones(bone) {
const [type, length] = bone.split("@");
const generator = () => genStructure(type);
return Array.from({ length }).map(generator);
}
function genStructure(type) {
let children = [];
type = type || props.type || "";
const bone = rootTypes.value[type] || "";
if (type === bone) ; else if (type.indexOf(",") > -1)
return mapBones(type);
else if (type.indexOf("@") > -1)
return genBones(type);
else if (bone.indexOf(",") > -1)
children = mapBones(bone);
else if (bone.indexOf("@") > -1)
children = genBones(bone);
else if (bone)
children.push(genStructure(bone));
return [genBone(type, children)];
}
function genSkeleton() {
const children = [];
if (!isLoading.value)
children.push(slots.default?.());
else
children.push(genStructure());
if (!props.transition)
return children;
return h(Transition, {
onAfterEnter: resetStyles,
onBeforeEnter,
onBeforeLeave,
onLeaveCancelled: resetStyles
}, { default: () => children });
}
function mapBones(bones) {
return bones.replace(/\s/g, "").split(",").map(genStructure);
}
function onBeforeEnter(el) {
resetStyles(el);
if (!isLoading.value)
return;
el._initialStyle = {
display: el.style.display,
transition: el.style.transition
};
el.style.setProperty("transition", "none", "important");
}
function onBeforeLeave(el) {
el.style.setProperty("display", "none", "important");
}
function resetStyles(el) {
if (!el._initialStyle)
return;
el.style.display = el._initialStyle.display || "";
el.style.transition = el._initialStyle.transition;
delete el._initialStyle;
}
return () => {
const View = process.env.TARO_ENV === "h5" ? resolveComponent("taro-view") : "view";
return h(View, mergeProps(_attrs.value, {
class: classes.value,
style: isLoading.value ? dimensions.value.style : void 0
}), { default: () => [genSkeleton()] });
};
}
});
const AtSlider = defineComponent({
name: "AtSlider",
emits: ["change", "changing"],
props: {
min: {
type: Number,
default: 0
},
max: {
type: Number,
default: 100
},
step: {
type: Number,
default: 1
},
value: {
type: Number,
default: 0
},
disabled: Boolean,
showValue: Boolean,
activeColor: {
type: String,
default: "#6190e8"
},
blockSize: {
type: Number,
default: 28,
validator: (val) => val >= 12 && val <= 28
},
blockColor: {
type: String,
default: "#ffffff"
},
backgroundColor: {
type: String,
default: "#e9e9e9"
}
},
setup(props, { emit }) {
const state = reactive({
_value: clampNumber(props.value, props.min, props.max)
});
const precision = computed(() => 10 ** countDecimals(props.step));
const rootClasses = computed(() => ({
"at-slider": true,
"at-slider--disabled": props.disabled
}));
function clampNumber(value, lower, upper) {
return Math.max(lower, Math.min(upper, value));
}
function countDecimals(value) {
if (Math.floor(value) === value)
return 0;
return value.toString().split(".")[1].length || 0;
}
function ensurePrecision(value) {
return Math.round((value + Number.EPSILON) * precision.value) / precision.value;
}
function handleChanging(e) {
const { _value } = state;
let { value } = e.detail;
value = ensurePrecision(value);
if (value !== _value) {
state._value = value;
}
emit("changing", value);
}
function handleChange(e) {
let { value } = e.detail;
value = ensurePrecision(value);
state._value = value;
emit("change", value);
}
watch(() => [
props.value,
props.min,
props.max
], ([value, min, max]) => {
state._value = clampNumber(value, min, max);
});
return {
...toRefs(props),
value_: toRef(state, "_value"),
rootClasses,
handleChange,
handleChanging
};
}
});
// Binding optimization for webpack code-split
const _resolveComponent$b = resolveComponent, _createVNode$8 = createVNode, _withCtx$b = withCtx, _toDisplayString$7 = toDisplayString, _createTextVNode$7 = createTextVNode, _openBlock$b = openBlock, _createBlock$b = createBlock, _createCommentVNode$6 = createCommentVNode, _mergeProps$b = mergeProps;
function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_slider = _resolveComponent$b("taro-slider");
const _component_taro_view = _resolveComponent$b("taro-view");
return (_openBlock$b(), _createBlock$b(_component_taro_view, _mergeProps$b(_ctx.$attrs, { class: _ctx.rootClasses }), {
default: _withCtx$b(() => [
_createVNode$8(_component_taro_view, { class: "at-slider__inner" }, {
default: _withCtx$b(() => [
_createVNode$8(_component_taro_slider, {
min: _ctx.min,
max: _ctx.max,
step: _ctx.step,
value: _ctx.value_,
disabled: _ctx.disabled,
blockSize: _ctx.blockSize,
blockColor: _ctx.blockColor,
activeColor: _ctx.activeColor,
backgroundColor: _ctx.backgroundColor,
onChange: _ctx.handleChange,
onChanging: _ctx.handleChanging
}, null, 8 /* PROPS */, ["min", "max", "step", "value", "disabled", "blockSize", "blockColor", "activeColor", "backgroundColor", "onChange", "onChanging"])
]),
_: 1 /* STABLE */
}),
(_ctx.showValue)
? (_openBlock$b(), _createBlock$b(_component_taro_view, {
key: 0,
class: "at-slider__text"
}, {
default: _withCtx$b(() => [
_createTextVNode$7(_toDisplayString$7(_ctx.value_), 1 /* TEXT */)
]),
_: 1 /* STABLE */
}))
: _createCommentVNode$6("v-if", true)
]),
_: 1 /* STABLE */
}, 16 /* FULL_PROPS */, ["class"]))
}
AtSlider.render = _sfc_render$b;
const AtSteps = defineComponent({
name: "AtSteps",
emits: {
"change": (current) => !!(typeof current === "number")
},
props: {
current: {
type: Number,
default: 0
},
items: {
type: Array,
default: []
}
},
setup(props, { emit }) {
const genStepItemClasses = computed(() => (i) => ({
"at-steps__item": true,
"at-steps__item--active": i === props.current,
"at-steps__item--inactive": i !== props.current
}));
const genItemStatusClasses = computed(() => (item) => ({
"at-icon": true,
"at-steps__single-icon": true,
"at-icon-check-circle": item.status === "success",
"at-icon-close-circle": item.status === "error",
"at-steps__single-icon--success": item.status === "success",
"at-steps__single-icon--error": item.status === "error"
}));
const genItemIconClasses = computed(() => (item) => ({
"at-icon": true,
"at-steps__circle-icon": true,
[`at-icon-${item.icon?.value}`]: Boolean(item.icon && item.icon.value)
}));
const genItemIconStyle = (item, i) => {
const iconInfo = props.current === i ? {
value: item.icon.value,
size: item.icon.size,
color: item.icon.activeColor
} : {
value: item.icon.value,
size: item.icon.size,
color: item.icon.inactiveColor
};
const { iconStyle } = useIconStyle(iconInfo);
return iconStyle.value;
};
function handleClick(current) {
emit("change", current);
}
return {
items: toRef(props, "items"),
genItemIconClasses,
genStepItemClasses,
genItemStatusClasses,
genItemIconStyle,
handleClick
};
}
});
// Binding optimization for webpack code-split
const _renderList$5 = renderList, _Fragment$5 = Fragment, _openBlock$a = openBlock, _createElementBlock$5 = createElementBlock, _resolveComponent$a = resolveComponent, _createBlock$a = createBlock, _createCommentVNode$5 = createCommentVNode, _normalizeClass$5 = normalizeClass, _normalizeStyle$4 = normalizeStyle, _toDisplayString$6 = toDisplayString, _createTextVNode$6 = createTextVNode, _withCtx$a = withCtx, _createVNode$7 = createVNode, _mergeProps$a = mergeProps;
function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_view = _resolveComponent$a("taro-view");
const _component_taro_text = _resolveComponent$a("taro-text");
return (_openBlock$a(), _createBlock$a(_component_taro_view, _mergeProps$a(_ctx.$attrs, { class: "at-steps" }), {
default: _withCtx$a(() => [
(!!_ctx.items)
? (_openBlock$a(true), _createElementBlock$5(_Fragment$5, { key: 0 }, _renderList$5(_ctx.items, (item, i) => {
return (_openBlock$a(), _createBlock$a(_component_taro_view, {
key: `${item.title}-${i}`,
class: _normalizeClass$5(_ctx.genStepItemClasses(i)),
onTap: $event => (_ctx.handleClick(i))
}, {
default: _withCtx$a(() => [
_createVNode$7(_component_taro_view, { class: "at-steps__circular-wrap" }, {
default: _withCtx$a(() => [
(i !== 0)
? (_openBlock$a(), _createBlock$a(_component_taro_view, {
key: 0,
class: "at-steps__left-line"
}))
: _createCommentVNode$5("v-if", true),
(item.status)
? (_openBlock$a(), _createBlock$a(_component_taro_view, {
key: 1,
class: _normalizeClass$5(_ctx.genItemStatusClasses(item))
}, null, 8 /* PROPS */, ["class"]))
: (_openBlock$a(), _createBlock$a(_component_taro_view, {
key: 2,
class: "at-steps__circular"
}, {
default: _withCtx$a(() => [
(item.icon)
? (_openBlock$a(), _createBlock$a(_component_taro_text, {
key: 0,
class: _normalizeClass$5(_ctx.genItemIconClasses(item)),
style: _normalizeStyle$4(_ctx.genItemIconStyle(item, i))
}, null, 8 /* PROPS */, ["class", "style"]))
: (_openBlock$a(), _createBlock$a(_component_taro_text, {
key: 1,
class: "at-steps__num"
}, {
default: _withCtx$a(() => [
_createTextVNode$6(_toDisplayString$6(i+1), 1 /* TEXT */)
]),
_: 2 /* DYNAMIC */
}, 1024 /* DYNAMIC_SLOTS */))
]),
_: 2 /* DYNAMIC */
}, 1024 /* DYNAMIC_SLOTS */)),
(i !== _ctx.items.length - 1)
? (_openBlock$a(), _createBlock$a(_component_taro_view, {
key: 3,
class: "at-steps__right-line"
}))
: _createCommentVNode$5("v-if", true)
]),
_: 2 /* DYNAMIC */
}, 1024 /* DYNAMIC_SLOTS */),
_createVNode$7(_component_taro_view, { class: "at-steps__title" }, {
default: _withCtx$a(() => [
_createTextVNode$6(_toDisplayString$6(item.title), 1 /* TEXT */)
]),
_: 2 /* DYNAMIC */
}, 1024 /* DYNAMIC_SLOTS */),
_createVNode$7(_component_taro_view, { class: "at-steps__desc" }, {
default: _withCtx$a(() => [
_createTextVNode$6(_toDisplayString$6(item.desc), 1 /* TEXT */)
]),
_: 2 /* DYNAMIC */
}, 1024 /* DYNAMIC_SLOTS */)
]),
_: 2 /* DYNAMIC */
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["class", "onTap"]))
}), 128 /* KEYED_FRAGMENT */))
: _createCommentVNode$5("v-if", true)
]),
_: 1 /* STABLE */
}, 16 /* FULL_PROPS */))
}
AtSteps.render = _sfc_render$a;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMax = Math.max,
nativeMin = Math.min;
/**
* The base implementation of `_.inRange` which doesn't coerce arguments.
*
* @private
* @param {number} number The number to check.
* @param {number} start The start of the range.
* @param {number} end The end of the range.
* @returns {boolean} Returns `true` if `number` is in the range, else `false`.
*/
function baseInRange(number, start, end) {
return number >= nativeMin(start, end) && number < nativeMax(start, end);
}
/** Used to match a single whitespace character. */
var reWhitespace = /\s/;
/**
* Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
* character of `string`.
*
* @private
* @param {string} string The string to inspect.
* @returns {number} Returns the index of the last non-whitespace character.
*/
function trimmedEndIndex(string) {
var index = string.length;
while (index-- && reWhitespace.test(string.charAt(index))) {}
return index;
}
/** Used to match leading whitespace. */
var reTrimStart = /^\s+/;
/**
* The base implementation of `_.trim`.
*
* @private
* @param {string} string The string to trim.
* @returns {string} Returns the trimmed string.
*/
function baseTrim(string) {
return string
? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
: string;
}
/** Used as references for various `Number` constants. */
var NAN = 0 / 0;
/** Used to detect bad signed hexadecimal string values. */
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
/** Used to detect binary string values. */
var reIsBinary = /^0b[01]+$/i;
/** Used to detect octal string values. */
var reIsOctal = /^0o[0-7]+$/i;
/** Built-in method references without a dependency on `root`. */
var freeParseInt = parseInt;
/**
* Converts `value` to a number.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to process.
* @returns {number} Returns the number.
* @example
*
* _.toNumber(3.2);
* // => 3.2
*
* _.toNumber(Number.MIN_VALUE);
* // => 5e-324
*
* _.toNumber(Infinity);
* // => Infinity
*
* _.toNumber('3.2');
* // => 3.2
*/
function toNumber(value) {
if (typeof value == 'number') {
return value;
}
if (isSymbol(value)) {
return NAN;
}
if (isObject$4(value)) {
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
value = isObject$4(other) ? (other + '') : other;
}
if (typeof value != 'string') {
return value === 0 ? value : +value;
}
value = baseTrim(value);
var isBinary = reIsBinary.test(value);
return (isBinary || reIsOctal.test(value))
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
: (reIsBadHex.test(value) ? NAN : +value);
}
/** Used as references for various `Number` constants. */
var INFINITY = 1 / 0,
MAX_INTEGER = 1.7976931348623157e+308;
/**
* Converts `value` to a finite number.
*
* @static
* @memberOf _
* @since 4.12.0
* @category Lang
* @param {*} value The value to convert.
* @returns {number} Returns the converted number.
* @example
*
* _.toFinite(3.2);
* // => 3.2
*
* _.toFinite(Number.MIN_VALUE);
* // => 5e-324
*
* _.toFinite(Infinity);
* // => 1.7976931348623157e+308
*
* _.toFinite('3.2');
* // => 3.2
*/
function toFinite(value) {
if (!value) {
return value === 0 ? value : 0;
}
value = toNumber(value);
if (value === INFINITY || value === -INFINITY) {
var sign = (value < 0 ? -1 : 1);
return sign * MAX_INTEGER;
}
return value === value ? value : 0;
}
/**
* Checks if `n` is between `start` and up to, but not including, `end`. If
* `end` is not specified, it's set to `start` with `start` then set to `0`.
* If `start` is greater than `end` the params are swapped to support
* negative ranges.
*
* @static
* @memberOf _
* @since 3.3.0
* @category Number
* @param {number} number The number to check.
* @param {number} [start=0] The start of the range.
* @param {number} end The end of the range.
* @returns {boolean} Returns `true` if `number` is in the range, else `false`.
* @see _.range, _.rangeRight
* @example
*
* _.inRange(3, 2, 4);
* // => true
*
* _.inRange(4, 8);
* // => true
*
* _.inRange(4, 2);
* // => false
*
* _.inRange(2, 2);
* // => false
*
* _.inRange(1.2, 2);
* // => true
*
* _.inRange(5.2, 4);
* // => false
*
* _.inRange(-3, -2, -6);
* // => true
*/
function inRange(number, start, end) {
start = toFinite(start);
if (end === undefined) {
end = start;
start = 0;
} else {
end = toFinite(end);
}
number = toNumber(number);
return baseInRange(number, start, end);
}
const AtSwipeActionOptions = defineComponent({
name: "AtSwipeActionOptions",
emits: {
"queryed-dom": ({ width }) => {
return !!(width && typeof width === "number");
}
},
props: {
componentId: {
type: String,
default: ""
},
options: {
type: Array,
default: []
}
},
setup(props, { emit }) {
watch(() => props.options, (options, preOptions) => {
if (options !== preOptions) {
trrigerOptionsDomUpadte();
}
});
function trrigerOptionsDomUpadte() {
delayQuerySelector(this, `#swipeActionOptions-${props.componentId}`, 100).then((res) => {
const arr = [...res];
if (Boolean(arr[0])) {
emit("queryed-dom", arr[0]);
}
});
}
onMounted(() => {
trrigerOptionsDomUpadte();
});
return {
componentId: toRef(props, "componentId")
};
}
});
// Binding optimization for webpack code-split
const _renderSlot$5 = renderSlot, _resolveComponent$9 = resolveComponent, _mergeProps$9 = mergeProps, _withCtx$9 = withCtx, _openBlock$9 = openBlock, _createBlock$9 = createBlock;
function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_view = _resolveComponent$9("taro-view");
return (_openBlock$9(), _createBlock$9(_component_taro_view, _mergeProps$9(_ctx.$attrs, {
id: `swipeActionOptions-${_ctx.componentId}`,
class: "at-swipe-action__options"
}), {
default: _withCtx$9(() => [
_renderSlot$5(_ctx.$slots, "default")
]),
_: 3 /* FORWARDED */
}, 16 /* FULL_PROPS */, ["id"]))
}
AtSwipeActionOptions.render = _sfc_render$9;
const AtSwipeAction = defineComponent({
name: "AtSwipeAction",
components: {
AtSwipeActionOptions
},
emits: {
"opened": null,
"closed": null,
"click": (item, index, event) => {
return !!(item && item.text && typeof item.text === "string" && typeof index === "number" && typeof event === "object");
}
},
props: {
isOpened: Boolean,
disabled: Boolean,
autoClose: Boolean,
options: {
type: Array,
default: () => []
}
},
setup(props, { emit }) {
const endValue = ref(0);
const startX = ref(0);
const startY = ref(0);
const maxOffsetSize = ref(0);
const isMoving = ref(false);
const isTouching = ref(false);
const domInfo = ref({});
const state = reactive({
componentId: uuid(),
offsetSize: 0,
_isOpened: !!props.isOpened
});
const transformStyle = computed(() => {
const transform = computeTransform(state.offsetSize);
return transform ? { transform } : {};
});
const actionContentClasses = computed(() => ({
"at-swipe-action__content": true,
"animation": !isTouching.value
}));
const genActionItemClasses = computed(() => (item) => ({
"at-swipe-action__option": true,
[`${item.className}`]: Boolean(item.className)
}));
watch(() => props.isOpened, (isOpened) => {
if (isOpened !== state._isOpened) {
_reset(!!isOpened);
}
});
function getDomInfo() {
return Promise.all([
delayGetClientRect({
delayTime: 0,
selectorStr: `#swipeAction-${state.componentId}`
}),
delayGetScrollOffset({ delayTime: 0 })
]).then(([rect, scrollOffset]) => {
if (rect[0]) {
rect[0].top += scrollOffset[0].scrollTop;
rect[0].bottom += scrollOffset[0].scrollTop;
domInfo.value = rect[0];
}
});
}
function _reset(isOpened) {
isMoving.value = false;
isTouching.value = false;
if (isOpened) {
endValue.value = -maxOffsetSize.value;
state._isOpened = true;
state.offsetSize = -maxOffsetSize.value;
} else {
endValue.value = 0;
state.offsetSize = 0;
state._isOpened = false;
}
}
function computeTransform(value) {
return value ? `translate3d(${value}px,0,0)` : null;
}
function handleOpened(event) {
if (state._isOpened) {
emit("opened", event);
}
}
function handleClosed(event) {
if (!state._isOpened) {
emit("closed", event);
}
}
function handleTouchstart(e) {
if (props.disabled)
return;
const { clientX, clientY } = e.touches[0];
getDomInfo();
startX.value = clientX;
startY.value = clientY;
isTouching.value = true;
}
function handleTouchmove(e) {
if (isEmpty(domInfo.value))
return;
const { top, bottom, left, right } = domInfo.value;
const { clientX, clientY, pageX, pageY } = e.touches[0];
const x = Math.abs(clientX - startX.value);
const y = Math.abs(clientY - startY.value);
const inDom = inRange(pageX, left, right) && inRange(pageY, top, bottom);
if (!isMoving.value && inDom) {
isMoving.value = y === 0 || x / y >= Number.parseFloat(Math.tan(45 * Math.PI / 180).toFixed(2));
}
if (isTouching.value && isMoving.value) {
e.preventDefault();
const offsetSize = clientX - startX.value;
const isRight = offsetSize > 0;
if (state.offsetSize === 0 && isRight)
return;
const value = endValue.value + offsetSize;
state.offsetSize = value >= 0 ? 0 : value;
}
}
function handleTouchend(event) {
if (props.disabled)
return;
isTouching.value = false;
const { offsetSize } = state;
endValue.value = offsetSize;
const breakpoint = maxOffsetSize.value / 2;
const absOffsetSize = Math.abs(offsetSize);
if (absOffsetSize > breakpoint) {
_reset(true);
handleOpened(event);
return;
}
_reset(false);
handleClosed(event);
}
function handleDomInfo({ width }) {
const { _isOpened } = state;
maxOffsetSize.value = width;
_reset(_isOpened);
}
function handleClick(item, index, event) {
emit("click", item, index, event);
if (props.autoClose) {
_reset(false);
handleClosed(event);
}
}
return {
options: toRef(props, "options"),
componentId: toRef(state, "componentId"),
transformStyle,
actionContentClasses,
genActionItemClasses,
handleClick,
handleDomInfo,
handleTouchend,
handleTouchmove,
handleTouchstart
};
}
});
// Binding optimization for webpack code-split
const _renderSlot$4 = renderSlot, _resolveComponent$8 = resolveComponent, _normalizeClass$4 = normalizeClass, _normalizeStyle$3 = normalizeStyle, _withCtx$8 = withCtx, _createVNode$6 = createVNode, _renderList$4 = renderList, _Fragment$4 = Fragment, _openBlock$8 = openBlock, _createElementBlock$4 = createElementBlock, _toDisplayString$5 = toDisplayString, _createTextVNode$5 = createTextVNode, _createBlock$8 = createBlock, _createCommentVNode$4 = createCommentVNode, _mergeProps$8 = mergeProps;
function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_view = _resolveComponent$8("taro-view");
const _component_taro_text = _resolveComponent$8("taro-text");
const _component_at_swipe_action_options = _resolveComponent$8("at-swipe-action-options");
return (_openBlock$8(), _createBlock$8(_component_taro_view, _mergeProps$8(_ctx.$attrs, {
id: `swipeAction-${_ctx.componentId}`,
class: "at-swipe-action",
onTouchend: _ctx.handleTouchend,
onTouchmove: _ctx.handleTouchmove,
onTouchstart: _ctx.handleTouchstart
}), {
default: _withCtx$8(() => [
_createVNode$6(_component_taro_view, {
class: _normalizeClass$4(_ctx.actionContentClasses),
style: _normalizeStyle$3(_ctx.transformStyle)
}, {
default: _withCtx$8(() => [
_renderSlot$4(_ctx.$slots, "default")
]),
_: 3 /* FORWARDED */
}, 8 /* PROPS */, ["class", "style"]),
(Array.isArray(_ctx.options) && _ctx.options.length > 0)
? (_openBlock$8(), _createBlock$8(_component_at_swipe_action_options, {
key: 0,
options: _ctx.options,
componentId: _ctx.componentId,
onQueryedDom: _ctx.handleDomInfo
}, {
default: _withCtx$8(() => [
(_openBlock$8(true), _createElementBlock$4(_Fragment$4, null, _renderList$4(_ctx.options, (item, key) => {
return (_openBlock$8(), _createBlock$8(_component_taro_view, {
key: `${item.text}-${key}`,
class: _normalizeClass$4(_ctx.genActionItemClasses(item)),
style: _normalizeStyle$3(item.style),
onTap: $event => (_ctx.handleClick(item, key, $event))
}, {
default: _withCtx$8(() => [
_createVNode$6(_component_taro_text, { class: "option__text" }, {
default: _withCtx$8(() => [
_createTextVNode$5(_toDisplayString$5(item.text), 1 /* TEXT */)
]),
_: 2 /* DYNAMIC */
}, 1024 /* DYNAMIC_SLOTS */)
]),
_: 2 /* DYNAMIC */
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["class", "style", "onTap"]))
}), 128 /* KEYED_FRAGMENT */))
]),
_: 1 /* STABLE */
}, 8 /* PROPS */, ["options", "componentId", "onQueryedDom"]))
: _createCommentVNode$4("v-if", true)
]),
_: 3 /* FORWARDED */
}, 16 /* FULL_PROPS */, ["id", "onTouchend", "onTouchmove", "onTouchstart"]))
}
AtSwipeAction.render = _sfc_render$8;
const AtSwitch = defineComponent({
name: "AtSwitch",
emits: {
"update:checked": (value) => !!(typeof value === "boolean")
},
props: {
title: {
type: String,
default: ""
},
color: {
type: String,
default: "#6190e8"
},
border: Boolean,
checked: Boolean,
disabled: Boolean
},
setup(props, { emit }) {
const modelChecked = useModelValue(props, emit, "checked");
const rootClasses = computed(() => ({
"at-switch": true,
"at-switch--without-border": !props.border
}));
const containerClasses = computed(() => ({
"at-switch__container": true,
"at-switch--disabled": props.disabled
}));
function handleChange(event) {
const { value, checked } = event.detail;
const state = typeof value === "undefined" ? checked : value;
modelChecked.value = state;
}
return {
...toRefs(props),
modelChecked,
rootClasses,
containerClasses,
handleChange
};
}
});
// Binding optimization for webpack code-split
const _toDisplayString$4 = toDisplayString, _createTextVNode$4 = createTextVNode, _resolveComponent$7 = resolveComponent, _withCtx$7 = withCtx, _createVNode$5 = createVNode, _normalizeClass$3 = normalizeClass, _mergeProps$7 = mergeProps, _openBlock$7 = openBlock, _createBlock$7 = createBlock;
function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_view = _resolveComponent$7("taro-view");
const _component_taro_switch = _resolveComponent$7("taro-switch");
return (_openBlock$7(), _createBlock$7(_component_taro_view, _mergeProps$7(_ctx.$attrs, { class: _ctx.rootClasses }), {
default: _withCtx$7(() => [
_createVNode$5(_component_taro_view, { class: "at-switch__title" }, {
default: _withCtx$7(() => [
_createTextVNode$4(_toDisplayString$4(_ctx.title), 1 /* TEXT */)
]),
_: 1 /* STABLE */
}),
_createVNode$5(_component_taro_view, {
class: _normalizeClass$3(_ctx.containerClasses)
}, {
default: _withCtx$7(() => [
_createVNode$5(_component_taro_view, { class: "at-switch__mask" }),
_createVNode$5(_component_taro_switch, {
class: "at-switch__switch",
color: _ctx.color,
checked: _ctx.modelChecked,
onChange: _ctx.handleChange
}, null, 8 /* PROPS */, ["color", "checked", "onChange"])
]),
_: 1 /* STABLE */
}, 8 /* PROPS */, ["class"])
]),
_: 1 /* STABLE */
}, 16 /* FULL_PROPS */, ["class"]))
}
AtSwitch.render = _sfc_render$7;
const AtTabBar = defineComponent({
name: "AtTabBar",
components: {
AtBadge
},
emits: {
"click": (index) => !!(typeof index === "number")
},
props: {
fixed: Boolean,
current: {
type: Number,
default: 0
},
iconSize: {
type: [Number, String],
default: 24,
validator: (prop) => {
return typeof parseInt(`${prop}`) === "number";
}
},
fontSize: {
type: [Number, String],
default: 14,
validator: (prop) => {
return typeof parseInt(`${prop}`) === "number";
}
},
color: {
type: String,
default: "#333"
},
selectedColor: {
type: String,
default: "#6190E8"
},
backgroundColor: {
type: String,
default: "#fff"
},
tabList: {
type: Array,
default: []
}
},
setup(props, { emit }) {
const rootStyle = computed(() => ({
backgroundColor: props.backgroundColor
}));
const titleStyle = computed(() => ({
fontSize: props.fontSize ? convertToUnit(props.fontSize) : ""
}));
const imgStyle = computed(() => ({
width: convertToUnit(props.iconSize),
height: convertToUnit(props.iconSize)
}));
const rootClasses = computed(() => ({
"at-tab-bar": true,
"at-tab-bar--fixed": props.fixed
}));
const genItemClasses = (i) => ({
"at-tab-bar__item": true,
"at-tab-bar__item--active": props.current === i
});
const genImgClasses = (selected) => ({
"at-tab-bar__inner-img": true,
"at-tab-bar__inner-img--inactive": !selected
});
const genImgSrc = (item, i) => {
return props.current === i ? item.selectedImage || item.image : item.image;
};
const genItemStyle = (i) => {
return props.current === i ? { color: props.selectedColor } : { color: props.color };
};
function genIconInfo(item, i) {
const iconInfo = {
prefixClass: item.iconPrefixClass,
value: item.iconType,
color: props.color,
size: props.iconSize
};
if (props.current === i) {
iconInfo.value = item.selectedIconType || item.iconType;
iconInfo.color = props.selectedColor;
}
return iconInfo;
}
const genIconClasses = (item, i) => {
const iconInfo = genIconInfo(item, i);
const { iconClasses } = useIconClasses(iconInfo, true);
return iconClasses.value;
};
const genIconStyle = (item, i) => {
const iconInfo = genIconInfo(item, i);
const { iconStyle } = useIconStyle(iconInfo);
return iconStyle.value;
};
function handleClick(index) {
emit("click", index);
}
return {
tabList: toRef(props, "tabList"),
current: toRef(props, "current"),
imgStyle,
rootStyle,
titleStyle,
genItemStyle,
rootClasses,
genItemClasses,
genIconStyle,
genIconClasses,
genImgClasses,
genImgSrc,
handleClick
};
}
});
// Binding optimization for webpack code-split
const _renderList$3 = renderList, _Fragment$3 = Fragment, _openBlock$6 = openBlock, _createElementBlock$3 = createElementBlock, _resolveComponent$6 = resolveComponent, _normalizeClass$2 = normalizeClass, _normalizeStyle$2 = normalizeStyle, _createVNode$4 = createVNode, _withCtx$6 = withCtx, _createBlock$6 = createBlock, _createCommentVNode$3 = createCommentVNode, _toDisplayString$3 = toDisplayString, _createTextVNode$3 = createTextVNode, _mergeProps$6 = mergeProps;
function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_text = _resolveComponent$6("taro-text");
const _component_taro_view = _resolveComponent$6("taro-view");
const _component_at_badge = _resolveComponent$6("at-badge");
const _component_taro_image = _resolveComponent$6("taro-image");
return (_openBlock$6(), _createBlock$6(_component_taro_view, _mergeProps$6(_ctx.$attrs, {
class: _ctx.rootClasses,
style: _ctx.rootStyle
}), {
default: _withCtx$6(() => [
(_openBlock$6(true), _createElementBlock$3(_Fragment$3, null, _renderList$3(_ctx.tabList, (item, i) => {
return (_openBlock$6(), _createBlock$6(_component_taro_view, {
key: `${item.title}-${i}`,
class: _normalizeClass$2(_ctx.genItemClasses(i)),
style: _normalizeStyle$2(_ctx.genItemStyle(i)),
onTap: $event => (_ctx.handleClick(i))
}, {
default: _withCtx$6(() => [
(item.iconType)
? (_openBlock$6(), _createBlock$6(_component_at_badge, {
key: 0,
dot: !!item.dot,
value: item.text,
maxValue: Number(item.max)
}, {
default: _withCtx$6(() => [
_createVNode$4(_component_taro_view, { class: "at-tab-bar__icon" }, {
default: _withCtx$6(() => [
_createVNode$4(_component_taro_text, {
class: _normalizeClass$2(_ctx.genIconClasses(item, i)),
style: _normalizeStyle$2(_ctx.genIconStyle(item, i))
}, null, 8 /* PROPS */, ["class", "style"])
]),
_: 2 /* DYNAMIC */
}, 1024 /* DYNAMIC_SLOTS */)
]),
_: 2 /* DYNAMIC */
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["dot", "value", "maxValue"]))
: (item.image)
? (_openBlock$6(), _createBlock$6(_component_at_badge, {
key: 1,
dot: !!item.dot,
value: item.text,
maxValue: Number(item.max)
}, {
default: _withCtx$6(() => [
_createVNode$4(_component_taro_view, { class: "at-tab-bar__icon" }, {
default: _withCtx$6(() => [
_createVNode$4(_component_taro_image, {
mode: "widthFix",
src: _ctx.genImgSrc(item, i),
class: _normalizeClass$2(_ctx.genImgClasses(_ctx.current === i)),
style: _normalizeStyle$2(_ctx.imgStyle)
}, null, 8 /* PROPS */, ["src", "class", "style"]),
_createVNode$4(_component_taro_image, {
mode: "widthFix",
src: _ctx.genImgSrc(item, i),
class: _normalizeClass$2(_ctx.genImgClasses(_ctx.current !== i)),
style: _normalizeStyle$2(_ctx.imgStyle)
}, null, 8 /* PROPS */, ["src", "class", "style"])
]),
_: 2 /* DYNAMIC */
}, 1024 /* DYNAMIC_SLOTS */)
]),
_: 2 /* DYNAMIC */
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["dot", "value", "maxValue"]))
: _createCommentVNode$3("v-if", true),
_createVNode$4(_component_taro_view, null, {
default: _withCtx$6(() => [
_createVNode$4(_component_at_badge, {
dot: Boolean(item.iconType || item.image) ? false : !!item.dot,
value: Boolean(item.iconType || item.image) ? '' : item.text,
maxValue: Boolean(item.iconType || item.image) ? 0 : Number(item.max)
}, {
default: _withCtx$6(() => [
_createVNode$4(_component_taro_view, {
class: "at-tab-bar__title",
style: _normalizeStyle$2(_ctx.titleStyle)
}, {
default: _withCtx$6(() => [
_createTextVNode$3(_toDisplayString$3(item.title), 1 /* TEXT */)
]),
_: 2 /* DYNAMIC */
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["style"])
]),
_: 2 /* DYNAMIC */
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["dot", "value", "maxValue"])
]),
_: 2 /* DYNAMIC */
}, 1024 /* DYNAMIC_SLOTS */)
]),
_: 2 /* DYNAMIC */
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["class", "style", "onTap"]))
}), 128 /* KEYED_FRAGMENT */))
]),
_: 1 /* STABLE */
}, 16 /* FULL_PROPS */, ["class", "style"]))
}
AtTabBar.render = _sfc_render$6;
const ENV = Taro.getEnv();
const MIN_DISTANCE = 100;
const MAX_INTERVAL = 10;
const AtTabs = defineComponent({
name: "AtTabs",
emits: {
"click": (index, event) => {
return !!(typeof index === "number" && typeof event === "object");
}
},
props: {
tabDirection: {
type: String,
default: "horizontal"
},
height: String,
current: {
type: Number,
default: 0
},
scroll: Boolean,
animated: {
type: Boolean,
default: true
},
swipeable: {
type: Boolean,
default: true
},
tabList: {
type: Array,
default: []
}
},
setup(props, { emit }) {
const tabId = ref(uuid());
const _touchDot = ref(0);
const _timer = ref(null);
const _interval = ref(0);
const _isMoving = ref(false);
const tabHeaderRef = ref(null);
const state = reactive({
scrollLeft: 0,
scrollTop: 0,
scrollIntoView: ""
});
const scrollX = computed(() => props.tabDirection === "horizontal");
const scrollY = computed(() => props.tabDirection === "vertical");
const rootClasses = computed(() => ({
[`at-tabs--${props.tabDirection}`]: true,
"at-tabs--scroll": props.scroll,
[`at-tabs--${ENV}`]: true,
"at-tabs": true
}));
const heightStyle = computed(() => scrollY.value ? { height: props.height } : {});
const underlineStyle = computed(() => ({
height: scrollY.value ? `${props.tabList.length * 100}%` : "1PX",
width: scrollX.value ? `${props.tabList.length * 100}%` : "1PX"
}));
const bodyStyle = computed(() => {
const transformStyle = scrollX.value ? `translate3d(-${props.current * 100}%, 0px, 0px)` : `translate3d(0px, -${props.current * 100}%, 0px)`;
const bodyStyle2 = {
...heightStyle.value,
transform: transformStyle,
WebkitTransform: transformStyle
};
if (!props.animated) {
bodyStyle2.transition = "unset";
}
return bodyStyle2;
});
const genTabItemClasses = computed(() => (idx) => ({
"at-tabs__item": true,
"at-tabs__item--active": props.current === idx
}));
function updateState(idx) {
if (props.scroll) {
if (ENV !== Taro.ENV_TYPE.WEB) {
const index = Math.max(idx - 1, 0);
state.scrollIntoView = `tab${tabId.value}${index}`;
} else {
const index = Math.max(idx - 1, 0);
const prevTabItem = tabHeaderRef.value.$el.children[index];
if (prevTabItem) {
state.scrollTop = prevTabItem.offsetTop;
state.scrollLeft = prevTabItem.offsetLeft;
}
}
}
}
function handleClick(index, event) {
emit("click", index, event);
}
function handleTouchstart(e) {
if (!props.swipeable || scrollY.value)
return;
_touchDot.value = e.touches[0].pageX;
_timer.value = setInterval(() => {
_interval.value++;
}, 100);
}
function handleTouchmove(e) {
if (!props.swipeable || scrollY.value)
return;
const touchMove = e.touches[0].pageX;
const moveDistance = touchMove - _touchDot.value;
const maxIndex = props.tabList.length;
if (!_isMoving.value && _interval.value < MAX_INTERVAL && _touchDot.value > 20) {
if (props.current + 1 < maxIndex && moveDistance <= -MIN_DISTANCE) {
_isMoving.value = true;
handleClick(props.current + 1, e);
} else if (props.current - 1 >= 0 && moveDistance >= MIN_DISTANCE) {
_isMoving.value = true;
handleClick(props.current - 1, e);
}
}
}
function handleTouchend() {
if (!props.swipeable || scrollY.value)
return;
clearInterval(_timer.value);
_interval.value = 0;
_isMoving.value = false;
}
watch(() => props.current, (current) => {
updateState(current);
});
onMounted(() => {
updateState(props.current);
});
return {
...toRefs(props),
...toRefs(state),
tabId,
scrollX,
scrollY,
bodyStyle,
heightStyle,
underlineStyle,
tabHeaderRef,
rootClasses,
genTabItemClasses,
handleClick,
handleTouchend,
handleTouchmove,
handleTouchstart
};
}
});
// Binding optimization for webpack code-split
const _renderList$2 = renderList, _Fragment$2 = Fragment, _openBlock$5 = openBlock, _createElementBlock$2 = createElementBlock, _toDisplayString$2 = toDisplayString, _createTextVNode$2 = createTextVNode, _resolveComponent$5 = resolveComponent, _withCtx$5 = withCtx, _createVNode$3 = createVNode, _normalizeClass$1 = normalizeClass, _createBlock$5 = createBlock, _normalizeStyle$1 = normalizeStyle, _renderSlot$3 = renderSlot, _mergeProps$5 = mergeProps;
function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_text = _resolveComponent$5("taro-text");
const _component_taro_view = _resolveComponent$5("taro-view");
const _component_taro_scroll_view = _resolveComponent$5("taro-scroll-view");
return (_openBlock$5(), _createBlock$5(_component_taro_view, _mergeProps$5(_ctx.$attrs, {
class: _ctx.rootClasses,
style: _ctx.heightStyle
}), {
default: _withCtx$5(() => [
(_ctx.scroll)
? (_openBlock$5(), _createBlock$5(_component_taro_scroll_view, {
key: 0,
class: "at-tabs__header",
scrollWithAnimation: true,
id: _ctx.tabId,
ref: (el) => _ctx.tabHeaderRef = el,
style: _normalizeStyle$1(_ctx.heightStyle),
scrollX: _ctx.scrollX,
scrollY: _ctx.scrollY,
scrollTop: _ctx.scrollTop,
scrollLeft: _ctx.scrollLeft,
scrollIntoView: _ctx.scrollIntoView
}, {
default: _withCtx$5(() => [
(_openBlock$5(true), _createElementBlock$2(_Fragment$2, null, _renderList$2(_ctx.tabList, (item, idx) => {
return (_openBlock$5(), _createBlock$5(_component_taro_view, {
key: `${item.title}-${idx}`,
id: `tab${_ctx.tabId}${idx}`,
class: _normalizeClass$1(_ctx.genTabItemClasses(idx)),
onTap: $event => (_ctx.handleClick(idx, $event))
}, {
default: _withCtx$5(() => [
_createVNode$3(_component_taro_text, { style: {"white-space":"nowrap"} }, {
default: _withCtx$5(() => [
_createTextVNode$2(_toDisplayString$2(item.title), 1 /* TEXT */)
]),
_: 2 /* DYNAMIC */
}, 1024 /* DYNAMIC_SLOTS */),
_createVNode$3(_component_taro_view, { class: "at-tabs__item-underline" })
]),
_: 2 /* DYNAMIC */
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["id", "class", "onTap"]))
}), 128 /* KEYED_FRAGMENT */))
]),
_: 1 /* STABLE */
}, 8 /* PROPS */, ["id", "style", "scrollX", "scrollY", "scrollTop", "scrollLeft", "scrollIntoView"]))
: (_openBlock$5(), _createBlock$5(_component_taro_view, {
key: 1,
id: _ctx.tabId,
class: "at-tabs__header"
}, {
default: _withCtx$5(() => [
(_openBlock$5(true), _createElementBlock$2(_Fragment$2, null, _renderList$2(_ctx.tabList, (item, idx) => {
return (_openBlock$5(), _createBlock$5(_component_taro_view, {
key: `${item.title}-${idx}`,
id: `tab${_ctx.tabId}${idx}`,
class: _normalizeClass$1(_ctx.genTabItemClasses(idx)),
onTap: $event => (_ctx.handleClick(idx, $event))
}, {
default: _withCtx$5(() => [
_createVNode$3(_component_taro_text, { style: {"white-space":"nowrap"} }, {
default: _withCtx$5(() => [
_createTextVNode$2(_toDisplayString$2(item.title), 1 /* TEXT */)
]),
_: 2 /* DYNAMIC */
}, 1024 /* DYNAMIC_SLOTS */),
_createVNode$3(_component_taro_view, { class: "at-tabs__item-underline" })
]),
_: 2 /* DYNAMIC */
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["id", "class", "onTap"]))
}), 128 /* KEYED_FRAGMENT */))
]),
_: 1 /* STABLE */
}, 8 /* PROPS */, ["id"])),
_createVNode$3(_component_taro_view, {
class: "at-tabs__body",
style: _normalizeStyle$1(_ctx.bodyStyle),
onTouchend: _ctx.handleTouchend,
onTouchmove: _ctx.handleTouchmove,
onTouchstart: _ctx.handleTouchstart
}, {
default: _withCtx$5(() => [
_createVNode$3(_component_taro_view, {
class: "at-tabs__underline",
style: _normalizeStyle$1(_ctx.underlineStyle)
}, null, 8 /* PROPS */, ["style"]),
_renderSlot$3(_ctx.$slots, "default")
]),
_: 3 /* FORWARDED */
}, 8 /* PROPS */, ["style", "onTouchend", "onTouchmove", "onTouchstart"])
]),
_: 3 /* FORWARDED */
}, 16 /* FULL_PROPS */, ["class", "style"]))
}
AtTabs.render = _sfc_render$5;
const AtTabsPane = defineComponent({
name: "AtTabsPane",
props: {
tabDirection: {
type: String,
default: "horizontal"
},
index: {
type: Number,
default: 0
},
current: {
type: Number,
default: 0
}
},
setup(props) {
const rootClasses = computed(() => ({
"at-tabs-pane--active": props.index === props.current,
"at-tabs-pane--inactive": props.index !== props.current,
"at-tabs-pane--vertical": props.tabDirection === "vertical",
"at-tabs-pane": true
}));
return {
rootClasses
};
}
});
// Binding optimization for webpack code-split
const _renderSlot$2 = renderSlot, _resolveComponent$4 = resolveComponent, _mergeProps$4 = mergeProps, _withCtx$4 = withCtx, _openBlock$4 = openBlock, _createBlock$4 = createBlock;
function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_view = _resolveComponent$4("taro-view");
return (_openBlock$4(), _createBlock$4(_component_taro_view, _mergeProps$4(_ctx.$attrs, { class: _ctx.rootClasses }), {
default: _withCtx$4(() => [
_renderSlot$2(_ctx.$slots, "default")
]),
_: 3 /* FORWARDED */
}, 16 /* FULL_PROPS */, ["class"]))
}
AtTabsPane.render = _sfc_render$4;
const SIZE_CLASS = {
normal: "normal",
small: "small"
};
const TYPE_CLASS = {
primary: "primary"
};
const AtTag = defineComponent({
name: "AtTag",
emits: {
"click": (tagInfo, e) => {
return !!(tagInfo && typeof tagInfo.name === "string" && typeof tagInfo.active === "boolean");
}
},
props: {
size: {
type: String,
default: "normal",
validator: (val) => ["normal", "small"].includes(val)
},
type: {
type: String,
default: "",
validator: (val) => ["", "primary"].includes(val)
},
name: {
type: String,
default: ""
},
circle: Boolean,
active: Boolean,
disabled: Boolean
},
setup(props, { emit }) {
const rootClasses = computed(() => ({
[`at-tag--${SIZE_CLASS[props.size]}`]: SIZE_CLASS[props.size],
[`at-tag--${props.type}`]: TYPE_CLASS[props.type],
"at-tag--disabled": props.disabled,
"at-tag--circle": props.circle,
"at-tag--active": props.active,
"at-tag": true
}));
function handleClick(event) {
if (!props.disabled) {
emit("click", {
name: props.name,
active: Boolean(props.active)
}, event);
}
}
return {
rootClasses,
handleClick
};
}
});
// Binding optimization for webpack code-split
const _renderSlot$1 = renderSlot, _resolveComponent$3 = resolveComponent, _mergeProps$3 = mergeProps, _withCtx$3 = withCtx, _openBlock$3 = openBlock, _createBlock$3 = createBlock;
function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_view = _resolveComponent$3("taro-view");
return (_openBlock$3(), _createBlock$3(_component_taro_view, _mergeProps$3(_ctx.$attrs, {
class: _ctx.rootClasses,
onTap: _ctx.handleClick
}), {
default: _withCtx$3(() => [
_renderSlot$1(_ctx.$slots, "default")
]),
_: 3 /* FORWARDED */
}, 16 /* FULL_PROPS */, ["class", "onTap"]))
}
AtTag.render = _sfc_render$3;
const AtTextarea = defineComponent({
name: "AtTextarea",
emits: [
"blur",
"focus",
"confirm",
"linechange",
"update:modelValue"
],
props: {
modelValue: {
type: String,
default: ""
},
maxLength: {
type: [String, Number],
default: 200
},
focus: Boolean,
fixed: Boolean,
disabled: Boolean,
autoFocus: Boolean,
showConfirmBar: Boolean,
count: { type: Boolean, default: true },
textOverflowForbidden: { type: Boolean, default: true },
placeholder: { type: String, default: "" },
placeholderClass: { type: String, default: "" },
placeholderStyle: { type: String, default: "" },
selectionStart: { type: Number, default: -1 },
selectionEnd: { type: Number, default: -1 },
height: { type: [String, Number], default: 100 },
cursorSpacing: { type: Number, default: 100 }
},
setup(props, { emit }) {
const ENV = Taro.getEnv();
const isAlipay = ENV === Taro.ENV_TYPE.ALIPAY;
const inputValue = useModelValue(props, emit);
const maxlength = computed(() => parseInt(props.maxLength.toString()));
const actualMaxLength = computed(() => getMaxLength(maxlength.value, Boolean(props.textOverflowForbidden)));
const textareaStyle = computed(() => props.height ? { height: `${pxTransform(Number(props.height))}` } : {});
const rootClasses = computed(() => ({
"at-textarea": true,
[`at-textarea--${ENV}`]: true,
"at-textarea--error": maxlength.value < inputValue.value.length
}));
const placeholderClasses = computed(() => props.placeholderClass ? `placeholder ${props.placeholderClass}` : "placeholder");
const showCount = computed(() => isAlipay ? { showCount: props.count } : {});
function getMaxLength(maxLength, textOverflowForbidden) {
if (!textOverflowForbidden) {
return maxLength + 500;
}
return maxLength;
}
function handleInput(event) {
inputValue.value = event.detail.value;
}
function handleFocus(event) {
emit("focus", event);
}
function handleBlur(event) {
emit("blur", event);
}
function handleConfirm(event) {
emit("confirm", event);
}
function handleLinechange(event) {
emit("linechange", event);
}
return {
...toRefs(props),
isAlipay,
inputValue,
showCount,
maxlength,
actualMaxLength,
rootClasses,
textareaStyle,
placeholderClasses,
handleBlur,
handleInput,
handleFocus,
handleConfirm,
handleLinechange
};
}
});
// Binding optimization for webpack code-split
const _resolveComponent$2 = resolveComponent, _mergeProps$2 = mergeProps, _createVNode$2 = createVNode, _toDisplayString$1 = toDisplayString, _createTextVNode$1 = createTextVNode, _withCtx$2 = withCtx, _openBlock$2 = openBlock, _createBlock$2 = createBlock, _createCommentVNode$2 = createCommentVNode;
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_textarea = _resolveComponent$2("taro-textarea");
const _component_taro_view = _resolveComponent$2("taro-view");
return (_openBlock$2(), _createBlock$2(_component_taro_view, _mergeProps$2(_ctx.$attrs, { class: _ctx.rootClasses }), {
default: _withCtx$2(() => [
_createVNode$2(_component_taro_textarea, _mergeProps$2({ class: "at-textarea__textarea" }, _ctx.showCount, {
style: _ctx.textareaStyle,
value: _ctx.inputValue,
fixed: _ctx.fixed,
focus: _ctx.focus,
disabled: _ctx.disabled,
autoFocus: _ctx.autoFocus,
showConfirmBar: _ctx.showConfirmBar,
maxlength: _ctx.actualMaxLength,
cursorSpacing: _ctx.cursorSpacing,
selectionEnd: _ctx.selectionEnd,
selectionStart: _ctx.selectionStart,
placeholder: _ctx.placeholder,
placeholderStyle: _ctx.placeholderStyle,
placeholderClass: _ctx.placeholderClasses,
onBlur: _ctx.handleBlur,
onFocus: _ctx.handleFocus,
onInput: _ctx.handleInput,
onConfirm: _ctx.handleConfirm,
onLinechange: _ctx.handleLinechange
}), null, 16 /* FULL_PROPS */, ["style", "value", "fixed", "focus", "disabled", "autoFocus", "showConfirmBar", "maxlength", "cursorSpacing", "selectionEnd", "selectionStart", "placeholder", "placeholderStyle", "placeholderClass", "onBlur", "onFocus", "onInput", "onConfirm", "onLinechange"]),
(_ctx.count && !_ctx.isAlipay)
? (_openBlock$2(), _createBlock$2(_component_taro_view, {
key: 0,
class: "at-textarea__counter"
}, {
default: _withCtx$2(() => [
_createTextVNode$1(_toDisplayString$1(`${_ctx.inputValue.length} / ${_ctx.maxlength}`), 1 /* TEXT */)
]),
_: 1 /* STABLE */
}))
: _createCommentVNode$2("v-if", true)
]),
_: 1 /* STABLE */
}, 16 /* FULL_PROPS */, ["class"]))
}
AtTextarea.render = _sfc_render$2;
const AtTimeline = defineComponent({
name: "AtTimeline",
props: {
pending: Boolean,
items: {
type: Array,
default: []
}
},
setup(props) {
const rootClasses = computed(() => ({
"at-timeline": true,
"at-timeline--pending": props.pending
}));
const genIconClasses = (item) => ({
"at-icon": true,
[`at-icon-${item.icon}`]: Boolean(item.icon)
});
const genItemRootClasses = (item) => ({
"at-timeline-item": true,
[`${`at-timeline-item--${item.color}`}`]: Boolean(item.color)
});
const genDotClasses = (item) => ({
"at-timeline-item__icon": Boolean(item.icon),
"at-timeline-item__dot": !Boolean(item.icon)
});
return {
items: toRef(props, "items"),
rootClasses,
genDotClasses,
genIconClasses,
genItemRootClasses
};
}
});
// Binding optimization for webpack code-split
const _renderList$1 = renderList, _Fragment$1 = Fragment, _openBlock$1 = openBlock, _createElementBlock$1 = createElementBlock, _resolveComponent$1 = resolveComponent, _createVNode$1 = createVNode, _normalizeClass = normalizeClass, _createBlock$1 = createBlock, _createCommentVNode$1 = createCommentVNode, _withCtx$1 = withCtx, _toDisplayString = toDisplayString, _createTextVNode = createTextVNode, _mergeProps$1 = mergeProps;
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_view = _resolveComponent$1("taro-view");
const _component_taro_text = _resolveComponent$1("taro-text");
return (_openBlock$1(), _createBlock$1(_component_taro_view, _mergeProps$1(_ctx.$attrs, { class: _ctx.rootClasses }), {
default: _withCtx$1(() => [
(_openBlock$1(true), _createElementBlock$1(_Fragment$1, null, _renderList$1(_ctx.items, (item, index) => {
return (_openBlock$1(), _createBlock$1(_component_taro_view, {
key: `at-timeline-item-${index}`,
class: _normalizeClass(_ctx.genItemRootClasses(item))
}, {
default: _withCtx$1(() => [
_createVNode$1(_component_taro_view, { class: "at-timeline-item__tail" }),
_createVNode$1(_component_taro_view, {
class: _normalizeClass(_ctx.genDotClasses(item))
}, {
default: _withCtx$1(() => [
(item.icon)
? (_openBlock$1(), _createBlock$1(_component_taro_text, {
key: 0,
class: _normalizeClass(_ctx.genIconClasses(item))
}, null, 8 /* PROPS */, ["class"]))
: _createCommentVNode$1("v-if", true)
]),
_: 2 /* DYNAMIC */
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["class"]),
_createVNode$1(_component_taro_view, { class: "at-timeline-item__content" }, {
default: _withCtx$1(() => [
_createVNode$1(_component_taro_view, { class: "at-timeline-item__content-item" }, {
default: _withCtx$1(() => [
_createTextVNode(_toDisplayString(item.title), 1 /* TEXT */)
]),
_: 2 /* DYNAMIC */
}, 1024 /* DYNAMIC_SLOTS */),
(item.content && item.content.length > 0)
? (_openBlock$1(true), _createElementBlock$1(_Fragment$1, { key: 0 }, _renderList$1(item.content, (content, subIndex) => {
return (_openBlock$1(), _createBlock$1(_component_taro_view, {
key: subIndex,
class: "at-timeline-item__content-item at-timeline-item__content--sub"
}, {
default: _withCtx$1(() => [
_createTextVNode(_toDisplayString(content), 1 /* TEXT */)
]),
_: 2 /* DYNAMIC */
}, 1024 /* DYNAMIC_SLOTS */))
}), 128 /* KEYED_FRAGMENT */))
: _createCommentVNode$1("v-if", true)
]),
_: 2 /* DYNAMIC */
}, 1024 /* DYNAMIC_SLOTS */)
]),
_: 2 /* DYNAMIC */
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["class"]))
}), 128 /* KEYED_FRAGMENT */))
]),
_: 1 /* STABLE */
}, 16 /* FULL_PROPS */, ["class"]))
}
AtTimeline.render = _sfc_render$1;
const { useDimensions, makeDimensionsProps } = dimensionsFactory();
const AtVirtualScroll = defineComponent({
name: "AtVirtualScroll",
emits: ["reach-top", "reach-bottom"],
props: {
...makeDimensionsProps(),
bench: {
type: [Number, String],
default: 0
},
itemHeight: {
type: [Number, String],
required: true
},
items: {
type: Array,
default: () => []
},
scrollToItem: [Number, String],
reachTopThreshold: {
type: [Number, String],
default: 50
},
reachBottomThreshold: {
type: [Number, String],
default: 50
}
},
setup(props) {
const first = ref(0);
const last = ref(0);
const scrollTop = ref(0);
const elRef = ref(null);
const anchor = computed(() => process.env.TARO_ENV === "h5" ? { scrollTop: scrollTop.value } : { scrollIntoView: `item-${props.scrollToItem || 0}` });
const __bench = computed(() => {
return parseInt(`${props.bench}`, 10);
});
const item_height = computed(() => {
return parseInt(`${props.itemHeight}`, 10);
});
const firstToRender = computed(() => {
return Math.max(0, first.value - __bench.value);
});
const lastToRender = computed(() => {
return Math.min(props.items.length, last.value + __bench.value);
});
const scrollContainerStyle = computed(() => ({
height: convertToUnit(props.items.length * item_height.value)
}));
const genScrollItemStyle = computed(() => (i) => ({
top: convertToUnit((i + firstToRender.value) * item_height.value)
}));
const { dimensions } = useDimensions(props);
watch(() => props.height, updateFirstAndLast);
watch(() => props.itemHeight, updateFirstAndLast);
watch(() => props.scrollToItem, (index, _prevIndex) => {
let parsedIndex = parseInt(`${index || 0}`, 10);
parsedIndex = Math.min(props.items.length - 1, Math.max(0, parsedIndex));
scrollTop.value = parsedIndex * item_height.value;
updateFirstAndLast();
});
onMounted(() => {
if (typeof props.scrollToItem !== "undefined") {
let parsedIndex = parseInt(`${props.scrollToItem}`, 10);
scrollTop.value = parsedIndex * item_height.value;
updateFirstAndLast();
} else {
last.value = getLast(0);
}
});
function getFirst() {
return Math.floor(scrollTop.value / item_height.value);
}
function getLast(first2) {
const height = parseInt(`${props.height}`, 10) || elRef.value.$el.clientHeight;
return first2 + Math.ceil(height / item_height.value);
}
function updateFirstAndLast() {
first.value = getFirst();
last.value = getLast(first.value);
}
function handleScroll(e) {
scrollTop.value = process.env.TARO_ENV === "h5" ? elRef.value.$el.scrollTop : e.detail.scrollTop;
updateFirstAndLast();
}
return {
...toRefs(props),
anchor,
elRef,
scrollTop,
dimensions,
item_height,
lastToRender,
firstToRender,
genScrollItemStyle,
scrollContainerStyle,
handleScroll
};
}
});
// Binding optimization for webpack code-split
const _renderSlot = renderSlot, _resolveComponent = resolveComponent, _withCtx = withCtx, _openBlock = openBlock, _createBlock = createBlock, _createCommentVNode = createCommentVNode, _renderList = renderList, _Fragment = Fragment, _createElementBlock = createElementBlock, _normalizeStyle = normalizeStyle, _createVNode = createVNode, _mergeProps = mergeProps;
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
const _component_taro_view = _resolveComponent("taro-view");
const _component_taro_scroll_view = _resolveComponent("taro-scroll-view");
return (_openBlock(), _createBlock(_component_taro_view, null, {
default: _withCtx(() => [
('header' in _ctx.$slots)
? (_openBlock(), _createBlock(_component_taro_view, {
key: 0,
class: "at-virtual-scroll__header"
}, {
default: _withCtx(() => [
_renderSlot(_ctx.$slots, "header")
]),
_: 3 /* FORWARDED */
}))
: _createCommentVNode("v-if", true),
_createVNode(_component_taro_scroll_view, _mergeProps({ class: "at-virtual-scroll" }, _ctx.anchor, {
ref: el => _ctx.elRef = el,
style: _ctx.dimensions.style,
scrollY: true,
scrollWithAnimation: true,
upperThreshold: parseInt(`${_ctx.reachTopThreshold}`, 10),
lowerThreshold: parseInt(`${_ctx.reachBottomThreshold}`, 10),
onScroll: _ctx.handleScroll,
onScrolltoupper: _cache[0] || (_cache[0] = $event => (_ctx.$emit('reach-top', $event))),
onScrolltolower: _cache[1] || (_cache[1] = $event => (_ctx.$emit('reach-bottom', $event)))
}), {
default: _withCtx(() => [
_createVNode(_component_taro_view, null, {
default: _withCtx(() => [
_createVNode(_component_taro_view, {
class: "at-virtual-scroll__container",
style: _normalizeStyle(_ctx.scrollContainerStyle)
}, {
default: _withCtx(() => [
(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(_ctx.items.slice(_ctx.firstToRender, _ctx.lastToRender), (item, index) => {
return (_openBlock(), _createBlock(_component_taro_view, {
class: "at-virtual-scroll__item",
key: _ctx.firstToRender + index,
id: `item-${_ctx.firstToRender + index}`,
style: _normalizeStyle(_ctx.genScrollItemStyle(index))
}, {
default: _withCtx(() => [
_renderSlot(_ctx.$slots, "default", {
index: _ctx.firstToRender + index,
item: item
})
]),
_: 2 /* DYNAMIC */
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["id", "style"]))
}), 128 /* KEYED_FRAGMENT */))
]),
_: 3 /* FORWARDED */
}, 8 /* PROPS */, ["style"]),
('footer' in _ctx.$slots)
? (_openBlock(), _createBlock(_component_taro_view, {
key: 0,
class: "at-virtual-scroll__footer"
}, {
default: _withCtx(() => [
_renderSlot(_ctx.$slots, "footer")
]),
_: 3 /* FORWARDED */
}))
: _createCommentVNode("v-if", true)
]),
_: 3 /* FORWARDED */
})
]),
_: 3 /* FORWARDED */
}, 16 /* FULL_PROPS */, ["style", "upperThreshold", "lowerThreshold", "onScroll"])
]),
_: 3 /* FORWARDED */
}))
}
AtVirtualScroll.render = _sfc_render;
const allComponents = {
AtAccordion,
AtActionSheet,
AtActionSheetItem,
AtActivityIndicator,
AtAvatar,
AtBadge,
AtButton,
AtCalendar,
AtCard,
AtCheckbox,
AtCountdown,
AtCurtain,
AtDivider,
AtDrawer,
AtFab,
AtFlex,
AtFlexItem,
AtFloatLayout,
AtForm,
AtGrid,
AtIcon,
AtImagePicker,
AtIndexes,
AtInput,
AtInputNumber,
AtList,
AtListItem,
AtLoadMore,
AtLoading,
AtMessage,
AtModal,
AtModalAction,
AtModalContent: _sfc_main$1,
AtModalHeader: _sfc_main,
AtNavBar,
AtNoticebar,
AtPagination,
AtProgress,
AtRadio,
AtRange,
AtRate,
AtSearchBar,
AtSegmentedControl,
AtSkeleton,
AtSlider,
AtSteps,
AtSwipeAction,
AtSwitch,
AtTabBar,
AtTabs,
AtTabsPane,
AtTag,
AtTextarea,
AtTimeline,
AtToast,
AtVirtualScroll
};
const createUI = (components = allComponents) => {
const install = (app) => {
for (const key in components) {
const component = components[key];
app.component(key, component);
}
};
return { install };
};
export { AtAccordion, AtActionSheet, AtActionSheetItem, AtActivityIndicator, AtAvatar, AtBadge, AtButton, AtCalendar, AtCard, AtCheckbox, AtCountdown, AtCurtain, AtDivider, AtDrawer, AtFab, AtFlex, AtFlexItem, AtFloatLayout, AtForm, AtGrid, AtIcon, AtImagePicker, AtIndexes, AtInput, AtInputNumber, AtList, AtListItem, AtLoadMore, AtLoading, AtMessage, AtModal, AtModalAction, _sfc_main$1 as AtModalContent, _sfc_main as AtModalHeader, AtNavBar, AtNoticebar, AtPagination, AtProgress, AtRadio, AtRange, AtRate, AtSearchBar, AtSegmentedControl, AtSkeleton, AtSlider, AtSteps, AtSwipeAction, AtSwitch, AtTabBar, AtTabs, AtTabsPane, AtTag, AtTextarea, AtTimeline, AtToast, AtVirtualScroll, createUI };
//# sourceMappingURL=index.h5.es.js.map