wave-ui 1.66.0 → 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);
@@ -5536,16 +5707,16 @@ var render$f = function() {
5536
5707
  } } }, [_vm.$scopedSlots["item-title." + (tab.id || i + 1)] ? _vm._t("item-title." + (tab.id || i + 1), null, { "item": _vm.getOriginalItem(tab), "index": i + 1, "active": tab._uid === _vm.activeTabUid }) : _vm._t("item-title", function() {
5537
5708
  return [_c("div", { domProps: { "innerHTML": _vm._s(tab[_vm.itemTitleKey]) } })];
5538
5709
  }, { "item": _vm.getOriginalItem(tab), "index": i + 1, "active": tab._uid === _vm.activeTabUid })], 2);
5539
- }), _vm.$scopedSlots["tabs-bar-extra"] ? _c("div", { staticClass: "w-tabs__bar-extra" }, [_vm._t("tabs-bar-extra")], 2) : _vm._e(), !_vm.noSlider && !_vm.card ? _c("div", { staticClass: "w-tabs__slider", class: _vm.sliderColor, style: _vm.sliderStyles }) : _vm._e()], 2), _vm.tabs.length ? _c("div", { staticClass: "w-tabs__content-wrap" }, [_vm.keepInDom ? _c("transition-group", { attrs: { "name": _vm.transitionName } }, _vm._l(_vm.tabs, function(tab, i) {
5710
+ }), _vm.$scopedSlots["tabs-bar-extra"] ? _c("div", { staticClass: "w-tabs__bar-extra" }, [_vm._t("tabs-bar-extra")], 2) : _vm._e(), !_vm.noSlider && !_vm.card ? _c("div", { staticClass: "w-tabs__slider", class: _vm.sliderColor, style: _vm.sliderStyles }) : _vm._e()], 2), _vm.keepInDom ? _c("transition-group", { staticClass: "w-tabs__content-wrap", attrs: { "name": _vm.transitionName, "tag": "div" } }, _vm._l(_vm.tabs, function(tab, i) {
5540
5711
  return _c("tab-content", { directives: [{ name: "show", rawName: "v-show", value: tab._uid === _vm.activeTab._uid, expression: "tab._uid === activeTab._uid" }], key: tab._uid, class: _vm.contentClass, attrs: { "item": tab } }, [_vm.$scopedSlots["item-content." + (tab._index + 1)] ? _vm._t("item-content." + (tab._index + 1), null, { "item": _vm.getOriginalItem(tab), "index": tab._index + 1, "active": tab._index === _vm.activeTab._index }) : _vm._t("item-content", function() {
5541
5712
  return [tab[_vm.itemContentKey] ? _c("div", { domProps: { "innerHTML": _vm._s(tab[_vm.itemContentKey]) } }) : _vm._e()];
5542
5713
  }, { "item": _vm.getOriginalItem(tab), "index": tab._index + 1, "active": tab._index === _vm.activeTab._index })], 2);
5543
- }), 1) : _c("transition", { attrs: { "name": _vm.transitionName, "mode": _vm.transitionMode } }, [_c("keep-alive", { attrs: { "exclude": _vm.keepAlive ? "" : "tab-content" } }, [_c("tab-content", { key: _vm.activeTabUid, class: _vm.contentClass, attrs: { "item": _vm.activeTab }, scopedSlots: _vm._u([{ key: "default", fn: function(ref) {
5714
+ }), 1) : _c("div", { staticClass: "w-tabs__content-wrap" }, [_c("transition", { attrs: { "name": _vm.transitionName, "mode": _vm.transitionMode } }, [_c("keep-alive", { attrs: { "exclude": _vm.keepAlive ? "" : "tab-content" } }, [_c("tab-content", { key: _vm.activeTabUid, class: _vm.contentClass, attrs: { "item": _vm.activeTab }, scopedSlots: _vm._u([{ key: "default", fn: function(ref) {
5544
5715
  var item = ref.item;
5545
5716
  return [item ? [_vm.$scopedSlots["item-content." + (item._index + 1)] ? _vm._t("item-content." + (item._index + 1), null, { "item": _vm.getOriginalItem(item), "index": item._index + 1, "active": item._uid === _vm.activeTabUid }) : _vm._t("item-content", function() {
5546
5717
  return [item[_vm.itemContentKey] ? _c("div", { domProps: { "innerHTML": _vm._s(item[_vm.itemContentKey]) } }) : _vm._e()];
5547
5718
  }, { "item": _vm.getOriginalItem(item), "index": item._index + 1, "active": item._uid === _vm.activeTabUid })] : _vm._e()];
5548
- } }], null, true) })], 1)], 1)], 1) : _vm._e()]);
5719
+ } }], null, true) })], 1)], 1)], 1)], 1);
5549
5720
  };
