Compare commits
No commits in common. 'main' and 'develop' have entirely different histories.
Before Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 54 KiB |
Before Width: | Height: | Size: 41 KiB |
Before Width: | Height: | Size: 74 KiB |
Before Width: | Height: | Size: 51 KiB |
Before Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 103 KiB |
Before Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 72 KiB |
Before Width: | Height: | Size: 103 KiB |
Before Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 51 KiB |
Before Width: | Height: | Size: 55 KiB |
Before Width: | Height: | Size: 80 KiB |
Before Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 55 KiB |
Before Width: | Height: | Size: 80 KiB |
Before Width: | Height: | Size: 277 KiB |
Before Width: | Height: | Size: 73 KiB |
Before Width: | Height: | Size: 43 KiB |
Before Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 132 KiB |
Before Width: | Height: | Size: 68 KiB |
Before Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 70 KiB |
Before Width: | Height: | Size: 236 KiB |
@ -1,31 +0,0 @@
|
|||||||
/*
|
|
||||||
* Eslint config file
|
|
||||||
* Documentation: https://eslint.org/docs/user-guide/configuring/
|
|
||||||
* Install the Eslint extension before using this feature.
|
|
||||||
*/
|
|
||||||
module.exports = {
|
|
||||||
env: {
|
|
||||||
es6: true,
|
|
||||||
browser: true,
|
|
||||||
node: true,
|
|
||||||
},
|
|
||||||
ecmaFeatures: {
|
|
||||||
modules: true,
|
|
||||||
},
|
|
||||||
parserOptions: {
|
|
||||||
ecmaVersion: 2018,
|
|
||||||
sourceType: 'module',
|
|
||||||
},
|
|
||||||
globals: {
|
|
||||||
wx: true,
|
|
||||||
App: true,
|
|
||||||
Page: true,
|
|
||||||
getCurrentPages: true,
|
|
||||||
getApp: true,
|
|
||||||
Component: true,
|
|
||||||
requirePlugin: true,
|
|
||||||
requireMiniProgram: true,
|
|
||||||
},
|
|
||||||
// extends: 'eslint:recommended',
|
|
||||||
rules: {},
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
# Windows
|
|
||||||
[Dd]esktop.ini
|
|
||||||
Thumbs.db
|
|
||||||
$RECYCLE.BIN/
|
|
||||||
|
|
||||||
# macOS
|
|
||||||
.DS_Store
|
|
||||||
.fseventsd
|
|
||||||
.Spotlight-V100
|
|
||||||
.TemporaryItems
|
|
||||||
.Trashes
|
|
||||||
|
|
||||||
# Node.js
|
|
||||||
node_modules/
|
|
@ -1,10 +0,0 @@
|
|||||||
import gulpError from './utils/gulpError';
|
|
||||||
App({
|
|
||||||
onShow() {
|
|
||||||
if (gulpError !== 'gulpErrorPlaceHolder') {
|
|
||||||
wx.redirectTo({
|
|
||||||
url: `/pages/gulp-error/index?gulpError=${gulpError}`,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
@ -1,57 +0,0 @@
|
|||||||
{
|
|
||||||
"entryPagePath": "pages/record/record",
|
|
||||||
"pages": [
|
|
||||||
"pages/my/my",
|
|
||||||
"pages/record/record",
|
|
||||||
"pages/login/login",
|
|
||||||
"pages/home/home",
|
|
||||||
"pages/useguide/useguide",
|
|
||||||
"pages/problem/problem",
|
|
||||||
"pages/articles/articles",
|
|
||||||
"pages/addPage/addarticles",
|
|
||||||
"pages/articledetail/articledetail"
|
|
||||||
],
|
|
||||||
"usingComponents": {
|
|
||||||
"t-message": "tdesign-miniprogram/message/message",
|
|
||||||
"t-toast": "tdesign-miniprogram/toast/toast",
|
|
||||||
"t-icon": "tdesign-miniprogram/icon/icon",
|
|
||||||
"t-input": "tdesign-miniprogram/input/input",
|
|
||||||
"t-swiper": "tdesign-miniprogram/swiper/swiper",
|
|
||||||
"t-swiper-nav": "tdesign-miniprogram/swiper-nav/swiper-nav"
|
|
||||||
},
|
|
||||||
"window": {
|
|
||||||
"backgroundTextStyle": "light",
|
|
||||||
"navigationStyle": "default",
|
|
||||||
"navigationBarBackgroundColor": "#f6f6f6",
|
|
||||||
"backgroundColor": "#f6f6f6",
|
|
||||||
"navigationBarTitleText": "智能识别",
|
|
||||||
"navigationBarTextStyle": "black"
|
|
||||||
},
|
|
||||||
"tabBar": {
|
|
||||||
"color": "#CEC8E9",
|
|
||||||
"selectedColor": "#19DD51",
|
|
||||||
"borderStyle": "white",
|
|
||||||
"backgroundColor": "#F7FAFB",
|
|
||||||
"list": [
|
|
||||||
{
|
|
||||||
"pagePath": "pages/record/record",
|
|
||||||
"text": "知识科普",
|
|
||||||
"iconPath": "assets/record.png",
|
|
||||||
"selectedIconPath": "assets/record_act.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"pagePath": "pages/home/home",
|
|
||||||
"text": "拍照识别",
|
|
||||||
"iconPath": "assets/home.png",
|
|
||||||
"selectedIconPath": "assets/home_act.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"pagePath": "pages/my/my",
|
|
||||||
"text": "ai问答",
|
|
||||||
"iconPath": "assets/mine.png",
|
|
||||||
"selectedIconPath": "assets/mine_act.png"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"sitemapLocation": "sitemap.json"
|
|
||||||
}
|
|
@ -1,5 +0,0 @@
|
|||||||
page {
|
|
||||||
background: #f6f6f6;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
Before Width: | Height: | Size: 143 KiB |
Before Width: | Height: | Size: 416 KiB |
Before Width: | Height: | Size: 513 KiB |
Before Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 116 KiB |
Before Width: | Height: | Size: 125 KiB |
Before Width: | Height: | Size: 3.7 KiB |
@ -1,3 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
baseUrl:'http://192.168.251.13:8000',
|
|
||||||
}
|
|
@ -1,66 +0,0 @@
|
|||||||
import { SuperComponent } from '../common/src/index';
|
|
||||||
export default class ActionSheet extends SuperComponent {
|
|
||||||
static show: (options: import("./show").ActionSheetShowOption) => WechatMiniprogram.Component.TrivialInstance;
|
|
||||||
externalClasses: string[];
|
|
||||||
properties: {
|
|
||||||
align?: {
|
|
||||||
type: StringConstructor;
|
|
||||||
value?: "center" | "left";
|
|
||||||
};
|
|
||||||
cancelText?: {
|
|
||||||
type: StringConstructor;
|
|
||||||
value?: string;
|
|
||||||
};
|
|
||||||
count?: {
|
|
||||||
type: NumberConstructor;
|
|
||||||
value?: number;
|
|
||||||
};
|
|
||||||
description?: {
|
|
||||||
type: StringConstructor;
|
|
||||||
value?: string;
|
|
||||||
};
|
|
||||||
items: {
|
|
||||||
type: ArrayConstructor;
|
|
||||||
value?: (string | import("./type").ActionSheetItem)[];
|
|
||||||
};
|
|
||||||
showCancel?: {
|
|
||||||
type: BooleanConstructor;
|
|
||||||
value?: boolean;
|
|
||||||
};
|
|
||||||
theme?: {
|
|
||||||
type: StringConstructor;
|
|
||||||
value?: "list" | "grid";
|
|
||||||
};
|
|
||||||
visible: {
|
|
||||||
type: BooleanConstructor;
|
|
||||||
value?: boolean;
|
|
||||||
};
|
|
||||||
defaultVisible: {
|
|
||||||
type: BooleanConstructor;
|
|
||||||
value?: boolean;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
data: {
|
|
||||||
prefix: string;
|
|
||||||
classPrefix: string;
|
|
||||||
gridThemeItems: any[];
|
|
||||||
currentSwiperIndex: number;
|
|
||||||
};
|
|
||||||
controlledProps: {
|
|
||||||
key: string;
|
|
||||||
event: string;
|
|
||||||
}[];
|
|
||||||
ready(): void;
|
|
||||||
methods: {
|
|
||||||
onSwiperChange(e: WechatMiniprogram.TouchEvent): void;
|
|
||||||
splitGridThemeActions(): void;
|
|
||||||
show(options: any): void;
|
|
||||||
memoInitialData(): void;
|
|
||||||
close(): void;
|
|
||||||
onPopupVisibleChange({ detail }: {
|
|
||||||
detail: any;
|
|
||||||
}): void;
|
|
||||||
onSelect(event: WechatMiniprogram.TouchEvent): void;
|
|
||||||
onCancel(): void;
|
|
||||||
};
|
|
||||||
}
|
|
@ -1,94 +0,0 @@
|
|||||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
||||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
||||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
||||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
||||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
||||||
};
|
|
||||||
import { chunk } from '../common/utils';
|
|
||||||
import { SuperComponent, wxComponent } from '../common/src/index';
|
|
||||||
import config from '../common/config';
|
|
||||||
import { ActionSheetTheme, show } from './show';
|
|
||||||
import props from './props';
|
|
||||||
const { prefix } = config;
|
|
||||||
const name = `${prefix}-action-sheet`;
|
|
||||||
let ActionSheet = class ActionSheet extends SuperComponent {
|
|
||||||
constructor() {
|
|
||||||
super(...arguments);
|
|
||||||
this.externalClasses = [`${prefix}-class`, `${prefix}-class-content`, `${prefix}-class-cancel`];
|
|
||||||
this.properties = Object.assign({}, props);
|
|
||||||
this.data = {
|
|
||||||
prefix,
|
|
||||||
classPrefix: name,
|
|
||||||
gridThemeItems: [],
|
|
||||||
currentSwiperIndex: 0,
|
|
||||||
};
|
|
||||||
this.controlledProps = [
|
|
||||||
{
|
|
||||||
key: 'visible',
|
|
||||||
event: 'visible-change',
|
|
||||||
},
|
|
||||||
];
|
|
||||||
this.methods = {
|
|
||||||
onSwiperChange(e) {
|
|
||||||
const { detail: { current }, } = e;
|
|
||||||
this.setData({
|
|
||||||
currentSwiperIndex: current,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
splitGridThemeActions() {
|
|
||||||
if (this.data.theme !== ActionSheetTheme.Grid)
|
|
||||||
return;
|
|
||||||
this.setData({
|
|
||||||
gridThemeItems: chunk(this.data.items, this.data.count),
|
|
||||||
});
|
|
||||||
},
|
|
||||||
show(options) {
|
|
||||||
this.setData(Object.assign(Object.assign(Object.assign({}, this.initialData), options), { visible: true }));
|
|
||||||
this.splitGridThemeActions();
|
|
||||||
this.autoClose = true;
|
|
||||||
this._trigger('visible-change', { visible: true });
|
|
||||||
},
|
|
||||||
memoInitialData() {
|
|
||||||
this.initialData = Object.assign(Object.assign({}, this.properties), this.data);
|
|
||||||
},
|
|
||||||
close() {
|
|
||||||
this.triggerEvent('close', { trigger: 'command' });
|
|
||||||
this._trigger('visible-change', { visible: false });
|
|
||||||
},
|
|
||||||
onPopupVisibleChange({ detail }) {
|
|
||||||
if (!detail.visible) {
|
|
||||||
this.triggerEvent('close', { trigger: 'overlay' });
|
|
||||||
this._trigger('visible-change', { visible: false });
|
|
||||||
}
|
|
||||||
if (this.autoClose) {
|
|
||||||
this.setData({ visible: false });
|
|
||||||
this.autoClose = false;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onSelect(event) {
|
|
||||||
const { currentSwiperIndex, items, gridThemeItems, count, theme } = this.data;
|
|
||||||
const { index } = event.currentTarget.dataset;
|
|
||||||
const isSwiperMode = theme === ActionSheetTheme.Grid;
|
|
||||||
const item = isSwiperMode ? gridThemeItems[currentSwiperIndex][index] : items[index];
|
|
||||||
const realIndex = isSwiperMode ? index + currentSwiperIndex * count : index;
|
|
||||||
if (item) {
|
|
||||||
this.triggerEvent('selected', { selected: item, index: realIndex });
|
|
||||||
this.trigger('close', { trigger: 'select' });
|
|
||||||
this._trigger('visible-change', { visible: false });
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onCancel() {
|
|
||||||
this.triggerEvent('cancel');
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
ready() {
|
|
||||||
this.memoInitialData();
|
|
||||||
this.splitGridThemeActions();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
ActionSheet.show = show;
|
|
||||||
ActionSheet = __decorate([
|
|
||||||
wxComponent()
|
|
||||||
], ActionSheet);
|
|
||||||
export default ActionSheet;
|
|
@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"component": true,
|
|
||||||
"usingComponents": {
|
|
||||||
"t-icon": "../icon/icon",
|
|
||||||
"t-popup": "../popup/popup",
|
|
||||||
"t-grid": "../grid/grid",
|
|
||||||
"t-grid-item": "../grid-item/grid-item",
|
|
||||||
"t-swiper-nav": "../swiper-nav/swiper-nav"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,41 +0,0 @@
|
|||||||
<wxs src="./action-sheet.wxs" module="this" />
|
|
||||||
<wxs src="../common/utils.wxs" module="_" />
|
|
||||||
<import src="./template/list.wxml" />
|
|
||||||
<import src="./template/grid.wxml" />
|
|
||||||
|
|
||||||
<view id="{{classPrefix}}" style="{{_._style([style, customStyle])}}" class="{{classPrefix}} class {{prefix}}-class">
|
|
||||||
<t-popup visible="{{visible}}" placement="bottom" bind:visible-change="onPopupVisibleChange">
|
|
||||||
<view
|
|
||||||
class="{{_.cls(classPrefix + '__content', [['grid', gridThemeItems.length]])}} {{prefix}}-class-content"
|
|
||||||
tabindex="0"
|
|
||||||
>
|
|
||||||
<view wx:if="{{description}}" tabindex="0" class="{{_.cls(classPrefix + '__description', [align])}}"
|
|
||||||
>{{description}}</view
|
|
||||||
>
|
|
||||||
<block wx:if="{{gridThemeItems.length}}">
|
|
||||||
<template is="grid" data="{{classPrefix, prefix, gridThemeItems, count, currentSwiperIndex}}" />
|
|
||||||
</block>
|
|
||||||
<view wx:elif="{{items && items.length}}" class="{{classPrefix}}__list">
|
|
||||||
<block wx:for="{{ items }}" wx:key="index">
|
|
||||||
<template
|
|
||||||
is="list"
|
|
||||||
data="{{index, classPrefix, listThemeItemClass: _.cls(classPrefix + '__list-item', [align, [disabled, item.disabled]]), item}}"
|
|
||||||
/>
|
|
||||||
</block>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<slot />
|
|
||||||
<view wx:if="{{showCancel}}" class="{{classPrefix}}__footer {{classPrefix}}__safe">
|
|
||||||
<view class="{{classPrefix}}__gap-{{theme}}" />
|
|
||||||
<view
|
|
||||||
class="{{classPrefix}}__cancel {{prefix}}-class-cancel"
|
|
||||||
hover-class="{{classPrefix}}__cancel--hover"
|
|
||||||
hover-stay-time="70"
|
|
||||||
bind:tap="onCancel"
|
|
||||||
aria-role="button"
|
|
||||||
>
|
|
||||||
{{ cancelText }}
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</t-popup>
|
|
||||||
</view>
|
|
@ -1,19 +0,0 @@
|
|||||||
var getListThemeItemClass = function (props) {
|
|
||||||
var classPrefix = props.classPrefix;
|
|
||||||
var item = props.item;
|
|
||||||
var prefix = props.prefix;
|
|
||||||
var classList = [classPrefix + '__list-item'];
|
|
||||||
if (item.disabled) {
|
|
||||||
classList.push(prefix + '-is-disabled');
|
|
||||||
}
|
|
||||||
return classList.join(' ');
|
|
||||||
};
|
|
||||||
|
|
||||||
var isImage = function (name) {
|
|
||||||
return name.indexOf('/') !== -1;
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
getListThemeItemClass: getListThemeItemClass,
|
|
||||||
isImage: isImage,
|
|
||||||
};
|
|
@ -1,169 +0,0 @@
|
|||||||
.t-float-left {
|
|
||||||
float: left;
|
|
||||||
}
|
|
||||||
.t-float-right {
|
|
||||||
float: right;
|
|
||||||
}
|
|
||||||
@keyframes tdesign-fade-out {
|
|
||||||
from {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
to {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.hotspot-expanded.relative {
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
.hotspot-expanded::after {
|
|
||||||
content: '';
|
|
||||||
display: block;
|
|
||||||
position: absolute;
|
|
||||||
left: 0;
|
|
||||||
top: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
transform: scale(1.5);
|
|
||||||
}
|
|
||||||
.t-action-sheet__content {
|
|
||||||
color: var(--td-action-sheet-color, var(--td-font-gray-1, rgba(0, 0, 0, 0.9)));
|
|
||||||
border-top-left-radius: var(--td-action-sheet-border-radius, var(--td-radius-extra-large, 24rpx));
|
|
||||||
border-top-right-radius: var(--td-action-sheet-border-radius, var(--td-radius-extra-large, 24rpx));
|
|
||||||
background-color: var(--td-bg-color-container, var(--td-font-white-1, #ffffff));
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
.t-action-sheet__content--grid {
|
|
||||||
padding-top: 16rpx;
|
|
||||||
}
|
|
||||||
.t-action-sheet__content:focus {
|
|
||||||
outline: 0;
|
|
||||||
}
|
|
||||||
.t-action-sheet__grid {
|
|
||||||
padding-bottom: 16rpx;
|
|
||||||
}
|
|
||||||
.t-action-sheet__grid--swiper {
|
|
||||||
padding-bottom: 48rpx;
|
|
||||||
}
|
|
||||||
.t-action-sheet__description {
|
|
||||||
color: var(--td-action-sheet-description-color, var(--td-font-gray-3, rgba(0, 0, 0, 0.4)));
|
|
||||||
line-height: 44rpx;
|
|
||||||
font-size: 28rpx;
|
|
||||||
text-align: var(--td-action-sheet-text-align, center);
|
|
||||||
padding: 24rpx 32rpx;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
.t-action-sheet__description:focus {
|
|
||||||
outline: 0;
|
|
||||||
}
|
|
||||||
.t-action-sheet__description::after {
|
|
||||||
content: '';
|
|
||||||
display: block;
|
|
||||||
position: absolute;
|
|
||||||
top: unset;
|
|
||||||
bottom: 0;
|
|
||||||
left: unset;
|
|
||||||
right: unset;
|
|
||||||
background-color: var(--td-action-sheet-border-color, var(--td-gray-color-1, #f3f3f3));
|
|
||||||
}
|
|
||||||
.t-action-sheet__description::after {
|
|
||||||
height: 1px;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
transform: scaleY(0.5);
|
|
||||||
}
|
|
||||||
.t-action-sheet__description--left {
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
.t-action-sheet__description--left::after {
|
|
||||||
left: 32rpx;
|
|
||||||
}
|
|
||||||
.t-action-sheet__list-item {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
position: relative;
|
|
||||||
height: var(--td-action-sheet-list-item-height, 112rpx);
|
|
||||||
padding: 0 32rpx;
|
|
||||||
}
|
|
||||||
.t-action-sheet__list-item::after {
|
|
||||||
content: '';
|
|
||||||
display: block;
|
|
||||||
position: absolute;
|
|
||||||
top: unset;
|
|
||||||
bottom: 0;
|
|
||||||
left: unset;
|
|
||||||
right: unset;
|
|
||||||
background-color: var(--td-action-sheet-border-color, var(--td-gray-color-1, #f3f3f3));
|
|
||||||
}
|
|
||||||
.t-action-sheet__list-item::after {
|
|
||||||
height: 1px;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
transform: scaleY(0.5);
|
|
||||||
}
|
|
||||||
.t-action-sheet__list-item:focus {
|
|
||||||
outline: 0;
|
|
||||||
}
|
|
||||||
.t-action-sheet__list-item--left {
|
|
||||||
justify-content: start;
|
|
||||||
}
|
|
||||||
.t-action-sheet__list-item--left::after {
|
|
||||||
left: 32rpx;
|
|
||||||
}
|
|
||||||
.t-action-sheet__list-item--disabled {
|
|
||||||
color: var(--td-action-sheet-list-item-disabled-color, var(--td-font-gray-4, rgba(0, 0, 0, 0.26)));
|
|
||||||
}
|
|
||||||
.t-action-sheet__list-item-text {
|
|
||||||
font-size: var(--td-font-size-m, 32rpx);
|
|
||||||
word-wrap: normal;
|
|
||||||
white-space: nowrap;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
}
|
|
||||||
.t-action-sheet__list-item-icon {
|
|
||||||
margin-right: 16rpx;
|
|
||||||
}
|
|
||||||
.t-action-sheet__swiper-wrap {
|
|
||||||
margin-top: 8rpx;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
.t-action-sheet__footer {
|
|
||||||
background-color: var(--td-bg-color-container, var(--td-font-white-1, #ffffff));
|
|
||||||
}
|
|
||||||
.t-action-sheet__gap-list {
|
|
||||||
height: 16rpx;
|
|
||||||
background-color: var(--td-action-sheet-border-color, var(--td-gray-color-1, #f3f3f3));
|
|
||||||
}
|
|
||||||
.t-action-sheet__gap-grid {
|
|
||||||
height: 1rpx;
|
|
||||||
background-color: var(--td-action-sheet-border-color, var(--td-gray-color-1, #f3f3f3));
|
|
||||||
}
|
|
||||||
.t-action-sheet__cancel {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
height: var(--td-action-sheet-cancel-height, 96rpx);
|
|
||||||
}
|
|
||||||
.t-action-sheet__dots {
|
|
||||||
position: absolute;
|
|
||||||
left: 50%;
|
|
||||||
bottom: 32rpx;
|
|
||||||
transform: translateX(-50%);
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
}
|
|
||||||
.t-action-sheet__dots-item {
|
|
||||||
width: 16rpx;
|
|
||||||
height: 16rpx;
|
|
||||||
background-color: #dcdcdc;
|
|
||||||
border-radius: 50%;
|
|
||||||
margin: 0 16rpx;
|
|
||||||
transition: all 0.4s ease-in;
|
|
||||||
}
|
|
||||||
.t-action-sheet__dots-item.t-is-active {
|
|
||||||
background-color: #0052d9;
|
|
||||||
}
|
|
||||||
.t-action-sheet__safe {
|
|
||||||
padding-bottom: constant(safe-area-inset-bottom);
|
|
||||||
padding-bottom: env(safe-area-inset-bottom);
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
import ActionSheet from './action-sheet';
|
|
||||||
export * from './show';
|
|
||||||
export default ActionSheet;
|
|
@ -1,3 +0,0 @@
|
|||||||
import ActionSheet from './action-sheet';
|
|
||||||
export * from './show';
|
|
||||||
export default ActionSheet;
|
|
@ -1,3 +0,0 @@
|
|||||||
import { TdActionSheetProps } from './type';
|
|
||||||
declare const props: TdActionSheetProps;
|
|
||||||
export default props;
|
|
@ -1,38 +0,0 @@
|
|||||||
const props = {
|
|
||||||
align: {
|
|
||||||
type: String,
|
|
||||||
value: 'center',
|
|
||||||
},
|
|
||||||
cancelText: {
|
|
||||||
type: String,
|
|
||||||
value: '取消',
|
|
||||||
},
|
|
||||||
count: {
|
|
||||||
type: Number,
|
|
||||||
value: 8,
|
|
||||||
},
|
|
||||||
description: {
|
|
||||||
type: String,
|
|
||||||
value: '',
|
|
||||||
},
|
|
||||||
items: {
|
|
||||||
type: Array,
|
|
||||||
},
|
|
||||||
showCancel: {
|
|
||||||
type: Boolean,
|
|
||||||
value: true,
|
|
||||||
},
|
|
||||||
theme: {
|
|
||||||
type: String,
|
|
||||||
value: 'list',
|
|
||||||
},
|
|
||||||
visible: {
|
|
||||||
type: Boolean,
|
|
||||||
value: null,
|
|
||||||
},
|
|
||||||
defaultVisible: {
|
|
||||||
type: Boolean,
|
|
||||||
value: false,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
export default props;
|
|
@ -1,29 +0,0 @@
|
|||||||
/// <reference types="miniprogram-api-typings" />
|
|
||||||
/// <reference types="miniprogram-api-typings" />
|
|
||||||
export interface ActionSheetItem {
|
|
||||||
label: string;
|
|
||||||
color?: string;
|
|
||||||
disabled?: boolean;
|
|
||||||
icon?: string;
|
|
||||||
}
|
|
||||||
declare type Context = WechatMiniprogram.Page.TrivialInstance | WechatMiniprogram.Component.TrivialInstance;
|
|
||||||
export declare enum ActionSheetTheme {
|
|
||||||
List = "list",
|
|
||||||
Grid = "grid"
|
|
||||||
}
|
|
||||||
interface ActionSheetProps {
|
|
||||||
visible: boolean;
|
|
||||||
items: Array<string | ActionSheetItem>;
|
|
||||||
defaultVisible?: boolean;
|
|
||||||
cancelText?: string;
|
|
||||||
count?: number;
|
|
||||||
showCancel?: boolean;
|
|
||||||
theme?: ActionSheetTheme;
|
|
||||||
}
|
|
||||||
export interface ActionSheetShowOption extends Omit<ActionSheetProps, 'visible'> {
|
|
||||||
context?: Context;
|
|
||||||
selector?: string;
|
|
||||||
}
|
|
||||||
export declare const show: (options: ActionSheetShowOption) => WechatMiniprogram.Component.TrivialInstance;
|
|
||||||
export declare const close: (options: ActionSheetShowOption) => void;
|
|
||||||
export {};
|
|
@ -1,33 +0,0 @@
|
|||||||
var __rest = (this && this.__rest) || function (s, e) {
|
|
||||||
var t = {};
|
|
||||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
||||||
t[p] = s[p];
|
|
||||||
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
||||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
||||||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
||||||
t[p[i]] = s[p[i]];
|
|
||||||
}
|
|
||||||
return t;
|
|
||||||
};
|
|
||||||
import { getInstance } from '../common/utils';
|
|
||||||
export var ActionSheetTheme;
|
|
||||||
(function (ActionSheetTheme) {
|
|
||||||
ActionSheetTheme["List"] = "list";
|
|
||||||
ActionSheetTheme["Grid"] = "grid";
|
|
||||||
})(ActionSheetTheme || (ActionSheetTheme = {}));
|
|
||||||
export const show = function (options) {
|
|
||||||
const _a = Object.assign({}, options), { context, selector = '#t-action-sheet' } = _a, otherOptions = __rest(_a, ["context", "selector"]);
|
|
||||||
const instance = getInstance(context, selector);
|
|
||||||
if (instance) {
|
|
||||||
instance.show(Object.assign({}, otherOptions));
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
console.error('未找到组件,请确认 selector && context 是否正确');
|
|
||||||
};
|
|
||||||
export const close = function (options) {
|
|
||||||
const { context, selector = '#t-action-sheet' } = Object.assign({}, options);
|
|
||||||
const instance = getInstance(context, selector);
|
|
||||||
if (instance) {
|
|
||||||
instance.close();
|
|
||||||
}
|
|
||||||
};
|
|
@ -1,49 +0,0 @@
|
|||||||
<template name="grid">
|
|
||||||
<block wx:if="{{gridThemeItems.length === 1}}">
|
|
||||||
<t-grid align="center" t-class="{{classPrefix}}__grid" column="{{count / 2}}" class="{{classPrefix}}__single-wrap">
|
|
||||||
<t-grid-item
|
|
||||||
t-class="{{classPrefix}}__grid-item"
|
|
||||||
class="{{classPrefix}}__square"
|
|
||||||
wx:for="{{gridThemeItems[0]}}"
|
|
||||||
wx:key="index"
|
|
||||||
bind:tap="onSelect"
|
|
||||||
data-index="{{index}}"
|
|
||||||
icon="{{item.icon}}"
|
|
||||||
text="{{item.label}}"
|
|
||||||
image="{{item.image}}"
|
|
||||||
>
|
|
||||||
</t-grid-item>
|
|
||||||
</t-grid>
|
|
||||||
</block>
|
|
||||||
<block wx:elif="{{gridThemeItems.length > 1}}">
|
|
||||||
<view class="{{classPrefix}}__swiper-wrap">
|
|
||||||
<swiper style="height: 456rpx" autoplay="{{false}}" current="{{currentSwiperIndex}}" bindchange="onSwiperChange">
|
|
||||||
<swiper-item wx:for="{{gridThemeItems}}" wx:key="index">
|
|
||||||
<t-grid align="center" t-class="{{classPrefix}}__grid {{classPrefix}}__grid--swiper" column="{{count / 2}}">
|
|
||||||
<t-grid-item
|
|
||||||
t-class="{{classPrefix}}__grid-item"
|
|
||||||
class="{{classPrefix}}__square"
|
|
||||||
wx:for="{{item}}"
|
|
||||||
wx:key="index"
|
|
||||||
data-index="{{index}}"
|
|
||||||
bind:tap="onSelect"
|
|
||||||
icon="{{item.icon}}"
|
|
||||||
text="{{item.label}}"
|
|
||||||
image="{{item.image}}"
|
|
||||||
>
|
|
||||||
</t-grid-item>
|
|
||||||
</t-grid>
|
|
||||||
</swiper-item>
|
|
||||||
</swiper>
|
|
||||||
<view class="{{classPrefix}}__nav">
|
|
||||||
<view class="{{classPrefix}}__dots">
|
|
||||||
<view
|
|
||||||
wx:for="{{gridThemeItems.length}}"
|
|
||||||
wx:key="index"
|
|
||||||
class="{{classPrefix}}__dots-item {{index === currentSwiperIndex ? prefix + '-is-active' : ''}}"
|
|
||||||
/>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</block>
|
|
||||||
</template>
|
|
@ -1,14 +0,0 @@
|
|||||||
<template name="list">
|
|
||||||
<view
|
|
||||||
data-index="{{index}}"
|
|
||||||
style="{{ item.color ? 'color: ' + item.color : '' }}"
|
|
||||||
class="{{listThemeItemClass}}"
|
|
||||||
bind:tap="onSelect"
|
|
||||||
aria-role="{{ariaRole || 'button'}}"
|
|
||||||
aria-label="{{item.label || item}}"
|
|
||||||
tabindex="0"
|
|
||||||
>
|
|
||||||
<t-icon wx:if="{{item.icon}}" name="{{item.icon}}" class="{{classPrefix}}__list-item-icon" size="48rpx"></t-icon>
|
|
||||||
<view class="{{classPrefix}}__list-item-text">{{item.label || item}}</view>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
@ -1,43 +0,0 @@
|
|||||||
export interface TdActionSheetProps {
|
|
||||||
align?: {
|
|
||||||
type: StringConstructor;
|
|
||||||
value?: 'center' | 'left';
|
|
||||||
};
|
|
||||||
cancelText?: {
|
|
||||||
type: StringConstructor;
|
|
||||||
value?: string;
|
|
||||||
};
|
|
||||||
count?: {
|
|
||||||
type: NumberConstructor;
|
|
||||||
value?: number;
|
|
||||||
};
|
|
||||||
description?: {
|
|
||||||
type: StringConstructor;
|
|
||||||
value?: string;
|
|
||||||
};
|
|
||||||
items: {
|
|
||||||
type: ArrayConstructor;
|
|
||||||
value?: Array<string | ActionSheetItem>;
|
|
||||||
};
|
|
||||||
showCancel?: {
|
|
||||||
type: BooleanConstructor;
|
|
||||||
value?: boolean;
|
|
||||||
};
|
|
||||||
theme?: {
|
|
||||||
type: StringConstructor;
|
|
||||||
value?: 'list' | 'grid';
|
|
||||||
};
|
|
||||||
visible: {
|
|
||||||
type: BooleanConstructor;
|
|
||||||
value?: boolean;
|
|
||||||
};
|
|
||||||
defaultVisible: {
|
|
||||||
type: BooleanConstructor;
|
|
||||||
value?: boolean;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
export interface ActionSheetItem {
|
|
||||||
label: string;
|
|
||||||
color?: string;
|
|
||||||
disabled?: boolean;
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
export {};
|
|
@ -1,28 +0,0 @@
|
|||||||
import { SuperComponent, RelationsOptions } from '../common/src/index';
|
|
||||||
export default class AvatarGroup extends SuperComponent {
|
|
||||||
externalClasses: string[];
|
|
||||||
properties: import("./type").TdAvatarGroupProps;
|
|
||||||
data: {
|
|
||||||
prefix: string;
|
|
||||||
classPrefix: string;
|
|
||||||
hasChild: boolean;
|
|
||||||
length: number;
|
|
||||||
className: string;
|
|
||||||
};
|
|
||||||
options: {
|
|
||||||
multipleSlots: boolean;
|
|
||||||
};
|
|
||||||
relations: RelationsOptions;
|
|
||||||
lifetimes: {
|
|
||||||
attached(): void;
|
|
||||||
ready(): void;
|
|
||||||
};
|
|
||||||
observers: {
|
|
||||||
'cascading, size'(): void;
|
|
||||||
};
|
|
||||||
methods: {
|
|
||||||
setClass(): void;
|
|
||||||
handleMax(): void;
|
|
||||||
handleChildCascading(): void;
|
|
||||||
};
|
|
||||||
}
|
|
@ -1,86 +0,0 @@
|
|||||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
||||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
||||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
||||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
||||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
||||||
};
|
|
||||||
import { SuperComponent, wxComponent } from '../common/src/index';
|
|
||||||
import config from '../common/config';
|
|
||||||
import avatarGroupProps from './props';
|
|
||||||
const { prefix } = config;
|
|
||||||
const name = `${prefix}-avatar-group`;
|
|
||||||
let AvatarGroup = class AvatarGroup extends SuperComponent {
|
|
||||||
constructor() {
|
|
||||||
super(...arguments);
|
|
||||||
this.externalClasses = [`${prefix}-class`, `${prefix}-class-content`, `${prefix}-class-image`];
|
|
||||||
this.properties = avatarGroupProps;
|
|
||||||
this.data = {
|
|
||||||
prefix,
|
|
||||||
classPrefix: name,
|
|
||||||
hasChild: true,
|
|
||||||
length: 0,
|
|
||||||
className: '',
|
|
||||||
};
|
|
||||||
this.options = {
|
|
||||||
multipleSlots: true,
|
|
||||||
};
|
|
||||||
this.relations = {
|
|
||||||
'../avatar/avatar': {
|
|
||||||
type: 'descendant',
|
|
||||||
},
|
|
||||||
};
|
|
||||||
this.lifetimes = {
|
|
||||||
attached() {
|
|
||||||
this.setClass();
|
|
||||||
},
|
|
||||||
ready() {
|
|
||||||
this.setData({
|
|
||||||
length: this.$children.length,
|
|
||||||
});
|
|
||||||
this.handleMax();
|
|
||||||
this.handleChildCascading();
|
|
||||||
},
|
|
||||||
};
|
|
||||||
this.observers = {
|
|
||||||
'cascading, size'() {
|
|
||||||
this.setClass();
|
|
||||||
},
|
|
||||||
};
|
|
||||||
this.methods = {
|
|
||||||
setClass() {
|
|
||||||
const { cascading, size } = this.properties;
|
|
||||||
const direction = cascading.split('-')[0];
|
|
||||||
const classList = [
|
|
||||||
name,
|
|
||||||
`${prefix}-class`,
|
|
||||||
`${name}-offset-${direction}-${size.indexOf('px') > -1 ? 'medium' : size}`,
|
|
||||||
];
|
|
||||||
this.setData({
|
|
||||||
className: classList.join(' '),
|
|
||||||
});
|
|
||||||
},
|
|
||||||
handleMax() {
|
|
||||||
const { max } = this.data;
|
|
||||||
const len = this.$children.length;
|
|
||||||
if (!max || max > len)
|
|
||||||
return;
|
|
||||||
const restAvatars = this.$children.splice(max, len - max);
|
|
||||||
restAvatars.forEach((child) => {
|
|
||||||
child.hide();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
handleChildCascading() {
|
|
||||||
if (this.properties.cascading === 'right-up')
|
|
||||||
return;
|
|
||||||
const defaultZIndex = 100;
|
|
||||||
this.$children.forEach((child, index) => {
|
|
||||||
child.updateCascading(defaultZIndex - index * 10);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
};
|
|
||||||
AvatarGroup = __decorate([
|
|
||||||
wxComponent()
|
|
||||||
], AvatarGroup);
|
|
||||||
export default AvatarGroup;
|
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"component": true,
|
|
||||||
"usingComponents": {
|
|
||||||
"t-avatar": "../avatar/avatar"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
<wxs src="../common/utils.wxs" module="_" />
|
|
||||||
|
|
||||||
<view style="{{_._style([style, customStyle])}}" class="{{className}} class">
|
|
||||||
<slot />
|
|
||||||
<!-- 自定义折叠元素 -->
|
|
||||||
<view class="{{classPrefix}}__collapse--slot">
|
|
||||||
<slot name="collapse-avatar" />
|
|
||||||
</view>
|
|
||||||
<!-- 默认折叠元素 -->
|
|
||||||
<view class="{{classPrefix}}__collapse--default" wx:if="{{max && (max < length)}}">
|
|
||||||
<t-avatar
|
|
||||||
t-class-image="{{prefix}}-avatar--border {{prefix}}-avatar--border-{{size}} {{prefix}}-class-image"
|
|
||||||
t-class-content="{{prefix}}-class-content"
|
|
||||||
size="{{size}}"
|
|
||||||
icon="{{ collapseAvatar ? '' : 'user-add'}}"
|
|
||||||
aria-role="none"
|
|
||||||
>{{collapseAvatar}}</t-avatar
|
|
||||||
>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
@ -1,137 +0,0 @@
|
|||||||
.t-float-left {
|
|
||||||
float: left;
|
|
||||||
}
|
|
||||||
.t-float-right {
|
|
||||||
float: right;
|
|
||||||
}
|
|
||||||
@keyframes tdesign-fade-out {
|
|
||||||
from {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
to {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.hotspot-expanded.relative {
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
.hotspot-expanded::after {
|
|
||||||
content: '';
|
|
||||||
display: block;
|
|
||||||
position: absolute;
|
|
||||||
left: 0;
|
|
||||||
top: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
transform: scale(1.5);
|
|
||||||
}
|
|
||||||
.t-avatar {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
box-sizing: border-box;
|
|
||||||
background-color: var(--td-avatar-bg-color, var(--td-brand-color-light-active, var(--td-primary-color-2, #d9e1ff)));
|
|
||||||
color: var(--td-avatar-content-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
|
|
||||||
}
|
|
||||||
.t-avatar__wrapper {
|
|
||||||
display: inline-flex;
|
|
||||||
position: relative;
|
|
||||||
vertical-align: top;
|
|
||||||
margin-left: var(--td-avatar-margin-left, 0);
|
|
||||||
}
|
|
||||||
.t-avatar--large {
|
|
||||||
width: var(--td-avatar-large-width, 128rpx);
|
|
||||||
height: var(--td-avatar-large-width, 128rpx);
|
|
||||||
font-size: var(--td-avatar-text-large-font-size, 16px);
|
|
||||||
}
|
|
||||||
.t-avatar--large .t-avatar__icon {
|
|
||||||
font-size: var(--td-avatar-icon-large-font-size, 64rpx);
|
|
||||||
}
|
|
||||||
.t-avatar--medium {
|
|
||||||
width: var(--td-avatar-medium-width, 96rpx);
|
|
||||||
height: var(--td-avatar-medium-width, 96rpx);
|
|
||||||
font-size: var(--td-avatar-text-medium-font-size, var(--td-font-size-base, 28rpx));
|
|
||||||
}
|
|
||||||
.t-avatar--medium .t-avatar__icon {
|
|
||||||
font-size: var(--td-avatar-icon-medium-font-size, 48rpx);
|
|
||||||
}
|
|
||||||
.t-avatar--small {
|
|
||||||
width: var(--td-avatar-small-width, 80rpx);
|
|
||||||
height: var(--td-avatar-small-width, 80rpx);
|
|
||||||
font-size: var(--td-avatar-text-small-font-size, var(--td-font-size-s, 24rpx));
|
|
||||||
}
|
|
||||||
.t-avatar--small .t-avatar__icon {
|
|
||||||
font-size: var(--td-avatar-icon-small-font-size, 40rpx);
|
|
||||||
}
|
|
||||||
.t-avatar .t-image,
|
|
||||||
.t-avatar__image {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
.t-avatar--circle {
|
|
||||||
border-radius: var(--td-avatar-circle-border-radius, var(--td-radius-circle, 50%));
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
.t-avatar--round {
|
|
||||||
border-radius: var(--td-avatar-round-border-radius, var(--td-radius-default, 12rpx));
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
.t-avatar__text,
|
|
||||||
.t-avatar__icon {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
.t-avatar__text:empty,
|
|
||||||
.t-avatar__icon:empty {
|
|
||||||
width: 0;
|
|
||||||
height: 0;
|
|
||||||
}
|
|
||||||
.t-avatar--border {
|
|
||||||
border-color: var(--td-avatar-border-color, #fff);
|
|
||||||
border-style: solid;
|
|
||||||
}
|
|
||||||
.t-avatar--border-small {
|
|
||||||
border-width: var(--td-avatar-border-width-small, 4rpx);
|
|
||||||
}
|
|
||||||
.t-avatar--border-medium {
|
|
||||||
border-width: var(--td-avatar-border-width-medium, 6rpx);
|
|
||||||
}
|
|
||||||
.t-avatar--border-large {
|
|
||||||
border-width: var(--td-avatar-border-width-large, 8rpx);
|
|
||||||
}
|
|
||||||
.t-avatar-group {
|
|
||||||
display: inline-flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
.t-avatar-group-offset-left-small {
|
|
||||||
--td-avatar-margin-left: var(--td-avatar-group-margin-left-small, -4px);
|
|
||||||
}
|
|
||||||
.t-avatar-group-offset-left-medium {
|
|
||||||
--td-avatar-margin-left: var(--td-avatar-group-margin-left-medium, -6px);
|
|
||||||
}
|
|
||||||
.t-avatar-group-offset-left-large {
|
|
||||||
--td-avatar-margin-left: var(--td-avatar-group-margin-left-large, -8px);
|
|
||||||
}
|
|
||||||
.t-avatar-group-offset-right-small {
|
|
||||||
--td-avatar-margin-left: var(--td-avatar-group-margin-left-small, -4px);
|
|
||||||
}
|
|
||||||
.t-avatar-group-offset-right-medium {
|
|
||||||
--td-avatar-margin-left: var(--td-avatar-group-margin-left-medium, -6px);
|
|
||||||
}
|
|
||||||
.t-avatar-group-offset-right-large {
|
|
||||||
--td-avatar-margin-left: var(--td-avatar-group-margin-left-large, -8px);
|
|
||||||
}
|
|
||||||
.t-avatar-group__collapse--slot {
|
|
||||||
float: left;
|
|
||||||
}
|
|
||||||
.t-avatar-group__collapse--slot:not(:empty) + .t-avatar-group__collapse--default {
|
|
||||||
display: none;
|
|
||||||
float: left;
|
|
||||||
}
|
|
||||||
.t-avatar-group__collapse--slot:empty + .t-avatar-group__collapse--default {
|
|
||||||
display: block;
|
|
||||||
float: left;
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
import { TdAvatarGroupProps } from './type';
|
|
||||||
declare const props: TdAvatarGroupProps;
|
|
||||||
export default props;
|
|
@ -1,20 +0,0 @@
|
|||||||
const props = {
|
|
||||||
cascading: {
|
|
||||||
type: String,
|
|
||||||
value: 'left-up',
|
|
||||||
},
|
|
||||||
collapseAvatar: {
|
|
||||||
type: String,
|
|
||||||
},
|
|
||||||
externalClasses: {
|
|
||||||
type: Array,
|
|
||||||
},
|
|
||||||
max: {
|
|
||||||
type: Number,
|
|
||||||
},
|
|
||||||
size: {
|
|
||||||
type: String,
|
|
||||||
value: 'medium',
|
|
||||||
},
|
|
||||||
};
|
|
||||||
export default props;
|
|
@ -1,27 +0,0 @@
|
|||||||
export interface TdAvatarGroupProps {
|
|
||||||
cascading?: {
|
|
||||||
type: StringConstructor;
|
|
||||||
value?: CascadingValue;
|
|
||||||
};
|
|
||||||
collapseAvatar?: {
|
|
||||||
type: StringConstructor;
|
|
||||||
value?: string;
|
|
||||||
};
|
|
||||||
style?: {
|
|
||||||
type: StringConstructor;
|
|
||||||
value?: string;
|
|
||||||
};
|
|
||||||
externalClasses?: {
|
|
||||||
type: ArrayConstructor;
|
|
||||||
value?: ['t-class', 't-class-image', 't-class-content'];
|
|
||||||
};
|
|
||||||
max?: {
|
|
||||||
type: NumberConstructor;
|
|
||||||
value?: number;
|
|
||||||
};
|
|
||||||
size?: {
|
|
||||||
type: StringConstructor;
|
|
||||||
value?: string;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
export declare type CascadingValue = 'left-up' | 'right-up';
|
|
@ -1 +0,0 @@
|
|||||||
export {};
|
|
@ -1,23 +0,0 @@
|
|||||||
/// <reference types="miniprogram-api-typings" />
|
|
||||||
import { SuperComponent, RelationsOptions } from '../common/src/index';
|
|
||||||
export default class Avatar extends SuperComponent {
|
|
||||||
options: WechatMiniprogram.Component.ComponentOptions;
|
|
||||||
externalClasses: string[];
|
|
||||||
properties: import("./type").TdAvatarProps;
|
|
||||||
data: {
|
|
||||||
prefix: string;
|
|
||||||
classPrefix: string;
|
|
||||||
isShow: boolean;
|
|
||||||
zIndex: number;
|
|
||||||
bordered: boolean;
|
|
||||||
};
|
|
||||||
relations: RelationsOptions;
|
|
||||||
observers: {
|
|
||||||
icon(icon: any): void;
|
|
||||||
};
|
|
||||||
methods: {
|
|
||||||
hide(): void;
|
|
||||||
updateCascading(zIndex: any): void;
|
|
||||||
onLoadError(e: WechatMiniprogram.CustomEvent): void;
|
|
||||||
};
|
|
||||||
}
|
|
@ -1,77 +0,0 @@
|
|||||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
||||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
||||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
||||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
||||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
||||||
};
|
|
||||||
import { SuperComponent, wxComponent } from '../common/src/index';
|
|
||||||
import config from '../common/config';
|
|
||||||
import avatarProps from './props';
|
|
||||||
import { setIcon } from '../common/utils';
|
|
||||||
const { prefix } = config;
|
|
||||||
const name = `${prefix}-avatar`;
|
|
||||||
let Avatar = class Avatar extends SuperComponent {
|
|
||||||
constructor() {
|
|
||||||
super(...arguments);
|
|
||||||
this.options = {
|
|
||||||
multipleSlots: true,
|
|
||||||
styleIsolation: 'apply-shared',
|
|
||||||
};
|
|
||||||
this.externalClasses = [
|
|
||||||
`${prefix}-class`,
|
|
||||||
`${prefix}-class-image`,
|
|
||||||
`${prefix}-class-icon`,
|
|
||||||
`${prefix}-class-alt`,
|
|
||||||
`${prefix}-class-content`,
|
|
||||||
];
|
|
||||||
this.properties = avatarProps;
|
|
||||||
this.data = {
|
|
||||||
prefix,
|
|
||||||
classPrefix: name,
|
|
||||||
isShow: true,
|
|
||||||
zIndex: 0,
|
|
||||||
bordered: false,
|
|
||||||
};
|
|
||||||
this.relations = {
|
|
||||||
'../avatar-group/avatar-group': {
|
|
||||||
type: 'ancestor',
|
|
||||||
linked(parent) {
|
|
||||||
var _a;
|
|
||||||
this.parent = parent;
|
|
||||||
this.setData({
|
|
||||||
size: (_a = this.data.size) !== null && _a !== void 0 ? _a : parent.data.size,
|
|
||||||
bordered: true,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
this.observers = {
|
|
||||||
icon(icon) {
|
|
||||||
const obj = setIcon('icon', icon, '');
|
|
||||||
this.setData(Object.assign({}, obj));
|
|
||||||
},
|
|
||||||
};
|
|
||||||
this.methods = {
|
|
||||||
hide() {
|
|
||||||
this.setData({
|
|
||||||
isShow: false,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
updateCascading(zIndex) {
|
|
||||||
this.setData({ zIndex });
|
|
||||||
},
|
|
||||||
onLoadError(e) {
|
|
||||||
if (this.properties.hideOnLoadFailed) {
|
|
||||||
this.setData({
|
|
||||||
isShow: false,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
this.triggerEvent('error', e.detail);
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
};
|
|
||||||
Avatar = __decorate([
|
|
||||||
wxComponent()
|
|
||||||
], Avatar);
|
|
||||||
export default Avatar;
|
|
@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"component": true,
|
|
||||||
"usingComponents": {
|
|
||||||
"t-icon": "../icon/icon",
|
|
||||||
"t-badge": "../badge/badge",
|
|
||||||
"t-image": "../image/image"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,54 +0,0 @@
|
|||||||
<import src="../common/template/icon.wxml" />
|
|
||||||
<wxs src="../common/utils.wxs" module="_" />
|
|
||||||
<wxs src="./avatar.wxs" module="this" />
|
|
||||||
|
|
||||||
<view
|
|
||||||
class="{{classPrefix}}__wrapper class {{prefix}}-class"
|
|
||||||
style="{{_._style([this.getStyles(isShow, zIndex), style, customStyle])}}"
|
|
||||||
>
|
|
||||||
<t-badge
|
|
||||||
color="{{badgeProps.color || ''}}"
|
|
||||||
content="{{badgeProps.content || ''}}"
|
|
||||||
count="{{badgeProps.count || 0}}"
|
|
||||||
dot="{{badgeProps.dot || false}}"
|
|
||||||
max-count="{{badgeProps.maxCount || 99}}"
|
|
||||||
offset="{{badgeProps.offset || []}}"
|
|
||||||
shape="{{badgeProps.shape || 'circle'}}"
|
|
||||||
show-zero="{{badgeProps.showZero || false}}"
|
|
||||||
size="{{badgeProps.size || 'medium'}}"
|
|
||||||
t-class="{{badgeProps.tClass}}"
|
|
||||||
t-class-content="{{badgeProps.tClassContent}}"
|
|
||||||
t-class-count="{{badgeProps.tClassCount}}"
|
|
||||||
>
|
|
||||||
<view
|
|
||||||
class="{{this.getClass(classPrefix, size, shape, bordered)}} {{prefix}}-class-image"
|
|
||||||
style="{{this.getSize(size)}}"
|
|
||||||
aria-label="{{ ariaLabel || alt ||'头像'}}"
|
|
||||||
aria-role="{{ ariaRole || 'img'}}"
|
|
||||||
aria-hidden="{{ ariaHidden }}"
|
|
||||||
>
|
|
||||||
<t-image
|
|
||||||
wx:if="{{image}}"
|
|
||||||
t-class="{{prefix}}-image {{classPrefix}}__image"
|
|
||||||
t-class-load="{{prefix}}-class-alt"
|
|
||||||
style="{{imageProps.style || ''}}"
|
|
||||||
src="{{image}}"
|
|
||||||
mode="{{imageProps.mode || 'aspectFill'}}"
|
|
||||||
lazy="{{imageProps.lazy || false}}"
|
|
||||||
loading="{{imageProps.loading || 'default'}}"
|
|
||||||
shape="{{imageProps.shape || 'round'}}"
|
|
||||||
webp="{{imageProps.webp || false}}"
|
|
||||||
error="{{alt || 'default'}}"
|
|
||||||
bind:error="onLoadError"
|
|
||||||
/>
|
|
||||||
<template
|
|
||||||
wx:elif="{{iconName || _.isNoEmptyObj(iconData)}}"
|
|
||||||
is="icon"
|
|
||||||
data="{{class: classPrefix + '__icon', tClass: prefix + '-class-icon', name: iconName, ...iconData}}"
|
|
||||||
/>
|
|
||||||
<view wx:else class="{{classPrefix}}__text {{prefix}}-class-content">
|
|
||||||
<slot />
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</t-badge>
|
|
||||||
</view>
|
|
@ -1,26 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
getClass: function (classPrefix, size, shape, bordered) {
|
|
||||||
var hasPx = (size || '').indexOf('px') > -1;
|
|
||||||
var borderSize = hasPx ? 'medium' : size;
|
|
||||||
var classNames = [
|
|
||||||
classPrefix,
|
|
||||||
classPrefix + (shape === 'round' ? '--round' : '--circle'),
|
|
||||||
bordered ? classPrefix + '--border' + ' ' + classPrefix + '--border-' + borderSize : '',
|
|
||||||
hasPx ? '' : classPrefix + '--' + size,
|
|
||||||
];
|
|
||||||
return classNames.join(' ');
|
|
||||||
},
|
|
||||||
|
|
||||||
getSize: function (size = 'medium') {
|
|
||||||
var pxIndex = size.indexOf('px');
|
|
||||||
if (pxIndex > -1) {
|
|
||||||
return 'width:' + size + ';height:' + size + ';font-size:' + ((size.slice(0, pxIndex) / 8) * 3 + 2) + 'px;';
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
getStyles: function (isShow, zIndex) {
|
|
||||||
var displayStyle = isShow ? '' : 'display: none;';
|
|
||||||
var zIndexStyle = zIndex ? 'z-index:' + zIndex + ';' : '';
|
|
||||||
return displayStyle + zIndexStyle;
|
|
||||||
},
|
|
||||||
};
|
|
@ -1,104 +0,0 @@
|
|||||||
.t-float-left {
|
|
||||||
float: left;
|
|
||||||
}
|
|
||||||
.t-float-right {
|
|
||||||
float: right;
|
|
||||||
}
|
|
||||||
@keyframes tdesign-fade-out {
|
|
||||||
from {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
to {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.hotspot-expanded.relative {
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
.hotspot-expanded::after {
|
|
||||||
content: '';
|
|
||||||
display: block;
|
|
||||||
position: absolute;
|
|
||||||
left: 0;
|
|
||||||
top: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
transform: scale(1.5);
|
|
||||||
}
|
|
||||||
.t-avatar {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
box-sizing: border-box;
|
|
||||||
background-color: var(--td-avatar-bg-color, var(--td-brand-color-light-active, var(--td-primary-color-2, #d9e1ff)));
|
|
||||||
color: var(--td-avatar-content-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
|
|
||||||
}
|
|
||||||
.t-avatar__wrapper {
|
|
||||||
display: inline-flex;
|
|
||||||
position: relative;
|
|
||||||
vertical-align: top;
|
|
||||||
margin-left: var(--td-avatar-margin-left, 0);
|
|
||||||
}
|
|
||||||
.t-avatar--large {
|
|
||||||
width: var(--td-avatar-large-width, 128rpx);
|
|
||||||
height: var(--td-avatar-large-width, 128rpx);
|
|
||||||
font-size: var(--td-avatar-text-large-font-size, 16px);
|
|
||||||
}
|
|
||||||
.t-avatar--large .t-avatar__icon {
|
|
||||||
font-size: var(--td-avatar-icon-large-font-size, 64rpx);
|
|
||||||
}
|
|
||||||
.t-avatar--medium {
|
|
||||||
width: var(--td-avatar-medium-width, 96rpx);
|
|
||||||
height: var(--td-avatar-medium-width, 96rpx);
|
|
||||||
font-size: var(--td-avatar-text-medium-font-size, var(--td-font-size-base, 28rpx));
|
|
||||||
}
|
|
||||||
.t-avatar--medium .t-avatar__icon {
|
|
||||||
font-size: var(--td-avatar-icon-medium-font-size, 48rpx);
|
|
||||||
}
|
|
||||||
.t-avatar--small {
|
|
||||||
width: var(--td-avatar-small-width, 80rpx);
|
|
||||||
height: var(--td-avatar-small-width, 80rpx);
|
|
||||||
font-size: var(--td-avatar-text-small-font-size, var(--td-font-size-s, 24rpx));
|
|
||||||
}
|
|
||||||
.t-avatar--small .t-avatar__icon {
|
|
||||||
font-size: var(--td-avatar-icon-small-font-size, 40rpx);
|
|
||||||
}
|
|
||||||
.t-avatar .t-image,
|
|
||||||
.t-avatar__image {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
.t-avatar--circle {
|
|
||||||
border-radius: var(--td-avatar-circle-border-radius, var(--td-radius-circle, 50%));
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
.t-avatar--round {
|
|
||||||
border-radius: var(--td-avatar-round-border-radius, var(--td-radius-default, 12rpx));
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
.t-avatar__text,
|
|
||||||
.t-avatar__icon {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
.t-avatar__text:empty,
|
|
||||||
.t-avatar__icon:empty {
|
|
||||||
width: 0;
|
|
||||||
height: 0;
|
|
||||||
}
|
|
||||||
.t-avatar--border {
|
|
||||||
border-color: var(--td-avatar-border-color, #fff);
|
|
||||||
border-style: solid;
|
|
||||||
}
|
|
||||||
.t-avatar--border-small {
|
|
||||||
border-width: var(--td-avatar-border-width-small, 4rpx);
|
|
||||||
}
|
|
||||||
.t-avatar--border-medium {
|
|
||||||
border-width: var(--td-avatar-border-width-medium, 6rpx);
|
|
||||||
}
|
|
||||||
.t-avatar--border-large {
|
|
||||||
border-width: var(--td-avatar-border-width-large, 8rpx);
|
|
||||||
}
|
|