Skip to content

Commit d66ff94

Browse files
ww-mwclaude
andcommitted
Refine Architectural Data presentation; release v1.0.2
- Surface accurate arch type names in the Data Type column via the systemcomposer interface/type catalog (DataInterface, PhysicalInterface, ServiceInterface, ValueType, StructType, NumericType, EnumType). - Add a dedicated ServiceBus node type with FunctionElement children (Prototype shown as Value, function icon). - Map each interface element's Data Type: DataInterface/StructType elements to DataType_internal (default double), PhysicalInterface elements to Type_internal (default connection domain), FunctionElement and EnumItem to empty (not applicable). - ValueType Data Type maps to the DataType property (default double); Value is empty and non-editable for AliasType/NumericType/ValueType. - Distinguish StructType from DataInterface via the systemcomposer catalog; typeStruct / typeStructElement / typeConnectionElement icons. - Render the Data Type column in italics and understate section header rows. - Add unit tests covering the arch presentation behaviors. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 07ec154 commit d66ff94

28 files changed

Lines changed: 594 additions & 38 deletions

‎.gitignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@ coverage/
77
*.vsix
88
test/parity/dump-output.txt
99
.DS_Store
10+
11+
# Local-only internal notes — must never be pushed to the public remote
12+
CLAUDE.md

‎README.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,15 @@ No MATLAB&reg; or Simulink installation is required to view or edit files — Si
5656

5757
## Release Notes
5858

59+
### 1.0.2
60+
61+
- Refined the presentation of Architectural Data entries: accurate type names
62+
(DataInterface, PhysicalInterface, ServiceInterface, ValueType, StructType,
63+
NumericType, EnumType) in the Data Type column, dedicated icons for service
64+
interfaces and struct types, and correct Value/Data Type mapping for each
65+
interface element.
66+
- Render the Data Type column in italics and understate the section header rows.
67+
5968
### 1.0.1
6069

6170
- Render read-only model and project entries in the normal text color.

‎media/icons/busElement.svg‎

Lines changed: 3 additions & 0 deletions
Loading

‎media/icons/function.svg‎

Lines changed: 4 additions & 0 deletions
Loading

‎media/icons/serviceInterfaces.svg‎

Lines changed: 8 additions & 0 deletions
Loading

‎package-lock.json‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "data-explorer-vscode",
33
"displayName": "Simulink Data Explorer Extension for Visual Studio Code",
44
"description": "Explore Simulink models, data dictionaries, MAT-files, and projects as interactive tables and relationship trees.",
5-
"version": "1.0.1",
5+
"version": "1.0.2",
66
"publisher": "mathworks",
77
"private": true,
88
"license": "BSD-3-Clause",

