@j2inn/resolvable-ui-elements 0.0.2-beta.6 → 0.0.3
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/dist/resolvableElements/elements/expr/ResolvableExprElement.d.ts +6 -0
- package/dist/resolvableElements/elements/expr/ResolvableExprElement.js +14 -1
- package/dist/resolvableElements/elements/expr/ResolvableExprElement.js.map +1 -1
- package/dist/resolvableElements/react/SectionChecker.d.ts +0 -3
- package/dist/resolvableElements/react/SectionChecker.jsx +0 -3
- package/dist/resolvableElements/react/SectionChecker.jsx.map +1 -1
- package/dist_es/resolvableElements/elements/expr/ResolvableExprElement.d.ts +6 -0
- package/dist_es/resolvableElements/elements/expr/ResolvableExprElement.js +14 -1
- package/dist_es/resolvableElements/elements/expr/ResolvableExprElement.js.map +1 -1
- package/dist_es/resolvableElements/react/SectionChecker.d.ts +0 -3
- package/dist_es/resolvableElements/react/SectionChecker.jsx +0 -3
- package/dist_es/resolvableElements/react/SectionChecker.jsx.map +1 -1
- package/package.json +1 -1
|
@@ -6,9 +6,15 @@ import { UiElementConstructorData, UiElementData } from '../UiElement';
|
|
|
6
6
|
*/
|
|
7
7
|
export declare class ResolvableExprElement<T extends UiElementData> extends ResolvableValueElement<T> {
|
|
8
8
|
#private;
|
|
9
|
+
static collectionTypes: Set<string>;
|
|
9
10
|
constructor(data: UiElementConstructorData<T>);
|
|
10
11
|
refreshes: number;
|
|
11
12
|
protected doInitialize: (parameters: HDict) => Promise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* Checks whether the declared resolvedType of this element is a collection.
|
|
15
|
+
* @returns true if the resolvedType is a collection.
|
|
16
|
+
*/
|
|
17
|
+
isExpectedResultACollection: () => boolean;
|
|
12
18
|
protected doClose: () => Promise<void>;
|
|
13
19
|
getParameterList: () => string[];
|
|
14
20
|
}
|
|
@@ -12,6 +12,7 @@ const ResolvableValueElement_1 = require("../ResolvableValueElement");
|
|
|
12
12
|
* Resolves to the result of an expression.
|
|
13
13
|
*/
|
|
14
14
|
class ResolvableExprElement extends ResolvableValueElement_1.ResolvableValueElement {
|
|
15
|
+
static collectionTypes = new Set(['HGrid', 'HList']);
|
|
15
16
|
constructor(data) {
|
|
16
17
|
super(data);
|
|
17
18
|
}
|
|
@@ -29,7 +30,10 @@ class ResolvableExprElement extends ResolvableValueElement_1.ResolvableValueElem
|
|
|
29
30
|
return;
|
|
30
31
|
}
|
|
31
32
|
const val = grid[0]?.get('val');
|
|
32
|
-
|
|
33
|
+
// Identify when it's necessary to unpack the result `val` or not
|
|
34
|
+
// since the eval wraps the result value in a grid's first dict `val` tag for non-collections.
|
|
35
|
+
const shouldUnpackResult = !this.isExpectedResultACollection() && val;
|
|
36
|
+
if (shouldUnpackResult) {
|
|
33
37
|
this.value = val;
|
|
34
38
|
}
|
|
35
39
|
else {
|
|
@@ -42,6 +46,15 @@ class ResolvableExprElement extends ResolvableValueElement_1.ResolvableValueElem
|
|
|
42
46
|
}, haystack_core_1.HNum.make(refreshAfter, haystack_units_1.second).convertTo(haystack_units_1.millisecond).value);
|
|
43
47
|
}
|
|
44
48
|
};
|
|
49
|
+
/**
|
|
50
|
+
* Checks whether the declared resolvedType of this element is a collection.
|
|
51
|
+
* @returns true if the resolvedType is a collection.
|
|
52
|
+
*/
|
|
53
|
+
isExpectedResultACollection = () => {
|
|
54
|
+
const { resolvedType } = this._meta;
|
|
55
|
+
return (ResolvableExprElement.collectionTypes.has(resolvedType) ||
|
|
56
|
+
resolvedType.endsWith('[]'));
|
|
57
|
+
};
|
|
45
58
|
doClose = async () => {
|
|
46
59
|
if (this.#timeout) {
|
|
47
60
|
clearTimeout(this.#timeout);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResolvableExprElement.js","sourceRoot":"","sources":["../../../../src/resolvableElements/elements/expr/ResolvableExprElement.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,iDAA2C;AAC3C,mDAAoD;AACpD,iFAGyC;AAEzC,sEAAkE;AAIlE;;GAEG;AACH,MAAa,qBAEX,SAAQ,+CAAyB;IAClC,YAAY,IAAiC;QAC5C,KAAK,CAAC,IAAI,CAAC,CAAA;IACZ,CAAC;IAED,SAAS,GAAG,CAAC,CAAA;IACb,QAAQ,CAAS;IAEP,YAAY,GAAG,KAAK,EAAE,UAAiB,EAAiB,EAAE;QACnE,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,CAAA;IAC9B,CAAC,CAAA;IAED,YAAY,GAAG,KAAK,EAAE,UAAiB,EAAiB,EAAE;QACzD,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC,KAAkC,CAAA;QAEtE,MAAM,kBAAkB,GAAG,IAAA,sDAAyB,EAAC,IAAI,EAAE,UAAU,CAAC,CAAA;QAEtE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAA;QAEzD,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE;YACnB,OAAO,CAAC,KAAK,CACZ,sCAAsC,EACtC,kBAAkB,EAClB,IAAI,CAAC,QAAQ,EAAE,CACf,CAAA;YACD,OAAM;SACN;QAED,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,KAAK,CAAC,CAAA;QAE/B,IAAI,GAAG,EAAE;
|
|
1
|
+
{"version":3,"file":"ResolvableExprElement.js","sourceRoot":"","sources":["../../../../src/resolvableElements/elements/expr/ResolvableExprElement.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,iDAA2C;AAC3C,mDAAoD;AACpD,iFAGyC;AAEzC,sEAAkE;AAIlE;;GAEG;AACH,MAAa,qBAEX,SAAQ,+CAAyB;IAClC,MAAM,CAAC,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAA;IAEpD,YAAY,IAAiC;QAC5C,KAAK,CAAC,IAAI,CAAC,CAAA;IACZ,CAAC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CAAC,CAAA;IAED;;;OAGG;IACH,2BAA2B,GAAG,GAAY,EAAE;QAC3C,MAAM,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC,KAAkC,CAAA;QAEhE,OAAO,CACN,qBAAqB,CAAC,eAAe,CAAC,GAAG,CAAC,YAAY,CAAC;YACvD,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,CAC3B,CAAA;IACF,CAAC,CAAA;IAES,OAAO,GAAG,KAAK,IAAmB,EAAE;QAC7C,IAAI,IAAI,CAAC,QAAQ,EAAE;YAClB,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;SAC3B;IACF,CAAC,CAAA;IAED,gBAAgB,GAAmB,GAAG,EAAE;QACvC,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,KAAkC,CAAA;QAExD,MAAM,UAAU,GAAa,EAAE,CAAA;QAE/B,IAAI,IAAI,EAAE;YACT,IAAA,qDAAwB,EAAC,IAAI,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE;gBAC3C,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;gBACtB,OAAO,EAAE,CAAA;YACV,CAAC,CAAC,CAAA;SACF;QAED,OAAO,UAAU,CAAA;IAClB,CAAC,CAAA;;AAnFF,sDAoFC"}
|
|
@@ -11,12 +11,9 @@ export declare type OptionalSection<P> = P | (Omit<P, 'section'> & {
|
|
|
11
11
|
* that checks if the 'section' prop is defined before rendering the SectionComponent.
|
|
12
12
|
* If the 'section' prop is undefined, it returns an empty element.
|
|
13
13
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
14
|
* @template P - Props of the original SectionComponent
|
|
17
15
|
* @param {React.FC<P>} SectionComponent - The original component that will be wrapped
|
|
18
16
|
* @returns {React.FC<P | (Omit<P, 'section'> & { section?: undefined })>} - The wrapped component
|
|
19
|
-
*
|
|
20
17
|
* @example
|
|
21
18
|
* const CheckedComponent = SectionChecker(({section, ...props}) => {
|
|
22
19
|
* return <div>{section.title}</div>
|
|
@@ -10,12 +10,9 @@ const react_1 = __importDefault(require("react"));
|
|
|
10
10
|
* that checks if the 'section' prop is defined before rendering the SectionComponent.
|
|
11
11
|
* If the 'section' prop is undefined, it returns an empty element.
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
13
|
* @template P - Props of the original SectionComponent
|
|
16
14
|
* @param {React.FC<P>} SectionComponent - The original component that will be wrapped
|
|
17
15
|
* @returns {React.FC<P | (Omit<P, 'section'> & { section?: undefined })>} - The wrapped component
|
|
18
|
-
*
|
|
19
16
|
* @example
|
|
20
17
|
* const CheckedComponent = SectionChecker(({section, ...props}) => {
|
|
21
18
|
* return <div>{section.title}</div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SectionChecker.jsx","sourceRoot":"","sources":["../../../src/resolvableElements/react/SectionChecker.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAAyB;AAUzB
|
|
1
|
+
{"version":3,"file":"SectionChecker.jsx","sourceRoot":"","sources":["../../../src/resolvableElements/react/SectionChecker.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAAyB;AAUzB;;;;;;;;;;;;GAYG;AACI,MAAM,cAAc,GAAG,CAC7B,gBAA6B,EAC5B,EAAE;IACH,MAAM,uBAAuB,GAAG,CAAC,KAAyB,EAAE,EAAE;QAC7D,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,IAAI,KAAK,CAAC,EAAG,CAAA;IAChE,CAAC,CAAA;IAED,OAAO,uBAAuB,CAAA;AAC/B,CAAC,CAAA;AARY,QAAA,cAAc,kBAQ1B"}
|
|
@@ -6,9 +6,15 @@ import { UiElementConstructorData, UiElementData } from '../UiElement';
|
|
|
6
6
|
*/
|
|
7
7
|
export declare class ResolvableExprElement<T extends UiElementData> extends ResolvableValueElement<T> {
|
|
8
8
|
#private;
|
|
9
|
+
static collectionTypes: Set<string>;
|
|
9
10
|
constructor(data: UiElementConstructorData<T>);
|
|
10
11
|
refreshes: number;
|
|
11
12
|
protected doInitialize: (parameters: HDict) => Promise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* Checks whether the declared resolvedType of this element is a collection.
|
|
15
|
+
* @returns true if the resolvedType is a collection.
|
|
16
|
+
*/
|
|
17
|
+
isExpectedResultACollection: () => boolean;
|
|
12
18
|
protected doClose: () => Promise<void>;
|
|
13
19
|
getParameterList: () => string[];
|
|
14
20
|
}
|
|
@@ -9,6 +9,7 @@ import { ResolvableValueElement } from '../ResolvableValueElement';
|
|
|
9
9
|
* Resolves to the result of an expression.
|
|
10
10
|
*/
|
|
11
11
|
export class ResolvableExprElement extends ResolvableValueElement {
|
|
12
|
+
static collectionTypes = new Set(['HGrid', 'HList']);
|
|
12
13
|
constructor(data) {
|
|
13
14
|
super(data);
|
|
14
15
|
}
|
|
@@ -26,7 +27,10 @@ export class ResolvableExprElement extends ResolvableValueElement {
|
|
|
26
27
|
return;
|
|
27
28
|
}
|
|
28
29
|
const val = grid[0]?.get('val');
|
|
29
|
-
|
|
30
|
+
// Identify when it's necessary to unpack the result `val` or not
|
|
31
|
+
// since the eval wraps the result value in a grid's first dict `val` tag for non-collections.
|
|
32
|
+
const shouldUnpackResult = !this.isExpectedResultACollection() && val;
|
|
33
|
+
if (shouldUnpackResult) {
|
|
30
34
|
this.value = val;
|
|
31
35
|
}
|
|
32
36
|
else {
|
|
@@ -39,6 +43,15 @@ export class ResolvableExprElement extends ResolvableValueElement {
|
|
|
39
43
|
}, HNum.make(refreshAfter, second).convertTo(millisecond).value);
|
|
40
44
|
}
|
|
41
45
|
};
|
|
46
|
+
/**
|
|
47
|
+
* Checks whether the declared resolvedType of this element is a collection.
|
|
48
|
+
* @returns true if the resolvedType is a collection.
|
|
49
|
+
*/
|
|
50
|
+
isExpectedResultACollection = () => {
|
|
51
|
+
const { resolvedType } = this._meta;
|
|
52
|
+
return (ResolvableExprElement.collectionTypes.has(resolvedType) ||
|
|
53
|
+
resolvedType.endsWith('[]'));
|
|
54
|
+
};
|
|
42
55
|
doClose = async () => {
|
|
43
56
|
if (this.#timeout) {
|
|
44
57
|
clearTimeout(this.#timeout);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResolvableExprElement.js","sourceRoot":"","sources":["../../../../src/resolvableElements/elements/expr/ResolvableExprElement.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAS,IAAI,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,EACN,wBAAwB,EACxB,yBAAyB,GACzB,MAAM,kCAAkC,CAAA;AAEzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAA;AAIlE;;GAEG;AACH,MAAM,OAAO,qBAEX,SAAQ,sBAAyB;IAClC,YAAY,IAAiC;QAC5C,KAAK,CAAC,IAAI,CAAC,CAAA;IACZ,CAAC;IAED,SAAS,GAAG,CAAC,CAAA;IACb,QAAQ,CAAS;IAEP,YAAY,GAAG,KAAK,EAAE,UAAiB,EAAiB,EAAE;QACnE,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,CAAA;IAC9B,CAAC,CAAA;IAED,YAAY,GAAG,KAAK,EAAE,UAAiB,EAAiB,EAAE;QACzD,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC,KAAkC,CAAA;QAEtE,MAAM,kBAAkB,GAAG,yBAAyB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAA;QAEtE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAA;QAEzD,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE;YACnB,OAAO,CAAC,KAAK,CACZ,sCAAsC,EACtC,kBAAkB,EAClB,IAAI,CAAC,QAAQ,EAAE,CACf,CAAA;YACD,OAAM;SACN;QAED,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,KAAK,CAAC,CAAA;QAE/B,IAAI,GAAG,EAAE;
|
|
1
|
+
{"version":3,"file":"ResolvableExprElement.js","sourceRoot":"","sources":["../../../../src/resolvableElements/elements/expr/ResolvableExprElement.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAS,IAAI,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,EACN,wBAAwB,EACxB,yBAAyB,GACzB,MAAM,kCAAkC,CAAA;AAEzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAA;AAIlE;;GAEG;AACH,MAAM,OAAO,qBAEX,SAAQ,sBAAyB;IAClC,MAAM,CAAC,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAA;IAEpD,YAAY,IAAiC;QAC5C,KAAK,CAAC,IAAI,CAAC,CAAA;IACZ,CAAC;IAED,SAAS,GAAG,CAAC,CAAA;IACb,QAAQ,CAAS;IAEP,YAAY,GAAG,KAAK,EAAE,UAAiB,EAAiB,EAAE;QACnE,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,CAAA;IAC9B,CAAC,CAAA;IAED,YAAY,GAAG,KAAK,EAAE,UAAiB,EAAiB,EAAE;QACzD,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC,KAAkC,CAAA;QAEtE,MAAM,kBAAkB,GAAG,yBAAyB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAA;QAEtE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAA;QAEzD,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE;YACnB,OAAO,CAAC,KAAK,CACZ,sCAAsC,EACtC,kBAAkB,EAClB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AE;YACT,wBAAwB,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE;gBAC3C,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;gBACtB,OAAO,EAAE,CAAA;YACV,CAAC,CAAC,CAAA;SACF;QAED,OAAO,UAAU,CAAA;IAClB,CAAC,CAAA"}
|
|
@@ -11,12 +11,9 @@ export declare type OptionalSection<P> = P | (Omit<P, 'section'> & {
|
|
|
11
11
|
* that checks if the 'section' prop is defined before rendering the SectionComponent.
|
|
12
12
|
* If the 'section' prop is undefined, it returns an empty element.
|
|
13
13
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
14
|
* @template P - Props of the original SectionComponent
|
|
17
15
|
* @param {React.FC<P>} SectionComponent - The original component that will be wrapped
|
|
18
16
|
* @returns {React.FC<P | (Omit<P, 'section'> & { section?: undefined })>} - The wrapped component
|
|
19
|
-
*
|
|
20
17
|
* @example
|
|
21
18
|
* const CheckedComponent = SectionChecker(({section, ...props}) => {
|
|
22
19
|
* return <div>{section.title}</div>
|
|
@@ -4,12 +4,9 @@ import React from 'react';
|
|
|
4
4
|
* that checks if the 'section' prop is defined before rendering the SectionComponent.
|
|
5
5
|
* If the 'section' prop is undefined, it returns an empty element.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
7
|
* @template P - Props of the original SectionComponent
|
|
10
8
|
* @param {React.FC<P>} SectionComponent - The original component that will be wrapped
|
|
11
9
|
* @returns {React.FC<P | (Omit<P, 'section'> & { section?: undefined })>} - The wrapped component
|
|
12
|
-
*
|
|
13
10
|
* @example
|
|
14
11
|
* const CheckedComponent = SectionChecker(({section, ...props}) => {
|
|
15
12
|
* return <div>{section.title}</div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SectionChecker.jsx","sourceRoot":"","sources":["../../../src/resolvableElements/react/SectionChecker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAUzB
|
|
1
|
+
{"version":3,"file":"SectionChecker.jsx","sourceRoot":"","sources":["../../../src/resolvableElements/react/SectionChecker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAUzB;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAC7B,gBAA6B,EAC5B,EAAE;IACH,MAAM,uBAAuB,GAAG,CAAC,KAAyB,EAAE,EAAE;QAC7D,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,IAAI,KAAK,CAAC,EAAG,CAAA;IAChE,CAAC,CAAA;IAED,OAAO,uBAAuB,CAAA;AAC/B,CAAC,CAAA"}
|