@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.
@@ -222,6 +222,14 @@ export default {
222
222
  return val;
223
223
  },
224
224
  cleanOutput(val) {
225
+
226
+ if (this.type == 'reference') {
227
+ if (!this.multiValue) {
228
+ if (Array.isArray(val) && val.length) {
229
+ return val[0]
230
+ }
231
+ }
232
+ }
225
233
  return val;
226
234
  }
227
235
  },
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div class="ux-multi-group" v-if="multiValue">
3
- <panel ref="row" :key="entry" v-for="(entry, index) in model">
4
- <panel-header>
3
+ <ux-panel ref="row" :key="entry" v-for="(entry, index) in model">
4
+ <ux-panel-header>
5
5
  <flex-row>
6
6
  <flex-cell vcenter>
7
7
  <div>
@@ -9,11 +9,11 @@
9
9
  </div>
10
10
  </flex-cell>
11
11
  </flex-row>
12
- </panel-header>
13
- <panel-body>
12
+ </ux-panel-header>
13
+ <ux-panel-body>
14
14
  <ux-render :fields="fields" :flex="sameLine" :parentModel="parentModel" v-model="model[index]" />
15
- </panel-body>
16
- </panel>
15
+ </ux-panel-body>
16
+ </ux-panel>
17
17
  </div>
18
18
  <template v-else>
19
19
  <ux-render :fields="fields" :flex="sameLine" :parentModel="parentModel" v-model="model" />
@@ -9,7 +9,8 @@
9
9
  </native-select> of the following rules
10
10
  </div>
11
11
  </div>
12
- <filter-rule :enableRemove="model.filters.length > 1" :key="`rule-${index}`" @remove="removeRule(index)" :definition="definition" v-model="model.filters[index]" :index="index" v-for="(rule, index) in model.filters" />
12
+ <!-- :enableRemove="model.filters.length > 1" -->
13
+ <filter-rule enableRemove :key="`rule-${index}`" @remove="removeRule(index)" :definition="definition" v-model="model.filters[index]" :index="index" v-for="(rule, index) in model.filters" />
13
14
  <ux-button @click="addRule()">Add Filter Rule</ux-button>
14
15
  </div>
15
16
  </flex-body>
@@ -9,7 +9,12 @@
9
9
  </flex-cell>
10
10
  <flex-cell v-if="model.comparator">
11
11
  <div v-if="inputType == 'array'">
12
- <text-field :field="arrayField" v-model="model.values" />
12
+ <template v-if="hasOptions">
13
+ <native-select v-model="model.values" :field="multiOptionsField" />
14
+ </template>
15
+ <template v-else>
16
+ <text-field :field="arrayField" v-model="model.values" />
17
+ </template>
13
18
  </div>
14
19
  <div v-if="inputType == 'range'">
15
20
  <text-field :field="normalField" v-model="model.value" />
@@ -50,16 +55,20 @@
50
55
  <text-field :field="normalField" v-model="model.value" />
51
56
  </div>
52
57
  <div v-if="inputType == 'normal'">
53
- <text-field :field="normalField" v-model="model.value" />
58
+ <template v-if="hasOptions">
59
+ <native-select v-model="model.value" :field="singleOptionsField" />
60
+ </template>
61
+ <template v-else>
62
+ <text-field :field="normalField" v-model="model.value" />
63
+ </template>
54
64
  </div>
55
- <!-- <pre>{{inputType}}</pre> -->
56
- <!-- <pre>{{comparator}}</pre>
57
- <native-select v-model="model.value" :field="comparatorField">
58
- {{model.comparator || 'Select Value'}}
59
- </native-select> -->
65
+
66
+
67
+ <!-- <pre>{{field}}</pre> -->
68
+
60
69
  </flex-cell>
61
70
  <flex-cell shrink v-if="enableRemove">
62
- <ux-button icon @click="$emit('remove')">
71
+ <ux-button size="sm" icon @click="$emit('remove')">
63
72
  <ux-icon icon="fa-times" />
64
73
  </ux-button>
65
74
  </flex-cell>
@@ -112,6 +121,9 @@ export default {
112
121
  }
113
122
  },
