mirror of https://github.com/ElemeFE/element
Form: add size attribute (#7428)
parent
ab47262588
commit
9b09f6aa9f
|
@ -31,6 +31,9 @@ const install = function(Vue, opts = {}) {
|
||||||
|
|
||||||
Vue.use(Loading.directive);
|
Vue.use(Loading.directive);
|
||||||
|
|
||||||
|
const ELEMENT = {};
|
||||||
|
ELEMENT.size = opts.size || '';
|
||||||
|
|
||||||
Vue.prototype.$loading = Loading.service;
|
Vue.prototype.$loading = Loading.service;
|
||||||
Vue.prototype.$msgbox = MessageBox;
|
Vue.prototype.$msgbox = MessageBox;
|
||||||
Vue.prototype.$alert = MessageBox.alert;
|
Vue.prototype.$alert = MessageBox.alert;
|
||||||
|
@ -38,6 +41,8 @@ const install = function(Vue, opts = {}) {
|
||||||
Vue.prototype.$prompt = MessageBox.prompt;
|
Vue.prototype.$prompt = MessageBox.prompt;
|
||||||
Vue.prototype.$notify = Notification;
|
Vue.prototype.$notify = Notification;
|
||||||
Vue.prototype.$message = Message;
|
Vue.prototype.$message = Message;
|
||||||
|
|
||||||
|
Vue.prototype.$ELEMENT = ELEMENT;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* istanbul ignore if */
|
/* istanbul ignore if */
|
||||||
|
|
|
@ -1678,7 +1678,7 @@ Search and select options with a keyword.
|
||||||
| filterable | whether the options can be searched | boolean | — | — |
|
| filterable | whether the options can be searched | boolean | — | — |
|
||||||
| debounce | debounce delay when typing filter keyword, in milliseconds | number | — | 300 |
|
| debounce | debounce delay when typing filter keyword, in milliseconds | number | — | 300 |
|
||||||
| change-on-select | whether selecting an option of any level is permitted | boolean | — | false |
|
| change-on-select | whether selecting an option of any level is permitted | boolean | — | false |
|
||||||
| size | size of Input | string | large / small / mini | — |
|
| size | size of Input | string | medium / small / mini | — |
|
||||||
|
|
||||||
### props
|
### props
|
||||||
| Attribute | Description | Type | Accepted Values | Default |
|
| Attribute | Description | Type | Accepted Values | Default |
|
||||||
|
|
|
@ -287,7 +287,7 @@ If the variable bound to `visible` is managed in Vuex store, the `.sync` can not
|
||||||
| title | title of Dialog. Can also be passed with a named slot (see the following table) | string | — | — |
|
| title | title of Dialog. Can also be passed with a named slot (see the following table) | string | — | — |
|
||||||
| width | width of Dialog | string | — | 50% |
|
| width | width of Dialog | string | — | 50% |
|
||||||
| fullscreen | whether the Dialog takes up full screen | boolean | — | false |
|
| fullscreen | whether the Dialog takes up full screen | boolean | — | false |
|
||||||
| top | value for `margin-top` of Dialog CSS, works when `size` is not `full` | string | — | 15vh |
|
| top | value for `margin-top` of Dialog CSS | string | — | 15vh |
|
||||||
| modal | whether a mask is displayed | boolean | — | true |
|
| modal | whether a mask is displayed | boolean | — | true |
|
||||||
| modal-append-to-body | whether to append modal to body element. If false, the modal will be appended to Dialog's parent element | boolean | — | true |
|
| modal-append-to-body | whether to append modal to body element. If false, the modal will be appended to Dialog's parent element | boolean | — | true |
|
||||||
| append-to-body | whether to append Dialog itself to body. A nested Dialog should have this attribute set to `true` | boolean | — | false |
|
| append-to-body | whether to append Dialog itself to body. A nested Dialog should have this attribute set to `true` | boolean | — | false |
|
||||||
|
|
|
@ -739,6 +739,51 @@ This example shows how to customize your own validation rules to finish a two-fa
|
||||||
When an `el-form-item` is nested in another `el-form-item`, its label width will be `0`. You can set `label-width` on that `el-form-item` if needed.
|
When an `el-form-item` is nested in another `el-form-item`, its label width will be `0`. You can set `label-width` on that `el-form-item` if needed.
|
||||||
:::
|
:::
|
||||||
|
|
||||||
|
### Size control
|
||||||
|
|
||||||
|
All components in a Form inherit their `size` attribute from that Form. Similarly, FormItem also has a `size` attribute.
|
||||||
|
|
||||||
|
::: demo Still you can fine tune each component's `size` if you don't want that component to inherit its size from From or FormIten.
|
||||||
|
```html
|
||||||
|
<el-form ref="form" :model="form" label-width="120px" size="mini">
|
||||||
|
<el-form-item label="Activity name">
|
||||||
|
<el-input v-model="form.name"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="Activity zone">
|
||||||
|
<el-select v-model="form.region" placeholder="please select your zone">
|
||||||
|
<el-option label="Zone one" value="shanghai"></el-option>
|
||||||
|
<el-option label="Zone two" value="beijing"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="Activity time">
|
||||||
|
<el-col :span="11">
|
||||||
|
<el-date-picker type="date" placeholder="Pick a date" v-model="form.date1" style="width: 100%;"></el-date-picker>
|
||||||
|
</el-col>
|
||||||
|
<el-col class="line" :span="2">-</el-col>
|
||||||
|
<el-col :span="11">
|
||||||
|
<el-time-picker type="fixed-time" placeholder="Pick a time" v-model="form.date2" style="width: 100%;"></el-time-picker>
|
||||||
|
</el-col>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="Activity type">
|
||||||
|
<el-checkbox-group v-model="form.type">
|
||||||
|
<el-checkbox-button label="Online activities" name="type"></el-checkbox-button>
|
||||||
|
<el-checkbox-button label="Promotion activities" name="type"></el-checkbox-button>
|
||||||
|
</el-checkbox-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="Resources">
|
||||||
|
<el-radio-group v-model="form.resource" size="medium">
|
||||||
|
<el-radio border label="Sponsor"></el-radio>
|
||||||
|
<el-radio border label="Venue"></el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item size="large">
|
||||||
|
<el-button type="primary" @click="onSubmit">Create</el-button>
|
||||||
|
<el-button>Cancel</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
```
|
||||||
|
:::
|
||||||
|
|
||||||
### Form Attributes
|
### Form Attributes
|
||||||
|
|
||||||
| Attribute | Description | Type | Accepted Values | Default |
|
| Attribute | Description | Type | Accepted Values | Default |
|
||||||
|
@ -752,6 +797,7 @@ When an `el-form-item` is nested in another `el-form-item`, its label width will
|
||||||
| show-message | whether to show the error message | boolean | — | true |
|
| show-message | whether to show the error message | boolean | — | true |
|
||||||
| inline-message | whether to display the error message inline with the form item | boolean | — | false |
|
| inline-message | whether to display the error message inline with the form item | boolean | — | false |
|
||||||
| status-icon | whether to display an icon indicating the validation result | boolean | — | false |
|
| status-icon | whether to display an icon indicating the validation result | boolean | — | false |
|
||||||
|
| size | control the size of components in this form | string | medium / small / mini | - |
|
||||||
|
|
||||||
### Form Methods
|
### Form Methods
|
||||||
|
|
||||||
|
@ -773,6 +819,7 @@ When an `el-form-item` is nested in another `el-form-item`, its label width will
|
||||||
| error | field error message, set its value and the field will validate error and show this message immediately | string | — | — |
|
| error | field error message, set its value and the field will validate error and show this message immediately | string | — | — |
|
||||||
| show-message | whether to show the error message | boolean | — | true |
|
| show-message | whether to show the error message | boolean | — | true |
|
||||||
| inline-message | inline style validate message | boolean | — | false |
|
| inline-message | inline style validate message | boolean | — | false |
|
||||||
|
| size | control the size of components in this form-item | string | medium / small / mini | - |
|
||||||
|
|
||||||
### Form-Item Slot
|
### Form-Item Slot
|
||||||
| Name | Description |
|
| Name | Description |
|
||||||
|
|
|
@ -1678,7 +1678,7 @@
|
||||||
| filterable | 是否可搜索选项 | boolean | — | — |
|
| filterable | 是否可搜索选项 | boolean | — | — |
|
||||||
| debounce | 搜索关键词输入的去抖延迟,毫秒 | number | — | 300 |
|
| debounce | 搜索关键词输入的去抖延迟,毫秒 | number | — | 300 |
|
||||||
| change-on-select | 是否允许选择任意一级的选项 | boolean | — | false |
|
| change-on-select | 是否允许选择任意一级的选项 | boolean | — | false |
|
||||||
| size | 尺寸 | string | large / small / mini | — |
|
| size | 尺寸 | string | medium / small / mini | — |
|
||||||
|
|
||||||
### props
|
### props
|
||||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||||
|
|
|
@ -282,7 +282,7 @@ Dialog 组件的内容可以是任意的,甚至可以是表格或表单,下
|
||||||
| title | Dialog 的标题,也可通过具名 slot (见下表)传入 | string | — | — |
|
| title | Dialog 的标题,也可通过具名 slot (见下表)传入 | string | — | — |
|
||||||
| width | Dialog 的宽度 | string | — | 50% |
|
| width | Dialog 的宽度 | string | — | 50% |
|
||||||
| fullscreen | 是否为全屏 Dialog | boolean | — | false |
|
| fullscreen | 是否为全屏 Dialog | boolean | — | false |
|
||||||
| top | Dialog CSS 中的 margin-top 值(仅在 size 不为 full 时有效) | string | — | 15vh |
|
| top | Dialog CSS 中的 margin-top 值 | string | — | 15vh |
|
||||||
| modal | 是否需要遮罩层 | boolean | — | true |
|
| modal | 是否需要遮罩层 | boolean | — | true |
|
||||||
| modal-append-to-body | 遮罩层是否插入至 body 元素上,若为 false,则遮罩层会插入至 Dialog 的父元素上 | boolean | — | true |
|
| modal-append-to-body | 遮罩层是否插入至 body 元素上,若为 false,则遮罩层会插入至 Dialog 的父元素上 | boolean | — | true |
|
||||||
| append-to-body | Dialog 自身是否插入至 body 元素上。嵌套的 Dialog 必须指定该属性并赋值为 true | boolean | — | false |
|
| append-to-body | Dialog 自身是否插入至 body 元素上。嵌套的 Dialog 必须指定该属性并赋值为 true | boolean | — | false |
|
||||||
|
|
|
@ -728,6 +728,52 @@
|
||||||
嵌套在 `el-form-item` 中的 `el-form-item` 标签宽度默认为零,不会继承 `el-form` 的 `label-width`。如果需要可以为其单独设置 `label-width` 属性。
|
嵌套在 `el-form-item` 中的 `el-form-item` 标签宽度默认为零,不会继承 `el-form` 的 `label-width`。如果需要可以为其单独设置 `label-width` 属性。
|
||||||
:::
|
:::
|
||||||
|
|
||||||
|
### 表单内组件尺寸控制
|
||||||
|
|
||||||
|
通过设置 Form 上的 `size` 属性可以使该表单内所有可调节大小的组件继承该尺寸。Form-Item 也具有该属性。
|
||||||
|
|
||||||
|
::: demo 如果希望某个表单项或某个表单组件的尺寸不同于 Form 上的`size`属性,直接为这个表单项或表单组件设置自己的`size`即可。
|
||||||
|
```html
|
||||||
|
<el-form ref="form" :model="form" label-width="80px" size="mini">
|
||||||
|
<el-form-item label="活动名称">
|
||||||
|
<el-input v-model="form.name"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="活动区域">
|
||||||
|
<el-select v-model="form.region" placeholder="请选择活动区域">
|
||||||
|
<el-option label="区域一" value="shanghai"></el-option>
|
||||||
|
<el-option label="区域二" value="beijing"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="活动时间">
|
||||||
|
<el-col :span="11">
|
||||||
|
<el-date-picker type="date" placeholder="选择日期" v-model="form.date1" style="width: 100%;"></el-date-picker>
|
||||||
|
</el-col>
|
||||||
|
<el-col class="line" :span="2">-</el-col>
|
||||||
|
<el-col :span="11">
|
||||||
|
<el-time-picker type="fixed-time" placeholder="选择时间" v-model="form.date2" style="width: 100%;"></el-time-picker>
|
||||||
|
</el-col>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="活动性质">
|
||||||
|
<el-checkbox-group v-model="form.type">
|
||||||
|
<el-checkbox-button label="美食/餐厅线上活动" name="type"></el-checkbox-button>
|
||||||
|
<el-checkbox-button label="地推活动" name="type"></el-checkbox-button>
|
||||||
|
<el-checkbox-button label="线下主题活动" name="type"></el-checkbox-button>
|
||||||
|
</el-checkbox-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="特殊资源">
|
||||||
|
<el-radio-group v-model="form.resource" size="medium">
|
||||||
|
<el-radio border label="线上品牌商赞助"></el-radio>
|
||||||
|
<el-radio border label="线下场地免费"></el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item size="large">
|
||||||
|
<el-button type="primary" @click="onSubmit">立即创建</el-button>
|
||||||
|
<el-button>取消</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
```
|
||||||
|
:::
|
||||||
|
|
||||||
### Form Attributes
|
### Form Attributes
|
||||||
|
|
||||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||||
|
@ -741,6 +787,7 @@
|
||||||
| show-message | 是否显示校验错误信息 | boolean | — | true |
|
| show-message | 是否显示校验错误信息 | boolean | — | true |
|
||||||
| inline-message | 是否以行内形式展示校验信息 | boolean | — | false |
|
| inline-message | 是否以行内形式展示校验信息 | boolean | — | false |
|
||||||
| status-icon | 是否在输入框中显示校验结果反馈图标 | boolean | — | false |
|
| status-icon | 是否在输入框中显示校验结果反馈图标 | boolean | — | false |
|
||||||
|
| size | 用于控制该表单内组件的尺寸 | string | medium / small / mini | - |
|
||||||
|
|
||||||
### Form Methods
|
### Form Methods
|
||||||
|
|
||||||
|
@ -762,6 +809,7 @@
|
||||||
| error | 表单域验证错误信息, 设置该值会使表单验证状态变为`error`,并显示该错误信息 | string | — | — |
|
| error | 表单域验证错误信息, 设置该值会使表单验证状态变为`error`,并显示该错误信息 | string | — | — |
|
||||||
| show-message | 是否显示校验错误信息 | boolean | — | true |
|
| show-message | 是否显示校验错误信息 | boolean | — | true |
|
||||||
| inline-message | 以行内形式展示校验信息 | boolean | — | false |
|
| inline-message | 以行内形式展示校验信息 | boolean | — | false |
|
||||||
|
| size | 用于控制该表单域下组件的尺寸 | string | medium / small / mini | - |
|
||||||
|
|
||||||
### Form-Item Slot
|
### Form-Item Slot
|
||||||
| name | 说明 |
|
| name | 说明 |
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
:type="nativeType"
|
:type="nativeType"
|
||||||
:class="[
|
:class="[
|
||||||
type ? 'el-button--' + type : '',
|
type ? 'el-button--' + type : '',
|
||||||
size ? 'el-button--' + size : '',
|
buttonSize ? 'el-button--' + buttonSize : '',
|
||||||
{
|
{
|
||||||
'is-disabled': disabled,
|
'is-disabled': disabled,
|
||||||
'is-loading': loading,
|
'is-loading': loading,
|
||||||
|
@ -25,6 +25,8 @@
|
||||||
export default {
|
export default {
|
||||||
name: 'ElButton',
|
name: 'ElButton',
|
||||||
|
|
||||||
|
inject: ['elFormItem'],
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
type: {
|
type: {
|
||||||
type: String,
|
type: String,
|
||||||
|
@ -46,6 +48,15 @@
|
||||||
round: Boolean
|
round: Boolean
|
||||||
},
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
_elFormItemSize() {
|
||||||
|
return (this.elFormItem || {}).elFormItemSize;
|
||||||
|
},
|
||||||
|
buttonSize() {
|
||||||
|
return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
handleClick(evt) {
|
handleClick(evt) {
|
||||||
this.$emit('click', evt);
|
this.$emit('click', evt);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
'is-opened': menuVisible,
|
'is-opened': menuVisible,
|
||||||
'is-disabled': disabled
|
'is-disabled': disabled
|
||||||
},
|
},
|
||||||
size ? 'el-cascader--' + size : ''
|
cascaderSize ? 'el-cascader--' + cascaderSize : ''
|
||||||
]"
|
]"
|
||||||
@click="handleClick"
|
@click="handleClick"
|
||||||
@mouseenter="inputHover = true"
|
@mouseenter="inputHover = true"
|
||||||
|
@ -87,6 +87,8 @@ export default {
|
||||||
|
|
||||||
mixins: [popperMixin, emitter, Locale],
|
mixins: [popperMixin, emitter, Locale],
|
||||||
|
|
||||||
|
inject: ['elFormItem'],
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
ElInput
|
ElInput
|
||||||
},
|
},
|
||||||
|
@ -179,6 +181,12 @@ export default {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return labels;
|
return labels;
|
||||||
|
},
|
||||||
|
_elFormItemSize() {
|
||||||
|
return (this.elFormItem || {}).elFormItemSize;
|
||||||
|
},
|
||||||
|
cascaderSize() {
|
||||||
|
return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,8 @@
|
||||||
|
|
||||||
mixins: [Emitter],
|
mixins: [Emitter],
|
||||||
|
|
||||||
|
inject: ['elFormItem'],
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
selfModel: false,
|
selfModel: false,
|
||||||
|
@ -133,8 +135,12 @@
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_elFormItemSize() {
|
||||||
|
return (this.elFormItem || {}).elFormItemSize;
|
||||||
|
},
|
||||||
|
|
||||||
size() {
|
size() {
|
||||||
return this._checkboxGroup.size;
|
return this._checkboxGroup.checkboxGroupSize || this._elFormItemSize || (this.$ELEMENT || {}).size;
|
||||||
},
|
},
|
||||||
|
|
||||||
isDisabled() {
|
isDisabled() {
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
|
|
||||||
mixins: [Emitter],
|
mixins: [Emitter],
|
||||||
|
|
||||||
|
inject: ['elFormItem'],
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
value: {},
|
value: {},
|
||||||
disabled: Boolean,
|
disabled: Boolean,
|
||||||
|
@ -18,6 +20,15 @@
|
||||||
textColor: String
|
textColor: String
|
||||||
},
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
_elFormItemSize() {
|
||||||
|
return (this.elFormItem || {}).elFormItemSize;
|
||||||
|
},
|
||||||
|
checkboxGroupSize() {
|
||||||
|
return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
value(value) {
|
value(value) {
|
||||||
this.dispatch('ElFormItem', 'el.form.change', [value]);
|
this.dispatch('ElFormItem', 'el.form.change', [value]);
|
||||||
|
|
|
@ -60,6 +60,8 @@
|
||||||
|
|
||||||
mixins: [Emitter],
|
mixins: [Emitter],
|
||||||
|
|
||||||
|
inject: ['elFormItem'],
|
||||||
|
|
||||||
componentName: 'ElCheckbox',
|
componentName: 'ElCheckbox',
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
|
@ -131,10 +133,15 @@
|
||||||
: this.disabled;
|
: this.disabled;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_elFormItemSize() {
|
||||||
|
return (this.elFormItem || {}).elFormItemSize;
|
||||||
|
},
|
||||||
|
|
||||||
checkboxSize() {
|
checkboxSize() {
|
||||||
|
const temCheckboxSize = this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
|
||||||
return this.isGroup
|
return this.isGroup
|
||||||
? this._checkboxGroup.size || this.size
|
? this._checkboxGroup.checkboxGroupSize || temCheckboxSize
|
||||||
: this.size;
|
: temCheckboxSize;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
:class="[
|
:class="[
|
||||||
'el-color-picker',
|
'el-color-picker',
|
||||||
disabled ? 'is-disabled' : '',
|
disabled ? 'is-disabled' : '',
|
||||||
size ? `el-color-picker--${ size }` : ''
|
colorSize ? `el-color-picker--${ colorSize }` : ''
|
||||||
]"
|
]"
|
||||||
v-clickoutside="hide">
|
v-clickoutside="hide">
|
||||||
<div class="el-color-picker__mask" v-if="disabled"></div>
|
<div class="el-color-picker__mask" v-if="disabled"></div>
|
||||||
|
@ -46,6 +46,8 @@
|
||||||
popperClass: String
|
popperClass: String
|
||||||
},
|
},
|
||||||
|
|
||||||
|
inject: ['elFormItem'],
|
||||||
|
|
||||||
directives: { Clickoutside },
|
directives: { Clickoutside },
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -58,6 +60,14 @@
|
||||||
? `rgba(${ r }, ${ g }, ${ b }, ${ this.color.get('alpha') / 100 })`
|
? `rgba(${ r }, ${ g }, ${ b }, ${ this.color.get('alpha') / 100 })`
|
||||||
: `rgb(${ r }, ${ g }, ${ b })`;
|
: `rgb(${ r }, ${ g }, ${ b })`;
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
_elFormItemSize() {
|
||||||
|
return (this.elFormItem || {}).elFormItemSize;
|
||||||
|
},
|
||||||
|
|
||||||
|
colorSize() {
|
||||||
|
return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
:class="'el-date-editor--' + type"
|
:class="'el-date-editor--' + type"
|
||||||
:readonly="!editable || readonly"
|
:readonly="!editable || readonly"
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
:size="size"
|
:size="pickerSize"
|
||||||
:name="name"
|
:name="name"
|
||||||
v-if="!ranged"
|
v-if="!ranged"
|
||||||
v-clickoutside="handleClose"
|
v-clickoutside="handleClose"
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
class="el-date-editor el-range-editor el-input__inner"
|
class="el-date-editor el-range-editor el-input__inner"
|
||||||
:class="[
|
:class="[
|
||||||
'el-date-editor--' + type,
|
'el-date-editor--' + type,
|
||||||
'el-range-editor--' + size,
|
'el-range-editor--' + pickerSize,
|
||||||
pickerVisible ? 'is-active' : ''
|
pickerVisible ? 'is-active' : ''
|
||||||
]"
|
]"
|
||||||
@click="handleRangeClick"
|
@click="handleRangeClick"
|
||||||
|
@ -266,6 +266,8 @@ const valueEquals = function(a, b) {
|
||||||
export default {
|
export default {
|
||||||
mixins: [Emitter, NewPopper, Focus('reference')],
|
mixins: [Emitter, NewPopper, Focus('reference')],
|
||||||
|
|
||||||
|
inject: ['elFormItem'],
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
size: String,
|
size: String,
|
||||||
format: String,
|
format: String,
|
||||||
|
@ -421,6 +423,14 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
return this.value;
|
return this.value;
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
_elFormItemSize() {
|
||||||
|
return (this.elFormItem || {}).elFormItemSize;
|
||||||
|
},
|
||||||
|
|
||||||
|
pickerSize() {
|
||||||
|
return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,12 @@
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
dropdownSize() {
|
||||||
|
return this.size || (this.$ELEMENT || {}).size;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.$on('menu-item-click', this.handleMenuItemClick);
|
this.$on('menu-item-click', this.handleMenuItemClick);
|
||||||
this.initEvent();
|
this.initEvent();
|
||||||
|
@ -114,7 +120,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
render(h) {
|
render(h) {
|
||||||
let { hide, splitButton, type, size } = this;
|
let { hide, splitButton, type, dropdownSize } = this;
|
||||||
|
|
||||||
var handleMainButtonClick = (event) => {
|
var handleMainButtonClick = (event) => {
|
||||||
this.$emit('click', event);
|
this.$emit('click', event);
|
||||||
|
@ -124,10 +130,10 @@
|
||||||
let triggerElm = !splitButton
|
let triggerElm = !splitButton
|
||||||
? this.$slots.default
|
? this.$slots.default
|
||||||
: (<el-button-group>
|
: (<el-button-group>
|
||||||
<el-button type={type} size={size} nativeOn-click={handleMainButtonClick}>
|
<el-button type={type} size={dropdownSize} nativeOn-click={handleMainButtonClick}>
|
||||||
{this.$slots.default}
|
{this.$slots.default}
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button ref="trigger" type={type} size={size} class="el-dropdown__caret-button">
|
<el-button ref="trigger" type={type} size={dropdownSize} class="el-dropdown__caret-button">
|
||||||
<i class="el-dropdown__icon el-icon-caret-bottom"></i>
|
<i class="el-dropdown__icon el-icon-caret-bottom"></i>
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-button-group>);
|
</el-button-group>);
|
||||||
|
|
|
@ -86,7 +86,8 @@
|
||||||
showMessage: {
|
showMessage: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
}
|
},
|
||||||
|
size: String
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
error(value) {
|
error(value) {
|
||||||
|
@ -158,6 +159,12 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return isRequired;
|
return isRequired;
|
||||||
|
},
|
||||||
|
_formSize() {
|
||||||
|
return this.elForm.size;
|
||||||
|
},
|
||||||
|
elFormItemSize() {
|
||||||
|
return this.size || this._formSize;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
|
|
@ -33,7 +33,8 @@
|
||||||
showMessage: {
|
showMessage: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
}
|
},
|
||||||
|
size: String
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
rules() {
|
rules() {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="el-input-number"
|
<div class="el-input-number"
|
||||||
:class="[
|
:class="[
|
||||||
size ? 'el-input-number--' + size : '',
|
inputNumberSize ? 'el-input-number--' + inputNumberSize : '',
|
||||||
{ 'is-disabled': disabled },
|
{ 'is-disabled': disabled },
|
||||||
{ 'is-without-controls': !controls },
|
{ 'is-without-controls': !controls },
|
||||||
{ 'is-controls-right': controlsAtRight }
|
{ 'is-controls-right': controlsAtRight }
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
@focus="handleFocus"
|
@focus="handleFocus"
|
||||||
@input="debounceHandleInput"
|
@input="debounceHandleInput"
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
:size="size"
|
:size="inputNumberSize"
|
||||||
:max="max"
|
:max="max"
|
||||||
:min="min"
|
:min="min"
|
||||||
:name="name"
|
:name="name"
|
||||||
|
@ -60,6 +60,7 @@
|
||||||
export default {
|
export default {
|
||||||
name: 'ElInputNumber',
|
name: 'ElInputNumber',
|
||||||
mixins: [Focus('input')],
|
mixins: [Focus('input')],
|
||||||
|
inject: ['elFormItem'],
|
||||||
directives: {
|
directives: {
|
||||||
repeatClick: RepeatClick
|
repeatClick: RepeatClick
|
||||||
},
|
},
|
||||||
|
@ -130,6 +131,12 @@
|
||||||
},
|
},
|
||||||
controlsAtRight() {
|
controlsAtRight() {
|
||||||
return this.controlsPosition === 'right';
|
return this.controlsPosition === 'right';
|
||||||
|
},
|
||||||
|
_elFormItemSize() {
|
||||||
|
return (this.elFormItem || {}).elFormItemSize;
|
||||||
|
},
|
||||||
|
inputNumberSize() {
|
||||||
|
return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div :class="[
|
<div :class="[
|
||||||
type === 'textarea' ? 'el-textarea' : 'el-input',
|
type === 'textarea' ? 'el-textarea' : 'el-input',
|
||||||
size ? 'el-input--' + size : '',
|
inputSize ? 'el-input--' + inputSize : '',
|
||||||
{
|
{
|
||||||
'is-disabled': disabled,
|
'is-disabled': disabled,
|
||||||
'el-input-group': $slots.prepend || $slots.append,
|
'el-input-group': $slots.prepend || $slots.append,
|
||||||
|
@ -139,6 +139,9 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
|
_elFormItemSize() {
|
||||||
|
return (this.elFormItem || {}).elFormItemSize;
|
||||||
|
},
|
||||||
validateState() {
|
validateState() {
|
||||||
return this.elFormItem ? this.elFormItem.validateState : '';
|
return this.elFormItem ? this.elFormItem.validateState : '';
|
||||||
},
|
},
|
||||||
|
@ -152,6 +155,9 @@
|
||||||
textareaStyle() {
|
textareaStyle() {
|
||||||
return merge({}, this.textareaCalcStyle, { resize: this.resize });
|
return merge({}, this.textareaCalcStyle, { resize: this.resize });
|
||||||
},
|
},
|
||||||
|
inputSize() {
|
||||||
|
return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
|
||||||
|
},
|
||||||
isGroup() {
|
isGroup() {
|
||||||
return this.$slots.prepend || this.$slots.append;
|
return this.$slots.prepend || this.$slots.append;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,11 +36,14 @@
|
||||||
|
|
||||||
mixins: [Emitter],
|
mixins: [Emitter],
|
||||||
|
|
||||||
|
inject: ['elFormItem'],
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
label: {},
|
label: {},
|
||||||
disabled: Boolean,
|
disabled: Boolean,
|
||||||
name: String
|
name: String
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
value: {
|
value: {
|
||||||
get() {
|
get() {
|
||||||
|
@ -69,8 +72,11 @@
|
||||||
color: this._radioGroup.textColor || ''
|
color: this._radioGroup.textColor || ''
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
_elFormItemSize() {
|
||||||
|
return (this.elFormItem || {}).elFormItemSize;
|
||||||
|
},
|
||||||
size() {
|
size() {
|
||||||
return this._radioGroup.size;
|
return this._radioGroup.radioGroupSize || this._elFormItemSize || (this.$ELEMENT || {}).size;
|
||||||
},
|
},
|
||||||
isDisabled() {
|
isDisabled() {
|
||||||
return this.disabled || this._radioGroup.disabled;
|
return this.disabled || this._radioGroup.disabled;
|
||||||
|
|
|
@ -21,6 +21,8 @@
|
||||||
|
|
||||||
componentName: 'ElRadioGroup',
|
componentName: 'ElRadioGroup',
|
||||||
|
|
||||||
|
inject: ['elFormItem'],
|
||||||
|
|
||||||
mixins: [Emitter],
|
mixins: [Emitter],
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
|
@ -30,6 +32,16 @@
|
||||||
textColor: String,
|
textColor: String,
|
||||||
disabled: Boolean
|
disabled: Boolean
|
||||||
},
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
_elFormItemSize() {
|
||||||
|
return (this.elFormItem || {}).elFormItemSize;
|
||||||
|
},
|
||||||
|
radioGroupSize() {
|
||||||
|
return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
this.$on('handleChange', value => {
|
this.$on('handleChange', value => {
|
||||||
this.$emit('change', value);
|
this.$emit('change', value);
|
||||||
|
|
|
@ -48,6 +48,8 @@
|
||||||
|
|
||||||
mixins: [Emitter],
|
mixins: [Emitter],
|
||||||
|
|
||||||
|
inject: ['elFormItem'],
|
||||||
|
|
||||||
componentName: 'ElRadio',
|
componentName: 'ElRadio',
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
|
@ -89,10 +91,14 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
_elFormItemSize() {
|
||||||
|
return (this.elFormItem || {}).elFormItemSize;
|
||||||
|
},
|
||||||
radioSize() {
|
radioSize() {
|
||||||
|
const temRadioSize = this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
|
||||||
return this.isGroup
|
return this.isGroup
|
||||||
? this._radioGroup.size || this.size
|
? this._radioGroup.radioGroupSize || temRadioSize
|
||||||
: this.size;
|
: temRadioSize;
|
||||||
},
|
},
|
||||||
isDisabled() {
|
isDisabled() {
|
||||||
return this.isGroup
|
return this.isGroup
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
class="el-select"
|
class="el-select"
|
||||||
:class="[size ? 'el-select--' + size : '']"
|
:class="[selectSize ? 'el-select--' + selectSize : '']"
|
||||||
v-clickoutside="handleClose">
|
v-clickoutside="handleClose">
|
||||||
<div
|
<div
|
||||||
class="el-select__tags"
|
class="el-select__tags"
|
||||||
|
@ -140,6 +140,8 @@
|
||||||
|
|
||||||
componentName: 'ElSelect',
|
componentName: 'ElSelect',
|
||||||
|
|
||||||
|
inject: ['elFormItem'],
|
||||||
|
|
||||||
provide() {
|
provide() {
|
||||||
return {
|
return {
|
||||||
'select': this
|
'select': this
|
||||||
|
@ -147,6 +149,9 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
|
_elFormItemSize() {
|
||||||
|
return (this.elFormItem || {}).elFormItemSize;
|
||||||
|
},
|
||||||
iconClass() {
|
iconClass() {
|
||||||
let criteria = this.clearable &&
|
let criteria = this.clearable &&
|
||||||
!this.disabled &&
|
!this.disabled &&
|
||||||
|
@ -180,6 +185,10 @@
|
||||||
let hasExistingOption = this.options.filter(option => !option.created)
|
let hasExistingOption = this.options.filter(option => !option.created)
|
||||||
.some(option => option.currentLabel === this.query);
|
.some(option => option.currentLabel === this.query);
|
||||||
return this.filterable && this.allowCreate && this.query !== '' && !hasExistingOption;
|
return this.filterable && this.allowCreate && this.query !== '' && !hasExistingOption;
|
||||||
|
},
|
||||||
|
|
||||||
|
selectSize() {
|
||||||
|
return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
class="el-tag"
|
class="el-tag"
|
||||||
:class="[
|
:class="[
|
||||||
type ? 'el-tag--' + type : '',
|
type ? 'el-tag--' + type : '',
|
||||||
size && `el-tag--${size}`,
|
tagSize && `el-tag--${tagSize}`,
|
||||||
{'is-hit': hit}
|
{'is-hit': hit}
|
||||||
]"
|
]"
|
||||||
:style="{backgroundColor: color}">
|
:style="{backgroundColor: color}">
|
||||||
|
@ -31,6 +31,11 @@
|
||||||
handleClose(event) {
|
handleClose(event) {
|
||||||
this.$emit('close', event);
|
this.$emit('close', event);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
tagSize() {
|
||||||
|
return this.size || (this.$ELEMENT || {}).size;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
position: relative;
|
position: relative;
|
||||||
font-size: $--font-size-base;
|
font-size: $--font-size-base;
|
||||||
|
line-height: $--input-height;
|
||||||
|
|
||||||
.el-input,
|
.el-input,
|
||||||
.el-input__inner {
|
.el-input__inner {
|
||||||
|
@ -44,7 +45,6 @@
|
||||||
left: 0;
|
left: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
line-height: 40px;
|
|
||||||
padding: 0 25px 0 15px;
|
padding: 0 25px 0 15px;
|
||||||
color: $--input-color;
|
color: $--input-color;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
@ -63,26 +63,17 @@
|
||||||
|
|
||||||
@include m(medium) {
|
@include m(medium) {
|
||||||
font-size: $--input-medium-font-size;
|
font-size: $--input-medium-font-size;
|
||||||
|
line-height: #{$--input-medium-height};
|
||||||
@include e(label) {
|
|
||||||
line-height: #{$--input-medium-height };
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@include m(small) {
|
@include m(small) {
|
||||||
font-size: $--input-small-font-size;
|
font-size: $--input-small-font-size;
|
||||||
|
line-height: #{$--input-small-height};
|
||||||
@include e(label) {
|
|
||||||
line-height: #{$--input-small-height };
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@include m(mini) {
|
@include m(mini) {
|
||||||
font-size: $--input-mini-font-size;
|
font-size: $--input-mini-font-size;
|
||||||
|
line-height: #{$--input-mini-height};
|
||||||
@include e(label) {
|
|
||||||
line-height: #{$--input-mini-height};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@include when(disabled) {
|
@include when(disabled) {
|
||||||
|
|
|
@ -35,6 +35,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
|
&::before {
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
& .el-dropdown__icon {
|
& .el-dropdown__icon {
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
position: relative;
|
position: relative;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 180px;
|
width: 180px;
|
||||||
|
line-height: #{$--input-height - 2};
|
||||||
|
|
||||||
.el-input {
|
.el-input {
|
||||||
display: block;
|
display: block;
|
||||||
|
@ -23,7 +24,6 @@
|
||||||
top: 1px;
|
top: 1px;
|
||||||
width: $--input-height;
|
width: $--input-height;
|
||||||
height: auto;
|
height: auto;
|
||||||
line-height: #{$--input-height - 2};
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
background: $--background-color-base;
|
background: $--background-color-base;
|
||||||
color: $--color-text-regular;
|
color: $--color-text-regular;
|
||||||
|
@ -70,9 +70,9 @@
|
||||||
|
|
||||||
@include m(medium) {
|
@include m(medium) {
|
||||||
width: 200px;
|
width: 200px;
|
||||||
|
line-height: #{$--input-medium-height - 2};
|
||||||
|
|
||||||
@include e((increase, decrease)) {
|
@include e((increase, decrease)) {
|
||||||
line-height: #{$--input-medium-height - 2};
|
|
||||||
width: $--input-medium-height;
|
width: $--input-medium-height;
|
||||||
font-size: $--input-medium-font-size;
|
font-size: $--input-medium-font-size;
|
||||||
}
|
}
|
||||||
|
@ -85,9 +85,9 @@
|
||||||
|
|
||||||
@include m(small) {
|
@include m(small) {
|
||||||
width: 130px;
|
width: 130px;
|
||||||
|
line-height: #{$--input-small-height - 2};
|
||||||
|
|
||||||
@include e((increase, decrease)) {
|
@include e((increase, decrease)) {
|
||||||
line-height: #{$--input-small-height - 2};
|
|
||||||
width: $--input-small-height;
|
width: $--input-small-height;
|
||||||
font-size: $--input-small-font-size;
|
font-size: $--input-small-font-size;
|
||||||
|
|
||||||
|
@ -104,9 +104,9 @@
|
||||||
|
|
||||||
@include m(mini) {
|
@include m(mini) {
|
||||||
width: 130px;
|
width: 130px;
|
||||||
|
line-height: #{$--input-mini-height - 2};
|
||||||
|
|
||||||
@include e((increase, decrease)) {
|
@include e((increase, decrease)) {
|
||||||
line-height: #{$--input-mini-height - 2};
|
|
||||||
width: $--input-mini-height;
|
width: $--input-mini-height;
|
||||||
font-size: $--input-mini-font-size;
|
font-size: $--input-mini-font-size;
|
||||||
|
|
||||||
|
|
|
@ -153,6 +153,9 @@ const install = function(Vue, opts = {}) {
|
||||||
|
|
||||||
Vue.use(Loading.directive);
|
Vue.use(Loading.directive);
|
||||||
|
|
||||||
|
const ELEMENT = {};
|
||||||
|
ELEMENT.size = opts.size || '';
|
||||||
|
|
||||||
Vue.prototype.$loading = Loading.service;
|
Vue.prototype.$loading = Loading.service;
|
||||||
Vue.prototype.$msgbox = MessageBox;
|
Vue.prototype.$msgbox = MessageBox;
|
||||||
Vue.prototype.$alert = MessageBox.alert;
|
Vue.prototype.$alert = MessageBox.alert;
|
||||||
|
@ -160,6 +163,8 @@ const install = function(Vue, opts = {}) {
|
||||||
Vue.prototype.$prompt = MessageBox.prompt;
|
Vue.prototype.$prompt = MessageBox.prompt;
|
||||||
Vue.prototype.$notify = Notification;
|
Vue.prototype.$notify = Notification;
|
||||||
Vue.prototype.$message = Message;
|
Vue.prototype.$message = Message;
|
||||||
|
|
||||||
|
Vue.prototype.$ELEMENT = ELEMENT;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* istanbul ignore if */
|
/* istanbul ignore if */
|
||||||
|
|
Loading…
Reference in New Issue