mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-02-11 13:10:26 +08:00
refactor: use treeshakable import on base components
This commit is contained in:
parent
5ebf11ba06
commit
03645c4411
src
auto-complete/src
back-top/src
badge/src
button/src
cascader/src
date-picker/src
drawer/src
input/src
log/src
message/src
modal/src
popover/src
popselect/src
select/src
slider/src
spin/src
time-picker/src
tree/src
@ -25,7 +25,7 @@
|
||||
@blur="handleBlur"
|
||||
/>
|
||||
</slot>
|
||||
<n-lazy-teleport
|
||||
<n-base-lazy-teleport
|
||||
:show="active"
|
||||
to="body"
|
||||
adjust-to
|
||||
@ -65,7 +65,7 @@
|
||||
</transition>
|
||||
</div>
|
||||
</div>
|
||||
</n-lazy-teleport>
|
||||
</n-base-lazy-teleport>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -85,9 +85,11 @@ import {
|
||||
import { call } from '../../_utils/vue'
|
||||
import { useIsMounted } from 'vooks'
|
||||
import { warn } from '../../_utils/naive'
|
||||
import NLazyTeleport from '../../_base/lazy-teleport'
|
||||
import {
|
||||
NBaseLazyTeleport,
|
||||
NBaseSelectMenu
|
||||
} from '../../_base'
|
||||
import NInput from '../../input'
|
||||
import NBaseSelectMenu from '../../_base/select-menu'
|
||||
import styles from './styles'
|
||||
import { mapAutoCompleteOptionsToSelectOptions } from './utils'
|
||||
|
||||
@ -95,7 +97,7 @@ export default {
|
||||
name: 'AutoComplete',
|
||||
components: {
|
||||
NInput,
|
||||
NLazyTeleport,
|
||||
NBaseLazyTeleport,
|
||||
NBaseSelectMenu
|
||||
},
|
||||
directives: {
|
||||
|
@ -5,7 +5,7 @@
|
||||
style="display: none;"
|
||||
aria-hidden
|
||||
>
|
||||
<n-lazy-teleport
|
||||
<n-base-lazy-teleport
|
||||
:to="to"
|
||||
:show="mergedShow"
|
||||
>
|
||||
@ -46,7 +46,7 @@
|
||||
</slot>
|
||||
</div>
|
||||
</transition>
|
||||
</n-lazy-teleport>
|
||||
</n-base-lazy-teleport>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -62,12 +62,12 @@ import {
|
||||
import { formatLength, warn } from '../../_utils'
|
||||
import styles from './styles'
|
||||
import getTarget from '../../_utils/dom/get-target'
|
||||
import NLazyTeleport from '../../_base/lazy-teleport'
|
||||
import { NBaseLazyTeleport } from '../../_base'
|
||||
|
||||
export default {
|
||||
name: 'BackTop',
|
||||
components: {
|
||||
NLazyTeleport
|
||||
NBaseLazyTeleport
|
||||
},
|
||||
mixins: [
|
||||
configurable,
|
||||
|
@ -37,12 +37,13 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import themeable from '../../_mixins/themeable'
|
||||
import withapp from '../../_mixins/withapp'
|
||||
import usecssr from '../../_mixins/usecssr'
|
||||
import {
|
||||
configurable,
|
||||
themeable,
|
||||
usecssr
|
||||
} from '../../_mixins'
|
||||
import { NBaseSlotMachine, NBaseWave } from '../../_base'
|
||||
import styles from './styles/index.js'
|
||||
import NBaseSlotMachine from '../../_base/slot-machine'
|
||||
import NBaseWave from '../../_base/wave'
|
||||
|
||||
export default {
|
||||
name: 'Badge',
|
||||
@ -51,7 +52,7 @@ export default {
|
||||
NBaseWave
|
||||
},
|
||||
mixins: [
|
||||
withapp,
|
||||
configurable,
|
||||
themeable,
|
||||
usecssr(styles)
|
||||
],
|
||||
|
@ -75,9 +75,12 @@ import {
|
||||
themeable,
|
||||
usecssr
|
||||
} from '../../_mixins'
|
||||
import { NFadeInExpandTransition, NIconSwitchTransition } from '../../_base'
|
||||
import NBaseLoading from '../../_base/loading'
|
||||
import NBaseWave from '../../_base/wave/index.js'
|
||||
import {
|
||||
NFadeInExpandTransition,
|
||||
NIconSwitchTransition,
|
||||
NBaseLoading,
|
||||
NBaseWave
|
||||
} from '../../_base'
|
||||
import NIcon from '../../icon/index.js'
|
||||
import styles from './styles/index.js'
|
||||
import { createHoverColor, createPressedColor } from '../../_utils/color/index.js'
|
||||
|
@ -35,7 +35,7 @@
|
||||
@delete-last-option="handleDeleteLastOption"
|
||||
@pattern-input="handlePatternInput"
|
||||
/>
|
||||
<n-lazy-teleport
|
||||
<n-base-lazy-teleport
|
||||
:show="showMenu && !showSelectMenu"
|
||||
adjust-to
|
||||
>
|
||||
@ -50,8 +50,8 @@
|
||||
:size="mergedSize"
|
||||
:menu-model="menuModel"
|
||||
/>
|
||||
</n-lazy-teleport>
|
||||
<n-lazy-teleport
|
||||
</n-base-lazy-teleport>
|
||||
<n-base-lazy-teleport
|
||||
:show="showMenu && showSelectMenu"
|
||||
adjust-to
|
||||
>
|
||||
@ -69,13 +69,15 @@
|
||||
:tm-nodes="treeMate.treeNodes"
|
||||
@update:value="handleMenuInput"
|
||||
/>
|
||||
</n-lazy-teleport>
|
||||
</n-base-lazy-teleport>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import NBaseSelection from '../../_base/selection'
|
||||
import NLazyTeleport from '../../_base/lazy-teleport'
|
||||
import {
|
||||
NBaseSelection,
|
||||
NBaseLazyTeleport
|
||||
} from '../../_base'
|
||||
import {
|
||||
configurable,
|
||||
themeable,
|
||||
@ -94,7 +96,7 @@ export default {
|
||||
CascaderMenu,
|
||||
CascaderSelectMenu,
|
||||
NBaseSelection,
|
||||
NLazyTeleport
|
||||
NBaseLazyTeleport
|
||||
},
|
||||
mixins: [
|
||||
configurable,
|
||||
|
@ -40,7 +40,7 @@
|
||||
</template>
|
||||
<script>
|
||||
import { ref } from 'vue'
|
||||
import NBaseMenuMask from '../../_base/menu-mask'
|
||||
import { NBaseMenuMask } from '../../_base'
|
||||
import NCascaderSubmenu from './CascaderSubmenu.vue'
|
||||
import { placeable } from '../../_mixins'
|
||||
import { getPickerElement } from './utils'
|
||||
|
@ -71,8 +71,7 @@
|
||||
<script>
|
||||
import { computed, inject, toRef } from 'vue'
|
||||
import NCheckbox from '../../checkbox'
|
||||
import NBaseLoading from '../../_base/loading'
|
||||
import { NIconSwitchTransition } from '../../_base'
|
||||
import { NBaseLoading, NIconSwitchTransition } from '../../_base'
|
||||
import { ChevronRightIcon, CheckmarkIcon } from '../../_base/icons'
|
||||
import { useMemo } from 'vooks'
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
||||
<script>
|
||||
import { ref, inject, toRef } from 'vue'
|
||||
import { createTreeMate } from 'treemate'
|
||||
import NBaseSelectMenu from '../../_base/select-menu'
|
||||
import { NBaseSelectMenu } from '../../_base'
|
||||
import { createSelectOptions, getPickerElement } from './utils'
|
||||
import {
|
||||
placeable
|
||||
|
@ -171,7 +171,7 @@ import DaterangePanel from './panel/daterange.vue'
|
||||
import NInput from '../../input'
|
||||
import NIcon from '../../icon'
|
||||
import { CalendarIcon } from '../../_base/icons'
|
||||
import NBaseLazyTeleport from '../../_base/lazy-teleport'
|
||||
import { NBaseLazyTeleport } from '../../_base'
|
||||
|
||||
import {
|
||||
format,
|
||||
|
@ -1,4 +1,4 @@
|
||||
import FocusDetector from '../../../_base/focus-detector'
|
||||
import { NBaseFocusDetector } from '../../../_base'
|
||||
import {
|
||||
ArrowRight20Filled as FastForwardIcon,
|
||||
ArrowLeft20Filled as FastBackwardIcon,
|
||||
@ -27,7 +27,7 @@ export default {
|
||||
}
|
||||
},
|
||||
components: {
|
||||
FocusDetector,
|
||||
NBaseFocusDetector,
|
||||
FastForwardIcon,
|
||||
FastBackwardIcon,
|
||||
BackwardIcon,
|
||||
|
@ -100,7 +100,7 @@
|
||||
{{ localeNs.confirm }}
|
||||
</n-button>
|
||||
</div>
|
||||
<focus-detector @focus="handleFocusDetectorFocus" />
|
||||
<n-base-focus-detector @focus="handleFocusDetectorFocus" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -167,7 +167,7 @@
|
||||
{{ localeNs.confirm }}
|
||||
</n-button>
|
||||
</div>
|
||||
<focus-detector @focus="handleFocusDetectorFocus" />
|
||||
<n-base-focus-detector @focus="handleFocusDetectorFocus" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -131,7 +131,7 @@
|
||||
{{ localeNs.confirm }}
|
||||
</n-button>
|
||||
</div>
|
||||
<focus-detector @focus="handleFocusDetectorFocus" />
|
||||
<n-base-focus-detector @focus="handleFocusDetectorFocus" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -232,7 +232,7 @@
|
||||
v-else
|
||||
style="height: 12px"
|
||||
/>
|
||||
<focus-detector @focus="handleFocusDetectorFocus" />
|
||||
<n-base-focus-detector @focus="handleFocusDetectorFocus" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<n-lazy-teleport
|
||||
<n-base-lazy-teleport
|
||||
:to="to"
|
||||
:show="show"
|
||||
>
|
||||
@ -33,7 +33,7 @@
|
||||
<slot />
|
||||
</n-drawer-body-wrapper>
|
||||
</div>
|
||||
</n-lazy-teleport>
|
||||
</n-base-lazy-teleport>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@ -45,14 +45,14 @@ import {
|
||||
import { zindexable } from '../../_directives'
|
||||
import { warn, formatLength } from '../../_utils'
|
||||
import { useCompitable, useIsMounted } from 'vooks'
|
||||
import NLazyTeleport from '../../_base/lazy-teleport'
|
||||
import { NBaseLazyTeleport } from '../../_base'
|
||||
import NDrawerBodyWrapper from './DrawerBodyWrapper.vue'
|
||||
import styles from './styles/index'
|
||||
|
||||
export default {
|
||||
name: 'Drawer',
|
||||
components: {
|
||||
NLazyTeleport,
|
||||
NBaseLazyTeleport,
|
||||
NDrawerBodyWrapper
|
||||
},
|
||||
directives: {
|
||||
|
@ -159,7 +159,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import NBaseSuffix from '../../_base/suffix'
|
||||
import { NBaseSuffix } from '../../_base'
|
||||
import {
|
||||
configurable,
|
||||
themeable,
|
||||
|
@ -7,8 +7,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import NBaseLoading from '../../_base/loading'
|
||||
import locale from '../../_mixins/locale'
|
||||
import { NBaseLoading } from '../../_base'
|
||||
import { locale } from '../../_mixins'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
|
@ -7,8 +7,7 @@ import {
|
||||
ErrorIcon,
|
||||
CloseIcon
|
||||
} from '../../_base/icons'
|
||||
import NBaseLoading from '../../_base/loading'
|
||||
import { NIconSwitchTransition } from '../../_base'
|
||||
import { NIconSwitchTransition, NBaseLoading } from '../../_base'
|
||||
import { render } from '../../_utils/vue'
|
||||
import {
|
||||
configurable,
|
||||
|
@ -5,7 +5,7 @@ import presetProps from './presetProps'
|
||||
import { useIsMounted, useClicked, useClickPosition } from 'vooks'
|
||||
import { warn } from '../../_utils/naive/warn'
|
||||
import { omit } from '../../_utils/vue'
|
||||
import NLazyTeleport from '../../_base/lazy-teleport'
|
||||
import { NBaseLazyTeleport } from '../../_base'
|
||||
import NModalBodyWrapper from './BodyWrapper.vue'
|
||||
import styles from './styles'
|
||||
|
||||
@ -125,7 +125,7 @@ export default {
|
||||
}
|
||||
},
|
||||
render () {
|
||||
return h(NLazyTeleport, {
|
||||
return h(NBaseLazyTeleport, {
|
||||
to: this.to,
|
||||
show: this.show
|
||||
}, {
|
||||
|
@ -12,7 +12,7 @@ import {
|
||||
useIsMounted
|
||||
} from 'vooks'
|
||||
import { omit, warn } from '../../_utils'
|
||||
import NLazyTeleport from '../../_base/lazy-teleport'
|
||||
import { NBaseLazyTeleport } from '../../_base'
|
||||
import NPopoverBody from './PopoverBody'
|
||||
|
||||
function appendEvents (vNode, events) {
|
||||
@ -290,7 +290,7 @@ export default {
|
||||
|
||||
return h(Fragment, [
|
||||
manuallyPositioned ? null : triggerVNode,
|
||||
h(NLazyTeleport, {
|
||||
h(NBaseLazyTeleport, {
|
||||
to: 'body',
|
||||
show: this.mergedShow,
|
||||
adjustTo: true
|
||||
|
@ -13,7 +13,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import NBaseSelectMenu from '../../_base/select-menu'
|
||||
import { NBaseSelectMenu } from '../../_base'
|
||||
import {
|
||||
configurable,
|
||||
themeable,
|
||||
|
@ -40,7 +40,7 @@
|
||||
@blur="handleTriggerBlur"
|
||||
@focus="handleTriggerFocus"
|
||||
/>
|
||||
<n-lazy-teleport
|
||||
<n-base-lazy-teleport
|
||||
:show="mergedShow"
|
||||
adjust-to
|
||||
>
|
||||
@ -92,7 +92,7 @@
|
||||
</transition>
|
||||
</div>
|
||||
</div>
|
||||
</n-lazy-teleport>
|
||||
</n-base-lazy-teleport>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -117,14 +117,13 @@ import {
|
||||
zindexable
|
||||
} from '../../_directives'
|
||||
import {
|
||||
warn
|
||||
} from '../../_utils/naive'
|
||||
warn, call
|
||||
} from '../../_utils'
|
||||
import {
|
||||
call
|
||||
} from '../../_utils/vue'
|
||||
import NBaseSelectMenu from '../../_base/select-menu'
|
||||
import NBaseSelection from '../../_base/selection'
|
||||
import NLazyTeleport from '../../_base/lazy-teleport'
|
||||
NBaseSelectMenu,
|
||||
NBaseSelection,
|
||||
NBaseLazyTeleport
|
||||
} from '../../_base'
|
||||
import styles from './styles/index.js'
|
||||
|
||||
function patternMatched (pattern, value) {
|
||||
@ -162,7 +161,7 @@ export default {
|
||||
components: {
|
||||
NBaseSelectMenu,
|
||||
NBaseSelection,
|
||||
NLazyTeleport
|
||||
NBaseLazyTeleport
|
||||
},
|
||||
directives: {
|
||||
clickoutside,
|
||||
|
@ -65,7 +65,7 @@
|
||||
{{ mark.label }}
|
||||
</div>
|
||||
</div>
|
||||
<n-lazy-teleport
|
||||
<n-base-lazy-teleport
|
||||
:show="showTooltip"
|
||||
adjust-to
|
||||
>
|
||||
@ -97,7 +97,7 @@
|
||||
</transition>
|
||||
</div>
|
||||
</div>
|
||||
</n-lazy-teleport>
|
||||
</n-base-lazy-teleport>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -117,7 +117,7 @@ import styles from './styles'
|
||||
import { warn } from '../../_utils/naive'
|
||||
import { call } from '../../_utils/vue'
|
||||
import { useIsMounted } from 'vooks'
|
||||
import NLazyTeleport from '../../_base/lazy-teleport'
|
||||
import { NBaseLazyTeleport } from '../../_base'
|
||||
|
||||
function handleFirstHandleMouseMove (e) {
|
||||
const railRect = this.railRef.getBoundingClientRect()
|
||||
@ -145,7 +145,7 @@ export default {
|
||||
zindexable
|
||||
},
|
||||
components: {
|
||||
NLazyTeleport
|
||||
NBaseLazyTeleport
|
||||
},
|
||||
mixins: [
|
||||
configurable,
|
||||
|
@ -41,7 +41,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import NBaseLoading from '../../_base/loading'
|
||||
import { NBaseLoading } from '../../_base'
|
||||
import {
|
||||
configurable,
|
||||
themeable,
|
||||
|
@ -34,7 +34,7 @@
|
||||
</n-icon>
|
||||
</template>
|
||||
</n-input>
|
||||
<n-lazy-teleport
|
||||
<n-base-lazy-teleport
|
||||
:to="to"
|
||||
:show="active"
|
||||
:disabled="teleportDisabled"
|
||||
@ -177,14 +177,14 @@
|
||||
</transition>
|
||||
</div>
|
||||
</div>
|
||||
</n-lazy-teleport>
|
||||
</n-base-lazy-teleport>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ref } from 'vue'
|
||||
import { useIsMounted } from 'vooks'
|
||||
import NLazyTeleport from '../../_base/lazy-teleport'
|
||||
import { NBaseLazyTeleport, NBaseFocusDetector } from '../../_base'
|
||||
import NScrollbar from '../../scrollbar'
|
||||
import NInput from '../../input'
|
||||
import NIcon from '../../icon'
|
||||
@ -207,7 +207,7 @@ import {
|
||||
} from 'date-fns'
|
||||
import { strictParse } from '../../date-picker/src/utils'
|
||||
import keyboardDelegate from '../../_utils/delegate/keyboardDelegate'
|
||||
import NBaseFocusDetector from '../../_base/focus-detector'
|
||||
|
||||
import {
|
||||
TimeOutline as TimeIcon
|
||||
} from 'vicons/ionicons-v5'
|
||||
@ -231,7 +231,7 @@ export default {
|
||||
NIcon,
|
||||
NScrollbar,
|
||||
NBaseFocusDetector,
|
||||
NLazyTeleport,
|
||||
NBaseLazyTeleport,
|
||||
TimeIcon
|
||||
},
|
||||
directives: {
|
||||
|
@ -22,8 +22,7 @@
|
||||
import {
|
||||
MdArrowDropright
|
||||
} from 'vicons/ionicons-v4'
|
||||
import NBaseLoading from '../../_base/loading'
|
||||
import { NIconSwitchTransition } from '../../_base'
|
||||
import { NIconSwitchTransition, NBaseLoading } from '../../_base'
|
||||
|
||||
export default {
|
||||
name: 'NTreeSwitcher',
|
||||
|
Loading…
Reference in New Issue
Block a user