@fkui/vue-labs 6.40.0 → 6.41.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.
@@ -2601,7 +2601,7 @@ const _hoisted_1$e = {
2601
2601
  class: "table-ng__cell table-ng__cell--expand"
2602
2602
  };
2603
2603
  const _hoisted_2$9 = ["aria-label", "aria-expanded"];
2604
- const _hoisted_3$5 = {
2604
+ const _hoisted_3$4 = {
2605
2605
  key: 1,
2606
2606
  ref: "expandable",
2607
2607
  tabindex: "-1",
@@ -2647,7 +2647,7 @@ const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
2647
2647
  }, [vue.createVNode(vue.unref(vue$1.FIcon), {
2648
2648
  class: "button__icon",
2649
2649
  name: toggleIcon.value
2650
- }, null, 8, ["name"])], 8, _hoisted_2$9)])) : (vue.openBlock(), vue.createElementBlock("td", _hoisted_3$5, null, 512));
2650
+ }, null, 8, ["name"])], 8, _hoisted_2$9)])) : (vue.openBlock(), vue.createElementBlock("td", _hoisted_3$4, null, 512));
2651
2651
  };
2652
2652
  }
2653
2653
  });
@@ -2993,7 +2993,7 @@ const inputFieldConfig = {
2993
2993
  }
2994
2994
  }
2995
2995
  };
2996
- const _hoisted_1$c = ["aria-sort"];
2996
+ const _hoisted_1$c = ["aria-sort", "onKeydown"];
2997
2997
  const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
2998
2998
  __name: "ITableHeader",
2999
2999
  props: {
@@ -3057,19 +3057,13 @@ const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
3057
3057
  }
3058
3058
  emit("toggleSortOrder", String(__props.column.sortable));
3059
3059
  }
