diff --git a/package.json b/package.json index 2e52eb2ef..ab6ad3898 100644 --- a/package.json +++ b/package.json @@ -76,8 +76,8 @@ "@vicons/fluent": "^0.7.0", "@vicons/ionicons4": "^0.7.0", "@vicons/ionicons5": "^0.7.0", - "@vitejs/plugin-vue": "^1.2.0", - "@vue/compiler-sfc": "^3.0.9", + "@vitejs/plugin-vue": "^1.2.1", + "@vue/compiler-sfc": "^3.0.10", "@vue/eslint-config-standard": "^6.0.0", "@vue/eslint-config-typescript": "^7.0.0", "@vue/test-utils": "^2.0.0-rc.4", @@ -118,7 +118,7 @@ "vdirs": "^0.1.0", "vfonts": "^0.1.0", "vooks": "^0.1.5", - "vue": "^3.0.9", + "vue": "^3.0.10", "vue-router": "^4.0.5", "vueuc": "^0.3.0" }, diff --git a/src/_internal/select-menu/src/SelectMenu.tsx b/src/_internal/select-menu/src/SelectMenu.tsx index 3dab34e32..d265ede19 100644 --- a/src/_internal/select-menu/src/SelectMenu.tsx +++ b/src/_internal/select-menu/src/SelectMenu.tsx @@ -8,7 +8,6 @@ import { watch, toRef, renderSlot, - VNode, provide, reactive } from 'vue' @@ -415,9 +414,7 @@ export default defineComponent({ ) : (
- {renderSlot($slots, 'empty', undefined, () => [ - () as VNode - ])} + {renderSlot($slots, 'empty', undefined, () => [])}
)} {$slots.action && ( diff --git a/src/auto-complete/src/AutoComplete.tsx b/src/auto-complete/src/AutoComplete.tsx index b1c78878f..8aa5f8974 100644 --- a/src/auto-complete/src/AutoComplete.tsx +++ b/src/auto-complete/src/AutoComplete.tsx @@ -8,7 +8,6 @@ import { PropType, mergeProps, renderSlot, - VNode, withDirectives, CSSProperties } from 'vue' @@ -292,24 +291,20 @@ export default defineComponent({ value: this.mergedValue }, () => [ - ( - - ) as VNode + ] ) ) @@ -333,25 +328,23 @@ export default defineComponent({ default: () => this.active ? withDirectives( - ( - - ) as VNode, + , [[clickoutside, this.handleClickOutsideMenu]] ) : null diff --git a/src/back-top/src/BackTop.tsx b/src/back-top/src/BackTop.tsx index ec127a899..0a0825537 100644 --- a/src/back-top/src/BackTop.tsx +++ b/src/back-top/src/BackTop.tsx @@ -9,7 +9,6 @@ import { renderSlot, mergeProps, Transition, - VNode, PropType, onMounted, onBeforeUnmount @@ -286,11 +285,9 @@ export default defineComponent({ 'default', undefined, () => [ - ( - - {{ default: () => BackTopIcon }} - - ) as VNode + + {{ default: () => BackTopIcon }} + ] ) ] diff --git a/src/cascader/src/CascaderMenu.tsx b/src/cascader/src/CascaderMenu.tsx index 3f8d99b46..f0df1f889 100644 --- a/src/cascader/src/CascaderMenu.tsx +++ b/src/cascader/src/CascaderMenu.tsx @@ -8,8 +8,7 @@ import { inject, nextTick, Transition, - withDirectives, - VNode + withDirectives } from 'vue' import { FollowerPlacement } from 'vueuc' import { clickoutside } from 'vdirs' @@ -103,28 +102,26 @@ export default defineComponent({ default: () => this.show ? withDirectives( - ( -
- {this.menuModel.map((submenuOptions, index) => { - return ( - { - if (instance) submenuInstRefs[index] = instance - }) as any - } - key={index} - tmNodes={submenuOptions} - depth={index + 1} - /> - ) - })} - -
- ) as VNode, +
+ {this.menuModel.map((submenuOptions, index) => { + return ( + { + if (instance) submenuInstRefs[index] = instance + }) as any + } + key={index} + tmNodes={submenuOptions} + depth={index + 1} + /> + ) + })} + +
, [[clickoutside, this.handleClickOutside]] ) : null diff --git a/src/cascader/src/CascaderSelectMenu.tsx b/src/cascader/src/CascaderSelectMenu.tsx index 3a051d9ac..bfe33aeda 100644 --- a/src/cascader/src/CascaderSelectMenu.tsx +++ b/src/cascader/src/CascaderSelectMenu.tsx @@ -5,7 +5,6 @@ import { inject, toRef, defineComponent, - VNode, PropType, computed, watch, @@ -165,21 +164,19 @@ export default defineComponent({ default: () => this.show ? withDirectives( - ( - - ) as VNode, + , [[clickoutside, this.handleClickOutside]] ) : null diff --git a/src/collapse/src/CollapseItem.tsx b/src/collapse/src/CollapseItem.tsx index 4dfa37d89..c49adb546 100644 --- a/src/collapse/src/CollapseItem.tsx +++ b/src/collapse/src/CollapseItem.tsx @@ -1,12 +1,4 @@ -import { - h, - defineComponent, - PropType, - inject, - computed, - renderSlot, - VNode -} from 'vue' +import { h, defineComponent, PropType, inject, computed, renderSlot } from 'vue' import { createId } from 'seemly' import { ChevronRightIcon as ArrowIcon } from '../../_internal/icons' import { NBaseIcon } from '../../_internal' @@ -89,9 +81,7 @@ export default defineComponent({ {arrowPlacement === 'right' && headerNode}
{renderSlot($slots, 'arrow', { collapsed: collapsed }, () => [ - ( - {{ default: () => }} - ) as VNode + {{ default: () => }} ])}
{arrowPlacement === 'left' && headerNode} diff --git a/src/collapse/src/CollapseItemContent.tsx b/src/collapse/src/CollapseItemContent.tsx index 779f2d587..fb3d46c06 100644 --- a/src/collapse/src/CollapseItemContent.tsx +++ b/src/collapse/src/CollapseItemContent.tsx @@ -1,4 +1,4 @@ -import { h, withDirectives, vShow, defineComponent, VNode, toRef } from 'vue' +import { h, withDirectives, vShow, defineComponent, toRef } from 'vue' import { useFalseUntilTruthy } from 'vooks' import { NFadeInExpandTransition } from '../../_internal' @@ -22,7 +22,7 @@ export default defineComponent({
{this.$slots}
- ) as VNode + ) return useVShow ? withDirectives(contentNode, [[vShow, show]]) : show diff --git a/src/date-picker/src/DatePicker.tsx b/src/date-picker/src/DatePicker.tsx index 0259e87ba..29dd599ce 100644 --- a/src/date-picker/src/DatePicker.tsx +++ b/src/date-picker/src/DatePicker.tsx @@ -8,7 +8,6 @@ import { PropType, watch, withDirectives, - VNode, ExtractPropTypes, CSSProperties, reactive, @@ -595,98 +594,97 @@ export default defineComponent({ > {{ - default: () => - [ - - {{ - default: () => - this.isRange ? ( - - {{ - separator: () => ( - - {{ default: () => }} - - ), - clear: () => ( - - {{ default: () => }} - - ) - }} - - ) : ( - - {{ - clear: () => ( - - {{ default: () => }} - - ) - }} - - ) - }} - , - - {{ - default: () => ( - [ + + {{ + default: () => + this.isRange ? ( + {{ - default: () => - this.active - ? withDirectives( - (this.type === 'datetime' ? ( - - ) : this.type === 'daterange' ? ( - - ) : this.type === 'datetimerange' ? ( - - ) : ( - - )) as VNode, - [[clickoutside, this.handleClickOutside]] - ) - : null + separator: () => ( + + {{ default: () => }} + + ), + clear: () => ( + + {{ default: () => }} + + ) }} - +
+ ) : ( + + {{ + clear: () => ( + + {{ default: () => }} + + ) + }} + ) - }} - - ] as VNode[] + }} + , + + {{ + default: () => ( + + {{ + default: () => + this.active + ? withDirectives( + this.type === 'datetime' ? ( + + ) : this.type === 'daterange' ? ( + + ) : this.type === 'datetimerange' ? ( + + ) : ( + + ), + [[clickoutside, this.handleClickOutside]] + ) + : null + }} + + ) + }} + + ] }} diff --git a/src/dialog/src/Dialog.tsx b/src/dialog/src/Dialog.tsx index 9703a7dc3..85f4a465e 100644 --- a/src/dialog/src/Dialog.tsx +++ b/src/dialog/src/Dialog.tsx @@ -5,7 +5,6 @@ import { VNodeChild, PropType, renderSlot, - VNode, CSSProperties } from 'vue' import { useConfig, useTheme } from '../../_mixins' @@ -204,17 +203,11 @@ export default defineComponent({ {{ default: () => - renderSlot( - $slots, - 'icon', - undefined, - () => - [ - this.icon - ? h(render, { render: this.icon }) - : iconMap[this.type] - ] as VNode[] - ) + renderSlot($slots, 'icon', undefined, () => [ + this.icon + ? h(render, { render: this.icon }) + : iconMap[this.type] + ]) }} @@ -224,17 +217,11 @@ export default defineComponent({ {{ default: () => - renderSlot( - $slots, - 'icon', - undefined, - () => - [ - this.icon - ? h(render, { render: this.icon }) - : iconMap[this.type] - ] as VNode[] - ) + renderSlot($slots, 'icon', undefined, () => [ + this.icon + ? h(render, { render: this.icon }) + : iconMap[this.type] + ]) }} ) : null} @@ -252,42 +239,34 @@ export default defineComponent({ ])}
- {renderSlot( - $slots, - 'action', - undefined, - () => - [ - negativeText ? ( - - {{ - default: () => - h(render, { render: () => this.negativeText }) - }} - - ) : null, - - {{ - default: () => - h(render, { render: () => this.positiveText }) - }} - - ] as VNode[] - )} + {renderSlot($slots, 'action', undefined, () => [ + negativeText ? ( + + {{ + default: () => h(render, { render: () => this.negativeText }) + }} + + ) : null, + + {{ + default: () => h(render, { render: () => this.positiveText }) + }} + + ])}
) diff --git a/src/drawer/src/Drawer.tsx b/src/drawer/src/Drawer.tsx index f3ea9a956..f6be29ea1 100644 --- a/src/drawer/src/Drawer.tsx +++ b/src/drawer/src/Drawer.tsx @@ -7,7 +7,6 @@ import { CSSProperties, reactive, withDirectives, - VNode, Transition } from 'vue' import { VLazyTeleport } from 'vueuc' @@ -198,39 +197,34 @@ export default defineComponent({ {{ default: () => { return withDirectives( - ( -
+ + {{ + default: () => + this.show ? ( +
+ ) : null + }} + + - - {{ - default: () => - this.show ? ( -
- ) : null - }} - - - {this.$slots} - -
- ) as VNode, + {this.$slots} +
+
, [[zindexable, { enabled: this.show }]] ) } diff --git a/src/drawer/src/DrawerBodyWrapper.tsx b/src/drawer/src/DrawerBodyWrapper.tsx index 1521abea2..52e6f330a 100644 --- a/src/drawer/src/DrawerBodyWrapper.tsx +++ b/src/drawer/src/DrawerBodyWrapper.tsx @@ -11,7 +11,6 @@ import { PropType, withDirectives, vShow, - VNode, renderSlot, mergeProps } from 'vue' @@ -88,53 +87,51 @@ export default defineComponent({ const { NDrawer, $slots } = this return this.displayDirective === 'show' || this.displayed || this.show ? withDirectives( - ( -
- {/* Keep the wrapper dom. Make sure the drawer has a host. +
+ {/* Keep the wrapper dom. Make sure the drawer has a host. Nor the detached content will disappear without transition */} - - {{ - default: () => - withDirectives( - h( - 'div', - mergeProps(this.$attrs, { - ref: 'bodyRef', - class: [ - 'n-drawer', - `n-drawer--${this.placement}-placement`, - { - 'n-drawer--native-scrollbar': this.nativeScrollbar - } - ] - }), - [ - this.nativeScrollbar ? ( - renderSlot($slots, 'default') - ) : ( - - {$slots} - - ) - ] as VNode[] - ), - [[vShow, this.show]] - ) - }} - -
- ) as VNode, + + {{ + default: () => + withDirectives( + h( + 'div', + mergeProps(this.$attrs, { + ref: 'bodyRef', + class: [ + 'n-drawer', + `n-drawer--${this.placement}-placement`, + { + 'n-drawer--native-scrollbar': this.nativeScrollbar + } + ] + }), + [ + this.nativeScrollbar ? ( + renderSlot($slots, 'default') + ) : ( + + {$slots} + + ) + ] + ), + [[vShow, this.show]] + ) + }} + +
, [ [ vShow, diff --git a/src/dynamic-input/src/DynamicInput.tsx b/src/dynamic-input/src/DynamicInput.tsx index 046d7e0af..c461f2a9d 100644 --- a/src/dynamic-input/src/DynamicInput.tsx +++ b/src/dynamic-input/src/DynamicInput.tsx @@ -11,8 +11,7 @@ import { inject, CSSProperties, provide, - reactive, - VNode + reactive } from 'vue' import { useMergedState } from 'vooks' import { createId } from 'seemly' @@ -314,40 +313,39 @@ export default defineComponent({
{{ - default: () => - [ - !this.removeDisabled ? ( - remove(index)} - > - {{ - icon: () => ( - - {{ default: () => }} - - ) - }} - - ) : null, + default: () => [ + !this.removeDisabled ? ( createItem(index)} + circle + onClick={() => remove(index)} > {{ icon: () => ( - {{ default: () => }} + {{ default: () => }} ) }} - ] as VNode[] + ) : null, + createItem(index)} + > + {{ + icon: () => ( + + {{ default: () => }} + + ) + }} + + ] }}
diff --git a/src/empty/src/Empty.tsx b/src/empty/src/Empty.tsx index 24f8f4e1a..07bc786b0 100644 --- a/src/empty/src/Empty.tsx +++ b/src/empty/src/Empty.tsx @@ -4,8 +4,7 @@ import { computed, PropType, CSSProperties, - renderSlot, - VNode + renderSlot } from 'vue' import { EmptyIcon } from '../../_internal/icons' import { useLocale, useTheme } from '../../_mixins' @@ -69,7 +68,7 @@ export default defineComponent({
{renderSlot($slots, 'icon', undefined, () => [ - ({{ default: () => }}) as VNode + {{ default: () => }} ])}
{this.showDescription ? ( diff --git a/src/loading-bar/src/LoadingBar.tsx b/src/loading-bar/src/LoadingBar.tsx index 3987a7192..be9d20075 100644 --- a/src/loading-bar/src/LoadingBar.tsx +++ b/src/loading-bar/src/LoadingBar.tsx @@ -6,7 +6,6 @@ import { inject, withDirectives, vShow, - VNode, CSSProperties, ref, nextTick @@ -153,21 +152,13 @@ export default defineComponent({ {{ default: () => withDirectives( - h( - 'div', - { - class: 'n-loading-bar-container' - }, - [ - ( -
- ) as VNode - ] - ), +
+
+
, [[vShow, this.loading || (!this.loading && this.entering)]] ) }} diff --git a/src/log/src/Log.tsx b/src/log/src/Log.tsx index 017bab0d2..1ddea7cff 100644 --- a/src/log/src/Log.tsx +++ b/src/log/src/Log.tsx @@ -3,7 +3,6 @@ import { Transition, defineComponent, computed, - VNode, provide, PropType, nextTick, @@ -272,7 +271,7 @@ export default defineComponent({ {{ default: () => (this.loading ? : null) }} - ] as VNode[] + ] ) } }) diff --git a/src/modal/src/BodyWrapper.tsx b/src/modal/src/BodyWrapper.tsx index 25aad388d..020defb2e 100644 --- a/src/modal/src/BodyWrapper.tsx +++ b/src/modal/src/BodyWrapper.tsx @@ -184,68 +184,66 @@ export default defineComponent({ } return this.displayDirective === 'show' || this.displayed || this.show ? withDirectives( - ( -
- - {{ - default: () => ( - - {{ - default: () => - withDirectives( - (this.preset === 'confirm' || - this.preset === 'dialog' ? ( - - {$slots} - - ) : this.preset === 'card' ? ( - - {$slots} - - ) : ( - childNode - )) as any, - [ - [vShow, this.show], - [clickoutside, handleClickOutside] - ] - ) - }} - - ) - }} - -
- ) as VNode, +
+ + {{ + default: () => ( + + {{ + default: () => + withDirectives( + (this.preset === 'confirm' || + this.preset === 'dialog' ? ( + + {$slots} + + ) : this.preset === 'card' ? ( + + {$slots} + + ) : ( + childNode + )) as any, + [ + [vShow, this.show], + [clickoutside, handleClickOutside] + ] + ) + }} + + ) + }} + +
, [ [ vShow, diff --git a/src/popconfirm/src/PopconfirmPanel.tsx b/src/popconfirm/src/PopconfirmPanel.tsx index 208bc610d..27b2315ec 100644 --- a/src/popconfirm/src/PopconfirmPanel.tsx +++ b/src/popconfirm/src/PopconfirmPanel.tsx @@ -5,7 +5,6 @@ import { inject, PropType, renderSlot, - VNode, CSSProperties } from 'vue' import { NButton } from '../../button' @@ -84,24 +83,18 @@ export default defineComponent({ {renderSlot(this.$slots, 'default')}
- {renderSlot( - this.$slots, - 'action', - undefined, - () => - [ - - {this.localizedNegativeText} - , - - {this.localizedPositiveText} - - ] as VNode[] - )} + {renderSlot(this.$slots, 'action', undefined, () => [ + + {this.localizedNegativeText} + , + + {this.localizedPositiveText} + + ])}
) diff --git a/src/popover/src/Popover.ts b/src/popover/src/Popover.ts index 84fb392c8..05fc26ea1 100644 --- a/src/popover/src/Popover.ts +++ b/src/popover/src/Popover.ts @@ -217,9 +217,9 @@ export default defineComponent({ return compatibleShowArrowRef.value }) // trigger - let triggerVNode = null as VNode | null + let triggerVNode: VNode | null = null // bodyInstance - let bodyInstance = null as BodyInstance | null + let bodyInstance: BodyInstance | null = null const showTimerIdRef = ref(null) const hideTimerIdRef = ref(null) const positionManuallyRef = useMemo(() => { diff --git a/src/rate/src/Rate.tsx b/src/rate/src/Rate.tsx index d1f678bb9..8e10e472a 100644 --- a/src/rate/src/Rate.tsx +++ b/src/rate/src/Rate.tsx @@ -5,7 +5,6 @@ import { computed, defineComponent, renderList, - VNode, PropType, CSSProperties } from 'vue' @@ -104,28 +103,24 @@ export default defineComponent({ style={this.cssVars as CSSProperties} onMouseleave={this.handleMouseLeave} > - {renderList( - this.count, - (_, index) => - ( -
this.handleClick(index)} - onMouseenter={() => this.handleMouseEnter(index)} - > - {{ default: () => StarIcon }} -
- ) as VNode - )} + {renderList(this.count, (_, index) => ( +
this.handleClick(index)} + onMouseenter={() => this.handleMouseEnter(index)} + > + {{ default: () => StarIcon }} +
+ ))}
) } diff --git a/src/scrollbar/src/ScrollBar.tsx b/src/scrollbar/src/ScrollBar.tsx index a8a8d3746..54eb43b8b 100644 --- a/src/scrollbar/src/ScrollBar.tsx +++ b/src/scrollbar/src/ScrollBar.tsx @@ -9,7 +9,6 @@ import { mergeProps, renderSlot, Transition, - VNode, ExtractPropTypes, CSSProperties } from 'vue' @@ -650,7 +649,7 @@ export default defineComponent({ }}
- ] as VNode[] + ] ) }} diff --git a/src/time-picker/src/Panel.tsx b/src/time-picker/src/Panel.tsx index 66bd4822f..9fb69a692 100644 --- a/src/time-picker/src/Panel.tsx +++ b/src/time-picker/src/Panel.tsx @@ -1,4 +1,4 @@ -import { h, ref, defineComponent, inject, PropType, computed, VNode } from 'vue' +import { h, ref, defineComponent, inject, PropType, computed } from 'vue' import { NScrollbar } from '../../scrollbar' import { NButton } from '../../button' import { NBaseFocusDetector } from '../../_internal' @@ -263,7 +263,7 @@ export default defineComponent({ , - ] as VNode[] + ] ) } }) diff --git a/src/time-picker/src/TimePicker.tsx b/src/time-picker/src/TimePicker.tsx index 92deda994..336af343c 100644 --- a/src/time-picker/src/TimePicker.tsx +++ b/src/time-picker/src/TimePicker.tsx @@ -10,7 +10,6 @@ import { provide, nextTick, watch, - VNode, CSSProperties, reactive } from 'vue' @@ -645,38 +644,36 @@ export default defineComponent({ default: () => this.active ? withDirectives( - ( - - ) as VNode, + , [[clickoutside, this.handleClickOutside]] ) : null diff --git a/themes/tusimple/src/data-table.tsx b/themes/tusimple/src/data-table.tsx index d57b891fb..20c47b415 100644 --- a/themes/tusimple/src/data-table.tsx +++ b/themes/tusimple/src/data-table.tsx @@ -1,4 +1,4 @@ -import { h, VNode } from 'vue' +import { h } from 'vue' import { CaretUpOutline, CaretDownOutline } from '@vicons/ionicons5' import { colors } from './theme-overrides-light' import { GRAY_COLOR_4 } from './vars' @@ -80,5 +80,5 @@ export const renderFilter: DataTableRenderFilter = ({ active, show }) => { - ) as VNode + ) } diff --git a/themes/tusimple/src/icons.tsx b/themes/tusimple/src/icons.tsx index 55c3b8535..62fd06818 100644 --- a/themes/tusimple/src/icons.tsx +++ b/themes/tusimple/src/icons.tsx @@ -176,35 +176,35 @@ const toIcon = ( ) function clear (): VNode { - return clearIcon as VNode + return clearIcon } function success (): VNode { - return successIcon as VNode + return successIcon } function warning (): VNode { - return warningIcon as VNode + return warningIcon } function error (): VNode { - return errorIcon as VNode + return errorIcon } function attach (): VNode { - return attachIcon as VNode + return attachIcon } function trash (): VNode { - return trashIcon as VNode + return trashIcon } function cancel (): VNode { - return cancelIcon as VNode + return cancelIcon } function to (): VNode { - return toIcon as VNode + return toIcon } export const icons = {