diff --git a/CAPABILITY.md b/CAPABILITY.md index 8903ed7..c22626a 100644 --- a/CAPABILITY.md +++ b/CAPABILITY.md @@ -250,6 +250,8 @@ - **`collapsible`** (Boolean): 仅在 `tree` 模式下有效,开启树形节点的展开/收起能力。 - **`auto-select`** (Boolean): 开启后,点击列表项时自动将该项的 `id` 记录至 `state.selectedItem`,如果重复点击则会置空。 - **`auto-select-group`** (Boolean): 开启后,点击分组时自动将分组的 `id` 记录至 `state.selectedGroup`。 +- **`filter`** (String): 筛选关键字。支持通过 attribute 传入以自动同步至 `state.filter`。 +- **`order`** (String): 排序规则。支持通过 attribute 传入以自动同步至 `state.order`。 ### 4. 内部状态模型 (`State`) - `list` (读写): 原始列表数据数组。 @@ -257,6 +259,8 @@ - `collapsed` (读写): 仅在 `tree` 且 `collapsible` 时使用,存储节点 ID 折叠状态的 Map Proxy。 - `selectedItem` (读写): 当前选中的列表项 ID。 - `selectedGroup` (读写): 当前选中的分组 ID。 +- `filter` (读写): 筛选关键字(进行 label 和 summary 的不区分大小写模糊匹配)或自定义过滤函数 `(item) => boolean`。 +- `order` (读写): 排序规则。可为排序字段名(例如 `'name'`;前缀 `-` 表示降序,如 `'-name'`;或者后缀 `'desc'`/`'asc'` 语法,如 `'name desc'`),也可以为自定义排序函数 `(a, b) => number`。 - `_flatList` (只读): 列表核心逻辑处理后的扁平化数组。 - `_renderedList` (只读): 实际在 DOM 中遍历渲染的数组片段(若开启虚拟滚动,则只包含可视区切片)。 diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c44d5a..802de85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## [1.0.22] - 2026-06-28 +### Added +- **List**: Added internal filtering and sorting capabilities on the `List` component across all three layout modes (`normal`, `group`, `tree`). Supports `filter` and `order` attributes and state fields. In `tree` mode, filtering correctly propagates up to preserve parent-descendant hierarchy. Added a MutationObserver to listen to attribute changes and sync them reactively to internal component state. + ## [1.0.21] - 2026-06-27 ### Fixed - **API**: Preserved declarative preset fields injected through `$.request.*` when the `API` component initializes its internal reactive request state. diff --git a/README.md b/README.md index 56cfa83..9bfbb8e 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ - + ``` + + + + +
+