goodteditor-ui 1.0.26 → 1.0.28

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 (116) 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/index.js +53 -53
  6. package/jsconfig.json +13 -13
  7. package/package.json +67 -67
  8. package/src/App.vue +36 -36
  9. package/src/components/ui/Avatar.md +68 -68
  10. package/src/components/ui/Avatar.vue +180 -180
  11. package/src/components/ui/Badge.md +20 -20
  12. package/src/components/ui/Badge.vue +75 -75
  13. package/src/components/ui/Collapse.md +90 -90
  14. package/src/components/ui/Collapse.vue +86 -86
  15. package/src/components/ui/ColorPicker/Alpha.vue +114 -114
  16. package/src/components/ui/ColorPicker/Colors.vue +117 -117
  17. package/src/components/ui/ColorPicker/Hue.vue +113 -113
  18. package/src/components/ui/ColorPicker/Preview.vue +55 -55
  19. package/src/components/ui/ColorPicker/Saturation.vue +123 -123
  20. package/src/components/ui/ColorPicker/mixin.js +105 -105
  21. package/src/components/ui/ColorPicker.md +17 -17
  22. package/src/components/ui/ColorPicker.vue +314 -314
  23. package/src/components/ui/Datalist.md +41 -41
  24. package/src/components/ui/Datalist.vue +164 -164
  25. package/src/components/ui/DatePicker.md +168 -168
  26. package/src/components/ui/DatePicker.vue +527 -527
  27. package/src/components/ui/FileSelector.md +105 -105
  28. package/src/components/ui/FileSelector.vue +82 -82
  29. package/src/components/ui/Grid.md +130 -130
  30. package/src/components/ui/Grid.vue +92 -92
  31. package/src/components/ui/Image.md +59 -59
  32. package/src/components/ui/Image.vue +57 -57
  33. package/src/components/ui/InputAutocomplete.md +115 -115
  34. package/src/components/ui/InputAutocomplete.vue +374 -349
  35. package/src/components/ui/InputColorPicker.md +51 -51
  36. package/src/components/ui/InputColorPicker.vue +151 -151
  37. package/src/components/ui/InputDatePicker.md +121 -121
  38. package/src/components/ui/InputDatePicker.vue +326 -326
  39. package/src/components/ui/InputTags.md +51 -51
  40. package/src/components/ui/InputTags.vue +184 -184
  41. package/src/components/ui/InputTimePicker.md +25 -25
  42. package/src/components/ui/InputTimePicker.vue +253 -253
  43. package/src/components/ui/InputUnits.md +20 -20
  44. package/src/components/ui/InputUnits.vue +257 -257
  45. package/src/components/ui/Lazy.md +37 -37
  46. package/src/components/ui/Lazy.vue +92 -92
  47. package/src/components/ui/Pagination.md +74 -74
  48. package/src/components/ui/Pagination.vue +138 -138
  49. package/src/components/ui/Paginator.md +34 -34
  50. package/src/components/ui/Paginator.vue +83 -83
  51. package/src/components/ui/Popover.md +34 -34
  52. package/src/components/ui/Popover.vue +274 -274
  53. package/src/components/ui/Popup.md +59 -59
  54. package/src/components/ui/Popup.vue +150 -150
  55. package/src/components/ui/ResponsiveContainer.md +58 -58
  56. package/src/components/ui/ResponsiveContainer.vue +99 -99
  57. package/src/components/ui/Select.md +187 -187
  58. package/src/components/ui/Select.vue +421 -421
  59. package/src/components/ui/TimePicker.md +50 -50
  60. package/src/components/ui/TimePicker.vue +252 -252
  61. package/src/components/ui/Tooltip.md +54 -54
  62. package/src/components/ui/Tooltip.vue +113 -113
  63. package/src/components/ui/WysiwygEditor/WysiwygEditor.d.ts +128 -128
  64. package/src/components/ui/WysiwygEditor/constants.js +273 -273
  65. package/src/components/ui/WysiwygEditor/extensions/blockquote.js +15 -15
  66. package/src/components/ui/WysiwygEditor/extensions/bold.js +15 -15
  67. package/src/components/ui/WysiwygEditor/extensions/bullet-list.js +15 -15
  68. package/src/components/ui/WysiwygEditor/extensions/code-block.js +13 -13
  69. package/src/components/ui/WysiwygEditor/extensions/code.js +13 -13
  70. package/src/components/ui/WysiwygEditor/extensions/font-size.js +34 -34
  71. package/src/components/ui/WysiwygEditor/extensions/formatting.js +14 -14
  72. package/src/components/ui/WysiwygEditor/extensions/heading.js +13 -13
  73. package/src/components/ui/WysiwygEditor/extensions/horizontal-rule.js +15 -15
  74. package/src/components/ui/WysiwygEditor/extensions/image.js +37 -33
  75. package/src/components/ui/WysiwygEditor/extensions/index.d.ts +32 -32
  76. package/src/components/ui/WysiwygEditor/extensions/index.js +32 -32
  77. package/src/components/ui/WysiwygEditor/extensions/italic.js +15 -15
  78. package/src/components/ui/WysiwygEditor/extensions/link.js +16 -16
  79. package/src/components/ui/WysiwygEditor/extensions/list-item.js +15 -15
  80. package/src/components/ui/WysiwygEditor/extensions/ordered-list.js +15 -15
  81. package/src/components/ui/WysiwygEditor/extensions/paragraph.js +23 -23
  82. package/src/components/ui/WysiwygEditor/extensions/strike.js +15 -15
  83. package/src/components/ui/WysiwygEditor/extensions/table-cell.js +13 -13
  84. package/src/components/ui/WysiwygEditor/extensions/table-header.js +15 -15
  85. package/src/components/ui/WysiwygEditor/extensions/table-row.js +15 -15
  86. package/src/components/ui/WysiwygEditor/extensions/table.js +29 -29
  87. package/src/components/ui/WysiwygEditor/extensions/text-align.js +6 -6
  88. package/src/components/ui/WysiwygEditor/extensions/text-style.js +12 -12
  89. package/src/components/ui/WysiwygEditor/extensions/underline.js +15 -15
  90. package/src/components/ui/WysiwygEditor/index.d.ts +4 -4
  91. package/src/components/ui/WysiwygEditor/index.js +4 -4
  92. package/src/components/ui/WysiwygEditor/renders/Button.vue +28 -28
  93. package/src/components/ui/WysiwygEditor/renders/ColorPicker.vue +41 -41
  94. package/src/components/ui/WysiwygEditor/renders/Image.vue +200 -162
  95. package/src/components/ui/WysiwygEditor/renders/InputAuto.vue +34 -34
  96. package/src/components/ui/WysiwygEditor/renders/InputUnits.vue +37 -37
  97. package/src/components/ui/WysiwygEditor/renders/Link.vue +82 -82
  98. package/src/components/ui/WysiwygEditor/renders/Select.vue +47 -47
  99. package/src/components/ui/WysiwygEditor/renders/ToolbarPopover.vue +49 -49
  100. package/src/components/ui/WysiwygEditor/renders/components/Popover.vue +15 -0
  101. package/src/components/ui/WysiwygEditor/renders/components/WithPopover.vue +35 -35
  102. package/src/components/ui/WysiwygEditor/renders/index.d.ts +8 -8
  103. package/src/components/ui/WysiwygEditor/renders/index.js +8 -8
  104. package/src/components/ui/WysiwygEditor/renders/mixins/RenderMixin.js +39 -39
  105. package/src/components/ui/WysiwygEditor/renders/mixins/index.js +1 -1
  106. package/src/components/ui/WysiwygEditor/tools-and-commands.js +709 -702
  107. package/src/components/ui/WysiwygEditor/utils.js +72 -72
  108. package/src/components/ui/WysiwygEditor.md +18 -18
  109. package/src/components/ui/WysiwygEditor.vue +266 -266
  110. package/src/components/ui/utils/FormComponent.js +107 -107
  111. package/src/components/ui/utils/Helpers.js +84 -84
  112. package/src/components/ui/utils/WithPopover.js +81 -81
  113. package/src/main.js +8 -8
  114. package/styleguide.config.js +37 -37
  115. package/vue.config.js +8 -8
  116. package/dist/js.png +0 -0
