map = $map; $this->color = $color; $this->type = $type; } /** * @param $label * @return array */ public function render($label): array { $statusArr = []; foreach ($this->map as $key => $vo) { $statusArr[$key]['name'] = $vo; $statusArr[$key]['color'] = $this->color[$key] ?? 'blue'; } $node = []; foreach ($statusArr as $key => $vo) { if ($this->type === 'badge') { $item = (new Badge($vo['name']))->color($vo['color'])->render(); $item['vIf'] = "rowData.record['{$label}'] == " . (is_numeric($key) ? $key : "'$key'"); } else { $item = [ 'nodeName' => 'div', 'class' => 'text-' . $vo['color'] . '-900', 'child' => $vo['name'] ]; } $node[] = $item; } return $node; } }