wj-elements 0.1.79 → 0.1.81
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-dialog.js +6 -6
- package/dist/wje-element.js +32 -4
- package/dist/wje-master.js +2 -0
- package/dist/wje-menu-item.js +2 -6
- package/dist/wje-router-outlet.js +0 -4
- package/dist/wje-store.js +1 -1
- package/package.json +2 -6
package/dist/wje-dialog.js
CHANGED
|
@@ -11,19 +11,19 @@ class Dialog extends WJElement {
|
|
|
11
11
|
constructor() {
|
|
12
12
|
super();
|
|
13
13
|
__publicField(this, "className", "Dialog");
|
|
14
|
-
__publicField(this, "onOpen", () => {
|
|
15
|
-
Promise.resolve(this.beforeOpen(this)).then((res) => {
|
|
14
|
+
__publicField(this, "onOpen", (e) => {
|
|
15
|
+
Promise.resolve(this.beforeOpen(this, e)).then((res) => {
|
|
16
16
|
this.dialog.showModal();
|
|
17
17
|
if (this.dialog.open) {
|
|
18
|
-
Promise.resolve(this.afterOpen(this));
|
|
18
|
+
Promise.resolve(this.afterOpen(this, e));
|
|
19
19
|
}
|
|
20
20
|
});
|
|
21
21
|
});
|
|
22
|
-
__publicField(this, "onClose", () => {
|
|
23
|
-
Promise.resolve(this.beforeClose(this)).then((res) => {
|
|
22
|
+
__publicField(this, "onClose", (e) => {
|
|
23
|
+
Promise.resolve(this.beforeClose(this, e)).then((res) => {
|
|
24
24
|
this.dialog.close();
|
|
25
25
|
if (this.dialog.open) {
|
|
26
|
-
Promise.resolve(this.afterClose(this));
|
|
26
|
+
Promise.resolve(this.afterClose(this, e));
|
|
27
27
|
}
|
|
28
28
|
});
|
|
29
29
|
});
|
package/dist/wje-element.js
CHANGED
|
@@ -161,16 +161,36 @@ class UniversalService {
|
|
|
161
161
|
}
|
|
162
162
|
class WjePermissionsApi {
|
|
163
163
|
constructor() {
|
|
164
|
+
this._permissionKey = "permissions";
|
|
164
165
|
}
|
|
166
|
+
static set permissionKey(value) {
|
|
167
|
+
WjePermissionsApi._permissionKey = value || "permissions";
|
|
168
|
+
}
|
|
169
|
+
static get permissionKey() {
|
|
170
|
+
return WjePermissionsApi._permissionKey;
|
|
171
|
+
}
|
|
172
|
+
static set permissions(value) {
|
|
173
|
+
window.localStorage.setItem(WjePermissionsApi.permissionKey, value);
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Returns the permissions.
|
|
177
|
+
* @returns {*}
|
|
178
|
+
*/
|
|
165
179
|
static get permissions() {
|
|
166
|
-
return [
|
|
167
|
-
...intranet.storage().getItem("permissions", "settings") || [],
|
|
168
|
-
...intranet.storage().getItem("globalPermissions", "settings") || []
|
|
169
|
-
];
|
|
180
|
+
return window.localStorage.getItem(WjePermissionsApi.permissionKey) || [];
|
|
170
181
|
}
|
|
182
|
+
/**
|
|
183
|
+
* Checks if the permission is included.
|
|
184
|
+
* @param key
|
|
185
|
+
* @returns {*}
|
|
186
|
+
*/
|
|
171
187
|
static includesKey(key) {
|
|
172
188
|
return WjePermissionsApi.permissions.includes(key);
|
|
173
189
|
}
|
|
190
|
+
/**
|
|
191
|
+
* Returns the keys for the permission check.
|
|
192
|
+
* @returns {*[]}
|
|
193
|
+
*/
|
|
174
194
|
static getKeys() {
|
|
175
195
|
let key = [];
|
|
176
196
|
if (this.hasAttribute("permission-check")) {
|
|
@@ -178,9 +198,17 @@ class WjePermissionsApi {
|
|
|
178
198
|
}
|
|
179
199
|
return key;
|
|
180
200
|
}
|
|
201
|
+
/**
|
|
202
|
+
* Checks if the component should be shown.
|
|
203
|
+
* @returns {*}
|
|
204
|
+
*/
|
|
181
205
|
static shouldShow() {
|
|
182
206
|
return this.hasAttribute("show") && JSON.parse(this.getAttribute("show"));
|
|
183
207
|
}
|
|
208
|
+
/**
|
|
209
|
+
* Checks if the permission is fulfilled.
|
|
210
|
+
* @returns {*}
|
|
211
|
+
*/
|
|
184
212
|
static isPermissionFulfilled() {
|
|
185
213
|
return WjePermissionsApi.getKeys.bind(this)().some((perm) => WjePermissionsApi.permissions.includes(perm)) || WjePermissionsApi.shouldShow.bind(this)();
|
|
186
214
|
}
|
package/dist/wje-master.js
CHANGED
|
@@ -5,6 +5,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
7
|
import WJElement, { event } from "./wje-element.js";
|
|
8
|
+
import { WjePermissionsApi } from "./wje-element.js";
|
|
8
9
|
import { defaultStoreActions, store } from "./wje-store.js";
|
|
9
10
|
import { b, w } from "./router-links-F7MJWhZi.js";
|
|
10
11
|
import { fetchAndParseCSS } from "./wje-fetchAndParseCSS.js";
|
|
@@ -5452,6 +5453,7 @@ export {
|
|
|
5452
5453
|
default84 as Tooltip,
|
|
5453
5454
|
default85 as VisuallyHidden,
|
|
5454
5455
|
WJElement,
|
|
5456
|
+
WjePermissionsApi,
|
|
5455
5457
|
b as bindRouterLinks,
|
|
5456
5458
|
defaultStoreActions,
|
|
5457
5459
|
event,
|
package/dist/wje-menu-item.js
CHANGED
|
@@ -33,9 +33,7 @@ class MenuItem extends WJElement {
|
|
|
33
33
|
e.stopPropagation();
|
|
34
34
|
} else {
|
|
35
35
|
event.dispatchCustomEvent(this, "wje-menu-item:click");
|
|
36
|
-
event.dispatchCustomEvent(this, this.dialog
|
|
37
|
-
bubbles: true
|
|
38
|
-
});
|
|
36
|
+
event.dispatchCustomEvent(this, this.dialog);
|
|
39
37
|
}
|
|
40
38
|
break;
|
|
41
39
|
case "CONTEXT":
|
|
@@ -49,9 +47,7 @@ class MenuItem extends WJElement {
|
|
|
49
47
|
}
|
|
50
48
|
} else {
|
|
51
49
|
event.dispatchCustomEvent(this, "wje-menu-item:click");
|
|
52
|
-
event.dispatchCustomEvent(this, this.dialog
|
|
53
|
-
bubbles: true
|
|
54
|
-
});
|
|
50
|
+
event.dispatchCustomEvent(this, this.dialog);
|
|
55
51
|
}
|
|
56
52
|
break;
|
|
57
53
|
}
|
|
@@ -114,12 +114,10 @@ function runTransition(el, name, type, cb) {
|
|
|
114
114
|
}
|
|
115
115
|
class GenericCSS extends AnimationHook {
|
|
116
116
|
beforeEnter(outlet, el) {
|
|
117
|
-
el.style.display = "none";
|
|
118
117
|
const name = outlet.getAttribute("animation") || "outlet";
|
|
119
118
|
el.classList.add(`${name}-enter`);
|
|
120
119
|
}
|
|
121
120
|
enter(outlet, el) {
|
|
122
|
-
el.style.display = "block";
|
|
123
121
|
const name = outlet.getAttribute("animation") || "outlet";
|
|
124
122
|
runTransition(el, name, "enter");
|
|
125
123
|
}
|
|
@@ -140,7 +138,6 @@ function getAnimationHook(name) {
|
|
|
140
138
|
}
|
|
141
139
|
class AnimatedOutlet extends HTMLElement {
|
|
142
140
|
appendChild(el) {
|
|
143
|
-
debugger;
|
|
144
141
|
if (!this.hasAttribute("animation")) {
|
|
145
142
|
super.appendChild(el);
|
|
146
143
|
return;
|
|
@@ -156,7 +153,6 @@ class AnimatedOutlet extends HTMLElement {
|
|
|
156
153
|
}
|
|
157
154
|
}
|
|
158
155
|
removeChild(el) {
|
|
159
|
-
debugger;
|
|
160
156
|
if (!this.hasAttribute("animation")) {
|
|
161
157
|
super.removeChild(el);
|
|
162
158
|
return;
|
package/dist/wje-store.js
CHANGED
|
@@ -228,7 +228,7 @@ class Store {
|
|
|
228
228
|
if (Array.isArray(action.payload) && action.payload.length == 0) {
|
|
229
229
|
console.warn(`Nemá zmysel pridávať prázdne pole do pola`);
|
|
230
230
|
}
|
|
231
|
-
if (!Array.isArray(action.payload) && action.type != defaultStoreActions.updateAction(stateValueName).type && action.type != defaultStoreActions.deleteAction(stateValueName).type) {
|
|
231
|
+
if (!Array.isArray(action.payload) && action.type != defaultStoreActions.updateAction(stateValueName).type && action.type != defaultStoreActions.deleteAction(stateValueName).type && action.type != defaultStoreActions.updateAction(stateValueName).type) {
|
|
232
232
|
console.error(`Nemôžete pridať do poľa hodnotu, ktorá nie je pole. Skontrolujte si či definovanie stavu vyzerá takto: "store.define(${stateValueName}, [])"`);
|
|
233
233
|
}
|
|
234
234
|
switch (action.type) {
|
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.81",
|
|
5
5
|
"homepage": "https://github.com/lencys/wj-elements",
|
|
6
6
|
"author": "Lukáš Ondrejček <lukas.ondrejcek@gmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -35,9 +35,6 @@
|
|
|
35
35
|
"exports": {
|
|
36
36
|
".": {
|
|
37
37
|
"import": "./dist/wje-master.js"
|
|
38
|
-
},
|
|
39
|
-
"./*.js": {
|
|
40
|
-
"import": "./dist/*.js"
|
|
41
38
|
}
|
|
42
39
|
},
|
|
43
40
|
"browserslist": [
|
|
@@ -55,7 +52,6 @@
|
|
|
55
52
|
"devDependencies": {
|
|
56
53
|
"@custom-elements-manifest/analyzer": "^0.9.3",
|
|
57
54
|
"custom-element-jet-brains-integration": "^1.4.4",
|
|
58
|
-
"dotenv": "^16.4.5",
|
|
59
55
|
"javascript-obfuscator": "^4.1.0",
|
|
60
56
|
"miragejs": "^0.1.48",
|
|
61
57
|
"rollup-plugin-terser": "^7.0.2",
|
|
@@ -64,4 +60,4 @@
|
|
|
64
60
|
"vite": "^5.1.2",
|
|
65
61
|
"vite-plugin-javascript-obfuscator": "^3.1.0"
|
|
66
62
|
}
|
|
67
|
-
}
|
|
63
|
+
}
|