qcobjects-sdk 2.4.66 → 2.5.105

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 (177) hide show
  1. package/.github/workflows/npmpublish.yml +47 -0
  2. package/README.md +0 -1
  3. package/VERSION +1 -1
  4. package/build/index.js +137 -25
  5. package/build/ts/org.qcobjects.base.components.js +75 -0
  6. package/build/ts/org.qcobjects.cloud.auth.session.data.js +122 -0
  7. package/build/ts/org.qcobjects.cloud.auth.session.usertoken.js +97 -0
  8. package/build/ts/org.qcobjects.components.grid.js +63 -0
  9. package/build/ts/org.qcobjects.components.js +200 -0
  10. package/build/{js/org.qcobjects.modal.effects.js → ts/org.qcobjects.components.list.js} +40 -29
  11. package/build/ts/org.qcobjects.components.notifications.js +180 -0
  12. package/build/ts/org.qcobjects.components.slider.js +207 -0
  13. package/build/{js → ts}/org.qcobjects.components.splashscreen.js +123 -130
  14. package/build/ts/org.qcobjects.controllers.form.js +180 -0
  15. package/build/ts/org.qcobjects.controllers.grid.js +269 -0
  16. package/build/{js → ts}/org.qcobjects.controllers.js +11 -11
  17. package/build/ts/org.qcobjects.controllers.list.js +235 -0
  18. package/build/ts/org.qcobjects.controllers.slider.js +126 -0
  19. package/build/ts/org.qcobjects.controllers.swagger.js +75 -0
  20. package/build/ts/org.qcobjects.effects.base.js +70 -0
  21. package/build/ts/org.qcobjects.effects.extended.js +270 -0
  22. package/build/ts/org.qcobjects.effects.js +49 -0
  23. package/build/ts/org.qcobjects.i18n_messages.js +59 -0
  24. package/build/{js → ts}/org.qcobjects.modal.controllers.js +16 -15
  25. package/build/ts/org.qcobjects.modal.effects.js +46 -0
  26. package/build/{js → ts}/org.qcobjects.models.js +11 -11
  27. package/{src/js/org.qcobjects.tools.canvas.ts → build/ts/org.qcobjects.tools.canvas.js} +16 -21
  28. package/build/{js → ts}/org.qcobjects.tools.js +10 -3
  29. package/build/ts/org.qcobjects.tools.layouts.js +74 -0
  30. package/build/{js → ts}/org.qcobjects.views.js +11 -11
  31. package/build-esbuild.js +72 -0
  32. package/eslint.config.mjs +88 -0
  33. package/package.json +67 -63
  34. package/postbuild.js +10 -0
  35. package/public/browser/index.js +9829 -0
  36. package/public/browser/index.js.map +7 -0
  37. package/public/cjs/index.cjs +9879 -0
  38. package/public/cjs/index.cjs.map +7 -0
  39. package/public/esm/index.mjs +9819 -0
  40. package/public/esm/index.mjs.map +7 -0
  41. package/public/types/index.d.ts +614 -0
  42. package/spec/helpers/mock-sdk.helper.ts +2 -0
  43. package/spec/mocks/qcobjects-sdk.mock.ts +1 -0
  44. package/spec/support/jasmine.json +7 -4
  45. package/src/index.ts +127 -2
  46. package/src/ts/org.qcobjects.base.components.ts +83 -0
  47. package/src/ts/org.qcobjects.cloud.auth.session.data.ts +134 -0
  48. package/src/ts/org.qcobjects.cloud.auth.session.usertoken.ts +108 -0
  49. package/src/ts/org.qcobjects.components.grid.ts +68 -0
  50. package/src/{js → ts}/org.qcobjects.components.list.ts +15 -31
  51. package/src/{js → ts}/org.qcobjects.components.notifications.ts +12 -12
  52. package/src/ts/org.qcobjects.components.slider.ts +216 -0
  53. package/src/{js → ts}/org.qcobjects.components.splashscreen.ts +31 -39
  54. package/src/ts/org.qcobjects.components.ts +226 -0
  55. package/src/ts/org.qcobjects.controllers.form.ts +209 -0
  56. package/src/ts/org.qcobjects.controllers.grid.ts +291 -0
  57. package/src/ts/org.qcobjects.controllers.list.ts +256 -0
  58. package/src/ts/org.qcobjects.controllers.slider.ts +153 -0
  59. package/src/ts/org.qcobjects.controllers.swagger.ts +83 -0
  60. package/src/{js → ts}/org.qcobjects.controllers.ts +7 -9
  61. package/src/ts/org.qcobjects.effects.base.ts +81 -0
  62. package/src/{js/org.qcobjects.effects.ts → ts/org.qcobjects.effects.extended.ts} +70 -198
  63. package/src/ts/org.qcobjects.effects.ts +42 -0
  64. package/src/ts/org.qcobjects.i18n_messages.ts +68 -0
  65. package/src/{js → ts}/org.qcobjects.modal.controllers.ts +12 -14
  66. package/src/{js → ts}/org.qcobjects.modal.effects.ts +22 -18
  67. package/src/{js → ts}/org.qcobjects.models.ts +8 -11
  68. package/src/ts/org.qcobjects.tools.canvas.ts +57 -0
  69. package/src/ts/org.qcobjects.tools.layouts.ts +82 -0
  70. package/src/{js → ts}/org.qcobjects.tools.ts +7 -1
  71. package/src/{js → ts}/org.qcobjects.views.ts +9 -8
  72. package/src/types/global/index.d.ts +181 -0
  73. package/transpile.js +65 -0
  74. package/tsconfig.d.json +65 -3
  75. package/tsconfig.jasmine.json +64 -0
  76. package/tsconfig.json +71 -7
  77. package/.eslintignore +0 -4
  78. package/.eslintrc.cjs +0 -6
  79. package/.github/workflows/npmpublish-beta.yml +0 -38
  80. package/.github/workflows/npmpublish-lts.yml +0 -38
  81. package/.github/workflows/npmpublish-main.yml +0 -40
  82. package/.gitmodules +0 -4
  83. package/build/QCObjects-SDK.js +0 -97
  84. package/build/css/base-modal.css +0 -43
  85. package/build/css/basic-layout-embedded-nav.css +0 -14
  86. package/build/css/basic-layout.css +0 -76
  87. package/build/css/components/horizontal-list.css +0 -64
  88. package/build/css/components/list.css +0 -57
  89. package/build/css/components/splashscreen.css +0 -111
  90. package/build/css/modal.css +0 -46
  91. package/build/index.cjs +0 -4
  92. package/build/index.mjs +0 -2
  93. package/build/js/org.qcobjects.cloud.auth.session.data.js +0 -125
  94. package/build/js/org.qcobjects.cloud.auth.session.usertoken.js +0 -109
  95. package/build/js/org.qcobjects.components.grid.js +0 -81
  96. package/build/js/org.qcobjects.components.js +0 -292
  97. package/build/js/org.qcobjects.components.list.js +0 -71
  98. package/build/js/org.qcobjects.components.notifications.js +0 -179
  99. package/build/js/org.qcobjects.components.slider.js +0 -193
  100. package/build/js/org.qcobjects.controllers.form.js +0 -178
  101. package/build/js/org.qcobjects.controllers.grid.js +0 -258
  102. package/build/js/org.qcobjects.controllers.list.js +0 -228
  103. package/build/js/org.qcobjects.controllers.slider.js +0 -131
  104. package/build/js/org.qcobjects.controllers.swagger.js +0 -50
  105. package/build/js/org.qcobjects.effects.js +0 -417
  106. package/build/js/org.qcobjects.i18n_messages.js +0 -72
  107. package/build/js/org.qcobjects.tools.canvas.js +0 -53
  108. package/build/js/org.qcobjects.tools.layouts.js +0 -73
  109. package/build/templates/components/modalyoulose.tpl.html +0 -3
  110. package/build/templates/components/modalyouwin.tpl.html +0 -4
  111. package/build/templates/components/splashscreen.tpl.html +0 -128
  112. package/build/templates/components/swagger-ui.tpl.html +0 -22
  113. package/docs/CNAME +0 -1
  114. package/public/QCObjects-SDK.js +0 -696
  115. package/public/QCObjects-SDK.js.map +0 -7
  116. package/public/css/base-modal.css +0 -2
  117. package/public/css/base-modal.css.map +0 -7
  118. package/public/css/basic-layout-embedded-nav.css +0 -2
  119. package/public/css/basic-layout-embedded-nav.css.map +0 -7
  120. package/public/css/basic-layout.css +0 -2
  121. package/public/css/basic-layout.css.map +0 -7
  122. package/public/css/components/horizontal-list.css +0 -2
  123. package/public/css/components/horizontal-list.css.map +0 -7
  124. package/public/css/components/list.css +0 -2
  125. package/public/css/components/list.css.map +0 -7
  126. package/public/css/components/splashscreen.css +0 -2
  127. package/public/css/components/splashscreen.css.map +0 -7
  128. package/public/css/modal.css +0 -2
  129. package/public/css/modal.css.map +0 -7
  130. package/public/index.cjs +0 -4
  131. package/public/index.js +0 -27
  132. package/public/index.mjs +0 -2
  133. package/public/templates/components/modalyoulose.tpl.html +0 -3
  134. package/public/templates/components/modalyouwin.tpl.html +0 -4
  135. package/public/templates/components/splashscreen.tpl.html +0 -128
  136. package/public/templates/components/swagger-ui.tpl.html +0 -22
  137. package/src/QCObjects-SDK.d.ts +0 -26
  138. package/src/QCObjects-SDK.ts +0 -108
  139. package/src/index.cts +0 -2
  140. package/src/index.d.ts +0 -2
  141. package/src/index.mts +0 -2
  142. package/src/js/org.qcobjects.cloud.auth.session.data.d.ts +0 -1
  143. package/src/js/org.qcobjects.cloud.auth.session.data.ts +0 -135
  144. package/src/js/org.qcobjects.cloud.auth.session.usertoken.d.ts +0 -2
  145. package/src/js/org.qcobjects.cloud.auth.session.usertoken.ts +0 -128
  146. package/src/js/org.qcobjects.components.d.ts +0 -10
  147. package/src/js/org.qcobjects.components.grid.d.ts +0 -3
  148. package/src/js/org.qcobjects.components.grid.ts +0 -95
  149. package/src/js/org.qcobjects.components.list.d.ts +0 -3
  150. package/src/js/org.qcobjects.components.notifications.d.ts +0 -1
  151. package/src/js/org.qcobjects.components.slider.d.ts +0 -1
  152. package/src/js/org.qcobjects.components.slider.ts +0 -205
  153. package/src/js/org.qcobjects.components.splashscreen.d.ts +0 -28
  154. package/src/js/org.qcobjects.components.ts +0 -336
  155. package/src/js/org.qcobjects.controllers.d.ts +0 -1
  156. package/src/js/org.qcobjects.controllers.form.d.ts +0 -1
  157. package/src/js/org.qcobjects.controllers.form.ts +0 -206
  158. package/src/js/org.qcobjects.controllers.grid.d.ts +0 -1
  159. package/src/js/org.qcobjects.controllers.grid.ts +0 -287
  160. package/src/js/org.qcobjects.controllers.list.d.ts +0 -1
  161. package/src/js/org.qcobjects.controllers.list.ts +0 -254
  162. package/src/js/org.qcobjects.controllers.slider.d.ts +0 -1
  163. package/src/js/org.qcobjects.controllers.slider.ts +0 -158
  164. package/src/js/org.qcobjects.controllers.swagger.d.ts +0 -1
  165. package/src/js/org.qcobjects.controllers.swagger.ts +0 -83
  166. package/src/js/org.qcobjects.effects.d.ts +0 -20
  167. package/src/js/org.qcobjects.i18n_messages.d.ts +0 -1
  168. package/src/js/org.qcobjects.i18n_messages.ts +0 -82
  169. package/src/js/org.qcobjects.modal.controllers.d.ts +0 -1
  170. package/src/js/org.qcobjects.modal.effects.d.ts +0 -1
  171. package/src/js/org.qcobjects.models.d.ts +0 -1
  172. package/src/js/org.qcobjects.tools.canvas.d.ts +0 -1
  173. package/src/js/org.qcobjects.tools.d.ts +0 -1
  174. package/src/js/org.qcobjects.tools.layouts.d.ts +0 -1
  175. package/src/js/org.qcobjects.tools.layouts.ts +0 -85
  176. package/src/js/org.qcobjects.views.d.ts +0 -1
  177. /package/spec/{testsSpec.js → testsSpec.ts} +0 -0
