@claspo/common 7.3.1-dev.2 → 7.3.1-dev.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/package.json +1 -1
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sorter.js +0 -196
- package/jest.config.ts +0 -204
- package/src/DefaultEventEmitter.test.ts +0 -84
- package/src/DefaultEventEmitter.ts +0 -96
- package/src/HttpAbortableLoader.ts +0 -35
- package/src/InAppLayoutType.ts +0 -6
- package/src/LayoutType.ts +0 -18
- package/src/PrizePool.interface.ts +0 -32
- package/src/RenderMode.ts +0 -10
- package/src/UuidGenerator.ts +0 -16
- package/src/WidgetInitConfig.interface.ts +0 -163
- package/src/WidgetType.ts +0 -18
- package/src/action/type.ts +0 -7
- package/src/async/createAsyncIterator.ts +0 -33
- package/src/async/debounce.ts +0 -28
- package/src/async/timeout.ts +0 -3
- package/src/component-manifest/ComponentManifest.interface.ts +0 -160
- package/src/component-manifest/ContextMenuManifest.interface.ts +0 -52
- package/src/component-manifest/DisplayCondition.interface.ts +0 -65
- package/src/component-manifest/FloatingControlManifest.interface.ts +0 -89
- package/src/component-manifest/PropPathCondition.interface.ts +0 -4
- package/src/component-manifest/PropertyPaneManifest.interface.ts +0 -614
- package/src/converter/time/TimeConverter.spec.ts +0 -11
- package/src/converter/time/TimeUnit.spec.ts +0 -12
- package/src/converter/time/TimeUnit.ts +0 -34
- package/src/converter/time/TimerConverter.ts +0 -29
- package/src/document/ComponentInsertType.ts +0 -6
- package/src/document/Document.interface.ts +0 -625
- package/src/document/DocumentCssVarsReplace.test.ts +0 -2947
- package/src/document/DocumentCssVarsReplace.ts +0 -31
- package/src/document/DocumentUtils.test.ts +0 -595
- package/src/document/DocumentUtils.ts +0 -194
- package/src/document/hidden-fields.interface.ts +0 -54
- package/src/dom/ViewportSize.ts +0 -61
- package/src/dom/copyToClipboard.ts +0 -17
- package/src/dom/getMostNestedNode.ts +0 -9
- package/src/dom/insertHtmlIntoElement.ts +0 -36
- package/src/dom/sanitizeHTML.test.ts +0 -59
- package/src/dom/sanitizeHTML.ts +0 -78
- package/src/element/BaseElementInViewportHandler.ts +0 -41
- package/src/element/CssVarsOperations.ts +0 -37
- package/src/element/ThemeCssVars.ts +0 -28
- package/src/element/recursiveFindParentNodeByAttribute.test.ts +0 -63
- package/src/element/recursiveFindParentNodeByAttribute.ts +0 -25
- package/src/flat.ts +0 -16
- package/src/handler/HandlerTypes.ts +0 -4
- package/src/math/RandomDistributor.test.ts +0 -35
- package/src/math/RandomDistributor.ts +0 -58
- package/src/math/sum.ts +0 -3
- package/src/network/HttpClient.ts +0 -28
- package/src/network/HttpStatus.ts +0 -4
- package/src/object/isDictionary.test.ts +0 -24
- package/src/object/isDictionary.ts +0 -13
- package/src/object/omitKeys.test.ts +0 -19
- package/src/object/omitKeys.ts +0 -20
- package/src/storage/BaseCachingStorage.test.ts +0 -70
- package/src/storage/BaseCachingStorage.ts +0 -37
- package/src/storage/CachingCookieStorage.test.ts +0 -75
- package/src/storage/CachingCookieStorage.ts +0 -36
- package/src/storage/CachingLocalStorage.test.ts +0 -59
- package/src/storage/CachingLocalStorage.ts +0 -34
- package/src/storage/getCookie.test.ts +0 -53
- package/src/storage/getCookie.ts +0 -10
- package/src/storage/setCookie.test.ts +0 -97
- package/src/storage/setCookie.ts +0 -49
- package/src/theme/theme.utils.ts +0 -50
- package/src/url/sanitizeUrl.test.ts +0 -62
- package/src/url/sanitizeUrl.ts +0 -51
- package/src/utils/CaseTransformer.test.ts +0 -16
- package/src/utils/CaseTransformer.ts +0 -10
- package/src/utils/NullishCoalescingOperator.ts +0 -3
- package/src/utils/NumericDecline.ts +0 -25
- package/src/utils/addEventListener.ts +0 -23
- package/src/utils/allSettled.ts +0 -6
- package/src/utils/checkTimeZone.spec.ts +0 -18
- package/src/utils/checkTimeZone.ts +0 -6
- package/src/utils/deviceUtils.ts +0 -12
- package/src/utils/flatMap.test.ts +0 -21
- package/src/utils/flatMap.ts +0 -3
- package/src/utils/fromEntries.ts +0 -6
- package/src/utils/generateRandomNumber.test.ts +0 -23
- package/src/utils/generateRandomNumber.ts +0 -3
- package/src/utils/objectSort.ts +0 -41
- package/src/utils/orientationUtils.ts +0 -18
- package/src/velocity/SysVelocityContext.spec.ts +0 -88
- package/src/velocity/SysVelocityContext.ts +0 -129
- package/src/velocity/SysVelocityRenderer.spec.ts +0 -36
- package/src/velocity/SysVelocityRenderer.ts +0 -11
- package/test/__mocks/jestGlobalMocks.js +0 -1887
- /package/{out/DefaultEventEmitter.d.ts → DefaultEventEmitter.d.ts} +0 -0
- /package/{out/DefaultEventEmitter.js → DefaultEventEmitter.js} +0 -0
- /package/{out/HttpAbortableLoader.d.ts → HttpAbortableLoader.d.ts} +0 -0
- /package/{out/HttpAbortableLoader.js → HttpAbortableLoader.js} +0 -0
- /package/{out/InAppLayoutType.d.ts → InAppLayoutType.d.ts} +0 -0
- /package/{out/InAppLayoutType.js → InAppLayoutType.js} +0 -0
- /package/{out/LayoutType.d.ts → LayoutType.d.ts} +0 -0
- /package/{out/LayoutType.js → LayoutType.js} +0 -0
- /package/{out/PrizePool.interface.d.ts → PrizePool.interface.d.ts} +0 -0
- /package/{out/PrizePool.interface.js → PrizePool.interface.js} +0 -0
- /package/{out/RenderMode.d.ts → RenderMode.d.ts} +0 -0
- /package/{out/RenderMode.js → RenderMode.js} +0 -0
- /package/{out/UuidGenerator.d.ts → UuidGenerator.d.ts} +0 -0
- /package/{out/UuidGenerator.js → UuidGenerator.js} +0 -0
- /package/{out/WidgetInitConfig.interface.d.ts → WidgetInitConfig.interface.d.ts} +0 -0
- /package/{out/WidgetInitConfig.interface.js → WidgetInitConfig.interface.js} +0 -0
- /package/{out/WidgetType.d.ts → WidgetType.d.ts} +0 -0
- /package/{out/WidgetType.js → WidgetType.js} +0 -0
- /package/{out/action → action}/type.d.ts +0 -0
- /package/{out/action → action}/type.js +0 -0
- /package/{out/async → async}/createAsyncIterator.d.ts +0 -0
- /package/{out/async → async}/createAsyncIterator.js +0 -0
- /package/{out/async → async}/debounce.d.ts +0 -0
- /package/{out/async → async}/debounce.js +0 -0
- /package/{out/async → async}/timeout.d.ts +0 -0
- /package/{out/async → async}/timeout.js +0 -0
- /package/{out/component-manifest → component-manifest}/ComponentManifest.interface.d.ts +0 -0
- /package/{out/component-manifest → component-manifest}/ComponentManifest.interface.js +0 -0
- /package/{out/component-manifest → component-manifest}/ContextMenuManifest.interface.d.ts +0 -0
- /package/{out/component-manifest → component-manifest}/ContextMenuManifest.interface.js +0 -0
- /package/{out/component-manifest → component-manifest}/DisplayCondition.interface.d.ts +0 -0
- /package/{out/component-manifest → component-manifest}/DisplayCondition.interface.js +0 -0
- /package/{out/component-manifest → component-manifest}/FloatingControlManifest.interface.d.ts +0 -0
- /package/{out/component-manifest → component-manifest}/FloatingControlManifest.interface.js +0 -0
- /package/{out/component-manifest → component-manifest}/PropPathCondition.interface.d.ts +0 -0
- /package/{out/component-manifest → component-manifest}/PropPathCondition.interface.js +0 -0
- /package/{out/component-manifest → component-manifest}/PropertyPaneManifest.interface.d.ts +0 -0
- /package/{out/component-manifest → component-manifest}/PropertyPaneManifest.interface.js +0 -0
- /package/{out/converter → converter}/time/TimeUnit.d.ts +0 -0
- /package/{out/converter → converter}/time/TimeUnit.js +0 -0
- /package/{out/converter → converter}/time/TimerConverter.d.ts +0 -0
- /package/{out/converter → converter}/time/TimerConverter.js +0 -0
- /package/{out/document → document}/ComponentInsertType.d.ts +0 -0
- /package/{out/document → document}/ComponentInsertType.js +0 -0
- /package/{out/document → document}/Document.interface.d.ts +0 -0
- /package/{out/document → document}/Document.interface.js +0 -0
- /package/{out/document → document}/DocumentCssVarsReplace.d.ts +0 -0
- /package/{out/document → document}/DocumentCssVarsReplace.js +0 -0
- /package/{out/document → document}/DocumentUtils.d.ts +0 -0
- /package/{out/document → document}/DocumentUtils.js +0 -0
- /package/{out/document → document}/hidden-fields.interface.d.ts +0 -0
- /package/{out/document → document}/hidden-fields.interface.js +0 -0
- /package/{out/dom → dom}/ViewportSize.d.ts +0 -0
- /package/{out/dom → dom}/ViewportSize.js +0 -0
- /package/{out/dom → dom}/copyToClipboard.d.ts +0 -0
- /package/{out/dom → dom}/copyToClipboard.js +0 -0
- /package/{out/dom → dom}/getMostNestedNode.d.ts +0 -0
- /package/{out/dom → dom}/getMostNestedNode.js +0 -0
- /package/{out/dom → dom}/insertHtmlIntoElement.d.ts +0 -0
- /package/{out/dom → dom}/insertHtmlIntoElement.js +0 -0
- /package/{out/dom → dom}/sanitizeHTML.d.ts +0 -0
- /package/{out/dom → dom}/sanitizeHTML.js +0 -0
- /package/{out/element → element}/BaseElementInViewportHandler.d.ts +0 -0
- /package/{out/element → element}/BaseElementInViewportHandler.js +0 -0
- /package/{out/element → element}/CssVarsOperations.d.ts +0 -0
- /package/{out/element → element}/CssVarsOperations.js +0 -0
- /package/{out/element → element}/ThemeCssVars.d.ts +0 -0
- /package/{out/element → element}/ThemeCssVars.js +0 -0
- /package/{out/element → element}/recursiveFindParentNodeByAttribute.d.ts +0 -0
- /package/{out/element → element}/recursiveFindParentNodeByAttribute.js +0 -0
- /package/{out/flat.d.ts → flat.d.ts} +0 -0
- /package/{out/flat.js → flat.js} +0 -0
- /package/{out/handler → handler}/HandlerTypes.d.ts +0 -0
- /package/{out/handler → handler}/HandlerTypes.js +0 -0
- /package/{out/math → math}/RandomDistributor.d.ts +0 -0
- /package/{out/math → math}/RandomDistributor.js +0 -0
- /package/{out/math → math}/sum.d.ts +0 -0
- /package/{out/math → math}/sum.js +0 -0
- /package/{out/network → network}/HttpClient.d.ts +0 -0
- /package/{out/network → network}/HttpClient.js +0 -0
- /package/{out/network → network}/HttpStatus.d.ts +0 -0
- /package/{out/network → network}/HttpStatus.js +0 -0
- /package/{out/object → object}/isDictionary.d.ts +0 -0
- /package/{out/object → object}/isDictionary.js +0 -0
- /package/{out/object → object}/omitKeys.d.ts +0 -0
- /package/{out/object → object}/omitKeys.js +0 -0
- /package/{out/storage → storage}/BaseCachingStorage.d.ts +0 -0
- /package/{out/storage → storage}/BaseCachingStorage.js +0 -0
- /package/{out/storage → storage}/CachingCookieStorage.d.ts +0 -0
- /package/{out/storage → storage}/CachingCookieStorage.js +0 -0
- /package/{out/storage → storage}/CachingLocalStorage.d.ts +0 -0
- /package/{out/storage → storage}/CachingLocalStorage.js +0 -0
- /package/{out/storage → storage}/getCookie.d.ts +0 -0
- /package/{out/storage → storage}/getCookie.js +0 -0
- /package/{out/storage → storage}/setCookie.d.ts +0 -0
- /package/{out/storage → storage}/setCookie.js +0 -0
- /package/{out/theme → theme}/theme.utils.d.ts +0 -0
- /package/{out/theme → theme}/theme.utils.js +0 -0
- /package/{out/url → url}/sanitizeUrl.d.ts +0 -0
- /package/{out/url → url}/sanitizeUrl.js +0 -0
- /package/{out/utils → utils}/CaseTransformer.d.ts +0 -0
- /package/{out/utils → utils}/CaseTransformer.js +0 -0
- /package/{out/utils → utils}/NullishCoalescingOperator.d.ts +0 -0
- /package/{out/utils → utils}/NullishCoalescingOperator.js +0 -0
- /package/{out/utils → utils}/NumericDecline.d.ts +0 -0
- /package/{out/utils → utils}/NumericDecline.js +0 -0
- /package/{out/utils → utils}/addEventListener.d.ts +0 -0
- /package/{out/utils → utils}/addEventListener.js +0 -0
- /package/{out/utils → utils}/allSettled.d.ts +0 -0
- /package/{out/utils → utils}/allSettled.js +0 -0
- /package/{out/utils → utils}/checkTimeZone.d.ts +0 -0
- /package/{out/utils → utils}/checkTimeZone.js +0 -0
- /package/{out/utils → utils}/deviceUtils.d.ts +0 -0
- /package/{out/utils → utils}/deviceUtils.js +0 -0
- /package/{out/utils → utils}/flatMap.d.ts +0 -0
- /package/{out/utils → utils}/flatMap.js +0 -0
- /package/{out/utils → utils}/fromEntries.d.ts +0 -0
- /package/{out/utils → utils}/fromEntries.js +0 -0
- /package/{out/utils → utils}/generateRandomNumber.d.ts +0 -0
- /package/{out/utils → utils}/generateRandomNumber.js +0 -0
- /package/{out/utils → utils}/objectSort.d.ts +0 -0
- /package/{out/utils → utils}/objectSort.js +0 -0
- /package/{out/utils → utils}/orientationUtils.d.ts +0 -0
- /package/{out/utils → utils}/orientationUtils.js +0 -0
- /package/{out/velocity → velocity}/SysVelocityContext.d.ts +0 -0
- /package/{out/velocity → velocity}/SysVelocityContext.js +0 -0
- /package/{out/velocity → velocity}/SysVelocityRenderer.d.ts +0 -0
- /package/{out/velocity → velocity}/SysVelocityRenderer.js +0 -0
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
type NumberLike = number | string;
|
|
2
|
-
|
|
3
|
-
export interface SysVelocityContextI {
|
|
4
|
-
mathTool: {
|
|
5
|
-
add: (a: NumberLike, b: NumberLike) => number;
|
|
6
|
-
sub: (a: NumberLike, b: NumberLike) => number;
|
|
7
|
-
mul: (a: NumberLike, b: NumberLike) => number;
|
|
8
|
-
div: (a: NumberLike, b: NumberLike) => number;
|
|
9
|
-
};
|
|
10
|
-
stringTool: {
|
|
11
|
-
equalsIgnoreCase: (a: string, b: string) => boolean;
|
|
12
|
-
};
|
|
13
|
-
numberTool: {
|
|
14
|
-
integer: (a: NumberLike) => number;
|
|
15
|
-
format: (f: string | null, v: NumberLike) => string;
|
|
16
|
-
number: (v: NumberLike, separator?: string, precision?: number) => string;
|
|
17
|
-
};
|
|
18
|
-
dateTool: {
|
|
19
|
-
currentDate: (format?: string) => string | number;
|
|
20
|
-
currentTimeStamp: () => number;
|
|
21
|
-
formatDate: (format: string | null, date: Date | string | number) => string | number;
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export default class SysVelocityContext {
|
|
26
|
-
|
|
27
|
-
create(): SysVelocityContextI {
|
|
28
|
-
return {
|
|
29
|
-
mathTool: {
|
|
30
|
-
add: function(a: NumberLike, b: NumberLike): number {
|
|
31
|
-
return Number(a) + Number(b);
|
|
32
|
-
},
|
|
33
|
-
sub: function(a: NumberLike, b: NumberLike): number {
|
|
34
|
-
return (a as number) - (b as number);
|
|
35
|
-
},
|
|
36
|
-
mul: function(a: NumberLike, b: NumberLike): number {
|
|
37
|
-
return (a as number) * (b as number);
|
|
38
|
-
},
|
|
39
|
-
div: function(a: NumberLike, b: NumberLike): number {
|
|
40
|
-
return (a as number) / (b as number);
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
stringTool: {
|
|
44
|
-
equalsIgnoreCase: function(a: string, b: string): boolean {
|
|
45
|
-
return String(a).toLowerCase() === String(b).toLowerCase();
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
numberTool: {
|
|
49
|
-
integer: function(a: NumberLike): number {
|
|
50
|
-
return Math.floor(a as number);
|
|
51
|
-
},
|
|
52
|
-
format: function(f: string | null, v: NumberLike): string {
|
|
53
|
-
const precision = (f || '').split('.')[1];
|
|
54
|
-
return Number(v).toFixed((precision || '').length);
|
|
55
|
-
},
|
|
56
|
-
number: function(v: NumberLike, separator: string = ',', precision: number = 3): string {
|
|
57
|
-
return Number(v)
|
|
58
|
-
.toFixed(precision)
|
|
59
|
-
.replace(new RegExp(`[.]0{${precision}}`), '')
|
|
60
|
-
.split('.')
|
|
61
|
-
.map((item: string, i: number) => {
|
|
62
|
-
if (i === 0) {
|
|
63
|
-
return item
|
|
64
|
-
.split('')
|
|
65
|
-
.reverse()
|
|
66
|
-
.join('')
|
|
67
|
-
.split('')
|
|
68
|
-
.map((char: string, i: number) => {
|
|
69
|
-
if (i % 3 === 0 && i !== 0) {
|
|
70
|
-
char += separator;
|
|
71
|
-
return char;
|
|
72
|
-
}
|
|
73
|
-
return char;
|
|
74
|
-
})
|
|
75
|
-
.reverse()
|
|
76
|
-
.join('');
|
|
77
|
-
} else if (i === 1) {
|
|
78
|
-
return item;
|
|
79
|
-
}
|
|
80
|
-
return undefined;
|
|
81
|
-
})
|
|
82
|
-
.join('.');
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
dateTool: {
|
|
86
|
-
currentDate: function(format?: string): string | number {
|
|
87
|
-
return this.formatDate(format || 'ISO', new Date());
|
|
88
|
-
},
|
|
89
|
-
currentTimeStamp: function(): number {
|
|
90
|
-
return this.formatDate(null, new Date()) as number;
|
|
91
|
-
},
|
|
92
|
-
formatDate: function(format: string | null, date: Date | string | number): string | number {
|
|
93
|
-
const formatNumberLess10 = (number: number): string => number < 9 ? `0${number}` : `${number}`;
|
|
94
|
-
const dateObject = new Date(date);
|
|
95
|
-
if (dateObject.toString() === 'Invalid Date') {
|
|
96
|
-
return date as string;
|
|
97
|
-
}
|
|
98
|
-
if (format === 'ISO') {
|
|
99
|
-
return dateObject.toISOString();
|
|
100
|
-
}
|
|
101
|
-
if (!format || typeof format !== 'string') {
|
|
102
|
-
return dateObject.getTime();
|
|
103
|
-
}
|
|
104
|
-
const parsedFormat = format.split(' ');
|
|
105
|
-
let result = '';
|
|
106
|
-
parsedFormat.forEach((piece: string) => {
|
|
107
|
-
const upperPiece = piece.toUpperCase();
|
|
108
|
-
result = result.length === 0 ? result : result + ' ';
|
|
109
|
-
if (upperPiece.includes('HH')) {
|
|
110
|
-
result += upperPiece
|
|
111
|
-
.replace('HH', formatNumberLess10(dateObject.getHours()))
|
|
112
|
-
.replace('MM', formatNumberLess10(dateObject.getMinutes()))
|
|
113
|
-
.replace('SS', formatNumberLess10(dateObject.getSeconds()))
|
|
114
|
-
}
|
|
115
|
-
if (upperPiece.includes('YYYY') || upperPiece.includes('DD')) {
|
|
116
|
-
result += upperPiece
|
|
117
|
-
.replace('YYYY', String(dateObject.getFullYear()))
|
|
118
|
-
.replace('DD', formatNumberLess10(dateObject.getDate()))
|
|
119
|
-
.replace('MM', formatNumberLess10(dateObject.getMonth() + 1));
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
return result;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import SysVelocityRenderer from "./SysVelocityRenderer";
|
|
2
|
-
import SysVelocityContext from "./SysVelocityContext";
|
|
3
|
-
|
|
4
|
-
describe('SysVelocityRenderer', function () {
|
|
5
|
-
const baseCtx = new SysVelocityContext().create();
|
|
6
|
-
const instance = new SysVelocityRenderer();
|
|
7
|
-
|
|
8
|
-
const context = {
|
|
9
|
-
"FIRSTNAME": "Kate",
|
|
10
|
-
"nestedObject": {
|
|
11
|
-
"prop1": "value1"
|
|
12
|
-
},
|
|
13
|
-
"array": [
|
|
14
|
-
{
|
|
15
|
-
"el": 1
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
"el": 2
|
|
19
|
-
}
|
|
20
|
-
]
|
|
21
|
-
};
|
|
22
|
-
const render = (template: string) => instance.render(template, {...baseCtx, data: context});
|
|
23
|
-
|
|
24
|
-
it('should support syntax', function () {
|
|
25
|
-
|
|
26
|
-
expect(render('$data.get("FIRSTNAME")')).toEqual("Kate");
|
|
27
|
-
expect(render('$data.get("nestedObject").get("prop1")')).toEqual("value1");
|
|
28
|
-
expect(render('$data.nestedObject.prop1')).toEqual("value1");
|
|
29
|
-
expect(render('#foreach($item in $!data.get(\'array\'))$item.el#end')).toEqual("12");
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it('should have sys ctx', function () {
|
|
33
|
-
|
|
34
|
-
expect(render('$mathTool.add(1,1)')).toEqual("2");
|
|
35
|
-
});
|
|
36
|
-
});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// @ts-ignore
|
|
2
|
-
import * as Velocity from 'velocityjs';
|
|
3
|
-
import SysVelocityContext from "./SysVelocityContext";
|
|
4
|
-
|
|
5
|
-
const sysCtx = new SysVelocityContext().create();
|
|
6
|
-
|
|
7
|
-
export default class SysVelocityRenderer {
|
|
8
|
-
render(template: string, context: Record<string, any>): string {
|
|
9
|
-
return Velocity.render(template, {...sysCtx, ...context});
|
|
10
|
-
}
|
|
11
|
-
}
|