mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-14 21:12:53 +00:00
fix click select
This commit is contained in:
parent
ab5bad582e
commit
33ea4d3803
@ -260,8 +260,6 @@ export class SimulatorHost implements ISimulator<SimulatorProps> {
|
||||
if (isLeftButton && !isRootNode(node)) {
|
||||
let nodes: Node[] = [node];
|
||||
let ignoreUpSelected = false;
|
||||
// 排除根节点拖拽
|
||||
selection.remove(this.document.rootNode.id);
|
||||
if (isMulti) {
|
||||
// multi select mode, directily add
|
||||
if (!selection.has(node.id)) {
|
||||
@ -269,9 +267,10 @@ export class SimulatorHost implements ISimulator<SimulatorProps> {
|
||||
selection.add(node.id);
|
||||
ignoreUpSelected = true;
|
||||
}
|
||||
selection.remove(this.document.rootNode.id);
|
||||
// 获得顶层 nodes
|
||||
nodes = selection.getTopNodes();
|
||||
} else if (selection.containsNode(node)) {
|
||||
} else if (selection.containsNode(node, true)) {
|
||||
nodes = selection.getTopNodes();
|
||||
} else {
|
||||
// will clear current selection & select dragment in dragstart
|
||||
|
||||
@ -97,9 +97,12 @@ export class Selection {
|
||||
/**
|
||||
* 选区是否包含节点
|
||||
*/
|
||||
containsNode(node: Node) {
|
||||
containsNode(node: Node, excludeRoot = false) {
|
||||
for (const id of this._selected) {
|
||||
const parent = this.doc.getNode(id);
|
||||
if (excludeRoot && parent === this.doc.rootNode) {
|
||||
continue;
|
||||
}
|
||||
if (parent?.contains(node)) {
|
||||
return true;
|
||||
}
|
||||
@ -124,11 +127,12 @@ export class Selection {
|
||||
/**
|
||||
* 获取顶层选区节点, 场景:拖拽时,建立蒙层,只蒙在最上层
|
||||
*/
|
||||
getTopNodes() {
|
||||
getTopNodes(includeRoot = false) {
|
||||
const nodes = [];
|
||||
for (const id of this._selected) {
|
||||
const node = this.doc.getNode(id);
|
||||
if (!node) {
|
||||
// 排除根节点
|
||||
if (!node || (!includeRoot && node === this.doc.rootNode)) {
|
||||
continue;
|
||||
}
|
||||
let i = nodes.length;
|
||||
|
||||
@ -28,6 +28,10 @@ export default {
|
||||
name: 'type',
|
||||
propType: 'string'
|
||||
},
|
||||
{
|
||||
name: 'onClick',
|
||||
propType: 'func'
|
||||
},
|
||||
{
|
||||
name: 'children',
|
||||
propType: 'string'
|
||||
@ -66,6 +70,22 @@ export default {
|
||||
{
|
||||
name: 'placeholder',
|
||||
propType: 'string'
|
||||
},
|
||||
{
|
||||
name: 'onChange',
|
||||
propType: 'func'
|
||||
},
|
||||
{
|
||||
name: 'onKeyDown',
|
||||
propType: 'func'
|
||||
},
|
||||
{
|
||||
name: 'onFocus',
|
||||
propType: 'func'
|
||||
},
|
||||
{
|
||||
name: 'onBlur',
|
||||
propType: 'func'
|
||||
}
|
||||
],
|
||||
},
|
||||
@ -83,7 +103,11 @@ export default {
|
||||
{
|
||||
name: 'device',
|
||||
propType: 'string'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'onChange',
|
||||
propType: 'func'
|
||||
},
|
||||
],
|
||||
},
|
||||
'Form.Item': {
|
||||
@ -126,6 +150,26 @@ export default {
|
||||
{
|
||||
name: 'defaultValue',
|
||||
propType: 'number'
|
||||
},
|
||||
{
|
||||
name: 'onChange',
|
||||
propType: 'func'
|
||||
},
|
||||
{
|
||||
name: 'onKeyDown',
|
||||
propType: 'func'
|
||||
},
|
||||
{
|
||||
name: 'onFocus',
|
||||
propType: 'func'
|
||||
},
|
||||
{
|
||||
name: 'onBlur',
|
||||
propType: 'func'
|
||||
},
|
||||
{
|
||||
name: 'onCorrect',
|
||||
propType: 'func'
|
||||
}
|
||||
],
|
||||
},
|
||||
@ -151,6 +195,38 @@ export default {
|
||||
{
|
||||
name: 'placeholder',
|
||||
propType: 'string'
|
||||
},
|
||||
{
|
||||
name: 'onChange',
|
||||
propType: 'func'
|
||||
},
|
||||
{
|
||||
name: 'onVisibleChange',
|
||||
propType: 'func'
|
||||
},
|
||||
{
|
||||
name: 'onToggleHighlightItem',
|
||||
propType: 'func'
|
||||
},
|
||||
{
|
||||
name: 'onSearch',
|
||||
propType: 'func'
|
||||
},
|
||||
{
|
||||
name: 'onSearchClear',
|
||||
propType: 'func'
|
||||
},
|
||||
{
|
||||
name: 'onRemove',
|
||||
propType: 'func'
|
||||
},
|
||||
{
|
||||
name: 'onFocus',
|
||||
propType: 'func'
|
||||
},
|
||||
{
|
||||
name: 'onBlur',
|
||||
propType: 'func'
|
||||
}
|
||||
],
|
||||
}
|
||||
|
||||
@ -191,6 +191,7 @@ registerMetadataTransducer(metadata => {
|
||||
if (EVENT_RE.test(name) && (propType === 'func' || propType === 'any')) {
|
||||
if (supportEvents) {
|
||||
supportEvents.push(name);
|
||||
(events as any).supportEvents = supportEvents;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user