@progress/kendo-angular-schematics 13.5.0-develop.3 → 13.5.0-develop.4
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/collection.json +9 -27
- package/e2e/utils.d.ts +17 -0
- package/e2e/utils.js +71 -0
- package/e2e/utils.js.map +1 -0
- package/package.json +5 -2
- package/src/chart/files/__name@dasherize@if-flat__/__name@dasherize__.__type@dasherize__.__style__.template +6 -0
- package/src/chart/files/__name@dasherize@if-flat__/__name@dasherize__.__type@dasherize__.html.template +1 -0
- package/src/chart/files/__name@dasherize@if-flat__/__name@dasherize__.__type@dasherize__.spec.ts.template +21 -0
- package/src/chart/files/__name@dasherize@if-flat__/__name@dasherize__.__type@dasherize__.ts.template +34 -0
- package/src/chart/files/chart.html.include +103 -0
- package/src/{charts/circular → chart}/index.d.ts +2 -2
- package/src/chart/index.js +238 -0
- package/src/chart/index.js.map +1 -0
- package/src/chart/schema.d.ts +230 -0
- package/src/chart/schema.js +72 -0
- package/src/chart/schema.js.map +1 -0
- package/src/chart/schema.json +235 -0
- package/src/grid/files/__name@dasherize@if-flat__/__name@dasherize__.__type@dasherize__.__style__.template +6 -0
- package/src/grid/files/__name@dasherize@if-flat__/__name@dasherize__.__type@dasherize__.html.template +1 -0
- package/src/grid/files/__name@dasherize@if-flat__/__name@dasherize__.__type@dasherize__.spec.ts.template +21 -0
- package/src/grid/files/__name@dasherize@if-flat__/__name@dasherize__.__type@dasherize__.ts.template +37 -0
- package/src/grid/files/__name@dasherize@if-flat__/__name@dasherize__.sample-data.ts.template +1233 -0
- package/src/grid/files/{html/__name@dasherize__/__name@dasherize__.component.html → grid.html.include} +4 -9
- package/src/grid/index.d.ts +2 -2
- package/src/grid/index.js +77 -61
- package/src/grid/index.js.map +1 -1
- package/src/grid/schema.d.ts +12 -11
- package/src/grid/schema.js +16 -5
- package/src/grid/schema.js.map +1 -1
- package/src/grid/schema.json +82 -37
- package/src/ngAdd/index.js +2 -1
- package/src/ngAdd/index.js.map +1 -1
- package/src/rules/index.js +2 -1
- package/src/rules/index.js.map +1 -1
- package/src/scheduler/files/__name@dasherize@if-flat__/__name@dasherize__.__type@dasherize__.__style__.template +6 -0
- package/src/scheduler/files/__name@dasherize@if-flat__/__name@dasherize__.__type@dasherize__.html.template +1 -0
- package/src/scheduler/files/__name@dasherize@if-flat__/__name@dasherize__.__type@dasherize__.spec.ts.template +21 -0
- package/src/scheduler/files/__name@dasherize@if-flat__/__name@dasherize__.__type@dasherize__.ts.template +26 -0
- package/src/scheduler/files/{events-utc.ts → __name@dasherize@if-flat__/__name@dasherize__.sample-data.ts.template} +0 -6
- package/src/scheduler/files/scheduler.html.include +7 -0
- package/src/scheduler/index.d.ts +2 -2
- package/src/scheduler/index.js +54 -32
- package/src/scheduler/index.js.map +1 -1
- package/src/scheduler/schema.d.ts +10 -2
- package/src/scheduler/schema.json +78 -2
- package/src/third_party/d3fc/d3fc-rebind/rebindAll.js +32 -0
- package/src/third_party/d3fc/day.js +61 -0
- package/src/third_party/d3fc/duration.js +34 -0
- package/src/third_party/d3fc/filter/skipWeekends.js +32 -0
- package/src/third_party/d3fc/financial.js +184 -0
- package/src/third_party/d3fc/fn.js +31 -0
- package/src/third_party/d3fc/geometricBrownianMotion.js +94 -0
- package/src/third_party/d3fc/interval.js +89 -0
- package/src/third_party/d3fc/randomNormal.js +49 -0
- package/src/third_party/d3fc/year.js +71 -0
- package/src/third_party/index.d.ts +28 -0
- package/src/third_party/index.js +40 -0
- package/src/third_party/index.js.map +1 -0
- package/src/third_party/index.v13.d.ts +13 -0
- package/src/third_party/index.v13.js +67 -0
- package/src/third_party/index.v13.js.map +1 -0
- package/src/utils/ast-utils.js +2 -1
- package/src/utils/ast-utils.js.map +1 -1
- package/src/utils/bootstrap-module.js +2 -1
- package/src/utils/bootstrap-module.js.map +1 -1
- package/src/{charts/scatter/schema.js → utils/parse-complex-options.d.ts} +1 -3
- package/src/utils/parse-complex-options.js +32 -0
- package/src/utils/parse-complex-options.js.map +1 -0
- package/src/charts/categorical/files/data.d.ts +0 -5
- package/src/charts/categorical/files/data.js +0 -29
- package/src/charts/categorical/files/data.js.map +0 -1
- package/src/charts/categorical/files/data.ts +0 -25
- package/src/charts/categorical/files/html/__name@dasherize__/__name@dasherize__.component.html +0 -46
- package/src/charts/categorical/files/html/__name@dasherize__/__name@dasherize__.component.ts +0 -25
- package/src/charts/categorical/files/inline/__name@dasherize__/__name@dasherize__.component.ts +0 -69
- package/src/charts/categorical/index.d.ts +0 -7
- package/src/charts/categorical/index.js +0 -124
- package/src/charts/categorical/index.js.map +0 -1
- package/src/charts/categorical/schema.d.ts +0 -92
- package/src/charts/categorical/schema.js +0 -54
- package/src/charts/categorical/schema.js.map +0 -1
- package/src/charts/categorical/schema.json +0 -253
- package/src/charts/circular/files/data.d.ts +0 -5
- package/src/charts/circular/files/data.js +0 -15
- package/src/charts/circular/files/data.js.map +0 -1
- package/src/charts/circular/files/data.ts +0 -11
- package/src/charts/circular/files/html/__name@dasherize__/__name@dasherize__.component.html +0 -27
- package/src/charts/circular/files/html/__name@dasherize__/__name@dasherize__.component.ts +0 -23
- package/src/charts/circular/files/inline/__name@dasherize__/__name@dasherize__.component.ts +0 -52
- package/src/charts/circular/index.js +0 -50
- package/src/charts/circular/index.js.map +0 -1
- package/src/charts/circular/schema.d.ts +0 -31
- package/src/charts/circular/schema.js +0 -7
- package/src/charts/circular/schema.js.map +0 -1
- package/src/charts/circular/schema.json +0 -175
- package/src/charts/scatter/files/data.d.ts +0 -5
- package/src/charts/scatter/files/data.js +0 -25
- package/src/charts/scatter/files/data.js.map +0 -1
- package/src/charts/scatter/files/data.ts +0 -21
- package/src/charts/scatter/files/html/__name@dasherize__/__name@dasherize__.component.html +0 -35
- package/src/charts/scatter/files/html/__name@dasherize__/__name@dasherize__.component.ts +0 -21
- package/src/charts/scatter/files/inline/__name@dasherize__/__name@dasherize__.component.ts +0 -58
- package/src/charts/scatter/index.d.ts +0 -7
- package/src/charts/scatter/index.js +0 -50
- package/src/charts/scatter/index.js.map +0 -1
- package/src/charts/scatter/schema.d.ts +0 -32
- package/src/charts/scatter/schema.js.map +0 -1
- package/src/charts/scatter/schema.json +0 -209
- package/src/charts/stock/files/data.d.ts +0 -5
- package/src/charts/stock/files/data.js +0 -418
- package/src/charts/stock/files/data.js.map +0 -1
- package/src/charts/stock/files/data.ts +0 -414
- package/src/charts/stock/files/html/__name@dasherize__/__name@dasherize__.component.html +0 -57
- package/src/charts/stock/files/html/__name@dasherize__/__name@dasherize__.component.ts +0 -23
- package/src/charts/stock/files/inline/__name@dasherize__/__name@dasherize__.component.ts +0 -83
- package/src/charts/stock/index.d.ts +0 -7
- package/src/charts/stock/index.js +0 -50
- package/src/charts/stock/index.js.map +0 -1
- package/src/charts/stock/schema.d.ts +0 -36
- package/src/charts/stock/schema.js +0 -7
- package/src/charts/stock/schema.js.map +0 -1
- package/src/charts/stock/schema.json +0 -285
- package/src/grid/files/data.d.ts +0 -5
- package/src/grid/files/data.js +0 -1241
- package/src/grid/files/data.js.map +0 -1
- package/src/grid/files/data.ts +0 -1237
- package/src/grid/files/html/__name@dasherize__/__name@dasherize__.component.ts +0 -29
- package/src/grid/files/inline/__name@dasherize__/__name@dasherize__.component.ts +0 -79
- package/src/scheduler/files/events-utc.d.ts +0 -5
- package/src/scheduler/files/events-utc.js +0 -846
- package/src/scheduler/files/events-utc.js.map +0 -1
- package/src/scheduler/files/html/__name@dasherize__/__name@dasherize__.component.html +0 -29
- package/src/scheduler/files/html/__name@dasherize__/__name@dasherize__.component.ts +0 -17
- package/src/scheduler/files/inline/__name@dasherize__/__name@dasherize__.component.ts +0 -48
package/src/scheduler/index.js
CHANGED
|
@@ -4,44 +4,66 @@
|
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
"use strict";
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.scheduler = void 0;
|
|
8
|
-
const core_1 = require("@angular-devkit/core");
|
|
9
|
-
const strings_1 = require("@angular-devkit/core/src/utils/strings");
|
|
10
7
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
8
|
+
const third_party_1 = require("../third_party");
|
|
9
|
+
// The code for the schematic is forked from:
|
|
10
|
+
// https://github.com/angular/angular-cli/blob/main/packages/schematics/angular/component/index.ts
|
|
11
|
+
// We have some added code that we will have to merge.
|
|
12
|
+
function default_1(options) {
|
|
13
|
+
return async (host, context) => {
|
|
14
|
+
console.log("START: " + JSON.stringify(options, null, " "));
|
|
15
|
+
const workspace = await (0, third_party_1.getWorkspace)(host);
|
|
16
|
+
const project = workspace.projects.get(options.project);
|
|
17
|
+
if (!project) {
|
|
18
|
+
throw new schematics_1.SchematicsException(`Project "${options.project}" does not exist.`);
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
(0,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
if (options.path === undefined) {
|
|
21
|
+
options.path = (0, third_party_1.buildDefaultPath)(project);
|
|
22
|
+
}
|
|
23
|
+
options.module = (0, third_party_1.findModuleFromOptions)(host, options);
|
|
24
|
+
const parsedPath = (0, third_party_1.parseName)(options.path, options.name);
|
|
25
|
+
options.name = parsedPath.name;
|
|
26
|
+
options.path = parsedPath.path;
|
|
27
|
+
options.selector =
|
|
28
|
+
options.selector || (0, third_party_1.buildSelector)(options, (project && project.prefix) || '');
|
|
29
|
+
(0, third_party_1.validateHtmlSelector)(options.selector);
|
|
30
|
+
const skipStyleFile = options.inlineStyle || options.style === third_party_1.Style.None;
|
|
31
|
+
console.log("PROCESSED: " + JSON.stringify(options, null, " "));
|
|
32
|
+
const templateSource = (0, schematics_1.apply)((0, schematics_1.url)('./files'), [
|
|
33
|
+
// Kendo specific, filters all .include files used as partials in templates.
|
|
34
|
+
(0, schematics_1.filter)(path => !path.endsWith('.include')),
|
|
35
|
+
options.skipTests ? (0, schematics_1.filter)((path) => !path.endsWith('.spec.ts.template')) : (0, schematics_1.noop)(),
|
|
36
|
+
skipStyleFile ? (0, schematics_1.filter)((path) => !path.endsWith('.__style__.template')) : (0, schematics_1.noop)(),
|
|
37
|
+
options.inlineTemplate ? (0, schematics_1.filter)((path) => !path.endsWith('.html.template')) : (0, schematics_1.noop)(),
|
|
38
|
+
(0, schematics_1.applyTemplates)({
|
|
39
|
+
...third_party_1.strings,
|
|
40
|
+
'if-flat': (s) => (options.flat ? '' : s),
|
|
41
|
+
...options,
|
|
42
|
+
// Kendo specific, allows the component content to be included in inline and html files.
|
|
43
|
+
include(path) {
|
|
44
|
+
return (0, schematics_1.applyContentTemplate)(this)((0, schematics_1.url)("./files")(context).get(path)).content.toString();
|
|
45
|
+
},
|
|
28
46
|
}),
|
|
29
|
-
|
|
47
|
+
!options.type
|
|
48
|
+
? (0, schematics_1.forEach)(((file) => {
|
|
49
|
+
return file.path.includes('..')
|
|
50
|
+
? {
|
|
51
|
+
content: file.content,
|
|
52
|
+
path: file.path.replace('..', '.'),
|
|
53
|
+
}
|
|
54
|
+
: file;
|
|
55
|
+
}))
|
|
56
|
+
: (0, schematics_1.noop)(),
|
|
57
|
+
(0, schematics_1.move)(parsedPath.path),
|
|
30
58
|
]);
|
|
31
|
-
const angularComponentOptions = {
|
|
32
|
-
path: _options.path,
|
|
33
|
-
name: _options.name,
|
|
34
|
-
inlineTemplate: _options.inlineTemplate,
|
|
35
|
-
inlineStyle: _options.inlineStyle,
|
|
36
|
-
skipTests: _options.skipTests,
|
|
37
|
-
style: "css"
|
|
38
|
-
};
|
|
39
|
-
_tree.create(`${_options.path}/${(0, strings_1.dasherize)(_options.name)}/events-utc.ts`, events_utc_1.eventsSourceCode);
|
|
40
59
|
return (0, schematics_1.chain)([
|
|
41
|
-
(0,
|
|
42
|
-
|
|
60
|
+
(0, third_party_1.addDeclarationToNgModule)({
|
|
61
|
+
type: 'component',
|
|
62
|
+
...options,
|
|
63
|
+
}),
|
|
64
|
+
(0, schematics_1.mergeWith)(templateSource),
|
|
43
65
|
]);
|
|
44
66
|
};
|
|
45
67
|
}
|
|
46
|
-
exports.
|
|
68
|
+
exports.default = default_1;
|
|
47
69
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/schematics/src/scheduler/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/schematics/src/scheduler/index.ts"],"names":[],"mappings":"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"}
|
|
@@ -2,9 +2,17 @@
|
|
|
2
2
|
* Copyright © 2023 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
export interface
|
|
6
|
-
path?: string;
|
|
5
|
+
export interface KendoAngularSchedulerSchema {
|
|
7
6
|
name: string;
|
|
7
|
+
path?: string;
|
|
8
|
+
project?: string;
|
|
9
|
+
module?: string;
|
|
10
|
+
selector?: string;
|
|
11
|
+
prefix: string;
|
|
12
|
+
style?: "css" | "scss" | "sass" | "less" | "none";
|
|
13
|
+
flat?: boolean;
|
|
14
|
+
type?: string;
|
|
15
|
+
displayBlock?: boolean;
|
|
8
16
|
inlineStyle: boolean;
|
|
9
17
|
inlineTemplate: boolean;
|
|
10
18
|
skipTests: boolean;
|
|
@@ -2,21 +2,90 @@
|
|
|
2
2
|
"progress:name": "Scheduler",
|
|
3
3
|
"progress:description": "Generate new Kendo UI for Angular Scheduler page",
|
|
4
4
|
"$schema": "http://json-schema.org/schema",
|
|
5
|
-
"$id": "
|
|
5
|
+
"$id": "KendoAngularScheduler",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"properties": {
|
|
8
8
|
"path": {
|
|
9
9
|
"type": "string",
|
|
10
10
|
"format": "path",
|
|
11
|
+
"$default": {
|
|
12
|
+
"$source": "workingDirectory"
|
|
13
|
+
},
|
|
14
|
+
"description": "The path at which to create the component file, relative to the current workspace. Default is a folder with the same name as the component in the project root.",
|
|
15
|
+
"visible": false,
|
|
16
|
+
"progress:editorVisible": false
|
|
17
|
+
},
|
|
18
|
+
"project": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"description": "The name of the project.",
|
|
21
|
+
"$default": {
|
|
22
|
+
"$source": "projectName"
|
|
23
|
+
},
|
|
11
24
|
"progress:editorVisible": false
|
|
12
25
|
},
|
|
13
26
|
"name": {
|
|
14
27
|
"type": "string",
|
|
28
|
+
"description": "The name of the component.",
|
|
15
29
|
"$default": {
|
|
16
30
|
"$source": "argv",
|
|
17
31
|
"index": 0
|
|
18
32
|
},
|
|
19
|
-
"default": "
|
|
33
|
+
"default": "Scheduler",
|
|
34
|
+
"x-prompt": "What name would you like to use for the component?"
|
|
35
|
+
},
|
|
36
|
+
"module": {
|
|
37
|
+
"type": "string",
|
|
38
|
+
"description": "The declaring NgModule.",
|
|
39
|
+
"alias": "m",
|
|
40
|
+
"progress:editorVisible": false
|
|
41
|
+
},
|
|
42
|
+
"selector": {
|
|
43
|
+
"type": "string",
|
|
44
|
+
"format": "html-selector",
|
|
45
|
+
"description": "The HTML selector to use for this component.",
|
|
46
|
+
"progress:editorVisible": false
|
|
47
|
+
},
|
|
48
|
+
"type": {
|
|
49
|
+
"type": "string",
|
|
50
|
+
"description": "Adds a developer-defined type to the filename, in the format \"name.type.ts\".",
|
|
51
|
+
"default": "Component",
|
|
52
|
+
"progress:editorVisible": false
|
|
53
|
+
},
|
|
54
|
+
"displayBlock": {
|
|
55
|
+
"description": "Specifies if the style will contain `:host { display: block; }`.",
|
|
56
|
+
"type": "boolean",
|
|
57
|
+
"default": false,
|
|
58
|
+
"alias": "b",
|
|
59
|
+
"progress:editorVisible": false
|
|
60
|
+
},
|
|
61
|
+
"standalone": {
|
|
62
|
+
"description": "Whether the generated component is standalone.",
|
|
63
|
+
"type": "boolean",
|
|
64
|
+
"default": false,
|
|
65
|
+
"x-user-analytics": 15,
|
|
66
|
+
"progress:editorVisible": false
|
|
67
|
+
},
|
|
68
|
+
"changeDetection": {
|
|
69
|
+
"description": "The change detection strategy to use in the new component.",
|
|
70
|
+
"enum": ["Default", "OnPush"],
|
|
71
|
+
"type": "string",
|
|
72
|
+
"default": "Default",
|
|
73
|
+
"alias": "c",
|
|
74
|
+
"progress:editorVisible": false
|
|
75
|
+
},
|
|
76
|
+
"viewEncapsulation": {
|
|
77
|
+
"description": "The view encapsulation strategy to use in the new component.",
|
|
78
|
+
"enum": ["Emulated", "None", "ShadowDom"],
|
|
79
|
+
"type": "string",
|
|
80
|
+
"alias": "v",
|
|
81
|
+
"x-user-analytics": 11,
|
|
82
|
+
"progress:editorVisible": false
|
|
83
|
+
},
|
|
84
|
+
"skipSelector": {
|
|
85
|
+
"type": "boolean",
|
|
86
|
+
"default": false,
|
|
87
|
+
"description": "Specifies if the component should have a selector or not.",
|
|
88
|
+
"progress:editorVisible": false
|
|
20
89
|
},
|
|
21
90
|
|
|
22
91
|
"inlineTemplate": {
|
|
@@ -27,6 +96,13 @@
|
|
|
27
96
|
"default": false,
|
|
28
97
|
"alias": "t"
|
|
29
98
|
},
|
|
99
|
+
"style": {
|
|
100
|
+
"description": "The file extension or preprocessor to use for style files, or 'none' to skip generating the style file.",
|
|
101
|
+
"type": "string",
|
|
102
|
+
"default": "css",
|
|
103
|
+
"enum": ["css", "scss", "sass", "less", "none"],
|
|
104
|
+
"x-user-analytics": "ep.ng_style"
|
|
105
|
+
},
|
|
30
106
|
"inlineStyle": {
|
|
31
107
|
"progress:category": "Code Generation",
|
|
32
108
|
"description": "Include styles inline in the component.ts file. Only CSS styles can be included inline. By default, an external styles file is created and referenced in the component.ts file.",
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2023 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
const createReboundMethod = (target, source, name) => {
|
|
6
|
+
const method = source[name];
|
|
7
|
+
if (typeof method !== 'function') {
|
|
8
|
+
throw new Error(`Attempt to rebind ${name} which isn't a function on the source object`);
|
|
9
|
+
}
|
|
10
|
+
return (...args) => {
|
|
11
|
+
var value = method.apply(source, args);
|
|
12
|
+
return value === source ? target : value;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const createTransform = (transforms) =>
|
|
17
|
+
(name) => transforms.reduce(
|
|
18
|
+
(name, fn) => name && fn(name),
|
|
19
|
+
name
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
const rebindAll = (target, source, ...transforms) => {
|
|
23
|
+
const transform = createTransform(transforms);
|
|
24
|
+
for (const name of Object.keys(source)) {
|
|
25
|
+
const result = transform(name);
|
|
26
|
+
if (result) {
|
|
27
|
+
target[result] = createReboundMethod(target, source, name);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
32
|
+
exports.rebindAll = rebindAll;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2023 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
// The following source code is copied from https://github.com/d3/d3-time
|
|
6
|
+
|
|
7
|
+
// Copyright 2010-2022 Mike Bostock
|
|
8
|
+
|
|
9
|
+
// Permission to use, copy, modify, and/or distribute this software for any purpose
|
|
10
|
+
// with or without fee is hereby granted, provided that the above copyright notice
|
|
11
|
+
// and this permission notice appear in all copies.
|
|
12
|
+
|
|
13
|
+
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
14
|
+
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
15
|
+
// FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
16
|
+
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
17
|
+
// OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
18
|
+
// TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
|
19
|
+
// THIS SOFTWARE.
|
|
20
|
+
|
|
21
|
+
const { timeInterval } = require("./interval");
|
|
22
|
+
const { durationDay, durationMinute } = require("./duration");
|
|
23
|
+
|
|
24
|
+
const timeDay = timeInterval(
|
|
25
|
+
date => date.setHours(0, 0, 0, 0),
|
|
26
|
+
(date, step) => date.setDate(date.getDate() + step),
|
|
27
|
+
(start, end) => (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationDay,
|
|
28
|
+
date => date.getDate() - 1
|
|
29
|
+
);
|
|
30
|
+
module.exports.timeDay = timeDay;
|
|
31
|
+
|
|
32
|
+
const timeDays = timeDay.range;
|
|
33
|
+
module.exports.timeDays = timeDays;
|
|
34
|
+
|
|
35
|
+
const utcDay = timeInterval((date) => {
|
|
36
|
+
date.setUTCHours(0, 0, 0, 0);
|
|
37
|
+
}, (date, step) => {
|
|
38
|
+
date.setUTCDate(date.getUTCDate() + step);
|
|
39
|
+
}, (start, end) => {
|
|
40
|
+
return (end - start) / durationDay;
|
|
41
|
+
}, (date) => {
|
|
42
|
+
return date.getUTCDate() - 1;
|
|
43
|
+
});
|
|
44
|
+
module.exports.utcDay = utcDay;
|
|
45
|
+
|
|
46
|
+
const utcDays = utcDay.range;
|
|
47
|
+
module.exports.utcDays = utcDay.range;
|
|
48
|
+
|
|
49
|
+
const unixDay = timeInterval((date) => {
|
|
50
|
+
date.setUTCHours(0, 0, 0, 0);
|
|
51
|
+
}, (date, step) => {
|
|
52
|
+
date.setUTCDate(date.getUTCDate() + step);
|
|
53
|
+
}, (start, end) => {
|
|
54
|
+
return (end - start) / durationDay;
|
|
55
|
+
}, (date) => {
|
|
56
|
+
return Math.floor(date / durationDay);
|
|
57
|
+
});
|
|
58
|
+
module.exports.unixDay = unixDay;
|
|
59
|
+
|
|
60
|
+
const unixDays = unixDay.range;
|
|
61
|
+
module.exports.unixDays = unixDays;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2023 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
// The following source code is copied from https://github.com/d3/d3-time
|
|
6
|
+
|
|
7
|
+
// Copyright 2010-2022 Mike Bostock
|
|
8
|
+
|
|
9
|
+
// Permission to use, copy, modify, and/or distribute this software for any purpose
|
|
10
|
+
// with or without fee is hereby granted, provided that the above copyright notice
|
|
11
|
+
// and this permission notice appear in all copies.
|
|
12
|
+
|
|
13
|
+
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
14
|
+
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
15
|
+
// FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
16
|
+
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
17
|
+
// OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
18
|
+
// TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
|
19
|
+
// THIS SOFTWARE.
|
|
20
|
+
|
|
21
|
+
const durationSecond = 1000;
|
|
22
|
+
module.exports.durationSecond = durationSecond;
|
|
23
|
+
const durationMinute = durationSecond * 60;
|
|
24
|
+
module.exports.durationMinute = durationMinute;
|
|
25
|
+
const durationHour = durationMinute * 60;
|
|
26
|
+
module.exports.durationHour = durationHour;
|
|
27
|
+
const durationDay = durationHour * 24;
|
|
28
|
+
module.exports.durationDay = durationDay;
|
|
29
|
+
const durationWeek = durationDay * 7;
|
|
30
|
+
module.exports.durationWeek = durationWeek;
|
|
31
|
+
const durationMonth = durationDay * 30;
|
|
32
|
+
module.exports.durationMonth = durationMonth;
|
|
33
|
+
const durationYear = durationDay * 365;
|
|
34
|
+
module.exports.durationYear = durationYear;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2023 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
// The following source code is copied from https://github.com/d3fc/d3fc
|
|
6
|
+
|
|
7
|
+
// The MIT License (MIT)
|
|
8
|
+
|
|
9
|
+
// Copyright (c) 2015-2019 Scott Logic Ltd.
|
|
10
|
+
|
|
11
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
// of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
// in the Software without restriction, including without limitation the rights
|
|
14
|
+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
// copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
// furnished to do so, subject to the following conditions:
|
|
17
|
+
|
|
18
|
+
// The above copyright notice and this permission notice shall be included in
|
|
19
|
+
// all copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
27
|
+
// THE SOFTWARE.
|
|
28
|
+
|
|
29
|
+
module.exports = function(datum) {
|
|
30
|
+
const day = datum.date.getDay();
|
|
31
|
+
return !(day === 0 || day === 6);
|
|
32
|
+
}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2023 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
// The following source code is copied from https://github.com/d3fc/d3fc
|
|
6
|
+
|
|
7
|
+
// The MIT License (MIT)
|
|
8
|
+
|
|
9
|
+
// Copyright (c) 2015-2019 Scott Logic Ltd.
|
|
10
|
+
|
|
11
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
// of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
// in the Software without restriction, including without limitation the rights
|
|
14
|
+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
// copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
// furnished to do so, subject to the following conditions:
|
|
17
|
+
|
|
18
|
+
// The above copyright notice and this permission notice shall be included in
|
|
19
|
+
// all copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
27
|
+
// THE SOFTWARE.
|
|
28
|
+
|
|
29
|
+
const geometricBrownianMotion = require('./geometricBrownianMotion');
|
|
30
|
+
const randomNormal = require('./randomNormal');
|
|
31
|
+
const { rebindAll } = require('./d3fc-rebind/rebindAll');
|
|
32
|
+
// const { timeDay, timeYear } = require('d3-time');
|
|
33
|
+
const { timeDay } = require("./day");
|
|
34
|
+
const { timeYear } = require("./year");
|
|
35
|
+
const { functor } = require('./fn');
|
|
36
|
+
|
|
37
|
+
module.exports = function() {
|
|
38
|
+
let startDate = new Date();
|
|
39
|
+
let startPrice = 100;
|
|
40
|
+
let interval = timeDay;
|
|
41
|
+
let intervalStep = 1;
|
|
42
|
+
let unitInterval = timeYear;
|
|
43
|
+
let unitIntervalStep = 1;
|
|
44
|
+
let filter = null;
|
|
45
|
+
let volume = () => {
|
|
46
|
+
const normal = randomNormal(1, 0.1);
|
|
47
|
+
return Math.ceil(normal() * 1000);
|
|
48
|
+
};
|
|
49
|
+
const gbm = geometricBrownianMotion();
|
|
50
|
+
|
|
51
|
+
const getOffsetPeriod = date => {
|
|
52
|
+
const unitMilliseconds = unitInterval.offset(date, unitIntervalStep) - date;
|
|
53
|
+
return (interval.offset(date, intervalStep) - date) / unitMilliseconds;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const calculateOHLC = (start, price) => {
|
|
57
|
+
const period = getOffsetPeriod(start);
|
|
58
|
+
const prices = gbm.period(period)(price);
|
|
59
|
+
const ohlc = {
|
|
60
|
+
date: start,
|
|
61
|
+
open: prices[0],
|
|
62
|
+
high: Math.max.apply(Math, prices),
|
|
63
|
+
low: Math.min.apply(Math, prices),
|
|
64
|
+
close: prices[gbm.steps()]
|
|
65
|
+
};
|
|
66
|
+
ohlc.volume = volume(ohlc);
|
|
67
|
+
return ohlc;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const getNextDatum = ohlc => {
|
|
71
|
+
let date, price, filtered;
|
|
72
|
+
do {
|
|
73
|
+
date = ohlc ? interval.offset(ohlc.date, intervalStep) : new Date(startDate.getTime());
|
|
74
|
+
price = ohlc ? ohlc.close : startPrice;
|
|
75
|
+
ohlc = calculateOHLC(date, price);
|
|
76
|
+
filtered = filter && !filter(ohlc);
|
|
77
|
+
} while (filtered);
|
|
78
|
+
return ohlc;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const makeStream = () => {
|
|
82
|
+
let latest;
|
|
83
|
+
const stream = {};
|
|
84
|
+
stream.next = () => {
|
|
85
|
+
const ohlc = getNextDatum(latest);
|
|
86
|
+
latest = ohlc;
|
|
87
|
+
return ohlc;
|
|
88
|
+
};
|
|
89
|
+
stream.take = numPoints => stream.until((d, i) => !numPoints || numPoints < 0 || i === numPoints);
|
|
90
|
+
stream.until = comparison => {
|
|
91
|
+
const data = [];
|
|
92
|
+
let index = 0;
|
|
93
|
+
let ohlc = getNextDatum(latest);
|
|
94
|
+
let compared = comparison && !comparison(ohlc, index);
|
|
95
|
+
while (compared) {
|
|
96
|
+
data.push(ohlc);
|
|
97
|
+
latest = ohlc;
|
|
98
|
+
ohlc = getNextDatum(latest);
|
|
99
|
+
index += 1;
|
|
100
|
+
compared = comparison && !comparison(ohlc, index);
|
|
101
|
+
}
|
|
102
|
+
return data;
|
|
103
|
+
};
|
|
104
|
+
return stream;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
const financial = numPoints => makeStream().take(numPoints);
|
|
108
|
+
financial.stream = makeStream;
|
|
109
|
+
|
|
110
|
+
if (typeof Symbol !== 'function' || typeof Symbol.iterator !== 'symbol') {
|
|
111
|
+
throw new Error('d3fc-random-data depends on Symbol. Make sure that you load a polyfill in older browsers. See README.');
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
financial[Symbol.iterator] = () => {
|
|
115
|
+
const stream = makeStream();
|
|
116
|
+
return {
|
|
117
|
+
next: () => ({
|
|
118
|
+
value: stream.next(),
|
|
119
|
+
done: false
|
|
120
|
+
})
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
financial.startDate = (...args) => {
|
|
125
|
+
if (!args.length) {
|
|
126
|
+
return startDate;
|
|
127
|
+
}
|
|
128
|
+
startDate = args[0];
|
|
129
|
+
return financial;
|
|
130
|
+
};
|
|
131
|
+
financial.startPrice = (...args) => {
|
|
132
|
+
if (!args.length) {
|
|
133
|
+
return startPrice;
|
|
134
|
+
}
|
|
135
|
+
startPrice = args[0];
|
|
136
|
+
return financial;
|
|
137
|
+
};
|
|
138
|
+
financial.interval = (...args) => {
|
|
139
|
+
if (!args.length) {
|
|
140
|
+
return interval;
|
|
141
|
+
}
|
|
142
|
+
interval = args[0];
|
|
143
|
+
return financial;
|
|
144
|
+
};
|
|
145
|
+
financial.intervalStep = (...args) => {
|
|
146
|
+
if (!args.length) {
|
|
147
|
+
return intervalStep;
|
|
148
|
+
}
|
|
149
|
+
intervalStep = args[0];
|
|
150
|
+
return financial;
|
|
151
|
+
};
|
|
152
|
+
financial.unitInterval = (...args) => {
|
|
153
|
+
if (!args.length) {
|
|
154
|
+
return unitInterval;
|
|
155
|
+
}
|
|
156
|
+
unitInterval = args[0];
|
|
157
|
+
return financial;
|
|
158
|
+
};
|
|
159
|
+
financial.unitIntervalStep = (...args) => {
|
|
160
|
+
if (!args.length) {
|
|
161
|
+
return unitIntervalStep;
|
|
162
|
+
}
|
|
163
|
+
unitIntervalStep = args[0];
|
|
164
|
+
return financial;
|
|
165
|
+
};
|
|
166
|
+
financial.filter = (...args) => {
|
|
167
|
+
if (!args.length) {
|
|
168
|
+
return filter;
|
|
169
|
+
}
|
|
170
|
+
filter = args[0];
|
|
171
|
+
return financial;
|
|
172
|
+
};
|
|
173
|
+
financial.volume = (...args) => {
|
|
174
|
+
if (!args.length) {
|
|
175
|
+
return volume;
|
|
176
|
+
}
|
|
177
|
+
volume = functor(args[0]);
|
|
178
|
+
return financial;
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
rebindAll(financial, gbm);
|
|
182
|
+
|
|
183
|
+
return financial;
|
|
184
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2023 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
// The following source code is copied from https://github.com/d3fc/d3fc
|
|
6
|
+
|
|
7
|
+
// The MIT License (MIT)
|
|
8
|
+
|
|
9
|
+
// Copyright (c) 2015-2019 Scott Logic Ltd.
|
|
10
|
+
|
|
11
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
// of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
// in the Software without restriction, including without limitation the rights
|
|
14
|
+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
// copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
// furnished to do so, subject to the following conditions:
|
|
17
|
+
|
|
18
|
+
// The above copyright notice and this permission notice shall be included in
|
|
19
|
+
// all copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
27
|
+
// THE SOFTWARE.
|
|
28
|
+
|
|
29
|
+
module.exports.functor = function functor(v) {
|
|
30
|
+
return typeof v === 'function' ? v : () => v;
|
|
31
|
+
}
|