package/src/index.ts CHANGED
@@ -1,2 +1,127 @@
1
- import * as sdk from "./QCObjects-SDK";
2
- export default sdk;
1
+ /* eslint-disable @typescript-eslint/no-empty-function */
2
+ /**
3
+ * QCObjects SDK 2.5
4
+ * ________________
5
+ *
6
+ * Author: Jean Machuca <correojean@gmail.com>
7
+ *
8
+ * Cross Browser Javascript Framework for MVC Patterns
9
+ * QuickCorp/QCObjects is licensed under the
10
+ * GNU Lesser General Public License v3.0
11
+ * [LICENSE] (https://github.com/QuickCorp/QCObjects/blob/master/LICENSE.txt)
12
+ *
13
+ * Permissions of this copyleft license are conditioned on making available
14
+ * complete source code of licensed works and modifications under the same
15
+ * license or the GNU GPLv3. Copyright and license notices must be preserved.
16
+ * Contributors provide an express grant of patent rights. However, a larger
17
+ * work using the licensed work through interfaces provided by the licensed
18
+ * work may be distributed under different terms and without source code for
19
+ * the larger work.
20
+ *
21
+ * Copyright (C) 2015 Jean Machuca,<correojean@gmail.com>
22
+ *
23
+ * Everyone is permitted to copy and distribute verbatim copies of this
24
+ * license document, but changing it is not allowed.
25
+ */
26
+
27
+ import { CONFIG, GlobalSettings, _top } from "qcobjects";
28
+ export {i18n_messages} from "./ts/org.qcobjects.i18n_messages";
29
+ export {Contact} from "./ts/org.qcobjects.models";
30
+ export {
31
+ ShadowedComponent,
32
+ ButtonField,
33
+ InputField,
34
+ TextField,
35
+ EmailField,
36
+ ModalEnclosureComponent,
37
+ ModalComponent,
38
+ SwaggerUIComponent
39
+ } from "./ts/org.qcobjects.components";
40
+ export {FormField, FieldComponentParams} from "./ts/org.qcobjects.base.components";
41
+ export {
42
+ GridComponent,
43
+ GridItemComponent
44
+ } from "./ts/org.qcobjects.components.grid";
45
+ export {
46
+ ListItemComponent,
47
+ ListComponent
48
+ } from "./ts/org.qcobjects.components.list";
49
+ export {
50
+ SlideListComponent,
51
+ SlideItemComponent,
52
+ SliderComponent
53
+ } from "./ts/org.qcobjects.components.slider";
54
+ export { NotificationComponent } from "./ts/org.qcobjects.components.notifications";
55
+ export {
56
+ SplashScreenComponent,
57
+ VideoSplashScreenComponent,
58
+ CubeSplashScreenComponent
59
+ } from "./ts/org.qcobjects.components.splashscreen";
60
+ export { GenericController } from "./ts/org.qcobjects.controllers";
61
+ export { ListController, ListControllerParams } from "./ts/org.qcobjects.controllers.list";
62
+ export { GridController, DataGridController } from "./ts/org.qcobjects.controllers.grid";
63
+ export { SliderController } from "./ts/org.qcobjects.controllers.slider";
64
+ export { FormController, FormValidations } from "./ts/org.qcobjects.controllers.form";
65
+ export { SwaggerUIController } from "./ts/org.qcobjects.controllers.swagger";
66
+ export {
67
+ Fade, Move, MoveXInFromRight,
68
+ MoveXInFromLeft,
69
+ MoveYInFromBottom,
70
+ MoveYInFromTop,
71
+ RotateX,
72
+ RotateY,
73
+ RotateZ,
74
+ Rotate,
75
+ Radius,
76
+ Resize,
77
+ WipeLeft,
78
+ WipeRight,
79
+ WipeUp,
80
+ WipeDown,
81
+ ModalFade, ModalMoveUp, ModalMoveDown
82
+ } from "./ts/org.qcobjects.effects";
83
+ export { ModalController } from "./ts/org.qcobjects.modal.controllers";
84
+ export { GridView } from "./ts/org.qcobjects.views";
85
+ export { CanvasTool } from "./ts/org.qcobjects.tools.canvas";
86
+ export { BasicLayout } from "./ts/org.qcobjects.tools.layouts";
87
+ export { SessionUserToken } from "./ts/org.qcobjects.cloud.auth.session.usertoken";
88
+ export { SessionData } from "./ts/org.qcobjects.cloud.auth.session.data";
89
+
90
+ // eslint-disable-next-line camelcase
91
+ (function __qcobjects_sdk__(_top: any) {
92
+ "use strict";
93
+ if (typeof Object.defineProperty !== "undefined" && typeof _top !== "undefined") {
94
+ try {
95
+ Object.defineProperty(_top, "__qcobjects_sdk__", {
96
+ enumerable: true,
97
+ configurable: false,
98
+ writable: false,
99
+ // eslint-disable-next-line camelcase
100
+ value: __qcobjects_sdk__,
101
+ });
102
+ } catch (e) {
103
+ if (typeof _top.__qcobjects_sdk__ !== "undefined") {
104
+ _top.__qcobjects_sdk__.__loaded__ = true;
105
+ }
106
+ }
107
+ }
108
+
109
+ if (typeof _top.__qcobjects_sdk__.__loaded__ === "undefined") {
110
+ _top.__qcobjects_sdk__.__loaded__ = true;
111
+ if (typeof _top === "undefined") {
112
+ throw Error("Top context empty: It should either global, module or window");
113
+ }
114
+
115
+ const __start__ = GlobalSettings.__start__.bind(_top);
116
+
117
+
118
+ _top._sdk_ = Promise.resolve().then(() => {
119
+ CONFIG.set("useSDK", true);
120
+ __start__();
121
+ });
122
+
123
+ }
124
+
125
+ })(_top);
126
+
127
+ export default _top;
@@ -0,0 +1,83 @@
1
+ import {Package, Component, logger} from "qcobjects";
2
+ export type FieldComponentParams = {
3
+ name: string;
4
+ body: any;
5
+ data: any;
6
+ basePath?: string;
7
+ fieldType: string;
8
+ }
9
+ export class FormField extends Component {
10
+ fieldType!: string;
11
+ cached = false;
12
+ reload = true;
13
+ body: any;
14
+ name!: string;
15
+ data: any;
16
+ constructor(o: FieldComponentParams) {
17
+ o.name = (typeof o.name !== "undefined") ? (o.name) : ("form-field");
18
+ super(o);
19
+ }
20
+
21
+ createBindingEvents() {
22
+ let _objList;
23
+ if (typeof this.fieldType === "undefined" || this.fieldType == null) {
24
+ _objList = this.body.subelements("*[data-field]"); // every child with data-field set
25
+ } else {
26
+ _objList = this.body.subelements(this.fieldType + "[data-field]"); // every child with data-field set and tagname is equal to fieldType property
27
+ }
28
+ for (let _datak = 0; _datak < _objList.length; _datak++) {
29
+ const _obj = _objList[_datak];
30
+ _obj.addEventListener("change", () => {
31
+ logger.debug("Executing change event binding");
32
+ this.executeBindings();
33
+ });
34
+ _obj.addEventListener("blur", () => {
35
+ logger.debug("Executing change event binding");
36
+ this.executeBindings();
37
+ });
38
+ _obj.addEventListener("focus", () => {
39
+ logger.debug("Executing change event binding");
40
+ this.executeBindings();
41
+ });
42
+ _obj.addEventListener("keydown", () => {
43
+ logger.debug("Executing keydown event binding");
44
+ this.executeBindings();
45
+ });
46
+ }
47
+ }
48
+
49
+ executeBinding(_obj: HTMLElement & { value: any }) {
50
+ const _datamodel = _obj.getAttribute("data-field");
51
+ logger.debug("Binding " + _datamodel + " for " + this.name);
52
+ this.data[_datamodel as keyof typeof this.data] = _obj.value;
53
+ }
54
+
55
+ executeBindings() {
56
+ let _objList;
57
+ if (typeof this.fieldType === "undefined" || this.fieldType == null) {
58
+ _objList = this.body.subelements("*[data-field]"); // every child with data-field set
59
+ } else {
60
+ _objList = this.body.subelements(this.fieldType + "[data-field]"); // every child with data-field set and tagname is equal to fieldType property
61
+ }
62
+ for (let _datak = 0; _datak < _objList.length; _datak++) {
63
+ const _obj = _objList[_datak] as HTMLElement & { value: any };
64
+ const _datamodel = _obj.getAttribute("data-field");
65
+ logger.debug("Binding " + _datamodel + " for " + this.name);
66
+ this.data[_datamodel as keyof typeof this.data] = _obj.value;
67
+ }
68
+ }
69
+
70
+ done(standardResponse: any): Promise<any> {
71
+ const _ret_ = super.done(standardResponse);
72
+ this.executeBindings();
73
+ this.createBindingEvents();
74
+ logger.debug("Field loaded: " + this.fieldType + "[name=" + this.name + "]");
75
+ return _ret_ as Promise<any>;
76
+ }
77
+
78
+
79
+ }
80
+
81
+ Package("org.qcobjects.base.components", [
82
+ FormField
83
+ ]);
@@ -0,0 +1,134 @@
1
+ /**
2
+ * QCObjects SDK 2.5
3
+ * ________________
4
+ *
5
+ * Author: Jean Machuca <correojean@gmail.com>
6
+ *
7
+ * Cross Browser Javascript Framework for MVC Patterns
8
+ * QuickCorp/QCObjects is licensed under the
9
+ * GNU Lesser General Public License v3.0
10
+ * [LICENSE] (https://github.com/QuickCorp/QCObjects/blob/master/LICENSE.txt)
11
+ *
12
+ * Permissions of this copyleft license are conditioned on making available
13
+ * complete source code of licensed works and modifications under the same
14
+ * license or the GNU GPLv3. Copyright and license notices must be preserved.
15
+ * Contributors provide an express grant of patent rights. However, a larger
16
+ * work using the licensed work through interfaces provided by the licensed
17
+ * work may be distributed under different terms and without source code for
18
+ * the larger work.
19
+ *
20
+ * Copyright (C) 2015 Jean Machuca,<correojean@gmail.com>
21
+ *
22
+ * Everyone is permitted to copy and distribute verbatim copies of this
23
+ * license document, but changing it is not allowed.
24
+ */
25
+ "use strict";
26
+ import { Package, InheritClass, _DataStringify } from "qcobjects";
27
+ import { SessionUserToken } from "./org.qcobjects.cloud.auth.session.usertoken";
28
+
29
+ export class SessionData extends InheritClass {
30
+
31
+ __session_container__: any = null;
32
+ sessionData: any;
33
+
34
+ /**
35
+ * Sets the session container
36
+ *
37
+ * @param {*} sessionContainer1, sessionContainer2, ...
38
+ *
39
+ */
40
+ setSessionContainer() {
41
+ // eslint-disable-next-line prefer-rest-params
42
+ this.__session_container__ = [...arguments];
43
+ }
44
+
45
+ /**
46
+ * Gets the session container
47
+ *
48
+ * @return {*} sessionContainer
49
+ */
50
+ getSessionContainer() {
51
+ if (typeof this.__session_container__ === "undefined" || this.__session_container__ === null) {
52
+ throw new Error("You need to set a session container first: sessionData.setSessionContainer(...arguments)");
53
+ }
54
+ return this.__session_container__;
55
+ }
56
+
57
+ /**
58
+ * Gets the session data
59
+ *
60
+ * @return {*} sessionData
61
+ */
62
+ getSessionData(...args: any[]) {
63
+
64
+ const s = sessionStorage.getItem(`${this.index(args)}`);
65
+ let sessionData;
66
+ if (s !== null) {
67
+ sessionData = JSON.parse(s);
68
+ }
69
+ if (typeof sessionData === "undefined" || sessionData === null) {
70
+ sessionData = {};
71
+ }
72
+ return sessionData;
73
+ }
74
+
75
+ /**
76
+ * Returns an index of the session
77
+ *
78
+ * @param {string} valueForIndex
79
+ * @return {string} index
80
+ * @example sessionInstance.index("me@email.com", "myusername")
81
+ *
82
+ */
83
+ index(...args: any[]) {
84
+ if (typeof SessionUserToken === "undefined") {
85
+ throw new Error("You need to import SessionUserToken first: Import (\"org.qcobjects.cloud.auth.session.usertoken\")");
86
+ }
87
+ return `session_${btoa(SessionUserToken.getGlobalUserToken(args))}`;
88
+ }
89
+
90
+ /**
91
+ * Saves the session instance
92
+ *
93
+ */
94
+ save(...args: any[]) {
95
+ const s = _DataStringify(this.sessionData);
96
+ sessionStorage.setItem(`${this.index(args)}`, s);
97
+ }
98
+
99
+
100
+ /**
101
+ *
102
+ * Gets the session value
103
+ *
104
+ * @param {*} name
105
+ * @param {*} defaultValue
106
+ * @return {*}
107
+ */
108
+ get(name: string, defaultValue: any) {
109
+ const sessionData = this.getSessionData(this.getSessionContainer());
110
+ return (typeof sessionData[name] !== "undefined") ? (sessionData[name]) : (defaultValue);
111
+ }
112
+
113
+ /**
114
+ *
115
+ * Sets the session value
116
+ *
117
+ * @param {*} name
118
+ * @param {*} value
119
+ */
120
+ set(name: string, value: any) {
121
+ const sessionContainer = this.getSessionContainer();
122
+ const sessionData = this.getSessionData(sessionContainer);
123
+ this.sessionData = sessionData;
124
+ this.sessionData[name] = value;
125
+ this.save(sessionContainer);
126
+ }
127
+
128
+ }
129
+
130
+ Package("org.qcobjects.cloud.auth.session.data", [
131
+ SessionData
132
+
133
+ ]);
134
+
@@ -0,0 +1,108 @@
1
+ /**
2
+ * QCObjects SDK 2.5
3
+ * ________________
4
+ *
5
+ * Author: Jean Machuca <correojean@gmail.com>
6
+ *
7
+ * Cross Browser Javascript Framework for MVC Patterns
8
+ * QuickCorp/QCObjects is licensed under the
9
+ * GNU Lesser General Public License v3.0
10
+ * [LICENSE] (https://github.com/QuickCorp/QCObjects/blob/master/LICENSE.txt)
11
+ *
12
+ * Permissions of this copyleft license are conditioned on making available
13
+ * complete source code of licensed works and modifications under the same
14
+ * license or the GNU GPLv3. Copyright and license notices must be preserved.
15
+ * Contributors provide an express grant of patent rights. However, a larger
16
+ * work using the licensed work through interfaces provided by the licensed
17
+ * work may be distributed under different terms and without source code for
18
+ * the larger work.
19
+ *
20
+ * Copyright (C) 2015 Jean Machuca,<correojean@gmail.com>
21
+ *
22
+ * Everyone is permitted to copy and distribute verbatim copies of this
23
+ * license document, but changing it is not allowed.
24
+ */
25
+ "use strict";
26
+ import { CONFIG, ComplexStorageCache, InheritClass, New, Package, _Crypt, global } from "qcobjects";
27
+
28
+
29
+ type TGlobalUser = { username: string, token: string, id: string, priority: number };
30
+
31
+ export class SessionUserToken extends InheritClass {
32
+ static user = {};
33
+ __cache__: ComplexStorageCache;
34
+ __instanceID: any;
35
+
36
+ constructor(o: any) {
37
+ super(o);
38
+
39
+ const __instance__ = this;
40
+ this.__cache__ = new ComplexStorageCache({
41
+ index: __instance__.__instanceID.toString(),
42
+ load() {
43
+ let __token__;
44
+ if (typeof navigator !== "undefined" && typeof origin !== "undefined") {
45
+ __token__ = _Crypt.encrypt(`${navigator.userAgent}|${o.username}|${(+(new Date())).toString()}`, origin);
46
+ } else {
47
+ __token__ = _Crypt.encrypt(`${o.username}|${(+(new Date())).toString()}`, CONFIG.get("domain", "localhost"));
48
+ }
49
+ SessionUserToken.user = {
50
+ priority: __instance__.__instanceID.toString(),
51
+ token: __token__
52
+ };
53
+ return SessionUserToken.user;
54
+ },
55
+ alternate(cacheController: any) {
56
+ SessionUserToken.user = cacheController?.cache.getCached(__instance__.__instanceID.toString()); // setting dataObject with the cached value
57
+ }
58
+ });
59
+
60
+ }
61
+
62
+ static generateIndex(s: any) {
63
+ return (typeof Buffer !== "undefined") ? (Buffer.from(s, "ascii").toString("base64")) : (btoa(s));
64
+ }
65
+
66
+ static getGlobalUser(...args: any[]): TGlobalUser {
67
+ const username = [args].join("|");
68
+ const __index__ = "userToken_" + SessionUserToken.generateIndex(username);
69
+ if (typeof (global as any).get(__index__) === "undefined" || (global as any).get(__index__) === null) {
70
+ (global as any).set(__index__, New(SessionUserToken, {
71
+ username
72
+ }));
73
+ }
74
+ SessionUserToken.user = (global as any).get(__index__).user;
75
+ return global.get(__index__).user as TGlobalUser;
76
+ }
77
+
78
+ static getGlobalUserToken(...args: any[]): string {
79
+ return SessionUserToken.getGlobalUser(args).token;
80
+ }
81
+
82
+ static getGlobalUserId(...args: any[]) {
83
+ return SessionUserToken.getGlobalUser(args).id;
84
+ }
85
+
86
+ static getGlobalUserPriority(...args: any[]) {
87
+ return SessionUserToken.getGlobalUser(args).priority;
88
+ }
89
+
90
+ static getLoginCredentialsToken(username: string, password: string): string {
91
+ return _Crypt.encrypt(`${username}${password}`, SessionUserToken.getGlobalUserToken(username)) as string;
92
+ }
93
+
94
+ static closeGlobalSession(...args: any[]) {
95
+ SessionUserToken.getGlobalUser(args);
96
+ const username = [args].join("|");
97
+ const __index__ = "userToken_" + SessionUserToken.generateIndex(username);
98
+ if (typeof (global as any).get(__index__) !== "undefined") {
99
+ (global as any).get(__index__).__cache__.clear();
100
+ (global as any).set(__index__, null);
101
+ SessionUserToken.user = {};
102
+ }
103
+ }
104
+ }
105
+
106
+ Package("org.qcobjects.cloud.auth.session.usertoken", [
107
+ SessionUserToken
108
+ ]);
@@ -0,0 +1,68 @@
1
+ /**
2
+ * QCObjects SDK 2.5
3
+ * ________________
4
+ *
5
+ * Author: Jean Machuca <correojean@gmail.com>
6
+ *
7
+ * Cross Browser Javascript Framework for MVC Patterns
8
+ * QuickCorp/QCObjects is licensed under the
9
+ * GNU Lesser General Public License v3.0
10
+ * [LICENSE] (https://github.com/QuickCorp/QCObjects/blob/master/LICENSE.txt)
11
+ *
12
+ * Permissions of this copyleft license are conditioned on making available
13
+ * complete source code of licensed works and modifications under the same
14
+ * license or the GNU GPLv3. Copyright and license notices must be preserved.
15
+ * Contributors provide an express grant of patent rights. However, a larger
16
+ * work using the licensed work through interfaces provided by the licensed
17
+ * work may be distributed under different terms and without source code for
18
+ * the larger work.
19
+ *
20
+ * Copyright (C) 2015 Jean Machuca,<correojean@gmail.com>
21
+ *
22
+ * Everyone is permitted to copy and distribute verbatim copies of this
23
+ * license document, but changing it is not allowed.
24
+ */
25
+ "use strict";
26
+ import { Package, Component } from "qcobjects";
27
+
28
+ export class GridItemComponent extends Component {
29
+ name = "grid-item";
30
+ shadowed = true;
31
+ tplsource = "inline";
32
+ template = `
33
+ <img src="{{image}}" />
34
+ <p>{{description}}</p>
35
+ `;
36
+
37
+ cached = false;
38
+
39
+ }
40
+
41
+ export class GridComponent extends Component {
42
+ name = "grid";
43
+ cached = false;
44
+ view = null;
45
+ shadowed = true;
46
+ rows = 3;
47
+ cols = 3;
48
+ templateURI = "";
49
+ data = {};
50
+ tplsource = "inline";
51
+ template = "<p>Loading...</p>";
52
+ body: any;
53
+
54
+ constructor(o: any) {
55
+ super(o);
56
+ this.body.setAttribute("controllerClass", "DataGridController");
57
+ const subcomponentClass = (this.body.getAttribute("subcomponentClass") !== null) ? (this.body.getAttribute("subcomponentClass")) : ("GridItemComponent");
58
+ this.body.setAttribute("subcomponentClass", subcomponentClass as string);
59
+
60
+ }
61
+
62
+
63
+ }
64
+
65
+ Package("org.qcobjects.components.grid", [
66
+ GridComponent,
67
+ GridItemComponent
68
+ ]);
@@ -1,7 +1,5 @@
1
- import { Component, ComponentParams, Package } from "qcobjects";
2
-
3
1
  /**
4
- * QCObjects SDK 2.4
2
+ * QCObjects SDK 2.5
5
3
  * ________________
6
4
  *
7
5
  * Author: Jean Machuca <correojean@gmail.com>
@@ -24,40 +22,36 @@ import { Component, ComponentParams, Package } from "qcobjects";
24
22
  * Everyone is permitted to copy and distribute verbatim copies of this
25
23
  * license document, but changing it is not allowed.
26
24
  */
