@infineon/infineon-vue-datatable 0.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 (63) hide show
  1. package/LICENSE +21 -0
  2. package/package.json +44 -0
  3. package/src/datatable/InfineonDatatable.vue +278 -0
  4. package/src/datatable/InfineonDatatablePager.vue +146 -0
  5. package/src/datatable/InfineonDatatableRow.vue +229 -0
  6. package/src/datatable/InfineonDatatableRowColumn.vue +88 -0
  7. package/src/datatable/InfineonDatatableShowColumnsPicker.vue +45 -0
  8. package/src/datatable/InfineonDatatableSortIcon.vue +49 -0
  9. package/src/index.js +4 -0
  10. package/src/plugins/axiosErrorHandler.js +11 -0
  11. package/src/plugins/axiosLoadingOverlay.js +42 -0
  12. package/src/plugins/fontawesome.js +70 -0
  13. package/src/plugins/treeView/index.js +12 -0
  14. package/src/plugins/treeView/src/components/Control.vue +152 -0
  15. package/src/plugins/treeView/src/components/HiddenFields.vue +40 -0
  16. package/src/plugins/treeView/src/components/Input.vue +298 -0
  17. package/src/plugins/treeView/src/components/Menu.vue +314 -0
  18. package/src/plugins/treeView/src/components/MenuPortal.vue +195 -0
  19. package/src/plugins/treeView/src/components/MultiValue.vue +60 -0
  20. package/src/plugins/treeView/src/components/MultiValueItem.vue +49 -0
  21. package/src/plugins/treeView/src/components/Option.vue +302 -0
  22. package/src/plugins/treeView/src/components/Placeholder.vue +20 -0
  23. package/src/plugins/treeView/src/components/SingleValue.vue +32 -0
  24. package/src/plugins/treeView/src/components/Tip.vue +40 -0
  25. package/src/plugins/treeView/src/components/Treeselect.vue +63 -0
  26. package/src/plugins/treeView/src/components/icons/Arrow.vue +14 -0
  27. package/src/plugins/treeView/src/components/icons/Delete.vue +17 -0
  28. package/src/plugins/treeView/src/constants.js +50 -0
  29. package/src/plugins/treeView/src/mixins/treeselectMixin.js +2083 -0
  30. package/src/plugins/treeView/src/utils/.eslintrc.js +6 -0
  31. package/src/plugins/treeView/src/utils/constant.js +1 -0
  32. package/src/plugins/treeView/src/utils/createMap.js +1 -0
  33. package/src/plugins/treeView/src/utils/debounce.js +1 -0
  34. package/src/plugins/treeView/src/utils/deepExtend.js +29 -0
  35. package/src/plugins/treeView/src/utils/find.js +6 -0
  36. package/src/plugins/treeView/src/utils/identity.js +1 -0
  37. package/src/plugins/treeView/src/utils/includes.js +3 -0
  38. package/src/plugins/treeView/src/utils/index.js +38 -0
  39. package/src/plugins/treeView/src/utils/isNaN.js +3 -0
  40. package/src/plugins/treeView/src/utils/isPromise.js +1 -0
  41. package/src/plugins/treeView/src/utils/last.js +1 -0
  42. package/src/plugins/treeView/src/utils/noop.js +1 -0
  43. package/src/plugins/treeView/src/utils/onLeftClick.js +7 -0
  44. package/src/plugins/treeView/src/utils/once.js +1 -0
  45. package/src/plugins/treeView/src/utils/quickDiff.js +9 -0
  46. package/src/plugins/treeView/src/utils/removeFromArray.js +4 -0
  47. package/src/plugins/treeView/src/utils/scrollIntoView.js +15 -0
  48. package/src/plugins/treeView/src/utils/setupResizeAndScrollEventListeners.js +34 -0
  49. package/src/plugins/treeView/src/utils/warning.js +11 -0
  50. package/src/plugins/treeView/src/utils/watchSize.js +67 -0
  51. package/src/plugins/treeView/styles/assets/checkbox-checked-disabled.png +0 -0
  52. package/src/plugins/treeView/styles/assets/checkbox-checked-disabled@2x.png +0 -0
  53. package/src/plugins/treeView/styles/assets/checkbox-checked-disabled@3x.png +0 -0
  54. package/src/plugins/treeView/styles/assets/checkbox-checked.png +0 -0
  55. package/src/plugins/treeView/styles/assets/checkbox-checked@2x.png +0 -0
  56. package/src/plugins/treeView/styles/assets/checkbox-checked@3x.png +0 -0
  57. package/src/plugins/treeView/styles/assets/checkbox-indeterminate-disabled.png +0 -0
  58. package/src/plugins/treeView/styles/assets/checkbox-indeterminate-disabled@2x.png +0 -0
  59. package/src/plugins/treeView/styles/assets/checkbox-indeterminate-disabled@3x.png +0 -0
  60. package/src/plugins/treeView/styles/assets/checkbox-indeterminate.png +0 -0
  61. package/src/plugins/treeView/styles/assets/checkbox-indeterminate@2x.png +0 -0
  62. package/src/plugins/treeView/styles/assets/checkbox-indeterminate@3x.png +0 -0
  63. package/src/plugins/treeView/styles/style.less +1150 -0
