@qikdev/vue-ui 0.0.1 → 0.0.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.
- package/package.json +6 -2
- package/src/components.js +209 -6
- package/src/content/browser.vue +477 -0
- package/src/content/item.vue +48 -0
- package/src/content/render/field.vue +423 -0
- package/src/content/render/group.vue +65 -0
- package/src/content/render/render-mixin.js +101 -0
- package/src/content/render/render.vue +86 -0
- package/src/filter/FilterBuilder.vue +147 -0
- package/src/filter/FilterCondition.vue +335 -0
- package/src/filter/FilterRule.vue +257 -0
- package/src/form/expressions/index.js +83 -0
- package/src/form/field.vue +624 -0
- package/src/form/form.vue +280 -0
- package/src/form/getDefaultValue.js +224 -0
- package/src/form/inputs/button-select.vue +208 -0
- package/src/form/inputs/checkbox.vue +91 -0
- package/src/form/inputs/content-select.vue +187 -0
- package/src/form/inputs/currency.vue +205 -0
- package/src/form/inputs/datefield.vue +132 -0
- package/src/form/inputs/group.vue +155 -0
- package/src/form/inputs/input-mixin.js +440 -0
- package/src/form/inputs/native-select-old.vue +43 -0
- package/src/form/inputs/object-field.vue +50 -0
- package/src/form/inputs/option.vue +19 -0
- package/src/form/inputs/options-manager.vue +244 -0
- package/src/form/inputs/phone-number-input.vue +235 -0
- package/src/form/inputs/search.vue +117 -0
- package/src/form/inputs/select.vue +211 -0
- package/src/form/inputs/switch.vue +87 -0
- package/src/form/inputs/textarea.vue +80 -0
- package/src/form/inputs/textfield.vue +165 -0
- package/src/form/inputs/timezone.vue +642 -0
- package/src/form/inputs/upload/filedrop.vue +72 -0
- package/src/form/inputs/upload/upload.vue +323 -0
- package/src/form/parseBoolean.js +24 -0
- package/src/layout/flex-body.vue +3 -2
- package/src/layout/flex-cell.vue +45 -0
- package/src/layout/flex-column.vue +1 -1
- package/src/layout/flex-footer.vue +3 -2
- package/src/layout/flex-header.vue +3 -2
- package/src/layout/flex-row.vue +35 -0
- package/src/layout/flex-spacer.vue +17 -0
- package/src/layout/panel-body.vue +13 -0
- package/src/layout/panel-footer.vue +20 -0
- package/src/layout/panel-header.vue +20 -0
- package/src/layout/panel.vue +23 -0
- package/src/modal/ConfirmModal.vue +50 -0
- package/src/modal/ContentModal.vue +99 -0
- package/src/modal/Modal.vue +85 -0
- package/src/modal/ModalMixin.js +21 -0
- package/src/modal/OptionsModal.vue +31 -0
- package/src/modal/PromptModal.vue +31 -0
- package/src/services/selection.js +140 -0
- package/src/table/Table.vue +269 -0
- package/src/table/TableCell.vue +64 -0
- package/src/table/TableRow.vue +94 -0
- package/src/table/cells/TableCellMixin.js +15 -0
- package/src/table/cells/Thumbnail.vue +38 -0
- package/src/ui/button.vue +254 -0
- package/src/ui/checkbox.vue +79 -0
- package/src/ui/icon.vue +57 -0
- package/src/ui/image.vue +158 -0
- package/src/ui/link.vue +62 -0
- package/src/ui/list-item.vue +16 -0
- package/src/ui/list.vue +26 -0
- package/src/ui/menu.vue +135 -0
- package/src/ui/progressbar.vue +77 -0
- package/src/ui/spinner.vue +26 -0
- package/src/ui/switch.vue +89 -0
- package/yarn-error.log +2923 -0
- package/index.js +0 -14
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<flex-column class="wrapper">
|
|
3
|
+
<flex-body>
|
|
4
|
+
<div class="padder">
|
|
5
|
+
<h5>{{options.title}}</h5>
|
|
6
|
+
<div>{{options.description}}</div>
|
|
7
|
+
</div>
|
|
8
|
+
</flex-body>
|
|
9
|
+
<flex-footer>
|
|
10
|
+
<div class="padder">
|
|
11
|
+
<flex-row>
|
|
12
|
+
<flex-cell>
|
|
13
|
+
<ux-button @click="dismiss">Cancel</ux-button>
|
|
14
|
+
</flex-cell>
|
|
15
|
+
|
|
16
|
+
<flex-cell>
|
|
17
|
+
<ux-button @click="close">Confirm</ux-button>
|
|
18
|
+
</flex-cell>
|
|
19
|
+
</flex-row>
|
|
20
|
+
</div>
|
|
21
|
+
</flex-footer>
|
|
22
|
+
</flex-column>
|
|
23
|
+
</template>
|
|
24
|
+
<script>
|
|
25
|
+
|
|
26
|
+
import ModalMixin from './ModalMixin';
|
|
27
|
+
|
|
28
|
+
export default {
|
|
29
|
+
mixins:[ModalMixin],
|
|
30
|
+
}
|
|
31
|
+
</script>
|
|
32
|
+
<style lang="scss" scoped>
|
|
33
|
+
|
|
34
|
+
.wrapper {
|
|
35
|
+
border-radius: 0.5em;
|
|
36
|
+
overflow: hidden;
|
|
37
|
+
background: #fff;
|
|
38
|
+
text-align: center;
|
|
39
|
+
|
|
40
|
+
h5 {
|
|
41
|
+
font-size: 1.2em;
|
|
42
|
+
margin:0;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.padder {
|
|
46
|
+
padding: 1em;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
</style>
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
<template>
|
|
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>
|
|
27
|
+
Loading
|
|
28
|
+
</flex-column>
|
|
29
|
+
|
|
30
|
+
<pre>{{model}}</pre>
|
|
31
|
+
</flex-column>
|
|
32
|
+
</template>
|
|
33
|
+
<script>
|
|
34
|
+
import Search from '../form/inputs/search.vue';
|
|
35
|
+
|
|
36
|
+
import ContentBrowser from '../content/browser.vue';
|
|
37
|
+
import ModalMixin from './ModalMixin';
|
|
38
|
+
|
|
39
|
+
export default {
|
|
40
|
+
components: {
|
|
41
|
+
ContentBrowser,
|
|
42
|
+
Search,
|
|
43
|
+
},
|
|
44
|
+
mixins: [ModalMixin],
|
|
45
|
+
async created() {
|
|
46
|
+
var self = this;
|
|
47
|
+
var glossary = await self.$qik.content.glossary({ hash: true });
|
|
48
|
+
var definition = glossary[self.type]
|
|
49
|
+
self.definition = definition;
|
|
50
|
+
},
|
|
51
|
+
computed: {
|
|
52
|
+
type() {
|
|
53
|
+
return this.options.type;
|
|
54
|
+
},
|
|
55
|
+
title() {
|
|
56
|
+
return this.definition.title;
|
|
57
|
+
},
|
|
58
|
+
plural() {
|
|
59
|
+
return this.definition.plural;
|
|
60
|
+
},
|
|
61
|
+
maximum() {
|
|
62
|
+
return this.options.maximum || 0;
|
|
63
|
+
},
|
|
64
|
+
browserOptions() {
|
|
65
|
+
return {}
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
data() {
|
|
69
|
+
return {
|
|
70
|
+
search: '',
|
|
71
|
+
searching: false,
|
|
72
|
+
definition: null,
|
|
73
|
+
model: this.options.model.slice(),
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
methods: {
|
|
77
|
+
rowClicked(row) {
|
|
78
|
+
this.$refs.browser.toggle(row);
|
|
79
|
+
},
|
|
80
|
+
selectionComplete(data) {
|
|
81
|
+
this.close(this.model);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
</script>
|
|
86
|
+
<style lang="scss" scoped>
|
|
87
|
+
.wrapper {
|
|
88
|
+
min-width: 80vw;
|
|
89
|
+
min-height: 80vh;
|
|
90
|
+
border-radius: 0.5em;
|
|
91
|
+
overflow: hidden;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.header {
|
|
95
|
+
background:#fff;
|
|
96
|
+
padding: 1em;
|
|
97
|
+
border-bottom: 1px solid rgba(#000, 0.1);
|
|
98
|
+
}
|
|
99
|
+
</style>
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="modal-wrapper">
|
|
3
|
+
<div class="modal-blanket" @click="blanketClick"/>
|
|
4
|
+
<div class="modal-content" :style="style">
|
|
5
|
+
<component :options="modal.options" v-bind="componentProps" @close="close" @dismiss="dismiss" :is="modal.component" />
|
|
6
|
+
</div>
|
|
7
|
+
</div>
|
|
8
|
+
</template>
|
|
9
|
+
<script>
|
|
10
|
+
export default {
|
|
11
|
+
props: {
|
|
12
|
+
modal: {
|
|
13
|
+
type: Object,
|
|
14
|
+
required: true,
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
data() {
|
|
18
|
+
return {}
|
|
19
|
+
},
|
|
20
|
+
methods: {
|
|
21
|
+
blanketClick() {
|
|
22
|
+
this.dismiss();
|
|
23
|
+
},
|
|
24
|
+
dismiss(err) {
|
|
25
|
+
this.$qik.closeModal(this.modal.id);
|
|
26
|
+
this.modal.reject(err);
|
|
27
|
+
},
|
|
28
|
+
close(value) {
|
|
29
|
+
this.$qik.closeModal(this.modal.id);
|
|
30
|
+
this.modal.resolve(value);
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
computed: {
|
|
34
|
+
componentProps() {
|
|
35
|
+
return this.modal.componentProps || {};
|
|
36
|
+
},
|
|
37
|
+
style() {
|
|
38
|
+
|
|
39
|
+
var styles = {}
|
|
40
|
+
|
|
41
|
+
if(this.modal.style) {
|
|
42
|
+
styles = Object.assign(styles, this.modal.style);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return styles;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
</script>
|
|
50
|
+
<style lang="scss" scoped>
|
|
51
|
+
.modal-wrapper {
|
|
52
|
+
margin:0;
|
|
53
|
+
padding:0;
|
|
54
|
+
position: fixed;
|
|
55
|
+
top:0;
|
|
56
|
+
left:0;
|
|
57
|
+
right:0;
|
|
58
|
+
bottom:0;
|
|
59
|
+
display: flex;
|
|
60
|
+
width:100vw;
|
|
61
|
+
height:100vh;
|
|
62
|
+
z-index: 100;
|
|
63
|
+
justify-content: center;
|
|
64
|
+
align-items:center;
|
|
65
|
+
overflow: hidden;
|
|
66
|
+
box-sizing: border-box;
|
|
67
|
+
|
|
68
|
+
.modal-blanket {
|
|
69
|
+
position:absolute;
|
|
70
|
+
background: rgba(#333, 0.5);
|
|
71
|
+
left:0;
|
|
72
|
+
top:0;
|
|
73
|
+
right:0;
|
|
74
|
+
bottom:0;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.modal-content {
|
|
78
|
+
display: flex;
|
|
79
|
+
overflow: hidden;
|
|
80
|
+
z-index: 101;
|
|
81
|
+
max-width: 90%;
|
|
82
|
+
max-height: 90%;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
</style>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
props:{
|
|
3
|
+
options:{
|
|
4
|
+
type:Object,
|
|
5
|
+
default() {
|
|
6
|
+
return {}
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
data() {
|
|
11
|
+
return {}
|
|
12
|
+
},
|
|
13
|
+
methods: {
|
|
14
|
+
dismiss(error) {
|
|
15
|
+
this.$emit('dismiss', error);
|
|
16
|
+
},
|
|
17
|
+
close(result) {
|
|
18
|
+
this.$emit('close',result);
|
|
19
|
+
},
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<flex-column>
|
|
3
|
+
<flex-header>
|
|
4
|
+
Options
|
|
5
|
+
</flex-header>
|
|
6
|
+
<flex-body>
|
|
7
|
+
Options
|
|
8
|
+
</flex-body>
|
|
9
|
+
<flex-footer>
|
|
10
|
+
<flex-row>
|
|
11
|
+
<flex-cell>
|
|
12
|
+
<ux-button @click="dismiss">Cancel</ux-button>
|
|
13
|
+
</flex-cell>
|
|
14
|
+
|
|
15
|
+
<flex-cell>
|
|
16
|
+
<ux-button @click="done">Done</ux-button>
|
|
17
|
+
</flex-cell>
|
|
18
|
+
</flex-row>
|
|
19
|
+
</flex-footer>
|
|
20
|
+
</flex-column>
|
|
21
|
+
</template>
|
|
22
|
+
<script>
|
|
23
|
+
|
|
24
|
+
import ModalMixin from './ModalMixin';
|
|
25
|
+
|
|
26
|
+
export default {
|
|
27
|
+
mixins:[ModalMixin],
|
|
28
|
+
}
|
|
29
|
+
</script>
|
|
30
|
+
<style lang="scss">
|
|
31
|
+
</style>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<flex-column>
|
|
3
|
+
<flex-header>
|
|
4
|
+
Prompt
|
|
5
|
+
</flex-header>
|
|
6
|
+
<flex-body>
|
|
7
|
+
Prompt
|
|
8
|
+
</flex-body>
|
|
9
|
+
<flex-footer>
|
|
10
|
+
<flex-row>
|
|
11
|
+
<flex-cell>
|
|
12
|
+
<ux-button @click="dismiss">Cancel</ux-button>
|
|
13
|
+
</flex-cell>
|
|
14
|
+
|
|
15
|
+
<flex-cell>
|
|
16
|
+
<ux-button @click="done">Done</ux-button>
|
|
17
|
+
</flex-cell>
|
|
18
|
+
</flex-row>
|
|
19
|
+
</flex-footer>
|
|
20
|
+
</flex-column>
|
|
21
|
+
</template>
|
|
22
|
+
<script>
|
|
23
|
+
|
|
24
|
+
import ModalMixin from './ModalMixin';
|
|
25
|
+
|
|
26
|
+
export default {
|
|
27
|
+
mixins:[ModalMixin],
|
|
28
|
+
}
|
|
29
|
+
</script>
|
|
30
|
+
<style lang="scss">
|
|
31
|
+
</style>
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { reactive, watchEffect } from 'vue';
|
|
2
|
+
|
|
3
|
+
export default function(options) {
|
|
4
|
+
|
|
5
|
+
options = options || {};
|
|
6
|
+
let minimum = Math.max(parseInt(options.minimum || 0), 0);
|
|
7
|
+
let maximum = Math.max(parseInt(options.maximum || 0), 0);
|
|
8
|
+
|
|
9
|
+
///////////////////////////////////
|
|
10
|
+
|
|
11
|
+
const service = {}
|
|
12
|
+
|
|
13
|
+
///////////////////////////////////
|
|
14
|
+
|
|
15
|
+
const selection = reactive([]);
|
|
16
|
+
let hash = {};
|
|
17
|
+
|
|
18
|
+
///////////////////////////////////
|
|
19
|
+
|
|
20
|
+
watchEffect(function() {
|
|
21
|
+
recreateHash();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
///////////////////////////////////
|
|
25
|
+
|
|
26
|
+
function recreateHash() {
|
|
27
|
+
hash = selection.reduce(function(set, item) {
|
|
28
|
+
|
|
29
|
+
var id = item._id || item.id;
|
|
30
|
+
if (!id) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
set[id] = item;
|
|
34
|
+
return set;
|
|
35
|
+
}, {});
|
|
36
|
+
}
|
|
37
|
+
///////////////////////////////////
|
|
38
|
+
|
|
39
|
+
service.isSelected = function(item) {
|
|
40
|
+
return hash[item._id || item.id];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
service.select = function(item) {
|
|
44
|
+
|
|
45
|
+
//If there is a limit set
|
|
46
|
+
if (maximum) {
|
|
47
|
+
//But we are at or past the limit
|
|
48
|
+
if (selection.length >= maximum) {
|
|
49
|
+
if (maximum === 1) {
|
|
50
|
+
//Clear the selection
|
|
51
|
+
selection.length = 0;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
//Check if this item is already selected
|
|
57
|
+
if (service.isSelected(item)) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
//Add the item into the selection array
|
|
62
|
+
selection.push(item);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
service.deselect = function(item) {
|
|
66
|
+
|
|
67
|
+
//If we can only select one item
|
|
68
|
+
//then just clear the selection
|
|
69
|
+
if (maximum === 1) {
|
|
70
|
+
selection.length = 0;
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
//Find the index of the item
|
|
75
|
+
var index = selection.findIndex(function(entry) {
|
|
76
|
+
return (entry._id && entry._id == item._id) || (entry.id && entry.id == item.id)
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
//If there was no index found
|
|
80
|
+
if(index == -1) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
//remove it from the array
|
|
85
|
+
selection.splice(index, 1);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
service.toggle = function(item) {
|
|
89
|
+
if (service.isSelected(item)) {
|
|
90
|
+
service.deselect(item);
|
|
91
|
+
} else {
|
|
92
|
+
service.select(item);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
service.selectMultiple = function(array) {
|
|
97
|
+
array.forEach(function(item) {
|
|
98
|
+
service.select(item);
|
|
99
|
+
})
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
service.deselectMultiple = function(array) {
|
|
103
|
+
array.forEach(function(item) {
|
|
104
|
+
service.deselect(item);
|
|
105
|
+
})
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
service.setSelection = function(array) {
|
|
109
|
+
selection.length = 0;
|
|
110
|
+
setTimeout(function() {
|
|
111
|
+
service.selectMultiple(array);
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
service.deselectAll = function() {
|
|
117
|
+
selection.length = 0;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
///////////////////////////////////
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
Object.defineProperty(service, 'items', {
|
|
124
|
+
value: selection,
|
|
125
|
+
writable: false,
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
///////////////////////////////////
|
|
129
|
+
|
|
130
|
+
Object.defineProperty(service, 'hash', {
|
|
131
|
+
get() {
|
|
132
|
+
return hash;
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
///////////////////////////////////
|
|
138
|
+
|
|
139
|
+
return service;
|
|
140
|
+
}
|