goodteditor-ui 1.0.12 → 1.0.13

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 (75) hide show
  1. package/.eslintrc.js +7 -7
  2. package/.prettierrc +14 -14
  3. package/README.md +35 -35
  4. package/babel.config.js +5 -5
  5. package/dist/js.png +0 -0
  6. package/index.js +51 -51
  7. package/jsconfig.json +13 -13
  8. package/package.json +57 -57
  9. package/src/App.vue +36 -36
  10. package/src/components/ui/Avatar.md +68 -68
  11. package/src/components/ui/Avatar.vue +177 -177
  12. package/src/components/ui/Badge.md +20 -20
  13. package/src/components/ui/Badge.vue +75 -75
  14. package/src/components/ui/Collapse.md +90 -90
  15. package/src/components/ui/Collapse.vue +86 -86
  16. package/src/components/ui/ColorPicker/Alpha.vue +114 -114
  17. package/src/components/ui/ColorPicker/Colors.vue +117 -117
  18. package/src/components/ui/ColorPicker/Hue.vue +113 -113
  19. package/src/components/ui/ColorPicker/Preview.vue +55 -55
  20. package/src/components/ui/ColorPicker/Saturation.vue +123 -123
  21. package/src/components/ui/ColorPicker/mixin.js +105 -105
  22. package/src/components/ui/ColorPicker.md +17 -17
  23. package/src/components/ui/ColorPicker.vue +314 -314
  24. package/src/components/ui/Datalist.md +41 -41
  25. package/src/components/ui/Datalist.vue +157 -157
  26. package/src/components/ui/DatePicker.md +168 -168
  27. package/src/components/ui/DatePicker.vue +527 -527
  28. package/src/components/ui/FileSelector.md +105 -105
  29. package/src/components/ui/FileSelector.vue +82 -82
  30. package/src/components/ui/Grid.md +130 -130
  31. package/src/components/ui/Grid.vue +92 -92
  32. package/src/components/ui/Image.md +59 -59
  33. package/src/components/ui/Image.vue +57 -57
  34. package/src/components/ui/InputAutocomplete.md +115 -115
  35. package/src/components/ui/InputAutocomplete.vue +341 -341
  36. package/src/components/ui/InputColorPicker.md +51 -51
  37. package/src/components/ui/InputColorPicker.vue +151 -151
  38. package/src/components/ui/InputDatePicker.md +121 -121
  39. package/src/components/ui/InputDatePicker.vue +310 -310
  40. package/src/components/ui/InputTags.md +51 -51
  41. package/src/components/ui/InputTags.vue +184 -184
  42. package/src/components/ui/InputTimePicker.md +25 -25
  43. package/src/components/ui/InputTimePicker.vue +253 -253
  44. package/src/components/ui/InputUnits.md +20 -20
  45. package/src/components/ui/InputUnits.vue +257 -257
  46. package/src/components/ui/Lazy.md +37 -37
  47. package/src/components/ui/Lazy.vue +92 -92
  48. package/src/components/ui/Pagination.md +74 -74
  49. package/src/components/ui/Pagination.vue +138 -138
  50. package/src/components/ui/Paginator.md +34 -34
  51. package/src/components/ui/Paginator.vue +83 -83
  52. package/src/components/ui/Popover.md +34 -34
  53. package/src/components/ui/Popover.vue +258 -209
  54. package/src/components/ui/Popup.md +59 -59
  55. package/src/components/ui/Popup.vue +150 -150
  56. package/src/components/ui/ResponsiveContainer.md +58 -58
  57. package/src/components/ui/ResponsiveContainer.vue +99 -99
  58. package/src/components/ui/Select.md +187 -187
  59. package/src/components/ui/Select.vue +420 -420
  60. package/src/components/ui/TimePicker.md +50 -50
  61. package/src/components/ui/TimePicker.vue +252 -252
  62. package/src/components/ui/Tooltip.md +114 -52
  63. package/src/components/ui/Tooltip.vue +113 -113
  64. package/src/components/ui/utils/FormComponent.js +107 -107
  65. package/src/components/ui/utils/Helpers.js +84 -61
  66. package/src/components/ui/utils/WithPopover.js +99 -81
  67. package/src/main.js +8 -8
  68. package/styleguide.config.js +37 -37
  69. package/vue.config.js +8 -8
  70. package/.idea/codeStyles/Project.xml +0 -51
  71. package/.idea/codeStyles/codeStyleConfig.xml +0 -5
  72. package/.idea/goodt-ui.iml +0 -12
  73. package/.idea/inspectionProfiles/Project_Default.xml +0 -6
  74. package/.idea/modules.xml +0 -8
  75. package/.idea/vcs.xml +0 -6
