子系统:组件渲染
Methods
(static) aiAddRemove(reference, config) → {*}
「标准」Ux.aiAddRemove
Parameters:
Name | Type | Description |
---|---|---|
reference |
||
config |
Returns:
- Type
- *
(static) aiAnchor(item, onClick, defaultType) → {*}
「标准」Ux.aiAnchor
Parameters:
Name | Type | Default | Description |
---|---|---|---|
item |
|||
onClick |
|||
defaultType |
BUTTON
|
Returns:
- Type
- *
(static) aiBlock(icon, text, key) → {*}
「标准」Ux.aiBlock
Parameters:
Name | Type | Description |
---|---|---|
icon |
||
text |
||
key |
Returns:
- Type
- *
(static) aiBreadcrumb(items, rest, addOn) → {JSX.Element}
「标准」Ux.aiBreadcrumb
面包屑的渲染,使用Ant中的<Breadcrumb/>
元素执行导航渲染
- 外层使用
<Breadcrumb/>
。 - 元素使用
<Breadcrumb.Item/>
。 - 元素内使用
Ux.aiLink
方法渲染链接地址。
Parameters:
Name | Type | Description |
---|---|---|
items |
Array | 每一个链接的配置信息 |
rest |
Object | 根属性对象 |
addOn |
Object | 附加属性,应用于内容层 |
Returns:
- Type
- JSX.Element
(static) aiCell(Element, attrs, text) → {*}
「标准」Ux.aiCell
Parameters:
Name | Type | Description |
---|---|---|
Element |
||
attrs |
||
text |
Returns:
- Type
- *
(static) aiChild()
「标准」Ux.aiChild
(static) aiChildItem(items, reference, Component) → {*}
「标准」Ux.aiChildItem
Parameters:
Name | Type | Description |
---|---|---|
items |
||
reference |
||
Component |
Returns:
- Type
- *
(static) aiChildren(reference, additional) → {*}
「标准」Ux.aiChildren
Parameters:
Name | Type | Description |
---|---|---|
reference |
||
additional |
Returns:
- Type
- *
(static) aiCommand()
「标准」Ux.aiCommand
(static) aiEmpty(size) → {*}
「标准」Ux.aiEmpty
Parameters:
Name | Type | Default | Description |
---|---|---|---|
size |
30
|
Returns:
- Type
- *
(static) aiErrorInput(reference, condition) → {*|boolean}
「标准」Ux.aiErrorInput
Parameters:
Name | Type | Default | Description |
---|---|---|---|
reference |
|||
condition |
true
|
Returns:
- Type
- * | boolean
(static) aiErrorPage(error) → {*}
「标准」Ux.aiErrorPage
Parameters:
Name | Type | Description |
---|---|---|
error |
Returns:
- Type
- *
(static) aiIcon(type, addOn) → {*}
「标准」Ux.aiIcon
针对图标进行处理,类型包含icon和image两种
- 如果type以
img:
开头,则使用<img/>
标签 - 其他情况则使用Ant Design中的
<Icon/>
处理
Parameters:
Name | Type | Description |
---|---|---|
type |
String | 传入的字符串值 |
addOn |
Object | 附加配置 |
Returns:
- Type
- *
(static) aiItemTransfer(item, reference) → {*|string}
「标准」Ux.aiItemTransfer
Parameters:
Name | Type | Description |
---|---|---|
item |
||
reference |
Returns:
- Type
- * | string
(static) aiLink(item, addOn) → {JSX.Element}
「标准」Ux.aiLink
链接渲染专用流程。
1.item的数据结构
{
"uri": "链接地址",
"disabled": "是否禁用该链接",
"className": "Css中对应的className",
"text": "文本数据",
"__uri": (event) => {
// onClick函数,Function
}
}
2. 分流程操作
2.1. 条件矩阵
编号 | uri | disabled | __uri |
---|---|---|---|
A | 无值或EXPAND |
x | x |
B | 有值不为EXPAND |
true | x |
C | 有值不为EXPAND |
false | Function |
D「默认」 | 有值不为EXPAND |
false | 无 |
2.2. 条件流程
条件 | Jsx元素 | 流程说明 |
---|---|---|
A | <span/> |
直接显示文本,不显示链接,<span/> 元素。 |
B | <span/> |
直接显示禁用文本,带ux-disabled 的className,<span/> 元素。 |
C | <a/> |
渲染链接,onClick绑定__uri ,<a/> 元素。 |
D「默认」 | <Link/> |
(react-router)根据item生成to 属性,<Link/> 元素,生成调用aiUrl 函数。 |
3. 额外说明
系统中使用了react-router
,而在addOn
参数中,通常会传入$router
变量(DataRouter)以方便在链接中触发路由事件。
路由中的onClick事件必须执行如下流程:
- 调用
event.preventDefault
(或Ux.prevent
)禁用<a/>
的默认行为。 - 然后调用
Ux.toRoute
来执行链接的跳转(这种做法和直接触发<Link/>
中的to
类似)。
Parameters:
Name | Type | Description |
---|---|---|
item |
Object | 每一个元素的基本配置。 |
addOn |
Object | 附加属性,应用于内容层。 |
Returns:
- Type
- JSX.Element
(static) aiLinkBack(reference, attrs) → {*}
「标准」Ux.aiLinkBack
Parameters:
Name | Type | Description |
---|---|---|
reference |
||
attrs |
Returns:
- Type
- *
(static) aiLinkMore(config, reference) → {*}
「标准」Ux.aiLinkMore
Parameters:
Name | Type | Description |
---|---|---|
config |
||
reference |
Returns:
- Type
- *
(static) aiMenuContext(items, rest) → {*}
「标准」Ux.aiMenuContext
Parameters:
Name | Type | Description |
---|---|---|
items |
||
rest |
Returns:
- Type
- *
(static) aiMenuTop(items, rest, addOn) → {*}
「标准」Ux.aiMenuTop
Parameters:
Name | Type | Description |
---|---|---|
items |
||
rest |
||
addOn |
Returns:
- Type
- *
(static) aiSider(items, rest, addOn) → {*}
「标准」Ux.aiSider
Parameters:
Name | Type | Description |
---|---|---|
items |
||
rest |
||
addOn |
Returns:
- Type
- *
(static) aiTabExtra(reference, config) → {*}
「标准」Ux.aiTabExtra
Parameters:
Name | Type | Description |
---|---|---|
reference |
||
config |
Returns:
- Type
- *
(static) aiTabPage(reference, children) → {*}
「标准」Ux.aiTabPage
Parameters:
Name | Type | Description |
---|---|---|
reference |
||
children |
Returns:
- Type
- *
(static) aiTitle(item, addOn) → {*}
「标准」Ux.aiTitle
Parameters:
Name | Type | Description |
---|---|---|
item |
||
addOn |
Returns:
- Type
- *
(static) aiTopBar(reference, buttons, disabled) → {*}
「标准」Ux.aiTopBar
Parameters:
Name | Type | Description |
---|---|---|
reference |
||
buttons |
||
disabled |
Returns:
- Type
- *
(static) aiTree(item, rest) → {*}
「标准」Ux.aiTree
Parameters:
Name | Type | Description |
---|---|---|
item |
||
rest |
Returns:
- Type
- *
(static) aiUrl(item, addOn) → {String}
「标准」Ux.aiUrl
链接计算专用方法,第二参addOn
中包含了$router
(DataRouter)对象。
1.基本说明
代码逻辑分为两部分:基础路径计算和参数计算。
- 先根据
uri
计算基础路径。 - 再追加特定的参数信息到链接后缀中。
2.基础路径baseUri
uri | 说明 |
---|---|
$MAIN$ | 该值计算该链接路径为Z_ENTRY_ADMIN (环境变量中配置的主界面) |
$SELF$ | 该值会将链接设置成当前页面($router.uri() ) |
其他 | 1)根据/ 符号的结尾符号执行链接规范化。2)根据Z_ROUTE 配置追加应用路径。 |
3.查询参数
- 先计算路径尾部是否包含
?
操作符。 - 维持
mid
和pid
的基础值。
参数名 | 含义 |
---|---|
mid | Menu主键(主菜单参数值) |
pid | Page主键(页面参数值,二级菜单主键) |
此处的
mid
和pid
是为了用户在点击F5
时维持菜单的开合状态而设置,所以在编程过程中避免使用mid
和pid
等参数值。
Parameters:
Name | Type | Description |
---|---|---|
item |
Object | 每一个元素的基本配置。 |
addOn |
Object | 附加属性,应用于内容层。 |
Returns:
跳转链接
- Type
- String
(static) aiViewMy(config, reference) → {*}
「标准」Ux.aiViewMy
Parameters:
Name | Type | Description |
---|---|---|
config |
||
reference |
Returns:
- Type
- *
(static) aiYN(value) → {*|boolean}
「标准」Ux.aiYN
Parameters:
Name | Type | Description |
---|---|---|
value |
Returns:
- Type
- * | boolean