@qikdev/vue-ui 0.1.2 → 0.1.8

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.
Files changed (92) hide show
  1. package/README.md +4 -89
  2. package/dist/favicon.ico +0 -0
  3. package/dist/index.css +1 -0
  4. package/dist/lib.es.js +17802 -0
  5. package/dist/lib.es.js.map +1 -0
  6. package/dist/lib.umd.js +9 -0
  7. package/dist/lib.umd.js.map +1 -0
  8. package/package.json +31 -24
  9. package/.gitlab-ci.yml +0 -13
  10. package/jsdoc.conf +0 -10
  11. package/src/components.js +0 -255
  12. package/src/content/browser.vue +0 -842
  13. package/src/content/item.vue +0 -48
  14. package/src/content/render/field.vue +0 -431
  15. package/src/content/render/group.vue +0 -65
  16. package/src/content/render/render-mixin.js +0 -101
  17. package/src/content/render/render.vue +0 -86
  18. package/src/filter/FilterBuilder.vue +0 -145
  19. package/src/filter/FilterCondition.vue +0 -373
  20. package/src/filter/FilterRule.vue +0 -259
  21. package/src/form/expressions/index.js +0 -83
  22. package/src/form/field.vue +0 -640
  23. package/src/form/form.vue +0 -280
  24. package/src/form/getDefaultValue.js +0 -226
  25. package/src/form/inputs/button-select.vue +0 -208
  26. package/src/form/inputs/checkbox.vue +0 -91
  27. package/src/form/inputs/content-select.vue +0 -187
  28. package/src/form/inputs/currency.vue +0 -205
  29. package/src/form/inputs/datefield.vue +0 -132
  30. package/src/form/inputs/group.vue +0 -155
  31. package/src/form/inputs/html.vue +0 -39
  32. package/src/form/inputs/input-mixin.js +0 -440
  33. package/src/form/inputs/native-select-old.vue +0 -43
  34. package/src/form/inputs/object-field.vue +0 -50
  35. package/src/form/inputs/option.vue +0 -19
  36. package/src/form/inputs/options-manager.vue +0 -244
  37. package/src/form/inputs/phone-number-input.vue +0 -235
  38. package/src/form/inputs/search.vue +0 -117
  39. package/src/form/inputs/select.vue +0 -229
  40. package/src/form/inputs/switch.vue +0 -87
  41. package/src/form/inputs/textarea.vue +0 -80
  42. package/src/form/inputs/textfield.vue +0 -185
  43. package/src/form/inputs/timezone.vue +0 -642
  44. package/src/form/inputs/type-select.vue +0 -247
  45. package/src/form/inputs/upload/filedrop.vue +0 -72
  46. package/src/form/inputs/upload/upload.vue +0 -323
  47. package/src/form/parseBoolean.js +0 -24
  48. package/src/layout/flex-body.vue +0 -23
  49. package/src/layout/flex-cell.vue +0 -45
  50. package/src/layout/flex-column.vue +0 -31
  51. package/src/layout/flex-footer.vue +0 -14
  52. package/src/layout/flex-header.vue +0 -14
  53. package/src/layout/flex-row.vue +0 -39
  54. package/src/layout/flex-spacer.vue +0 -18
  55. package/src/layout/panel-body.vue +0 -13
  56. package/src/layout/panel-footer.vue +0 -20
  57. package/src/layout/panel-header.vue +0 -20
  58. package/src/layout/panel.vue +0 -23
  59. package/src/layout/tab.vue +0 -34
  60. package/src/layout/tabset.vue +0 -72
  61. package/src/mixins/RememberScroll.js +0 -30
  62. package/src/modal/ConfirmModal.vue +0 -50
  63. package/src/modal/ContentModal.vue +0 -107
  64. package/src/modal/Modal.vue +0 -86
  65. package/src/modal/ModalMixin.js +0 -21
  66. package/src/modal/OptionsModal.vue +0 -31
  67. package/src/modal/PromptModal.vue +0 -31
  68. package/src/services/device.js +0 -211
  69. package/src/services/selection.js +0 -165
  70. package/src/table/Table.vue +0 -316
  71. package/src/table/TableCell.vue +0 -113
  72. package/src/table/TableRow.vue +0 -82
  73. package/src/table/cells/Button.vue +0 -56
  74. package/src/table/cells/TableCellMixin.js +0 -15
  75. package/src/table/cells/Thumbnail.vue +0 -39
  76. package/src/table/cells/Value.vue +0 -46
  77. package/src/ui/button.vue +0 -255
  78. package/src/ui/checkbox.vue +0 -79
  79. package/src/ui/icon.vue +0 -57
  80. package/src/ui/image.vue +0 -158
  81. package/src/ui/link.vue +0 -62
  82. package/src/ui/list-item.vue +0 -22
  83. package/src/ui/list.vue +0 -26
  84. package/src/ui/menu.vue +0 -147
  85. package/src/ui/pager.vue +0 -156
  86. package/src/ui/progressbar.vue +0 -77
  87. package/src/ui/spinner.vue +0 -26
  88. package/src/ui/switch.vue +0 -89
  89. package/src/version.js +0 -1
  90. package/test/index.spec.js +0 -42
  91. package/test/mocha.opts +0 -0
  92. package/yarn-error.log +0 -2923
