dbm 1.2.0 → 1.2.2

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.
Files changed (82) hide show
  1. package/core/source/FirstSource.js +36 -0
  2. package/core/source/index.js +21 -0
  3. package/dbm.js +8 -0
  4. package/flow/controllers/index.js +2 -1
  5. package/flow/controllers/select/InArray.js +67 -0
  6. package/flow/controllers/select/index.js +2 -1
  7. package/flow/controllers/timing/IntervalStep.js +60 -0
  8. package/flow/controllers/timing/index.js +1 -0
  9. package/flow/index.js +13 -3
  10. package/flow/updatefunctions/animation/AnimateValue.js +39 -0
  11. package/flow/updatefunctions/animation/index.js +13 -0
  12. package/flow/updatefunctions/basic/MappedList.js +49 -0
  13. package/flow/updatefunctions/basic/PropertyOf.js +1 -1
  14. package/flow/updatefunctions/basic/PropertyOfWithDefault.js +28 -0
  15. package/flow/updatefunctions/basic/Translation.js +71 -0
  16. package/flow/updatefunctions/basic/index.js +77 -0
  17. package/flow/updatefunctions/index.js +1 -0
  18. package/flow/updatefunctions/logic/FloatMod.js +26 -0
  19. package/flow/updatefunctions/logic/PositionedItems.js +1 -1
  20. package/flow/updatefunctions/logic/index.js +18 -0
  21. package/flow/updatefunctions/thirdparty/google/index.js +3 -0
  22. package/flow/updatefunctions/thirdparty/google/maps/AutoComplete.js +132 -0
  23. package/flow/updatefunctions/thirdparty/google/maps/PlaceDetails.js +80 -0
  24. package/flow/updatefunctions/thirdparty/google/maps/index.js +4 -0
  25. package/flow/updatefunctions/thirdparty/index.js +2 -1
  26. package/graphapi/webclient/ApiConnection.js +2 -0
  27. package/graphapi/webclient/WebSocketConnection.js +1 -0
  28. package/graphapi/webclient/admin/EditorGroup.js +1 -1
  29. package/graphapi/webclient/admin/ItemEditor.js +39 -0
  30. package/graphapi/webclient/admin/ItemSaveData.js +6 -0
  31. package/graphapi/webclient/admin/SaveFunctions.js +4 -0
  32. package/graphapi/webclient/admin/ValueEditor.js +15 -0
  33. package/graphapi/webclient/decode/DecodeBaseObject.js +4 -0
  34. package/graphapi/webclient/decode/index.js +32 -1
  35. package/graphapi/webclient/index.js +41 -0
  36. package/package.json +1 -1
  37. package/react/admin/EditObject.js +52 -0
  38. package/react/admin/EditObjectById.js +2 -3
  39. package/react/admin/EditPage.js +18 -0
  40. package/react/admin/EditorGroup.js +23 -0
  41. package/react/admin/SaveAllButton.js +34 -0
  42. package/react/admin/editorsgroup/EditField.js +2 -2
  43. package/react/admin/editorsgroup/EditFieldTranslation.js +27 -0
  44. package/react/admin/editorsgroup/EditIdentifer.js +3 -3
  45. package/react/admin/editorsgroup/EditItem.js +1 -1
  46. package/react/admin/editorsgroup/EditRelation.js +2 -2
  47. package/react/admin/editorsgroup/EditVisibility.js +2 -2
  48. package/react/admin/editorsgroup/index.js +2 -1
  49. package/react/admin/index.js +3 -0
  50. package/react/admin/objects/EditObject.js +9 -4
  51. package/react/admin/objects/itemeditors/Name.js +31 -29
  52. package/react/admin/pageeditors/LinkPreviews.js +98 -0
  53. package/react/admin/pageeditors/index.js +1 -0
  54. package/react/area/FixedWidthInfiniteSlideshow.js +50 -0
  55. package/react/area/List.js +4 -0
  56. package/react/area/index.js +1 -0
  57. package/react/blocks/admin/objects/RunObjectCommands.js +0 -14
  58. package/react/blocks/admin/objects/User.js +29 -1
  59. package/react/blocks/content/LinkList.js +67 -0
  60. package/react/blocks/content/LinkListCard.js +83 -0
  61. package/react/blocks/content/index.js +3 -1
  62. package/react/blocks/faq/AskAQuestion.js +1 -1
  63. package/react/blocks/index.js +34 -0
  64. package/react/form/Option.js +18 -0
  65. package/react/form/index.js +2 -1
  66. package/react/text/HtmlText.js +6 -1
  67. package/react/text/NumberDisplay.js +30 -0
  68. package/react/text/OptionalLink.js +21 -0
  69. package/react/text/TranslatedText.js +25 -0
  70. package/react/text/TranslationGroup.js +24 -0
  71. package/react/text/index.js +10 -2
  72. package/site/SiteDataLoader.js +8 -13
  73. package/site/index.js +2 -0
  74. package/site/translation/TranslationLoader.js +59 -0
  75. package/site/translation/index.js +27 -0
  76. package/utils/ArrayFunctions.js +16 -0
  77. package/utils/CompareFunctions.js +24 -0
  78. package/utils/StringFunctions.js +18 -3
  79. package/utils/index.js +3 -1
  80. package/utils/thirdparty/index.js +1 -0
  81. package/utils/thirdparty/wprrapi/WprrApiParser.js +31 -0
  82. package/utils/thirdparty/wprrapi/index.js +3 -0
