diff --git a/packages/form/src/containers/Container.vue b/packages/form/src/containers/Container.vue
index 536bc7a57..36150854a 100644
--- a/packages/form/src/containers/Container.vue
+++ b/packages/form/src/containers/Container.vue
@@ -2,6 +2,7 @@
diff --git a/packages/stage/src/ActionManager.ts b/packages/stage/src/ActionManager.ts
index 97c33ff76..0bda62698 100644
--- a/packages/stage/src/ActionManager.ts
+++ b/packages/stage/src/ActionManager.ts
@@ -181,7 +181,7 @@ export default class ActionManager extends EventEmitter {
return el.id === this.selectedEl?.id;
}
- public setSelectedEl(el: HTMLElement): void {
+ public setSelectedEl(el?: HTMLElement): void {
this.selectedEl = el;
}
@@ -258,7 +258,7 @@ export default class ActionManager extends EventEmitter {
}
public select(el: HTMLElement, event: MouseEvent | undefined): void {
- this.selectedEl = el;
+ this.setSelectedEl(el);
this.clearSelectStatus(SelectStatus.MULTI_SELECT);
this.dr.select(el, event);
}
@@ -399,7 +399,7 @@ export default class ActionManager extends EventEmitter {
// 如果已有单选选中元素,不是magic-ui-page就可以加入多选列表
if (this.selectedEl && !this.selectedEl.className.includes(PAGE_CLASS)) {
this.selectedElList.push(this.selectedEl as HTMLElement);
- this.selectedEl = undefined;
+ this.setSelectedEl(undefined);
}
// 判断元素是否已在多选列表
const existIndex = this.selectedElList.findIndex((selectedDom) => selectedDom.id === el.id);
diff --git a/packages/stage/src/StageRender.ts b/packages/stage/src/StageRender.ts
index ffc541ce3..bebd19a6e 100644
--- a/packages/stage/src/StageRender.ts
+++ b/packages/stage/src/StageRender.ts
@@ -156,12 +156,6 @@ export default class StageRender extends EventEmitter {
x = x - rect.left;
y = y - rect.top;
}
- } else if (this.nativeContainer) {
- const rect = this.nativeContainer.getClientRects()[0];
- if (rect) {
- x = x - rect.left;
- y = y - rect.top;
- }
}
return this.getDocument()?.elementsFromPoint(x / this.zoom, y / this.zoom) as HTMLElement[];
diff --git a/playground/src/configs/form-config/checkbox.ts b/playground/src/configs/form-config/checkbox.ts
new file mode 100644
index 000000000..1902bf2f1
--- /dev/null
+++ b/playground/src/configs/form-config/checkbox.ts
@@ -0,0 +1,3 @@
+import type { FormConfig } from '@tmagic/form';
+
+export default [] as FormConfig;
diff --git a/playground/src/configs/form-config/common.ts b/playground/src/configs/form-config/common.ts
new file mode 100644
index 000000000..49af25fe7
--- /dev/null
+++ b/playground/src/configs/form-config/common.ts
@@ -0,0 +1,27 @@
+import type { FormConfig } from '@tmagic/form';
+
+export default [
+ {
+ name: 'id',
+ type: 'hidden',
+ },
+ {
+ name: 'type',
+ type: 'hidden',
+ },
+ {
+ name: 'name',
+ text: '表单key',
+ extra: '字段名',
+ },
+ {
+ name: 'text',
+ text: '标签文本',
+ extra: 'label 标签的文本',
+ },
+ {
+ name: 'labelWidth',
+ text: '标签宽度',
+ extra: '表单域标签的的宽度,例如 "50px"。支持 auto。',
+ },
+] as FormConfig;
diff --git a/playground/src/configs/form-config/display.ts b/playground/src/configs/form-config/display.ts
new file mode 100644
index 000000000..1902bf2f1
--- /dev/null
+++ b/playground/src/configs/form-config/display.ts
@@ -0,0 +1,3 @@
+import type { FormConfig } from '@tmagic/form';
+
+export default [] as FormConfig;
diff --git a/playground/src/configs/form-config/index.ts b/playground/src/configs/form-config/index.ts
new file mode 100644
index 000000000..439c6a663
--- /dev/null
+++ b/playground/src/configs/form-config/index.ts
@@ -0,0 +1,13 @@
+import checkbox from './checkbox';
+import display from './display';
+import number from './number';
+import switchConfig from './switch';
+import text from './text';
+
+export default {
+ text,
+ checkbox,
+ display,
+ number,
+ switch: switchConfig,
+};
diff --git a/playground/src/configs/form-config/number.ts b/playground/src/configs/form-config/number.ts
new file mode 100644
index 000000000..3cbf5e6da
--- /dev/null
+++ b/playground/src/configs/form-config/number.ts
@@ -0,0 +1,23 @@
+import type { FormConfig } from '@tmagic/form';
+
+export default [
+ {
+ type: 'number',
+ name: 'min',
+ text: '最小值',
+ },
+ {
+ type: 'number',
+ name: 'max',
+ text: '最大值',
+ },
+ {
+ type: 'number',
+ name: 'step',
+ text: '步数',
+ },
+ {
+ name: 'placeholder',
+ text: 'placeholder',
+ },
+] as FormConfig;
diff --git a/playground/src/configs/form-config/switch.ts b/playground/src/configs/form-config/switch.ts
new file mode 100644
index 000000000..1902bf2f1
--- /dev/null
+++ b/playground/src/configs/form-config/switch.ts
@@ -0,0 +1,3 @@
+import type { FormConfig } from '@tmagic/form';
+
+export default [] as FormConfig;
diff --git a/playground/src/configs/form-config/text.ts b/playground/src/configs/form-config/text.ts
new file mode 100644
index 000000000..4bd3e2ea6
--- /dev/null
+++ b/playground/src/configs/form-config/text.ts
@@ -0,0 +1,26 @@
+import type { FormConfig } from '@tmagic/form';
+
+export default [
+ {
+ name: 'placeholder',
+ text: 'placeholder',
+ },
+ {
+ name: 'append',
+ legend: '后置按钮',
+ type: 'fieldset',
+ labelWidth: '80px',
+ items: [
+ {
+ name: 'text',
+ text: '按钮文案',
+ },
+ {
+ name: 'handler',
+ type: 'vs-code',
+ height: '400px',
+ text: '点击',
+ },
+ ],
+ },
+] as FormConfig;
diff --git a/playground/src/pages/Editor.vue b/playground/src/pages/Editor.vue
index 3a9dc4668..3633a5e2b 100644
--- a/playground/src/pages/Editor.vue
+++ b/playground/src/pages/Editor.vue
@@ -43,7 +43,7 @@