3060
- function onKeydownCell(e) {
3061
- if (e.key === "Enter") {
3062
- e.preventDefault();
3063
- onClickCell();
3064
- }
3065
- }
3066
3060
  return (_ctx, _cache) => {
3067
3061
  return vue.openBlock(), vue.createElementBlock("th", {
3068
3062
  ref: "th",
3069
3063
  "aria-sort": sortValue.value,
3070
3064
  class: vue.normalizeClass(columnClasses.value),
3071
3065
  tabindex: "-1",
3072
- onKeydown: onKeydownCell,
3066
+ onKeydown: vue.withKeys(vue.withModifiers(onClickCell, ["prevent"]), ["enter", "space"]),
3073
3067
  onClick: vue.withModifiers(onClickCell, ["stop"])
3074
3068
  }, [vue.createVNode(vue.unref(vue$1.IFlex), {
3075
3069
  gap: "1x",
@@ -3763,12 +3757,8 @@ function requireEs_iterator_map() {
3763
3757
  return es_iterator_map;
3764
3758
  }
3765
3759
  requireEs_iterator_map();
3766
- const _hoisted_1$7 = {
3767
- key: 0,
3768
- class: "table-ng__cell table-ng__cell--anchor"
3769
- };
3770
- const _hoisted_2$5 = ["href"];
3771
- const _hoisted_3$4 = {
3760
+ const _hoisted_1$7 = ["href"];
3761
+ const _hoisted_2$5 = {
3772
3762
  key: 1,
3773
3763
  ref: "target",
3774
3764
  tabindex: "-1",
@@ -3789,13 +3779,18 @@ const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
3789
3779
  };
3790
3780
  __expose(expose);
3791
3781
  return (_ctx, _cache) => {
3792
- return __props.column.text(__props.row) ? (vue.openBlock(), vue.createElementBlock("td", _hoisted_1$7, [vue.createElementVNode("a", {
3782
+ return __props.column.text(__props.row) ? (vue.openBlock(), vue.createElementBlock("td", {
3783
+ key: 0,
3784
+ class: "table-ng__cell table-ng__cell--anchor",
3785
+ onKeydown: _cache[0] || (_cache[0] = vue.withKeys(vue.withModifiers(() => {
3786
+ }, ["prevent"]), ["space"]))
3787
+ }, [vue.createElementVNode("a", {
3793
3788
  ref: "target",
3794
3789
  class: "anchor anchor--block",
3795
3790
  target: "_blank",
3796
3791
  href: __props.column.href,
3797
3792
  tabindex: "-1"
3798
- }, vue.toDisplayString(__props.column.text(__props.row)), 9, _hoisted_2$5)])) : (vue.openBlock(), vue.createElementBlock("td", _hoisted_3$4, null, 512));
3793
+ }, vue.toDisplayString(__props.column.text(__props.row)), 9, _hoisted_1$7)], 32)) : (vue.openBlock(), vue.createElementBlock("td", _hoisted_2$5, null, 512));
3799
3794
  };
3800
3795
  }
3801
3796
  });
@@ -4016,7 +4011,7 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
4016
4011
  const activeOptionId = logic.ElementIdService.generateElementId();
4017
4012
  const activeOption = vue.ref(null);
4018
4013
  async function onCellKeyDown(e) {
4019
- if (e.code === "Enter" || e.code === "NumpadEnter") {
4014
+ if (e.code === "Enter" || e.code === "NumpadEnter" || e.code === "Space") {
4020
4015
  await startEditing(e);
4021
4016
  }
4022
4017
  }
@@ -4344,22 +4339,38 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
4344
4339
  }
4345
4340
  function setUpFakeValidation(el) {
4346
4341
  logic.assertRef(inputElement);
4342
+ const input = inputElement.value;
4343
+ function emitFakeValidity(nativeEvent) {
4344
+ const fakeEvent = new CustomEvent("validity", {
4345
+ detail: {
4346
+ isValid: true,
4347
+ nativeEvent,
4348
+ validityMode: "INITIAL",
4349
+ validationMessage: "",
4350
+ target: input,
4351
+ elementId: String(input.id)
4352
+ }
4353
+ });
4354
+ onValidity(fakeEvent);
4355
+ }
4347
4356
  const nativeEvents = ["change", "blur"];
4348
4357
  for (const nativeEvent of nativeEvents) {
4349
4358
  core.useEventListener(el, nativeEvent, () => {
4350
- const fakeEvent = new CustomEvent("validity", {
4351
- detail: {
4352
- isValid: true,
4353
- nativeEvent,
4354
- validityMode: "INITIAL",
4355
- validationMessage: "",
4356
- target: inputElement.value,
4357
- elementId: String(inputElement.value.id)
4358
- }
4359
- });
4360
- onValidity(fakeEvent);
4359
+ emitFakeValidity(nativeEvent);
4361
4360
  });
4362
4361
  }
4362
+ validationFacade = {
4363
+ validateElement: () => {
4364
+ emitFakeValidity("validate");
4365
+ return Promise.resolve({
4366
+ isValid: true,
4367
+ error: "",
4368
+ isSubmitted: false,
4369
+ isTouched: false
4370
+ });
4371
+ },
4372
+ dispatchComponentValidityEvent: () => void 0
4373
+ };
4363
4374
  core.useEventListener(el, "input", onPendingValidity);
4364
4375
  core.useEventListener(el, "component-validity", (e) => {
4365
4376
  e.stopPropagation();
@@ -4427,6 +4438,9 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
4427
4438
  inputElement.value.tabIndex = -1;
4428
4439
  logic.assertRef(tdElement);
4429
4440
  tdElement.value.style.removeProperty("width");
4441
+ if (reason === "blur") {
4442
+ tdElement.value.tabIndex = 0;
4443
+ }
4430
4444
  void stopEdit2(inputElement.value, reason);
4431
4445
  }
4432
4446
  function fromColumnValue() {
@@ -4483,6 +4497,7 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
4483
4497
  });
4484
4498
  } else {
4485
4499
  pendingStopEditReason = "enter";
4500
+ void validationFacade.validateElement(inputElement.value);
4486
4501
  }
4487
4502
  break;
4488
4503
  }
@@ -4564,7 +4579,7 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
4564
4579
  onKeydown
4565
4580
  }, [vue.createElementVNode("div", {
4566
4581
  class: vue.normalizeClass(divClasses.value)
4567
- }, [vue.createElementVNode("span", _hoisted_2$2, vue.toDisplayString(fromColumnValue()), 1), _cache[1] || (_cache[1] = vue.createTextVNode()), viewModeErrorMessage.value ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_3$2, vue.toDisplayString(viewModeErrorMessage.value), 1)) : vue.createCommentVNode("", true), _cache[2] || (_cache[2] = vue.createTextVNode()), vue.withDirectives(vue.createElementVNode("input", vue.mergeProps({
4582
+ }, [vue.createElementVNode("span", _hoisted_2$2, vue.toDisplayString(fromColumnValue()), 1), _cache[2] || (_cache[2] = vue.createTextVNode()), viewModeErrorMessage.value ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_3$2, vue.toDisplayString(viewModeErrorMessage.value), 1)) : vue.createCommentVNode("", true), _cache[3] || (_cache[3] = vue.createTextVNode()), vue.withDirectives(vue.createElementVNode("input", vue.mergeProps({
4568
4583
  id: vue.unref(inputId),
4569
4584
  ref: "input",
4570
4585
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => viewValue.value = $event),
@@ -4580,7 +4595,7 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
4580
4595
  "aria-hidden": !inEdit.value,
4581
4596
  onValidity,
4582
4597
  onPendingValidity
4583
- }), null, 16, _hoisted_4$2), [[vue.vModelText, viewValue.value]])], 2), _cache[3] || (_cache[3] = vue.createTextVNode()), vue.createVNode(vue.unref(vue$1.IPopupError), {
4598
+ }), null, 16, _hoisted_4$2), [[vue.vModelText, viewValue.value]])], 2), _cache[4] || (_cache[4] = vue.createTextVNode()), vue.createVNode(vue.unref(vue$1.IPopupError), {
4584
4599
  anchor: tdElement.value,
4585
4600
  "is-open": openPopupError.value,
4586
4601
  "error-message": validity.value.validationMessage,
@@ -4590,8 +4605,10 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
4590
4605
  key: 1,
4591
4606
  ref: "td",
4592
4607
  tabindex: "-1",
4593
- class: vue.normalizeClass(staticClasses.value)
4594
- }, vue.toDisplayString(fromColumnValue()), 3));
4608
+ class: vue.normalizeClass(staticClasses.value),
4609
+ onKeydown: _cache[1] || (_cache[1] = vue.withKeys(vue.withModifiers(() => {
4610
+ }, ["prevent"]), ["space"]))
4611
+ }, vue.toDisplayString(fromColumnValue()), 35));
4595
4612
  };
