提交 a855d466 编写于 作者: ModStart's avatar ModStart

develop

上级 146ccaa6
......@@ -61,6 +61,7 @@ use ModStart\Support\Concern\HasFluentAttribute;
*
* @method AbstractField|mixed isLayoutField($vlaue = null)
* @method AbstractField|mixed isCustomField($vlaue = null)
* @method AbstractField|mixed gridFixed($vlaue = null)
*
* >>>>>> 数据流转换流程 >>>>>>
*
......@@ -159,6 +160,7 @@ class AbstractField implements Renderable
'hookRendering',
'isLayoutField',
'isCustomField',
'gridFixed',
];
/**
* 字段渲染模式,默认为 add,请查看 @see FieldRenderMode
......@@ -202,6 +204,11 @@ class AbstractField implements Renderable
* @var bool
*/
protected $isCustomField = false;
/**
* 数据表示模式下浮动布局
* @var null|left|right
*/
private $gridFixed = null;
public static function getAssets()
{
......
......@@ -25,6 +25,12 @@ trait HasItemOperate
*/
private $hookItemOperateRendering;
/**
* 操作列初始化时回调
* @var \Closure
*/
private $hookItemOperateFieldBuild;
private function setupItemOperate()
{
$this->itemOperate = new ItemOperate($this);
......@@ -42,6 +48,9 @@ trait HasItemOperate
}
return $this->itemOperate->render();
});
if ($this->hookItemOperateFieldBuild) {
call_user_func($this->hookItemOperateFieldBuild, $field);
}
$this->pushField($field);
}
}
......@@ -67,4 +76,28 @@ trait HasItemOperate
$this->hookItemOperateRendering = $callback;
return $this;
}
/**
* @param null $callback = function(AbstractField $field){ }
* @return $this|\Closure
*/
public function hookItemOperateFieldBuild($callback = null)
{
if (null === $callback) {
return $this->hookItemOperateFieldBuild;
}
$this->hookItemOperateFieldBuild = $callback;
return $this;
}
/**
* 操作栏浮动
* @param $fixed string left|right
*/
public function operateFixed($fixed)
{
$this->hookItemOperateFieldBuild(function (AbstractField $field) use ($fixed) {
$field->gridFixed($fixed);
});
}
}
......@@ -430,6 +430,9 @@ class Grid
} else {
$record['withAuto'] = true;
}
if ($field->gridFixed()) {
$record['fixed'] = $field->gridFixed();
}
$head[] = $record;
}
return Response::jsonSuccessData([
......
......@@ -50,7 +50,7 @@ class TextLink extends AbstractWidget
if ($this->disabled) {
return '<a href="javascript:;" class="ub-text-link ub-text-muted">' . $this->text . '</a>';
} else {
return '<a href="' . $this->link . '" class="ub-text-link ub-text-' . $this->type . '" ' . $this->attr . '>' . $this->text . '</a>';
return '<a href="' . $this->link . '" class="ub-text-link ub-text-' . ($this->type == 'primary' ? 'link' : $this->type) . '" ' . $this->attr . '>' . $this->text . '</a>';
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册