5550
5721
  var staticRenderFns$f = [];
5551
5722
  var index_vue_vue_type_style_index_0_lang = "";
@@ -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() {
@@ -5709,28 +5882,33 @@ const __vue2_script$f = {
5709
5882
  }
5710
5883
  },
5711
5884
  updateActiveTab(index2) {
5885
+ var _a, _b;
5712
5886
  if (typeof index2 === "string")
5713
5887
  index2 = ~~index2;
5714
5888
  else if (isNaN(index2) || index2 < 0)
5715
5889
  index2 = 0;
5716
- this.openTab(this.tabs[index2]._uid);
5717
- this.$nextTick(() => {
5718
- const ref = this.$refs["tabs-bar"];
5719
- this.activeTabEl = ref && ref.querySelector(`.w-tabs__bar-item:nth-child(${index2 + 1})`);
5720
- if (this.activeTabEl) {
5721
- this.activeTabEl.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" });
5722
- }
5723
- });
5890
+ if ((_a = this.tabs[index2]) == null ? void 0 : _a._uid) {
5891
+ this.openTab((_b = this.tabs[index2]) == null ? void 0 : _b._uid);
5892
+ this.$nextTick(() => {
5893
+ const ref = this.$refs["tabs-bar"];
5894
+ this.activeTabEl = ref && ref.querySelector(`.w-tabs__bar-item:nth-child(${index2 + 1})`);
5895
+ if (this.activeTabEl) {
5896
+ this.activeTabEl.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" });
5897
+ }
5898
+ });
5899
+ }
5724
5900
  },
5725
5901
  getOriginalItem(item) {
5726
5902
  return this.items[item._index] || {};
5727
5903
  }
5728
5904
  },
5729
5905
  beforeMount() {
5906
+ var _a;
5730
5907
  this.tabs = [];
5731
5908
  const items = typeof this.items === "number" ? Array(this.items).fill().map(Object) : this.items;
5732
5909
  items.forEach(this.addTab);
5733
- this.updateActiveTab(this.value);
5910
+ if ((_a = this.value) != null ? _a : false)
5911
+ this.updateActiveTab(this.value);
5734
5912
  this.$nextTick(() => {
5735
5913
  this.updateSlider();
5736
5914
  setTimeout(() => this.init = false, 0);
@@ -5793,7 +5971,7 @@ var render$e = function() {
5793
5971
  var _h = _vm.$createElement;
5794
5972
  var _c = _vm._self._c || _h;
5795
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) {
5796
- 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 } });
5797
5975
  }), 0), !_vm.noHeaders ? _c("thead", [_c("tr", _vm._l(_vm.headers, function(header, i) {
5798
5976
  return _c("th", { key: i, staticClass: "w-table__header", class: _vm.headerClasses(header), on: { "click": function($event) {
5799
5977
  !_vm.colResizing.dragging && header.sortable !== false && _vm.sortTable(header);
@@ -5806,7 +5984,7 @@ var render$e = function() {
5806
5984
  return [_vm._v("Loading...")];
5807
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() {
5808
5986
  return [_vm._v("No data to show.")];
5809
- })], 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) {
5810
5988
  return [_vm.$scopedSlots["item"] ? _vm._t("item", null, { "item": item, "index": i + 1, "select": function() {
5811
5989
  return _vm.doSelectRow(item, i);
5812
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) {
@@ -5815,13 +5993,21 @@ var render$e = function() {
5815
5993
  var _obj, _obj$1;
5816
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()])];
5817
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()];
5818
- })] : _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) {
5819
- _vm.$set(_vm.paginationConfig, "itemsPerPage", $$v);
5820
- }, 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) {
5821
- _vm.paginationConfig.page--;
5822
- } } }), _c("w-button", { staticClass: "pagination-arrow pagination-arrow--next", attrs: { "icon": "wi-chevron-right", "text": "", "lg": "" }, on: { "click": function($event) {
5823
- _vm.paginationConfig.page++;
5824
- } } })], 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()])]);
5825
6011
  };
5826
6012
  var staticRenderFns$e = [];
5827
6013
  var wTable_vue_vue_type_style_index_0_lang = "";
