refactor(cascader): new icon loading impl use new base loading

This commit is contained in:
07akioni 2020-12-24 00:22:22 +08:00
parent 95c7f9a164
commit 734ee1ffc5
4 changed files with 40 additions and 43 deletions

View File

@ -11,15 +11,15 @@
v-if="show"
key="loading"
class="n-base-loading-circular n-base-loading__icon"
:viewBox="`0 0 ${radius * 2} ${radius * 2}`"
:viewBox="`0 0 ${(radius * 2) / scale} ${(radius * 2) / scale}`"
>
<circle
:style="{
strokeWidth
}"
class="n-base-loading-circular-path"
:cx="radius"
:cy="radius"
:cx="radius / scale"
:cy="radius / scale"
fill="none"
:r="radius - strokeWidth / 2"
/>
@ -43,6 +43,10 @@ export default {
},
mixins: [withCssr(styles)],
props: {
scale: {
type: Number,
default: 1
},
radius: {
type: Number,
default: 100

View File

@ -3,6 +3,7 @@
:theme="theme"
class="n-base-selection__mark"
:stroke-width="20"
:scale="0.8"
:show="loading"
>
<n-base-clear-button

View File

@ -21,21 +21,21 @@
<span class="n-cascader-option__label">{{ label }}</span>
<div class="n-cascader-option__suffix">
<div class="n-cascader-option-icon-placeholder">
<n-icon-switch-transition v-if="!isLeaf">
<n-base-loading
v-if="isLoading"
key="loading"
class="n-cascader-option-icon"
:theme="NCascader.mergedTheme"
/>
<n-base-loading
v-if="!isLeaf"
:scale="0.8"
:stroke-width="20"
:show="isLoading"
class="n-cascader-option-icon"
:theme="NCascader.mergedTheme"
>
<n-icon
v-else
key="arrow"
class="n-cascader-option-icon n-cascader-option-icon--arrow"
>
<chevron-right-icon />
</n-icon>
</n-icon-switch-transition>
</n-base-loading>
<transition
v-else-if="!multiple && leafOnly"
name="n-fade-in-scale-up-transition"
@ -55,7 +55,7 @@
<script>
import { computed, inject, toRef } from 'vue'
import { NCheckbox } from '../../checkbox'
import { NBaseLoading, NIconSwitchTransition } from '../../_base'
import { NBaseLoading } from '../../_base'
import { ChevronRightIcon, CheckmarkIcon } from '../../_base/icons'
import { useMemo } from 'vooks'
@ -64,7 +64,6 @@ export default {
components: {
NCheckbox,
NBaseLoading,
NIconSwitchTransition,
ChevronRightIcon,
CheckmarkIcon
},

View File

@ -1,29 +1,30 @@
import { c, cTB, cB, cE, cM } from '../../../_utils/cssr'
import fadeInScaleUpTransition from '../../../_styles/transitions/fade-in-scale-up'
import iconSwitchTransition from '../../../_styles/transitions/icon-switch'
import { depx, pxfy } from 'seemly'
export default
c([
({ props }) => {
const {
cubicBezierEaseInOut,
transformDebounceScale
} = props.$global
const {
arrowColor,
optionTextColor,
optionTextColorMatched,
optionTextColorDisabled,
optionCheckMarkColor,
menuColor,
menuBoxShadow,
menuBorderColor,
menuBorderRadius,
optionColorHover,
optionHeight,
optionFontSize
} = props.$local
$local: {
arrowColor,
optionTextColor,
optionTextColorMatched,
optionTextColorDisabled,
optionCheckMarkColor,
menuColor,
menuBoxShadow,
menuBorderColor,
menuBorderRadius,
optionColorHover,
optionHeight,
optionFontSize
},
$global: {
cubicBezierEaseInOut,
transformDebounceScale
}
} = props
const menuHeight = pxfy(depx(optionHeight) * 6.6)
return cTB(
'cascader-menu',
@ -119,19 +120,13 @@ c([
justifyContent: 'center'
}),
cB('cascader-option-icon-placeholder', {
lineHeight: 0,
position: 'relative',
width: '16px',
height: '16px',
fontSize: '16px'
}, [
cB('cascader-option-icon', {
position: 'absolute',
left: 0,
right: 0,
top: 0,
bottom: 0
}, [
iconSwitchTransition(),
cB('cascader-option-icon', [
cM('checkmark', {
color: optionCheckMarkColor
}, [
@ -143,9 +138,7 @@ c([
])
]),
cM('selected', {
raw: `
color: ${optionTextColorMatched}
`
color: optionTextColorMatched
}),
cM('active', {
color: optionTextColorMatched,