@qikdev/vue-ui 0.0.4 → 0.1.2

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.
@@ -1,14 +1,14 @@
1
1
  <template>
2
2
  <tr :class="classes" class="table-row">
3
3
  <slot>
4
- <th v-if="enableSelection" class="table-cell first shrink" @click.stop.prevent="clickSelect(row)">
4
+ <th v-if="enableSelection" class="table-cell table-select first shrink" @click.stop.prevent="clickSelect(row)">
5
5
  <ux-checkbox :value="selected">
6
6
  </ux-checkbox>
7
7
  </th>
8
8
  <table-cell @click.stop.prevent="clickCell(column)" :column="column" :row="row" v-for="column in columns">
9
9
  </table-cell>
10
10
  <th v-if="enableActions" class="table-cell last shrink" @click.stop.prevent="clickActions(row)">
11
- <ux-button icon>
11
+ <ux-button size="xs" icon>
12
12
  <ux-icon icon="fa-ellipsis" />
13
13
  </ux-button>
14
14
  </th>
@@ -52,12 +52,13 @@ export default {
52
52
  this.$emit('click:cell', {row:this.row, column});
53
53
  this.$emit('click:row', this.row);
54
54
  },
55
- clickActions() {
56
- this.$emit('click:actions', this.row);
57
- this.$emit('click:row', this.row);
55
+ clickActions(row) {
56
+ console.log('click actions')
57
+ this.$emit('click:actions', row);
58
58
  },
59
- clickSelect() {
60
- this.$emit('click:select', this.row);
59
+ clickSelect(row) {
60
+ console.log('click select')
61
+ this.$emit('click:select', row);
61
62
  // this.$emit('click:row', this.row);
62
63
  },
63
64
  },
@@ -76,19 +77,6 @@ export default {
76
77
  </script>
77
78
  <style scoped lang="scss">
78
79
 
79
- tr {
80
- border-bottom: 1px solid rgba(#000, 0.05);
81
- &:last-of-type {
82
- border-bottom:none;
83
- }
84
- }
85
80
 
86
- tr:nth-child(odd) {
87
- background: rgba(#000, 0.02);
88
- }
89
-
90
- tr.selected {
91
- background: rgba(orange, 0.1);
92
- }
93
81
 
94
82
  </style>
@@ -0,0 +1,56 @@
1
+ <template>
2
+ <td class="table-button-cell">
3
+ <ux-button :size="button.size" :loading="processing" @click.stop.prevent="clicked">
4
+ <template v-if="button.text">{{button.text}}</template><ux-icon v-if="button.icon" :icon="button.icon" right/>
5
+ </ux-button>
6
+ </td>
7
+ </template>
8
+ <script>
9
+
10
+ import TableCellMixin from './TableCellMixin.js';
11
+
12
+ export default {
13
+ data() {
14
+ return {
15
+ processing:false,
16
+ }
17
+ },
18
+ mixins:[TableCellMixin],
19
+ computed:{
20
+ button() {
21
+ return this.column.button;
22
+ },
23
+ type() {
24
+ return this.row?.meta?.type
25
+ }
26
+ },
27
+ methods:{
28
+ async clicked() {
29
+
30
+ this.processing = true;
31
+ await this.button.action(this.row);
32
+ this.processing = false;
33
+ }
34
+ }
35
+ }
36
+ </script>
37
+
38
+
39
+ <style scoped lang="scss">
40
+
41
+ td {
42
+ width:60px;
43
+ padding:0.3em !important;
44
+
45
+ .ux-image {
46
+ border-radius:0.1em;
47
+ }
48
+
49
+ :deep .ux-btn-text {
50
+ display: block;
51
+ white-space: nowrap;
52
+ }
53
+ }
54
+
55
+
56
+ </style>
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <td class="table-image-cell">
3
3
  <template v-if="type == 'image' || type == 'video'">
4
- <ux-image v-model="row" :type="type" :width="50"/>
4
+ <ux-image :item="row" :type="type" :width="50"/>
5
5
  </template>
6
6
  <template v-else>
7
7
  <ux-icon icon="fa-file"/>
@@ -26,6 +26,7 @@ export default {
26
26
  <style scoped lang="scss">
27
27
 
28
28
  td {
29
+ min-width:60px;
29
30
  width:60px;
30
31
  padding:0.3em !important;
31
32
 
@@ -0,0 +1,46 @@
1
+ <template>
2
+ <a @click.stop.prevent="clicked(value)" v-if="reference">{{renderValue}}</a>
3
+ <template v-else>{{renderValue}}</template>
4
+ </template>
5
+ <script>
6
+
7
+ export default {
8
+ props:{
9
+ value:{
10
+ required:true,
11
+ }
12
+ },
13
+ computed:{
14
+ reference() {
15
+ return !!(this.value && this.value._id)
16
+ },
17
+ renderValue() {
18
+ return this.value ? this.value.title || this.value.name || this.value : undefined;
19
+ }
20
+ },
21
+ methods:{
22
+ clicked(item) {
23
+ this.$qik.dispatch('item:view', item);
24
+ }
25
+ },
26
+ }
27
+ </script>
28
+ <style lang="scss" scoped>
29
+ a {
30
+ padding: 0.5em 1em;
31
+ margin: 0.1em;
32
+ background: rgba(#000, 0.05);
33
+ border-radius: 0.5em;
34
+ display: inline-block;
35
+ line-height: 1;
36
+ font-size: 0.7em;
37
+ cursor:pointer;
38
+ white-space: nowrap;
39
+ text-overflow: ellipsis;
40
+ overflow: hidden ;
41
+
42
+ &:hover {
43
+ background: rgba(#000, 0.1);
44
+ }
45
+ }
46
+ </style>
package/src/ui/image.vue CHANGED
@@ -6,7 +6,7 @@
6
6
  <script>
7
7
  export default {
8
8
  props: {
9
- modelValue: {
9
+ item: {
10
10
  type: Object,
11
11
  },
12
12
  width: {
@@ -35,7 +35,7 @@ export default {
35
35
  },
36
36
  data() {
37
37
  return {
38
- model: this.modelValue,
38
+ model: this.item,
39
39
  }
40
40
  },
41
41
  computed: {
@@ -3,6 +3,12 @@
3
3
  <slot/>
4
4
  </div>
5
5
  </template>
6
+ <script>
7
+
8
+ export default {
9
+
10
+ }
11
+ </script>
6
12
  <style lang="scss" scoped>
7
13
 
8
14
  .ux-list-item {
package/src/ui/menu.vue CHANGED
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="ux-menu">
2
+ <div class="ux-menu" :class="{right}">
3
3
  <span>
4
4
  <slot name="activator" :on="on" />
5
5
  </span>
@@ -11,6 +11,10 @@
11
11
  <script>
12
12
  export default {
13
13
  props: {
14
+ right:{
15
+ type:Boolean,
16
+ default:false,
17
+ },
14
18
  closeOnClick: {
15
19
  type: Boolean,
16
20
  default () {
@@ -59,8 +63,6 @@ export default {
59
63
  }
60
64
  },
61
65
  globalClick(event) {
62
- console.log('GLOBAL', event);
63
-
64
66
 
65
67
  if (this.triggerEvent === event) {
66
68
  return;
@@ -129,7 +131,17 @@ export default {
129
131
 
130
132
  .ux-menu-panel {
131
133
  position: fixed;
132
- z-index: 1;
134
+ z-index: 10;
135
+ max-height: 70vh;
136
+ overflow: auto;
137
+ text-align: left;
138
+ text-transform: none;
139
+ letter-spacing: 0;
140
+ font-weight: normal;
141
+ }
142
+
143
+ &.right .ux-menu-panel{
144
+ right:0;
133
145
  }
134
146
  }
135
147
  </style>
@@ -0,0 +1,156 @@
1
+ <template>
2
+ <flex-row center gap>
3
+ <flex-cell shrink class="text">
4
+ <native-select v-model="perPage" :field="perPageField">
5
+ <template v-if="$device.breakpoint.xs">{{displayStartIndex}}-{{endIndex}} of {{total}}</template>
6
+ <template v-else>Showing {{displayStartIndex}} to {{endIndex}} of {{total}} total</template>
7
+ </native-select>
8
+ </flex-cell>
9
+ <flex-cell>
10
+ </flex-cell>
11
+ <flex-cell shrink v-if="totalPages > 1">
12
+ <flex-row gap center>
13
+ <flex-cell shrink class="text">
14
+ <native-select v-model="currentPage" :field="pageField">
15
+ <template v-if="$device.breakpoint.xs">{{currentPage}}/{{totalPages}}</template>
16
+ <template v-else>Page {{currentPage}} of {{totalPages}}</template>
17
+ </native-select>
18
+ </flex-cell>
19
+ <flex-cell shrink>
20
+ <ux-button icon @click="previousPage()">
21
+ <ux-icon icon="fa-arrow-left" />
22
+ </ux-button>
23
+ </flex-cell>
24
+ <flex-cell shrink>
25
+ <ux-button icon @click="nextPage()">
26
+ <ux-icon icon="fa-arrow-right" />
27
+ </ux-button>
28
+ </flex-cell>
29
+ </flex-row>
30
+ </flex-cell>
31
+ </flex-row>
32
+ </template>
33
+ <script>
34
+ import NativeSelect from '../form/inputs/select.vue';
35
+
36
+
37
+ export default {
38
+ props: {
39
+ total: {
40
+ type: Number,
41
+ default () {
42
+ return 0;
43
+ }
44
+ },
45
+ },
46
+ components: {
47
+ NativeSelect,
48
+ },
49
+ watch: {
50
+ totalPages() {
51
+ this.currentPage = 0;
52
+ },
53
+ },
54
+ computed: {
55
+ perPage: {
56
+ get() {
57
+ return this.page.size;
58
+ },
59
+ set(i) {
60
+ i = Math.max(i, 1);
61
+ this.page.size = i;
62
+ this.dispatch();
63
+ }
64
+
65
+ },
66
+ pageField() {
67
+ return {
68
+ type: 'integer',
69
+ maximum: 1,
70
+ minimum: 1,
71
+ options: Array(this.totalPages).fill(1).map((x, y) => x + y),
72
+ }
73
+ },
74
+ // total() {
75
+ // return this.dataSource.total;
76
+ // },
77
+ totalPages() {
78
+ return Math.ceil(this.total / this.perPage)
79
+ },
80
+ startIndex() {
81
+ return (this.currentPage - 1) * this.page.size;
82
+ },
83
+ displayStartIndex() {
84
+ return this.total ? this.startIndex + 1 : 0;
85
+ },
86
+ endIndex() {
87
+ return Math.min(this.startIndex + this.page.size, this.total);
88
+ },
89
+ currentPage: {
90
+ get() {
91
+ return this.page.index;
92
+ },
93
+ set(index) {
94
+
95
+
96
+ if (this.totalPages) {
97
+ index = Math.min(this.totalPages, index);
98
+ }
99
+
100
+ index = Math.max(index, 1);
101
+
102
+ this.page.index = index;
103
+ this.dispatch();
104
+ }
105
+ },
106
+
107
+ },
108
+ methods: {
109
+ dispatch() {
110
+ return this.$emit('update:page', this.page);
111
+ },
112
+ previousPage() {
113
+ this.currentPage--;
114
+ },
115
+ nextPage() {
116
+ this.currentPage++;
117
+ },
118
+ },
119
+ data() {
120
+ return {
121
+ page: {
122
+ size: 50,
123
+ index: 1,
124
+ },
125
+ perPageField: {
126
+ minimum: 1,
127
+ maximum: 1,
128
+ options: [{
129
+ title: '50 per page',
130
+ value: 50,
131
+ },
132
+ {
133
+ title: '100 per page',
134
+ value: 100,
135
+ },
136
+ {
137
+ title: '250 per page',
138
+ value: 250,
139
+ },
140
+ {
141
+ title: '500 per page',
142
+ value: 500,
143
+ },
144
+ ]
145
+ }
146
+ }
147
+ }
148
+ }
149
+ </script>
150
+ <style lang="scss" scoped>
151
+
152
+ .text {
153
+ opacity: 0.5;
154
+ font-size: 0.8em;
155
+ }
156
+ </style>
package/src/version.js CHANGED
@@ -1 +1 @@
1
- export const version = '0.1.0'
1
+ export const version = '0.1.2'