@@ -5837,6 +6023,9 @@ const __vue2_script$e = {
5837
6023
  fixedFooter: { type: Boolean },
5838
6024
  loading: { type: [Boolean, String] },
5839
6025
  sort: { type: [String, Array] },
6026
+ sortFunction: { type: Function },
6027
+ filter: { type: Function },
6028
+ fetch: { type: Function },
5840
6029
  expandableRows: {
5841
6030
  validator: (value) => {
5842
6031
  if (![void 0, true, false, 1, "1", ""].includes(value)) {
@@ -5861,8 +6050,6 @@ const __vue2_script$e = {
5861
6050
  selectedRows: { type: Array },
5862
6051
  forceSelection: { type: Boolean },
5863
6052
  uidKey: { type: String, default: "id" },
5864
- filter: { type: Function },
5865
- sortFunction: { type: Function },
5866
6053
  mobileBreakpoint: { type: Number, default: 0 },
5867
6054
  resizableColumns: { type: Boolean },
5868
6055
  pagination: {
@@ -5903,12 +6090,20 @@ const __vue2_script$e = {
5903
6090
  columnEl: null,
5904
6091
  nextColumnEl: null
5905
6092
  },
5906
- paginationConfig: {}
6093
+ paginationConfig: {
6094
+ itemsPerPage: 0,
6095
+ itemsPerPageOptions: {},
6096
+ start: 0,
6097
+ end: 0,
6098
+ page: 1,
6099
+ total: 0
6100
+ }
5907
6101
  }),
5908
6102
  computed: {
5909
6103
  tableItems() {
5910
6104
  return this.items.map((item, i) => {
5911
- item._uid = item[this.uidKey] !== void 0 ? item[this.uidKey] : i;
6105
+ var _a;
6106
+ item._uid = (_a = item[this.uidKey]) != null ? _a : i;
5912
6107
  return item;
5913
6108
  });
5914
6109
  },
@@ -5916,7 +6111,7 @@ const __vue2_script$e = {
5916
6111
  return typeof this.filter === "function" ? this.tableItems.filter(this.filter) : this.tableItems;
5917
6112
  },
5918
6113
  sortedItems() {
5919
- if (!this.activeSorting.length || this.sortFunction)
6114
+ if (!this.activeSorting.length || this.sortFunction || this.fetch)
5920
6115
  return this.filteredItems;
5921
6116
  const sortKey1 = this.activeSorting[0].replace(/^[+-]/, "");
5922
6117
  const sortDesc1 = this.activeSorting[0][0] === "-";
@@ -5930,6 +6125,9 @@ const __vue2_script$e = {
5930
6125
  return (a > b ? 1 : -1) * (sortDesc1 ? -1 : 1);
5931
6126
  });
5932
6127
  },
6128
+ paginatedItems() {
6129
+ return typeof this.fetch === "function" ? this.sortedItems : this.sortedItems.slice(this.paginationConfig.start - 1, this.paginationConfig.end);
6130
+ },
5933
6131
  activeSortingKeys() {
5934
6132
  return this.activeSorting.reduce((obj, item) => {
5935
6133
  obj[item.replace(/^[+-]/, "")] = item[0];
@@ -5941,8 +6139,15 @@ const __vue2_script$e = {
5941
6139
  "w-table-wrap--loading": this.loading
5942
6140
  };
5943
6141
  },
6142
+ colClasses() {
6143
+ return this.headers.map((header) => {
6144
+ return { "w-table__col--highlighted": this.activeSortingKeys[header.key] };
6145
+ }) || [];
6146
+ },
5944
6147
  classes() {
5945
6148
  return {
6149
+ "w-table--loading": this.loading,
6150
+ "w-table--loading-in-header": this.loading === "header",
5946
6151
  "w-table--fixed-layout": this.fixedLayout || this.resizableColumns || this.hasStickyColumn,
5947
6152
  "w-table--mobile": this.isMobile || null,
5948
6153
  "w-table--resizable-cols": this.resizableColumns || null,
@@ -5989,9 +6194,10 @@ const __vue2_script$e = {
5989
6194
  } else
5990
6195
  this.$set(this.activeSorting, 0, (alreadySortingThis ? "-" : "+") + header.key);
5991
6196
  this.$emit("update:sort", this.activeSorting);
5992
- if (typeof this.sortFunction === "function") {
6197
+ if (typeof this.sortFunction === "function")
5993
6198
  await this.sortFunction(this.activeSorting);
5994
- }
6199
+ else if (typeof this.fetch === "function")
6200
+ await this.callApiFetch();
5995
6201
  },
5996
6202
  doSelectRow(item, index2) {
5997
6203
  const expandable = this.expandableRows === "" ? true : this.expandableRows;
@@ -6102,19 +6308,70 @@ const __vue2_script$e = {
6102
6308
  this.colResizing.nextColWidth = null;
6103
6309
  }, 0);
6104
6310
  },
6105
- updatePaginationConfig() {
6106
- var _a, _b, _c, _d, _e;
6107
- const itemsPerPage = ((_a = this.pagination) == null ? void 0 : _a.itemsPerPage) || 10;
6108
- const total = ((_b = this.pagination) == null ? void 0 : _b.total) || this.items.length;
6109
- const page = ((_c = this.pagination) == null ? void 0 : _c.page) || 1;
6110
- 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({
6111
6332
  itemsPerPage,
6112
- 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({
6113
6368
  page,
6114
- start: ((_e = this.pagination) == null ? void 0 : _e.start) || 1,
6115
- end: total >= itemsPerPage * page ? itemsPerPage * page : total % (itemsPerPage * page),
6116
- total
6117
- };
6369
+ start,
6370
+ end: end || total,
6371
+ total,
6372
+ itemsPerPage: itemsPerPage || total,
6373
+ sorting: this.activeSorting
6374
+ });
6118
6375
  }
6119
6376
  },
6120
6377
  created() {
@@ -6127,7 +6384,7 @@ const __vue2_script$e = {
6127
6384
  if ((this.selectedRows || []).length)
6128
6385
  this.selectedRowsInternal = this.selectedRows;
6129
6386
  if (this.pagination)
6130
- this.updatePaginationConfig();
6387
+ this.initPagination();
6131
6388
  },
6132
6389
  watch: {
6133
6390
  sort(sorting) {
@@ -6153,6 +6410,15 @@ const __vue2_script$e = {
6153
6410
  },
6154
6411
  selectedRows(array) {
6155
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 });
6156
6422
  }
6157
6423
  }
6158
6424
  };
@@ -7162,7 +7428,7 @@ var render = function() {
7162
7428
  var _c = _vm._self._c || _h;
7163
7429
  return _c("ul", { staticClass: "w-tree", class: _vm.classes }, _vm._l(_vm.currentDepthItems, function(item, i) {
7164
7430
  var _obj;
7165
- 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) {
7166
7432
  !_vm.disabled && !item.disabled && _vm.onLabelClick(item, $event);
7167
7433
  }, "keydown": function($event) {
7168
7434
  !_vm.disabled && !item.disabled && _vm.onLabelKeydown(item, $event);
@@ -7171,11 +7437,11 @@ var render = function() {
7171
7437
  !_vm.disabled && !item.disabled && _vm.onLabelClick(item, $event);
7172
7438
  } } }) : _vm._e(), _vm._t("item", function() {
7173
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()];
7174
- }, { "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) {
7175
- 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));
7176
7442
  }, "after-leave": function($event) {
7177
- return _vm.$emit("close", { item: item.originalItem, open: item.open, depth: _vm.depth });
7178
- } } }, [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) {
7179
7445
  return _vm.$emit("before-open", $event);
7180
7446
  }, "open": function($event) {
7181
7447
  return _vm.$emit("open", $event);
@@ -7192,8 +7458,9 @@ var render = function() {
7192
7458
  } }, scopedSlots: _vm._u([{ key: "item", fn: function(ref) {
7193
7459
  var item2 = ref.item;
7194
7460
  var depth = ref.depth;
7461
+ var path = ref.path;
7195
7462
  var open = ref.open;
7196
- 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 })];
7197
7464
  } }], null, true) }, "w-tree", _vm.$props, false)) : _vm._e()], 1)], 1);
