qcobjects 2.5.119-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 +5 -2
- 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 +22 -2
- package/public/browser/QCObjects.js.map +2 -2
- package/public/cjs/QCObjects.cjs +22 -2
- package/public/cjs/QCObjects.cjs.map +2 -2
- package/public/esm/QCObjects.mjs +22 -2
- 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 +71 -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,11 @@ export class Component extends InheritClass implements IComponent {
|
|
|
126
126
|
});
|
|
127
127
|
const self = this;
|
|
128
128
|
|
|
129
|
-
if (typeof
|
|
129
|
+
if (typeof name !== "undefined") {
|
|
130
|
+
self.name = name;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (typeof self.name === "undefined" && typeof name === "undefined") {
|
|
130
134
|
logger.warn("A name is not defined for " + __getType__(self));
|
|
131
135
|
}
|
|
132
136
|
|
|
@@ -155,7 +159,7 @@ export class Component extends InheritClass implements IComponent {
|
|
|
155
159
|
logger.info(`Component._new_ The component ${self.name} was built successfully!`);
|
|
156
160
|
}).catch(function (standardResponse) {
|
|
157
161
|
logger.warn(`Component._new_ Something went wrong building the component ${self.name}`);
|
|
158
|
-
console.error(standardResponse);
|
|
162
|
+
console.error(`Component._new_ Something went wrong building the component ${self.name}`, standardResponse);
|
|
159
163
|
});
|
|
160
164
|
}).catch((e: any) => {
|
|
161
165
|
throw Error(`Unexpected error ${e}`);
|
|
@@ -250,8 +254,8 @@ export class Component extends InheritClass implements IComponent {
|
|
|
250
254
|
return _serviceClassName;
|
|
251
255
|
}
|
|
252
256
|
|
|
253
|
-
protected get responseToData
|
|
254
|
-
let _response_to_data_:boolean = false;
|
|
257
|
+
protected get responseToData(): boolean {
|
|
258
|
+
let _response_to_data_: boolean = false;
|
|
255
259
|
if (isBrowser) {
|
|
256
260
|
const responseToAttr = (this.body as HTMLElement).getAttribute("response-to");
|
|
257
261
|
_response_to_data_ = responseToAttr === "data" || this.responseTo === "data";
|
|
@@ -261,8 +265,8 @@ export class Component extends InheritClass implements IComponent {
|
|
|
261
265
|
return _response_to_data_;
|
|
262
266
|
}
|
|
263
267
|
|
|
264
|
-
protected get responseToTemplate
|
|
265
|
-
let _response_to_template_:boolean = false;
|
|
268
|
+
protected get responseToTemplate(): boolean {
|
|
269
|
+
let _response_to_template_: boolean = false;
|
|
266
270
|
if (isBrowser) {
|
|
267
271
|
const responseToAttr = (this.body as HTMLElement).getAttribute("response-to");
|
|
268
272
|
_response_to_template_ = responseToAttr === "template" || this.responseTo === "template";
|
|
@@ -270,7 +274,7 @@ export class Component extends InheritClass implements IComponent {
|
|
|
270
274
|
_response_to_template_ = this.responseTo === "template";
|
|
271
275
|
}
|
|
272
276
|
return _response_to_template_;
|
|
273
|
-
}
|
|
277
|
+
}
|
|
274
278
|
|
|
275
279
|
createServiceInstance(): Promise<JSON | string | null> {
|
|
276
280
|
const component = this;
|
|
@@ -498,9 +502,9 @@ export class Component extends InheritClass implements IComponent {
|
|
|
498
502
|
await _component_.createControllerInstance();
|
|
499
503
|
await _component_.createEffectInstance();
|
|
500
504
|
})()
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
505
|
+
.catch((e: any) => {
|
|
506
|
+
throw new Error(`Unknown error ${e}.`);
|
|
507
|
+
});
|
|
504
508
|
|
|
505
509
|
logger.debug(`Trying to run component helpers for ${_component_.name}...`);
|
|
506
510
|
try {
|
|
@@ -522,8 +526,8 @@ export class Component extends InheritClass implements IComponent {
|
|
|
522
526
|
return new Promise(function (resolve, reject) {
|
|
523
527
|
try {
|
|
524
528
|
resolve(componentDone.call(_component_));
|
|
525
|
-
} catch (e:any) {
|
|
526
|
-
reject(new Error
|
|
529
|
+
} catch (e: any) {
|
|
530
|
+
reject(new Error(e));
|
|
527
531
|
}
|
|
528
532
|
});
|
|
529
533
|
|
|
@@ -561,7 +565,7 @@ export class Component extends InheritClass implements IComponent {
|
|
|
561
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); })) : ({});
|
|
562
566
|
}
|
|
563
567
|
|
|
564
|
-
__buildSubComponents__(rebuildObjects = false):any {
|
|
568
|
+
__buildSubComponents__(rebuildObjects = false): any {
|
|
565
569
|
const _component_: Component = this as Component;
|
|
566
570
|
let elementList = _component_.subtags;
|
|
567
571
|
if (!rebuildObjects) {
|
|
@@ -579,7 +583,7 @@ export class Component extends InheritClass implements IComponent {
|
|
|
579
583
|
const { error, component } = standardResponse;
|
|
580
584
|
resolve({ error, component });
|
|
581
585
|
} else {
|
|
582
|
-
reject(
|
|
586
|
+
reject(new Error(" Unknown error."));
|
|
583
587
|
}
|
|
584
588
|
});
|
|
585
589
|
return _ret_;
|
|
@@ -589,14 +593,14 @@ export class Component extends InheritClass implements IComponent {
|
|
|
589
593
|
this[key] = value;
|
|
590
594
|
}
|
|
591
595
|
|
|
592
|
-
get(key: string, _defaultValue?: string):any {
|
|
596
|
+
get(key: string, _defaultValue?: string): any {
|
|
593
597
|
return this[key] || _defaultValue;
|
|
594
598
|
}
|
|
595
599
|
|
|
596
600
|
feedComponent(): Promise<any> {
|
|
597
601
|
const _component_ = this;
|
|
598
602
|
logger.debug(`[Component][${this.name}][feedComponent] start feeding component...`);
|
|
599
|
-
const _feedComponent_InBrowser = function (_component_: Component):any {
|
|
603
|
+
const _feedComponent_InBrowser = function (_component_: Component): any {
|
|
600
604
|
if (typeof _component_.container === "undefined" && typeof _component_.body === "undefined") {
|
|
601
605
|
logger.warn("COMPONENT {{NAME}} has an undefined container and body".replace("{{NAME}}", _component_.name));
|
|
602
606
|
return;
|
|
@@ -609,7 +613,7 @@ export class Component extends InheritClass implements IComponent {
|
|
|
609
613
|
logger.debug("Preparing slots for Shadowed COMPONENT {{NAME}}".replace("{{NAME}}", _component_.name));
|
|
610
614
|
const tmp_shadowContainer = _DOMCreateElement("div");
|
|
611
615
|
container.subelements("[slot]").map(
|
|
612
|
-
|
|
616
|
+
(c: { parentElement: any; }): any => {
|
|
613
617
|
if (c.parentElement === container) {
|
|
614
618
|
tmp_shadowContainer.appendChild(c as any);
|
|
615
619
|
}
|
|
@@ -622,12 +626,12 @@ export class Component extends InheritClass implements IComponent {
|
|
|
622
626
|
_component_.shadowRoot = shadowContainer.attachShadow({
|
|
623
627
|
mode: "open"
|
|
624
628
|
}) as IQCObjectsShadowedElement;
|
|
625
|
-
} catch (e:any) {
|
|
629
|
+
} catch (e: any) {
|
|
626
630
|
logger.debug(`An error ocurred: ${e}.`);
|
|
627
631
|
try {
|
|
628
632
|
logger.debug("Shadowed COMPONENT {{NAME}} is repeated".replace("{{NAME}}", _component_.name));
|
|
629
633
|
_component_.shadowRoot = shadowContainer.shadowRoot as IQCObjectsShadowedElement;
|
|
630
|
-
} catch (e:any) {
|
|
634
|
+
} catch (e: any) {
|
|
631
635
|
logger.debug(`An error ocurred: ${e}.`);
|
|
632
636
|
logger.warn("Shadowed COMPONENT {{NAME}} is not allowed on this browser".replace("{{NAME}}", _component_.name));
|
|
633
637
|
}
|
|
@@ -674,7 +678,7 @@ export class Component extends InheritClass implements IComponent {
|
|
|
674
678
|
|
|
675
679
|
};
|
|
676
680
|
|
|
677
|
-
const _feedComponent_InNode = function (_component_: Component):any {
|
|
681
|
+
const _feedComponent_InNode = function (_component_: Component): any {
|
|
678
682
|
const parsedAssignmentText = _component_.parsedAssignmentText;
|
|
679
683
|
_component_.innerHTML = parsedAssignmentText;
|
|
680
684
|
};
|
|
@@ -682,22 +686,22 @@ export class Component extends InheritClass implements IComponent {
|
|
|
682
686
|
let _ret_;
|
|
683
687
|
if (!is_a(_component_, "Component")) {
|
|
684
688
|
logger.warn("Trying to feed a non component object");
|
|
685
|
-
return Promise.reject(new Error
|
|
689
|
+
return Promise.reject(new Error(`Trying to feed a non component object ${typeof _component_}`));
|
|
686
690
|
}
|
|
687
|
-
return new Promise
|
|
691
|
+
return new Promise<any>((resolve, reject) => {
|
|
688
692
|
if (isBrowser) {
|
|
689
693
|
try {
|
|
690
694
|
_ret_ = _feedComponent_InBrowser(_component_);
|
|
691
695
|
resolve(_ret_);
|
|
692
|
-
} catch (e:any) {
|
|
693
|
-
reject
|
|
696
|
+
} catch (e: any) {
|
|
697
|
+
reject(new Error(e));
|
|
694
698
|
}
|
|
695
699
|
} else {
|
|
696
700
|
try {
|
|
697
701
|
_ret_ = _feedComponent_InNode(_component_);
|
|
698
702
|
resolve(_ret_);
|
|
699
|
-
} catch (e:any){
|
|
700
|
-
reject
|
|
703
|
+
} catch (e: any) {
|
|
704
|
+
reject(new Error(e));
|
|
701
705
|
}
|
|
702
706
|
|
|
703
707
|
}
|
|
@@ -709,7 +713,7 @@ export class Component extends InheritClass implements IComponent {
|
|
|
709
713
|
const _component = this as Component;
|
|
710
714
|
var _promise = new Promise<{ request?: XMLHttpRequest, component: Component }>(function (resolve, reject) {
|
|
711
715
|
if (typeof _component === "undefined" || _component === null) {
|
|
712
|
-
reject(new Error
|
|
716
|
+
reject(new Error("Component is undefined"));
|
|
713
717
|
}
|
|
714
718
|
if (isQCObjects_Object(_component) && is_a(_component, "Component")) {
|
|
715
719
|
switch (true) {
|
|
@@ -722,9 +726,9 @@ export class Component extends InheritClass implements IComponent {
|
|
|
722
726
|
_component.__done__().then(function () {
|
|
723
727
|
if (typeof _component.done === "function") {
|
|
724
728
|
_component.done.call(_component, standardResponse)
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
729
|
+
.catch((e: any) => {
|
|
730
|
+
logger.debug(`It was an error while calling done() in ${_component.name}: ${e}`);
|
|
731
|
+
});
|
|
728
732
|
}
|
|
729
733
|
resolve.call(_promise, standardResponse);
|
|
730
734
|
}, function () {
|
|
@@ -736,10 +740,10 @@ export class Component extends InheritClass implements IComponent {
|
|
|
736
740
|
(async (_component) => {
|
|
737
741
|
await _component.feedComponent.bind(_component)();
|
|
738
742
|
})(_component)
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
+
.catch((e: any) => {
|
|
744
|
+
logger.debug(`It was not possible to feed the component ${_component.name}: ${e}`);
|
|
745
|
+
});
|
|
746
|
+
var standardResponse = {
|
|
743
747
|
request: undefined,
|
|
744
748
|
component: _component
|
|
745
749
|
};
|
|
@@ -792,9 +796,9 @@ export class Component extends InheritClass implements IComponent {
|
|
|
792
796
|
return _promise;
|
|
793
797
|
}
|
|
794
798
|
|
|
795
|
-
Cast(oClass: any):any {
|
|
799
|
+
Cast(oClass: any): any {
|
|
796
800
|
/* Cast method for components has been deprecated. Don't use this method, it is available only for compatibility purposes */
|
|
797
|
-
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 => {
|
|
798
802
|
return {
|
|
799
803
|
[m]: oClass[m].bind(this)
|
|
800
804
|
};
|
|
@@ -802,7 +806,7 @@ export class Component extends InheritClass implements IComponent {
|
|
|
802
806
|
return _Cast(this, o);
|
|
803
807
|
}
|
|
804
808
|
|
|
805
|
-
route
|
|
809
|
+
route() {
|
|
806
810
|
return (this.constructor as typeof Component).route();
|
|
807
811
|
}
|
|
808
812
|
|
|
@@ -826,12 +830,12 @@ export class Component extends InheritClass implements IComponent {
|
|
|
826
830
|
.then(function () {
|
|
827
831
|
rc.reload = true;
|
|
828
832
|
rc.rebuild()
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
833
|
+
.then(() => {
|
|
834
|
+
resolve();
|
|
835
|
+
})
|
|
836
|
+
.catch((e: any) => {
|
|
837
|
+
logger.debug(`Error ${e}`);
|
|
838
|
+
});
|
|
835
839
|
return;
|
|
836
840
|
})
|
|
837
841
|
.then(function () {
|
|
@@ -848,11 +852,11 @@ export class Component extends InheritClass implements IComponent {
|
|
|
848
852
|
}
|
|
849
853
|
resolve();
|
|
850
854
|
}
|
|
851
|
-
}).catch
|
|
855
|
+
}).catch((e: any) => {
|
|
852
856
|
logger.debug(`Error: ${e}`);
|
|
853
857
|
});
|
|
854
858
|
} else if (typeof rc !== "undefined") {
|
|
855
|
-
reject(new Error
|
|
859
|
+
reject(new Error("Component " + rc.name + " is not an instance of Component"));
|
|
856
860
|
}
|
|
857
861
|
return;
|
|
858
862
|
});
|
|
@@ -878,12 +882,12 @@ export class Component extends InheritClass implements IComponent {
|
|
|
878
882
|
|
|
879
883
|
fullscreen() {
|
|
880
884
|
if (isBrowser) {
|
|
881
|
-
const elem:HTMLElement = this.body as HTMLElement;
|
|
885
|
+
const elem: HTMLElement = this.body as HTMLElement;
|
|
882
886
|
if (elem.requestFullscreen) {
|
|
883
887
|
elem.requestFullscreen()
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
888
|
+
.catch((e: any) => {
|
|
889
|
+
throw new Error(`An error ocurred when requesting fullscreen: ${e}`);
|
|
890
|
+
});
|
|
887
891
|
} else if ((elem as any).mozRequestFullScreen) {
|
|
888
892
|
/* Firefox */
|
|
889
893
|
(elem as any).mozRequestFullScreen();
|
|
@@ -903,7 +907,7 @@ export class Component extends InheritClass implements IComponent {
|
|
|
903
907
|
if (isBrowser) {
|
|
904
908
|
if (document.exitFullscreen) {
|
|
905
909
|
document.exitFullscreen()
|
|
906
|
-
|
|
910
|
+
.catch((e: any) => { throw new Error(`An error ocurred when trying to exit fullscrenn ${e}.`); });
|
|
907
911
|
} else if ((document as any).mozCancelFullScreen) {
|
|
908
912
|
(document as any).mozCancelFullScreen();
|
|
909
913
|
} else if ((document as any).webkitExitFullscreen) {
|
|
@@ -925,10 +929,10 @@ export class Component extends InheritClass implements IComponent {
|
|
|
925
929
|
component.innerHTML = (componentBody as HTMLElement)?.innerHTML;
|
|
926
930
|
component.routingNodes = (componentBody as IQCObjectsElement)?.subelements("routing");
|
|
927
931
|
component.routings = [];
|
|
928
|
-
component.routingNodes.map(
|
|
932
|
+
component.routingNodes.map((routingNode): any => {
|
|
929
933
|
const attributeNames = (routingNode as HTMLElement).getAttributeNames();
|
|
930
934
|
const routing = {} as TComponentRouting;
|
|
931
|
-
attributeNames.map(
|
|
935
|
+
attributeNames.map((attributeName: any, a: string | number): any => {
|
|
932
936
|
(routing as any)[attributeNames[a as any]] = (routingNode as HTMLElement).getAttribute(attributeNames[a as any]);
|
|
933
937
|
return attributeName;
|
|
934
938
|
});
|
|
@@ -957,9 +961,9 @@ export class Component extends InheritClass implements IComponent {
|
|
|
957
961
|
});
|
|
958
962
|
}
|
|
959
963
|
|
|
960
|
-
parseTemplate(template: any):string {
|
|
964
|
+
parseTemplate(template: any): string {
|
|
961
965
|
const _self = this;
|
|
962
|
-
let _parsedAssignmentText:string;
|
|
966
|
+
let _parsedAssignmentText: string;
|
|
963
967
|
const value = template;
|
|
964
968
|
if (Object.hasOwn(_self, "templateHandler")) {
|
|
965
969
|
const templateHandlerName = _self.templateHandler;
|
|
@@ -974,7 +978,7 @@ export class Component extends InheritClass implements IComponent {
|
|
|
974
978
|
if (Object.hasOwn(_self, "assignRoutingParams") && _self.assignRoutingParams) {
|
|
975
979
|
try {
|
|
976
980
|
selfData = Object.assign(selfData, _self.routingParams);
|
|
977
|
-
} catch (e:any) {
|
|
981
|
+
} catch (e: any) {
|
|
978
982
|
logger.debug(`An error ocurred: ${e}.`);
|
|
979
983
|
logger.debug("[parseTemplate] it was not possible to assign the routing params to the template");
|
|
980
984
|
}
|
|
@@ -994,7 +998,7 @@ export class Component extends InheritClass implements IComponent {
|
|
|
994
998
|
if (isBrowser) {
|
|
995
999
|
if (__valid_routing_way__(rc.validRoutingWays, rc.routingWay || "")) {
|
|
996
1000
|
rc.routingPath = (location as any)[rc.routingWay as string];
|
|
997
|
-
rc.routingSelected.map(
|
|
1001
|
+
rc.routingSelected.map((routing: TComponentRouting,): TComponentRouting => {
|
|
998
1002
|
const componentURI = ComponentURI({
|
|
999
1003
|
"COMPONENTS_BASE_PATH": CONFIG.get("componentsBasePath"),
|
|
1000
1004
|
"COMPONENT_NAME": routing.name.toString(),
|
|
@@ -1006,7 +1010,7 @@ export class Component extends InheritClass implements IComponent {
|
|
|
1006
1010
|
});
|
|
1007
1011
|
if (rc.routingSelected.length > 0) {
|
|
1008
1012
|
rc.template = "";
|
|
1009
|
-
if (typeof rc.body !== "undefined" && rc.body !== null){
|
|
1013
|
+
if (typeof rc.body !== "undefined" && rc.body !== null) {
|
|
1010
1014
|
(rc.body as HTMLElement).innerHTML = "";
|
|
1011
1015
|
}
|
|
1012
1016
|
}
|
|
@@ -1021,7 +1025,7 @@ export class Component extends InheritClass implements IComponent {
|
|
|
1021
1025
|
if (isBrowser) {
|
|
1022
1026
|
const component = this;
|
|
1023
1027
|
const _componentRoot = component.componentRoot as IQCObjectsShadowedElement;
|
|
1024
|
-
if (typeof _componentRoot !== "undefined" && _componentRoot !== null){
|
|
1028
|
+
if (typeof _componentRoot !== "undefined" && _componentRoot !== null) {
|
|
1025
1029
|
const _imgLazyLoaded = [..._componentRoot.subelements("img[lazy-src]")];
|
|
1026
1030
|
const _lazyLoadImages = function (image: Element | HTMLElement) {
|
|
1027
1031
|
image.setAttribute("src", image.getAttribute("lazy-src")?.toString() as string);
|
|
@@ -1092,7 +1096,7 @@ export class Component extends InheritClass implements IComponent {
|
|
|
1092
1096
|
|
|
1093
1097
|
}
|
|
1094
1098
|
|
|
1095
|
-
get componentRoot
|
|
1099
|
+
get componentRoot(): TBody {
|
|
1096
1100
|
return (this.shadowed) ? (this.shadowRoot) : (this.body);
|
|
1097
1101
|
}
|
|
1098
1102
|
|
|
@@ -1102,7 +1106,7 @@ export class Component extends InheritClass implements IComponent {
|
|
|
1102
1106
|
if (document.location.hash !== "") {
|
|
1103
1107
|
const _componentRoot = component.componentRoot;
|
|
1104
1108
|
((_componentRoot as IQCObjectsShadowedElement)?.subelements(document.location.hash) as unknown as Element[]).map(
|
|
1105
|
-
|
|
1109
|
+
(element: Element): any => {
|
|
1106
1110
|
if (typeof element.scrollIntoView === "function") {
|
|
1107
1111
|
element.scrollIntoView(
|
|
1108
1112
|
CONFIG.get("scrollIntoHash", {
|
|
@@ -1130,13 +1134,13 @@ export class Component extends InheritClass implements IComponent {
|
|
|
1130
1134
|
const lang2 = navigator.language.slice(0, 2);
|
|
1131
1135
|
const i18n = _top.global.get("i18n");
|
|
1132
1136
|
if ((lang1 !== lang2) && (typeof i18n === "object" && Object.hasOwn(i18n, "messages"))) {
|
|
1133
|
-
const callback_i18n =
|
|
1137
|
+
const callback_i18n = () => {
|
|
1134
1138
|
return new Promise<void>(function (resolve) {
|
|
1135
1139
|
const messages = i18n.messages.filter(function (message: any) {
|
|
1136
1140
|
return Object.hasOwn(message, lang1) && Object.hasOwn(message, lang2);
|
|
1137
1141
|
});
|
|
1138
1142
|
(_componentRoot?.subelements("ul,li,h1,h2,h3,a,b,p,input,textarea,summary,details,option,component") as HTMLElement[])
|
|
1139
|
-
.map(
|
|
1143
|
+
.map((element: HTMLElement): HTMLElement => {
|
|
1140
1144
|
messages.map(function (message: { [x: string]: any; }) {
|
|
1141
1145
|
let _innerHTML = element.innerHTML;
|
|
1142
1146
|
_innerHTML = _innerHTML?.replace(new RegExp(`${message[lang1]}`, "g"), message[lang2]);
|
|
@@ -1150,7 +1154,7 @@ export class Component extends InheritClass implements IComponent {
|
|
|
1150
1154
|
};
|
|
1151
1155
|
callback_i18n.call(component).then(function () {
|
|
1152
1156
|
logger.debug("i18n loaded for component: " + component.name);
|
|
1153
|
-
}).catch((e:any) => {throw new Error
|
|
1157
|
+
}).catch((e: any) => { throw new Error(`An error ocurred when parsing i18n: ${e}.`); });
|
|
1154
1158
|
|
|
1155
1159
|
}
|
|
1156
1160
|
}
|
|
@@ -1197,7 +1201,7 @@ export class Component extends InheritClass implements IComponent {
|
|
|
1197
1201
|
__component_helpers__ = __component_helpers__.concat(component._componentHelpers);
|
|
1198
1202
|
|
|
1199
1203
|
__component_helpers__.map(
|
|
1200
|
-
|
|
1204
|
+
(_component_helper_): any => {
|
|
1201
1205
|
logger.debug(`Executing ${_component_helper_.name} as component helper for ${component.name}...`);
|
|
1202
1206
|
_component_helper_();
|
|
1203
1207
|
return _component_helper_;
|
|
@@ -1216,7 +1220,7 @@ Package("com.qcobjects", [
|
|
|
1216
1220
|
Component
|
|
1217
1221
|
]);
|
|
1218
1222
|
|
|
1219
|
-
(_methods_)(ClassFactory("Component")).map(
|
|
1223
|
+
(_methods_)(ClassFactory("Component")).map((__c__): any => {
|
|
1220
1224
|
(_protected_code_)(__c__);
|
|
1221
1225
|
return __c__;
|
|
1222
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";
|