@mozaic-ds/vue 0.35.0-beta.2 → 0.35.0-beta.3

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.
@@ -22391,22 +22391,18 @@ MLink.install = function (Vue) {
22391
22391
  Vue.component(MLink.name, MLink);
22392
22392
  };
22393
22393
 
22394
- ;// CONCATENATED MODULE: ./node_modules/babel-loader/lib/index.js??clonedRuleSet-83.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/listbox/MListBoxActions.vue?vue&type=template&id=dc7f0b5a&
22395
- var MListBoxActionsvue_type_template_id_dc7f0b5a_render = function render() {
22394
+ ;// CONCATENATED MODULE: ./node_modules/babel-loader/lib/index.js??clonedRuleSet-83.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/listbox/MListBoxActions.vue?vue&type=template&id=6fe6b471&
22395
+ var MListBoxActionsvue_type_template_id_6fe6b471_render = function render() {
22396
22396
  var _vm = this,
22397
22397
  _c = _vm._self._c;
22398
22398
  return _c('div', {
22399
22399
  directives: [{
22400
22400
  name: "click-outside",
22401
22401
  rawName: "v-click-outside",
22402
- value: _vm.onClickOutside,
22403
- expression: "onClickOutside"
22402
+ value: _vm.closeListbox,
22403
+ expression: "closeListbox"
22404
22404
  }],
22405
- staticClass: "mc-listbox-options",
22406
- class: {
22407
- 'mc-listbox-options--fixed': _vm.hasDataTable
22408
- },
22409
- style: _vm.setStyles
22405
+ staticClass: "mc-listbox-options"
22410
22406
  }, [_c('button', {
22411
22407
  ref: "trigger",
22412
22408
  staticClass: "mc-listbox-options__trigger",
@@ -22415,29 +22411,32 @@ var MListBoxActionsvue_type_template_id_dc7f0b5a_render = function render() {
22415
22411
  },
22416
22412
  on: {
22417
22413
  "click": function click($event) {
22418
- return _vm.onSwitch($event);
22414
+ return _vm.onClickTrigger($event);
22419
22415
  }
22420
22416
  }
22421
- }, [_c('m-icon', {
22417
+ }, [_c('MIcon', {
22422
22418
  attrs: {
22423
- "name": "DisplayOptions24",
22419
+ "name": _vm.icon,
22424
22420
  "color": _vm.triggerIconColor
22425
22421
  }
22426
22422
  }), _c('span', {
22427
22423
  staticClass: "mc-listbox-options__trigger-label"
22428
22424
  }, [_vm._v(_vm._s(_vm.triggerLabel))])], 1), _c('div', {
22425
+ directives: [{
22426
+ name: "show",
22427
+ rawName: "v-show",
22428
+ value: _vm.isOpen,
22429
+ expression: "isOpen"
22430
+ }],
22429
22431
  ref: "listbox",
22430
22432
  staticClass: "mc-listbox-options__container",
22431
- class: {
22432
- 'is-open': _vm.isOpen,
22433
- 'align-right': _vm.position == 'right',
22434
- 'align-top': _vm.displayTop
22435
- },
22433
+ class: _vm.classObjectListbox,
22434
+ style: _vm.styleObjectListbox,
22436
22435
  attrs: {
22437
22436
  "role": "listbox",
22438
22437
  "aria-labelledby": "listbox"
22439
22438
  }
22440
- }, _vm._l(_vm.listItems, function (list, i) {
22439
+ }, _vm._l(_vm.getItems, function (list, i) {
22441
22440
  return _c('ul', {
22442
22441
  key: "list".concat(i),
22443
22442
  staticClass: "mc-listbox-options__list"
@@ -22448,7 +22447,7 @@ var MListBoxActionsvue_type_template_id_dc7f0b5a_render = function render() {
22448
22447
  class: {
22449
22448
  'is-disabled': item.disabled
22450
22449
  }
22451
- }, [item.icon ? _c('m-icon', {
22450
+ }, [item.icon ? _c('MIcon', {
22452
22451
  staticClass: "mc-listbox-options__icon",
22453
22452
  attrs: {
22454
22453
  "name": item.icon,
@@ -22476,7 +22475,7 @@ var MListBoxActionsvue_type_template_id_dc7f0b5a_render = function render() {
22476
22475
  }), 0);
22477
22476
  }), 0)]);
22478
22477
  };
22479
- var MListBoxActionsvue_type_template_id_dc7f0b5a_staticRenderFns = [];
22478
+ var MListBoxActionsvue_type_template_id_6fe6b471_staticRenderFns = [];
22480
22479
 
22481
22480
  ;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-83.use[1]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/listbox/MListBoxActions.vue?vue&type=script&lang=js&
22482
22481
 
@@ -22526,18 +22525,35 @@ var MListBoxActionsvue_type_template_id_dc7f0b5a_staticRenderFns = [];
22526
22525
  triggerIconColor: {
22527
22526
  type: String,
22528
22527
  default: 'currentColor'
22528
+ },
22529
+ icon: {
22530
+ type: String,
22531
+ default: 'DisplayOptions24'
22529
22532
  }
22530
22533
  },
22531
22534
  data: function data() {
22532
22535
  return {
22533
22536
  isOpen: this.open,
22534
22537
  displayTop: false,
22535
- posTop: '0px',
22536
- hasDataTable: false
22538
+ listboxTop: '0px',
22539
+ listboxLeft: '0px'
22537
22540
  };
22538
22541
  },
22539
22542
  computed: {
22540
- listItems: function listItems() {
22543
+ classObjectListbox: function classObjectListbox() {
22544
+ return {
22545
+ 'is-open': this.isOpen,
22546
+ 'align-right': this.position == 'right',
22547
+ 'align-top': this.displayTop
22548
+ };
22549
+ },
22550
+ styleObjectListbox: function styleObjectListbox() {
22551
+ return {
22552
+ top: this.listboxTop,
22553
+ left: this.listboxLeft
22554
+ };
22555
+ },
22556
+ getItems: function getItems() {
22541
22557
  var hasNestedArray = this.items.filter(Array.isArray).length;
22542
22558
  if (hasNestedArray === 0) {
22543
22559
  var listItems = [];
@@ -22545,40 +22561,20 @@ var MListBoxActionsvue_type_template_id_dc7f0b5a_staticRenderFns = [];
22545
22561
  return [this.items];
22546
22562
  }
22547
22563
  return this.items;
22548
- },
22549
- setStyles: function setStyles() {
22550
- return {
22551
- '--listbox-top': this.hasDataTable ? this.posTop + 'px' : null
22552
- };
22553
22564
  }
22554
22565
  },
22555
22566
  mounted: function mounted() {
22556
- this.hasDataTable = this.$parent.$options._componentTag === 'm-data-table' ? true : false;
22557
- if (this.hasDataTable) {
22558
- this.$parent.$el.querySelector('.mc-data-table__body').addEventListener('scroll', this.handleScroll);
22559
- }
22567
+ this.teleport(this.$refs.listbox);
22568
+ },
22569
+ created: function created() {
22570
+ window.addEventListener('scroll', this.closeListbox, {
22571
+ capture: true
22572
+ });
22560
22573
  },
22561
22574
  destroyed: function destroyed() {
22562
- if (this.hasDataTable) {
22563
- this.$parent.$el.querySelector('.mc-data-table__body').removeEventListener('scroll', this.handleScroll);
22564
- }
22575
+ window.removeEventListener('scroll', this.closeListbox);
22565
22576
  },
22566
22577
  methods: {
22567
- onClickOutside: function onClickOutside() {
22568
- this.isOpen = false;
22569
- },
22570
- onSwitch: function onSwitch(e) {
22571
- if (!this.isOpen) {
22572
- if (this.$refs.listbox.clientHeight + e.clientY >= window.innerHeight) {
22573
- this.displayTop = true;
22574
- }
22575
- if (this.hasDataTable) {
22576
- var buttonSizes = this.$refs.trigger.getBoundingClientRect();
22577
- this.posTop = buttonSizes.top + buttonSizes.height;
22578
- }
22579
- }
22580
- this.isOpen = !this.isOpen;
22581
- },
22582
22578
  onClickItem: function onClickItem(item, listIndex, itemIndex) {
22583
22579
  var valToEmit = Object.assign({
22584
22580
  listIndex: listIndex,
@@ -22587,17 +22583,46 @@ var MListBoxActionsvue_type_template_id_dc7f0b5a_staticRenderFns = [];
22587
22583
  this.$emit('update:itemSelected', valToEmit); // TODO: deprecated
22588
22584
  this.$emit('item-clicked', valToEmit);
22589
22585
  },
22590
- handleScroll: function handleScroll() {
22586
+ onClickTrigger: function onClickTrigger(e) {
22587
+ var _this = this;
22588
+ this.$nextTick(function () {
22589
+ if (_this.$refs.listbox.clientHeight + e.clientY >= window.innerHeight) {
22590
+ _this.displayTop = true;
22591
+ }
22592
+ });
22593
+ this.isOpen = !this.isOpen;
22594
+ this.setListBoxPosition();
22595
+ },
22596
+ setListBoxPosition: function setListBoxPosition() {
22597
+ var _this$$refs$trigger$g = this.$refs.trigger.getBoundingClientRect(),
22598
+ top = _this$$refs$trigger$g.top,
22599
+ left = _this$$refs$trigger$g.left,
22600
+ height = _this$$refs$trigger$g.height;
22601
+ var topValue = Math.floor(top) + Math.floor(height) + window.scrollY;
22602
+ var leftValue = Math.floor(left);
22603
+ this.listboxTop = "".concat(topValue, "px");
22604
+ this.listboxLeft = "".concat(leftValue, "px");
22605
+ },
22606
+ teleport: function teleport(elToMove, elTarget) {
22607
+ var target = elTarget !== null && elTarget !== void 0 ? elTarget : document.body;
22608
+ if (target && elToMove) {
22609
+ target.append(elToMove);
22610
+ }
22611
+ },
22612
+ closeListbox: function closeListbox() {
22613
+ if (!this.isOpen) {
22614
+ return;
22615
+ }
22591
22616
  this.isOpen = false;
22592
22617
  }
22593
22618
  }
22594
22619
  });
22595
22620
  ;// CONCATENATED MODULE: ./src/components/listbox/MListBoxActions.vue?vue&type=script&lang=js&
22596
22621
  /* harmony default export */ var listbox_MListBoxActionsvue_type_script_lang_js_ = (MListBoxActionsvue_type_script_lang_js_);
22597
- ;// CONCATENATED MODULE: ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-65.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-65.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/@vue/cli-service/node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-65.use[2]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-65.use[3]!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-84.use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/listbox/MListBoxActions.vue?vue&type=style&index=0&id=dc7f0b5a&prod&lang=scss&
22622
+ ;// CONCATENATED MODULE: ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-65.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-65.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/@vue/cli-service/node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-65.use[2]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-65.use[3]!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-84.use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/listbox/MListBoxActions.vue?vue&type=style&index=0&id=6fe6b471&prod&lang=scss&
22598
22623
  // extracted by mini-css-extract-plugin
22599
22624
 
22600
- ;// CONCATENATED MODULE: ./src/components/listbox/MListBoxActions.vue?vue&type=style&index=0&id=dc7f0b5a&prod&lang=scss&
22625
+ ;// CONCATENATED MODULE: ./src/components/listbox/MListBoxActions.vue?vue&type=style&index=0&id=6fe6b471&prod&lang=scss&
22601
22626
 
22602
22627
  ;// CONCATENATED MODULE: ./src/components/listbox/MListBoxActions.vue
22603
22628
 
@@ -22610,8 +22635,8 @@ var MListBoxActionsvue_type_template_id_dc7f0b5a_staticRenderFns = [];
22610
22635
 
22611
22636
  var MListBoxActions_component = normalizeComponent(
22612
22637
  listbox_MListBoxActionsvue_type_script_lang_js_,
22613
- MListBoxActionsvue_type_template_id_dc7f0b5a_render,
22614
- MListBoxActionsvue_type_template_id_dc7f0b5a_staticRenderFns,
22638
+ MListBoxActionsvue_type_template_id_6fe6b471_render,
22639
+ MListBoxActionsvue_type_template_id_6fe6b471_staticRenderFns,
22615
22640
  false,
22616
22641
  null,
22617
22642
  null,