flux-eco / ui-transformer
由fluxlabs ag开发的flux-capacitor应用程序的组件
1.1.0
2022-04-26 18:38 UTC
Requires
- php: >=8.0
- ext-curl: *
- ext-json: *
- ext-yaml: *
- flux-eco/dot-env: >=1.2.0
README
此组件将描述数据转换成JSON实例,以用于用户界面。例如:
- 翻译未翻译的字符串
- 合并通过引用链接的JSON文档
用法
@see 目录示例
.env
UI_TRANSFORM_TRANSLATION_FILES_DIRECTORY=configs/translations
UI_TRANSFORM_UI_DEFINITION_DIRECTORY=configs/ui
UI_TRANSFORM_PAGE_LIST_DEFINITION_FILE_PATH=configs/ui/pages.yaml
UI_TRANSFORM_MARKDOWN_TO_HTML_CONVERTER_REST_API_URL=https://:9001
translations\de.yaml
pageTitle:
todo: Todo's
topic: Thema
topic:
title: Thema
description: Beschreibung
todo:
title: ToDo
description: Beschreibung
action:
delete: Delete
edit: Edit
ui\pages.yaml
- $ref: topic/page.yaml
- $ref: todo/page.yaml
ui\topic\page.yaml
title:
type: lngKey
key: pageTitle.topic
url: "/listdata/Topic"
avatar: "/icons/seminars.png"
pageType: ListData
projectionName: topic
editForm:
$ref: editForm.yaml
createForm:
$ref: createForm.yaml
itemActions:
edit:
type: form
key: editForm
title:
type: lngKey
key: action.edit
delete:
type: form
key: deleteForm
title:
type: lngKey
key: action.delete
todos:
type: subobject
key: todos
title:
type: lngKey
key: pageTitle.todo
projectionName: todo
ui\topic\editForm.yaml
rootObjectAggregateName: ToDo
properties:
- title:
type: lngKey
key: topic.title
key: title
dataIndex: title
valueType: string
width: m
formItemProps:
rules:
- required: true
message: Please enter a Title
- title:
type: lngKey
key: topic.description
key: description
dataIndex: description
valueType: textarea
width: m
formItemProps: [ ]
ui...
-> @see directory examples
example.php
<?php
require_once __DIR__ . '/../vendor/autoload.php';
fluxDotEnv\loadDotEnv(__DIR__);
//get page list
$pages = fluxUiTransformer\getPages();
echo "getPages(): ".PHP_EOL;
print_r($pages).PHP_EOL.PHP_EOL;
//get page
$pageTopic = fluxUiTransformer\getPageDefinition('topic');
echo "getPageDefinition('topic'): ".PHP_EOL;
print_r($pageTopic).PHP_EOL;
输出
getPages():
Array
(
[data] => Array
(
[0] => Array
(
[title] => Thema
[url] => /listdata/Topic
[avatar] => /icons/seminars.png
[pageType] => ListData
[projectionName] => topic
[editForm] => Array
(
[rootObjectAggregateName] => ToDo
[properties] => Array
(
[0] => Array
(
[title] => Thema
[key] => title
[dataIndex] => title
[valueType] => string
[width] => m
[formItemProps] => Array
(
[rules] => Array
(
[0] => Array
(
[required] => 1
[message] => Please enter a Title
)
)
)
)
[1] => Array
(
[title] => Beschreibung
[key] => description
[dataIndex] => description
[valueType] => textarea
[width] => m
[formItemProps] => Array
(
)
)
)
)
[createForm] => Array
(
[rootObjectAggregateName] => Topic
[properties] => Array
(
[0] => Array
(
[title] => Thema
[key] => title
[dataIndex] => title
[valueType] => string
[width] => m
[formItemProps] => Array
(
[rules] => Array
(
[0] => Array
(
[required] => 1
[message] => Please enter a Title
)
)
)
)
[1] => Array
(
[title] => Beschreibung
[key] => description
[dataIndex] => description
[valueType] => textarea
[width] => m
[formItemProps] => Array
(
)
)
)
)
[itemActions] => Array
(
[edit] => Array
(
[type] => form
[key] => editForm
[title] => Edit
)
[delete] => Array
(
[type] => form
[key] => deleteForm
[title] => Delete
)
[todos] => Array
(
[type] => subobject
[key] => todos
[title] => Todo's
[projectionName] => todo
)
)
)
[1] => Array
(
[title] => Todo's
[url] => /listdata/Todo
[avatar] => /icons/seminars.png
[pageType] => ListData
[projectionName] => todo
[editForm] => Array
(
[rootObjectAggregateName] => Todo
[properties] => Array
(
[0] => Array
(
[title] => ToDo
[key] => title
[dataIndex] => title
[valueType] => string
[width] => m
[formItemProps] => Array
(
[rules] => Array
(
[0] => Array
(
[required] => 1
[message] => Please enter a Title
)
)
)
)
[1] => Array
(
[title] => Beschreibung
[key] => description
[dataIndex] => description
[valueType] => textarea
[width] => m
[formItemProps] => Array
(
)
)
)
)
[createForm] => Array
(
[rootObjectAggregateName] => Todo
[properties] => Array
(
[0] => Array
(
[title] => ToDo
[key] => title
[dataIndex] => title
[valueType] => string
[width] => m
[formItemProps] => Array
(
[rules] => Array
(
[0] => Array
(
[required] => 1
[message] => Please enter a Title
)
)
)
)
[1] => Array
(
[title] => Beschreibung
[key] => description
[dataIndex] => description
[valueType] => textarea
[width] => m
[formItemProps] => Array
(
)
)
)
)
[itemActions] => Array
(
[edit] => Array
(
[type] => form
[key] => editForm
[title] => Edit
)
[delete] => Array
(
[type] => form
[key] => deleteForm
[title] => Delete
)
)
)
)
[status] => success
[total] => 2
)
getPageDefinition('topic'):
Array
(
[title] => Thema
[url] => /listdata/Topic
[avatar] => /icons/seminars.png
[pageType] => ListData
[projectionName] => topic
[editForm] => Array
(
[rootObjectAggregateName] => ToDo
[properties] => Array
(
[0] => Array
(
[title] => Thema
[key] => title
[dataIndex] => title
[valueType] => string
[width] => m
[formItemProps] => Array
(
[rules] => Array
(
[0] => Array
(
[required] => 1
[message] => Please enter a Title
)
)
)
)
[1] => Array
(
[title] => Beschreibung
[key] => description
[dataIndex] => description
[valueType] => textarea
[width] => m
[formItemProps] => Array
(
)
)
)
)
[createForm] => Array
(
[rootObjectAggregateName] => Topic
[properties] => Array
(
[0] => Array
(
[title] => Thema
[key] => title
[dataIndex] => title
[valueType] => string
[width] => m
[formItemProps] => Array
(
[rules] => Array
(
[0] => Array
(
[required] => 1
[message] => Please enter a Title
)
)
)
)
[1] => Array
(
[title] => Beschreibung
[key] => description
[dataIndex] => description
[valueType] => textarea
[width] => m
[formItemProps] => Array
(
)
)
)
)
[itemActions] => Array
(
[edit] => Array
(
[type] => form
[key] => editForm
[title] => Edit
)
[delete] => Array
(
[type] => form
[key] => deleteForm
[title] => Delete
)
[todos] => Array
(
[type] => subobject
[key] => todos
[title] => Todo's
[projectionName] => todo
)
)
)
贡献 💜
请...
- ... 在 https://git.fluxlabs.ch 注册一个账户
- ... 创建拉取请求 🔥
调整建议/错误报告 🐾
请...
- ... 在 https://git.fluxlabs.ch 注册一个账户
- ... 向我们请求服务水平协议: support@fluxlabs.ch 😘
- ... 阅读和创建问题