27
- const _top = (typeof module === "object" && typeof module.exports === "object") ? (
28
- module.exports = (typeof globalThis !== "undefined"
29
- ? globalThis
30
- : typeof self !== "undefined"
31
- ? self
32
- : typeof window !== "undefined"
33
- ? window
34
- : typeof global !== "undefined"
35
- ? global
36
- : {})
37
- ) : ((typeof global === "object") ? (global) : (
38
- (typeof window === "object") ? (window) : ({})
39
- ));
40
- (function(global:any) {
41
25
  "use strict";
42
- class ListItemComponent extends Component {
26
+ import { Component, Package } from "qcobjects";
27
+
28
+
29
+ export class ListItemComponent extends Component {
43
30
  shadowed= false;
44
31
  tplsource= "inline";
45
32
  template="<a href=\"{{value}}\">{{label}}</a>";
46
33
  cached= false;
47
34
 
48
- constructor (o:ComponentParams){
35
+ constructor (o:any){
49
36
  o.name="list-item";
50
37
  super(o);
51
38
  }
52
39
 
53
40
  }
54
41
 
55
- class ListComponent extends Component {
42
+ export class ListComponent extends Component {
43
+ data!:any;
56
44
  shadowed= true;
57
45
  tplsource= "inline";
58
46
  template= "<p>Loading...</p>";
47
+ body: any;
48
+ shadowRoot: HTMLElement | undefined;
49
+ rows!: string | number | null;
50
+ subcomponents!: never[];
51
+ done: any;
52
+ serviceData: any;
59
53
 
60
- constructor (o:ComponentParams){
54
+ constructor (o:any){
61
55
  o.name = "list";
62
56
  super(o);
63
57
  this.body.setAttribute("controllerClass","ListController");
@@ -71,13 +65,3 @@ Package("org.qcobjects.components.list",[
71
65
  ListItemComponent,
72
66
  ListComponent
73
67
  ]);
74
-
75
- global.ListComponent = ListComponent;
76
- global.ListItemComponent = ListItemComponent;
77
-
78
- })(_top);
79
-
80
- const ListComponent = (_top as any).ListComponent;
81
- const ListItemComponent = (_top as any).ListItemComponent;
82
-
83
- export {ListComponent, ListItemComponent};
@@ -1,8 +1,5 @@
1
- import { Package, Component, _DOMCreateElement, New, _super_, ComponentParams, QCObjectsElement } from "qcobjects";
2
- import { Fade, Move } from "./org.qcobjects.effects";
3
-
4
1
  /**
5
- * QCObjects SDK 2.4
2
+ * QCObjects SDK 2.5
6
3
  * ________________
7
4
  *
8
5
  * Author: Jean Machuca <correojean@gmail.com>
@@ -25,17 +22,21 @@ import { Fade, Move } from "./org.qcobjects.effects";
25
22
  * Everyone is permitted to copy and distribute verbatim copies of this
26
23
  * license document, but changing it is not allowed.
27
24
  */
28
- (function() {
29
25
  "use strict";
30
- class NotificationComponent extends Component {
26
+ import { Package, Component, _DOMCreateElement, New, _super_ } from "qcobjects";
27
+ import { Fade, Move } from "./org.qcobjects.effects";
28
+
29
+
30
+ export class NotificationComponent extends Component {
31
31
  cached= false;
32
32
  tplsource= "inline";
33
33
  shadowed= false;
34
34
  kinds:string[];
35
+ template: string;
35
36
 
36
- constructor (o:ComponentParams){
37
+ constructor (o:any){
37
38
  o.name= "notification";
38
- o.body = _DOMCreateElement("div") as QCObjectsElement;
39
+ o.body = _DOMCreateElement("div") as HTMLElement;
39
40
  super(o);
40
41
 
41
42
  this.template= `
@@ -110,8 +111,9 @@ class NotificationComponent extends Component {
110
111
  disappearEffect.apply(element);
111
112
  },2000);
112
113
  };
113
- (element as QCObjectsElement).subelements("div.notification_background").map(element=>New(Fade,{duration:500}).apply(element,0,1));
114
- (element as QCObjectsElement).subelements("div.notification").map(element=>_display_(element));
114
+
115
+ (element as any).subelements("div.notification_background").map((element:HTMLElement):any=> {return (new Fade ({duration:500})).apply(element,0,1);} );
116
+ (element as any).subelements("div.notification").map((element:any)=>_display_(element));
115
117
  setTimeout(function (){
116
118
  element.remove();
117
119
  },2200);
@@ -187,5 +189,3 @@ class NotificationComponent extends Component {
187
189
  Package("org.quickcorp.components.notifications", [
188
190
  NotificationComponent
189
191
  ]);
190
-
191
- })();