‎src/dex/components/dex-icon.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ const ALIASES: Record<string, string> = {
99
string: 'wsString',
1010
parameter: 'wsParameters',
1111
bus: 'typeBus',
12-
busElement: 'typeBusElement',
1312
enum: 'typeEnum',
1413
signal: 'typeSignal',
1514
alias: 'typeAlias',

‎src/dex/components/dex-tree-table.ts‎

Lines changed: 56 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ export interface TreeTableRow {
99
ID: string;
1010
parent: string | null;
1111
Name: { label: string; iconId?: string; editable?: boolean; clipboardMode?: string };
12-
Value: { text: string; editable?: boolean; clipboardMode?: string; linkTarget?: string } | string;
12+
Value:
13+
| { text: string; editable?: boolean; clipboardMode?: string; linkTarget?: string; editor?: string; options?: string[] }
14+
| string;
1315
_valueEditable?: boolean;
1416
DataType: { text: string; clipboardMode?: string; linkTarget?: string } | string;
1517
Description: { text: string; clipboardMode?: string } | string;
@@ -283,6 +285,11 @@ export class DexTreeTable extends LitElement {
283285
border-right: none;
284286
}
285287
288+
/* The Data Type column is rendered in italics. */
289+
td.col-DataType {
290+
font-style: italic;
291+
}
292+
286293
:host([table-style='light']) td {
287294
border-right: none;
288295
}
@@ -345,6 +352,18 @@ export class DexTreeTable extends LitElement {
345352
color: var(--dex-color-text-muted, #666);
346353
}
347354
355+
/* Section header rows are intentionally understated: muted gray, italic
356+
Name, and no vertical cell borders so the row reads as one continuous
357+
strip rather than a set of columns. */
358+
tr.section-row .name-cell .label {
359+
font-style: italic;
360+
color: var(--dex-color-text-muted, #666);
361+
}
362+
363+
tr.section-row td {
364+
border-right: none;
365+
}
366+
348367
.value-object {
349368
color: var(--dex-color-text-muted, #767676);
350369
font-style: italic;
@@ -417,7 +436,13 @@ export class DexTreeTable extends LitElement {
417436

418437
@state() private _expandedIds: Set<string> = new Set();
419438
@state() private _filterText = '';
420-
@state() private _editingCell: { rowId: string; columnId: string; value: string } | null = null;
439+
@state() private _editingCell: {
440+
rowId: string;
441+
columnId: string;
442+
value: string;
443+
editor?: string;
444+
options?: string[];
445+
} | null = null;
421446
@state() private _scrollTop = 0;
422447
@state() private _viewportHeight = 400;
423448
@state() private _focusedCol = 0;
@@ -1259,7 +1284,7 @@ export class DexTreeTable extends LitElement {
12591284
? row.Value
12601285
: { text: String(row.Value || ''), editable: row._valueEditable ?? false };
12611286
if (!val.editable) return;
1262-
this._onCellDblClick(row.ID, 'Value', val.text || '');
1287+
this._onCellDblClick(row.ID, 'Value', val.text || '', (val as { editor?: string }).editor, (val as { options?: string[] }).options);
12631288
} else if (columnId === 'Description') {
12641289
if (row._valueEditable === false) return;
12651290
const val = typeof row.Description === 'object' ? row.Description.text : String(row.Description || '');
@@ -1408,13 +1433,22 @@ export class DexTreeTable extends LitElement {
14081433
}
14091434
}
14101435

1411-
private _onCellDblClick(rowId: string, columnId: string, currentValue: string): void {
1412-
this._editingCell = { rowId, columnId, value: currentValue };
1436+
private _onCellDblClick(
1437+
rowId: string,
1438+
columnId: string,
1439+
currentValue: string,
1440+
editor?: string,
1441+
options?: string[],
1442+
): void {
1443+
this._editingCell = { rowId, columnId, value: currentValue, editor, options };
14131444
this.updateComplete.then(() => {
1414-
const input = this.shadowRoot?.querySelector('.edit-input') as HTMLInputElement;
1445+
const input = this.shadowRoot?.querySelector('.edit-input') as HTMLInputElement | HTMLSelectElement;
14151446
if (input) {
14161447
input.focus();
1417-
input.select();
1448+
// <select> has no text to select; only inputs/textareas support .select().
1449+
if (typeof (input as HTMLInputElement).select === 'function') {
1450+
(input as HTMLInputElement).select();
1451+
}
14181452
}
14191453
});
14201454
}
@@ -1447,7 +1481,7 @@ export class DexTreeTable extends LitElement {
14471481

14481482
private _commitEdit(): void {
14491483
if (!this._editingCell) return;
1450-
const input = this.shadowRoot?.querySelector('.edit-input') as HTMLInputElement;
1484+
const input = this.shadowRoot?.querySelector('.edit-input') as HTMLInputElement | HTMLSelectElement;
14511485
if (!input) return;
14521486
const newValue = input.value;
14531487
const oldValue = this._editingCell.value;
@@ -1550,6 +1584,17 @@ export class DexTreeTable extends LitElement {
15501584
const linkTarget = (val as { linkTarget?: string }).linkTarget;
15511585

15521586
if (isEditing) {
1587+
if (this._editingCell?.editor === 'select') {
1588+
const options = this._editingCell?.options || [];
1589+
return html`<select
1590+
class="edit-input"
1591+
@keydown=${this._onEditKeyDown}
1592+
@change=${this._onEditBlur}
1593+
@blur=${this._onEditBlur}
1594+
>
1595+
${options.map((opt) => html`<option .value=${opt} ?selected=${opt === text}>${opt}</option>`)}
1596+
</select>`;
1597+
}
15531598
return html`<input
15541599
class="edit-input"
15551600
.value=${text}
@@ -1822,12 +1867,13 @@ export class DexTreeTable extends LitElement {
18221867
const isSelected = this.selectedRowIds.includes(row.ID);
18231868
const isDragSource = this._dragSourceId === row.ID;
18241869
const isDropTarget = this._dropTargetId === row.ID;
1870+
const isSection = row.ID.indexOf('section:') === 0;
18251871
return html`
18261872
<tr
18271873
role="row"
18281874
aria-rowindex=${startIdx + ri + 2}
18291875
aria-selected=${isSelected}
1830-
class="data-row ${isSelected ? 'selected' : ''} ${clipMode === 'cut' ? 'cut' : ''} ${clipMode ===
1876+
class="data-row ${isSection ? 'section-row' : ''} ${isSelected ? 'selected' : ''} ${clipMode === 'cut' ? 'cut' : ''} ${clipMode ===
18311877
'copy'
18321878
? 'copied'
18331879
: ''} ${isDragSource ? 'drag-source' : ''} ${isDropTarget && this._dropPosition === 'on'
@@ -1847,7 +1893,7 @@ export class DexTreeTable extends LitElement {
18471893
return html`<td
18481894
role="gridcell"
18491895
aria-colindex=${ci + 1}
1850-
class="${isFocused ? 'focused' : ''}"
1896+
class="col-${col} ${isFocused ? 'focused' : ''}"
18511897
@click=${(e: MouseEvent) => this._onCellClick(row.ID, ci, e)}
18521898
@dblclick=${() => this._onCellDblClickIfEditable(row, col)}
18531899
>

‎src/dex/datamodel/node/BaseNode.ts‎

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export interface PropClass {
77
editor: string;
88
nodeProperty?: string;
99
readValue?: (node: BaseNode) => string;
10+
readOptions?: (node: BaseNode) => string[];
1011
format: (value: unknown) => string;
1112
}
1213

@@ -17,6 +18,7 @@ export interface PropInfo {
1718
displayValue: string;
1819
editable: boolean;
1920
editor: string;
21+
options?: string[];
2022
}
2123

2224
export interface RowData {
@@ -70,6 +72,12 @@ export default class BaseNode {
7072
return '';
7173
}
7274

75+
// The value shown in the DataType column; subclasses may override to show a
76+
// friendlier type than the class-identity dataType.
77+
get displayDataType(): string {
78+
return this.dataType;
79+
}
80+
7381
get displayValue(): string {
7482
return '';
7583
}
@@ -197,6 +205,7 @@ export default class BaseNode {
197205
displayValue,
198206
editable,
199207
editor: PropClassRef.editor,
208+
options: PropClassRef.readOptions ? PropClassRef.readOptions(this) : undefined,
200209
};
201210
}
202211

@@ -221,7 +230,13 @@ export default class BaseNode {
221230
if (colKey === 'Name') {
222231
row.Name = { label: info.displayValue, iconId: this.icon, disabled: this.disabled, editable: info.editable };
223232
} else if (colKey === 'Value') {
224-
row.Value = info.displayValue;
233+
// A 'select' editor carries its dropdown options on the cell so the
234+
// webview can render a combobox instead of a text input.
235+
if (info.editor === 'select') {
236+
row.Value = { text: info.displayValue, editable: info.editable, editor: 'select', options: info.options || [] };
237+
} else {
238+
row.Value = info.displayValue;
239+
}
225240
row._valueEditable = info.editable;
226241
} else {
227242
row[colKey] = info.displayValue;
@@ -236,7 +251,7 @@ export default class BaseNode {
236251
row._valueEditable = this.valueEditable;
237252
}
238253
if (!('DataType' in row)) {
239-
row.DataType = this.dataType;
254+
row.DataType = this.displayDataType;
240255
}
241256
if (!('Description' in row)) {
242257
row.Description = (this as unknown as { Description?: string }).Description || '';

0 commit comments

Comments
 (0)