Skip to content

Commit 8529d5d

Browse files
committed
修改组件目录结构,此次更新影响较大,请尽快更改有使用的组件引入,老的组件将会在后面删除
1 parent b2328d7 commit 8529d5d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+5027
-65
lines changed

src/Components/Alert.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33

44
namespace SmallRuralDog\Admin\Components;
55

6-
6+
/**
7+
* @deprecated
8+
* Class Alert
9+
* @package SmallRuralDog\Admin\Components
10+
*/
711
class Alert extends Component
812
{
913
protected $componentName = "Alert";
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?php
2+
3+
4+
namespace SmallRuralDog\Admin\Components\Attrs;
5+
6+
7+
class CascaderOption extends SelectOption
8+
{
9+
/**
10+
* @var CascaderOption[]
11+
*/
12+
protected $children = [];
13+
14+
protected $leaf = true;
15+
16+
static function make($value, $label)
17+
{
18+
$op = new CascaderOption();
19+
$op->type = "default";
20+
$op->value = $value;
21+
$op->label = $label;
22+
return $op;
23+
}
24+
25+
/**
26+
* @param CascaderOption[] $children
27+
* @return $this
28+
*/
29+
public function children($children)
30+
{
31+
$this->children = $children;
32+
return $this;
33+
}
34+
35+
/**
36+
* @param bool $leaf
37+
* @return $this
38+
*/
39+
public function leaf($leaf=true)
40+
{
41+
$this->leaf = $leaf;
42+
return $this;
43+
}
44+
45+
46+
47+
public function jsonSerialize()
48+
{
49+
$data = [];
50+
foreach ($this as $key => $val) {
51+
if (!empty($val)) $data[$key] = $val;
52+
}
53+
return $data;
54+
}
55+
56+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
4+
namespace SmallRuralDog\Admin\Components\Attrs;
5+
6+
7+
class CascaderProps
8+
{
9+
public $expandTrigger = 'click';
10+
public $multiple = false;
11+
public $checkStrictly = false;
12+
public $emitPath = true;
13+
public $lazy = false;
14+
public $lazyUrl;
15+
public $value = 'value';
16+
public $label = 'label';
17+
public $children = 'children';
18+
public $leaf = 'leaf';
19+
}

src/Components/Attrs/SelectOption.php

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?php
2+
3+
4+
namespace SmallRuralDog\Admin\Components\Attrs;
5+
6+
7+
use SmallRuralDog\Admin\Traits\AdminJsonBuilder;
8+
9+
class SelectOption extends AdminJsonBuilder
10+
{
11+
protected $type = "default";
12+
protected $label;
13+
protected $value;
14+
protected $avatar;
15+
protected $desc;
16+
protected $disabled = false;
17+
18+
static function make($value, $label)
19+
{
20+
$op = new SelectOption();
21+
$op->type = "default";
22+
$op->value = $value;
23+
$op->label = $label;
24+
return $op;
25+
}
26+
27+
/**
28+
* 是否禁用该选项
29+
* @param bool $disabled
30+
* @return $this
31+
*/
32+
public function disabled($disabled = true)
33+
{
34+
$this->disabled = $disabled;
35+
return $this;
36+
}
37+
38+
/**
39+
* @param string $avatar
40+
* @return $this
41+
*/
42+
public function avatar($avatar)
43+
{
44+
$this->avatar = $avatar;
45+
return $this;
46+
}
47+
48+
/**
49+
* @param mixed $desc
50+
* @return $this
51+
*/
52+
public function desc($desc)
53+
{
54+
$this->desc = $desc;
55+
return $this;
56+
}
57+
}

src/Components/Attrs/TransferData.php

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
3+
4+
namespace SmallRuralDog\Admin\Components\Attrs;
5+
6+
7+
use SmallRuralDog\Admin\Traits\AdminJsonBuilder;
8+
9+
class TransferData extends AdminJsonBuilder
10+
{
11+
12+
protected $key;
13+
protected $label;
14+
protected $disabled = false;
15+
16+
17+
static public function make($key, $label, $disabled = false)
18+
{
19+
return new TransferData($key, $label, $disabled);
20+
}
21+
22+
/**
23+
* TransferData constructor.
24+
* @param $key
25+
* @param $label
26+
* @param bool $disabled
27+
*/
28+
public function __construct($key, $label, $disabled)
29+
{
30+
$this->key = $key;
31+
$this->label = $label;
32+
$this->disabled = $disabled;
33+
}
34+
35+
36+
/**
37+
* @inheritDoc
38+
*/
39+
public function jsonSerialize()
40+
{
41+
$data = [];
42+
foreach ($this as $key => $val) {
43+
$data[$key] = $val;
44+
}
45+
return $data;
46+
}
47+
}

src/Components/Avatar.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
namespace SmallRuralDog\Admin\Components;
55

66
/**
7+
* @deprecated
78
* Class Avatar
89
* @package SmallRuralDog\Admin\Components
910
*/

src/Components/CSwitch.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33

44
namespace SmallRuralDog\Admin\Components;
55

6-
6+
/**
7+
* @deprecated
8+
* Class CSwitch
9+
* @package SmallRuralDog\Admin\Components
10+
*/
711
class CSwitch extends Component
812
{
913
protected $componentName = "CSwitch";

src/Components/Card.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66

77
use SmallRuralDog\Admin\Layout\Content;
88

9+
/**
10+
* @deprecated
11+
* Class Card
12+
* @package SmallRuralDog\Admin\Components
13+
*/
914
class Card extends Component
1015
{
1116
protected $componentName = "Card";

src/Components/Cascader.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33

44
namespace SmallRuralDog\Admin\Components;
55

6-
6+
/**
7+
* @deprecated
8+
* Class Cascader
9+
* @package SmallRuralDog\Admin\Components
10+
*/
711
class Cascader extends Component
812
{
913
protected $componentName = "Cascader";

src/Components/CascaderOption.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33

44
namespace SmallRuralDog\Admin\Components;
55

6-
6+
/**
7+
* @deprecated
8+
* Class CascaderOption
9+
* @package SmallRuralDog\Admin\Components
10+
*/
711
class CascaderOption extends SelectOption
812
{
913
/**

0 commit comments

Comments
 (0)