起源:值通道
Methods
(static) valueFabric(reference, input, consumer)
「引擎」Ux.valueFabric
解析 fabric 专用事件配置处理器,该函数为后期函数,用于提取字段数据。
第二个参数通常为:
// source,keyField,keyValue
Ux.valueFabric(reference, `room.type,key,${roomTypeId}`, type => {
const standardPrice = type.price;
formValues.discount = Ux.mathDiscount(price, standardPrice);
});
第三参数为回调函数,会将读取到的数据直接传给回调函数来执行,这里执行的是唯一数据,上述示例中,读取的数据为:
- source = room.type 的Assist数据源(一般是一个DataArray)。
- 使用key = 值筛选唯一记录。
- 将唯一记录传给 consumer 函数执行筛选过后的回调流程。
Parameters:
Name | Type | Description |
---|---|---|
reference |
Object | ReactComponent | React对应组件引用。 |
input |
Object | 输入数据。 |
consumer |
function | 执行函数。 |
(static) valueFabrics(reference, input, consumer)
「引擎」Ux.valueFabrics
(略)增强版的valueFabric函数,带过滤器的版本,可支持过滤操作。
Parameters:
Name | Type | Description |
---|---|---|
reference |
Object | ReactComponent | React对应组件引用。 |
input |
Object | 输入数据。 |
consumer |
function | 执行函数。 |
(static) valueLimit(jsx) → {Object}
「标准」Ux.valueLimit
Zero UI 中用于计算自定义组件中的继承属性,移除原生态的 Ant Design 中不支持的特殊属性
- fnOut:Redux架构下写状态树的专用函数,可统一写。
- reference:React Component 组件引用。
- config:自定义控件传入的基本配置信息(大部分组件中的配置都是使用 config)。
框架中的代码如:
// 根据Filter计算双重数据源
const from = Op.getFrom(this, config, fromTable);
const to = Op.getTo(this, config, toTable);
// 处理InputGroup中的jsx
const attrs = Ux.valueLimit(jsx);
const $attrs = Ux.clone(attrs);
return (
<Input.Group {...$attrs} className={"ux_table-transfer"}>
<Table {...fromTable} dataSource={from}/>
<Filter config={config} reference={this}/>
<Table {...toTable} dataSource={to}/>
</Input.Group>
);
Parameters:
Name | Type | Description |
---|---|---|
jsx |
Object | 处理React中的jsx继承属性专用 |
Returns:
返回最终将要继承的属性信息
- Type
- Object
(static) valueQr(input, reference) → {Object}
「引擎」 Ux.valueQr
基本介绍
用于标准化 qr 语法的专用函数,其中标准化包括:
- 直接移除
__DELETE__
部分的数据,去掉删除条件值 - 针对带有解析表达式的属性,执行
parseValue
配合 reference 执行数据源解析得到真实值
此方法可以在任何地方直接标准化查询条件,让查询条件配合最终值变得合法
Parameters:
Name | Type | Description |
---|---|---|
input |
Object | 传入的没有处理的 Qr |
reference |
ReactComponent | React对应组件引用。 |
Returns:
返回最终结果
- Type
- Object