mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-01-30 12:52:43 +08:00
chore: rename all synthetic
to merged
This commit is contained in:
parent
8c7c2f5dc6
commit
5a9e28a363
@ -44,7 +44,7 @@
|
||||
:arrow="showArrow"
|
||||
:disabled="disabled"
|
||||
:active="active"
|
||||
:clearable="syntheticClearable && selected"
|
||||
:clearable="mergedClearable && selected"
|
||||
@clear="handleClear"
|
||||
/>
|
||||
</div>
|
||||
@ -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"
|
||||
/>
|
||||
</div>
|
||||
@ -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 () {
|
||||
|
@ -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
|
||||
|
@ -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: {
|
||||
|
@ -28,7 +28,7 @@
|
||||
</slot>
|
||||
</div>
|
||||
<n-collapse-item-content
|
||||
:display-directive="syntheticDisplayDirective"
|
||||
:display-directive="mergedDisplayDirective"
|
||||
:show="!collapsed"
|
||||
>
|
||||
<slot />
|
||||
@ -75,7 +75,7 @@ export default {
|
||||
useInjectionCollection('NCollapse', 'collectedItemNames', toRef(props, 'name'))
|
||||
},
|
||||
computed: {
|
||||
syntheticDisplayDirective () {
|
||||
mergedDisplayDirective () {
|
||||
const { displayDirective, NCollapse } = this
|
||||
if (displayDirective) {
|
||||
return displayDirective
|
||||
|
@ -45,16 +45,16 @@
|
||||
>
|
||||
<n-pagination
|
||||
:theme="mergedTheme"
|
||||
:page="syntheticPagination.page"
|
||||
:page-count="syntheticPagination.pageCount"
|
||||
:page-size="syntheticPagination.pageSize"
|
||||
:page="mergedPagination.page"
|
||||
:page-count="mergedPagination.pageCount"
|
||||
:page-size="mergedPagination.pageSize"
|
||||
:page-slot="pagination.pageSlot"
|
||||
:page-sizes="pagination.pageSizes"
|
||||
:show-size-picker="pagination.showSizePicker"
|
||||
:show-quick-jumper="!!pagination.showQuickJumper"
|
||||
:disabled="!!pagination.disabled"
|
||||
:on-change="syntheticOnPageChange"
|
||||
:on-page-size-change="syntheticOnPageSizeChange"
|
||||
:on-change="mergedOnPageChange"
|
||||
:on-page-size-change="mergedOnPageSizeChange"
|
||||
/>
|
||||
</div>
|
||||
</n-spin>
|
||||
@ -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)) {
|
||||
|
@ -43,7 +43,7 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
activeSorter () {
|
||||
const activeSorter = this.NDataTable.syntheticActiveSorter
|
||||
const activeSorter = this.NDataTable.mergedActiveSorter
|
||||
return activeSorter
|
||||
},
|
||||
active () {
|
||||
|
@ -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: {
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
[`n-${mergedTheme}-theme`]: mergedTheme,
|
||||
[`n-layout--${siderCollapseMode}-collapse-mode`]: siderCollapseMode
|
||||
}"
|
||||
:style="syntheticLayoutStyle"
|
||||
:style="mergedLayoutStyle"
|
||||
>
|
||||
<n-scrollbar
|
||||
v-if="!nativeScrollbar"
|
||||
@ -86,7 +86,7 @@ export default {
|
||||
}
|
||||
return null
|
||||
},
|
||||
syntheticLayoutStyle () {
|
||||
mergedLayoutStyle () {
|
||||
return Object.assign({
|
||||
marginLeft: this.styleMarginLeft,
|
||||
transition: this.transitionDisabled ? 'none' : null
|
||||
|
@ -17,7 +17,7 @@
|
||||
@scroll="handleScroll"
|
||||
>
|
||||
<n-log-line
|
||||
v-for="(line, index) in syntheticLines"
|
||||
v-for="(line, index) in mergedLines"
|
||||
:key="index"
|
||||
:line="line"
|
||||
/>
|
||||
@ -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')
|
||||
}
|
||||
|
@ -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
|
||||
}"
|
||||
>
|
||||
<div
|
||||
@ -111,7 +111,7 @@
|
||||
}"
|
||||
>
|
||||
<div
|
||||
v-if="syntheticIndicatorPlacement === 'inside'"
|
||||
v-if="mergedIndicatorPlacement === 'inside'"
|
||||
class="n-progress-graph-line-indicator"
|
||||
>
|
||||
{{ percentage + unit }}
|
||||
@ -119,7 +119,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
v-if="syntheticIndicatorPlacement === 'inside-label'"
|
||||
v-if="mergedIndicatorPlacement === 'inside-label'"
|
||||
ref="indicator"
|
||||
class="n-progress-graph-line-indicator"
|
||||
:style="indicatorPercentageIsCaculated ? {
|
||||
@ -138,7 +138,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="showIndicator && syntheticIndicatorPlacement === 'outside'">
|
||||
<div v-if="showIndicator && mergedIndicatorPlacement === 'outside'">
|
||||
<div
|
||||
v-if="$slots.default"
|
||||
class="n-progress-custom-content"
|
||||
@ -354,7 +354,7 @@ export default {
|
||||
setup () {
|
||||
const vm = getCurrentInstance().proxy
|
||||
onFontsReady(() => {
|
||||
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()
|
||||
})
|
||||
|
@ -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
|
||||
})
|
||||
|
@ -30,7 +30,7 @@
|
||||
<div class="n-upload-file-list" :style="fileListStyle">
|
||||
<n-fade-in-expand-transition group>
|
||||
<n-upload-file
|
||||
v-for="file in syntheticFileList"
|
||||
v-for="file in mergedFileList"
|
||||
:key="file.id"
|
||||
:file="file"
|
||||
/>
|
||||
@ -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) {
|
||||
|
@ -145,7 +145,7 @@ export default {
|
||||
Promise.resolve(
|
||||
NUpload.onRemove({
|
||||
file: Object.assign({}, file),
|
||||
fileList: NUpload.syntheticFileList
|
||||
fileList: NUpload.mergedFileList
|
||||
})
|
||||
).then(
|
||||
result => {
|
||||
|
Loading…
Reference in New Issue
Block a user