Merge pull request #21 from iview/2.0

更新
This commit is contained in:
yangdan8 2018-12-20 22:00:17 +08:00 committed by GitHub
commit ba307d7961
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 904 additions and 857 deletions

View file

@ -3,6 +3,7 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>iView test page</title> <title>iView test page</title>
<meta name="viewport" content="user-scalable=no,width=device-width,initial-scale=1"/>
<!-- <link href="/test/dist/main.css" rel="stylesheet"> --> <!-- <link href="/test/dist/main.css" rel="stylesheet"> -->
</head> </head>
<body> <body>

View file

@ -62,6 +62,13 @@
<br><br> <br><br>
<Tag v-for="item in count" :key="item" :name="item" closable @on-close="handleClose2">标签{{ item + 1 }}</Tag> <Tag v-for="item in count" :key="item" :name="item" closable @on-close="handleClose2">标签{{ item + 1 }}</Tag>
<Button icon="ios-plus-empty" type="dashed" size="small" @click="handleAdd">添加标签</Button> <Button icon="ios-plus-empty" type="dashed" size="small" @click="handleAdd">添加标签</Button>
<br><br><hr><br>
<Tag :checked="checked" checkable>test</Tag>
<Button @click="toggle">
Toggle
</Button>
<span>{{ checked }}</span>
</div> </div>
</template> </template>
<script> <script>
@ -69,7 +76,8 @@
data () { data () {
return { return {
show: true, show: true,
count: [0, 1, 2] count: [0, 1, 2],
checked: true
}; };
}, },
methods: { methods: {
@ -86,6 +94,9 @@
handleClose2 (event, name) { handleClose2 (event, name) {
const index = this.count.indexOf(name); const index = this.count.indexOf(name);
this.count.splice(index, 1); this.count.splice(index, 1);
},
toggle() {
this.checked = !this.checked;
} }
} }
}; };

View file

@ -294,8 +294,11 @@
this.$refs.input.currentValue = ''; this.$refs.input.currentValue = '';
const oldVal = JSON.stringify(this.currentValue); const oldVal = JSON.stringify(this.currentValue);
this.currentValue = item.value.split(','); this.currentValue = item.value.split(',');
this.emitValue(this.currentValue, oldVal); // use setTimeout for #4786, can not use nextTick, because @on-find-selected use nextTick
this.handleClose(); setTimeout(() => {
this.emitValue(this.currentValue, oldVal);
this.handleClose();
}, 0);
}, },
handleFocus () { handleFocus () {
this.$refs.input.focus(); this.$refs.input.focus();

View file

@ -77,10 +77,16 @@
// return value back recursion // // return value back recursion //
const backItem = this.getBaseItem(item); const backItem = this.getBaseItem(item);
if (backItem.label !== this.tmpItem.label || backItem.value !== this.tmpItem.value) { // #5021 for this.changeOnSelect if #4472
if (
this.changeOnSelect ||
(backItem.label !== this.tmpItem.label || backItem.value !== this.tmpItem.value) ||
(backItem.label === this.tmpItem.label && backItem.value === this.tmpItem.value)
) {
this.tmpItem = backItem; this.tmpItem = backItem;
this.emitUpdate([backItem]); this.emitUpdate([backItem]);
} }
if (item.children && item.children.length){ if (item.children && item.children.length){
this.sublist = item.children; this.sublist = item.children;
this.dispatch('Cascader', 'on-result-change', { this.dispatch('Cascader', 'on-result-change', {

View file

@ -55,6 +55,7 @@
if (this.timeDisabled) return; if (this.timeDisabled) return;
this.$emit('on-pick-toggle-time'); this.$emit('on-pick-toggle-time');
this.dispatch('CalendarPicker', 'focus-input'); this.dispatch('CalendarPicker', 'focus-input');
this.dispatch('CalendarPicker', 'update-popper');
}, },
handleTab(e) { handleTab(e) {
const tabbables = [...this.$el.children]; const tabbables = [...this.$el.children];

View file

@ -679,6 +679,9 @@
}, },
focus() { focus() {
this.$refs.input && this.$refs.input.focus(); this.$refs.input && this.$refs.input.focus();
},
updatePopper () {
this.$refs.drop.update();
} }
}, },
watch: { watch: {
@ -715,6 +718,7 @@
// to handle focus from confirm buttons // to handle focus from confirm buttons
this.$on('focus-input', () => this.focus()); this.$on('focus-input', () => this.focus());
this.$on('update-popper', () => this.updatePopper());
} }
}; };
</script> </script>

View file

@ -11,28 +11,32 @@
</template> </template>
<script> <script>
const prefixCls = 'ivu-scroll'; import Spin from '../spin/spin.vue';
import Icon from '../icon/icon.vue';
export default { const prefixCls = 'ivu-scroll';
props: ['text', 'active', 'spinnerHeight'],
computed: { export default {
wrapperClasses() { props: ['text', 'active', 'spinnerHeight'],
return [ components: { Spin, Icon },
`${prefixCls}-loader-wrapper`, computed: {
{ wrapperClasses() {
[`${prefixCls}-loader-wrapper-active`]: this.active return [
} `${prefixCls}-loader-wrapper`,
]; {
}, [`${prefixCls}-loader-wrapper-active`]: this.active
spinnerClasses() { }
return `${prefixCls}-spinner`; ];
}, },
iconClasses() { spinnerClasses() {
return `${prefixCls}-spinner-icon`; return `${prefixCls}-spinner`;
}, },
textClasses() { iconClasses() {
return `${prefixCls}-loader-text`; return `${prefixCls}-spinner-icon`;
},
textClasses() {
return `${prefixCls}-loader-text`;
}
} }
} };
};
</script> </script>

View file

@ -2,9 +2,7 @@
<li <li
:class="classes" :class="classes"
@click.stop="select" @click.stop="select"
@touchend.stop="select"
@mousedown.prevent @mousedown.prevent
@touchstart.prevent
><slot>{{ showLabel }}</slot></li> ><slot>{{ showLabel }}</slot></li>
</template> </template>
<script> <script>

View file

@ -137,6 +137,11 @@
this.$emit('on-change', checked, this.name); this.$emit('on-change', checked, this.name);
} }
} }
},
watch: {
checked (val) {
this.isChecked = val;
}
} }
}; };
</script> </script>

