qcobjects 2.5.120-beta → 2.5.122-beta
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/VERSION +1 -1
- package/build/Component.js +1 -1
- package/build/InheritClass.js +14 -0
- package/build/QCObjects.js +18 -7
- package/build/WidgetsFactory.js +5 -0
- package/build/index.cjs +4 -24
- package/build/index.js +17 -7
- package/build/index.mjs +1 -1
- package/build-esbuild.js +2 -1
- package/package.json +4 -5
- package/public/browser/QCObjects.js +18 -1
- package/public/browser/QCObjects.js.map +2 -2
- package/public/cjs/QCObjects.cjs +18 -1
- package/public/cjs/QCObjects.cjs.map +2 -2
- package/public/esm/QCObjects.mjs +18 -1
- package/public/esm/QCObjects.mjs.map +2 -2
- package/public/types/index.d.ts +30 -28
- package/src/ArrayCollection.ts +1 -1
- package/src/CONFIG.ts +1 -1
- package/src/Class.ts +1 -1
- package/src/ClassFactory.ts +1 -1
- package/src/Component.ts +67 -67
- package/src/ComponentFactory.ts +1 -1
- package/src/Controller.ts +1 -1
- package/src/Crypt.ts +1 -1
- package/src/DDO.ts +1 -1
- package/src/DOMCreateElement.ts +1 -1
- package/src/DefaultTemplateHandler.ts +1 -1
- package/src/Effect.ts +1 -1
- package/src/InheritClass.ts +18 -4
- package/src/MainProcess.ts +1 -1
- package/src/PrimaryCollections.ts +1 -1
- package/src/Processor.ts +1 -1
- package/src/QCObjects.ts +2 -2
- package/src/Service.ts +1 -1
- package/src/SourceCSS.ts +1 -1
- package/src/SourceJS.ts +1 -1
- package/src/Tag.ts +1 -1
- package/src/Timer.ts +1 -1
- package/src/TransitionEffect.ts +2 -1
- package/src/WidgetsFactory.ts +5 -1
- package/src/asyncLoad.ts +1 -1
- package/src/componentLoader.ts +1 -1
- package/src/defaultProcessors.ts +1 -1
- package/src/globalSettings.ts +1 -1
- package/src/index.cts +2 -0
- package/src/index.mts +2 -0
- package/src/routings.ts +1 -1
- package/src/serviceLoader.ts +1 -1
- package/src/top.ts +1 -1
- package/src/types/global/index.d.ts +2 -1
- package/tsconfig.d.json +4 -8
- package/tsconfig.json +2 -2
package/src/Component.ts
CHANGED
|
@@ -22,7 +22,7 @@ import { CONFIG } from "./CONFIG";
|
|
|
22
22
|
import { serviceLoader } from "./serviceLoader";
|
|
23
23
|
import { _tag_filter_ } from "./tag_filter";
|
|
24
24
|
import { componentLoader } from "./componentLoader";
|
|
25
|
-
import { IComponent, IController, IEffect, IProcessor, IQCObjectsElement, IQCObjectsShadowedElement, IView, TBody, TComponentDoneResponse, TComponentParams, TComponentRouting, TComponentRoutings } from "types";
|
|
25
|
+
import { IComponent, IController, IEffect, IProcessor, IQCObjectsElement, IQCObjectsShadowedElement, IView, TBody, TComponentDoneResponse, TComponentParams, TComponentRouting, TComponentRoutings } from "./types/global";
|
|
26
26
|
|
|
27
27
|
export class Component extends InheritClass implements IComponent {
|
|
28
28
|
static shadowed: boolean | undefined = false;
|
|
@@ -30,7 +30,7 @@ export class Component extends InheritClass implements IComponent {
|
|
|
30
30
|
[key: string]: any;
|
|
31
31
|
name!: string;
|
|
32
32
|
templateURI!: string;
|
|
33
|
-
url!:string;
|
|
33
|
+
url!: string;
|
|
34
34
|
tplsource!: string;
|
|
35
35
|
tplextension!: string;
|
|
36
36
|
template!: string;
|
|
@@ -126,7 +126,7 @@ export class Component extends InheritClass implements IComponent {
|
|
|
126
126
|
});
|
|
127
127
|
const self = this;
|
|
128
128
|
|
|
129
|
-
if (typeof name !== "undefined"){
|
|
129
|
+
if (typeof name !== "undefined") {
|
|
130
130
|
self.name = name;
|
|
131
131
|
}
|
|
132
132
|
|
|
@@ -159,7 +159,7 @@ export class Component extends InheritClass implements IComponent {
|
|
|
159
159
|
logger.info(`Component._new_ The component ${self.name} was built successfully!`);
|
|
160
160
|
}).catch(function (standardResponse) {
|
|
161
161
|
logger.warn(`Component._new_ Something went wrong building the component ${self.name}`);
|
|
162
|
-
console.error(standardResponse);
|
|
162
|
+
console.error(`Component._new_ Something went wrong building the component ${self.name}`, standardResponse);
|
|
163
163
|
});
|
|
164
164
|
}).catch((e: any) => {
|
|
165
165
|
throw Error(`Unexpected error ${e}`);
|
|
@@ -254,8 +254,8 @@ export class Component extends InheritClass implements IComponent {
|
|
|
254
254
|
return _serviceClassName;
|
|
255
255
|
}
|
|
256
256
|
|
|
257
|
-
protected get responseToData
|
|
258
|
-
let _response_to_data_:boolean = false;
|
|
257
|
+
protected get responseToData(): boolean {
|
|
258
|
+
let _response_to_data_: boolean = false;
|
|
259
259
|
if (isBrowser) {
|
|
260
260
|
const responseToAttr = (this.body as HTMLElement).getAttribute("response-to");
|
|
261
261
|
_response_to_data_ = responseToAttr === "data" || this.responseTo === "data";
|
|
@@ -265,8 +265,8 @@ export class Component extends InheritClass implements IComponent {
|
|
|
265
265
|
return _response_to_data_;
|
|
266
266
|
}
|
|
267
267
|
|
|
268
|
-
protected get responseToTemplate
|
|
269
|
-
let _response_to_template_:boolean = false;
|
|
268
|
+
protected get responseToTemplate(): boolean {
|
|
269
|
+
let _response_to_template_: boolean = false;
|
|
270
270
|
if (isBrowser) {
|
|
271
271
|
const responseToAttr = (this.body as HTMLElement).getAttribute("response-to");
|
|
272
272
|
_response_to_template_ = responseToAttr === "template" || this.responseTo === "template";
|
|
@@ -274,7 +274,7 @@ export class Component extends InheritClass implements IComponent {
|
|
|
274
274
|
_response_to_template_ = this.responseTo === "template";
|
|
275
275
|
}
|
|
276
276
|
return _response_to_template_;
|
|
277
|
-
}
|
|
277
|
+
}
|
|
278
278
|
|
|
279
279
|
createServiceInstance(): Promise<JSON | string | null> {
|
|
280
280
|
const component = this;
|
|
@@ -502,9 +502,9 @@ export class Component extends InheritClass implements IComponent {
|
|
|
502
502
|
await _component_.createControllerInstance();
|
|
503
503
|
await _component_.createEffectInstance();
|
|
504
504
|
})()
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
505
|
+
.catch((e: any) => {
|
|
506
|
+
throw new Error(`Unknown error ${e}.`);
|
|
507
|
+
});
|
|
508
508
|
|
|
509
509
|
logger.debug(`Trying to run component helpers for ${_component_.name}...`);
|
|
510
510
|
try {
|
|
@@ -526,8 +526,8 @@ export class Component extends InheritClass implements IComponent {
|
|
|
526
526
|
return new Promise(function (resolve, reject) {
|
|
527
527
|
try {
|
|
528
528
|
resolve(componentDone.call(_component_));
|
|
529
|
-
} catch (e:any) {
|
|
530
|
-
reject(new Error
|
|
529
|
+
} catch (e: any) {
|
|
530
|
+
reject(new Error(e));
|
|
531
531
|
}
|
|
532
532
|
});
|
|
533
533
|
|
|
@@ -565,7 +565,7 @@ export class Component extends InheritClass implements IComponent {
|
|
|
565
565
|
return (isBrowser) ? ([{}].concat([...(c as HTMLElement).getAttributeNames()].filter(n => n.startsWith("data-")).map(a => { return { [a.split("-")[1]]: (c as HTMLElement).getAttribute(a) }; })).reduce((accumulator, colData) => { return Object.assign(accumulator, colData); })) : ({});
|
|
566
566
|
}
|
|
567
567
|
|
|
568
|
-
__buildSubComponents__(rebuildObjects = false):any {
|
|
568
|
+
__buildSubComponents__(rebuildObjects = false): any {
|
|
569
569
|
const _component_: Component = this as Component;
|
|
570
570
|
let elementList = _component_.subtags;
|
|
571
571
|
if (!rebuildObjects) {
|
|
@@ -583,7 +583,7 @@ export class Component extends InheritClass implements IComponent {
|
|
|
583
583
|
const { error, component } = standardResponse;
|
|
584
584
|
resolve({ error, component });
|
|
585
585
|
} else {
|
|
586
|
-
reject(
|
|
586
|
+
reject(new Error(" Unknown error."));
|
|
587
587
|
}
|
|
588
588
|
});
|
|
589
589
|
return _ret_;
|
|
@@ -593,14 +593,14 @@ export class Component extends InheritClass implements IComponent {
|
|
|
593
593
|
this[key] = value;
|
|
594
594
|
}
|
|
595
595
|
|
|
596
|
-
get(key: string, _defaultValue?: string):any {
|
|
596
|
+
get(key: string, _defaultValue?: string): any {
|
|
597
597
|
return this[key] || _defaultValue;
|
|
598
598
|
}
|
|
599
599
|
|
|
600
600
|
feedComponent(): Promise<any> {
|
|
601
601
|
const _component_ = this;
|
|
602
602
|
logger.debug(`[Component][${this.name}][feedComponent] start feeding component...`);
|
|
603
|
-
const _feedComponent_InBrowser = function (_component_: Component):any {
|
|
603
|
+
const _feedComponent_InBrowser = function (_component_: Component): any {
|
|
604
604
|
if (typeof _component_.container === "undefined" && typeof _component_.body === "undefined") {
|
|
605
605
|
logger.warn("COMPONENT {{NAME}} has an undefined container and body".replace("{{NAME}}", _component_.name));
|
|
606
606
|
return;
|
|
@@ -613,7 +613,7 @@ export class Component extends InheritClass implements IComponent {
|
|
|
613
613
|
logger.debug("Preparing slots for Shadowed COMPONENT {{NAME}}".replace("{{NAME}}", _component_.name));
|
|
614
614
|
const tmp_shadowContainer = _DOMCreateElement("div");
|
|
615
615
|
container.subelements("[slot]").map(
|
|
616
|
-
|
|
616
|
+
(c: { parentElement: any; }): any => {
|
|
617
617
|
if (c.parentElement === container) {
|
|
618
618
|
tmp_shadowContainer.appendChild(c as any);
|
|
619
619
|
}
|
|
@@ -626,12 +626,12 @@ export class Component extends InheritClass implements IComponent {
|
|
|
626
626
|
_component_.shadowRoot = shadowContainer.attachShadow({
|
|
627
627
|
mode: "open"
|
|
628
628
|
}) as IQCObjectsShadowedElement;
|
|
629
|
-
} catch (e:any) {
|
|
629
|
+
} catch (e: any) {
|
|
630
630
|
logger.debug(`An error ocurred: ${e}.`);
|
|
631
631
|
try {
|
|
632
632
|
logger.debug("Shadowed COMPONENT {{NAME}} is repeated".replace("{{NAME}}", _component_.name));
|
|
633
633
|
_component_.shadowRoot = shadowContainer.shadowRoot as IQCObjectsShadowedElement;
|
|
634
|
-
} catch (e:any) {
|
|
634
|
+
} catch (e: any) {
|
|
635
635
|
logger.debug(`An error ocurred: ${e}.`);
|
|
636
636
|
logger.warn("Shadowed COMPONENT {{NAME}} is not allowed on this browser".replace("{{NAME}}", _component_.name));
|
|
637
637
|
}
|
|
@@ -678,7 +678,7 @@ export class Component extends InheritClass implements IComponent {
|
|
|
678
678
|
|
|
679
679
|
};
|
|
680
680
|
|
|
681
|
-
const _feedComponent_InNode = function (_component_: Component):any {
|
|
681
|
+
const _feedComponent_InNode = function (_component_: Component): any {
|
|
682
682
|
const parsedAssignmentText = _component_.parsedAssignmentText;
|
|
683
683
|
_component_.innerHTML = parsedAssignmentText;
|
|
684
684
|
};
|
|
@@ -686,22 +686,22 @@ export class Component extends InheritClass implements IComponent {
|
|
|
686
686
|
let _ret_;
|
|
687
687
|
if (!is_a(_component_, "Component")) {
|
|
688
688
|
logger.warn("Trying to feed a non component object");
|
|
689
|
-
return Promise.reject(new Error
|
|
689
|
+
return Promise.reject(new Error(`Trying to feed a non component object ${typeof _component_}`));
|
|
690
690
|
}
|
|
691
|
-
return new Promise
|
|
691
|
+
return new Promise<any>((resolve, reject) => {
|
|
692
692
|
if (isBrowser) {
|
|
693
693
|
try {
|
|
694
694
|
_ret_ = _feedComponent_InBrowser(_component_);
|
|
695
695
|
resolve(_ret_);
|
|
696
|
-
} catch (e:any) {
|
|
697
|
-
reject
|
|
696
|
+
} catch (e: any) {
|
|
697
|
+
reject(new Error(e));
|
|
698
698
|
}
|
|
699
699
|
} else {
|
|
700
700
|
try {
|
|
701
701
|
_ret_ = _feedComponent_InNode(_component_);
|
|
702
702
|
resolve(_ret_);
|
|
703
|
-
} catch (e:any){
|
|
704
|
-
reject
|
|
703
|
+
} catch (e: any) {
|
|
704
|
+
reject(new Error(e));
|
|
705
705
|
}
|
|
706
706
|
|
|
707
707
|
}
|
|
@@ -713,7 +713,7 @@ export class Component extends InheritClass implements IComponent {
|
|
|
713
713
|
const _component = this as Component;
|
|
714
714
|
var _promise = new Promise<{ request?: XMLHttpRequest, component: Component }>(function (resolve, reject) {
|
|
715
715
|
if (typeof _component === "undefined" || _component === null) {
|
|
716
|
-
reject(new Error
|
|
716
|
+
reject(new Error("Component is undefined"));
|
|
717
717
|
}
|
|
718
718
|
if (isQCObjects_Object(_component) && is_a(_component, "Component")) {
|
|
719
719
|
switch (true) {
|
|
@@ -726,9 +726,9 @@ export class Component extends InheritClass implements IComponent {
|
|
|
726
726
|
_component.__done__().then(function () {
|
|
727
727
|
if (typeof _component.done === "function") {
|
|
728
728
|
_component.done.call(_component, standardResponse)
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
729
|
+
.catch((e: any) => {
|
|
730
|
+
logger.debug(`It was an error while calling done() in ${_component.name}: ${e}`);
|
|
731
|
+
});
|
|
732
732
|
}
|
|
733
733
|
resolve.call(_promise, standardResponse);
|
|
734
734
|
}, function () {
|
|
@@ -740,10 +740,10 @@ export class Component extends InheritClass implements IComponent {
|
|
|
740
740
|
(async (_component) => {
|
|
741
741
|
await _component.feedComponent.bind(_component)();
|
|
742
742
|
})(_component)
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
743
|
+
.catch((e: any) => {
|
|
744
|
+
logger.debug(`It was not possible to feed the component ${_component.name}: ${e}`);
|
|
745
|
+
});
|
|
746
|
+
var standardResponse = {
|
|
747
747
|
request: undefined,
|
|
748
748
|
component: _component
|
|
749
749
|
};
|
|
@@ -796,9 +796,9 @@ export class Component extends InheritClass implements IComponent {
|
|
|
796
796
|
return _promise;
|
|
797
797
|
}
|
|
798
798
|
|
|
799
|
-
Cast(oClass: any):any {
|
|
799
|
+
Cast(oClass: any): any {
|
|
800
800
|
/* Cast method for components has been deprecated. Don't use this method, it is available only for compatibility purposes */
|
|
801
|
-
const o = _methods_(oClass).map((m):any => (m as Function).name.replace(/bound /g, "")).map(m => {
|
|
801
|
+
const o = _methods_(oClass).map((m): any => (m as Function).name.replace(/bound /g, "")).map(m => {
|
|
802
802
|
return {
|
|
803
803
|
[m]: oClass[m].bind(this)
|
|
804
804
|
};
|
|
@@ -806,7 +806,7 @@ export class Component extends InheritClass implements IComponent {
|
|
|
806
806
|
return _Cast(this, o);
|
|
807
807
|
}
|
|
808
808
|
|
|
809
|
-
route
|
|
809
|
+
route() {
|
|
810
810
|
return (this.constructor as typeof Component).route();
|
|
811
811
|
}
|
|
812
812
|
|
|
@@ -830,12 +830,12 @@ export class Component extends InheritClass implements IComponent {
|
|
|
830
830
|
.then(function () {
|
|
831
831
|
rc.reload = true;
|
|
832
832
|
rc.rebuild()
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
833
|
+
.then(() => {
|
|
834
|
+
resolve();
|
|
835
|
+
})
|
|
836
|
+
.catch((e: any) => {
|
|
837
|
+
logger.debug(`Error ${e}`);
|
|
838
|
+
});
|
|
839
839
|
return;
|
|
840
840
|
})
|
|
841
841
|
.then(function () {
|
|
@@ -852,11 +852,11 @@ export class Component extends InheritClass implements IComponent {
|
|
|
852
852
|
}
|
|
853
853
|
resolve();
|
|
854
854
|
}
|
|
855
|
-
}).catch
|
|
855
|
+
}).catch((e: any) => {
|
|
856
856
|
logger.debug(`Error: ${e}`);
|
|
857
857
|
});
|
|
858
858
|
} else if (typeof rc !== "undefined") {
|
|
859
|
-
reject(new Error
|
|
859
|
+
reject(new Error("Component " + rc.name + " is not an instance of Component"));
|
|
860
860
|
}
|
|
861
861
|
return;
|
|
862
862
|
});
|
|
@@ -882,12 +882,12 @@ export class Component extends InheritClass implements IComponent {
|
|
|
882
882
|
|
|
883
883
|
fullscreen() {
|
|
884
884
|
if (isBrowser) {
|
|
885
|
-
const elem:HTMLElement = this.body as HTMLElement;
|
|
885
|
+
const elem: HTMLElement = this.body as HTMLElement;
|
|
886
886
|
if (elem.requestFullscreen) {
|
|
887
887
|
elem.requestFullscreen()
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
888
|
+
.catch((e: any) => {
|
|
889
|
+
throw new Error(`An error ocurred when requesting fullscreen: ${e}`);
|
|
890
|
+
});
|
|
891
891
|
} else if ((elem as any).mozRequestFullScreen) {
|
|
892
892
|
/* Firefox */
|
|
893
893
|
(elem as any).mozRequestFullScreen();
|
|
@@ -907,7 +907,7 @@ export class Component extends InheritClass implements IComponent {
|
|
|
907
907
|
if (isBrowser) {
|
|
908
908
|
if (document.exitFullscreen) {
|
|
909
909
|
document.exitFullscreen()
|
|
910
|
-
|
|
910
|
+
.catch((e: any) => { throw new Error(`An error ocurred when trying to exit fullscrenn ${e}.`); });
|
|
911
911
|
} else if ((document as any).mozCancelFullScreen) {
|
|
912
912
|
(document as any).mozCancelFullScreen();
|
|
913
913
|
} else if ((document as any).webkitExitFullscreen) {
|
|
@@ -929,10 +929,10 @@ export class Component extends InheritClass implements IComponent {
|
|
|
929
929
|
component.innerHTML = (componentBody as HTMLElement)?.innerHTML;
|
|
930
930
|
component.routingNodes = (componentBody as IQCObjectsElement)?.subelements("routing");
|
|
931
931
|
component.routings = [];
|
|
932
|
-
component.routingNodes.map(
|
|
932
|
+
component.routingNodes.map((routingNode): any => {
|
|
933
933
|
const attributeNames = (routingNode as HTMLElement).getAttributeNames();
|
|
934
934
|
const routing = {} as TComponentRouting;
|
|
935
|
-
attributeNames.map(
|
|
935
|
+
attributeNames.map((attributeName: any, a: string | number): any => {
|
|
936
936
|
(routing as any)[attributeNames[a as any]] = (routingNode as HTMLElement).getAttribute(attributeNames[a as any]);
|
|
937
937
|
return attributeName;
|
|
938
938
|
});
|
|
@@ -961,9 +961,9 @@ export class Component extends InheritClass implements IComponent {
|
|
|
961
961
|
});
|
|
962
962
|
}
|
|
963
963
|
|
|
964
|
-
parseTemplate(template: any):string {
|
|
964
|
+
parseTemplate(template: any): string {
|
|
965
965
|
const _self = this;
|
|
966
|
-
let _parsedAssignmentText:string;
|
|
966
|
+
let _parsedAssignmentText: string;
|
|
967
967
|
const value = template;
|
|
968
968
|
if (Object.hasOwn(_self, "templateHandler")) {
|
|
969
969
|
const templateHandlerName = _self.templateHandler;
|
|
@@ -978,7 +978,7 @@ export class Component extends InheritClass implements IComponent {
|
|
|
978
978
|
if (Object.hasOwn(_self, "assignRoutingParams") && _self.assignRoutingParams) {
|
|
979
979
|
try {
|
|
980
980
|
selfData = Object.assign(selfData, _self.routingParams);
|
|
981
|
-
} catch (e:any) {
|
|
981
|
+
} catch (e: any) {
|
|
982
982
|
logger.debug(`An error ocurred: ${e}.`);
|
|
983
983
|
logger.debug("[parseTemplate] it was not possible to assign the routing params to the template");
|
|
984
984
|
}
|
|
@@ -998,7 +998,7 @@ export class Component extends InheritClass implements IComponent {
|
|
|
998
998
|
if (isBrowser) {
|
|
999
999
|
if (__valid_routing_way__(rc.validRoutingWays, rc.routingWay || "")) {
|
|
1000
1000
|
rc.routingPath = (location as any)[rc.routingWay as string];
|
|
1001
|
-
rc.routingSelected.map(
|
|
1001
|
+
rc.routingSelected.map((routing: TComponentRouting,): TComponentRouting => {
|
|
1002
1002
|
const componentURI = ComponentURI({
|
|
1003
1003
|
"COMPONENTS_BASE_PATH": CONFIG.get("componentsBasePath"),
|
|
1004
1004
|
"COMPONENT_NAME": routing.name.toString(),
|
|
@@ -1010,7 +1010,7 @@ export class Component extends InheritClass implements IComponent {
|
|
|
1010
1010
|
});
|
|
1011
1011
|
if (rc.routingSelected.length > 0) {
|
|
1012
1012
|
rc.template = "";
|
|
1013
|
-
if (typeof rc.body !== "undefined" && rc.body !== null){
|
|
1013
|
+
if (typeof rc.body !== "undefined" && rc.body !== null) {
|
|
1014
1014
|
(rc.body as HTMLElement).innerHTML = "";
|
|
1015
1015
|
}
|
|
1016
1016
|
}
|
|
@@ -1025,7 +1025,7 @@ export class Component extends InheritClass implements IComponent {
|
|
|
1025
1025
|
if (isBrowser) {
|
|
1026
1026
|
const component = this;
|
|
1027
1027
|
const _componentRoot = component.componentRoot as IQCObjectsShadowedElement;
|
|
1028
|
-
if (typeof _componentRoot !== "undefined" && _componentRoot !== null){
|
|
1028
|
+
if (typeof _componentRoot !== "undefined" && _componentRoot !== null) {
|
|
1029
1029
|
const _imgLazyLoaded = [..._componentRoot.subelements("img[lazy-src]")];
|
|
1030
1030
|
const _lazyLoadImages = function (image: Element | HTMLElement) {
|
|
1031
1031
|
image.setAttribute("src", image.getAttribute("lazy-src")?.toString() as string);
|
|
@@ -1096,7 +1096,7 @@ export class Component extends InheritClass implements IComponent {
|
|
|
1096
1096
|
|
|
1097
1097
|
}
|
|
1098
1098
|
|
|
1099
|
-
get componentRoot
|
|
1099
|
+
get componentRoot(): TBody {
|
|
1100
1100
|
return (this.shadowed) ? (this.shadowRoot) : (this.body);
|
|
1101
1101
|
}
|
|
1102
1102
|
|
|
@@ -1106,7 +1106,7 @@ export class Component extends InheritClass implements IComponent {
|
|
|
1106
1106
|
if (document.location.hash !== "") {
|
|
1107
1107
|
const _componentRoot = component.componentRoot;
|
|
1108
1108
|
((_componentRoot as IQCObjectsShadowedElement)?.subelements(document.location.hash) as unknown as Element[]).map(
|
|
1109
|
-
|
|
1109
|
+
(element: Element): any => {
|
|
1110
1110
|
if (typeof element.scrollIntoView === "function") {
|
|
1111
1111
|
element.scrollIntoView(
|
|
1112
1112
|
CONFIG.get("scrollIntoHash", {
|
|
@@ -1134,13 +1134,13 @@ export class Component extends InheritClass implements IComponent {
|
|
|
1134
1134
|
const lang2 = navigator.language.slice(0, 2);
|
|
1135
1135
|
const i18n = _top.global.get("i18n");
|
|
1136
1136
|
if ((lang1 !== lang2) && (typeof i18n === "object" && Object.hasOwn(i18n, "messages"))) {
|
|
1137
|
-
const callback_i18n =
|
|
1137
|
+
const callback_i18n = () => {
|
|
1138
1138
|
return new Promise<void>(function (resolve) {
|
|
1139
1139
|
const messages = i18n.messages.filter(function (message: any) {
|
|
1140
1140
|
return Object.hasOwn(message, lang1) && Object.hasOwn(message, lang2);
|
|
1141
1141
|
});
|
|
1142
1142
|
(_componentRoot?.subelements("ul,li,h1,h2,h3,a,b,p,input,textarea,summary,details,option,component") as HTMLElement[])
|
|
1143
|
-
.map(
|
|
1143
|
+
.map((element: HTMLElement): HTMLElement => {
|
|
1144
1144
|
messages.map(function (message: { [x: string]: any; }) {
|
|
1145
1145
|
let _innerHTML = element.innerHTML;
|
|
1146
1146
|
_innerHTML = _innerHTML?.replace(new RegExp(`${message[lang1]}`, "g"), message[lang2]);
|
|
@@ -1154,7 +1154,7 @@ export class Component extends InheritClass implements IComponent {
|
|
|
1154
1154
|
};
|
|
1155
1155
|
callback_i18n.call(component).then(function () {
|
|
1156
1156
|
logger.debug("i18n loaded for component: " + component.name);
|
|
1157
|
-
}).catch((e:any) => {throw new Error
|
|
1157
|
+
}).catch((e: any) => { throw new Error(`An error ocurred when parsing i18n: ${e}.`); });
|
|
1158
1158
|
|
|
1159
1159
|
}
|
|
1160
1160
|
}
|
|
@@ -1201,7 +1201,7 @@ export class Component extends InheritClass implements IComponent {
|
|
|
1201
1201
|
__component_helpers__ = __component_helpers__.concat(component._componentHelpers);
|
|
1202
1202
|
|
|
1203
1203
|
__component_helpers__.map(
|
|
1204
|
-
|
|
1204
|
+
(_component_helper_): any => {
|
|
1205
1205
|
logger.debug(`Executing ${_component_helper_.name} as component helper for ${component.name}...`);
|
|
1206
1206
|
_component_helper_();
|
|
1207
1207
|
return _component_helper_;
|
|
@@ -1220,7 +1220,7 @@ Package("com.qcobjects", [
|
|
|
1220
1220
|
Component
|
|
1221
1221
|
]);
|
|
1222
1222
|
|
|
1223
|
-
(_methods_)(ClassFactory("Component")).map(
|
|
1223
|
+
(_methods_)(ClassFactory("Component")).map((__c__): any => {
|
|
1224
1224
|
(_protected_code_)(__c__);
|
|
1225
1225
|
return __c__;
|
|
1226
1226
|
});
|
package/src/ComponentFactory.ts
CHANGED
package/src/Controller.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IController, IComponent, TControllerParams, IQCObjectsElement, IQCObjectsShadowedElement } from "types";
|
|
1
|
+
import { IController, IComponent, TControllerParams, IQCObjectsElement, IQCObjectsShadowedElement } from "./types/global";
|
|
2
2
|
import { ClassFactory } from "./ClassFactory";
|
|
3
3
|
import { __getType__ } from "./getType";
|
|
4
4
|
import { InheritClass } from "./InheritClass";
|
package/src/Crypt.ts
CHANGED
package/src/DDO.ts
CHANGED
package/src/DOMCreateElement.ts
CHANGED
package/src/Effect.ts
CHANGED
package/src/InheritClass.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type IInheritClass, type IQCObjectsElement, type TBody } from "types";
|
|
1
|
+
import { type IInheritClass, type IQCObjectsElement, type TBody } from "./types/global";
|
|
2
2
|
import { logger } from "./Logger";
|
|
3
3
|
import { __instanceID, IncrementInstanceID } from "./IncrementInstanceID";
|
|
4
4
|
import { _CastProps, _Cast } from "./Cast";
|
|
@@ -31,7 +31,21 @@ export class InheritClass implements IInheritClass {
|
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
const self:
|
|
34
|
+
const self:this = this;
|
|
35
|
+
if (typeof _o_ !== "undefined" && _o_ !== null){
|
|
36
|
+
Object.keys(_o_)
|
|
37
|
+
.filter(function (k) {
|
|
38
|
+
return isNaN(k as any) && !["__instanceID", "__classType", "__definition"].includes(k);
|
|
39
|
+
})
|
|
40
|
+
.forEach(function (key) {
|
|
41
|
+
if (typeof self[key] === "function") {
|
|
42
|
+
self[key] = _o_[key].bind(self);
|
|
43
|
+
} else {
|
|
44
|
+
self[key] = _o_[key];
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
35
49
|
IncrementInstanceID();
|
|
36
50
|
if (!self.__instanceID) {
|
|
37
51
|
Object.defineProperty(self, "__instanceID", {
|
|
@@ -80,10 +94,10 @@ export class InheritClass implements IInheritClass {
|
|
|
80
94
|
|
|
81
95
|
try {
|
|
82
96
|
self.__new__.call(self, _o_);
|
|
83
|
-
if (typeof self === "object" && Object.hasOwn(self, "_new_") && typeof self._new_.isCalled === "undefined") {
|
|
97
|
+
if (typeof self === "object" && Object.hasOwn(self, "_new_") && typeof (self._new_ as any).isCalled === "undefined") {
|
|
84
98
|
try {
|
|
85
99
|
self._new_(_o_);
|
|
86
|
-
self._new_.isCalled = true;
|
|
100
|
+
(self._new_ as any).isCalled = true;
|
|
87
101
|
} catch (e: any) {
|
|
88
102
|
logger.warn(`${self.__classType}._new_() failed with error: ${e}`);
|
|
89
103
|
}
|
package/src/MainProcess.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IQCObjectsElement, IQCObjectsShadowedElement } from "types";
|
|
1
|
+
import { IQCObjectsElement, IQCObjectsShadowedElement } from "./types/global";
|
|
2
2
|
import { _top } from "./top";
|
|
3
3
|
import { _fireAsyncLoad, asyncLoad } from "./asyncLoad";
|
|
4
4
|
import { captureFalseTouch } from "./captureFalseTouch";
|
package/src/Processor.ts
CHANGED
package/src/QCObjects.ts
CHANGED
|
@@ -34,7 +34,6 @@
|
|
|
34
34
|
export * as AssignPolyfill from "./assign";
|
|
35
35
|
export * as __top__ from "./top";
|
|
36
36
|
export * as QCObjects from "./MainProcess";
|
|
37
|
-
|
|
38
37
|
export {_top, resetTop} from "./top";
|
|
39
38
|
export { _QC_CLASSES, _QC_PACKAGES, _QC_PACKAGES_IMPORTED, _QC_READY_LISTENERS } from "./PrimaryCollections";
|
|
40
39
|
export { _DataStringify } from "./DataStringify";
|
|
@@ -96,8 +95,9 @@ export { DDO } from "./DDO";
|
|
|
96
95
|
export { Toggle } from "./Toggle";
|
|
97
96
|
export { findPackageNodePath } from "./findPackageNodePath";
|
|
98
97
|
export { getDocumentLayout } from "./DocumentLayout";
|
|
99
|
-
export { IQCObjectsElement, IQCObjectsShadowedElement } from "types";
|
|
98
|
+
export { IQCObjectsElement, IQCObjectsShadowedElement } from "./types/global";
|
|
100
99
|
export { __to_number } from "./mathFunctions";
|
|
101
100
|
export {_top as global} from "./top";
|
|
102
101
|
export {__make_global__} from "./make_global";
|
|
103
102
|
export {get, set} from "./top";
|
|
103
|
+
export default {};
|
package/src/Service.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { logger } from "./Logger";
|
|
|
6
6
|
import { Package } from "./Package";
|
|
7
7
|
import { _secretKey } from "./secretKey";
|
|
8
8
|
import { CONFIG } from "./CONFIG";
|
|
9
|
-
import { IJSONService, IService, TServiceDoneResponse, TServiceStandardResponse } from "types";
|
|
9
|
+
import { IJSONService, IService, TServiceDoneResponse, TServiceStandardResponse } from "./types/global";
|
|
10
10
|
|
|
11
11
|
export class Service extends InheritClass implements IService{
|
|
12
12
|
options!: object;
|
package/src/SourceCSS.ts
CHANGED
package/src/SourceJS.ts
CHANGED
package/src/Tag.ts
CHANGED
package/src/Timer.ts
CHANGED
package/src/TransitionEffect.ts
CHANGED
|
@@ -2,7 +2,8 @@ import { Effect } from "./Effect";
|
|
|
2
2
|
import { logger } from "./Logger";
|
|
3
3
|
import { Package } from "./Package";
|
|
4
4
|
import { ClassFactory } from "./ClassFactory";
|
|
5
|
-
import {
|
|
5
|
+
import { IQCObjectsElement, IQCObjectsShadowedElement } from "./types/global";
|
|
6
|
+
import { ITransitionEffect, IComponent, TTransitionEffectParams } from "./types/global";
|
|
6
7
|
|
|
7
8
|
export class TransitionEffect extends Effect implements ITransitionEffect{
|
|
8
9
|
duration = 385;
|
package/src/WidgetsFactory.ts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
|
|
2
2
|
/* eslint-disable no-unused-vars */
|
|
3
|
-
import { I_ComponentWidget_ } from "types";
|
|
4
3
|
import { _DOMCreateElement } from "./DOMCreateElement";
|
|
5
4
|
import { Export } from "./Export";
|
|
6
5
|
import { _protected_code_ } from "./introspection";
|
|
7
6
|
import { isBrowser } from "./platform";
|
|
7
|
+
import { I_ComponentWidget_ } from "./types/global";
|
|
8
8
|
|
|
9
9
|
class QCObjectsWidgetNode implements I_ComponentWidget_ {
|
|
10
|
+
writingSuggestions!: string;
|
|
11
|
+
currentCSSZoom!: number;
|
|
12
|
+
ariaColIndexText!: string | null;
|
|
13
|
+
ariaRowIndexText!: string | null;
|
|
10
14
|
accessKey!: string;
|
|
11
15
|
accessKeyLabel!: string;
|
|
12
16
|
autocapitalize!: string;
|
package/src/asyncLoad.ts
CHANGED
package/src/componentLoader.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IComponent, TCacheController } from "types";
|
|
1
|
+
import { IComponent, TCacheController } from "./types/global";
|
|
2
2
|
import { asyncLoad } from "./asyncLoad";
|
|
3
3
|
import { ComplexStorageCache } from "./ComplexStorageCache";
|
|
4
4
|
import { _DataStringify } from "./DataStringify";
|
package/src/defaultProcessors.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { logger } from "./Logger";
|
|
|
2
2
|
import { GlobalProcessor as Processor } from "./Processor";
|
|
3
3
|
import { _top } from "./top";
|
|
4
4
|
import { range } from "./range";
|
|
5
|
-
import { IComponent } from "types";
|
|
5
|
+
import { IComponent } from "./types/global";
|
|
6
6
|
|
|
7
7
|
// Set Processors
|
|
8
8
|
export const setDefaultProcessors = () => {
|