goodteditor-ui 1.0.75 → 2.0.0

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 (45) hide show
  1. package/.eslintrc.js +10 -8
  2. package/index.html +20 -0
  3. package/package.json +13 -33
  4. package/postcss.config.js +1 -0
  5. package/src/components/ui/Badge.vue +3 -2
  6. package/src/components/ui/ColorPicker/Alpha.vue +1 -0
  7. package/src/components/ui/ColorPicker/Colors.vue +2 -1
  8. package/src/components/ui/ColorPicker/Hue.vue +1 -0
  9. package/src/components/ui/ColorPicker/Saturation.vue +1 -0
  10. package/src/components/ui/ColorPicker.vue +5 -4
  11. package/src/components/ui/Datalist.vue +8 -7
  12. package/src/components/ui/DatePicker.vue +11 -10
  13. package/src/components/ui/FileSelector.vue +2 -1
  14. package/src/components/ui/Grid.vue +14 -9
  15. package/src/components/ui/Image.vue +4 -2
  16. package/src/components/ui/InputAutocomplete.vue +23 -22
  17. package/src/components/ui/InputColorPicker.vue +10 -9
  18. package/src/components/ui/InputDatePicker.vue +11 -10
  19. package/src/components/ui/InputTags.vue +14 -13
  20. package/src/components/ui/InputTimePicker.vue +10 -9
  21. package/src/components/ui/InputUnits.vue +5 -5
  22. package/src/components/ui/Lazy.vue +5 -4
  23. package/src/components/ui/Pagination.vue +5 -4
  24. package/src/components/ui/Paginator.vue +5 -4
  25. package/src/components/ui/Popover.vue +14 -9
  26. package/src/components/ui/Popup.vue +5 -4
  27. package/src/components/ui/ResponsiveContainer.vue +17 -10
  28. package/src/components/ui/Select.vue +19 -14
  29. package/src/components/ui/TimePicker.vue +6 -7
  30. package/src/components/ui/Tooltip.vue +4 -3
  31. package/src/components/ui/WysiwygEditor/WysiwygEditor.vue +11 -10
  32. package/src/components/ui/WysiwygEditor/extensions/font-size.js +1 -1
  33. package/src/components/ui/WysiwygEditor/extensions/formatting.js +1 -1
  34. package/src/components/ui/WysiwygEditor/renders/ColorPicker.vue +3 -3
  35. package/src/components/ui/WysiwygEditor/renders/InputAuto.vue +3 -3
  36. package/src/components/ui/WysiwygEditor/renders/InputUnits.vue +2 -2
  37. package/src/components/ui/WysiwygEditor/renders/Select.vue +2 -2
  38. package/src/components/ui/WysiwygEditor/renders/ToolbarPopover.vue +2 -2
  39. package/src/components/ui/WysiwygEditor/renders/components/Tooltip.vue +2 -1
  40. package/src/components/ui/WysiwygEditor/renders/mixins/RenderMixin.js +1 -0
  41. package/src/components/ui/utils/FormComponent.js +36 -37
  42. package/src/main.js +2 -6
  43. package/vite.config.js +6 -0
  44. package/babel.config.js +0 -5
  45. package/vue.config.js +0 -8
@@ -31,7 +31,7 @@
31
31
  size="small"
32
32
  :key="index"
33
33
  removable
34
- @click.native.stop
34
+ @click.stop
35
35
  @remove="deselectOption(option)">
36
36
  <span>{{ getOptionLabel(option) }}</span>
37
37
  </ui-badge>
@@ -92,13 +92,13 @@
92
92
  </div>
93
93
  </slot>
94
94
 
95
- <ui-popover :show.sync="popoverShow" v-bind="popoverOptions">
95
+ <ui-popover v-model:show="popoverShow" v-bind="popoverOptions">
96
96
  <ui-datalist
97
+ v-model:cursorIndex="dataListCursorIndex"
97
98
  class="w-100 pull-left"
98
- @click.native.stop
99
+ @click.stop
99
100
  @select-option="onDatalistSelectOption"
100
101
  v-bind="{ size, options, class: datalistCssClass }"
101
- :cursorIndex.sync="dataListCursorIndex"
102
102
  ref="datalist">
103
103
  <template #header>
104
104
  <!--
