@fkui/vue 5.45.0 → 5.45.1

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.
@@ -9815,7 +9815,16 @@ const _sfc_main$J = defineComponent({
9815
9815
  }
9816
9816
  },
9817
9817
  setup() {
9818
- return FTableInjected();
9818
+ const {
9819
+ renderColumns,
9820
+ setVisibilityColumn: setVisibilityColumn2,
9821
+ addColumn: addColumn2
9822
+ } = FTableInjected();
9823
+ return {
9824
+ renderColumns,
9825
+ setVisibilityColumn: setVisibilityColumn2,
9826
+ addColumn: addColumn2
9827
+ };
9819
9828
  },
9820
9829
  computed: {
9821
9830
  classes() {
@@ -13719,10 +13728,6 @@ function useExpandableTable(expandableAttribute, keyAttribute, describedby, emit
13719
13728
  const expanded = isExpanded(row) ? [] : ["table__expandable-row--collapsed"];
13720
13729
  return ["table__expandable-row", ...border, ...expanded];
13721
13730
  }
13722
- function expandableColumnClasses(column, index) {
13723
- const indented = index === 0 ? ["table__column--indented"] : [];
13724
- return ["table__column", `table__column--${column.type}`, column.size, ...indented];
13725
- }
13726
13731
  function getExpandableDescribedby(row) {
13727
13732
  if (!isExpandableTable) {
13728
13733
  return void 0;
@@ -13756,7 +13761,6 @@ function useExpandableTable(expandableAttribute, keyAttribute, describedby, emit
13756
13761
  isExpanded,
13757
13762
  rowAriaExpanded,
13758
13763
  expandableRowClasses,
13759
- expandableColumnClasses,
13760
13764
  getExpandableDescribedby,
13761
13765
  expandableRows,
13762
13766
  hasExpandableContent
@@ -13866,6 +13870,22 @@ const _sfc_main$g = defineComponent({
13866
13870
  type: Array,
13867
13871
  required: false,
13868
13872
  default: void 0
13873
+ },
13874
+ /**
13875
+ * Enable showing the active row.
13876
+ */
13877
+ showActive: {
13878
+ type: Boolean,
13879
+ required: false,
13880
+ default: true
13881
+ },
13882
+ /**
13883
+ * V-model will bind to value containing the current active row.
13884
+ */
13885
+ active: {
13886
+ type: Object,
13887
+ required: false,
13888
+ default: () => void 0
13869
13889
  }
13870
13890
  },
13871
13891
  emits: [
@@ -13874,6 +13894,7 @@ const _sfc_main$g = defineComponent({
13874
13894
  "update",
13875
13895
  "unselect",
13876
13896
  "update:modelValue",
13897
+ "update:active",
13877
13898
  "select",
13878
13899
  /**
13879
13900
  * Emitted when row is expanded.
@@ -13908,7 +13929,8 @@ const _sfc_main$g = defineComponent({
13908
13929
  activeRow: void 0,
13909
13930
  columns: [],
13910
13931
  selectedRows: [],
13911
- tr: []
13932
+ tr: [],
13933
+ tbodyKey: 0
13912
13934
  };
13913
13935
  },
13914
13936
  computed: {
@@ -13946,7 +13968,7 @@ const _sfc_main$g = defineComponent({
13946
13968
  return tableScrollClasses(this.scroll);
13947
13969
  },
13948
13970
  nbOfColumns() {
13949
- let columnCount = this.columns.length;
13971
+ let columnCount = this.visibleColumns.length;
13950
13972
  if (this.selectable) {
13951
13973
  columnCount++;
13952
13974
  }
@@ -13967,6 +13989,20 @@ const _sfc_main$g = defineComponent({
13967
13989
  });
13968
13990
  }
13969
13991
  }
13992
+ },
13993
+ active: {
13994
+ immediate: true,
13995
+ handler: function() {
13996
+ this.updateActiveRowFromVModel();
13997
+ }
13998
+ },
13999
+ showActive: {
14000
+ immediate: true,
14001
+ handler: function(val) {
14002
+ if (!val) {
14003
+ this.tbodyKey ^= 1;
14004
+ }
14005
+ }
13970
14006
  }
13971
14007
  },
13972
14008
  updated() {
@@ -13985,6 +14021,9 @@ const _sfc_main$g = defineComponent({
13985
14021
  },
13986
14022
  methods: {
13987
14023
  isActive(row) {
14024
+ if (!this.showActive) {
14025
+ return false;
14026
+ }
13988
14027
  return itemEquals(row, this.activeRow, this.keyAttribute);
13989
14028
  },
13990
14029
  isSelected(row) {
@@ -14017,7 +14056,7 @@ const _sfc_main$g = defineComponent({
14017
14056
  }
14018
14057
  if (!itemEquals(row, this.activeRow, this.keyAttribute)) {
14019
14058
  this.$emit("change", row);
14020
- this.activeRow = row;
14059
+ this.setActiveRow(row);
14021
14060
  if (tr) {
14022
14061
  tr.focus();
14023
14062
  const td = tr.children[0];
@@ -14108,6 +14147,17 @@ const _sfc_main$g = defineComponent({
14108
14147
  },
14109
14148
  escapeNewlines(value) {
14110
14149
  return value.replace(/\n/g, "<br/>");
14150
+ },
14151
+ updateActiveRowFromVModel() {
14152
+ if (this.active === void 0) {
14153
+ this.setActiveRow(void 0);
14154
+ } else if (!itemEquals(this.active, this.activeRow, this.keyAttribute)) {
14155
+ this.setActiveRow(this.active);
14156
+ }
14157
+ },
14158
+ setActiveRow(row) {
14159
+ this.activeRow = row;
14160
+ this.$emit("update:active", this.activeRow);
14111
14161
  }
14112
14162
  }
14113
14163
  });
@@ -14145,40 +14195,37 @@ const _hoisted_11$1 = {
14145
14195
  key: 1,
14146
14196
  class: "table__column__description"
14147
14197
  };
14148
- const _hoisted_12$1 = {
14149
- ref: "tbodyElement"
14150
- };
14151
- const _hoisted_13 = ["aria-label", "aria-expanded", "aria-level", "aria-describedby", "onKeydown", "onClick"];
14152
- const _hoisted_14 = {
14198
+ const _hoisted_12$1 = ["aria-label", "aria-expanded", "aria-level", "aria-describedby", "onKeydown", "onClick"];
14199
+ const _hoisted_13 = {
14153
14200
  key: 0
14154
14201
  };
14155
- const _hoisted_15 = {
14202
+ const _hoisted_14 = {
14156
14203
  key: 0,
14157
14204
  class: "table__expand-icon"
14158
14205
  };
14159
- const _hoisted_16 = {
14206
+ const _hoisted_15 = {
14160
14207
  key: 1,
14161
14208
  class: "table__column--selectable"
14162
14209
  };
14163
- const _hoisted_17 = {
14210
+ const _hoisted_16 = {
14164
14211
  class: "table__input"
14165
14212
  };
14166
- const _hoisted_18 = {
14213
+ const _hoisted_17 = {
14167
14214
  key: 0,
14168
14215
  class: "sr-only"
14169
14216
  };
14170
- const _hoisted_19 = {
14217
+ const _hoisted_18 = {
14171
14218
  key: 0,
14172
- class: "table__column--selectable"
14219
+ class: "table__column--placeholder"
14173
14220
  };
14174
- const _hoisted_20 = ["colspan"];
14175
- const _hoisted_21 = {
14221
+ const _hoisted_19 = ["colspan"];
14222
+ const _hoisted_20 = {
14176
14223
  key: 0
14177
14224
  };
14178
- const _hoisted_22 = {
14225
+ const _hoisted_21 = {
14179
14226
  key: 1
14180
14227
  };
14181
- const _hoisted_23 = ["colspan"];
14228
+ const _hoisted_22 = ["colspan"];
14182
14229
  function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
14183
14230
  const _component_f_icon = resolveComponent("f-icon");
14184
14231
  const _component_f_checkbox_field = resolveComponent("f-checkbox-field");
@@ -14187,12 +14234,12 @@ function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
14187
14234
  }, [createElementVNode("table", mergeProps({
14188
14235
  class: ["table", _ctx.tableClasses],
14189
14236
  role: _ctx.tableRole
14190
- }, _ctx.$attrs), [_ctx.hasCaption ? (openBlock(), createElementBlock("caption", _hoisted_2$d, [renderSlot(_ctx.$slots, "caption")])) : createCommentVNode("", true), _cache[14] || (_cache[14] = createTextVNode()), createElementVNode("colgroup", null, [_ctx.isExpandableTable ? (openBlock(), createElementBlock("col", _hoisted_3$9)) : createCommentVNode("", true), _cache[0] || (_cache[0] = createTextVNode()), _ctx.selectable ? (openBlock(), createElementBlock("col", _hoisted_4$8)) : createCommentVNode("", true), _cache[1] || (_cache[1] = createTextVNode()), (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.columns, (column) => {
14237
+ }, _ctx.$attrs), [_ctx.hasCaption ? (openBlock(), createElementBlock("caption", _hoisted_2$d, [renderSlot(_ctx.$slots, "caption")])) : createCommentVNode("", true), _cache[15] || (_cache[15] = createTextVNode()), createElementVNode("colgroup", null, [_ctx.isExpandableTable ? (openBlock(), createElementBlock("col", _hoisted_3$9)) : createCommentVNode("", true), _cache[0] || (_cache[0] = createTextVNode()), _ctx.selectable ? (openBlock(), createElementBlock("col", _hoisted_4$8)) : createCommentVNode("", true), _cache[1] || (_cache[1] = createTextVNode()), (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.columns, (column) => {
14191
14238
  return openBlock(), createElementBlock("col", {
14192
14239
  key: column.id,
14193
14240
  class: normalizeClass(column.size)
14194
14241
  }, null, 2);
14195
- }), 128))]), _cache[15] || (_cache[15] = createTextVNode()), createElementVNode("thead", null, [createElementVNode("tr", _hoisted_5$6, [_ctx.isExpandableTable ? (openBlock(), createElementBlock("th", _hoisted_6$4, [createElementVNode("span", _hoisted_7$4, toDisplayString(_ctx.$t("fkui.interactive-table.select", "Expandera")), 1)])) : createCommentVNode("", true), _cache[4] || (_cache[4] = createTextVNode()), _ctx.selectable ? (openBlock(), createElementBlock("th", _hoisted_8$4, [createElementVNode("span", _hoisted_9$3, toDisplayString(_ctx.$t("fkui.interactive-table.select", "Markera")), 1)])) : createCommentVNode("", true), _cache[5] || (_cache[5] = createTextVNode()), (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.visibleColumns, (column) => {
14242
+ }), 128))]), _cache[16] || (_cache[16] = createTextVNode()), createElementVNode("thead", null, [createElementVNode("tr", _hoisted_5$6, [_ctx.isExpandableTable ? (openBlock(), createElementBlock("th", _hoisted_6$4, [createElementVNode("span", _hoisted_7$4, toDisplayString(_ctx.$t("fkui.interactive-table.select", "Expandera")), 1)])) : createCommentVNode("", true), _cache[4] || (_cache[4] = createTextVNode()), _ctx.selectable ? (openBlock(), createElementBlock("th", _hoisted_8$4, [createElementVNode("span", _hoisted_9$3, toDisplayString(_ctx.$t("fkui.interactive-table.select", "Markera")), 1)])) : createCommentVNode("", true), _cache[5] || (_cache[5] = createTextVNode()), (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.visibleColumns, (column) => {
14196
14243
  return openBlock(), createElementBlock("th", mergeProps({
14197
14244
  key: column.id,
14198
14245
  scope: "col",
@@ -14206,7 +14253,10 @@ function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
14206
14253
  class: normalizeClass(_ctx.iconClasses(column)),
14207
14254
  name: _ctx.iconName(column)
14208
14255
  }, null, 8, ["class", "name"])) : createCommentVNode("", true), _cache[3] || (_cache[3] = createTextVNode()), column.description ? (openBlock(), createElementBlock("span", _hoisted_11$1, toDisplayString(column.description), 1)) : createCommentVNode("", true)], 16);
14209
- }), 128))])]), _cache[16] || (_cache[16] = createTextVNode()), createElementVNode("tbody", _hoisted_12$1, [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.rows, (row, index) => {
14256
+ }), 128))])]), _cache[17] || (_cache[17] = createTextVNode()), (openBlock(), createElementBlock("tbody", {
14257
+ ref: "tbodyElement",
14258
+ key: _ctx.tbodyKey
14259
+ }, [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.rows, (row, index) => {
14210
14260
  return openBlock(), createElementBlock(Fragment, {
14211
14261
  key: _ctx.rowKey(row)
14212
14262
  }, [createElementVNode("tr", {
@@ -14218,15 +14268,15 @@ function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
14218
14268
  tabindex: "0",
14219
14269
  onKeydown: withModifiers(($event) => _ctx.onKeydown($event, index), ["self"]),
14220
14270
  onClick: ($event) => _ctx.onClick($event, row, index)
14221
- }, [_ctx.isExpandableTable ? (openBlock(), createElementBlock("td", _hoisted_14, [_ctx.hasExpandableContent(row) ? (openBlock(), createElementBlock("div", _hoisted_15, [createVNode(_component_f_icon, {
14271
+ }, [_ctx.isExpandableTable ? (openBlock(), createElementBlock("td", _hoisted_13, [_ctx.hasExpandableContent(row) ? (openBlock(), createElementBlock("div", _hoisted_14, [createVNode(_component_f_icon, {
14222
14272
  name: "arrow-right",
14223
14273
  rotate: _ctx.isExpanded(row) ? "270" : "90"
14224
- }, null, 8, ["rotate"])])) : createCommentVNode("", true)])) : createCommentVNode("", true), _cache[6] || (_cache[6] = createTextVNode()), _ctx.selectable ? (openBlock(), createElementBlock("td", _hoisted_16, [createElementVNode("div", _hoisted_17, [createVNode(_component_f_checkbox_field, {
14274
+ }, null, 8, ["rotate"])])) : createCommentVNode("", true)])) : createCommentVNode("", true), _cache[6] || (_cache[6] = createTextVNode()), _ctx.selectable ? (openBlock(), createElementBlock("td", _hoisted_15, [createElementVNode("div", _hoisted_16, [createVNode(_component_f_checkbox_field, {
14225
14275
  value: true,
14226
14276
  "model-value": _ctx.isSelected(row),
14227
14277
  onClick: withModifiers(($event) => _ctx.onSelect(row), ["self"])
14228
14278
  }, {
14229
- default: withCtx(() => [_ctx.hasCheckboxDescription ? (openBlock(), createElementBlock("span", _hoisted_18, [renderSlot(_ctx.$slots, "checkbox-description", mergeProps({
14279
+ default: withCtx(() => [_ctx.hasCheckboxDescription ? (openBlock(), createElementBlock("span", _hoisted_17, [renderSlot(_ctx.$slots, "checkbox-description", mergeProps({
14230
14280
  ref_for: true
14231
14281
  }, {
14232
14282
  row
@@ -14236,21 +14286,21 @@ function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
14236
14286
  ref_for: true
14237
14287
  }, {
14238
14288
  row
14239
- }))], 42, _hoisted_13), _cache[11] || (_cache[11] = createTextVNode()), _ctx.isExpandableTable && _ctx.hasExpandableContent(row) ? (openBlock(true), createElementBlock(Fragment, {
14289
+ }))], 42, _hoisted_12$1), _cache[11] || (_cache[11] = createTextVNode()), _ctx.isExpandableTable && _ctx.hasExpandableContent(row) ? (openBlock(true), createElementBlock(Fragment, {
14240
14290
  key: 0
14241
14291
  }, renderList(_ctx.expandableRows(row), (expandableRow, expandableIndex) => {
14242
14292
  return openBlock(), createElementBlock("tr", {
14243
14293
  key: _ctx.rowKey(expandableRow),
14244
14294
  "aria-level": "2",
14245
14295
  class: normalizeClass(_ctx.expandableRowClasses(row, expandableIndex))
14246
- }, [_cache[8] || (_cache[8] = createElementVNode("td", null, null, -1)), _cache[9] || (_cache[9] = createTextVNode()), _ctx.selectable ? (openBlock(), createElementBlock("td", _hoisted_19)) : createCommentVNode("", true), _cache[10] || (_cache[10] = createTextVNode()), !_ctx.hasExpandableSlot ? (openBlock(true), createElementBlock(Fragment, {
14247
- key: 1
14248
- }, renderList(_ctx.columns, (column, columnIndex) => {
14249
- return openBlock(), createElementBlock("td", {
14250
- key: `${_ctx.rowKey(expandableRow)}${column.name}`,
14251
- class: normalizeClass(_ctx.expandableColumnClasses(column, columnIndex))
14252
- }, toDisplayString(expandableRow[column.name]), 3);
14253
- }), 128)) : (openBlock(), createElementBlock("td", {
14296
+ }, [_cache[8] || (_cache[8] = createElementVNode("td", {
14297
+ class: "table__column--placeholder"
14298
+ }, null, -1)), _cache[9] || (_cache[9] = createTextVNode()), _ctx.selectable ? (openBlock(), createElementBlock("td", _hoisted_18)) : createCommentVNode("", true), _cache[10] || (_cache[10] = createTextVNode()), !_ctx.hasExpandableSlot ? renderSlot(_ctx.$slots, "default", mergeProps({
14299
+ key: 1,
14300
+ ref_for: true
14301
+ }, {
14302
+ row: expandableRow
14303
+ })) : (openBlock(), createElementBlock("td", {
14254
14304
  key: 2,
14255
14305
  class: "table__column table__column--indented",
14256
14306
  colspan: _ctx.columns.length
@@ -14259,14 +14309,16 @@ function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
14259
14309
  }, {
14260
14310
  expandableRow,
14261
14311
  parentRow: row
14262
- }))], 8, _hoisted_20))], 2);
14312
+ }))], 8, _hoisted_19))], 2);
14263
14313
  }), 128)) : createCommentVNode("", true)], 64);
14264
- }), 128)), _cache[12] || (_cache[12] = createTextVNode()), _ctx.isEmpty && _ctx.columns.length === 0 ? (openBlock(), createElementBlock("tr", _hoisted_21, [renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps({
14314
+ }), 128)), _cache[13] || (_cache[13] = createTextVNode()), _ctx.isEmpty && _ctx.columns.length === 0 ? (openBlock(), createElementBlock("tr", _hoisted_20, [renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps({
14265
14315
  row: {}
14266
- })))])) : createCommentVNode("", true), _cache[13] || (_cache[13] = createTextVNode()), _ctx.isEmpty ? (openBlock(), createElementBlock("tr", _hoisted_22, [createElementVNode("td", {
14316
+ })))])) : createCommentVNode("", true), _cache[14] || (_cache[14] = createTextVNode()), _ctx.isEmpty ? (openBlock(), createElementBlock("tr", _hoisted_21, [createElementVNode("td", {
14267
14317
  class: "table__column table__column--action",
14268
14318
  colspan: _ctx.nbOfColumns
14269
- }, [renderSlot(_ctx.$slots, "empty", {}, () => [createTextVNode(toDisplayString(_ctx.$t("fkui.interactive-table.empty", "Tabellen är tom")), 1)])], 8, _hoisted_23)])) : createCommentVNode("", true)], 512)], 16, _hoisted_1$f)], 2);
14319
+ }, [renderSlot(_ctx.$slots, "empty", {}, () => [createTextVNode(toDisplayString(_ctx.$t("fkui.interactive-table.empty", "Tabellen är tom")), 1)])], 8, _hoisted_22), _cache[12] || (_cache[12] = createTextVNode()), renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps({
14320
+ row: {}
14321
+ })))])) : createCommentVNode("", true)]))], 16, _hoisted_1$f)], 2);
14270
14322
  }
14271
14323
  const FInteractiveTable = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["render", _sfc_render$g]]);
14272
14324
  const _sfc_main$f = defineComponent({