@knime/kds-table 10.2.0 → 11.1.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.
Files changed (3) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +70 -30
  3. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @knime/kds-table
2
2
 
3
+ ## 11.1.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [1cbcad8]
8
+ - @knime/kds-styles@11.1.0
9
+ - @knime/kds-components@11.1.0
10
+
11
+ ## 11.0.0
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [880698d, df12b1a]
16
+ - @knime/kds-components@11.0.0
17
+ - @knime/kds-styles@11.0.0
18
+
3
19
  ## 10.2.0
4
20
 
5
21
  ### Patch Changes
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # KNIME® Design System – Table Component
2
2
 
3
- This is part of the [KNIME Design System](../README.md).
3
+ This is part of the [KNIME Design System](../../README.md).
4
4
 
5
5
  This package contains the table component used by e.g. the TableView of KNIME Analytics Platform and KNIME Hub. It is based on the [Vue] JavaScript framework and built on the KNIME Design System tokens.
6
6
 
@@ -8,7 +8,7 @@ It's published as npm package: [@knime/kds-table]
8
8
 
9
9
  ## Development
10
10
 
11
- This package is part of the [KNIME Design System monorepo](../README.md). For setup instructions, see the **[root README](../README.md)**.
11
+ This package is part of the [KNIME Design System monorepo](../../README.md). For setup instructions, see the **[root README](../../README.md)**.
12
12
 
13
13
  ### Launch development server
14
14
 
@@ -34,17 +34,14 @@ Coverage data is collected at the root level and merged with Storybook coverage
34
34
  ### TypeScript setup
35
35
 
36
36
  The package-level [tsconfig.json](tsconfig.json) is the source of truth for editor support and `pnpm run type-check`.
37
- The build-specific [tsconfig.build.json](tsconfig.build.json) extends it and only overrides declaration output plus build-only excludes. The remaining differences to `@knime/kds-components` are intentional for now:
37
+ The build-specific [tsconfig.build.json](tsconfig.build.json) extends it and only overrides declaration output plus build-only excludes. Unlike `@knime/kds-components`, it sets `allowJs`, because some unit tests under `src/**/__tests__` are still JavaScript.
38
38
 
39
- - `allowJs`, because the package still ships typed JavaScript utility modules.
40
- - The `@knime/components` path stub, to stop `vue-tsc` from following that package's source export.
41
-
42
- The package now uses [src/index.ts](src/index.ts) as its public entrypoint, aligned with `@knime/kds-components`.
39
+ The package uses [src/index.ts](src/index.ts) as its public entrypoint, aligned with `@knime/kds-components`.
43
40
  Type declarations are emitted as a source-like tree under `dist/src`, and the published `types` entry points to `dist/src/index.d.ts`.
44
41
 
45
42
  ### Logging
46
43
 
47
- You can log using the global `consola` variable (which the embedding application needs to provide).
44
+ The table logs via the global `consola` variable, which the embedding application needs to provide (e.g. `window.consola = consola`).
48
45
 
49
46
  See https://github.com/nuxt/consola for details.
50
47
 
@@ -53,46 +50,91 @@ See https://github.com/nuxt/consola for details.
53
50
  To build the table component as [Vue library]:
54
51
 
55
52
  ```sh
56
- pnpm run build # Build only this package
57
- pnpm run build # From root: builds all packages including table
53
+ pnpm run build # From this package: build only the table
54
+ pnpm run build:table # From the monorepo root: build only the table
55
+ pnpm run build # From the monorepo root: build all packages
58
56
  ```
59
57
 
60
58
  Results are saved to `dist/`.
61
59
 
62
60
  ## Versioning & Publishing
63
61
 
