* zin: add suffix block for entity label wg.

This commit is contained in:
dingyongliang
2023-05-23 17:16:40 +08:00
parent 0e92294803
commit dd08a5f484
2 changed files with 17 additions and 2 deletions
+9
View File
@@ -1181,6 +1181,11 @@ function dashboard()
* string title
* string|array|null content
* bool useHtml=false
*
* ====== blocks ======
* subTitle => array()
* actions => array()
* ====================
*/
function section()
{
@@ -1193,6 +1198,10 @@ function section()
* string|int|null entityID
* string|int|null level
* string text
*
* ====== blocks ======
* suffix = array()
* ====================
*/
function entityLabel()
{
+8 -2
View File
@@ -12,6 +12,10 @@ class entityLabel extends wg
'text: string' // 实体文本
);
protected static $defineBlocks = array(
'suffix' => array()
);
protected function onAddChild(mixed $child): mixed
{
if(is_string($child) && !$this->props->has('text'))
@@ -47,14 +51,16 @@ class entityLabel extends wg
protected function build(): wg
{
$entityID = $this->buildEntityID();
$suffix = $this->block('suffix');
$entityID = $this->buildEntityID();
$entityName = $this->buildEntityName();
return div
(
setClass('entity-label', 'flex', 'items-center'),
set($this->props->skip(array_keys(static::getDefinedProps()))),
$entityID,
$entityName
$entityName,
$suffix
);
}
}