polymatica-widget 2.1.2 → 2.1.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/__internal__/widget-options.js +2 -2
- package/config.d.ts +18 -22
- package/config.js +63 -29
- package/package.json +1 -1
package/config.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ColumnType } from "./dataset";
|
|
2
2
|
import { Text } from "./locale";
|
|
3
3
|
import { Options } from "./widget";
|
|
4
|
-
import { WidgetOptionConfig } from "./__internal__/widget-options";
|
|
5
4
|
export declare enum Size {
|
|
6
5
|
Small = "small",
|
|
7
6
|
Medium = "medium",
|
|
@@ -55,7 +54,7 @@ export interface Block {
|
|
|
55
54
|
}
|
|
56
55
|
export interface OptionsConfig {
|
|
57
56
|
options: {
|
|
58
|
-
provider(options: Options, data: unknown):
|
|
57
|
+
provider(options: Options, data: unknown): void;
|
|
59
58
|
default: Options;
|
|
60
59
|
validators?: OptionsValidation;
|
|
61
60
|
};
|
|
@@ -73,63 +72,60 @@ interface Column {
|
|
|
73
72
|
readonly name: string;
|
|
74
73
|
readonly type: ColumnType;
|
|
75
74
|
}
|
|
76
|
-
declare class Option {
|
|
77
|
-
constructor(config: WidgetOptionConfig);
|
|
78
|
-
}
|
|
79
75
|
export declare const STEP = 24;
|
|
80
76
|
export declare function title(label: Text, params?: {
|
|
81
77
|
hint: Text;
|
|
82
|
-
}):
|
|
78
|
+
}): void;
|
|
83
79
|
export declare function label(label: Text, params?: {
|
|
84
80
|
hint: Text;
|
|
85
|
-
}):
|
|
86
|
-
export declare function spacer(span: number):
|
|
87
|
-
export declare function line():
|
|
81
|
+
}): void;
|
|
82
|
+
export declare function spacer(span: number): void;
|
|
83
|
+
export declare function line(): void;
|
|
88
84
|
export declare function text(params: {
|
|
89
85
|
key: string;
|
|
90
86
|
label: Text;
|
|
91
87
|
span?: number;
|
|
92
|
-
}):
|
|
88
|
+
}): void;
|
|
93
89
|
export declare function number(params: {
|
|
94
90
|
key: string;
|
|
95
91
|
label: Text;
|
|
96
92
|
span?: number;
|
|
97
|
-
}):
|
|
93
|
+
}): void;
|
|
98
94
|
export declare function integer(params: {
|
|
99
95
|
key: string;
|
|
100
96
|
label: Text;
|
|
101
97
|
span?: number;
|
|
102
|
-
}):
|
|
98
|
+
}): void;
|
|
103
99
|
export declare function range(params: {
|
|
104
100
|
key: string;
|
|
105
101
|
label: Text;
|
|
106
102
|
span?: number;
|
|
107
|
-
}):
|
|
103
|
+
}): void;
|
|
108
104
|
export declare function interval(params: {
|
|
109
105
|
key: string;
|
|
110
106
|
label: Text;
|
|
111
107
|
span?: number;
|
|
112
|
-
}):
|
|
108
|
+
}): void;
|
|
113
109
|
export declare function date(params: {
|
|
114
110
|
key: string;
|
|
115
111
|
label: Text;
|
|
116
112
|
span?: number;
|
|
117
|
-
}):
|
|
113
|
+
}): void;
|
|
118
114
|
export declare function time(params: {
|
|
119
115
|
key: string;
|
|
120
116
|
label: Text;
|
|
121
117
|
span?: number;
|
|
122
|
-
}):
|
|
118
|
+
}): void;
|
|
123
119
|
export declare function dateTime(params: {
|
|
124
120
|
key: string;
|
|
125
121
|
label: Text;
|
|
126
122
|
span?: number;
|
|
127
|
-
}):
|
|
123
|
+
}): void;
|
|
128
124
|
export declare function checkbox(params: {
|
|
129
125
|
key: string;
|
|
130
126
|
label: Text;
|
|
131
127
|
span?: number;
|
|
132
|
-
}):
|
|
128
|
+
}): void;
|
|
133
129
|
export declare function radio(params: {
|
|
134
130
|
key: string;
|
|
135
131
|
label: Text;
|
|
@@ -138,7 +134,7 @@ export declare function radio(params: {
|
|
|
138
134
|
value: string;
|
|
139
135
|
}[];
|
|
140
136
|
span?: number;
|
|
141
|
-
}):
|
|
137
|
+
}): void;
|
|
142
138
|
export declare function radioButton(params: {
|
|
143
139
|
key: string;
|
|
144
140
|
label: Text;
|
|
@@ -147,7 +143,7 @@ export declare function radioButton(params: {
|
|
|
147
143
|
value: string;
|
|
148
144
|
}[];
|
|
149
145
|
span?: number;
|
|
150
|
-
}):
|
|
146
|
+
}): void;
|
|
151
147
|
export declare function select(params: {
|
|
152
148
|
key: string;
|
|
153
149
|
label: Text;
|
|
@@ -156,12 +152,12 @@ export declare function select(params: {
|
|
|
156
152
|
value: string;
|
|
157
153
|
}[];
|
|
158
154
|
span?: number;
|
|
159
|
-
}):
|
|
155
|
+
}): void;
|
|
160
156
|
export declare function colorPicker(params: {
|
|
161
157
|
key: string;
|
|
162
158
|
label: Text;
|
|
163
159
|
span?: number;
|
|
164
|
-
}):
|
|
160
|
+
}): void;
|
|
165
161
|
export interface OptionsValidation {
|
|
166
162
|
[key: string]: OptionsValidator;
|
|
167
163
|
}
|
package/config.js
CHANGED
|
@@ -16,93 +16,127 @@ var Method;
|
|
|
16
16
|
Method["PivotTable"] = "pivot";
|
|
17
17
|
})(Method = exports.Method || (exports.Method = {}));
|
|
18
18
|
// widget options
|
|
19
|
-
class Option {
|
|
20
|
-
constructor(config) {
|
|
21
|
-
const value = Object.seal(config);
|
|
22
|
-
Object.defineProperty(this, "toJSON", {
|
|
23
|
-
value() {
|
|
24
|
-
return value;
|
|
25
|
-
},
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
19
|
exports.STEP = 24;
|
|
30
20
|
// layout
|
|
31
21
|
function title(label, params) {
|
|
32
22
|
const options = [];
|
|
33
23
|
if (params === null || params === void 0 ? void 0 : params.hint)
|
|
34
24
|
options.push({ label: params.hint, value: 0 });
|
|
35
|
-
|
|
25
|
+
const option = {
|
|
26
|
+
type: widget_options_1.WidgetOptionType.Title,
|
|
27
|
+
label,
|
|
28
|
+
options,
|
|
29
|
+
};
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
this.target.push(option);
|
|
36
32
|
}
|
|
37
33
|
exports.title = title;
|
|
38
34
|
function label(label, params) {
|
|
39
35
|
const options = [];
|
|
40
36
|
if (params === null || params === void 0 ? void 0 : params.hint)
|
|
41
37
|
options.push({ label: params.hint, value: 0 });
|
|
42
|
-
|
|
38
|
+
const option = {
|
|
39
|
+
type: widget_options_1.WidgetOptionType.Label,
|
|
40
|
+
label,
|
|
41
|
+
options,
|
|
42
|
+
};
|
|
43
|
+
// @ts-ignore
|
|
44
|
+
this.target.push(option);
|
|
43
45
|
}
|
|
44
46
|
exports.label = label;
|
|
45
47
|
function spacer(span) {
|
|
46
|
-
|
|
48
|
+
const option = {
|
|
49
|
+
type: widget_options_1.WidgetOptionType.Spacer,
|
|
50
|
+
span,
|
|
51
|
+
};
|
|
52
|
+
// @ts-ignore
|
|
53
|
+
this.target.push(option);
|
|
47
54
|
}
|
|
48
55
|
exports.spacer = spacer;
|
|
49
56
|
function line() {
|
|
50
|
-
|
|
57
|
+
const option = {
|
|
51
58
|
type: widget_options_1.WidgetOptionType.LineHorizontal,
|
|
52
|
-
|
|
53
|
-
|
|
59
|
+
};
|
|
60
|
+
// @ts-ignore
|
|
61
|
+
this.target.push(option);
|
|
54
62
|
}
|
|
55
63
|
exports.line = line;
|
|
56
64
|
// controls
|
|
57
65
|
function text(params) {
|
|
58
|
-
|
|
66
|
+
const option = Object.assign(Object.assign({}, params), { type: widget_options_1.WidgetOptionType.Text });
|
|
67
|
+
// @ts-ignore
|
|
68
|
+
this.target.push(option);
|
|
59
69
|
}
|
|
60
70
|
exports.text = text;
|
|
61
71
|
function number(params) {
|
|
62
|
-
|
|
72
|
+
const option = Object.assign(Object.assign({}, params), { type: widget_options_1.WidgetOptionType.Number });
|
|
73
|
+
// @ts-ignore
|
|
74
|
+
this.target.push(option);
|
|
63
75
|
}
|
|
64
76
|
exports.number = number;
|
|
65
77
|
function integer(params) {
|
|
66
|
-
|
|
78
|
+
const option = Object.assign(Object.assign({}, params), { type: widget_options_1.WidgetOptionType.Integer });
|
|
79
|
+
// @ts-ignore
|
|
80
|
+
this.target.push(option);
|
|
67
81
|
}
|
|
68
82
|
exports.integer = integer;
|
|
69
83
|
function range(params) {
|
|
70
|
-
|
|
84
|
+
const option = Object.assign(Object.assign({}, params), { type: widget_options_1.WidgetOptionType.Range });
|
|
85
|
+
// @ts-ignore
|
|
86
|
+
this.target.push(option);
|
|
71
87
|
}
|
|
72
88
|
exports.range = range;
|
|
73
89
|
function interval(params) {
|
|
74
|
-
|
|
90
|
+
const option = Object.assign(Object.assign({}, params), { type: widget_options_1.WidgetOptionType.Interval });
|
|
91
|
+
// @ts-ignore
|
|
92
|
+
this.target.push(option);
|
|
75
93
|
}
|
|
76
94
|
exports.interval = interval;
|
|
77
95
|
function date(params) {
|
|
78
|
-
|
|
96
|
+
const option = Object.assign(Object.assign({}, params), { type: widget_options_1.WidgetOptionType.Date });
|
|
97
|
+
// @ts-ignore
|
|
98
|
+
this.target.push(option);
|
|
79
99
|
}
|
|
80
100
|
exports.date = date;
|
|
81
101
|
function time(params) {
|
|
82
|
-
|
|
102
|
+
const option = Object.assign(Object.assign({}, params), { type: widget_options_1.WidgetOptionType.Time });
|
|
103
|
+
// @ts-ignore
|
|
104
|
+
this.target.push(option);
|
|
83
105
|
}
|
|
84
106
|
exports.time = time;
|
|
85
107
|
function dateTime(params) {
|
|
86
|
-
|
|
108
|
+
const option = Object.assign(Object.assign({}, params), { type: widget_options_1.WidgetOptionType.DateTime });
|
|
109
|
+
// @ts-ignore
|
|
110
|
+
this.target.push(option);
|
|
87
111
|
}
|
|
88
112
|
exports.dateTime = dateTime;
|
|
89
113
|
function checkbox(params) {
|
|
90
|
-
|
|
114
|
+
const option = Object.assign(Object.assign({}, params), { type: widget_options_1.WidgetOptionType.Checkbox });
|
|
115
|
+
// @ts-ignore
|
|
116
|
+
this.target.push(option);
|
|
91
117
|
}
|
|
92
118
|
exports.checkbox = checkbox;
|
|
93
119
|
function radio(params) {
|
|
94
|
-
|
|
120
|
+
const option = Object.assign(Object.assign({}, params), { type: widget_options_1.WidgetOptionType.Radio });
|
|
121
|
+
// @ts-ignore
|
|
122
|
+
this.target.push(option);
|
|
95
123
|
}
|
|
96
124
|
exports.radio = radio;
|
|
97
125
|
function radioButton(params) {
|
|
98
|
-
|
|
126
|
+
const option = Object.assign(Object.assign({}, params), { type: widget_options_1.WidgetOptionType.RadioButtons });
|
|
127
|
+
// @ts-ignore
|
|
128
|
+
this.target.push(option);
|
|
99
129
|
}
|
|
100
130
|
exports.radioButton = radioButton;
|
|
101
131
|
function select(params) {
|
|
102
|
-
|
|
132
|
+
const option = Object.assign(Object.assign({}, params), { type: widget_options_1.WidgetOptionType.Select });
|
|
133
|
+
// @ts-ignore
|
|
134
|
+
this.target.push(option);
|
|
103
135
|
}
|
|
104
136
|
exports.select = select;
|
|
105
137
|
function colorPicker(params) {
|
|
106
|
-
|
|
138
|
+
const option = Object.assign(Object.assign({}, params), { type: widget_options_1.WidgetOptionType.ColorPicker });
|
|
139
|
+
// @ts-ignore
|
|
140
|
+
this.target.push(option);
|
|
107
141
|
}
|
|
108
142
|
exports.colorPicker = colorPicker;
|