@@ -1,52 +1,114 @@
1
- ```vue
2
- <template>
3
- <div class="pos-rel pad-l5">
4
- <ui-select
5
- class="pos-abs pos-top-left"
6
- v-model="position"
7
- v-bind="{ options, size: 'small' }"
8
- ></ui-select>
9
- <ui-tooltip :position="position">
10
- <template #target="{ events, binds }">
11
- <div
12
- class="pad-l2 bg-green color-white radius text-center"
13
- v-on="events"
14
- v-bind="binds"
15
- >
16
- hover me
17
- </div>
18
- </template>
19
- <div>Title</div>
20
- <div>
21
- I'm on the <code>{{ position }}</code> side
22
- </div>
23
- </ui-tooltip>
24
- </div>
25
- </template>
26
- <script>
27
- import UiSelect from './Select.vue';
28
- import UiTooltip from './Tooltip.vue';
29
- export default {
30
- components: { UiSelect, UiTooltip },
31
- data() {
32
- return {
33
- position: 'top',
34
- options: [
35
- 'left',
36
- 'left-start',
37
- 'left-end',
38
- 'top',
39
- 'top-start',
40
- 'top-end',
41
- 'bottom',
42
- 'bottom-start',
43
- 'bottom-end',
44
- 'right',
45
- 'right-start',
46
- 'right-end',
47
- ],
48
- };
49
- },
50
- };
51
- </script>
52
- ```
1
+ Simple example
2
+
3
+ ```vue
4
+ <template>
5
+ <div class="pos-rel pad-l5">
6
+ <ui-select
7
+ class="pos-abs pos-top-left"
8
+ v-model="position"
9
+ v-bind="{ options, size: 'small' }"
10
+ ></ui-select>
11
+ <ui-tooltip :position="position">
12
+ <template #target="{ events, binds }">
13
+ <div
14
+ class="pad-l2 bg-green color-white radius text-center"
15
+ v-on="events"
16
+ v-bind="binds"
17
+ >
18
+ hover me
19
+ </div>
20
+ </template>
21
+ <div>Title</div>
22
+ <div>
23
+ I'm on the <code>{{ position }}</code> side
24
+ </div>
25
+ </ui-tooltip>
26
+ </div>
27
+ </template>
28
+ <script>
29
+ import UiSelect from './Select.vue';
30
+ import UiTooltip from './Tooltip.vue';
31
+ export default {
32
+ components: { UiSelect, UiTooltip },
33
+ data() {
34
+ return {
35
+ position: 'top',
36
+ options: [
37
+ 'left',
38
+ 'left-start',
39
+ 'left-end',
40
+ 'top',
41
+ 'top-start',
42
+ 'top-end',
43
+ 'bottom',
44
+ 'bottom-start',
45
+ 'bottom-end',
46
+ 'right',
47
+ 'right-start',
48
+ 'right-end',
49
+ ],
50
+ };
51
+ },
52
+ };
53
+ </script>
54
+ ```
55
+
56
+ Advanced example. Using cursor tracking
57
+
58
+ ```vue
59
+ <template>
60
+ <div class="pos-rel pad-l5">
61
+ <ui-tooltip v-bind="options">
62
+ <template #target="{ binds }">
63
+ <div
64
+ ref="target"
65
+ class="pad-l2 bg-green color-white radius text-center"
66
+ v-bind="binds"
67
+ >
68
+ hover me
69
+ </div>
70
+ </template>
71
+ <div>
72
+ I follow the cursor everywhere
73
+ </div>
74
+ </ui-tooltip>
75
+ </div>
76
+ </template>
77
+ <script>
78
+ import UiTooltip from './Tooltip.vue';
79
+ export default {
80
+ components: { UiTooltip },
81
+ data() {
82
+ return {
83
+ options: {
84
+ show: false,
85
+ shouldFollowCursor: true,
86
+ cursorCoordinates: [0, 0]
87
+ }
88
+ };
89
+ },
90
+ mounted() {
91
+ this.$refs.target.addEventListener('mouseover', this.showTooltip);
92
+ this.$refs.target.addEventListener('mousemove', this.changeTooltipCoords);
93
+ this.$refs.target.addEventListener('mouseleave', this.hideTooltip);
94
+ },
95
+ beforeDestroy() {
96
+ this.$refs.target.removeEventListener('mouseover', this.showTooltip);
97
+ this.$refs.target.removeEventListener('mousemove', this.changeTooltipCoords);
98
+ this.$refs.target.removeEventListener('mouseleave', this.hideTooltip);
99
+
100
+ },
101
+ methods: {
102
+ showTooltip() {
103
+ this.options.show = true;
104
+ },
105
+ hideTooltip() {
106
+ this.options.show = false;
107
+ },
108
+ changeTooltipCoords({ clientX: x, clientY: y }) {
109
+ this.options.cursorCoordinates = [x, y];
110
+ }
111
+ }
112
+ };
113
+ </script>
114
+ ```
@@ -1,113 +1,113 @@
1
- <template>
2
- <div class="ui-tooltip">
3
- <slot name="target" v-bind="{ events: targetEvents, binds: targetBinds }"></slot>
4
- <ui-popover
5
- v-bind="popoverOptions"
6
- :show.sync="popoverShow"
7
- @mouseenter.native="onPopoverMouseEnter"
8
- @mouseleave.native="onPopoverMouseLeave"
9
- >
10
- <!--
11
- @slot Tooltip slot
12
- -->
13
- <slot name="tooltip">
14
- <div class="tooltip">
15
- <!--
16
- @slot Tooltip content slot
17
- -->
18
- <slot></slot>
19
- </div>
20
- </slot>
21
- </ui-popover>
22
- </div>
23
- </template>
24
- <style lang="less" scoped>
25
- .ui-tooltip {
26
- display: contents;
27
- }
28
- </style>
29
- <script>
30
- import UiPopover from './Popover.vue';
31
- import { Position } from './utils/Helpers';
32
- import WithPopover from './utils/WithPopover';
33
-
34
- export default {
35
- components: { UiPopover },
36
- mixins: [WithPopover],
37
- props: {
38
- /**
39
- * Whether to show the tooltip
40
- */
41
- show: {
42
- type: Boolean,
43
- default: false,
44
- },
45
- /**
46
- * Hide delay in ms
47
- */
48
- hideDelay: {
49
- type: Number,
50
- default: 150,
51
- },
52
- position: {
53
- type: String,
54
- default: Position.TOP,
55
- },
56
- positionOffset: {
57
- type: Array,
58
- default() {
59
- return [0, 5];
60
- },
61
- },
62
- },
63
- data() {
64
- return {
65
- targetEvents: {
66
- mouseenter: this.onTargetMouseEnter,
67
- mouseleave: this.onTargetMouseLeave,
68
- },
69
- timeout: null,
70
- };
71
- },
72
- computed: {
73
- targetBinds() {
74
- return {
75
- 'data-popover': this.popoverTargetId,
76
- };
77
- },
78
- },
79
- watch: {
80
- show: {
81
- handler(v) {
82
- this.setShow(v);
83
- },
84
- immediate: true,
85
- },
86
- },
87
- methods: {
88
- setShow(val) {
89
- const { timeout, hideDelay } = this;
90
- if (timeout) {
91
- clearTimeout(timeout);
92
- }
93
- if (val) {
94
- this.popoverShow = true;
95
- } else {
96
- this.timeout = setTimeout(() => (this.popoverShow = false), hideDelay);
97
- }
98
- },
99
- onTargetMouseEnter(e) {
100
- this.setShow(true);
101
- },
102
- onTargetMouseLeave(e) {
103
- this.setShow(false);
104
- },
105
- onPopoverMouseEnter(e) {
106
- this.setShow(true);
107
- },
108
- onPopoverMouseLeave(e) {
109
- this.setShow(false);
110
- },
111
- },
112
- };
113
- </script>
1
+ <template>
2
+ <div class="ui-tooltip">
3
+ <slot name="target" v-bind="{ events: targetEvents, binds: targetBinds }"></slot>
4
+ <ui-popover
5
+ v-bind="popoverOptions"
6
+ :show.sync="popoverShow"
7
+ @mouseenter.native="onPopoverMouseEnter"
8
+ @mouseleave.native="onPopoverMouseLeave"
9
+ >
10
+ <!--
11
+ @slot Tooltip slot
12
+ -->
13
+ <slot name="tooltip">
14
+ <div class="tooltip">
15
+ <!--
16
+ @slot Tooltip content slot
17
+ -->
18
+ <slot></slot>
19
+ </div>
20
+ </slot>
21
+ </ui-popover>
22
+ </div>
23
+ </template>
24
+ <style lang="less" scoped>
25
+ .ui-tooltip {
26
+ display: contents;
27
+ }
28
+ </style>
29
+ <script>
30
+ import UiPopover from './Popover.vue';
31
+ import { Position } from './utils/Helpers';
32
+ import WithPopover from './utils/WithPopover';
33
+
34
+ export default {
35
+ components: { UiPopover },
36
+ mixins: [WithPopover],
37
+ props: {
38
+ /**
39
+ * Whether to show the tooltip
40
+ */
41
+ show: {
42
+ type: Boolean,
43
+ default: false,
44
+ },
45
+ /**
46
+ * Hide delay in ms
47
+ */
48
+ hideDelay: {
49
+ type: Number,
50
+ default: 150,
51
+ },
52
+ position: {
53
+ type: String,
54
+ default: Position.TOP,
55
+ },
56
+ positionOffset: {
57
+ type: Array,
58
+ default() {
59
+ return [0, 5];
60
+ },
61
+ },
62
+ },
63
+ data() {
64
+ return {
65
+ targetEvents: {
66
+ mouseenter: this.onTargetMouseEnter,
67
+ mouseleave: this.onTargetMouseLeave,
68
+ },
69
+ timeout: null,
70
+ };
71
+ },
72
+ computed: {
73
+ targetBinds() {
74
+ return {
75
+ 'data-popover': this.popoverTargetId,
76
+ };
77
+ },
78
+ },
79
+ watch: {
80
+ show: {
81
+ handler(v) {
82
+ this.setShow(v);
83
+ },
84
+ immediate: true,
85
+ },
86
+ },
87
+ methods: {
88
+ setShow(val) {
89
+ const { timeout, hideDelay } = this;
90
+ if (timeout) {
91
+ clearTimeout(timeout);
92
+ }
93
+ if (val) {
94
+ this.popoverShow = true;
95
+ } else {
96
+ this.timeout = setTimeout(() => (this.popoverShow = false), hideDelay);
97
+ }
98
+ },
99
+ onTargetMouseEnter(e) {
100
+ this.setShow(true);
101
+ },
102
+ onTargetMouseLeave(e) {
103
+ this.setShow(false);
104
+ },
105
+ onPopoverMouseEnter(e) {
106
+ this.setShow(true);
107
+ },
108
+ onPopoverMouseLeave(e) {
109
+ this.setShow(false);
110
+ },
111
+ },
112
+ };
113
+ </script>
@@ -1,107 +1,107 @@
1
- const r = () =>
2
- Math.random()
3
- .toString(36)
4
- .substr(2);
5
-
6
- export default {
7
- props: {
8
- /**
9
- * @model
10
- */
11
- value: {
12
- default: '',
13
- },
14
- /**
15
- * Defines the size of the component
16
- * @values '', small, large
17
- */
18
- size: {
19
- type: String,
20
- default: '',
21
- validator: function(value) {
22
- return ['', 'small', 'large'].indexOf(value) >= 0;
23
- },
24
- },
25
- /**
26
- * Placeholder
27
- */
28
- placeholder: {
29
- type: String,
30
- default: '',
31
- },
32
- /**
33
- * Readonly
34
- */
35
- readonly: {
36
- type: Boolean,
37
- default: false,
38
- },
39
- /**
40
- * Disabled
41
- */
42
- disabled: {
43
- type: Boolean,
44
- default: false,
45
- },
46
- },
47
- data() {
48
- return {
49
- inputId: this.uid(),
50
- cssClass: {},
51
- rootHasFocus: false,
52
- };
53
- },
54
- watch: {
55
- size: {
56
- handler(val, valOld) {
57
- if (valOld) {
58
- this.$delete(this.cssClass, `form-elem-${valOld}`);
59
- }
60
- if (val) {
61
- this.$set(this.cssClass, `form-elem-${val}`, true);
62
- }
63
- },
64
- immediate: true,
65
- },
66
- readonly: {
67
- handler(val) {
68
- this.$set(this.cssClass, 'events-none', val);
69
- },
70
- immediate: true,
71
- },
72
- disabled: {
73
- handler(val) {
74
- this.$set(this.cssClass, 'disabled', val);
75
- },
76
- immediate: true,
77
- },
78
- rootHasFocus(val) {
79
- this.$set(this.cssClass, 'focus', val);
80
- },
81
- },
82
- created() {
83
- window.addEventListener('blur', this.onWinBlur);
84
- document.addEventListener('mousedown', this.onDocMouseDown);
85
- },
86
- destroyed() {
87
- window.removeEventListener('blur', this.onWinBlur);
88
- document.removeEventListener('mousedown', this.onDocMouseDown);
89
- },
90
- methods: {
91
- uid() {
92
- return `${r()}-${r()}`;
93
- },
94
- getInputRef() {
95
- return document ? document.getElementById(this.inputId) : null;
96
- },
97
- onWinBlur(e) {
98
- this.rootHasFocus = false;
99
- },
100
- onDocMouseDown(e) {
101
- if (this.$el.contains(e.target)) {
102
- return;
103
- }
104
- this.rootHasFocus = false;
105
- },
106
- },
107
- };
1
+ const r = () =>
2
+ Math.random()
3
+ .toString(36)
4
+ .substr(2);
5
+
6
+ export default {
7
+ props: {
8
+ /**
9
+ * @model
10
+ */
11
+ value: {
12
+ default: '',
13
+ },
14
+ /**
15
+ * Defines the size of the component
16
+ * @values '', small, large
17
+ */
18
+ size: {
19
+ type: String,
20
+ default: '',
21
+ validator: function(value) {
22
+ return ['', 'small', 'large'].indexOf(value) >= 0;
23
+ },
24
+ },
25
+ /**
26
+ * Placeholder
27
+ */
28
+ placeholder: {
29
+ type: String,
30
+ default: '',
31
+ },
32
+ /**
33
+ * Readonly
34
+ */
35
+ readonly: {
36
+ type: Boolean,
37
+ default: false,
38
+ },
39
+ /**
40
+ * Disabled
41
+ */
42
+ disabled: {
43
+ type: Boolean,
44
+ default: false,
45
+ },
46
+ },
47
+ data() {
48
+ return {
49
+ inputId: this.uid(),
50
+ cssClass: {},
51
+ rootHasFocus: false,
52
+ };
53
+ },
54
+ watch: {
55
+ size: {
56
+ handler(val, valOld) {
57
+ if (valOld) {
58
+ this.$delete(this.cssClass, `form-elem-${valOld}`);
59
+ }
60
+ if (val) {
61
+ this.$set(this.cssClass, `form-elem-${val}`, true);
62
+ }
63
+ },
64
+ immediate: true,
65
+ },
66
+ readonly: {
67
+ handler(val) {
68
+ this.$set(this.cssClass, 'events-none', val);
69
+ },
70
+ immediate: true,
71
+ },
72
+ disabled: {
73
+ handler(val) {
74
+ this.$set(this.cssClass, 'disabled', val);
75
+ },
76
+ immediate: true,
77
+ },
78
+ rootHasFocus(val) {
79
+ this.$set(this.cssClass, 'focus', val);
80
+ },
81
+ },
82
+ created() {
83
+ window.addEventListener('blur', this.onWinBlur);
84
+ document.addEventListener('mousedown', this.onDocMouseDown);
85
+ },
86
+ destroyed() {
87
+ window.removeEventListener('blur', this.onWinBlur);
88
+ document.removeEventListener('mousedown', this.onDocMouseDown);
89
+ },
90
+ methods: {
91
+ uid() {
92
+ return `${r()}-${r()}`;
93
+ },
94
+ getInputRef() {
95
+ return document ? document.getElementById(this.inputId) : null;
96
+ },
97
+ onWinBlur(e) {
98
+ this.rootHasFocus = false;
99
+ },
100
+ onDocMouseDown(e) {
101
+ if (this.$el.contains(e.target)) {
102
+ return;
103
+ }
104
+ this.rootHasFocus = false;
105
+ },
106
+ },
107
+ };