@onereach/ui-components 3.0.2-beta.2476.0 → 3.0.2-beta.2480.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 (60) hide show
  1. package/dist/bundled/v2/{OrSelect-0b9b27e9.js → OrSelect-33f58941.js} +6 -5
  2. package/dist/bundled/v2/components/index.d.ts +0 -1
  3. package/dist/bundled/v2/components/index.js +1 -2
  4. package/dist/bundled/v2/components/or-select-v3/index.js +1 -1
  5. package/dist/bundled/v2/index.js +2 -3
  6. package/dist/bundled/v3/components/index.d.ts +0 -1
  7. package/dist/bundled/v3/components/index.js +0 -1
  8. package/dist/bundled/v3/index.js +116 -141
  9. package/dist/esm/v2/{OrSelect-8307ad20.js → OrSelect-4b901267.js} +6 -5
  10. package/dist/esm/v2/components/index.d.ts +0 -1
  11. package/dist/esm/v2/components/index.js +1 -2
  12. package/dist/esm/v2/components/or-select-v3/index.js +1 -1
  13. package/dist/esm/v2/index.js +1 -2
  14. package/dist/esm/v3/{OrSelect-c3a50846.js → OrSelect-6ccd02ea.js} +5 -4
  15. package/dist/esm/v3/components/index.d.ts +0 -1
  16. package/dist/esm/v3/components/index.js +1 -2
  17. package/dist/esm/v3/components/or-select-v3/index.js +1 -1
  18. package/dist/esm/v3/index.js +1 -2
  19. package/package.json +1 -1
  20. package/src/components/index.ts +0 -1
  21. package/src/components/or-select-v3/OrSelect.vue +65 -64
  22. package/dist/bundled/v2/OrTree-b8e47647.js +0 -236
  23. package/dist/bundled/v2/components/or-tree-v3/OrTree.vue.d.ts +0 -47
  24. package/dist/bundled/v2/components/or-tree-v3/TreeNode.vue.d.ts +0 -82
  25. package/dist/bundled/v2/components/or-tree-v3/index.d.ts +0 -2
  26. package/dist/bundled/v2/components/or-tree-v3/index.js +0 -17
  27. package/dist/bundled/v2/components/or-tree-v3/styles.d.ts +0 -1
  28. package/dist/bundled/v2/components/or-tree-v3/types.d.ts +0 -10
  29. package/dist/bundled/v2/components/or-tree-v3/utils.d.ts +0 -5
  30. package/dist/bundled/v3/OrTree.vue_vue_type_script_lang-9a31b9b4.js +0 -146
  31. package/dist/bundled/v3/components/or-tree-v3/OrTree.vue.d.ts +0 -47
  32. package/dist/bundled/v3/components/or-tree-v3/TreeNode.vue.d.ts +0 -82
  33. package/dist/bundled/v3/components/or-tree-v3/index.d.ts +0 -2
  34. package/dist/bundled/v3/components/or-tree-v3/index.js +0 -16
  35. package/dist/bundled/v3/components/or-tree-v3/styles.d.ts +0 -1
  36. package/dist/bundled/v3/components/or-tree-v3/types.d.ts +0 -10
  37. package/dist/bundled/v3/components/or-tree-v3/utils.d.ts +0 -5
  38. package/dist/esm/v2/OrTree-32b2fede.js +0 -233
  39. package/dist/esm/v2/components/or-tree-v3/OrTree.vue.d.ts +0 -47
  40. package/dist/esm/v2/components/or-tree-v3/TreeNode.vue.d.ts +0 -82
  41. package/dist/esm/v2/components/or-tree-v3/index.d.ts +0 -2
  42. package/dist/esm/v2/components/or-tree-v3/index.js +0 -15
  43. package/dist/esm/v2/components/or-tree-v3/styles.d.ts +0 -1
  44. package/dist/esm/v2/components/or-tree-v3/types.d.ts +0 -10
  45. package/dist/esm/v2/components/or-tree-v3/utils.d.ts +0 -5
  46. package/dist/esm/v3/OrTree-bf625e80.js +0 -170
  47. package/dist/esm/v3/components/or-tree-v3/OrTree.vue.d.ts +0 -47
  48. package/dist/esm/v3/components/or-tree-v3/TreeNode.vue.d.ts +0 -82
  49. package/dist/esm/v3/components/or-tree-v3/index.d.ts +0 -2
  50. package/dist/esm/v3/components/or-tree-v3/index.js +0 -14
  51. package/dist/esm/v3/components/or-tree-v3/styles.d.ts +0 -1
  52. package/dist/esm/v3/components/or-tree-v3/types.d.ts +0 -10
  53. package/dist/esm/v3/components/or-tree-v3/utils.d.ts +0 -5
  54. package/src/components/or-tree-v3/OrTree.stories3.ts +0 -105
  55. package/src/components/or-tree-v3/OrTree.vue +0 -85
  56. package/src/components/or-tree-v3/TreeNode.vue +0 -72
  57. package/src/components/or-tree-v3/index.ts +0 -2
  58. package/src/components/or-tree-v3/styles.ts +0 -13
  59. package/src/components/or-tree-v3/types.ts +0 -12
  60. package/src/components/or-tree-v3/utils.ts +0 -31