4596
4613
  }
4597
4614
  });
@@ -5070,8 +5087,8 @@ function useSelectable(options) {
5070
5087
  };
5071
5088
  }
5072
5089
  function matching(needle) {
5073
- const id = vue$1.getItemIdentifier(needle);
5074
- return (item) => vue$1.getItemIdentifier(item) === id;
5090
+ const id = vue$1.getItemIdentifier(needle.row);
5091
+ return (item) => vue$1.getItemIdentifier(item.row) === id;
5075
5092
  }
5076
5093
  function useTabstop(tableRef, metaRows) {
5077
5094
  let pendingRowRemoval = false;
@@ -5459,7 +5476,7 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
5459
5476
  selectedRows,
5460
5477
  rows: keyedRows
5461
5478
  });
5462
- const tableApi = useTabstop(tableRef, keyedRows);
5479
+ const tableApi = useTabstop(tableRef, metaRows);
5463
5480
  __expose(tableApi);
5464
5481
  vue.onMounted(() => {
5465
5482
  logic.assertRef(tableRef);
@@ -5477,13 +5494,13 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
5477
5494
  onFocusout: onTableFocusout,
5478
5495
  onClick,
5479
5496
  onKeydown
5480
- }, [hasCaption.value ? (vue.openBlock(), vue.createElementBlock("caption", _hoisted_2$1, [vue.renderSlot(_ctx.$slots, "caption")])) : vue.createCommentVNode("", true), _cache[4] || (_cache[4] = vue.createTextVNode()), hasColumns.value ? (vue.openBlock(), vue.createElementBlock("thead", _hoisted_3$1, [vue.createElementVNode("tr", _hoisted_4$1, [isTreegrid.value ? (vue.openBlock(), vue.createElementBlock("th", _hoisted_5$1)) : vue.createCommentVNode("", true), _cache[0] || (_cache[0] = vue.createTextVNode()), __props.selectable ? (vue.openBlock(), vue.createBlock(_sfc_main$d, {
5497
+ }, [hasCaption.value ? (vue.openBlock(), vue.createElementBlock("caption", _hoisted_2$1, [vue.renderSlot(_ctx.$slots, "caption")])) : vue.createCommentVNode("", true), _cache[6] || (_cache[6] = vue.createTextVNode()), hasColumns.value ? (vue.openBlock(), vue.createElementBlock("thead", _hoisted_3$1, [vue.createElementVNode("tr", _hoisted_4$1, [isTreegrid.value ? (vue.openBlock(), vue.createElementBlock("th", _hoisted_5$1)) : vue.createCommentVNode("", true), _cache[2] || (_cache[2] = vue.createTextVNode()), __props.selectable ? (vue.openBlock(), vue.createBlock(_sfc_main$d, {
5481
5498
  key: 1,
5482
5499
  ref: bindCellApiRef,
5483
5500
  state: vue.unref(selectableHeaderState)(),
5484
5501
  selectable: __props.selectable,
5485
5502
  onToggle: vue.unref(toggleSelectableHeader)
5486
- }, null, 8, ["state", "selectable", "onToggle"])) : vue.createCommentVNode("", true), _cache[1] || (_cache[1] = vue.createTextVNode()), (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(columns.value, (column) => {
5503
+ }, null, 8, ["state", "selectable", "onToggle"])) : vue.createCommentVNode("", true), _cache[3] || (_cache[3] = vue.createTextVNode()), (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(columns.value, (column) => {
5487
5504
  return vue.openBlock(), vue.createBlock(_sfc_main$e, {
5488
5505
  key: column.id,
5489
5506
  column,
@@ -5492,10 +5509,12 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
5492
5509
  scope: "col",
5493
5510
  onToggleSortOrder
5494
5511
  }, null, 8, ["column", "sort-enabled", "sort-order"]);
5495
- }), 128))])])) : vue.createCommentVNode("", true), _cache[5] || (_cache[5] = vue.createTextVNode()), hasColumns.value ? (vue.openBlock(), vue.createElementBlock("tbody", _hoisted_6$1, [isEmpty.value ? (vue.openBlock(), vue.createElementBlock("tr", _hoisted_7$1, [vue.createElementVNode("td", {
5512
+ }), 128))])])) : vue.createCommentVNode("", true), _cache[7] || (_cache[7] = vue.createTextVNode()), hasColumns.value ? (vue.openBlock(), vue.createElementBlock("tbody", _hoisted_6$1, [isEmpty.value ? (vue.openBlock(), vue.createElementBlock("tr", _hoisted_7$1, [vue.createElementVNode("td", {
5496
5513
  colspan: fullColspan.value,
5497
- class: "table-ng__cell"
5498
- }, [vue.renderSlot(_ctx.$slots, "empty", {}, () => [vue.createTextVNode(vue.toDisplayString(vue.unref($t)("fkui.ftable.empty.text", "Tabellen är tom")), 1)])], 8, _hoisted_8)])) : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, {
5514
+ class: "table-ng__cell",
5515
+ onKeydown: _cache[0] || (_cache[0] = vue.withKeys(vue.withModifiers(() => {
5516
+ }, ["prevent"]), ["space"]))
5517
+ }, [vue.renderSlot(_ctx.$slots, "empty", {}, () => [vue.createTextVNode(vue.toDisplayString(vue.unref($t)("fkui.ftable.empty.text", "Tabellen är tom")), 1)])], 40, _hoisted_8)])) : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, {
5499
5518
  key: 1
5500
5519
  }, vue.renderList(metaRows.value, ({
5501
5520
  key,
@@ -5523,7 +5542,7 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
5523
5542
  "is-expanded": isExpanded,
5524
5543
  "row-key": key,
5525
5544
  onToggle: onToggleExpanded
5526
- }, null, 8, ["is-expandable", "is-expanded", "row-key"])) : vue.createCommentVNode("", true), _cache[3] || (_cache[3] = vue.createTextVNode()), level > 1 && hasExpandableSlot.value ? (vue.openBlock(), vue.createBlock(_sfc_main$f, {
5545
+ }, null, 8, ["is-expandable", "is-expanded", "row-key"])) : vue.createCommentVNode("", true), _cache[5] || (_cache[5] = vue.createTextVNode()), level > 1 && hasExpandableSlot.value ? (vue.openBlock(), vue.createBlock(_sfc_main$f, {
5527
5546
  key: 1,
5528
5547
  colspan: expandedColspan.value
5529
5548
  }, {
@@ -5544,7 +5563,7 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
5544
5563
  state: vue.unref(selectableRowState)(row),
5545
5564
  row,
5546
5565
  onToggle: vue.unref(toggleSelectableRow)
5547
- }, null, 8, ["level", "selectable", "state", "row", "onToggle"])) : vue.createCommentVNode("", true), _cache[2] || (_cache[2] = vue.createTextVNode()), (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(columns.value, (column) => {
5566
+ }, null, 8, ["level", "selectable", "state", "row", "onToggle"])) : vue.createCommentVNode("", true), _cache[4] || (_cache[4] = vue.createTextVNode()), (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(columns.value, (column) => {
5548
5567
  return vue.openBlock(), vue.createElementBlock(vue.Fragment, {
5549
5568
  key: column.id
5550
5569
  }, ["component" in column ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(column.component), {
@@ -5561,16 +5580,29 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
5561
5580
  row
5562
5581
  }, null, 8, ["row"])) : vue.createCommentVNode("", true)], 64);
5563
5582
  }), 128))], 64))], 10, _hoisted_9);