View file

@ -128,6 +128,10 @@
width: auto !important; width: auto !important;
margin: 10px; margin: 10px;
} }
.@{modal-prefix-cls}-fullscreen{
width: 100% !important;
margin: 0;
}
.vertical-center-modal { .vertical-center-modal {
.@{modal-prefix-cls} { .@{modal-prefix-cls} {
flex: 1; flex: 1;

138
types/message.d.ts vendored
View file

@ -5,80 +5,78 @@
import Vue, { VNode, CreateElement } from "vue"; import Vue, { VNode, CreateElement } from "vue";
export declare interface Message { export declare interface Message {
/** /**
* *
* @param config MessageConfig为相关配置,string为待显示的内容 * @param config MessageConfig为相关配置,string为待显示的内容
*/ */
info(config?: MessageConfig | string): void; info(config?: MessageConfig | string): void;
/** /**
* *
* @param config MessageConfig为相关配置,string为待显示的内容 * @param config MessageConfig为相关配置,string为待显示的内容
*/ */
success(config?: MessageConfig | string): void; success(config?: MessageConfig | string): void;
/** /**
* *
* @param config MessageConfig为相关配置,string为待显示的内容 * @param config MessageConfig为相关配置,string为待显示的内容
*/ */
warning(config?: MessageConfig | string): void; warning(config?: MessageConfig | string): void;
/** /**
* *
* @param config MessageConfig为相关配置,string为待显示的内容 * @param config MessageConfig为相关配置,string为待显示的内容
*/ */
error(config?: MessageConfig | string): void; error(config?: MessageConfig | string): void;
/** /**
* *
* @param config MessageConfig为相关配置,string为待显示的内容 * @param config MessageConfig为相关配置,string为待显示的内容
*/ */
loading(options?: MessageConfig | string): void; loading(options?: MessageConfig | string): void;
/** /**
* *
* @param config MessageConfig为相关配置,string为待显示的内容 * @param config MessageConfig为相关配置,string为待显示的内容
*/ */
config(options?: MessageConfig): void; config(options?: MessageConfig): void;
/** /**
* *
*/ */
destroy(): void; destroy(): void;
} }
export declare interface MessageConfig { export declare interface MessageConfig {
/**
*
*/
content?: string;
/**
* 使 Vue Render
*/
render?: (h: CreateElement) => VNode;
/**
*
*/
onClose?: () => void;
/**
*
* @default false
*/
closable?: boolean;
/**
*
* @default 24
*/
top?: number;
/**
*
* @default 1.5
*/
duration?: number;
}
declare module 'vue/types/vue' {
interface Vue {
/** /**
* *
*/ */
$Message: Message; content?: string;
} /**
* 使 Vue Render
* @param h Render函数
*/
render?: (h?: CreateElement) => VNode;
/**
*
*/
onClose?: () => void;
/**
*
* @default false
*/
closable?: boolean;
/**
*
* @default 24
*/
top?: number;
/**
*
* @default 1.5
*/
duration?: number;
} }
declare module "vue/types/vue" {
interface Vue {
/**
*
*/
$Message: Message;
}
}

401
types/modal.d.ts vendored
View file

@ -2,222 +2,223 @@
// Project: https://github.com/iview/iview // Project: https://github.com/iview/iview
// Definitions by: yangdan // Definitions by: yangdan
// Definitions: https://github.com/yangdan8/iview.git // Definitions: https://github.com/yangdan8/iview.git
import Vue, { VNode } from 'vue'; import Vue, { VNode, CreateElement } from "vue";
export declare interface Modal { export declare interface Modal {
/**
* 使 v-model
* @default false
*/
value?: boolean;
/**
* 使 slot title
*/
title?: string;
/**
* Esc ,
* @default true
*/
closable?: boolean;
/**
*
* @default true
*/
'mask-closable'?: boolean;
/**
* loading visible来关闭对话框,
* @default false
*/
loading?: boolean;
/**
*
* @default false
*/
scrollable?: boolean;
/**
*
* @default false
*/
fullscreen?: boolean;
/**
*
* @default false
*/
draggable?: boolean;
/**
* draggable
* @default true
*/
mask?: boolean;
/**
*
* @default
*/
'ok-text'?: string;
/**
*
* @default
*/
'cancel-text'?: string;
/**
* px
* 768px auto,
* @default 520
*/
width?: number | string;
/**
*
* @default false
*/
'footer-hide'?: boolean;
/**
* .ivu-modal的样式
*/
style?: object;
/**
* .ivu-modal-wrap的类名
*/
'class-name'?: string;
/**
*
* @default 1000
*/
'z-index'?: number;
/**
* ,
* @default ['ease', 'fade']
*/
'transition-names'?: Array<string>;
/**
* body true
* @default true
*/
transfer?: boolean;
/**
*
*/
$emit(eventName: 'on-ok'): this;
/**
*
*/
$emit(eventName: 'on-cancel'): this;
/**
*
*/
$emit(eventName: 'on-visible-change', visible: boolean): this;
/**
* slot插槽对象
*/
$slots: {
/** /**
* * 使 v-model
* @default false
*/ */
'': VNode[]; value?: boolean;
/** /**
* * 使 slot title
*/ */
header: VNode[]; title?: string;
/** /**
* * Esc ,
* @default true
*/ */
footer: VNode[]; closable?: boolean;
/** /**
* *
* @default true
*/ */
close: VNode[]; "mask-closable"?: boolean;
}; /**
* loading visible来关闭对话框,
* @default false
*/
loading?: boolean;
/**
*
* @default false
*/
scrollable?: boolean;
/**
*
* @default false
*/
fullscreen?: boolean;
/**
*
* @default false
*/
draggable?: boolean;
/**
* draggable
* @default true
*/
mask?: boolean;
/**
*
* @default
*/
"ok-text"?: string;
/**
*
* @default
*/
"cancel-text"?: string;
/**
* px
* 768px auto,
* @default 520
*/
width?: number | string;
/**
*
* @default false
*/
"footer-hide"?: boolean;
/**
* .ivu-modal的样式
*/
style?: object;
/**
* .ivu-modal-wrap的类名
*/
"class-name"?: string;
/**
*
* @default 1000
*/
"z-index"?: number;
/**
* ,
* @default ['ease', 'fade']
*/
"transition-names"?: Array<string>;
/**
* body true
* @default true
*/
transfer?: boolean;
/**
*
*/
$emit(eventName: "on-ok"): this;
/**
*
*/
$emit(eventName: "on-cancel"): this;
/**
*
*/
$emit(eventName: "on-visible-change", visible: boolean): this;
/**
* slot插槽对象
*/
$slots: {
/**
*
*/
"": VNode[];
/**
*
*/
header: VNode[];
/**
*
*/
footer: VNode[];
/**
*
*/
close: VNode[];
};
} }
export declare interface ModalInstance { export declare interface ModalInstance {
/** /**
* *
* @param config ModalConfig为相关配置,string为待显示的内容 * @param config ModalConfig为相关配置,string为待显示的内容
*/ */
info(config?: ModalConfig | string): void; info(config?: ModalConfig | string): void;
/** /**
* *
* @param config ModalConfig为相关配置,string为待显示的内容 * @param config ModalConfig为相关配置,string为待显示的内容
*/ */
success(config?: ModalConfig | string): void; success(config?: ModalConfig | string): void;
/** /**
* *
* @param config ModalConfig为相关配置,string为待显示的内容 * @param config ModalConfig为相关配置,string为待显示的内容
*/ */
warning(config?: ModalConfig | string): void; warning(config?: ModalConfig | string): void;
/** /**
* *
* @param config ModalConfig为相关配置,string为待显示的内容 * @param config ModalConfig为相关配置,string为待显示的内容
*/ */
error(config?: ModalConfig | string): void; error(config?: ModalConfig | string): void;
/** /**
* *
* @param config ModalConfig为相关配置,string为待显示的内容 * @param config ModalConfig为相关配置,string为待显示的内容
*/ */
confirm(config?: ModalConfig | string): void; confirm(config?: ModalConfig | string): void;
/** /**
* *
*/ */
remove(): void; remove(): void;
} }
export declare interface ModalConfig { export declare interface ModalConfig {
/** /**
* Element选择器字符串 * Element选择器字符串
*/ */
title?: string; title?: string;
/** /**
* Element选择器字符串 * Element选择器字符串
*/ */
content?: string; content?: string;
/** /**
* 使 content * 使 content
*/ * @param h Render函数
render?: (h?) => void; */
/** render?: (h?: CreateElement) => void;
* px /**
* @default 416 * px
*/ * @default 416
width?: number | string; */
/** width?: number | string;
* /**
* @default *
*/ * @default
okText?: string; */
/** okText?: string;
* Modal.confirm() /**
* @default * Modal.confirm()
*/ * @default
cancelText?: string; */
/** cancelText?: string;
* loading Modal.remove() /**
* @default false * loading Modal.remove()
*/ * @default false
loading?: boolean; */
/** loading?: boolean;
* /**
* @default false *
*/ * @default false
scrollable?: boolean; */
/** scrollable?: boolean;
* /**
* @default false *
*/ * @default false
closable?: boolean; */
/** closable?: boolean;
* /**
*/ *
onOk?: () => void; */
/** onOk?: () => void;
* Modal.confirm() /**
*/ * Modal.confirm()
onCancel?: () => void; */
onCancel?: () => void;
} }
declare module 'vue/types/vue' { declare module "vue/types/vue" {
interface Vue { interface Vue {
/** /**
* *
*/ */
$Modal: ModalInstance; $Modal: ModalInstance;
} }
} }

155
types/notice.d.ts vendored
View file

@ -5,88 +5,89 @@
import Vue, { VNode, CreateElement } from "vue"; import Vue, { VNode, CreateElement } from "vue";
export declare interface Notice { export declare interface Notice {
/** /**
* *
* @param config NoticeConfig为相关配置,string为待显示的内容 * @param config NoticeConfig为相关配置,string为待显示的内容
*/ */
open(config?: NoticeConfig | string): void; open(config?: NoticeConfig | string): void;
/** /**
* *
* @param config NoticeConfig为相关配置,string为待显示的内容 * @param config NoticeConfig为相关配置,string为待显示的内容
*/ */
info(config?: NoticeConfig | string): void; info(config?: NoticeConfig | string): void;
/** /**
* *
* @param config NoticeConfig为相关配置,string为待显示的内容 * @param config NoticeConfig为相关配置,string为待显示的内容
*/ */
success(config?: NoticeConfig | string): void; success(config?: NoticeConfig | string): void;
/** /**
* *
* @param config NoticeConfig为相关配置,string为待显示的内容 * @param config NoticeConfig为相关配置,string为待显示的内容
*/ */
warning(config?: NoticeConfig | string): void; warning(config?: NoticeConfig | string): void;
/** /**
* *
* @param config NoticeConfig为相关配置,string为待显示的内容 * @param config NoticeConfig为相关配置,string为待显示的内容
*/ */
error(config?: NoticeConfig): void; error(config?: NoticeConfig): void;
/** /**
* *
*/ */
config(options?: NoticeGlobalConfig): void; config(options?: NoticeGlobalConfig): void;
/** /**
* *
*/ */
close(name?: string): void; close(name?: string): void;
/** /**
* *
*/ */
destroy(): void; destroy(): void;
} }
export declare interface NoticeConfig { export declare interface NoticeConfig {
/** /**
* *
*/ */
title?: string; title?: string;
/** /**
* *
*/ */
desc?: string; desc?: string;
/** /**
* 使 Vue Render * 使 Vue Render
*/ * @param h Render函数
render?: (h: CreateElement) => VNode; */
/** render?: (h?: CreateElement) => VNode;
* 0 4.5 /**
*/ * 0 4.5
duration?: number; */
/** duration?: number;
* /**
*/ *
name?: string; */
/** name?: string;
* /**
*/ *
onClose?: Function; */
onClose?: Function;
} }
export declare interface NoticeGlobalConfig { export declare interface NoticeGlobalConfig {
/** /**
* 24 * 24
*/ */
top?: number; top?: number;
/** /**
* 4.5 * 4.5
*/ */
duration?: number; duration?: number;
} }
declare module 'vue/types/vue' { declare module "vue/types/vue" {
interface Vue { interface Vue {
/** /**
* *
*/ */
$Notice: Notice; $Notice: Notice;
} }
} }

785
types/table.d.ts vendored
View file

@ -2,418 +2,427 @@
// Project: https://github.com/iview/iview // Project: https://github.com/iview/iview
// Definitions by: yangdan // Definitions by: yangdan
// Definitions: https://github.com/yangdan8/iview.git // Definitions: https://github.com/yangdan8/iview.git
import Vue, { VNode } from 'vue'; import Vue, { VNode, CreateElement } from "vue";
export declare interface Table extends Vue { export declare interface Table extends Vue {
/**
* cellClassName
* 使
* @default []
*/
data?: object[];
/**
*
* @default []
*/
columns?: object[];
/**
*
* @default false
*/
stripe?: boolean;
/**
*
* @default false
*/
border?: boolean;
/**
*
* @default true
*/
'show-header'?: boolean;
/**
* px
* @default
*/
width?: number | string;
/**
* px
*/
height?: number | string;
/**
*
* @default false
*/
loading?: boolean;
/**
*
* @default false
*/
'disabled-hover'?: boolean;
/**
*
* @default false
*/
'highlight-row'?: boolean;
/**
* className
* row
* index
*/
'row-class-name'?: (row?: object, index?: number) => void;
/**
* largesmalldefault
*/
size?: string;
/**
*
* @default
*/
'no-data-text'?: string;
/**
*
* @default
*/
'no-filtered-data-text'?: string;
/**
* highlight-row
* currentRow
* oldCurrentRow
*/
$emit(eventName: 'on-current-change', currentRow: object, oldCurrentRow: object): this;
/**
*
* selection
* row
*/
$emit(eventName: 'on-select', selection: object[], row: object): this;
/**
*
* selection
* row
*/
$emit(eventName: 'on-select-cancel', selection: object[], row: object): this;
/**
*
* selection
*/
$emit(eventName: 'on-select-all', selection: object[]): this;
/**
*
* selection
*/
$emit(eventName: 'on-selection-change', selection: object[]): this;
/**
*
* column
* key
* order asc desc
*/
$emit(eventName: 'on-sort-change', column?: object, key?: string, order?: 'asc' | 'desc'): this;
/**
*
*/
$emit(eventName: 'on-filter-change', value: any): this;
/**
*
* currentRow
* index?: 当前行的索引
*/
$emit(eventName: 'on-row-click', currentRow: object, index: number): this;
/**
*
* currentRow
* index?: 当前行的索引
*/
$emit(eventName: 'on-row-dblclick', currentRow: object, index: number): this;
/**
*
* row
* status
*/
$emit(eventName: 'on-expand', row: object, status: string): this;
/**
*
*/
exportCsv(params: TableExportCsvParams): void;
/**
* table
*/
handleResize(): void;
/**
* highlight-row
*/
clearCurrentRow(): void;
/**
* slot插槽对象
*/
$slots: {
/** /**
* * cellClassName
* 使
* @default []
*/ */
header: VNode[]; data?: object[];
/** /**
* *
* @default []
*/ */
footer: VNode[]; columns?: object[];
/** /**
* *
* @default false
*/ */
loading: VNode[]; stripe?: boolean;
}; /**
*
* @default false
*/
border?: boolean;
/**
*
* @default true
*/
"show-header"?: boolean;
/**
* px
* @default
*/
width?: number | string;
/**
* px
*/
height?: number | string;
/**
*
* @default false
*/
loading?: boolean;
/**
*
* @default false
*/
"disabled-hover"?: boolean;
/**
*
* @default false
*/
"highlight-row"?: boolean;
/**
* className
* row
* index
*/
"row-class-name"?: (row?: object, index?: number) => void;
/**
* largesmalldefault
*/
size?: string;
/**
*
* @default
*/
"no-data-text"?: string;
/**
*
* @default
*/
"no-filtered-data-text"?: string;
/**
* highlight-row
* currentRow
* oldCurrentRow
*/
$emit(
eventName: "on-current-change",
currentRow: object,
oldCurrentRow: object
): this;
/**
*
* selection
* row
*/
$emit(eventName: "on-select", selection: object[], row: object): this;
/**
*
* selection
* row
*/
$emit(
eventName: "on-select-cancel",
selection: object[],
row: object
): this;
/**
*
* selection
*/
$emit(eventName: "on-select-all", selection: object[]): this;
/**
*
* selection
*/
$emit(eventName: "on-selection-change", selection: object[]): this;
/**
*
* column
* key
* order asc desc
*/
$emit(
eventName: "on-sort-change",
column?: object,
key?: string,
order?: "asc" | "desc"
): this;
/**
*
*/
$emit(eventName: "on-filter-change", value: any): this;
/**
*
* currentRow
* index?: 当前行的索引
*/
$emit(eventName: "on-row-click", currentRow: object, index: number): this;
/**
*
* currentRow
* index?: 当前行的索引
*/
$emit(
eventName: "on-row-dblclick",
currentRow: object,
index: number
): this;
/**
*
* row
* status
*/
$emit(eventName: "on-expand", row: object, status: string): this;
/**
*
*/
exportCsv(params: TableExportCsvParams): void;
/**
* table
*/
handleResize(): void;
/**
* highlight-row
*/
clearCurrentRow(): void;
/**
* slot插槽对象
*/
$slots: {
/**
*
*/
header: VNode[];
/**
*
*/
footer: VNode[];
/**
*
*/
loading: VNode[];
};
} }
export declare interface TableColumn { export declare interface TableColumn {
/** /**
* indexselectionexpandhtml * indexselectionexpandhtml
*/ */
type?: 'index' | 'selection' | 'expand' | 'html'; type?: "index" | "selection" | "expand" | "html";
/** /**
* *
* @default # * @default #
*/ */
title?: string; title?: string;
/** /**
* *
*/ */
key?: string; key?: string;
/** /**
* *
*/ */
width?: number; width?: number;
/** /**
* *
*/ */
minWidth?: number; minWidth?: number;
/** /**
* *
*/ */
maxWidth?: number; maxWidth?: number;
/** /**
* left right center , left * left right center , left
* @default left * @default left
*/ */
align?: 'left' | 'right' | 'center'; align?: "left" | "right" | "center";
/** /**
* *
*/ */
className?: string; className?: string;
/** /**
* left right * left right
*/ */
fixed?: 'left' | 'right'; fixed?: "left" | "right";
/** /**
* *
* @default false * @default false
*/ */
ellipsis?: boolean; ellipsis?: boolean;
/** /**
* Tooltip * Tooltip
* @default false * @default false
*/ */
tooltip?: boolean; tooltip?: boolean;
/** /**
* 使 Vue Render * 使 Vue Render
* h rowcolumn index * h rowcolumn index
* *
* Render rc.18 render * Render rc.18 render
*/ * @param h Render函数
render?: (h?: * @param params rowcolumn index
( */
el?: string | object | Function, render?: (
data?: string | TableRenderCreateElementData | TableRenderCreateElementResult | Array<TableRenderCreateElementResult>, h?: CreateElement,
vnode?: string | TableRenderCreateElementResult[] params?: TableColumnRenderParams
) => TableRenderCreateElementResult, ) => TableRenderCreateElementResult;
params?: TableColumnRenderParams /**
) => TableRenderCreateElementResult; * column index
/** * @param h Render函数
* column index * @param params rowcolumn index
*/ */
renderHeader?: (h?: renderHeader?: (
( h?: CreateElement,
el?: string | object | Function, params?: TableColumnRenderHeadParams
data?: string | TableRenderCreateElementData | TableRenderCreateElementResult | Array<TableRenderCreateElementResult>, ) => TableRenderCreateElementResult;
vnode?: string | TableRenderCreateElementResult[] /**
) => TableRenderCreateElementResult, * custom
params?: TableColumnRenderHeadParams * Table on- sort - change ,false
) => TableRenderCreateElementResult; * @default false
/** */
* custom sortable?: boolean | "custom";
* Table on- sort - change ,false /**
* @default false * 使 a b type
*/ * sortable?: true type asc desc
sortable?: boolean | 'custom'; */
/** sortMethod?: (a: any, b: any, type: "asc" | "desc") => void;
* 使 a b type /**
* sortable?: true type asc desc * asc desc
*/ */
sortMethod?: (a: any, b: any, type: 'asc' | 'desc') => void; sortType?: "asc" | "desc";
/** /**
* asc desc * label value 使filterMethod
*/ */
sortType?: 'asc' | 'desc'; filters?: { label: string; value: string | number | boolean }[];
/** /**
* label value 使filterMethod * 使 true
*/ */
filters?: { label: string, value: string | number | boolean }[]; filterMethod?: () => void;
/** /**
* 使 true *
*/ * @default true
filterMethod?: () => void; */
/** filterMultiple?: boolean;
* /**
* @default true * 使 value
*/ */
filterMultiple?: boolean; filteredValue?: (string | number | boolean)[];
/** /**
* 使 value * 使
*/ */
filteredValue?: (string | number | boolean)[]; filterRemote?: () => void;
/** /**
* 使 *
*/ */
filterRemote?: () => void; children?: object[];
/**
*
*/
children?: object[];
} }
export declare interface TableRenderCreateElementData { export declare interface TableRenderCreateElementData {
/** /**
* `v-bind:class` API * `v-bind:class` API
*/ */
'class'?: object; class?: object;
/** /**
* `v-bind:style` API * `v-bind:style` API
*/ */
style?: object; style?: object;
/** /**
* HTML * HTML
*/ */
attrs?: object, attrs?: object;
/** /**
* props * props
*/ */
props?: object; props?: object;
/** /**
* DOM * DOM
*/ */
domProps?: object; domProps?: object;
/** /**
* "on" * "on"
* v-on?:keyup.enter * v-on?:keyup.enter
* keyCode * keyCode
*/ */
on?: object; on?: object;
/** /**
* 使 vm.$emit * 使 vm.$emit
*/ */
nativeOn?: object; nativeOn?: object;
/** /**
* . * .
* Vue * Vue
*/ */
directives?: object[]; directives?: object[];
/** /**
* slot * slot
*/ */
slot?: string; slot?: string;
/** /**
* ,myKey * ,myKey
*/ */
key?: string; key?: string;
/** /**
* myRef * myRef
*/ */
ref?: string ref?: string;
} }
export declare interface TableColumnRenderParams { export declare interface TableColumnRenderParams {
/** /**
* *
*/ */
row?: object; row?: object;
/** /**
* *
*/ */
column?: object; column?: object;
/** /**
* *
*/ */
index?: number; index?: number;
} }
export declare interface TableRenderCreateElementResult { export declare interface TableRenderCreateElementResult {
child?: object; child?: object;
children?: Array<any>; children?: Array<any>;
componentInstance?: object; componentInstance?: object;
componentOptions?: object; componentOptions?: object;
context?: object; context?: object;
data?: object; data?: object;
elm?: object; elm?: object;
functionalContext?: object; functionalContext?: object;
isCloned?: boolean; isCloned?: boolean;
isComment?: boolean; isComment?: boolean;
isOnce?: boolean; isOnce?: boolean;
isRootInsert?: boolean; isRootInsert?: boolean;
isStatic?: boolean; isStatic?: boolean;
key?: object; key?: object;
ns?: object; ns?: object;
parent?: object; parent?: object;
raw?: boolean; raw?: boolean;
tag?: string; tag?: string;
text?: object; text?: object;
} }
export declare interface TableColumnRenderHeadParams { export declare interface TableColumnRenderHeadParams {
/** /**
* *
*/ */
column?: object; column?: object;
/** /**
* *
*/ */
index?: number; index?: number;
} }
export declare interface TableExportCsvParams { export declare interface TableExportCsvParams {
/** /**
* table.csv * table.csv
*/ */
filename?: string; filename?: string;
/** /**
* true * true
*/ */
original?: boolean; original?: boolean;
/** /**
* false * false
*/ */
noHeader?: boolean; noHeader?: boolean;
/** /**
* *
*/ */
columns?: any[]; columns?: any[];
/** /**
* *
*/ */
data?: any[]; data?: any[];
/** /**
* *
*/ */
callback?: () => void; callback?: () => void;
/** /**
* (,) * (,)
* @default , * @default ,
*/ */
separator?: string; separator?: string;
/** /**
* *
* @default false * @default false
*/ */
quoted?: boolean; quoted?: boolean;
} }

189
types/tree.d.ts vendored
View file

@ -2,102 +2,103 @@
// Project: https://github.com/iview/iview // Project: https://github.com/iview/iview
// Definitions by: yangdan // Definitions by: yangdan
// Definitions: https://github.com/yangdan8/iview.git // Definitions: https://github.com/yangdan8/iview.git
import Vue, { VNode } from 'vue'; import Vue, { VNode, CreateElement } from "vue";
export declare interface Tree extends Vue { export declare interface Tree extends Vue {
/** /**
* tree * tree
*/ */
data?: TreeChild[]; data?: TreeChild[];
/** /**
* *
* @default false * @default false
*/ */
multiple?: boolean; multiple?: boolean;
/** /**
* *
* @default false * @default false
*/ */
'show-checkbox'?: boolean; "show-checkbox"?: boolean;
/** /**
* *
* @default * @default
*/ */
'empty-text'?: string; "empty-text"?: string;
/** /**
* *
*/ */
'load-data'?: () => void; "load-data"?: () => void;
/** /**
* *
*/ * @param h Render函数
render?: () => void; */
/** render?: (h?: CreateElement) => void;
* /**
* @default children *
*/ * @default children
'children-key'?:string; */
/** "children-key"?: string;
* /**
* @default *
*/ * @default
$emit(eventName: 'on-select-change', value: TreeChild[]): this; */
/** $emit(eventName: "on-select-change", value: TreeChild[]): this;
* /**
* @default *
*/ * @default
$emit(eventName: 'on-check-change', value: TreeChild[]): this; */
/** $emit(eventName: "on-check-change", value: TreeChild[]): this;
* /**
* @default *
*/ * @default
$emit(eventName: 'on-toggle-expand', value: TreeChild): this; */
/** $emit(eventName: "on-toggle-expand", value: TreeChild): this;
* /**
*/ *
getCheckedNodes(): void; */
/** getCheckedNodes(): void;
* /**
*/ *
getSelectedNodes(): void; */
getSelectedNodes(): void;
} }
export declare interface TreeChild extends Vue { export declare interface TreeChild extends Vue {
/** /**
* *
*/ */
title?: string; title?: string;
/** /**
* *
* @default false * @default false
*/ */
expand?: boolean; expand?: boolean;
/** /**
* *
* @default false * @default false
*/ */
disabled?: boolean; disabled?: boolean;
/** /**
* checkbox * checkbox
* @default false * @default false
*/ */
disableCheckbox?: boolean; disableCheckbox?: boolean;
/** /**
* *
* @default false * @default false
*/ */
selected?: boolean; selected?: boolean;
/** /**
* () * ()
* @default false * @default false
*/ */
checked?: boolean; checked?: boolean;
/** /**
* *
*/ */
children?: TreeChild[]; children?: TreeChild[];
/** /**
* *
*/ */
render(): void; render(): void;
} }