wave-ui 1.66.1 → 1.67.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.
@@ -556,7 +556,7 @@ const _WaveUI = class {
556
556
  }
557
557
  });
558
558
  const { components: components2 = {} } = options || {};
559
- for (let id in components2) {
559
+ for (const id in components2) {
560
560
  const component = components2[id];
561
561
  if ((_a = options.presets) == null ? void 0 : _a[component.name])
562
562
  injectPresets(component, options.presets[component.name]);
@@ -1508,7 +1508,7 @@ var render$K = function() {
1508
1508
  var _vm = this;
1509
1509
  var _h = _vm.$createElement;
1510
1510
  var _c = _vm._self._c || _h;
1511
- return _c("div", { staticClass: "w-card", class: _vm.classes }, [_vm.$slots.title ? _c("div", { staticClass: "w-card__title", class: Object.assign({}, { "w-card__title--has-toolbar": _vm.titleHasToolbar }, _vm.titleClasses) }, [_vm._t("title")], 2) : _vm.title ? _c("div", { staticClass: "w-card__title", class: _vm.titleClasses, domProps: { "innerHTML": _vm._s(_vm.title) } }) : _vm._e(), _vm.image ? _c("w-image", _vm._b({ staticClass: "w-card__image", attrs: { "src": _vm.image } }, "w-image", _vm.imgProps, false), [_vm._t("image-content")], 2) : _vm._e(), _c("div", { staticClass: "w-card__content", class: _vm.contentClasses }, [_vm._t("default")], 2), _vm.$slots.actions ? _c("div", { staticClass: "w-card__actions", class: { "w-card__actions--has-toolbar": _vm.actionsHasToolbar } }, [_vm._t("actions")], 2) : _vm._e()], 1);
1511
+ return _c("div", { staticClass: "w-card", class: _vm.classes }, [_vm.$slots.title ? _c("div", { staticClass: "w-card__title", class: Object.assign({}, { "w-card__title--has-toolbar": _vm.$slots.title && _vm.titleHasToolbar }, _vm.titleClasses) }, [_vm._t("title")], 2) : _vm.title ? _c("div", { staticClass: "w-card__title", class: Object.assign({}, { "w-card__title--has-toolbar": _vm.title && _vm.titleHasToolbar }, _vm.titleClasses), domProps: { "innerHTML": _vm._s(_vm.title) } }) : _vm._e(), _vm.image ? _c("w-image", _vm._b({ staticClass: "w-card__image", attrs: { "src": _vm.image } }, "w-image", _vm.imgProps, false), [_vm._t("image-content")], 2) : _vm._e(), _c("div", { staticClass: "w-card__content", class: _vm.contentClasses }, [_vm._t("default")], 2), _vm.$slots.actions ? _c("div", { staticClass: "w-card__actions", class: { "w-card__actions--has-toolbar": _vm.actionsHasToolbar } }, [_vm._t("actions")], 2) : _vm._e()], 1);
1512
1512
  };
1513
1513
  var staticRenderFns$K = [];
1514
1514
  var wCard_vue_vue_type_style_index_0_lang = "";
@@ -1943,7 +1943,9 @@ const __vue2_script$H = {
1943
1943
  icon: this.icon,
1944
1944
  tooltip: label,
1945
1945
  tooltipProps,
1946
- ...this.mainButton
1946
+ ...this.mainButton,
1947
+ ...this.$attrs,
1948
+ class: [this.$vnode.data.staticClass, this.$vnode.data.class]
1947
1949
  };
1948
1950
  }
1949
1951
  },
