polymatica-widget 2.0.16 → 2.0.17
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/__internal__/widget-options.js +3 -3
- package/config.d.ts +161 -6
- package/config.js +108 -7
- package/index.d.ts +0 -2
- package/index.js +0 -2
- package/package.json +3 -1
- package/widget.d.ts +13 -10
- package/widget-config.d.ts +0 -141
- package/widget-config.js +0 -89
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getSpan = exports.valueConversion = exports.WidgetOptionType = void 0;
|
|
4
|
-
const
|
|
4
|
+
const config_1 = require("../config");
|
|
5
5
|
var WidgetOptionType;
|
|
6
6
|
(function (WidgetOptionType) {
|
|
7
7
|
// Layout
|
|
@@ -71,8 +71,8 @@ function parseDate(source) {
|
|
|
71
71
|
}
|
|
72
72
|
function getSpan(source) {
|
|
73
73
|
const span = source | 0;
|
|
74
|
-
if (span >
|
|
75
|
-
return
|
|
74
|
+
if (span > config_1.STEP)
|
|
75
|
+
return config_1.STEP;
|
|
76
76
|
if (span < 0)
|
|
77
77
|
return 0;
|
|
78
78
|
return span;
|
package/config.d.ts
CHANGED
|
@@ -1,11 +1,166 @@
|
|
|
1
|
+
import { Column } from './dataset';
|
|
1
2
|
import { Text } from './locale';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
size: WidgetSize | [WidgetSize, WidgetSize];
|
|
6
|
-
}
|
|
7
|
-
export declare enum WidgetSize {
|
|
3
|
+
import { Options } from './widget';
|
|
4
|
+
import { WidgetOptionConfig } from './__internal__/widget-options';
|
|
5
|
+
export declare enum Size {
|
|
8
6
|
Small = "small",
|
|
9
7
|
Medium = "medium",
|
|
10
8
|
Large = "large"
|
|
11
9
|
}
|
|
10
|
+
export declare enum Method {
|
|
11
|
+
Aggregate = "aggregate",
|
|
12
|
+
Table = "table",
|
|
13
|
+
PivotTable = "pivot"
|
|
14
|
+
}
|
|
15
|
+
export interface WidgetConfig {
|
|
16
|
+
label: Text;
|
|
17
|
+
icon: string;
|
|
18
|
+
size: Size | [Size, Size];
|
|
19
|
+
}
|
|
20
|
+
export interface SingleData {
|
|
21
|
+
data: DataConfig;
|
|
22
|
+
}
|
|
23
|
+
export declare type MultiData<DataItemKeys extends string, RepeatableKeys extends DataItemKeys = never> = {
|
|
24
|
+
data: {
|
|
25
|
+
[Key in DataItemKeys]: Key extends RepeatableKeys ? DataConfig & Repeatable : DataConfig;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export interface Repeatable {
|
|
29
|
+
repeatable: true | {
|
|
30
|
+
min?: number;
|
|
31
|
+
max?: number;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export interface DataConfig {
|
|
35
|
+
method: Method;
|
|
36
|
+
blocks: Block[];
|
|
37
|
+
validation?: {
|
|
38
|
+
requiredSome?: string[];
|
|
39
|
+
requiredEvery?: string[];
|
|
40
|
+
};
|
|
41
|
+
drilldown?: {
|
|
42
|
+
sources: string[];
|
|
43
|
+
};
|
|
44
|
+
heatmap?: {
|
|
45
|
+
targets: string[];
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export interface Block {
|
|
49
|
+
key: string;
|
|
50
|
+
label: Text;
|
|
51
|
+
icon?: string;
|
|
52
|
+
aggregation?: boolean;
|
|
53
|
+
max?: number;
|
|
54
|
+
}
|
|
55
|
+
export interface OptionsConfig {
|
|
56
|
+
provider: OptionsProvider;
|
|
57
|
+
default: Options;
|
|
58
|
+
validators?: OptionsValidation;
|
|
59
|
+
}
|
|
60
|
+
declare class Option {
|
|
61
|
+
readonly config: WidgetOptionConfig;
|
|
62
|
+
constructor(_: symbol, config: WidgetOptionConfig);
|
|
63
|
+
}
|
|
64
|
+
export declare const STEP = 24;
|
|
65
|
+
export declare type OptionsProvider<Data extends SelectedData | SelectedMultiData<string> | SelectedMultiData<any, string> | undefined = undefined> = (options: Options, data: Data) => Option[];
|
|
66
|
+
export interface SelectedData {
|
|
67
|
+
columns: Column[];
|
|
68
|
+
columnsByBlock: {
|
|
69
|
+
[blockKey: string]: Column[];
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
export declare type SelectedMultiData<DataItemKeys extends string, RepeatableKeys extends DataItemKeys = never> = {
|
|
73
|
+
[Key in DataItemKeys]: Key extends RepeatableKeys ? SelectedData[] : SelectedData;
|
|
74
|
+
};
|
|
75
|
+
export declare function title(label: Text, params?: {
|
|
76
|
+
hint: Text;
|
|
77
|
+
}): Option;
|
|
78
|
+
export declare function label(label: Text, params?: {
|
|
79
|
+
hint: Text;
|
|
80
|
+
}): Option;
|
|
81
|
+
export declare function spacer(span: number): Option;
|
|
82
|
+
export declare function line(): Option;
|
|
83
|
+
export declare function text(params: {
|
|
84
|
+
key: string;
|
|
85
|
+
label: Text;
|
|
86
|
+
span?: number;
|
|
87
|
+
}): Option;
|
|
88
|
+
export declare function number(params: {
|
|
89
|
+
key: string;
|
|
90
|
+
label: Text;
|
|
91
|
+
span?: number;
|
|
92
|
+
}): Option;
|
|
93
|
+
export declare function integer(params: {
|
|
94
|
+
key: string;
|
|
95
|
+
label: Text;
|
|
96
|
+
span?: number;
|
|
97
|
+
}): Option;
|
|
98
|
+
export declare function range(params: {
|
|
99
|
+
key: string;
|
|
100
|
+
label: Text;
|
|
101
|
+
span?: number;
|
|
102
|
+
}): Option;
|
|
103
|
+
export declare function interval(params: {
|
|
104
|
+
key: string;
|
|
105
|
+
label: Text;
|
|
106
|
+
span?: number;
|
|
107
|
+
}): Option;
|
|
108
|
+
export declare function date(params: {
|
|
109
|
+
key: string;
|
|
110
|
+
label: Text;
|
|
111
|
+
span?: number;
|
|
112
|
+
}): Option;
|
|
113
|
+
export declare function time(params: {
|
|
114
|
+
key: string;
|
|
115
|
+
label: Text;
|
|
116
|
+
span?: number;
|
|
117
|
+
}): Option;
|
|
118
|
+
export declare function dateTime(params: {
|
|
119
|
+
key: string;
|
|
120
|
+
label: Text;
|
|
121
|
+
span?: number;
|
|
122
|
+
}): Option;
|
|
123
|
+
export declare function checkbox(params: {
|
|
124
|
+
key: string;
|
|
125
|
+
label: Text;
|
|
126
|
+
span?: number;
|
|
127
|
+
}): Option;
|
|
128
|
+
export declare function radio(params: {
|
|
129
|
+
key: string;
|
|
130
|
+
label: Text;
|
|
131
|
+
options: {
|
|
132
|
+
label: Text;
|
|
133
|
+
value: string;
|
|
134
|
+
}[];
|
|
135
|
+
span?: number;
|
|
136
|
+
}): Option;
|
|
137
|
+
export declare function radioButton(params: {
|
|
138
|
+
key: string;
|
|
139
|
+
label: Text;
|
|
140
|
+
options: {
|
|
141
|
+
label: Text;
|
|
142
|
+
value: string;
|
|
143
|
+
}[];
|
|
144
|
+
span?: number;
|
|
145
|
+
}): Option;
|
|
146
|
+
export declare function select(params: {
|
|
147
|
+
key: string;
|
|
148
|
+
label: Text;
|
|
149
|
+
options: {
|
|
150
|
+
label: Text;
|
|
151
|
+
value: string;
|
|
152
|
+
}[];
|
|
153
|
+
span?: number;
|
|
154
|
+
}): Option;
|
|
155
|
+
export declare function colorPicker(params: {
|
|
156
|
+
key: string;
|
|
157
|
+
label: Text;
|
|
158
|
+
span?: number;
|
|
159
|
+
}): Option;
|
|
160
|
+
export interface OptionsValidation {
|
|
161
|
+
[key: string]: OptionsValidator;
|
|
162
|
+
}
|
|
163
|
+
export interface OptionsValidator {
|
|
164
|
+
(value: any): Text | null;
|
|
165
|
+
}
|
|
166
|
+
export {};
|
package/config.js
CHANGED
|
@@ -1,9 +1,110 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
exports.colorPicker = exports.select = exports.radioButton = exports.radio = exports.checkbox = exports.dateTime = exports.time = exports.date = exports.interval = exports.range = exports.integer = exports.number = exports.text = exports.line = exports.spacer = exports.label = exports.title = exports.STEP = exports.Method = exports.Size = void 0;
|
|
4
|
+
const widget_options_1 = require("./__internal__/widget-options");
|
|
5
|
+
// enums
|
|
6
|
+
var Size;
|
|
7
|
+
(function (Size) {
|
|
8
|
+
Size["Small"] = "small";
|
|
9
|
+
Size["Medium"] = "medium";
|
|
10
|
+
Size["Large"] = "large";
|
|
11
|
+
})(Size = exports.Size || (exports.Size = {}));
|
|
12
|
+
var Method;
|
|
13
|
+
(function (Method) {
|
|
14
|
+
Method["Aggregate"] = "aggregate";
|
|
15
|
+
Method["Table"] = "table";
|
|
16
|
+
Method["PivotTable"] = "pivot";
|
|
17
|
+
})(Method = exports.Method || (exports.Method = {}));
|
|
18
|
+
// widget options
|
|
19
|
+
const token = Symbol();
|
|
20
|
+
class Option {
|
|
21
|
+
constructor(_, config) {
|
|
22
|
+
if (_ !== token)
|
|
23
|
+
throw '';
|
|
24
|
+
Object.defineProperty(this, 'config', {
|
|
25
|
+
get() {
|
|
26
|
+
return Object.seal(config);
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.STEP = 24;
|
|
32
|
+
// layout
|
|
33
|
+
function title(label, params) {
|
|
34
|
+
const options = [];
|
|
35
|
+
if (params === null || params === void 0 ? void 0 : params.hint)
|
|
36
|
+
options.push({ label: params.hint, value: 0 });
|
|
37
|
+
return new Option(token, { type: widget_options_1.WidgetOptionType.Title, label });
|
|
38
|
+
}
|
|
39
|
+
exports.title = title;
|
|
40
|
+
function label(label, params) {
|
|
41
|
+
const options = [];
|
|
42
|
+
if (params === null || params === void 0 ? void 0 : params.hint)
|
|
43
|
+
options.push({ label: params.hint, value: 0 });
|
|
44
|
+
return new Option(token, { type: widget_options_1.WidgetOptionType.Label, label, options });
|
|
45
|
+
}
|
|
46
|
+
exports.label = label;
|
|
47
|
+
function spacer(span) {
|
|
48
|
+
return new Option(token, { type: widget_options_1.WidgetOptionType.Spacer, span });
|
|
49
|
+
}
|
|
50
|
+
exports.spacer = spacer;
|
|
51
|
+
function line() {
|
|
52
|
+
return new Option(token, {
|
|
53
|
+
type: widget_options_1.WidgetOptionType.LineHorizontal,
|
|
54
|
+
span: 0,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
exports.line = line;
|
|
58
|
+
// controls
|
|
59
|
+
function text(params) {
|
|
60
|
+
return new Option(token, Object.assign({ type: widget_options_1.WidgetOptionType.Text }, params));
|
|
61
|
+
}
|
|
62
|
+
exports.text = text;
|
|
63
|
+
function number(params) {
|
|
64
|
+
return new Option(token, Object.assign({ type: widget_options_1.WidgetOptionType.Number }, params));
|
|
65
|
+
}
|
|
66
|
+
exports.number = number;
|
|
67
|
+
function integer(params) {
|
|
68
|
+
return new Option(token, Object.assign({ type: widget_options_1.WidgetOptionType.Integer }, params));
|
|
69
|
+
}
|
|
70
|
+
exports.integer = integer;
|
|
71
|
+
function range(params) {
|
|
72
|
+
return new Option(token, Object.assign({ type: widget_options_1.WidgetOptionType.Range }, params));
|
|
73
|
+
}
|
|
74
|
+
exports.range = range;
|
|
75
|
+
function interval(params) {
|
|
76
|
+
return new Option(token, Object.assign({ type: widget_options_1.WidgetOptionType.Interval }, params));
|
|
77
|
+
}
|
|
78
|
+
exports.interval = interval;
|
|
79
|
+
function date(params) {
|
|
80
|
+
return new Option(token, Object.assign({ type: widget_options_1.WidgetOptionType.Date }, params));
|
|
81
|
+
}
|
|
82
|
+
exports.date = date;
|
|
83
|
+
function time(params) {
|
|
84
|
+
return new Option(token, Object.assign({ type: widget_options_1.WidgetOptionType.Time }, params));
|
|
85
|
+
}
|
|
86
|
+
exports.time = time;
|
|
87
|
+
function dateTime(params) {
|
|
88
|
+
return new Option(token, Object.assign({ type: widget_options_1.WidgetOptionType.DateTime }, params));
|
|
89
|
+
}
|
|
90
|
+
exports.dateTime = dateTime;
|
|
91
|
+
function checkbox(params) {
|
|
92
|
+
return new Option(token, Object.assign({ type: widget_options_1.WidgetOptionType.Checkbox }, params));
|
|
93
|
+
}
|
|
94
|
+
exports.checkbox = checkbox;
|
|
95
|
+
function radio(params) {
|
|
96
|
+
return new Option(token, Object.assign({ type: widget_options_1.WidgetOptionType.Radio }, params));
|
|
97
|
+
}
|
|
98
|
+
exports.radio = radio;
|
|
99
|
+
function radioButton(params) {
|
|
100
|
+
return new Option(token, Object.assign({ type: widget_options_1.WidgetOptionType.RadioButtons }, params));
|
|
101
|
+
}
|
|
102
|
+
exports.radioButton = radioButton;
|
|
103
|
+
function select(params) {
|
|
104
|
+
return new Option(token, Object.assign({ type: widget_options_1.WidgetOptionType.Select }, params));
|
|
105
|
+
}
|
|
106
|
+
exports.select = select;
|
|
107
|
+
function colorPicker(params) {
|
|
108
|
+
return new Option(token, Object.assign({ type: widget_options_1.WidgetOptionType.ColorPicker }, params));
|
|
109
|
+
}
|
|
110
|
+
exports.colorPicker = colorPicker;
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -14,10 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./config"), exports);
|
|
18
17
|
__exportStar(require("./dataset"), exports);
|
|
19
18
|
__exportStar(require("./declare"), exports);
|
|
20
19
|
__exportStar(require("./locale"), exports);
|
|
21
20
|
__exportStar(require("./theme"), exports);
|
|
22
|
-
__exportStar(require("./widget-config"), exports);
|
|
23
21
|
__exportStar(require("./widget"), exports);
|
package/package.json
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "polymatica-widget",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.17",
|
|
4
4
|
"description": "SDK для создания виджетов для платформы Polymatica",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "ISC",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"dependencies": {
|
|
9
|
+
"-": "^0.0.1",
|
|
10
|
+
"D": "^1.0.0",
|
|
9
11
|
"logical-not": "^1.0.9"
|
|
10
12
|
}
|
|
11
13
|
}
|
package/widget.d.ts
CHANGED
|
@@ -15,18 +15,20 @@ export declare abstract class Widget {
|
|
|
15
15
|
export interface SingleData {
|
|
16
16
|
readonly dataset: Dataset;
|
|
17
17
|
}
|
|
18
|
-
export interface MultiData {
|
|
19
|
-
readonly datasets:
|
|
20
|
-
[datasetKey: string]: Dataset;
|
|
21
|
-
};
|
|
18
|
+
export interface MultiData<DataKeys extends string> {
|
|
19
|
+
readonly datasets: Record<DataKeys, Dataset>;
|
|
22
20
|
}
|
|
23
|
-
export declare type Repeatable<
|
|
21
|
+
export declare type Repeatable<Data extends SingleData | MultiData<string>, RepeatableKeys extends GetMultiDataKeys<Data> | never = never> = Data extends SingleData ? {
|
|
24
22
|
readonly datasets: Dataset[];
|
|
25
|
-
} : {
|
|
26
|
-
readonly datasets:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
} : RepeatableKeys extends string ? {
|
|
24
|
+
readonly datasets: Record<Exclude<GetMultiDataKeys<Data>, RepeatableKeys>, Dataset> & Record<RepeatableKeys, Dataset[]>;
|
|
25
|
+
} : never;
|
|
26
|
+
declare type GetMultiDataKeys<T> = T extends MultiData<infer U> ? U : never;
|
|
27
|
+
export declare type Provide<T> = T extends {
|
|
28
|
+
dataset: infer U;
|
|
29
|
+
} ? U : T extends {
|
|
30
|
+
datasets: infer U;
|
|
31
|
+
} ? U : never;
|
|
30
32
|
export interface Dataset {
|
|
31
33
|
columns: Column[];
|
|
32
34
|
columnsByBlock: {
|
|
@@ -49,3 +51,4 @@ export declare enum WidgetRenderEnv {
|
|
|
49
51
|
Default = "default",
|
|
50
52
|
Print = "print"
|
|
51
53
|
}
|
|
54
|
+
export {};
|
package/widget-config.d.ts
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import { Text } from './locale';
|
|
2
|
-
import { Options } from './widget';
|
|
3
|
-
import { WidgetOptionConfig } from './__internal__/widget-options';
|
|
4
|
-
export declare enum DataQueryMethod {
|
|
5
|
-
Aggregate = "aggregate",
|
|
6
|
-
Table = "table",
|
|
7
|
-
PivotTable = "pivot"
|
|
8
|
-
}
|
|
9
|
-
export interface WidgetConfig {
|
|
10
|
-
data?: {
|
|
11
|
-
config: DataConfig | (DataConfig & WithKey)[];
|
|
12
|
-
};
|
|
13
|
-
options?: {
|
|
14
|
-
provider: GetWidgetOptionsConfig;
|
|
15
|
-
default: Options;
|
|
16
|
-
validators?: OptionsValidation;
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
export interface DataConfig {
|
|
20
|
-
method: DataQueryMethod;
|
|
21
|
-
blocks: Block[];
|
|
22
|
-
validation?: {
|
|
23
|
-
requiredSome?: string[];
|
|
24
|
-
requiredEvery?: string[];
|
|
25
|
-
};
|
|
26
|
-
repeatable?: boolean | {
|
|
27
|
-
min?: number;
|
|
28
|
-
max?: number;
|
|
29
|
-
};
|
|
30
|
-
drilldown?: {
|
|
31
|
-
sources: string[];
|
|
32
|
-
};
|
|
33
|
-
heatmap?: {
|
|
34
|
-
targets: string[];
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
export interface WithKey {
|
|
38
|
-
key: string;
|
|
39
|
-
}
|
|
40
|
-
export interface Block {
|
|
41
|
-
key: string;
|
|
42
|
-
label: Text;
|
|
43
|
-
icon?: string;
|
|
44
|
-
aggregation?: boolean;
|
|
45
|
-
max?: number;
|
|
46
|
-
}
|
|
47
|
-
export declare const STEP = 24;
|
|
48
|
-
export interface GetWidgetOptionsConfig {
|
|
49
|
-
(options: Options): WidgetOptionConfig[];
|
|
50
|
-
}
|
|
51
|
-
export declare function title(label: Text, params?: {
|
|
52
|
-
hint: Text;
|
|
53
|
-
}): WidgetOptionConfig;
|
|
54
|
-
export declare function label(label: Text, params?: {
|
|
55
|
-
hint: Text;
|
|
56
|
-
}): WidgetOptionConfig;
|
|
57
|
-
export declare function spacer(span: number): WidgetOptionConfig;
|
|
58
|
-
export declare function line(): WidgetOptionConfig;
|
|
59
|
-
export declare function text(params: {
|
|
60
|
-
key: string;
|
|
61
|
-
label: Text;
|
|
62
|
-
span?: number;
|
|
63
|
-
}): WidgetOptionConfig;
|
|
64
|
-
export declare function number(params: {
|
|
65
|
-
key: string;
|
|
66
|
-
label: Text;
|
|
67
|
-
span?: number;
|
|
68
|
-
}): WidgetOptionConfig;
|
|
69
|
-
export declare function integer(params: {
|
|
70
|
-
key: string;
|
|
71
|
-
label: Text;
|
|
72
|
-
span?: number;
|
|
73
|
-
}): WidgetOptionConfig;
|
|
74
|
-
export declare function range(params: {
|
|
75
|
-
key: string;
|
|
76
|
-
label: Text;
|
|
77
|
-
span?: number;
|
|
78
|
-
}): WidgetOptionConfig;
|
|
79
|
-
export declare function interval(params: {
|
|
80
|
-
key: string;
|
|
81
|
-
label: Text;
|
|
82
|
-
span?: number;
|
|
83
|
-
}): WidgetOptionConfig;
|
|
84
|
-
export declare function date(params: {
|
|
85
|
-
key: string;
|
|
86
|
-
label: Text;
|
|
87
|
-
span?: number;
|
|
88
|
-
}): WidgetOptionConfig;
|
|
89
|
-
export declare function time(params: {
|
|
90
|
-
key: string;
|
|
91
|
-
label: Text;
|
|
92
|
-
span?: number;
|
|
93
|
-
}): WidgetOptionConfig;
|
|
94
|
-
export declare function dateTime(params: {
|
|
95
|
-
key: string;
|
|
96
|
-
label: Text;
|
|
97
|
-
span?: number;
|
|
98
|
-
}): WidgetOptionConfig;
|
|
99
|
-
export declare function checkbox(params: {
|
|
100
|
-
key: string;
|
|
101
|
-
label: Text;
|
|
102
|
-
span?: number;
|
|
103
|
-
}): WidgetOptionConfig;
|
|
104
|
-
export declare function radio(params: {
|
|
105
|
-
key: string;
|
|
106
|
-
label: Text;
|
|
107
|
-
options: {
|
|
108
|
-
label: Text;
|
|
109
|
-
value: string;
|
|
110
|
-
}[];
|
|
111
|
-
span?: number;
|
|
112
|
-
}): WidgetOptionConfig;
|
|
113
|
-
export declare function radioButton(params: {
|
|
114
|
-
key: string;
|
|
115
|
-
label: Text;
|
|
116
|
-
options: {
|
|
117
|
-
label: Text;
|
|
118
|
-
value: string;
|
|
119
|
-
}[];
|
|
120
|
-
span?: number;
|
|
121
|
-
}): WidgetOptionConfig;
|
|
122
|
-
export declare function select(params: {
|
|
123
|
-
key: string;
|
|
124
|
-
label: Text;
|
|
125
|
-
options: {
|
|
126
|
-
label: Text;
|
|
127
|
-
value: string;
|
|
128
|
-
}[];
|
|
129
|
-
span?: number;
|
|
130
|
-
}): WidgetOptionConfig;
|
|
131
|
-
export declare function colorPicker(params: {
|
|
132
|
-
key: string;
|
|
133
|
-
label: Text;
|
|
134
|
-
span?: number;
|
|
135
|
-
}): WidgetOptionConfig;
|
|
136
|
-
export interface OptionsValidation {
|
|
137
|
-
[key: string]: OptionsValidator;
|
|
138
|
-
}
|
|
139
|
-
export interface OptionsValidator {
|
|
140
|
-
(value: any): Text | null;
|
|
141
|
-
}
|
package/widget-config.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.colorPicker = exports.select = exports.radioButton = exports.radio = exports.checkbox = exports.dateTime = exports.time = exports.date = exports.interval = exports.range = exports.integer = exports.number = exports.text = exports.line = exports.spacer = exports.label = exports.title = exports.STEP = exports.DataQueryMethod = void 0;
|
|
4
|
-
const widget_options_1 = require("./__internal__/widget-options");
|
|
5
|
-
// enums
|
|
6
|
-
var DataQueryMethod;
|
|
7
|
-
(function (DataQueryMethod) {
|
|
8
|
-
DataQueryMethod["Aggregate"] = "aggregate";
|
|
9
|
-
DataQueryMethod["Table"] = "table";
|
|
10
|
-
DataQueryMethod["PivotTable"] = "pivot";
|
|
11
|
-
})(DataQueryMethod = exports.DataQueryMethod || (exports.DataQueryMethod = {}));
|
|
12
|
-
// widget options
|
|
13
|
-
exports.STEP = 24;
|
|
14
|
-
// layout
|
|
15
|
-
function title(label, params) {
|
|
16
|
-
const options = [];
|
|
17
|
-
if (params === null || params === void 0 ? void 0 : params.hint)
|
|
18
|
-
options.push({ label: params.hint, value: 0 });
|
|
19
|
-
return { type: widget_options_1.WidgetOptionType.Title, label };
|
|
20
|
-
}
|
|
21
|
-
exports.title = title;
|
|
22
|
-
function label(label, params) {
|
|
23
|
-
const options = [];
|
|
24
|
-
if (params === null || params === void 0 ? void 0 : params.hint)
|
|
25
|
-
options.push({ label: params.hint, value: 0 });
|
|
26
|
-
return { type: widget_options_1.WidgetOptionType.Label, label, options };
|
|
27
|
-
}
|
|
28
|
-
exports.label = label;
|
|
29
|
-
function spacer(span) {
|
|
30
|
-
return { type: widget_options_1.WidgetOptionType.Spacer, span };
|
|
31
|
-
}
|
|
32
|
-
exports.spacer = spacer;
|
|
33
|
-
function line() {
|
|
34
|
-
return { type: widget_options_1.WidgetOptionType.LineHorizontal, span: 0 };
|
|
35
|
-
}
|
|
36
|
-
exports.line = line;
|
|
37
|
-
// controls
|
|
38
|
-
function text(params) {
|
|
39
|
-
return Object.assign({ type: widget_options_1.WidgetOptionType.Text }, params);
|
|
40
|
-
}
|
|
41
|
-
exports.text = text;
|
|
42
|
-
function number(params) {
|
|
43
|
-
return Object.assign({ type: widget_options_1.WidgetOptionType.Number }, params);
|
|
44
|
-
}
|
|
45
|
-
exports.number = number;
|
|
46
|
-
function integer(params) {
|
|
47
|
-
return Object.assign({ type: widget_options_1.WidgetOptionType.Integer }, params);
|
|
48
|
-
}
|
|
49
|
-
exports.integer = integer;
|
|
50
|
-
function range(params) {
|
|
51
|
-
return Object.assign({ type: widget_options_1.WidgetOptionType.Range }, params);
|
|
52
|
-
}
|
|
53
|
-
exports.range = range;
|
|
54
|
-
function interval(params) {
|
|
55
|
-
return Object.assign({ type: widget_options_1.WidgetOptionType.Interval }, params);
|
|
56
|
-
}
|
|
57
|
-
exports.interval = interval;
|
|
58
|
-
function date(params) {
|
|
59
|
-
return Object.assign({ type: widget_options_1.WidgetOptionType.Date }, params);
|
|
60
|
-
}
|
|
61
|
-
exports.date = date;
|
|
62
|
-
function time(params) {
|
|
63
|
-
return Object.assign({ type: widget_options_1.WidgetOptionType.Time }, params);
|
|
64
|
-
}
|
|
65
|
-
exports.time = time;
|
|
66
|
-
function dateTime(params) {
|
|
67
|
-
return Object.assign({ type: widget_options_1.WidgetOptionType.DateTime }, params);
|
|
68
|
-
}
|
|
69
|
-
exports.dateTime = dateTime;
|
|
70
|
-
function checkbox(params) {
|
|
71
|
-
return Object.assign({ type: widget_options_1.WidgetOptionType.Checkbox }, params);
|
|
72
|
-
}
|
|
73
|
-
exports.checkbox = checkbox;
|
|
74
|
-
function radio(params) {
|
|
75
|
-
return Object.assign({ type: widget_options_1.WidgetOptionType.Radio }, params);
|
|
76
|
-
}
|
|
77
|
-
exports.radio = radio;
|
|
78
|
-
function radioButton(params) {
|
|
79
|
-
return Object.assign({ type: widget_options_1.WidgetOptionType.RadioButtons }, params);
|
|
80
|
-
}
|
|
81
|
-
exports.radioButton = radioButton;
|
|
82
|
-
function select(params) {
|
|
83
|
-
return Object.assign({ type: widget_options_1.WidgetOptionType.Select }, params);
|
|
84
|
-
}
|
|
85
|
-
exports.select = select;
|
|
86
|
-
function colorPicker(params) {
|
|
87
|
-
return Object.assign({ type: widget_options_1.WidgetOptionType.ColorPicker }, params);
|
|
88
|
-
}
|
|
89
|
-
exports.colorPicker = colorPicker;
|