wave-ui 1.61.0 → 1.62.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.
@@ -1815,7 +1815,7 @@ var render$G = function() {
1815
1815
  var _c = _vm._self._c || _h;
1816
1816
  return _c("div", { staticClass: "w-confirm" }, [_c("w-menu", _vm._b({ scopedSlots: _vm._u([{ key: "activator", fn: function(ref) {
1817
1817
  var on = ref.on;
1818
- return [_c("w-button", _vm._g(_vm._b({ staticClass: "w-confirm__button" }, "w-button", _vm.buttonProps, false), Object.assign({}, _vm.$listeners, on)), [_vm._t("default")], 2)];
1818
+ return [_c("w-button", _vm._g(_vm._b({ staticClass: "w-confirm__button" }, "w-button", _vm.buttonProps, false), Object.assign({}, _vm.$listeners, _vm.disablePrompt ? {} : on)), [_vm._t("default")], 2)];
1819
1819
  } }], null, true), model: { value: _vm.showPopup, callback: function($$v) {
1820
1820
  _vm.showPopup = $$v;
1821
1821
  }, expression: "showPopup" } }, "w-menu", _vm.wMenuProps, false), [_c("w-flex", { attrs: { "column": !_vm.inline, "align-center": "" } }, [_c("div", [_vm._t("question", function() {
@@ -1843,6 +1843,7 @@ const __vue2_script$G = {
1843
1843
  bgColor: { type: String },
1844
1844
  color: { type: String },
1845
1845
  icon: { type: String },
1846
+ disablePrompt: { type: Boolean },
1846
1847
  mainButton: { type: Object },
1847
1848
  question: { type: String, default: "Are you sure?" },
1848
1849
  cancel: { type: [Boolean, Object, String], default: void 0 },
@@ -3408,7 +3409,7 @@ const __vue2_script$u = {
3408
3409
  this.$emit("item-select", this.cleanLi(li));
3409
3410
  } else if (e.keyCode === 27)
3410
3411
  this.$emit("keydown:escape");
3411
- else if (this.arrowsNavigation) {
3412
+ else if (this.arrowsNavigation && [38, 40].includes(e.keyCode)) {
3412
3413
  e.preventDefault();
3413
3414
  if (e.keyCode === 38)
3414
3415
  this.focusPrevNextItem(li._index, false);
@@ -4755,7 +4756,7 @@ var render$l = function() {
4755
4756
  }, "blur": _vm.onBlur, "keydown": function($event) {
4756
4757
  !_vm.isDisabled && !_vm.isReadonly && _vm.onKeydown($event);
4757
4758
  } } }), _vm._l(_vm.inputValue.length ? _vm.inputValue : [{}], function(val, i) {
4758
- return _c("input", { key: i, attrs: { "type": "hidden", "name": _vm.inputName + (_vm.multiple ? "[]" : "") }, domProps: { "value": val.value || "" } });
4759
+ return _c("input", { key: i, attrs: { "type": "hidden", "name": _vm.inputName + (_vm.multiple ? "[]" : "") }, domProps: { "value": val.value === void 0 ? "" : val.value.toString() } });
4759
4760
  }), _vm.labelPosition === "inside" && _vm.showLabelInside ? [_vm.$slots.default || _vm.label ? _c("label", { staticClass: "w-select__label w-select__label--inside w-form-el-shakable", class: _vm.labelClasses, attrs: { "for": "w-select--" + _vm._uid } }, [_vm._t("default", function() {
4760
4761
  return [_vm._v(_vm._s(_vm.label))];
4761
4762
  })], 2) : _vm._e()] : _vm._e(), _vm.innerIconRight ? _c("w-icon", { staticClass: "w-select__icon w-select__icon--inner-right", attrs: { "tag": "label" }, on: { "click": function($event) {
@@ -4931,7 +4932,7 @@ const __vue2_script$l = {
4931
4932
  this.$emit("input", selection);
4932
4933
  },
4933
4934
  checkSelection(items) {
4934
- items = Array.isArray(items) ? items : items ? [items] : [];
4935
+ items = Array.isArray(items) ? items : items !== void 0 ? [items] : [];
4935
4936
  const allValues = this.selectItems.map((item) => item.value);
4936
4937
  return items.map((item) => {
4937
4938
  let value = item;
@@ -5323,7 +5324,7 @@ var render$h = function() {
5323
5324
  })], 2) : _vm._e()] : _vm._e(), _c("div", _vm._g({ staticClass: "w-switch__input", class: _vm.inputClasses, on: { "click": function($event) {
5324
5325
  _vm.$refs.input.focus();
5325
5326
  _vm.$refs.input.click();
5326
- } } }, _vm.$listeners), [_vm.$slots.track ? _c("div", { staticClass: "w-switch__track" }, [_vm._t("track")], 2) : _vm._e(), _vm.$slots.thumb || _vm.loading ? _c("div", { staticClass: "w-switch__thumb" }, [_vm.loading ? _c("w-progress", _vm._b({ attrs: { "circle": "", "color": "inherit" } }, "w-progress", typeof _vm.loading === "number" ? { "model-value": _vm.loading } : {}, false)) : _vm._t("thumb")], 2) : _vm._e()]), _vm.hasLabel && !_vm.labelOnLeft ? [_vm.$slots.default || _vm.label ? _c("label", { staticClass: "w-switch__label w-switch__label--right w-form-el-shakable", class: _vm.labelClasses, attrs: { "for": "w-switch--" + _vm._uid } }, [_vm._t("default", function() {
5327
+ } } }, _vm.$listeners), [_vm.$slots.track ? _c("div", { staticClass: "w-switch__track" }, [_vm._t("track")], 2) : _vm._e(), _vm.$slots.thumb || _vm.loading ? _c("div", { staticClass: "w-switch__thumb" }, [_vm.loading ? _c("w-progress", _vm._b({ attrs: { "circle": "", "color": "inherit" } }, "w-progress", typeof _vm.loading === "number" ? { value: _vm.loading } : {}, false)) : _vm._t("thumb")], 2) : _vm._e()]), _vm.hasLabel && !_vm.labelOnLeft ? [_vm.$slots.default || _vm.label ? _c("label", { staticClass: "w-switch__label w-switch__label--right w-form-el-shakable", class: _vm.labelClasses, attrs: { "for": "w-switch--" + _vm._uid } }, [_vm._t("default", function() {
5327
5328
  return [_vm._v(_vm._s(_vm.label))];
5328
5329
  })], 2) : _vm._e()] : _vm._e()], 2);
5329
5330
  };
@@ -5688,7 +5689,13 @@ var render$e = function() {
5688
5689
  var _obj, _obj$1;
5689
5690
  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()])];
5690
5691
  })], 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()];
5691
- })] : _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"] ? _c("tfoot", { staticClass: "w-table__footer" }, [_vm.$slots["footer-row"] ? _vm._t("footer-row") : _c("tr", { staticClass: "w-table__row" }, [_c("td", { staticClass: "w-table__cell", attrs: { "colspan": _vm.headers.length } }, [_vm._t("footer")], 2)])], 2) : _vm._e()])]);
5692
+ })] : _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) {
5693
+ _vm.$set(_vm.paginationConfig, "itemsPerPage", $$v);
5694
+ }, 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) {
5695
+ _vm.paginationConfig.page--;
5696
+ } } }), _c("w-button", { staticClass: "pagination-arrow pagination-arrow--next", attrs: { "icon": "wi-chevron-right", "text": "", "lg": "" }, on: { "click": function($event) {
5697
+ _vm.paginationConfig.page++;
5698
+ } } })], 1)], 1)])]) : _vm._e()], 2) : _vm._e()])]);
5692
5699
  };
