wj-elements 0.1.80 → 0.1.82

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/localize.js CHANGED
@@ -1,7 +1,7 @@
1
1
  class LocalizerDefault {
2
2
  constructor(element) {
3
3
  this.element = element;
4
- this.lang = this.element.lang || document.documentElement.lang || "sk";
4
+ this.lang = this.element.lang || document.documentElement.lang || "sk-SK";
5
5
  this.dir = this.element.dir || document.documentElement.dir || "ltr";
6
6
  this.setLanguage();
7
7
  }
@@ -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";
@@ -123,7 +124,7 @@ function formatDate(input, format) {
123
124
  return format.replace(/yyyy|MM|dd|HH|mm|ss|MMMM|MMM/g, (matched) => map[matched]);
124
125
  }
125
126
  const sk = {
126
- code: "sk",
127
+ code: "sk-SK",
127
128
  name: "Slovak",
128
129
  dir: "ltr",
129
130
  "welcome": "Vitajte",
@@ -131,12 +132,13 @@ const sk = {
131
132
  "wj.file.upload.uploaded": "Nahraných: ",
132
133
  "wj.file.upload.from": "z",
133
134
  "wj.stepper.button.next": "Ďalej",
135
+ "wj.stepper.button.finish": "Dokončiť",
134
136
  "wj.stepper.button.previous": "Späť",
135
137
  "wj.stepper.step": "Krok"
136
138
  };
137
139
  Localizer.registerTranslation(sk);
138
140
  const en = {
139
- code: "en",
141
+ code: "en-GB",
140
142
  name: "English",
141
143
  dir: "ltr",
142
144
  "welcome": "Welcome",
@@ -5452,6 +5454,7 @@ export {
5452
5454
  default84 as Tooltip,
5453
5455
  default85 as VisuallyHidden,
5454
5456
  WJElement,
5457
+ WjePermissionsApi,
5455
5458
  b as bindRouterLinks,
5456
5459
  defaultStoreActions,
5457
5460
  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.82",
5
5
  "homepage": "https://github.com/lencys/wj-elements",
6
6
  "author": "Lukáš Ondrejček <lukas.ondrejcek@gmail.com>",
7
7
  "license": "MIT",
@@ -36,8 +36,8 @@
36
36
  ".": {
37
37
  "import": "./dist/wje-master.js"
38
38
  },
39
- "./*.js": {
40
- "import": "./dist/*.js"
39
+ "./*": {
40
+ "import": "./dist/*"
41
41
  }
42
42
  },
43
43
  "browserslist": [
@@ -55,7 +55,6 @@
55
55
  "devDependencies": {
56
56
  "@custom-elements-manifest/analyzer": "^0.9.3",
57
57
  "custom-element-jet-brains-integration": "^1.4.4",
58
- "dotenv": "^16.4.5",
59
58
  "javascript-obfuscator": "^4.1.0",
60
59
  "miragejs": "^0.1.48",
61
60
  "rollup-plugin-terser": "^7.0.2",
@@ -64,4 +63,4 @@
64
63
  "vite": "^5.1.2",
65
64
  "vite-plugin-javascript-obfuscator": "^3.1.0"
66
65
  }
67
- }
66
+ }