wj-elements 0.1.80 → 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.
@@ -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
  }
@@ -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,
@@ -138,7 +138,6 @@ function getAnimationHook(name) {
138
138
  }
139
139
  class AnimatedOutlet extends HTMLElement {
140
140
  appendChild(el) {
141
- debugger;
142
141
  if (!this.hasAttribute("animation")) {
143
142
  super.appendChild(el);
144
143
  return;
@@ -154,7 +153,6 @@ class AnimatedOutlet extends HTMLElement {
154
153
  }
155
154
  }
156
155
  removeChild(el) {
157
- debugger;
158
156
  if (!this.hasAttribute("animation")) {
159
157
  super.removeChild(el);
160
158
  return;
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.80",
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
+ }