@knime/kds-table 7.0.0 → 7.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @knime/kds-table
2
2
 
3
+ ## 7.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 2c25f9d: `TableUI`: added optional `rowCountItems` to `ActionConfig` — when given, the row count in the action bar becomes a dropdown offering these menu items (e.g. to choose how many rows to fetch), each carrying its own handler like `settingsItems`.
8
+ - 2c25f9d: `TableUI`: the action bar no longer replaces the table size with a "No data" placeholder when a table has neither rows nor columns; it shows the plain counts ("Rows: 0") instead.
9
+ - 2c25f9d: `TableUI`: `tableState.tableSizes.totalNumRows` may now be `null` for a table whose row count is unknown (e.g. a database table). The action bar then shows "Rows: -" instead of "Rows: 0", and never renders an "m of n" range against an unknown total.
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+ - @knime/kds-components@7.1.0
15
+ - @knime/kds-styles@7.1.0
16
+
3
17
  ## 7.0.0
4
18
 
5
19
  ### Patch Changes
package/dist/index.css CHANGED
@@ -215,7 +215,7 @@ tr {
215
215
  }
216
216
 
217
217
  .kds-table-action-bar {
218
- &[data-v-b0b2c849] {
218
+ &[data-v-6aefb7ab] {
219
219
  display: grid;
220
220
  grid-template-columns: 1fr 1fr 1fr;
221
221
  min-height: var(--kds-dimension-component-height-2-5x);
@@ -223,42 +223,61 @@ tr {
223
223
  padding-left: var(--kds-spacing-container-0-5x);
224
224
  border-bottom: var(--kds-border-base-subtle);
225
225
  }
226
- &.temporary-view[data-v-b0b2c849] {
226
+ &.temporary-view[data-v-6aefb7ab] {
227
227
  background-color: var(--kds-color-background-static-info-muted);
228
228
  }
229
- & .dimension[data-v-b0b2c849] {
230
- font: var(--kds-font-base-title-small);
231
- color: var(--kds-color-text-and-icon-muted);
229
+ & .dimension {
230
+ &[data-v-6aefb7ab] {
231
+ --dimension-font: var(--kds-font-base-title-small);
232
+ --dimension-color: var(--kds-color-text-and-icon-muted);
233
+
234
+ font: var(--dimension-font);
235
+ color: var(--dimension-color);
232
236
  white-space: pre;
237
+
238
+ /*
239
+ * Match the row-count dropdown trigger's label to the dimension text.
240
+ * :deep() is needed since KdsMenuButton is a multi-root component, so the
241
+ * scope id is not inherited by the button element the class lands on.
242
+ */
243
+ }
244
+ &.with-row-count-dropdown[data-v-6aefb7ab] {
245
+ display: inline-flex;
246
+ align-items: center;
247
+ }
248
+ &[data-v-6aefb7ab] .row-count-menu-button {
249
+ font: var(--dimension-font);
250
+ color: var(--dimension-color);
251
+ }
233
252
  }
234
253
  & .preview {
235
- &[data-v-b0b2c849] {
254
+ &[data-v-6aefb7ab] {
236
255
  display: flex;
237
256
  gap: var(--kds-spacing-container-0-12x);
238
257
  align-items: center;
239
258
  }
240
- & .preview-label[data-v-b0b2c849] {
259
+ & .preview-label[data-v-6aefb7ab] {
241
260
  font: var(--kds-font-base-title-small-strong);
242
261
  color: var(--kds-color-text-and-icon-neutral);
243
262
  }
244
263
  }
245
- & .left[data-v-b0b2c849],
246
- & .center[data-v-b0b2c849],
247
- & .right[data-v-b0b2c849] {
264
+ & .left[data-v-6aefb7ab],
265
+ & .center[data-v-6aefb7ab],
266
+ & .right[data-v-6aefb7ab] {
248
267
  display: flex;
249
268
  flex: 1;
250
269
  align-items: center;
251
270
  min-width: 0;
252
271
  padding: var(--kds-spacing-container-0-12x) 0;
253
272
  }
254
- & .left[data-v-b0b2c849],
255
- & .center[data-v-b0b2c849] {
273
+ & .left[data-v-6aefb7ab],
274
+ & .center[data-v-6aefb7ab] {
256
275
  gap: var(--kds-spacing-container-0-5x);
257
276
  }
258
- & .center[data-v-b0b2c849] {
277
+ & .center[data-v-6aefb7ab] {
259
278
  justify-content: center;
260
279
  }
261
- & .right[data-v-b0b2c849] {
280
+ & .right[data-v-6aefb7ab] {
262
281
  gap: var(--kds-spacing-container-0-25x);
263
282
  justify-content: flex-end;
264
283
  }
package/dist/index.js CHANGED
@@ -5654,9 +5654,13 @@ var _hoisted_3$1 = {
5654
5654
  };
5655
5655
  var _hoisted_4$1 = {
5656
5656
  key: 1,
5657
+ class: "dimension with-row-count-dropdown"
5658
+ };
5659
+ var _hoisted_5 = {
5660
+ key: 2,
5657
5661
  class: "dimension"
5658
5662
  };
5659
- var _hoisted_5 = { class: "right" };
5663
+ var _hoisted_6 = { class: "right" };
5660
5664
  //#endregion
5661
5665
  //#region src/components/control/TableActionBar.vue
5662
5666
  var TableActionBar_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
@@ -5688,19 +5692,24 @@ var TableActionBar_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
5688
5692
  /**
5689
5693
  * Renders "total" by default, and "current of total" only when `current` is
5690
5694
  * given and strictly below `total`. The `current >= total` guard prevents an
5691
- * inconsistent "m of n" where m would not be smaller than n.
5695
+ * inconsistent "m of n" where m would not be smaller than n. An unknown total
5696
+ * (`null`) renders as "-".
5692
5697
  */
5693
5698
  const formatCount = (label, total, current) => {
5699
+ if (total === null) return `${label}: -`;
5694
5700
  return `${label}: ${current !== void 0 && current < total ? `${current} of ${total}` : total}`;
5695
5701
  };
5696
- const dimensionText = computed(() => {
5697
- const totalNumRows = __props.tableSizes?.totalNumRows ?? 0;
5702
+ const rowText = computed(() => formatCount(__props.rowLabel, __props.tableSizes ? __props.tableSizes.totalNumRows : 0, __props.tableSizes?.currentNumRows));
5703
+ const columnText = computed(() => {
5698
5704
  const totalNumColumns = __props.tableSizes?.totalNumColumns ?? 0;
5699
- if (totalNumRows === 0 && totalNumColumns === 0) return "No data";
5700
- const rowText = formatCount(__props.rowLabel, totalNumRows, __props.tableSizes?.currentNumRows);
5701
- if (totalNumColumns < 2) return rowText;
5702
- return `${rowText} | ${formatCount("Cols", totalNumColumns, __props.tableSizes?.currentNumColumns)}`;
5705
+ if (totalNumColumns < 2) return;
5706
+ return formatCount("Cols", totalNumColumns, __props.tableSizes?.currentNumColumns);
5703
5707
  });
5708
+ const dimensionText = computed(() => {
5709
+ if (columnText.value === void 0) return rowText.value;
5710
+ return `${rowText.value} | ${columnText.value}`;
5711
+ });
5712
+ const showRowCountDropdown = computed(() => Boolean(__props.actionConfig.rowCountItems?.length));
5704
5713
  const emit = __emit;
5705
5714
  return (_ctx, _cache) => {
5706
5715
  return hasContent.value ? (openBlock(), createElementBlock("div", {
@@ -5716,8 +5725,15 @@ var TableActionBar_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
5716
5725
  createElementVNode("div", _hoisted_2$3, [isPreview.value ? (openBlock(), createElementBlock("div", _hoisted_3$1, [_cache[3] || (_cache[3] = createElementVNode("span", { class: "preview-label" }, "Preview", -1)), __props.actionState?.previewDescription ? (openBlock(), createBlock(unref(KdsInfoToggleButton), {
5717
5726
  key: 0,
5718
5727
  content: __props.actionState.previewDescription
5719
- }, null, 8, ["content"])) : createCommentVNode("", true)])) : createCommentVNode("", true), __props.showTableSize ? (openBlock(), createElementBlock("span", _hoisted_4$1, toDisplayString(dimensionText.value), 1)) : createCommentVNode("", true)]),
5720
- createElementVNode("div", _hoisted_5, [
5728
+ }, null, 8, ["content"])) : createCommentVNode("", true)])) : createCommentVNode("", true), __props.showTableSize && showRowCountDropdown.value ? (openBlock(), createElementBlock("span", _hoisted_4$1, [createVNode(unref(KdsMenuButton), {
5729
+ class: "row-count-menu-button",
5730
+ label: rowText.value,
5731
+ size: "small",
5732
+ variant: "transparent",
5733
+ "trailing-icon": "chevron-down",
5734
+ items: __props.actionConfig.rowCountItems ?? []
5735
+ }, null, 8, ["label", "items"]), columnText.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createTextVNode(toDisplayString(` | ${columnText.value}`), 1)], 64)) : createCommentVNode("", true)])) : __props.showTableSize ? (openBlock(), createElementBlock("span", _hoisted_5, toDisplayString(dimensionText.value), 1)) : createCommentVNode("", true)]),
5736
+ createElementVNode("div", _hoisted_6, [
5721
5737
  __props.actionConfig.enableSearch ? (openBlock(), createBlock(unref(KdsSearchInput), {
5722
5738
  key: 0,
5723
5739
  ariaLabel: "Search table",
@@ -5745,7 +5761,7 @@ var TableActionBar_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
5745
5761
  ], 2)) : createCommentVNode("", true);
5746
5762
  };
5747
5763
  }
5748
- }), [["__scopeId", "data-v-b0b2c849"]]);
5764
+ }), [["__scopeId", "data-v-6aefb7ab"]]);
5749
5765
  //#endregion
5750
5766
  //#region src/utils/columnHeaderActionButtons.ts
5751
5767
  /**