7198
7465
  }), 0);
7199
7466
  };
@@ -7205,6 +7472,7 @@ const __vue2_script = {
7205
7472
  value: { type: [Object, Array] },
7206
7473
  data: { type: [Object, Array], required: true },
7207
7474
  depth: { type: Number, default: 0 },
7475
+ parent: { type: Object, default: null },
7208
7476
  branchClass: { type: String },
7209
7477
  leafClass: { type: String },
7210
7478
  branchIcon: { type: String },
@@ -7237,6 +7505,7 @@ const __vue2_script = {
7237
7505
  return {
7238
7506
  [`w-tree--depth${this.depth}`]: true,
7239
7507
  "w-tree--expand-icon": this.expandIcon && !this.depth,
7508
+ "w-tree--selectable": this.selectable,
7240
7509
  "w-tree--disabled": this.disabled && !this.depth,
7241
7510
  "w-tree--no-expand-button": !this.expandIcon
7242
7511
  };
@@ -7251,8 +7520,8 @@ const __vue2_script = {
7251
7520
  if (!Array.isArray(items))
7252
7521
  items = [items];
7253
7522
  items.forEach((item, i) => {
7254
- var _a;
7255
- this.currentDepthItems.push({
7523
+ var _a, _b;
7524
+ const itemWrapper = {
7256
7525
  originalItem: item,
7257
7526
  _uid: this.depth.toString() + (i + 1),
7258
7527
  label: item[this.itemLabelKey],
@@ -7260,20 +7529,44 @@ const __vue2_script = {
7260
7529
  branch: item.branch,
7261
7530
  route: item[this.itemRouteKey],
7262
7531
  disabled: item[this.itemDisabledKey],
7532
+ selected: ((_a = oldItems[i]) == null ? void 0 : _a.selected) || false,
7263
7533
  depth: this.depth,
7264
- open: !!(((_a = oldItems[i]) == null ? void 0 : _a.open) || this.expandAll || item[this.itemOpenKey])
7265
- });
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);
7266
7540
  });
7267
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
+ },
7268
7561
  expandDepth(item, open) {
7269
7562
  if (typeof open === "boolean")
7270
7563
  item.open = open;
7271
7564
  else
7272
7565
  item.open = !item.open;
7273
- const emitParams = { item: item.originalItem, open: item.open, depth: this.depth };
7274
- 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);
7275
7568
  if (!this.unexpandableEmpty && !item.children) {
7276
- this.$emit(item.open ? "open" : "close", emitParams);
7569
+ this.$emit(item.open ? "open" : "close", emitPayload);
7277
7570
  }
7278
7571
  return true;
7279
7572
  },
@@ -7281,19 +7574,13 @@ const __vue2_script = {
7281
7574
  const route = item[this.itemRouteKey];
7282
7575
  if (route && this.$router && !this.hasExternalLink(item))
7283
7576
  e.preventDefault();
7284
- this.$emit("click", { item: item.originalItem, depth: this.depth, e });
7285
7577
  if (item.children || item.branch && !this.unexpandableEmpty)
7286
7578
  this.expandDepth(item);
7287
7579
  if (this.selectable)
7288
- this.emitItemSelection(item, e);
7289
- },
7290
- emitItemSelection(item, e) {
7291
- const emitParams = { item: item.originalItem, depth: this.depth, e };
7292
- if (item.children || item.branch && !this.unexpandableEmpty) {
7293
- emitParams.open = item.open;
7294
- }
7295
- this.$emit("input", emitParams);
7296
- 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);
7297
7584
  },
7298
7585
  onLabelKeydown(item, e) {
7299
7586
  if (!(e.metaKey || e.ctrlKey || e.altKey || e.shiftKey) && [13, 32, 37, 38, 39, 40].includes(e.which)) {
@@ -7319,8 +7606,31 @@ const __vue2_script = {
7319
7606
  });
7320
7607
  }
7321
7608
  }
