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,82 +1,82 @@
1
- <template>
2
- <with-popover :show.sync="isPopoverShown">
3
- <template #button="{ togglePopover }">
4
- <button :title="title" class="btn btn-small btn-outline btn-icon" @click="togglePopover">
5
- <div class="icon">
6
- <i class="mdi" :class="icon"></i>
7
- </div>
8
- </button>
9
- </template>
10
- <div class="row row-hgap-3 mar-bot-l1">
11
- <div class="col col-vmid text-truncate">
12
- <div class="form-label form-label-xsmall text-truncate">Url</div>
13
- </div>
14
- <div class="col col-vmid col-12-12">
15
- <input-autocomplete v-model="url" class="w-100" size="small" />
16
- </div>
17
- </div>
18
- <div class="row row-hgap-3 mar-bot-l1">
19
- <div class="col col-vmid text-truncate">
20
- <div class="form-label form-label-xsmall text-truncate">Target</div>
21
- </div>
22
- <div class="col col-vmid col-12-12">
23
- <ui-select
24
- v-model="target"
25
- :options="$options.static.TargetTypeOptions"
26
- class="w-100"
27
- size="small" />
28
- </div>
29
- </div>
30
- <button class="btn btn-outline btn-small w-100" @click="execute">Применить</button>
31
- </with-popover>
32
- </template>
33
-
34
- <script>
35
- import InputAutocomplete from '../../InputAutocomplete.vue';
36
- import UiSelect from '../../Select.vue';
37
- import WithPopover from './components/WithPopover.vue';
38
- import { useRender } from './mixins';
39
-
40
- const TargetType = {
41
- BLANK: '_blank',
42
- SELF: '_self'
43
- };
44
-
45
- export default {
46
- components: {
47
- WithPopover,
48
- InputAutocomplete,
49
- UiSelect
50
- },
51
- mixins: [useRender()],
52
- data: () => ({
53
- url: '',
54
- target: null,
55
- isPopoverShown: false
56
- }),
57
- static: {
58
- TargetTypeOptions: [
59
- { label: 'blank', value: TargetType.BLANK },
60
- { label: 'self', value: TargetType.SELF }
61
- ]
62
- },
63
- watch: {
64
- isPopoverShown(isShown) {
65
- if (isShown) {
66
- const { url = '', target = TargetType.BLANK } = this.tool.getValue();
67
- this.url = url;
68
- this.target = target;
69
- }
70
- }
71
- },
72
- methods: {
73
- execute() {
74
- const { tool, url, target } = this;
75
- tool.exec({ url, target });
76
-
77
- this.isPopoverShown = false;
78
- this.emitExecuted();
79
- }
80
- }
81
- };
82
- </script>
1
+ <template>
2
+ <with-popover :show.sync="isPopoverShown">
3
+ <template #button="{ togglePopover }">
4
+ <button :title="title" class="btn btn-small btn-outline btn-icon" @click="togglePopover">
5
+ <div class="icon">
6
+ <i class="mdi" :class="icon"></i>
7
+ </div>
8
+ </button>
9
+ </template>
10
+ <div class="row row-hgap-3 mar-bot-l1">
11
+ <div class="col col-vmid text-truncate">
12
+ <div class="form-label form-label-xsmall text-truncate">Url</div>
13
+ </div>
14
+ <div class="col col-vmid col-12-12">
15
+ <input-autocomplete v-model="url" class="w-100" size="small" />
16
+ </div>
17
+ </div>
18
+ <div class="row row-hgap-3 mar-bot-l1">
19
+ <div class="col col-vmid text-truncate">
20
+ <div class="form-label form-label-xsmall text-truncate">Target</div>
21
+ </div>
22
+ <div class="col col-vmid col-12-12">
23
+ <ui-select
24
+ v-model="target"
25
+ :options="$options.static.TargetTypeOptions"
26
+ class="w-100"
27
+ size="small" />
28
+ </div>
29
+ </div>
30
+ <button class="btn btn-outline btn-small w-100" @click="execute">Применить</button>
31
+ </with-popover>
32
+ </template>
33
+
34
+ <script>
35
+ import InputAutocomplete from '../../InputAutocomplete.vue';
36
+ import UiSelect from '../../Select.vue';
37
+ import WithPopover from './components/WithPopover.vue';
38
+ import { useRender } from './mixins';
39
+
40
+ const TargetType = {
41
+ BLANK: '_blank',
42
+ SELF: '_self'
43
+ };
44
+
45
+ export default {
46
+ components: {
47
+ WithPopover,
48
+ InputAutocomplete,
49
+ UiSelect
50
+ },
51
+ mixins: [useRender()],
52
+ data: () => ({
53
+ url: '',
54
+ target: null,
55
+ isPopoverShown: false
56
+ }),
57
+ static: {
58
+ TargetTypeOptions: [
59
+ { label: 'blank', value: TargetType.BLANK },
60
+ { label: 'self', value: TargetType.SELF }
61
+ ]
62
+ },
63
+ watch: {
64
+ isPopoverShown(isShown) {
65
+ if (isShown) {
66
+ const { url = '', target = TargetType.BLANK } = this.tool.getValue();
67
+ this.url = url;
68
+ this.target = target;
69
+ }
70
+ }
71
+ },
72
+ methods: {
73
+ execute() {
74
+ const { tool, url, target } = this;
75
+ tool.exec({ url, target });
76
+
77
+ this.isPopoverShown = false;
78
+ this.emitExecuted();
79
+ }
80
+ }
81
+ };
82
+ </script>
@@ -1,47 +1,47 @@
1
- <template>
2
- <div :title="title" class="select-tool">
3
- <ui-select
4
- v-bind="{ value, options, valueObjects, disabled: !isEnabled, size: 'small' }"
5
- class="w-100"
6
- @change="onChange" />
7
- </div>
8
- </template>
9
-
10
- <script>
11
- import UiSelect from '../../Select.vue';
12
- import { useRender } from './mixins';
13
-
14
- export default {
15
- components: { UiSelect },
16
- mixins: [useRender()],
17
- computed: {
18
- value() {
19
- return this.tool.getValue(this.options);
20
- },
21
- options() {
22
- const { options = [] } = this.tool;
23
-
24
- return options.map((option) => typeof option === 'string'
25
- ? { value: option, label: option }
26
- : { value: option, label: option.title }
27
- );
28
- },
29
- valueObjects() {
30
- const [option] = this.options;
31
- return typeof option.value === 'object';
32
- }
33
- },
34
- methods: {
35
- onChange(option) {
36
- this.tool.exec(this.valueObjects ? option.value : option);
37
- this.emitExecuted();
38
- }
39
- }
40
- };
41
- </script>
42
-
43
- <style scoped>
44
- .select-tool {
45
- width: 7.5rem;
46
- }
47
- </style>
1
+ <template>
2
+ <div :title="title" class="select-tool">
3
+ <ui-select
4
+ v-bind="{ value, options, valueObjects, disabled: !isEnabled, size: 'small' }"
5
+ class="w-100"
6
+ @change="onChange" />
7
+ </div>
8
+ </template>
9
+
10
+ <script>
11
+ import UiSelect from '../../Select.vue';
12
+ import { useRender } from './mixins';
13
+
14
+ export default {
15
+ components: { UiSelect },
16
+ mixins: [useRender()],
17
+ computed: {
18
+ value() {
19
+ return this.tool.getValue(this.options);
20
+ },
21
+ options() {
22
+ const { options = [] } = this.tool;
23
+
24
+ return options.map((option) => typeof option === 'string'
25
+ ? { value: option, label: option }
26
+ : { value: option, label: option.title }
27
+ );
28
+ },
29
+ valueObjects() {
30
+ const [option] = this.options;
31
+ return typeof option.value === 'object';
32
+ }
33
+ },
34
+ methods: {
35
+ onChange(option) {
36
+ this.tool.exec(this.valueObjects ? option.value : option);
37
+ this.emitExecuted();
38
+ }
39
+ }
40
+ };
41
+ </script>
42
+
43
+ <style scoped>
44
+ .select-tool {
45
+ width: 7.5rem;
46
+ }
47
+ </style>
@@ -1,49 +1,49 @@
1
- <template>
2
- <div :data-popover="popoverTargetId" :title="title">
3
- <button
4
- class="btn btn-small btn-outline btn-icon"
5
- @click="togglePopover">
6
- <div class="icon">
7
- <i class="mdi" :class="icon"></i>
8
- </div>
9
- </button>
10
- <popover :show.sync="popoverShow" v-bind="popoverOptions">
11
- <ui-datalist
12
- class="w-100 pull-left"
13
- v-bind="{ size: 'small', options: tool.options }"
14
- @click.native.stop>
15
- <template #option="{ option, index }">
16
- <li :key="index" class="list-item" >
17
- <component :is="option.render" :tool="option" @command-executed="onCommandExecuted" />
18
- </li>
19
- </template>
20
- </ui-datalist>
21
- </popover>
22
- </div>
23
- </template>
24
-
25
- <script>
26
- import Popover from '../../Popover.vue';
27
- import UiDatalist from '../../Datalist.vue';
28
- import WithPopover from '../../utils/WithPopover';
29
- import { useRender } from './mixins';
30
-
31
- export default {
32
- components: { Popover, UiDatalist },
33
- mixins: [useRender(), WithPopover],
34
- methods: {
35
- onCommandExecuted() {
36
- this.popoverShow = false;
37
- this.emitExecuted();
38
- }
39
- }
40
- };
41
- </script>
42
-
43
- <style>
44
- .list-item {
45
- display: inline-block !important;
46
- padding: 0.25rem !important;
47
- min-height: calc(var(--line-height)*1rem);
48
- }
49
- </style>
1
+ <template>
2
+ <div :data-popover="popoverTargetId" :title="title">
3
+ <button
4
+ class="btn btn-small btn-outline btn-icon"
5
+ @click="togglePopover">
6
+ <div class="icon">
7
+ <i class="mdi" :class="icon"></i>
8
+ </div>
9
+ </button>
10
+ <popover :show.sync="popoverShow" v-bind="popoverOptions">
11
+ <ui-datalist
12
+ class="w-100 pull-left"
13
+ v-bind="{ size: 'small', options: tool.options }"
14
+ @click.native.stop>
15
+ <template #option="{ option, index }">
16
+ <li :key="index" class="list-item" >
17
+ <component :is="option.render" :tool="option" @command-executed="onCommandExecuted" />
18
+ </li>
19
+ </template>
20
+ </ui-datalist>
21
+ </popover>
22
+ </div>
23
+ </template>
24
+
25
+ <script>
26
+ import Popover from '../../Popover.vue';
27
+ import UiDatalist from '../../Datalist.vue';
28
+ import WithPopover from '../../utils/WithPopover';
29
+ import { useRender } from './mixins';
30
+
31
+ export default {
32
+ components: { Popover, UiDatalist },
33
+ mixins: [useRender(), WithPopover],
34
+ methods: {
35
+ onCommandExecuted() {
36
+ this.popoverShow = false;
37
+ this.emitExecuted();
38
+ }
39
+ }
40
+ };
41
+ </script>
42
+
43
+ <style>
44
+ .list-item {
45
+ display: inline-block !important;
46
+ padding: 0.25rem !important;
47
+ min-height: calc(var(--line-height)*1rem);
48
+ }
49
+ </style>
@@ -0,0 +1,15 @@
1
+ <script>
2
+ import Popover from '../../../Popover.vue';
3
+
4
+ export default {
5
+ extends: Popover,
6
+ methods: {
7
+ addEventListeners() {
8
+ window.addEventListener('blur', this.onWinBlur);
9
+ },
10
+ removeEventListeners() {
11
+ window.removeEventListener('blur', this.onWinBlur);
12
+ }
13
+ }
14
+ };
15
+ </script>
@@ -1,35 +1,35 @@
1
- <template>
2
- <div :data-popover="popoverTargetId">
3
- <slot name="button" v-bind="{ togglePopover }"></slot>
4
-
5
- <popover :show.sync="popoverShow" v-bind="popoverOptions">
6
- <div class="dropdown pad-l1 pad-top-l2">
7
- <div class="close pos-abs pos-top-right mar-2" @click="togglePopover">
8
- <i class="mdi mdi-close color-grey" />
9
- </div>
10
- <slot></slot>
11
- </div>
12
- </popover>
13
- </div>
14
- </template>
15
-
16
- <script>
17
- import Popover from '../../../Popover.vue';
18
- import WithPopover from '../../../utils/WithPopover';
19
-
20
- export default {
21
- components: { Popover },
22
- mixins: [WithPopover],
23
- props: {
24
- show: {
25
- type: Boolean,
26
- default: false
27
- }
28
- },
29
- watch: {
30
- popoverShow(val) {
31
- this.$nextTick(() => this.$emit('update:show', val));
32
- }
33
- }
34
- };
35
- </script>
1
+ <template>
2
+ <div :data-popover="popoverTargetId">
3
+ <slot name="button" v-bind="{ togglePopover }"></slot>
4
+
5
+ <popover :show.sync="popoverShow" v-bind="popoverOptions">
6
+ <div class="dropdown pad-l1 pad-top-l2">
7
+ <div class="close pos-abs pos-top-right mar-2" @click="togglePopover">
8
+ <i class="mdi mdi-close color-grey" />
9
+ </div>
10
+ <slot v-bind="{ togglePopover }"></slot>
11
+ </div>
12
+ </popover>
13
+ </div>
14
+ </template>
15
+
16
+ <script>
17
+ import WithPopover from '../../../utils/WithPopover';
18
+ import Popover from './Popover.vue';
19
+
20
+ export default {
21
+ components: { Popover },
22
+ mixins: [WithPopover],
23
+ props: {
24
+ show: {
25
+ type: Boolean,
26
+ default: false
27
+ }
28
+ },
29
+ watch: {
30
+ popoverShow(val) {
31
+ this.$nextTick(() => this.$emit('update:show', val));
32
+ }
33
+ }
34
+ };
35
+ </script>
@@ -1,8 +1,8 @@
1
- export { default as Button } from './Button.vue';
2
- export { default as Select } from './Select.vue';
3
- export { default as InputUnits } from './InputUnits.vue';
4
- export { default as ColorPicker } from './ColorPicker.vue';
5
- export { default as ToolbarPopover } from './ToolbarPopover.vue';
6
- export { default as InputAuto } from './InputAuto.vue';
7
- export { default as Link } from './Link.vue';
8
- export { default as Image } from './Image.vue';
1
+ export { default as Button } from './Button.vue';
2
+ export { default as Select } from './Select.vue';
3
+ export { default as InputUnits } from './InputUnits.vue';
4
+ export { default as ColorPicker } from './ColorPicker.vue';
5
+ export { default as ToolbarPopover } from './ToolbarPopover.vue';
6
+ export { default as InputAuto } from './InputAuto.vue';
7
+ export { default as Link } from './Link.vue';
8
+ export { default as Image } from './Image.vue';
@@ -1,8 +1,8 @@
1
- export { default as Button } from './Button.vue';
2
- export { default as Select } from './Select.vue';
3
- export { default as InputUnits } from './InputUnits.vue';
4
- export { default as ColorPicker } from './ColorPicker.vue';
5
- export { default as ToolbarPopover } from './ToolbarPopover.vue';
6
- export { default as InputAuto } from './InputAuto.vue';
7
- export { default as Link } from './Link.vue';
8
- export { default as Image } from './Image.vue';
1
+ export { default as Button } from './Button.vue';
2
+ export { default as Select } from './Select.vue';
3
+ export { default as InputUnits } from './InputUnits.vue';
4
+ export { default as ColorPicker } from './ColorPicker.vue';
5
+ export { default as ToolbarPopover } from './ToolbarPopover.vue';
6
+ export { default as InputAuto } from './InputAuto.vue';
7
+ export { default as Link } from './Link.vue';
8
+ export { default as Image } from './Image.vue';
@@ -1,39 +1,39 @@
1
- export const useRender = () => ({
2
- props: {
3
- tool: {
4
- type: Object,
5
- default: null
6
- }
7
- },
8
- computed: {
9
- icon() {
10
- const { tool } = this;
11
-
12
- if (tool == null) {
13
- return 'mdi-help-box';
14
- }
15
-
16
- return [null, undefined, ''].includes(tool.icon) ? 'mdi-help-box' : `mdi-${tool.icon}`;
17
- },
18
- title() {
19
- const { tool } = this;
20
-
21
- if (tool == null) {
22
- return 'Unknown tool';
23
- }
24
-
25
- return tool.title ?? tool.name ?? 'Unknown tool';
26
- },
27
- isActive() {
28
- return this.tool.isActive();
29
- },
30
- isEnabled() {
31
- return this.tool.isEnabled();
32
- }
33
- },
34
- methods: {
35
- emitExecuted() {
36
- this.$emit('command-executed');
37
- }
38
- }
39
- })
1
+ export const useRender = () => ({
2
+ props: {
3
+ tool: {
4
+ type: Object,
5
+ default: null
6
+ }
7
+ },
8
+ computed: {
9
+ icon() {
10
+ const { tool } = this;
11
+
12
+ if (tool == null) {
13
+ return 'mdi-help-box';
14
+ }
15
+
16
+ return [null, undefined, ''].includes(tool.icon) ? 'mdi-help-box' : `mdi-${tool.icon}`;
17
+ },
18
+ title() {
19
+ const { tool } = this;
20
+
21
+ if (tool == null) {
22
+ return 'Unknown tool';
23
+ }
24
+
25
+ return tool.title ?? tool.name ?? 'Unknown tool';
26
+ },
27
+ isActive() {
28
+ return this.tool.isActive();
29
+ },
30
+ isEnabled() {
31
+ return this.tool.isEnabled();
32
+ }
33
+ },
34
+ methods: {
35
+ emitExecuted() {
36
+ this.$emit('command-executed');
37
+ }
38
+ }
39
+ })
@@ -1 +1 @@
1
- export { useRender } from './RenderMixin';
1
+ export { useRender } from './RenderMixin';