goodteditor-ui 1.0.9 → 1.0.12

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/.idea/codeStyles/Project.xml +51 -0
  3. package/.idea/codeStyles/codeStyleConfig.xml +5 -0
  4. package/.idea/goodt-ui.iml +12 -0
  5. package/.idea/inspectionProfiles/Project_Default.xml +6 -0
  6. package/.idea/modules.xml +8 -0
  7. package/.idea/vcs.xml +6 -0
  8. package/.prettierrc +14 -14
  9. package/README.md +35 -35
  10. package/babel.config.js +5 -5
  11. package/index.js +51 -47
  12. package/jsconfig.json +13 -13
  13. package/package.json +57 -57
  14. package/src/App.vue +36 -36
  15. package/src/components/ui/Avatar.md +68 -0
  16. package/src/components/ui/Avatar.vue +177 -0
  17. package/src/components/ui/Badge.md +20 -20
  18. package/src/components/ui/Badge.vue +75 -75
  19. package/src/components/ui/Collapse.md +90 -90
  20. package/src/components/ui/Collapse.vue +86 -86
  21. package/src/components/ui/ColorPicker/Alpha.vue +114 -114
  22. package/src/components/ui/ColorPicker/Colors.vue +117 -117
  23. package/src/components/ui/ColorPicker/Hue.vue +113 -113
  24. package/src/components/ui/ColorPicker/Preview.vue +55 -55
  25. package/src/components/ui/ColorPicker/Saturation.vue +123 -123
  26. package/src/components/ui/ColorPicker/mixin.js +105 -105
  27. package/src/components/ui/ColorPicker.md +17 -17
  28. package/src/components/ui/ColorPicker.vue +314 -314
  29. package/src/components/ui/Datalist.md +41 -41
  30. package/src/components/ui/Datalist.vue +157 -157
  31. package/src/components/ui/DatePicker.md +168 -168
  32. package/src/components/ui/DatePicker.vue +527 -527
  33. package/src/components/ui/FileSelector.md +105 -105
  34. package/src/components/ui/FileSelector.vue +82 -82
  35. package/src/components/ui/Grid.md +130 -130
  36. package/src/components/ui/Grid.vue +92 -92
  37. package/src/components/ui/Image.md +59 -59
  38. package/src/components/ui/Image.vue +57 -57
  39. package/src/components/ui/InputAutocomplete.md +115 -115
  40. package/src/components/ui/InputAutocomplete.vue +341 -341
  41. package/src/components/ui/InputColorPicker.md +51 -51
  42. package/src/components/ui/InputColorPicker.vue +151 -151
  43. package/src/components/ui/InputDatePicker.md +121 -121
  44. package/src/components/ui/InputDatePicker.vue +310 -310
  45. package/src/components/ui/InputTags.md +51 -51
  46. package/src/components/ui/InputTags.vue +184 -184
  47. package/src/components/ui/InputTimePicker.md +25 -25
  48. package/src/components/ui/InputTimePicker.vue +253 -253
  49. package/src/components/ui/InputUnits.md +20 -20
  50. package/src/components/ui/InputUnits.vue +257 -257
  51. package/src/components/ui/Lazy.md +37 -37
  52. package/src/components/ui/Lazy.vue +92 -92
  53. package/src/components/ui/Pagination.md +74 -74
  54. package/src/components/ui/Pagination.vue +138 -138
  55. package/src/components/ui/Paginator.md +34 -34
  56. package/src/components/ui/Paginator.vue +83 -83
  57. package/src/components/ui/Popover.md +34 -34
  58. package/src/components/ui/Popover.vue +209 -209
  59. package/src/components/ui/Popup.md +59 -59
  60. package/src/components/ui/Popup.vue +150 -150
  61. package/src/components/ui/ResponsiveContainer.md +58 -0
  62. package/src/components/ui/ResponsiveContainer.vue +99 -0
  63. package/src/components/ui/Select.md +187 -187
  64. package/src/components/ui/Select.vue +420 -420
  65. package/src/components/ui/TimePicker.md +50 -50
  66. package/src/components/ui/TimePicker.vue +252 -252
  67. package/src/components/ui/Tooltip.md +52 -52
  68. package/src/components/ui/Tooltip.vue +113 -113
  69. package/src/components/ui/utils/FormComponent.js +107 -107
  70. package/src/components/ui/utils/Helpers.js +61 -61
  71. package/src/components/ui/utils/WithPopover.js +81 -81
  72. package/src/main.js +8 -8
  73. package/styleguide.config.js +37 -37
  74. package/vue.config.js +8 -8
  75. package/dist/js.png +0 -0
