/
Cybran65
/
Project_0
Обзор
Документация
Войти
/
Cybran65
/
Project_0
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
src/data/properties.ts
238 строк
9 KB
Cybran65
style: выравнивание модели, масштаб ленты и векторные иконки
09 авг 2026, 01:10
09 авг 2026, 01:10
9ead2b4
Код
Авторство
О чём код?
import type { DemoElement, PropertyGroup, PropertySheet, TreeNode } from '../types'; import { contourArea } from '../lib/geometry'; /** Свойства объектов проекта. */ const STATUS_OPTIONS = ['В работе', 'На проверке', 'Согласовано', 'Отклонено']; export const PROPERTY_SHEETS: PropertySheet = { project: [ { id: 'common', title: 'Общие', fields: [ { id: 'name', label: 'Название', value: 'Проект «Учебный объект»', type: 'text' }, { id: 'type', label: 'Тип', value: 'Проект', type: 'readonly' }, { id: 'code', label: 'Шифр', value: 'УО-2026-01', type: 'text' }, { id: 'status', label: 'Статус', value: 'В работе', type: 'choice', options: STATUS_OPTIONS }, ], }, { id: 'lifecycle', title: 'Жизненный цикл', fields: [ { id: 'stage', label: 'Стадия', value: 'Проектирование', type: 'readonly' }, { id: 'owner', label: 'Ответственный', value: 'Проектировщик', type: 'readonly' }, { id: 'visible', label: 'Видимость', value: true, type: 'boolean' }, ], }, ], site: [ { id: 'common', title: 'Общие', fields: [ { id: 'name', label: 'Название', value: 'Участок', type: 'text' }, { id: 'type', label: 'Тип', value: 'Участок', type: 'readonly' }, { id: 'level', label: 'Уровень', value: '—', type: 'readonly' }, { id: 'status', label: 'Статус', value: 'В работе', type: 'choice', options: STATUS_OPTIONS }, { id: 'visible', label: 'Видимость', value: true, type: 'boolean' }, ], }, { id: 'geometry', title: 'Геометрия', fields: [ { id: 'area', label: 'Площадь', value: '900,0', type: 'readonly', unit: 'м²' }, { id: 'size', label: 'Габарит', value: '30,0 × 30,0', type: 'readonly', unit: 'м' }, ], }, ], building: [ { id: 'common', title: 'Общие', fields: [ { id: 'name', label: 'Название', value: 'Здание', type: 'text' }, { id: 'type', label: 'Тип', value: 'Здание', type: 'readonly' }, { id: 'level', label: 'Уровень', value: 'Уровень 1 … Крыша', type: 'readonly' }, { id: 'status', label: 'Статус', value: 'На проверке', type: 'choice', options: STATUS_OPTIONS }, { id: 'visible', label: 'Видимость', value: true, type: 'boolean' }, ], }, { id: 'composition', title: 'Состав', fields: [ { id: 'levels', label: 'Уровней', value: '2', type: 'readonly' }, { id: 'height', label: 'Высота', value: '7,2', type: 'readonly', unit: 'м' }, ], }, ], 'level-1': [ { id: 'common', title: 'Общие', fields: [ { id: 'name', label: 'Название', value: 'Уровень 1', type: 'text' }, { id: 'type', label: 'Тип', value: 'Уровень', type: 'readonly' }, { id: 'level', label: 'Уровень', value: 'Уровень 1', type: 'readonly' }, { id: 'status', label: 'Статус', value: 'В работе', type: 'choice', options: STATUS_OPTIONS }, { id: 'visible', label: 'Видимость', value: true, type: 'boolean' }, ], }, { id: 'geometry', title: 'Геометрия', fields: [ { id: 'elevation', label: 'Отметка', value: '+0,000', type: 'text', unit: 'м' }, { id: 'floorHeight', label: 'Высота этажа', value: '3,6', type: 'text', unit: 'м' }, ], }, ], 'level-2': [ { id: 'common', title: 'Общие', fields: [ { id: 'name', label: 'Название', value: 'Уровень 2', type: 'text' }, { id: 'type', label: 'Тип', value: 'Уровень', type: 'readonly' }, { id: 'level', label: 'Уровень', value: 'Уровень 2', type: 'readonly' }, { id: 'status', label: 'Статус', value: 'На проверке', type: 'choice', options: STATUS_OPTIONS }, { id: 'visible', label: 'Видимость', value: true, type: 'boolean' }, ], }, { id: 'geometry', title: 'Геометрия', fields: [ { id: 'elevation', label: 'Отметка', value: '+3,600', type: 'text', unit: 'м' }, { id: 'floorHeight', label: 'Высота этажа', value: '3,6', type: 'text', unit: 'м' }, ], }, ], roof: [ { id: 'common', title: 'Общие', fields: [ { id: 'name', label: 'Название', value: 'Крыша', type: 'text' }, { id: 'type', label: 'Тип', value: 'Покрытие', type: 'readonly' }, { id: 'level', label: 'Уровень', value: 'Крыша', type: 'readonly' }, { id: 'status', label: 'Статус', value: 'Согласовано', type: 'choice', options: STATUS_OPTIONS }, { id: 'visible', label: 'Видимость', value: true, type: 'boolean' }, ], }, { id: 'geometry', title: 'Геометрия', fields: [{ id: 'elevation', label: 'Отметка', value: '+7,200', type: 'text', unit: 'м' }], }, ], documentation: [ { id: 'common', title: 'Общие', fields: [ { id: 'name', label: 'Название', value: 'Документация', type: 'text' }, { id: 'type', label: 'Тип', value: 'Раздел', type: 'readonly' }, { id: 'status', label: 'Статус', value: 'В работе', type: 'choice', options: STATUS_OPTIONS }, { id: 'visible', label: 'Видимость', value: true, type: 'boolean' }, ], }, { id: 'sheets', title: 'Листы', fields: [ { id: 'count', label: 'Комплектов', value: '3', type: 'readonly' }, { id: 'revision', label: 'Ревизия', value: 'Rev. 0', type: 'text' }, ], }, ], }; /** * Свойства элемента, построенного пользователем. * Геометрия считается по контуру; нормативных характеристик здесь нет. */ export function buildElementSheet(element: DemoElement, parentLabel: string): PropertyGroup[] { return [ { id: 'common', title: 'Общие', fields: [ { id: 'name', label: 'Название', value: element.label, type: 'text' }, { id: 'type', label: 'Тип', value: element.kind, type: 'readonly' }, { id: 'level', label: 'Уровень', value: parentLabel || '—', type: 'readonly' }, { id: 'status', label: 'Статус', value: 'В работе', type: 'choice', options: STATUS_OPTIONS }, { id: 'visible', label: 'Видимость', value: true, type: 'boolean' }, ], }, { id: 'geometry', title: 'Геометрия', fields: [ { id: 'area', label: 'Площадь основания', value: contourArea(element.footprint).toFixed(2), type: 'readonly', unit: 'м²', }, { id: 'base', label: 'Отметка низа', value: element.base.toFixed(3), type: 'readonly', unit: 'м', }, { id: 'height', label: 'Высота', value: element.height.toFixed(2), type: 'text', unit: 'м', }, ], }, { id: 'identification', title: 'Идентификация', fields: [ { id: 'id', label: 'Идентификатор', value: element.id, type: 'readonly' }, { id: 'origin', label: 'Источник', value: 'Текущий сеанс', type: 'readonly' }, ], }, ]; } /** Свойства по умолчанию для узлов без собственной карточки. */ export function buildDefaultSheet(node: TreeNode, parentLabel: string): PropertyGroup[] { return [ { id: 'common', title: 'Общие', fields: [ { id: 'name', label: 'Название', value: node.label, type: 'text' }, { id: 'type', label: 'Тип', value: node.kind, type: 'readonly' }, { id: 'level', label: 'Уровень', value: parentLabel || '—', type: 'readonly' }, { id: 'status', label: 'Статус', value: 'В работе', type: 'choice', options: STATUS_OPTIONS }, { id: 'visible', label: 'Видимость', value: true, type: 'boolean' }, ], }, { id: 'identification', title: 'Идентификация', fields: [ { id: 'id', label: 'Идентификатор', value: node.id, type: 'readonly' }, { id: 'author', label: 'Автор', value: 'Проектировщик', type: 'readonly' }, { id: 'changed', label: 'Изменён', value: '08.08.2026 10:24', type: 'readonly' }, ], }, ]; }