mirror of
https://github.com/jumpserver/lina.git
synced 2026-01-29 21:28:52 +00:00
perf: 支持 help text as placeholder
This commit is contained in:
@@ -156,7 +156,7 @@ export const accountFieldsMeta = (vm) => {
|
||||
}
|
||||
},
|
||||
push_now: {
|
||||
helpText: vm.$t('WindowsPushHelpText'),
|
||||
helpTip: vm.$t('WindowsPushHelpText'),
|
||||
hidden: (formValue) => {
|
||||
const automation = vm.iPlatform.automation || {}
|
||||
return !automation.push_account_enabled ||
|
||||
|
||||
@@ -190,7 +190,6 @@ export default {
|
||||
|
||||
.action-item {
|
||||
margin-left: 5px;
|
||||
line-height: 1;
|
||||
|
||||
&:first-child {
|
||||
margin-left: 0;
|
||||
|
||||
@@ -162,19 +162,22 @@ export class FormFieldGenerator {
|
||||
|
||||
afterGenerateField(field) {
|
||||
field.label = toSentenceCase(field.label)
|
||||
if (!field.helpText && field.helpTip && field.helpTipAsText) {
|
||||
field.helpText = field.helpTip
|
||||
field.helpTip = ''
|
||||
if (!field.helpTip && field.helpText && field.helpTextAsTip) {
|
||||
field.helpTip = field.helpText
|
||||
field.helpText = ''
|
||||
}
|
||||
if (field.placeholder) {
|
||||
field.el.placeholder = field.placeholder
|
||||
}
|
||||
return field
|
||||
}
|
||||
|
||||
generateField(name, fieldsMeta, remoteFieldsMeta) {
|
||||
let field = { id: name, prop: name, el: {}, attrs: {}, rules: [] }
|
||||
let field = { id: name, prop: name, el: {}, attrs: {}, rules: [], helpTextAsTip: true }
|
||||
const remoteFieldMeta = remoteFieldsMeta[name] || {}
|
||||
const fieldMeta = fieldsMeta[name] || {}
|
||||
field.label = remoteFieldMeta.label
|
||||
field.helpTip = toSentenceCase(remoteFieldMeta['help_text'])
|
||||
field.helpText = toSentenceCase(remoteFieldMeta['help_text'])
|
||||
field = this.generateFieldByType(remoteFieldMeta.type, field, fieldMeta, remoteFieldMeta)
|
||||
field = this.generateFieldByName(name, field)
|
||||
field = this.generateFieldByOther(field, fieldMeta, remoteFieldMeta)
|
||||
@@ -195,6 +198,11 @@ export class FormFieldGenerator {
|
||||
if (!label) {
|
||||
return field
|
||||
}
|
||||
if (field.helpText && field.helpTextAsPlaceholder) {
|
||||
field.el.placeholder = field.helpText
|
||||
field.helpText = ''
|
||||
return field
|
||||
}
|
||||
if (field.type === 'select' || [ObjectSelect2].indexOf(field.component) > -1) {
|
||||
field.el.placeholder = i18n.t('Please select ') + label.toLowerCase()
|
||||
} else if (field.type === 'input') {
|
||||
|
||||
@@ -526,11 +526,3 @@ li.rmenu i.fa {
|
||||
.el-checkbox__inner {
|
||||
border-radius: 1px !important;
|
||||
}
|
||||
|
||||
.el-button.el-button--primary {
|
||||
border-color: var(--color-border);
|
||||
|
||||
&:hover {
|
||||
border-color: var(--color-border);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,16 +19,20 @@ export function changeElementColor(themeColors) {
|
||||
const blendColor = mix('ffffff', value.replace(/#/g, ''), 35)
|
||||
const darken = mix('000000', value.replace(/#/g, ''), 10)
|
||||
colorsCssText = colorsCssText + `
|
||||
.el-button--${key}:focus {
|
||||
.el-button--${key}{
|
||||
border-color: var(--color-border);
|
||||
}
|
||||
.el-button--${key}:focus,
|
||||
.el-button--${key}:active,
|
||||
.el-button--${key}:hover {
|
||||
background-color: ${darken}!important;
|
||||
border-color: var(--color-border)!important;
|
||||
}
|
||||
.el-button--${key}.is-disabled,
|
||||
.el-button--${key}.is-disabled:active,
|
||||
.el-button--${key}.is-disabled:focus {
|
||||
background-color: ${blendColor}!important;
|
||||
}
|
||||
.el-button--${key}:hover{
|
||||
background-color: ${darken}!important;
|
||||
border-color: var(--color-border);
|
||||
}
|
||||
.el-link.el-link--${key}{
|
||||
color: ${value}!important;
|
||||
|
||||
@@ -36,6 +36,12 @@ export default {
|
||||
],
|
||||
url: '/api/v1/users/users/',
|
||||
fieldsMeta: {
|
||||
name: {
|
||||
helpTextAsPlaceholder: true
|
||||
},
|
||||
username: {
|
||||
helpTextAsPlaceholder: true
|
||||
},
|
||||
password_strategy: {
|
||||
hidden: (formValue) => {
|
||||
return this.$route.params.id || formValue.source !== 'local'
|
||||
|
||||
Reference in New Issue
Block a user