antd-mini-rpx
Advanced tools
Comparing version 0.0.7 to 0.0.8
@@ -23,3 +23,4 @@ "use strict"; | ||
var _this = this; | ||
var _a = this.props, uid = _a.uid, name = _a.name, disabled = _a.disabled, expandIcon = _a.expandIcon, closeIcon = _a.closeIcon; | ||
var _a = this.props, name = _a.name, disabled = _a.disabled, expandIcon = _a.expandIcon, closeIcon = _a.closeIcon; | ||
var key = "".concat(this.$page.$id, "-").concat(this.props.uid); | ||
if (typeof name !== 'string') { | ||
@@ -45,3 +46,3 @@ console_1.log.error('CollapseItem', 'name 作为唯一的标识,属必填字段,类型为 string。'); | ||
var getDisabled = function () { return _this.props.disabled; }; | ||
context_1.context.addItem(uid, "".concat(this.$id), { | ||
context_1.context.addItem(key, "".concat(this.$id), { | ||
setActive: setActive, | ||
@@ -61,3 +62,3 @@ setAccordion: setAccordion, | ||
try { | ||
context_1.context.updateItemValue(uid, "".concat(this.$id)); | ||
context_1.context.updateItemValue(key, "".concat(this.$id)); | ||
// eslint-disable-next-line no-empty | ||
@@ -68,3 +69,4 @@ } | ||
didUnmount: function () { | ||
context_1.context.removeItem(this.props.uid, "".concat(this.$id)); | ||
var key = "".concat(this.$page.$id, "-").concat(this.props.uid); | ||
context_1.context.removeItem(key, "".concat(this.$id)); | ||
}, | ||
@@ -93,8 +95,9 @@ didUpdate: function (prevProps) { | ||
return; | ||
var key = "".concat(this.$page.$id, "-").concat(this.props.uid); | ||
if (this.data.supportSjs) { | ||
// for 2.0 | ||
context_1.context.triggerItem(this.props.uid, "".concat(this.$id), !this.data._isActive); | ||
context_1.context.triggerItem(key, "".concat(this.$id), !this.data._isActive); | ||
return; | ||
} | ||
var group = context_1.context.getGroup(this.props.uid); | ||
var group = context_1.context.getGroup(key); | ||
if (group) { | ||
@@ -193,3 +196,4 @@ var accordion = group ? group.getGroupPropsVal('accordion') : false; | ||
}, function () { | ||
context_1.context.onChangeByTrigger(_this.props.uid); | ||
var key = "".concat(_this.$page.$id, "-").concat(_this.props.uid); | ||
context_1.context.onChangeByTrigger(key); | ||
}); | ||
@@ -207,3 +211,4 @@ }, 10); | ||
}, function () { | ||
context_1.context.onChangeByTrigger(_this.props.uid); | ||
var key = "".concat(_this.$page.$id, "-").concat(_this.props.uid); | ||
context_1.context.onChangeByTrigger(key); | ||
}); | ||
@@ -210,0 +215,0 @@ }); |
@@ -1,2 +0,1 @@ | ||
import { IBaseProps } from '../../_base'; | ||
@@ -11,3 +10,3 @@ /** | ||
*/ | ||
icon?:string; | ||
icon?: string; | ||
/** | ||
@@ -37,3 +36,8 @@ * @description 标题栏内容 | ||
closeIcon: string; | ||
/** | ||
* @description 当页面有多个Collapse时需传入,页面唯一,与外部的 Collapse 组件的 uid 一致 | ||
* @default 'Collapse' | ||
*/ | ||
uid?: string; | ||
} | ||
export declare const CollapseItemDefaultProps: Partial<ICollapseItemProps>; |
@@ -14,3 +14,4 @@ "use strict"; | ||
var _this = this; | ||
var _a = this.props, uid = _a.uid, name = _a.name; | ||
var name = this.props.name; | ||
var key = "".concat(this.$page.$id, "-").concat(this.props.uid); | ||
var getGroupPropsVal = function (key) { | ||
@@ -32,11 +33,12 @@ switch (key) { | ||
}; | ||
context_1.context.addGroup(uid); | ||
context_1.context.setGroupPropsVal(uid, getGroupPropsVal); | ||
context_1.context.setItemsAccordion(uid); | ||
context_1.context.addGroup(key); | ||
context_1.context.setGroupPropsVal(key, getGroupPropsVal); | ||
context_1.context.setItemsAccordion(key); | ||
if (Array.isArray(name)) { | ||
context_1.context.updateGroupValue(uid, true); | ||
context_1.context.updateGroupValue(key, true); | ||
} | ||
}, | ||
didUnmount: function () { | ||
context_1.context.removeGroup(this.props.uid); | ||
var key = "".concat(this.$page.$id, "-").concat(this.props.uid); | ||
context_1.context.removeGroup(key); | ||
}, | ||
@@ -46,8 +48,10 @@ didUpdate: function (prevProps) { | ||
var oldUID = prevProps.uid, _d = prevProps.name, oldName = _d === void 0 ? [] : _d, _e = prevProps.accordion, oldAccordion = _e === void 0 ? false : _e; | ||
var newKey = "".concat(this.$page.$id, "-").concat(newUID); | ||
var oldKey = "".concat(this.$page.$id, "-").concat(oldUID); | ||
context_1.context.updateGroup(newUID, { | ||
isNameChanged: !(0, fast_deep_equal_1.default)(newName, oldName), | ||
isUIDChanged: newUID !== oldUID, | ||
isUIDChanged: newKey !== oldKey, | ||
isAccordionChanged: newAccordion !== oldAccordion, | ||
}, { oldUID: oldUID }); | ||
}, { oldUID: oldKey }); | ||
}, | ||
}); |
@@ -7,3 +7,2 @@ import { IBaseProps } from '../_base'; | ||
export interface ICollapseProps extends IBaseProps { | ||
uid?: string; | ||
/** | ||
@@ -24,3 +23,8 @@ * @description 当前激活的索引 | ||
accordion?: boolean; | ||
/** | ||
* @description 当页面有多个Collapse时需传入,页面唯一,与内部的 CollapseItem 组件的 uid 一致 | ||
* @default 'Collapse' | ||
*/ | ||
uid?: string; | ||
} | ||
export declare const CollapseDefaultProps: Partial<ICollapseProps>; |
@@ -15,2 +15,3 @@ "use strict"; | ||
var _this = this; | ||
var key = "".concat(this.$page.$id, "-").concat(this.props.uid); | ||
var getValue = function () { return _this.props.value; }; | ||
@@ -21,5 +22,11 @@ var isMult = function () { return _this.props.type === 'multiple'; }; | ||
}); }; | ||
var setShow = function (show) { return _this.setData({ | ||
show: show, | ||
}); }; | ||
var setShow = function (show) { | ||
var onOpen = _this.props.onOpen; | ||
_this.setData({ | ||
show: show, | ||
}); | ||
if (show && onOpen) { | ||
onOpen(); | ||
} | ||
}; | ||
var getShow = function () { return _this.data.show; }; | ||
@@ -32,4 +39,4 @@ var setPrevValue = function (prevValue) { return _this.setData({ | ||
var getid = function () { return "".concat(_this.$id); }; | ||
context_1.context.addItem(this.props.uid, "".concat(this.$id), { isMult: isMult, getValue: getValue, setValue: setValue, getPlaceHolder: getPlaceHolder, setShow: setShow, getid: getid, getShow: getShow, setPrevValue: setPrevValue, getCurValue: getCurValue }); | ||
context_1.context.updateItemValue(this.props.uid, "".concat(this.$id)); | ||
context_1.context.addItem(key, "".concat(this.$id), { isMult: isMult, getValue: getValue, setValue: setValue, getPlaceHolder: getPlaceHolder, setShow: setShow, getid: getid, getShow: getShow, setPrevValue: setPrevValue, getCurValue: getCurValue }); | ||
context_1.context.updateItemValue(key, "".concat(this.$id)); | ||
this.setData({ | ||
@@ -63,2 +70,3 @@ curValue: getValue(), | ||
} | ||
var key = "".concat(this.$page.$id, "-").concat(this.props.uid); | ||
this.setData({ | ||
@@ -73,3 +81,3 @@ show: false, | ||
// 更改占位符 | ||
var group = context_1.context.getGroup(this.props.uid); | ||
var group = context_1.context.getGroup(key); | ||
if (group) { | ||
@@ -95,3 +103,4 @@ var placeHolderArray = group.getGroupDataVal(); | ||
resetArrow: function () { | ||
var group = context_1.context.getGroup(this.props.uid); | ||
var key = "".concat(this.$page.$id, "-").concat(this.props.uid); | ||
var group = context_1.context.getGroup(key); | ||
if (group) { | ||
@@ -108,3 +117,4 @@ group.setGroupDataVal({ key: 'currentFilterItemId', val: '' }); | ||
var _a; | ||
var group = context_1.context.getGroup(this.props.uid); | ||
var key = "".concat(this.$page.$id, "-").concat(this.props.uid); | ||
var group = context_1.context.getGroup(key); | ||
if (group) { | ||
@@ -111,0 +121,0 @@ var val = (_a = {}, _a[this.$id] = active, _a); |
@@ -41,3 +41,8 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ | ||
onFormat?: (v: any) => string; | ||
/** | ||
* @description 当页面有多个Filter时需传入,页面唯一,与外部的Filter组件的 uid 一致 | ||
* @default 'filter' | ||
*/ | ||
uid?: string; | ||
} | ||
export declare const FilterItemDefaultProps: Partial<IFilterItemProps>; |
@@ -17,2 +17,3 @@ "use strict"; | ||
var _this = this; | ||
var key = "".concat(this.$page.$id, "-").concat(this.props.uid); | ||
var setGroupDataVal = function (val) { | ||
@@ -40,11 +41,16 @@ switch (val.key) { | ||
var getGroupDataVal = function () { return _this.data.placeHolderObj; }; | ||
context_1.context.addGroup(this.props.uid); | ||
context_1.context.setGroupDataVal(this.props.uid, setGroupDataVal); | ||
context_1.context.getGroupDataVal(this.props.uid, getGroupDataVal); | ||
context_1.context.updateGroupValue(this.props.uid); | ||
context_1.context.addGroup(key); | ||
context_1.context.setGroupDataVal(key, setGroupDataVal); | ||
context_1.context.getGroupDataVal(key, getGroupDataVal); | ||
context_1.context.updateGroupValue(key); | ||
}, | ||
didUnmount: function () { | ||
var key = "".concat(this.$page.$id, "-").concat(this.props.uid); | ||
context_1.context.removeGroup(key); | ||
}, | ||
methods: { | ||
showFilterItem: function (e) { | ||
var _this = this; | ||
var group = context_1.context.getGroup(this.props.uid); | ||
var key = "".concat(this.$page.$id, "-").concat(this.props.uid); | ||
var group = context_1.context.getGroup(key); | ||
if (group) { | ||
@@ -51,0 +57,0 @@ (0, tools_1.objectEntries)(group.items).forEach(function (_a) { |
@@ -6,3 +6,9 @@ import { IBaseProps } from '../_base'; | ||
export type IFilterProps = IBaseProps | ||
export interface IFilterProps extends IBaseProps { | ||
/** | ||
* @description 当页面有多个Filter时需传入,页面唯一,与内部的 FilterItem 组件的 uid 一致 | ||
* @default 'filter' | ||
*/ | ||
uid?: string; | ||
} | ||
export declare const FilterDefaultProps: Partial<IFilterProps>; |
@@ -14,3 +14,4 @@ "use strict"; | ||
didUnmount: function () { | ||
context_1.context.removeGroup(this.props.uid); | ||
var key = "".concat(this.$page.$id, "-").concat(this.props.uid); | ||
context_1.context.removeGroup(key); | ||
}, | ||
@@ -20,6 +21,7 @@ methods: { | ||
var _a = this.props, index = _a.index, direction = _a.direction, uid = _a.uid; | ||
context_1.context.updateItemIndex(uid, index); | ||
context_1.context.updateItemDirection(uid, direction); | ||
var key = "".concat(this.$page.$id, "-").concat(uid); | ||
context_1.context.updateItemIndex(key, index); | ||
context_1.context.updateItemDirection(key, direction); | ||
}, | ||
}, | ||
}); |
@@ -18,3 +18,8 @@ import { IBaseProps } from '../_base'; | ||
direction?: 'horizontal' | 'vertical'; | ||
/** | ||
* @description 当页面有多个Steps时需传入,页面唯一,与内部的 StepItem 组件的 uid 一致 | ||
* @default 'steps' | ||
*/ | ||
uid?: string; | ||
} | ||
export declare const StepsDefaultProps: Partial<IStepsProps>; |
@@ -14,2 +14,3 @@ "use strict"; | ||
var uid = this.props.uid; | ||
var key = "".concat(this.$page.$id, "-").concat(uid); | ||
var setItemIndex = function (index) { return _this.setData({ | ||
@@ -21,3 +22,3 @@ _index: index, | ||
}); }; | ||
context_1.context.addItem(uid, "".concat(this.$id), { | ||
context_1.context.addItem(key, "".concat(this.$id), { | ||
setItemIndex: setItemIndex, | ||
@@ -28,5 +29,6 @@ setItemDirection: setItemDirection, | ||
didUnmount: function () { | ||
context_1.context.removeItem(this.props.uid, "".concat(this.$id)); | ||
var key = "".concat(this.$page.$id, "-").concat(this.props.uid); | ||
context_1.context.removeItem(key, "".concat(this.$id)); | ||
}, | ||
methods: {}, | ||
}); |
@@ -1,2 +0,1 @@ | ||
import { IBaseProps, IconType } from '../../_base'; | ||
@@ -37,3 +36,8 @@ /** | ||
index: number; | ||
/** | ||
* @description 当页面有多个Steps时需传入,页面唯一,与外部的 Steps 组件的 uid 一致 | ||
* @default 'steps' | ||
*/ | ||
uid?: string; | ||
} | ||
export declare const StepItemDefaultProps: Partial<IStepItemProps>; |
@@ -37,3 +37,4 @@ "use strict"; | ||
var setGroupDataVal = function () { | ||
var group = tabsStore_1.tabsStore.getGroup(_this.props.uid); | ||
var key = "".concat(_this.$page.$id, "-").concat(_this.props.uid); | ||
var group = tabsStore_1.tabsStore.getGroup(key); | ||
if (group) { | ||
@@ -50,3 +51,4 @@ var items = (0, tools_1.objectValues)(group.items).reduce(function (prev, cur) { | ||
}; | ||
tabsStore_1.tabsStore.setGroupDataVal(this.props.uid, function () { return setTimeout(setGroupDataVal, 50); }); | ||
var key = "".concat(this.$page.$id, "-").concat(this.props.uid); | ||
tabsStore_1.tabsStore.setGroupDataVal(key, function () { return setTimeout(setGroupDataVal, 50); }); | ||
setGroupDataVal(); | ||
@@ -148,7 +150,9 @@ this.updateTabsItemFallbackVal(this.props.fallback); | ||
didUnmount: function () { | ||
tabsStore_1.tabsStore.removeGroup(this.props.uid); | ||
var key = "".concat(this.$page.$id, "-").concat(this.props.uid); | ||
tabsStore_1.tabsStore.removeGroup(key); | ||
}, | ||
methods: { | ||
updateTabsItemFallbackVal: function (v) { | ||
var group = tabsStore_1.tabsStore.getGroup(this.props.uid); | ||
var key = "".concat(this.$page.$id, "-").concat(this.props.uid); | ||
var group = tabsStore_1.tabsStore.getGroup(key); | ||
if (group) { | ||
@@ -155,0 +159,0 @@ (0, tools_1.objectValues)(group.items).forEach(function (item) { |
@@ -17,7 +17,7 @@ "use strict"; | ||
// 更新 fallback 值 | ||
console.log(this.props.tab); | ||
var key = "".concat(this.$page.$id, "-").concat(this.props.uid); | ||
var setFallback = function (v) { return _this.setData({ fallback: v }); }; | ||
// 注册 item | ||
var getTabsItemVal = function () { return _this.props.tab; }; | ||
tabsStore_1.tabsStore.addItem(this.props.uid, "".concat(this.$id), { setFallback: setFallback, getTabsItemVal: getTabsItemVal }); | ||
tabsStore_1.tabsStore.addItem(key, "".concat(this.$id), { setFallback: setFallback, getTabsItemVal: getTabsItemVal }); | ||
// 更新视图 | ||
@@ -32,4 +32,4 @@ // console.log(tabsStore) | ||
didUnmount: function () { | ||
tabsStore_1.tabsStore.removeItem(this.props.uid, "".concat(this.$id)); | ||
console.log(tabsStore_1.tabsStore); | ||
var key = "".concat(this.$page.$id, "-").concat(this.props.uid); | ||
tabsStore_1.tabsStore.removeItem(key, "".concat(this.$id)); | ||
}, | ||
@@ -47,3 +47,4 @@ methods: { | ||
update: function () { | ||
var group = tabsStore_1.tabsStore.getGroup(this.props.uid); | ||
var key = "".concat(this.$page.$id, "-").concat(this.props.uid); | ||
var group = tabsStore_1.tabsStore.getGroup(key); | ||
if (group && group.setGroupDataVal) | ||
@@ -50,0 +51,0 @@ group.setGroupDataVal(); |
{ | ||
"name": "antd-mini-rpx", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"scripts": { | ||
@@ -5,0 +5,0 @@ "dev": "minidev dev --less --typescript --no-source-map", |
356560
6397