style: lint format
parent
37d35f7801
commit
5b583962db
|
@ -71,6 +71,7 @@ const getSlots = ele => {
|
|||
return { ...slots, ...getScopedSlots(ele) };
|
||||
};
|
||||
|
||||
export const skipFlattenKey = Symbol('skipFlatten');
|
||||
const flattenChildren = (children = [], filterEmpty = true) => {
|
||||
const temp = Array.isArray(children) ? children : [children];
|
||||
const res = [];
|
||||
|
@ -78,7 +79,7 @@ const flattenChildren = (children = [], filterEmpty = true) => {
|
|||
if (Array.isArray(child)) {
|
||||
res.push(...flattenChildren(child, filterEmpty));
|
||||
} else if (child && child.type === Fragment) {
|
||||
if (child.props && child.props.skipFlatten) {
|
||||
if (child.key === skipFlattenKey) {
|
||||
res.push(child);
|
||||
} else {
|
||||
res.push(...flattenChildren(child.children, filterEmpty));
|
||||
|
|
|
@ -11,7 +11,7 @@ export default defineComponent({
|
|||
useProvideRadioOptionTypeContext('button');
|
||||
return () => {
|
||||
return (
|
||||
<Radio {...props} prefixCls={prefixCls.value} type="radio">
|
||||
<Radio {...props} prefixCls={prefixCls.value}>
|
||||
{slots.default?.()}
|
||||
</Radio>
|
||||
);
|
||||
|
|
|
@ -50,7 +50,6 @@ export const listItemProps = () => {
|
|||
};
|
||||
|
||||
export type ListItemProps = Partial<ExtractPropTypes<ReturnType<typeof listItemProps>>>;
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ListItem',
|
||||
inheritAttrs: false,
|
||||
|
@ -110,7 +109,7 @@ export default defineComponent({
|
|||
src={file.thumbUrl || file.url}
|
||||
alt={file.name}
|
||||
class={`${prefixCls}-list-item-image`}
|
||||
crossOrigin={file.crossOrigin}
|
||||
crossorigin={file.crossOrigin}
|
||||
/>
|
||||
) : (
|
||||
iconNode
|
||||
|
|
|
@ -4,7 +4,7 @@ import type {
|
|||
} from '../vc-upload/interface';
|
||||
import type { ProgressProps } from '../progress';
|
||||
import type { VueNode } from '../_util/type';
|
||||
import type { ExtractPropTypes, PropType, CSSProperties } from 'vue';
|
||||
import type { ExtractPropTypes, PropType, CSSProperties, ImgHTMLAttributes } from 'vue';
|
||||
|
||||
export interface FileType extends OriRcFile {
|
||||
readonly lastModifiedDate: Date;
|
||||
|
@ -27,7 +27,7 @@ export interface UploadFile<T = any> {
|
|||
status?: UploadFileStatus;
|
||||
percent?: number;
|
||||
thumbUrl?: string;
|
||||
crossOrigin?: HTMLImageElement['crossOrigin'];
|
||||
crossOrigin?: ImgHTMLAttributes['crossorigin'];
|
||||
originFileObj?: FileType;
|
||||
response?: T;
|
||||
error?: any;
|
||||
|
|
|
@ -5,6 +5,7 @@ import Trigger from '../vc-trigger';
|
|||
import placements from './placements';
|
||||
import { cloneElement } from '../_util/vnode';
|
||||
import classNames from '../_util/classNames';
|
||||
import { skipFlattenKey } from '../_util/props-util';
|
||||
|
||||
export default defineComponent({
|
||||
props: {
|
||||
|
@ -72,7 +73,7 @@ export default defineComponent({
|
|||
getPopupContainer: () => triggerRef.value.getPopupDomNode(),
|
||||
};
|
||||
return (
|
||||
<Fragment skipFlatten>
|
||||
<Fragment key={skipFlattenKey}>
|
||||
{props.arrow && <div class={`${props.prefixCls}-arrow`} />}
|
||||
{cloneElement(overlayElement, extraOverlayProps, false)}
|
||||
</Fragment>
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import type { CSSProperties } from 'vue';
|
||||
import { defineComponent, ref } from 'vue';
|
||||
import classNames from '../_util/classNames';
|
||||
import type { MouseEventHandler } from '../_util/EventInterface';
|
||||
|
@ -101,7 +102,7 @@ export default defineComponent({
|
|||
element = (
|
||||
<span
|
||||
class={affixWrapperCls}
|
||||
style={attrs.style}
|
||||
style={attrs.style as CSSProperties}
|
||||
hidden={!hasAddon({ addonAfter, addonBefore }) && hidden}
|
||||
onMousedown={onInputMouseDown}
|
||||
ref={containerRef}
|
||||
|
@ -136,7 +137,7 @@ export default defineComponent({
|
|||
// Need another wrapper for changing display:table to display:inline-block
|
||||
// and put style prop in wrapper
|
||||
return (
|
||||
<span class={mergedGroupClassName} style={attrs.style} hidden={hidden}>
|
||||
<span class={mergedGroupClassName} style={attrs.style as CSSProperties} hidden={hidden}>
|
||||
<span class={mergedWrapperClassName}>
|
||||
{addonBefore && <span class={addonCls}>{addonBefore}</span>}
|
||||
{cloneElement(element, { style: null, hidden: null })}
|
||||
|
|
|
@ -30,7 +30,7 @@ import { conductCheck } from '../vc-tree/utils/conductUtil';
|
|||
import { warning } from '../vc-util/warning';
|
||||
import { toReactive } from '../_util/toReactive';
|
||||
import useMaxLevel from '../vc-tree/useMaxLevel';
|
||||
import type { ExpandAction } from '../tree/DirectoryTree';
|
||||
import type { ExpandAction } from '../vc-tree/props';
|
||||
|
||||
export type OnInternalSelect = (value: RawValueType, info: { selected: boolean }) => void;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import type { InjectionKey } from 'vue';
|
||||
import { provide, inject } from 'vue';
|
||||
import type { ExpandAction } from '../tree/DirectoryTree';
|
||||
import type { ExpandAction } from '../vc-tree/props';
|
||||
import type { DefaultOptionType, InternalFieldName, OnInternalSelect } from './TreeSelect';
|
||||
|
||||
export interface TreeSelectContextProps {
|
||||
|
|
|
@ -65,6 +65,7 @@ export default defineComponent({
|
|||
disabled: false,
|
||||
checkStrictly: false,
|
||||
draggable: false,
|
||||
expandAction: false,
|
||||
defaultExpandParent: true,
|
||||
autoExpandParent: false,
|
||||
defaultExpandAll: false,
|
||||
|
@ -617,16 +618,34 @@ export default defineComponent({
|
|||
|
||||
dragNode = null;
|
||||
};
|
||||
const triggerExpandActionExpand: NodeMouseEventHandler = (e, treeNode) => {
|
||||
const { expanded, key } = treeNode;
|
||||
|
||||
const node = flattenNodes.value.filter(nodeItem => nodeItem.key === key)[0];
|
||||
const eventNode = convertNodePropsToEventData({
|
||||
...getTreeNodeProps(key, treeNodeRequiredProps.value),
|
||||
data: node.data,
|
||||
});
|
||||
setExpandedKeys(expanded ? arrDel(expandedKeys.value, key) : arrAdd(expandedKeys.value, key));
|
||||
|
||||
onNodeExpand(e, eventNode);
|
||||
};
|
||||
|
||||
const onNodeClick: NodeMouseEventHandler = (e, treeNode) => {
|
||||
const { onClick } = props;
|
||||
const { onClick, expandAction } = props;
|
||||
if (expandAction === 'click') {
|
||||
triggerExpandActionExpand(e, treeNode);
|
||||
}
|
||||
if (onClick) {
|
||||
onClick(e, treeNode);
|
||||
}
|
||||
};
|
||||
|
||||
const onNodeDoubleClick: NodeMouseEventHandler = (e, treeNode) => {
|
||||
const { onDblclick } = props;
|
||||
const { onDblclick, expandAction } = props;
|
||||
if (expandAction === 'doubleclick' || expandAction === 'dblclick') {
|
||||
triggerExpandActionExpand(e, treeNode);
|
||||
}
|
||||
if (onDblclick) {
|
||||
onDblclick(e, treeNode);
|
||||
}
|
||||
|
@ -1107,6 +1126,8 @@ export default defineComponent({
|
|||
onContextmenu,
|
||||
onScroll,
|
||||
direction,
|
||||
rootClassName,
|
||||
rootStyle,
|
||||
} = props;
|
||||
|
||||
const { class: className, style } = attrs;
|
||||
|
@ -1179,11 +1200,12 @@ export default defineComponent({
|
|||
>
|
||||
<div
|
||||
role="tree"
|
||||
class={classNames(prefixCls, className, {
|
||||
class={classNames(prefixCls, className, rootClassName, {
|
||||
[`${prefixCls}-show-line`]: showLine,
|
||||
[`${prefixCls}-focused`]: focused.value,
|
||||
[`${prefixCls}-active-focused`]: activeKey.value !== null,
|
||||
})}
|
||||
style={rootStyle}
|
||||
>
|
||||
<NodeList
|
||||
ref={listRef}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// base rc-tree 5.4.4
|
||||
// base rc-tree 5.6.3
|
||||
import type { TreeProps, TreeNodeProps } from './props';
|
||||
import Tree from './Tree';
|
||||
import TreeNode from './TreeNode';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { ExtractPropTypes, PropType } from 'vue';
|
||||
import type { CSSProperties, ExtractPropTypes, PropType } from 'vue';
|
||||
import type { BasicDataNode } from '.';
|
||||
import type { EventHandler } from '../_util/EventInterface';
|
||||
import PropTypes from '../_util/vue-types';
|
||||
|
@ -110,6 +110,7 @@ export type AllowDrop<TreeDataType extends BasicDataNode = DataNode> = (
|
|||
) => boolean;
|
||||
|
||||
export type DraggableFn = (node: DataNode) => boolean;
|
||||
export type ExpandAction = false | 'click' | 'doubleclick' | 'dblclick';
|
||||
export const treeProps = () => ({
|
||||
prefixCls: String,
|
||||
focusable: { type: Boolean, default: undefined },
|
||||
|
@ -125,6 +126,7 @@ export const treeProps = () => ({
|
|||
showIcon: { type: Boolean, default: undefined },
|
||||
icon: PropTypes.any,
|
||||
selectable: { type: Boolean, default: undefined },
|
||||
expandAction: [String, Boolean] as PropType<ExpandAction>,
|
||||
disabled: { type: Boolean, default: undefined },
|
||||
multiple: { type: Boolean, default: undefined },
|
||||
checkable: { type: Boolean, default: undefined },
|
||||
|
@ -203,7 +205,7 @@ export const treeProps = () => ({
|
|||
) => void
|
||||
>,
|
||||
},
|
||||
loadData: { type: Function as PropType<(treeNode: EventDataNode) => Promise<void>> },
|
||||
loadData: { type: Function as PropType<(treeNode: EventDataNode) => Promise<any>> },
|
||||
loadedKeys: { type: Array as PropType<Key[]> },
|
||||
onMouseenter: { type: Function as PropType<(info: NodeMouseEventParams) => void> },
|
||||
onMouseleave: { type: Function as PropType<(info: NodeMouseEventParams) => void> },
|
||||
|
@ -245,6 +247,9 @@ export const treeProps = () => ({
|
|||
|
||||
// direction for drag logic
|
||||
direction: { type: String as PropType<Direction> },
|
||||
|
||||
rootClassName: String,
|
||||
rootStyle: Object as PropType<CSSProperties>,
|
||||
});
|
||||
|
||||
export type TreeProps = Partial<ExtractPropTypes<ReturnType<typeof treeProps>>>;
|
||||
|
|
Loading…
Reference in New Issue