Skip to content

Commit

Permalink
bugfix: form样式调整 TencentBlueKing#1578
Browse files Browse the repository at this point in the history
  • Loading branch information
hLinx committed Dec 2, 2022
2 parents 39d3d4f + 54abebb commit 9fd67bc
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 45 deletions.
31 changes: 12 additions & 19 deletions src/frontend/src/components/jb-form/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,13 @@
const { width } = item.querySelector('span').getBoundingClientRect();
max = Math.max(max, width);
});

const labelWidth = max + labelPadding + safePadding;
$labelEleList.forEach((item) => {
item.style.width = `${max + labelPadding + safePadding}px`;
item.style.width = `${labelWidth}px`;
});
$formEle.querySelectorAll('.bk-form-content').forEach((item) => {
item.style.marginLeft = `${max + this.paddingLeft}px`;
item.style.marginLeft = `${labelWidth}px`;
});
this.max = max;
},
Expand Down Expand Up @@ -180,22 +182,20 @@
<style lang='postcss'>
.job-form {
.bk-form {
.bk-label {
height: 32px;
padding-right: 24px;
word-break: keep-all;
white-space: pre;
box-sizing: border-box;
}

.bk-form-item {
display: flex;
margin-bottom: 20px;

.bk-form-content {
flex: 1;
display: flex;
flex-direction: column;
margin-left: 0 !important;
overflow: hidden;
}
}

&.bk-form-vertical {
.bk-form-item {
flex-direction: column;
margin: 0;
margin-bottom: 20px;
}
Expand Down Expand Up @@ -229,12 +229,5 @@
}
}
}

.bk-label {
padding-right: 24px;
word-break: keep-all;
white-space: pre;
box-sizing: border-box;
}
}
</style>
29 changes: 4 additions & 25 deletions src/frontend/src/components/jb-form/item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,13 @@
<template>
<bk-form-item
ref="bkFormItem"
class="jb-form-item"
:class="classes"
:error-display-type="errorDisplayType"
:label="label"
v-bind="$attrs"
v-on="$listeners">
<div class="jb-form-item-content">
<slot />
</div>
<slot />
</bk-form-item>
</template>
<script>
Expand All @@ -47,29 +46,21 @@
type: String,
default: '',
},
layout: {
type: String,
default: '',
},
errorDisplayType: {
type: String,
default: 'normal',
},
},

computed: {
classes () {
const classes = {
'jb-form-item': true,
'label-miss': !this.label,
};
if (this.layout) {
classes[`layout-${this.layout}`] = true;
}
return classes;
},
},

methods: {
clearValidator () {
this.$refs.bkFormItem.clearValidator();
Expand All @@ -87,20 +78,8 @@
}
}

&.layout-inline {
flex-direction: row !important;
}

&.layout-vertical {
flex-direction: column !important;
}

.jb-form-item-content {
flex: 1;
}

.bk-label {
height: 32px;
}
}
</style>
2 changes: 2 additions & 0 deletions src/frontend/src/views/dangerous-rule-manage/index/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,8 @@
</script>
<style lang='postcss'>
.dangerous-rule-manage-page {
padding-bottom: 20px;

.rule-table {
width: 100%;
border: 1px solid #dcdee5;
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/views/script-template/index/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
</div>
<element-teleport to="#siteHeaderStatusBar">
<span style="padding-left: 12px; font-size: 12px; color: #979ba5;">
{{ $t('脚本模板仅对当前用户在新建脚本相关场景下有效(如快速执行脚本、新建脚本、作业脚本步骤)') }}
{{ $t('scriptTemplate.脚本模板仅对当前用户在新建脚本相关场景下有效(如快速执行脚本、新建脚本、作业脚本步骤)') }}
</span>
</element-teleport>
</div>
Expand Down

0 comments on commit 9fd67bc

Please sign in to comment.