5693
5700
  var staticRenderFns$e = [];
5694
5701
  var wTable_vue_vue_type_style_index_0_lang = "";
@@ -5731,7 +5738,21 @@ const __vue2_script$e = {
5731
5738
  filter: { type: Function },
5732
5739
  sortFunction: { type: Function },
5733
5740
  mobileBreakpoint: { type: Number, default: 0 },
5734
- resizableColumns: { type: Boolean }
5741
+ resizableColumns: { type: Boolean },
5742
+ pagination: {
5743
+ type: [Boolean, Object, String],
5744
+ validator: (object) => {
5745
+ if (!object)
5746
+ return true;
5747
+ else if (typeof object === "object" && (!object.itemsPerPage || object.page && isNaN(object.page))) {
5748
+ consoleError(
5749
+ "Wrong pagination config received in the w-table's `pagination` prop (received: `" + JSON.stringify(object) + "`). \nExpected object: { itemsPerPage: Integer, page: Integer } or { itemsPerPage: Integer, start: Integer }."
5750
+ );
5751
+ return false;
5752
+ }
5753
+ return true;
5754
+ }
5755
+ }
5735
5756
  },
5736
5757
  emits: [
5737
5758
  "row-select",
@@ -5755,7 +5776,8 @@ const __vue2_script$e = {
5755
5776
  nextColWidth: null,
5756
5777
  columnEl: null,
5757
5778
  nextColumnEl: null
5758
- }
5779
+ },
5780
+ paginationConfig: {}
5759
5781
  }),
