ui-sdk-table-vue 0.1.2 → 0.1.3

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/docs/agents.md CHANGED
@@ -27,7 +27,7 @@ const columns: ColumnDef<Ship>[] = [
27
27
 
28
28
  // The agent of UI SDK sees every component of the page that has a name, and its actions.
29
29
  const agent = createAgent()
30
- const answer = shallowRef('')
30
+ const answer = shallowRef('No action yet.')
31
31
 
32
32
  async function act(action: string, args: unknown[]) {
33
33
  const result = await agent.act({ steps: [{ ref: 'Ships in port', action, args }] })
@@ -24,7 +24,7 @@ const people: Person[] = [
24
24
  const columns: ColumnDef<Person>[] = [
25
25
  { id: 'name', header: 'Name', sortable: true },
26
26
  { id: 'team', header: 'Team', sortable: true },
27
- { id: 'score', header: 'Score', sortable: true },
27
+ { id: 'score', header: 'Score', sortable: true, format: 'integer' },
28
28
  ]
29
29
  </script>
30
30
 
package/docs/formats.md CHANGED
@@ -27,8 +27,18 @@ const funds: Fund[] = [
27
27
 
28
28
  const columns: ColumnDef<Fund>[] = [
29
29
  { id: 'fund', header: 'Fund' },
30
- { id: 'fee', header: 'Fee', format: 'decimal' },
31
- { id: 'year', header: 'One year', format: 'decimal' },
30
+ {
31
+ id: 'fee',
32
+ header: 'Fee',
33
+ format: 'decimal',
34
+ formatOptions: { minimumFractionDigits: 4, maximumFractionDigits: 4 },
35
+ },
36
+ {
37
+ id: 'year',
38
+ header: 'One year',
39
+ format: 'percentage',
40
+ formatOptions: { minimumFractionDigits: 1, maximumFractionDigits: 1, showUnit: true },
41
+ },
32
42
  ]
33
43
 
34
44
  const controller = createTableController()
package/docs/llms.txt CHANGED
@@ -138,7 +138,7 @@ const people: Person[] = [
138
138
  const columns: ColumnDef<Person>[] = [
139
139
  { id: 'name', header: 'Name', sortable: true },
140
140
  { id: 'team', header: 'Team', sortable: true },
141
- { id: 'score', header: 'Score', sortable: true },
141
+ { id: 'score', header: 'Score', sortable: true, format: 'integer' },
142
142
  ]
143
143
  </script>
144
144
 
package/docs/rows.md CHANGED
@@ -149,6 +149,11 @@ const products: Product[] = [
149
149
  { id: 'p3', name: 'Green tea', stock: 120 },
150
150
  { id: 'p4', name: 'Dark coffee', stock: 3 },
151
151
  { id: 'p5', name: 'Honey', stock: 27 },
152
+ { id: 'p6', name: 'Rice', stock: 64 },
153
+ { id: 'p7', name: 'Lentils', stock: 15 },
154
+ { id: 'p8', name: 'Olive oil', stock: 22 },
155
+ { id: 'p9', name: 'Sea salt', stock: 90 },
156
+ { id: 'p10', name: 'Oats', stock: 37 },
152
157
  ]
153
158
 
154
159
  const columns: ColumnDef<Product>[] = [
@@ -161,26 +166,43 @@ const pinning = shallowRef<RowPinning>({ top: ['p4'] })
161
166
  </script>
162
167
 
163
168
  <template>
164
- <Table
165
- v-model:row-pinning="pinning"
166
- :rows="products"
167
- :columns="columns"
168
- :controller="controller"
169
- aria-label="Products, the pinned ones on top"
170
- >
171
- <template #col-name="{ row, text, pinned }">
172
- <button
173
- type="button"
174
- :aria-pressed="!!pinned"
175
- :aria-label="`Pin ${text} to the top`"
176
- @click="controller.pinRow(row.id, pinned ? null : 'top')"
177
- >
178
- {{ pinned ? '★' : '☆' }}
179
- </button>
180
- {{ text }}
181
- </template>
182
- </Table>
169
+ <!-- The frame scrolls. The header and the pinned rows stay at its top. -->
170
+ <div class="frame">
171
+ <Table
172
+ v-model:row-pinning="pinning"
173
+ :rows="products"
174
+ :columns="columns"
175
+ :controller="controller"
176
+ sticky-header
177
+ aria-label="Products, the pinned ones on top"
178
+ >
179
+ <template #col-name="{ row, text, pinned }">
180
+ <button
181
+ type="button"
182
+ :aria-pressed="!!pinned"
183
+ :aria-label="`Pin ${text} to the top`"
184
+ @click="controller.pinRow(row.id, pinned ? null : 'top')"
185
+ >
186
+ {{ pinned ? '★' : '☆' }}
187
+ </button>
188
+ {{ text }}
189
+ </template>
190
+ </Table>
191
+ </div>
183
192
  </template>
193
+
194
+ <style scoped>
195
+ .frame {
196
+ max-block-size: 230px;
197
+ overflow: auto;
198
+ border: 1px solid #e4e4e7;
199
+ }
200
+
201
+ /* What sticks needs a background of its own, so the rows that scroll under it do not show through. */
202
+ .frame :deep(tr[data-sticky] > *) {
203
+ background: #fff;
204
+ }
205
+ </style>
184
206
  ```
185
207
 
186
208
  Press the star before Honey to pin it. It moves to the top with Dark coffee, and a sort leaves both there.
@@ -241,6 +263,7 @@ const controller = createTableController()
241
263
  .frame {
242
264
  block-size: 280px;
243
265
  overflow: auto;
266
+ border: 1px solid #e4e4e7;
244
267
  }
245
268
 
246
269
  .frame :deep(tr[data-sticky] > *) {
@@ -60,7 +60,9 @@ const all = computed(() => {
60
60
  (on) => (on === true ? controller.selectAll() : controller.clearSelection())
61
61
  "
62
62
  >
63
- <CheckboxIndicator>✓</CheckboxIndicator>
63
+ <CheckboxIndicator v-slot="{ state }">{{
64
+ state.indeterminate ? '–' : '✓'
65
+ }}</CheckboxIndicator>
64
66
  </Checkbox>
65
67
  </template>
66
68
  <template #col-pick="{ row, selected: on, toggleSelected }">
@@ -173,6 +173,7 @@ function cancel() {
173
173
  <output data-testid="address">{{ bar.address.value || '—' }}</output>
174
174
  <input
175
175
  aria-label="Formula of the active cell"
176
+ placeholder="Press a cell"
176
177
  :value="bar.text.value"
177
178
  :disabled="!bar.ready.value"
178
179
  :aria-invalid="!!bar.error.value"
@@ -197,18 +197,19 @@ const lists = computed(() =>
197
197
  </script>
198
198
 
199
199
  <template>
200
- <ToggleGroup
201
- v-for="list in lists"
202
- :key="list.id"
203
- multiple
204
- :aria-label="list.label"
205
- :value="list.chosen"
206
- @value-change="(values) => controller.setColumnFilter(list.id, values)"
207
- >
208
- <Toggle v-for="facet in list.values" :key="facet.text" :value="String(facet.value)">
209
- {{ facet.text }} ({{ facet.count }})
210
- </Toggle>
211
- </ToggleGroup>
200
+ <div v-for="list in lists" :key="list.id">
201
+ <span :id="`facet-${list.id}`" class="control-label">{{ list.label }}</span>
202
+ <ToggleGroup
203
+ multiple
204
+ :aria-labelledby="`facet-${list.id}`"
205
+ :value="list.chosen"
206
+ @value-change="(values) => controller.setColumnFilter(list.id, values)"
207
+ >
208
+ <Toggle v-for="facet in list.values" :key="facet.text" :value="String(facet.value)">
209
+ {{ facet.text }} ({{ facet.count }})
210
+ </Toggle>
211
+ </ToggleGroup>
212
+ </div>
212
213
  <Table :rows="shoes" :columns="columns" :controller="controller" aria-label="Running shoes" />
213
214
  </template>
214
215
  ```
package/docs/styling.md CHANGED
@@ -55,8 +55,8 @@ const columns: ColumnDef<Reading>[] = [
55
55
 
56
56
  <style scoped>
57
57
  .frame {
58
- max-inline-size: 460px;
59
- max-block-size: 260px;
58
+ max-inline-size: 420px;
59
+ max-block-size: 220px;
60
60
  overflow: auto;
61
61
  border: 1px solid #e4e4e7;
62
62
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ui-sdk-table-vue",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Vue parts for the ui-sdk-table primitive: slots, v-model and controllers.",
5
5
  "keywords": [
6
6
  "data-grid",
@@ -37,7 +37,7 @@
37
37
  "access": "public"
38
38
  },
39
39
  "dependencies": {
40
- "ui-sdk-table-core": "0.1.2"
40
+ "ui-sdk-table-core": "0.1.3"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/jsdom": "^30.0.0",