【modify】使用ESLint格式化代码

This commit is contained in:
zer0Black
2023-03-01 09:33:58 +08:00
parent 694855ae8b
commit 63369b8b87
400 changed files with 42942 additions and 43132 deletions
@@ -4,17 +4,17 @@ import JVxeCellMixins from '../mixins/JVxeCellMixins'
export const JVXERenderType = {
editer: 'editer',
spaner: 'spaner',
default: 'default',
default: 'default'
}
/** 安装所有vxe组件 */
export function installAllCell(VXETable) {
export function installAllCell (VXETable) {
// 遍历所有组件批量注册
Object.keys(AllCells).forEach(type => installOneCell(VXETable, type))
}
/** 安装单个vxe组件 */
export function installOneCell(VXETable, type) {
export function installOneCell (VXETable, type) {
const switches = getEnhancedMixins(type, 'switches')
if (switches.editRender === false) {
installCellRender(VXETable, type, AllCells[type])
@@ -24,7 +24,7 @@ export function installOneCell(VXETable, type) {
}
/** 注册可编辑组件 */
export function installEditRender(VXETable, type, comp, spanComp) {
export function installEditRender (VXETable, type, comp, spanComp) {
// 获取当前组件的增强
const enhanced = getEnhancedMixins(type)
// span 组件
@@ -40,23 +40,23 @@ export function installEditRender(VXETable, type, comp, spanComp) {
// 显示模板
renderCell: createRender(spanComp, enhanced, JVXERenderType.spaner),
// 增强注册
...enhanced.installOptions,
...enhanced.installOptions
})
}
/** 注册普通组件 */
export function installCellRender(VXETable, type, comp = AllCells[JVXETypes.normal]) {
export function installCellRender (VXETable, type, comp = AllCells[JVXETypes.normal]) {
// 获取当前组件的增强
const enhanced = getEnhancedMixins(type)
VXETable.renderer.add(JVXETypes._prefix + type, {
// 默认显示模板
renderDefault: createRender(comp, enhanced, JVXERenderType.default),
// 增强注册
...enhanced.installOptions,
...enhanced.installOptions
})
}
function createRender(comp, enhanced, renderType) {
function createRender (comp, enhanced, renderType) {
return function (h, renderOptions, params) {
return [h(comp, {
props: {
@@ -65,7 +65,7 @@ function createRender(comp, enhanced, renderType) {
column: params.column,
params: params,
renderOptions: renderOptions,
renderType: renderType,
renderType: renderType
}
})]
}
@@ -75,8 +75,8 @@ function createRender(comp, enhanced, renderType) {
const AllCellsMixins = new Map()
/** 获取某个组件的增强 */
export function getEnhanced(type) {
let cell = AllCells[type]
export function getEnhanced (type) {
const cell = AllCells[type]
if (cell && cell.enhanced) {
return cell.enhanced
}
@@ -89,16 +89,16 @@ export function getEnhanced(type) {
* @param type JVXETypes
* @param name 可空,增强名称,留空返回所有增强
*/
export function getEnhancedMixins(type, name) {
export function getEnhancedMixins (type, name) {
const getByName = (e) => name ? e[name] : e
if (AllCellsMixins.has(type)) {
return getByName(AllCellsMixins.get(type))
}
let defEnhanced = JVxeCellMixins.enhanced
let enhanced = getEnhanced(type)
const defEnhanced = JVxeCellMixins.enhanced
const enhanced = getEnhanced(type)
if (enhanced) {
Object.keys(defEnhanced).forEach(key => {
let def = defEnhanced[key]
const def = defEnhanced[key]
if (enhanced.hasOwnProperty(key)) {
// 方法如果存在就不覆盖
if (typeof def !== 'function' && typeof def !== 'string') {
@@ -115,9 +115,8 @@ export function getEnhancedMixins(type, name) {
return getByName(defEnhanced)
}
/** 辅助方法:替换${...}变量 */
export function replaceProps(col, value) {
export function replaceProps (col, value) {
if (value && typeof value === 'string') {
let text = value
text = text.replace(/\${title}/g, col.title)