@synopackageland/ui 0.10.5 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/README.md +27 -8
- package/dist/DataGridListDemo.vue.d.ts +6 -0
- package/dist/components/composite/data-grid/DataGrid.vue.d.ts +52 -1
- package/dist/components/composite/data-grid/columnState.d.ts +10 -0
- package/dist/components/composite/data-grid/columnWidths.d.ts +15 -1
- package/dist/components/composite/data-grid/labels.d.ts +15 -1
- package/dist/components/composite/data-grid/rowFilter.d.ts +10 -0
- package/dist/components/composite/data-grid/viewState.d.ts +15 -0
- package/dist/components/composite/scroll-edges/ScrollEdges.vue.d.ts +3 -1
- package/dist/composables/elementWidth.d.ts +2 -2
- package/dist/i18n/text.d.ts +4 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +7254 -7002
- package/dist/json-preview/preview.js +2171 -2135
- package/dist/reka-runtime.json +1 -1
- package/dist/theme.css +1 -1
- package/dist/themes/dsm7-embedded-theme.css +1 -1
- package/dist/themes/dsm7-embedded.css +1 -1
- package/dist/themes/dsm7.css +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.11.0 (2026-10-17)
|
|
4
|
+
|
|
5
|
+
- `DataGrid` handles long lists by itself. Every column gets a pixel width: a column with `width` keeps it, a column without one is flexible and shares the rest by the new `flex` weight (default 1), never below its `minWidth` (default 80 px for a flexible column). A long file name can no longer take the whole width, a header never wraps one character per line, and the grid scrolls sideways only when the minimums do not fit (a phone) or the user widened columns. A plain cell is cut to one line with its full text in a tooltip; `wrap: true` wraps a column instead. Headers carry their label as a tooltip.
|
|
6
|
+
- Column chooser: `column-chooser` adds a columns button at the right of the header where the user shows and hides columns (`hideable: false` keeps one, `defaultHidden: true` starts one hidden) and resets order, visibility and widths. `v-model:hidden-columns`; `resetColumns()` is exposed.
|
|
7
|
+
- Column reorder: `column-reorder` moves a column by dragging its header onto another, or with Alt+Left/Right on a focused header. `v-model:column-order`.
|
|
8
|
+
- Quick filter: `filter` (with `searchable` / `searchText` per column, `filter-row`, or `:local-filter="false"` for server results) runs before sorting and paging, so it finds rows on every page. The footer reads "3 of 240 items" and an empty result says "No matching items".
|
|
9
|
+
- Paging: `page` and `page-size` work unbound as well as with `v-model:page` / `v-model:page-size`; `page-sizes` adds a page-size choice to the footer. A new filter, sort or page size goes back to page 1; a page past the end (the rows shrank) shows the last page.
|
|
10
|
+
- Saved view: `state-key` saves the user's column order, hidden columns, widths, sort and page size in localStorage and restores them; bound props win. `loadGridState` / `saveGridState` and the `DataGridViewState` type are exported for apps that keep the view elsewhere.
|
|
11
|
+
- New `labels`: `columns`, `resetColumns`, `filtered(count, total)`, `noMatch`, `pageSize` (optional, like the row labels; translated in all nine locales).
|
|
12
|
+
- **Visible change:** columns without a `width` share the free width evenly (by `flex`) instead of sizing to their content, and the table always has a trailing filler column. **Behavior change:** a grid that did not bind `page` now pages when the footer buttons are clicked (before, it only emitted `update:page`).
|
|
13
|
+
- Visible changes for apps: Download Hub's list no longer lets a long name push 存放位置 and 狀態 into one-character columns. Give the main column `flex: 2` and a `minWidth`, mark optional columns (start/finish time, speed) `defaultHidden`, add `column-chooser`, `column-reorder`, `page-sizes` and a `state-key`, and bind a `SearchField variant="filter"` to `filter`. Remove hand-written `title` attributes on plain cells and app-side filtering of the current page.
|
|
14
|
+
|
|
15
|
+
繁中摘要:`DataGrid` 自己處理長清單。每欄都有像素寬度:有 `width` 的欄維持,沒有的欄依新的 `flex`(預設 1)分配剩餘寬度、不小於 `minWidth`(彈性欄預設 80px);長檔名不再吃掉整個寬度,表頭不會一字一行,只有最小寬度放不下(手機)或使用者拉寬欄時才橫向捲動。一般儲存格單行省略並以 tooltip 顯示全文,`wrap: true` 改為換行;表頭也有 tooltip。新增欄位選擇(`column-chooser`:表頭右側按鈕,可顯示/隱藏欄、重設順序/顯示/寬度;`hideable: false`、`defaultHidden`、`v-model:hidden-columns`、`resetColumns()`)、欄位排序(`column-reorder`:拖曳表頭或 Alt+←/→;`v-model:column-order`)、快速篩選(`filter`,在排序與分頁前搜尋全部列;`searchable`、`searchText`、`filter-row`、`:local-filter="false"`;頁尾顯示「3/240 個項目」,無結果顯示「沒有符合的項目」)、分頁改進(`page`/`page-size` 不綁也能用,`page-sizes` 選每頁筆數;篩選、排序、每頁筆數變更時回到第 1 頁,超出頁數時顯示最後一頁)、狀態保存(`state-key` 把欄順序、隱藏、寬度、排序、每頁筆數存 localStorage;綁定的 props 優先;匯出 `loadGridState`/`saveGridState`)。新增 labels:`columns`、`resetColumns`、`filtered`、`noMatch`、`pageSize`(九種語系皆已翻譯)。**可見變更:**沒有 `width` 的欄改為平均分配剩餘寬度而非依內容;表格最後固定有填充欄。**行為變更:**沒綁 `page` 的 grid 點頁尾按鈕會自己換頁(以前只 emit)。App 升級時:主欄設 `flex: 2` 與 `minWidth`,選用欄(開始/完成時間、速度)設 `defaultHidden`,加上 `column-chooser`、`column-reorder`、`page-sizes`、`state-key`,並把 `SearchField variant="filter"` 綁到 `filter`;移除自己在一般儲存格加的 `title` 與只篩選目前頁的程式。
|
|
16
|
+
|
|
3
17
|
## 0.10.5 (2026-10-17)
|
|
4
18
|
|
|
5
19
|
- **Visible change:** `Checkbox`, `RadioGroup` and the `TreeView` checkbox use an 18 px box with a 9 px text gap (was 16 px and 8 px); the check, indeterminate dash and radio dot scale with the box. Labels use a 20 px line height and vertical `RadioGroup` / `CheckboxGroup` items have an 8 px gap: the net row pitch is 28 px (20 + 8), down from the intermediate 30 px. Tokens `--ui-choice-box-size`, `--ui-choice-box-gap`, `--ui-choice-box-offset` and `--ui-choice-stack-gap` control these sizes. Textless DataGrid selection boxes, including select-all, are centred without the inline line-box offset; the horizontal gap remains 34 px (`--ui-choice-inline-gap`).
|
package/README.md
CHANGED
|
@@ -475,30 +475,49 @@ maps its own states to six link states.
|
|
|
475
475
|
|
|
476
476
|
### DataGrid
|
|
477
477
|
|
|
478
|
+
`DataGrid` is the list for data that grows (downloads, tasks, files): sorting,
|
|
479
|
+
column chooser, column reorder, resize, quick filter, paging and saved view
|
|
480
|
+
state. `DataTable` stays the small read-only table that becomes cards on a
|
|
481
|
+
phone; use `DataGrid` for anything a user searches or arranges.
|
|
482
|
+
|
|
478
483
|
```vue
|
|
484
|
+
<SearchField v-model="filter" variant="filter" />
|
|
479
485
|
<DataGrid
|
|
480
|
-
:columns="[
|
|
486
|
+
:columns="[
|
|
487
|
+
{ key: 'name', label: '名稱', sortable: true, flex: 2, minWidth: 200, hideable: false },
|
|
488
|
+
{ key: 'size', label: '大小', sortable: true, width: 90, align: 'right' },
|
|
489
|
+
{ key: 'location', label: '存放位置', minWidth: 120 },
|
|
490
|
+
{ key: 'started', label: '開始時間', sortable: true, width: 140, defaultHidden: true },
|
|
491
|
+
]"
|
|
481
492
|
:rows="rows"
|
|
482
|
-
:
|
|
483
|
-
|
|
493
|
+
:filter="filter"
|
|
494
|
+
:page-sizes="[50, 100, 200]"
|
|
495
|
+
state-key="downloads"
|
|
496
|
+
column-chooser
|
|
497
|
+
column-reorder
|
|
484
498
|
footer
|
|
485
499
|
refreshable
|
|
486
|
-
:labels="{ items: n => `${n} 個項目`, refresh: '重新整理', empty: '沒有資料' }"
|
|
487
500
|
@refresh="reload"
|
|
488
501
|
/>
|
|
489
502
|
```
|
|
490
503
|
|
|
504
|
+
- **Column widths.** A column with `width` (px, or a percentage of the grid) keeps it; a column without one is flexible and shares the rest by `flex` (default 1), never below its `minWidth` (default 80px for a flexible column, 40px for a fixed one). A long text cannot widen its column, and a header never wraps. When the minimums do not fit (a phone), the grid scrolls sideways instead of squeezing.
|
|
505
|
+
- **Long text.** A plain cell is cut to one line with an ellipsis and shows its full text on hover (`title`); `wrap: true` wraps a column instead. A `#cell-<key>` slot renders its own content: `CellText` cuts and titles it the same way.
|
|
491
506
|
- **Sort.** Click a sortable header, or focus it and press Enter/Space (`aria-sort` is set). Cycle: ascending, descending, off. Leave `sort` unbound and the grid sorts itself (start with `default-sort`); bind `v-model:sort` to control it; with `:local-sort="false"` it only emits.
|
|
492
|
-
- **Column
|
|
507
|
+
- **Column chooser.** `column-chooser` adds a columns button at the right of the header: the user shows and hides columns and resets them. `hideable: false` keeps a column, `defaultHidden: true` starts one hidden; the last shown column cannot be hidden. Bind `v-model:hidden-columns` to control it.
|
|
508
|
+
- **Column reorder.** `column-reorder` lets the user drag a header onto another, or focus it and press Alt+Left/Right. Bind `v-model:column-order` to control it; keys of new columns not in a saved order follow at the end.
|
|
509
|
+
- **Column resize.** Drag the right edge of a header, or focus the edge and press the left/right arrows (10px). Persist widths with `v-model:column-widths` (or `@column-resize`); pass them back to restore. `resizable` is on by default; turn it off per grid or per column.
|
|
510
|
+
- **Quick filter.** `filter` shows the rows whose shown, searchable columns contain the text (case-insensitive), across every page, before sorting and paging. `searchable: false` leaves a column out, `searchText(row)` gives the text to search, `filter-row(row, text)` replaces the match. Rows that come filtered from a server: `:local-filter="false"`. The footer reads "3 of 240 items" and an empty result says nothing matches.
|
|
511
|
+
- **Paging.** Long lists are paged in the footer (20 rows per page by default). `page` and `page-size` work unbound or with `v-model:page` / `v-model:page-size`; `page-sizes` adds the page-size choice. A new filter, sort or page size goes back to page 1, and a page past the end shows the last one. With `:local-pagination="false"` and `total-rows` the app pages on its server. Virtual scrolling is not provided.
|
|
512
|
+
- **Saved view.** `state-key="downloads"` saves the user's column order, hidden columns, widths, sort and page size in this browser (localStorage) and restores them; bound props win. To keep them on a server, bind the v-models instead, or use the exported `loadGridState` / `saveGridState`. `resetColumns()` (exposed) and the chooser's Reset restore order, visibility and widths.
|
|
493
513
|
- **Layout.** Sticky header (default), column dividers, hover and selected row colours, `max-height` to scroll inside the grid. `selectable` adds checkboxes; with `select-on-row-click` a row click selects the row and Ctrl/Cmd-click toggles it.
|
|
494
|
-
- **Footer bar.** `footer` shows the DSM bar with the item count; `refreshable` adds the refresh button (`@refresh`, `refreshing` spins it). Without `footer` it appears
|
|
495
|
-
- **Localisation.** Every built-in string goes through `labels`: `empty`, `items(count)`, `page(page, count)`, `previous`, `next`, `refresh`, `selectAll`, `selectRow(key)`, `resizeColumn(label)`. `emptyText` still works.
|
|
514
|
+
- **Footer bar.** `footer` shows the DSM bar with the item count; `refreshable` adds the refresh button (`@refresh`, `refreshing` spins it). Without `footer` it appears when there is more than one page, a page-size choice that matters, or a `#footer` slot.
|
|
515
|
+
- **Localisation.** Every built-in string goes through `labels`: `empty`, `noMatch`, `items(count)`, `filtered(count, total)`, `page(page, count)`, `previous`, `next`, `pageSize`, `refresh`, `selectAll`, `selectRow(key)`, `resizeColumn(label)`, `columns`, `resetColumns`. `emptyText` still works.
|
|
496
516
|
- **Loading.** `loading` masks the table with a centred indicator; `loading-text` adds a message.
|
|
497
517
|
- **Footer layout.** The footer has top and bottom divider lines and a separator
|
|
498
518
|
before Refresh. In a flex column with a bounded height, the grid fills the
|
|
499
519
|
remaining space and its rows scroll above the footer. Use `class="flex-none"`
|
|
500
520
|
for a grid that should retain its content height.
|
|
501
|
-
- Virtual scrolling is not provided; page long lists (`page-size`).
|
|
502
521
|
|
|
503
522
|
### Loading
|
|
504
523
|
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
stateKey?: string;
|
|
3
|
+
};
|
|
4
|
+
declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
5
|
+
declare const _default: typeof __VLS_export;
|
|
6
|
+
export default _default;
|
|
@@ -6,9 +6,22 @@ export type DataGridSort = {
|
|
|
6
6
|
export type DataGridColumn = {
|
|
7
7
|
key: string;
|
|
8
8
|
label: string;
|
|
9
|
-
/** A pixel width (`120`, `"120px"`)
|
|
9
|
+
/** A pixel width (`120`, `"120px"`) or a percentage of the grid; without it the column is flexible. */
|
|
10
10
|
width?: string | number;
|
|
11
|
+
/** Defaults to 80px for a flexible column, 40px for a fixed one. */
|
|
11
12
|
minWidth?: string | number;
|
|
13
|
+
/** A flexible column's share of the space the fixed columns leave; defaults to 1. */
|
|
14
|
+
flex?: number;
|
|
15
|
+
/** Wraps the cell text instead of cutting it to one line with an ellipsis. */
|
|
16
|
+
wrap?: boolean;
|
|
17
|
+
/** `false` keeps the column shown: the column chooser cannot hide it. */
|
|
18
|
+
hideable?: boolean;
|
|
19
|
+
/** Starts hidden; the user can show it from the column chooser. */
|
|
20
|
+
defaultHidden?: boolean;
|
|
21
|
+
/** `false` leaves the column out of the quick filter. */
|
|
22
|
+
searchable?: boolean;
|
|
23
|
+
/** The text the quick filter searches for a row; defaults to the cell value. */
|
|
24
|
+
searchText?: (row: Record<string, unknown>) => string;
|
|
12
25
|
align?: 'left' | 'center' | 'right';
|
|
13
26
|
sortable?: boolean;
|
|
14
27
|
/** Overrides the grid's `resizable` for this column. */
|
|
@@ -105,9 +118,19 @@ type __VLS_Props = {
|
|
|
105
118
|
selectOnRowClick?: boolean;
|
|
106
119
|
/** One selected row at a time, picked by clicking the row; no checkbox column. */
|
|
107
120
|
singleSelect?: boolean;
|
|
121
|
+
/** Bind to control the page; leave unset and the grid pages by itself. */
|
|
108
122
|
page?: number;
|
|
123
|
+
/** Rows per page; defaults to the first of `pageSizes`, else 20. Bind with `v-model:page-size` to follow the user's choice. */
|
|
109
124
|
pageSize?: number;
|
|
125
|
+
/** Page sizes the user can pick from in the footer, e.g. `[20, 50, 100]`. */
|
|
126
|
+
pageSizes?: number[];
|
|
110
127
|
totalRows?: number;
|
|
128
|
+
/** Quick filter text: shows the rows whose shown, searchable columns contain it, across all pages. */
|
|
129
|
+
filter?: string;
|
|
130
|
+
/** Replaces the quick filter's match with your own; it gets the trimmed, lower-cased filter text. */
|
|
131
|
+
filterRow?: (row: Record<string, unknown>, text: string) => boolean;
|
|
132
|
+
/** `false` when the rows arrive filtered (a server search): the grid shows them as they are. */
|
|
133
|
+
localFilter?: boolean;
|
|
111
134
|
localSort?: boolean;
|
|
112
135
|
localPagination?: boolean;
|
|
113
136
|
loading?: boolean;
|
|
@@ -119,6 +142,20 @@ type __VLS_Props = {
|
|
|
119
142
|
resizable?: boolean;
|
|
120
143
|
/** Persisted column widths in px, by column key. */
|
|
121
144
|
columnWidths?: DataGridColumnWidths;
|
|
145
|
+
/** Column keys in display order; bind to keep the user's order, leave unset and the grid tracks it. */
|
|
146
|
+
columnOrder?: string[];
|
|
147
|
+
/** Keys of hidden columns; defaults to the columns marked `defaultHidden`. */
|
|
148
|
+
hiddenColumns?: string[];
|
|
149
|
+
/**
|
|
150
|
+
* Saves the user's column order, hidden columns, widths, sort and page size
|
|
151
|
+
* in this browser under this key and restores them. Bound props win; to keep
|
|
152
|
+
* them on a server, bind the v-models instead.
|
|
153
|
+
*/
|
|
154
|
+
stateKey?: string;
|
|
155
|
+
/** A header menu where the user shows and hides columns and resets them. */
|
|
156
|
+
columnChooser?: boolean;
|
|
157
|
+
/** Drag a header onto another, or press Alt+Left/Right on it, to move the column. */
|
|
158
|
+
columnReorder?: boolean;
|
|
122
159
|
/** `true` always shows the footer bar, `false` never; unset shows it when paged or given a slot. */
|
|
123
160
|
footer?: boolean;
|
|
124
161
|
refreshable?: boolean;
|
|
@@ -137,6 +174,7 @@ type __VLS_Props = {
|
|
|
137
174
|
/** Row reordering with drag and drop plus keyboard support. */
|
|
138
175
|
draggable?: boolean | DataGridDraggable;
|
|
139
176
|
};
|
|
177
|
+
declare function resetColumns(): void;
|
|
140
178
|
type __VLS_Slots = {
|
|
141
179
|
empty?: (props: Record<string, never>) => unknown;
|
|
142
180
|
'group-title'?: (props: DataGridGroupSlotProps) => unknown;
|
|
@@ -160,12 +198,16 @@ declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {
|
|
|
160
198
|
collapseAllGroups: () => void;
|
|
161
199
|
moveRowUp: (row: Record<string, unknown>) => void;
|
|
162
200
|
moveRowDown: (row: Record<string, unknown>) => void;
|
|
201
|
+
resetColumns: typeof resetColumns;
|
|
163
202
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
164
203
|
refresh: () => any;
|
|
204
|
+
"update:pageSize": (value: number) => any;
|
|
165
205
|
"update:sort": (value: DataGridSort | null) => any;
|
|
166
206
|
"update:selectedKeys": (value: string[]) => any;
|
|
167
207
|
"update:page": (value: number) => any;
|
|
168
208
|
"update:columnWidths": (value: DataGridColumnWidths) => any;
|
|
209
|
+
"update:columnOrder": (value: string[]) => any;
|
|
210
|
+
"update:hiddenColumns": (value: string[]) => any;
|
|
169
211
|
"update:rows": (value: Record<string, unknown>[]) => any;
|
|
170
212
|
"update:expandedKeys": (value: string[]) => any;
|
|
171
213
|
columnResize: (value: {
|
|
@@ -192,10 +234,13 @@ declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {
|
|
|
192
234
|
cellUpdate: (value: DataGridCellUpdate) => any;
|
|
193
235
|
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
194
236
|
onRefresh?: (() => any) | undefined;
|
|
237
|
+
"onUpdate:pageSize"?: ((value: number) => any) | undefined;
|
|
195
238
|
"onUpdate:sort"?: ((value: DataGridSort | null) => any) | undefined;
|
|
196
239
|
"onUpdate:selectedKeys"?: ((value: string[]) => any) | undefined;
|
|
197
240
|
"onUpdate:page"?: ((value: number) => any) | undefined;
|
|
198
241
|
"onUpdate:columnWidths"?: ((value: DataGridColumnWidths) => any) | undefined;
|
|
242
|
+
"onUpdate:columnOrder"?: ((value: string[]) => any) | undefined;
|
|
243
|
+
"onUpdate:hiddenColumns"?: ((value: string[]) => any) | undefined;
|
|
199
244
|
"onUpdate:rows"?: ((value: Record<string, unknown>[]) => any) | undefined;
|
|
200
245
|
"onUpdate:expandedKeys"?: ((value: string[]) => any) | undefined;
|
|
201
246
|
onColumnResize?: ((value: {
|
|
@@ -222,6 +267,7 @@ declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {
|
|
|
222
267
|
onCellUpdate?: ((value: DataGridCellUpdate) => any) | undefined;
|
|
223
268
|
}>, {
|
|
224
269
|
footer: boolean;
|
|
270
|
+
filter: string;
|
|
225
271
|
sort: DataGridSort | null;
|
|
226
272
|
loading: boolean;
|
|
227
273
|
group: DataGridGroup | null;
|
|
@@ -231,15 +277,20 @@ declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {
|
|
|
231
277
|
pageSize: number;
|
|
232
278
|
selectable: boolean;
|
|
233
279
|
rowKey: string;
|
|
280
|
+
columnOrder: string[];
|
|
281
|
+
hiddenColumns: string[];
|
|
234
282
|
defaultSort: DataGridSort | null;
|
|
235
283
|
selectedKeys: string[];
|
|
236
284
|
selectOnRowClick: boolean;
|
|
237
285
|
singleSelect: boolean;
|
|
286
|
+
localFilter: boolean;
|
|
238
287
|
localSort: boolean;
|
|
239
288
|
localPagination: boolean;
|
|
240
289
|
loadingRows: number;
|
|
241
290
|
stickyHeader: boolean;
|
|
242
291
|
resizable: boolean;
|
|
292
|
+
columnChooser: boolean;
|
|
293
|
+
columnReorder: boolean;
|
|
243
294
|
refreshable: boolean;
|
|
244
295
|
refreshing: boolean;
|
|
245
296
|
expandable: DataGridExpandable | null;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Columns in a saved order: keys the order names come first, in its order;
|
|
3
|
+
* columns it does not name (added since it was saved) follow in their own
|
|
4
|
+
* order; keys of columns that are gone are ignored.
|
|
5
|
+
*/
|
|
6
|
+
export declare function orderColumns<T extends {
|
|
7
|
+
key: string;
|
|
8
|
+
}>(columns: T[], order: string[]): T[];
|
|
9
|
+
/** `keys` with `key` moved to index `to`. */
|
|
10
|
+
export declare function moveKey(keys: string[], key: string, to: number): string[];
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
export declare const DEFAULT_MIN_COLUMN_WIDTH = 40;
|
|
2
|
-
|
|
2
|
+
/** A flexible column keeps room for a short header and a few characters. */
|
|
3
|
+
export declare const FLEX_MIN_COLUMN_WIDTH = 80;
|
|
3
4
|
export declare const KEYBOARD_RESIZE_STEP = 10;
|
|
4
5
|
/** A pixel width from a number or a `"120px"` / `"120"` string; other units are unknown. */
|
|
5
6
|
export declare function toPixels(value: string | number | undefined): number | undefined;
|
|
6
7
|
export declare function clampWidth(width: number, minWidth: number): number;
|
|
8
|
+
export type ColumnWidthSpec = {
|
|
9
|
+
key: string;
|
|
10
|
+
/** A fixed width in px; without it the column shares the rest by `flex`. */
|
|
11
|
+
width?: number;
|
|
12
|
+
minWidth: number;
|
|
13
|
+
flex: number;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Pixel widths for every column: fixed ones keep theirs, flexible ones share
|
|
17
|
+
* what is left by weight and never drop below their minimum. Unknown space
|
|
18
|
+
* (`0`) gives the minimums, so the grid scrolls rather than squeezes.
|
|
19
|
+
*/
|
|
20
|
+
export declare function distributeColumnWidths(columns: ColumnWidthSpec[], available: number): Record<string, number>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Text overrides for the grid chrome. The
|
|
2
|
+
* Text overrides for the grid chrome. The row-operation and column labels were added
|
|
3
3
|
* after the first release and stay optional so an existing external
|
|
4
4
|
* `DataGridLabels` object literal keeps compiling; the grid merges the defaults in.
|
|
5
5
|
*/
|
|
@@ -16,12 +16,26 @@ export type DataGridLabels = {
|
|
|
16
16
|
expandRow?: (key: string) => string;
|
|
17
17
|
collapseRow?: (key: string) => string;
|
|
18
18
|
reorderRow?: (key: string) => string;
|
|
19
|
+
/** The column chooser button. */
|
|
20
|
+
columns?: string;
|
|
21
|
+
resetColumns?: string;
|
|
22
|
+
/** The item count while the quick filter hides rows. */
|
|
23
|
+
filtered?: (count: number, total: number) => string;
|
|
24
|
+
/** The empty text when rows exist but none matches the filter. */
|
|
25
|
+
noMatch?: string;
|
|
26
|
+
/** The page-size chooser. */
|
|
27
|
+
pageSize?: string;
|
|
19
28
|
};
|
|
20
29
|
/** `DataGridLabels` after the defaults were merged in: every label is present. */
|
|
21
30
|
export type ResolvedDataGridLabels = DataGridLabels & {
|
|
22
31
|
expandRow: (key: string) => string;
|
|
23
32
|
collapseRow: (key: string) => string;
|
|
24
33
|
reorderRow: (key: string) => string;
|
|
34
|
+
columns: string;
|
|
35
|
+
resetColumns: string;
|
|
36
|
+
filtered: (count: number, total: number) => string;
|
|
37
|
+
noMatch: string;
|
|
38
|
+
pageSize: string;
|
|
25
39
|
};
|
|
26
40
|
export declare const defaultDataGridLabels: ResolvedDataGridLabels;
|
|
27
41
|
/** Locale-aware chrome; the exported English defaults remain available to callers. */
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type FilterColumn = {
|
|
2
|
+
key: string;
|
|
3
|
+
searchable?: boolean;
|
|
4
|
+
searchText?: (row: Record<string, unknown>) => string;
|
|
5
|
+
};
|
|
6
|
+
/** The filter text as matched: trimmed and case-folded; empty matches every row. */
|
|
7
|
+
export declare const normalizeFilter: (text: string | undefined) => string;
|
|
8
|
+
/** Whether a searchable column's text (its value, or `searchText`) contains the normalized filter. */
|
|
9
|
+
export declare function rowMatches(row: Record<string, unknown>, columns: FilterColumn[], filter: string): boolean;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** What a user changed in a grid's view; every field is optional. */
|
|
2
|
+
export type DataGridViewState = {
|
|
3
|
+
columnOrder?: string[];
|
|
4
|
+
hiddenColumns?: string[];
|
|
5
|
+
columnWidths?: Record<string, number>;
|
|
6
|
+
sort?: {
|
|
7
|
+
key: string;
|
|
8
|
+
direction: 'asc' | 'desc';
|
|
9
|
+
} | null;
|
|
10
|
+
pageSize?: number;
|
|
11
|
+
};
|
|
12
|
+
/** The view state saved under `key` in this browser; fields it cannot trust are dropped. */
|
|
13
|
+
export declare function loadGridState(key: string): DataGridViewState;
|
|
14
|
+
/** Saves the view state under `key`; a browser that refuses storage keeps the grid working unsaved. */
|
|
15
|
+
export declare function saveGridState(key: string, state: DataGridViewState): void;
|
|
@@ -7,7 +7,9 @@ declare var __VLS_1: {};
|
|
|
7
7
|
type __VLS_Slots = {} & {
|
|
8
8
|
default?: (props: typeof __VLS_1) => any;
|
|
9
9
|
};
|
|
10
|
-
declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {
|
|
10
|
+
declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {
|
|
11
|
+
viewport: Readonly<import('vue').ShallowRef<HTMLElement | null>>;
|
|
12
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
11
13
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
12
14
|
declare const _default: typeof __VLS_export;
|
|
13
15
|
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
2
|
/** Observe the component's container, including DSM window resizes that do not
|
|
3
3
|
* resize the document viewport. Zero is unknown (e.g. hidden tab or SSR). */
|
|
4
|
-
export declare function useElementWidth(element: Readonly<
|
|
4
|
+
export declare function useElementWidth(element: Readonly<Ref<HTMLElement | null | undefined>>): Ref<number, number>;
|
package/dist/i18n/text.d.ts
CHANGED
|
@@ -122,6 +122,10 @@ export declare const englishUiText: {
|
|
|
122
122
|
readonly "Expand row {key}": "Expand row {key}";
|
|
123
123
|
readonly "Collapse row {key}": "Collapse row {key}";
|
|
124
124
|
readonly "Reorder row {key}": "Reorder row {key}";
|
|
125
|
+
readonly Columns: "Columns";
|
|
126
|
+
readonly "Reset columns": "Reset columns";
|
|
127
|
+
readonly "{count} of {total} items": "{count} of {total} items";
|
|
128
|
+
readonly "No matching items": "No matching items";
|
|
125
129
|
readonly "Sort by {name}": "Sort by {name}";
|
|
126
130
|
readonly "Value is required": "Value is required";
|
|
127
131
|
readonly "Value does not match the expected format": "Value does not match the expected format";
|
package/dist/index.d.ts
CHANGED
|
@@ -126,6 +126,7 @@ export { default as Statistic } from './components/composite/statistic/Statistic
|
|
|
126
126
|
export type { DataTableColumn } from './components/composite/data-table/DataTable.vue';
|
|
127
127
|
export { default as DataGrid } from './components/composite/data-grid/DataGrid.vue';
|
|
128
128
|
export type { DataGridColumn, DataGridColumnWidths, DataGridLabels, ResolvedDataGridLabels, DataGridSort, DataGridGroup, DataGridExpandable, DataGridDraggable, DataGridReorder, DataGridCellUpdate, DataGridAdapter, DataGridCellSlotProps } from './components/composite/data-grid/DataGrid.vue';
|
|
129
|
+
export { loadGridState, saveGridState, type DataGridViewState } from './components/composite/data-grid/viewState';
|
|
129
130
|
export { default as TreeView } from './components/composite/tree-view/TreeView.vue';
|
|
130
131
|
export type { TreeNode, TreeViewCheckPayload, TreeViewDraggableConfig, TreeViewPosition, TreeViewReorder } from './components/composite/tree-view/TreeView.vue';
|
|
131
132
|
export { default as FilePicker } from './components/composite/file-picker/FilePicker.vue';
|