UNPKG

@progress/kendo-base-components-vue-wrapper

Version:
60 lines (52 loc) 2.34 kB
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = { methods: { resolveInnerTags(tagName) { var items = []; const defaultSlot = this.v3 && this.$slots.default && typeof this.$slots.default === 'function' ? this.$slots.default() : this.$slots.default; for (const childSlot of defaultSlot) { if (childSlot.tag && childSlot.tag.indexOf(tagName) !== -1 || childSlot.type && childSlot.type.name && childSlot.type.name.toLowerCase().indexOf(tagName) !== -1) { var childOptions = childSlot.componentOptions; var childInstance = this.v3 ? childSlot : childSlot.componentInstance; const item = this.v3 ? childInstance.$props || childInstance.props : childOptions.propsData; if (this.v3) { const itemKeys = Object.keys(item); for (const propKey of itemKeys) { if (propKey.indexOf('-') !== -1) { item[this.camelize(propKey)] = item[propKey]; } } } if (!item.items) { item.items = childInstance.subitems; } items.push(item); this.handleWatcher(childInstance); } } return items; }, handleWatcher(childInstance) { var that = this; if (!childInstance._isWatchAttached && childInstance.$watch) { childInstance.$watch('$props', () => { if (that.updateWidget) { that.updateWidget(); } else if (that._resolveInnerChildren) { that._resolveInnerChildren(); } }, { deep: true }); childInstance._isWatchAttached = true; } }, camelize(str) { const arr = str.split('-'); const capital = arr.map((item, index) => index ? item.charAt(0).toUpperCase() + item.slice(1).toLowerCase() : item); const capitalString = capital.join(''); return capitalString; } } };