交互接口:转换函数
Methods
(static) toCss(name) → {string}
「标准」Ux.toCss
执行CSS前缀的注入流程,根据环境变量中配置的Z_CSS_PREFIX
来追加CSS类名的前缀。
Parameters:
Name | Type | Description |
---|---|---|
name |
String | 当前类名称。 |
Returns:
返回带前缀的 css 类名。
- Type
- string
(static) toCssA(callback) → {*}
「标准」Ux.toCssA
Parameters:
Name | Type | Description |
---|---|---|
callback |
Returns:
- Type
- *
(static) toCssLogo(reference) → {*}
「标准」Ux.toCssLogo
Parameters:
Name | Type | Description |
---|---|---|
reference |
Returns:
- Type
- *
(static) toGrid(config) → {Object}
「引擎」Ux.toGrid
生成 Grid 布局的宽度运算,表单中专用,1、2、3、4列不同布局处理。
{
grid: "数值,不同数值对应不同宽度"
}
grid值 | 宽度 |
---|---|
5 | 20% |
4 | 25% |
3 | 33.33% |
2 | 50% |
1 | 100% |
Parameters:
Name | Type | Description |
---|---|---|
config |
Object | 传入配置数据 |
Returns:
返回 style 属性
- Type
- Object
(static) toGridSpan(columns, index) → {Object}
「引擎」Ux.toGridSpan
根据列计算 span / offset 等相关信息,针对布局执行核心操作。
Parameters:
Name | Type | Default | Description |
---|---|---|---|
columns |
Number |
4
|
列信息 |
index |
Number |
0
|
是否纳入 index 执行计算 |
Returns:
返回可用于 Col 的属性
- Type
- Object
(static) toHeight(adjust) → {number}
「标准」Ux.toHeight
根据修正宽度计算组件最大高度信息,按分辨率智能切换。
Parameters:
Name | Type | Default | Description |
---|---|---|---|
adjust |
Number |
0
|
修正高度值。 |
Returns:
返回最终计算的页面高度值。
- Type
- number
(static) toHeightState(adjust) → {Object}
「标准」Ux.toHeightState
高度修正专用的状态生成器:
{
$heightStyle: {
style: {
maxHeight
}
},
$heightValue: number
}
Parameters:
Name | Type | Description |
---|---|---|
adjust |
Number | 修正高度值。 |
Returns:
返回最终状态的数据结构
- Type
- Object
(static) toHeightStyle(adjust) → {*}
「标准」Ux.toHeightStyle
Parameters:
Name | Type | Description |
---|---|---|
adjust |
Returns:
- Type
- *
(static) toLink(data, $app) → {string|any}
「标准」Ux.toLink
- 如果 data 是 Object,则针对 data 中的任何一个对象的
uri
执行路由转换。 - 如果 data 是 Array,则针对 data 中的任何一个元素对象执行
uri
转换。 - 如果 data 是 String,则直接执行转换。
Parameters:
Name | Type | Description |
---|---|---|
data |
String | Object | 输入的转换源。 |
$app |
DataObject | 应用程序对象。 |
Returns:
转换的最终数据。
- Type
- string | any
(static) toLogout(cleanApp) → {any}
「引擎」Ux.toLogout
登录注销专用函数,配合当前系统中的信息实现用户注销功能。
Parameters:
Name | Type | Default | Description |
---|---|---|---|
cleanApp |
Boolean |
true
|
是否清除应用信息(登录时不清除) |
Returns:
返回注销结果。
- Type
- any
(static) toOriginal(reference, switched, exclude)
「引擎」Ux.toOriginal
带原始参数target
的核心路由跳转功能,新参数中不包含key, id, target
,可以和 toRoute
配合使用。
- target:该值为原始的路由路径,如果有值则直接跳转,用于登录控制过后返回原始页面专用。
Parameters:
Name | Type | Description |
---|---|---|
reference |
Object | ReactComponent | React组件引用。 |
switched |
String | 传入内容替换掉 Cv.ENTRY_ADMIN |
exclude |
Array | 移除参数集 |
(static) toPassword(reference)
「引擎」Ux.toPassword
直接重定向到密码更改页,带参数控制 limitation=true
Parameters:
Name | Type | Description |
---|---|---|
reference |
Object | ReactComponent | React组件引用。 |
(static) toPid(reference, data, state)
「引擎」Ux.toPid
根据 pid 的值计算 defaultOpenKeys 和 defaultSelectedKeys 值。
Parameters:
Name | Type | Description |
---|---|---|
reference |
Object | ReactComponent | React组件引用信息。 |
data |
Array | 菜单数据信息。 |
state |
Object | 被修改的状态信息 |
(static) toRoute(reference, uri, params)
「引擎」Ux.toRoute
执行 react-router 的路由跳转功能,路由地址中可以包含前缀,也可以不包含前缀,但框架内部会存在内部逻辑。
1. 特殊参数
1)mid为特殊参数,表示模块信息,对应动态中的module(app, module, page) 2)pid为特殊参数,表示页面信息,对应动态中的page(app, module, page) 3)target为Base64处理过的目标变量,它表示当前页面如果调用toRoute失败时会直接执行target页面
2. 参数读取流程
- 如果params中传入了mid, pid,那么优先考虑params中的值:
- 如果是二参调用,则追加mid / pid参数到目标页面中(标准菜单处理办法)
- 如果是三参调用,只提供mid,则表示模块页面路由
- 如果是三参调用,提供了mid和pid,则表示直接引导到模块中的某个页面
- 如果params中传入了target,则追加target参数并执行Base64编码,如果没传该参数则直接忽略
- 其他参数直接忽略掉,不执行传入,除非在params中传入新参数。
3. 路径解析流程
- 先处理基础路径
- 如果基础路径中包含了参数如:uri?p1=v1&p2=v2,则追加参数时
&
为前缀 --> baseUri - 如果基础路径以
Z_ROUTE
为前缀,则不追加路由前缀,如果不以Z_ROUTE
为前缀,则追加Z_ROUTE
前缀,react-router专用
- 如果基础路径中包含了参数如:uri?p1=v1&p2=v2,则追加参数时
- 参数对部分,主要考虑前缀信息,如果本身路径带了参数,则前缀使用
&
符号(追加参数模式),如果路径本身不带参数,则前缀使用?
符号(设置参数模式)
Parameters:
Name | Type | Description |
---|---|---|
reference |
Object | ReactComponent | React组件引用。 |
uri |
String | 跳转路由信息,会追加 |
params |
Object | 当前路由所需参数信息 |
(static) toUnauthorized(reference)
「引擎」Ux.toUnauthorized
Parameters:
Name | Type | Description |
---|---|---|
reference |
(static) toUri(uri, $app) → {String}
「标准」Ux.toUri
Parameters:
Name | Type | Description |
---|---|---|
uri |
||
$app |
Returns:
- Type
- String
(static) toUrl(uri, key, value) → {string|null}
「标准」Ux.toUrl
将key=value
追加到url路径中,如
// url = /api/params?name=x
Ux.toUrl(url, "pass", "111")
// url = /api/params?name=x&pass=1111
系统会自动计算参数中的 key = value 相关信息
Parameters:
Name | Type | Description |
---|---|---|
uri |
String | 需要读取的查询参数名称。 |
key |
String | 追加的参数名 |
value |
Any | 追加的参数值 |
Returns:
返回读取的参数值。
- Type
- string | null
(static) toVis(view, position) → {*}
「标准」Ux.toVis
Parameters:
Name | Type | Description |
---|---|---|
view |
||
position |
Returns:
- Type
- *
(static) toX(columns) → {number}
「引擎」Ux.toX
根据列信息自动计算表格宽度,计算值会包含多种不同的列值。
Parameters:
Name | Type | Description |
---|---|---|
columns |
Array | 列配置数组 |
Returns:
返回最终宽度
- Type
- number