@@ -0,0 +1,195 @@
1
+ <script>
2
+ import { createApp, defineComponent, h } from 'vue';
3
+ import { watchSize, setupResizeAndScrollEventListeners, find } from '../utils';
4
+ import Menu from './Menu.vue';
5
+
6
+ const PortalTarget = {
7
+ name: 'vue-treeselect--portal-target',
8
+ inject: ['instance'],
9
+
10
+ watch: {
11
+ 'instance.menu.isOpen': {
12
+ handler(newValue) {
13
+ if (newValue) {
14
+ this.setupHandlers();
15
+ } else {
16
+ this.removeHandlers();
17
+ }
18
+ },
19
+ },
20
+
21
+ 'instance.menu.placement': {
22
+ handler(newValue) {
23
+ this.updateMenuContainerOffset();
24
+ },
25
+ },
26
+
27
+ },
28
+
29
+ created() {
30
+ this.controlResizeAndScrollEventListeners = null;
31
+ this.controlSizeWatcher = null;
32
+ },
33
+
34
+ mounted() {
35
+ const { instance } = this;
36
+
37
+ if (instance.menu.isOpen) this.setupHandlers();
38
+ },
39
+
40
+ methods: {
41
+ setupHandlers() {
42
+ this.updateWidth();
43
+ this.updateMenuContainerOffset();
44
+ this.setupControlResizeAndScrollEventListeners();
45
+ this.setupControlSizeWatcher();
46
+ },
47
+
48
+ removeHandlers() {
49
+ this.removeControlResizeAndScrollEventListeners();
50
+ this.removeControlSizeWatcher();
51
+ },
52
+
53
+ setupControlResizeAndScrollEventListeners() {
54
+ const { instance } = this;
55
+ const $control = instance.getControl();
56
+
57
+ // istanbul ignore next
58
+ if (this.controlResizeAndScrollEventListeners) return;
59
+
60
+ this.controlResizeAndScrollEventListeners = {
61
+ remove: setupResizeAndScrollEventListeners($control, this.updateMenuContainerOffset),
62
+ };
63
+ },
64
+
65
+ setupControlSizeWatcher() {
66
+ const { instance } = this;
67
+ const $control = instance.getControl();
68
+
69
+ // istanbul ignore next
70
+ if (this.controlSizeWatcher) return;
71
+
72
+ this.controlSizeWatcher = {
73
+ remove: watchSize($control, () => {
74
+ this.updateWidth();
75
+ this.updateMenuContainerOffset();
76
+ }),
77
+ };
78
+ },
79
+
80
+ removeControlResizeAndScrollEventListeners() {
81
+ if (!this.controlResizeAndScrollEventListeners) return;
82
+
83
+ this.controlResizeAndScrollEventListeners.remove();
84
+ this.controlResizeAndScrollEventListeners = null;
85
+ },
86
+
87
+ removeControlSizeWatcher() {
88
+ if (!this.controlSizeWatcher) return;
89
+
90
+ this.controlSizeWatcher.remove();
91
+ this.controlSizeWatcher = null;
92
+ },
93
+
94
+ updateWidth() {
95
+ const { instance } = this;
96
+ const $portalTarget = this.$el;
97
+ const $control = instance.getControl();
98
+ const controlRect = $control.getBoundingClientRect();
99
+
100
+ $portalTarget.style.width = `${controlRect.width}px`;
101
+ },
102
+
103
+ updateMenuContainerOffset() {
104
+ const { instance } = this;
105
+ const $control = instance.getControl();
106
+ const $portalTarget = this.$el;
107
+ const controlRect = $control.getBoundingClientRect();
108
+ const portalTargetRect = $portalTarget.getBoundingClientRect();
109
+ const offsetY = instance.menu.placement === 'bottom' ? controlRect.height : 0;
110
+ const left = `${Math.round(controlRect.left - portalTargetRect.left)}px`;
111
+ const top = `${Math.round(controlRect.top - portalTargetRect.top + offsetY)}px`;
112
+ const menuContainerStyle = this.$refs.menu.$refs['menu-container'].style;
113
+ const transformVariations = ['transform', 'webkitTransform', 'MozTransform', 'msTransform'];
114
+ const transform = find(transformVariations, (t) => t in document.body.style);
115
+
116
+ // IE9 doesn't support `translate3d()`.
117
+ menuContainerStyle[transform] = `translate(${left}, ${top})`;
118
+ },
119
+ },
120
+
121
+ render() {
122
+ const { instance } = this;
123
+ const portalTargetClass = ['vue-treeselect__portal-target', instance.wrapperClass];
124
+ const portalTargetStyle = { zIndex: instance.zIndex };
125
+
126
+ return (
127
+ h('div', {
128
+ class: portalTargetClass,
129
+ style: portalTargetStyle,
130
+ 'data-instance-id': instance.getInstanceId(),
131
+ }, [
132
+ h(Menu, { ref: 'menu' }),
133
+ ])
134
+ );
135
+ },
136
+
137
+ unmounted() {
138
+ this.removeHandlers();
139
+ },
140
+ };
141
+
142
+ let placeholder;
143
+ // eslint-disable-next-line vue/one-component-per-file
144
+ export default {
145
+ inject: ['instance'],
146
+ created() {
147
+ this.portalTarget = null;
148
+ },
149
+
150
+ mounted() {
151
+ this.setup();
152
+ },
153
+
154
+ unmounted() {
155
+ this.teardown();
156
+ },
157
+
158
+ methods: {
159
+ setup() {
160
+ const el = document.createElement('div');
161
+ document.body.appendChild(el);
162
+ // eslint-disable-next-line vue/one-component-per-file
163
+ this.portalTarget = createApp({
164
+ parent: this,
165
+ ...PortalTarget,
166
+ });
167
+ this.portalTarget.provide('instance', this.instance);
168
+ this.portalTarget.mount(el);
169
+ // this.portalTarget = new Vue({
170
+ // el,
171
+ // parent: this,
172
+ // ...PortalTarget,
173
+ // })
174
+ },
175
+
176
+ teardown() {
177
+ // eslint-disable-next-line no-underscore-dangle
178
+ document.body.removeChild(this.portalTarget._instance.vnode.el.parentElement);
179
+ // eslint-disable-next-line no-underscore-dangle
180
+ this.portalTarget._instance.vnode.el.parentElement.innerHTML = '';
181
+ this.portalTarget = null;
182
+ },
183
+ },
184
+
185
+ render() {
186
+ if (!placeholder) {
187
+ placeholder = (
188
+ h('div', { class: 'vue-treeselect__menu-placeholder' })
189
+ );
190
+ }
191
+
192
+ return placeholder;
193
+ },
194
+ };
195
+ </script>
@@ -0,0 +1,60 @@
1
+ <script>
2
+ import { defineComponent, h } from 'vue';
3
+ import MultiValueItem from './MultiValueItem.vue';
4
+ import Input from './Input.vue';
5
+ import Placeholder from './Placeholder.vue';
6
+
7
+ export default {
8
+ inject: ['instance'],
9
+
10
+ methods: {
11
+ renderMultiValueItems() {
12
+ const { instance } = this;
13
+
14
+ return instance.internalValue
15
+ .slice(0, instance.limit)
16
+ .map(instance.getNode)
17
+ .map((node) => (
18
+ h(MultiValueItem, { key: `multi-value-item-${node.id}`, node })));
19
+ },
20
+
21
+ renderExceedLimitTip() {
22
+ const { instance } = this;
23
+ const count = instance.internalValue.length - instance.limit;
24
+
25
+ if (count <= 0) return null;
26
+
27
+ return (
28
+ h('div', { class: 'vue-treeselect__limit-tip vue-treeselect-helper-zoom-effect-off', key: 'exceed-limit-tip' }, [
29
+ h('span', { class: 'vue-treeselect__limit-tip-text' }, [instance.limitText(count)]),
30
+ ])
31
+ );
32
+ },
33
+ },
34
+
35
+ render() {
36
+ const { renderValueContainer } = this.$parent;
37
+ // const transitionGroupProps = {
38
+ // props: {
39
+ // tag: 'div',
40
+ // name: 'vue-treeselect__multi-value-item--transition',
41
+ // appear: true,
42
+ // },
43
+ // }
44
+
45
+ return renderValueContainer(
46
+ h('transition-group', {
47
+ class: 'vue-treeselect__multi-value',
48
+ tag: 'div',
49
+ name: 'vue-treeselect__multi-value-item--transition',
50
+ appear: true,
51
+ }, [
52
+ this.renderMultiValueItems(),
53
+ this.renderExceedLimitTip(),
54
+ h(Placeholder, { key: 'placeholder' }),
55
+ h(Input, { ref: 'input', key: 'input' }),
56
+ ]),
57
+ );
58
+ },
59
+ };
60
+ </script>
@@ -0,0 +1,49 @@
1
+ <script>
2
+ import { defineComponent, h } from 'vue';
3
+ import { onLeftClick } from '../utils';
4
+ import DeleteIcon from './icons/Delete.vue';
5
+
6
+ export default {
7
+ inject: ['instance'],
8
+
9
+ props: {
10
+ node: {
11
+ type: Object,
12
+ required: true,
13
+ },
14
+ },
15
+
16
+ methods: {
17
+ handleMouseDown: onLeftClick(function handleMouseDown() {
18
+ const { instance, node } = this;
19
+
20
+ // Deselect this node.
21
+ instance.select(node);
22
+ }),
23
+ },
24
+
25
+ render() {
26
+ const { instance, node } = this;
27
+ const itemClass = {
28
+ 'vue-treeselect__multi-value-item': true,
29
+ 'vue-treeselect__multi-value-item-disabled': node.isDisabled,
30
+ 'vue-treeselect__multi-value-item-new': node.isNew,
31
+ };
32
+ const customValueLabelRenderer = instance.$slots['value-label'];
33
+ const labelRenderer = customValueLabelRenderer
34
+ ? customValueLabelRenderer({ node }) : node.label || node.id;
35
+
36
+ return (
37
+ h('div', { class: 'vue-treeselect__multi-value-item-container' }, [
38
+ h('div', { class: itemClass, onMousedown: this.handleMouseDown }, [
39
+ h('span', { class: 'vue-treeselect__multi-value-label' },
40
+ labelRenderer),
41
+ h('span', { class: 'vue-treeselect__icon vue-treeselect__value-remove' }, [
42
+ h(DeleteIcon),
43
+ ]),
44
+ ]),
45
+ ])
46
+ );
47
+ },
48
+ };
49
+ </script>
@@ -0,0 +1,302 @@
1
+ <script>
2
+ import { defineComponent, h } from 'vue';
3
+ import { UNCHECKED, INDETERMINATE, CHECKED } from '../constants';
4
+ import { onLeftClick } from '../utils';
5
+ import Tip from './Tip.vue';
6
+ import ArrowIcon from './icons/Arrow.vue';
7
+
8
+ let arrowPlaceholder; let checkMark; let
9
+ minusMark;
10
+
11
+ const Option = {
12
+ name: 'vue-treeselect--option',
13
+ inject: ['instance'],
14
+
15
+ props: {
16
+ node: {
17
+ type: Object,
18
+ required: true,
19
+ },
20
+ },
21
+
22
+ computed: {
23
+ shouldExpand() {
24
+ const { instance, node } = this;
25
+
26
+ return node.isBranch && instance.shouldExpand(node);
27
+ },
28
+
29
+ shouldShow() {
30
+ const { instance, node } = this;
31
+ return instance.shouldShowOptionInMenu(node);
32
+ },
33
+ },
34
+
35
+ methods: {
36
+ renderOption() {
37
+ const { instance, node } = this;
38
+ const optionClass = {
39
+ 'vue-treeselect__option': true,
40
+ 'vue-treeselect__option--disabled': node.isDisabled,
41
+ 'vue-treeselect__option--selected': instance.isSelected(node),
42
+ 'vue-treeselect__option--highlight': node.isHighlighted,
43
+ 'vue-treeselect__option--matched': instance.localSearch.active && node.isMatched,
44
+ 'vue-treeselect__option--hide': !this.shouldShow,
45
+ };
46
+
47
+ const t = (
48
+ h('div', {
49
+ class: optionClass,
50
+ onMouseenter: this.handleMouseEnterOption,
51
+ dataId: node.id,
52
+ }, [
53
+ this.renderArrow(),
54
+ this.renderCheckboxContainer([
55
+ this.renderCheckbox(),
56
+ ]), this.renderLabelContainer([
57
+ this.renderLabel(),
58
+ ])])
59
+ );
60
+ return t;
61
+ },
62
+
63
+ renderSubOptionsList() {
64
+ if (!this.shouldExpand) return null;
65
+
66
+ return (
67
+ h('div', { class: 'vue-treeselect__list' }, [
68
+ ...this.renderSubOptions(),
69
+ this.renderNoChildrenTip(),
70
+ this.renderLoadingChildrenTip(),
71
+ this.renderLoadingChildrenErrorTip(),
72
+ ])
73
+ );
74
+ },
75
+
76
+ renderArrow() {
77
+ const { instance, node } = this;
78
+
79
+ if (instance.shouldFlattenOptions && this.shouldShow) return null;
80
+ if (node.isBranch) {
81
+ const arrowClass = {
82
+ 'vue-treeselect__option-arrow': true,
83
+ 'vue-treeselect__option-arrow--rotated': this.shouldExpand,
84
+ };
85
+
86
+ return (
87
+ h('div', { class: 'vue-treeselect__option-arrow-container', onMousedown: this.handleMouseDownOnArrow },
88
+ [
89
+ h('transition', { name: 'vue-treeselect__option-arrow--prepare', appear: true }, [
90
+ h(ArrowIcon, { class: arrowClass })]),
91
+ ])
92
+ );
93
+ }
94
+
95
+ // For leaf nodes, we render a placeholder to keep its label aligned to
96
+ // branch nodes. Unless there is no branch nodes at all (a normal
97
+ // non-tree select).
98
+ if (/* node.isLeaf && */instance.hasBranchNodes) {
99
+ if (!arrowPlaceholder) {
100
+ arrowPlaceholder = (
101
+ h('div', { class: 'vue-treeselect__option-arrow-placeholder' }, [])
102
+ );
103
+ }
104
+
105
+ return arrowPlaceholder;
106
+ }
107
+
108
+ return null;
109
+ },
110
+
111
+ renderLabelContainer(children) {
112
+ return (
113
+ h('div', {
114
+ class: 'vue-treeselect__label-container',
115
+ onMousedown: this.handleMouseDownOnLabelContainer,
116
+ }, children)
117
+ );
118
+ },
119
+
120
+ renderCheckboxContainer(children) {
121
+ const { instance, node } = this;
122
+
123
+ if (instance.single) return null;
124
+ if (instance.disableBranchNodes && node.isBranch) return null;
125
+
126
+ return (
127
+ h('div', {
128
+ class: 'vue-treeselect__checkbox-container',
129
+ onMousedown: this.handleMouseDownOnLabelContainer,
130
+ }, children)
131
+ );
132
+ },
133
+
134
+ renderCheckbox() {
135
+ const { instance, node } = this;
136
+ const checkedState = instance.forest.checkedStateMap[node.id];
137
+ const checkboxClass = {
138
+ 'vue-treeselect__checkbox': true,
139
+ 'vue-treeselect__checkbox--checked': checkedState === CHECKED,
140
+ 'vue-treeselect__checkbox--indeterminate': checkedState === INDETERMINATE,
141
+ 'vue-treeselect__checkbox--unchecked': checkedState === UNCHECKED,
142
+ 'vue-treeselect__checkbox--disabled': node.isDisabled,
143
+ };
144
+
145
+ if (!checkMark) {
146
+ checkMark = (
147
+ h('span', { class: 'vue-treeselect__check-mark' })
148
+ );
149
+ }
150
+ if (!minusMark) {
151
+ minusMark = (
152
+ h('span', { class: 'vue-treeselect__minus-mark' })
153
+ );
154
+ }
155
+
156
+ return (
157
+ h('span', { class: checkboxClass }, [
158
+ checkMark,
159
+ minusMark])
160
+ );
161
+ },
162
+
163
+ renderLabel() {
164
+ const { instance, node } = this;
165
+ const shouldShowCount = (
166
+ node.isBranch && (instance.localSearch.active
167
+ ? instance.showCountOnSearchComputed
168
+ : instance.showCount
169
+ )
170
+ );
171
+ // eslint-disable-next-line no-nested-ternary
172
+ const count = shouldShowCount
173
+ ? instance.localSearch.active
174
+ ? instance.localSearch.countMap[node.id][instance.showCountOf]
175
+ : node.count[instance.showCountOf]
176
+ : NaN;
177
+ const labelClassName = 'vue-treeselect__label';
178
+ const countClassName = 'vue-treeselect__count';
179
+ const customLabelRenderer = instance.$slots['option-label'];
180
+
181
+ if (customLabelRenderer) {
182
+ return customLabelRenderer({
183
+ node,
184
+ shouldShowCount,
185
+ count,
186
+ labelClassName,
187
+ countClassName,
188
+ });
189
+ }
190
+ return (
191
+ h('label', { class: labelClassName }, [
192
+ node.label,
193
+ (shouldShowCount && (
194
+ h('span', { class: countClassName }, [count])
195
+ )),
196
+ ])
197
+ );
198
+ },
199
+
200
+ renderSubOptions() {
201
+ const { node } = this;
202
+
203
+ if (!node.childrenStates.isLoaded) return null;
204
+
205
+ return node.children.map((childNode) => (
206
+ h(Option, { node: childNode, key: childNode.id })
207
+ ));
208
+ },
209
+
210
+ renderNoChildrenTip() {
211
+ const { instance, node } = this;
212
+
213
+ if (!node.childrenStates.isLoaded || node.children.length) return null;
214
+
215
+ return (
216
+ h(Tip, { type: 'no-children', icon: 'warning' }, () => instance.noChildrenText)
217
+ );
218
+ },
219
+
220
+ renderLoadingChildrenTip() {
221
+ const { instance, node } = this;
222
+
223
+ if (!node.childrenStates.isLoading) return null;
224
+
225
+ return (
226
+ h(Tip, { type: 'loading', icon: 'loader' }, () => [instance.noChildrenText])
227
+ );
228
+ },
229
+
230
+ renderLoadingChildrenErrorTip() {
231
+ const { instance, node } = this;
232
+
233
+ if (!node.childrenStates.loadingError) return null;
234
+
235
+ return (
236
+ h(Tip, { type: 'error', icon: 'error' }, () => [
237
+ node.childrenStates.loadingError,
238
+ h('a', { class: 'vue-treeselect__retry', title: instance.retryTitle, onMousedown: this.handleMouseDownOnRetry }, [
239
+ instance.retryText]),
240
+ ])
241
+ );
242
+ },
243
+
244
+ handleMouseEnterOption(evt) {
245
+ const { instance, node } = this;
246
+
247
+ // Equivalent to `self` modifier.
248
+ // istanbul ignore next
249
+ if (evt.target !== evt.currentTarget) return;
250
+
251
+ instance.setCurrentHighlightedOption(node, false);
252
+ },
253
+
254
+ handleMouseDownOnArrow: onLeftClick(function handleMouseDownOnOptionArrow() {
255
+ const { instance, node } = this;
256
+ instance.toggleExpanded(node);
257
+ }),
258
+
259
+ handleMouseDownOnLabelContainer: onLeftClick(function handleMouseDownOnLabelContainer() {
260
+ const { instance, node } = this;
261
+
262
+ if (node.isBranch && instance.disableBranchNodes) {
263
+ instance.toggleExpanded(node);
264
+ } else {
265
+ instance.select(node);
266
+ }
267
+ }),
268
+
269
+ handleMouseDownOnRetry: onLeftClick(function handleMouseDownOnRetry() {
270
+ const { instance, node } = this;
271
+ instance.loadChildrenOptions(node);
272
+ }),
273
+ },
274
+
275
+ render() {
276
+ const { node } = this;
277
+ const indentLevel = this.instance.shouldFlattenOptions ? 0 : node.level;
278
+ const listItemClass = {
279
+ 'vue-treeselect__list-item': true,
280
+ [`vue-treeselect__indent-level-${indentLevel}`]: true,
281
+ };
282
+
283
+ const childs = [this.renderOption()];
284
+
285
+ if (node.isBranch) {
286
+ childs.push(h('transition', {
287
+ name: 'vue-treeselect__list--transition',
288
+ }, [
289
+ this.renderSubOptionsList(),
290
+ ]));
291
+ }
292
+
293
+ return (
294
+ h('div', { class: listItemClass },
295
+ childs)
296
+ );
297
+ },
298
+ };
299
+
300
+ // eslint-disable-next-line vue/require-direct-export
301
+ export default Option;
302
+ </script>
@@ -0,0 +1,20 @@
1
+ <script>
2
+ import { defineComponent, h } from 'vue';
3
+
4
+ export default {
5
+ inject: ['instance'],
6
+
7
+ render() {
8
+ const { instance } = this;
9
+ const placeholderClass = {
10
+ 'vue-treeselect__placeholder': true,
11
+ 'vue-treeselect-helper-zoom-effect-off': true,
12
+ 'vue-treeselect-helper-hide': instance.hasValue || instance.trigger.searchQuery,
13
+ };
14
+
15
+ return (
16
+ h('div', { class: placeholderClass }, instance.placeholder)
17
+ );
18
+ },
19
+ };
20
+ </script>
@@ -0,0 +1,32 @@
1
+ <script>
2
+ import { h } from 'vue';
3
+ import Input from './Input.vue';
4
+ import Placeholder from './Placeholder.vue';
5
+
6
+ export default {
7
+ inject: ['instance'],
8
+ methods: {
9
+ renderSingleValueLabel() {
10
+ const { instance } = this;
11
+ const node = instance.selectedNodes[0];
12
+
13
+ const customValueLabelRenderer = instance.$slots['value-label'];
14
+ return customValueLabelRenderer
15
+ ? customValueLabelRenderer({ node })
16
+ : node.label;
17
+ },
18
+ },
19
+ render() {
20
+ const { instance, $parent: { renderValueContainer } } = this;
21
+ const shouldShowValue = instance.hasValue && !instance.trigger.searchQuery;
22
+
23
+ return renderValueContainer([
24
+ shouldShowValue && (
25
+ h('div', { class: 'vue-treeselect__single-value' }, [this.renderSingleValueLabel()])
26
+ ),
27
+ h(Placeholder),
28
+ h(Input, { ref: 'input' }),
29
+ ]);
30
+ },
31
+ };
32
+ </script>
@@ -0,0 +1,40 @@
1
+ <script>
2
+ import { defineComponent, h } from 'vue';
3
+
4
+ export default defineComponent({
5
+ functional: true,
6
+
7
+ props: {
8
+ type: {
9
+ type: String,
10
+ required: true,
11
+ },
12
+ icon: {
13
+ type: String,
14
+ required: true,
15
+ },
16
+ },
17
+
18
+ render() {
19
+ const { type, icon } = this;
20
+
21
+ return (
22
+ h('div', {
23
+ class: `vue-treeselect__tip vue-treeselect__${type}-tip`,
24
+ }, [
25
+ h('div', {
26
+ class: 'vue-treeselect__icon-container',
27
+ }, [
28
+ h('span', { class: `vue-treeselect__icon-${icon}` }),
29
+ ]),
30
+
31
+ h('span', {
32
+ class: `vue-treeselect__tip-text vue-treeselect__${type}-tip-text`,
33
+ }, [
34
+ this.$slots.default(),
35
+ ]),
36
+ ])
37
+ );
38
+ },
39
+ });
40
+ </script>