|
@@ -168,6 +168,9 @@ class Asset
|
|
|
'@qrcode' => [
|
|
|
'js' => '@admin/dcat/plugins/jquery-qrcode/dist/jquery-qrcode.min.js',
|
|
|
],
|
|
|
+ '@sortable' => [
|
|
|
+ 'js' => '@admin/dcat/plugins/sortable/Sortable.min.js',
|
|
|
+ ],
|
|
|
];
|
|
|
|
|
|
/**
|
|
@@ -311,7 +314,7 @@ class Asset
|
|
|
}
|
|
|
|
|
|
if (mb_strpos($name, '@') !== 0) {
|
|
|
- $name = '@'.$name;
|
|
|
+ $name = '@' . $name;
|
|
|
}
|
|
|
|
|
|
$this->alias[$name] = $value;
|
|
@@ -333,7 +336,7 @@ class Asset
|
|
|
}
|
|
|
|
|
|
if (mb_strpos($alias, '@') !== 0) {
|
|
|
- $alias = '@'.$alias;
|
|
|
+ $alias = '@' . $alias;
|
|
|
}
|
|
|
|
|
|
$this->js($this->alias[$alias]['js'] ?? null);
|
|
@@ -347,7 +350,7 @@ class Asset
|
|
|
*/
|
|
|
public function css($css)
|
|
|
{
|
|
|
- if (! $css) {
|
|
|
+ if (!$css) {
|
|
|
return;
|
|
|
}
|
|
|
$this->css = array_merge(
|
|
@@ -377,7 +380,7 @@ class Asset
|
|
|
*/
|
|
|
public function js($js)
|
|
|
{
|
|
|
- if (! $js) {
|
|
|
+ if (!$js) {
|
|
|
return;
|
|
|
}
|
|
|
$this->js = array_merge(
|
|
@@ -402,7 +405,7 @@ class Asset
|
|
|
|
|
|
$paths = isset($this->alias[$path][$type]) ? (array) $this->alias[$path][$type] : null;
|
|
|
|
|
|
- if (! $paths) {
|
|
|
+ if (!$paths) {
|
|
|
return $paths;
|
|
|
}
|
|
|
|
|
@@ -422,14 +425,14 @@ class Asset
|
|
|
*/
|
|
|
public function url($path)
|
|
|
{
|
|
|
- if (! $path) {
|
|
|
+ if (!$path) {
|
|
|
return $path;
|
|
|
}
|
|
|
|
|
|
$path = $this->getRealPath($path);
|
|
|
|
|
|
if (mb_strpos($path, '//') === false) {
|
|
|
- $path = config('admin.assets_server').'/'.trim($path, '/');
|
|
|
+ $path = config('admin.assets_server') . '/' . trim($path, '/');
|
|
|
}
|
|
|
|
|
|
return (config('admin.https') || config('admin.secure')) ? secure_asset($path) : asset($path);
|
|
@@ -444,7 +447,7 @@ class Asset
|
|
|
*/
|
|
|
public function getRealPath(?string $path)
|
|
|
{
|
|
|
- if (! $this->containsAlias($path)) {
|
|
|
+ if (!$this->containsAlias($path)) {
|
|
|
return $path;
|
|
|
}
|
|
|
|
|
@@ -452,7 +455,7 @@ class Asset
|
|
|
'/',
|
|
|
array_map(
|
|
|
function ($v) {
|
|
|
- if (! $this->isPathAlias($v)) {
|
|
|
+ if (!$this->isPathAlias($v)) {
|
|
|
return $v;
|
|
|
}
|
|
|
|
|
@@ -506,7 +509,7 @@ class Asset
|
|
|
*/
|
|
|
public function headerJs($js)
|
|
|
{
|
|
|
- if (! $js) {
|
|
|
+ if (!$js) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -536,7 +539,7 @@ class Asset
|
|
|
*/
|
|
|
public function script($script, bool $direct = false)
|
|
|
{
|
|
|
- if (! $script) {
|
|
|
+ if (!$script) {
|
|
|
return;
|
|
|
}
|
|
|
if ($direct) {
|
|
@@ -553,7 +556,7 @@ class Asset
|
|
|
*/
|
|
|
public function style($style)
|
|
|
{
|
|
|
- if (! $style) {
|
|
|
+ if (!$style) {
|
|
|
return;
|
|
|
}
|
|
|
$this->style = array_merge($this->style, (array) $style);
|
|
@@ -564,12 +567,10 @@ class Asset
|
|
|
*/
|
|
|
protected function addFontCss()
|
|
|
{
|
|
|
- $this->fonts && (
|
|
|
- $this->baseCss = array_merge(
|
|
|
+ $this->fonts && ($this->baseCss = array_merge(
|
|
|
$this->baseCss,
|
|
|
(array) $this->fonts
|
|
|
- )
|
|
|
- );
|
|
|
+ ));
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -596,7 +597,7 @@ class Asset
|
|
|
$html = '';
|
|
|
|
|
|
foreach (array_unique($this->css) as &$v) {
|
|
|
- if (! $paths = $this->get($v, 'css')) {
|
|
|
+ if (!$paths = $this->get($v, 'css')) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
@@ -615,13 +616,13 @@ class Asset
|
|
|
*/
|
|
|
public function withVersionQuery($url)
|
|
|
{
|
|
|
- if (! Str::contains($url, '?')) {
|
|
|
+ if (!Str::contains($url, '?')) {
|
|
|
$url .= '?';
|
|
|
}
|
|
|
|
|
|
- $ver = 'v'.Admin::VERSION;
|
|
|
+ $ver = 'v' . Admin::VERSION;
|
|
|
|
|
|
- return Str::endsWith($url, '?') ? $url.$ver : $url.'&'.$ver;
|
|
|
+ return Str::endsWith($url, '?') ? $url . $ver : $url . '&' . $ver;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -646,7 +647,7 @@ class Asset
|
|
|
$html = '';
|
|
|
|
|
|
foreach (array_unique($this->js) as &$v) {
|
|
|
- if (! $paths = $this->get($v, 'js')) {
|
|
|
+ if (!$paths = $this->get($v, 'js')) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
@@ -666,7 +667,7 @@ class Asset
|
|
|
$html = '';
|
|
|
|
|
|
foreach (array_unique($this->headerJs) as &$v) {
|
|
|
- if (! $paths = $this->get($v, 'js')) {
|
|
|
+ if (!$paths = $this->get($v, 'js')) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
@@ -695,7 +696,7 @@ class Asset
|
|
|
console.error(e)
|
|
|
}
|
|
|
})();
|
|
|
-Dcat.ready(function () {
|
|
|
+Dcat.ready(function () {
|
|
|
try {
|
|
|
{$script}
|
|
|
} catch (e) {
|