+ zin: add thinkNode wg.
This commit is contained in:
@@ -192,6 +192,7 @@ function caseTimeInfo(): caseTimeInfo {return createWg('caseTimeInfo', func_get_
|
||||
function caseRelatedList(): caseRelatedList {return createWg('caseRelatedList', func_get_args());}
|
||||
function flowSubTable(): flowSubTable {return createWg('flowSubTable', func_get_args());}
|
||||
function thumbnail(): thumbnail {return createWg('thumbnail', func_get_args());}
|
||||
function thinkNode(): thinkNode {return createWg('thinkNode', func_get_args());}
|
||||
function thinkStep(): thinkStep {return createWg('thinkStep', func_get_args());}
|
||||
function thinkRadio(): thinkRadio{return createWg('thinkRadio', func_get_args());}
|
||||
function thinkCheckbox(): thinkCheckbox {return createWg('thinkCheckbox', func_get_args());}
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace zin;
|
||||
require_once dirname(__DIR__) . DS . 'thinkradio' . DS . 'v1.php';
|
||||
|
||||
/**
|
||||
* 多选题型(thinkCheckbox)部件类
|
||||
* 多选题型部件类
|
||||
* The thinkCheckbox widget class
|
||||
*/
|
||||
class thinkCheckbox extends thinkRadio
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
namespace zin;
|
||||
|
||||
class thinkNode extends wg
|
||||
{
|
||||
protected static array $defineProps = array(
|
||||
'item: object',
|
||||
'status?: string="detail"',
|
||||
);
|
||||
|
||||
protected function buildBody(): wg|array
|
||||
{
|
||||
list($item, $status) = $this->prop(array('item', 'status'));
|
||||
|
||||
if($status == 'detail')
|
||||
{
|
||||
return thinkStepDetail
|
||||
(
|
||||
set::type($item->type),
|
||||
set::title($item->title),
|
||||
set::desc($item->desc),
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$options = json_encode($item->options, true);
|
||||
$itemData = get_object_vars($item);
|
||||
$item = (object)array_merge($itemData, $options);
|
||||
|
||||
$item->options = null;
|
||||
|
||||
if($item == 'node') return thinkNode(set($this->getRestProps()));
|
||||
if($type == 'transition') return thinkTransition(set($this->getRestProps()));
|
||||
if($type == 'question')
|
||||
{
|
||||
$questionType = zget($item, 'questionType', 'radio');
|
||||
if($questionType == 'radio') return thinkRadio(set($this->getRestProps()));
|
||||
if($questionType == 'checkbox') return thinkCheckbox(set($this->getRestProps()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function build(): wg|array
|
||||
{
|
||||
list($item, $status) = $this->prop(array('item', 'status'));
|
||||
if(!$item) return array();
|
||||
|
||||
return array(
|
||||
$status !== 'detail' ? array(
|
||||
div
|
||||
(
|
||||
setClass('flex items-center justify-between'),
|
||||
setStyle(array('height' => '48px', 'padding' => '0 48px', 'color' => 'var(--color-gray-950)')),
|
||||
div
|
||||
(
|
||||
setClass('font-medium'),
|
||||
data('lang.thinkwizard.step.nodeInfo'),
|
||||
),
|
||||
btn
|
||||
(
|
||||
set::type('primary'),
|
||||
set::btnType('submit'),
|
||||
data('lang.save')
|
||||
)
|
||||
),
|
||||
h::hr()
|
||||
) : null,
|
||||
$this->buildBody(),
|
||||
$this->children()
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ namespace zin;
|
||||
require_once dirname(__DIR__) . DS . 'thinkstep' . DS . 'v1.php';
|
||||
|
||||
/**
|
||||
* 单选题型(thinkRadio)部件类
|
||||
* 单选题型部件类
|
||||
* The thinkRadio widget class
|
||||
*/
|
||||
class thinkRadio extends thinkStep
|
||||
|
||||
Reference in New Issue
Block a user