@@ -238,10 +238,8 @@ export default {
238
238
  /**
239
239
  * @model
240
240
  */
241
- value: {
242
- default() {
243
- return null;
244
- }
241
+ modelValue: {
242
+ default: null
245
243
  },
246
244
  /**
247
245
  * Options. Array of Objects (option objects)
@@ -300,6 +298,7 @@ export default {
300
298
  default: null
301
299
  }
302
300
  },
301
+ emits: ['change'],
303
302
  data() {
304
303
  return {
305
304
  optionsSelected: [],
@@ -308,22 +307,25 @@ export default {
308
307
  },
309
308
  computed: {
310
309
  /**
311
- * @return {object}
310
+ * @return {string[]}
312
311
  */
313
312
  cssClassExt() {
314
- let obj = { 'u-select-none': this.readonly };
315
- return { ...this.cssClass, ...obj };
313
+ const cssClass = [...this.cssClass];
314
+ if (this.readonly) {
315
+ cssClass.push('u-select-none');
316
+ }
317
+ return cssClass;
316
318
  }
317
319
  },
318
320
  watch: {
319
- value: {
321
+ modelValue: {
320
322
  handler(model) {
321
323
  this.importModel(model);
322
324
  },
323
325
  immediate: true
324
326
  },
325
327
  options() {
326
- this.importModel(this.value);
328
+ this.importModel(this.modelValue);
327
329
  }
328
330
  },
329
331
  methods: {
@@ -352,6 +354,9 @@ export default {
352
354
  if (optionsSelected.length > 0) {
353
355
  this.dataListCursorIndex = this.getOptionIndex(optionsSelected[0]);
354
356
  this.optionsSelected = this.multiple ? optionsSelected : [optionsSelected[0]];
357
+ } else {
358
+ this.dataListCursorIndex = -1;
359
+ this.optionsSelected = [];
355
360
  }
356
361
  },
357
362
  exportModel() {
@@ -370,7 +375,7 @@ export default {
370
375
  * Input event
371
376
  * @property {any} value
372
377
  */
373
- this.$emit('input', value, { cancel: rollback });
378
+ this.$emit('update:modelValue', value, { cancel: rollback });
374
379
  /**
375
380
  * Change event
376
381
  * @property {any} model
@@ -86,7 +86,7 @@
86
86
  &-datalist {
87
87
  z-index: auto;
88
88
  min-width: 3em;
89
- ::v-deep > ul {
89
+ :deep(> ul) {
90
90
  min-height: calc(
91
91
  var(--ui-time-picker-item-size) * var(--ui-time-picker-datalist-min-items)
92
92
  );
@@ -107,11 +107,9 @@ export default {
107
107
  /**
108
108
  * @model Object { h:Number, m:Number } where h stands for 'hour'; m stands for 'minute'
109
109
  */
110
- value: {
110
+ modelValue: {
111
111
  type: Object,
112
- default() {
113
- return null;
114
- },
112
+ default: null
115
113
  },
116
114
  /**
117
115
  * Hour/minute step size Object (works similar to how input step attribute works)
@@ -154,6 +152,7 @@ export default {
154
152
  },
155
153
  },
156
154
  },
155
+ emits: ['update:modelValue', 'change'],
157
156
  data() {
158
157
  return {
159
158
  h: -1,
@@ -166,7 +165,7 @@ export default {
166
165
  };
167
166
  },
168
167
  watch: {
169
- value: {
168
+ modelValue: {
170
169
  handler(val) {
171
170
  this.$nextTick(() => {
172
171
  this.m = val ? val.m : -1;
@@ -239,7 +238,7 @@ export default {
239
238
  * Input event
240
239
  * @property {Object} option
241
240
  */
242
- this.$emit('input', obj);
241
+ this.$emit('update:modelValue', obj);
243
242
  /**
244
243
  * Change event
245
244
  * @property {Object} option
@@ -8,11 +8,11 @@
8
8
  -->
9
9
  <slot name="target" v-bind="{ events: targetEvents, binds: targetBinds, visible }"></slot>
10
10
  <ui-popover
11
+ v-model:show="popoverShow"
11
12
  v-bind="popoverOptions"
12
- :show.sync="popoverShow"
13
13
  ref="popover"
14
- @mouseenter.native="onPopoverMouseEnter"
15
- @mouseleave.native="onPopoverMouseLeave"
14
+ @mouseenter="onPopoverMouseEnter"
15
+ @mouseleave="onPopoverMouseLeave"
16
16
  >
17
17
  <!--
18
18
  @slot Tooltip slot
@@ -78,6 +78,7 @@ export default {
78
78
  default: TriggerOn.MOUSE_MOVE
79
79
  }
80
80
  },
81
+ emits: ['hidden'],
81
82
  data() {
82
83
  return {
83
84
  timeout: null,
@@ -46,7 +46,7 @@
46
46
  </template>
47
47
 
48
48
  <script>
49
- import { Editor, EditorContent } from '@tiptap/vue-2';
49
+ import { Editor, EditorContent } from '@tiptap/vue-3';
50
50
 
51
51
  import { debounce } from '../utils/Helpers';
52
52
  import { resolveExtensions } from './extensions';
@@ -68,7 +68,7 @@ export default {
68
68
  /**
69
69
  * @model
70
70
  */
71
- value: {
71
+ modelValue: {
72
72
  type: String,
73
73
  default: '',
74
74
  },
@@ -122,6 +122,7 @@ export default {
122
122
  },
123
123
  },
124
124
  },
125
+ emits: ['update:modelValue', 'change'],
125
126
  data: () => ({
126
127
  /** @type {Editor} */
127
128
  editor: null,
@@ -158,7 +159,7 @@ export default {
158
159
  /**
159
160
  * @param {string} value
160
161
  */
161
- value(value) {
162
+ modelValue(value) {
162
163
  const isSame = this.content === value;
163
164
 
164
165
  if (isSame) {
@@ -182,10 +183,10 @@ export default {
182
183
  this.onSelectionUpdateDebounced = debounce(this.onSelectionUpdate, 300);
183
184
  },
184
185
  mounted() {
185
- const { $refs, value, bubbleMenu, autofocus, editorContent, editorClass, onSelectionUpdateDebounced } = this;
186
+ const { $refs, modelValue, bubbleMenu, autofocus, editorContent, editorClass, onSelectionUpdateDebounced } = this;
186
187
 
187
188
  this.editor = new Editor({
188
- content: value,
189
+ content: modelValue,
189
190
  extensions: resolveExtensions({
190
191
  ...(bubbleMenu && {
191
192
  bubbleMenu: {
@@ -210,7 +211,7 @@ export default {
210
211
  }
211
212
  },
212
213
  onBlur: () => {
213
- const isSame = this.content === this.value;
214
+ const isSame = this.content === this.modelValue;
214
215
 
215
216
  if (isSame) {
216
217
  return;
@@ -223,7 +224,7 @@ export default {
223
224
  activated() {
224
225
  this.editor.commands.focus(this.caretPosition);
225
226
  },
226
- beforeDestroy() {
227
+ beforeUnmount() {
227
228
  this.editor?.destroy();
228
229
  },
229
230
  methods: {
@@ -232,7 +233,7 @@ export default {
232
233
  * Input event
233
234
  * @property {string} value
234
235
  */
235
- this.$emit('input', this.content);
236
+ this.$emit('update:modelValue', this.content);
236
237
  },
237
238
  onChange() {
238
239
  /**
@@ -265,7 +266,7 @@ export default {
265
266
  get tools() {
266
267
  return toolGroups.flatMap(({ group }) => group);
267
268
  },
268
- change: this.change,
269
+ onChange: this.onChange,
269
270
  getImageUrl: this.getImageUrl,
270
271
  });
271
272
 
@@ -304,7 +305,7 @@ export default {
304
305
  }
305
306
  }
306
307
 
307
- ::v-deep .ProseMirror {
308
+ :deep(.ProseMirror) {
308
309
  &.focus-outline-none:focus-visible {
309
310
  outline: none;
310
311
  }
@@ -1,4 +1,4 @@
1
- import { Extension } from '@tiptap/vue-2';
1
+ import { Extension } from '@tiptap/vue-3';
2
2
  import { MarkType } from '../constants';
3
3
 
4
4
  export const FontSize = Extension.create({
@@ -1,4 +1,4 @@
1
- import { Extension } from '@tiptap/vue-2';
1
+ import { Extension } from '@tiptap/vue-3';
2
2
 
3
3
  export const Formatting = Extension.create({
4
4
  name: 'formatting',
@@ -8,8 +8,8 @@
8
8
  <i class="mdi" :class="icon"></i>
9
9
  </div>
10
10
  </button>
11
- <popover :show.sync="popoverShow" v-bind="popoverOptions">
12
- <color-picker class="pull-left" v-bind="{ value, showSubmit: true }" @submit="onSubmit" />
11
+ <popover v-model:show="popoverShow" v-bind="popoverOptions">
12
+ <color-picker class="pull-left" v-bind="{ modelValue, showSubmit: true }" @submit="onSubmit" />
13
13
  </popover>
14
14
  </div>
15
15
  </template>
@@ -30,7 +30,7 @@ export default {
30
30
  }
31
31
  },
32
32
  computed: {
33
- value() {
33
+ modelValue() {
34
34
  return this.tool.getValue();
35
35
  }
36
36
  },
@@ -2,13 +2,13 @@
2
2
  <div :title="title" class="autocomplete-tool">
3
3
  <input-autocomplete
4
4
  v-bind="{
5
- value,
5
+ modelValue,
6
6
  options: tool.options,
7
7
  disabled: !isEnabled,
8
8
  size: 'small',
9
9
  appendToBody: false
10
10
  }"
11
- @input="onInput" />
11
+ @update:modelValue="onInput" />
12
12
  </div>
13
13
  </template>
14
14
 
@@ -20,7 +20,7 @@ export default {
20
20
  components: { InputAutocomplete },
21
21
  mixins: [useRender()],
22
22
  computed: {
23
- value() {
23
+ modelValue() {
24
24
  return this.tool.getValue() ?? '';
25
25
  }
26
26
  },
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div :title="title" class="input-units-tool">
3
3
  <input-units
4
- v-bind="{ value, units, size: 'small', disabled: !isEnabled, appendToBody: false }"
4
+ v-bind="{ modelValue, units, size: 'small', disabled: !isEnabled, appendToBody: false }"
5
5
  @change="onChange" />
6
6
  </div>
7
7
  </template>
@@ -14,7 +14,7 @@ export default {
14
14
  components: { InputUnits },
15
15
  mixins: [useRender()],
16
16
  computed: {
17
- value() {
17
+ modelValue() {
18
18
  return this.tool.getValue();
19
19
  },
20
20
  units() {
@@ -2,7 +2,7 @@
2
2
  <div :title="title" class="select-tool">
3
3
  <ui-select
4
4
  v-bind="{
5
- value,
5
+ modelValue,
6
6
  options,
7
7
  valueObjects,
8
8
  disabled: !isEnabled,
@@ -22,7 +22,7 @@ export default {
22
22
  components: { UiSelect },
23
23
  mixins: [useRender()],
24
24
  computed: {
25
- value() {
25
+ modelValue() {
26
26
  return this.tool.getValue(this.options);
27
27
  },
28
28
  options() {
@@ -8,11 +8,11 @@
8
8
  <i class="mdi" :class="icon"></i>
9
9
  </div>
10
10
  </button>
11
- <popover :show.sync="popoverShow" v-bind="popoverOptions" position="bottom-end">
11
+ <popover v-model:show="popoverShow" v-bind="popoverOptions" position="bottom-end">
12
12
  <ui-datalist
13
13
  class="w-100 pull-left"
14
14
  v-bind="{ size: 'small', options: tool.options }"
15
- @click.native.stop>
15
+ @click.stop>
16
16
  <template #option="{ option, index }">
17
17
  <li :key="index" class="list-item" >
18
18
  <component :is="option.render" :tool="option" @command-executed="onCommandExecuted" />
@@ -26,6 +26,7 @@
26
26
  import Tooltip from '../../../Tooltip.vue';
27
27
 
28
28
  export default {
29
- components: { Tooltip }
29
+ components: { Tooltip },
30
+ emits: ['hidden']
30
31
  };
31
32
  </script>
@@ -7,6 +7,7 @@ export const useRender = () => ({
7
7
  default: null
8
8
  }
9
9
  },
10
+ emits: ['command-executed'],
10
11
  computed: {
11
12
  /** @return {string} */
12
13
  icon() {
@@ -5,12 +5,18 @@ const r = () =>
5
5
  .toString(36)
6
6
  .substr(2);
7
7
 
8
+ const Size = {
9
+ LARGE: { name: 'large', class: ['form-elem-large'] },
10
+ SMALL: { name: 'small', class: ['form-elem-small'] },
11
+ NORMAL: { name: 'normal', class: [] }
12
+ };
13
+
8
14
  export default {
9
15
  props: {
10
16
  /**
11
17
  * @model
12
18
  */
13
- value: {
19
+ modelValue: {
14
20
  default: '',
15
21
  },
16
22
  /**
@@ -19,10 +25,11 @@ export default {
19
25
  */
20
26
  size: {
21
27
  type: String,
22
- default: '',
23
- validator: function(value) {
24
- return ['', 'small', 'large'].indexOf(value) >= 0;
25
- },
28
+ default: Size.NORMAL.name,
29
+ validator: (val) =>
30
+ Object.values(Size)
31
+ .map(({ name }) => name)
32
+ .includes(val)
26
33
  },
27
34
  /**
28
35
  * Placeholder
@@ -46,48 +53,40 @@ export default {
46
53
  default: false,
47
54
  },
48
55
  },
56
+ emits: ['update:modelValue'],
49
57
  data() {
50
58
  return {
51
59
  inputId: this.uid(),
52
- cssClass: {},
53
60
  rootHasFocus: false,
54
61
  };
55
62
  },
56
- watch: {
57
- size: {
58
- handler(val, valOld) {
59
- if (valOld) {
60
- this.$delete(this.cssClass, `form-elem-${valOld}`);
61
- }
62
- if (val) {
63
- this.$set(this.cssClass, `form-elem-${val}`, true);
64
- }
65
- },
66
- immediate: true,
67
- },
68
- readonly: {
69
- handler(val) {
70
- this.$set(this.cssClass, 'readonly events-none', val);
71
- },
72
- immediate: true,
73
- },
74
- disabled: {
75
- handler(val) {
76
- this.$set(this.cssClass, 'disabled', val);
77
- },
78
- immediate: true,
79
- },
80
- rootHasFocus(val) {
81
- this.$set(this.cssClass, 'focus', val);
63
+ computed: {
64
+ cssClass() {
65
+ const { size, readonly, disabled, rootHasFocus } = this;
66
+ const sizeDef = Object.values(Size).find((def) => def.name === size);
67
+ const classes = [...sizeDef.class];
68
+
69
+ if (readonly) {
70
+ classes.push('events-none')
71
+ }
72
+ if (disabled) {
73
+ classes.push('disabled');
74
+ }
75
+ if (rootHasFocus) {
76
+ classes.push('focus');
77
+ }
78
+ return classes;
82
79
  },
83
80
  },
84
81
  created() {
85
- window.addEventListener('blur', this.onWinBlur);
86
- document.addEventListener('mousedown', this.onDocMouseDown);
82
+ this.controller = new AbortController();
83
+ const { signal } = this.controller;
84
+ window.addEventListener('blur', this.onWinBlur, { signal });
85
+ document.addEventListener('mousedown', this.onDocMouseDown, { signal });
87
86
  },
88
- destroyed() {
89
- window.removeEventListener('blur', this.onWinBlur);
90
- document.removeEventListener('mousedown', this.onDocMouseDown);
87
+ beforeUnmount() {
88
+ this.controller.abort();
89
+ this.controller = null;
91
90
  },
92
91
  methods: {
93
92
  uid() {
package/src/main.js CHANGED
@@ -1,4 +1,4 @@
1
- import Vue from 'vue';
1
+ import { createApp } from 'vue';
2
2
  import App from './App.vue';
3
3
 
4
4
  // css
@@ -6,8 +6,4 @@ import 'goodt-framework-css/dist/all.css';
6
6
  import '@mdi/font/css/materialdesignicons.min.css';
7
7
  import '@mdi/light-font/css/materialdesignicons-light.min.css';
8
8
 
9
- Vue.config.productionTip = false;
10
-
11
- new Vue({
12
- render: h => h(App)
13
- }).$mount('#app');
9
+ createApp(App).mount('#app');
package/vite.config.js ADDED
@@ -0,0 +1,6 @@
1
+ import { defineConfig } from 'vite';
2
+ import vue from '@vitejs/plugin-vue';
3
+
4
+ export default defineConfig({
5
+ plugins: [vue()],
6
+ });
package/babel.config.js DELETED
@@ -1,5 +0,0 @@
1
- module.exports = {
2
- presets: [
3
- '@vue/cli-plugin-babel/preset'
4
- ]
5
- }
package/vue.config.js DELETED
@@ -1,8 +0,0 @@
1
- /* eslint-disable */
2
- module.exports = {
3
- devServer: {
4
- port: 3000
5
- },
6
- filenameHashing: true,
7
- lintOnSave: false
8
- };