@codernote/record-tree 1.0.9 → 1.0.10
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/README.md +3 -0
- package/dist/index.js +21 -17
- package/package.json +2 -2
package/README.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
import _ from "@codernote/tree-editor";
|
|
3
3
|
import v from "vue-inline-svg";
|
|
4
4
|
import m from "vue-popperjs";
|
|
5
|
-
import { byNameFindIcon as
|
|
6
|
-
function p(t, e, o, r, n, l,
|
|
5
|
+
import { byNameFindIcon as y, oss as b, icons as C } from "@codernote/utils";
|
|
6
|
+
function p(t, e, o, r, n, l, d, f) {
|
|
7
7
|
var i = typeof t == "function" ? t.options : t;
|
|
8
8
|
e && (i.render = e, i.staticRenderFns = o, i._compiled = !0), r && (i.functional = !0), l && (i._scopeId = "data-v-" + l);
|
|
9
9
|
var s;
|
|
10
|
-
if (
|
|
11
|
-
a = a || this.$vnode && this.$vnode.ssrContext || this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext, !a && typeof __VUE_SSR_CONTEXT__ < "u" && (a = __VUE_SSR_CONTEXT__), n && n.call(this, a), a && a._registeredComponents && a._registeredComponents.add(
|
|
10
|
+
if (d ? (s = function(a) {
|
|
11
|
+
a = a || this.$vnode && this.$vnode.ssrContext || this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext, !a && typeof __VUE_SSR_CONTEXT__ < "u" && (a = __VUE_SSR_CONTEXT__), n && n.call(this, a), a && a._registeredComponents && a._registeredComponents.add(d);
|
|
12
12
|
}, i._ssrRegister = s) : n && (s = f ? function() {
|
|
13
13
|
n.call(
|
|
14
14
|
this,
|
|
@@ -22,8 +22,8 @@ function p(t, e, o, r, n, l, c, f) {
|
|
|
22
22
|
return s.call(u), h(g, u);
|
|
23
23
|
};
|
|
24
24
|
} else {
|
|
25
|
-
var
|
|
26
|
-
i.beforeCreate =
|
|
25
|
+
var c = i.beforeCreate;
|
|
26
|
+
i.beforeCreate = c ? [].concat(c, s) : [s];
|
|
27
27
|
}
|
|
28
28
|
return {
|
|
29
29
|
exports: t,
|
|
@@ -78,6 +78,10 @@ const N = {
|
|
|
78
78
|
return { title: "" };
|
|
79
79
|
}
|
|
80
80
|
},
|
|
81
|
+
readOnly: {
|
|
82
|
+
type: Boolean,
|
|
83
|
+
default: !1
|
|
84
|
+
},
|
|
81
85
|
// 图标相关配置
|
|
82
86
|
tags: {
|
|
83
87
|
type: Array,
|
|
@@ -124,7 +128,7 @@ const N = {
|
|
|
124
128
|
);
|
|
125
129
|
return {
|
|
126
130
|
...t,
|
|
127
|
-
icon: (e =
|
|
131
|
+
icon: (e = y(t.icon)) == null ? void 0 : e.value
|
|
128
132
|
};
|
|
129
133
|
},
|
|
130
134
|
curNodes() {
|
|
@@ -146,9 +150,9 @@ const N = {
|
|
|
146
150
|
}
|
|
147
151
|
},
|
|
148
152
|
mounted() {
|
|
149
|
-
this.treeEditor = new _("root_tree"), this.$nextTick(() => {
|
|
150
|
-
this.treeEditor.on("fileUpload", (t, e) => {
|
|
151
|
-
this.uploadLoading = !0,
|
|
153
|
+
this.treeEditor = new _("root_tree", { readOnly: this.readOnly }), this.$nextTick(() => {
|
|
154
|
+
this.readOnly || (this.treeEditor.on("fileUpload", (t, e) => {
|
|
155
|
+
this.uploadLoading = !0, b.uploadFile(t, (o, r) => {
|
|
152
156
|
if (this.uploadLoading = !1, r && e) {
|
|
153
157
|
const n = r.filter((l) => l.code === 0).map((l) => l.data);
|
|
154
158
|
e(n);
|
|
@@ -161,7 +165,7 @@ const N = {
|
|
|
161
165
|
});
|
|
162
166
|
}), this.enableDbEnter && this.treeEditor.on("dbEnter", () => {
|
|
163
167
|
this.$emit("dbEnter");
|
|
164
|
-
}), this.treeEditor.loadTree(this.curNodes);
|
|
168
|
+
})), this.treeEditor.loadTree(this.curNodes);
|
|
165
169
|
});
|
|
166
170
|
},
|
|
167
171
|
methods: {
|
|
@@ -179,7 +183,7 @@ const N = {
|
|
|
179
183
|
},
|
|
180
184
|
// 根据svg的icon名找到svg实体
|
|
181
185
|
getSvgUrl(t) {
|
|
182
|
-
const e =
|
|
186
|
+
const e = C.find((o) => o.name === t.icon);
|
|
183
187
|
return (e == null ? void 0 : e.value) || "";
|
|
184
188
|
},
|
|
185
189
|
// 选择tag图标
|
|
@@ -269,7 +273,7 @@ const N = {
|
|
|
269
273
|
};
|
|
270
274
|
var $ = function() {
|
|
271
275
|
var e = this, o = e._self._c;
|
|
272
|
-
return o("div", { staticClass: "record-tree", on: { mouseenter: e.hideHoverNote } }, [e._t("default"), o("div", { staticClass: "record-tree-title-bar" }, [e.tagVisible ? o("Picker", { scopedSlots: e._u([{ key: "default", fn: function() {
|
|
276
|
+
return o("div", { staticClass: "record-tree", on: { mouseenter: e.hideHoverNote } }, [e._t("default"), o("div", { staticClass: "record-tree-title-bar" }, [e.tagVisible ? o("Picker", { scopedSlots: e._u([e.readOnly ? null : { key: "default", fn: function() {
|
|
273
277
|
return [o("div", { staticClass: "record-tree-popper-content", style: { width: e.tagConfig.popW, height: e.tagConfig.popH } }, e._l(e.tags, function(r, n) {
|
|
274
278
|
return o("span", { key: n, staticClass: "record-tree-popper-content-item", on: { click: function(l) {
|
|
275
279
|
return e.tagSelect(r);
|
|
@@ -289,7 +293,7 @@ var $ = function() {
|
|
|
289
293
|
height: e.tagConfig.tagSize + "px",
|
|
290
294
|
backgroundColor: e.curTag.color
|
|
291
295
|
} })], 1)];
|
|
292
|
-
}, proxy: !0 }], null, !
|
|
296
|
+
}, proxy: !0 }], null, !0) }) : e._e(), o("div", { staticClass: "record-tree-title", attrs: { contenteditable: !e.readOnly, id: "tree_title" }, domProps: { innerHTML: e._s(e.note.title) }, on: { blur: e.titleBlur, click: function(r) {
|
|
293
297
|
r.stopPropagation();
|
|
294
298
|
}, keydown: function(r) {
|
|
295
299
|
return !r.type.indexOf("key") && e._k(r.keyCode, "enter", 13, r.key, "Enter") ? null : (r.preventDefault(), e.handleTitleEnter.apply(null, arguments));
|
|
@@ -300,7 +304,7 @@ var $ = function() {
|
|
|
300
304
|
}, function() {
|
|
301
305
|
var t = this, e = t._self._c;
|
|
302
306
|
return e("p", [e("span", { staticClass: "record-tree-icon record-tree-icon-loading" }), e("b", [t._v("正在上传资源,请稍后...")])]);
|
|
303
|
-
}],
|
|
307
|
+
}], O = /* @__PURE__ */ p(
|
|
304
308
|
D,
|
|
305
309
|
$,
|
|
306
310
|
x,
|
|
@@ -310,7 +314,7 @@ var $ = function() {
|
|
|
310
314
|
null,
|
|
311
315
|
null
|
|
312
316
|
);
|
|
313
|
-
const
|
|
317
|
+
const B = O.exports;
|
|
314
318
|
export {
|
|
315
|
-
|
|
319
|
+
B as RecordTree
|
|
316
320
|
};
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codernote/record-tree",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"vue-inline-svg": "^2.1.3",
|
|
8
8
|
"vue-popperjs": "^2.3.0",
|
|
9
|
-
"@codernote/tree-editor": "1.0.
|
|
9
|
+
"@codernote/tree-editor": "1.0.8",
|
|
10
10
|
"@codernote/utils": "1.0.5"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|