generated from liutk/owl-admin-base
Merge branch 'main' of https://gitea.hmily.club/pdkj/store-manage into main
commit
eb4475c88d
|
|
@ -6,7 +6,6 @@ use Slowlyo\OwlAdmin\Admin;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Validator;
|
use Illuminate\Support\Facades\Validator;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Slowlyo\OwlAdmin\Models\AdminUser;
|
|
||||||
use Slowlyo\OwlAdmin\Controllers\AuthController as AdminAuthController;
|
use Slowlyo\OwlAdmin\Controllers\AuthController as AdminAuthController;
|
||||||
use Illuminate\Support\Facades\Hash;
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
|
||||||
|
|
@ -36,8 +35,10 @@ class AuthController extends AdminAuthController
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
abort(Response::HTTP_BAD_REQUEST, $validator->errors()->first());
|
abort(Response::HTTP_BAD_REQUEST, $validator->errors()->first());
|
||||||
}
|
}
|
||||||
$adminModel = Admin::config("admin.auth.model", AdminUser::class);
|
|
||||||
|
$adminModel = Admin::adminUserModel();
|
||||||
$user = $adminModel::query()->where('username', $request->username)->first();
|
$user = $adminModel::query()->where('username', $request->username)->first();
|
||||||
|
|
||||||
if($user && $user->lock){
|
if($user && $user->lock){
|
||||||
abort(Response::HTTP_BAD_REQUEST, '您的账号已被锁定,需要联系超级管理员解锁。');
|
abort(Response::HTTP_BAD_REQUEST, '您的账号已被锁定,需要联系超级管理员解锁。');
|
||||||
}else{
|
}else{
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,194 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin;
|
||||||
|
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
use Slowlyo\OwlAdmin\Admin;
|
||||||
|
|
||||||
|
class Menu
|
||||||
|
{
|
||||||
|
protected array $menus = [];
|
||||||
|
|
||||||
|
public function all()
|
||||||
|
{
|
||||||
|
$menus = $this->userMenus()
|
||||||
|
->push(...array_map(fn($item) => $this->formatItem($item), $this->menus))
|
||||||
|
->sortBy('order')
|
||||||
|
->values()
|
||||||
|
->toArray();
|
||||||
|
|
||||||
|
return array_merge($this->list2Menu($menus), $this->extra());
|
||||||
|
}
|
||||||
|
|
||||||
|
private function userMenus()
|
||||||
|
{
|
||||||
|
/** @var \App\Models\AdminUser */
|
||||||
|
$user = Admin::user();
|
||||||
|
|
||||||
|
return $user->allMenus();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function list2Menu($list, $parentId = 0, $parentName = ''): array
|
||||||
|
{
|
||||||
|
$data = [];
|
||||||
|
foreach ($list as $key => $item) {
|
||||||
|
if ($item['parent_id'] == $parentId) {
|
||||||
|
$idStr = "[{$item['id']}]";
|
||||||
|
$_temp = [
|
||||||
|
'name' => $parentName ? $parentName . '-' . $idStr : $idStr,
|
||||||
|
'path' => $item['url'],
|
||||||
|
'component' => data_get($item, 'component') ?? 'amis',
|
||||||
|
'is_home' => $item['is_home'],
|
||||||
|
'is_full' => $item['is_full'] ?? 0,
|
||||||
|
'is_link' => $item['url_type'] == Admin::adminMenuModel()::TYPE_LINK,
|
||||||
|
'meta' => [
|
||||||
|
'title' => $item['title'],
|
||||||
|
'icon' => $item['icon'] ?? '-',
|
||||||
|
'hide' => $item['visible'] == 0,
|
||||||
|
'order' => $item['order'],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
$children = $this->list2Menu($list, (int)$item['id'], $_temp['name']);
|
||||||
|
|
||||||
|
if (!empty($children)) {
|
||||||
|
$_temp['component'] = 'amis';
|
||||||
|
$_temp['children'] = $children;
|
||||||
|
}
|
||||||
|
|
||||||
|
$data[] = $_temp;
|
||||||
|
if (!in_array($_temp['path'], Admin::config('admin.route.without_extra_routes'))) {
|
||||||
|
array_push($data, ...$this->generateRoute($_temp));
|
||||||
|
}
|
||||||
|
unset($list[$key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function generateRoute($item): array
|
||||||
|
{
|
||||||
|
$url = $item['path'] ?? '';
|
||||||
|
$url = preg_replace('/\?.*/', '', $url);
|
||||||
|
|
||||||
|
if (!$url || array_key_exists('children', $item)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$menu = fn($action, $path) => [
|
||||||
|
'name' => $item['name'] . '-' . $action,
|
||||||
|
'path' => $url . $path,
|
||||||
|
'component' => 'amis',
|
||||||
|
'meta' => [
|
||||||
|
'hide' => true,
|
||||||
|
'icon' => Arr::get($item, 'meta.icon'),
|
||||||
|
'title' => Arr::get($item, 'meta.title') . ' - ' . __('admin.' . $action),
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
return [
|
||||||
|
$menu('create', '/create'),
|
||||||
|
$menu('show', '/:id'),
|
||||||
|
$menu('edit', '/:id/edit'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function add($menus)
|
||||||
|
{
|
||||||
|
$this->menus = array_merge($this->menus, $menus);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function formatItem($item)
|
||||||
|
{
|
||||||
|
return array_merge([
|
||||||
|
'title' => '',
|
||||||
|
'url' => '',
|
||||||
|
'url_type' => 1,
|
||||||
|
'icon' => '',
|
||||||
|
'parent_id' => 0,
|
||||||
|
'id' => 999,
|
||||||
|
'is_home' => 0,
|
||||||
|
'visible' => 1,
|
||||||
|
'order' => 99,
|
||||||
|
], $item);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 额外菜单
|
||||||
|
*
|
||||||
|
* @return array|array[]
|
||||||
|
*/
|
||||||
|
private function extra()
|
||||||
|
{
|
||||||
|
$extraMenus = [
|
||||||
|
[
|
||||||
|
'name' => 'user_setting',
|
||||||
|
'path' => '/user_setting',
|
||||||
|
'component' => 'amis',
|
||||||
|
'meta' => [
|
||||||
|
'hide' => true,
|
||||||
|
'title' => __('admin.user_setting'),
|
||||||
|
'icon' => 'material-symbols:manage-accounts',
|
||||||
|
'singleLayout' => 'basic',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
if (Admin::config('admin.show_development_tools')) {
|
||||||
|
$extraMenus = array_merge($extraMenus, $this->devToolMenus());
|
||||||
|
}
|
||||||
|
|
||||||
|
return $extraMenus;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开发者工具菜单
|
||||||
|
*
|
||||||
|
* @return array[]
|
||||||
|
*/
|
||||||
|
private function devToolMenus()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
[
|
||||||
|
'name' => 'dev_tools',
|
||||||
|
'path' => '/dev_tools',
|
||||||
|
'component' => 'amis',
|
||||||
|
'meta' => [
|
||||||
|
'title' => __('admin.developer'),
|
||||||
|
'icon' => 'fluent:window-dev-tools-20-regular',
|
||||||
|
],
|
||||||
|
'children' => [
|
||||||
|
[
|
||||||
|
'name' => 'dev_tools_extensions',
|
||||||
|
'path' => '/dev_tools/extensions',
|
||||||
|
'component' => 'amis',
|
||||||
|
'meta' => [
|
||||||
|
'title' => __('admin.extensions.menu'),
|
||||||
|
'icon' => 'ion:extension-puzzle-outline',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'dev_tools_code_generator',
|
||||||
|
'path' => '/dev_tools/code_generator',
|
||||||
|
'component' => 'amis',
|
||||||
|
'meta' => [
|
||||||
|
'title' => __('admin.code_generator'),
|
||||||
|
'icon' => 'ic:baseline-code',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'dev_tools_editor',
|
||||||
|
'path' => '/dev_tools/editor',
|
||||||
|
'component' => 'editor',
|
||||||
|
'meta' => [
|
||||||
|
'title' => __('admin.visual_editor'),
|
||||||
|
'icon' => 'mdi:monitor-edit',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||||
|
use Slowlyo\OwlAdmin\Admin;
|
||||||
|
use Slowlyo\OwlAdmin\Models\AdminRole as Model;
|
||||||
|
|
||||||
|
class AdminRole extends Model
|
||||||
|
{
|
||||||
|
protected static function boot(): void
|
||||||
|
{
|
||||||
|
parent::boot();
|
||||||
|
|
||||||
|
static::deleting(function (AdminRole $model) {
|
||||||
|
$model->menus()->detach();
|
||||||
|
$model->permissions()->detach();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function menus(): BelongsToMany
|
||||||
|
{
|
||||||
|
return $this->belongsToMany(Admin::adminMenuModel()::class, 'admin_role_menus', 'role_id', 'menu_id');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,56 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
use Slowlyo\OwlAdmin\Admin;
|
||||||
|
use Slowlyo\OwlAdmin\Models\AdminUser as Model;
|
||||||
|
|
||||||
|
class AdminUser extends Model
|
||||||
|
{
|
||||||
|
public function roles(): BelongsToMany
|
||||||
|
{
|
||||||
|
return $this->belongsToMany(Admin::adminRoleModel(), 'admin_role_users', 'user_id', 'role_id')->withTimestamps();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function allMenus(): Collection
|
||||||
|
{
|
||||||
|
$model = Admin::adminMenuModel();
|
||||||
|
$allMenus = $model::all()->keyBy($this->getKeyName());
|
||||||
|
|
||||||
|
if ($this->isAdministrator()) {
|
||||||
|
return $allMenus;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @var \Illuminate\Database\Eloquent\Collection */
|
||||||
|
$roleMenus = $this->roles
|
||||||
|
->pluck('menus')
|
||||||
|
->flatten()
|
||||||
|
->keyBy($this->getKeyName());
|
||||||
|
|
||||||
|
$allRoleMenus = $roleMenus->collect();
|
||||||
|
|
||||||
|
foreach ($roleMenus as $roleMenu) {
|
||||||
|
if (is_null($roleMenu->parent_id) || $allRoleMenus->has($roleMenu->parent_id)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$parent = $allMenus->get($roleMenu->parent_id);
|
||||||
|
|
||||||
|
while ($parent) {
|
||||||
|
$allRoleMenus->put($parent->id, $parent);
|
||||||
|
|
||||||
|
if (is_null($parent->parent_id)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$parent = $allMenus->get($parent->parent_id);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
unset($allMenus, $roleMenus);
|
||||||
|
|
||||||
|
return $allRoleMenus;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -11,8 +11,7 @@ class AppServiceProvider extends ServiceProvider
|
||||||
*/
|
*/
|
||||||
public function register(): void
|
public function register(): void
|
||||||
{
|
{
|
||||||
//
|
$this->app->singleton('admin.menu', \App\Admin\Menu::class);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,10 @@ return [
|
||||||
'name' => 'Owl Admin',
|
'name' => 'Owl Admin',
|
||||||
|
|
||||||
// 应用 logo
|
// 应用 logo
|
||||||
'logo' => '/admin/logo.png',
|
'logo' => '/admin-assets/logo.png',
|
||||||
|
|
||||||
// 默认头像
|
// 默认头像
|
||||||
'default_avatar' => '/admin/default-avatar.png',
|
'default_avatar' => '/admin-assets/default-avatar.png',
|
||||||
|
|
||||||
// 应用安装目录
|
// 应用安装目录
|
||||||
'directory' => app_path('Admin'),
|
'directory' => app_path('Admin'),
|
||||||
|
|
@ -45,7 +45,7 @@ return [
|
||||||
'providers' => [
|
'providers' => [
|
||||||
'admin' => [
|
'admin' => [
|
||||||
'driver' => 'eloquent',
|
'driver' => 'eloquent',
|
||||||
'model' => \Slowlyo\OwlAdmin\Models\AdminUser::class,
|
'model' => \App\Models\AdminUser::class,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'except' => [
|
'except' => [
|
||||||
|
|
@ -61,12 +61,6 @@ return [
|
||||||
'file' => 'files',
|
'file' => 'files',
|
||||||
'rich' => 'rich',
|
'rich' => 'rich',
|
||||||
],
|
],
|
||||||
// 临时目录
|
|
||||||
'tem_directory' => [
|
|
||||||
'image' => 'temporary/images',
|
|
||||||
'file' => 'temporary/file',
|
|
||||||
'rich' => 'temporary/rich',
|
|
||||||
]
|
|
||||||
],
|
],
|
||||||
|
|
||||||
'https' => env('ADMIN_HTTPS', false),
|
'https' => env('ADMIN_HTTPS', false),
|
||||||
|
|
@ -109,9 +103,13 @@ return [
|
||||||
'footer' => '<a href="https://github.com/slowlyo/owl-admin" target="_blank">Owl Admin</a>',
|
'footer' => '<a href="https://github.com/slowlyo/owl-admin" target="_blank">Owl Admin</a>',
|
||||||
],
|
],
|
||||||
|
|
||||||
|
'database' => [
|
||||||
|
'connection' => env('DB_CONNECTION', 'mysql'),
|
||||||
|
],
|
||||||
|
|
||||||
'models' => [
|
'models' => [
|
||||||
'admin_user' => \Slowlyo\OwlAdmin\Models\AdminUser::class,
|
'admin_user' => \App\Models\AdminUser::class,
|
||||||
'admin_role' => \Slowlyo\OwlAdmin\Models\AdminRole::class,
|
'admin_role' => \App\Models\AdminRole::class,
|
||||||
'admin_menu' => \Slowlyo\OwlAdmin\Models\AdminMenu::class,
|
'admin_menu' => \Slowlyo\OwlAdmin\Models\AdminMenu::class,
|
||||||
'admin_permission' => \Slowlyo\OwlAdmin\Models\AdminPermission::class,
|
'admin_permission' => \Slowlyo\OwlAdmin\Models\AdminPermission::class,
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('admin_menus', function (Blueprint $table) {
|
||||||
|
$table->string('slug')->unique()->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('admin_menus', function (Blueprint $table) {
|
||||||
|
$table->dropColumn(['slug']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('admin_permissions', function (Blueprint $table) {
|
||||||
|
$table->dropUnique(['name']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('admin_permissions', function (Blueprint $table) {
|
||||||
|
$table->unique(['name']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('admin_permissions', function (Blueprint $table) {
|
||||||
|
$table->string('slug')->change();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('admin_permissions', function (Blueprint $table) {
|
||||||
|
$table->string('slug', 50)->change();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('admin_role_menus', function (Blueprint $table) {
|
||||||
|
$table->integer('role_id');
|
||||||
|
$table->integer('menu_id');
|
||||||
|
$table->index(['role_id', 'menu_id']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('admin_role_menus');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,168 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
use Slowlyo\OwlAdmin\Models\AdminMenu;
|
||||||
|
use Slowlyo\OwlAdmin\Models\AdminPermission;
|
||||||
|
|
||||||
|
class AdminPermissionSeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| 主页
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
'home' => [
|
||||||
|
'name' => '主页',
|
||||||
|
'icon' => 'line-md:home-twotone-alt',
|
||||||
|
'uri' => '/',
|
||||||
|
'children' => [],
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| 系统管理
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
'system' => [
|
||||||
|
'name' => '系统管理',
|
||||||
|
'icon' => 'material-symbols:settings-outline',
|
||||||
|
'uri' => '',
|
||||||
|
'children' => [
|
||||||
|
'admin_users' => [
|
||||||
|
'name' => '账号管理',
|
||||||
|
'icon' => 'ph:user-gear',
|
||||||
|
'uri' => '/system/admin_users',
|
||||||
|
'resource' => ['list', 'create', 'update', 'delete'],
|
||||||
|
'children' => ['change_password' => '修改密码'],
|
||||||
|
],
|
||||||
|
'admin_roles' => [
|
||||||
|
'name' => '角色管理',
|
||||||
|
'icon' => 'carbon:user-role',
|
||||||
|
'uri' => '/system/admin_roles',
|
||||||
|
'resource' => ['list', 'create', 'update', 'delete'],
|
||||||
|
'children' => [
|
||||||
|
'set_menus' => '设置菜单',
|
||||||
|
'set_permissions' => '设置权限',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'admin_permissions' => [
|
||||||
|
'name' => '权限管理',
|
||||||
|
'icon' => 'fluent-mdl2:permissions',
|
||||||
|
'uri' => '/system/admin_permissions',
|
||||||
|
'resource' => ['list', 'create', 'update', 'delete'],
|
||||||
|
'children' => [],
|
||||||
|
],
|
||||||
|
'admin_menus' => [
|
||||||
|
'name' => '菜单管理',
|
||||||
|
'icon' => 'ant-design:menu-unfold-outlined',
|
||||||
|
'uri' => '/system/admin_menus',
|
||||||
|
'resource' => ['list', 'create', 'update', 'delete'],
|
||||||
|
'children' => [],
|
||||||
|
],
|
||||||
|
'settings' => [
|
||||||
|
'name' => '系统设置',
|
||||||
|
'icon' => 'akar-icons:settings-horizontal',
|
||||||
|
'uri' => '/system/settings',
|
||||||
|
'resource' => true,
|
||||||
|
'children' => [],
|
||||||
|
],
|
||||||
|
'keywords' => [
|
||||||
|
'name' => '数据字典',
|
||||||
|
'icon' => 'ph:codesandbox-logo-light',
|
||||||
|
'uri' => '/system/keywords',
|
||||||
|
'resource' => ['list', 'create', 'update', 'delete'],
|
||||||
|
'children' => [],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->handleAdminMenus($data);
|
||||||
|
$this->handleAdminPermissions($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handleAdminMenus(array $data, ?AdminMenu $parent = null): void
|
||||||
|
{
|
||||||
|
foreach ($data as $slug => $node) {
|
||||||
|
if (! is_array($node) || ! array_key_exists('uri', $node)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @var \Slowlyo\OwlAdmin\Models\AdminMenu */
|
||||||
|
$menu = AdminMenu::updateOrCreate([
|
||||||
|
'slug' => ($parent->slug ?? 'admin').'.'.$slug,
|
||||||
|
], [
|
||||||
|
'parent_id' => $parent->id ?? 0,
|
||||||
|
'order' => $node['order'] ?? 0,
|
||||||
|
'title' => $node['name'],
|
||||||
|
'icon' => $node['icon'],
|
||||||
|
'url' => $node['uri'],
|
||||||
|
'url_type' => $node['uri_type'] ?? 1,
|
||||||
|
'visible' => $node['visible'] ?? 1,
|
||||||
|
'is_home' => $node['is_home'] ?? 0,
|
||||||
|
'is_full' => $node['is_full'] ?? 0,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->handleAdminMenus($node['children'] ?? [], $menu);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function handleAdminPermissions(array $data, ?AdminPermission $parent = null)
|
||||||
|
{
|
||||||
|
foreach ($data as $slug => $node) {
|
||||||
|
$permission = AdminPermission::updateOrCreate([
|
||||||
|
'slug' => ($parent->slug ?? 'admin') . '.' . $slug,
|
||||||
|
], [
|
||||||
|
'parent_id' => $parent->id ?? 0,
|
||||||
|
'name' => is_array($node) ? $node['name'] : $node,
|
||||||
|
]);
|
||||||
|
|
||||||
|
if (! is_array($node)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 资源路由权限
|
||||||
|
if (array_key_exists('resource', $node)) {
|
||||||
|
$resourceAbilities = [];
|
||||||
|
|
||||||
|
if (is_array($node['resource'])) {
|
||||||
|
$resourceAbilities = $node['resource'];
|
||||||
|
} elseif ($node['resource'] === true) {
|
||||||
|
$resourceAbilities = array_keys($this->resourceAbilityMap());
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($resourceAbilities as $resourceAbility) {
|
||||||
|
AdminPermission::updateOrCreate([
|
||||||
|
'slug' => $permission->slug . '.' . $resourceAbility,
|
||||||
|
], [
|
||||||
|
'parent_id' => $permission->id,
|
||||||
|
'name' => $this->resourceAbilityMap()[$resourceAbility],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->handleAdminPermissions($node['children'] ?? [], $permission);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function resourceAbilityMap(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'list' => '列表',
|
||||||
|
'create' => '新增',
|
||||||
|
'update' => '编辑',
|
||||||
|
'delete' => '删除',
|
||||||
|
'view' => '查看',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -15,6 +15,7 @@ class AdminSeeder extends Seeder
|
||||||
{
|
{
|
||||||
$this->call([
|
$this->call([
|
||||||
KeywordSeeder::class,
|
KeywordSeeder::class,
|
||||||
|
AdminPermissionSeeder::class,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,21 +60,6 @@ return [
|
||||||
'cancel' => '取消',
|
'cancel' => '取消',
|
||||||
'please_login' => '请先登录',
|
'please_login' => '请先登录',
|
||||||
'unauthorized' => '无权访问',
|
'unauthorized' => '无权访问',
|
||||||
'id' => 'ID',
|
|
||||||
|
|
||||||
'components' => [
|
|
||||||
'content' => '内容',
|
|
||||||
'parent_select' => '父级',
|
|
||||||
'order' => '排序',
|
|
||||||
'decimal' => '金额',
|
|
||||||
'status' => '状态',
|
|
||||||
'status_map' => [
|
|
||||||
'enabled' => '已启用',
|
|
||||||
'disabled' => '已禁用',
|
|
||||||
],
|
|
||||||
'tag' => '标签',
|
|
||||||
'files' => '文件'
|
|
||||||
],
|
|
||||||
|
|
||||||
'code_generators' => [
|
'code_generators' => [
|
||||||
'remark1' => '额外参数请参考',
|
'remark1' => '额外参数请参考',
|
||||||
|
|
@ -157,8 +142,6 @@ return [
|
||||||
'old_password_required' => '请输入原密码',
|
'old_password_required' => '请输入原密码',
|
||||||
'old_password_error' => '原密码错误',
|
'old_password_error' => '原密码错误',
|
||||||
'username_already_exists' => '用户名已存在',
|
'username_already_exists' => '用户名已存在',
|
||||||
'lock' => '锁定',
|
|
||||||
'edit_password' => '修改密码'
|
|
||||||
],
|
],
|
||||||
|
|
||||||
'admin_roles' => '角色',
|
'admin_roles' => '角色',
|
||||||
|
|
@ -269,43 +252,4 @@ return [
|
||||||
'selected_rows_no_data' => '请选择要导出的数据',
|
'selected_rows_no_data' => '请选择要导出的数据',
|
||||||
'please_install_laravel_excel' => '请先安装 laravel-excel 扩展',
|
'please_install_laravel_excel' => '请先安装 laravel-excel 扩展',
|
||||||
],
|
],
|
||||||
'keywords' => [
|
|
||||||
'search_name' => '名称/KEY',
|
|
||||||
'parent_keyword' => '父级关键字',
|
|
||||||
],
|
|
||||||
'articles' => [
|
|
||||||
'id' => '主键ID',
|
|
||||||
'title' => '标题',
|
|
||||||
'content' => '内容',
|
|
||||||
'cover' =>'封面',
|
|
||||||
'category' => '分类',
|
|
||||||
'tags' => '标签',
|
|
||||||
't_ids' => '标签',
|
|
||||||
'published_at' => '定时发布',
|
|
||||||
'published_at_g' => '发布时间',
|
|
||||||
'is_enable' => '显示',
|
|
||||||
'is_recommend' => '推荐',
|
|
||||||
'sort' => '排序',
|
|
||||||
'appendixes' => '附件',
|
|
||||||
'published_at_remark' => '*若未设置发布时间且操作设置为显示,则默认生成发布时间',
|
|
||||||
],
|
|
||||||
'ads' => [
|
|
||||||
'id' => 'ID',
|
|
||||||
'address' => '位置',
|
|
||||||
'resource' =>'内容',
|
|
||||||
'published_at' => '定时发布',
|
|
||||||
'published_at_g' => '发布时间',
|
|
||||||
'is_enable' => '显示',
|
|
||||||
'remark' => '备注',
|
|
||||||
'sort' => '排序',
|
|
||||||
'published_at_remark' => '*若未设置发布时间且操作设置为显示,则默认生成发布时间',
|
|
||||||
'jump_type' => '跳转类型',
|
|
||||||
'jump_config'=>'跳转配置',
|
|
||||||
'jump_config_arr'=>[
|
|
||||||
'web_link' => '网页地址',
|
|
||||||
'app_link' => '应用路径',
|
|
||||||
'mini_id' => '小程序ID',
|
|
||||||
'mini_link'=> '小程序路径'
|
|
||||||
],
|
|
||||||
]
|
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -2,15 +2,10 @@
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'dashboard' => '控制台',
|
'dashboard' => '控制台',
|
||||||
'index' => '主页',
|
|
||||||
'admin_system' => '系统管理',
|
'admin_system' => '系统管理',
|
||||||
'admin_users' => '管理员',
|
'admin_users' => '管理员',
|
||||||
'admin_roles' => '角色',
|
'admin_roles' => '角色',
|
||||||
'admin_permission' => '权限',
|
'admin_permission' => '权限',
|
||||||
'admin_menu' => '菜单',
|
'admin_menu' => '菜单',
|
||||||
'admin_setting' => '设置',
|
'admin_setting' => '设置',
|
||||||
'keywords' => '数据字典',
|
|
||||||
'web_content' => '内容管理',
|
|
||||||
'articles' => '文章管理',
|
|
||||||
'ads' => '广告管理',
|
|
||||||
];
|
];
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
|
|
@ -1,4 +1,4 @@
|
||||||
import{ct as Rt,e as Lt}from"./index-794802cd.js";import{h as Bt}from"./index-a466bea1.js";function Xt(J,rt){for(var $=0;$<rt.length;$++){const Y=rt[$];if(typeof Y!="string"&&!Array.isArray(Y)){for(const R in Y)if(R!=="default"&&!(R in J)){const j=Object.getOwnPropertyDescriptor(Y,R);j&&Object.defineProperty(J,R,j.get?j:{enumerable:!0,get:()=>Y[R]})}}}return Object.freeze(Object.defineProperty(J,Symbol.toStringTag,{value:"Module"}))}var Tt={exports:{}};const Yt=Rt(Bt);(function(J,rt){(function(Y,R){J.exports=R(Yt)})(self,function($){return(()=>{var Y={"./index.js":(L,K,mt)=>{mt.r(K);var O=mt("echarts/lib/echarts");O.extendSeriesModel({type:"series.wordCloud",visualStyleAccessPath:"textStyle",visualStyleMapper:function(f){return{fill:f.get("color")}},visualDrawType:"fill",optionUpdated:function(){var f=this.option;f.gridSize=Math.max(Math.floor(f.gridSize),4)},getInitialData:function(f,o){var a=O.helper.createDimensions(f.data,{coordDimensions:["value"]}),l=new O.List(a,this);return l.initData(f.data),l},defaultOption:{maskImage:null,shape:"circle",keepAspect:!1,left:"center",top:"center",width:"70%",height:"80%",sizeRange:[12,60],rotationRange:[-90,90],rotationStep:45,gridSize:8,drawOutOfBound:!1,shrinkToFit:!1,textStyle:{fontWeight:"normal"}}}),O.extendChartView({type:"wordCloud",render:function(f,o,a){var l=this.group;l.removeAll();var t=f.getData(),x=f.get("gridSize");f.layoutInstance.ondraw=function(d,r,T,P){var B=t.getItemModel(T),q=B.getModel("textStyle"),b=new O.graphic.Text({style:O.helper.createTextStyle(q),scaleX:1/P.info.mu,scaleY:1/P.info.mu,x:(P.gx+P.info.gw/2)*x,y:(P.gy+P.info.gh/2)*x,rotation:P.rot});b.setStyle({x:P.info.fillTextOffsetX,y:P.info.fillTextOffsetY+r*.5,text:d,verticalAlign:"middle",fill:t.getItemVisual(T,"style").fill,fontSize:r}),l.add(b),t.setItemGraphicEl(T,b),b.ensureState("emphasis").style=O.helper.createTextStyle(B.getModel(["emphasis","textStyle"]),{state:"emphasis"}),b.ensureState("blur").style=O.helper.createTextStyle(B.getModel(["blur","textStyle"]),{state:"blur"}),O.helper.enableHoverEmphasis(b,B.get(["emphasis","focus"]),B.get(["emphasis","blurScope"])),b.stateTransition={duration:f.get("animation")?f.get(["stateAnimation","duration"]):0,easing:f.get(["stateAnimation","easing"])},b.__highDownDispatcher=!0},this._model=f},remove:function(){this.group.removeAll(),this._model.layoutInstance.dispose()},dispose:function(){this._model.layoutInstance.dispose()}});/*!
|
import{cu as Rt,f as Lt}from"./index-c791cd12.js";import{h as Bt}from"./index-a466bea1.js";function Xt(J,rt){for(var $=0;$<rt.length;$++){const Y=rt[$];if(typeof Y!="string"&&!Array.isArray(Y)){for(const R in Y)if(R!=="default"&&!(R in J)){const j=Object.getOwnPropertyDescriptor(Y,R);j&&Object.defineProperty(J,R,j.get?j:{enumerable:!0,get:()=>Y[R]})}}}return Object.freeze(Object.defineProperty(J,Symbol.toStringTag,{value:"Module"}))}var Tt={exports:{}};const Yt=Rt(Bt);(function(J,rt){(function(Y,R){J.exports=R(Yt)})(self,function($){return(()=>{var Y={"./index.js":(L,K,mt)=>{mt.r(K);var O=mt("echarts/lib/echarts");O.extendSeriesModel({type:"series.wordCloud",visualStyleAccessPath:"textStyle",visualStyleMapper:function(f){return{fill:f.get("color")}},visualDrawType:"fill",optionUpdated:function(){var f=this.option;f.gridSize=Math.max(Math.floor(f.gridSize),4)},getInitialData:function(f,o){var a=O.helper.createDimensions(f.data,{coordDimensions:["value"]}),l=new O.List(a,this);return l.initData(f.data),l},defaultOption:{maskImage:null,shape:"circle",keepAspect:!1,left:"center",top:"center",width:"70%",height:"80%",sizeRange:[12,60],rotationRange:[-90,90],rotationStep:45,gridSize:8,drawOutOfBound:!1,shrinkToFit:!1,textStyle:{fontWeight:"normal"}}}),O.extendChartView({type:"wordCloud",render:function(f,o,a){var l=this.group;l.removeAll();var t=f.getData(),x=f.get("gridSize");f.layoutInstance.ondraw=function(d,r,T,P){var B=t.getItemModel(T),q=B.getModel("textStyle"),b=new O.graphic.Text({style:O.helper.createTextStyle(q),scaleX:1/P.info.mu,scaleY:1/P.info.mu,x:(P.gx+P.info.gw/2)*x,y:(P.gy+P.info.gh/2)*x,rotation:P.rot});b.setStyle({x:P.info.fillTextOffsetX,y:P.info.fillTextOffsetY+r*.5,text:d,verticalAlign:"middle",fill:t.getItemVisual(T,"style").fill,fontSize:r}),l.add(b),t.setItemGraphicEl(T,b),b.ensureState("emphasis").style=O.helper.createTextStyle(B.getModel(["emphasis","textStyle"]),{state:"emphasis"}),b.ensureState("blur").style=O.helper.createTextStyle(B.getModel(["blur","textStyle"]),{state:"blur"}),O.helper.enableHoverEmphasis(b,B.get(["emphasis","focus"]),B.get(["emphasis","blurScope"])),b.stateTransition={duration:f.get("animation")?f.get(["stateAnimation","duration"]):0,easing:f.get(["stateAnimation","easing"])},b.__highDownDispatcher=!0},this._model=f},remove:function(){this.group.removeAll(),this._model.layoutInstance.dispose()},dispose:function(){this._model.layoutInstance.dispose()}});/*!
|
||||||
* wordcloud2.js
|
* wordcloud2.js
|
||||||
* http://timdream.org/wordcloud2.js/
|
* http://timdream.org/wordcloud2.js/
|
||||||
*
|
*
|
||||||
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
|
|
@ -1 +1 @@
|
||||||
import{l as e}from"./editor.main-1a036850.js";import"./index-794802cd.js";var t=["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"],r={wordPattern:/(-?\d*\.\d\w*)|([^\`\~\!\@\$\^\&\*\(\)\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\s]+)/g,comments:{blockComment:["<!--","-->"]},brackets:[["<!--","-->"],["<",">"],["{","}"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],surroundingPairs:[{open:'"',close:'"'},{open:"'",close:"'"},{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:"<",close:">"}],onEnterRules:[{beforeText:new RegExp("<(?!(?:"+t.join("|")+"))([_:\\w][_:\\w-.\\d]*)([^/>]*(?!/)>)[^<]*$","i"),afterText:/^<\/([_:\w][_:\w-.\d]*)\s*>$/i,action:{indentAction:e.IndentAction.IndentOutdent}},{beforeText:new RegExp("<(?!(?:"+t.join("|")+"))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$","i"),action:{indentAction:e.IndentAction.Indent}}],folding:{markers:{start:new RegExp("^\\s*<!--\\s*#region\\b.*-->"),end:new RegExp("^\\s*<!--\\s*#endregion\\b.*-->")}}},o={defaultToken:"",tokenPostfix:".html",ignoreCase:!0,tokenizer:{root:[[/<!DOCTYPE/,"metatag","@doctype"],[/<!--/,"comment","@comment"],[/(<)((?:[\w\-]+:)?[\w\-]+)(\s*)(\/>)/,["delimiter","tag","","delimiter"]],[/(<)(script)/,["delimiter",{token:"tag",next:"@script"}]],[/(<)(style)/,["delimiter",{token:"tag",next:"@style"}]],[/(<)((?:[\w\-]+:)?[\w\-]+)/,["delimiter",{token:"tag",next:"@otherTag"}]],[/(<\/)((?:[\w\-]+:)?[\w\-]+)/,["delimiter",{token:"tag",next:"@otherTag"}]],[/</,"delimiter"],[/[^<]+/]],doctype:[[/[^>]+/,"metatag.content"],[/>/,"metatag","@pop"]],comment:[[/-->/,"comment","@pop"],[/[^-]+/,"comment.content"],[/./,"comment.content"]],otherTag:[[/\/?>/,"delimiter","@pop"],[/"([^"]*)"/,"attribute.value"],[/'([^']*)'/,"attribute.value"],[/[\w\-]+/,"attribute.name"],[/=/,"delimiter"],[/[ \t\r\n]+/]],script:[[/type/,"attribute.name","@scriptAfterType"],[/"([^"]*)"/,"attribute.value"],[/'([^']*)'/,"attribute.value"],[/[\w\-]+/,"attribute.name"],[/=/,"delimiter"],[/>/,{token:"delimiter",next:"@scriptEmbedded",nextEmbedded:"text/javascript"}],[/[ \t\r\n]+/],[/(<\/)(script\s*)(>)/,["delimiter","tag",{token:"delimiter",next:"@pop"}]]],scriptAfterType:[[/=/,"delimiter","@scriptAfterTypeEquals"],[/>/,{token:"delimiter",next:"@scriptEmbedded",nextEmbedded:"text/javascript"}],[/[ \t\r\n]+/],[/<\/script\s*>/,{token:"@rematch",next:"@pop"}]],scriptAfterTypeEquals:[[/"([^"]*)"/,{token:"attribute.value",switchTo:"@scriptWithCustomType.$1"}],[/'([^']*)'/,{token:"attribute.value",switchTo:"@scriptWithCustomType.$1"}],[/>/,{token:"delimiter",next:"@scriptEmbedded",nextEmbedded:"text/javascript"}],[/[ \t\r\n]+/],[/<\/script\s*>/,{token:"@rematch",next:"@pop"}]],scriptWithCustomType:[[/>/,{token:"delimiter",next:"@scriptEmbedded.$S2",nextEmbedded:"$S2"}],[/"([^"]*)"/,"attribute.value"],[/'([^']*)'/,"attribute.value"],[/[\w\-]+/,"attribute.name"],[/=/,"delimiter"],[/[ \t\r\n]+/],[/<\/script\s*>/,{token:"@rematch",next:"@pop"}]],scriptEmbedded:[[/<\/script/,{token:"@rematch",next:"@pop",nextEmbedded:"@pop"}],[/[^<]+/,""]],style:[[/type/,"attribute.name","@styleAfterType"],[/"([^"]*)"/,"attribute.value"],[/'([^']*)'/,"attribute.value"],[/[\w\-]+/,"attribute.name"],[/=/,"delimiter"],[/>/,{token:"delimiter",next:"@styleEmbedded",nextEmbedded:"text/css"}],[/[ \t\r\n]+/],[/(<\/)(style\s*)(>)/,["delimiter","tag",{token:"delimiter",next:"@pop"}]]],styleAfterType:[[/=/,"delimiter","@styleAfterTypeEquals"],[/>/,{token:"delimiter",next:"@styleEmbedded",nextEmbedded:"text/css"}],[/[ \t\r\n]+/],[/<\/style\s*>/,{token:"@rematch",next:"@pop"}]],styleAfterTypeEquals:[[/"([^"]*)"/,{token:"attribute.value",switchTo:"@styleWithCustomType.$1"}],[/'([^']*)'/,{token:"attribute.value",switchTo:"@styleWithCustomType.$1"}],[/>/,{token:"delimiter",next:"@styleEmbedded",nextEmbedded:"text/css"}],[/[ \t\r\n]+/],[/<\/style\s*>/,{token:"@rematch",next:"@pop"}]],styleWithCustomType:[[/>/,{token:"delimiter",next:"@styleEmbedded.$S2",nextEmbedded:"$S2"}],[/"([^"]*)"/,"attribute.value"],[/'([^']*)'/,"attribute.value"],[/[\w\-]+/,"attribute.name"],[/=/,"delimiter"],[/[ \t\r\n]+/],[/<\/style\s*>/,{token:"@rematch",next:"@pop"}]],styleEmbedded:[[/<\/style/,{token:"@rematch",next:"@pop",nextEmbedded:"@pop"}],[/[^<]+/,""]]}};export{r as conf,o as language};
|
import{l as e}from"./editor.main-adb31ab8.js";import"./index-c791cd12.js";var t=["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"],r={wordPattern:/(-?\d*\.\d\w*)|([^\`\~\!\@\$\^\&\*\(\)\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\s]+)/g,comments:{blockComment:["<!--","-->"]},brackets:[["<!--","-->"],["<",">"],["{","}"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],surroundingPairs:[{open:'"',close:'"'},{open:"'",close:"'"},{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:"<",close:">"}],onEnterRules:[{beforeText:new RegExp("<(?!(?:"+t.join("|")+"))([_:\\w][_:\\w-.\\d]*)([^/>]*(?!/)>)[^<]*$","i"),afterText:/^<\/([_:\w][_:\w-.\d]*)\s*>$/i,action:{indentAction:e.IndentAction.IndentOutdent}},{beforeText:new RegExp("<(?!(?:"+t.join("|")+"))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$","i"),action:{indentAction:e.IndentAction.Indent}}],folding:{markers:{start:new RegExp("^\\s*<!--\\s*#region\\b.*-->"),end:new RegExp("^\\s*<!--\\s*#endregion\\b.*-->")}}},o={defaultToken:"",tokenPostfix:".html",ignoreCase:!0,tokenizer:{root:[[/<!DOCTYPE/,"metatag","@doctype"],[/<!--/,"comment","@comment"],[/(<)((?:[\w\-]+:)?[\w\-]+)(\s*)(\/>)/,["delimiter","tag","","delimiter"]],[/(<)(script)/,["delimiter",{token:"tag",next:"@script"}]],[/(<)(style)/,["delimiter",{token:"tag",next:"@style"}]],[/(<)((?:[\w\-]+:)?[\w\-]+)/,["delimiter",{token:"tag",next:"@otherTag"}]],[/(<\/)((?:[\w\-]+:)?[\w\-]+)/,["delimiter",{token:"tag",next:"@otherTag"}]],[/</,"delimiter"],[/[^<]+/]],doctype:[[/[^>]+/,"metatag.content"],[/>/,"metatag","@pop"]],comment:[[/-->/,"comment","@pop"],[/[^-]+/,"comment.content"],[/./,"comment.content"]],otherTag:[[/\/?>/,"delimiter","@pop"],[/"([^"]*)"/,"attribute.value"],[/'([^']*)'/,"attribute.value"],[/[\w\-]+/,"attribute.name"],[/=/,"delimiter"],[/[ \t\r\n]+/]],script:[[/type/,"attribute.name","@scriptAfterType"],[/"([^"]*)"/,"attribute.value"],[/'([^']*)'/,"attribute.value"],[/[\w\-]+/,"attribute.name"],[/=/,"delimiter"],[/>/,{token:"delimiter",next:"@scriptEmbedded",nextEmbedded:"text/javascript"}],[/[ \t\r\n]+/],[/(<\/)(script\s*)(>)/,["delimiter","tag",{token:"delimiter",next:"@pop"}]]],scriptAfterType:[[/=/,"delimiter","@scriptAfterTypeEquals"],[/>/,{token:"delimiter",next:"@scriptEmbedded",nextEmbedded:"text/javascript"}],[/[ \t\r\n]+/],[/<\/script\s*>/,{token:"@rematch",next:"@pop"}]],scriptAfterTypeEquals:[[/"([^"]*)"/,{token:"attribute.value",switchTo:"@scriptWithCustomType.$1"}],[/'([^']*)'/,{token:"attribute.value",switchTo:"@scriptWithCustomType.$1"}],[/>/,{token:"delimiter",next:"@scriptEmbedded",nextEmbedded:"text/javascript"}],[/[ \t\r\n]+/],[/<\/script\s*>/,{token:"@rematch",next:"@pop"}]],scriptWithCustomType:[[/>/,{token:"delimiter",next:"@scriptEmbedded.$S2",nextEmbedded:"$S2"}],[/"([^"]*)"/,"attribute.value"],[/'([^']*)'/,"attribute.value"],[/[\w\-]+/,"attribute.name"],[/=/,"delimiter"],[/[ \t\r\n]+/],[/<\/script\s*>/,{token:"@rematch",next:"@pop"}]],scriptEmbedded:[[/<\/script/,{token:"@rematch",next:"@pop",nextEmbedded:"@pop"}],[/[^<]+/,""]],style:[[/type/,"attribute.name","@styleAfterType"],[/"([^"]*)"/,"attribute.value"],[/'([^']*)'/,"attribute.value"],[/[\w\-]+/,"attribute.name"],[/=/,"delimiter"],[/>/,{token:"delimiter",next:"@styleEmbedded",nextEmbedded:"text/css"}],[/[ \t\r\n]+/],[/(<\/)(style\s*)(>)/,["delimiter","tag",{token:"delimiter",next:"@pop"}]]],styleAfterType:[[/=/,"delimiter","@styleAfterTypeEquals"],[/>/,{token:"delimiter",next:"@styleEmbedded",nextEmbedded:"text/css"}],[/[ \t\r\n]+/],[/<\/style\s*>/,{token:"@rematch",next:"@pop"}]],styleAfterTypeEquals:[[/"([^"]*)"/,{token:"attribute.value",switchTo:"@styleWithCustomType.$1"}],[/'([^']*)'/,{token:"attribute.value",switchTo:"@styleWithCustomType.$1"}],[/>/,{token:"delimiter",next:"@styleEmbedded",nextEmbedded:"text/css"}],[/[ \t\r\n]+/],[/<\/style\s*>/,{token:"@rematch",next:"@pop"}]],styleWithCustomType:[[/>/,{token:"delimiter",next:"@styleEmbedded.$S2",nextEmbedded:"$S2"}],[/"([^"]*)"/,"attribute.value"],[/'([^']*)'/,"attribute.value"],[/[\w\-]+/,"attribute.name"],[/=/,"delimiter"],[/[ \t\r\n]+/],[/<\/style\s*>/,{token:"@rematch",next:"@pop"}]],styleEmbedded:[[/<\/style/,{token:"@rematch",next:"@pop",nextEmbedded:"@pop"}],[/[^<]+/,""]]}};export{r as conf,o as language};
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue