=> ({
style: {
- writingMode: "vertical-lr",
- textOrientation: "upright",
- paddingLeft: 0,
- paddingRight: 0,
+ writingMode: "horizontal-tb",
+ whiteSpace: "nowrap",
+ paddingLeft: 8,
+ paddingRight: 8,
},
});
function render_column_title(label: string) {
- return
{label.split(/(<[^>]+>)/g).filter(Boolean).map((part, index) =>
- part.startsWith("<") && part.endsWith(">")
- ? {part.slice(1, -1)}
- : {part}
- )}
;
+ return
{label.replaceAll("<", "").replaceAll(">", "")}
;
}
function compare_values(a: unknown, b: unknown): number {
@@ -131,9 +127,10 @@ function create_columns(model: readonly Aircraft_Column_Model[]): TableColumnTyp
dataIndex: column.key,
key: column.key,
onHeaderCell,
+ width: column.type === "timestamp" ? 190 : Math.max(88, column.label.length * 18 + 44),
defaultSortOrder: normalized_sort_order(column.defaultSortOrder),
sorter: (a, b) => compare_values(a[column.key], b[column.key]),
- render: value =>
+ render: value =>
{value == null ? "" : typeof value === "boolean" ? (value ? "是" : "否") : String(value)}
,
};
@@ -222,8 +219,8 @@ export class Aircraft_List extends enhance.Base {
}
render() {
- return
-
+ return
+
}
placeholder="请选择数据来源"
@@ -238,13 +235,15 @@ export class Aircraft_List extends enhance.Base {
}}/>
- dataSource={this.dataSource}
- columns={this.columns}
- showSorterTooltip={false}
- size="small"
- scroll={{x: "max-content", y: "calc(100vh - 300px)"}}
- pagination={false}
- style={{overflowX: "auto"}}/>
+
+
dataSource={this.dataSource}
+ columns={this.columns}
+ showSorterTooltip={false}
+ size="small"
+ scroll={{x: "max-content", y: "calc(100vh - 300px)"}}
+ pagination={false}
+ style={{width: "100%"}}/>
+
;
}
diff --git a/src/Map/Cesium_Model_Settings.tsx b/src/Map/Cesium_Model_Settings.tsx
index 5f40f4c..9945014 100644
--- a/src/Map/Cesium_Model_Settings.tsx
+++ b/src/Map/Cesium_Model_Settings.tsx
@@ -1,5 +1,5 @@
import React from "react";
-import {Button, message, Space, Upload} from "antd";
+import {Button, Card, message, Select, Space, Upload} from "antd";
import {UploadOutlined} from "@ant-design/icons";
import enhance from "../core/enhance.tsx";
import {col_style, row_style, setting_style} from "../Global.tsx";
@@ -46,6 +46,7 @@ export type Cesium_Model_Settings_Schema = {
export class Cesium_Model_Settings extends enhance.Base {
config: Map_Model_Config = empty_map_model_config;
schema: Cesium_Model_Settings_Schema;
+ selected_collection_items: Record = {};
constructor(schema: Cesium_Model_Settings_Schema) {
super();
@@ -96,21 +97,42 @@ export class Cesium_Model_Settings extends enhance.Base {
);
}
+ render_collection(collection: Model_Collection_Schema) {
+ const available = collection.items.filter(item => get_path(this.config, `${collection.path}.${item.key}`));
+ const selected = available.some(item => item.key === this.selected_collection_items[collection.path])
+ ? this.selected_collection_items[collection.path]
+ : available[0]?.key;
+ if (!selected) return null;
+ const item = available.find(value => value.key === selected)!;
+ return (
+
+
+
+
+ );
+ }
+
render(props: any) {
return (
{this.schema.title ?? "Cesium模型设置"}
-
+
{(this.schema.groups || []).map(group =>
this.render_model(group.title, group.path, group.upload))}
- {(this.schema.collections || []).flatMap(collection => [
- {collection.title}
,
- ...collection.items.map(item => this.render_model(item.label, `${collection.path}.${item.key}`, {
- model_type: collection.upload_model_type,
- label: collection.upload_label || "上传模型",
- success_message: collection.upload_success_message
- }, item.key))
- ])}
+ {(this.schema.collections || []).map(collection => this.render_collection(collection))}