5564
- }), 128))])) : vue.createCommentVNode("", true), _cache[6] || (_cache[6] = vue.createTextVNode()), hasFooter.value ? (vue.openBlock(), vue.createElementBlock("tfoot", _hoisted_10, [vue.createElementVNode("tr", {
5583
+ }), 128))])) : vue.createCommentVNode("", true), _cache[8] || (_cache[8] = vue.createTextVNode()), hasFooter.value ? (vue.openBlock(), vue.createElementBlock("tfoot", _hoisted_10, [vue.createElementVNode("tr", {
5565
5584
  class: "table-ng__row",
5566
5585
  "aria-rowindex": ariaRowcount.value
5567
5586
  }, [vue.createElementVNode("td", {
5568
5587
  colspan: fullColspan.value,
5569
- class: "table-ng__cell--custom"
5570
- }, [vue.renderSlot(_ctx.$slots, "footer")], 8, _hoisted_12)], 8, _hoisted_11)])) : vue.createCommentVNode("", true)], 42, _hoisted_1$2);
5588
+ class: "table-ng__cell--custom",
5589
+ onKeydown: _cache[1] || (_cache[1] = vue.withKeys(vue.withModifiers(() => {
5590
+ }, ["prevent"]), ["space"]))
5591
+ }, [vue.renderSlot(_ctx.$slots, "footer")], 40, _hoisted_12)], 8, _hoisted_11)])) : vue.createCommentVNode("", true)], 42, _hoisted_1$2);
5571
5592
  };
