@avakhula/ui 0.1.1 → 0.1.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@avakhula/ui",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.umd.cjs",
6
6
  "source": "src/index.js",
package/src/App.vue CHANGED
@@ -1,19 +1,23 @@
1
1
  <template>
2
-
3
- <ib-input
4
- type="email"
5
- name="email"
6
- @input="val => console.log(val)"
7
- @blur="val => console.log(val)"
8
- />
2
+ <div class="test">
3
+ <limit-selector />
4
+ </div>
9
5
  </template>
10
6
 
11
7
  <script>
12
- import IbInput from "./components/Form/Input/Input.vue"
13
-
8
+ import LimitSelector from "./components/Pagination/LimitSelector.vue"
14
9
  export default {
15
10
  components: {
16
- IbInput
17
- }
11
+ LimitSelector
12
+ }
13
+ }
14
+ </script>
15
+
16
+
17
+ <style lang="scss">
18
+ .test {
19
+ height: 100vh;
20
+ display: flex;
21
+ align-items: end;
18
22
  }
19
- </script>
23
+ </style>
@@ -101,6 +101,7 @@ export default {
101
101
  },
102
102
  methods: {
103
103
  onChange() {
104
+ if (this.disabled) return;
104
105
  this.checked = !this.checked;
105
106
  this.$emit("input", this.checked);
106
107
  },
@@ -10,7 +10,7 @@
10
10
  :vertical="vertical"
11
11
  ref="dropdown"
12
12
  @close="onClose"
13
- @open="isOpen = true"
13
+ @open="onOpen"
14
14
  >
15
15
  <template v-if="hasTrigger" v-slot:trigger>
16
16
  <slot v-bind:selected-count="selectedKeys.length" name="trigger"></slot>
@@ -242,6 +242,7 @@
242
242
  </template>
243
243
 
244
244
  <script>
245
+ // <!-- TODO: use constants for vertical position -->
245
246
  import IbInput from "../Form/Input/Input.vue";
246
247
  import Option from "./Option.vue";
247
248
  import Mark from "mark.js/dist/mark.es6.min";
@@ -374,9 +375,10 @@ export default {
374
375
  type: Boolean,
375
376
  default: false,
376
377
  },
377
- vertical: {
378
- type: String,
379
- },
378
+ // vertical: {
379
+ // type: String,
380
+ // default: "bottom"
381
+ // },
380
382
  emptyMessage: {
381
383
  type: String,
382
384
  default: "",
@@ -409,12 +411,15 @@ export default {
409
411
  "search",
410
412
  "resize",
411
413
  "submit",
414
+ "clearValue",
412
415
  "update:modelValue",
413
416
  ],
414
417
  watch: {
415
418
  value(value) {
416
419
  this.val = value;
417
- this.setPreparedValues();
420
+ if (!Array.isArray(value) || value.join(',') !== Object.keys(this.selected).join(',')) {
421
+ this.setPreparedValues(this.actualOptions, false);
422
+ }
418
423
  },
419
424
  modelValue(value) {
420
425
  this.val = value;
@@ -512,6 +517,7 @@ export default {
512
517
  actualBookmarkedOptions: {},
513
518
  selected: [],
514
519
  isOpen: false,
520
+ vertical: "bottom",
515
521
  allOptionsIsChecked: true,
516
522
  hasTreeChildren: false,
517
523
  uid: `f${(~~(Math.random() * 1e8)).toString(16)}`,
@@ -657,7 +663,6 @@ export default {
657
663
  this.setPreparedValues();
658
664
  this.allOptionsIsChecked = false;
659
665
  this.selected = [];
660
- const values = Object.keys(this.selected);
661
666
 
662
667
  if (this.isMultiple) {
663
668
  this.$emit("update:modelValue", null);
@@ -907,7 +912,19 @@ export default {
907
912
  this.$emit("close", Object.keys(this.selected)[0]);
908
913
  }
909
914
  this.$emit("blur");
915
+ this.vertical = "bottom";
910
916
  },
917
+ onOpen() {
918
+ const screenHeight = document.documentElement.scrollHeight;
919
+ this.isOpen = true;
920
+
921
+ this.$nextTick(() => {
922
+ const newScreenHeight = document.documentElement.scrollHeight
923
+ if(newScreenHeight > screenHeight) {
924
+ this.vertical = "top";
925
+ }
926
+ })
927
+ }
911
928
  },
912
929
  computed: {
913
930
  hasTrigger() {
@@ -119,6 +119,13 @@ $tree-search-border-color: $gray-600;
119
119
  margin-left: auto;
120
120
  }
121
121
 
122
+ .dropdown-top {
123
+ .tree-drop {
124
+ bottom: 42px;
125
+ top: auto;
126
+ }
127
+ }
128
+
122
129
  .tree-drop {
123
130
  z-index: 9998;
124
131
  box-shadow: $menu-shadow;