@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,269 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="table-wrapper">
|
|
3
|
+
<div class="table-scroll" ref="scroll">
|
|
4
|
+
<table>
|
|
5
|
+
<thead>
|
|
6
|
+
<tr>
|
|
7
|
+
<th v-if="enableSelection" class="first shrink">
|
|
8
|
+
<ux-menu>
|
|
9
|
+
<template #activator="{ on }">
|
|
10
|
+
<ux-checkbox v-on="on" :value="pageSelected"></ux-checkbox>
|
|
11
|
+
</template>
|
|
12
|
+
<ux-list>
|
|
13
|
+
<ux-list-item @click="selectPage()">
|
|
14
|
+
Select Page
|
|
15
|
+
</ux-list-item>
|
|
16
|
+
|
|
17
|
+
<ux-list-item v-if="someSelectedOnPage" @click="deselectPage()">
|
|
18
|
+
Deselect Page
|
|
19
|
+
</ux-list-item>
|
|
20
|
+
<ux-list-item v-if="selectAll" @click="selectAll()">
|
|
21
|
+
Select All ({{total}})
|
|
22
|
+
</ux-list-item>
|
|
23
|
+
<ux-list-item v-if="deselectAll" @click="deselectAll()">
|
|
24
|
+
Deselect All
|
|
25
|
+
</ux-list-item>
|
|
26
|
+
|
|
27
|
+
</ux-list>
|
|
28
|
+
</ux-menu>
|
|
29
|
+
</th>
|
|
30
|
+
<th @click="toggleSort(column)" :class="column.class" v-for="column in renderColumns">
|
|
31
|
+
{{column.title}}
|
|
32
|
+
</th>
|
|
33
|
+
<th v-if="enableActions" class="last shrink"></th>
|
|
34
|
+
</tr>
|
|
35
|
+
</thead>
|
|
36
|
+
<tbody>
|
|
37
|
+
<table-row :enableSelection="enableSelection" :enableActions="enableActions" :key="row._id" @click:cell="clickCell" @click:row="clickRow" @click:select="clickSelect" @click:actions="clickActions" :selected="isSelected(row)" :row="row" :columns="columns" v-for="row in renderRows" />
|
|
38
|
+
</tbody>
|
|
39
|
+
</table>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
</template>
|
|
43
|
+
<script>
|
|
44
|
+
import TableRow from './TableRow.vue';
|
|
45
|
+
import TableCell from './TableCell.vue';
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
export default {
|
|
49
|
+
components: {
|
|
50
|
+
TableRow,
|
|
51
|
+
TableCell,
|
|
52
|
+
},
|
|
53
|
+
watch: {
|
|
54
|
+
rows() {
|
|
55
|
+
this.$refs.scroll.scroll({
|
|
56
|
+
top: 0,
|
|
57
|
+
left: 0,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
props: {
|
|
62
|
+
total:{
|
|
63
|
+
type:Number,
|
|
64
|
+
},
|
|
65
|
+
columns: {
|
|
66
|
+
type: Array,
|
|
67
|
+
default () {
|
|
68
|
+
return []
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
rows: {
|
|
72
|
+
type: Array,
|
|
73
|
+
default () {
|
|
74
|
+
return [];
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
scrollable: {
|
|
78
|
+
type: Boolean,
|
|
79
|
+
default () {
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
enableActions: {
|
|
84
|
+
type: Boolean,
|
|
85
|
+
default () {
|
|
86
|
+
return false;
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
enableSelection: {
|
|
90
|
+
type: Boolean,
|
|
91
|
+
default () {
|
|
92
|
+
return true;
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
selection: {
|
|
96
|
+
type: Array,
|
|
97
|
+
default () {
|
|
98
|
+
return []
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
selectAll:{
|
|
102
|
+
type:Function,
|
|
103
|
+
},
|
|
104
|
+
deselectAll:{
|
|
105
|
+
type:Function,
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
computed: {
|
|
109
|
+
selectionHash() {
|
|
110
|
+
var self = this;
|
|
111
|
+
return self.selection.reduce(function(set, row) {
|
|
112
|
+
var id = row._id || row.id;
|
|
113
|
+
set[id] = row;
|
|
114
|
+
return set;
|
|
115
|
+
}, {})
|
|
116
|
+
},
|
|
117
|
+
pageSelected() {
|
|
118
|
+
var self = this;
|
|
119
|
+
|
|
120
|
+
if (!self.rows || !self.rows.length) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
//Check to see if any rows are not selected
|
|
125
|
+
return !self.rows.some(function(row) {
|
|
126
|
+
return !(self.selectionHash[row._id || row.id]);
|
|
127
|
+
})
|
|
128
|
+
},
|
|
129
|
+
renderColumns() {
|
|
130
|
+
return this.columns.map(function(column) {
|
|
131
|
+
|
|
132
|
+
var col = Object.assign({}, column);
|
|
133
|
+
|
|
134
|
+
col.class = [];
|
|
135
|
+
if (col.shrink) {
|
|
136
|
+
col.class.push('shrink')
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return col;
|
|
140
|
+
});
|
|
141
|
+
},
|
|
142
|
+
renderRows() {
|
|
143
|
+
return this.rows;
|
|
144
|
+
},
|
|
145
|
+
someSelectedOnPage() {
|
|
146
|
+
return this.rows.some(this.isSelected);
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
methods: {
|
|
150
|
+
|
|
151
|
+
togglePage() {
|
|
152
|
+
|
|
153
|
+
var self = this;
|
|
154
|
+
|
|
155
|
+
console.log('TOGGLE', self.pageSelected)
|
|
156
|
+
if (self.pageSelected) {
|
|
157
|
+
self.deselectPage();
|
|
158
|
+
} else {
|
|
159
|
+
self.selectPage();
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
selectPage() {
|
|
163
|
+
var self = this;
|
|
164
|
+
self.$emit('select:multiple', self.rows);
|
|
165
|
+
},
|
|
166
|
+
deselectPage() {
|
|
167
|
+
var self = this;
|
|
168
|
+
self.$emit('deselect:multiple', self.rows);
|
|
169
|
+
},
|
|
170
|
+
|
|
171
|
+
isSelected(row) {
|
|
172
|
+
|
|
173
|
+
var self = this;
|
|
174
|
+
var rowID = row._id || row.id;
|
|
175
|
+
return self.selection.some(function(r) {
|
|
176
|
+
var rid = r._id || r.id;
|
|
177
|
+
return r == row || rid == rowID;
|
|
178
|
+
});
|
|
179
|
+
},
|
|
180
|
+
classes(row) {
|
|
181
|
+
let array = [];
|
|
182
|
+
if (this.isSelected(row)) {
|
|
183
|
+
array.push('selected');
|
|
184
|
+
}
|
|
185
|
+
return array;
|
|
186
|
+
},
|
|
187
|
+
|
|
188
|
+
toggleSort(column) {
|
|
189
|
+
|
|
190
|
+
},
|
|
191
|
+
clickRow(row) {
|
|
192
|
+
this.$emit('click:row', row);
|
|
193
|
+
},
|
|
194
|
+
clickCell({ row, column }) {
|
|
195
|
+
this.$emit('click:cell', { row, column });
|
|
196
|
+
},
|
|
197
|
+
clickActions(row) {
|
|
198
|
+
this.$emit('click:actions', row);
|
|
199
|
+
},
|
|
200
|
+
clickSelect(row) {
|
|
201
|
+
this.$emit('select:row:toggle', row);
|
|
202
|
+
},
|
|
203
|
+
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
</script>
|
|
207
|
+
<style scoped lang="scss">
|
|
208
|
+
.table-wrapper {
|
|
209
|
+
// box-sizing:border-box;
|
|
210
|
+
display: flex;
|
|
211
|
+
flex: 1;
|
|
212
|
+
overflow: hidden;
|
|
213
|
+
|
|
214
|
+
.table-scroll {
|
|
215
|
+
overflow: auto;
|
|
216
|
+
position: relative;
|
|
217
|
+
width: 100%;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
:deep(table) {
|
|
223
|
+
width: 100%;
|
|
224
|
+
border-collapse: collapse;
|
|
225
|
+
|
|
226
|
+
thead {
|
|
227
|
+
th {
|
|
228
|
+
top: 0;
|
|
229
|
+
position: sticky;
|
|
230
|
+
text-transform: uppercase;
|
|
231
|
+
letter-spacing: 0.05em;
|
|
232
|
+
line-height: 20px;
|
|
233
|
+
white-space: nowrap;
|
|
234
|
+
font-size: 11px;
|
|
235
|
+
padding: 0.5em;
|
|
236
|
+
background: #fff;
|
|
237
|
+
z-index: 2;
|
|
238
|
+
text-align: left;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
border-bottom: 1px solid rgba(#000, 0.05);
|
|
242
|
+
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
th.first,
|
|
246
|
+
td.first {
|
|
247
|
+
position: sticky;
|
|
248
|
+
left: 0;
|
|
249
|
+
// z-index: 1;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
th.last,
|
|
253
|
+
td.last {
|
|
254
|
+
position: sticky;
|
|
255
|
+
right: 0;
|
|
256
|
+
// z-index: 1;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
td,
|
|
260
|
+
th {
|
|
261
|
+
padding: 0.5em;
|
|
262
|
+
|
|
263
|
+
&.shrink {
|
|
264
|
+
width: 1px;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
</style>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component v-if="component" :is="component" :column="column" :row="row" :value="value"/>
|
|
3
|
+
<td v-else class="table-cell">
|
|
4
|
+
{{value}}
|
|
5
|
+
</td>
|
|
6
|
+
</template>
|
|
7
|
+
<script>
|
|
8
|
+
|
|
9
|
+
import _get from 'lodash/get';
|
|
10
|
+
import {defineAsyncComponent} from 'vue';
|
|
11
|
+
|
|
12
|
+
import ThumbnailCell from './cells/Thumbnail.vue';
|
|
13
|
+
|
|
14
|
+
export default {
|
|
15
|
+
data() {
|
|
16
|
+
return {
|
|
17
|
+
component:null,
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
async created() {
|
|
21
|
+
var self = this;
|
|
22
|
+
|
|
23
|
+
var component;
|
|
24
|
+
|
|
25
|
+
///////////////////////////////
|
|
26
|
+
|
|
27
|
+
switch (this.column.renderer) {
|
|
28
|
+
case 'thumbnail':
|
|
29
|
+
// simple usage
|
|
30
|
+
component = ThumbnailCell;
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
///////////////////////////////
|
|
35
|
+
|
|
36
|
+
this.component = component;
|
|
37
|
+
},
|
|
38
|
+
props:{
|
|
39
|
+
column:{
|
|
40
|
+
type:Object,
|
|
41
|
+
required:true,
|
|
42
|
+
},
|
|
43
|
+
row:{
|
|
44
|
+
type:Object,
|
|
45
|
+
required:true,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
computed:{
|
|
49
|
+
renderer() {
|
|
50
|
+
return this.column.renderer;
|
|
51
|
+
},
|
|
52
|
+
value() {
|
|
53
|
+
return _get(this.row, this.column.key);
|
|
54
|
+
},
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
</script>
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
<style scoped lang="scss">
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
</style>
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<tr :class="classes" class="table-row">
|
|
3
|
+
<slot>
|
|
4
|
+
<th v-if="enableSelection" class="table-cell first shrink" @click.stop.prevent="clickSelect(row)">
|
|
5
|
+
<ux-checkbox :value="selected">
|
|
6
|
+
</ux-checkbox>
|
|
7
|
+
</th>
|
|
8
|
+
<table-cell @click.stop.prevent="clickCell(column)" :column="column" :row="row" v-for="column in columns">
|
|
9
|
+
</table-cell>
|
|
10
|
+
<th v-if="enableActions" class="table-cell last shrink" @click.stop.prevent="clickActions(row)">
|
|
11
|
+
<ux-button icon>
|
|
12
|
+
<ux-icon icon="fa-ellipsis" />
|
|
13
|
+
</ux-button>
|
|
14
|
+
</th>
|
|
15
|
+
</slot>
|
|
16
|
+
</tr>
|
|
17
|
+
</template>
|
|
18
|
+
<script>
|
|
19
|
+
import TableCell from './TableCell.vue';
|
|
20
|
+
|
|
21
|
+
export default {
|
|
22
|
+
components: {
|
|
23
|
+
TableCell,
|
|
24
|
+
},
|
|
25
|
+
props: {
|
|
26
|
+
selected: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
},
|
|
29
|
+
row: {
|
|
30
|
+
type: Object,
|
|
31
|
+
required: true,
|
|
32
|
+
},
|
|
33
|
+
columns: {
|
|
34
|
+
type: Array,
|
|
35
|
+
required: true,
|
|
36
|
+
},
|
|
37
|
+
enableActions:{
|
|
38
|
+
type:Boolean,
|
|
39
|
+
default() {
|
|
40
|
+
return false;
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
enableSelection:{
|
|
44
|
+
type:Boolean,
|
|
45
|
+
default() {
|
|
46
|
+
return true;
|
|
47
|
+
},
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
methods:{
|
|
51
|
+
clickCell(column) {
|
|
52
|
+
this.$emit('click:cell', {row:this.row, column});
|
|
53
|
+
this.$emit('click:row', this.row);
|
|
54
|
+
},
|
|
55
|
+
clickActions() {
|
|
56
|
+
this.$emit('click:actions', this.row);
|
|
57
|
+
this.$emit('click:row', this.row);
|
|
58
|
+
},
|
|
59
|
+
clickSelect() {
|
|
60
|
+
this.$emit('click:select', this.row);
|
|
61
|
+
// this.$emit('click:row', this.row);
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
computed: {
|
|
65
|
+
classes() {
|
|
66
|
+
var array = [];
|
|
67
|
+
|
|
68
|
+
if (this.selected) {
|
|
69
|
+
array.push('selected');
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return array;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
</script>
|
|
77
|
+
<style scoped lang="scss">
|
|
78
|
+
|
|
79
|
+
tr {
|
|
80
|
+
border-bottom: 1px solid rgba(#000, 0.05);
|
|
81
|
+
&:last-of-type {
|
|
82
|
+
border-bottom:none;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
tr:nth-child(odd) {
|
|
87
|
+
background: rgba(#000, 0.02);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
tr.selected {
|
|
91
|
+
background: rgba(orange, 0.1);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
</style>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<td class="table-image-cell">
|
|
3
|
+
<template v-if="type == 'image' || type == 'video'">
|
|
4
|
+
<ux-image v-model="row" :type="type" :width="50"/>
|
|
5
|
+
</template>
|
|
6
|
+
<template v-else>
|
|
7
|
+
<ux-icon icon="fa-file"/>
|
|
8
|
+
</template>
|
|
9
|
+
</td>
|
|
10
|
+
</template>
|
|
11
|
+
<script>
|
|
12
|
+
|
|
13
|
+
import TableCellMixin from './TableCellMixin.js';
|
|
14
|
+
|
|
15
|
+
export default {
|
|
16
|
+
mixins:[TableCellMixin],
|
|
17
|
+
computed:{
|
|
18
|
+
type() {
|
|
19
|
+
return this.row?.meta?.type
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
<style scoped lang="scss">
|
|
27
|
+
|
|
28
|
+
td {
|
|
29
|
+
width:60px;
|
|
30
|
+
padding:0.3em !important;
|
|
31
|
+
|
|
32
|
+
.ux-image {
|
|
33
|
+
border-radius:0.1em;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
</style>
|