@qikdev/vue-ui 0.0.3 → 0.1.1
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 +1 -1
- package/src/components.js +36 -8
- package/src/content/browser.vue +510 -161
- package/src/content/render/field.vue +8 -0
- package/src/content/render/group.vue +6 -6
- package/src/filter/FilterBuilder.vue +2 -1
- package/src/filter/FilterCondition.vue +46 -8
- package/src/filter/FilterRule.vue +3 -1
- package/src/form/field.vue +13 -0
- package/src/form/getDefaultValue.js +2 -0
- package/src/form/inputs/group.vue +6 -6
- package/src/form/inputs/html.vue +39 -0
- package/src/form/inputs/select.vue +18 -0
- package/src/form/inputs/type-select.vue +247 -0
- package/src/layout/flex-row.vue +1 -1
- package/src/layout/flex-spacer.vue +1 -0
- package/src/layout/tab.vue +34 -0
- package/src/layout/tabset.vue +72 -0
- package/src/mixins/RememberScroll.js +19 -0
- package/src/modal/ContentModal.vue +34 -25
- package/src/modal/Modal.vue +2 -1
- package/src/services/device.js +211 -0
- package/src/services/selection.js +37 -12
- package/src/table/Table.vue +80 -13
- package/src/table/TableCell.vue +80 -31
- package/src/table/TableRow.vue +8 -20
- package/src/table/cells/Button.vue +56 -0
- package/src/table/cells/Thumbnail.vue +2 -1
- package/src/table/cells/Value.vue +46 -0
- package/src/ui/image.vue +2 -2
- package/src/ui/list-item.vue +6 -0
- package/src/ui/menu.vue +16 -4
- package/src/ui/pager.vue +156 -0
- package/src/version.js +1 -1
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<flex-column>
|
|
3
|
+
<flex-header class="tabset-menu">
|
|
4
|
+
<flex-row>
|
|
5
|
+
<a :class="{active:index === activeIndex}" v-for="(tab, index) in tabs" @click="select(index)">{{tab.props.heading}}</a>
|
|
6
|
+
</flex-row>
|
|
7
|
+
</flex-header>
|
|
8
|
+
<flex-column>
|
|
9
|
+
<flex-column v-show="index === activeIndex" :key="index" v-for="(tab, index) in tabs">
|
|
10
|
+
<component :is="tab" />
|
|
11
|
+
</flex-column>
|
|
12
|
+
<!-- -->
|
|
13
|
+
<!-- <slot/> -->
|
|
14
|
+
</flex-column>
|
|
15
|
+
</flex-column>
|
|
16
|
+
</template>
|
|
17
|
+
<script>
|
|
18
|
+
export default {
|
|
19
|
+
data() {
|
|
20
|
+
return {
|
|
21
|
+
activeIndex: 0,
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
methods: {
|
|
25
|
+
select(i) {
|
|
26
|
+
console.log('SELECT', this.activeIndex)
|
|
27
|
+
this.activeIndex = i;
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
computed: {
|
|
31
|
+
tabs() {
|
|
32
|
+
|
|
33
|
+
var slotChildren = this.$slots.default()
|
|
34
|
+
// .map(function(t) {
|
|
35
|
+
// return t.children;
|
|
36
|
+
// });
|
|
37
|
+
console.log('SLOT CHILDREN', slotChildren);
|
|
38
|
+
return slotChildren;
|
|
39
|
+
|
|
40
|
+
//
|
|
41
|
+
// return [];
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
}
|
|
45
|
+
</script>
|
|
46
|
+
<style lang="scss" scoped>
|
|
47
|
+
|
|
48
|
+
.tabset-menu {
|
|
49
|
+
background: rgba(#000, 0.05);
|
|
50
|
+
|
|
51
|
+
a {
|
|
52
|
+
display: block;
|
|
53
|
+
flex:1;
|
|
54
|
+
align-items: center;
|
|
55
|
+
padding:1em;
|
|
56
|
+
text-transform: uppercase;
|
|
57
|
+
text-align: center;
|
|
58
|
+
letter-spacing: 0.05em;
|
|
59
|
+
cursor: pointer;
|
|
60
|
+
color: rgba(#000, 0.5);
|
|
61
|
+
font-weight: bold;
|
|
62
|
+
border-top:3px solid transparent;
|
|
63
|
+
|
|
64
|
+
&.active {
|
|
65
|
+
background: #fff;
|
|
66
|
+
color: $primary;
|
|
67
|
+
border-top:3px solid $primary;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
</style>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
data() {
|
|
3
|
+
return {
|
|
4
|
+
scrollTop: 0,
|
|
5
|
+
}
|
|
6
|
+
},
|
|
7
|
+
mounted() {
|
|
8
|
+
var scroller = this.$refs.scroll;
|
|
9
|
+
scroller.addEventListener('scroll', this.updateScroll);
|
|
10
|
+
},
|
|
11
|
+
beforeUnmount() {
|
|
12
|
+
var scroller = this.$refs.scroll;
|
|
13
|
+
scroller.removeEventListener('scroll', this.updateScroll);
|
|
14
|
+
},
|
|
15
|
+
activated() {
|
|
16
|
+
var scroller = this.$refs.scroll;
|
|
17
|
+
scroller.scrollTop = this.scrollTop;
|
|
18
|
+
},
|
|
19
|
+
}
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<flex-column class="wrapper">
|
|
3
|
-
|
|
4
|
-
<template v-if="definition">
|
|
5
|
-
<flex-header>
|
|
6
|
-
<div class="header">
|
|
7
|
-
<flex-row center>
|
|
8
|
-
<flex-cell shrink>
|
|
9
|
-
Select {{maximum == 1 ? title : plural}}
|
|
10
|
-
</flex-cell>
|
|
11
|
-
<flex-spacer />
|
|
12
|
-
<flex-cell>
|
|
13
|
-
<search v-model="search" :loading="searching" :debounce="500" placeholder="Search" />
|
|
14
|
-
</flex-cell>
|
|
15
|
-
<flex-spacer />
|
|
16
|
-
<flex-cell shrink>
|
|
17
|
-
<ux-button color="primary" @click="selectionComplete">Done</ux-button>
|
|
18
|
-
</flex-cell>
|
|
19
|
-
</flex-row>
|
|
20
|
-
</div>
|
|
21
|
-
</flex-header>
|
|
22
|
-
<content-browser ref="browser" :search="search" @click:row="rowClicked" :maximum="options.maximum" v-model="model" :type="options.type" :options="browserOptions">
|
|
23
|
-
</content-browser>
|
|
24
|
-
</template>
|
|
25
|
-
|
|
26
|
-
<flex-column v-else>
|
|
3
|
+
<flex-column v-if="loading">
|
|
27
4
|
Loading
|
|
28
5
|
</flex-column>
|
|
6
|
+
<template v-else>
|
|
7
|
+
<template v-if="definition">
|
|
8
|
+
<flex-header>
|
|
9
|
+
<div class="header">
|
|
10
|
+
<flex-row center>
|
|
11
|
+
<flex-cell shrink>
|
|
12
|
+
Select {{maximum == 1 ? title : plural}}
|
|
13
|
+
</flex-cell>
|
|
14
|
+
<flex-spacer />
|
|
15
|
+
<flex-cell>
|
|
16
|
+
<search v-model="search" :loading="searching" :debounce="500" placeholder="Search" />
|
|
17
|
+
</flex-cell>
|
|
18
|
+
<flex-spacer />
|
|
19
|
+
<flex-cell shrink>
|
|
20
|
+
<ux-button color="primary" @click="selectionComplete">Done</ux-button>
|
|
21
|
+
</flex-cell>
|
|
22
|
+
</flex-row>
|
|
23
|
+
</div>
|
|
24
|
+
</flex-header>
|
|
25
|
+
<content-browser ref="browser" :search="search" @click:row="rowClicked" :maximum="options.maximum" v-model="model" :type="options.type" :options="browserOptions">
|
|
26
|
+
</content-browser>
|
|
27
|
+
</template>
|
|
29
28
|
|
|
29
|
+
</template>
|
|
30
30
|
</flex-column>
|
|
31
31
|
</template>
|
|
32
32
|
<script>
|
|
@@ -44,7 +44,15 @@ export default {
|
|
|
44
44
|
async created() {
|
|
45
45
|
var self = this;
|
|
46
46
|
var glossary = await self.$qik.content.glossary({ hash: true });
|
|
47
|
+
self.loading = false;
|
|
47
48
|
var definition = glossary[self.type]
|
|
49
|
+
|
|
50
|
+
if(!definition) {
|
|
51
|
+
//Close immediately
|
|
52
|
+
self.$qik.notify('You do not have the required permissions to list content of this type');
|
|
53
|
+
self.dismiss()
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
48
56
|
self.definition = definition;
|
|
49
57
|
},
|
|
50
58
|
computed: {
|
|
@@ -69,6 +77,7 @@ export default {
|
|
|
69
77
|
search: '',
|
|
70
78
|
searching: false,
|
|
71
79
|
definition: null,
|
|
80
|
+
loading: true,
|
|
72
81
|
model: this.options.model.slice(),
|
|
73
82
|
}
|
|
74
83
|
},
|
|
@@ -91,7 +100,7 @@ export default {
|
|
|
91
100
|
}
|
|
92
101
|
|
|
93
102
|
.header {
|
|
94
|
-
background
|
|
103
|
+
background: #fff;
|
|
95
104
|
padding: 1em;
|
|
96
105
|
border-bottom: 1px solid rgba(#000, 0.1);
|
|
97
106
|
}
|
package/src/modal/Modal.vue
CHANGED
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
|
|
2
|
+
import { reactive } from 'vue'
|
|
3
|
+
|
|
4
|
+
export default function() {
|
|
5
|
+
|
|
6
|
+
var service = reactive({
|
|
7
|
+
mounted:false,
|
|
8
|
+
screen: {
|
|
9
|
+
width: 1024,
|
|
10
|
+
height: 768,
|
|
11
|
+
},
|
|
12
|
+
limits: {
|
|
13
|
+
xs: 600,
|
|
14
|
+
sm: 960,
|
|
15
|
+
md: 1264,
|
|
16
|
+
lg: 1904,
|
|
17
|
+
},
|
|
18
|
+
breakpoint: {
|
|
19
|
+
mobile: false,
|
|
20
|
+
tablet: false,
|
|
21
|
+
desktop: false,
|
|
22
|
+
xs: false,
|
|
23
|
+
sm: false,
|
|
24
|
+
md: false,
|
|
25
|
+
lg: false,
|
|
26
|
+
xl: false,
|
|
27
|
+
xsOnly: false,
|
|
28
|
+
smOnly: false,
|
|
29
|
+
smAndDown: false,
|
|
30
|
+
smAndUp: false,
|
|
31
|
+
mdOnly: false,
|
|
32
|
+
mdAndDown: false,
|
|
33
|
+
mdAndUp: false,
|
|
34
|
+
lgOnly: false,
|
|
35
|
+
lgAndDown: false,
|
|
36
|
+
lgAndUp: false,
|
|
37
|
+
xlOnly: false,
|
|
38
|
+
point: 0,
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
////////////////////////////////
|
|
43
|
+
|
|
44
|
+
var mounted;
|
|
45
|
+
let WindowReference;
|
|
46
|
+
|
|
47
|
+
////////////////////////////////
|
|
48
|
+
|
|
49
|
+
service.resize = function() {
|
|
50
|
+
console.log('RESIZE')
|
|
51
|
+
|
|
52
|
+
var width = Math.max(WindowReference.innerWidth || 0);
|
|
53
|
+
var height = Math.max(WindowReference.innerHeight || 0);
|
|
54
|
+
|
|
55
|
+
service.screen = {
|
|
56
|
+
width,
|
|
57
|
+
height,
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
///////////////////////////////////////////
|
|
61
|
+
|
|
62
|
+
var breakpoint = {
|
|
63
|
+
mobile: false,
|
|
64
|
+
tablet: false,
|
|
65
|
+
desktop: false,
|
|
66
|
+
xs: false,
|
|
67
|
+
sm: false,
|
|
68
|
+
md: false,
|
|
69
|
+
lg: false,
|
|
70
|
+
xl: false,
|
|
71
|
+
xsOnly: false,
|
|
72
|
+
smOnly: false,
|
|
73
|
+
smAndDown: false,
|
|
74
|
+
smAndUp: false,
|
|
75
|
+
mdOnly: false,
|
|
76
|
+
mdAndDown: false,
|
|
77
|
+
mdAndUp: false,
|
|
78
|
+
lgOnly: false,
|
|
79
|
+
lgAndDown: false,
|
|
80
|
+
lgAndUp: false,
|
|
81
|
+
xlOnly: false,
|
|
82
|
+
point: 0,
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
///////////////////////////////////////////
|
|
86
|
+
|
|
87
|
+
var point = 0;
|
|
88
|
+
|
|
89
|
+
if (width > service.limits.xs) {
|
|
90
|
+
point++;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (width > service.limits.sm) {
|
|
94
|
+
point++;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (width > service.limits.md) {
|
|
98
|
+
point++;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (width > service.limits.lg) {
|
|
102
|
+
point++;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
///////////////////////////////////////////
|
|
106
|
+
|
|
107
|
+
//XS Mobile
|
|
108
|
+
if (point < 1) {
|
|
109
|
+
breakpoint.mobile = true;
|
|
110
|
+
breakpoint.xs = true;
|
|
111
|
+
breakpoint.xsOnly = true;
|
|
112
|
+
|
|
113
|
+
//Down
|
|
114
|
+
breakpoint.smAndDown = true;
|
|
115
|
+
breakpoint.mdAndDown = true;
|
|
116
|
+
breakpoint.lgAndDown = true;
|
|
117
|
+
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
//SM Tablet
|
|
121
|
+
if (point == 1) {
|
|
122
|
+
breakpoint.tablet = true;
|
|
123
|
+
breakpoint.sm = true;
|
|
124
|
+
breakpoint.smOnly = true;
|
|
125
|
+
|
|
126
|
+
//Down
|
|
127
|
+
breakpoint.smAndDown = true;
|
|
128
|
+
breakpoint.mdAndDown = true;
|
|
129
|
+
breakpoint.lgAndDown = true;
|
|
130
|
+
|
|
131
|
+
//Up
|
|
132
|
+
breakpoint.smAndUp = true;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
//MD Tablet
|
|
136
|
+
if (point == 2) {
|
|
137
|
+
breakpoint.desktop = true;
|
|
138
|
+
breakpoint.md = true;
|
|
139
|
+
breakpoint.mdOnly = true;
|
|
140
|
+
//Down
|
|
141
|
+
breakpoint.mdAndDown = true;
|
|
142
|
+
breakpoint.lgAndDown = true;
|
|
143
|
+
|
|
144
|
+
//Up
|
|
145
|
+
breakpoint.smAndUp = true;
|
|
146
|
+
breakpoint.mdAndUp = true;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
//LG Desktop
|
|
150
|
+
if (point == 3) {
|
|
151
|
+
breakpoint.desktop = true;
|
|
152
|
+
breakpoint.lg = true;
|
|
153
|
+
breakpoint.lgOnly = true;
|
|
154
|
+
//Down
|
|
155
|
+
breakpoint.lgAndDown = true;
|
|
156
|
+
|
|
157
|
+
//Up
|
|
158
|
+
breakpoint.smAndUp = true;
|
|
159
|
+
breakpoint.mdAndUp = true;
|
|
160
|
+
breakpoint.lgAndUp = true;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
//XL Desktop
|
|
164
|
+
if (point > 3) {
|
|
165
|
+
breakpoint.desktop = true;
|
|
166
|
+
breakpoint.xl = true;
|
|
167
|
+
breakpoint.xlOnly = true;
|
|
168
|
+
//Up
|
|
169
|
+
breakpoint.smAndUp = true;
|
|
170
|
+
breakpoint.mdAndUp = true;
|
|
171
|
+
breakpoint.lgAndUp = true;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
service.point = point;
|
|
176
|
+
service.breakpoint = breakpoint;
|
|
177
|
+
|
|
178
|
+
// console.log('SERVICE', point, service.screen, breakpoint)
|
|
179
|
+
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
////////////////////////////////
|
|
184
|
+
|
|
185
|
+
service.mount = function(window) {
|
|
186
|
+
if (mounted) {
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
WindowReference = window;
|
|
191
|
+
service.resize();
|
|
192
|
+
mounted = true;
|
|
193
|
+
service.mounted = true;
|
|
194
|
+
WindowReference.addEventListener('resize', service.resize);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
////////////////////////////////
|
|
199
|
+
|
|
200
|
+
service.unmount = function() {
|
|
201
|
+
WindowReference.removeEventListener('resize', service.resize);
|
|
202
|
+
WindowReference = false;
|
|
203
|
+
mounted = false;
|
|
204
|
+
service.mounted = false;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
////////////////////////////////
|
|
208
|
+
|
|
209
|
+
return service;
|
|
210
|
+
|
|
211
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { reactive,
|
|
1
|
+
import { reactive, watch } from 'vue';
|
|
2
|
+
import { EventDispatcher } from '@qikdev/sdk';
|
|
2
3
|
|
|
3
4
|
export default function(options) {
|
|
4
5
|
|
|
@@ -8,7 +9,7 @@ export default function(options) {
|
|
|
8
9
|
|
|
9
10
|
///////////////////////////////////
|
|
10
11
|
|
|
11
|
-
const service = {}
|
|
12
|
+
const service = EventDispatcher({})
|
|
12
13
|
|
|
13
14
|
///////////////////////////////////
|
|
14
15
|
|
|
@@ -17,7 +18,8 @@ export default function(options) {
|
|
|
17
18
|
|
|
18
19
|
///////////////////////////////////
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
|
|
22
|
+
watch(selection, function() {
|
|
21
23
|
recreateHash();
|
|
22
24
|
});
|
|
23
25
|
|
|
@@ -33,6 +35,7 @@ export default function(options) {
|
|
|
33
35
|
set[id] = item;
|
|
34
36
|
return set;
|
|
35
37
|
}, {});
|
|
38
|
+
|
|
36
39
|
}
|
|
37
40
|
///////////////////////////////////
|
|
38
41
|
|
|
@@ -40,7 +43,8 @@ export default function(options) {
|
|
|
40
43
|
return hash[item._id || item.id];
|
|
41
44
|
}
|
|
42
45
|
|
|
43
|
-
service.select = function(item) {
|
|
46
|
+
service.select = function(item, ignoreDispatch) {
|
|
47
|
+
|
|
44
48
|
|
|
45
49
|
//If there is a limit set
|
|
46
50
|
if (maximum) {
|
|
@@ -60,9 +64,14 @@ export default function(options) {
|
|
|
60
64
|
|
|
61
65
|
//Add the item into the selection array
|
|
62
66
|
selection.push(item);
|
|
67
|
+
|
|
68
|
+
if (!ignoreDispatch) {
|
|
69
|
+
service.dispatch('change', selection);
|
|
70
|
+
}
|
|
63
71
|
}
|
|
64
72
|
|
|
65
|
-
service.deselect = function(item) {
|
|
73
|
+
service.deselect = function(item, ignoreDispatch) {
|
|
74
|
+
|
|
66
75
|
|
|
67
76
|
//If we can only select one item
|
|
68
77
|
//then just clear the selection
|
|
@@ -77,44 +86,60 @@ export default function(options) {
|
|
|
77
86
|
})
|
|
78
87
|
|
|
79
88
|
//If there was no index found
|
|
80
|
-
if(index == -1) {
|
|
89
|
+
if (index == -1) {
|
|
81
90
|
return;
|
|
82
91
|
}
|
|
83
92
|
|
|
84
93
|
//remove it from the array
|
|
85
94
|
selection.splice(index, 1);
|
|
95
|
+
if (!ignoreDispatch) {
|
|
96
|
+
service.dispatch('change', selection);
|
|
97
|
+
}
|
|
98
|
+
|
|
86
99
|
}
|
|
87
100
|
|
|
88
|
-
service.toggle = function(item) {
|
|
101
|
+
service.toggle = function(item, ignoreDispatch) {
|
|
102
|
+
|
|
89
103
|
if (service.isSelected(item)) {
|
|
90
|
-
service.deselect(item);
|
|
104
|
+
service.deselect(item, ignoreDispatch);
|
|
91
105
|
} else {
|
|
92
|
-
service.select(item);
|
|
106
|
+
service.select(item, ignoreDispatch);
|
|
93
107
|
}
|
|
94
108
|
}
|
|
95
109
|
|
|
96
110
|
service.selectMultiple = function(array) {
|
|
111
|
+
|
|
112
|
+
|
|
97
113
|
array.forEach(function(item) {
|
|
98
|
-
service.select(item);
|
|
114
|
+
service.select(item, true);
|
|
99
115
|
})
|
|
116
|
+
|
|
117
|
+
service.dispatch('change', selection);
|
|
100
118
|
}
|
|
101
119
|
|
|
102
120
|
service.deselectMultiple = function(array) {
|
|
121
|
+
|
|
122
|
+
|
|
103
123
|
array.forEach(function(item) {
|
|
104
|
-
service.deselect(item);
|
|
124
|
+
service.deselect(item, true);
|
|
105
125
|
})
|
|
126
|
+
|
|
127
|
+
service.dispatch('change', selection);
|
|
106
128
|
}
|
|
107
129
|
|
|
108
130
|
service.setSelection = function(array) {
|
|
131
|
+
|
|
132
|
+
|
|
109
133
|
selection.length = 0;
|
|
110
134
|
setTimeout(function() {
|
|
111
135
|
service.selectMultiple(array);
|
|
112
136
|
})
|
|
113
|
-
|
|
137
|
+
|
|
114
138
|
}
|
|
115
139
|
|
|
116
140
|
service.deselectAll = function() {
|
|
117
141
|
selection.length = 0;
|
|
142
|
+
service.dispatch('change', selection);
|
|
118
143
|
}
|
|
119
144
|
|
|
120
145
|
///////////////////////////////////
|