@@ -1,86 +1,86 @@
1
- <template>
2
- <div class="ui-collapse">
3
- <!--
4
- @slot Heading slot contains <mark>header</mark>, <mark>icon-open</mark>, <mark>icon-close</mark> slots
5
- @binding {boolean} isOpen open flag
6
- @binding {function} toggle function which toggles the visibility of the content
7
- -->
8
- <slot name="heading" v-bind="{ isOpen: show, toggle }">
9
- <div class="row row-collapse u-select-none">
10
- <div class="col col-vmid">
11
- <!--
12
- @slot Header content
13
- @binding {function} toggle function which toggles the visibility of the content
14
- -->
15
- <slot name="header" :toggle="toggle">
16
- <span class="cursor-pointer u-select-none text-bold" @click="toggle">
17
- Header
18
- </span>
19
- </slot>
20
- </div>
21
- <div class="col col-auto col-vmid" v-if="icon">
22
- <div class="cursor-pointer" @click="toggle">
23
- <!--
24
- @slot Custom slot for the 'open' state
25
- -->
26
- <slot name="icon-open" v-if="show">
27
- <div class="icon">
28
- <i class="color-primary mdil mdil-24px mdil-minus"></i>
29
- </div>
30
- </slot>
31
- <!--
32
- @slot Custom slot for the 'close' state
33
- -->
34
- <slot name="icon-close" v-else>
35
- <div class="icon">
36
- <i class="color-primary mdil mdil-24px mdil-plus"></i>
37
- </div>
38
- </slot>
39
- </div>
40
- </div>
41
- </div>
42
- </slot>
43
- <!--
44
- @slot Content
45
- -->
46
- <slot v-if="show">Content</slot>
47
- </div>
48
- </template>
49
- <script>
50
- export default {
51
- props: {
52
- /**
53
- * Whether the content is visible
54
- */
55
- visible: {
56
- type: Boolean,
57
- default: false,
58
- },
59
- /**
60
- * Whether the icons are visible
61
- */
62
- icon: {
63
- type: Boolean,
64
- default: true,
65
- },
66
- },
67
- data() {
68
- return {
69
- show: false,
70
- };
71
- },
72
- watch: {
73
- visible: {
74
- handler(val) {
75
- this.show = val;
76
- },
77
- immediate: true,
78
- },
79
- },
80
- methods: {
81
- toggle() {
82
- this.show = !this.show;
83
- },
84
- },
85
- };
86
- </script>
1
+ <template>
2
+ <div class="ui-collapse">
3
+ <!--
4
+ @slot Heading slot contains <mark>header</mark>, <mark>icon-open</mark>, <mark>icon-close</mark> slots
5
+ @binding {boolean} isOpen open flag
6
+ @binding {function} toggle function which toggles the visibility of the content
7
+ -->
8
+ <slot name="heading" v-bind="{ isOpen: show, toggle }">
9
+ <div class="row row-collapse u-select-none">
10
+ <div class="col col-vmid">
11
+ <!--
12
+ @slot Header content
13
+ @binding {function} toggle function which toggles the visibility of the content
14
+ -->
15
+ <slot name="header" :toggle="toggle">
16
+ <span class="cursor-pointer u-select-none text-bold" @click="toggle">
17
+ Header
18
+ </span>
19
+ </slot>
20
+ </div>
21
+ <div class="col col-auto col-vmid" v-if="icon">
22
+ <div class="cursor-pointer" @click="toggle">
23
+ <!--
24
+ @slot Custom slot for the 'open' state
25
+ -->
26
+ <slot name="icon-open" v-if="show">
27
+ <div class="icon">
28
+ <i class="color-primary mdil mdil-24px mdil-minus"></i>
29
+ </div>
30
+ </slot>
31
+ <!--
32
+ @slot Custom slot for the 'close' state
33
+ -->
34
+ <slot name="icon-close" v-else>
35
+ <div class="icon">
36
+ <i class="color-primary mdil mdil-24px mdil-plus"></i>
37
+ </div>
38
+ </slot>
39
+ </div>
40
+ </div>
41
+ </div>
42
+ </slot>
43
+ <!--
44
+ @slot Content
45
+ -->
46
+ <slot v-if="show">Content</slot>
47
+ </div>
48
+ </template>
49
+ <script>
50
+ export default {
51
+ props: {
52
+ /**
53
+ * Whether the content is visible
54
+ */
55
+ visible: {
56
+ type: Boolean,
57
+ default: false,
58
+ },
59
+ /**
60
+ * Whether the icons are visible
61
+ */
62
+ icon: {
63
+ type: Boolean,
64
+ default: true,
65
+ },
66
+ },
67
+ data() {
68
+ return {
69
+ show: false,
70
+ };
71
+ },
72
+ watch: {
73
+ visible: {
74
+ handler(val) {
75
+ this.show = val;
76
+ },
77
+ immediate: true,
78
+ },
79
+ },
80
+ methods: {
81
+ toggle() {
82
+ this.show = !this.show;
83
+ },
84
+ },
85
+ };
86
+ </script>
@@ -1,114 +1,114 @@
1
- <template>
2
- <div class="ui-color-picker-color-alpha" @mousedown.prevent.stop="selectAlpha">
3
- <canvas ref="canvasAlpha" />
4
- <div :style="slideAlphaStyle" class="slide" />
5
- </div>
6
- </template>
7
- <style lang="less" scoped>
8
- .ui-color-picker-color-alpha {
9
- position: relative;
10
- cursor: pointer;
11
- .slide {
12
- position: absolute;
13
- left: 0;
14
- top: 100px;
15
- width: 100%;
16
- height: 4px;
17
- background: #fff;
18
- box-shadow: 0 0 1px 0 rgba(0, 0, 0, 0.3);
19
- pointer-events: none;
20
- }
21
- }
22
- </style>
23
- <script>
24
- import mixin from './mixin';
25
- export default {
26
- mixins: [mixin],
27
- props: {
28
- color: {
29
- type: String,
30
- default: '#000000',
31
- },
32
- rgba: {
33
- type: Object,
34
- default: null,
35
- },
36
- width: {
37
- type: Number,
38
- default: 15,
39
- },
40
- height: {
41
- type: Number,
42
- default: 152,
43
- },
44
- },
45
- data() {
46
- return {
47
- slideAlphaStyle: {},
48
- alphaSize: 5,
49
- };
50
- },
51
- watch: {
52
- color() {
53
- this.renderColor();
54
- },
55
- 'rgba.a'() {
56
- this.renderSlide();
57
- },
58
- },
59
- mounted() {
60
- this.renderColor();
61
- this.renderSlide();
62
- },
63
- methods: {
64
- renderColor() {
65
- const canvas = this.$refs.canvasAlpha;
66
- const width = this.width;
67
- const height = this.height;
68
- const size = this.alphaSize;
69
- const canvasSquare = this.createAlphaSquare(size);
70
-
71
- const ctx = canvas.getContext('2d');
72
- canvas.width = width;
73
- canvas.height = height;
74
-
75
- ctx.fillStyle = ctx.createPattern(canvasSquare, 'repeat');
76
- ctx.fillRect(0, 0, width, height);
77
-
78
- this.createLinearGradient('p', ctx, width, height, 'rgba(255,255,255,0)', this.color);
79
- },
80
- renderSlide() {
81
- this.slideAlphaStyle = {
82
- top: this.rgba.a * this.height - 2 + 'px',
83
- };
84
- },
85
- selectAlpha(e) {
86
- const { top: hueTop } = this.$el.getBoundingClientRect();
87
-
88
- const mousemove = e => {
89
- let y = e.clientY - hueTop;
90
-
91
- if (y < 0) {
92
- y = 0;
93
- }
94
- if (y > this.height) {
95
- y = this.height;
96
- }
97
-
98
- let a = parseFloat((y / this.height).toFixed(2));
99
- this.$emit('selectAlpha', a);
100
- };
101
-
102
- mousemove(e);
103
-
104
- const mouseup = () => {
105
- document.removeEventListener('mousemove', mousemove);
106
- document.removeEventListener('mouseup', mouseup);
107
- };
108
-
109
- document.addEventListener('mousemove', mousemove);
110
- document.addEventListener('mouseup', mouseup);
111
- },
112
- },
113
- };
114
- </script>
1
+ <template>
2
+ <div class="ui-color-picker-color-alpha" @mousedown.prevent.stop="selectAlpha">
3
+ <canvas ref="canvasAlpha" />
4
+ <div :style="slideAlphaStyle" class="slide" />
5
+ </div>
6
+ </template>
7
+ <style lang="less" scoped>
8
+ .ui-color-picker-color-alpha {
9
+ position: relative;
10
+ cursor: pointer;
11
+ .slide {
12
+ position: absolute;
13
+ left: 0;
14
+ top: 100px;
15
+ width: 100%;
16
+ height: 4px;
17
+ background: #fff;
18
+ box-shadow: 0 0 1px 0 rgba(0, 0, 0, 0.3);
19
+ pointer-events: none;
20
+ }
21
+ }
22
+ </style>
23
+ <script>
24
+ import mixin from './mixin';
25
+ export default {
26
+ mixins: [mixin],
27
+ props: {
28
+ color: {
29
+ type: String,
30
+ default: '#000000',
31
+ },
32
+ rgba: {
33
+ type: Object,
34
+ default: null,
35
+ },
36
+ width: {
37
+ type: Number,
38
+ default: 15,
39
+ },
40
+ height: {
41
+ type: Number,
42
+ default: 152,
43
+ },
44
+ },
45
+ data() {
46
+ return {
47
+ slideAlphaStyle: {},
48
+ alphaSize: 5,
49
+ };
50
+ },
51
+ watch: {
52
+ color() {
53
+ this.renderColor();
54
+ },
55
+ 'rgba.a'() {
56
+ this.renderSlide();
57
+ },
58
+ },
59
+ mounted() {
60
+ this.renderColor();
61
+ this.renderSlide();
62
+ },
63
+ methods: {
64
+ renderColor() {
65
+ const canvas = this.$refs.canvasAlpha;
66
+ const width = this.width;
67
+ const height = this.height;
68
+ const size = this.alphaSize;
69
+ const canvasSquare = this.createAlphaSquare(size);
70
+
71
+ const ctx = canvas.getContext('2d');
72
+ canvas.width = width;
73
+ canvas.height = height;
74
+
75
+ ctx.fillStyle = ctx.createPattern(canvasSquare, 'repeat');
76
+ ctx.fillRect(0, 0, width, height);
77
+
78
+ this.createLinearGradient('p', ctx, width, height, 'rgba(255,255,255,0)', this.color);
79
+ },
80
+ renderSlide() {
81
+ this.slideAlphaStyle = {
82
+ top: this.rgba.a * this.height - 2 + 'px',
83
+ };
84
+ },
85
+ selectAlpha(e) {
86
+ const { top: hueTop } = this.$el.getBoundingClientRect();
87
+
88
+ const mousemove = e => {
89
+ let y = e.clientY - hueTop;
90
+
91
+ if (y < 0) {
92
+ y = 0;
93
+ }
94
+ if (y > this.height) {
95
+ y = this.height;
96
+ }
97
+
98
+ let a = parseFloat((y / this.height).toFixed(2));
99
+ this.$emit('selectAlpha', a);
100
+ };
101
+
102
+ mousemove(e);
103
+
104
+ const mouseup = () => {
105
+ document.removeEventListener('mousemove', mousemove);
106
+ document.removeEventListener('mouseup', mouseup);
107
+ };
108
+
109
+ document.addEventListener('mousemove', mousemove);
110
+ document.addEventListener('mouseup', mouseup);
111
+ },
112
+ },
113
+ };
114
+ </script>
@@ -1,117 +1,117 @@
1
- <template>
2
- <div class="ui-color-picker-colors">
3
- <div class="colors">
4
- <div
5
- class="item shadow"
6
- v-for="item in colorsDefault"
7
- :key="item"
8
- @click="selectColor(item)"
9
- >
10
- <div
11
- class="alpha"
12
- :style="{ background: `url(${imgAlphaBase64})` }"
13
- />
14
- <div class="color" :style="{ background: item }" />
15
- </div>
16
- </div>
17
- <template v-if="colorsHistory.length">
18
- <hr class="mar-top-3 mar-bot-3" />
19
- <div class="colors">
20
- <div
21
- class="item shadow"
22
- v-for="item in colorsHistory"
23
- :key="item"
24
- @click="selectColor(item)"
25
- >
26
- <div
27
- class="alpha"
28
- :style="{ background: `url(${imgAlphaBase64})` }"
29
- />
30
- <div class="color" :style="{ background: item }" />
31
- </div>
32
- </div>
33
- </template>
34
- </div>
35
- </template>
36
- <style lang="less" scoped>
37
- .colors {
38
- display: grid;
39
- gap: 0.25em;
40
- grid-template-columns: repeat(auto-fill, minmax(1em, 1fr));
41
-
42
- .item {
43
- position: relative;
44
- width: 100%;
45
- height: 1em;
46
- transition: all 0.1s;
47
- cursor: pointer;
48
- &:hover {
49
- transform: scale(1.25);
50
- }
51
- .alpha,
52
- .color {
53
- height: 100%;
54
- }
55
- .alpha {
56
- position: absolute;
57
- }
58
- .color {
59
- position: relative;
60
- }
61
- }
62
- }
63
- </style>
64
- <script>
65
- import mixin from './mixin';
66
- export default {
67
- mixins: [mixin],
68
- props: {
69
- color: {
70
- type: String,
71
- default: '#000000'
72
- },
73
- colorsDefault: {
74
- type: Array,
75
- default: () => []
76
- },
77
- colorsHistoryKey: {
78
- type: String,
79
- default: ''
80
- }
81
- },
82
- data() {
83
- return {
84
- imgAlphaBase64: '',
85
- colorsHistory:
86
- JSON.parse(localStorage.getItem(this.colorsHistoryKey)) || []
87
- };
88
- },
89
- created() {
90
- this.imgAlphaBase64 = this.createAlphaSquare(4).toDataURL();
91
- },
92
- destroyed() {
93
- this.setColorsHistory(this.color);
94
- },
95
- methods: {
96
- selectColor(color) {
97
- this.$emit('selectColor', color);
98
- },
99
- setColorsHistory(color) {
100
- if (!color) {
101
- return;
102
- }
103
- const colors = this.colorsHistory;
104
- const index = colors.indexOf(color);
105
- if (index >= 0) {
106
- colors.splice(index, 1);
107
- }
108
- if (colors.length >= 8) {
109
- colors.length = 7;
110
- }
111
- colors.unshift(color);
112
- this.colorsHistory = colors;
113
- localStorage.setItem(this.colorsHistoryKey, JSON.stringify(colors));
114
- }
115
- }
116
- };
117
- </script>
1
+ <template>
2
+ <div class="ui-color-picker-colors">
3
+ <div class="colors">
4
+ <div
5
+ class="item shadow"
6
+ v-for="item in colorsDefault"
7
+ :key="item"
8
+ @click="selectColor(item)"
9
+ >
10
+ <div
11
+ class="alpha"
12
+ :style="{ background: `url(${imgAlphaBase64})` }"
13
+ />
14
+ <div class="color" :style="{ background: item }" />
15
+ </div>
16
+ </div>
17
+ <template v-if="colorsHistory.length">
18
+ <hr class="mar-top-3 mar-bot-3" />
19
+ <div class="colors">
20
+ <div
21
+ class="item shadow"
22
+ v-for="item in colorsHistory"
23
+ :key="item"
24
+ @click="selectColor(item)"
25
+ >
26
+ <div
27
+ class="alpha"
28
+ :style="{ background: `url(${imgAlphaBase64})` }"
29
+ />
30
+ <div class="color" :style="{ background: item }" />
31
+ </div>
32
+ </div>
33
+ </template>
34
+ </div>
35
+ </template>
36
+ <style lang="less" scoped>
37
+ .colors {
38
+ display: grid;
39
+ gap: 0.25em;
40
+ grid-template-columns: repeat(auto-fill, minmax(1em, 1fr));
41
+
42
+ .item {
43
+ position: relative;
44
+ width: 100%;
45
+ height: 1em;
46
+ transition: all 0.1s;
47
+ cursor: pointer;
48
+ &:hover {
49
+ transform: scale(1.25);
50
+ }
51
+ .alpha,
52
+ .color {
53
+ height: 100%;
54
+ }
55
+ .alpha {
56
+ position: absolute;
57
+ }
58
+ .color {
59
+ position: relative;
60
+ }
61
+ }
62
+ }
63
+ </style>
64
+ <script>
65
+ import mixin from './mixin';
66
+ export default {
67
+ mixins: [mixin],
68
+ props: {
69
+ color: {
70
+ type: String,
71
+ default: '#000000'
72
+ },
73
+ colorsDefault: {
74
+ type: Array,
75
+ default: () => []
76
+ },
77
+ colorsHistoryKey: {
78
+ type: String,
79
+ default: ''
80
+ }
81
+ },
82
+ data() {
83
+ return {
84
+ imgAlphaBase64: '',
85
+ colorsHistory:
86
+ JSON.parse(localStorage.getItem(this.colorsHistoryKey)) || []
87
+ };
88
+ },
89
+ created() {
90
+ this.imgAlphaBase64 = this.createAlphaSquare(4).toDataURL();
91
+ },
92
+ destroyed() {
93
+ this.setColorsHistory(this.color);
94
+ },
95
+ methods: {
96
+ selectColor(color) {
97
+ this.$emit('selectColor', color);
98
+ },
99
+ setColorsHistory(color) {
100
+ if (!color) {
101
+ return;
102
+ }
103
+ const colors = this.colorsHistory;
104
+ const index = colors.indexOf(color);
105
+ if (index >= 0) {
106
+ colors.splice(index, 1);
107
+ }
108
+ if (colors.length >= 8) {
109
+ colors.length = 7;
110
+ }
111
+ colors.unshift(color);
112
+ this.colorsHistory = colors;
113
+ localStorage.setItem(this.colorsHistoryKey, JSON.stringify(colors));
114
+ }
115
+ }
116
+ };
117
+ </script>