antd-mini
Advanced tools
Comparing version 0.0.19-beta.3 to 0.0.19-beta.4
@@ -8,3 +8,3 @@ "use strict"; | ||
var BadgeDefaultProps = { | ||
placement: 'top-right', | ||
position: 'top-right', | ||
stroke: false, | ||
@@ -11,0 +11,0 @@ type: 'dot', |
@@ -16,5 +16,3 @@ "use strict"; | ||
}, | ||
// 阻止事件冒泡 | ||
emptyEvent: function () { }, | ||
}, | ||
}); |
@@ -23,3 +23,2 @@ "use strict"; | ||
props: props_1.SelectorDefaultProps, | ||
data: {}, | ||
methods: { | ||
@@ -29,6 +28,24 @@ onChange: function (e) { | ||
var _b = e.currentTarget.dataset, disabled = _b.disabled, value = _b.value; | ||
var _c = this.props, multiple = _c.multiple, items = _c.items; | ||
var _c = this.props, multiple = _c.multiple, items = _c.items, maxSelectedCount = _c.maxSelectedCount, minSelectedCount = _c.minSelectedCount, onSelectMax = _c.onSelectMax, onSelectMin = _c.onSelectMin; | ||
if (!disabled && !this.props.disabled) { | ||
var nextValue_1; | ||
var fixedValue = getFixedValue(this.data.cValue, multiple); | ||
if ((fixedValue === null || fixedValue === void 0 ? void 0 : fixedValue.indexOf(value)) === -1) { | ||
if (!isNaN(maxSelectedCount) && | ||
fixedValue.length >= maxSelectedCount) { | ||
if (onSelectMax) { | ||
onSelectMax(value, items.find(function (v) { return v.value === value; })); | ||
} | ||
return; | ||
} | ||
} | ||
else { | ||
if (!isNaN(minSelectedCount) && | ||
fixedValue.length <= minSelectedCount) { | ||
if (onSelectMin) { | ||
onSelectMin(value, items.find(function (v) { return v.value === value; })); | ||
} | ||
return; | ||
} | ||
} | ||
if (multiple) { | ||
@@ -47,3 +64,5 @@ // 之前已经选中,删除它 | ||
var sortValue = function (v) { | ||
return items.map(function (item) { return item.value; }).filter(function (item) { return v.indexOf(item) !== -1; }); | ||
return items | ||
.map(function (item) { return item.value; }) | ||
.filter(function (item) { return v.indexOf(item) !== -1; }); | ||
}; | ||
@@ -50,0 +69,0 @@ nextValue_1 = sortValue(nextValue_1); |
{ | ||
"component": true, | ||
"usingComponents": { | ||
"tap-modal":"../TapModal/index" | ||
} | ||
"usingComponents": {} | ||
} |
@@ -28,3 +28,4 @@ import { IBaseFormItemPropsWithOutFocus } from '../_base'; | ||
export interface ISelectorProps extends IBaseFormItemPropsWithOutFocus<string[]> { | ||
export interface ISelectorProps | ||
extends IBaseFormItemPropsWithOutFocus<string[]> { | ||
/** | ||
@@ -56,3 +57,19 @@ * @description 已选择项, 取 items 每一项的 value | ||
controlled?: boolean; | ||
/** | ||
* @description 最小选择数量 | ||
*/ | ||
minSelectedCount?: number; | ||
/** | ||
* @description 最大选择数量 | ||
*/ | ||
maxSelectedCount?: number; | ||
/** | ||
* @description 触发最大限制 | ||
*/ | ||
onSelectMax(value: string, item: ISelectorItem): void; | ||
/** | ||
* @description 触发最小限制 | ||
*/ | ||
onSelectMin(value: string, item: ISelectorItem): void; | ||
} | ||
export declare const SelectorDefaultProps: Partial<ISelectorProps>; |
{ | ||
"name": "antd-mini", | ||
"version": "0.0.19-beta.3", | ||
"version": "0.0.19-beta.4", | ||
"scripts": { | ||
@@ -5,0 +5,0 @@ "dev": "minidev dev --no-source-map", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
530055
482
9524