diff --git a/src/_base/selection/src/Selection.vue b/src/_base/selection/src/Selection.vue index 4102c3ec6..693048bd1 100644 --- a/src/_base/selection/src/Selection.vue +++ b/src/_base/selection/src/Selection.vue @@ -44,7 +44,7 @@ :arrow="showArrow" :disabled="disabled" :active="active" - :clearable="syntheticClearable && selected" + :clearable="mergedClearable && selected" @clear="handleClear" /> @@ -100,7 +100,7 @@ :theme="theme" :disabled="disabled" :active="active" - :clearable="syntheticClearable && selected" + :clearable="mergedClearable && selected" :loading="loading" @clear="handleClear" /> @@ -145,7 +145,7 @@ :arrow="showArrow" :disabled="disabled" :active="active" - :clearable="syntheticClearable && selected" + :clearable="mergedClearable && selected" @clear="handleClear" /> @@ -176,7 +176,7 @@ :arrow="showArrow" :disabled="disabled" :active="active" - :clearable="syntheticClearable && selected" + :clearable="mergedClearable && selected" :loading="loading" @clear="handleClear" /> @@ -304,11 +304,11 @@ export default { } }, computed: { - syntheticClearable () { + mergedClearable () { return this.clearable && !this.disabled }, showArrow () { - if (!this.syntheticClearable) return true + if (!this.mergedClearable) return true else return !(this.hover && this.selected) }, filterablePlaceholder () { diff --git a/src/affix/src/Affix.vue b/src/affix/src/Affix.vue index 9195871d8..3e5510620 100644 --- a/src/affix/src/Affix.vue +++ b/src/affix/src/Affix.vue @@ -75,25 +75,25 @@ export default { affixed () { return this.stickToBottom || this.stickToTop }, - syntheticOffsetTop () { + mergedOffsetTop () { return this.offsetTop === undefined ? this.top : this.offsetTop }, - syntheticTop () { + mergedTop () { return this.top === undefined ? this.offsetTop : this.top }, - syntheticBottom () { + mergedBottom () { return this.bottom === undefined ? this.offsetBottom : this.bottom }, - syntheticOffsetBottom () { + mergedOffsetBottom () { return this.offsetBottom === undefined ? this.bottom : this.offsetBottom }, style () { const style = {} - if (this.stickToTop && this.syntheticOffsetTop !== undefined) { - style.top = `${this.syntheticTop}px` + if (this.stickToTop && this.mergedOffsetTop !== undefined) { + style.top = `${this.mergedTop}px` } - if (this.stickToBottom && this.syntheticOffsetBottom !== undefined) { - style.bottom = `${this.syntheticBottom}px` + if (this.stickToBottom && this.mergedOffsetBottom !== undefined) { + style.bottom = `${this.mergedBottom}px` } return style } @@ -150,19 +150,19 @@ export default { const pxToTop = affixRect.top - containerRect.top const pxToBottom = containerRect.bottom - affixRect.bottom const { - syntheticOffsetTop, - syntheticOffsetBottom + mergedOffsetTop, + mergedOffsetBottom } = this - if (syntheticOffsetTop !== undefined && pxToTop <= syntheticOffsetTop) { + if (mergedOffsetTop !== undefined && pxToTop <= mergedOffsetTop) { this.stickToTop = true - this.topAffixedTriggerScrollTop = containerEl.scrollTop - (syntheticOffsetTop - pxToTop) + this.topAffixedTriggerScrollTop = containerEl.scrollTop - (mergedOffsetTop - pxToTop) } else { this.stickToTop = false this.topAffixedTriggerScrollTop = null } - if (syntheticOffsetBottom !== undefined && pxToBottom <= syntheticOffsetBottom) { + if (mergedOffsetBottom !== undefined && pxToBottom <= mergedOffsetBottom) { this.stickToBottom = true - this.bottomAffixedTriggerScrollTop = containerEl.scrollTop + syntheticOffsetBottom - pxToBottom + this.bottomAffixedTriggerScrollTop = containerEl.scrollTop + mergedOffsetBottom - pxToBottom } else { this.stickToBottom = false this.bottomAffixedTriggerScrollTop = null diff --git a/src/checkbox/src/Checkbox.vue b/src/checkbox/src/Checkbox.vue index ffc0ebb5f..77a97228f 100644 --- a/src/checkbox/src/Checkbox.vue +++ b/src/checkbox/src/Checkbox.vue @@ -153,7 +153,7 @@ export default { }, setup (props) { const NCheckboxGroup = inject('NCheckboxGroup', null) - const syntheticCheckedRef = computed(() => { + const mergedCheckedRef = computed(() => { if (NCheckboxGroup) { const groupValueSet = NCheckboxGroup.valueSet if (groupValueSet) { @@ -175,7 +175,7 @@ export default { uncontrolledCheckedRef ), mergedDisabled: mergedDisabledRef, - renderSafeChecked: useMemo(() => syntheticCheckedRef.value) + renderSafeChecked: useMemo(() => mergedCheckedRef.value) } }, methods: { diff --git a/src/collapse/src/CollapseItem.vue b/src/collapse/src/CollapseItem.vue index a39086de5..17aca9513 100644 --- a/src/collapse/src/CollapseItem.vue +++ b/src/collapse/src/CollapseItem.vue @@ -28,7 +28,7 @@ @@ -75,7 +75,7 @@ export default { useInjectionCollection('NCollapse', 'collectedItemNames', toRef(props, 'name')) }, computed: { - syntheticDisplayDirective () { + mergedDisplayDirective () { const { displayDirective, NCollapse } = this if (displayDirective) { return displayDirective diff --git a/src/data-table/src/DataTable.vue b/src/data-table/src/DataTable.vue index eec6df189..917f22064 100644 --- a/src/data-table/src/DataTable.vue +++ b/src/data-table/src/DataTable.vue @@ -45,16 +45,16 @@ > @@ -385,7 +385,7 @@ export default { return true }) : [] }, - syntheticCheckedRowKeys () { + mergedCheckedRowKeys () { if (this.checkedRowKeys !== null) return this.checkedRowKeys return this.internalCheckedRowKeys }, @@ -403,7 +403,7 @@ export default { ) return activeFilters }, - syntheticActiveSorter () { + mergedActiveSorter () { /** * If one of the columns's sort order is false or 'ascend' or 'descend', * the table's controll functionality should work in controlled manner. @@ -424,27 +424,27 @@ export default { if (columnsWithControlledSortOrder.length) return null return this.internalActiveSorter }, - syntheticPageSize () { + mergedPageSize () { return this.pagination.pageSize || this.internalPageSize }, - syntheticCurrentPage () { + mergedCurrentPage () { return this.pagination.page || this.internalCurrentPage }, - syntheticPagination () { + mergedPagination () { if (!this.pagination) return null return { ...this.pagination, /** - * writing synthetic props after pagination to avoid + * writing merged props after pagination to avoid * pagination[key] === undefined * key still exists but value is undefined */ - page: this.syntheticCurrentPage, - pageSize: this.syntheticPageSize, - pageCount: this.syntheticPageCount + page: this.mergedCurrentPage, + pageSize: this.mergedPageSize, + pageCount: this.mergedPageCount } }, - syntheticOnPageChange () { + mergedOnPageChange () { return page => { this.pagination.onChange && this.pagination.onChange(page) // eslint-disable-next-line vue/no-side-effects-in-computed-properties @@ -452,7 +452,7 @@ export default { this.doUpdatePage(page) } }, - syntheticOnPageSizeChange () { + mergedOnPageSizeChange () { return pageSize => { this.pagination.onPageSizeChange && this.pagination.onPageSizeChange(pageSize) // eslint-disable-next-line vue/no-side-effects-in-computed-properties @@ -460,18 +460,18 @@ export default { this.doUpdatePageSize(pageSize) } }, - syntheticPageCount () { + mergedPageCount () { if (this.pagination.pageCount) return this.pagination.pageCount if (this.filteredData.length === 0) return 1 const { pageSize } = this.pagination return Math.ceil(this.filteredData.length / pageSize) }, sortedData () { - const activeSorter = this.syntheticActiveSorter + const activeSorter = this.mergedActiveSorter if (activeSorter) { /** - * When async, syntheticActiveSorter.sorter should be true - * If want use default sorter, syntheticActiveSorter.sorter should be 'default' + * When async, mergedActiveSorter.sorter should be true + * If want use default sorter, mergedActiveSorter.sorter should be 'default' */ if ( activeSorter.sorter === true || @@ -508,12 +508,12 @@ export default { paginatedData () { if (!this.pagination) return this.sortedData if (!this.paging) return this.sortedData - const pageSize = this.syntheticPageSize + const pageSize = this.mergedPageSize const startIndex = (this.internalCurrentPage - 1) * pageSize return this.sortedData.slice(startIndex, startIndex + pageSize) }, countOfCurrentPageCheckedRows () { - const checkedRowKeys = this.syntheticCheckedRowKeys + const checkedRowKeys = this.mergedCheckedRowKeys const rowKey = this.rowKey return this.paginatedData.reduce((total, row) => { const key = createRowKey(row, rowKey) @@ -528,7 +528,7 @@ export default { } }, watch: { - syntheticCurrentPage () { + mergedCurrentPage () { this.scrollMainTableBodyToTop() } }, @@ -737,7 +737,7 @@ export default { this.changeFilters(filters) }, checkAll (column) { - const checkedRowKeys = Array.from(this.syntheticCheckedRowKeys) + const checkedRowKeys = Array.from(this.mergedCheckedRowKeys) const rowKey = this.rowKey this.paginatedData.forEach(row => { if (column.disabled && column.disabled(row)) { @@ -748,7 +748,7 @@ export default { this.changeCheckedRowKeys(checkedRowKeys) }, clearCheckAll (column) { - const checkedRowKeys = Array.from(this.syntheticCheckedRowKeys) + const checkedRowKeys = Array.from(this.mergedCheckedRowKeys) const rowKey = this.rowKey this.paginatedData.forEach(row => { if (column.disabled && column.disabled(row)) { diff --git a/src/data-table/src/HeaderButton/SortButton.vue b/src/data-table/src/HeaderButton/SortButton.vue index 40fc8b598..d2e01eaa3 100644 --- a/src/data-table/src/HeaderButton/SortButton.vue +++ b/src/data-table/src/HeaderButton/SortButton.vue @@ -43,7 +43,7 @@ export default { }, computed: { activeSorter () { - const activeSorter = this.NDataTable.syntheticActiveSorter + const activeSorter = this.NDataTable.mergedActiveSorter return activeSorter }, active () { diff --git a/src/data-table/src/TableParts/Body.vue b/src/data-table/src/TableParts/Body.vue index 92e976e9a..3c235d3a7 100644 --- a/src/data-table/src/TableParts/Body.vue +++ b/src/data-table/src/TableParts/Body.vue @@ -138,13 +138,13 @@ export default { return this.NDataTable.rowKey }, currentPage () { - const pagination = this.NDataTable.syntheticPagination + const pagination = this.NDataTable.mergedPagination if (!pagination) return -1 if (!pagination.page) return -1 return pagination.page }, checkedRowKeys () { - return this.NDataTable.syntheticCheckedRowKeys + return this.NDataTable.mergedCheckedRowKeys } }, methods: { diff --git a/src/data-table/src/TableParts/Header.vue b/src/data-table/src/TableParts/Header.vue index 31920927e..bd3f095a8 100644 --- a/src/data-table/src/TableParts/Header.vue +++ b/src/data-table/src/TableParts/Header.vue @@ -157,7 +157,7 @@ export default { }, computed: { pagination () { - return this.NDataTable.syntheticPagination + return this.NDataTable.mergedPagination }, currentPage () { return (this.pagination && this.pagination.page) || null @@ -197,7 +197,7 @@ export default { const filterElement = filterRef && filterRef.$el if (filterElement && filterElement.contains(e.target)) return if (!column.sorter) return - const activeSorter = this.NDataTable.syntheticActiveSorter + const activeSorter = this.NDataTable.mergedActiveSorter const nextSorter = createNextSorter(column.key, activeSorter, column.sorter) this.NDataTable.changeSorter(nextSorter) } diff --git a/src/layout/src/Layout.vue b/src/layout/src/Layout.vue index 295a00458..af9bc6eb0 100644 --- a/src/layout/src/Layout.vue +++ b/src/layout/src/Layout.vue @@ -7,7 +7,7 @@ [`n-${mergedTheme}-theme`]: mergedTheme, [`n-layout--${siderCollapseMode}-collapse-mode`]: siderCollapseMode }" - :style="syntheticLayoutStyle" + :style="mergedLayoutStyle" > @@ -137,7 +137,7 @@ export default { const lineHeight = Math.floor(this.fontSize * this.lineHeight) return `calc(${this.rows * lineHeight}px)` }, - syntheticLines () { + mergedLines () { if (!this.log) return [] return this.log.split('\n') } diff --git a/src/progress/src/Progress.vue b/src/progress/src/Progress.vue index aef752e65..6bca06cc2 100644 --- a/src/progress/src/Progress.vue +++ b/src/progress/src/Progress.vue @@ -87,7 +87,7 @@ ref="line" class="n-progress-graph-line" :class="{ - [`n-progress-graph-line--indicator-${syntheticIndicatorPlacement}`]: true + [`n-progress-graph-line--indicator-${mergedIndicatorPlacement}`]: true }" >
{{ percentage + unit }} @@ -119,7 +119,7 @@
+
{ - if (vm.syntheticIndicatorPlacement === 'inside-label') { + if (vm.mergedIndicatorPlacement === 'inside-label') { nextTick(() => { vm.indicatorPercentage = vm.calcIndicatorPercentage() nextTick(() => { @@ -392,11 +392,11 @@ export default { if (this.height !== undefined) return formatLength(this.height, { c: 0.5 }) return null }, - syntheticIndicatorPlacement () { + mergedIndicatorPlacement () { return this.indicatorPlacement || this.indicatorPosition }, fillStyleMaxWidth () { - return Math.max(this.percentage - (this.syntheticIndicatorPlacement === 'inside-label' ? 2 : 0), 0) + return Math.max(this.percentage - (this.mergedIndicatorPlacement === 'inside-label' ? 2 : 0), 0) }, strokeDasharray () { if (this.type === 'multiple-circle') { @@ -450,7 +450,7 @@ export default { }, watch: { percentage (newPercentage) { - if (this.syntheticIndicatorPlacement === 'inside-label') { + if (this.mergedIndicatorPlacement === 'inside-label') { this.$nextTick().then(() => { this.indicatorPercentage = this.calcIndicatorPercentage() }) diff --git a/src/time/src/Time.js b/src/time/src/Time.js index 25f09a662..eebe12810 100644 --- a/src/time/src/Time.js +++ b/src/time/src/Time.js @@ -41,13 +41,13 @@ export default { locale: this.dateFnsLocale } }, - syntheticTime () { + mergedTime () { if (this.unix) { return fromUnixTime(this.time) } return this.time }, - syntheticTo () { + mergedTo () { if (this.unix) { return fromUnixTime(this.to) } @@ -55,13 +55,13 @@ export default { }, renderedTime () { if (this.format) { - return format(this.syntheticTime, this.format, this.dateFnsOptions) + return format(this.mergedTime, this.format, this.dateFnsOptions) } else if (this.type === 'date') { - return format(this.syntheticTime, 'yyyy-MM-dd', this.dateFnsOptions) + return format(this.mergedTime, 'yyyy-MM-dd', this.dateFnsOptions) } else if (this.type === 'datetime') { - return format(this.syntheticTime, 'yyyy-MM-dd hh:mm:ss', this.dateFnsOptions) + return format(this.mergedTime, 'yyyy-MM-dd hh:mm:ss', this.dateFnsOptions) } else { - return formatDistance(this.syntheticTime, this.syntheticTo, { + return formatDistance(this.mergedTime, this.mergedTo, { addSuffix: true, locale: this.dateFnsLocale }) diff --git a/src/upload/src/Upload.vue b/src/upload/src/Upload.vue index b862f9d35..e8aef3c7f 100644 --- a/src/upload/src/Upload.vue +++ b/src/upload/src/Upload.vue @@ -30,7 +30,7 @@
@@ -275,7 +275,7 @@ export default { } }, computed: { - syntheticFileList () { + mergedFileList () { if (this.fileList) { return this.fileList } else { @@ -346,9 +346,9 @@ export default { const headers = this.headers const data = this.data const fieldName = this.name - const filesToUpload = fileId ? this.syntheticFileList.filter( + const filesToUpload = fileId ? this.mergedFileList.filter( file => file.id === fileId - ) : this.syntheticFileList + ) : this.mergedFileList filesToUpload.forEach(file => { if (file.status === 'pending') { const formData = new FormData() @@ -376,7 +376,7 @@ export default { append, remove } = options - const fileListAfterChange = this.syntheticFileList + const fileListAfterChange = this.mergedFileList const fileIndex = fileListAfterChange.findIndex(file => file.id === fileAfterChange.id) if (append || remove || ~fileIndex) { if (append) { diff --git a/src/upload/src/UploadFile.vue b/src/upload/src/UploadFile.vue index 07d3f4560..6ffbd779e 100644 --- a/src/upload/src/UploadFile.vue +++ b/src/upload/src/UploadFile.vue @@ -145,7 +145,7 @@ export default { Promise.resolve( NUpload.onRemove({ file: Object.assign({}, file), - fileList: NUpload.syntheticFileList + fileList: NUpload.mergedFileList }) ).then( result => {