Skip to content

Commit e249900

Browse files
authored
Merge pull request #113 from sheepzh/ele
Upgrade element-plus to v2.x.x
2 parents 4ae135b + 45c656f commit e249900

29 files changed

+141
-63
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"clipboardy": "^3.0.0",
5252
"countup.js": "^2.2.0",
5353
"echarts": "^5.3.3",
54-
"element-plus": "1.2.0-beta.6",
54+
"element-plus": "2.2.6",
5555
"psl": "^1.8.0",
5656
"vue": "^3.2.37",
5757
"vue-router": "^4.0.16"

src/app/components/common/date-range-filter-item.ts

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const _default = defineComponent({
2626
setup(props, ctx) {
2727
// @ts-ignore
2828
const dateRange: Ref<Date[]> = ref(props.defaultRange || [undefined, undefined])
29+
// @ts-ignore
2930
return () => h('span', { class: 'filter-item' }, h(ElDatePicker,
3031
{
3132
modelValue: dateRange.value,

src/app/components/common/editable-tag.sass

+17-7
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,19 @@
66
*/
77

88
.el-tag
9+
height: 32px
910
margin-right: 10px
1011

12+
.editable-tag-container
13+
// offset right margin from the rightmost child
14+
margin-right: -10px
15+
display: flex
16+
flex-flow: row wrap
17+
justify-content: space-between
18+
.item-input-container,.item-add-button
19+
// The last line left
20+
margin-right: auto
21+
1122
.item-cancel-button
1223
border-right: 0.5px
1324
border-radius: 0
@@ -17,24 +28,23 @@
1728
margin-left: 0px !important
1829
margin-right: 10px
1930
.item-check-button,.item-cancel-button,.item-add-button
20-
height: 30px
31+
height: 32px
2132
line-height: 30px
2233
.item-add-button
2334
padding: 0 15px
2435
.item-check-button,.item-cancel-button
2536
padding: 0 10px
2637

27-
.input-new-tag
28-
width: 140px
29-
input
30-
height: 32px
31-
3238
.item-input-container
33-
display: inline-block
39+
display: inline-flex
40+
.el-input__wrapper
41+
height: 30px
42+
width: 140px
3443

3544
.editable-item
3645
margin-bottom: 9px
3746
line-height: 32px !important
47+
display: inline-flex
3848

3949
.edit-icon
4050
height: 14px

src/app/components/common/popup-confirm-button.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const _default = defineComponent({
3636
onConfirm: () => ctx.emit("confirm")
3737
}, {
3838
reference: () => h(ElButton, {
39-
size: "mini",
39+
size: 'small',
4040
type: props.buttonType,
4141
icon: props.buttonIcon,
4242
style: {

src/app/components/common/switch-filter-item.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const _default = defineComponent({
2121
emits: ["change"],
2222
setup(props, ctx) {
2323
const modelValue: Ref<boolean> = ref(props.defaultValue)
24-
return () => h("span", {}, [
24+
return () => h("span", { class: "filter-switch" }, [
2525
h('a', { class: 'filter-name' }, props.label),
2626
h(ElSwitch, {
2727
class: 'filter-item',

src/app/components/dashboard/feedback.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const _default = defineComponent({
2828
effect: Effect.LIGHT,
2929
}, () => h(ElButton, {
3030
type: "info",
31-
size: "mini",
31+
size: 'small',
3232
icon: Headset,
3333
round: true,
3434
onClick: () => chrome.tabs.create({

src/app/components/data-manage/clear/filter/date-filter.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@ const pickerShortcuts = [
3737
datePickerShortcut('till30DaysAgo', 30)
3838
]
3939

40+
// @ts-ignore
4041
const picker = ({ dateRangeRef }: DateFilterProps) => h(ElDatePicker, {
4142
modelValue: dateRangeRef.value,
4243
"onUpdate:modelValue": (date: Array<Date>) => dateRangeRef.value = date,
43-
size: 'mini',
44+
size: 'small',
4445
style: 'width:250px;',
4546
startPlaceholder: '1994/12/15',
4647
format: "YYYY/MM/DD",

src/app/components/data-manage/clear/filter/number-filter.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const elInput = (valRef: Ref<string>, placeholder: string, min?: Ref<string>) =>
1717
placeholder: placeholder,
1818
min: min !== undefined ? min.value || '0' : undefined,
1919
clearable: true,
20-
size: 'mini',
20+
size: 'small',
2121
modelValue: valRef.value,
2222
onInput: (val: string) => valRef.value = val.trim(),
2323
onClear: () => valRef.value = ''

src/app/components/data-manage/clear/filter/operation-button.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ const button = (props: _Props) => h(ElButton,
139139
{
140140
icon: props.button.icon,
141141
type: props.button.type,
142-
size: 'mini',
142+
size: 'small',
143143
onClick: () => handleClick(props)
144144
},
145145
() => t(msg => msg.item.operation[props.button.message])

src/app/components/limit/table/column/operation.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const _default = defineComponent({
2626
default: ({ row }: { row: TimeLimitItem }) => [
2727
h(ElButton, {
2828
type: 'danger',
29-
size: 'mini',
29+
size: 'small',
3030
icon: Delete,
3131
onClick() {
3232
const { cond } = row

src/app/components/limit/table/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const _default = defineComponent({
2424
setup(props, ctx) {
2525
return () => h(ElTable, {
2626
border: true,
27-
size: 'mini',
27+
size: 'small',
2828
style: { width: '100%' },
2929
highlightCurrentRow: true,
3030
fit: true,

src/app/components/option/common.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { OptionMessage } from "@app/locale/components/option"
2121
export function renderOptionItem(input: VNode | { [key: string]: VNode }, label: (msg: OptionMessage) => string, defaultValue: string | number) {
2222
const param = isVNode(input) ? { input } : input
2323
const labelArcher = h('a', { class: 'option-label' }, tN(msg => label(msg.option), param))
24-
const defaultTag = h(ElTag, { size: 'mini' }, () => defaultValue)
24+
const defaultTag = h(ElTag, { size: 'small' }, () => defaultValue)
2525
const defaultArcher = h('a', { class: 'option-default' }, tN(msg => msg.option.defaultValue, { default: defaultTag }))
2626
return h('div', { class: 'option-line' }, [labelArcher, defaultArcher])
2727
}

src/app/components/option/components/appearance.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const allLocaleOptions: Timer.LocaleOption[] = ["default", ...allLocales]
4646

4747
const locale = (option: Ref<Timer.AppearanceOption>) => h(ElSelect, {
4848
modelValue: option.value.locale,
49-
size: 'mini',
49+
size: 'small',
5050
style: { width: '120px' },
5151
onChange: async (newVal: Timer.LocaleOption) => {
5252
option.value.locale = newVal

src/app/components/option/components/popup.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { ALL_POPUP_DURATION } from "@util/constant/popup"
1616

1717
const popupMaxInput = (option: Ref<Timer.PopupOption>) => h(ElInputNumber, {
1818
modelValue: option.value.popupMax,
19-
size: 'mini',
19+
size: 'small',
2020
min: 5,
2121
max: 30,
2222
onChange: (val: number) => {
@@ -28,7 +28,7 @@ const popupMaxInput = (option: Ref<Timer.PopupOption>) => h(ElInputNumber, {
2828
const typeOptions = () => ALL_DATA_ITEMS.map(item => h(ElOption, { value: item, label: t(msg => msg.item[item]) }))
2929
const typeSelect = (option: Ref<Timer.PopupOption>) => h(ElSelect, {
3030
modelValue: option.value.defaultType,
31-
size: 'mini',
31+
size: 'small',
3232
style: { width: '120px' },
3333
onChange: (val: Timer.DataDimension) => {
3434
option.value.defaultType = val
@@ -39,7 +39,7 @@ const typeSelect = (option: Ref<Timer.PopupOption>) => h(ElSelect, {
3939
const durationOptions = () => ALL_POPUP_DURATION.map(item => h(ElOption, { value: item, label: t(msg => msg.option.popup.duration[item]) }))
4040
const durationSelect = (option: Ref<Timer.PopupOption>) => h(ElSelect, {
4141
modelValue: option.value.defaultDuration,
42-
size: 'mini',
42+
size: 'small',
4343
style: { width: t(msg => msg.option.popup.durationWidth) },
4444
onChange: (val: Timer.PopupDuration) => {
4545
option.value.defaultDuration = val

src/app/components/option/style/index.sass

+6
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,16 @@
2525
.option-line
2626
height: 30px
2727
line-height: 30px
28+
.el-input--small
29+
height: 28px
30+
.el-input__wrapper
31+
height: 26px
2832
.option-label
2933
float: left
3034
.option-default
3135
float: right
36+
.el-tag
37+
height: 20px
3238
.option-container>span
3339
margin: 20px
3440
padding-left: 20px

src/app/components/report/filter/download-file.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const _default = defineComponent({
1919
setup(_, ctx) {
2020
return () => h(ElDropdown, { class: 'export-dropdown', showTimeout: 100 }, {
2121
default: () => h(ElButton,
22-
{ size: 'mini', class: 'export-dropdown-button' },
22+
{ size: 'small', class: 'export-dropdown-button' },
2323
() => h(ElIcon, { size: 17, style: { padding: '0 1px' } }, () => h(Download))
2424
),
2525
dropdown: () => h(ElDropdownMenu, {},

src/app/components/report/filter/index.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,12 @@ const _default = defineComponent({
120120
}
121121
}),
122122
// Float right
123-
h("div", { style: { float: "right" } }, [
123+
h("div", { class: "filter-item-right-group" }, [
124124
h(ElButton, {
125125
class: "batch-delete-button",
126126
disabled: mergeHost.value,
127-
type: "text",
127+
type: "primary",
128+
link: true,
128129
icon: DeleteFilled,
129130
onClick: () => ctx.emit("batchDelete", computeOption())
130131
}, () => batchDeleteButtonText),

src/app/components/report/styles/element.sass

+3
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,16 @@
1010

1111
.batch-delete-button
1212
margin-right: 20px
13+
height: 41px !important
14+
margin-top: 2px
1315

1416
.export-dropdown
1517

1618
&-menu-icon
1719
font-size: 16px
1820

1921
&-button
22+
width: 30px
2023
padding: 7px !important
2124
margin-top: 8px
2225

src/app/components/report/table/columns/alias-info.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ type _Emits = "change"
2121

2222
function renderEditing(data: _Data, ctx: SetupContext<_Emits[]>) {
2323
return h(ElInput, {
24-
size: "mini",
24+
size: 'small',
2525
ref: data.input,
2626
modelValue: data.inputVal.value,
2727
onInput: (newVal: string) => data.inputVal.value = newVal?.trimStart(),
@@ -60,7 +60,6 @@ function renderText(data: _Data) {
6060
style: { paddingRight: "4px" }
6161
}, data.inputVal.value))
6262
result.push(h(ElIcon, {
63-
size: 17,
6463
class: "edit-btn"
6564
}, () => h(Edit, {
6665
onClick: () => {

src/app/components/report/table/columns/operation.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ const _default = defineComponent({
6767
// Trend
6868
h(ElButton, {
6969
icon: Stopwatch,
70-
size: 'mini',
70+
size: 'small',
7171
type: 'primary',
7272
onClick() {
7373
const query: LocationQueryRaw = {

src/app/components/report/table/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const _default = defineComponent({
5151
return () => h(ElTable, {
5252
data: props.data,
5353
border: true,
54-
size: 'mini',
54+
size: 'small',
5555
defaultSort: props.defaultSort,
5656
style: { width: '100%' },
5757
highlightCurrentRow: true,

src/app/components/rule-merge/item-list.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ const itemList = () => {
102102
onSaved: (origin, merged) => handleInputConfirm(origin, merged, addButtonRef)
103103
})
104104
result.push(addButton)
105-
return result
105+
return h('div', { class: 'editable-tag-container' }, result)
106106
}
107107

108108
export default itemList

src/app/components/site-manage/table/column/operation.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const deleteButton = (ctx: SetupContext<_Emit[]>, row: HostAliasInfo) => h(Popup
2323

2424
const modifyButtonText = t(msg => msg.siteManage.button.modify)
2525
const modifyButton = (ctx: SetupContext<_Emit[]>, row: HostAliasInfo) => h(ElButton, {
26-
size: 'mini',
26+
size: 'small',
2727
type: "primary",
2828
icon: Edit,
2929
onClick: () => ctx.emit("modify", row)

src/app/components/site-manage/table/column/source.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const SOURCE_DESC: { [source in HostAliasSource]: string } = {
1717

1818
function renderSource(source: HostAliasSource) {
1919
const type = source === HostAliasSource.USER ? '' : 'info'
20-
return h(ElTag, { type, size: 'mini' }, () => SOURCE_DESC[source])
20+
return h(ElTag, { type, size: 'small' }, () => SOURCE_DESC[source])
2121
}
2222

2323
const _default = defineComponent({

src/app/components/site-manage/table/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const _default = defineComponent({
2323
return () => h(ElTable, {
2424
data: props.data,
2525
border: true,
26-
size: 'mini',
26+
size: 'small',
2727
style: { width: '100%' },
2828
highlightCurrentRow: true,
2929
fit: true,

src/app/components/whitelist/item-list.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function handleAdd(inputValue: string, ref: Ref) {
6666
}).catch(() => { })
6767
}
6868

69-
const tags: () => VNode[] = () => {
69+
function tags(): VNode {
7070
const result = []
7171
whitelistRef.value.forEach((white: string, index: number) => {
7272
const itemRef: Ref = ref()
@@ -82,7 +82,7 @@ const tags: () => VNode[] = () => {
8282
ref: addButtonRef,
8383
onSaved: (inputVal: string) => handleAdd(inputVal, addButtonRef)
8484
}))
85-
return result
85+
return h('div', { class: 'editable-tag-container' }, result)
8686
}
8787

8888
export default tags

src/app/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { App, createApp } from "vue"
99
import Main from "./layout"
1010
import 'element-plus/theme-chalk/index.css'
1111
import './styles' // global css
12+
import './styles/compatible'
1213
import installRouter from "./router"
1314
import '../common/timer'
1415
import ElementPlus from 'element-plus'

src/app/styles/compatible.sass

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/**
2+
* Copyright (c) 2022 Hengyang Zhang
3+
*
4+
* This software is released under the MIT License.
5+
* https://opensource.org/licenses/MIT
6+
*/
7+
8+
// Compatible for element-ui
9+
.el-button--small
10+
min-height: 28px
11+
padding: 7px 15px
12+
.el-input
13+
line-height: var(--el-input-height)
14+
.el-input__wrapper
15+
height: var(--el-input-inner-height)
16+
17+
.el-table
18+
.el-checkbox.el-checkbox--small
19+
height: 28px
20+
21+
.el-table--small .el-table__cell
22+
padding: 6px 0
23+
24+
.el-pagination
25+
--el-pagination-font-size: 13px
26+
--el-pagination-button-width: 35.5px
27+
--el-pagination-button-height: 28px
28+
29+
.el-pagination__sizes>.el-select--default, .el-pagination__jump>.el-input
30+
line-height: 28px
31+
--el-input-inner-height: 26px
32+
33+
.filter-item.el-button
34+
min-height: 40px
35+
36+
.el-input--prefix
37+
.el-input__wrapper
38+
padding-left: 0px
39+
.el-select
40+
input
41+
padding-left: 11px
42+
43+
\:root
44+
--el-input-height: 40px
45+
--el-input-inner-height: 38px

0 commit comments

Comments
 (0)