doph-js 0.0.29 → 0.0.30
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/dophJs.js +58 -61
- package/dist/dophJs.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/dophJs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useSlots as
|
|
1
|
+
import { useSlots as y, computed as d, h as m, openBlock as r, createBlock as S, unref as u, createElementBlock as c, Fragment as h, normalizeClass as p, renderSlot as g, createCommentVNode as _, createVNode as D, createElementVNode as f, resolveComponent as k, toDisplayString as B, renderList as v, getCurrentInstance as $, reactive as x } from "vue";
|
|
2
2
|
const z = {
|
|
3
3
|
__name: "BIcon",
|
|
4
4
|
props: {
|
|
@@ -6,15 +6,15 @@ const z = {
|
|
|
6
6
|
size: [Number, String],
|
|
7
7
|
color: String
|
|
8
8
|
},
|
|
9
|
-
setup(
|
|
10
|
-
const
|
|
11
|
-
const { color:
|
|
12
|
-
return
|
|
13
|
-
}), a =
|
|
14
|
-
const
|
|
15
|
-
if (
|
|
16
|
-
return typeof
|
|
17
|
-
}), i =
|
|
9
|
+
setup(t) {
|
|
10
|
+
const e = t, n = y(), l = d(() => {
|
|
11
|
+
const { color: o } = e;
|
|
12
|
+
return o === void 0 ? null : o;
|
|
13
|
+
}), a = d(() => {
|
|
14
|
+
const o = e.size ?? null;
|
|
15
|
+
if (o !== void 0)
|
|
16
|
+
return typeof o == "number" || /^\d+$/.test(o) ? `${o}px` : o;
|
|
17
|
+
}), i = m(
|
|
18
18
|
"i",
|
|
19
19
|
{
|
|
20
20
|
class: "icon",
|
|
@@ -23,119 +23,116 @@ const z = {
|
|
|
23
23
|
fontSize: a.value
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
|
-
|
|
26
|
+
e.component ? m(e.component) : n
|
|
27
27
|
);
|
|
28
|
-
return (
|
|
28
|
+
return (o, b) => (r(), S(u(i)));
|
|
29
29
|
}
|
|
30
|
-
},
|
|
30
|
+
}, w = {
|
|
31
31
|
__name: "DButton",
|
|
32
32
|
props: {
|
|
33
33
|
class: String,
|
|
34
34
|
icon: Object
|
|
35
35
|
},
|
|
36
|
-
setup(
|
|
37
|
-
const
|
|
36
|
+
setup(t) {
|
|
37
|
+
const e = t;
|
|
38
38
|
let n = null;
|
|
39
|
-
return
|
|
40
|
-
component:
|
|
39
|
+
return e.icon && (n = m(z, {
|
|
40
|
+
component: e.icon,
|
|
41
41
|
color: "inherit"
|
|
42
|
-
})), (l, a) => (
|
|
43
|
-
u(n) ? _("", !0) : (
|
|
42
|
+
})), (l, a) => (r(), c(h, null, [
|
|
43
|
+
u(n) ? _("", !0) : (r(), c("div", {
|
|
44
44
|
key: 0,
|
|
45
|
-
class: p(["button",
|
|
45
|
+
class: p(["button", e.class])
|
|
46
46
|
}, [
|
|
47
|
-
|
|
47
|
+
g(l.$slots, "default")
|
|
48
48
|
], 2)),
|
|
49
|
-
u(n) ? (
|
|
49
|
+
u(n) ? (r(), c("div", {
|
|
50
50
|
key: 1,
|
|
51
|
-
class: p(["button button-ext",
|
|
51
|
+
class: p(["button button-ext", e.class])
|
|
52
52
|
}, [
|
|
53
|
-
|
|
53
|
+
D(u(n)),
|
|
54
54
|
f("div", null, [
|
|
55
|
-
|
|
55
|
+
g(l.$slots, "default")
|
|
56
56
|
])
|
|
57
57
|
], 2)) : _("", !0)
|
|
58
58
|
], 64));
|
|
59
59
|
}
|
|
60
|
-
},
|
|
60
|
+
}, C = { class: "tree-item" }, N = { key: 0 }, j = {
|
|
61
61
|
__name: "DTreeItem",
|
|
62
62
|
props: {
|
|
63
63
|
model: Object,
|
|
64
64
|
treeId: [String, Number]
|
|
65
65
|
},
|
|
66
|
-
setup(
|
|
67
|
-
const
|
|
68
|
-
s.mutations.setTreeSelect(
|
|
69
|
-
}, a =
|
|
70
|
-
return (i,
|
|
71
|
-
const
|
|
72
|
-
return
|
|
66
|
+
setup(t) {
|
|
67
|
+
const e = t, n = d(() => e.model.children && e.model.children.length), l = (i) => {
|
|
68
|
+
s.mutations.setTreeSelect(e.treeId, e.model.id);
|
|
69
|
+
}, a = d(() => s.actions.isTreeSelected(e.treeId, e.model.id) ? "selected" : "");
|
|
70
|
+
return (i, o) => {
|
|
71
|
+
const b = k("d-tree-item", !0);
|
|
72
|
+
return r(), c("li", C, [
|
|
73
73
|
f("div", {
|
|
74
74
|
class: p(a.value),
|
|
75
75
|
onClick: l,
|
|
76
76
|
style: { display: "flex", "flex-direction": "row", "justify-content": "space-between", "align-items": "center" }
|
|
77
77
|
}, [
|
|
78
|
-
f("div", null, B(
|
|
78
|
+
f("div", null, B(e.model.title), 1)
|
|
79
79
|
], 2),
|
|
80
|
-
n.value ? (
|
|
81
|
-
(
|
|
80
|
+
n.value ? (r(), c("ul", N, [
|
|
81
|
+
(r(!0), c(h, null, v(t.model.children, (T) => (r(), S(b, {
|
|
82
82
|
class: "tree-item",
|
|
83
|
-
model:
|
|
84
|
-
treeId:
|
|
83
|
+
model: T,
|
|
84
|
+
treeId: e.treeId
|
|
85
85
|
}, null, 8, ["model", "treeId"]))), 256))
|
|
86
86
|
])) : _("", !0)
|
|
87
87
|
]);
|
|
88
88
|
};
|
|
89
89
|
}
|
|
90
|
-
}, O = { class: "tree" },
|
|
90
|
+
}, O = { class: "tree" }, E = {
|
|
91
91
|
__name: "DTree",
|
|
92
92
|
props: {
|
|
93
93
|
items: Array,
|
|
94
94
|
noSelect: Boolean,
|
|
95
95
|
multiSelect: Boolean
|
|
96
96
|
},
|
|
97
|
-
setup(
|
|
98
|
-
const
|
|
99
|
-
return s.actions.initTreeStore(n,
|
|
100
|
-
(
|
|
97
|
+
setup(t) {
|
|
98
|
+
const e = t, n = $().uid;
|
|
99
|
+
return s.actions.initTreeStore(n, e.noSelect, e.multiSelect), (l, a) => (r(), c("ul", O, [
|
|
100
|
+
(r(!0), c(h, null, v(t.items, (i) => (r(), S(j, {
|
|
101
101
|
key: i.id,
|
|
102
102
|
model: i,
|
|
103
103
|
treeId: u(n)
|
|
104
104
|
}, null, 8, ["model", "treeId"]))), 128))
|
|
105
105
|
]));
|
|
106
106
|
}
|
|
107
|
-
}, R = {
|
|
108
|
-
install(e) {
|
|
109
|
-
e.component("DTree", w), e.component("DTreeItem", v);
|
|
110
|
-
}
|
|
111
107
|
}, s = {
|
|
112
|
-
state:
|
|
108
|
+
state: x({
|
|
113
109
|
trees: {}
|
|
114
110
|
}),
|
|
115
111
|
getters: {
|
|
116
|
-
getTreeSelect(
|
|
117
|
-
return s.state.trees[
|
|
112
|
+
getTreeSelect(t) {
|
|
113
|
+
return s.state.trees[t].selected;
|
|
118
114
|
}
|
|
119
115
|
},
|
|
120
116
|
mutations: {
|
|
121
|
-
setTreeSelect(
|
|
122
|
-
s.state.trees[
|
|
123
|
-
return n !==
|
|
124
|
-
}) : s.state.trees[
|
|
117
|
+
setTreeSelect(t, e) {
|
|
118
|
+
s.state.trees[t].noSelect || (s.state.trees[t].multiSelect ? s.state.trees[t].selected.includes(e) ? s.state.trees[t].selected = s.state.trees[t].selected.filter(function(n) {
|
|
119
|
+
return n !== e;
|
|
120
|
+
}) : s.state.trees[t].selected = [...s.state.trees[t].selected, e] : s.state.trees[t].selected = [e]);
|
|
125
121
|
}
|
|
126
122
|
},
|
|
127
123
|
actions: {
|
|
128
|
-
initTreeStore(
|
|
129
|
-
s.state.trees[
|
|
124
|
+
initTreeStore(t, e, n) {
|
|
125
|
+
s.state.trees[t] = [], s.state.trees[t].selected = [], s.state.trees[t].noSelect = e, s.state.trees[t].multiSelect = n;
|
|
130
126
|
},
|
|
131
|
-
isTreeSelected(
|
|
132
|
-
return s.state.trees[
|
|
127
|
+
isTreeSelected(t, e) {
|
|
128
|
+
return s.state.trees[t].selected.includes(e);
|
|
133
129
|
}
|
|
134
130
|
}
|
|
135
131
|
};
|
|
136
132
|
export {
|
|
137
|
-
|
|
133
|
+
w as DButton,
|
|
138
134
|
z as DIcon,
|
|
139
|
-
|
|
140
|
-
|
|
135
|
+
E as DTree,
|
|
136
|
+
j as DTreeItem,
|
|
137
|
+
s as DTreeStore
|
|
141
138
|
};
|
package/dist/dophJs.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(s,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(s=typeof globalThis<"u"?globalThis:s||self,e(s.DophJs={},s.Vue))})(this,function(s,e){"use strict";const
|
|
1
|
+
(function(s,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(s=typeof globalThis<"u"?globalThis:s||self,e(s.DophJs={},s.Vue))})(this,function(s,e){"use strict";const h="",T="",g="",y="",m={__name:"BIcon",props:{component:Object,size:[Number,String],color:String},setup(n){const t=n,c=e.useSlots(),r=e.computed(()=>{const{color:l}=t;return l===void 0?null:l}),a=e.computed(()=>{const l=t.size??null;if(l!==void 0)return typeof l=="number"||/^\d+$/.test(l)?`${l}px`:l}),i=e.h("i",{class:"icon",style:{color:r.value,fontSize:a.value}},t.component?e.h(t.component):c);return(l,p)=>(e.openBlock(),e.createBlock(e.unref(i)))}},f={__name:"DButton",props:{class:String,icon:Object},setup(n){const t=n;let c=null;return t.icon&&(c=e.h(m,{component:t.icon,color:"inherit"})),(r,a)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(c)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["button",t.class])},[e.renderSlot(r.$slots,"default")],2)),e.unref(c)?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["button button-ext",t.class])},[e.createVNode(e.unref(c)),e.createElementVNode("div",null,[e.renderSlot(r.$slots,"default")])],2)):e.createCommentVNode("",!0)],64))}},u={class:"tree-item"},S={key:0},d={__name:"DTreeItem",props:{model:Object,treeId:[String,Number]},setup(n){const t=n,c=e.computed(()=>t.model.children&&t.model.children.length),r=i=>{o.mutations.setTreeSelect(t.treeId,t.model.id)},a=e.computed(()=>o.actions.isTreeSelected(t.treeId,t.model.id)?"selected":"");return(i,l)=>{const p=e.resolveComponent("d-tree-item",!0);return e.openBlock(),e.createElementBlock("li",u,[e.createElementVNode("div",{class:e.normalizeClass(a.value),onClick:r,style:{display:"flex","flex-direction":"row","justify-content":"space-between","align-items":"center"}},[e.createElementVNode("div",null,e.toDisplayString(t.model.title),1)],2),c.value?(e.openBlock(),e.createElementBlock("ul",S,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.model.children,B=>(e.openBlock(),e.createBlock(p,{class:"tree-item",model:B,treeId:t.treeId},null,8,["model","treeId"]))),256))])):e.createCommentVNode("",!0)])}}},_={class:"tree"},k={__name:"DTree",props:{items:Array,noSelect:Boolean,multiSelect:Boolean},setup(n){const t=n,c=e.getCurrentInstance().uid;return o.actions.initTreeStore(c,t.noSelect,t.multiSelect),(r,a)=>(e.openBlock(),e.createElementBlock("ul",_,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.items,i=>(e.openBlock(),e.createBlock(d,{key:i.id,model:i,treeId:e.unref(c)},null,8,["model","treeId"]))),128))]))}},o={state:e.reactive({trees:{}}),getters:{getTreeSelect(n){return o.state.trees[n].selected}},mutations:{setTreeSelect(n,t){o.state.trees[n].noSelect||(o.state.trees[n].multiSelect?o.state.trees[n].selected.includes(t)?o.state.trees[n].selected=o.state.trees[n].selected.filter(function(c){return c!==t}):o.state.trees[n].selected=[...o.state.trees[n].selected,t]:o.state.trees[n].selected=[t])}},actions:{initTreeStore(n,t,c){o.state.trees[n]=[],o.state.trees[n].selected=[],o.state.trees[n].noSelect=t,o.state.trees[n].multiSelect=c},isTreeSelected(n,t){return o.state.trees[n].selected.includes(t)}}};s.DButton=f,s.DIcon=m,s.DTree=k,s.DTreeItem=d,s.DTreeStore=o,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
|