5572
5593
  }
5573
5594
  });
5595
+ function isSortable(column) {
5596
+ return "key" in column && column.key !== void 0 && column.sort !== false;
5597
+ }
5598
+ function toEntry(column) {
5599
+ return [column.key, column.header];
5600
+ }
5601
+ function getTableSortableAttributes(columns) {
5602
+ const sortable = columns.filter(isSortable);
5603
+ const attributes = sortable.map(toEntry);
5604
+ return Object.fromEntries(attributes);
5605
+ }
5574
5606
  var es_array_toSpliced = {};
5575
5607
  var hasRequiredEs_array_toSpliced;
5576
5608
  function requireEs_array_toSpliced() {
@@ -7497,7 +7529,7 @@ const validators = [hoursMinutesValidator, greaterThanTimeValidator, lessThanTim
7497
7529
  for (const validator of validators) {
7498
7530
  logic.ValidationService.registerValidator(validator);
7499
7531
  }
7500
- const _sfc_main = vue.defineComponent({
7532
+ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
7501
7533
  name: "XTimeTextField",
7502
7534
  extends: vue$1.FTextField,
7503
7535
  mixins: [vue$1.TranslationMixin],
@@ -7544,6 +7576,7 @@ exports.baseTypes = baseTypes;
7544
7576
  exports.defineTableColumns = defineTableColumns;
7545
7577
  exports.forgivingParseTimeToNumber = forgivingParseTimeToNumber;
7546
7578
  exports.formatNumberToTime = formatNumberToTime;
7579
+ exports.getTableSortableAttributes = getTableSortableAttributes;
7547
7580
  exports.hoursMinutesStringToMinutes = hoursMinutesStringToMinutes;
7548
7581
  exports.matchPropertyValue = matchPropertyValue;
7549
7582
  exports.minutesToHoursFloat = minutesToHoursFloat;