@schukai/monster 3.100.18 → 3.100.20

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/CHANGELOG.md CHANGED
@@ -2,6 +2,22 @@
2
2
 
3
3
 
4
4
 
5
+ ## [3.100.20] - 2025-01-22
6
+
7
+ ### Bug Fixes
8
+
9
+ - **treeSelect:** check if internalNodesSymbol available
10
+
11
+
12
+
13
+ ## [3.100.19] - 2025-01-21
14
+
15
+ ### Bug Fixes
16
+
17
+ - check header by rest api
18
+
19
+
20
+
5
21
  ## [3.100.18] - 2025-01-20
6
22
 
7
23
  ### Bug Fixes
package/package.json CHANGED
@@ -1 +1 @@
1
- {"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.6.13","@popperjs/core":"^2.11.8"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","homepage":"https://monsterjs.org/","keywords":["framework","web","dom","css","sass","mobile-first","app","front-end","templates","schukai","core","shopcloud","alvine","monster","buildmap","stack","observer","observable","uuid","node","nodelist","css-in-js","logger","log","theme"],"license":"AGPL 3.0","main":"source/monster.mjs","module":"source/monster.mjs","name":"@schukai/monster","repository":{"type":"git","url":"https://gitlab.schukai.com/oss/libraries/javascript/monster.git"},"type":"module","version":"3.100.18"}
1
+ {"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.6.13","@popperjs/core":"^2.11.8"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","homepage":"https://monsterjs.org/","keywords":["framework","web","dom","css","sass","mobile-first","app","front-end","templates","schukai","core","shopcloud","alvine","monster","buildmap","stack","observer","observable","uuid","node","nodelist","css-in-js","logger","log","theme"],"license":"AGPL 3.0","main":"source/monster.mjs","module":"source/monster.mjs","name":"@schukai/monster","repository":{"type":"git","url":"https://gitlab.schukai.com/oss/libraries/javascript/monster.git"},"type":"module","version":"3.100.20"}
@@ -288,6 +288,11 @@ function formatKeyLabel(node) {
288
288
  * @return {Array}
289
289
  */
290
290
  function buildTreeLabels(value) {
291
+
292
+ if (!this[internalNodesSymbol]) {
293
+ return [value];
294
+ }
295
+
291
296
  let node = this[internalNodesSymbol].get(value);
292
297
  if (node === undefined) {
293
298
  node = this[internalNodesSymbol].get(parseInt(value));
@@ -94,7 +94,10 @@ class RestAPI extends Server {
94
94
  write: {
95
95
  init: {
96
96
  method: "POST",
97
- headers: null,
97
+ headers: {
98
+ Accept: "application/json",
99
+ "Content-Type": "application/json",
100
+ },
98
101
  },
99
102
  responseCallback: null,
100
103
  acceptedStatus: [200, 201],
@@ -118,7 +121,9 @@ class RestAPI extends Server {
118
121
  read: {
119
122
  init: {
120
123
  method: "GET",
121
- headers: null,
124
+ headers: {
125
+ Accept: "application/json"
126
+ },
122
127
  },
123
128
  path: null,
124
129
  responseCallback: null,
@@ -141,10 +146,9 @@ class RestAPI extends Server {
141
146
  read() {
142
147
  let init = this.getOption("read.init");
143
148
  if (!isObject(init)) init = {};
144
- if (!(init["headers"] instanceof Headers)) {
149
+ if (!(init["headers"] instanceof Headers) && !isObject(init["headers"])) {
145
150
  init["headers"] = new Headers();
146
151
  init["headers"].append("Accept", "application/json");
147
- init["headers"].append("X-Requested-With", "XMLHttpRequest");
148
152
  }
149
153
 
150
154
  if (!init["method"]) init["method"] = "GET";
@@ -166,7 +170,7 @@ class RestAPI extends Server {
166
170
  write() {
167
171
  let init = this.getOption("write.init");
168
172
  if (!isObject(init)) init = {};
169
- if (!(init["headers"] instanceof Headers)) {
173
+ if (!(init["headers"] instanceof Headers) && !isObject(init["headers"])) {
170
174
  init["headers"] = new Headers();
171
175
  init["headers"].append("Accept", "application/json");
172
176
  init["headers"].append("Content-Type", "application/json");
@@ -206,6 +210,10 @@ class RestAPI extends Server {
206
210
  function fetchData(init, key, callback) {
207
211
  let response;
208
212
 
213
+ if (init?.headers === null) {
214
+ init.headers = new Headers();
215
+ }
216
+
209
217
  return fetch(this.getOption(`${key}.url`), init)
210
218
  .then((resp) => {
211
219
  response = resp;