提交 314af25a 作者: 方治民

feat: 接入 pont 接口生成工具、统一代码格式

上级 ebec3835
......@@ -14,6 +14,7 @@ VITE_DROP_CONSOLE = false
# Basic interface address SPA
VITE_GLOB_API_URL=/basic-api
# VITE_GLOB_API_URL=http://localhost:8181/basic-api
# File upload address, optional
VITE_GLOB_UPLOAD_URL=/upload
......
......@@ -15,11 +15,7 @@ module.exports = {
jsx: true,
},
},
extends: [
'plugin:vue/vue3-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
],
extends: ['plugin:vue/vue3-recommended', 'plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'],
rules: {
'vue/script-setup-uses-vars': 'error',
'@typescript-eslint/ban-ts-ignore': 'off',
......
......@@ -27,3 +27,5 @@ pnpm-debug.log*
*.njsproj
*.sln
*.sw?
.mocks/
\ No newline at end of file
......@@ -33,7 +33,6 @@
},
"files.exclude": {
"**/.cache": true,
"**/.editorconfig": true,
"**/.eslintcache": true,
"**/bower_components": true,
"**/.idea": true,
......
......@@ -9,12 +9,7 @@ export function resultSuccess<T = Recordable>(result: T, { message = 'ok' } = {}
}
}
export function resultPageSuccess<T = any>(
page: number,
pageSize: number,
list: T[],
{ message = 'ok' } = {},
) {
export function resultPageSuccess<T = any>(page: number, pageSize: number, list: T[], { message = 'ok' } = {}) {
const pageData = pagination(page, pageSize, list)
return {
......
......@@ -88,11 +88,9 @@ const menuList = (() => {
menuName: ['菜单1', '菜单2', '菜单3', '菜单4'][j],
icon: 'ion:document',
permission: ['menu1:view', 'menu2:add', 'menu3:update', 'menu4:del'][index],
component: [
'/dashboard/welcome/index',
'/dashboard/workbench/index',
'/dashboard/test/index',
][j],
component: ['/dashboard/welcome/index', '/dashboard/workbench/index', '/dashboard/test/index'][
j
],
orderNo: j + 1,
createTime: '@datetime',
'status|1': ['0', '1'],
......@@ -106,9 +104,7 @@ const menuList = (() => {
menuName: '按钮' + (j + 1) + '-' + (k + 1),
icon: '',
permission:
['menu1:view', 'menu2:add', 'menu3:update', 'menu4:del'][
index
] +
['menu1:view', 'menu2:add', 'menu3:update', 'menu4:del'][index] +
':btn' +
(k + 1),
component: [
......
......@@ -241,13 +241,11 @@ export default [
let menu: Object[]
switch (id) {
case '1':
dashboardRoute.redirect =
dashboardRoute.path + '/' + dashboardRoute.children[0].path
dashboardRoute.redirect = dashboardRoute.path + '/' + dashboardRoute.children[0].path
menu = [dashboardRoute, authRoute, levelRoute, sysRoute, linkRoute]
break
case '2':
dashboardRoute.redirect =
dashboardRoute.path + '/' + dashboardRoute.children[1].path
dashboardRoute.redirect = dashboardRoute.path + '/' + dashboardRoute.children[1].path
menu = [dashboardRoute, authRoute, levelRoute, linkRoute]
break
default:
......
......@@ -132,6 +132,7 @@
"lint-staged": "12.3.7",
"npm-run-all": "^4.1.5",
"picocolors": "^1.0.0",
"pont-engine": "^1.2.0",
"postcss": "^8.4.12",
"postcss-html": "^1.3.0",
"postcss-less": "^6.0.0",
......
{
"originUrl": "http://localhost:8181/basic-api/v2/api-docs",
"templatePath": "./pont.template",
"outDir": "./src/api/services",
"surrounding": "typeScript",
"mocks": {
"enable": true,
"basePath": "",
"port": 3101,
"wrapper": "{\"status\": 200, \"body\": {response}, \"message\": \"OK\"}"
},
"templateType": "fetch",
"prettierConfig": {
"printWidth": 120,
"semi": false,
"tabWidth": 4,
"singleQuote": true,
"trailingComma": "all",
"proseWrap": "never",
"endOfLine": "lf"
}
}
import { Interface, BaseClass, Property, CodeGenerator } from 'pont-engine'
export default class MyGenerator extends CodeGenerator {
getParams(inter: Interface) {
const requestParams = inter.getRequestParams(this.surrounding)
return `${requestParams.replace(
'options?: any',
`config?: axios.RequestConfig<Params${requestParams.includes('form') ? ' | FormData' : ''}>`,
)}, options?: axios.RequestOptions`
}
getInterfaceContentInDeclaration(inter: Interface) {
const requestParams = this.getParams(inter)
const paramsCode = inter.getParamsCode('Params')
return `
export ${paramsCode}
export type Response = ${inter.responseType.replace(/defs.Result\<(.*)\>/, '$1')};
export const init: Response;
export function request(${requestParams}): Promise<Response>;
`
}
getBaseClassInDeclaration(base: BaseClass) {
const originProps = base.properties
base.properties = base.properties.map((prop) => {
return new Property({
...prop,
required: false,
})
})
const result = super.getBaseClassInDeclaration(base)
base.properties = originProps
return result
}
getInterfaceContent(inter: Interface) {
const method = inter.method.toUpperCase()
const requestParams = this.getParams(inter)
const paramsCode = inter.getParamsCode('Params', this.surrounding)
return `
/**
* @desc ${inter.description}
*/
import * as defs from '../../baseClass';
import { defHttp } from '/@/utils/http/axios'
export ${paramsCode}
export const init = ${inter.response.getInitialValue()};
export function request(${requestParams}) {
return defHttp.request({
url: "${inter.path}",
method: '${method}',
${
method === 'GET'
? 'params'
: `data: ${requestParams.includes('form') ? 'form || params' : 'params'}`
},
...config,
}, options);
}
`
}
}
module.exports = {
printWidth: 100,
printWidth: 120,
semi: false,
tabWidth: 4,
vueIndentScriptAndStyle: true,
......@@ -7,5 +7,5 @@ module.exports = {
trailingComma: 'all',
proseWrap: 'never',
htmlWhitespaceSensitivity: 'strict',
endOfLine: 'auto',
endOfLine: 'lf',
}
This source diff could not be displayed because it is too large. You can view the blob instead.
export class LoginVo {
/** token */
token = ''
}
export class PageVo {
/** 数据 */
data = []
/** 数据最新时间 */
latest = ''
/** 数据总数 */
total = undefined
}
export class PermissionVo {
/** 子权限 */
children = []
/** 组件 */
component = ''
/** 是否启用 */
enable = false
/** 是否隐藏 */
hidden = false
/** 图标 */
icon = ''
/** 主键 */
id = undefined
/** 名称 */
name = ''
/** 路径 */
path = ''
/** 父级ID */
pid = undefined
/** 序号 */
serial = undefined
/** 权限类型 */
type = 'MENU'
/** 标识 */
uid = ''
}
export class Result {
/** 内容 */
body = new LoginVo()
/** 业务标识码 */
code = undefined
/** 详细信息 */
details = ''
/** 异常信息 */
error = ''
/** 消息 */
message = ''
/** 状态码 */
status = undefined
/** 耗时 */
times = ''
/** 响应时间 */
timestamp = ''
}
export class RoleVo {
/** 主键 */
id = undefined
/** 名称 */
name = ''
/** 权限 */
permissions = []
/** 标识 */
uid = ''
}
export class UserInfo {
/** 头像 */
avatar = ''
/** 邮箱 */
email = ''
/** 主页地址 */
homePath = ''
/** 手机号 */
mobile = ''
/** 权限 */
permissions = []
/** 真实姓名 */
realName = ''
/** 角色 */
roles = []
/** 职称 */
title = ''
/** 主键 */
userId = undefined
/** 用户名 */
username = ''
}
export class UserVo {
/** 头像 */
avatar = ''
/** 最后登录时间 */
createTime = ''
/** 是否删除 */
deleted = false
/** 邮箱 */
email = ''
/** 是否启用 */
enabled = false
/** 主键 */
id = undefined
/** 最后登录IP地址 */
lastLoginIp = ''
/** 最后登录时间 */
lastLoginTime = ''
/** 手机号 */
mobile = ''
/** 真实姓名 */
realName = ''
/** 职称 */
title = ''
/** 用户名 */
username = ''
}
import * as defs from './baseClass'
import './mods/'
;(window as any).defs = defs
/**
* @description
*/
import * as login from './login'
import * as logout from './logout'
import * as register from './register'
export { login, logout, register }
/**
* @desc 登录
*/
import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios'
export class Params {
/** 账号(支持用户名/手机号/邮箱) */
account: string
/** 密码 */
password: string
}
export const init = new defs.Result()
export function request(params: Params, config?: axios.RequestConfig<Params>, options?: axios.RequestOptions) {
return defHttp.request(
{
url: '/basic-api/auth/login',
method: 'POST',
data: params,
...config,
},
options,
)
}
/**
* @desc 登出
*/
import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios'
export class Params {}
export const init = new defs.Result()
export function request(params: Params, config?: axios.RequestConfig<Params>, options?: axios.RequestOptions) {
return defHttp.request(
{
url: '/basic-api/auth/logout',
method: 'GET',
params,
...config,
},
options,
)
}
/**
* @desc 注册
*/
import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios'
export class Params {
/** 头像 */
avatar?: string
/** 邮箱 */
email?: string
/** 是否启用 */
enable?: boolean
/** 手机号 */
mobile: string
/** 密码 */
password: string
/** 真实姓名 */
realName: string
/** 职称 */
title?: string
/** 用户名 */
username: string
}
export const init = new defs.Result()
export function request(params: Params, config?: axios.RequestConfig<Params>, options?: axios.RequestOptions) {
return defHttp.request(
{
url: '/basic-api/auth/register',
method: 'POST',
data: params,
...config,
},
options,
)
}
/**
* @desc fail
*/
import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios'
export class Params {}
export const init = new defs.Result()
export function request(params: Params, config?: axios.RequestConfig<Params>, options?: axios.RequestOptions) {
return defHttp.request(
{
url: '/basic-api/hello/fail',
method: 'GET',
params,
...config,
},
options,
)
}
/**
* @desc hello
*/
import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios'
export class Params {}
export const init = new defs.Result()
export function request(params: Params, config?: axios.RequestConfig<Params>, options?: axios.RequestOptions) {
return defHttp.request(
{
url: '/basic-api/hello/',
method: 'GET',
params,
...config,
},
options,
)
}
/**
* @description
*/
import * as hello from './hello'
import * as fail from './fail'
import * as page from './page'
export { hello, fail, page }
/**
* @desc page
*/
import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios'
export class Params {
/** 当前页数 */
pageNo: number
/** 分页条数 */
pageSize: number
/** 排序字段 */
sortField?: string
/** 排序方向(ASC|DESC) */
sortOrder?: 'ASC' | 'DESC'
}
export const init = new defs.Result()
export function request(params: Params, config?: axios.RequestConfig<Params>, options?: axios.RequestOptions) {
return defHttp.request(
{
url: '/basic-api/hello/page',
method: 'GET',
params,
...config,
},
options,
)
}
import * as auth from './auth'
import * as hello from './hello'
import * as minio from './minio'
import * as permission from './permission'
import * as role from './role'
import * as user from './user'
;(window as any).API = {
auth,
hello,
minio,
permission,
role,
user,
}
/**
* @description
*/
import * as upload from './upload'
export { upload }
/**
* @desc 文件上传
*/
import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios'
export class Params {}
export const init = new defs.Result()
export function request(
params: Params,
form: FormData,
config?: axios.RequestConfig<Params | FormData>,
options?: axios.RequestOptions,
) {
return defHttp.request(
{
url: '/basic-api/common/minio/upload',
method: 'POST',
data: form || params,
...config,
},
options,
)
}
/**
* @desc 新增
*/
import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios'
export class Params {
/** 组件 */
component?: string
/** 是否启用 */
enable?: boolean
/** 是否隐藏 */
hidden?: boolean
/** 图标 */
icon?: string
/** 名称 */
name: string
/** 路径 */
path?: string
/** 父级ID */
pid?: number
/** 序号 */
serial?: number
/** 权限类型 */
type: 'MENU' | 'BUTTON'
/** 标识 */
uid: string
}
export const init = new defs.Result()
export function request(params: Params, config?: axios.RequestConfig<Params>, options?: axios.RequestOptions) {
return defHttp.request(
{
url: '/basic-api/manage/permission/add',
method: 'POST',
data: params,
...config,
},
options,
)
}
/**
* @desc 删除
*/
import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios'
export class Params {
/** id */
id: number
}
export const init = new defs.Result()
export function request(params: Params, config?: axios.RequestConfig<Params>, options?: axios.RequestOptions) {
return defHttp.request(
{
url: '/basic-api/manage/permission/deleted',
method: 'POST',
data: params,
...config,
},
options,
)
}
/**
* @desc 查询
*/
import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios'
export class Params {
/** id */
id: number
}
export const init = new defs.Result()
export function request(params: Params, config?: axios.RequestConfig<Params>, options?: axios.RequestOptions) {
return defHttp.request(
{
url: '/basic-api/manage/permission/find',
method: 'GET',
params,
...config,
},
options,
)
}
/**
* @description
*/
import * as add from './add'
import * as deleted from './deleted'
import * as find from './find'
import * as modify from './modify'
import * as page from './page'
import * as tree from './tree'
export { add, deleted, find, modify, page, tree }
/**
* @desc 修改
*/
import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios'
export class Params {
/** 组件 */
component?: string
/** 是否启用 */
enable?: boolean
/** 是否隐藏 */
hidden?: boolean
/** 图标 */
icon?: string
/** id */
id: number
/** 名称 */
name: string
/** 路径 */
path?: string
/** 父级ID */
pid?: number
/** 序号 */
serial?: number
/** 权限类型 */
type: 'MENU' | 'BUTTON'
/** 标识 */
uid: string
}
export const init = new defs.Result()
export function request(params: Params, config?: axios.RequestConfig<Params>, options?: axios.RequestOptions) {
return defHttp.request(
{
url: '/basic-api/manage/permission/modify',
method: 'POST',
data: params,
...config,
},
options,
)
}
/**
* @desc 分页查询
*/
import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios'
export class Params {
/** 当前页数 */
pageNo: number
/** 分页条数 */
pageSize: number
/** 排序字段 */
sortField?: string
/** 排序方向(ASC|DESC) */
sortOrder?: 'ASC' | 'DESC'
}
export const init = new defs.Result()
export function request(params: Params, config?: axios.RequestConfig<Params>, options?: axios.RequestOptions) {
return defHttp.request(
{
url: '/basic-api/manage/permission/page',
method: 'GET',
params,
...config,
},
options,
)
}
/**
* @desc 树结构查询
*/
import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios'
export class Params {
/** 父级 id */
pid?: number
}
export const init = new defs.Result()
export function request(params: Params, config?: axios.RequestConfig<Params>, options?: axios.RequestOptions) {
return defHttp.request(
{
url: '/basic-api/manage/permission/tree',
method: 'GET',
params,
...config,
},
options,
)
}
/**
* @desc 新增
*/
import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios'
export class Params {
/** 名称 */
name: string
/** 标识 */
uid: string
}
export const init = new defs.Result()
export function request(params: Params, config?: axios.RequestConfig<Params>, options?: axios.RequestOptions) {
return defHttp.request(
{
url: '/basic-api/manage/role/add',
method: 'POST',
data: params,
...config,
},
options,
)
}
/**
* @desc 分配权限
*/
import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios'
export class Params {
/** id */
id: number
/** ids 多个以逗号分割 */
ids: string
}
export const init = new defs.Result()
export function request(params: Params, config?: axios.RequestConfig<Params>, options?: axios.RequestOptions) {
return defHttp.request(
{
url: '/basic-api/manage/role/assign',
method: 'POST',
data: params,
...config,
},
options,
)
}
/**
* @desc 删除
*/
import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios'
export class Params {
/** id */
id: number
}
export const init = new defs.Result()
export function request(params: Params, config?: axios.RequestConfig<Params>, options?: axios.RequestOptions) {
return defHttp.request(
{
url: '/basic-api/manage/role/deleted',
method: 'POST',
data: params,
...config,
},
options,
)
}
/**
* @desc 查询
*/
import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios'
export class Params {
/** id */
id: number
}
export const init = new defs.Result()
export function request(params: Params, config?: axios.RequestConfig<Params>, options?: axios.RequestOptions) {
return defHttp.request(
{
url: '/basic-api/manage/role/find',
method: 'GET',
params,
...config,
},
options,
)
}
/**
* @description
*/
import * as add from './add'
import * as assign from './assign'
import * as deleted from './deleted'
import * as find from './find'
import * as modify from './modify'
import * as page from './page'
import * as selector from './selector'
export { add, assign, deleted, find, modify, page, selector }
/**
* @desc 修改
*/
import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios'
export class Params {
/** id */
id: number
/** 名称 */
name: string
/** 标识 */
uid: string
}
export const init = new defs.Result()
export function request(params: Params, config?: axios.RequestConfig<Params>, options?: axios.RequestOptions) {
return defHttp.request(
{
url: '/basic-api/manage/role/modify',
method: 'POST',
data: params,
...config,
},
options,
)
}
/**
* @desc 分页查询
*/
import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios'
export class Params {
/** 当前页数 */
pageNo: number
/** 分页条数 */
pageSize: number
/** 排序字段 */
sortField?: string
/** 排序方向(ASC|DESC) */
sortOrder?: 'ASC' | 'DESC'
}
export const init = new defs.Result()
export function request(params: Params, config?: axios.RequestConfig<Params>, options?: axios.RequestOptions) {
return defHttp.request(
{
url: '/basic-api/manage/role/page',
method: 'GET',
params,
...config,
},
options,
)
}
/**
* @desc 选项查询
*/
import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios'
export class Params {}
export const init = new defs.Result()
export function request(params: Params, config?: axios.RequestConfig<Params>, options?: axios.RequestOptions) {
return defHttp.request(
{
url: '/basic-api/manage/role/selector',
method: 'GET',
params,
...config,
},
options,
)
}
/**
* @desc 分配角色
*/
import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios'
export class Params {
/** id */
id: number
/** ids 多个以逗号分割 */
ids: string
}
export const init = new defs.Result()
export function request(params: Params, config?: axios.RequestConfig<Params>, options?: axios.RequestOptions) {
return defHttp.request(
{
url: '/basic-api/user/manage/assign',
method: 'POST',
data: params,
...config,
},
options,
)
}
/**
* @description
*/
import * as info from './info'
import * as assign from './assign'
import * as page from './page'
export { info, assign, page }
/**
* @desc 获取登录用户信息
*/
import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios'
export class Params {}
export const init = new defs.Result()
export function request(params: Params, config?: axios.RequestConfig<Params>, options?: axios.RequestOptions) {
return defHttp.request(
{
url: '/basic-api/user/info',
method: 'GET',
params,
...config,
},
options,
)
}
/**
* @desc 分页查询
*/
import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios'
export class Params {
/** 当前页数 */
pageNo: number
/** 分页条数 */
pageSize: number
/** 排序字段 */
sortField?: string
/** 排序方向(ASC|DESC) */
sortOrder?: 'ASC' | 'DESC'
}
export const init = new defs.Result()
export function request(params: Params, config?: axios.RequestConfig<Params>, options?: axios.RequestOptions) {
return defHttp.request(
{
url: '/basic-api/user/manage/page',
method: 'GET',
params,
...config,
},
options,
)
}
......@@ -8,10 +8,7 @@ const { uploadUrl = '' } = useGlobSetting()
/**
* @description: Upload interface
*/
export function uploadApi(
params: UploadFileParams,
onUploadProgress: (progressEvent: ProgressEvent) => void,
) {
export function uploadApi(params: UploadFileParams, onUploadProgress: (progressEvent: ProgressEvent) => void) {
return defHttp.uploadFile<UploadApiResult>(
{
url: uploadUrl,
......
......@@ -45,12 +45,7 @@
if (!unref(isSetState)) {
isSetState.value = true
const {
menuSetting: {
type: menuType,
mode: menuMode,
collapsed: menuCollapsed,
split: menuSplit,
},
menuSetting: { type: menuType, mode: menuMode, collapsed: menuCollapsed, split: menuSplit },
} = appStore.getProjectConfig
appStore.setProjectConfig({
menuSetting: {
......@@ -64,8 +59,7 @@
} else {
if (unref(isSetState)) {
isSetState.value = false
const { menuMode, menuCollapsed, menuType, menuSplit } =
appStore.getBeforeMiniInfo
const { menuMode, menuCollapsed, menuType, menuSplit } = appStore.getBeforeMiniInfo
appStore.setProjectConfig({
menuSetting: {
type: menuType,
......
......@@ -24,10 +24,7 @@
default: () => <SearchOutlined />,
}}
</Tooltip>
<AppSearchModal
onClose={changeModal.bind(null, false)}
visible={unref(showModal)}
/>
<AppSearchModal onClose={changeModal.bind(null, false)} visible={unref(showModal)} />
</div>
)
}
......
......@@ -41,8 +41,7 @@
margin-right: 0.4em;
background-color: linear-gradient(-225deg, #d5dbe4, #f8f8f8);
border-radius: 2px;
box-shadow: inset 0 -2px 0 0 #cdcde6, inset 0 0 1px 1px #fff,
0 1px 2px 1px rgb(30 35 90 / 40%);
box-shadow: inset 0 -2px 0 0 #cdcde6, inset 0 0 1px 1px #fff, 0 1px 2px 1px rgb(30 35 90 / 40%);
align-items: center;
justify-content: center;
......
......@@ -84,8 +84,11 @@
const [refs, setRefs] = useRefs()
const { getIsMobile } = useAppInject()
const { handleSearch, searchResult, keyword, activeIndex, handleEnter, handleMouseenter } =
useMenuSearch(refs, scrollWrap, emit)
const { handleSearch, searchResult, keyword, activeIndex, handleEnter, handleMouseenter } = useMenuSearch(
refs,
scrollWrap,
emit,
)
const getIsNotData = computed(() => !keyword || unref(searchResult).length === 0)
......
......@@ -18,9 +18,7 @@
* @default ''
*/
value: {
type: [Number, Array, String] as PropType<
RoleEnum | RoleEnum[] | string | string[]
>,
type: [Number, Array, String] as PropType<RoleEnum | RoleEnum[] | string | string[]>,
default: '',
},
},
......
......@@ -46,9 +46,7 @@
setup(props, { slots }) {
const { prefixCls } = useDesign('basic-help')
const getTooltipStyle = computed(
(): CSSProperties => ({ color: props.color, fontSize: props.fontSize }),
)
const getTooltipStyle = computed((): CSSProperties => ({ color: props.color, fontSize: props.fontSize }))
const getOverlayStyle = computed((): CSSProperties => ({ maxWidth: props.maxWidth }))
......
......@@ -15,11 +15,7 @@
<Tooltip>
<template #title>
<div class="w-50">每行显示数量</div
><Slider
id="slider"
v-bind="sliderProp"
v-model:value="grid"
@change="sliderChange"
><Slider id="slider" v-bind="sliderProp" v-model:value="grid" @change="sliderChange"
/></template>
<Button><TableOutlined /></Button>
</Tooltip>
......@@ -61,10 +57,7 @@
<CardMeta>
<template #title>
<TypographyText
:content="item.name"
:ellipsis="{ tooltip: item.address }"
/>
<TypographyText :content="item.name" :ellipsis="{ tooltip: item.address }" />
</template>
<template #avatar>
<Avatar :src="item.avatar" />
......@@ -80,12 +73,7 @@
</template>
<script lang="ts" setup>
import { computed, onMounted, ref } from 'vue'
import {
EditOutlined,
EllipsisOutlined,
RedoOutlined,
TableOutlined,
} from '@ant-design/icons-vue'
import { EditOutlined, EllipsisOutlined, RedoOutlined, TableOutlined } from '@ant-design/icons-vue'
import { List, Card, Image, Typography, Tooltip, Slider, Avatar } from 'ant-design-vue'
import { Dropdown } from '/@/components/Dropdown'
import { BasicForm, useForm } from '/@/components/Form'
......
<template>
<div class="h-full">
<CodeMirrorEditor
:value="getValue"
@change="handleValueChange"
:mode="mode"
:readonly="readonly"
/>
<CodeMirrorEditor :value="getValue" @change="handleValueChange" :mode="mode" :readonly="readonly" />
</div>
</template>
<script lang="ts" setup>
......
......@@ -66,10 +66,7 @@
)
function setTheme() {
unref(editor)?.setOption(
'theme',
appStore.getDarkMode === 'light' ? 'idea' : 'material-palenight',
)
unref(editor)?.setOption('theme', appStore.getDarkMode === 'light' ? 'idea' : 'material-palenight')
}
function refresh() {
......
<template>
<transition-group
class="h-full w-full"
v-bind="$attrs"
ref="elRef"
:name="transitionName"
:tag="tag"
mode="out-in"
>
<transition-group class="h-full w-full" v-bind="$attrs" ref="elRef" :name="transitionName" :tag="tag" mode="out-in">
<div key="component" v-if="isInit">
<slot :loading="loading"></slot>
</div>
......@@ -39,9 +32,7 @@
* If the component is scrolling in the page container, the viewport is the container
*/
viewport: {
type: (typeof window !== 'undefined'
? window.HTMLElement
: Object) as PropType<HTMLElement>,
type: (typeof window !== 'undefined' ? window.HTMLElement : Object) as PropType<HTMLElement>,
default: () => null,
},
/**
......@@ -124,8 +115,7 @@
rootMargin,
target: toRef(elRef.value, '$el'),
onIntersect: (entries: any[]) => {
const isIntersecting =
entries[0].isIntersecting || entries[0].intersectionRatio
const isIntersecting = entries[0].isIntersecting || entries[0].intersectionRatio
if (isIntersecting) {
init()
if (observer) {
......
......@@ -31,11 +31,7 @@
const ItemContent: FunctionalComponent<ItemContentProps> = (props) => {
const { item } = props
return (
<span
style="display: inline-block; width: 100%; "
class="px-4"
onClick={props.handler.bind(null, item)}
>
<span style="display: inline-block; width: 100%; " class="px-4" onClick={props.handler.bind(null, item)}>
{props.showIcon && item.icon && <Icon class="mr-2" icon={item.icon} />}
<span>{item.label}</span>
</span>
......@@ -101,11 +97,7 @@
if (!children || children.length === 0) {
return (
<>
<Menu.Item
disabled={disabled}
class={`${prefixCls}__item`}
key={label}
>
<Menu.Item disabled={disabled} class={`${prefixCls}__item`} key={label}>
<ItemContent {...contentProps} />
</Menu.Item>
{divider ? <Divider key={`d-${label}`} /> : null}
......@@ -115,11 +107,7 @@
if (!unref(showRef)) return null
return (
<Menu.SubMenu
key={label}
disabled={disabled}
popupClassName={`${prefixCls}__popup`}
>
<Menu.SubMenu key={label} disabled={disabled} popupClassName={`${prefixCls}__popup`}>
{{
title: () => <ItemContent {...contentProps} />,
default: () => renderMenuItem(children),
......@@ -135,12 +123,7 @@
const { items } = props
return (
<div class={prefixCls}>
<Menu
inlineIndent={12}
mode="vertical"
ref={wrapRef}
style={unref(getStyle)}
>
<Menu inlineIndent={12} mode="vertical" ref={wrapRef} style={unref(getStyle)}>
{renderMenuItem(items)}
</Menu>
</div>
......@@ -191,8 +174,7 @@
background-color: @component-background;
border: 1px solid rgb(0 0 0 / 8%);
border-radius: 0.25rem;
box-shadow: 0 2px 2px 0 rgb(0 0 0 / 14%), 0 3px 1px -2px rgb(0 0 0 / 10%),
0 1px 5px 0 rgb(0 0 0 / 6%);
box-shadow: 0 2px 2px 0 rgb(0 0 0 / 14%), 0 3px 1px -2px rgb(0 0 0 / 10%), 0 1px 5px 0 rgb(0 0 0 / 6%);
background-clip: padding-box;
user-select: none;
......
<template>
<a-input v-bind="$attrs" :class="prefixCls" :size="size" :value="state">
<template #addonAfter>
<CountButton
:size="size"
:count="count"
:value="state"
:beforeStartFunc="sendCodeApi"
/>
<CountButton :size="size" :count="count" :value="state" :beforeStartFunc="sendCodeApi" />
</template>
<template
#[item]="data"
v-for="item in Object.keys($slots).filter((k) => k !== 'addonAfter')"
>
<template #[item]="data" v-for="item in Object.keys($slots).filter((k) => k !== 'addonAfter')">
<slot :name="item" v-bind="data || {}"></slot>
</template>
</a-input>
......
......@@ -24,11 +24,7 @@
<div :class="`${prefixCls}-toolbar`">
<Upload :fileList="[]" accept="image/*" :beforeUpload="handleBeforeUpload">
<Tooltip :title="t('component.cropper.selectImage')" placement="bottom">
<a-button
size="small"
preIcon="ant-design:upload-outlined"
type="primary"
/>
<a-button size="small" preIcon="ant-design:upload-outlined" type="primary" />
</Tooltip>
</Upload>
<Space>
......@@ -50,10 +46,7 @@
@click="handlerToolbar('rotate', -45)"
/>
</Tooltip>
<Tooltip
:title="t('component.cropper.btn_rotate_right')"
placement="bottom"
>
<Tooltip :title="t('component.cropper.btn_rotate_right')" placement="bottom">
<a-button
type="primary"
preIcon="ant-design:rotate-right-outlined"
......@@ -103,11 +96,7 @@
</div>
<div :class="`${prefixCls}-right`">
<div :class="`${prefixCls}-preview`">
<img
:src="previewSource"
v-if="previewSource"
:alt="t('component.cropper.preview')"
/>
<img :src="previewSource" v-if="previewSource" :alt="t('component.cropper.preview')" />
</div>
<template v-if="previewSource">
<div :class="`${prefixCls}-group`">
......@@ -250,13 +239,7 @@
transparent 75%,
rgb(0 0 0 / 25%) 0
),
linear-gradient(
45deg,
rgb(0 0 0 / 25%) 25%,
transparent 0,
transparent 75%,
rgb(0 0 0 / 25%) 0
);
linear-gradient(45deg, rgb(0 0 0 / 25%) 25%, transparent 0, transparent 75%, rgb(0 0 0 / 25%) 0);
background-position: 0 0, 12px 12px;
background-size: 24px 24px;
}
......
<template>
<div :class="getClass" :style="getWrapperStyle">
<img
v-show="isReady"
ref="imgElRef"
:src="src"
:alt="alt"
:crossorigin="crossorigin"
:style="getImageStyle"
/>
<img v-show="isReady" ref="imgElRef" :src="src" :alt="alt" :crossorigin="crossorigin" :style="getImageStyle" />
</div>
</template>
<script lang="ts">
......@@ -165,14 +158,7 @@
context.drawImage(sourceCanvas, 0, 0, width, height)
context.globalCompositeOperation = 'destination-in'
context.beginPath()
context.arc(
width / 2,
height / 2,
Math.min(width, height) / 2,
0,
2 * Math.PI,
true,
)
context.arc(width / 2, height / 2, Math.min(width, height) / 2, 0, 2 * Math.PI, true)
context.fill()
return canvas
}
......
......@@ -11,12 +11,7 @@
</div>
<img :src="sourceValue" v-if="sourceValue" alt="avatar" />
</div>
<a-button
:class="`${prefixCls}-upload-btn`"
@click="openModal"
v-if="showBtn"
v-bind="btnProps"
>
<a-button :class="`${prefixCls}-upload-btn`" @click="openModal" v-if="showBtn" v-bind="btnProps">
{{ btnText ? btnText : t('component.cropper.selectImage') }}
</a-button>
......@@ -29,16 +24,7 @@
</div>
</template>
<script lang="ts">
import {
defineComponent,
computed,
CSSProperties,
unref,
ref,
watchEffect,
watch,
PropType,
} from 'vue'
import { defineComponent, computed, CSSProperties, unref, ref, watchEffect, watch, PropType } from 'vue'
import CopperModal from './CopperModal.vue'
import { useDesign } from '/@/hooks/web/useDesign'
import { useModal } from '/@/components/Modal'
......@@ -72,9 +58,7 @@
const getWidth = computed(() => `${props.width}`.replace(/px/, '') + 'px')
const getIconWidth = computed(
() => parseInt(`${props.width}`.replace(/px/, '')) / 2 + 'px',
)
const getIconWidth = computed(() => parseInt(`${props.width}`.replace(/px/, '')) / 2 + 'px')
const getStyle = computed((): CSSProperties => ({ width: unref(getWidth) }))
......
......@@ -12,10 +12,7 @@ export interface DescItem {
span?: number
show?: (...arg: any) => boolean
// render
render?: (
val: any,
data: Recordable,
) => VNode | undefined | JSX.Element | Element | string | number
render?: (val: any, data: Recordable) => VNode | undefined | JSX.Element | Element | string | number
}
export interface DescriptionProps extends DescriptionsProps {
......
......@@ -4,9 +4,7 @@ import { isProdMode } from '/@/utils/env'
export function useDescription(props?: Partial<DescriptionProps>): UseDescReturnType {
if (!getCurrentInstance()) {
throw new Error(
'useDescription() can only be used inside setup() or functional components!',
)
throw new Error('useDescription() can only be used inside setup() or functional components!')
}
const desc = ref<Nullable<DescInstance>>(null)
const loaded = ref(false)
......
......@@ -33,16 +33,7 @@
<script lang="ts">
import type { DrawerInstance, DrawerProps } from './typing'
import type { CSSProperties } from 'vue'
import {
defineComponent,
ref,
computed,
watch,
unref,
nextTick,
toRaw,
getCurrentInstance,
} from 'vue'
import { defineComponent, ref, computed, watch, unref, nextTick, toRaw, getCurrentInstance } from 'vue'
import { Drawer } from 'ant-design-vue'
import { useI18n } from '/@/hooks/web/useI18n'
import { isFunction, isNumber } from '/@/utils/is'
......@@ -115,9 +106,7 @@
const getFooterHeight = computed(() => {
const { footerHeight, showFooter } = unref(getProps)
if (showFooter && footerHeight) {
return isNumber(footerHeight)
? `${footerHeight}px`
: `${footerHeight.replace('px', '')}px`
return isNumber(footerHeight) ? `${footerHeight}px` : `${footerHeight.replace('px', '')}px`
}
return `0px`
})
......
......@@ -2,12 +2,7 @@
<div :class="prefixCls" :style="getStyle" v-if="showFooter || $slots.footer">
<template v-if="!$slots.footer">
<slot name="insertFooter"></slot>
<a-button
v-bind="cancelButtonProps"
@click="handleClose"
class="mr-2"
v-if="showCancelBtn"
>
<a-button v-bind="cancelButtonProps" @click="handleClose" class="mr-2" v-if="showCancelBtn">
{{ cancelText }}
</a-button>
<slot name="centerFooter"></slot>
......
......@@ -5,16 +5,7 @@ import type {
DrawerProps,
UseDrawerInnerReturnType,
} from './typing'
import {
ref,
getCurrentInstance,
unref,
reactive,
watchEffect,
nextTick,
toRaw,
computed,
} from 'vue'
import { ref, getCurrentInstance, unref, reactive, watchEffect, nextTick, toRaw, computed } from 'vue'
import { isProdMode } from '/@/utils/env'
import { isFunction } from '/@/utils/is'
import { tryOnUnmounted } from '@vueuse/core'
......@@ -103,9 +94,7 @@ export const useDrawerInner = (callbackFn?: Fn): UseDrawerInnerReturnType => {
const uidRef = ref<string>('')
if (!getCurrentInstance()) {
throw new Error(
'useDrawerInner() can only be used inside setup() or functional components!',
)
throw new Error('useDrawerInner() can only be used inside setup() or functional components!')
}
const getInstance = () => {
......
......@@ -6,15 +6,8 @@
<template #overlay>
<a-menu :selectedKeys="selectedKeys">
<template v-for="item in dropMenuList" :key="`${item.event}`">
<a-menu-item
v-bind="getAttr(item.event)"
@click="handleClickMenu(item)"
:disabled="item.disabled"
>
<a-popconfirm
v-if="popconfirm && item.popConfirm"
v-bind="getPopConfirmAttrs(item.popConfirm)"
>
<a-menu-item v-bind="getAttr(item.event)" @click="handleClickMenu(item)" :disabled="item.disabled">
<a-popconfirm v-if="popconfirm && item.popConfirm" v-bind="getPopConfirmAttrs(item.popConfirm)">
<template #icon v-if="item.popConfirm.icon">
<Icon :icon="item.popConfirm.icon" />
</template>
......@@ -84,10 +77,8 @@
const getPopConfirmAttrs = computed(() => {
return (attrs) => {
const originAttrs = omit(attrs, ['confirm', 'cancel', 'icon'])
if (!attrs.onConfirm && attrs.confirm && isFunction(attrs.confirm))
originAttrs['onConfirm'] = attrs.confirm
if (!attrs.onCancel && attrs.cancel && isFunction(attrs.cancel))
originAttrs['onCancel'] = attrs.cancel
if (!attrs.onConfirm && attrs.confirm && isFunction(attrs.confirm)) originAttrs['onConfirm'] = attrs.confirm
if (!attrs.onCancel && attrs.cancel && isFunction(attrs.cancel)) originAttrs['onCancel'] = attrs.cancel
return originAttrs
}
})
......
<template>
<BasicModal
v-bind="$attrs"
:title="t('component.excel.exportModalTitle')"
@ok="handleOk"
@register="registerModal"
>
<BasicForm
:labelWidth="100"
:schemas="schemas"
:showActionButtonGroup="false"
@register="registerForm"
/>
<BasicModal v-bind="$attrs" :title="t('component.excel.exportModalTitle')" @ok="handleOk" @register="registerModal">
<BasicForm :labelWidth="100" :schemas="schemas" :showActionButtonGroup="false" @register="registerForm" />
</BasicModal>
</template>
<script lang="ts">
......
<template>
<div>
<input
ref="inputRef"
type="file"
v-show="false"
accept=".xlsx, .xls"
@change="handleInputClick"
/>
<input ref="inputRef" type="file" v-show="false" accept=".xlsx, .xls" @change="handleInputClick" />
<div @click="handleUpload">
<slot></slot>
</div>
......
......@@ -3,15 +3,8 @@
<template v-for="item in toolbarItemList" :key="item.type">
<Tooltip placement="bottom" v-bind="item.disabled ? { visible: false } : {}">
<template #title>{{ item.tooltip }}</template>
<span
:class="`${prefixCls}-toolbar__icon`"
v-if="item.icon"
@click="onControl(item)"
>
<Icon
:icon="item.icon"
:class="item.disabled ? 'cursor-not-allowed disabeld' : 'cursor-pointer'"
/>
<span :class="`${prefixCls}-toolbar__icon`" v-if="item.icon" @click="onControl(item)">
<Icon :icon="item.icon" :class="item.disabled ? 'cursor-not-allowed disabeld' : 'cursor-pointer'" />
</span>
</Tooltip>
<Divider v-if="item.separate" type="vertical" />
......
......@@ -41,16 +41,7 @@
import type { AdvanceState } from './types/hooks'
import type { Ref } from 'vue'
import {
defineComponent,
reactive,
ref,
computed,
unref,
onMounted,
watch,
nextTick,
} from 'vue'
import { defineComponent, reactive, ref, computed, unref, onMounted, watch, nextTick } from 'vue'
import { Form, Row } from 'ant-design-vue'
import FormItem from './components/FormItem.vue'
import FormAction from './components/FormAction.vue'
......@@ -119,9 +110,7 @@
}
})
const getBindValue = computed(
() => ({ ...attrs, ...props, ...unref(getProps) } as Recordable),
)
const getBindValue = computed(() => ({ ...attrs, ...props, ...unref(getProps) } as Recordable))
const getSchema = computed((): FormSchema[] => {
const schemas: FormSchema[] = unref(schemaRef) || (unref(getProps).schemas as any)
......@@ -141,9 +130,7 @@
}
}
if (unref(getProps).showAdvancedButton) {
return schemas.filter(
(schema) => schema.component !== 'Divider',
) as FormSchema[]
return schemas.filter((schema) => schema.component !== 'Divider') as FormSchema[]
} else {
return schemas as FormSchema[]
}
......@@ -303,9 +290,7 @@
formActionType: formActionType as any,
setFormModel,
getFormClass,
getFormActionBindProps: computed(
(): Recordable => ({ ...getProps.value, ...advanceState }),
),
getFormActionBindProps: computed((): Recordable => ({ ...getProps.value, ...advanceState })),
...formActionType,
}
},
......
......@@ -25,12 +25,7 @@
</Button>
<slot name="advanceBefore"></slot>
<Button
type="link"
size="small"
@click="toggleAdvanced"
v-if="showAdvancedButton && !hideAdvanceBtn"
>
<Button type="link" size="small" @click="toggleAdvanced" v-if="showAdvancedButton && !hideAdvanceBtn">
{{ isAdvanced ? t('component.form.putAway') : t('component.form.unfold') }}
<BasicArrow class="ml-1" :expand="!isAdvanced" up />
</Button>
......@@ -88,9 +83,7 @@
const actionColOpt = computed(() => {
const { showAdvancedButton, actionSpan: span, actionColOptions } = props
const actionSpan = 24 - span
const advancedSpanObj = showAdvancedButton
? { span: actionSpan < 6 ? 24 : actionSpan }
: {}
const advancedSpanObj = showAdvancedButton ? { span: actionSpan < 6 ? 24 : actionSpan } : {}
const actionColOpt: Partial<ColEx> = {
style: { textAlign: 'right' },
span: showAdvancedButton ? 6 : 4,
......
......@@ -75,8 +75,7 @@
const { schema, tableAction, formModel, formActionType } = props
let { componentProps = {} } = schema
if (isFunction(componentProps)) {
componentProps =
componentProps({ schema, tableAction, formModel, formActionType }) ?? {}
componentProps = componentProps({ schema, tableAction, formModel, formActionType }) ?? {}
}
if (schema.component === 'Divider') {
componentProps = Object.assign({ type: 'horizontal' }, componentProps, {
......@@ -219,13 +218,7 @@
}
function renderComponent() {
const {
renderComponentContent,
component,
field,
changeEvent = 'change',
valueField,
} = props.schema
const { renderComponentContent, component, field, changeEvent = 'change', valueField } = props.schema
const isCheck = component && ['Switch', 'Checkbox'].includes(component)
......@@ -257,8 +250,7 @@
// RangePicker place is an array
if (isCreatePlaceholder && component !== 'RangePicker' && component) {
propsData.placeholder =
unref(getComponentsProps)?.placeholder ||
createPlaceholderMessage(component)
unref(getComponentsProps)?.placeholder || createPlaceholderMessage(component)
}
propsData.codeField = field
propsData.formValues = unref(getValues)
......@@ -293,24 +285,14 @@
) : (
label
)
const getHelpMessage = isFunction(helpMessage)
? helpMessage(unref(getValues))
: helpMessage
if (
!getHelpMessage ||
(Array.isArray(getHelpMessage) && getHelpMessage.length === 0)
) {
const getHelpMessage = isFunction(helpMessage) ? helpMessage(unref(getValues)) : helpMessage
if (!getHelpMessage || (Array.isArray(getHelpMessage) && getHelpMessage.length === 0)) {
return renderLabel
}
return (
<span>
{renderLabel}
<BasicHelp
placement="top"
class="mx-1"
text={getHelpMessage}
{...helpComponentProps}
/>
<BasicHelp placement="top" class="mx-1" text={getHelpMessage} {...helpComponentProps} />
</span>
)
}
......@@ -323,9 +305,7 @@
if (component === 'Divider') {
return (
<Col span={24}>
<Divider {...unref(getComponentsProps)}>
{renderLabelHelpMessage()}
</Divider>
<Divider {...unref(getComponentsProps)}>{renderLabelHelpMessage()}</Divider>
</Col>
)
} else {
......
......@@ -35,11 +35,7 @@ function genType() {
return [...DATE_TYPE, 'RangePicker']
}
export function setComponentRuleType(
rule: ValidationRule,
component: ComponentType,
valueFormat: string,
) {
export function setComponentRuleType(rule: ValidationRule, component: ComponentType, valueFormat: string) {
if (['DatePicker', 'MonthPicker', 'WeekPicker', 'TimePicker'].includes(component)) {
rule.type = valueFormat ? 'string' : 'object'
} else if (['RangePicker', 'Upload', 'CheckboxGroup', 'TimePicker'].includes(component)) {
......
......@@ -18,14 +18,7 @@ interface UseAdvancedContext {
defaultValueRef: Ref<Recordable>
}
export default function ({
advanceState,
emit,
getProps,
getSchema,
formModel,
defaultValueRef,
}: UseAdvancedContext) {
export default function ({ advanceState, emit, getProps, getSchema, formModel, defaultValueRef }: UseAdvancedContext) {
const { realWidthRef, screenEnum, screenRef } = useBreakpoint()
const getEmptySpan = computed((): number => {
......@@ -137,10 +130,7 @@ export default function ({
}
if (isShow && (colProps || baseColProps)) {
const { itemColSum: sum, isAdvanced } = getAdvanced(
{ ...baseColProps, ...colProps },
itemColSum,
)
const { itemColSum: sum, isAdvanced } = getAdvanced({ ...baseColProps, ...colProps }, itemColSum)
itemColSum = sum || 0
if (isAdvanced) {
......
......@@ -9,12 +9,7 @@ interface UseAutoFocusContext {
isInitedDefault: Ref<boolean>
formElRef: Ref<FormActionType>
}
export async function useAutoFocus({
getSchema,
getProps,
formElRef,
isInitedDefault,
}: UseAutoFocusContext) {
export async function useAutoFocus({ getSchema, getProps, formElRef, isInitedDefault }: UseAutoFocusContext) {
watchEffect(async () => {
if (unref(isInitedDefault) || !unref(getProps).autoFocusFirstItem) {
return
......
......@@ -93,11 +93,7 @@ export function useForm(props?: Props): UseFormReturnType {
form.setFieldsValue<T>(values)
},
appendSchemaByField: async (
schema: FormSchema,
prefixField: string | undefined,
first: boolean,
) => {
appendSchemaByField: async (schema: FormSchema, prefixField: string | undefined, first: boolean) => {
const form = await getForm()
form.appendSchemaByField(schema, prefixField, first)
},
......
......@@ -79,11 +79,7 @@ export function useFormEvents({
if (typeof componentProps === 'function') {
_props = _props({ formModel })
}
formModel[key] = value
? _props?.valueFormat
? value
: dateUtil(value)
: null
formModel[key] = value ? (_props?.valueFormat ? value : dateUtil(value)) : null
}
} else {
formModel[key] = value
......@@ -161,9 +157,7 @@ export function useFormEvents({
)
if (!hasField) {
error(
'All children of the form Schema array that need to be updated must contain the `field` field',
)
error('All children of the form Schema array that need to be updated must contain the `field` field')
return
}
schemaRef.value = updateData as FormSchema[]
......@@ -183,9 +177,7 @@ export function useFormEvents({
)
if (!hasField) {
error(
'All children of the form Schema array that need to be updated must contain the `field` field',
)
error('All children of the form Schema array that need to be updated must contain the `field` field')
return
}
const schema: FormSchema[] = []
......
......@@ -48,12 +48,7 @@ function tryDeconstructObject(key: string, value: any, target: Recordable) {
}
}
export function useFormValues({
defaultValueRef,
getSchema,
formModel,
getProps,
}: UseFormValuesContext) {
export function useFormValues({ defaultValueRef, getSchema, formModel, getProps }: UseFormValuesContext) {
// Processing form values
function handleFormValues(values: Recordable) {
if (!isObject(values)) {
......
......@@ -135,10 +135,7 @@ export interface FormSchema {
// Auxiliary text
subLabel?: string
// Help text on the right side of the text
helpMessage?:
| string
| string[]
| ((renderCallbackParams: RenderCallbackParams) => string | string[])
helpMessage?: string | string[] | ((renderCallbackParams: RenderCallbackParams) => string | string[])
// BaseHelp component props
helpComponentProps?: Partial<HelpComponentProps>
// Label width, if it is passed, the labelCol and WrapperCol configured by itemProps will be invalid
......@@ -189,11 +186,7 @@ export interface FormSchema {
// Rendering col content requires outer wrapper form-item
renderColContent?: (renderCallbackParams: RenderCallbackParams) => VNode | VNode[] | string
renderComponentContent?:
| ((renderCallbackParams: RenderCallbackParams) => any)
| VNode
| VNode[]
| string
renderComponentContent?: ((renderCallbackParams: RenderCallbackParams) => any) | VNode | VNode[] | string
// Custom slot, in from-item
slot?: string
......
<template>
<SvgIcon
:size="size"
:name="getSvgIcon"
v-if="isSvgIcon"
:class="[$attrs.class, 'anticon']"
:spin="spin"
/>
<SvgIcon :size="size" :name="getSvgIcon" v-if="isSvgIcon" :class="[$attrs.class, 'anticon']" :spin="spin" />
<span
v-else
ref="elRef"
......@@ -15,16 +9,7 @@
</template>
<script lang="ts">
import type { PropType } from 'vue'
import {
defineComponent,
ref,
watch,
onMounted,
nextTick,
unref,
computed,
CSSProperties,
} from 'vue'
import { defineComponent, ref, watch, onMounted, nextTick, unref, computed, CSSProperties } from 'vue'
import SvgIcon from './SvgIcon.vue'
import Iconify from '@purge-icons/generated'
import { isString } from '/@/utils/is'
......@@ -52,9 +37,7 @@
const isSvgIcon = computed(() => props.icon?.endsWith(SVG_END_WITH_FLAG))
const getSvgIcon = computed(() => props.icon.replace(SVG_END_WITH_FLAG, ''))
const getIconRef = computed(
() => `${props.prefix ? props.prefix + ':' : ''}${props.icon}`,
)
const getIconRef = computed(() => `${props.prefix ? props.prefix + ':' : ''}${props.icon}`)
const update = async () => {
if (unref(isSvgIcon)) return
......
......@@ -41,10 +41,7 @@
</li>
</ul>
</ScrollContainer>
<div
class="flex py-2 items-center justify-center"
v-if="getTotal >= pageSize"
>
<div class="flex py-2 items-center justify-center" v-if="getTotal >= pageSize">
<a-pagination
showLessItems
size="small"
......@@ -59,17 +56,10 @@
</template>
</template>
<span
class="cursor-pointer px-2 py-1 flex items-center"
v-if="isSvgMode && currentSelect"
>
<span class="cursor-pointer px-2 py-1 flex items-center" v-if="isSvgMode && currentSelect">
<SvgIcon :name="currentSelect" />
</span>
<Icon
:icon="currentSelect || 'ion:apps-outline'"
class="cursor-pointer px-2 py-1"
v-else
/>
<Icon :icon="currentSelect || 'ion:apps-outline'" class="cursor-pointer px-2 py-1" v-else />
</a-popover>
</template>
</a-input>
......@@ -137,10 +127,7 @@
const { clipboardRef, isSuccessRef } = useCopyToClipboard(props.value)
const { createMessage } = useMessage()
const { getPaginationList, getTotal, setCurrentPage } = usePagination(
currentList,
props.pageSize,
)
const { getPaginationList, getTotal, setCurrentPage } = usePagination(currentList, props.pageSize)
watchEffect(() => {
currentSelect.value = props.value
......
<template>
<svg
:class="[prefixCls, $attrs.class, spin && 'svg-icon-spin']"
:style="getStyle"
aria-hidden="true"
>
<svg :class="[prefixCls, $attrs.class, spin && 'svg-icon-spin']" :style="getStyle" aria-hidden="true">
<use :xlink:href="symbolId" />
</svg>
</template>
......
......@@ -15,9 +15,7 @@ interface Fn {
export function useLoading(props: Partial<LoadingProps>): [Fn, Fn, (string) => void]
export function useLoading(opt: Partial<UseLoadingOptions>): [Fn, Fn, (string) => void]
export function useLoading(
opt: Partial<LoadingProps> | Partial<UseLoadingOptions>,
): [Fn, Fn, (string) => void] {
export function useLoading(opt: Partial<LoadingProps> | Partial<UseLoadingOptions>): [Fn, Fn, (string) => void] {
let props: Partial<LoadingProps>
let target: HTMLElement | Ref<ElRef> = document.body
......
......@@ -3,16 +3,7 @@
</template>
<script lang="ts">
import type { Ref } from 'vue'
import {
defineComponent,
ref,
unref,
nextTick,
computed,
watch,
onBeforeUnmount,
onDeactivated,
} from 'vue'
import { defineComponent, ref, unref, nextTick, computed, watch, onBeforeUnmount, onDeactivated } from 'vue'
import Vditor from 'vditor'
import 'vditor/dist/index.css'
import { useLocale } from '/@/locales/useLocale'
......
......@@ -60,12 +60,7 @@
const { currentRoute } = useRouter()
const { handleOpenChange, setOpenKeys, getOpenKeys } = useOpenKeys(
menuState,
items,
mode as any,
accordion,
)
const { handleOpenChange, setOpenKeys, getOpenKeys } = useOpenKeys(menuState, items, mode as any, accordion)
const getIsTopMenu = computed(() => {
const { type, mode } = props
......@@ -77,8 +72,7 @@
})
const getMenuClass = computed(() => {
const align =
props.isHorizontal && unref(getSplit) ? 'start' : unref(getTopMenuAlign)
const align = props.isHorizontal && unref(getSplit) ? 'start' : unref(getTopMenuAlign)
return [
prefixCls,
`justify-${align}`,
......@@ -94,9 +88,7 @@
const inlineCollapseOptions: { inlineCollapsed?: boolean } = {}
if (isInline) {
inlineCollapseOptions.inlineCollapsed = props.mixSider
? false
: unref(getCollapsed)
inlineCollapseOptions.inlineCollapsed = props.mixSider ? false : unref(getCollapsed)
}
return inlineCollapseOptions
})
......@@ -138,8 +130,7 @@
return
}
const path =
(route || unref(currentRoute)).meta?.currentActiveMenu ||
(route || unref(currentRoute)).path
(route || unref(currentRoute)).meta?.currentActiveMenu || (route || unref(currentRoute)).path
setOpenKeys(path)
if (unref(currentActiveMenu)) return
if (props.isHorizontal && unref(getSplit)) {
......
<template>
<span :class="`${prefixCls}- flex items-center `">
<Icon
v-if="getIcon"
:icon="getIcon"
:size="18"
:class="`${prefixCls}-wrapper__icon mr-2`"
/>
<Icon v-if="getIcon" :icon="getIcon" :size="18" :class="`${prefixCls}-wrapper__icon mr-2`" />
{{ getI18nName }}
</span>
</template>
......
......@@ -31,10 +31,7 @@ export function useOpenKeys(
return
}
if (!unref(accordion)) {
menuState.openKeys = uniq([
...menuState.openKeys,
...getAllParentPath(menuList, path),
])
menuState.openKeys = uniq([...menuState.openKeys, ...getAllParentPath(menuList, path)])
} else {
menuState.openKeys = getAllParentPath(menuList, path)
}
......@@ -59,11 +56,7 @@ export function useOpenKeys(
}
function handleOpenChange(openKeys: string[]) {
if (
unref(mode) === MenuModeEnum.HORIZONTAL ||
!unref(accordion) ||
unref(getIsMixSidebar)
) {
if (unref(mode) === MenuModeEnum.HORIZONTAL || !unref(accordion) || unref(getIsMixSidebar)) {
menuState.openKeys = openKeys
} else {
// const menuList = toRaw(menus.value);
......
......@@ -51,17 +51,7 @@
<script lang="ts">
import type { ModalProps, ModalMethods } from './typing'
import {
defineComponent,
computed,
ref,
watch,
unref,
watchEffect,
toRef,
getCurrentInstance,
nextTick,
} from 'vue'
import { defineComponent, computed, ref, watch, unref, watchEffect, toRef, getCurrentInstance, nextTick } from 'vue'
import Modal from './components/Modal'
import ModalWrapper from './components/ModalWrapper.vue'
import ModalClose from './components/ModalClose.vue'
......@@ -178,8 +168,7 @@
async function handleCancel(e: Event) {
e?.stopPropagation()
// 过滤自定义关闭按钮的空白区域
if ((e.target as HTMLElement)?.classList?.contains(prefixCls + '-close--custom'))
return
if ((e.target as HTMLElement)?.classList?.contains(prefixCls + '-close--custom')) return
if (props.closeFunc && isFunction(props.closeFunc)) {
const isClose: boolean = await props.closeFunc()
visibleRef.value = !isClose
......
......@@ -15,11 +15,7 @@
</template>
<script lang="ts">
import { defineComponent, computed } from 'vue'
import {
FullscreenExitOutlined,
FullscreenOutlined,
CloseOutlined,
} from '@ant-design/icons-vue'
import { FullscreenExitOutlined, FullscreenOutlined, CloseOutlined } from '@ant-design/icons-vue'
import { useDesign } from '/@/hooks/web/useDesign'
import { Tooltip } from 'ant-design-vue'
import { useI18n } from '/@/hooks/web/useI18n'
......
......@@ -5,13 +5,7 @@
{{ cancelText }}
</a-button>
<slot name="centerFooter"></slot>
<a-button
:type="okType"
@click="handleOk"
:loading="confirmLoading"
v-bind="okButtonProps"
v-if="showOkBtn"
>
<a-button :type="okType" @click="handleOk" :loading="confirmLoading" v-bind="okButtonProps" v-if="showOkBtn">
{{ okText }}
</a-button>
<slot name="appendFooter"></slot>
......
......@@ -7,17 +7,7 @@
</template>
<script lang="ts">
import type { CSSProperties } from 'vue'
import {
defineComponent,
computed,
ref,
watchEffect,
unref,
watch,
onMounted,
nextTick,
onUnmounted,
} from 'vue'
import { defineComponent, computed, ref, watchEffect, unref, watch, onMounted, nextTick, onUnmounted } from 'vue'
import { useWindowSizeFn } from '/@/hooks/event/useWindowSizeFn'
import { ScrollContainer } from '/@/components/Container'
import { createModalContext } from '../hooks/useModalContext'
......@@ -149,10 +139,7 @@
if (props.fullScreen) {
realHeightRef.value =
window.innerHeight -
props.modalFooterHeight -
props.modalHeaderHeight -
28
window.innerHeight - props.modalFooterHeight - props.modalHeaderHeight - 28
} else {
realHeightRef.value = props.height
? props.height
......
import type {
UseModalReturnType,
ModalMethods,
ModalProps,
ReturnMethods,
UseModalInnerReturnType,
} from '../typing'
import {
ref,
onUnmounted,
unref,
getCurrentInstance,
reactive,
watchEffect,
nextTick,
toRaw,
} from 'vue'
import type { UseModalReturnType, ModalMethods, ModalProps, ReturnMethods, UseModalInnerReturnType } from '../typing'
import { ref, onUnmounted, unref, getCurrentInstance, reactive, watchEffect, nextTick, toRaw } from 'vue'
import { isProdMode } from '/@/utils/env'
import { isFunction } from '/@/utils/is'
import { isEqual } from 'lodash-es'
......
......@@ -39,8 +39,7 @@
line-height: 44px;
background-color: @component-background;
border-top: 1px solid @border-color-base;
box-shadow: 0 -6px 16px -8px rgb(0 0 0 / 8%), 0 -9px 28px 0 rgb(0 0 0 / 5%),
0 -12px 48px 16px rgb(0 0 0 / 3%);
box-shadow: 0 -6px 16px -8px rgb(0 0 0 / 8%), 0 -9px 28px 0 rgb(0 0 0 / 5%), 0 -12px 48px 16px rgb(0 0 0 / 3%);
transition: width 0.2s;
&__left {
......
<template>
<div :class="getClass" ref="wrapperRef">
<PageHeader
:ghost="ghost"
:title="title"
v-bind="omit($attrs, 'class')"
ref="headerRef"
v-if="getShowHeader"
>
<PageHeader :ghost="ghost" :title="title" v-bind="omit($attrs, 'class')" ref="headerRef" v-if="getShowHeader">
<template #default>
<template v-if="content">
{{ content }}
......@@ -18,12 +12,7 @@
</template>
</PageHeader>
<div
class="overflow-hidden"
:class="getContentClass"
:style="getContentStyle"
ref="contentRef"
>
<div class="overflow-hidden" :class="getContentClass" :style="getContentStyle" ref="contentRef">
<slot></slot>
</div>
......@@ -105,19 +94,13 @@
})
const getShowHeader = computed(
() =>
props.content ||
slots?.headerContent ||
props.title ||
getHeaderSlots.value.length,
() => props.content || slots?.headerContent || props.title || getHeaderSlots.value.length,
)
const getShowFooter = computed(() => slots?.leftFooter || slots?.rightFooter)
const getHeaderSlots = computed(() => {
return Object.keys(
omit(slots, 'default', 'leftFooter', 'rightFooter', 'headerContent'),
)
return Object.keys(omit(slots, 'default', 'leftFooter', 'rightFooter', 'headerContent'))
})
const getContentStyle = computed((): CSSProperties => {
......
......@@ -345,25 +345,16 @@
const renderController = () => {
return (
<div class={`${prefixCls}__controller`}>
<div
class={`${prefixCls}__controller-item`}
onClick={() => scaleFunc(-getScaleStep.value)}
>
<div class={`${prefixCls}__controller-item`} onClick={() => scaleFunc(-getScaleStep.value)}>
<img src={unScaleSvg} />
</div>
<div
class={`${prefixCls}__controller-item`}
onClick={() => scaleFunc(getScaleStep.value)}
>
<div class={`${prefixCls}__controller-item`} onClick={() => scaleFunc(getScaleStep.value)}>
<img src={scaleSvg} />
</div>
<div class={`${prefixCls}__controller-item`} onClick={resume}>
<img src={resumeSvg} />
</div>
<div
class={`${prefixCls}__controller-item`}
onClick={() => rotateFunc(-90)}
>
<div class={`${prefixCls}__controller-item`} onClick={() => rotateFunc(-90)}>
<img src={unRotateSvg} />
</div>
<div class={`${prefixCls}__controller-item`} onClick={() => rotateFunc(90)}>
......@@ -378,10 +369,7 @@
return null
}
return (
<div
class={[`${prefixCls}__arrow`, direction]}
onClick={() => handleChange(direction)}
>
<div class={[`${prefixCls}__arrow`, direction]} onClick={() => handleChange(direction)}>
{direction === 'left' ? <LeftOutlined /> : <RightOutlined />}
</div>
)
......@@ -390,12 +378,7 @@
return () => {
return (
imgState.show && (
<div
class={prefixCls}
ref={wrapElRef}
onMouseup={handleMouseUp}
onClick={handleMaskClick}
>
<div class={prefixCls} ref={wrapElRef} onMouseup={handleMouseUp} onClick={handleMaskClick}>
<div class={`${prefixCls}-content`}>
{/*<Spin*/}
{/* indicator={<LoadingOutlined style="font-size: 24px" spin />}*/}
......@@ -409,10 +392,7 @@
{/*/>*/}
<img
style={unref(getImageStyle)}
class={[
`${prefixCls}-image`,
imgState.status === StatueEnum.DONE ? '' : 'hidden',
]}
class={[`${prefixCls}-image`, imgState.status === StatueEnum.DONE ? '' : 'hidden']}
ref={imgElRef}
src={imgState.currentUrl}
onMousedown={handleAddMoveListener}
......
......@@ -3,12 +3,7 @@ import type { QRCodeRenderersOptions } from 'qrcode'
import { RenderQrCodeParams, ContentType } from './typing'
import { cloneDeep } from 'lodash-es'
export const renderQrCode = ({
canvas,
content,
width = 0,
options: params = {},
}: RenderQrCodeParams) => {
export const renderQrCode = ({ canvas, content, width = 0, options: params = {} }: RenderQrCodeParams) => {
const options = cloneDeep(params)
// 容错率,默认对内容少的二维码采用高容错率,内容多的二维码采用低容错率
options.errorCorrectionLevel = options.errorCorrectionLevel || getErrorCorrectionLevel(content)
......
......@@ -6,12 +6,7 @@
:style="style"
@scroll="handleScroll"
>
<component
:is="tag"
ref="resize"
:class="['scrollbar__view', viewClass]"
:style="viewStyle"
>
<component :is="tag" ref="resize" :class="['scrollbar__view', viewClass]" :style="viewStyle">
<slot></slot>
</component>
</div>
......@@ -26,16 +21,7 @@
import componentSetting from '/@/settings/componentSetting'
const { scrollbar } = componentSetting
import { toObject } from './util'
import {
defineComponent,
ref,
onMounted,
onBeforeUnmount,
nextTick,
provide,
computed,
unref,
} from 'vue'
import { defineComponent, ref, onMounted, onBeforeUnmount, nextTick, provide, computed, unref } from 'vue'
import Bar from './bar'
export default defineComponent({
......
import {
defineComponent,
h,
computed,
ref,
getCurrentInstance,
onUnmounted,
inject,
Ref,
} from 'vue'
import { defineComponent, h, computed, ref, getCurrentInstance, onUnmounted, inject, Ref } from 'vue'
import { on, off } from '/@/utils/domUtils'
import { renderThumbStyle, BAR_MAP } from './util'
......@@ -43,15 +34,11 @@ export default defineComponent({
}
const clickTrackHandler = (e: any) => {
const offset = Math.abs(
e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client],
)
const offset = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client])
const thumbHalf = thumb.value[bar.value.offset] / 2
const thumbPositionPercentage =
((offset - thumbHalf) * 100) / instance?.vnode.el?.[bar.value.offset]
const thumbPositionPercentage = ((offset - thumbHalf) * 100) / instance?.vnode.el?.[bar.value.offset]
wrap.value[bar.value.scroll] =
(thumbPositionPercentage * wrap.value[bar.value.scrollSize]) / 100
wrap.value[bar.value.scroll] = (thumbPositionPercentage * wrap.value[bar.value.scrollSize]) / 100
}
const startDrag = (e: any) => {
e.stopImmediatePropagation()
......@@ -67,15 +54,11 @@ export default defineComponent({
if (!prevPage) return
const offset =
(instance?.vnode.el?.getBoundingClientRect()[bar.value.direction] -
e[bar.value.client]) *
-1
const offset = (instance?.vnode.el?.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1
const thumbClickPosition = thumb.value[bar.value.offset] - prevPage
const thumbPositionPercentage =
((offset - thumbClickPosition) * 100) / instance?.vnode.el?.[bar.value.offset]
wrap.value[bar.value.scroll] =
(thumbPositionPercentage * wrap.value[bar.value.scrollSize]) / 100
wrap.value[bar.value.scroll] = (thumbPositionPercentage * wrap.value[bar.value.scrollSize]) / 100
}
function mouseUpDocumentHandler() {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论