evui 3.4.206 → 3.4.208

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 (162) hide show
  1. package/README.md +18 -33
  2. package/dist/404.html +44 -0
  3. package/dist/favicon.ico +0 -0
  4. package/dist/index.js +22645 -0
  5. package/dist/index.umd.cjs +28 -0
  6. package/dist/style.css +1 -0
  7. package/package.json +46 -43
  8. package/dist/evui.common.js +0 -63678
  9. package/dist/evui.common.js.map +0 -1
  10. package/dist/evui.umd.js +0 -63688
  11. package/dist/evui.umd.js.map +0 -1
  12. package/dist/evui.umd.min.js +0 -2
  13. package/dist/evui.umd.min.js.map +0 -1
  14. package/dist/img/EVUI.b82ee81a.svg +0 -293
  15. package/src/assets/logo.png +0 -0
  16. package/src/common/emitter.js +0 -20
  17. package/src/common/utils.bignumber.js +0 -67
  18. package/src/common/utils.debounce.js +0 -223
  19. package/src/common/utils.js +0 -151
  20. package/src/common/utils.table.js +0 -78
  21. package/src/common/utils.throttle.js +0 -83
  22. package/src/common/utils.tree.js +0 -18
  23. package/src/components/button/Button.vue +0 -195
  24. package/src/components/button/index.js +0 -7
  25. package/src/components/buttonGroup/ButtonGroup.vue +0 -11
  26. package/src/components/buttonGroup/index.js +0 -7
  27. package/src/components/calendar/Calendar.vue +0 -725
  28. package/src/components/calendar/index.js +0 -7
  29. package/src/components/calendar/uses.js +0 -1410
  30. package/src/components/chart/Chart.vue +0 -363
  31. package/src/components/chart/ChartToolbar.vue +0 -52
  32. package/src/components/chart/chart.core.js +0 -1170
  33. package/src/components/chart/chartZoom.core.js +0 -540
  34. package/src/components/chart/element/element.bar.js +0 -672
  35. package/src/components/chart/element/element.bar.time.js +0 -166
  36. package/src/components/chart/element/element.heatmap.js +0 -743
  37. package/src/components/chart/element/element.line.js +0 -611
  38. package/src/components/chart/element/element.pie.js +0 -197
  39. package/src/components/chart/element/element.scatter.js +0 -320
  40. package/src/components/chart/element/element.tip.js +0 -717
  41. package/src/components/chart/helpers/helpers.canvas.js +0 -265
  42. package/src/components/chart/helpers/helpers.constant.js +0 -235
  43. package/src/components/chart/helpers/helpers.util.js +0 -400
  44. package/src/components/chart/index.js +0 -9
  45. package/src/components/chart/model/index.js +0 -50
  46. package/src/components/chart/model/model.series.js +0 -125
  47. package/src/components/chart/model/model.store.js +0 -1427
  48. package/src/components/chart/plugins/plugins.interaction.js +0 -1655
  49. package/src/components/chart/plugins/plugins.legend.gradient.js +0 -606
  50. package/src/components/chart/plugins/plugins.legend.js +0 -1543
  51. package/src/components/chart/plugins/plugins.pie.js +0 -254
  52. package/src/components/chart/plugins/plugins.scrollbar.js +0 -732
  53. package/src/components/chart/plugins/plugins.title.js +0 -61
  54. package/src/components/chart/plugins/plugins.tooltip.js +0 -1041
  55. package/src/components/chart/scale/scale.js +0 -951
  56. package/src/components/chart/scale/scale.linear.js +0 -268
  57. package/src/components/chart/scale/scale.logarithmic.js +0 -135
  58. package/src/components/chart/scale/scale.step.js +0 -430
  59. package/src/components/chart/scale/scale.time.category.js +0 -338
  60. package/src/components/chart/scale/scale.time.js +0 -49
  61. package/src/components/chart/style/chart.scss +0 -405
  62. package/src/components/chart/uses.js +0 -721
  63. package/src/components/chartBrush/ChartBrush.vue +0 -323
  64. package/src/components/chartBrush/chartBrush.core.js +0 -691
  65. package/src/components/chartBrush/index.js +0 -9
  66. package/src/components/chartBrush/uses.js +0 -23
  67. package/src/components/chartGroup/ChartGroup.vue +0 -144
  68. package/src/components/chartGroup/index.js +0 -9
  69. package/src/components/chartGroup/style/chartGroup.scss +0 -5
  70. package/src/components/chartGroup/uses.js +0 -53
  71. package/src/components/checkbox/Checkbox.vue +0 -229
  72. package/src/components/checkbox/index.js +0 -7
  73. package/src/components/checkboxGroup/CheckboxGroup.vue +0 -44
  74. package/src/components/checkboxGroup/index.js +0 -7
  75. package/src/components/contextMenu/ContextMenu.vue +0 -95
  76. package/src/components/contextMenu/MenuList.vue +0 -182
  77. package/src/components/contextMenu/index.js +0 -7
  78. package/src/components/contextMenu/uses.js +0 -223
  79. package/src/components/datePicker/DatePicker.vue +0 -504
  80. package/src/components/datePicker/index.js +0 -7
  81. package/src/components/datePicker/uses.js +0 -460
  82. package/src/components/grid/Grid.vue +0 -1535
  83. package/src/components/grid/GridColumnSetting.vue +0 -358
  84. package/src/components/grid/GridFilterSetting.vue +0 -323
  85. package/src/components/grid/GridPagination.vue +0 -75
  86. package/src/components/grid/GridSummary.vue +0 -314
  87. package/src/components/grid/GridToolbar.vue +0 -35
  88. package/src/components/grid/icon/icon-option-button.vue +0 -17
  89. package/src/components/grid/icon/icon-sort-button.vue +0 -67
  90. package/src/components/grid/index.js +0 -11
  91. package/src/components/grid/style/grid.scss +0 -417
  92. package/src/components/grid/uses.js +0 -1629
  93. package/src/components/icon/Icon.vue +0 -53
  94. package/src/components/icon/index.js +0 -8
  95. package/src/components/inputNumber/InputNumber.vue +0 -212
  96. package/src/components/inputNumber/index.js +0 -7
  97. package/src/components/inputNumber/uses.js +0 -217
  98. package/src/components/loading/Loading.vue +0 -125
  99. package/src/components/loading/index.js +0 -7
  100. package/src/components/menu/Menu.vue +0 -79
  101. package/src/components/menu/MenuItem.vue +0 -201
  102. package/src/components/menu/index.js +0 -7
  103. package/src/components/message/Message.vue +0 -229
  104. package/src/components/message/index.js +0 -34
  105. package/src/components/messageBox/MessageBox.vue +0 -358
  106. package/src/components/messageBox/index.js +0 -22
  107. package/src/components/notification/Notification.vue +0 -316
  108. package/src/components/notification/index.js +0 -49
  109. package/src/components/pagination/Pagination.vue +0 -317
  110. package/src/components/pagination/index.js +0 -7
  111. package/src/components/pagination/pageButton.vue +0 -31
  112. package/src/components/progress/Progress.vue +0 -139
  113. package/src/components/progress/index.js +0 -7
  114. package/src/components/radio/Radio.vue +0 -159
  115. package/src/components/radio/index.js +0 -7
  116. package/src/components/radioGroup/RadioGroup.vue +0 -41
  117. package/src/components/radioGroup/index.js +0 -7
  118. package/src/components/scheduler/Scheduler.vue +0 -149
  119. package/src/components/scheduler/index.js +0 -7
  120. package/src/components/scheduler/uses.js +0 -183
  121. package/src/components/select/Select.vue +0 -556
  122. package/src/components/select/index.js +0 -7
  123. package/src/components/select/uses.js +0 -379
  124. package/src/components/slider/Slider.vue +0 -505
  125. package/src/components/slider/index.js +0 -7
  126. package/src/components/slider/uses.js +0 -391
  127. package/src/components/tabPanel/TabPanel.vue +0 -74
  128. package/src/components/tabPanel/index.js +0 -7
  129. package/src/components/tabs/Tabs.vue +0 -517
  130. package/src/components/tabs/index.js +0 -7
  131. package/src/components/textField/TextField.vue +0 -399
  132. package/src/components/textField/index.js +0 -7
  133. package/src/components/timePicker/TimePicker.vue +0 -364
  134. package/src/components/timePicker/index.js +0 -7
  135. package/src/components/toggle/Toggle.vue +0 -115
  136. package/src/components/toggle/index.js +0 -7
  137. package/src/components/tree/Tree.vue +0 -338
  138. package/src/components/tree/TreeNode.vue +0 -293
  139. package/src/components/tree/index.js +0 -7
  140. package/src/components/treeGrid/TreeGrid.vue +0 -1074
  141. package/src/components/treeGrid/TreeGridNode.vue +0 -349
  142. package/src/components/treeGrid/TreeGridToolbar.vue +0 -35
  143. package/src/components/treeGrid/icon/icon-tree.png +0 -0
  144. package/src/components/treeGrid/index.js +0 -9
  145. package/src/components/treeGrid/style/treeGrid.scss +0 -277
  146. package/src/components/treeGrid/uses.js +0 -1178
  147. package/src/components/window/Window.vue +0 -329
  148. package/src/components/window/index.js +0 -7
  149. package/src/components/window/uses.js +0 -908
  150. package/src/directives/clickoutside.js +0 -90
  151. package/src/main.js +0 -120
  152. package/src/style/components/input.scss +0 -108
  153. package/src/style/functions.scss +0 -3
  154. package/src/style/index.scss +0 -6
  155. package/src/style/lib/fonts/EVUI.eot +0 -0
  156. package/src/style/lib/fonts/EVUI.svg +0 -293
  157. package/src/style/lib/fonts/EVUI.ttf +0 -0
  158. package/src/style/lib/fonts/EVUI.woff +0 -0
  159. package/src/style/lib/icon.css +0 -888
  160. package/src/style/mixins.scss +0 -94
  161. package/src/style/themes.scss +0 -69
  162. package/src/style/variables.scss +0 -22