64
- Versioning and publishing are managed at the **[root level](../README.md#changesets--publishing)**.
62
+ Versioning and publishing are managed at the **[root level](../../README.md#changesets--publishing)**.
65
63
 
66
- All `@knime/kds-*` packages (including this table) are versioned together via Changesets. For release workflows, see the [root README](../README.md).
64
+ All `@knime/kds-*` packages (including this table) are versioned together via Changesets. For release workflows, see the [root README](../../README.md).
67
65
 
68
66
  ## Using the table component in a Vue application
69
67
 
70
- Install [@knime/kds-table] npm package as dependency:
68
+ Install the [@knime/kds-table] npm package together with `@knime/kds-styles`. It declares `vue` and `@vueuse/core` as peer dependencies:
71
69
 
72
70
  ```sh
73
- pnpm add @knime/kds-table
71
+ pnpm add @knime/kds-table @knime/kds-styles vue @vueuse/core
74
72
  ```
75
73
 
76
- ```js
77
- import { Table } from "@knime/kds-table";
74
+ The table uses the KDS CSS variables but does not load them. Import them once in your app (e.g. in `main.ts`):
78
75
 
79
- export default {
80
- // ...
81
- components: {
82
- Table,
83
- },
84
- // ...
85
- };
76
+ ```ts
77
+ import "@knime/kds-styles/kds-variables.css";
86
78
  ```
87
79
 
88
- Use in Template
80
+ `TableUI` must be rendered below a `useColumnSizes` provider, which sets the
81
+ column-width CSS variables on the given element. The table fills its parent
82
+ (`height: 100%`), so give that element a height:
83
+
84
+ ```vue
85
+ <script setup lang="ts">
86
+ import { ref } from "vue";
87
+
88
+ import {
89
+ type ColumnConfig,
90
+ type TableConfig,
91
+ TableUI,
92
+ columnTypes,
93
+ useColumnSizes,
94
+ } from "@knime/kds-table";
95
+
96
+ const columns: ColumnConfig[] = [
97
+ { id: "name", key: "name", header: "Name", type: columnTypes.String },
98
+ { id: "age", key: "age", header: "Age", type: columnTypes.Number },
99
+ ];
100
+
101
+ // An array of row groups; the rows to display go into the first group.
102
+ const data = [
103
+ [
104
+ { name: "Ada", age: 36 },
105
+ { name: "Alan", age: 41 },
106
+ ],
107
+ ];
108
+
109
+ const tableConfig: TableConfig = { enableColumnResizing: true };
110
+
111
+ const tableRoot = ref<HTMLElement | null>(null);
112
+ const colSizes = ref([200, 100]);
113
+ useColumnSizes(colSizes, tableRoot);
114
+ </script>
89
115
 
90
- ```xml
91
116
  <template>
92
- <Table />
117
+ <div ref="tableRoot" style="height: 300px">
118
+ <!-- `data` and `columns` are required; `tableConfig` toggles table features. -->
119
+ <TableUI :data="data" :columns="columns" :table-config="tableConfig" />
120
+ </div>
93
121
  </template>
94
122
  ```
95
123
 
124
+ Unlike the other KDS packages, this package's exports are **not** `Kds`-prefixed —
125
+ it predates that convention. The main entry points are:
126
+
127
+ | Export | Kind | Description |
128
+ | -------------------------------- | ---------- | ----------------------------------------------------------------------------- |
129
+ | `TableUI` | component | The table |
130
+ | `TableUIWithAutoSizeCalculation` | component | `TableUI` wrapper that measures content for auto column sizes and row heights |
131
+ | `TableActionBar` | component | Action bar (search, sort, …) rendered above the table |
132
+ | `useColumnSizes` | composable | Provides the column sizes to the table (required) |
133
+ | `constants` | const | Shared table constants |
134
+
135
+ See [`src/index.ts`](src/index.ts) for the complete public API, and the
136
+ **Table** section of the design-system Storybook for live examples.
137
+
96
138
  ### Using with Vitest, Nuxt, or Vite SSR
97
139
 
98
140
  The published JavaScript imports its CSS as a side effect (e.g.
@@ -124,12 +166,10 @@ export default defineNuxtConfig({ build: { transpile: [/@knime\//] } });
124
166
 
125
167
  The KNIME-Table expects that the embedding app provides the following:
126
168
 
127
- - Vue and Consola compatible to the versions defined in [`package.json`](package.json)
169
+ - `vue` and `@vueuse/core` matching the peer dependency ranges in [`package.json`](package.json)
170
+ - a global `consola` instance (see [Logging](#logging))
128
171
 
129
172
  [Vue]: https://vuejs.org/
130
- [node]: https://knime-com.atlassian.net/wiki/spaces/SPECS/pages/905281540/Node.js+Installation
131
173
  [Vue library]: https://vitejs.dev/guide/build.html#library-mode
132
174
  [Vitest]: https://vitest.dev/
133
- [lcov]: https://github.com/linux-test-project/lcov
134
- [clover]: http://openclover.org/
135
175
  [@knime/kds-table]: https://www.npmjs.com/package/@knime/kds-table
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@knime/kds-table",
3
3
  "type": "module",
4
- "version": "10.2.0",
4
+ "version": "11.1.0",
5
5
  "description": "Package containing the table component of the KNIME Design System",
6
6
  "license": "See LICENSE file",
7
7
  "author": "KNIME AG, Zurich, Switzerland",
@@ -10,8 +10,8 @@
10
10
  "vue": "~3.5.0"
11
11
  },
12
12
  "dependencies": {
13
- "@knime/kds-components": "^10.2.0",
14
- "@knime/kds-styles": "^10.2.0",
13
+ "@knime/kds-components": "^11.1.0",
14
+ "@knime/kds-styles": "^11.1.0",
15
15
  "@knime/utils": "^2.0.3",
16
16
  "@knime/vue-headless-virtual-scroller": "0.2.0",
17
17
  "fast-deep-equal": "3.1.3",