@@ -384,7 +384,6 @@ var __vue_render__ = function () {
384
384
  }
385
385
  })], 1), _vm._v(" "), _c('OrPopover', {
386
386
  ref: "popover",
387
- class: _vm.dropdownStyles,
388
387
  attrs: {
389
388
  "variant": 'auto',
390
389
  "trigger": _vm.inputBoxRoot,
@@ -392,6 +391,8 @@ var __vue_render__ = function () {
392
391
  "full-width": true,
393
392
  "disable-default-styles": true
394
393
  }
394
+ }, [_c('div', {
395
+ class: _vm.dropdownStyles
395
396
  }, [_vm.enableSearch ? [_c('OrInput', {
396
397
  attrs: {
397
398
  "type": 'search',
@@ -445,7 +446,7 @@ var __vue_render__ = function () {
445
446
  }
446
447
  }
447
448
  }, [_vm._t("optionTemplate", function () {
448
- return [_vm._v("\n " + _vm._s(option.label) + "\n ")];
449
+ return [_vm._v("\n " + _vm._s(option.label) + "\n ")];
449
450
  }, {
450
451
  "model": _vm.proxyModelValue,
451
452
  "option": option
@@ -484,7 +485,7 @@ var __vue_render__ = function () {
484
485
  }
485
486
  }
486
487
  }, [_vm._t("optionTemplate", function () {
487
- return [_vm._v("\n " + _vm._s(option.label) + "\n ")];
488
+ return [_vm._v("\n " + _vm._s(option.label) + "\n ")];
488
489
  }, {
489
490
  "model": _vm.proxyModelValue,
490
491
  "option": option
@@ -492,8 +493,8 @@ var __vue_render__ = function () {
492
493
  })]] : [_c('div', {
493
494
  class: _vm.noSearchResultsStyles
494
495
  }, [_vm._t("noSearchResultsTemplate", function () {
495
- return [_vm._v("\n No results\n ")];
496
- })], 2)]], 2)], 2), _vm._v(" "), _c('div', {
496
+ return [_vm._v("\n No results\n ")];
497
+ })], 2)]], 2)])], 2), _vm._v(" "), _c('div', {
497
498
  directives: [{
498
499
  name: "show",
499
500
  rawName: "v-show",
@@ -93,4 +93,3 @@ export * from './or-toast';
93
93
  export * from './or-toast-v3';
94
94
  export * from './or-tooltip';
95
95
  export * from './or-tooltip-v3';
96
- export * from './or-tree-v3';
@@ -70,7 +70,7 @@ export { _ as OrSearch } from '../OrSearch-2fbdbec9.js';
70
70
  export { _ as OrSearchV3 } from '../OrSearch-da9725b4.js';
71
71
  export { _ as OrSegmentedControlV3, S as SegmentedControlSize } from '../OrSegmentedControl-a1ea5b72.js';
72
72
  export { _ as OrSelect } from '../OrSelect-03e79c4b.js';
73
- export { _ as OrSelectV3 } from '../OrSelect-8307ad20.js';
73
+ export { _ as OrSelectV3 } from '../OrSelect-4b901267.js';
74
74
  export { _ as OrSidebar, O as OrSidebarSide } from '../OrSidebar-feacf13a.js';
75
75
  export { _ as OrSidebarV3 } from '../OrSidebar-5ca2144a.js';
76
76
  export { O as OrSidebarPlacement } from '../OrSidebarCollapseButton-b8e678d4.js';
@@ -101,7 +101,6 @@ export { p as PropsV3, a as useQueueV3, u as useToastV3 } from '../useToast-0665
101
101
  export { _ as OrTooltip } from '../OrTooltip-cefc51f9.js';
102
102
  export { _ as OrTooltipContent } from '../OrTooltip.vue_rollup-plugin-vue_styles.0-154aac4c.js';
103
103
  export { _ as OrTooltipV3 } from '../OrTooltip-f5d1e4f0.js';
104
- export { _ as OrTreeV3 } from '../OrTree-32b2fede.js';
105
104
  import 'vue-demi';
106
105
  import 'lodash';
107
106
  import '../style-inject.es-4c6f2515.js';
@@ -1,4 +1,4 @@
1
- export { _ as OrSelectV3 } from '../../OrSelect-8307ad20.js';
1
+ export { _ as OrSelectV3 } from '../../OrSelect-4b901267.js';
2
2
  export { a as SelectSize } from '../../OrInputBox.vue_rollup-plugin-vue_script-23426690.js';
3
3
  import 'vue-demi';
4
4
  import '../../dropdown-open-0d314aa4.js';
@@ -70,7 +70,7 @@ export { _ as OrSearch } from './OrSearch-2fbdbec9.js';
70
70
  export { _ as OrSearchV3 } from './OrSearch-da9725b4.js';
71
71
  export { _ as OrSegmentedControlV3, S as SegmentedControlSize } from './OrSegmentedControl-a1ea5b72.js';
72
72
  export { _ as OrSelect } from './OrSelect-03e79c4b.js';
73
- export { _ as OrSelectV3 } from './OrSelect-8307ad20.js';
73
+ export { _ as OrSelectV3 } from './OrSelect-4b901267.js';
74
74
  export { _ as OrSidebar, O as OrSidebarSide } from './OrSidebar-feacf13a.js';
75
75
  export { _ as OrSidebarV3 } from './OrSidebar-5ca2144a.js';
76
76
  export { O as OrSidebarPlacement } from './OrSidebarCollapseButton-b8e678d4.js';
@@ -101,7 +101,6 @@ export { p as PropsV3, a as useQueueV3, u as useToastV3 } from './useToast-06654
101
101
  export { _ as OrTooltip } from './OrTooltip-cefc51f9.js';
102
102
  export { _ as OrTooltipContent } from './OrTooltip.vue_rollup-plugin-vue_styles.0-154aac4c.js';
103
103
  export { _ as OrTooltipV3 } from './OrTooltip-f5d1e4f0.js';
104
- export { _ as OrTreeV3 } from './OrTree-32b2fede.js';
105
104
  export { D as DropdownClose, a as DropdownOpen } from './dropdown-open-0d314aa4.js';
106
105
  export { u as useControlAttributes, a as useIdAttribute } from './useIdAttribute-859439f0.js';
107
106
  export { u as useElevation } from './useElevation-92fce12c.js';
@@ -377,14 +377,15 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
377
377
  variant: 'outlined'
378
378
  }, null, 8 /* PROPS */, ["icon"])]), createVNode(_component_OrPopover, {
379
379
  ref: "popover",
380
- class: normalizeClass(_ctx.dropdownStyles),
381
380
  variant: 'auto',
382
381
  trigger: _ctx.inputBoxRoot,
383
382
  placement: 'bottom',
384
383
  "full-width": true,
385
384
  "disable-default-styles": true
386
385
  }, {
387
- default: withCtx(() => [_ctx.enableSearch ? (openBlock(), createBlock(_component_OrInput, {
386
+ default: withCtx(() => [createElementVNode("div", {
387
+ class: normalizeClass(_ctx.dropdownStyles)
388
+ }, [_ctx.enableSearch ? (openBlock(), createBlock(_component_OrInput, {
388
389
  key: 0,
389
390
  modelValue: _ctx.searchText,
390
391
  "onUpdate:modelValue": _cache[2] || (_cache[2] = $event => _ctx.searchText = $event),
@@ -480,10 +481,10 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
480
481
  }), 128 /* KEYED_FRAGMENT */))], 64 /* STABLE_FRAGMENT */))], 64 /* STABLE_FRAGMENT */)) : (openBlock(), createElementBlock("div", {
481
482
  key: 2,
482
483
  class: normalizeClass(_ctx.noSearchResultsStyles)
483
- }, [renderSlot(_ctx.$slots, "noSearchResultsTemplate", {}, () => [createTextVNode(" No results ")])], 2 /* CLASS */))]),
484
+ }, [renderSlot(_ctx.$slots, "noSearchResultsTemplate", {}, () => [createTextVNode(" No results ")])], 2 /* CLASS */))], 2 /* CLASS */)]),
484
485
 