@@ -1,180 +1,180 @@
1
- <template>
2
- <div class="ui-avatar" :style="cssStyle">
3
- <img
4
- class="ui-avatar__img"
5
- :src="src"
6
- :alt="isDoneState ? alt : ''"
7
- @error="onImageError"
8
- @load="onImageLoad"
9
- v-if="isLoadingState || isDoneState"
10
- />
11
- <div class="ui-avatar__alt" v-if="isErrorState">
12
- <!--
13
- @slot Alternative content slot (displayed if no image provided)
14
- @binding {string} alt alternative text
15
- @binding {string} abbr alternative text abbr
16
- -->
17
- <slot v-bind="{ alt, abbr }">
18
- <b class="ui-avatar__abbr">{{ abbr }}</b>
19
- </slot>
20
- </div>
21
- <div class="ui-avatar__loading" v-else-if="isLoadingState">
22
- <!--
23
- @slot Loading content slot
24
- -->
25
- <slot name="loading">
26
- <div class="preloader color-inherit"></div>
27
- </slot>
28
- </div>
29
- </div>
30
- </template>
31
- <style lang="less" scoped>
32
- .ui-avatar {
33
- --size: 2rem;
34
- --alt-scale: 0.4;
35
- position: relative;
36
- width: var(--size);
37
- height: var(--size);
38
- display: inline-flex;
39
- align-items: center;
40
- justify-content: center;
41
- overflow: hidden;
42
- &__abbr {
43
- font-size: calc(var(--size) * var(--alt-scale));
44
- line-height: 1;
45
- }
46
- &__img {
47
- width: 100%;
48
- height: 100%;
49
- object-fit: cover;
50
- }
51
- &__alt,
52
- &__loading {
53
- position: absolute;
54
- }
55
- }
56
- </style>
57
- <script>
58
- const State = {
59
- LOADING: 'loading',
60
- ERROR: 'error',
61
- DONE: 'done',
62
- };
63
- export default {
64
- props: {
65
- /**
66
- * Avatar src url
67
- */
68
- src: {
69
- type: String,
70
- default: '',
71
- },
72
- /**
73
- * Alternative text
74
- */
75
- alt: {
76
- type: String,
77
- default: '',
78
- },
79
- /**
80
- * Color (any web color format)
81
- */
82
- color: {
83
- type: String,
84
- default: '#fff',
85
- },
86
- /**
87
- * Background color (any web color format)
88
- */
89
- background: {
90
- type: String,
91
- default: '#999',
92
- },
93
- /**
94
- * Whether the avatar should be around
95
- */
96
- round: {
97
- type: Boolean,
98
- default: true,
99
- },
100
- /**
101
- * Defines avatar's size (any web size)
102
- */
103
- size: {
104
- type: String,
105
- default: '2rem',
106
- },
107
- },
108
- data: () => ({ state: State.LOADING }),
109
- computed: {
110
- /**
111
- * @return {boolean}
112
- */
113
- isLoadingState() {
114
- return this.state === State.LOADING;
115
- },
116
- /**
117
- * @return {boolean}
118
- */
119
- isErrorState() {
120
- return this.state === State.ERROR;
121
- },
122
- /**
123
- * @return {boolean}
124
- */
125
- isDoneState() {
126
- return this.state === State.DONE;
127
- },
128
- /**
129
- * @return {object}
130
- */
131
- cssClass() {
132
- return { 'ui-avatar--round': this.round };
133
- },
134
- /**
135
- * @return {object}
136
- */
137
- cssStyle() {
138
- const { size, color, round, background } = this;
139
- const borderRadius = round ? '50%' : 0;
140
- return { '--size': size, height: size, color, background, borderRadius };
141
- },
142
- /**
143
- * @return {string}
144
- */
145
- abbr() {
146
- const str = this.alt ?? '';
147
- return str
148
- .split(' ')
149
- .map(s => (s.length ? s[0].toUpperCase() : ''))
150
- .join('');
151
- },
152
- },
153
- watch: {
154
- src: {
155
- handler(val) {
156
- this.state = val ? State.LOADING : State.ERROR;
157
- },
158
- immediate: true,
159
- },
160
- },
161
- methods: {
162
- onImageError(event) {
163
- this.state = State.ERROR;
164
- /**
165
- * Error event
166
- * @property {Event} event
167
- */
168
- this.$emit('error', event);
169
- },
170
- onImageLoad(event) {
171
- this.state = State.DONE;
172
- /**
173
- * Load event
174
- * @property {Event} event
175
- */
176
- this.$emit('load', event);
177
- },
178
- },
179
- };
180
- </script>
1
+ <template>
2
+ <div class="ui-avatar" :style="cssStyle">
3
+ <img
4
+ class="ui-avatar__img"
5
+ :src="src"
6
+ :alt="isDoneState ? alt : ''"
7
+ @error="onImageError"
8
+ @load="onImageLoad"
9
+ v-if="isLoadingState || isDoneState"
10
+ />
11
+ <div class="ui-avatar__alt" v-if="isErrorState">
12
+ <!--
13
+ @slot Alternative content slot (displayed if no image provided)
14
+ @binding {string} alt alternative text
15
+ @binding {string} abbr alternative text abbr
16
+ -->
17
+ <slot v-bind="{ alt, abbr }">
18
+ <b class="ui-avatar__abbr">{{ abbr }}</b>
19
+ </slot>
20
+ </div>
21
+ <div class="ui-avatar__loading" v-else-if="isLoadingState">
22
+ <!--
23
+ @slot Loading content slot
24
+ -->
25
+ <slot name="loading">
26
+ <div class="preloader color-inherit"></div>
27
+ </slot>
28
+ </div>
29
+ </div>
30
+ </template>
31
+ <style lang="less" scoped>
32
+ .ui-avatar {
33
+ --size: 2rem;
34
+ --alt-scale: 0.4;
35
+ position: relative;
36
+ width: var(--size);
37
+ height: var(--size);
38
+ display: inline-flex;
39
+ align-items: center;
40
+ justify-content: center;
41
+ overflow: hidden;
42
+ &__abbr {
43
+ font-size: calc(var(--size) * var(--alt-scale));
44
+ line-height: 1;
45
+ }
46
+ &__img {
47
+ width: 100%;
48
+ height: 100%;
49
+ object-fit: cover;
50
+ }
51
+ &__alt,
52
+ &__loading {
53
+ position: absolute;
54
+ }
55
+ }
56
+ </style>
57
+ <script>
58
+ const State = {
59
+ LOADING: 'loading',
60
+ ERROR: 'error',
61
+ DONE: 'done',
62
+ };
63
+ export default {
64
+ props: {
65
+ /**
66
+ * Avatar src url
67
+ */
68
+ src: {
69
+ type: String,
70
+ default: '',
71
+ },
72
+ /**
73
+ * Alternative text
74
+ */
75
+ alt: {
76
+ type: String,
77
+ default: '',
78
+ },
79
+ /**
80
+ * Color (any web color format)
81
+ */
82
+ color: {
83
+ type: String,
84
+ default: '#fff',
85
+ },
86
+ /**
87
+ * Background color (any web color format)
88
+ */
89
+ background: {
90
+ type: String,
91
+ default: '#999',
92
+ },
93
+ /**
94
+ * Whether the avatar should be around
95
+ */
96
+ round: {
97
+ type: Boolean,
98
+ default: true,
99
+ },
100
+ /**
101
+ * Defines avatar's size (any web size)
102
+ */
103
+ size: {
104
+ type: String,
105
+ default: '2rem',
106
+ },
107
+ },
108
+ data: () => ({ state: State.LOADING }),
109
+ computed: {
110
+ /**
111
+ * @return {boolean}
112
+ */
113
+ isLoadingState() {
114
+ return this.state === State.LOADING;
115
+ },
116
+ /**
117
+ * @return {boolean}
118
+ */
119
+ isErrorState() {
120
+ return this.state === State.ERROR;
121
+ },
122
+ /**
123
+ * @return {boolean}
124
+ */
125
+ isDoneState() {
126
+ return this.state === State.DONE;
127
+ },
128
+ /**
129
+ * @return {object}
130
+ */
131
+ cssClass() {
132
+ return { 'ui-avatar--round': this.round };
133
+ },
134
+ /**
135
+ * @return {object}
136
+ */
137
+ cssStyle() {
138
+ const { size, color, round, background } = this;
139
+ const borderRadius = round ? '50%' : 0;
140
+ return { '--size': size, height: size, color, background, borderRadius };
141
+ },
142
+ /**
143
+ * @return {string}
144
+ */
145
+ abbr() {
146
+ const str = this.alt ?? '';
147
+ return str
148
+ .split(' ')
149
+ .map(s => (s.length ? s[0].toUpperCase() : ''))
150
+ .join('');
151
+ },
152
+ },
153
+ watch: {
154
+ src: {
155
+ handler(val) {
156
+ this.state = val ? State.LOADING : State.ERROR;
157
+ },
158
+ immediate: true,
159
+ },
160
+ },
161
+ methods: {
162
+ onImageError(event) {
163
+ this.state = State.ERROR;
164
+ /**
165
+ * Error event
166
+ * @property {Event} event
167
+ */
168
+ this.$emit('error', event);
169
+ },
170
+ onImageLoad(event) {
171
+ this.state = State.DONE;
172
+ /**
173
+ * Load event
174
+ * @property {Event} event
175
+ */
176
+ this.$emit('load', event);
177
+ },
178
+ },
179
+ };
180
+ </script>
@@ -1,20 +1,20 @@
1
- ```vue
2
- <template>
3
- <div class="pad-l5">
4
- <ui-badge>badge</ui-badge>
5
- <ui-badge theme="success" removable @remove="onRemove">badge</ui-badge>
6
- </div>
7
- </template>
8
- <script>
9
- import UiBadge from './Badge.vue';
10
-
11
- export default {
12
- components: { UiBadge },
13
- methods: {
14
- onRemove() {
15
- alert('remove badge');
16
- },
17
- },
18
- };
19
- </script>
20
- ```
1
+ ```vue
2
+ <template>
3
+ <div class="pad-l5">
4
+ <ui-badge>badge</ui-badge>
5
+ <ui-badge theme="success" removable @remove="onRemove">badge</ui-badge>
6
+ </div>
7
+ </template>
8
+ <script>
9
+ import UiBadge from './Badge.vue';
10
+
11
+ export default {
12
+ components: { UiBadge },
13
+ methods: {
14
+ onRemove() {
15
+ alert('remove badge');
16
+ },
17
+ },
18
+ };
19
+ </script>
20
+ ```
@@ -1,75 +1,75 @@
1
- <template>
2
- <div class="ui-badge badge" :class="cssClass">
3
- <!-- @slot Content slot -->
4
- <slot></slot>
5
- <!--
6
- @slot Custom 'remove' content (icon, button etc)
7
- @binding {function} remove remove function
8
- -->
9
- <slot name="remove" v-if="removable" :remove="onRemove">
10
- <i class="mdi mdi-close text-small mar-left-2 cursor-pointer" @click="onRemove"></i>
11
- </slot>
12
- </div>
13
- </template>
14
- <style lang="less" scoped>
15
- .ui-badge {
16
- white-space: normal;
17
- overflow-wrap: break-word;
18
- word-break: break-word;
19
- }
20
- </style>
21
- <script>
22
- export default {
23
- props: {
24
- /**
25
- * Size of the badge
26
- * @values '', xsmall, small, large
27
- */
28
- size: {
29
- type: String,
30
- default: '',
31
- validator(val) {
32
- return ['', 'xsmall', 'small', 'large'].indexOf(val) >= 0;
33
- },
34
- },
35
- /**
36
- * Theme of the badge
37
- * @values '', primary, success, warn, error, misc
38
- */
39
- theme: {
40
- type: String,
41
- default: '',
42
- validator(val) {
43
- return ['', 'primary', 'success', 'warn', 'error', 'misc'].indexOf(val) >= 0;
44
- },
45
- },
46
- /**
47
- * Whether the badge has a remove <slot>
48
- */
49
- removable: {
50
- type: Boolean,
51
- default: false,
52
- },
53
- },
54
- computed: {
55
- cssClass() {
56
- let o = {};
57
- if (this.size) {
58
- o[`text-${this.size}`] = true;
59
- }
60
- if (this.theme) {
61
- o[`badge-${this.theme}`] = true;
62
- }
63
- return o;
64
- },
65
- },
66
- methods: {
67
- onRemove() {
68
- /**
69
- * Remove event, emitted when close method is invoked
70
- */
71
- this.$emit('remove');
72
- },
73
- },
74
- };
75
- </script>
1
+ <template>
2
+ <div class="ui-badge badge" :class="cssClass">
3
+ <!-- @slot Content slot -->
4
+ <slot></slot>
5
+ <!--
6
+ @slot Custom 'remove' content (icon, button etc)
7
+ @binding {function} remove remove function
8
+ -->
9
+ <slot name="remove" v-if="removable" :remove="onRemove">
10
+ <i class="mdi mdi-close text-small mar-left-2 cursor-pointer" @click="onRemove"></i>
11
+ </slot>
12
+ </div>
13
+ </template>
14
+ <style lang="less" scoped>
15
+ .ui-badge {
16
+ white-space: normal;
17
+ overflow-wrap: break-word;
18
+ word-break: break-word;
19
+ }
20
+ </style>
21
+ <script>
22
+ export default {
23
+ props: {
24
+ /**
25
+ * Size of the badge
26
+ * @values '', xsmall, small, large
27
+ */
28
+ size: {
29
+ type: String,
30
+ default: '',
31
+ validator(val) {
32
+ return ['', 'xsmall', 'small', 'large'].indexOf(val) >= 0;
33
+ },
34
+ },
35
+ /**
36
+ * Theme of the badge
37
+ * @values '', primary, success, warn, error, misc
38
+ */
39
+ theme: {
40
+ type: String,
41
+ default: '',
42
+ validator(val) {
43
+ return ['', 'primary', 'success', 'warn', 'error', 'misc'].indexOf(val) >= 0;
44
+ },
45
+ },
46
+ /**
47
+ * Whether the badge has a remove <slot>
48
+ */
49
+ removable: {
50
+ type: Boolean,
51
+ default: false,
52
+ },
53
+ },
54
+ computed: {
55
+ cssClass() {
56
+ let o = {};
57
+ if (this.size) {
58
+ o[`text-${this.size}`] = true;
59
+ }
60
+ if (this.theme) {
61
+ o[`badge-${this.theme}`] = true;
62
+ }
63
+ return o;
64
+ },
65
+ },
66
+ methods: {
67
+ onRemove() {
68
+ /**
69
+ * Remove event, emitted when close method is invoked
70
+ */
71
+ this.$emit('remove');
72
+ },
73
+ },
74
+ };
75
+ </script>