5760
5782
  computed: {
5761
5783
  tableItems() {
@@ -5953,6 +5975,20 @@ const __vue2_script$e = {
5953
5975
  this.colResizing.colWidth = null;
5954
5976
  this.colResizing.nextColWidth = null;
5955
5977
  }, 0);
5978
+ },
5979
+ updatePaginationConfig() {
5980
+ var _a, _b, _c, _d, _e;
5981
+ const itemsPerPage = ((_a = this.pagination) == null ? void 0 : _a.itemsPerPage) || 10;
5982
+ const total = ((_b = this.pagination) == null ? void 0 : _b.total) || this.items.length;
5983
+ const page = ((_c = this.pagination) == null ? void 0 : _c.page) || 1;
5984
+ this.paginationConfig = {
5985
+ itemsPerPage,
5986
+ itemsPerPageOptions: ((_d = this.pagination) == null ? void 0 : _d.itemsPerPageOptions) || [{ label: "10", value: 10 }, { label: "100", value: 100 }, { label: "All", value: 0 }],
5987
+ page,
5988
+ start: ((_e = this.pagination) == null ? void 0 : _e.start) || 1,
5989
+ end: total >= itemsPerPage * page ? itemsPerPage * page : total % (itemsPerPage * page),
5990
+ total
5991
+ };
5956
5992
  }
5957
5993
  },
