@onereach/ui-components 3.0.2-beta.2480.0 → 3.0.2-beta.2641.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.
- package/dist/bundled/v2/{OrSelect-33f58941.js → OrSelect-0b9b27e9.js} +5 -6
- package/dist/bundled/v2/OrTree-b8e47647.js +236 -0
- package/dist/bundled/v2/components/index.d.ts +1 -0
- package/dist/bundled/v2/components/index.js +2 -1
- package/dist/bundled/v2/components/or-select-v3/index.js +1 -1
- package/dist/bundled/v2/components/or-tree-v3/OrTree.vue.d.ts +47 -0
- package/dist/bundled/v2/components/or-tree-v3/TreeNode.vue.d.ts +82 -0
- package/dist/bundled/v2/components/or-tree-v3/index.d.ts +2 -0
- package/dist/bundled/v2/components/or-tree-v3/index.js +17 -0
- package/dist/bundled/v2/components/or-tree-v3/styles.d.ts +1 -0
- package/dist/bundled/v2/components/or-tree-v3/types.d.ts +10 -0
- package/dist/bundled/v2/components/or-tree-v3/utils.d.ts +5 -0
- package/dist/bundled/v2/index.js +3 -2
- package/dist/bundled/v3/OrTree.vue_vue_type_script_lang-9a31b9b4.js +146 -0
- package/dist/bundled/v3/components/index.d.ts +1 -0
- package/dist/bundled/v3/components/index.js +1 -0
- package/dist/bundled/v3/components/or-tree-v3/OrTree.vue.d.ts +47 -0
- package/dist/bundled/v3/components/or-tree-v3/TreeNode.vue.d.ts +82 -0
- package/dist/bundled/v3/components/or-tree-v3/index.d.ts +2 -0
- package/dist/bundled/v3/components/or-tree-v3/index.js +16 -0
- package/dist/bundled/v3/components/or-tree-v3/styles.d.ts +1 -0
- package/dist/bundled/v3/components/or-tree-v3/types.d.ts +10 -0
- package/dist/bundled/v3/components/or-tree-v3/utils.d.ts +5 -0
- package/dist/bundled/v3/index.js +141 -116
- package/dist/esm/v2/{OrSelect-4b901267.js → OrSelect-8307ad20.js} +5 -6
- package/dist/esm/v2/OrTree-32b2fede.js +233 -0
- package/dist/esm/v2/components/index.d.ts +1 -0
- package/dist/esm/v2/components/index.js +2 -1
- package/dist/esm/v2/components/or-select-v3/index.js +1 -1
- package/dist/esm/v2/components/or-tree-v3/OrTree.vue.d.ts +47 -0
- package/dist/esm/v2/components/or-tree-v3/TreeNode.vue.d.ts +82 -0
- package/dist/esm/v2/components/or-tree-v3/index.d.ts +2 -0
- package/dist/esm/v2/components/or-tree-v3/index.js +15 -0
- package/dist/esm/v2/components/or-tree-v3/styles.d.ts +1 -0
- package/dist/esm/v2/components/or-tree-v3/types.d.ts +10 -0
- package/dist/esm/v2/components/or-tree-v3/utils.d.ts +5 -0
- package/dist/esm/v2/index.js +2 -1
- package/dist/esm/v3/{OrSelect-6ccd02ea.js → OrSelect-c3a50846.js} +4 -5
- package/dist/esm/v3/OrTree-bf625e80.js +170 -0
- package/dist/esm/v3/components/index.d.ts +1 -0
- package/dist/esm/v3/components/index.js +2 -1
- package/dist/esm/v3/components/or-select-v3/index.js +1 -1
- package/dist/esm/v3/components/or-tree-v3/OrTree.vue.d.ts +47 -0
- package/dist/esm/v3/components/or-tree-v3/TreeNode.vue.d.ts +82 -0
- package/dist/esm/v3/components/or-tree-v3/index.d.ts +2 -0
- package/dist/esm/v3/components/or-tree-v3/index.js +14 -0
- package/dist/esm/v3/components/or-tree-v3/styles.d.ts +1 -0
- package/dist/esm/v3/components/or-tree-v3/types.d.ts +10 -0
- package/dist/esm/v3/components/or-tree-v3/utils.d.ts +5 -0
- package/dist/esm/v3/index.js +2 -1
- package/package.json +2 -2
- package/src/components/index.ts +1 -0
- package/src/components/or-select-v3/OrSelect.vue +64 -65
- package/src/components/or-tree-v3/OrTree.stories3.ts +105 -0
- package/src/components/or-tree-v3/OrTree.vue +85 -0
- package/src/components/or-tree-v3/TreeNode.vue +72 -0
- package/src/components/or-tree-v3/index.ts +2 -0
- package/src/components/or-tree-v3/styles.ts +13 -0
- package/src/components/or-tree-v3/types.ts +12 -0
- package/src/components/or-tree-v3/utils.ts +31 -0
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { defineComponent } from 'vue-demi';
|
|
2
|
+
import { s as script$2 } from './OrIconButton-41ee266c.js';
|
|
3
|
+
import { resolveComponent, openBlock, createElementBlock, normalizeClass, normalizeStyle, createBlock, createCommentVNode, renderSlot, normalizeProps, guardReactiveProps, createTextVNode, toDisplayString, Fragment, renderList, withCtx } from 'vue';
|
|
4
|
+
|
|
5
|
+
const getFlatTree = tree => {
|
|
6
|
+
const flatTree = [];
|
|
7
|
+
const nodeMetadataByKey = {};
|
|
8
|
+
const goDeeper = (treeNode, level, parentNodeKey) => {
|
|
9
|
+
flatTree.push(treeNode);
|
|
10
|
+
nodeMetadataByKey[treeNode.key] = {
|
|
11
|
+
level,
|
|
12
|
+
isExpanded: false,
|
|
13
|
+
parentNodeKey
|
|
14
|
+
};
|
|
15
|
+
if (treeNode.children) {
|
|
16
|
+
for (const child of treeNode.children) {
|
|
17
|
+
goDeeper(child, level + 1, treeNode.key);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
for (const node of tree) {
|
|
22
|
+
goDeeper(node, 0, '');
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
flatTree,
|
|
26
|
+
nodeMetadataByKey
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const TreeNodeRoot = ['flex', 'items-center', 'gap-sm', 'pt-6', 'my-sm',
|
|
31
|
+
// Theme
|
|
32
|
+
'text-on-background', 'dark:text-on-background-dark', 'hover:bg-primary-opacity-0-08', 'dark:hover:bg-primary-opacity-0-08-dark'];
|
|
33
|
+
|
|
34
|
+
var script$1 = defineComponent({
|
|
35
|
+
components: {
|
|
36
|
+
OrIconButton: script$2
|
|
37
|
+
},
|
|
38
|
+
props: {
|
|
39
|
+
node: {
|
|
40
|
+
type: Object,
|
|
41
|
+
default: undefined
|
|
42
|
+
},
|
|
43
|
+
nodeKey: {
|
|
44
|
+
type: String,
|
|
45
|
+
default: ''
|
|
46
|
+
},
|
|
47
|
+
isExpanded: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
default: false
|
|
50
|
+
},
|
|
51
|
+
isLeaf: {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
default: false
|
|
54
|
+
},
|
|
55
|
+
level: {
|
|
56
|
+
type: Number,
|
|
57
|
+
default: 0
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
emits: ['trigger-expand'],
|
|
61
|
+
setup() {
|
|
62
|
+
return {
|
|
63
|
+
rootClasses: TreeNodeRoot
|
|
64
|
+
};
|
|
65
|
+
},
|
|
66
|
+
computed: {
|
|
67
|
+
expandIcon() {
|
|
68
|
+
return this.isExpanded ? 'keyboard_arrow_down' : 'arrow_right';
|
|
69
|
+
},
|
|
70
|
+
styleCSS() {
|
|
71
|
+
return {
|
|
72
|
+
// 24px -- gap-sm + tooltip width
|
|
73
|
+
'padding-left': this.isLeaf && this.level === 0 ? '24px' : `${(this.isLeaf ? 24 : 0) + this.level * 10}px`
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
function render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
80
|
+
const _component_or_icon_button = resolveComponent("or-icon-button");
|
|
81
|
+
return openBlock(), createElementBlock("div", {
|
|
82
|
+
class: normalizeClass(["tree-node", _ctx.rootClasses]),
|
|
83
|
+
style: normalizeStyle(_ctx.styleCSS)
|
|
84
|
+
}, [!_ctx.isLeaf ? (openBlock(), createBlock(_component_or_icon_button, {
|
|
85
|
+
key: 0,
|
|
86
|
+
icon: _ctx.expandIcon,
|
|
87
|
+
onClick: _cache[0] || (_cache[0] = $event => _ctx.$emit('trigger-expand', _ctx.nodeKey))
|
|
88
|
+
}, null, 8 /* PROPS */, ["icon"])) : createCommentVNode("v-if", true), renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(_ctx.$props)), () => [createTextVNode(toDisplayString(_ctx.nodeKey), 1 /* TEXT */)])], 6 /* CLASS, STYLE */);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
script$1.render = render$1;
|
|
92
|
+
script$1.__file = "src/components/or-tree-v3/TreeNode.vue";
|
|
93
|
+
|
|
94
|
+
var script = defineComponent({
|
|
95
|
+
components: {
|
|
96
|
+
TreeNode: script$1
|
|
97
|
+
},
|
|
98
|
+
props: {
|
|
99
|
+
initialData: {
|
|
100
|
+
type: Array,
|
|
101
|
+
default: () => []
|
|
102
|
+
},
|
|
103
|
+
identifierKey: {
|
|
104
|
+
type: String,
|
|
105
|
+
default: 'key'
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
data() {
|
|
109
|
+
return {
|
|
110
|
+
flatTree: [],
|
|
111
|
+
nodeMetadataByKey: {}
|
|
112
|
+
};
|
|
113
|
+
},
|
|
114
|
+
computed: {
|
|
115
|
+
visibleItems() {
|
|
116
|
+
return this.flatTree.filter(treeNode => {
|
|
117
|
+
return this.isNodeExpanded(treeNode.key);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
mounted() {
|
|
122
|
+
const {
|
|
123
|
+
nodeMetadataByKey,
|
|
124
|
+
flatTree
|
|
125
|
+
} = getFlatTree(this.initialData);
|
|
126
|
+
this.flatTree = flatTree;
|
|
127
|
+
this.nodeMetadataByKey = nodeMetadataByKey;
|
|
128
|
+
},
|
|
129
|
+
methods: {
|
|
130
|
+
onTriggerExpand(key) {
|
|
131
|
+
this.nodeMetadataByKey[key].isExpanded = !this.nodeMetadataByKey[key].isExpanded;
|
|
132
|
+
},
|
|
133
|
+
isNodeExpanded(key) {
|
|
134
|
+
const {
|
|
135
|
+
parentNodeKey,
|
|
136
|
+
level
|
|
137
|
+
} = this.nodeMetadataByKey[key];
|
|
138
|
+
const parentMetadata = this.nodeMetadataByKey[parentNodeKey];
|
|
139
|
+
if (level === 0) return true;
|
|
140
|
+
if (!parentMetadata.isExpanded) return false;
|
|
141
|
+
return this.isNodeExpanded(parentNodeKey);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
147
|
+
const _component_tree_node = resolveComponent("tree-node");
|
|
148
|
+
return openBlock(), createElementBlock("div", {
|
|
149
|
+
class: "or-tree",
|
|
150
|
+
onDrop: _cache[0] || (_cache[0] = (...args) => _ctx.onDrop && _ctx.onDrop(...args))
|
|
151
|
+
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.visibleItems, node => {
|
|
152
|
+
return openBlock(), createBlock(_component_tree_node, {
|
|
153
|
+
key: node[_ctx.identifierKey],
|
|
154
|
+
node: node,
|
|
155
|
+
"node-key": node[_ctx.identifierKey],
|
|
156
|
+
"is-expanded": _ctx.nodeMetadataByKey[node.key].isExpanded,
|
|
157
|
+
"is-leaf": !!node.isLeaf,
|
|
158
|
+
level: _ctx.nodeMetadataByKey[node.key].level,
|
|
159
|
+
onTriggerExpand: _ctx.onTriggerExpand
|
|
160
|
+
}, {
|
|
161
|
+
default: withCtx(props => [renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(props)))]),
|
|
162
|
+
_: 2 /* DYNAMIC */
|
|
163
|
+
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["node", "node-key", "is-expanded", "is-leaf", "level", "onTriggerExpand"]);
|
|
164
|
+
}), 128 /* KEYED_FRAGMENT */))], 32 /* HYDRATE_EVENTS */);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
script.render = render;
|
|
168
|
+
script.__file = "src/components/or-tree-v3/OrTree.vue";
|
|
169
|
+
|
|
170
|
+
export { script as s };
|
|
@@ -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-
|
|
69
|
+
export { s as OrSelectV3 } from '../OrSelect-c3a50846.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,6 +96,7 @@ 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';
|
|
99
100
|
import 'vue-demi';
|
|
100
101
|
import 'lodash';
|
|
101
102
|
import 'vue';
|
|
@@ -0,0 +1,47 @@
|
|
|
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;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { PropType } from 'vue-demi';
|
|
2
|
+
import { ITreeNode } from './types';
|
|
3
|
+
declare const _default: import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<{
|
|
4
|
+
rootClasses: string[];
|
|
5
|
+
}> & import("@vue/composition-api").Data, {}, {
|
|
6
|
+
expandIcon(): "keyboard_arrow_down" | "arrow_right";
|
|
7
|
+
styleCSS(): {
|
|
8
|
+
'padding-left': string;
|
|
9
|
+
};
|
|
10
|
+
}, {
|
|
11
|
+
node: {
|
|
12
|
+
type: PropType<ITreeNode>;
|
|
13
|
+
default: undefined;
|
|
14
|
+
};
|
|
15
|
+
nodeKey: {
|
|
16
|
+
type: StringConstructor;
|
|
17
|
+
default: string;
|
|
18
|
+
};
|
|
19
|
+
isExpanded: {
|
|
20
|
+
type: BooleanConstructor;
|
|
21
|
+
default: boolean;
|
|
22
|
+
};
|
|
23
|
+
isLeaf: {
|
|
24
|
+
type: BooleanConstructor;
|
|
25
|
+
default: boolean;
|
|
26
|
+
};
|
|
27
|
+
level: {
|
|
28
|
+
type: NumberConstructor;
|
|
29
|
+
default: number;
|
|
30
|
+
};
|
|
31
|
+
}, import("@vue/composition-api").ExtractPropTypes<{
|
|
32
|
+
node: {
|
|
33
|
+
type: PropType<ITreeNode>;
|
|
34
|
+
default: undefined;
|
|
35
|
+
};
|
|
36
|
+
nodeKey: {
|
|
37
|
+
type: StringConstructor;
|
|
38
|
+
default: string;
|
|
39
|
+
};
|
|
40
|
+
isExpanded: {
|
|
41
|
+
type: BooleanConstructor;
|
|
42
|
+
default: boolean;
|
|
43
|
+
};
|
|
44
|
+
isLeaf: {
|
|
45
|
+
type: BooleanConstructor;
|
|
46
|
+
default: boolean;
|
|
47
|
+
};
|
|
48
|
+
level: {
|
|
49
|
+
type: NumberConstructor;
|
|
50
|
+
default: number;
|
|
51
|
+
};
|
|
52
|
+
}>> & Omit<import("vue").VueConstructor<import("vue").default>, never> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{
|
|
53
|
+
node: ITreeNode;
|
|
54
|
+
nodeKey: string;
|
|
55
|
+
isExpanded: boolean;
|
|
56
|
+
isLeaf: boolean;
|
|
57
|
+
level: number;
|
|
58
|
+
} & {} & {
|
|
59
|
+
[x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
|
|
60
|
+
}, import("@vue/composition-api").ShallowUnwrapRef<{
|
|
61
|
+
rootClasses: string[];
|
|
62
|
+
}>, import("@vue/composition-api").Data, {
|
|
63
|
+
expandIcon(): "keyboard_arrow_down" | "arrow_right";
|
|
64
|
+
styleCSS(): {
|
|
65
|
+
'padding-left': string;
|
|
66
|
+
};
|
|
67
|
+
}, {}, {}, {}, string[], {
|
|
68
|
+
node: ITreeNode;
|
|
69
|
+
nodeKey: string;
|
|
70
|
+
isExpanded: boolean;
|
|
71
|
+
isLeaf: boolean;
|
|
72
|
+
level: number;
|
|
73
|
+
} & {} & {
|
|
74
|
+
[x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
|
|
75
|
+
}, {
|
|
76
|
+
node: ITreeNode;
|
|
77
|
+
nodeKey: string;
|
|
78
|
+
isExpanded: boolean;
|
|
79
|
+
isLeaf: boolean;
|
|
80
|
+
level: number;
|
|
81
|
+
}, true>);
|
|
82
|
+
export default _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { s as OrTreeV3 } from '../../OrTree-bf625e80.js';
|
|
2
|
+
import 'vue-demi';
|
|
3
|
+
import '../../OrIconButton-41ee266c.js';
|
|
4
|
+
import '../../OrIcon-62793572.js';
|
|
5
|
+
import 'vue';
|
|
6
|
+
import '../../OrTooltip-02f07fa2.js';
|
|
7
|
+
import '@vueuse/core';
|
|
8
|
+
import '../../OrPopover-52250a03.js';
|
|
9
|
+
import '@floating-ui/dom';
|
|
10
|
+
import '../../useElevation-92fce12c.js';
|
|
11
|
+
import '../../useResponsive-a02e95b7.js';
|
|
12
|
+
import '../../OrBottomSheet-0f24ecae.js';
|
|
13
|
+
import '../../OrOverlay-7cf03aea.js';
|
|
14
|
+
import '../../OrTeleport.vue3-8099178c.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const TreeNodeRoot: string[];
|
package/dist/esm/v3/index.js
CHANGED
|
@@ -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-
|
|
69
|
+
export { s as OrSelectV3 } from './OrSelect-c3a50846.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,6 +96,7 @@ 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';
|
|
99
100
|
export { D as DropdownClose, a as DropdownOpen } from './dropdown-open-0d314aa4.js';
|
|
100
101
|
export { u as useControlAttributes, a as useIdAttribute } from './useIdAttribute-859439f0.js';
|
|
101
102
|
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.
|
|
3
|
+
"version": "3.0.2-beta.2641.0",
|
|
4
4
|
"description": "Vue components library for v2/3",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "./dist/auto/index.js",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@codemirror/lang-json": "6.0.0",
|
|
39
39
|
"@codemirror/lang-markdown": "6.0.1",
|
|
40
40
|
"@floating-ui/dom": "0.3.1",
|
|
41
|
-
"@onereach/styles": "^2.37.
|
|
41
|
+
"@onereach/styles": "^2.37.4-beta.2641.0",
|
|
42
42
|
"@splidejs/splide": "4.0.6",
|
|
43
43
|
"@types/lodash": "4.14.173",
|
|
44
44
|
"@types/sortablejs": "1.10.7",
|
package/src/components/index.ts
CHANGED
|
@@ -91,72 +91,33 @@
|
|
|
91
91
|
|
|
92
92
|
<OrPopover
|
|
93
93
|
ref="popover"
|
|
94
|
+
:class="dropdownStyles"
|
|
94
95
|
:variant="'auto'"
|
|
95
96
|
:trigger="inputBoxRoot"
|
|
96
97
|
:placement="'bottom'"
|
|
97
98
|
:full-width="true"
|
|
98
99
|
:disable-default-styles="true"
|
|
99
100
|
>
|
|
100
|
-
<
|
|
101
|
-
<
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
</template>
|
|
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
|
-
>
|
|
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>
|
|
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>
|
|
155
110
|
|
|
156
|
-
|
|
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
|
+
>
|
|
157
118
|
<template v-if="multiple">
|
|
158
119
|
<OrMenuItem
|
|
159
|
-
v-for="option in
|
|
120
|
+
v-for="option in group"
|
|
160
121
|
:key="option.value"
|
|
161
122
|
>
|
|
162
123
|
<slot
|
|
@@ -176,7 +137,7 @@
|
|
|
176
137
|
|
|
177
138
|
<template v-else>
|
|
178
139
|
<OrMenuItem
|
|
179
|
-
v-for="option in
|
|
140
|
+
v-for="option in group"
|
|
180
141
|
:key="option.value"
|
|
181
142
|
@click.stop="proxyModelValue = option.value; close()"
|
|
182
143
|
>
|
|
@@ -189,17 +150,55 @@
|
|
|
189
150
|
</slot>
|
|
190
151
|
</OrMenuItem>
|
|
191
152
|
</template>
|
|
192
|
-
</
|
|
153
|
+
</OrExpansionPanel>
|
|
193
154
|
</template>
|
|
194
155
|
|
|
195
156
|
<template v-else>
|
|
196
|
-
<
|
|
197
|
-
<
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
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>
|
|
201
192
|
</template>
|
|
202
|
-
</
|
|
193
|
+
</template>
|
|
194
|
+
|
|
195
|
+
<template v-else>
|
|
196
|
+
<div :class="noSearchResultsStyles">
|
|
197
|
+
<slot name="noSearchResultsTemplate">
|
|
198
|
+
No results
|
|
199
|
+
</slot>
|
|
200
|
+
</div>
|
|
201
|
+
</template>
|
|
203
202
|
</OrPopover>
|
|
204
203
|
</OrInputBox>
|
|
205
204
|
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { action } from '@storybook/addon-actions';
|
|
2
|
+
import { StoryFn } from '@storybook/vue3';
|
|
3
|
+
import OrTree from './OrTree.vue';
|
|
4
|
+
|
|
5
|
+
const TREE_DATA = [
|
|
6
|
+
{
|
|
7
|
+
key: '0-0',
|
|
8
|
+
children: [
|
|
9
|
+
{
|
|
10
|
+
key: '0-0-0',
|
|
11
|
+
children: [
|
|
12
|
+
{
|
|
13
|
+
key: '0-0-0-0',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
key: '0-0-0-1',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
key: '0-0-0-2',
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
key: '0-0-1',
|
|
25
|
+
children: [
|
|
26
|
+
{
|
|
27
|
+
key: '0-0-1-0',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
key: '0-0-1-1',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
key: '0-0-1-2',
|
|
34
|
+
children: [
|
|
35
|
+
{
|
|
36
|
+
key: '0-0-1-2-0',
|
|
37
|
+
isLeaf: true,
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
key: '0-0-2',
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
key: '0-1',
|
|
50
|
+
children: [
|
|
51
|
+
{
|
|
52
|
+
key: '0-1-0-0',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
key: '0-1-0-1',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
key: '0-1-0-2',
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
key: '0-2',
|
|
64
|
+
isLeaf: true,
|
|
65
|
+
},
|
|
66
|
+
];
|
|
67
|
+
|
|
68
|
+
export default {
|
|
69
|
+
title: 'Components/Tree',
|
|
70
|
+
component: OrTree,
|
|
71
|
+
argTypes: {
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const Template: StoryFn<typeof OrTree> = (args) => ({
|
|
76
|
+
components: {
|
|
77
|
+
OrTree,
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
data() {
|
|
81
|
+
return {
|
|
82
|
+
TREE_DATA,
|
|
83
|
+
};
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
setup() {
|
|
87
|
+
return {
|
|
88
|
+
args,
|
|
89
|
+
onUpdateState: action('update:state'),
|
|
90
|
+
};
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
template: `
|
|
94
|
+
<OrTree
|
|
95
|
+
v-bind="args"
|
|
96
|
+
/>
|
|
97
|
+
`,
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
export const Default = Template.bind({});
|
|
101
|
+
|
|
102
|
+
Default.args = {
|
|
103
|
+
// Props
|
|
104
|
+
initialData: TREE_DATA,
|
|
105
|
+
};
|