114
123
  computed: {
124
+ hasOptions() {
125
+ return !!(this.field.options && this.field.options.length);
126
+ },
115
127
  fieldHash() {
116
128
  return this.fields.reduce(function(set, field) {
117
129
 
@@ -282,13 +294,39 @@ export default {
282
294
  placeholder: this.field.title,
283
295
  }
284
296
  },
297
+ multiOptionsField() {
298
+ return {
299
+ // title:`Select ${this.field.title}`,
300
+ options: this.field.options,
301
+ widget: 'select',
302
+ type: this.fieldType,
303
+ maximum: 0,
304
+ minimum: 1,
305
+ placeholder: this.field.title,
306
+ }
307
+ },
308
+ singleOptionsField() {
309
+ return {
310
+ title:`Select ${this.field.title}`,
311
+ options: this.field.options,
312
+ widget: 'select',
313
+ type: this.fieldType,
314
+ maximum: 1,
315
+ minimum: 0,
316
+ placeholder: this.field.title,
317
+ }
318
+ },
285
319
  normalField() {
320
+
321
+
322
+
286
323
  return {
287
324
  type: this.fieldType,
288
325
  maximum: 1,
289
326
  minimum: 1,
290
327
  placeholder: this.field.title,
291
328
  }
329
+
292
330
  },
293
331
  arrayField() {
294
332
  return {
@@ -10,7 +10,7 @@
10
10
  </div>
11
11
  </flex-cell>
12
12
  <flex-cell @click="$emit('remove')" shrink v-if="enableRemove">
13
- <ux-button icon>
13
+ <ux-button size="sm" icon>
14
14
  <ux-icon icon="fa-trash" />
15
15
  </ux-button>
16
16
  </flex-cell>
@@ -109,6 +109,8 @@ export default {
109
109
  break;
110
110
  }
111
111
  },
112
+
113
+
112
114
  fields() {
113
115
  var allFields = [...this.definition.fields];
114
116
  var definedFields = this.definition.definedFields || [];
@@ -1,5 +1,8 @@
1
1
  <template>
2
2
  <div class="ux-field" @focusin="focus" @focusout="blur" v-if="visible" :class="classes">
3
+ <template v-if="widget == 'html'">
4
+ <custom-html @touched="touch" :field="actualField" v-model="fieldModel" />
5
+ </template>
3
6
  <template v-if="widget == 'checkbox'">
4
7
  <checkbox @touched="touch" :field="actualField" v-model="fieldModel" />
5
8
  </template>
@@ -80,6 +83,7 @@ import TextField from './inputs/textfield.vue';
80
83
  import TextArea from './inputs/textarea.vue';
81
84
  import DateField from './inputs/datefield.vue';
82
85
  import Checkbox from './inputs/checkbox.vue';
86
+ import CustomHTML from './inputs/html.vue';
83
87
  import Switch from './inputs/switch.vue';
84
88
  import Upload from './inputs/upload/upload.vue';
85
89
  import FieldGroup from './inputs/group.vue';
@@ -139,6 +143,7 @@ export default {
139
143
  CurrencyField,
140
144
  TextArea,
141
145
  Checkbox,
146
+ CustomHtml:CustomHTML,
142
147
  BooleanSwitch: Switch,
143
148
  FieldGroup,
144
149
  ContentSelect,
@@ -536,6 +541,7 @@ export default {
536
541
  case 'options':
537
542
  case 'button':
538
543
  case 'type-select':
544
+ case 'html':
539
545
  break;
540
546
  case 'password':
541
547
  return 'textfield';
@@ -141,6 +141,7 @@ export default function getDefaultValue(fieldData, currentValue) {
141
141
  }
142
142
  break;
143
143
  case 'group':
144
+
144
145
  if (fieldData.asObject) {
145
146
  var number = ask;
146
147
  if (multiValue) {
@@ -205,6 +206,7 @@ export default function getDefaultValue(fieldData, currentValue) {
205
206
  }
206
207
  break;
207
208
  default:
209
+
208
210
  if (multiValue) {
209
211
  if (defaultValues.length) {
210
212
  output = defaultValues.slice(0, maximum);
@@ -1,8 +1,8 @@
1
1
  <template>
2
2
 
3
3
  <div class="ux-multi-group" v-if="multiValue">
4
- <panel ref="row" :key="entry" v-for="(entry, index) in model">
5
- <panel-header>
4
+ <ux-panel ref="row" :key="entry" v-for="(entry, index) in model">
5
+ <ux-panel-header>
6
6
  <flex-row>
7
7
  <flex-cell vcenter>
8
8
  <div>
@@ -15,11 +15,11 @@
15
15
  </ux-button>
16
16
  </flex-cell>
17
17
  </flex-row>
18
- </panel-header>
19
- <panel-body @keydown.enter="enterPress($event)">
18
+ </ux-panel-header>
19
+ <ux-panel-body @keydown.enter="enterPress($event)">
20
20
  <ux-form ref="form" @form:state="stateChange" :parentModel="parentModel" v-model="model[index]" :flex="sameLine" :fields="field.fields" />
21
- </panel-body>
22
- </panel>
21
+ </ux-panel-body>
22
+ </ux-panel>
23
23
  <ux-button v-if="canAddValue" @click="add()">{{addLabel}}
24
24
  <ux-icon icon="fa-plus" right />
25
25
  </ux-button>
@@ -0,0 +1,39 @@
1
+ <template>
2
+ <label class="ux-field-title" v-if="showLabel">{{label}} <span class="ux-required-marker" v-if="required">*</span></label>
3
+ <div class="ux-field-description" v-if="showDescription">{{description}}</div>
4
+ <div v-if="multiValue">
5
+ <flex-row class="ux-text-row">
6
+ <flex-cell>
7
+ <div v-html="field.template" :key="index" v-for="(entry, index) in model"></div>
8
+ </flex-cell>
9
+ <flex-cell shrink vcenter>
10
+ <ux-button tag="a" icon v-if="canRemoveValue" @click="remove(entry)">
11
+ <ux-icon icon="fa-times" />
12
+ </ux-button>
13
+ </flex-cell>
14
+ </flex-row>
15
+ <ux-button v-if="canAddValue" @click="add()">{{addLabel}}</ux-button>
16
+ </div>
17
+ <template v-else>
18
+ <div v-html="field.template"></div>
19
+ </template>
20
+ </template>
21
+ <script>
22
+ import InputMixin from './input-mixin';
23
+
24
+ export default {
25
+ props: {
26
+ modelValue: {
27
+ type: [String, Array],
28
+ },
29
+ },
30
+ mixins: [InputMixin],
31
+ methods: {
32
+ getNewDefaultEntry() {
33
+ return '';
34
+ },
35
+ },
36
+ }
37
+ </script>
38
+ <style lang="scss" scoped>
39
+ </style>
@@ -185,9 +185,27 @@ export default {
185
185
  position: relative;
186
186
  width:100%;
187
187
 
188
+
189
+
188
190
  & > .ux-btn {
189
191
  display: block;
192
+ position:relative;
190
193
  text-align: left;
194
+
195
+ &:after {
196
+ content:'▼';
197
+ position:absolute;
198
+ right:0;
199
+ line-height: 3.5em;
200
+ top:0;
201
+ bottom: 0;
202
+ height:100%;
203
+ font-size: 0.6em;
204
+ width:4em;
205
+ text-align: center;
206
+ opacity: 0.5;
207
+
208
+ }
191
209
  }
192
210
  }
193
211
 
@@ -30,7 +30,7 @@ export default {
30
30
  }
31
31
 
32
32
  &[gap] {
33
- gap: 0.2em;
33
+ gap: 0.4em;
34
34
  }
35
35
  }
36
36
 
@@ -10,6 +10,7 @@ export default {
10
10
  <style scoped lang="scss">
11
11
  .flex-spacer {
12
12
  padding:0.25em;
13
+ flex:1;
13
14
  }
14
15
 
15
16
 
@@ -0,0 +1,34 @@
1
+ <template>
2
+ <flex-column>
3
+
4
+ <slot/>
5
+
6
+ </flex-column>
7
+ </template>
8
+ <script>
9
+ export default {
10
+ props:{
11
+ heading:{
12
+ type:String,
13
+ required:true,
14
+ }
15
+ },
16
+ data() {
17
+ return {
18
+ isActive:false,
19
+ }
20
+ },
21
+ computed:{
22
+ active:{
23
+ get() {
24
+ return this.isActive;
25
+ },
26
+ set(a) {
27
+ this.isActive = a;
28
+ }
29
+ }
30
+ }
31
+ }
32
+ </script>
33
+ <style lang="scss" scoped>
34
+ </style>
@@ -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,30 @@
1
+
2
+ export default {
3
+ data() {
4
+ return {
5
+ scrollTop: 0,
6
+ }
7
+ },
8
+ methods: {
9
+ updateScroll(e) {
10
+ var scroller = this.$refs.scroll;
11
+ scroller = scroller.$el || scroller;
12
+ this.scrollTop = scroller.scrollTop;
13
+ },
14
+ },
15
+ mounted() {
16
+ var scroller = this.$refs.scroll;
17
+ scroller = scroller.$el || scroller;
18
+ scroller.addEventListener('scroll', this.updateScroll);
19
+ },
20
+ beforeUnmount() {
21
+ var scroller = this.$refs.scroll;
22
+ scroller = scroller.$el || scroller;
23
+ scroller.removeEventListener('scroll', this.updateScroll);
24
+ },
25
+ activated() {
26
+ var scroller = this.$refs.scroll;
27
+ scroller = scroller.$el || scroller;
28
+ scroller.scrollTop = this.scrollTop;
29
+ },
30
+ }
@@ -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:#fff;
103
+ background: #fff;
95
104
  padding: 1em;
96
105
  border-bottom: 1px solid rgba(#000, 0.1);
97
106
  }
@@ -58,7 +58,8 @@ export default {
58
58
  bottom:0;
59
59
  display: flex;
60
60
  width:100vw;
61
- height:100vh;
61
+ height: 100vh;
62
+ height: -webkit-fill-available;
62
63
  z-index: 100;
63
64
  justify-content: center;
64
65
  align-items:center;