plain-design 1.0.0-beta.112 → 1.0.0-beta.113

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plain-design",
3
- "version": "1.0.0-beta.112",
3
+ "version": "1.0.0-beta.113",
4
4
  "description": "",
5
5
  "main": "dist/plain-design.min.js",
6
6
  "module": "dist/plain-design.commonjs.min.js",
@@ -25,6 +25,7 @@ export const RenderPlcTreeNode = designComponent({
25
25
  const { refs, onRef } = useRefs({ el: iHTMLDivElement });
26
26
 
27
27
  const isLeaf = computed(() => props.treeNode.isLeaf());
28
+ const leafIcon = computed(() => props.treeNode.leafIcon());
28
29
  const checkStatus = cacheComputed(() => props.treeNode.checkStatus());
29
30
  const isExpanded = cacheComputed(() => props.treeNode.isExpanded());
30
31
 
@@ -63,7 +64,7 @@ export const RenderPlcTreeNode = designComponent({
63
64
 
64
65
  return () => {
65
66
  const { treeNode, tableNode } = props;
66
- const { leafIcon, folderExpandIcon, folderCollapseIcon } = props.treeCore.props;
67
+ const { folderExpandIcon, folderCollapseIcon } = props.treeCore.props;
67
68
  return (
68
69
  <div className={getComponentCls('plc-tree-node')} ref={onRef.el}>
69
70
  <div className="tree-node-operator">
@@ -74,7 +75,7 @@ export const RenderPlcTreeNode = designComponent({
74
75
  {treeNode.isLoading() ?
75
76
  <Loading type="gamma"/> :
76
77
  <Icon
77
- icon={isLeaf.value || treeNode.empty ? leafIcon : isExpanded.value ? folderExpandIcon : folderCollapseIcon}
78
+ icon={isLeaf.value || treeNode.empty ? leafIcon.value : isExpanded.value ? folderExpandIcon : folderCollapseIcon}
78
79
  />}
79
80
  </div>
80
81
  {props.treeCore.props.multiple && (
@@ -44,6 +44,7 @@ export const RenderTreeNode = designComponent({
44
44
  const checkStatus = cacheComputed(() => props.treeNode.checkStatus());
45
45
  const isExpanded = cacheComputed(() => props.treeNode.isExpanded());
46
46
  const isLeaf = cacheComputed(() => props.treeNode.isLeaf());
47
+ const leafIcon = computed(() => props.treeNode.leafIcon());
47
48
 
48
49
  const connectorClassesList = computed(() => {
49
50
 
@@ -124,7 +125,7 @@ export const RenderTreeNode = designComponent({
124
125
  props.treeNode.isLoading() ?
125
126
  <Loading type="gamma"/> :
126
127
  <Icon
127
- icon={props.treeNode.isLeaf() || props.treeNode.empty ? tree.props.leafIcon : isExpanded.value ? tree.props.folderExpandIcon : tree.props.folderCollapseIcon}
128
+ icon={props.treeNode.isLeaf() || props.treeNode.empty ? leafIcon.value : isExpanded.value ? tree.props.folderExpandIcon : tree.props.folderCollapseIcon}
128
129
  />
129
130
  }
130
131
  </div>
@@ -70,7 +70,7 @@ export interface iTreeProps {
70
70
  /*判断节点是否可以放置*/
71
71
  isAllowDroppable?: (startNode: iTreeNode, moveNode: iTreeNode, dropType: typeof eTreeDropType.TYPE) => boolean | void,
72
72
  /*叶子节点图标*/
73
- leafIcon: string,
73
+ leafIcon: string | ((treeNode: iTreeNode) => string),
74
74
  /*节点收起时显示图标*/
75
75
  folderCollapseIcon: string,
76
76
  /*节点展开时显示的图标*/
@@ -112,6 +112,8 @@ export function createTreeNode(
112
112
  /*默认情况下,没有设置isLeaf来判断节点是否为叶子节点的话,则判断是否存在有子节点数据来判断是否为叶子节点,如果子节点数据是一个空数组也视为非叶子节点*/
113
113
  return !props.isLeaf ? !childrenData() : props.isLeaf(data);
114
114
  };
115
+ /*叶子节点的图标*/
116
+ const leafIcon = () => {return typeof props.leafIcon === "string" ? props.leafIcon : props.leafIcon(data);};
115
117
  /*是否已经选中*/
116
118
  const checkStatus = (): typeof CheckboxStatus.TYPE => getCheckStatus()[key];
117
119
  /*是否可选中*/
@@ -194,6 +196,7 @@ export function createTreeNode(
194
196
  setChildrenData,
195
197
  children,
196
198
  isLeaf,
199
+ leafIcon,
197
200
  checkStatus,
198
201
  isCheckAble,
199
202
  isExpanded,
@@ -225,6 +228,7 @@ export interface iTreeNode {
225
228
  setChildrenData: (childrenData: any[] | null | undefined) => void, // 设置节点子数据
226
229
  children: () => iTreeNode[], // 子节点
227
230
  isLeaf: () => boolean, // 节点是否为叶子节点
231
+ leafIcon: () => string, // 叶子节点的图标
228
232
  checkStatus: () => typeof CheckboxStatus.TYPE, // 节点的选中状态,check选中,uncheck未选中,minus半选
229
233
  isCheckAble: () => boolean, // 节点是否可以选中
230
234
  isExpanded: () => boolean, // 节点是否已经展开