485
486
  _: 3 /* FORWARDED */
486
- }, 8 /* PROPS */, ["class", "trigger"])]),
487
+ }, 8 /* PROPS */, ["trigger"])]),
487
488
  _: 3 /* FORWARDED */
488
489
  }, 8 /* PROPS */, ["class", "variant", "size", "invalid", "readonly", "disabled"])), [[_directive_dropdown_open, _ctx.toggle], [_directive_dropdown_close, _ctx.close]]), withDirectives(createElementVNode("div", _hoisted_4, [_ctx.hint ? (openBlock(), createBlock(_component_OrHint, {
489
490
  key: 0,
@@ -93,4 +93,3 @@ export * from './or-toast';
93
93
  export * from './or-toast-v3';
94
94
  export * from './or-tooltip';
95
95
  export * from './or-tooltip-v3';
96
- export * from './or-tree-v3';
@@ -66,7 +66,7 @@ export { s as OrSearch } from '../OrSearch-1f80760e.js';
66
66
  export { s as OrSearchV3 } from '../OrSearch-b6a0f0e6.js';
67
67
  export { s as OrSegmentedControlV3, S as SegmentedControlSize } from '../OrSegmentedControl-4587c7a9.js';
68
68
  export { s as OrSelect } from '../OrSelect-88e5dfaf.js';
69
- export { s as OrSelectV3 } from '../OrSelect-c3a50846.js';
69
+ export { s as OrSelectV3 } from '../OrSelect-6ccd02ea.js';
70
70
  export { s as OrSidebar, O as OrSidebarSide } from '../OrSidebar-375c85a3.js';
71
71
  export { s as OrSidebarV3 } from '../OrSidebar-22253d76.js';
72
72
  export { O as OrSidebarPlacement } from '../OrSidebarCollapseButton-5154e452.js';
@@ -96,7 +96,6 @@ export { a as OrToastContainerV3, s as OrToastV3, t as TypesV3 } from '../types-
96
96
  export { p as PropsV3, a as useQueueV3, u as useToastV3 } from '../useToast-0665462d.js';
97
97
  export { s as OrTooltip, a as OrTooltipContent } from '../OrTooltip-8d7385bc.js';
98
98
  export { s as OrTooltipV3 } from '../OrTooltip-02f07fa2.js';
99
- export { s as OrTreeV3 } from '../OrTree-bf625e80.js';
100
99
  import 'vue-demi';
101
100
  import 'lodash';
102
101
  import 'vue';
@@ -1,4 +1,4 @@
1
- export { s as OrSelectV3 } from '../../OrSelect-c3a50846.js';
1
+ export { s as OrSelectV3 } from '../../OrSelect-6ccd02ea.js';
2
2
  export { a as SelectSize } from '../../OrInputBox-11389afd.js';
3
3
  import 'vue-demi';
4
4
  import '../../dropdown-open-0d314aa4.js';
@@ -66,7 +66,7 @@ export { s as OrSearch } from './OrSearch-1f80760e.js';
66
66
  export { s as OrSearchV3 } from './OrSearch-b6a0f0e6.js';
67
67
  export { s as OrSegmentedControlV3, S as SegmentedControlSize } from './OrSegmentedControl-4587c7a9.js';
68
68
  export { s as OrSelect } from './OrSelect-88e5dfaf.js';
69
- export { s as OrSelectV3 } from './OrSelect-c3a50846.js';
69
+ export { s as OrSelectV3 } from './OrSelect-6ccd02ea.js';
70
70
  export { s as OrSidebar, O as OrSidebarSide } from './OrSidebar-375c85a3.js';
71
71
  export { s as OrSidebarV3 } from './OrSidebar-22253d76.js';
72
72
  export { O as OrSidebarPlacement } from './OrSidebarCollapseButton-5154e452.js';
@@ -96,7 +96,6 @@ export { a as OrToastContainerV3, s as OrToastV3, t as TypesV3 } from './types-9
96
96
  export { p as PropsV3, a as useQueueV3, u as useToastV3 } from './useToast-0665462d.js';
97
97
  export { s as OrTooltip, a as OrTooltipContent } from './OrTooltip-8d7385bc.js';
98
98
  export { s as OrTooltipV3 } from './OrTooltip-02f07fa2.js';
99
- export { s as OrTreeV3 } from './OrTree-bf625e80.js';
100
99
  export { D as DropdownClose, a as DropdownOpen } from './dropdown-open-0d314aa4.js';
101
100
  export { u as useControlAttributes, a as useIdAttribute } from './useIdAttribute-859439f0.js';
102
101
  export { u as useElevation } from './useElevation-92fce12c.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/ui-components",
3
- "version": "3.0.2-beta.2476.0",
3
+ "version": "3.0.2-beta.2480.0",
4
4
  "description": "Vue components library for v2/3",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/auto/index.js",
@@ -93,4 +93,3 @@ export * from './or-toast';
93
93
  export * from './or-toast-v3';
94
94
  export * from './or-tooltip';
95
95
  export * from './or-tooltip-v3';
96
- export * from './or-tree-v3';
@@ -91,33 +91,72 @@
91
91
 
92
92
  <OrPopover
93
93
  ref="popover"
94
- :class="dropdownStyles"
95
94
  :variant="'auto'"
96
95
  :trigger="inputBoxRoot"
97
96
  :placement="'bottom'"
98
97
  :full-width="true"
99
98
  :disable-default-styles="true"
100
99
  >
101
- <template v-if="enableSearch">
102
- <OrInput
103
- v-model="searchText"
104
- :type="'search'"
105
- :placeholder="'Search'"
106
- :size="'s'"
107
- :disable-default-styles="true"
108
- />
109
- </template>
100
+ <div :class="dropdownStyles">
101
+ <template v-if="enableSearch">
102
+ <OrInput
103
+ v-model="searchText"
104
+ :type="'search'"
105
+ :placeholder="'Search'"
106
+ :size="'s'"
107
+ :disable-default-styles="true"
108
+ />
109
+ </template>
110
110
 
111
- <template v-if="resolvedSearchOptions.length > 0">
112
- <template v-if="groupByFunction">
113
- <OrExpansionPanel
114
- v-for="(group, groupName) in groupedOptions"
115
- :key="groupName"
116
- :label="groupName"
117
- >
111
+ <template v-if="resolvedSearchOptions.length > 0">
112
+ <template v-if="groupByFunction">
113
+ <OrExpansionPanel
114
+ v-for="(group, groupName) in groupedOptions"
115
+ :key="groupName"
116
+ :label="groupName"
117
+ >
118
+ <template v-if="multiple">
119
+ <OrMenuItem
120
+ v-for="option in group"
121
+ :key="option.value"
122
+ >
123
+ <slot
124
+ name="optionTemplate"
125
+ :model="proxyModelValue"
126
+ :option="option"
127
+ >
128
+ <OrCheckbox
129
+ v-model="proxyModelValue"
130
+ :value="option.value"
131
+ :label="option.label"
132
+ :label-variant="'input'"
133
+ />
134
+ </slot>
135
+ </OrMenuItem>
136
+ </template>
137
+
138
+ <template v-else>
139
+ <OrMenuItem
140
+ v-for="option in group"
141
+ :key="option.value"
142
+ @click.stop="proxyModelValue = option.value; close()"
143
+ >
144
+ <slot
145
+ name="optionTemplate"
146
+ :model="proxyModelValue"
147
+ :option="option"
148
+ >
149
+ {{ option.label }}
150
+ </slot>
151
+ </OrMenuItem>
152
+ </template>
153
+ </OrExpansionPanel>
154
+ </template>
155
+
156
+ <template v-else>
118
157
  <template v-if="multiple">
119
158
  <OrMenuItem
120
- v-for="option in group"
159
+ v-for="option in resolvedSearchOptions"
121
160
  :key="option.value"
122
161
  >
123
162
  <slot
@@ -137,7 +176,7 @@
137
176
 
138
177
  <template v-else>
139
178
  <OrMenuItem
140
- v-for="option in group"
179
+ v-for="option in resolvedSearchOptions"
141
180
  :key="option.value"
142
181
  @click.stop="proxyModelValue = option.value; close()"
143
182
  >
@@ -150,55 +189,17 @@
150
189
  </slot>
151
190
  </OrMenuItem>
152
191
  </template>
153
- </OrExpansionPanel>
192
+ </template>
154
193
  </template>
155
194
 
156
195
  <template v-else>
157
- <template v-if="multiple">
158
- <OrMenuItem
159
- v-for="option in resolvedSearchOptions"
160
- :key="option.value"
161
- >
162
- <slot
163
- name="optionTemplate"
164
- :model="proxyModelValue"
165
- :option="option"
166
- >
167
- <OrCheckbox
168
- v-model="proxyModelValue"
169
- :value="option.value"
170
- :label="option.label"
171
- :label-variant="'input'"
172
- />
173
- </slot>
174
- </OrMenuItem>
175
- </template>
176
-
177
- <template v-else>
178
- <OrMenuItem
179
- v-for="option in resolvedSearchOptions"
180
- :key="option.value"
181
- @click.stop="proxyModelValue = option.value; close()"
182
- >
183
- <slot
184
- name="optionTemplate"
185
- :model="proxyModelValue"
186
- :option="option"
187
- >
188
- {{ option.label }}
189
- </slot>
190
- </OrMenuItem>
191
- </template>
196
+ <div :class="noSearchResultsStyles">
197
+ <slot name="noSearchResultsTemplate">
198
+ No results
199
+ </slot>
200
+ </div>
192
201
  </template>
193
- </template>
194
-
195
- <template v-else>
196
- <div :class="noSearchResultsStyles">
197
- <slot name="noSearchResultsTemplate">
198
- No results
199
- </slot>
200
- </div>
201
- </template>
202
+ </div>
202
203
  </OrPopover>
203
204
  </OrInputBox>
204
205
 
@@ -1,236 +0,0 @@
1
- import './index-fa6eb4ca.js';
2
- import { O as OrIconButton } from './OrIconButton-d427d121.js';
3
- import { defineComponent } from '@vue/composition-api/dist/vue-composition-api.mjs';
4
- import { n as normalizeComponent } from './normalize-component-6e8e3d80.js';
5
-
6
- const getFlatTree = tree => {
7
- const flatTree = [];
8
- const nodeMetadataByKey = {};
9
- const goDeeper = (treeNode, level, parentNodeKey) => {
10
- flatTree.push(treeNode);
11
- nodeMetadataByKey[treeNode.key] = {
12
- level,
13
- isExpanded: false,
14
- parentNodeKey
15
- };
16
- if (treeNode.children) {
17
- for (const child of treeNode.children) {
18
- goDeeper(child, level + 1, treeNode.key);
19
- }
20
- }
21
- };
22
- for (const node of tree) {
23
- goDeeper(node, 0, '');
24
- }
25
- return {
26
- flatTree,
27
- nodeMetadataByKey
28
- };
29
- };
30
-
31
- const TreeNodeRoot = ['flex', 'items-center', 'gap-sm', 'pt-6', 'my-sm',
32
- // Theme
33
- 'text-on-background', 'dark:text-on-background-dark', 'hover:bg-primary-opacity-0-08', 'dark:hover:bg-primary-opacity-0-08-dark'];
34
-
35
- var script$1 = defineComponent({
36
- components: {
37
- OrIconButton
38
- },
39
- props: {
40
- node: {
41
- type: Object,
42
- default: undefined
43
- },
44
- nodeKey: {
45
- type: String,
46
- default: ''
47
- },
48
- isExpanded: {
49
- type: Boolean,
50
- default: false
51
- },
52
- isLeaf: {
53
- type: Boolean,
54
- default: false
55
- },
56
- level: {
57
- type: Number,
58
- default: 0
59
- }
60
- },
61
- emits: ['trigger-expand'],
62
- setup() {
63
- return {
64
- rootClasses: TreeNodeRoot
65
- };
66
- },
67
- computed: {
68
- expandIcon() {
69
- return this.isExpanded ? 'keyboard_arrow_down' : 'arrow_right';
70
- },
71
- styleCSS() {
72
- return {
73
- // 24px -- gap-sm + tooltip width
74
- 'padding-left': this.isLeaf && this.level === 0 ? '24px' : `${(this.isLeaf ? 24 : 0) + this.level * 10}px`
75
- };
76
- }
77
- }
78
- });
79
-
80
- /* script */
81
- const __vue_script__$1 = script$1;
82
-
83
- /* template */
84
- var __vue_render__$1 = function () {
85
- var _vm = this;
86
- var _h = _vm.$createElement;
87
- var _c = _vm._self._c || _h;
88
- return _c('div', {
89
- staticClass: "tree-node",
90
- class: _vm.rootClasses,
91
- style: _vm.styleCSS
92
- }, [!_vm.isLeaf ? _c('or-icon-button', {
93
- attrs: {
94
- "icon": _vm.expandIcon
95
- },
96
- on: {
97
- "click": function ($event) {
98
- return _vm.$emit('trigger-expand', _vm.nodeKey);
99
- }
100
- }
101
- }) : _vm._e(), _vm._v(" "), _vm._t("default", function () {
102
- return [_vm._v("\n " + _vm._s(_vm.nodeKey) + "\n ")];
103
- }, null, _vm.$props)], 2);
104
- };
105
- var __vue_staticRenderFns__$1 = [];
106
-
107
- /* style */
108
- const __vue_inject_styles__$1 = undefined;
109
- /* scoped */
110
- const __vue_scope_id__$1 = undefined;
111
- /* module identifier */
112
- const __vue_module_identifier__$1 = undefined;
113
- /* functional template */
114
- const __vue_is_functional_template__$1 = false;
115
- /* style inject */
116
-
117
- /* style inject SSR */
118
-
119
- /* style inject shadow dom */
120
-
121
- const __vue_component__$2 = /*#__PURE__*/normalizeComponent({
122
- render: __vue_render__$1,
123
- staticRenderFns: __vue_staticRenderFns__$1
124
- }, __vue_inject_styles__$1, __vue_script__$1, __vue_scope_id__$1, __vue_is_functional_template__$1, __vue_module_identifier__$1, false, undefined, undefined, undefined);
125
- var TreeNode = __vue_component__$2;
126
-
127
- var script = defineComponent({
128
- components: {
129
- TreeNode
130
- },
131
- props: {
132
- initialData: {
133
- type: Array,
134
- default: () => []
135
- },
136
- identifierKey: {
137
- type: String,
138
- default: 'key'
139
- }
140
- },
141
- data() {
142
- return {
143
- flatTree: [],
144
- nodeMetadataByKey: {}
145
- };
146
- },
147
- computed: {
148
- visibleItems() {
149
- return this.flatTree.filter(treeNode => {
150
- return this.isNodeExpanded(treeNode.key);
151
- });
152
- }
153
- },
154
- mounted() {
155
- const {
156
- nodeMetadataByKey,
157
- flatTree
158
- } = getFlatTree(this.initialData);
159
- this.flatTree = flatTree;
160
- this.nodeMetadataByKey = nodeMetadataByKey;
161
- },
162
- methods: {
163
- onTriggerExpand(key) {
164
- this.nodeMetadataByKey[key].isExpanded = !this.nodeMetadataByKey[key].isExpanded;
165
- },
166
- isNodeExpanded(key) {
167
- const {
168
- parentNodeKey,
169
- level
170
- } = this.nodeMetadataByKey[key];
171
- const parentMetadata = this.nodeMetadataByKey[parentNodeKey];
172
- if (level === 0) return true;
173
- if (!parentMetadata.isExpanded) return false;
174
- return this.isNodeExpanded(parentNodeKey);
175
- }
176
- }
177
- });
178
-
179
- /* script */
180
- const __vue_script__ = script;
181
-
182
- /* template */
183
- var __vue_render__ = function () {
184
- var _vm = this;
185
- var _h = _vm.$createElement;
186
- var _c = _vm._self._c || _h;
187
- return _c('div', {
188
- staticClass: "or-tree",
189
- on: {
190
- "drop": _vm.onDrop
191
- }
192
- }, _vm._l(_vm.visibleItems, function (node) {
193
- return _c('tree-node', {
194
- key: node[_vm.identifierKey],
195
- attrs: {
196
- "node": node,
197
- "node-key": node[_vm.identifierKey],
198
- "is-expanded": _vm.nodeMetadataByKey[node.key].isExpanded,
199
- "is-leaf": !!node.isLeaf,
200
- "level": _vm.nodeMetadataByKey[node.key].level
201
- },
202
- on: {
203
- "trigger-expand": _vm.onTriggerExpand
204
- },
205
- scopedSlots: _vm._u([{
206
- key: "default",
207
- fn: function (props) {
208
- return [_vm._t("default", null, null, props)];
209
- }
210
- }], null, true)
211
- });
212
- }), 1);
213
- };
214
- var __vue_staticRenderFns__ = [];
215
-
216
- /* style */
217
- const __vue_inject_styles__ = undefined;
218
- /* scoped */
219
- const __vue_scope_id__ = undefined;
220
- /* module identifier */
221
- const __vue_module_identifier__ = undefined;
222
- /* functional template */
223
- const __vue_is_functional_template__ = false;
224
- /* style inject */
225
-
226
- /* style inject SSR */
227
-
228
- /* style inject shadow dom */
229
-
230
- const __vue_component__ = /*#__PURE__*/normalizeComponent({
231
- render: __vue_render__,
232
- staticRenderFns: __vue_staticRenderFns__
233
- }, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, false, undefined, undefined, undefined);
234
- var __vue_component__$1 = __vue_component__;
235
-
236
- export { __vue_component__$1 as _ };
@@ -1,47 +0,0 @@
1
- import { PropType } from 'vue-demi';
2
- import { ITreeNode, ITreeNodeMetadata } from './types';
3
- declare const _default: import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<import("@vue/composition-api").Data> & {
4
- flatTree: ITreeNode[];
5
- nodeMetadataByKey: Record<string, ITreeNodeMetadata>;
6
- }, {
7
- onTriggerExpand(key: string): void;
8
- isNodeExpanded(key: string): boolean;
9
- }, {
10
- visibleItems(): ITreeNode[];
11
- }, {
12
- initialData: {
13
- type: PropType<ITreeNode[]>;
14
- default: () => never[];
15
- };
16
- identifierKey: {
17
- type: StringConstructor;
18
- default: string;
19
- };
20
- }, import("@vue/composition-api").ExtractPropTypes<{
21
- initialData: {
22
- type: PropType<ITreeNode[]>;
23
- default: () => never[];
24
- };
25
- identifierKey: {
26
- type: StringConstructor;
27
- default: string;
28
- };
29
- }>> & Omit<import("vue").VueConstructor<import("vue").default>, never> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{
30
- initialData: ITreeNode[];
31
- identifierKey: string;
32
- } & {}, import("@vue/composition-api").ShallowUnwrapRef<import("@vue/composition-api").Data>, {
33
- flatTree: ITreeNode[];
34
- nodeMetadataByKey: Record<string, ITreeNodeMetadata>;
35
- }, {
36
- visibleItems(): ITreeNode[];
37
- }, {
38
- onTriggerExpand(key: string): void;
39
- isNodeExpanded(key: string): boolean;
40
- }, {}, {}, {}, {
41
- initialData: ITreeNode[];
42
- identifierKey: string;
43
- } & {}, {
44
- initialData: ITreeNode[];
45
- identifierKey: string;
46
- }, true>);
47
- export default _default;