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