Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ release notes before you move the pin.

```json
"dependencies": {
"data-explorer-view": "github:mathworks/data-explorer-view#v1.8.0",
"data-explorer-view": "github:mathworks/data-explorer-view#v1.9.0",
"data-explorer-core": "github:mathworks/data-explorer-core#v1.59.0",
"lit": "^3.2.0"
}
Expand Down
4 changes: 2 additions & 2 deletions custom-elements.json
Original file line number Diff line number Diff line change
Expand Up @@ -8139,7 +8139,7 @@
"declarations": [
{
"kind": "class",
"description": "The tree table: a document's rows as a tree, with a search bar, sortable, resizable and\nreorderable columns (the Columns menu shows, hides and orders them, and a right-click on a\nheader filters on that column), cell editors, row drag and drop, links, matrix glyphs, an\n`+ Add` gallery and virtual scrolling for very large documents. Data comes in by properties\n(`rows` above all) and every user action goes out as a `dex-*` event; it never changes the\ndocument itself. Its defaults are a full editor; `readonly`, `canAdd` and `rowDrag` turn parts\nof that off.",
"description": "The tree table: a document's rows as a tree, with a search bar, sortable, resizable and\nreorderable columns (the Columns menu shows, hides and orders them, each within its group, and\nadds a column for any property the user names, from the rows' `_props`; a right-click on a\nheader filters on that column), cell editors, row drag and drop, links, matrix glyphs, an\n`+ Add` gallery and virtual scrolling for very large documents. Data comes in by properties\n(`rows` above all) and every user action goes out as a `dex-*` event; it never changes the\ndocument itself. Its defaults are a full editor; `readonly`, `canAdd` and `rowDrag` turn parts\nof that off.",
"name": "DexTreeTable",
"members": [
{
Expand Down Expand Up @@ -8187,7 +8187,7 @@
"text": "Record<string, string> | null"
},
"default": "null",
"description": "The group heading each column sits under in the Columns menu, by column key. Default null:\nno headings. Property only."
"description": "The group heading each column sits under in the Columns menu, by column key. The columns are\nshown group by group, and the user moves a column within its group only, in the menu and by\nits header. Default null: no headings. Property only."
},
{
"kind": "field",
Expand Down
2 changes: 2 additions & 0 deletions dist/model/rows/propertyCells.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/** The cell text of each of the node's own properties the row has no column for, or undefined. */
export declare function propertyCells(n: any, row: Record<string, unknown>): Record<string, string> | undefined;
102 changes: 102 additions & 0 deletions dist/model/rows/propertyCells.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
// Copyright 2026 The MathWorks, Inc.
//
// A row's properties beyond its columns: what a column the user names in the table's Columns menu
// (its Other Properties group) shows. The table reads the cell of such a column from the row's
// `_props`, by the property's name; a row whose object has no property of that name leaves the
// cell empty.
//
// Two places hold an object's own properties, and both are read:
// - an object whose CHILDREN are its class's properties (core's `isObjectPropertyBag`: a MATLAB
// class object, so a `MyClass` with `MyPropA`), each child by its name, as the child's own row
// shows its value;
// - an object that keeps a property bag (`serial._properties`, a Simulink object and a class
// derived from one), each top-level property by its name, where the value is one a property
// column shows: text, a number, a logical, a list of those, or a typed scalar (MATLAB's rule
// for these columns). Not a nested object (`CoderInfo`, `LoggingInfo`), whose own properties
// are not columns, nor a `*_internal` or envelope key.
//
// A property the row already has a cell for (Value, Description, `complexity` for `Complexity`)
// is left out: the menu shows that column for its name instead, so its text here would be a
// second copy of the cell on every row.
//
// The values are printed as core's Property Inspector prints them in its Other group (core's
// piOther), for the shapes kept; core does not export that printer, and calling `toPIObject()`
// per row for it cost three quarters of a 15,000-entry dictionary's open (measured 2026-11-17).
/** The cell text of each of the node's own properties the row has no column for, or undefined. */
export function propertyCells(n, row) {
let props;
const put = (name, text) => {
if (inRow(row, name) || (props && name in props))
return;
(props ??= {})[name] = text;
};
let isBag = false;
try {
isBag = n?.isObjectPropertyBag === true;
}
catch {
isBag = false;
}
if (isBag && Array.isArray(n.children)) {
for (const child of n.children) {
const name = child?.name;
// An object array's children are its elements (`obj(1)`), not properties.
if (typeof name !== 'string' || !PROPERTY_NAME.test(name))
continue;
let text;
try {
text = child.displayValue;
}
catch {
continue;
}
put(name, typeof text === 'string' ? text : text === undefined || text === null ? '' : String(text));
}
}
const bag = n?.serial?._properties;
if (isPlainObject(bag)) {
for (const name of Object.keys(bag)) {
if (!PROPERTY_NAME.test(name) || name.endsWith('_internal'))
continue;
const text = primitiveText(bag[name]);
if (text !== null)
put(name, text);
}
}
return props;
}
// A MATLAB property name: a letter, then letters, digits and underscores.
const PROPERTY_NAME = /^[A-Za-z][A-Za-z0-9_]*$/;
// Whether the row has a cell for `name`: under its own key, or under the lower-camel key a schema
// column gives a property (`Complexity` → `complexity`).
function inRow(row, name) {
return name in row || name.charAt(0).toLowerCase() + name.slice(1) in row;
}
function isPlainObject(v) {
return typeof v === 'object' && v !== null && !Array.isArray(v);
}
// The text of a value a property column shows, or null for one it does not. Each kept shape is
// printed as core's piOther prints it: a scalar as String(), a list as `[a, b, c]`, a typed
// scalar as its `_value`. The typed scalars core reads before printing (complex or MAT-stream
// cdata, an encoded binary value, a sparse array, a `Matrix(…)` empty) are not kept.
function primitiveText(v) {
if (typeof v === 'string')
return v;
if (typeof v === 'number' || typeof v === 'boolean')
return String(v);
if (Array.isArray(v)) {
return v.every((x) => typeof x === 'string' || typeof x === 'number' || typeof x === 'boolean')
? '[' + v.join(', ') + ']'
: null;
}
if (isPlainObject(v) && '_type' in v && '_value' in v) {
const value = v._value;
if (v._type === 'cdata' || v._type === 'sparse' || '_attrs' in v)
return null;
if (typeof value === 'number' || typeof value === 'boolean')
return String(value);
if (typeof value === 'string' && !value.startsWith('Matrix('))
return value;
}
return null;
}
3 changes: 2 additions & 1 deletion dist/model/rows/rowStamp.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ export interface StampContext {
* In this order, which both builders already applied: the entry's Status and clip mark, then
* the capability flags, then the grid-view payload if the node's value is a griddable matrix,
* then `_lazy` last, so a row is the same shape whichever builder made it. None rewrites the
* row's columns.
* row's columns. The object's own properties beyond its columns go under `_props`, before the
* flags.
*
* The pool shares the FINISHED row, rather than being passed to `toRow()`: the row is the
* node's cells plus the host's own, so sharing here covers all of them in one walk where doing
Expand Down
9 changes: 8 additions & 1 deletion dist/model/rows/rowStamp.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { stampMatrix } from '../matrix/matrixPayload.js';
import { stampLazy } from './lazyRows.js';
import { propertyCells } from './propertyCells.js';
/** The mark key for one entry. `\0` cannot occur in a section or entry name. */
export function clipMarkKey(section, name) {
return `${section}\u0000${name}`;
Expand Down Expand Up @@ -80,7 +81,8 @@ export function sharedIdTest() {
* In this order, which both builders already applied: the entry's Status and clip mark, then
* the capability flags, then the grid-view payload if the node's value is a griddable matrix,
* then `_lazy` last, so a row is the same shape whichever builder made it. None rewrites the
* row's columns.
* row's columns. The object's own properties beyond its columns go under `_props`, before the
* flags.
*
* The pool shares the FINISHED row, rather than being passed to `toRow()`: the row is the
* node's cells plus the host's own, so sharing here covers all of them in one walk where doing
Expand All @@ -102,6 +104,11 @@ export function stampRow(built, n, ctx) {
const flags = ctx.sharedId
? { _canCopy: false, _canDelete: false, _canAddChild: false }
: capabilityFlags(n, { canCopy: ctx.canCopy });
// The object's own properties the row has no column for, which a property column the user
// names reads (propertyCells.ts). Only on a row whose object has any.
const props = propertyCells(n, row);
if (props)
row = { ...row, _props: props };
const stamped = stampLazy(stampMatrix({ ...row, ...flags }, n), ctx.deferred);
return ctx.pool ? ctx.pool.share(stamped) : stamped;
}
6 changes: 6 additions & 0 deletions dist/model/rows/tableRow.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ export interface TreeTableRow {
_systemPath?: string;
_blockPath?: string;
_entryCount?: number;
/**
* The object's own properties the row has no column for, each its value as text, by the
* property's name (`{ SampleTime: '-1', MyPropA: '5' }`): what a property column the user adds
* in the Columns menu shows. Absent on a row whose object has none (propertyCells.ts).
*/
_props?: Record<string, string>;
/**
* Every other cell the row has, by column key: a dictionary entry's `Min`, `Max`, `Unit`, …,
* a block row's parameter links. Each column's cell has a shape of its own, which the table
Expand Down
2 changes: 1 addition & 1 deletion dist/model/version.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2026 The MathWorks, Inc.
// GENERATED by scripts/gen-version.mjs from package.json. Do not edit.
/** This package's version, as its package.json says: what an app's About shows for data-explorer-view. */
export const VIEW_VERSION = '1.8.0';
export const VIEW_VERSION = '1.9.0';
24 changes: 21 additions & 3 deletions dist/widgets/tree-table/dex-tree-table.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ export interface TableScrolledDetail {
}
/**
* The tree table: a document's rows as a tree, with a search bar, sortable, resizable and
* reorderable columns (the Columns menu shows, hides and orders them, and a right-click on a
* reorderable columns (the Columns menu shows, hides and orders them, each within its group, and
* adds a column for any property the user names, from the rows' `_props`; a right-click on a
* header filters on that column), cell editors, row drag and drop, links, matrix glyphs, an
* `+ Add` gallery and virtual scrolling for very large documents. Data comes in by properties
* (`rows` above all) and every user action goes out as a `dex-*` event; it never changes the
Expand Down Expand Up @@ -148,8 +149,9 @@ export declare class DexTreeTable extends LitElement {
*/
columnLabels: Record<string, string> | null;
/**
* The group heading each column sits under in the Columns menu, by column key. Default null:
* no headings. Property only.
* The group heading each column sits under in the Columns menu, by column key. The columns are
* shown group by group, and the user moves a column within its group only, in the menu and by
* its header. Default null: no headings. Property only.
*/
columnGroups: Record<string, string> | null;
/**
Expand Down Expand Up @@ -364,9 +366,12 @@ export declare class DexTreeTable extends LitElement {
private _columnMenuOpen;
private _columnMenuX;
private _columnMenuY;
private _columnMenuMaxHeight;
private _menuDragCol;
private _menuDragOverCol;
private _menuDragOverSide;
private _propertyColumns;
private _propertyNotice;
private _addGalleryOpen;
private _addPinned;
private _filterPopupCol;
Expand Down Expand Up @@ -401,8 +406,14 @@ export declare class DexTreeTable extends LitElement {
private _readKnownColumns;
private _persistOrder;
private _persistHidden;
private _persistPropertyColumns;
private get _availableColumns();
private _groupOf;
private _sameGroup;
private get _orderedBuiltins();
private get _orderedColumns();
private _columnLabel;
private get _columnVocabulary();
private get _visibleColumns();
private _getColWidth;
private _defaultColWidth;
Expand All @@ -413,6 +424,7 @@ export declare class DexTreeTable extends LitElement {
private _onHeaderDragOver;
private _onHeaderDragLeave;
private _onHeaderDrop;
private _moveColumn;
private _onHeaderDragEnd;
private _onAddButtonClick;
/**
Expand Down Expand Up @@ -443,6 +455,11 @@ export declare class DexTreeTable extends LitElement {
private _onColumnFilterCleared;
private _toggleColumnVisibility;
private _resetColumns;
private _addPropertyColumn;
private _removePropertyColumn;
private _propertyColumnsChanged;
private _onPropertyInputKeyDown;
private _addTypedPropertyColumn;
private _onMenuDragStart;
private _onMenuDragOver;
private _onMenuDragLeave;
Expand Down Expand Up @@ -617,6 +634,7 @@ export declare class DexTreeTable extends LitElement {
private _renderColumnsButton;
private _renderColumnFilterPopup;
private _renderColumnMenu;
private _renderColumnMenuItem;
}
/**
* Registers the widget as `<dex-tree-table>`, or under `tag`, after the parts its template draws,
Expand Down
Loading
Loading