Skip to content

style: beautify code #210

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
"dev": "pnpm dev --filter vue-devui",
"build": "pnpm build --filter vue-devui",
"build:lib": "pnpm build:lib --filter vue-devui",
"build:cli": "pnpm build --filter @devui/cli",
"build:cli": "pnpm build --filter devui-cli",
"prepare": "husky install",
"precommit": "lint-staged",
"lint:fix": "eslint --fix \"{packages}/**/*.{vue,js,ts,jsx,tsx}\"",
"stylelint": "stylelint --fix \"{packages}/**/*.{scss,css}\"",
"lint:fix": "eslint --fix \"packages/**/{*.vue,*.js,*.ts,*.jsx,*.tsx}\"",
"stylelint": "stylelint --fix \"packages/**/{*.scss,*.css}\"",
"test": "pnpm test --filter vue-devui"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/devui-cli/src/shared/generate-lib-entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { getComponentsMeta } from '../templates/component/utils'
import genLibEntryTemplate from '../templates/lib-entry/lib-entry'
import logger from './logger'

export default async function genLibEntry(filePath: string = '') {
export default async function genLibEntry(filePath = '') {
const componentsMeta = await getComponentsMeta()

writeFileSync(filePath, genLibEntryTemplate(componentsMeta), {
Expand Down
4 changes: 2 additions & 2 deletions packages/devui-cli/src/templates/component/doc.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getPartName } from "../lib-entry/lib-entry";
import { ComponentMeta } from "./meta";
import { getPartName } from '../lib-entry/lib-entry';
import { ComponentMeta } from './meta';

export default function genDocTemplate(meta: ComponentMeta) {
return `\
Expand Down
2 changes: 1 addition & 1 deletion packages/devui-cli/src/templates/component/style.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { coreClassName } from "./utils"
import { coreClassName } from './utils'

export default function genStyleTemplate(name: string) {
return `\
Expand Down
4 changes: 1 addition & 3 deletions packages/devui-theme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
"src"
],
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
"build": "vite build"
},
"dependencies": {
"css-vars-ponyfill": "^2.4.7",
Expand Down
12 changes: 6 additions & 6 deletions packages/devui-theme/src/theme/theme-management.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ import { EventBus } from './utils';
*
*/
export function ThemeServiceInit(
themes?: { [themeName: string]: Theme },
themes?: { [themeName: string]: Theme; },
defaultThemeName?: string,
extraData?: {
[themeName: string]: {
appendClasses?: Array<string>;
appendClasses?: Array<string>
cssVariables?: {
[cssVarName: string]: string;
};
};
[cssVarName: string]: string
}
}
},
ieSupport = false, // TODO:css-var-ponyflll 仍有一些问题待定位
allowDynamicTheme = false
Expand Down Expand Up @@ -54,7 +54,7 @@ export function ThemeServiceInit(
return themeService;
}

export function ThemeServiceFollowSystemOn(themeConfig?: { lightThemeName: string; darkThemeName: string }): Subscription {
export function ThemeServiceFollowSystemOn(themeConfig?: { lightThemeName: string; darkThemeName: string; }): Subscription {
if (typeof window === 'undefined') {
return null;
}
Expand Down
8 changes: 4 additions & 4 deletions packages/devui-theme/src/theme/theme-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ export class ThemeService {
extraData: {
[themeId: string]: {
cssVariables?: {
[varname: string]: string;
};
appendClasses?: Array<string>;
};
[varname: string]: string
}
appendClasses?: Array<string>
}
};
private _appendedClasses: Array<string>;
set appendClasses(classes: Array<string>) {
Expand Down
28 changes: 14 additions & 14 deletions packages/devui-theme/src/theme/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,31 @@ export class Theme {
name: string;
cnName?: string;
data: {
[cssVarName: string]: string;
[cssVarName: string]: string
};
extends?: ThemeId;
isDark?: boolean;
isPreview?: boolean;
isExtendable?: boolean;
extra?: {
appendClass?: Array<string>;
appendClass?: Array<string>
cssVariables?: {
[cssVarName: string]: string;
};
[prop: string]: any;
[cssVarName: string]: string
}
[prop: string]: any
} | any;

constructor(theme: {
id: ThemeId;
name: string;
cnName?: string;
id: ThemeId
name: string
cnName?: string
data: {
[cssVarName: string]: string;
};
extends?: ThemeId;
isDark?: boolean;
isPreview?: boolean;
isExtendable?: boolean;
[cssVarName: string]: string
}
extends?: ThemeId
isDark?: boolean
isPreview?: boolean
isExtendable?: boolean
}) {
this.id = theme.id;
this.name = theme.name;
Expand Down
14 changes: 7 additions & 7 deletions packages/devui-theme/src/theme/utils/interface.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
export interface IStorageService {
tryGetLocalStorage(key: string): any;
trySetLocalStorage(key: string, value: any): void;
tryGetLocalStorage(key: string): any
trySetLocalStorage(key: string, value: any): void
}

export interface IContextService {
getDataFromNameSpace(nameSpace: string): any;
setDataFromNameSpace(nameSpace: string, value: any): any;
getDataFromNameSpace(nameSpace: string): any
setDataFromNameSpace(nameSpace: string, value: any): any
}

export interface IEventBus {
add(eventName: string, callbacks: Function): void;
remove(eventName: string, callbacks: Function): void;
trigger(eventName: string, data: any): void;
add(eventName: string, callbacks: Function): void
remove(eventName: string, callbacks: Function): void
trigger(eventName: string, data: any): void
}
23 changes: 0 additions & 23 deletions packages/devui-vue/LICENSE

This file was deleted.

2 changes: 1 addition & 1 deletion packages/devui-vue/dc.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { defineCliConfig } from 'devui-cli';

export default defineCliConfig({
componentRootDir: './devui',
libClassPrefix: 'd',
libClassPrefix: 'devui',
libEntryFileName: 'vue-devui',
libEntryRootDir: './devui',
libPrefix: 'D',
Expand Down
2 changes: 1 addition & 1 deletion packages/devui-vue/devui-cli/commands/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const buildAll = async () => {
rollupOptions,
lib: {
entry: path.resolve(entryDir, 'vue-devui.ts'),
name: 'vue-devui',
name: 'VueDevui',
fileName: 'vue-devui',
formats: ['es', 'umd']
},
Expand Down
4 changes: 2 additions & 2 deletions packages/devui-vue/devui-cli/shared/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ const { INDEX_FILE_NAME, DEVUI_DIR } = require('./constant')
const { resolve } = require('path')
const logger = require('./logger')
const fs = require('fs-extra')
const traverse = require("@babel/traverse").default
const babelParser = require("@babel/parser")
const traverse = require('@babel/traverse').default
const babelParser = require('@babel/parser')

exports.bigCamelCase = (str) => {
return upperFirst(camelCase(str))
Expand Down
4 changes: 2 additions & 2 deletions packages/devui-vue/devui/accordion/src/accordion-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ export default defineComponent({
const rootSlots = getRootSlots()
const accordionCtx = inject('accordionContext') as any

let parentValue = parent.value
let deepValue = deepth.value
const parentValue = parent.value
const deepValue = deepth.value

const disabled = computed(() => {
return item.value && item.value[disabledKey.value]
Expand Down
8 changes: 4 additions & 4 deletions packages/devui-vue/devui/accordion/src/accordion-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import { getRootSlots } from '../src/utils'

export default defineComponent({
name: 'DAccordionList',
inheritAttrs: false,
components: {
DAccordionMenu,
DAccordionItem
},
inheritAttrs: false,
props: {
data: {
type: Array as () => Array<AccordionMenuItem>,
Expand Down Expand Up @@ -49,8 +49,8 @@ export default defineComponent({
innerListTemplate
} = toRefs(props)

let parentValue = parent.value
let deepValue = deepth.value
const parentValue = parent.value
const deepValue = deepth.value

const rootSlots = getRootSlots()

Expand All @@ -60,7 +60,7 @@ export default defineComponent({
return parentValue && parentValue[loadingKey.value]
})
const noContent = computed(() => {
let dataValue = data.value
const dataValue = data.value
return dataValue === undefined || dataValue === null || dataValue.length === 0
})

Expand Down
4 changes: 2 additions & 2 deletions packages/devui-vue/devui/accordion/src/accordion-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ export default defineComponent({
const rootSlots = getRootSlots()
const accordionCtx = inject('accordionContext') as any

let parentValue = parent.value
let deepValue = deepth.value
const parentValue = parent.value
const deepValue = deepth.value

const toggle = (itemEvent: AccordionMenuToggleEvent) => {
accordionCtx.menuToggleFn(itemEvent)
Expand Down
38 changes: 19 additions & 19 deletions packages/devui-vue/devui/accordion/src/accordion-types.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { ExtractPropTypes } from "vue";
import { AccordionMenuType } from "./accordion.type";
import { ExtractPropTypes } from 'vue';
import { AccordionMenuType } from './accordion.type';

export const accordionProps = {
data: {
type: Array as () => Array<any> | AccordionMenuType,
default: null,
},
/* Key值定义, 用于自定义数据结构 */
titleKey: { type: String, default: "title" }, // 标题的key,item[titleKey]类型为string,为标题显示内容
loadingKey: { type: String, default: "loading" }, // 子菜单动态加载item[loadingKey]类型为boolean
childrenKey: { type: String, default: "children" }, // 子菜单Key
disabledKey: { type: String, default: "disabled" }, // 是否禁用Key
activeKey: { type: String, default: "active" }, // 菜单是否激活/选中
openKey: { type: String, default: "open" }, // 菜单是否打开
titleKey: { type: String, default: 'title' }, // 标题的key,item[titleKey]类型为string,为标题显示内容
loadingKey: { type: String, default: 'loading' }, // 子菜单动态加载item[loadingKey]类型为boolean
childrenKey: { type: String, default: 'children' }, // 子菜单Key
disabledKey: { type: String, default: 'disabled' }, // 是否禁用Key
activeKey: { type: String, default: 'active' }, // 菜单是否激活/选中
openKey: { type: String, default: 'open' }, // 菜单是否打开

/* 菜单模板 */
menuItemTemplate: { type: Boolean, default: true }, // 可展开菜单内容条模板
Expand Down Expand Up @@ -42,21 +42,21 @@ export const accordionProps = {
/* 内置路由/链接/动态判断路由或链接类型 */
linkType: {
type: String as () =>
| "routerLink"
| "hrefLink"
| "dependOnLinkTypeKey"
| ""
| 'routerLink'
| 'hrefLink'
| 'dependOnLinkTypeKey'
| ''
| string,
default: "",
default: '',
},
linkTypeKey: { type: String, default: "linkType" }, // linkType为'dependOnLinkTypeKey'时指定对象linkType定义区
linkKey: { type: String, default: "link" }, // 链接内容的key
linkTargetKey: { type: String, default: "target" }, // 链接目标窗口的key
linkDefaultTarget: { type: String, default: "_self" }, // 不设置target的时候target默认值
linkTypeKey: { type: String, default: 'linkType' }, // linkType为'dependOnLinkTypeKey'时指定对象linkType定义区
linkKey: { type: String, default: 'link' }, // 链接内容的key
linkTargetKey: { type: String, default: 'target' }, // 链接目标窗口的key
linkDefaultTarget: { type: String, default: '_self' }, // 不设置target的时候target默认值

accordionType: {
type: String as () => "normal" | "embed",
default: "normal",
type: String as () => 'normal' | 'embed',
default: 'normal',
},
} as const;

Expand Down
11 changes: 6 additions & 5 deletions packages/devui-vue/devui/accordion/src/accordion.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
@import '../../style/theme/corner';
@import '../../style/core/animation';

.devui-accordion-menu {
ol, ul{
.devui-accordion-menu {
ol,
ul {
margin: 0 !important;
line-height: 0 !important;
font-size: 12px;
Expand Down Expand Up @@ -120,7 +121,7 @@ d-accordion-item-routerlink {
/* 展开图标相关 */
.devui-accordion-menu-item > .devui-accordion-item-title {
position: relative;

& > .devui-accordion-open-icon {
display: inline-block;
text-indent: 0;
Expand Down Expand Up @@ -177,8 +178,8 @@ d-accordion-item-routerlink {

.devui-accordion-list .devui-accordion-menu-hidden {
// display: none;
opacity: 0;
height: 0px;
opacity: 0;
height: 0;
overflow: hidden;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/devui-vue/devui/accordion/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AccordionMenuItem, AccordionMenuType } from './accordion.type'
import { ComponentInternalInstance, getCurrentInstance } from "vue"
import { ComponentInternalInstance, getCurrentInstance } from 'vue'

const flatten = (
arr: Array<any>,
Expand Down
6 changes: 4 additions & 2 deletions packages/devui-vue/devui/auto-complete/src/auto-complete.scss
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
@import '../../style/mixins/index';
@import '../../style/theme/color';

.devui-auto-complete,
.devui-auto-complete-menu {
.devui-dropdown-menu {
left: 0 !important;
top: 0 !important;
}
}
.devui-auto-complete{

.devui-auto-complete {
.active {
background: $devui-list-item-hover-bg;
}
Expand Down Expand Up @@ -90,4 +92,4 @@
.devui-dropdown-latestSource ul {
line-height: initial !important;
}
}
}
Loading