@@ -1,640 +0,0 @@
1
- <template>
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>
6
- <template v-if="widget == 'checkbox'">
7
- <checkbox @touched="touch" :field="actualField" v-model="fieldModel" />
8
- </template>
9
- <template v-if="widget == 'switch'">
10
- <boolean-switch @touched="touch" :field="actualField" v-model="fieldModel" />
11
- </template>
12
- <template v-if="widget == 'upload'">
13
- <upload @touched="touch" :field="actualField" v-model="fieldModel" />
14
- </template>
15
- <template v-if="widget == 'group'">
16
- <template v-if="asObject">
17
- <field-group @form:state="groupStateAltered" ref="group" @touched="touch" :field="actualField" :parentModel="parentModel" v-model="fieldModel" />
18
- </template>
19
- <template v-else>
20
- <field-group @form:state="groupStateAltered" ref="group" @touched="touch" :field="actualField" :parentModel="parentModel" v-model="sourceModel" />
21
- </template>
22
- </template>
23
- <template v-if="widget == 'select'">
24
- <native-select @touched="touch" :field="actualField" v-model="fieldModel" />
25
- </template>
26
- <template v-if="widget == 'button'">
27
- <button-select @touched="touch" :field="actualField" v-model="fieldModel" />
28
- </template>
29
- <template v-if="widget == 'textfield'">
30
- <text-field @touched="touch" :field="actualField" v-model="fieldModel" />
31
- </template>
32
- <template v-if="widget == 'currency'">
33
- <currency-field @touched="touch" :field="actualField" v-model="fieldModel" />
34
- </template>
35
- <template v-if="widget == 'datefield'">
36
- <date-field @touched="touch" :field="actualField" v-model="fieldModel" />
37
- </template>
38
- <template v-if="widget == 'content-select'">
39
- <content-select @touched="touch" :field="actualField" v-model="fieldModel" />
40
- </template>
41
-
42
- <template v-if="widget == 'type-select'">
43
- <type-select @touched="touch" :field="actualField" v-model="fieldModel" />
44
- </template>
45
- <template v-if="widget == 'richtext'">
46
- <text-area @touched="touch" :field="actualField" v-model="fieldModel" />
47
- </template>
48
- <template v-if="widget == 'textarea'">
49
- <text-area @touched="touch" :field="actualField" v-model="fieldModel" />
50
- </template>
51
- <template v-if="widget == 'timezone'">
52
- <timezone-select @touched="touch" :field="actualField" v-model="fieldModel" />
53
- </template>
54
- <template v-if="widget == 'phone'">
55
- <phone-number-input @touched="touch" :field="actualField" v-model="fieldModel" />
56
- </template>
57
- <template v-if="widget == 'value'">
58
- </template>
59
- <template v-if="widget == 'object'">
60
- <object-field @touched="touch" :field="actualField" v-model="fieldModel" />
61
- </template>
62
- <template v-if="widget == 'options'">
63
- <options-manager @touched="touch" :field="actualField" v-model="fieldModel" />
64
- </template>
65
- <div v-if="error && validateResults.message" class="ux-field-message">
66
- {{validateResults.message}}
67
- </div>
68
- <!-- <pre>Has Data: {{hasData}}</pre>
69
- <pre>Dirty: {{dirty}}</pre>
70
- <pre>Dirty Before: {{isDirtyBeforeInput}}</pre>
71
- <pre>Touched: {{touched}}</pre>
72
- <pre>DEFAULT VALUE: {{fieldDefaultValue}}</pre> -->
73
- </div>
74
- </template>
75
- <script>
76
- //Inputs
77
- import PhoneNumberInput from './inputs/phone-number-input.vue';
78
- import TimezoneSelect from './inputs/timezone.vue';
79
- import ContentSelect from './inputs/content-select.vue';
80
- import TypeSelect from './inputs/type-select.vue';
81
- import CurrencyField from './inputs/currency.vue';
82
- import TextField from './inputs/textfield.vue';
83
- import TextArea from './inputs/textarea.vue';
84
- import DateField from './inputs/datefield.vue';
85
- import Checkbox from './inputs/checkbox.vue';
86
- import CustomHTML from './inputs/html.vue';
87
- import Switch from './inputs/switch.vue';
88
- import Upload from './inputs/upload/upload.vue';
89
- import FieldGroup from './inputs/group.vue';
90
- import NativeSelect from './inputs/select.vue';
91
- import ButtonSelect from './inputs/button-select.vue';
92
- import ObjectField from './inputs/object-field.vue';
93
- import OptionsManager from './inputs/options-manager.vue';
94
-
95
- ////////////////
96
-
97
- import Expressions from './expressions';
98
- import getDefaultValue from './getDefaultValue';
99
- import parseBoolean from './parseBoolean';
100
-
101
- ////////////////////////////////////////
102
-
103
- function hasExpression(key) {
104
- return function() {
105
- var self = this;
106
- if (!self.expressions) {
107
- return;
108
- }
109
-
110
- let expression = self.expressions[key];
111
- if (expression) {
112
- return true;
113
- }
114
- }
115
- }
116
-
117
- ////////////////////////////////////////
118
-
119
- function computedExpression(key) {
120
- return function() {
121
- var self = this;
122
- if (!self.expressions) {
123
- return;
124
- }
125
-
126
- let expression = self.expressions[key];
127
- if (!expression) {
128
- return;
129
- }
130
-
131
- let context = self.expressionsContext;
132
- return Expressions.evaluateExpression(expression, context);
133
- }
134
- }
135
-
136
-
137
- export default {
138
- components: {
139
- ButtonSelect,
140
- NativeSelect,
141
- DateField,
142
- TextField,
143
- CurrencyField,
144
- TextArea,
145
- Checkbox,
146
- CustomHtml:CustomHTML,
147
- BooleanSwitch: Switch,
148
- FieldGroup,
149
- ContentSelect,
150
- TypeSelect,
151
- TimezoneSelect,
152
- PhoneNumberInput,
153
- Upload,
154
- ObjectField,
155
- OptionsManager,
156
- },
157
- props: {
158
- field: {
159
- type: Object,
160
- required: true,
161
- },
162
- parentModel: {
163
- type: Object,
164
- },
165
- modelValue: {
166
- type: Object,
167
- required: true,
168
- },
169
- },
170
- data() {
171
-
172
-
173
- return {
174
- defaultValue: null,
175
- model: this.modelValue,
176
- touched: false,
177
- focussed: false,
178
- validateResults: { valid: true },
179
- mounted: false,
180
- subFormState: {},
181
- isDirty: false,
182
- isDirtyBeforeInput: false,
183
- }
184
- },
185
-
186
- created() {
187
- this.checkDirtyState();
188
- },
189
- mounted() {
190
- this.mounted = true;
191
- },
192
- beforeUnmount() {
193
- this.mounted = false;
194
- },
195
- methods: {
196
- checkDirtyState() {
197
-
198
- //What is the value for this field right now?
199
- var existingData = this.fieldModel;
200
- var proposedDefaultValue = this.fieldDefaultValue;
201
-
202
- ///////////////////////////////////////////
203
-
204
- var existingString = JSON.stringify(this.cleanOutput(existingData));
205
- var proposedString = JSON.stringify(this.cleanOutput(proposedDefaultValue));
206
-
207
- //We already have data
208
-
209
-
210
- if (existingData && (existingString != proposedString)) {
211
- this.isDirty = true;
212
- this.isDirtyBeforeInput = true;
213
- //May as well put it in anyway so it can clean itself if need be
214
- this.fieldModel = existingData;
215
- } else {
216
- //The field is untouched
217
- this.isDirty = false;
218
- this.isDirtyBeforeInput = false;
219
-
220
- //Use the default
221
- this.fieldModel = proposedDefaultValue;
222
- }
223
-
224
- // ///////////////////////////////////////////
225
-
226
- // var defaultValue = currentValue || proposedDefaultValue
227
- // if (!currentValue) {
228
- // currentValue = defaultValue;
229
- // }
230
-
231
- // ///////////////////////////////////////////
232
-
233
- // this.fieldModel = currentValue;
234
-
235
- },
236
- groupStateAltered(details) {
237
- this.subFormState = details;
238
- },
239
- focus() {
240
- this.focussed = true;
241
- },
242
- blur() {
243
- this.focussed = false;
244
- if (this.expressions && this.expressions.value) {
245
- //Reset the value after we blur out
246
- this.fieldModel = this.getExpressionValue;
247
- }
248
- },
249
- reset() {
250
- // var defaultValue = this.expressions && this.expressions.defaultValue ? this.getExpressionDefaultValue : getDefaultValue(this.actualField);
251
- // this.fieldModel = defaultValue;
252
- this.touched = false;
253
- },
254
- touch() {
255
- this.touched = true;
256
- },
257
- cleanInput(val) {
258
- return val;
259
- },
260
- cleanOutput(val) {
261
- return val;
262
- }
263
- },
264
- watch: {
265
- mounted(val) {
266
- if (val) {
267
- this.$emit('field:mount', this);
268
- } else {
269
- this.$emit('field:unmount', this);
270
- }
271
- },
272
- visible(now) {
273
- //Remove and clear all data
274
- if (!now) {
275
- this.touched = false;
276
- if (this.expressions && this.expressions.value) {
277
- this.fieldModel = this.getExpressionValue
278
- } else {
279
- this.fieldModel = undefined;
280
- }
281
-
282
- } else {
283
- this.reset();
284
- }
285
-
286
- },
287
- focussed(val) {
288
- if (val) {
289
- this.$emit('field:focus', this);
290
- } else {
291
- this.$emit('field:blur', this);
292
- }
293
- },
294
- invalid(val) {
295
- this.$emit('field:invalid', this);
296
- },
297
- valid(val) {
298
- this.$emit('field:valid', this);
299
- },
300
- error(val) {
301
- this.$emit('field:error', this);
302
- },
303
- touched(val) {
304
- this.$emit('field:touched', this);
305
- },
306
- dirty(val) {
307
- this.$emit('field:dirty', this);
308
- },
309
- changeString(v) {
310
- this.validateResults = this.$qik.content.validateField(this.fieldModel, this.actualField);
311
- },
312
- modelValue(val, old) {
313
- this.model = val;
314
- this.touched = false;
315
- this.checkDirtyState();
316
- },
317
- getExpressionHide(result) {
318
-
319
- },
320
- getExpressionDefaultValue(result) {
321
-
322
- //If this already had data, or has been touched and now has data
323
- if (this.isDirtyBeforeInput || (this.touched && this.dirty)) {
324
- //Don't update it
325
- } else {
326
- this.fieldModel = result;
327
- }
328
-
329
- },
330
- getExpressionValue(result) {
331
- this.fieldModel = result;
332
- },
333
- },
334
- computed: {
335
- fieldDefaultValue() {
336
- return this.cleanInput(this.expressions && this.expressions.defaultValue ? this.getExpressionDefaultValue : getDefaultValue(this.actualField));
337
- },
338
- title() {
339
- return this.field.title;
340
- },
341
- actualField() {
342
-
343
- var field = this.field;
344
- if (this.getExpressionRequired) {
345
- return Object.assign({}, field, { minimum: 1 });
346
- }
347
-
348
- return field;
349
- },
350
- changeString() {
351
- return `${JSON.stringify(this.fieldModel)}-${this.actualField.minimum}`;
352
- },
353
- valid() {
354
- return !this.invalid;
355
- },
356
- error() {
357
- return !this.focussed && this.touched && this.invalid;
358
- },
359
- invalid() {
360
- //Check the subform
361
- var invalidSubForm = this.subFormState && this.subFormState.invalid;
362
- if (invalidSubForm) {
363
-
364
- return { invalidSubForm: this.subFormState, mounted: this.mounted };
365
- }
366
-
367
- //Check if our validator says this field is valid
368
- var isInvalid = !this.validateResults.valid;
369
- // if (isInvalid) {
370
-
371
- // }
372
-
373
-
374
-
375
- return isInvalid;
376
- },
377
- dirty() {
378
-
379
- return this.isDirty;
380
-
381
- },
382
- hasData() {
383
-
384
- if (typeof this.fieldModel === 'undefined') {
385
- return false;
386
- }
387
-
388
- if (this.multiValue) {
389
- if (!this.fieldModel || !this.fieldModel.length) {
390
- return false;
391
- }
392
- }
393
-
394
- if (this.fieldModel == '') {
395
- return false;
396
- }
397
-
398
- // if (this.hasExpressionDefaultValue) {
399
- // return this.touched && (this.fieldModel != this.getExpressionDefaultValue);
400
- // }
401
-
402
- return true;
403
- },
404
- getExpressionHide() {
405
- if (!this.expressions) {
406
- return;
407
- }
408
-
409
- let showExpression = this.expressions.show;
410
- let hideExpression = this.expressions.hide;
411
- let context = this.expressionsContext;
412
-
413
- if (showExpression) {
414
- return !!!Expressions.evaluateExpression(showExpression, context);
415
- } else if (hideExpression) {
416
- return Expressions.evaluateExpression(hideExpression, context);
417
- }
418
- },
419
- getExpressionRequired: computedExpression('required'),
420
- getExpressionDefaultValue: computedExpression('defaultValue'),
421
- getExpressionValue: computedExpression('value'),
422
- hasExpressionDefaultValue: hasExpression('defaultValue'),
423
- expressions() {
424
- return this.field.expressions;
425
- },
426
- expressionsContext() {
427
- return {
428
- this: this.model,
429
- model: this.model,
430
- data: this.parentModel,
431
- }
432
- },
433
- hidden() {
434
- if (this.actualField.readOnly) {
435
- return true;
436
- }
437
- return this.getExpressionHide;
438
- },
439
- visible() {
440
- return this.mounted && !this.hidden;
441
- },
442
- type() {
443
- return this.actualField.type || 'string';
444
- },
445
- key() {
446
- return this.actualField.key;
447
- },
448
- isGroup() {
449
- return this.type === 'group'
450
- },
451
- asObject() {
452
- return this.isGroup && this.actualField.asObject;
453
- },
454
- layoutGroup() {
455
- return this.isGroup && !this.actualField.asObject;
456
- },
457
- fieldModel: {
458
- get() {
459
- return this.cleanOutput(this.model[this.key]);
460
- },
461
- set(value) {
462
-
463
- var cleaned = this.cleanInput(value);
464
-
465
- if (this.model[this.key] != cleaned) {
466
- this.model[this.key] = cleaned
467
- this.isDirty = true;
468
- this.$emit('update:modelValue', this.model);
469
- }
470
- }
471
- },
472
- sourceModel: {
473
- get() {
474
- return this.model;
475
- },
476
- set(value) {
477
- this.model = value;
478
- this.$emit('update:modelValue', this.model);
479
- }
480
- },
481
- classes() {
482
- var array = [];
483
- array.push(`ux-field-${this.type}`)
484
-
485
- if (this.layoutGroup) {
486
- array.push('ux-layout-only');
487
- }
488
-
489
- if (this.touched) {
490
- array.push('ux-field-touched');
491
- }
492
-
493
- if (this.dirty) {
494
- array.push('ux-field-dirty');
495
- }
496
-
497
- if (this.valid) {
498
- array.push('ux-field-valid');
499
- }
500
-
501
- if (this.invalid) {
502
- array.push('ux-field-invalid');
503
- }
504
-
505
- if (this.error) {
506
- array.push('ux-field-error');
507
- }
508
-
509
- return array;
510
- },
511
- widget() {
512
-
513
- //We're a group
514
- if (this.type == 'group') {
515
- return this.type;
516
- }
517
-
518
- //Get the widget
519
- var widget = this.actualField.widget;
520
-
521
- ///////////////////////////////
522
-
523
-
524
- ///////////////////////////////
525
-
526
- switch (widget) {
527
- case 'content-select':
528
- case 'select':
529
- case 'checkbox':
530
- case 'datefield':
531
- case 'richtext':
532
- case 'textarea':
533
- case 'switch':
534
- case 'email':
535
- case 'url':
536
- case 'currency':
537
- case 'timezone':
538
- case 'country':
539
- case 'typeselect':
540
- case 'upload':
541
- case 'options':
542
- case 'button':
543
- case 'type-select':
544
- case 'html':
545
- break;
546
- case 'password':
547
- return 'textfield';
548
- break;
549
- case 'phone':
550
- case 'phonenumber':
551
- return 'phone'
552
- break;
553
-
554
- default:
555
- switch (this.type) {
556
- case 'date':
557
- widget = 'datefield';
558
- break;
559
- case 'reference':
560
- widget = 'content-select';
561
- break;
562
- case 'boolean':
563
- widget = 'checkbox';
564
- break;
565
- default:
566
- case 'string':
567
- widget = 'textfield';
568
- break;
569
- case 'object':
570
- widget = 'object';
571
- break;
572
- }
573
- break;
574
- }
575
-
576
- return widget;
577
-
578
- },
579
- },
580
-
581
- }
582
- </script>
583
- <style lang="scss" scoped>
584
- .ux-field {
585
- margin-bottom: 1.5em;
586
-
587
- &.ux-layout-only {
588
- margin-bottom: 0;
589
- }
590
-
591
- .ux-field-message {
592
- border: red;
593
- background: rgba(red, 0.1);
594
- color: red;
595
- font-size: 0.7em;
596
- padding: 0.3em 0.5em;
597
- border-radius: 0 1em 1em;
598
- margin: 0.3em 0;
599
- display: inline-block;
600
- }
601
-
602
- // &.ux-field-error {
603
- // .ux-field-message {
604
- // visibility: visible;
605
- // }
606
- // }
607
-
608
-
609
-
610
- }
611
-
612
-
613
-
614
- :deep(.ux-field-title) {
615
- // .ux-field-title {
616
- margin-top: 0.5em;
617
- display: block;
618
- margin-bottom: 0.2em;
619
- font-size: 0.9em;
620
- font-weight: bold;
621
- }
622
-
623
-
624
- :deep(.ux-field-description) {
625
- // .ux-field-description {
626
-
627
- font-size: clamp(12px, 0.8em, 16px);
628
- opacity: 0.5;
629
- margin-bottom: 0.5em;
630
-
631
- }
632
-
633
- .ux-field.ux-field-error> :deep(.ux-field-title) {
634
- color: red;
635
- }
636
-
637
- :deep(.ux-form-flex .ux-field-description) {
638
- // min-height: 2.6em;
639
- }
640
- </style>