提交
This commit is contained in:
44
甲情_甲意/miniprogram/node_modules/antd-mini/less/Selector/index.axml
generated
vendored
Normal file
44
甲情_甲意/miniprogram/node_modules/antd-mini/less/Selector/index.axml
generated
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
<import-sjs
|
||||
from="./index.sjs"
|
||||
name="util"
|
||||
></import-sjs>
|
||||
<view
|
||||
class="ant-selector {{className ? className : ''}} {{disabled ? 'ant-selector-disabled' : ''}}"
|
||||
style="{{style}}"
|
||||
>
|
||||
<view class="ant-selector-content-container">
|
||||
<block
|
||||
a:for="{{options}}"
|
||||
a:for-index="index"
|
||||
a:for-item="item"
|
||||
>
|
||||
<view class="ant-selector-content {{options.length <= 2 ? 'ant-selector-content-item2' : ''}}">
|
||||
<view
|
||||
class="ant-selector-item {{item.disabled ? 'ant-selector-item-disabled' : ''}} {{util.getChecked(item.value, mixin.value, multiple) ? 'ant-selector-item-active ' + (activeItemClassName || '') : ''}}"
|
||||
style="{{util.getChecked(item.value, mixin.value, multiple) ? activeItemStyle || '' : ''}}"
|
||||
data-value="{{item.value}}"
|
||||
data-disabled="{{item.disabled}}"
|
||||
onTap="onChange"
|
||||
>
|
||||
<view
|
||||
a:if="{{item.text}}"
|
||||
class="ant-selector-item-text"
|
||||
>
|
||||
{{item.text}}
|
||||
</view>
|
||||
<view
|
||||
a:if="{{item.subText}}"
|
||||
class="ant-selector-item-subtext"
|
||||
>
|
||||
{{item.subText}}
|
||||
</view>
|
||||
<view
|
||||
a:if="{{util.getChecked(item.value, mixin.value, multiple)}}"
|
||||
class="ant-selector-item-badge-active"
|
||||
></view>
|
||||
<slot item="{{item}}"></slot>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
1
甲情_甲意/miniprogram/node_modules/antd-mini/less/Selector/index.d.ts
generated
vendored
Normal file
1
甲情_甲意/miniprogram/node_modules/antd-mini/less/Selector/index.d.ts
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
export {};
|
63
甲情_甲意/miniprogram/node_modules/antd-mini/less/Selector/index.js
generated
vendored
Normal file
63
甲情_甲意/miniprogram/node_modules/antd-mini/less/Selector/index.js
generated
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
import { __spreadArray } from "tslib";
|
||||
import { Component, triggerEventValues, getValueFromProps, } from '../_util/simply';
|
||||
import { SelectorDefaultProps } from './props';
|
||||
import mixinValue from '../mixins/value';
|
||||
Component(SelectorDefaultProps, {
|
||||
onChange: function (e) {
|
||||
var _a = e.currentTarget.dataset, disabled = _a.disabled, value = _a.value;
|
||||
var _b = getValueFromProps(this, [
|
||||
'multiple',
|
||||
'options',
|
||||
'maxSelectedCount',
|
||||
'minSelectedCount',
|
||||
'disabled',
|
||||
]), multiple = _b[0], options = _b[1], maxSelectedCount = _b[2], minSelectedCount = _b[3], disabledFromProps = _b[4];
|
||||
if (disabled || disabledFromProps) {
|
||||
return;
|
||||
}
|
||||
if (multiple) {
|
||||
var currentValue_1 = this.getValue() || [];
|
||||
if (currentValue_1.indexOf(value) > -1) {
|
||||
if (typeof minSelectedCount === 'number' &&
|
||||
currentValue_1.length <= minSelectedCount) {
|
||||
triggerEventValues(this, 'selectMin', [value, options.find(function (v) { return v.value === value; })], e);
|
||||
return;
|
||||
}
|
||||
currentValue_1 = currentValue_1.filter(function (v) { return v !== value; });
|
||||
}
|
||||
else {
|
||||
if (typeof maxSelectedCount === 'number' &&
|
||||
currentValue_1.length >= maxSelectedCount) {
|
||||
triggerEventValues(this, 'selectMax', [value, options.find(function (v) { return v.value === value; })], e);
|
||||
return;
|
||||
}
|
||||
currentValue_1 = __spreadArray(__spreadArray([], currentValue_1, true), [value], false);
|
||||
}
|
||||
if (!this.isControlled()) {
|
||||
this.update(currentValue_1);
|
||||
}
|
||||
triggerEventValues(this, 'change', [
|
||||
currentValue_1,
|
||||
options.filter(function (v) { return currentValue_1.indexOf(v.value) > -1; }),
|
||||
], e);
|
||||
}
|
||||
else {
|
||||
if (value === this.getValue()) {
|
||||
if (minSelectedCount === 1) {
|
||||
triggerEventValues(this, 'selectMin', [value, options.find(function (v) { return v.value === value; })], e);
|
||||
return;
|
||||
}
|
||||
if (!this.isControlled()) {
|
||||
this.update(undefined);
|
||||
}
|
||||
triggerEventValues(this, 'change', [undefined, undefined], e);
|
||||
}
|
||||
else {
|
||||
if (!this.isControlled()) {
|
||||
this.update(value);
|
||||
}
|
||||
triggerEventValues(this, 'change', [value, options.find(function (v) { return v.value === value; })], e);
|
||||
}
|
||||
}
|
||||
},
|
||||
}, null, [mixinValue()]);
|
4
甲情_甲意/miniprogram/node_modules/antd-mini/less/Selector/index.json
generated
vendored
Normal file
4
甲情_甲意/miniprogram/node_modules/antd-mini/less/Selector/index.json
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
89
甲情_甲意/miniprogram/node_modules/antd-mini/less/Selector/index.less
generated
vendored
Normal file
89
甲情_甲意/miniprogram/node_modules/antd-mini/less/Selector/index.less
generated
vendored
Normal file
@ -0,0 +1,89 @@
|
||||
@import (reference) './variable.less';
|
||||
|
||||
@selectorPrefix: ant-selector;
|
||||
|
||||
.@{selectorPrefix} {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
// padding: calc(@selector-collapse / 2);
|
||||
background-color: @selector-background-color;
|
||||
line-height: @selector-line-height;
|
||||
|
||||
&-disabled .ant-selector-content {
|
||||
opacity: 0.6;
|
||||
|
||||
.@{selectorPrefix}-item-disabled {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
&-content {
|
||||
display: flex;
|
||||
flex: 0 33.3333%;
|
||||
padding: calc(@selector-collapse / 2);
|
||||
box-sizing: border-box;
|
||||
|
||||
&-item2 {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
&-container {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.ant-tap-modal-mask {
|
||||
width: calc(100% - 24 * @rpx);
|
||||
height: calc(100% - 24 * @rpx);
|
||||
margin: 12 * @rpx 0 0 12 * @rpx;
|
||||
}
|
||||
}
|
||||
|
||||
&-item {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
justify-content: flex-start;
|
||||
overflow: hidden;
|
||||
padding: calc(@selector-collapse / 2) calc(@selector-collapse / 4);
|
||||
text-align: center;
|
||||
background-color: @selector-item-background;
|
||||
border-radius: @corner-radius-md;
|
||||
|
||||
&-active {
|
||||
background-color: @selector-item-active-background;
|
||||
|
||||
.@{selectorPrefix}-item-text {
|
||||
color: @COLOR_BRAND1;
|
||||
}
|
||||
}
|
||||
|
||||
&-disabled {
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
&-text {
|
||||
font-size: @selector-item-size;
|
||||
color: @selector-item-color;
|
||||
}
|
||||
|
||||
&-subtext {
|
||||
font-size: @selector-item-sub-size;
|
||||
color: @selector-item-sub-color;
|
||||
}
|
||||
|
||||
&-badge-active {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACYAAAAfCAYAAAH8T49dAAAAAXNSR0IArs4c6QAAA7JJREFUWAnNV1tIlEEU/lYrzRClaHdd14jMlEwKBEGolwKhnqIICiKE6ikKhMRdk1ikwCx86KECoYKgsIuVUBT4FBQEUm9dpB4iKrSLouWau+7pnP2d/S/+e/fSPOxczne++ebM+WdngFSKs4XIhJMBKdFBl4/61MAspHJzqIbUjBrlqig2aHTLmUHQUIe0tBJDqgFr7fZRY4RwLS7QOIU4m4BrA+SeCOKbYpWpXT6tFwVavRVw7muZyaTNOoWSYgtyn6K6SBgvlVM0mKojNW/WWwWoLdMsJpDQ88ZWiUkA1w9poNh0av4aD3DnCBCaBmrOzoCqA7TsexB/ta79b4zJ3pzaaGmAvKEgPmdF5vTRUxAa1JRpk3He5HPeBBWBsU6ZjFV0sopmo7O1nZSMdyXMTrlWR9nCx8eA4XF9l5ZYQdLnxDjA+35T2eQTGJkAqtq1PFAk6rNQOJMyVwv95ENhpTIaa8mX/hNmJUa7tB2lrbSFE+q11bCofQ6N37TMTNUw0QDHuDZrMo7zJMc5T4RkTMbJW8zJO2JcjekoMBoStd1+2mUlEnzaZByfG5EIHtlNltYy+Wv4wiSccfYlJbJAgHIuBcHHW+KSdJneNqqIR/QhAPQe1SdISMbxaZoKYVCH6y0hKswHfA/1sbjLZKIXnIj1OlRvKaJtXcDgsD5uq4wTcUIRbS4F5NSoLtGc4hGJ1aSs8hwVjvzCmD6X1np/GiguAMYntaVZFSl8TJmrlXbYEQmwsh0Y5fNMYhSPSHBRZRyfbl4W/7tlVxwcn0/8oa7JjkbzNsVsLgiz4fB20fLQEK7y4vb/F8KcfqpHBL28KLda2KIJ23ebcp+9wnnOoSYlxlgvuDCPn6rCEfSxiAqjEGt7wYTxfb05AnTwxSf2+VrFGPvzKqwsQJ6pIO5zMtcZJ02lPS/C+P/roMMBOYP4uMqszJmwdS1U9Bu4xTJ2pirFUwRs3wA8eQP8+GP2ylqYx0cNYUIP0xabqeP35B7cc1g7/gX1/COwp9uMz0jY+ouUN/YVVziRG810iXtWQXJB38uCjH+5iiEtYSU+qp0mPGBnryJQtZ+fOuWrgQv9wLshNarV6QhSnkmFyR3q8iTOcCL7lZO1LlgKDPiAVSs0i7w6JBL5/E4xblmiCFk54wora6PyqTD6WNBGq1O8vrxc7vJdQO4ixpKOIOU3SxjfEI7zg7+L88f2XaYcE9WbWGDnboBPeJzkf0C7HErkL7aoMFeAnBTEPe5vTeawUPZ/WGpTpu45f4MAAAAASUVORK5CYII=')
|
||||
right bottom no-repeat;
|
||||
background-size: 19px 15px;
|
||||
}
|
||||
}
|
||||
}
|
9
甲情_甲意/miniprogram/node_modules/antd-mini/less/Selector/index.sjs
generated
vendored
Normal file
9
甲情_甲意/miniprogram/node_modules/antd-mini/less/Selector/index.sjs
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
function getChecked(value, values, multiple) {
|
||||
if (!multiple) {
|
||||
return value === values;
|
||||
}
|
||||
return (values || []).indexOf(value) > -1;
|
||||
}
|
||||
export default {
|
||||
getChecked: getChecked
|
||||
};
|
69
甲情_甲意/miniprogram/node_modules/antd-mini/less/Selector/props.d.ts
generated
vendored
Normal file
69
甲情_甲意/miniprogram/node_modules/antd-mini/less/Selector/props.d.ts
generated
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
import { IBaseProps } from '../_util/base';
|
||||
export type Value = string | number;
|
||||
export interface ISelectorItem {
|
||||
/**
|
||||
* @description 主文案
|
||||
*/
|
||||
text: string;
|
||||
/**
|
||||
* @description 选项值,在同一个 Selector 中唯一
|
||||
*/
|
||||
value: Value;
|
||||
/**
|
||||
* @description 辅助文案
|
||||
*/
|
||||
subText?: string;
|
||||
/**
|
||||
* @description 单个禁用
|
||||
*/
|
||||
disabled?: boolean;
|
||||
}
|
||||
/**
|
||||
* @description 筛选器,可供用户进行单选或者多选。
|
||||
*/
|
||||
export interface ISelectorProps extends IBaseProps {
|
||||
/**
|
||||
* @description 已选择项, 取 items 每一项的 value
|
||||
*/
|
||||
value: Value | Value[];
|
||||
/**
|
||||
* @description 默认选择项, 取 items 每一项的 value
|
||||
*/
|
||||
defaultValue: Value | Value[];
|
||||
/**
|
||||
* @description 可选项
|
||||
*/
|
||||
options: ISelectorItem[];
|
||||
/**
|
||||
* @description 每一项激活时新加类名
|
||||
*/
|
||||
activeItemClassName: string;
|
||||
/**
|
||||
* @description 每一项激活时样式
|
||||
*/
|
||||
activeItemStyle: string;
|
||||
/**
|
||||
* @description 是否允许多选
|
||||
* @default false
|
||||
*/
|
||||
multiple: boolean;
|
||||
/**
|
||||
* @description 最小选择数量
|
||||
*/
|
||||
minSelectedCount: number;
|
||||
/**
|
||||
* @description 最大选择数量
|
||||
*/
|
||||
maxSelectedCount: number;
|
||||
disabled?: boolean;
|
||||
onChange?(value: Value | Value[] | undefined, item: ISelectorItem | ISelectorItem[] | undefined, e: Record<string, any>): void;
|
||||
/**
|
||||
* @description 触发最大限制
|
||||
*/
|
||||
onSelectMax?(value: Value, item: ISelectorItem, e: Record<string, any>): void;
|
||||
/**
|
||||
* @description 触发最小限制
|
||||
*/
|
||||
onSelectMin?(value: Value, item: ISelectorItem, e: Record<string, any>): void;
|
||||
}
|
||||
export declare const SelectorDefaultProps: Partial<ISelectorProps>;
|
11
甲情_甲意/miniprogram/node_modules/antd-mini/less/Selector/props.js
generated
vendored
Normal file
11
甲情_甲意/miniprogram/node_modules/antd-mini/less/Selector/props.js
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
export var SelectorDefaultProps = {
|
||||
value: null,
|
||||
defaultValue: null,
|
||||
options: null,
|
||||
activeItemClassName: '',
|
||||
activeItemStyle: '',
|
||||
multiple: false,
|
||||
minSelectedCount: null,
|
||||
maxSelectedCount: null,
|
||||
disabled: false,
|
||||
};
|
19
甲情_甲意/miniprogram/node_modules/antd-mini/less/Selector/variable.less
generated
vendored
Normal file
19
甲情_甲意/miniprogram/node_modules/antd-mini/less/Selector/variable.less
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
@import (reference) '../style/themes/index.less';
|
||||
|
||||
// 间隔
|
||||
@selector-collapse: @h-spacing-large;
|
||||
// 背景
|
||||
@selector-background-color: @COLOR_CARD;
|
||||
// 选项背景
|
||||
@selector-item-background: @COLOR_GREY_CARD;
|
||||
// 选项激活背景
|
||||
@selector-item-active-background: @COLOR_WATHET;
|
||||
// 未选中选项字体颜色
|
||||
@selector-item-color: @COLOR_TEXT_PRIMARY;
|
||||
@selector-line-height: 1.4;
|
||||
// 选项字体大小
|
||||
@selector-item-size: @font-size-subtitle;
|
||||
// 副文案颜色
|
||||
@selector-item-sub-color: @COLOR_TEXT_ASSIST;
|
||||
// 副文案大小
|
||||
@selector-item-sub-size: @font-size-content;
|
Reference in New Issue
Block a user