@@ -1,144 +0,0 @@
1
- <template>
2
- <div
3
- v-if="zoomOptions.toolbar.show"
4
- ref="evChartToolbarRef"
5
- >
6
- <ev-chart-toolbar
7
- :toolbar="zoomOptions.toolbar"
8
- @on-click-toolbar="onClickToolbar"
9
- />
10
- </div>
11
-
12
- <div
13
- ref="evChartGroupRef"
14
- class="ev-chart-group__wrapper"
15
- >
16
- <slot />
17
- </div>
18
- </template>
19
-
20
- <script>
21
- import { onMounted, ref, watch, provide, toRef, computed } from 'vue';
22
- import evChartToolbar from '../chart/ChartToolbar';
23
- import { useGroupModel } from './uses';
24
- import { useZoomModel } from '../chart/uses';
25
-
26
- export default {
27
- name: 'EvChartGroup',
28
- components: {
29
- evChartToolbar,
30
- },
31
- props: {
32
- options: {
33
- type: Object,
34
- default: () => ({}),
35
- },
36
- zoomStartIdx: {
37
- type: Number,
38
- default: 0,
39
- },
40
- zoomEndIdx: {
41
- type: Number,
42
- default: 0,
43
- },
44
- groupSelectedLabel: {
45
- type: Object,
46
- default: null,
47
- },
48
- },
49
- emits: [
50
- 'update:groupSelectedLabel',
51
- 'update:zoomStartIdx',
52
- 'update:zoomEndIdx',
53
- 'update:groupHoveredLabel',
54
- ],
55
- setup(props, { emit }) {
56
- const {
57
- getNormalizedOptions,
58
- isExecuteZoom,
59
- brushSeries,
60
- evChartGroupRef,
61
- evChartPropsInGroup,
62
- } = useGroupModel();
63
-
64
- const normalizedOptions = getNormalizedOptions(props.options);
65
- provide('isExecuteZoom', isExecuteZoom);
66
- provide('isChartGroup', true);
67
- provide('brushSeries', brushSeries);
68
- provide('evChartPropsInGroup', evChartPropsInGroup);
69
- const groupSelectedLabel = computed({
70
- get: () => props.groupSelectedLabel,
71
- set: val => emit('update:groupSelectedLabel', val),
72
- });
73
- provide('groupSelectedLabel', groupSelectedLabel);
74
- const groupHoveredLabel = ref(null);
75
- provide('groupHoveredLabel', groupHoveredLabel);
76
-
77
- watch(() => props.options.syncHover, (newSyncHover) => {
78
- if (newSyncHover) {
79
- groupHoveredLabel.value = { label: '', horizontal: false };
80
- } else {
81
- groupHoveredLabel.value = null;
82
- }
83
- }, {
84
- immediate: true,
85
- });
86
-
87
- const {
88
- evChartZoomOptions,
89
- evChartInfo,
90
- evChartToolbarRef,
91
- evChartClone,
92
- brushIdx,
93
-
94
- createEvChartZoom,
95
- setOptionsForUseZoom,
96
- setDataForUseZoom,
97
- controlZoomIdx,
98
- onClickToolbar,
99
- } = useZoomModel(
100
- normalizedOptions,
101
- { wrapper: null, evChartGroupRef },
102
- groupSelectedLabel,
103
- evChartPropsInGroup,
104
- );
105
-
106
- provide('evChartClone', evChartClone);
107
- provide('evChartInfo', evChartInfo);
108
- provide('brushIdx', brushIdx);
109
-
110
- onMounted(() => {
111
- createEvChartZoom();
112
- });
113
-
114
- watch(() => evChartInfo.props.data, (evChartProps) => {
115
- setDataForUseZoom(evChartProps);
116
- }, { deep: true });
117
-
118
- watch(() => props.options, (zoomOptions) => {
119
- const newOpt = getNormalizedOptions(zoomOptions);
120
-
121
- setOptionsForUseZoom(newOpt);
122
- }, { deep: true });
123
-
124
- watch(() => [props.zoomStartIdx, props.zoomEndIdx], ([zoomStartIdx, zoomEndIdx]) => {
125
- if (brushIdx.isUseButton || brushIdx.isUseScroll) {
126
- return;
127
- }
128
-
129
- controlZoomIdx(zoomStartIdx, zoomEndIdx);
130
- });
131
-
132
- return {
133
- evChartGroupRef,
134
- evChartToolbarRef,
135
- zoomOptions: toRef(evChartZoomOptions, 'zoom'),
136
- onClickToolbar,
137
- };
138
- },
139
- };
140
- </script>
141
-
142
- <style lang="scss" scoped>
143
- @import 'style/chartGroup.scss';
144
- </style>
@@ -1,9 +0,0 @@
1
- import VueResizeObserver from 'vue-resize-observer';
2
- import EvChartGroup from './ChartGroup';
3
-
4
- EvChartGroup.install = (app) => {
5
- app.component(EvChartGroup.name, EvChartGroup);
6
- app.use(VueResizeObserver);
7
- };
8
-
9
- export default EvChartGroup;
@@ -1,5 +0,0 @@
1
- .ev-chart-group__wrapper {
2
- display: flex;
3
- height: 100%;
4
- flex-direction: column;
5
- }
@@ -1,53 +0,0 @@
1
- import { ref, reactive } from 'vue';
2
- import { defaultsDeep } from 'lodash-es';
3
-
4
- const DEFAULT_OPTIONS = {
5
- zoom: {
6
- bufferMemoryCnt: 100,
7
- keepZoomStatus: false,
8
- useAnimation: true,
9
- useWheelMove: true,
10
- toolbar: {
11
- show: false,
12
- items: {
13
- previous: {
14
- icon: 'ev-icon-allow2-left',
15
- size: 'medium',
16
- title: 'Previous',
17
- },
18
- latest: {
19
- icon: 'ev-icon-allow2-right',
20
- size: 'medium',
21
- title: 'Latest',
22
- },
23
- reset: {
24
- icon: 'ev-icon-redo',
25
- size: 'medium',
26
- title: 'Reset',
27
- },
28
- dragZoom: {
29
- icon: 'ev-icon-zoomin',
30
- size: 'medium',
31
- title: 'Drag Zoom',
32
- },
33
- },
34
- },
35
- },
36
- };
37
-
38
- // eslint-disable-next-line import/prefer-default-export
39
- export const useGroupModel = () => {
40
- const isExecuteZoom = ref(false);
41
- const evChartGroupRef = ref();
42
- const evChartPropsInGroup = ref([]);
43
- const brushSeries = reactive({ list: [], chartIdx: null });
44
- const getNormalizedOptions = options => defaultsDeep({}, options, DEFAULT_OPTIONS);
45
-
46
- return {
47
- getNormalizedOptions,
48
- isExecuteZoom,
49
- brushSeries,
50
- evChartGroupRef,
51
- evChartPropsInGroup,
52
- };
53
- };
@@ -1,229 +0,0 @@
1
- <template>
2
- <label
3
- class="ev-checkbox"
4
- :class="[
5
- { disabled, },
6
- { checked, },
7
- ]"
8
- >
9
- <input
10
- ref="checkbox"
11
- v-model="mv"
12
- type="checkbox"
13
- class="ev-checkbox-input"
14
- :disabled="disabled"
15
- :value="label"
16
- :readonly="readonly"
17
- @change="changeMv"
18
- />
19
- <span
20
- ref="checkboxLabel"
21
- class="ev-checkbox-label"
22
- >
23
- <template v-if="$slots.default">
24
- <slot />
25
- </template>
26
- <template v-else>
27
- {{ label }}
28
- </template>
29
- </span>
30
- </label>
31
- </template>
32
-
33
- <script>
34
- import { ref, computed, watch, nextTick, inject, onMounted } from 'vue';
35
-
36
- export default {
37
- name: 'EvCheckbox',
38
- props: {
39
- modelValue: {
40
- type: [String, Number, Boolean, Symbol, Array],
41
- default: false,
42
- },
43
- label: {
44
- type: [String, Number, Boolean, Symbol, Object],
45
- default: null,
46
- },
47
- tooltipTitle: {
48
- type: String,
49
- default: '',
50
- },
51
- disabled: {
52
- type: Boolean,
53
- default: false,
54
- },
55
- readonly: {
56
- type: Boolean,
57
- default: false,
58
- },
59
- indeterminate: {
60
- type: Boolean,
61
- default: false,
62
- },
63
- },
64
- emits: {
65
- 'update:modelValue': null,
66
- 'update:indeterminate': [Boolean],
67
- change: null,
68
- },
69
- setup(props, { emit }) {
70
- /**
71
- * checkbox label Ref
72
- */
73
- const checkboxLabel = ref();
74
-
75
- /**
76
- * checkbox label의 title(마우스 호버 시 보이는 내용)사용 되는
77
- * tooltipTitle props의 값이 있을 시 태그에 title 속성 추가
78
- */
79
- onMounted(() => {
80
- if (checkboxLabel.value && props.tooltipTitle) {
81
- checkboxLabel.value.title = props.tooltipTitle;
82
- }
83
- });
84
- /**
85
- * checkbox Ref
86
- */
87
- const checkbox = ref(null);
88
-
89
- /**
90
- * checkbox의 modelView 값
91
- * checkbox group 컴포넌트를 사용하는 경우 Provide('EvCheckboxGroupMv')가 실행
92
- * checkbox group 컴포넌트가 없는 경우 2nd argument 실행
93
- * - checkbox html5 indeterminate attribute 여부에 따라 v-model:indeterminate값을 update
94
- * - Vue3의 v-model:attr 방식은 Vue2의 :attr.sync와 동일 (사용방식이 변경)
95
- */
96
- const mv = inject(
97
- 'EvCheckboxGroupMv',
98
- computed({
99
- get: () => props.modelValue,
100
- set: (val) => {
101
- if (val && !checkbox.value.indeterminate) {
102
- emit('update:indeterminate', false);
103
- }
104
- emit('update:modelValue', val);
105
- },
106
- }),
107
- );
108
-
109
- /**
110
- * mv에 해당 값이 포함 또는 동일한지에 따라 check여부가 결정
111
- * return {Boolean}
112
- */
113
- const refLabel = computed(() => props.label);
114
- const checked = computed(() => {
115
- if (Array.isArray(mv.value)) {
116
- return mv.value.includes(refLabel.value);
117
- }
118
- return mv.value;
119
- });
120
-
121
- /**
122
- * 해당 컴포넌트를 '직접' 클릭하여 변경했을 때 실행되는 메소드
123
- * checkbox group을 사용하는 경우 Provide('EvCheckboxGroupChange')가 실행
124
- * checkbox group을 사용하지 않는 경우 2nd argument 실행
125
- */
126
- const changeMv = inject(
127
- 'EvCheckboxGroupChange',
128
- async (e) => {
129
- await nextTick();
130
- emit('change', mv.value, e);
131
- },
132
- );
133
-
134
- /**
135
- * props의 indeterminate 값을 감시하여
136
- * checkbox element의 indeterminate attribute에 값 적용
137
- */
138
- watch(
139
- () => props.indeterminate,
140
- (val) => {
141
- nextTick(() => {
142
- if (!checkbox.value) {
143
- return;
144
- }
145
- checkbox.value.indeterminate = val;
146
- });
147
- }, { immediate: true },
148
- );
149
-
150
- return {
151
- mv,
152
- checkboxLabel,
153
- checkbox,
154
- checked,
155
- changeMv,
156
- };
157
- },
158
- };
159
- </script>
160
-
161
- <style lang="scss">
162
- @import '../../style/index.scss';
163
-
164
- .ev-checkbox {
165
- margin-right: 30px;
166
- cursor: pointer;
167
- user-select: none;
168
- &-label {
169
- padding-left: 5px;
170
- }
171
- &-input {
172
- cursor: pointer;
173
- }
174
- }
175
-
176
- @include state('disabled') {
177
- .ev-checkbox-label {
178
- @include evThemify() {
179
- color: evThemed('disabled');
180
- }
181
- }
182
- .ev-checkbox-input,
183
- .ev-checkbox-label {
184
- cursor: not-allowed !important;
185
- }
186
- }
187
- @include state('type-button') {
188
- .ev-checkbox {
189
- display: inline-block;
190
- padding: 0;
191
- margin: 0;
192
- text-align: center;
193
-
194
- @include evThemify() {
195
- border: 1px solid evThemed('border-base');
196
- border-left: 0;
197
- }
198
- &:first-child {
199
- border-radius: $default-radius 0 0 $default-radius;
200
-
201
- @include evThemify() {
202
- border-left: 1px solid evThemed('border-base');
203
- }
204
- }
205
- &:last-child {
206
- border-radius: 0 $default-radius $default-radius 0;
207
- }
208
- &.checked {
209
- color: $color-white;
210
-
211
- @include evThemify() {
212
- background-color: evThemed('primary');
213
- }
214
- }
215
- &.disabled.checked {
216
- @include evThemify() {
217
- background-color: rgba(evThemed('border-base'), 0.5);
218
- }
219
- }
220
- }
221
- .ev-checkbox-input {
222
- @include visible-hide();
223
- }
224
- .ev-checkbox-label {
225
- display: inline-block;
226
- padding: 7px 12px;
227
- }
228
- }
229
- </style>
@@ -1,7 +0,0 @@
1
- import EvCheckbox from './Checkbox';
2
-
3
- EvCheckbox.install = (app) => {
4
- app.component(EvCheckbox.name, EvCheckbox);
5
- };
6
-
7
- export default EvCheckbox;
@@ -1,44 +0,0 @@
1
- <template>
2
- <div
3
- class="ev-checkbox-group"
4
- :class="{ 'type-button': type === 'button' }"
5
- role="group"
6
- >
7
- <slot />
8
- </div>
9
- </template>
10
-
11
- <script>
12
- import { computed, nextTick, provide } from 'vue';
13
-
14
- export default {
15
- name: 'EvCheckboxGroup',
16
- props: {
17
- modelValue: {
18
- type: Array,
19
- default: () => [],
20
- },
21
- type: {
22
- type: String,
23
- default: 'checkbox',
24
- },
25
- },
26
- emits: {
27
- 'update:modelValue': null,
28
- change: null,
29
- },
30
- setup(props, { emit }) {
31
- const mv = computed({
32
- get: () => props.modelValue,
33
- set: labels => emit('update:modelValue', labels),
34
- });
35
- provide('EvCheckboxGroupMv', mv);
36
-
37
- const change = async (e) => {
38
- await nextTick();
39
- emit('change', mv.value, e);
40
- };
41
- provide('EvCheckboxGroupChange', change);
42
- },
43
- };
44
- </script>
@@ -1,7 +0,0 @@
1
- import EvCheckboxGroup from './CheckboxGroup';
2
-
3
- EvCheckboxGroup.install = (app) => {
4
- app.component(EvCheckboxGroup.name, EvCheckboxGroup);
5
- };
6
-
7
- export default EvCheckboxGroup;
@@ -1,95 +0,0 @@
1
- <template>
2
- <template v-if="isShow && items.length">
3
- <teleport to="#ev-context-menu-modal">
4
- <menu-list
5
- ref="rootMenuList"
6
- v-model:isShow="isShow"
7
- v-clickoutside="hide"
8
- :class="customClass"
9
- :items="items"
10
- :style="menuStyle"
11
- :comp="comp"
12
- >
13
- <template
14
- v-for="(_, slotName) in $slots"
15
- :key="slotName"
16
- #[slotName]="slotProps"
17
- >
18
- <slot
19
- :name="slotName"
20
- v-bind="slotProps"
21
- />
22
- </template>
23
- </menu-list>
24
- </teleport>
25
- </template>
26
- </template>
27
-
28
- <script>
29
- import { onBeforeMount } from 'vue';
30
- import { clickoutside } from '@/directives/clickoutside';
31
- import MenuList from './MenuList';
32
- import { useModel, usePosition } from './uses';
33
-
34
- export default {
35
- name: 'EvContextMenu',
36
- directives: {
37
- clickoutside,
38
- },
39
- components: {
40
- MenuList,
41
- },
42
- props: {
43
- items: {
44
- type: Array,
45
- default: () => [],
46
- validator: (list) => {
47
- if (list.some(v => v.children !== undefined && !Array.isArray(v.children))) {
48
- console.warn('[EVUI][ContextMenu] children attribute must be \'Array\' type.');
49
- return false;
50
- } else if (list.some(v => v.click !== undefined && typeof v.click !== 'function')) {
51
- console.warn('[EVUI][ContextMenu] click attribute must be \'Function\' type.');
52
- return false;
53
- }
54
- return true;
55
- },
56
- },
57
- customClass: {
58
- type: String,
59
- default: '',
60
- },
61
- isShowMenuOnClick: {
62
- type: Boolean,
63
- default: false,
64
- },
65
- },
66
- setup() {
67
- const {
68
- comp,
69
- initWrapperDiv,
70
- } = useModel();
71
-
72
- const {
73
- isShow,
74
- rootMenuList,
75
- menuStyle,
76
- show,
77
- hide,
78
- } = usePosition();
79
-
80
- onBeforeMount(() => initWrapperDiv());
81
-
82
- return {
83
- isShow,
84
- rootMenuList,
85
- menuStyle,
86
- comp,
87
- show,
88
- hide,
89
- };
90
- },
91
- };
92
- </script>
93
-
94
- <style lang="scss">
95
- </style>