Merged
Conversation
48c7232 to
5b5018f
Compare
liujuping
reviewed
Nov 10, 2023
| }} | ||
| > | ||
| {icon && createIcon(icon)} | ||
| {icon && createIcon(icon, { key, node })} |
Collaborator
There was a problem hiding this comment.
这里的 node 得用 node.internalToShellNode()
另外,还需要补充一下相关的示例
Contributor
Author
There was a problem hiding this comment.
示例:
// demo.tsx
import React from 'react';
import { Node } from '@alilc/lowcode-designer';
import { Dropdown, Icon } from '@alifd/next';
import store from 'store';
const model = [
{
value: 'option1',
label: '选项1',
},
{
value: ' option2',
label: '选项2',
},
]
import './index.less';
function SettetSwitch(props: any) {
// 该 node 为 createIcon 传入
const { node } = props;
return (
<Dropdown
trigger={<Icon type="switch" size="small" />}
onVisibleChange={() => store.set('setterValue', null)}
triggerType={['hover']}
>
<div>
{model.map((item) => (
<div
className="component-select-item"
onClick={() => {
// 设置物料属性
node?.setPropValue('setter.componentName', item.value);
node?.document?.selection.remove(node.id);
}}
>
{item.label}
</div>
))}
</div>
</Dropdown>
);
}
export default {
name: 'settetSwitch',
content: {
icon: <SettetSwitch />,
title: 'Setter切换',
},
condition: (node: Node) => {
return node.componentMeta?.componentName === 'Setters';
},
important: true,
};
// plugin.tsx
export default async function registerPlugins() {
// 在设计器辅助层增加一个扩展 action
material.addBuiltinComponentAction(setterSelect);
}
Collaborator
|
@Super-Rz 分支指向 develop。 |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2629 +/- ##
=======================================
Coverage 85.04% 85.04%
=======================================
Files 222 222
Lines 8967 8967
Branches 2111 2111
=======================================
Hits 7626 7626
Misses 1248 1248
Partials 93 93 ☔ View full report in Codecov by Sentry. |
JackLian
pushed a commit
that referenced
this pull request
Nov 16, 2023
* fix: createIcon props * fix: createIcon props
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
addBuiltinComponentAction中icon的dom无法获取node节点,建议在 createAction中的 createIcon 补充 key,node参数
issuesId:#2622