wj-elements 0.1.72 → 0.1.73
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/wje-orgchart-item.js +156 -1
- package/dist/wje-orgchart.js +50 -1
- package/package.json +1 -1
|
@@ -5,7 +5,136 @@ var __publicField = (obj, key, value) => {
|
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
7
|
import WJElement from "./wje-element.js";
|
|
8
|
-
const styles =
|
|
8
|
+
const styles = `:host {
|
|
9
|
+
--wje-orgchart-item-width: 75px;
|
|
10
|
+
--wje-orgchart-item-border-radius: var(--wje-border-radius-large);
|
|
11
|
+
--wje-orgchart-item-height-line: 10px;
|
|
12
|
+
width: var(--wje-orgchart-item-width);
|
|
13
|
+
box-sizing: border-box;
|
|
14
|
+
|
|
15
|
+
.orgchart-item {
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
|
|
19
|
+
wje-card {
|
|
20
|
+
margin: 0 auto;
|
|
21
|
+
padding-inline: .25rem;
|
|
22
|
+
width: var(--wje-orgchart-item-width);
|
|
23
|
+
box-sizing: border-box;
|
|
24
|
+
&::part(native) {
|
|
25
|
+
border-radius: var(--wje-orgchart-border-radius) !important;
|
|
26
|
+
box-sizing: border-box;
|
|
27
|
+
overflow: visible;
|
|
28
|
+
padding-block: .125rem;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.expander {
|
|
34
|
+
position: absolute;
|
|
35
|
+
left: calc(50% + 1px / 2);
|
|
36
|
+
border: 1px solid var(--wje-border-color);
|
|
37
|
+
border-radius: 50%;
|
|
38
|
+
width: 12px;
|
|
39
|
+
height: 12px;
|
|
40
|
+
display: flex;
|
|
41
|
+
align-items: center;
|
|
42
|
+
justify-content: center;
|
|
43
|
+
background: var(--wje-color-contrast-0);
|
|
44
|
+
font-size: 8px;
|
|
45
|
+
line-height: 1;
|
|
46
|
+
box-sizing: border-box;
|
|
47
|
+
transform: translate(-50%, 6px);
|
|
48
|
+
padding-bottom: 1px;
|
|
49
|
+
cursor: pointer;
|
|
50
|
+
z-index: 999;
|
|
51
|
+
bottom: 0;
|
|
52
|
+
&.collapse {
|
|
53
|
+
content: "+";
|
|
54
|
+
wje-orgchart {
|
|
55
|
+
display: none;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
&:hover {
|
|
59
|
+
background: var(--wje-color-contrast-1);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
:host(.collapse) {
|
|
65
|
+
.expander {
|
|
66
|
+
content: "+";
|
|
67
|
+
}
|
|
68
|
+
slot[name=child] {
|
|
69
|
+
display: none;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/* ak nie je parent-group */
|
|
73
|
+
:host(:not(.parent-group)) {
|
|
74
|
+
text-align: center;
|
|
75
|
+
list-style-type: none;
|
|
76
|
+
position: relative;
|
|
77
|
+
padding: var(--wje-orgchart-item-height-line) 0 0 0;
|
|
78
|
+
transition: all 0.5s;
|
|
79
|
+
width: auto;
|
|
80
|
+
|
|
81
|
+
&::before, &::after {
|
|
82
|
+
content: '';
|
|
83
|
+
position: absolute;
|
|
84
|
+
top: 0;
|
|
85
|
+
right: 50%;
|
|
86
|
+
border-top: 1px solid var(--wje-border-color);
|
|
87
|
+
width: 50%;
|
|
88
|
+
height: var(--wje-orgchart-item-height-line);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
&::after {
|
|
92
|
+
right: auto;
|
|
93
|
+
left: 50%;
|
|
94
|
+
border-left: 1px solid var(--wje-border-color);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
wje-card::part(native) {
|
|
98
|
+
box-sizing: border-box;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
:host(:hover){
|
|
103
|
+
wje-card::part(native) {
|
|
104
|
+
background: var(--wje-color-contrast-3);
|
|
105
|
+
/*color: #000;*/
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
:host(.highlight){
|
|
110
|
+
wje-card::part(native) {
|
|
111
|
+
background: var(--wje-color-complete-2);
|
|
112
|
+
/*color: #000;*/
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
:host(:only-child)::after, :host(:only-child)::before {
|
|
118
|
+
display: none;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
:host(:only-child) {
|
|
122
|
+
padding-top: 0;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
:host(:first-child)::before,
|
|
126
|
+
:host(:last-child)::after {
|
|
127
|
+
border: 0 none;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
:host(:last-child)::before {
|
|
131
|
+
border-right: 1px solid var(--wje-border-color);
|
|
132
|
+
border-radius: 0 var(--wje-orgchart-item-border-radius) 0 0;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
:host(:first-child)::after {
|
|
136
|
+
border-radius: var(--wje-orgchart-item-border-radius) 0 0 0;
|
|
137
|
+
}`;
|
|
9
138
|
class OrgchartItem extends WJElement {
|
|
10
139
|
/**
|
|
11
140
|
* Creates an instance of OrgchartItem.
|
|
@@ -15,6 +144,14 @@ class OrgchartItem extends WJElement {
|
|
|
15
144
|
constructor() {
|
|
16
145
|
super();
|
|
17
146
|
__publicField(this, "className", "OrgchartItem");
|
|
147
|
+
/**
|
|
148
|
+
* Toggles the children of the orgchart item.
|
|
149
|
+
* @param e - The event object.
|
|
150
|
+
*/
|
|
151
|
+
__publicField(this, "toggleChildren", (e) => {
|
|
152
|
+
this.classList.toggle("collapse");
|
|
153
|
+
this.classList.contains("collapse") ? e.target.innerHTML = "+" : e.target.innerHTML = "-";
|
|
154
|
+
});
|
|
18
155
|
}
|
|
19
156
|
/**
|
|
20
157
|
* Returns the CSS styles for the component.
|
|
@@ -53,12 +190,30 @@ class OrgchartItem extends WJElement {
|
|
|
53
190
|
let slot = document.createElement("slot");
|
|
54
191
|
let child = document.createElement("slot");
|
|
55
192
|
child.setAttribute("name", "child");
|
|
193
|
+
let expander = document.createElement("div");
|
|
194
|
+
expander.setAttribute("part", "expander");
|
|
195
|
+
expander.classList.add("expander");
|
|
196
|
+
expander.innerHTML = "-";
|
|
56
197
|
card.appendChild(slot);
|
|
198
|
+
if (this.children.length > 0)
|
|
199
|
+
card.appendChild(expander);
|
|
57
200
|
native.appendChild(card);
|
|
58
201
|
native.appendChild(child);
|
|
59
202
|
fragment.appendChild(native);
|
|
203
|
+
this.expander = expander;
|
|
60
204
|
return fragment;
|
|
61
205
|
}
|
|
206
|
+
/**
|
|
207
|
+
* After Draws the component.
|
|
208
|
+
*
|
|
209
|
+
* @param {Object} context - The context for drawing.
|
|
210
|
+
* @param {Object} store - The store for drawing.
|
|
211
|
+
* @param {Object} params - The parameters for drawing.
|
|
212
|
+
* @returns {DocumentFragment}
|
|
213
|
+
*/
|
|
214
|
+
afterDraw(context, store, params) {
|
|
215
|
+
this.expander.addEventListener("click", this.toggleChildren);
|
|
216
|
+
}
|
|
62
217
|
}
|
|
63
218
|
OrgchartItem.define("wje-orgchart-item", OrgchartItem);
|
|
64
219
|
export {
|
package/dist/wje-orgchart.js
CHANGED
|
@@ -5,7 +5,56 @@ var __publicField = (obj, key, value) => {
|
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
7
|
import WJElement from "./wje-element.js";
|
|
8
|
-
const styles =
|
|
8
|
+
const styles = `
|
|
9
|
+
|
|
10
|
+
* {margin: 0; padding: 0;}
|
|
11
|
+
|
|
12
|
+
:host {
|
|
13
|
+
--wje-orgchart-height-line: 10px;
|
|
14
|
+
--wje-orgchart-border-radius: var(--wje-border-radius-large);
|
|
15
|
+
|
|
16
|
+
position: relative;
|
|
17
|
+
.native-orgchart {
|
|
18
|
+
padding-top: var(--wje-orgchart-height-line);
|
|
19
|
+
display: flex;
|
|
20
|
+
/*column-gap: .5rem;*/
|
|
21
|
+
}
|
|
22
|
+
&::before {
|
|
23
|
+
content: '';
|
|
24
|
+
position: absolute;
|
|
25
|
+
top: 0;
|
|
26
|
+
left: 50%;
|
|
27
|
+
border-left: 1px solid var(--wje-border-color);
|
|
28
|
+
width: 0;
|
|
29
|
+
height: var(--wje-orgchart-height-line);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/*.expander {*/
|
|
33
|
+
/* content: "+";*/
|
|
34
|
+
/* position: absolute;*/
|
|
35
|
+
/* top: -.5px;*/
|
|
36
|
+
/* left: calc(50% + 1px / 2);*/
|
|
37
|
+
/* border: 1px solid var(--wje-border-color);*/
|
|
38
|
+
/* border-radius: 50%;*/
|
|
39
|
+
/* width: 12px;*/
|
|
40
|
+
/* height: 12px;*/
|
|
41
|
+
/* display: flex;*/
|
|
42
|
+
/* align-items: center;*/
|
|
43
|
+
/* justify-content: center;*/
|
|
44
|
+
/* background: var(--wje-color-contrast-0);*/
|
|
45
|
+
/* font-size: 8px;*/
|
|
46
|
+
/* line-height: 1; !* Nastavenie line-height na 1 *!*/
|
|
47
|
+
/* box-sizing: border-box;*/
|
|
48
|
+
/* transform: translate(-50%, -50%);*/
|
|
49
|
+
/* padding-bottom: 1px;*/
|
|
50
|
+
/* cursor: pointer;*/
|
|
51
|
+
/* &:hover {*/
|
|
52
|
+
/* background: red;*/
|
|
53
|
+
/* }*/
|
|
54
|
+
/*}*/
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
`;
|
|
9
58
|
class Orgchart extends WJElement {
|
|
10
59
|
/**
|
|
11
60
|
* Creates an instance of Orgchart.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wj-elements",
|
|
3
3
|
"description": "WebJET Elements is a modern set of user interface tools harnessing the power of web components designed to simplify web application development.",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.73",
|
|
5
5
|
"homepage": "https://github.com/lencys/wj-elements",
|
|
6
6
|
"author": "Lukáš Ondrejček <lukas.ondrejcek@gmail.com>",
|
|
7
7
|
"license": "MIT",
|