7322
- if (this.selectable)
7609
+ if (e.which === 13) {
7610
+ if (this.selectable)
7611
+ item.selected = !item.selected;
7323
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;
7324
7634
  },
7325
7635
  getPreviousSibling(node, selector) {
7326
7636
  while (selector && (node = node.previousElementSibling)) {
@@ -7349,6 +7659,7 @@ const __vue2_script = {
7349
7659
  return {
7350
7660
  [item.children || item.branch ? "w-tree__item--branch" : "w-tree__item--leaf"]: true,
7351
7661
  "w-tree__item--disabled": item[this.itemDisabledKey],
7662
+ "w-tree__item--selected": item.selected,
7352
7663
  "w-tree__item--empty": item.branch && !item.children,
7353
7664
  "w-tree__item--unexpandable": item.branch && !item.children && this.unexpandableEmpty
7354
7665
  };
@@ -7417,7 +7728,7 @@ var components = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProp
7417
7728
  WRadio: wRadio,
7418
7729
  WRadios: wRadios,
7419
7730
  WRating: wRating,
7420
- WScrollbar: wScrollbar,
7731
+ WScrollable: wScrollable,
7421
7732
  WSelect: wSelect,
7422
7733
  WSlider: wSlider,
7423
7734
  WSpinner: wSpinner,