5958
5994
  created() {
@@ -5964,6 +6000,8 @@ const __vue2_script$e = {
5964
6000
  this.expandedRowsInternal = this.expandedRows;
5965
6001
  if ((this.selectedRows || []).length)
5966
6002
  this.selectedRowsInternal = this.selectedRows;
6003
+ if (this.pagination)
6004
+ this.updatePaginationConfig();
5967
6005
  },
5968
6006
  watch: {
5969
6007
  sort(sorting) {
@@ -6592,6 +6630,7 @@ const __vue2_script$7 = {
6592
6630
  },
6593
6631
  data: () => ({
6594
6632
  el: {
6633
+ savedState: false,
6595
6634
  originalStyles: "",
6596
6635
  width: 0,
6597
6636
  height: 0,
@@ -6621,7 +6660,7 @@ const __vue2_script$7 = {
6621
6660
  methods: {
6622
6661
  beforeAppear(el) {
6623
6662
  if (this.cleanTransitionCycle)
6624
- this.saveOriginalStyles(el);
6663
+ this.saveOriginalInlineStyles(el);
6625
6664
  this.cleanTransitionCycle = false;
6626
6665
  },
6627
6666
  appear(el, done) {
@@ -6636,7 +6675,7 @@ const __vue2_script$7 = {
6636
6675
  },
6637
6676
  beforeEnter(el) {
6638
6677
  if (this.cleanTransitionCycle)
6639
- this.saveOriginalStyles(el);
6678
+ this.saveOriginalInlineStyles(el);
6640
6679
  this.cleanTransitionCycle = false;
6641
6680
  },
6642
6681
  enter(el, done) {
@@ -6650,6 +6689,8 @@ const __vue2_script$7 = {
6650
6689
  this.cleanTransitionCycle = false;
6651
6690
  },
6652
6691
  beforeLeave(el) {
6692
+ if (!this.el.savedState)
6693
+ this.saveComputedStyles(el);
6653
6694
  this.beforeHide(el);
6654
6695
  this.cleanTransitionCycle = false;
6655
6696
  },
@@ -6661,6 +6702,7 @@ const __vue2_script$7 = {
6661
6702
  afterLeave(el) {
6662
6703
  this.applyOriginalStyles(el);
6663
6704
  this.cleanTransitionCycle = true;
6705
+ this.el.savedState = false;
6664
6706
  },
6665
6707
  applyHideStyles(el) {
6666
6708
  if (this.animX) {
@@ -6707,10 +6749,23 @@ const __vue2_script$7 = {
6707
6749
  applyOriginalStyles(el) {
6708
6750
  el.style.cssText = this.el.originalStyles;
6709
6751
  },
6710
- saveOriginalStyles(el) {
6752
+ saveOriginalInlineStyles(el) {
6711
6753
  this.el.originalStyles = el.style.cssText;
6712
6754
  },
6713
6755
  show(el, done) {
6756
+ this.saveComputedStyles(el);
6757
+ this.applyHideStyles(el);
6758
+ setTimeout(() => this.applyShowStyles(el), 20);
6759
+ setTimeout(done, this.duration);
6760
+ },
6761
+ beforeHide(el) {
6762
+ this.applyShowStyles(el);
6763
+ },
6764
+ hide(el, done) {
6765
+ setTimeout(() => this.applyHideStyles(el), 20);
6766
+ setTimeout(done, this.duration);
6767
+ },
6768
+ saveComputedStyles(el) {
6714
6769
  const computedStyles = window.getComputedStyle(el, null);
6715
6770
  if (this.animX) {
6716
6771
  this.el.width = el.offsetWidth;
@@ -6730,16 +6785,7 @@ const __vue2_script$7 = {
6730
6785
  this.el.borderTopWidth = computedStyles.getPropertyValue("borderTopWidth");
6731
6786
  this.el.borderBottomWidth = computedStyles.getPropertyValue("borderBottomWidth");
6732
6787
  }
6733
- this.applyHideStyles(el);
6734
- setTimeout(() => this.applyShowStyles(el), 20);
6735
- setTimeout(done, this.duration);
6736
- },
6737
- beforeHide(el) {
6738
- this.applyShowStyles(el);
6739
- },
6740
- hide(el, done) {
6741
- setTimeout(() => this.applyHideStyles(el), 20);
6742
- setTimeout(done, this.duration);
6788
+ this.el.savedState = true;
6743
6789
  }
6744
6790
  }
6745
6791
  };
@@ -6994,7 +7040,7 @@ var render = function() {
6994
7040
  }, "keydown": function($event) {
6995
7041
  !_vm.disabled && _vm.onLabelKeydown(item, $event);
6996
7042
  } } }, [(item.children || item.branch) && (_vm.expandOpenIcon && item.open || _vm.expandIcon) && !(_vm.unexpandableEmpty && !item.children) ? _c("w-button", { staticClass: "w-tree__item-expand", attrs: { "color": "inherit", "icon": item.open && _vm.expandOpenIcon || _vm.expandIcon, "icon-props": { rotate90a: !item.open }, "tabindex": -1, "disabled": _vm.disabled, "text": "", "sm": "" } }) : _vm._e(), _vm._t("item-label", function() {
6997
- return [_vm.itemIcon(item) ? _c("w-icon", { staticClass: "w-tree__item-icon" }, [_vm._v(_vm._s(_vm.itemIcon(item)))]) : _vm._e(), _c("span", [_vm._v(_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()];
7043
+ 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", [_vm._v(_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()];
6998
7044
  }, { "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) {
6999
7045
  return _vm.$emit("open", { item: item.originalItem, open: item.open, depth: _vm.depth });
7000
7046
  }, "after-leave": function($event) {
@@ -7041,8 +7087,11 @@ const __vue2_script = {
7041
7087
  disabled: { type: Boolean },
7042
7088
  noTransition: { type: Boolean },
7043
7089
  selectable: { type: Boolean },
7044
- depthReactivity: { type: Boolean },
7045
- counts: { type: Boolean }
7090
+ deepReactivity: { type: Boolean },
7091
+ counts: { type: Boolean },
7092
+ itemIconKey: { type: String, default: "icon" },
7093
+ iconColor: { type: String },
7094
+ itemIconColorKey: { type: String, default: "iconColor" }
7046
7095
  },
7047
7096
  emits: ["input", "before-open", "open", "before-close", "close", "click", "select"],
7048
7097
  data: () => ({
@@ -7071,7 +7120,7 @@ const __vue2_script = {
7071
7120
  children: !!item.children,
7072
7121
  branch: item.branch,
7073
7122
  depth: this.depth,
7074
- open: ((_a = oldItems[i]) == null ? void 0 : _a.open) || false
7123
+ open: !!(((_a = oldItems[i]) == null ? void 0 : _a.open) || this.expandAll)
7075
7124
  });
7076
7125
  });
7077
7126
  },
@@ -7147,7 +7196,7 @@ const __vue2_script = {
7147
7196
  liNode && liNode.querySelector(".w-tree__item-label").focus();
7148
7197
  },
7149
7198
  itemIcon(item) {
7150
- return item.originalItem.icon || !item.children && !item.branch && this.leafIcon || (item.children || item.branch) && (item.open && this.branchOpenIcon || this.branchIcon);
7199
+ return item.originalItem[this.itemIconKey] || !item.children && !item.branch && this.leafIcon || (item.children || item.branch) && (item.open && this.branchOpenIcon || this.branchIcon);
7151
7200
  },
7152
7201
  itemClasses(item) {
7153
7202
  return {
@@ -7162,7 +7211,7 @@ const __vue2_script = {
7162
7211
  this.dataPropUnwatch = this.$watch(
7163
7212
  "data",
7164
7213
  (items) => this.updateCurrentDepthTree(items, this.currentDepthItems),
7165
- { deep: !!this.depthReactivity }
7214
+ { deep: !!this.deepReactivity }
7166
7215
  );
7167
7216
  },
7168
7217
  destroyed() {