insertChild(child, index, batch) { if (!child) throw new Error('insertChild error: child is required.'); if (!(child instanceof Node)) { if (!batch) { const children = this.getChildren(true); if (children.indexOf(child.data) === -1) { if (typeof index === 'undefined' || index < 0) { children.push(child.data); } else { children.splice(index, 0, child.data); } } } objectAssign(child, { parent: this, store: this.store }); child = new Node(child); } child.level = this.level + 1; if (typeof index === 'undefined' || index < 0) { this.childNodes.push(child); } else { this.childNodes.splice(index, 0, child); } this.updateLeafState(); }
const Loading = (options = {}) => { options = merge({}, defaults, options); if (typeof options.target === 'string') { options.target = document.querySelector(options.target); } options.target = options.target || document.body; if (options.target !== document.body) { options.fullscreen = false; } else { options.body = true; } let parent = options.body ? document.body : options.target; let instance = new LoadingConstructor({ el: document.createElement('div'), data: options }); addStyle(options, parent, instance.$el); if (originalPosition !== 'absolute') { parent.style.position = 'relative'; } if (options.fullscreen && options.lock) { parent.style.overflow = 'hidden'; } parent.appendChild(instance.$el); return instance; };
const MessageBox = function(options, callback) { if (Vue.prototype.$isServer) return; if (typeof options === 'string' || isVNode(options)) { options = { message: options }; if (typeof arguments[1] === 'string') { options.title = arguments[1]; } } else if (options.callback && !callback) { callback = options.callback; } if (typeof Promise !== 'undefined') { return new Promise((resolve, reject) => { // eslint-disable-line msgQueue.push({ options: merge({}, defaults, MessageBox.defaults, options), callback: callback, resolve: resolve, reject: reject }); showNextMsg(); }); } else { msgQueue.push({ options: merge({}, defaults, MessageBox.defaults, options), callback: callback }); showNextMsg(); } };
return new Promise((resolve, reject) => { // eslint-disable-line msgQueue.push({ options: merge({}, defaults, MessageBox.defaults, options), callback: callback, resolve: resolve, reject: reject }); showNextMsg(); });
MessageBox.confirm = (message, title, options) => { if (typeof title === 'object') { options = title; title = ''; } return MessageBox(merge({ title: title, message: message, $type: 'confirm', showCancelButton: true }, options)); };
MessageBox.prompt = (message, title, options) => { if (typeof title === 'object') { options = title; title = ''; } return MessageBox(merge({ title: title, message: message, showCancelButton: true, showInput: true, $type: 'prompt' }, options)); };
MessageBox.alert = (message, title, options) => { if (typeof title === 'object') { options = title; title = ''; } return MessageBox(merge({ title: title, message: message, $type: 'alert', closeOnPressEscape: false, closeOnClickModal: false }, options)); };
insertChild(child, index) { if (!child) throw new Error('insertChild error: child is required.'); if (!(child instanceof Node)) { objectAssign(child, { parent: this, store: this.store }); child = new Node(child); } child.level = this.level + 1; if (typeof index === 'undefined' || index < 0) { this.childNodes.push(child); } else { this.childNodes.splice(index, 0, child); } this.updateLeafState(); }
const getDefaultColumn = function(type, options) { const column = {}; objectAssign(column, defaults[type || 'default']); for (let name in options) { if (options.hasOwnProperty(name)) { const value = options[name]; if (typeof value !== 'undefined') { column[name] = value; } } } if (!column.minWidth) { column.minWidth = 80; } column.realWidth = column.width === undefined ? column.minWidth : column.width; return column; };
const Loading = (options = {}) => { if (Vue.prototype.$isServer) return; options = merge({}, defaults, options); if (typeof options.target === 'string') { options.target = document.querySelector(options.target); } options.target = options.target || document.body; if (options.target !== document.body) { options.fullscreen = false; } else { options.body = true; } if (options.fullscreen && fullscreenLoading) { return fullscreenLoading; } let parent = options.body ? document.body : options.target; let instance = new LoadingConstructor({ el: document.createElement('div'), data: options }); addStyle(options, parent, instance); if (instance.originalPosition !== 'absolute' && instance.originalPosition !== 'fixed') { addClass(parent, 'el-loading-parent--relative'); } if (options.fullscreen && options.lock) { addClass(parent, 'el-loading-parent--hidden'); } parent.appendChild(instance.$el); Vue.nextTick(() => { instance.visible = true; }); if (options.fullscreen) { fullscreenLoading = instance; } return instance; };
array.forEach((item) => { this.insertChild(objectAssign({ data: item }, defaultProps)); });
showOverflowTooltip: this.showOverflowTooltip || this.showTooltipWhenOverflow, formatter: this.formatter, selectable: this.selectable, reserveSelection: this.reserveSelection, fixed: this.fixed === '' ? true : this.fixed, filterMethod: this.filterMethod, filters: this.filters, filterable: this.filters || this.filterMethod, filterMultiple: this.filterMultiple, filterOpened: false, filteredValue: this.filteredValue || [], filterPlacement: this.filterPlacement || '', index: this.index }); objectAssign(column, forced[type] || {}); this.columnConfig = column; let renderCell = column.renderCell; let _self = this; if (type === 'expand') { owner.renderExpanded = function(h, data) { return _self.$scopedSlots.default ? _self.$scopedSlots.default(data) : _self.$slots.default; }; column.renderCell = function(h, data) { return <div class="cell">{ renderCell(h, data, this._renderProxy) }</div>;
this.open(); } } else { this.close(); } } }, methods: { open(options) { if (!this.rendered) { this.rendered = true; this.$emit('visible-change', true); } const props = merge({}, this.$props || this, options); if (this._closeTimer) { clearTimeout(this._closeTimer); this._closeTimer = null; } clearTimeout(this._openTimer); const openDelay = Number(props.openDelay); if (openDelay > 0) { this._openTimer = setTimeout(() => { this._openTimer = null; this.doOpen(props); }, openDelay); } else { this.doOpen(props);