@@ -4327,7 +4329,7 @@ var render$q = function() {
4327
4329
  var _vm = this;
4328
4330
  var _h = _vm.$createElement;
4329
4331
  var _c = _vm._self._c || _h;
4330
- return _c("div", { staticClass: "w-progress", class: _vm.classes, style: _vm.styles }, [!_vm.circle ? _c("div", { staticClass: "w-progress__progress", class: { full: _vm.progressValue === 100 }, style: "width: " + _vm.progressValue + "%" }) : _c("svg", { attrs: { "viewBox": _vm.circleCenter / 2 + " " + _vm.circleCenter / 2 + " " + _vm.circleCenter + " " + _vm.circleCenter } }, [_vm.bgColor || this.progressValue > -1 ? _c("circle", { staticClass: "bg", class: _vm.bgColor, attrs: { "cx": _vm.circleCenter, "cy": _vm.circleCenter, "r": _vm.circleRadius, "fill": "transparent", "stroke-dasharray": _vm.circleCircumference, "stroke-width": _vm.stroke } }) : _vm._e(), _c("circle", { staticClass: "w-progress__progress", style: "stroke-dashoffset: " + (1 - _vm.progressValue / 100) * _vm.circleCircumference, attrs: { "cx": _vm.circleCenter, "cy": _vm.circleCenter, "r": _vm.circleRadius, "fill": "transparent", "stroke-width": _vm.stroke, "stroke-linecap": _vm.roundCap && "round", "stroke-dasharray": _vm.circleCircumference } })]), _vm.label || _vm.$slots.default ? _c("div", { staticClass: "w-progress__label", class: _vm.labelColor || false }, [_vm._t("default", function() {
4332
+ return _c("div", { staticClass: "w-progress", class: _vm.classes, style: _vm.styles }, [!_vm.circle ? _c("div", { staticClass: "w-progress__progress", class: { full: _vm.progressValue === 100 }, style: "width: " + _vm.progressValue + "%" }) : _c("svg", { attrs: { "viewBox": _vm.circleCenter / 2 + " " + _vm.circleCenter / 2 + " " + _vm.circleCenter + " " + _vm.circleCenter } }, [_vm.bgColor || this.progressValue > -1 ? _c("circle", { staticClass: "bg", class: _vm.bgColor || null, attrs: { "cx": _vm.circleCenter, "cy": _vm.circleCenter, "r": _vm.circleRadius, "fill": "transparent", "stroke-dasharray": _vm.circleCircumference, "stroke-width": _vm.stroke } }) : _vm._e(), _c("circle", { staticClass: "w-progress__progress", style: "stroke-dashoffset: " + (1 - _vm.progressValue / 100) * _vm.circleCircumference, attrs: { "cx": _vm.circleCenter, "cy": _vm.circleCenter, "r": _vm.circleRadius, "fill": "transparent", "stroke-width": _vm.stroke, "stroke-linecap": _vm.roundCap && "round", "stroke-dasharray": _vm.circleCircumference } })]), _vm.label || _vm.$slots.default ? _c("div", { staticClass: "w-progress__label", class: _vm.labelColor || false }, [_vm._t("default", function() {
4331
4333
  return [_vm._v(_vm._s(Math.round(_vm.progressValue)) + _vm._s(_vm.circle ? "" : "%"))];
4332
4334
  })], 2) : _vm._e()]);
4333
4335
  };
@@ -4736,7 +4738,8 @@ const __vue2_script$n = {
4736
4738
  "w-rating__button--half": isHalf,
4737
4739
  [this.icon]: true,
4738
4740
  [`size--${this.size}`]: true,
4739
- [isOn ? this.color : this.bgColor]: true
4741
+ [this.color]: isOn,
4742
+ [this.bgColor]: this.bgColor && !isOn
4740
4743
  };
4741
4744
  }
4742
4745
  },
@@ -4769,15 +4772,166 @@ var render$m = function() {
4769
4772
  var _vm = this;
4770
4773
  var _h = _vm.$createElement;
4771
4774
  var _c = _vm._self._c || _h;
4772
- return _c("div", { staticClass: "w-scrollbar" });
4775
+ return _c("div", _vm._b({ ref: "scrollable", staticClass: "w-scrollable", class: _vm.scrollableClasses, style: _vm.scrollableStyles, on: { "mouseenter": _vm.onMouseEnter, "mouseleave": _vm.onMouseLeave, "mousewheel": _vm.onMouseWheel } }, "div", _vm.$attrs, false), [_vm._t("default"), _c("div", { ref: "track", staticClass: "w-scrollbar", class: _vm.scrollbarClasses, on: { "mousedown": _vm.onTrackMouseDown } }, [_c("div", { ref: "thumb", staticClass: "w-scrollbar__thumb", style: _vm.thumbStyles })])], 2);
4773
4776
  };
4774
4777
  var staticRenderFns$m = [];
4775
- var wScrollbar_vue_vue_type_style_index_0_lang = "";
4778
+ var wScrollable_vue_vue_type_style_index_0_lang = "";
4779
+ const domProps = {
4780
+ h: {
4781
+ horizOrVert: "horizontal",
4782
+ topOrLeft: "left",
4783
+ widthOrHeight: "width",
4784
+ offsetWidthOrHeight: "offsetWidth",
4785
+ maxWidthOrHeight: "max-width",
4786
+ scrollWidthOrHeight: "scrollWidth",
4787
+ clientXorY: "clientX",
4788
+ deltaXorY: "deltaX",
4789
+ scrollTopOrLeft: "scrollLeft"
4790
+ },
4791
+ v: {
4792
+ horizOrVert: "vertical",
4793
+ topOrLeft: "top",
4794
+ widthOrHeight: "height",
4795
+ offsetWidthOrHeight: "offsetHeight",
4796
+ maxWidthOrHeight: "max-height",
4797
+ scrollWidthOrHeight: "scrollHeight",
4798
+ clientXorY: "clientY",
4799
+ deltaXorY: "deltaY",
4800
+ scrollTopOrLeft: "scrollTop"
4801
+ }
4802
+ };
4776
4803
  const __vue2_script$m = {
4777
- name: "w-scrollbar",
4778
- props: {},
4804
+ name: "w-scrollable",
4805
+ props: {
4806
+ color: { type: String, default: "primary" },
4807
+ bgColor: { type: String },
4808
+ width: { type: [Number, String] },
4809
+ height: { type: [Number, String] }
4810
+ },
4779
4811
  emits: [],
4780
- data: () => ({})
4812
+ data: () => ({
4813
+ mounted: false,
4814
+ scrollable: {
4815
+ top: null,
4816
+ left: null,
4817
+ hovered: false
4818
+ },
4819
+ scrollValuePercent: 0
4820
+ }),
4821
+ computed: {
4822
+ isHorizontal() {
4823
+ var _a, _b, _c, _d;
4824
+ if (!this.mounted)
4825
+ return false;
4826
+ console.log("\u{1F482}\u200D\u2642\uFE0F", (_a = this.$refs.scrollable) == null ? void 0 : _a.scrollWidth, (_b = this.$refs.scrollable) == null ? void 0 : _b.offsetWidth);
4827
+ return this.width && !this.height || ((_c = this.$refs.scrollable) == null ? void 0 : _c.scrollWidth) > ((_d = this.$refs.scrollable) == null ? void 0 : _d.offsetWidth);
4828
+ },
4829
+ m() {
4830
+ return domProps[this.isHorizontal ? "h" : "v"];
4831
+ },
4832
+ scrollableClasses() {
4833
+ return {
4834
+ [`w-scrollable--${this.m.horizOrVert}`]: true
4835
+ };
4836
+ },
4837
+ scrollbarClasses() {
4838
+ return {
4839
+ [`w-scrollbar--${this.m.horizOrVert}`]: true
4840
+ };
4841
+ },
4842
+ thumbSizePercent() {
4843
+ var _a, _b;
4844
+ if (!this.mounted)
4845
+ return 0;
4846
+ console.log("\u{1F612}", this[this.m.widthOrHeight], this.$refs.scrollable[[this.m.offsetWidthOrHeight]]);
4847
+ const widthOrHeight = (_a = this[this.m.widthOrHeight]) != null ? _a : this.$refs.scrollable[[this.m.offsetWidthOrHeight]];
4848
+ return widthOrHeight * 100 / ((_b = this.$refs.scrollable) == null ? void 0 : _b[this.m.scrollWidthOrHeight]) || 0;
4849
+ },
4850
+ scrollableStyles() {
4851
+ return {
4852
+ [this.m.maxWidthOrHeight]: `${this[this.m.widthOrHeight]}px`
4853
+ };
4854
+ },
4855
+ thumbStyles() {
4856
+ let topOrLeftValue = this.scrollValuePercent;
4857
+ topOrLeftValue = Math.max(0, Math.min(topOrLeftValue, 100 - this.thumbSizePercent));
4858
+ return {
4859
+ [this.m.widthOrHeight]: `${this.thumbSizePercent}%`,
4860
+ [this.m.topOrLeft]: `${topOrLeftValue}%`
4861
+ };
4862
+ }
4863
+ },
4864
+ methods: {
4865
+ onTrackMouseDown(e) {
4866
+ if (this.isDisabled || this.isReadonly)
4867
+ return;
4868
+ if ("ontouchstart" in window && e.type === "mousedown")
4869
+ return;
4870
+ const { top, left, width, height } = this.$refs.track.getBoundingClientRect();
4871
+ if (this.isHorizontal) {
4872
+ this.$refs.track.width = width;
4873
+ this.$refs.track.left = left;
4874
+ } else {
4875
+ this.$refs.track.height = height;
4876
+ this.$refs.track.top = top;
4877
+ }
4878
+ this.dragging = true;
4879
+ this.computeScroll(e.type === "touchstart" ? e.touches[0][this.m.clientXorY] : e[this.m.clientXorY]);
4880
+ this.scroll();
4881
+ document.addEventListener(e.type === "touchstart" ? "touchmove" : "mousemove", this.onDrag);
4882
+ document.addEventListener(e.type === "touchstart" ? "touchend" : "mouseup", this.onMouseUp, { once: true });
4883
+ },
4884
+ onDrag(e) {
4885
+ this.computeScroll(e.type === "touchmove" ? e.touches[0][this.m.clientXorY] : e[this.m.clientXorY]);
4886
+ this.scroll();
4887
+ },
4888
+ onMouseUp(e) {
4889
+ this.dragging = false;
4890
+ document.removeEventListener(e.type === "touchend" ? "touchmove" : "mousemove", this.onDrag);
4891
+ if (this.$refs.thumb)
4892
+ this.$refs.thumb.focus();
4893
+ },
4894
+ onMouseEnter() {
4895
+ this.scrollable.hovered = true;
4896
+ },
4897
+ onMouseLeave() {
4898
+ this.scrollable.hovered = false;
4899
+ },
4900
+ onMouseWheel(e) {
4901
+ if (!this.scrollable.hovered)
4902
+ return;
4903
+ if (this.scrollValuePercent <= 0 && e[this.m.deltaXorY] < 0)
4904
+ return;
4905
+ else if (this.scrollValuePercent >= 100 - this.thumbSizePercent && e[this.m.deltaXorY] > 0)
4906
+ return;
4907
+ e.preventDefault();
4908
+ this.scrollValuePercent += e[this.m.deltaXorY] * 0.05;
4909
+ this.scrollValuePercent = Math.max(0, Math.min(this.scrollValuePercent, 100));
4910
+ this.scroll();
4911
+ },
4912
+ computeScroll(cursorPositionXorY) {
4913
+ const { top, left, width, height } = this.$refs.scrollable.getBoundingClientRect();
4914
+ const topOrLeft = this.isHorizontal ? left : top;
4915
+ const widthOrHeight = this.isHorizontal ? width : height;
4916
+ this.scrollValuePercent = Math.max(0, Math.min((cursorPositionXorY - topOrLeft) / widthOrHeight * 100, 100));
4917
+ },
4918
+ scroll() {
4919
+ var _a;
4920
+ this.$refs.scrollable[this.m.scrollTopOrLeft] = this.scrollValuePercent * ((_a = this.$refs.scrollable) == null ? void 0 : _a[this.m.scrollWidthOrHeight]) / 100;
4921
+ this.updateThumbPosition();
4922
+ },
4923
+ updateThumbPosition() {
4924
+ this.$refs.thumb.style[this.m.topOrLeft] = this.scrollValuePercent;
4925
+ }
4926
+ },
4927
+ mounted() {
4928
+ this.mounted = true;
4929
+ const { top, left } = this.$refs.scrollable.getBoundingClientRect();
4930
+ this.scrollable.top = top;
4931
+ this.scrollable.left = left;
4932
+ this.$el.parentNode.style.position = "relative";
4933
+ this.$el.parentNode.style[this.m.maxWidthOrHeight] = `${this[this.m.widthOrHeight]}px`;
4934
+ }
4781
4935
  };
4782
4936
  const __cssModules$m = {};
4783
4937
  var __component__$m = /* @__PURE__ */ normalizeComponent(
@@ -4795,7 +4949,7 @@ function __vue2_injectStyles$m(context) {
4795
4949
  this[o] = __cssModules$m[o];
4796
4950
  }
4797
4951
  }
4798
- var wScrollbar = /* @__PURE__ */ function() {
4952
+ var wScrollable = /* @__PURE__ */ function() {
4799
4953
  return __component__$m.exports;
4800
4954
  }();
4801
4955
  var render$l = function() {
@@ -4804,12 +4958,14 @@ var render$l = function() {
4804
4958
  var _c = _vm._self._c || _h;
4805
4959
  return _c(_vm.formRegister ? "w-form-element" : "div", _vm._b({ ref: "formEl", tag: "component", class: _vm.classes, attrs: { "valid": _vm.valid, "wrap": _vm.hasLabel && _vm.labelPosition !== "inside" }, on: { "update:valid": function($event) {
4806
4960
  _vm.valid = $event;
4807
- }, "reset": _vm.onReset } }, "component", _vm.formRegister && { validators: _vm.validators, inputValue: _vm.selectionString, disabled: _vm.isDisabled, readonly: _vm.isReadonly }, false), [_vm.labelPosition === "left" ? [_vm.$slots.default || _vm.label ? _c("label", { staticClass: "w-select__label w-select__label--left w-form-el-shakable", class: _vm.labelClasses, attrs: { "for": "w-select--" + _vm._uid } }, [_vm._t("default", function() {
4961
+ }, "reset": _vm.onReset } }, "component", _vm.formRegister && { validators: _vm.validators, inputValue: _vm.selectionString, disabled: _vm.isDisabled, readonly: _vm.isReadonly, isFocused: _vm.isFocused }, false), [_vm.labelPosition === "left" ? [_vm.$slots.default || _vm.label ? _c("label", { staticClass: "w-select__label w-select__label--left w-form-el-shakable", class: _vm.labelClasses, attrs: { "for": "w-select--" + _vm._uid } }, [_vm._t("default", function() {
4808
4962
  return [_vm._v(_vm._s(_vm.label))];
4809
- })], 2) : _vm._e()] : _vm._e(), _c("w-menu", _vm._b({ attrs: { "menu-class": "w-select__menu " + (_vm.menuClass || ""), "transition": "slide-fade-down", "append-to": (_vm.menuProps || {}).appendTo !== void 0 ? (_vm.menuProps || {}).appendTo : void 0, "align-left": "", "custom": "", "min-width": "activator" }, scopedSlots: _vm._u([{ key: "activator", fn: function(ref) {
4963
+ })], 2) : _vm._e()] : _vm._e(), _c("w-menu", _vm._b({ attrs: { "menu-class": "w-select__menu " + (_vm.menuClass || ""), "transition": "slide-fade-down", "append-to": (_vm.menuProps || {}).appendTo !== void 0 ? (_vm.menuProps || {}).appendTo : void 0, "align-left": "", "custom": "", "min-width": "activator" }, on: { "close": function($event) {
4964
+ !$event && _vm.closeMenu();
4965
+ } }, scopedSlots: _vm._u([{ key: "activator", fn: function(ref) {
4810
4966
  ref.on;
4811
4967
  return [_c("div", { staticClass: "w-select__selection-wrap", class: _vm.inputWrapClasses, attrs: { "role": "button", "aria-haspopup": "listbox", "aria-expanded": _vm.showMenu ? "true" : "false", "aria-owns": "w-select-menu--" + _vm._uid, "aria-activedescendant": "w-select-menu--" + _vm._uid + "_item-1" }, on: { "click": function($event) {
4812
- !_vm.isDisabled && !_vm.isReadonly && (_vm.showMenu ? _vm.closeMenu : _vm.openMenu)();
4968
+ !_vm.isDisabled && !_vm.isReadonly && _vm.onInputFieldClick();
4813
4969
  } } }, [_vm.innerIconLeft ? _c("w-icon", { staticClass: "w-select__icon w-select__icon--inner-left", attrs: { "tag": "label" }, on: { "click": function($event) {
4814
4970
  return _vm.$emit("click:inner-icon-left", $event);
4815
4971
  } } }, [_vm._v(_vm._s(_vm.innerIconLeft))]) : _vm._e(), _vm.$scopedSlots.selection ? _c("div", { staticClass: "w-select__selection-slot" }, [_vm._t("selection", null, { "item": _vm.multiple ? _vm.inputValue : _vm.inputValue[0] })], 2) : _vm._e(), _c("div", { ref: "selection-input", staticClass: "w-select__selection", class: { "w-select__selection--placeholder": !_vm.$scopedSlots.selection && !_vm.selectionString && _vm.placeholder }, attrs: { "contenteditable": _vm.isDisabled || _vm.isReadonly ? "false" : "true", "id": "w-select--" + _vm._uid, "disabled": _vm.isDisabled || null, "readonly": "", "aria-readonly": "true", "tabindex": _vm.tabindex || null }, domProps: { "innerHTML": _vm._s((_vm.$scopedSlots.selection ? "" : _vm.selectionString) || _vm.placeholder) }, on: { "focus": function($event) {
@@ -4829,7 +4985,9 @@ var render$l = function() {
4829
4985
  return _vm.$emit("item-click", $event);
4830
4986
  }, "item-select": _vm.onListItemSelect, "keydown:enter": function($event) {
4831
4987
  _vm.noUnselect && !_vm.multiple && _vm.closeMenu();
4832
- }, "keydown:escape": _vm.closeMenu }, scopedSlots: _vm._u([_vm._l(_vm.items.length, function(i) {
4988
+ }, "keydown:escape": function($event) {
4989
+ _vm.showMenu && (this.showMenu = false);
4990
+ } }, scopedSlots: _vm._u([_vm._l(_vm.items.length, function(i) {
4833
4991
  return { key: "item." + i, fn: function(ref) {
4834
4992
  var item = ref.item;
4835
4993
  var selected = ref.selected;
@@ -4911,7 +5069,10 @@ const __vue2_script$l = {
4911
5069
  },
4912
5070
  selectionString() {
4913
5071
  return this.inputValue && this.inputValue.map(
4914
- (item) => item[this.itemValueKey] !== void 0 ? item[this.itemLabelKey] : item[this.itemLabelKey] !== void 0 ? item[this.itemLabelKey] : item
5072
+ (item) => {
5073
+ var _a;
5074
+ return item[this.itemValueKey] !== void 0 ? item[this.itemLabelKey] : (_a = item[this.itemLabelKey]) != null ? _a : item;
5075
+ }
4915
5076
  ).join(", ");
4916
5077
  },
4917
5078
  classes() {
@@ -4946,19 +5107,22 @@ const __vue2_script$l = {
4946
5107
  },
4947
5108
  methods: {
4948
5109
  onFocus(e) {
5110
+ if (this.isFocused)
5111
+ return;
4949
5112
  this.isFocused = true;
4950
5113
  this.$emit("focus", e);
4951
5114
  return false;
4952
5115
  },
4953
5116
  onBlur(e) {
5117
+ if (this.showMenu)
5118
+ return;
4954
5119
  this.isFocused = false;
4955
5120
  this.$emit("blur", e);
4956
5121
  },
4957
5122
  onKeydown(e) {
4958
- e.preventDefault();
4959
- if ([13, 27, 38, 40].includes(e.keyCode))
5123
+ if (!e.metaKey && !e.ctrlKey && e.keyCode !== 9)
4960
5124
  e.preventDefault();
4961
- if (e.keyCode === 27)
5125
+ if (e.keyCode === 27 && this.showMenu)
4962
5126
  this.closeMenu();
4963
5127
  else if (e.keyCode === 13)
4964
5128
  this.openMenu();
@@ -4985,10 +5149,16 @@ const __vue2_script$l = {
4985
5149
  this.$emit("update:modelValue", selection);
4986
5150
  this.$emit("input", selection);
4987
5151
  },
5152
+ onInputFieldClick() {
5153
+ if (this.showMenu)
5154
+ this.showMenu = false;
5155
+ else
5156
+ this.openMenu();
5157
+ },
4988
5158
  onListItemSelect(e) {
4989
5159
  this.$emit("item-select", e);
4990
5160
  if (!this.multiple)
4991
- this.closeMenu();
5161
+ this.showMenu = false;
4992
5162
  },
4993
5163
  onReset() {
4994
5164
  this.inputValue = [];
@@ -5016,7 +5186,8 @@ const __vue2_script$l = {
5016
5186
  }, 100);
5017
5187
  },
5018
5188
  closeMenu() {
5019
- if ((this.menuProps || {}).hideOnMenuClick === false)
5189
+ var _a;
5190
+ if (((_a = this.menuProps) == null ? void 0 : _a.hideOnMenuClick) === false)
5020
5191
  return;
5021
5192
  this.showMenu = false;
5022
5193
  setTimeout(() => this.$refs["selection-input"].focus(), 50);
@@ -5612,7 +5783,9 @@ const __vue2_script$f = {
5612
5783
  "w-tabs--no-slider": this.noSlider,
5613
5784
  "w-tabs--pill-slider": this.pillSlider,
5614
5785
  "w-tabs--fill-bar": this.fillBar,
5615
- "w-tabs--init": this.init
5786
+ "w-tabs--init": this.init,
5787
+ "w-tabs--dark": this.dark,
5788
+ "w-tabs--light": this.light
5616
5789
  };
5617
5790
  },
5618
5791
  tabsBarClasses() {
@@ -5798,7 +5971,7 @@ var render$e = function() {
5798
5971
  var _h = _vm.$createElement;
5799
5972
  var _c = _vm._self._c || _h;
5800
5973
  return _c("div", { staticClass: "w-table-wrap", class: _vm.wrapClasses }, [_c("table", { staticClass: "w-table", class: _vm.classes, on: { "mousedown": _vm.onMouseDown, "mouseover": _vm.onMouseOver, "mouseout": _vm.onMouseOut } }, [_c("colgroup", { ref: "colgroup" }, _vm._l(_vm.headers, function(header, i) {
5801
- return _c("col", { key: i, staticClass: "w-table__col", attrs: { "width": header.width || null } });
5974
+ return _c("col", { key: i, staticClass: "w-table__col", class: _vm.colClasses[i], attrs: { "width": header.width || null } });
5802
5975
  }), 0), !_vm.noHeaders ? _c("thead", [_c("tr", _vm._l(_vm.headers, function(header, i) {
5803
5976
  return _c("th", { key: i, staticClass: "w-table__header", class: _vm.headerClasses(header), on: { "click": function($event) {
5804
5977
  !_vm.colResizing.dragging && header.sortable !== false && _vm.sortTable(header);
@@ -5811,7 +5984,7 @@ var render$e = function() {
5811
5984
  return [_vm._v("Loading...")];
5812
5985
  })], 2)], 1)]) : !_vm.tableItems.length ? _c("tr", { staticClass: "no-data" }, [_c("td", { staticClass: "w-table__cell text-center", attrs: { "colspan": _vm.headers.length } }, [_vm._t("no-data", function() {
5813
5986
  return [_vm._v("No data to show.")];
5814
- })], 2)]) : _vm._e(), _vm.tableItems.length && _vm.loading !== true ? [_vm._l(_vm.sortedItems, function(item, i) {
5987
+ })], 2)]) : _vm._e(), _vm.tableItems.length && _vm.loading !== true ? [_vm._l(_vm.paginatedItems, function(item, i) {
5815
5988
  return [_vm.$scopedSlots["item"] ? _vm._t("item", null, { "item": item, "index": i + 1, "select": function() {
5816
5989
  return _vm.doSelectRow(item, i);
5817
5990
  }, "classes": { "w-table__row": true, "w-table__row--selected": _vm.selectedRowsByUid[item._uid] !== void 0, "w-table__row--expanded": _vm.expandedRowsByUid[item._uid] !== void 0 } }) : _c("tr", { key: i, staticClass: "w-table__row", class: { "w-table__row--selected": _vm.selectedRowsByUid[item._uid] !== void 0, "w-table__row--expanded": _vm.expandedRowsByUid[item._uid] !== void 0 }, on: { "click": function($event) {
@@ -5820,13 +5993,21 @@ var render$e = function() {
5820
5993
  var _obj, _obj$1;
5821
5994
  return [_vm.$scopedSlots["item-cell." + header.key] || _vm.$scopedSlots["item-cell." + (j + 1)] || _vm.$scopedSlots["item-cell"] ? _c("td", { key: j + "-a", staticClass: "w-table__cell", class: (_obj = {}, _obj["text-" + (header.align || "left")] = true, _obj["w-table__cell--sticky"] = header.sticky, _obj), attrs: { "data-label": header.label } }, [_vm.$scopedSlots["item-cell." + header.key] ? _vm._t("item-cell." + header.key, null, { "header": header, "item": item, "label": item[header.key] || "", "index": i + 1 }) : _vm.$scopedSlots["item-cell." + (j + 1)] ? _vm._t("item-cell." + (j + 1), null, { "header": header, "item": item, "label": item[header.key] || "", "index": i + 1 }) : _vm.$scopedSlots["item-cell"] ? _vm._t("item-cell", null, { "header": header, "item": item, "label": item[header.key] || "", "index": i + 1 }) : _vm._e(), j < _vm.headers.length - 1 && _vm.resizableColumns ? _c("span", { staticClass: "w-table__col-resizer", class: { "w-table__col-resizer--hover": _vm.colResizing.hover === j, "w-table__col-resizer--active": _vm.colResizing.columnIndex === j } }) : _vm._e()], 2) : _c("td", { key: j + "-b", staticClass: "w-table__cell", class: (_obj$1 = {}, _obj$1["text-" + (header.align || "left")] = true, _obj$1["w-table__cell--sticky"] = header.sticky, _obj$1), attrs: { "data-label": header.label } }, [_c("div", { domProps: { "innerHTML": _vm._s(item[header.key] || "") } }), j < _vm.headers.length - 1 && _vm.resizableColumns ? _c("span", { staticClass: "w-table__col-resizer", class: { "w-table__col-resizer--hover": _vm.colResizing.hover === j, "w-table__col-resizer--active": _vm.colResizing.columnIndex === j } }) : _vm._e()])];
5822
5995
  })], 2), _vm.expandedRowsByUid[item._uid] ? _c("tr", { staticClass: "w-table__row w-table__row--expansion" }, [_c("td", { staticClass: "w-table__cell", attrs: { "colspan": _vm.headers.length } }, [_c("w-transition-expand", { attrs: { "y": "" } }, [_vm.expandedRowsByUid[item._uid] ? _c("div", [_vm._t("row-expansion", null, { "item": item, "index": i + 1 })], 2) : _vm._e(), i < _vm.headers.length - 1 && _vm.resizableColumns ? _c("span", { staticClass: "w-table__col-resizer", class: { "w-table__col-resizer--hover": _vm.colResizing.hover === i, "w-table__col-resizer--active": _vm.colResizing.columnIndex === _vm.j } }) : _vm._e()])], 1)]) : _vm._e()];
5823
- })] : _vm._e(), _vm.$slots["extra-row"] ? _c("div", { staticClass: "w-table__extra-row" }, [_vm._t("extra-row")], 2) : _vm._e()], 2), _vm.$slots.footer || _vm.$slots["footer-row"] || _vm.pagination ? _c("tfoot", { staticClass: "w-table__footer" }, [_vm.$slots["footer-row"] ? _vm._t("footer-row") : _vm.$slots.footer ? _c("tr", { staticClass: "w-table__row" }, [_c("td", { staticClass: "w-table__cell", attrs: { "colspan": _vm.headers.length } }, [_vm._t("footer")], 2)]) : _vm._e(), _vm.pagination && _vm.paginationConfig ? _c("tr", { staticClass: "w-table__row w-table__pagination-wrap" }, [_c("td", { staticClass: "w-table__cell", attrs: { "colspan": _vm.headers.length } }, [_c("div", { staticClass: "w-table__pagination" }, [_vm.paginationConfig.itemsPerPageOptions ? _c("w-select", { staticClass: "pagination-number pagination-number--items-per-page", attrs: { "items": _vm.paginationConfig.itemsPerPageOptions, "label-position": "left", "label": "Items per page", "label-color": "inherit" }, model: { value: _vm.paginationConfig.itemsPerPage, callback: function($$v) {
5824
- _vm.$set(_vm.paginationConfig, "itemsPerPage", $$v);
5825
- }, expression: "paginationConfig.itemsPerPage" } }) : _vm._e(), _c("span", { staticClass: "pagination-number pagination-number--results" }, [_vm._v(_vm._s(_vm.paginationConfig.start) + "-" + _vm._s(_vm.paginationConfig.end) + " of " + _vm._s(_vm.paginationConfig.total))]), _c("div", { staticClass: "pagination-arrows" }, [_c("w-button", { staticClass: "pagination-arrow pagination-arrow--prev", attrs: { "icon": "wi-chevron-left", "text": "", "lg": "" }, on: { "click": function($event) {
5826
- _vm.paginationConfig.page--;
5827
- } } }), _c("w-button", { staticClass: "pagination-arrow pagination-arrow--next", attrs: { "icon": "wi-chevron-right", "text": "", "lg": "" }, on: { "click": function($event) {
5828
- _vm.paginationConfig.page++;
5829
- } } })], 1)], 1)])]) : _vm._e()], 2) : _vm._e()])]);
5996
+ })] : _vm._e(), _vm.$slots["extra-row"] ? _c("div", { staticClass: "w-table__extra-row" }, [_vm._t("extra-row")], 2) : _vm._e()], 2), _vm.$slots.footer || _vm.$slots["footer-row"] || _vm.pagination ? _c("tfoot", { staticClass: "w-table__footer" }, [_vm.$slots["footer-row"] ? _vm._t("footer-row") : _vm.$slots.footer ? _c("tr", { staticClass: "w-table__row" }, [_c("td", { staticClass: "w-table__cell", attrs: { "colspan": _vm.headers.length } }, [_vm._t("footer")], 2)]) : _vm._e(), _vm.pagination && _vm.paginationConfig ? _c("tr", { staticClass: "w-table__row w-table__pagination-wrap" }, [_c("td", { staticClass: "w-table__cell", attrs: { "colspan": _vm.headers.length } }, [_c("div", { staticClass: "w-table__pagination w-pagination" }, [_vm._t("pagination", function() {
5997
+ return [_vm.paginationConfig.itemsPerPageOptions ? _c("w-select", { staticClass: "w-pagination__items-per-page", attrs: { "items": _vm.paginationConfig.itemsPerPageOptions, "label-position": "left", "label": "Items per page", "label-color": "inherit" }, on: { "input": function($event) {
5998
+ return _vm.updatePaginationConfig({ itemsPerPage: _vm.paginationConfig.itemsPerPage });
5999
+ } }, model: { value: _vm.paginationConfig.itemsPerPage, callback: function($$v) {
6000
+ _vm.$set(_vm.paginationConfig, "itemsPerPage", $$v);
6001
+ }, expression: "paginationConfig.itemsPerPage" } }) : _vm._e(), _c("div", { staticClass: "pages-wrap" }, [_c("w-button", { staticClass: "w-pagination__arrow w-pagination__arrow--prev", attrs: { "disabled": _vm.paginationConfig.page <= 1, "icon": "wi-chevron-left", "text": "", "lg": "" }, on: { "click": function($event) {
6002
+ return _vm.goToPage("-1");
6003
+ } } }), _vm._l(_vm.paginationConfig.pagesCount, function(i) {
6004
+ return _c("w-button", { key: i, staticClass: "w-pagination__page", class: { "w-pagination__page--active": i === _vm.paginationConfig.page }, attrs: { "round": "", "lg": "" }, on: { "click": function($event) {
6005
+ i !== _vm.paginationConfig.page && _vm.goToPage(i);
6006
+ } } }, [_vm._v(_vm._s(i))]);
6007
+ }), _c("w-button", { staticClass: "w-pagination__arrow w-pagination__arrow--next", attrs: { "disabled": _vm.paginationConfig.page >= _vm.paginationConfig.pagesCount, "icon": "wi-chevron-right", "text": "", "lg": "" }, on: { "click": function($event) {
6008
+ return _vm.goToPage("+1");
6009
+ } } })], 2), _c("span", { staticClass: "w-pagination__results" }, [_vm._v(_vm._s(_vm.paginationConfig.start) + "-" + _vm._s(_vm.paginationConfig.end || _vm.paginationConfig.total) + " of " + _vm._s(_vm.paginationConfig.total))])];
6010
+ }, { "range": _vm.paginationConfig.start + "-" + _vm.paginationConfig.end, "total": _vm.paginationConfig.total })], 2)])]) : _vm._e()], 2) : _vm._e()])]);
5830
6011
  };
5831
6012
  var staticRenderFns$e = [];
5832
6013
  var wTable_vue_vue_type_style_index_0_lang = "";
@@ -5842,6 +6023,9 @@ const __vue2_script$e = {
5842
6023
  fixedFooter: { type: Boolean },
5843
6024
  loading: { type: [Boolean, String] },
5844
6025
  sort: { type: [String, Array] },
6026
+ sortFunction: { type: Function },
6027
+ filter: { type: Function },
6028
+ fetch: { type: Function },
5845
6029
  expandableRows: {
5846
6030
  validator: (value) => {
5847
6031
  if (![void 0, true, false, 1, "1", ""].includes(value)) {
@@ -5866,8 +6050,6 @@ const __vue2_script$e = {
5866
6050
  selectedRows: { type: Array },
5867
6051
  forceSelection: { type: Boolean },
5868
6052
  uidKey: { type: String, default: "id" },
5869
- filter: { type: Function },
5870
- sortFunction: { type: Function },
5871
6053
  mobileBreakpoint: { type: Number, default: 0 },
5872
6054
  resizableColumns: { type: Boolean },
5873
6055
  pagination: {
@@ -5908,12 +6090,20 @@ const __vue2_script$e = {
5908
6090
  columnEl: null,
5909
6091
  nextColumnEl: null
5910
6092
  },
5911
- paginationConfig: {}
6093
+ paginationConfig: {
6094
+ itemsPerPage: 0,
6095
+ itemsPerPageOptions: {},
6096
+ start: 0,
6097
+ end: 0,
6098
+ page: 1,
6099
+ total: 0
6100
+ }
5912
6101
  }),
5913
6102
  computed: {
5914
6103
  tableItems() {
5915
6104
  return this.items.map((item, i) => {
5916
- item._uid = item[this.uidKey] !== void 0 ? item[this.uidKey] : i;
6105
+ var _a;
6106
+ item._uid = (_a = item[this.uidKey]) != null ? _a : i;
5917
6107
  return item;
5918
6108
  });
5919
6109
  },
@@ -5921,7 +6111,7 @@ const __vue2_script$e = {
5921
6111
  return typeof this.filter === "function" ? this.tableItems.filter(this.filter) : this.tableItems;
5922
6112
  },
5923
6113
  sortedItems() {
5924
- if (!this.activeSorting.length || this.sortFunction)
6114
+ if (!this.activeSorting.length || this.sortFunction || this.fetch)
5925
6115
  return this.filteredItems;
5926
6116
  const sortKey1 = this.activeSorting[0].replace(/^[+-]/, "");
5927
6117
  const sortDesc1 = this.activeSorting[0][0] === "-";
@@ -5935,6 +6125,9 @@ const __vue2_script$e = {
5935
6125
  return (a > b ? 1 : -1) * (sortDesc1 ? -1 : 1);
5936
6126
  });
5937
6127
  },
6128
+ paginatedItems() {
6129
+ return typeof this.fetch === "function" ? this.sortedItems : this.sortedItems.slice(this.paginationConfig.start - 1, this.paginationConfig.end);
6130
+ },
5938
6131
  activeSortingKeys() {
5939
6132
  return this.activeSorting.reduce((obj, item) => {
5940
6133
  obj[item.replace(/^[+-]/, "")] = item[0];
@@ -5946,8 +6139,15 @@ const __vue2_script$e = {
5946
6139
  "w-table-wrap--loading": this.loading
5947
6140
  };
5948
6141
  },
6142
+ colClasses() {
6143
+ return this.headers.map((header) => {
6144
+ return { "w-table__col--highlighted": this.activeSortingKeys[header.key] };
6145
+ }) || [];
6146
+ },
5949
6147
  classes() {
5950
6148
  return {
6149
+ "w-table--loading": this.loading,
6150
+ "w-table--loading-in-header": this.loading === "header",
5951
6151
  "w-table--fixed-layout": this.fixedLayout || this.resizableColumns || this.hasStickyColumn,
5952
6152
  "w-table--mobile": this.isMobile || null,
5953
6153
  "w-table--resizable-cols": this.resizableColumns || null,
@@ -5994,9 +6194,10 @@ const __vue2_script$e = {
5994
6194
  } else
5995
6195
  this.$set(this.activeSorting, 0, (alreadySortingThis ? "-" : "+") + header.key);
5996
6196
  this.$emit("update:sort", this.activeSorting);
5997
- if (typeof this.sortFunction === "function") {
6197
+ if (typeof this.sortFunction === "function")
5998
6198
  await this.sortFunction(this.activeSorting);
5999
- }
6199
+ else if (typeof this.fetch === "function")
6200
+ await this.callApiFetch();
6000
6201
  },
6001
6202
  doSelectRow(item, index2) {
6002
6203
  const expandable = this.expandableRows === "" ? true : this.expandableRows;
@@ -6107,19 +6308,70 @@ const __vue2_script$e = {
6107
6308
  this.colResizing.nextColWidth = null;
6108
6309
  }, 0);
6109
6310
  },
6110
- updatePaginationConfig() {
6111
- var _a, _b, _c, _d, _e;
6112
- const itemsPerPage = ((_a = this.pagination) == null ? void 0 : _a.itemsPerPage) || 10;
6113
- const total = ((_b = this.pagination) == null ? void 0 : _b.total) || this.items.length;
6114
- const page = ((_c = this.pagination) == null ? void 0 : _c.page) || 1;
6115
- this.paginationConfig = {
6311
+ initPagination() {
6312
+ var _a, _b, _c;
6313
+ const itemsPerPage = (_b = (_a = this.pagination) == null ? void 0 : _a.itemsPerPage) != null ? _b : 20;
6314
+ const itemsPerPageOptions = ((_c = this.pagination) == null ? void 0 : _c.itemsPerPageOptions) || [20, 100, { label: "All", value: 0 }];
6315
+ if (!itemsPerPageOptions.find((item) => {
6316
+ var _a2;
6317
+ return ((_a2 = item == null ? void 0 : item.value) != null ? _a2 : item) === +itemsPerPage;
6318
+ })) {
6319
+ itemsPerPageOptions.push(itemsPerPage);
6320
+ }
6321
+ this.paginationConfig.itemsPerPageOptions = itemsPerPageOptions.map((item) => {
6322
+ var _a2;
6323
+ return {
6324
+ label: ["string", "number"].includes(typeof item) ? item.toString() : item.label || item.value,
6325
+ value: ["string", "number"].includes(typeof item) ? ~~item : (_a2 = item.value) != null ? _a2 : item.label
6326
+ };
6327
+ });
6328
+ this.paginationConfig.itemsPerPageOptions.sort((a, b) => a.value < b.value ? -1 : 1);
6329
+ const optionAll = this.paginationConfig.itemsPerPageOptions.shift();
6330
+ this.paginationConfig.itemsPerPageOptions.push(optionAll);
6331
+ this.updatePaginationConfig({
6116
6332
  itemsPerPage,
6117
- itemsPerPageOptions: ((_d = this.pagination) == null ? void 0 : _d.itemsPerPageOptions) || [{ label: "10", value: 10 }, { label: "100", value: 100 }, { label: "All", value: 0 }],
6333
+ page: this.pagination.page || 1,
6334
+ total: this.pagination.total || this.items.length
6335
+ });
6336
+ },
6337
+ updatePaginationConfig({ itemsPerPage, page, total }) {
6338
+ if (total)
6339
+ this.paginationConfig.total = total;
6340
+ if (itemsPerPage !== void 0) {
6341
+ this.paginationConfig.itemsPerPage = itemsPerPage;
6342
+ itemsPerPage = itemsPerPage || this.paginationConfig.total;
6343
+ this.paginationConfig.page = 1;
6344
+ ({ page } = this.paginationConfig);
6345
+ total = this.paginationConfig.total;
6346
+ this.paginationConfig.start = 1;
6347
+ this.paginationConfig.end = total >= itemsPerPage * page ? itemsPerPage * page : total % (itemsPerPage * page);
6348
+ this.paginationConfig.pagesCount = Math.ceil(total / itemsPerPage);
6349
+ }
6350
+ if (page)
6351
+ this.goToPage(page);
6352
+ },
6353
+ async goToPage(page) {
6354
+ if (["-1", "+1"].includes(page))
6355
+ this.paginationConfig.page += +page;
6356
+ else
6357
+ this.paginationConfig.page = page;
6358
+ const { itemsPerPage, total } = this.paginationConfig;
6359
+ this.paginationConfig.page = Math.max(1, this.paginationConfig.page);
6360
+ this.paginationConfig.start = itemsPerPage * (this.paginationConfig.page - 1) + 1;
6361
+ this.paginationConfig.end = this.paginationConfig.start - 1 + (itemsPerPage || total);
6362
+ if (typeof this.fetch === "function")
6363
+ await this.callApiFetch();
6364
+ },
6365
+ async callApiFetch() {
6366
+ const { page, start, end, total, itemsPerPage } = this.paginationConfig;
6367
+ return await this.fetch({
6118
6368
  page,
6119
- start: ((_e = this.pagination) == null ? void 0 : _e.start) || 1,
6120
- end: total >= itemsPerPage * page ? itemsPerPage * page : total % (itemsPerPage * page),
6121
- total
6122
- };
6369
+ start,
6370
+ end: end || total,
6371
+ total,
6372
+ itemsPerPage: itemsPerPage || total,
6373
+ sorting: this.activeSorting
6374
+ });
6123
6375
  }
6124
6376
  },
6125
6377
  created() {
@@ -6132,7 +6384,7 @@ const __vue2_script$e = {
6132
6384
  if ((this.selectedRows || []).length)
6133
6385
  this.selectedRowsInternal = this.selectedRows;
6134
6386
  if (this.pagination)
6135
- this.updatePaginationConfig();
6387
+ this.initPagination();
6136
6388
  },
6137
6389
  watch: {
6138
6390
  sort(sorting) {
@@ -6158,6 +6410,15 @@ const __vue2_script$e = {
6158
6410
  },
6159
6411
  selectedRows(array) {
6160
6412
  this.selectedRowsInternal = Array.isArray(array) && array.length ? this.selectedRows : [];
6413
+ },
6414
+ "pagination.page"(page) {
6415
+ this.updatePaginationConfig({ page });
6416
+ },
6417
+ "pagination.itemsPerPage"(itemsPerPage) {
6418
+ this.updatePaginationConfig({ itemsPerPage });
6419
+ },
6420
+ "pagination.total"(total) {
6421
+ this.updatePaginationConfig({ total });
6161
6422
  }
6162
6423
  }
6163
6424
  };
@@ -7167,7 +7428,7 @@ var render = function() {
7167
7428
  var _c = _vm._self._c || _h;
7168
7429
  return _c("ul", { staticClass: "w-tree", class: _vm.classes }, _vm._l(_vm.currentDepthItems, function(item, i) {
7169
7430
  var _obj;
7170
- return _c("li", { key: i, staticClass: "w-tree__item", class: _vm.itemClasses(item) }, [_c(!_vm.disabled && !item.disabled && item.route ? !_vm.$router || _vm.hasExternalLink(item) ? "a" : "router-link" : "div", _vm._b({ tag: "component", staticClass: "w-tree__item-label", attrs: { "tabindex": !_vm.disabled && !item.disabled && (item.children || item.branch || _vm.selectable) && !(_vm.unexpandableEmpty && !item.children) ? 0 : null }, on: { "click": function($event) {
7431
+ return _c("li", { key: i, staticClass: "w-tree__item", class: _vm.itemClasses(item) }, [_c(_vm.getTreeItemComponent(item), _vm._b({ tag: "component", staticClass: "w-tree__item-label", attrs: { "tabindex": _vm.getTreeItemTabindex(item) }, on: { "click": function($event) {
7171
7432
  !_vm.disabled && !item.disabled && _vm.onLabelClick(item, $event);
7172
7433
  }, "keydown": function($event) {
7173
7434
  !_vm.disabled && !item.disabled && _vm.onLabelKeydown(item, $event);
@@ -7176,11 +7437,11 @@ var render = function() {
7176
7437
  !_vm.disabled && !item.disabled && _vm.onLabelClick(item, $event);
7177
7438
  } } }) : _vm._e(), _vm._t("item", function() {
7178
7439
  return [_vm.itemIcon(item) ? _c("w-icon", { staticClass: "w-tree__item-icon", attrs: { "color": item.originalItem[_vm.itemIconColorKey] || _vm.iconColor } }, [_vm._v(_vm._s(_vm.itemIcon(item)))]) : _vm._e(), _c("span", { domProps: { "innerHTML": _vm._s(item.label) } }), _vm.counts && (item.children || item.branch) ? _c("span", { staticClass: "ml1" }, [_vm._v("(" + _vm._s(item.originalItem.children ? item.originalItem.children.length : 0) + ")")]) : _vm._e()];
7179
- }, { "item": item.originalItem, "depth": _vm.depth, "open": item.open })], 2), _c(_vm.noTransition ? "div" : "w-transition-expand", { tag: "component", attrs: { "y": !_vm.noTransition || null }, on: { "after-enter": function($event) {
7180
- return _vm.$emit("open", { item: item.originalItem, open: item.open, depth: _vm.depth });
7440
+ }, { "item": item.originalItem, "depth": _vm.depth, "path": item.path, "open": item.open })], 2), _c(_vm.noTransition ? "div" : "w-transition-expand", { tag: "component", attrs: { "y": !_vm.noTransition || null }, on: { "after-enter": function($event) {
7441
+ _vm.$emit("open", _vm.emitPayload(item));
7181
7442
  }, "after-leave": function($event) {
7182
- return _vm.$emit("close", { item: item.originalItem, open: item.open, depth: _vm.depth });
7183
- } } }, [item.children && item.open ? _c("w-tree", _vm._b({ attrs: { "depth": _vm.depth + 1, "data": item.originalItem.children }, on: { "before-open": function($event) {
7443
+ _vm.$emit("close", _vm.emitPayload(item));
7444
+ } } }, [item.children && item.open ? _c("w-tree", _vm._b({ attrs: { "depth": _vm.depth + 1, "data": item.originalItem.children, "parent": item }, on: { "before-open": function($event) {
7184
7445
  return _vm.$emit("before-open", $event);
7185
7446
  }, "open": function($event) {
7186
7447
  return _vm.$emit("open", $event);
@@ -7197,8 +7458,9 @@ var render = function() {
7197
7458
  } }, scopedSlots: _vm._u([{ key: "item", fn: function(ref) {
7198
7459
  var item2 = ref.item;
7199
7460
  var depth = ref.depth;
7461
+ var path = ref.path;
7200
7462
  var open = ref.open;
7201
- return [_vm._t("item", null, { "item": item2, "depth": depth, "open": open })];
7463
+ return [_vm._t("item", null, { "item": item2, "depth": depth, "path": path, "open": open })];
7202
7464
  } }], null, true) }, "w-tree", _vm.$props, false)) : _vm._e()], 1)], 1);
7203
7465
  }), 0);
7204
7466
  };
@@ -7210,6 +7472,7 @@ const __vue2_script = {
7210
7472
  value: { type: [Object, Array] },
7211
7473
  data: { type: [Object, Array], required: true },
7212
7474
  depth: { type: Number, default: 0 },
7475
+ parent: { type: Object, default: null },
7213
7476
  branchClass: { type: String },
7214
7477
  leafClass: { type: String },
7215
7478
  branchIcon: { type: String },
@@ -7242,6 +7505,7 @@ const __vue2_script = {
7242
7505
  return {
7243
7506
  [`w-tree--depth${this.depth}`]: true,
7244
7507
  "w-tree--expand-icon": this.expandIcon && !this.depth,
7508
+ "w-tree--selectable": this.selectable,
7245
7509
  "w-tree--disabled": this.disabled && !this.depth,
7246
7510
  "w-tree--no-expand-button": !this.expandIcon
7247
7511
  };
@@ -7256,8 +7520,8 @@ const __vue2_script = {
7256
7520
  if (!Array.isArray(items))
7257
7521
  items = [items];
7258
7522
  items.forEach((item, i) => {
7259
- var _a;
7260
- this.currentDepthItems.push({
7523
+ var _a, _b;
7524
+ const itemWrapper = {
7261
7525
  originalItem: item,
7262
7526
  _uid: this.depth.toString() + (i + 1),
7263
7527
  label: item[this.itemLabelKey],
@@ -7265,20 +7529,44 @@ const __vue2_script = {
7265
7529
  branch: item.branch,
7266
7530
  route: item[this.itemRouteKey],
7267
7531
  disabled: item[this.itemDisabledKey],
7532
+ selected: ((_a = oldItems[i]) == null ? void 0 : _a.selected) || false,
7268
7533
  depth: this.depth,
7269
- open: !!(((_a = oldItems[i]) == null ? void 0 : _a.open) || this.expandAll || item[this.itemOpenKey])
7270
- });
7534
+ open: !!(((_b = oldItems[i]) == null ? void 0 : _b.open) || this.expandAll || item[this.itemOpenKey]),
7535
+ parent: this.parent || null,
7536
+ path: []
7537
+ };
7538
+ itemWrapper.path = this.getTreeItemPath(itemWrapper);
7539
+ this.currentDepthItems.push(itemWrapper);
7271
7540
  });
7272
7541
  },
7542
+ getTreeItemComponent(item) {
7543
+ return !this.disabled && !item.disabled && item.route ? !this.$router || this.hasExternalLink(item) ? "a" : "router-link" : "div";
7544
+ },
7545
+ getTreeItemTabindex(item) {
7546
+ return !this.disabled && !item.disabled && (item.children || item.branch || this.selectable) && !(this.unexpandableEmpty && !item.children) ? 0 : null;
7547
+ },
7548
+ getTreeItemPath(item) {
7549
+ const ancestorsPath = [item];
7550
+ let ancestor = item.parent;
7551
+ while (ancestor) {
7552
+ ancestorsPath.push(ancestor);
7553
+ ancestor = ancestor.parent;
7554
+ }
7555
+ ancestorsPath.reverse();
7556
+ return ancestorsPath;
7557
+ },
7558
+ getTreeItemPathForOutput(item) {
7559
+ return item.path.map((item2) => item2.originalItem);
7560
+ },
7273
7561
  expandDepth(item, open) {
7274
7562
  if (typeof open === "boolean")
7275
7563
  item.open = open;
7276
7564
  else
7277
7565
  item.open = !item.open;
7278
- const emitParams = { item: item.originalItem, open: item.open, depth: this.depth };
7279
- this.$emit(item.open ? "before-open" : "before-close", emitParams);
7566
+ const emitPayload = this.emitPayload(item);
7567
+ this.$emit(item.open ? "before-open" : "before-close", emitPayload);
7280
7568
  if (!this.unexpandableEmpty && !item.children) {
7281
- this.$emit(item.open ? "open" : "close", emitParams);
7569
+ this.$emit(item.open ? "open" : "close", emitPayload);
7282
7570
  }
7283
7571
  return true;
7284
7572
  },
@@ -7286,19 +7574,13 @@ const __vue2_script = {
7286
7574
  const route = item[this.itemRouteKey];
7287
7575
  if (route && this.$router && !this.hasExternalLink(item))
7288
7576
  e.preventDefault();
7289
- this.$emit("click", { item: item.originalItem, depth: this.depth, e });
7290
7577
  if (item.children || item.branch && !this.unexpandableEmpty)
7291
7578
  this.expandDepth(item);
7292
7579
  if (this.selectable)
7293
- this.emitItemSelection(item, e);
7294
- },
7295
- emitItemSelection(item, e) {
7296
- const emitParams = { item: item.originalItem, depth: this.depth, e };
7297
- if (item.children || item.branch && !this.unexpandableEmpty) {
7298
- emitParams.open = item.open;
7299
- }
7300
- this.$emit("input", emitParams);
7301
- this.$emit("select", emitParams);
7580
+ item.selected = !item.selected;
7581
+ const emitPayload = this.emitPayload(item, e);
7582
+ this.$emit("click", emitPayload);
7583
+ this.emitItemSelection(item, e);
7302
7584
  },
7303
7585
  onLabelKeydown(item, e) {
7304
7586
  if (!(e.metaKey || e.ctrlKey || e.altKey || e.shiftKey) && [13, 32, 37, 38, 39, 40].includes(e.which)) {
@@ -7324,8 +7606,31 @@ const __vue2_script = {
7324
7606
  });
7325
7607
  }
7326
7608
  }
7327
- if (this.selectable)
7609
+ if (e.which === 13) {
7610
+ if (this.selectable)
7611
+ item.selected = !item.selected;
7328
7612
  this.emitItemSelection(item, e);
7613
+ }
7614
+ },
7615
+ emitItemSelection(item, e) {
7616
+ const emitPayload = this.emitPayload(item, e);
7617
+ this.$emit("update:model-value", emitPayload);
7618
+ if (this.selectable)
7619
+ this.$emit("select", emitPayload);
7620
+ },
7621
+ emitPayload(item, e) {
7622
+ const emitPayload = {
7623
+ item: item.originalItem,
7624
+ depth: this.depth,
7625
+ path: this.getTreeItemPathForOutput(item)
7626
+ };
7627
+ if (e)
7628
+ emitPayload.e = e;
7629
+ if (item.children || item.branch && !this.unexpandableEmpty)
7630
+ emitPayload.open = item.open;
7631
+ if (this.selectable)
7632
+ emitPayload.selected = item.selected;
7633
+ return emitPayload;
7329
7634
  },
7330
7635
  getPreviousSibling(node, selector) {
7331
7636
  while (selector && (node = node.previousElementSibling)) {
@@ -7354,6 +7659,7 @@ const __vue2_script = {
7354
7659
  return {
7355
7660
  [item.children || item.branch ? "w-tree__item--branch" : "w-tree__item--leaf"]: true,
7356
7661
  "w-tree__item--disabled": item[this.itemDisabledKey],
7662
+ "w-tree__item--selected": item.selected,
7357
7663
  "w-tree__item--empty": item.branch && !item.children,
7358
7664
  "w-tree__item--unexpandable": item.branch && !item.children && this.unexpandableEmpty
7359
7665
  };
@@ -7422,7 +7728,7 @@ var components = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProp
7422
7728
  WRadio: wRadio,
7423
7729
  WRadios: wRadios,
7424
7730
  WRating: wRating,
7425
- WScrollbar: wScrollbar,
7731
+ WScrollable: wScrollable,
7426
7732
  WSelect: wSelect,
7427
7733
  WSlider: wSlider,
7428
7734
  WSpinner: wSpinner,