@opentinyvue/vue-tree-menu 2.21.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/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 - present TinyVue Authors.
4
+ Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/index.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Copyright (c) 2022 - present TinyVue Authors.
3
+ * Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license.
6
+ *
7
+ * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
8
+ * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
9
+ * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
10
+ *
11
+ */
12
+ import TreeMenu from './src/pc.vue';
13
+ export default TreeMenu;
package/lib/index.js ADDED
@@ -0,0 +1,312 @@
1
+ import { $props, defineComponent, $prefix, setup } from '@opentinyvue/vue-common';
2
+ import { renderless, api } from '@opentinyvue/vue-renderless/tree-menu/vue';
3
+ import Tree from '@opentinyvue/vue-tree';
4
+ import Input from '@opentinyvue/vue-input';
5
+ import { iconSearch, iconLeftWardArrow, iconEditorMenuLeft, iconEditorMenuRight } from '@opentinyvue/vue-icon';
6
+ import '@opentinyvue/vue-theme/tree-menu/index.css';
7
+
8
+ function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
9
+ var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
10
+ if (render) {
11
+ options.render = render;
12
+ options.staticRenderFns = staticRenderFns;
13
+ options._compiled = true;
14
+ }
15
+ var hook;
16
+ if (injectStyles) {
17
+ hook = injectStyles;
18
+ }
19
+ if (hook) {
20
+ if (options.functional) {
21
+ options._injectStyles = hook;
22
+ var originalRender = options.render;
23
+ options.render = function renderWithStyleInjection(h, context) {
24
+ hook.call(context);
25
+ return originalRender(h, context);
26
+ };
27
+ } else {
28
+ var existing = options.beforeCreate;
29
+ options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
30
+ }
31
+ }
32
+ return {
33
+ exports: scriptExports,
34
+ options
35
+ };
36
+ }
37
+
38
+ function _extends() {
39
+ return _extends = Object.assign ? Object.assign.bind() : function(n) {
40
+ for (var e = 1; e < arguments.length; e++) {
41
+ var t = arguments[e];
42
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
43
+ }
44
+ return n;
45
+ }, _extends.apply(null, arguments);
46
+ }
47
+ var treeMenuProps = _extends({}, $props, {
48
+ placeholder: {
49
+ default: "",
50
+ type: String
51
+ },
52
+ data: Array,
53
+ nodeKey: String,
54
+ defaultExpandAll: Boolean,
55
+ suffixIcon: Object,
56
+ searchIcon: {
57
+ type: Object,
58
+ default: function _default() {
59
+ return iconSearch();
60
+ }
61
+ },
62
+ props: Object,
63
+ draggable: {
64
+ type: Boolean,
65
+ default: false
66
+ },
67
+ emptyText: {
68
+ type: String,
69
+ default: ""
70
+ },
71
+ checkStrictly: Boolean,
72
+ lazy: {
73
+ type: Boolean,
74
+ default: false
75
+ },
76
+ load: Function,
77
+ showCheckbox: Boolean,
78
+ filterNodeMethod: Function,
79
+ defaultCheckedKeys: Array,
80
+ defaultExpandedKeys: Array,
81
+ defaultExpandedKeysHighlight: [Number, String],
82
+ indent: {
83
+ type: Number,
84
+ default: 16
85
+ },
86
+ allowDrag: Function,
87
+ allowDrop: Function,
88
+ expandOnClickNode: {
89
+ type: Boolean,
90
+ default: true
91
+ },
92
+ ellipsis: {
93
+ type: Boolean,
94
+ default: false
95
+ },
96
+ wrap: {
97
+ type: Boolean,
98
+ default: false
99
+ },
100
+ getMenuDataSync: Function,
101
+ accordion: Boolean,
102
+ showTitle: {
103
+ type: Boolean,
104
+ default: true
105
+ },
106
+ showFilter: {
107
+ type: Boolean,
108
+ default: true
109
+ },
110
+ showExpand: {
111
+ type: Boolean,
112
+ default: false
113
+ },
114
+ collapsible: {
115
+ type: Boolean,
116
+ default: true
117
+ },
118
+ showNumber: {
119
+ type: Boolean,
120
+ default: false
121
+ },
122
+ nodeHeight: Number,
123
+ onlyCheckChildren: {
124
+ type: Boolean,
125
+ default: false
126
+ },
127
+ menuCollapsible: {
128
+ type: Boolean,
129
+ default: false
130
+ },
131
+ clearable: {
132
+ type: Boolean,
133
+ default: false
134
+ },
135
+ highlightQuery: {
136
+ type: Boolean,
137
+ default: false
138
+ },
139
+ // metaErp 新增属性
140
+ widthAdapt: {
141
+ type: Boolean,
142
+ default: false
143
+ }
144
+ });
145
+ var __vue2_script = defineComponent({
146
+ name: $prefix + "TreeMenu",
147
+ emits: ["change", "current-change", "node-drag-start", "node-drag-enter", "node-drag-over", "node-drag-end", "node-drop", "node-expand", "node-click", "check-change", "check", "collapse-change", "node-collapse"],
148
+ components: {
149
+ TinyTree: Tree,
150
+ TinyInput: Input,
151
+ IconArrow: iconLeftWardArrow(),
152
+ IconEditorMenuLeft: iconEditorMenuLeft(),
153
+ IconEditorMenuRight: iconEditorMenuRight()
154
+ },
155
+ props: treeMenuProps,
156
+ setup: function setup$1(props, context) {
157
+ return setup({
158
+ props,
159
+ context,
160
+ renderless,
161
+ api,
162
+ mono: true
163
+ });
164
+ }
165
+ });
166
+ var render = function render2() {
167
+ var _vm = this;
168
+ var _h = _vm.$createElement;
169
+ var _c = _vm._self._c || _h;
170
+ return _c("div", {
171
+ staticClass: "tiny-tree-menu",
172
+ class: {
173
+ "is-collapsed": _vm.state.isCollapsed,
174
+ "is-expand": _vm.state.isExpand,
175
+ "tiny-tree-menu__show-filter": _vm.showFilter,
176
+ "tiny-tree-menu__show-expand": _vm.showExpand
177
+ },
178
+ style: _vm.widthAdapt ? {
179
+ width: "100%"
180
+ } : {}
181
+ }, [_vm.menuCollapsible ? _c("div", {
182
+ staticClass: "tiny-tree-menu__toggle-button",
183
+ on: {
184
+ "click": function click($event) {
185
+ $event.stopPropagation();
186
+ return _vm.collapseChange.apply(null, arguments);
187
+ }
188
+ }
189
+ }, [_c("icon-arrow")], 1) : _vm._e(), _vm.showFilter ? _c("tiny-input", {
190
+ attrs: {
191
+ "placeholder": _vm.placeholder || _vm.t("ui.treeMenu.placeholder"),
192
+ "prefix-icon": _vm.searchIcon,
193
+ "clearable": _vm.state.clearable
194
+ },
195
+ model: {
196
+ value: _vm.state.filterText,
197
+ callback: function callback($$v) {
198
+ _vm.$set(_vm.state, "filterText", $$v);
199
+ },
200
+ expression: "state.filterText"
201
+ }
202
+ }) : _vm._e(), _c("tiny-tree", {
203
+ ref: "tree",
204
+ class: {
205
+ "tiny-tree-menu__wrap": !_vm.ellipsis ? _vm.wrap : false,
206
+ "tiny-tree-menu__overflow": _vm.ellipsis,
207
+ "only-check-children": _vm.onlyCheckChildren
208
+ },
209
+ attrs: {
210
+ "tiny_mode": "pc",
211
+ "theme": "tiny",
212
+ "accordion": _vm.accordion,
213
+ "data": _vm.state.data,
214
+ "node-key": _vm.nodeKey || "id",
215
+ "empty-text": _vm.emptyText,
216
+ "filter-node-method": _vm.filterNodeMethod || _vm.filterNode,
217
+ "draggable": _vm.draggable,
218
+ "default-expand-all": _vm.defaultExpandAll,
219
+ "check-strictly": _vm.checkStrictly,
220
+ "lazy": _vm.lazy,
221
+ "load": _vm.load,
222
+ "show-checkbox": _vm.showCheckbox,
223
+ "show-number": _vm.showNumber,
224
+ "collapsible": _vm.collapsible,
225
+ "node-height": _vm.nodeHeight,
226
+ "indent": _vm.indent,
227
+ "default-checked-keys": _vm.defaultCheckedKeys,
228
+ "default-expanded-keys": _vm.state.defaultExpandedKeys,
229
+ "default-expanded-keys-highlight": _vm.defaultExpandedKeysHighlight,
230
+ "allow-drag": _vm.allowDrag,
231
+ "props": _vm.props,
232
+ "allow-drop": _vm.allowDrop,
233
+ "highlight-query": _vm.highlightQuery,
234
+ "expand-on-click-node": _vm.expandOnClickNode,
235
+ "only-check-children": _vm.onlyCheckChildren
236
+ },
237
+ on: {
238
+ "node-drag-start": _vm.nodeDragStart,
239
+ "node-drag-enter": _vm.nodeDragEnter,
240
+ "node-drag-over": _vm.nodeDragOver,
241
+ "node-drag-end": _vm.nodeDragEnd,
242
+ "node-drop": _vm.nodeDrop,
243
+ "node-expand": _vm.nodeExpand,
244
+ "node-collapse": _vm.nodeCollapse,
245
+ "node-click": _vm.nodeClick,
246
+ "check-change": _vm.checkChange,
247
+ "check": _vm.check,
248
+ "current-change": _vm.currentChange
249
+ },
250
+ scopedSlots: _vm._u([{
251
+ key: "default",
252
+ fn: function fn(_ref) {
253
+ var node = _ref.node, data = _ref.data;
254
+ return [_c("div", {
255
+ staticClass: "tree-node"
256
+ }, [_c("div", {
257
+ staticClass: "tree-menus-link tiny-tree-node__label"
258
+ }, [_c("a", {
259
+ staticClass: "tree-node-body",
260
+ attrs: {
261
+ "title": _vm.getTitle(data.label),
262
+ "href": data.url || void 0
263
+ }
264
+ }, [_c("span", {
265
+ staticClass: "tree-node-name"
266
+ }, [!data.customIcon && _vm.suffixIcon ? _c(_vm.suffixIcon, {
267
+ tag: "component"
268
+ }) : _vm._e(), data.customIcon ? _c(data.customIcon, {
269
+ tag: "component"
270
+ }) : _vm._e(), _vm._t("default", function() {
271
+ return [_vm._v(_vm._s(data.label || node.label) + " ")];
272
+ }, {
273
+ "node": node,
274
+ "data": data,
275
+ "label": data.label
276
+ })], 2)])])])];
277
+ }
278
+ }], null, true)
279
+ }), _vm.showExpand ? _c("div", {
280
+ staticClass: "tiny-tree-menu__expand"
281
+ }, [_c("span", [!_vm.state.isExpand ? _c("icon-editor-menu-left", {
282
+ on: {
283
+ "click": function click($event) {
284
+ return _vm.handleToggleMenu("collapse");
285
+ }
286
+ }
287
+ }) : _c("icon-editor-menu-right", {
288
+ on: {
289
+ "click": function click($event) {
290
+ return _vm.handleToggleMenu("expand");
291
+ }
292
+ }
293
+ })], 1)]) : _vm._e()], 1);
294
+ };
295
+ var staticRenderFns = [];
296
+ var __cssModules = {};
297
+ var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles);
298
+ function __vue2_injectStyles(context) {
299
+ for (var o in __cssModules) {
300
+ this[o] = __cssModules[o];
301
+ }
302
+ }
303
+ var TreeMenu = /* @__PURE__ */ function() {
304
+ return __component__.exports;
305
+ }();
306
+ var version = "2.21.0";
307
+ TreeMenu.install = function(Vue) {
308
+ Vue.component(TreeMenu.name, TreeMenu);
309
+ };
310
+ TreeMenu.version = version;
311
+
312
+ export { TreeMenu as default };
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "@opentinyvue/vue-tree-menu",
3
+ "version": "2.21.0",
4
+ "description": "",
5
+ "main": "./lib/index.js",
6
+ "module": "./lib/index.js",
7
+ "sideEffects": false,
8
+ "type": "module",
9
+ "dependencies": {
10
+ "@opentinyvue/vue-common": "~2.21.0",
11
+ "@opentinyvue/vue-renderless": "~3.21.0",
12
+ "@opentinyvue/vue-input": "~2.21.0",
13
+ "@opentinyvue/vue-tree": "~2.21.0",
14
+ "@opentinyvue/vue-theme": "~3.21.0",
15
+ "@opentinyvue/vue-icon": "~2.21.0"
16
+ },
17
+ "license": "MIT",
18
+ "types": "index.d.ts",
19
+ "scripts": {
20
+ "build": "pnpm -w build:ui $npm_package_name",
21
+ "//postversion": "pnpm build"
22
+ }
23
+ }
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
package/src/props.d.ts ADDED
@@ -0,0 +1,101 @@
1
+ export declare const treeMenuProps: {
2
+ placeholder: {
3
+ default: string;
4
+ type: StringConstructor;
5
+ };
6
+ data: ArrayConstructor;
7
+ nodeKey: StringConstructor;
8
+ defaultExpandAll: BooleanConstructor;
9
+ suffixIcon: ObjectConstructor;
10
+ searchIcon: {
11
+ type: ObjectConstructor;
12
+ default: () => any;
13
+ };
14
+ props: ObjectConstructor;
15
+ draggable: {
16
+ type: BooleanConstructor;
17
+ default: boolean;
18
+ };
19
+ emptyText: {
20
+ type: StringConstructor;
21
+ default: string;
22
+ };
23
+ checkStrictly: BooleanConstructor;
24
+ lazy: {
25
+ type: BooleanConstructor;
26
+ default: boolean;
27
+ };
28
+ load: FunctionConstructor;
29
+ showCheckbox: BooleanConstructor;
30
+ filterNodeMethod: FunctionConstructor;
31
+ defaultCheckedKeys: ArrayConstructor;
32
+ defaultExpandedKeys: ArrayConstructor;
33
+ defaultExpandedKeysHighlight: (StringConstructor | NumberConstructor)[];
34
+ indent: {
35
+ type: NumberConstructor;
36
+ default: number;
37
+ };
38
+ allowDrag: FunctionConstructor;
39
+ allowDrop: FunctionConstructor;
40
+ expandOnClickNode: {
41
+ type: BooleanConstructor;
42
+ default: boolean;
43
+ };
44
+ ellipsis: {
45
+ type: BooleanConstructor;
46
+ default: boolean;
47
+ };
48
+ wrap: {
49
+ type: BooleanConstructor;
50
+ default: boolean;
51
+ };
52
+ getMenuDataSync: FunctionConstructor;
53
+ accordion: BooleanConstructor;
54
+ showTitle: {
55
+ type: BooleanConstructor;
56
+ default: boolean;
57
+ };
58
+ showFilter: {
59
+ type: BooleanConstructor;
60
+ default: boolean;
61
+ };
62
+ showExpand: {
63
+ type: BooleanConstructor;
64
+ default: boolean;
65
+ };
66
+ collapsible: {
67
+ type: BooleanConstructor;
68
+ default: boolean;
69
+ };
70
+ showNumber: {
71
+ type: BooleanConstructor;
72
+ default: boolean;
73
+ };
74
+ nodeHeight: NumberConstructor;
75
+ onlyCheckChildren: {
76
+ type: BooleanConstructor;
77
+ default: boolean;
78
+ };
79
+ menuCollapsible: {
80
+ type: BooleanConstructor;
81
+ default: boolean;
82
+ };
83
+ clearable: {
84
+ type: BooleanConstructor;
85
+ default: boolean;
86
+ };
87
+ highlightQuery: {
88
+ type: BooleanConstructor;
89
+ default: boolean;
90
+ };
91
+ widthAdapt: {
92
+ type: BooleanConstructor;
93
+ default: boolean;
94
+ };
95
+ tiny_mode: StringConstructor;
96
+ tiny_mode_root: BooleanConstructor;
97
+ tiny_template: (ObjectConstructor | FunctionConstructor)[];
98
+ tiny_renderless: FunctionConstructor;
99
+ tiny_theme: StringConstructor;
100
+ tiny_chart_theme: ObjectConstructor;
101
+ };