@@ -215,6 +215,15 @@ export let registerAllBlocks = function() {
215
215
  registerBlock("content/contentBlock", "Content block", createElement(Dbm.react.blocks.content.ContentBlock, {}), editor, {}, {});
216
216
  }
217
217
 
218
+ {
219
+ let editor = createElement(Dbm.react.admin.editor.EditorBlockName, {},
220
+ createElement(Dbm.react.form.LabelledArea, {label: "Link list"},
221
+ createElement(Dbm.react.admin.editor.fields.SelectObjectField, {name: "list", "objectType": "linkList"})
222
+ )
223
+ );
224
+ registerBlock("content/linkList", "Link list", createElement(Dbm.react.blocks.content.LinkList, {}), editor, {}, {});
225
+ }
226
+
218
227
  {
219
228
  let editor = createElement(Dbm.react.admin.editor.EditorBlockName, {},
220
229
  createElement(Dbm.react.form.LabelledArea, {label: "Link name"},
@@ -374,17 +383,42 @@ export let registerAllBlocks = function() {
374
383
  objectTypeEditor.editors = newArray;
375
384
  }
376
385
 
386
+ {
387
+ let objectTypeEditor = Dbm.getInstance().repository.getItem("admin/objectTypeEditors/group/translationGroup");
388
+ if(!objectTypeEditor.editors) {
389
+ objectTypeEditor.setValue("editors", []);
390
+ }
391
+
392
+ let newArray = [].concat(objectTypeEditor.editors);
393
+ newArray.push(Dbm.getInstance().repository.getItem("admin/itemEditors/name"));
394
+
395
+ objectTypeEditor.editors = newArray;
396
+ }
397
+
377
398
 
378
399
  let admin = Dbm.getInstance().repository.getItem("admin");
379
400
  admin.requireProperty("pageEditors", []);
380
401
 
381
402
  let pageEditors = [].concat(admin.pageEditors);
382
403
 
404
+ {
405
+ let newEditor = Dbm.getInstance().repository.getItem("admin/pageEditors/linkPreviews");
406
+ newEditor.setValue("element", React.createElement(Dbm.react.admin.pageeditors.LinkPreviews));
407
+ pageEditors.push(newEditor);
408
+ }
409
+
383
410
  {
384
411
  let newEditor = Dbm.getInstance().repository.getItem("admin/pageEditors/helpSections");
385
412
  newEditor.setValue("element", React.createElement(Dbm.react.admin.pageeditors.HelpSections));
386
413
  pageEditors.push(newEditor);
387
414
  }
388
415
 
416
+
417
+
389
418
  admin.pageEditors = pageEditors;
419
+
420
+ {
421
+ let elementItem = Dbm.getRepositoryItem("linkListCard");
422
+ elementItem.setValue("element", React.createElement(Dbm.react.blocks.content.LinkListCard));
423
+ }
390
424
  }
@@ -0,0 +1,18 @@
1
+ import React from "react";
2
+ import Dbm from "../../index.js";
3
+
4
+ export default class Option extends Dbm.react.BaseObject {
5
+ _construct() {
6
+ super._construct();
7
+
8
+ this.getDynamicProp("value", "");
9
+ }
10
+
11
+ _renderMainElement() {
12
+
13
+ let value = this.getDynamicProp("value").value;
14
+
15
+ return this._createMainElement("option", {"value": value,}, this.getPropValue("children"));
16
+ }
17
+ }
18
+
@@ -9,4 +9,5 @@ export {default as GraphApiImage} from "./GraphApiImage.js";
9
9
  export {default as EditArray} from "./EditArray.js";
10
10
  export {default as TextArea} from "./TextArea.js";
11
11
  export {default as EditObjectProperty} from "./EditObjectProperty.js";
12
- export {default as Form} from "./Form.js";
12
+ export {default as Form} from "./Form.js";
13
+ export {default as Option} from "./Option.js";
@@ -7,7 +7,12 @@ export default class HtmlText extends Dbm.react.BaseObject {
7
7
 
8
8
  _renderMainElement() {
9
9
 
10
- let text = "" + this.getPropValue("text");
10
+ let rawText = this.getPropValue("text");;
11
+ let text = "";
12
+
13
+ if(rawText !== undefined && rawText !== null) {
14
+ text += rawText;
15
+ }
11
16
 
12
17
  return this._createMainElement("span", {"dangerouslySetInnerHTML": {__html: text}});;
13
18
  }
@@ -0,0 +1,30 @@
1
+ import Dbm from "../../index.js";
2
+
3
+ export default class NumberDisplay extends Dbm.react.BaseObject {
4
+ _construct() {
5
+ super._construct();
6
+ }
7
+
8
+ render() {
9
+ let text = this.getPropValue("number");
10
+ let number = 1*text;
11
+
12
+ if(!isNaN(number)) {
13
+
14
+ let offset = this.getPropValueWithDefault("offset", 0);
15
+ if(offset) {
16
+ number += offset;
17
+ }
18
+
19
+
20
+ if("numberOfDecimals" in this.props) {
21
+ text = number.toFixed(this.getPropValue("numberOfDecimals"));
22
+ }
23
+ else {
24
+ text = "" + number;
25
+ }
26
+ }
27
+
28
+ return text;
29
+ }
30
+ }
@@ -0,0 +1,21 @@
1
+ import Dbm from "../../index.js";
2
+ import React from "react";
3
+
4
+ export default class OptionalLink extends Dbm.react.BaseObject {
5
+ _construct() {
6
+ super._construct();
7
+ }
8
+
9
+ _renderMainElement() {
10
+
11
+ let url = this.getPropValue("href");
12
+ let children = this.getPropValue("children");
13
+ if(url) {
14
+ return this._createMainElement(Dbm.react.text.Link, {href: url}, children);
15
+ }
16
+ else {
17
+ return React.createElement(React.Fragment, {}, children);
18
+ }
19
+
20
+ }
21
+ }
@@ -0,0 +1,25 @@
1
+ import Dbm from "../../index.js";
2
+
3
+ export default class TranslatedText extends Dbm.react.BaseObject {
4
+ _constructAfterProps() {
5
+ super._constructAfterProps();
6
+
7
+ let text = this.getPropValue("text");
8
+ let textId = this.getPropValue("textId");
9
+ let additionalPath = [];
10
+ if(!textId) {
11
+ textId = Dbm.utils.StringFunctions.convertToCamelCase(text);
12
+ }
13
+ let path = this.context.translationPath;
14
+
15
+ //METODO: split textId into additional path
16
+
17
+ let translation = Dbm.flow.updatefunctions.basic.translation(textId, text, path, additionalPath);
18
+
19
+ this.item.requireProperty("translatedText", text).connectInput(translation.output.properties.value);
20
+ }
21
+
22
+ _renderMainElement() {
23
+ return Dbm.react.text.text(this.item.properties.translatedText);
24
+ }
25
+ }
@@ -0,0 +1,24 @@
1
+ import React from "react";
2
+ import Dbm from "../../index.js";
3
+
4
+ export default class TranslationGroup extends Dbm.react.BaseObject {
5
+ _construct() {
6
+ super._construct();
7
+ }
8
+
9
+ render() {
10
+
11
+ let translationPath = this.context.translationPath;
12
+ if(!translationPath) {
13
+ translationPath = this.getPropValue("path");
14
+ }
15
+ else {
16
+ translationPath += "/" + this.getPropValue("path");
17
+ }
18
+
19
+ let values = {};
20
+ values["translationPath"] = translationPath;
21
+
22
+ return React.createElement(Dbm.react.context.AddContextVariables, {"values": values}, this.getPropValue("children"));
23
+ }
24
+ }
@@ -4,17 +4,25 @@ import {createElement} from "react";
4
4
  export {default as Text} from "./Text.js";
5
5
  export {default as HtmlText} from "./HtmlText.js";
6
6
  export {default as Link} from "./Link.js";
7
+ export {default as OptionalLink} from "./OptionalLink.js";
8
+ export {default as NumberDisplay} from "./NumberDisplay.js";
9
+ export {default as TranslatedText} from "./TranslatedText.js";
10
+ export {default as TranslationGroup} from "./TranslationGroup.js";
7
11
 
8
- export let text = function(aText) {
12
+ export const text = function(aText) {
9
13
  if(typeof(aText) === "string") {
10
14
  return aText;
11
15
  }
12
16
  return createElement(Dbm.react.text.Text, {text: aText});
13
17
  }
14
18
 
15
- export let htmlText = function(aText, aElementType = "span", aAdditionalProps = {}) {
19
+ export const htmlText = function(aText, aElementType = "span", aAdditionalProps = {}) {
16
20
  if(typeof(aText) === "string") {
17
21
  //return createElement(aElementType, {"dangerouslySetInnerHTML": {__html: aText}});
18
22
  }
19
23
  return createElement(Dbm.react.text.HtmlText, {text: aText, elementType: aElementType, ...aAdditionalProps});
24
+ }
25
+
26
+ export const translatedText = function(aText, aTextId) {
27
+ return createElement(Dbm.react.text.TranslatedText, {text: aText, textId: aTextId});
20
28
  }
@@ -4,15 +4,11 @@ export default class SiteDataLoader extends Dbm.core.BaseObject {
4
4
  _construct() {
5
5
  super._construct();
6
6
 
7
- this.item.setValue("status", 0);
7
+ this.item.setValue("status", Dbm.loading.LoadingStatus.NOT_STARTED);
8
8
  this.item.setValue("url", null);
9
9
  this.item.setValue("currentPage", null);
10
-
11
- let urlUpdate = new Dbm.flow.updatefunctions.basic.RunCommand();
12
- urlUpdate.input.properties.value.connectInput(this.item.properties.url);
13
- urlUpdate.input.command = Dbm.commands.callFunction(this._loadUrl.bind(this), []);
14
10
 
15
- urlUpdate.output.properties.value.startUpdating();
11
+ Dbm.flow.addUpdateCommand(this.item.properties.url, Dbm.commands.callFunction(this._loadUrl.bind(this), []));
16
12
  }
17
13
 
18
14
  _loadUrl() {
@@ -23,19 +19,18 @@ export default class SiteDataLoader extends Dbm.core.BaseObject {
23
19
  let parsedUrl = new URL(url);
24
20
  let pathName = parsedUrl.pathname;
25
21
 
26
- let pageData = Dbm.getInstance().repository.getItem(pathName);
22
+ let pageData = Dbm.getRepositoryItem(pathName);
27
23
  pageData.setValue("url", url);
28
24
 
29
- let graphApi = Dbm.getInstance().repository.getItem("graphApi").controller;
30
- let request = graphApi.requestUrl(pathName);
25
+ let request = Dbm.getGraphApi().requestUrl(pathName);
31
26
 
32
- this.item.setValue("status", 2);
33
- Dbm.flow.addUpdateCommandWhenMatched(request.properties.status, 1, Dbm.commands.callFunction(this._pageDataLoaded.bind(this), [pageData, request]))
27
+ this.item.setValue("status", Dbm.loading.LoadingStatus.LOADING);
28
+ Dbm.flow.addUpdateCommandWhenMatched(request.properties.status, Dbm.loading.LoadingStatus.LOADED, Dbm.commands.callFunction(this._pageDataLoaded.bind(this), [pageData, request]))
34
29
 
35
30
  }
36
31
  else {
37
32
  this.item.currentPage = null;
38
- this.item.setValue("status", 0);
33
+ this.item.setValue("status", Dbm.loading.LoadingStatus.NOT_STARTED);
39
34
  }
40
35
  }
41
36
 
@@ -48,7 +43,7 @@ export default class SiteDataLoader extends Dbm.core.BaseObject {
48
43
 
49
44
  if(this.item.url === aPageData.url) {
50
45
  this.item.currentPage = aPageData;
51
- this.item.setValue("status", 1);
46
+ this.item.setValue("status", Dbm.loading.LoadingStatus.LOADED);
52
47
 
53
48
  }
54
49
 
package/site/index.js CHANGED
@@ -1,5 +1,7 @@
1
1
  import Dbm from "../index.js";
2
2
 
3
+ export * as translation from "./translation/index.js";
4
+
3
5
  export {default as SiteNavigation} from "./SiteNavigation.js";
4
6
  export {default as SiteDataLoader} from "./SiteDataLoader.js";
5
7
  export {default as BrowserUpdater} from "./BrowserUpdater.js";
@@ -0,0 +1,59 @@
1
+ import Dbm from "../../index.js";
2
+
3
+ export default class TranslationLoader extends Dbm.core.BaseObject {
4
+ _construct() {
5
+ super._construct();
6
+
7
+ this.item.setValue("language", null);
8
+ this.item.setValue("baseUrl", "/assets/translations/");
9
+ this.item.setValue("ready", false);
10
+
11
+ Dbm.flow.addUpdateCommand(this.item.properties.language, Dbm.commands.callFunction(this._loadTranslation.bind(this), []));
12
+ }
13
+
14
+ _loadTranslation() {
15
+ console.log("_loadTranslation");
16
+
17
+ let language = this.item.language;
18
+
19
+ if(language) {
20
+ if(language.translations) {
21
+ this._updateTranslationManager();
22
+ }
23
+ else {
24
+ let baseUrl = this.item.baseUrl;
25
+
26
+ let fullUrl = baseUrl + language.code + ".json?version=" + Dbm.getRepositoryItem("site").version;
27
+
28
+ let loader = new Dbm.loading.JsonLoader();
29
+ loader.setUrl(fullUrl);
30
+ Dbm.flow.addUpdateCommandWhenMatched(loader.item.properties.status, Dbm.loading.LoadingStatus.LOADED, Dbm.commands.callFunction(this._translationLoaded.bind(this), [language, loader]));
31
+ this.item.ready = false;
32
+ loader.load();
33
+ }
34
+ }
35
+ else {
36
+ Dbm.getRepositoryItem("site/translations").setValue("data", {});
37
+ this.item.ready = true;
38
+ }
39
+ }
40
+
41
+ _translationLoaded(aLanguage, aLoader) {
42
+ console.log("_translationLoaded");
43
+ console.log(aLanguage, aLoader);
44
+
45
+ let data = aLoader.item.data;
46
+ aLanguage.setValue("translations", data);
47
+
48
+ if(aLanguage === this.item.language) {
49
+ this._updateTranslationManager();
50
+ }
51
+ }
52
+
53
+ _updateTranslationManager() {
54
+
55
+ Dbm.getRepositoryItem("site/translations").setValue("data", this.item.language.translations);
56
+
57
+ this.item.ready = true;
58
+ }
59
+ }
@@ -0,0 +1,27 @@
1
+ import Dbm from "../../index.js";
2
+
3
+ export {default as TranslationLoader} from "./TranslationLoader.js";
4
+
5
+ export const setupTranslationLoader = function(aUrlBase = "/assets/translations/") {
6
+
7
+ Dbm.getRepositoryItem("site/translations").requireProperty("data", {});
8
+
9
+ let controller = new Dbm.site.translation.TranslationLoader();
10
+ controller.item.register("site/translationLoader");
11
+
12
+ controller.item.setValue("baseUrl", aUrlBase);
13
+
14
+ controller.item.properties.language.connectInput(Dbm.getRepositoryItem("site").properties.currentLanguage);
15
+
16
+ return controller;
17
+ }
18
+
19
+ export const getLanguage = function(aLanguageCode) {
20
+ let item = Dbm.getRepositoryItem("languages/" + aLanguageCode);
21
+
22
+ if(!item.code) {
23
+ item.setValue("code", aLanguageCode);
24
+ }
25
+
26
+ return item;
27
+ }
@@ -292,6 +292,22 @@ export const getItemIndexByIfExists = function(aArray, aField, aIdentifier) {
292
292
  return -1;
293
293
  }
294
294
 
295
+ export const getItemByIfExists = function(aArray, aField, aIdentifier) {
296
+ let index = getItemIndexByIfExists(aArray, aField, aIdentifier);
297
+
298
+ return (index !== -1) ? aArray[index] : null;
299
+ }
300
+
301
+ export const getItemBy = function(aArray, aField, aIdentifier) {
302
+ let index = getItemIndexByIfExists(aArray, aField, aIdentifier);
303
+
304
+ if(index === -1) {
305
+ console.warn("No item found", aArray, aField, aIdentifier);
306
+ }
307
+
308
+ return (index !== -1) ? aArray[index] : null;
309
+ }
310
+
295
311
  export const sum = function(aArray) {
296
312
 
297
313
  if(!Array.isArray(aArray)) {
@@ -15,6 +15,14 @@ export const strictEquals = function(aA, aB) {
15
15
  return aA === aB;
16
16
  }
17
17
 
18
+ export const notEquals = function(aA, aB) {
19
+ return aA != aB;
20
+ }
21
+
22
+ export const strictNotEquals = function(aA, aB) {
23
+ return aA !== aB;
24
+ }
25
+
18
26
  export const arrayContains = function(aA, aB) {
19
27
  if(aA && aA.indexOf && aA.indexOf(aB) >= 0) {
20
28
  return true
@@ -31,6 +39,14 @@ export const inArray = function(aA, aB) {
31
39
  return false;
32
40
  }
33
41
 
42
+ export const notEmpty = function(aA, aB) {
43
+ if(aA && aA.length > 0) {
44
+ return true
45
+ }
46
+
47
+ return false;
48
+ }
49
+
34
50
  export const fullSetup = function() {
35
51
  Dbm.getInstance().repository.getItem("compareFunctions/objectExists").setValue("compare", objectExists);
36
52
 
@@ -40,6 +56,14 @@ export const fullSetup = function() {
40
56
  Dbm.getInstance().repository.getItem("compareFunctions/===").setValue("compare", strictEquals);
41
57
  Dbm.getInstance().repository.getItem("compareFunctions/strictEquals").setValue("compare", strictEquals);
42
58
 
59
+ Dbm.getInstance().repository.getItem("compareFunctions/!=").setValue("compare", notEquals);
60
+ Dbm.getInstance().repository.getItem("compareFunctions/notEquals").setValue("compare", notEquals);
61
+
62
+ Dbm.getInstance().repository.getItem("compareFunctions/!==").setValue("compare", strictNotEquals);
63
+ Dbm.getInstance().repository.getItem("compareFunctions/strictNotEquals").setValue("compare", strictNotEquals);
64
+
43
65
  Dbm.getInstance().repository.getItem("compareFunctions/arrayContains").setValue("compare", arrayContains);
44
66
  Dbm.getInstance().repository.getItem("compareFunctions/inArray").setValue("compare", inArray);
67
+
68
+ Dbm.getInstance().repository.getItem("compareFunctions/notEmpty").setValue("compare", notEmpty);
45
69
  }
@@ -1,4 +1,4 @@
1
- export let createNiceFileName = function(aFileName) {
1
+ export const createNiceFileName = function(aFileName) {
2
2
  let fileName = aFileName.toLowerCase();
3
3
 
4
4
  fileName = fileName.replace(/[åäã]/gi, 'a');
@@ -11,7 +11,7 @@ export let createNiceFileName = function(aFileName) {
11
11
  return fileName;
12
12
  }
13
13
 
14
- export let createNiceFilePath = function(aFileName) {
14
+ export const createNiceFilePath = function(aFileName) {
15
15
  let fileName = aFileName.toLowerCase();
16
16
 
17
17
  fileName = fileName.replace(/[åäã]/gi, 'a');
@@ -22,4 +22,19 @@ export let createNiceFilePath = function(aFileName) {
22
22
  fileName = fileName.replace(/\-+/gi, '-');
23
23
 
24
24
  return fileName;
25
- }
25
+ }
26
+
27
+ export const convertToCamelCase = function(aText) {
28
+ let currentArray = aText.split(" ");
29
+ let currentArrayLength = currentArray.length;
30
+ let returnText = currentArray[0].toLowerCase();
31
+ //METODO: handle special characters
32
+ for(let i = 1; i < currentArrayLength; i++) { //MENOTE: first iteration is done outside of loop
33
+ let currentString = currentArray[i].toLowerCase();
34
+ if(currentString.length > 0) {
35
+ returnText += currentString[0].toUpperCase() + currentString.substring(1, currentString.length);
36
+ }
37
+ }
38
+
39
+ return returnText;
40
+ };
package/utils/index.js CHANGED
@@ -2,4 +2,6 @@ export * as ArrayFunctions from "./ArrayFunctions.js";
2
2
  export * as NumberFunctions from "./NumberFunctions.js";
3
3
  export * as StringFunctions from "./StringFunctions.js";
4
4
  export * as UrlFunctions from "./UrlFunctions.js";
5
- export * as CompareFunctions from "./CompareFunctions.js";
5
+ export * as CompareFunctions from "./CompareFunctions.js";
6
+
7
+ export * as thirdparty from "./thirdparty/index.js";
@@ -0,0 +1 @@
1
+ export * as wprrapi from "./wprrapi/index.js";
@@ -0,0 +1,31 @@
1
+ import Dbm from "../../../index.js";
2
+
3
+ export default class WprrApiParser extends Dbm.core.BaseObject {
4
+
5
+ constructor() {
6
+ super();
7
+
8
+ this.items = {};
9
+ }
10
+
11
+ setItems(aItems) {
12
+ this.items = aItems;
13
+
14
+ return this;
15
+ }
16
+
17
+ getItem(aId) {
18
+ return this.items[aId];
19
+ }
20
+
21
+ getItems(aIds) {
22
+ let returnArray = [];
23
+ let currentArray = aIds;
24
+ let currentArrayLength = currentArray.length;
25
+ for(let i = 0; i < currentArrayLength; i++) {
26
+ returnArray.push(this.getItem(currentArray[i]));
27
+ }
28
+
29
+ return returnArray;
30
+ }
31
+ }
@@ -0,0 +1,3 @@
1
+ import Dbm from "../../../index.js";
2
+
3
+ export {default as WprrApiParser} from "./WprrApiParser.js";