From 52d0712577ca318597c339be561ca9bffffe2452 Mon Sep 17 00:00:00 2001 From: lizw-2015 <1183409807@qq.com> Date: Mon, 9 Jun 2025 10:18:42 +0800 Subject: [PATCH 1/2] =?UTF-8?q?refactor(charger,=20clx,=20ptr):=20?= =?UTF-8?q?=E9=87=8D=E6=9E=84=E5=85=85=E7=94=B5=E5=99=A8=E3=80=81CLX?= =?UTF-8?q?=E3=80=81PTR=20=E6=A8=A1=E5=9D=97=E7=9A=84=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除 ChargerMeta、ClxMeta、PtrMeta 文件 - 新增 ChargerPropertySetter、ClxPropertySetter 文件 - 更新 index.ts 文件,使用新的 propertySetter 配置 - 统一属性设置格式,提高代码可维护性 --- src/modules/charger/ChargerMeta.ts | 49 ---------------------------- src/modules/charger/ChargerPropertySetter.ts | 20 ++++++++++++ src/modules/charger/index.ts | 12 +++---- src/modules/clx/ClxMeta.ts | 49 ---------------------------- src/modules/clx/ClxPropertySetter.ts | 20 ++++++++++++ src/modules/clx/index.ts | 12 +++---- src/modules/ptr/PtrMeta.ts | 49 ---------------------------- 7 files changed, 52 insertions(+), 159 deletions(-) delete mode 100644 src/modules/charger/ChargerMeta.ts create mode 100644 src/modules/charger/ChargerPropertySetter.ts delete mode 100644 src/modules/clx/ClxMeta.ts create mode 100644 src/modules/clx/ClxPropertySetter.ts delete mode 100644 src/modules/ptr/PtrMeta.ts diff --git a/src/modules/charger/ChargerMeta.ts b/src/modules/charger/ChargerMeta.ts deleted file mode 100644 index cbf8f74..0000000 --- a/src/modules/charger/ChargerMeta.ts +++ /dev/null @@ -1,49 +0,0 @@ -import type { IMeta } from '@/core/base/IMeta.ts' - -export default [ - { field: 'uuid', editor: 'UUID', label: 'uuid', readonly: true, category: 'basic' }, - { field: 'name', editor: 'TextInput', label: '名称', category: 'basic' }, - { field: 'dt.label', editor: 'TextInput', label: '标签', category: 'basic' }, - { editor: 'TransformEditor', category: 'basic' }, - { field: 'dt.color', editor: 'Color', label: '颜色', category: 'basic' }, - { editor: '-', category: 'basic' }, - - { field: 'dt.chargerWidth', editor: 'NumberInput', label: '充电桩宽度', category: 'basic' }, - { field: 'dt.chargerDepth', editor: 'NumberInput', label: '充电桩深度', category: 'basic' }, - /** - * dt.bays 5列3层货架示例 - * { - * dt: { - * rackDepth: 1.1, // 货架深度 - * levelCount: 3, // 总层数 - * bayCount: 5, // 总列数 - * hideFloor: false, // 隐藏底板 - * extendColumns: true, // 扩展挡板 - * columnSpacing: 1, // 支脚跨越 - * bays: [ // 每列的配置 - * { - * bayWidth: 1.6, // 列的宽度 - * levelHeight: [ 1.4, 1.4, 1.4 ] // 每层的高度 - * }, - * {bayWidth: 1.6, levelHeight: [ 1.4, 1.4, 1.4 ]}, - * {bayWidth: 1.6, levelHeight: [ 1.4, 1.4, 1.4 ]}, - * {bayWidth: 1.6, levelHeight: [ 1.4, 1.4, 1.4 ]}, - * {bayWidth: 1.6, levelHeight: [ 1.4, 1.4, 1.4 ]}, - * ] - * } - * } - * - * - * - * - * - * - * - */ - - - { field: 'tf', editor: 'InOutCenterEditor', category: 'basic' }, - { field: 'dt.selectable', editor: 'Switch', label: '可选中', category: 'basic' }, - { field: 'dt.protected', editor: 'Switch', label: '受保护', category: 'basic' }, - { field: 'visible', editor: 'Switch', label: '可见', category: 'basic' } -] as IMeta diff --git a/src/modules/charger/ChargerPropertySetter.ts b/src/modules/charger/ChargerPropertySetter.ts new file mode 100644 index 0000000..ec222bc --- /dev/null +++ b/src/modules/charger/ChargerPropertySetter.ts @@ -0,0 +1,20 @@ +import type { PropertySetter } from "@/core/base/PropertyTypes.ts"; +import { basicFieldsSetter } from "@/editor/widgets/property/PropertyPanelConstant.ts"; + +const propertySetter: PropertySetter = { + flatten: { + fields: [ + ...basicFieldsSetter, + { + dataPath: 'dt.chargerWidth', label: '充电桩宽度', input: 'InputNumber', + inputProps: {}, + }, + { + dataPath: 'dt.chargerDepth', label: '充电桩深度', input: 'InputNumber', + inputProps: {}, + }, + ], + }, +}; + +export default propertySetter; diff --git a/src/modules/charger/index.ts b/src/modules/charger/index.ts index 1085ad5..3a29a70 100644 --- a/src/modules/charger/index.ts +++ b/src/modules/charger/index.ts @@ -1,15 +1,15 @@ import { defineModule } from '@/core/manager/ModuleManager.ts' import ChargerRenderer from './ChargerRenderer.ts' import ChargerEntity from './ChargerEntity.ts' -import ChargerMeta from './ChargerMeta.ts' import ChargerInteraction from './ChargerInteraction.ts' +import propertySetter from "@/modules/charger/ChargerPropertySetter.ts"; export const ITEM_TYPE_NAME = 'charger' export default defineModule({ - name: ITEM_TYPE_NAME, - renderer: new ChargerRenderer(ITEM_TYPE_NAME), - interaction: new ChargerInteraction(ITEM_TYPE_NAME), - meta: ChargerMeta, - entity: ChargerEntity + name: ITEM_TYPE_NAME, + renderer: new ChargerRenderer(ITEM_TYPE_NAME), + interaction: new ChargerInteraction(ITEM_TYPE_NAME), + setter: propertySetter, + entity: ChargerEntity, }) diff --git a/src/modules/clx/ClxMeta.ts b/src/modules/clx/ClxMeta.ts deleted file mode 100644 index 24ad4fc..0000000 --- a/src/modules/clx/ClxMeta.ts +++ /dev/null @@ -1,49 +0,0 @@ -import type { IMeta } from '@/core/base/IMeta.ts' - -export default [ - { field: 'uuid', editor: 'UUID', label: 'uuid', readonly: true, category: 'basic' }, - { field: 'name', editor: 'TextInput', label: '名称', category: 'basic' }, - { field: 'dt.label', editor: 'TextInput', label: '标签', category: 'basic' }, - { editor: 'TransformEditor', category: 'basic' }, - { field: 'dt.color', editor: 'Color', label: '颜色', category: 'basic' }, - { editor: '-', category: 'basic' }, - - { field: 'dt.clxWidth', editor: 'NumberInput', label: 'CLX宽度', category: 'basic' }, - { field: 'dt.clxDepth', editor: 'NumberInput', label: 'CLX深度', category: 'basic' }, - /** - * dt.bays 5列3层货架示例 - * { - * dt: { - * rackDepth: 1.1, // 货架深度 - * levelCount: 3, // 总层数 - * bayCount: 5, // 总列数 - * hideFloor: false, // 隐藏底板 - * extendColumns: true, // 扩展挡板 - * columnSpacing: 1, // 支脚跨越 - * bays: [ // 每列的配置 - * { - * bayWidth: 1.6, // 列的宽度 - * levelHeight: [ 1.4, 1.4, 1.4 ] // 每层的高度 - * }, - * {bayWidth: 1.6, levelHeight: [ 1.4, 1.4, 1.4 ]}, - * {bayWidth: 1.6, levelHeight: [ 1.4, 1.4, 1.4 ]}, - * {bayWidth: 1.6, levelHeight: [ 1.4, 1.4, 1.4 ]}, - * {bayWidth: 1.6, levelHeight: [ 1.4, 1.4, 1.4 ]}, - * ] - * } - * } - * - * - * - * - * - * - * - */ - - - { field: 'tf', editor: 'InOutCenterEditor', category: 'basic' }, - { field: 'dt.selectable', editor: 'Switch', label: '可选中', category: 'basic' }, - { field: 'dt.protected', editor: 'Switch', label: '受保护', category: 'basic' }, - { field: 'visible', editor: 'Switch', label: '可见', category: 'basic' } -] as IMeta diff --git a/src/modules/clx/ClxPropertySetter.ts b/src/modules/clx/ClxPropertySetter.ts new file mode 100644 index 0000000..5390c94 --- /dev/null +++ b/src/modules/clx/ClxPropertySetter.ts @@ -0,0 +1,20 @@ +import type { PropertySetter } from "@/core/base/PropertyTypes.ts"; +import { basicFieldsSetter } from "@/editor/widgets/property/PropertyPanelConstant.ts"; + +const propertySetter: PropertySetter = { + flatten: { + fields: [ + ...basicFieldsSetter, + { + dataPath: 'dt.clxWidth', label: 'CLX宽度', input: 'InputNumber', + inputProps: {}, + }, + { + dataPath: 'dt.clxDepth', label: 'CLX深度', input: 'InputNumber', + inputProps: {}, + }, + ], + }, +}; + +export default propertySetter; diff --git a/src/modules/clx/index.ts b/src/modules/clx/index.ts index 6e816eb..2c45f6c 100644 --- a/src/modules/clx/index.ts +++ b/src/modules/clx/index.ts @@ -1,15 +1,15 @@ import { defineModule } from '@/core/manager/ModuleManager.ts' import ClxRenderer from './ClxRenderer.ts' import ClxEntity from './ClxEntity.ts' -import ClxMeta from './ClxMeta.ts' import ClxInteraction from './ClxInteraction.ts' +import propertySetter from "@/modules/clx/ClxPropertySetter.ts"; export const ITEM_TYPE_NAME = 'clx' export default defineModule({ - name: ITEM_TYPE_NAME, - renderer: new ClxRenderer(ITEM_TYPE_NAME), - interaction: new ClxInteraction(ITEM_TYPE_NAME), - meta: ClxMeta, - entity: ClxEntity + name: ITEM_TYPE_NAME, + renderer: new ClxRenderer(ITEM_TYPE_NAME), + interaction: new ClxInteraction(ITEM_TYPE_NAME), + setter: propertySetter, + entity: ClxEntity }) diff --git a/src/modules/ptr/PtrMeta.ts b/src/modules/ptr/PtrMeta.ts deleted file mode 100644 index 4fede36..0000000 --- a/src/modules/ptr/PtrMeta.ts +++ /dev/null @@ -1,49 +0,0 @@ -import type { IMeta } from '@/core/base/IMeta.ts' - -export default [ - { field: 'uuid', editor: 'UUID', label: 'uuid', readonly: true, category: 'basic' }, - { field: 'name', editor: 'TextInput', label: '名称', category: 'basic' }, - { field: 'dt.label', editor: 'TextInput', label: '标签', category: 'basic' }, - { editor: 'TransformEditor', category: 'basic' }, - { field: 'dt.color', editor: 'Color', label: '颜色', category: 'basic' }, - { editor: '-', category: 'basic' }, - - { field: 'dt.ptrWidth', editor: 'NumberInput', label: 'PTR宽度', category: 'basic' }, - { field: 'dt.ptrDepth', editor: 'NumberInput', label: 'PTR深度', category: 'basic' }, - /** - * dt.bays 5列3层货架示例 - * { - * dt: { - * rackDepth: 1.1, // 货架深度 - * levelCount: 3, // 总层数 - * bayCount: 5, // 总列数 - * hideFloor: false, // 隐藏底板 - * extendColumns: true, // 扩展挡板 - * columnSpacing: 1, // 支脚跨越 - * bays: [ // 每列的配置 - * { - * bayWidth: 1.6, // 列的宽度 - * levelHeight: [ 1.4, 1.4, 1.4 ] // 每层的高度 - * }, - * {bayWidth: 1.6, levelHeight: [ 1.4, 1.4, 1.4 ]}, - * {bayWidth: 1.6, levelHeight: [ 1.4, 1.4, 1.4 ]}, - * {bayWidth: 1.6, levelHeight: [ 1.4, 1.4, 1.4 ]}, - * {bayWidth: 1.6, levelHeight: [ 1.4, 1.4, 1.4 ]}, - * ] - * } - * } - * - * - * - * - * - * - * - */ - - - { field: 'tf', editor: 'InOutCenterEditor', category: 'basic' }, - { field: 'dt.selectable', editor: 'Switch', label: '可选中', category: 'basic' }, - { field: 'dt.protected', editor: 'Switch', label: '受保护', category: 'basic' }, - { field: 'visible', editor: 'Switch', label: '可见', category: 'basic' } -] as IMeta From 3d77b7492f223d9609889a9548199073ecc52b35 Mon Sep 17 00:00:00 2001 From: lizw-2015 <1183409807@qq.com> Date: Mon, 9 Jun 2025 16:01:41 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat(editor):=20=E6=B7=BB=E5=8A=A0=20InOutC?= =?UTF-8?q?enterEditor=20=E7=BB=84=E4=BB=B6=E5=B9=B6=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 InOutCenterEditor 组件,用于编辑输入、输出和中心端口 - 在 PropertyPanelConstant 中注册 InOutCenterEditor 组件 - 更新 TransformEditor 组件,注释掉调试日志 - 新增 flex 布局相关 CSS 类 --- src/base.css | 43 ++++ src/editor/propEditors/InOutCenterEditor.vue | 282 +++++++++++++++++++++ .../widgets/property/PropertyPanelConstant.ts | 11 +- 3 files changed, 331 insertions(+), 5 deletions(-) create mode 100644 src/editor/propEditors/InOutCenterEditor.vue diff --git a/src/base.css b/src/base.css index f521ca7..399e6ac 100644 --- a/src/base.css +++ b/src/base.css @@ -382,3 +382,46 @@ body { opacity: 1; } } + +/** flex多行容器 */ +.flex-column-container { + display: flex; + flex-direction: column; + flex-wrap: nowrap; +} + +/** flex多列容器 */ +.flex-row-container { + display: flex; + flex-direction: row; + flex-wrap: nowrap; +} + +/** flex自动填充 */ +.flex-item-fill { + flex-grow: 1; + overflow: hidden; +} + +/** flex固定大小 */ +.flex-item-fixed { + flex-shrink: 0; +} + +/** flex主轴上对齐方式 */ +.flex-justify-content-center { + justify-content: center; +} + +/** flex交叉轴上对齐方式 */ +.flex-align-items-center { + align-items: center; +} + +/** 内容居中 */ +.content-center { + display: flex; + align-items: center; + justify-content: center; +} + diff --git a/src/editor/propEditors/InOutCenterEditor.vue b/src/editor/propEditors/InOutCenterEditor.vue new file mode 100644 index 0000000..73a96c3 --- /dev/null +++ b/src/editor/propEditors/InOutCenterEditor.vue @@ -0,0 +1,282 @@ + + + + + diff --git a/src/editor/widgets/property/PropertyPanelConstant.ts b/src/editor/widgets/property/PropertyPanelConstant.ts index f713f55..9197a78 100644 --- a/src/editor/widgets/property/PropertyPanelConstant.ts +++ b/src/editor/widgets/property/PropertyPanelConstant.ts @@ -3,6 +3,7 @@ import type { DataFormProps } from "@/components/data-form/DataFormTypes.ts"; import type { PropertyFieldSetter } from "@/core/base/PropertyTypes.ts"; import { dataFormInputComponents } from "@/components/data-form/DataFormConstant.ts"; import TransformEditor from "@/editor/propEditors/TransformEditor.vue"; +import InOutCenterEditor from "@/editor/propEditors/InOutCenterEditor.vue"; const defDataFormProps: DataFormProps = { columnCount: 1, @@ -12,6 +13,7 @@ const defDataFormProps: DataFormProps = { }; dataFormInputComponents.TransformEditor = markRaw(TransformEditor); +dataFormInputComponents.InOutCenterEditor = markRaw(InOutCenterEditor); const basicFieldsSetter: Array = [ { @@ -48,11 +50,10 @@ const basicFieldsSetter: Array = [ dataPath: 'tf', input: 'TransformEditor', inputProps: {}, }, - // { - // dataPath: 'dt', input: 'InOutCenterEditor', - // inputProps: { - // }, - // }, + { + dataPath: 'dt', input: 'InOutCenterEditor', + inputProps: {}, + }, ];