@kws3/ui 1.4.7 → 1.5.6
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/buttons/ConfirmButton.svelte +2 -0
- package/charts/AreaChart.svelte +144 -0
- package/charts/BarChart.svelte +166 -0
- package/charts/Chart.svelte +122 -0
- package/charts/DonutChart.svelte +85 -0
- package/charts/LineChart.svelte +144 -0
- package/charts/MixedChart.svelte +201 -0
- package/charts/PieChart.svelte +86 -0
- package/charts/RadialChart.svelte +117 -0
- package/charts/utils.js +213 -0
- package/controls/Checkbox.svelte +1 -1
- package/controls/NumberInput.svelte +3 -0
- package/forms/select/MultiSelect.svelte +2 -0
- package/helpers/Nl2br.svelte +1 -1
- package/index.js +13 -6
- package/package.json +3 -2
- package/settings.js +11 -0
- package/styles/Chart.scss +42 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
@component
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
@param {object} [options={}] - Chart options, see ApexCharts options for bar charts, Default: `{}`
|
|
6
|
+
@param {array} [labels=[]] - Data labels, Default: `[]`
|
|
7
|
+
@param {array} [sets=[]] - Data sets, Default: `[]`
|
|
8
|
+
@param {array} [data=[]] - Chart data, Default: `[]`
|
|
9
|
+
@param {boolean} [sparklines=false] - Displays the chart as a sparkline chart.
|
|
10
|
+
These are charts with minimal UI and can be
|
|
11
|
+
squeezed into small spaces, Default: `false`
|
|
12
|
+
@param {boolean} [multiaxis=false] - Whether the chart has multiple axes, Default: `false`
|
|
13
|
+
@param {object} [y_axis_options={}] - Y Axis options, see ApexCharts options for Y Axis, Default: `{}`
|
|
14
|
+
@param {string} [width="100%"] - Chart width, supports CSS size strings, Default: `"100%"`
|
|
15
|
+
@param {string} [height="auto"] - Chart height, supports CSS size strings, Default: `"auto"`
|
|
16
|
+
@param {array} [colors=null] - Chart colors, can be modified globally in framework settings
|
|
17
|
+
|
|
18
|
+
Send an array of colors to override the default colors, or do not send anything to use the default colors, Default: `null`
|
|
19
|
+
@param {string} [class=""] - CSS classes for container, Default: `""`
|
|
20
|
+
|
|
21
|
+
-->
|
|
22
|
+
<Chart
|
|
23
|
+
class={__class}
|
|
24
|
+
options={_options}
|
|
25
|
+
series={_data}
|
|
26
|
+
type="bar"
|
|
27
|
+
{height}
|
|
28
|
+
{width} />
|
|
29
|
+
|
|
30
|
+
<script>
|
|
31
|
+
import { Chart } from "@kws3/ui";
|
|
32
|
+
import { mixedChartOptions, merge } from "./utils";
|
|
33
|
+
import { defaultChartColors } from "../settings";
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Chart options, see ApexCharts options for bar charts
|
|
37
|
+
*/
|
|
38
|
+
export let options = {},
|
|
39
|
+
/**
|
|
40
|
+
* Data labels
|
|
41
|
+
*/
|
|
42
|
+
labels = [],
|
|
43
|
+
/**
|
|
44
|
+
* Data sets
|
|
45
|
+
*/
|
|
46
|
+
sets = [],
|
|
47
|
+
/**
|
|
48
|
+
* Chart data
|
|
49
|
+
*/
|
|
50
|
+
data = [],
|
|
51
|
+
/**
|
|
52
|
+
* Displays the chart as a sparkline chart.
|
|
53
|
+
* These are charts with minimal UI and can be
|
|
54
|
+
* squeezed into small spaces
|
|
55
|
+
*/
|
|
56
|
+
sparklines = false,
|
|
57
|
+
/**
|
|
58
|
+
* Whether the chart has multiple axes
|
|
59
|
+
*/
|
|
60
|
+
multiaxis = false,
|
|
61
|
+
/**
|
|
62
|
+
* Y Axis options, see ApexCharts options for Y Axis
|
|
63
|
+
*/
|
|
64
|
+
y_axis_options = {},
|
|
65
|
+
/**
|
|
66
|
+
* Chart width, supports CSS size strings
|
|
67
|
+
*/
|
|
68
|
+
width = "100%",
|
|
69
|
+
/**
|
|
70
|
+
* Chart height, supports CSS size strings
|
|
71
|
+
*/
|
|
72
|
+
height = "auto",
|
|
73
|
+
/**
|
|
74
|
+
* Chart colors, can be modified globally in framework settings
|
|
75
|
+
*
|
|
76
|
+
* Send an array of colors to override the default colors, or do not send anything to use the default colors
|
|
77
|
+
* @type {array}
|
|
78
|
+
*/
|
|
79
|
+
colors = null;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* CSS classes for container
|
|
83
|
+
*/
|
|
84
|
+
let klass = "";
|
|
85
|
+
export { klass as class };
|
|
86
|
+
|
|
87
|
+
$: __class =
|
|
88
|
+
"kws-mixed-chart " + `${sparklines ? "kws-sparklines" : ""} ` + klass;
|
|
89
|
+
|
|
90
|
+
let _data = [];
|
|
91
|
+
let yAxis = [];
|
|
92
|
+
|
|
93
|
+
$: usedColors = colors
|
|
94
|
+
? colors
|
|
95
|
+
: $defaultChartColors
|
|
96
|
+
? $defaultChartColors
|
|
97
|
+
: [];
|
|
98
|
+
|
|
99
|
+
$: data, sets, normaliseAll();
|
|
100
|
+
$: _options = merge(
|
|
101
|
+
mixedChartOptions(labels, multiaxis ? yAxis : yAxis[0], sparklines),
|
|
102
|
+
Object.assign({}, { colors: usedColors }, options)
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
const normaliseAll = () => {
|
|
106
|
+
if (data.length !== sets.length) {
|
|
107
|
+
console.warn("Data and sets lengths do not match");
|
|
108
|
+
}
|
|
109
|
+
normaliseSets();
|
|
110
|
+
normaliseData();
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
const normaliseSets = () => {
|
|
114
|
+
yAxis = [];
|
|
115
|
+
|
|
116
|
+
let _sets = sets || [],
|
|
117
|
+
oppositeAxisApplied = false,
|
|
118
|
+
mainSeriesName = null,
|
|
119
|
+
oppositeSeriesName = null;
|
|
120
|
+
|
|
121
|
+
_sets.forEach((set, idx) => {
|
|
122
|
+
let __set = {};
|
|
123
|
+
let obj = merge(
|
|
124
|
+
{
|
|
125
|
+
floating: false,
|
|
126
|
+
opposite: false,
|
|
127
|
+
decimalsInFloat: 0,
|
|
128
|
+
axisBorder: {
|
|
129
|
+
show: true,
|
|
130
|
+
},
|
|
131
|
+
axisTicks: {
|
|
132
|
+
show: true,
|
|
133
|
+
},
|
|
134
|
+
labels: {
|
|
135
|
+
show: true,
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
y_axis_options
|
|
139
|
+
);
|
|
140
|
+
if (typeof set === "string") {
|
|
141
|
+
__set = Object.assign(obj, {
|
|
142
|
+
name: set,
|
|
143
|
+
type: "column",
|
|
144
|
+
});
|
|
145
|
+
} else {
|
|
146
|
+
__set = Object.assign(obj, { name: "set-" + idx, type: "column" }, set);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
//series names cannot be random,
|
|
150
|
+
//they have to be of one of the sets
|
|
151
|
+
if (!mainSeriesName) {
|
|
152
|
+
mainSeriesName = __set.name;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (__set.opposite) {
|
|
156
|
+
//hide extras axes on the opposite side
|
|
157
|
+
if (!oppositeAxisApplied) {
|
|
158
|
+
oppositeAxisApplied = true;
|
|
159
|
+
if (!oppositeSeriesName) {
|
|
160
|
+
oppositeSeriesName = __set.name;
|
|
161
|
+
}
|
|
162
|
+
} else {
|
|
163
|
+
__set.show = false;
|
|
164
|
+
}
|
|
165
|
+
} else {
|
|
166
|
+
//hide extras axes on the main side
|
|
167
|
+
if (idx > 0) {
|
|
168
|
+
__set.show = false;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
if (__set.forceDisplay) {
|
|
173
|
+
__set.show = true;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
//set a common series name based on axis..
|
|
177
|
+
//so that scales for each axis are the same
|
|
178
|
+
__set.seriesName = __set.opposite ? oppositeSeriesName : mainSeriesName;
|
|
179
|
+
|
|
180
|
+
yAxis.push(__set);
|
|
181
|
+
});
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
const normaliseData = () => {
|
|
185
|
+
_data = [];
|
|
186
|
+
|
|
187
|
+
//ensuring data is an array of arrays
|
|
188
|
+
let sliced_data = (data || []).slice();
|
|
189
|
+
if (!Array.isArray(sliced_data[0])) {
|
|
190
|
+
sliced_data = [sliced_data];
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
sliced_data.forEach((set, idx) => {
|
|
194
|
+
_data.push({
|
|
195
|
+
name: yAxis[idx].name,
|
|
196
|
+
type: yAxis[idx].type,
|
|
197
|
+
data: set,
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
};
|
|
201
|
+
</script>
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
@component
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
@param {object} [options={}] - Chart options, see ApexCharts options for pie charts, Default: `{}`
|
|
6
|
+
@param {array} [labels=[]] - Data labels, Default: `[]`
|
|
7
|
+
@param {array} [data=[]] - Chart data, Default: `[]`
|
|
8
|
+
@param {boolean} [sparklines=false] - Displays the chart as a sparkline chart.
|
|
9
|
+
These are charts with minimal UI and can be
|
|
10
|
+
squeezed into small spaces, Default: `false`
|
|
11
|
+
@param {string} [width="100%"] - Chart width, supports CSS size strings, Default: `"100%"`
|
|
12
|
+
@param {string} [height="auto"] - Chart height, supports CSS size strings, Default: `"auto"`
|
|
13
|
+
@param {array} [colors=null] - Chart colors, can be modified globally in framework settings
|
|
14
|
+
|
|
15
|
+
Send an array of colors to override the default colors, or do not send anything to use the default colors, Default: `null`
|
|
16
|
+
@param {string} [class=""] - CSS classes for container, Default: `""`
|
|
17
|
+
|
|
18
|
+
-->
|
|
19
|
+
<Chart
|
|
20
|
+
class={__class}
|
|
21
|
+
options={_options}
|
|
22
|
+
series={_data}
|
|
23
|
+
type="pie"
|
|
24
|
+
{height}
|
|
25
|
+
{width} />
|
|
26
|
+
|
|
27
|
+
<script>
|
|
28
|
+
import { Chart } from "@kws3/ui";
|
|
29
|
+
import { pieChartOptions, merge } from "./utils";
|
|
30
|
+
import { defaultChartColors } from "../settings";
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Chart options, see ApexCharts options for pie charts
|
|
34
|
+
*/
|
|
35
|
+
export let options = {},
|
|
36
|
+
/**
|
|
37
|
+
* Data labels
|
|
38
|
+
*/
|
|
39
|
+
labels = [],
|
|
40
|
+
/**
|
|
41
|
+
* Chart data
|
|
42
|
+
*/
|
|
43
|
+
data = [],
|
|
44
|
+
/**
|
|
45
|
+
* Displays the chart as a sparkline chart.
|
|
46
|
+
* These are charts with minimal UI and can be
|
|
47
|
+
* squeezed into small spaces
|
|
48
|
+
*/
|
|
49
|
+
sparklines = false,
|
|
50
|
+
/**
|
|
51
|
+
* Chart width, supports CSS size strings
|
|
52
|
+
*/
|
|
53
|
+
width = "100%",
|
|
54
|
+
/**
|
|
55
|
+
* Chart height, supports CSS size strings
|
|
56
|
+
*/
|
|
57
|
+
height = "auto",
|
|
58
|
+
/**
|
|
59
|
+
* Chart colors, can be modified globally in framework settings
|
|
60
|
+
*
|
|
61
|
+
* Send an array of colors to override the default colors, or do not send anything to use the default colors
|
|
62
|
+
* @type {array}
|
|
63
|
+
*/
|
|
64
|
+
colors = null;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* CSS classes for container
|
|
68
|
+
*/
|
|
69
|
+
let klass = "";
|
|
70
|
+
export { klass as class };
|
|
71
|
+
|
|
72
|
+
$: __class =
|
|
73
|
+
"kws-pie-chart " + `${sparklines ? "kws-sparklines" : ""} ` + klass;
|
|
74
|
+
|
|
75
|
+
$: usedColors = colors
|
|
76
|
+
? colors
|
|
77
|
+
: $defaultChartColors
|
|
78
|
+
? $defaultChartColors
|
|
79
|
+
: [];
|
|
80
|
+
|
|
81
|
+
$: _data = data || Array(labels.length || 0).fill(0);
|
|
82
|
+
$: _options = merge(
|
|
83
|
+
pieChartOptions(labels, sparklines),
|
|
84
|
+
Object.assign({}, { colors: usedColors }, options)
|
|
85
|
+
);
|
|
86
|
+
</script>
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
@component
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
@param {object} [options={}] - Chart options, see ApexCharts options for radial charts, Default: `{}`
|
|
6
|
+
@param {array} [labels=[]] - Data labels, Default: `[]`
|
|
7
|
+
@param {array} [data=[]] - Chart data, Default: `[]`
|
|
8
|
+
@param {number} [start_angle=0] - Starting angle in degrees, Default: `0`
|
|
9
|
+
@param {number} [end_angle=360] - Ending angle in degrees, Default: `360`
|
|
10
|
+
@param {boolean} [sparklines=false] - Displays the chart as a sparkline chart.
|
|
11
|
+
These are charts with minimal UI and can be
|
|
12
|
+
squeezed into small spaces, Default: `false`
|
|
13
|
+
@param {string} [width="100%"] - Chart width, supports CSS size strings, Default: `"100%"`
|
|
14
|
+
@param {string} [height="auto"] - Chart height, supports CSS size strings, Default: `"auto"`
|
|
15
|
+
@param {array} [colors=null] - Chart colors, can be modified globally in framework settings
|
|
16
|
+
|
|
17
|
+
Send an array of colors to override the default colors, or do not send anything to use the default colors, Default: `null`
|
|
18
|
+
@param {string} [class=""] - CSS classes for container, Default: `""`
|
|
19
|
+
|
|
20
|
+
-->
|
|
21
|
+
<Chart
|
|
22
|
+
class={__class}
|
|
23
|
+
options={_options}
|
|
24
|
+
series={_data}
|
|
25
|
+
type="radialBar"
|
|
26
|
+
{height}
|
|
27
|
+
{width} />
|
|
28
|
+
|
|
29
|
+
<script>
|
|
30
|
+
import { Chart } from "@kws3/ui";
|
|
31
|
+
import { radialChartOptions, merge } from "./utils";
|
|
32
|
+
import { defaultChartColors } from "../settings";
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Chart options, see ApexCharts options for radial charts
|
|
36
|
+
*/
|
|
37
|
+
export let options = {},
|
|
38
|
+
/**
|
|
39
|
+
* Data labels
|
|
40
|
+
*/
|
|
41
|
+
labels = [],
|
|
42
|
+
/**
|
|
43
|
+
* Chart data
|
|
44
|
+
*/
|
|
45
|
+
data = [],
|
|
46
|
+
/**
|
|
47
|
+
* Starting angle in degrees
|
|
48
|
+
*/
|
|
49
|
+
start_angle = 0,
|
|
50
|
+
/**
|
|
51
|
+
* Ending angle in degrees
|
|
52
|
+
*/
|
|
53
|
+
end_angle = 360,
|
|
54
|
+
/**
|
|
55
|
+
* Displays the chart as a sparkline chart.
|
|
56
|
+
* These are charts with minimal UI and can be
|
|
57
|
+
* squeezed into small spaces
|
|
58
|
+
*/
|
|
59
|
+
sparklines = false,
|
|
60
|
+
/**
|
|
61
|
+
* Chart width, supports CSS size strings
|
|
62
|
+
*/
|
|
63
|
+
width = "100%",
|
|
64
|
+
/**
|
|
65
|
+
* Chart height, supports CSS size strings
|
|
66
|
+
*/
|
|
67
|
+
height = "auto",
|
|
68
|
+
/**
|
|
69
|
+
* Chart colors, can be modified globally in framework settings
|
|
70
|
+
*
|
|
71
|
+
* Send an array of colors to override the default colors, or do not send anything to use the default colors
|
|
72
|
+
* @type {array}
|
|
73
|
+
*/
|
|
74
|
+
colors = null;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* CSS classes for container
|
|
78
|
+
*/
|
|
79
|
+
let klass = "";
|
|
80
|
+
export { klass as class };
|
|
81
|
+
|
|
82
|
+
let _data = [],
|
|
83
|
+
_labels = [];
|
|
84
|
+
|
|
85
|
+
$: __class =
|
|
86
|
+
"kws-radial-chart " + `${sparklines ? "kws-sparklines" : ""} ` + klass;
|
|
87
|
+
|
|
88
|
+
$: usedColors = colors
|
|
89
|
+
? colors
|
|
90
|
+
: $defaultChartColors
|
|
91
|
+
? $defaultChartColors
|
|
92
|
+
: [];
|
|
93
|
+
|
|
94
|
+
$: data, normaliseData();
|
|
95
|
+
$: labels, normaliseLabels();
|
|
96
|
+
$: _options = merge(
|
|
97
|
+
radialChartOptions(_labels, start_angle, end_angle, sparklines),
|
|
98
|
+
Object.assign({}, { colors: usedColors }, options)
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
const normaliseData = () => {
|
|
102
|
+
_data = data;
|
|
103
|
+
if (!data) {
|
|
104
|
+
_data = Array(labels.length || 0).fill(0);
|
|
105
|
+
}
|
|
106
|
+
if (!Array.isArray(data)) {
|
|
107
|
+
_data = [data];
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const normaliseLabels = () => {
|
|
112
|
+
_labels = labels;
|
|
113
|
+
if (!Array.isArray(labels)) {
|
|
114
|
+
_labels = [labels];
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
</script>
|
package/charts/utils.js
ADDED
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import ApexCharts from "apexcharts/dist/apexcharts.esm";
|
|
2
|
+
|
|
3
|
+
const themeColors = [
|
|
4
|
+
"#284BED",
|
|
5
|
+
"#ED6134",
|
|
6
|
+
"#1DAFEC",
|
|
7
|
+
"#EDB405",
|
|
8
|
+
"#11EDB7",
|
|
9
|
+
"#77ED11",
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
export const merge = ApexCharts.merge;
|
|
13
|
+
|
|
14
|
+
export function pieChartOptions(labels, is_sparkline) {
|
|
15
|
+
return {
|
|
16
|
+
chart: {
|
|
17
|
+
type: "pie",
|
|
18
|
+
dropShadow: {
|
|
19
|
+
enabled: false,
|
|
20
|
+
},
|
|
21
|
+
toolbar: {
|
|
22
|
+
show: false,
|
|
23
|
+
},
|
|
24
|
+
sparkline: {
|
|
25
|
+
enabled: is_sparkline ? true : false,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
colors: themeColors,
|
|
29
|
+
fill: {
|
|
30
|
+
opacity: 1,
|
|
31
|
+
},
|
|
32
|
+
stroke: {
|
|
33
|
+
width: 0,
|
|
34
|
+
},
|
|
35
|
+
states: {
|
|
36
|
+
active: {
|
|
37
|
+
filter: {
|
|
38
|
+
type: "none",
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
dataLabels: {
|
|
43
|
+
enabled: false,
|
|
44
|
+
},
|
|
45
|
+
tooltip: {
|
|
46
|
+
shared: true,
|
|
47
|
+
intersect: false,
|
|
48
|
+
fillSeriesColor: false,
|
|
49
|
+
x: {
|
|
50
|
+
show: true,
|
|
51
|
+
formatter: undefined,
|
|
52
|
+
},
|
|
53
|
+
theme: false,
|
|
54
|
+
},
|
|
55
|
+
labels: labels,
|
|
56
|
+
legend: {
|
|
57
|
+
position: "bottom",
|
|
58
|
+
horizontalAlign: "center",
|
|
59
|
+
labels: {
|
|
60
|
+
useSeriesColors: true,
|
|
61
|
+
},
|
|
62
|
+
markers: {
|
|
63
|
+
size: 3,
|
|
64
|
+
shape: "circle",
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function donutChartOptions(labels, is_sparkline) {
|
|
71
|
+
var obj = pieChartOptions(labels, is_sparkline);
|
|
72
|
+
obj.chart.type = "donut";
|
|
73
|
+
return obj;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function radialChartOptions(labels, startAngle, endAngle, is_sparkline) {
|
|
77
|
+
var obj = pieChartOptions(labels, is_sparkline);
|
|
78
|
+
obj.chart.type = "radialBar";
|
|
79
|
+
obj.plotOptions = {
|
|
80
|
+
radialBar: {
|
|
81
|
+
startAngle,
|
|
82
|
+
endAngle,
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
return obj;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export function mixedChartOptions(xAxis, yAxis, is_sparkline) {
|
|
89
|
+
return {
|
|
90
|
+
chart: {
|
|
91
|
+
type: "bar",
|
|
92
|
+
stacked: false,
|
|
93
|
+
dropShadow: {
|
|
94
|
+
enabled: false,
|
|
95
|
+
},
|
|
96
|
+
toolbar: {
|
|
97
|
+
show: false,
|
|
98
|
+
},
|
|
99
|
+
sparkline: {
|
|
100
|
+
enabled: is_sparkline ? true : false,
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
colors: themeColors,
|
|
104
|
+
fill: {
|
|
105
|
+
opacity: 1,
|
|
106
|
+
},
|
|
107
|
+
states: {
|
|
108
|
+
active: {
|
|
109
|
+
filter: {
|
|
110
|
+
type: "none",
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
grid: {
|
|
115
|
+
clipMarkers: false,
|
|
116
|
+
},
|
|
117
|
+
dataLabels: {
|
|
118
|
+
enabled: false,
|
|
119
|
+
},
|
|
120
|
+
markers: {
|
|
121
|
+
size: 3,
|
|
122
|
+
shape: "circle",
|
|
123
|
+
strokeWidth: 1,
|
|
124
|
+
hover: {
|
|
125
|
+
sizeOffset: 3,
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
plotOptions: {
|
|
129
|
+
bar: {
|
|
130
|
+
horizontal: false,
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
tooltip: {
|
|
134
|
+
shared: is_sparkline ? false : true,
|
|
135
|
+
intersect: is_sparkline ? true : false,
|
|
136
|
+
x: {
|
|
137
|
+
show: is_sparkline ? true : false,
|
|
138
|
+
},
|
|
139
|
+
y: [
|
|
140
|
+
{},
|
|
141
|
+
{
|
|
142
|
+
formatter: undefined,
|
|
143
|
+
},
|
|
144
|
+
],
|
|
145
|
+
fixed: {
|
|
146
|
+
enabled: is_sparkline ? false : true,
|
|
147
|
+
position: "topLeft",
|
|
148
|
+
offsetY: 10,
|
|
149
|
+
offsetX: 25,
|
|
150
|
+
},
|
|
151
|
+
theme: false,
|
|
152
|
+
},
|
|
153
|
+
xaxis: {
|
|
154
|
+
categories: xAxis,
|
|
155
|
+
axisBorder: {
|
|
156
|
+
show: false,
|
|
157
|
+
},
|
|
158
|
+
axisTicks: {
|
|
159
|
+
show: false,
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
yaxis: yAxis,
|
|
163
|
+
stroke: {
|
|
164
|
+
width: 2,
|
|
165
|
+
curve: "smooth",
|
|
166
|
+
},
|
|
167
|
+
legend: {
|
|
168
|
+
position: "top",
|
|
169
|
+
horizontalAlign: "right",
|
|
170
|
+
fontSize: "12px",
|
|
171
|
+
labels: {
|
|
172
|
+
useSeriesColors: true,
|
|
173
|
+
},
|
|
174
|
+
markers: {
|
|
175
|
+
width: 8,
|
|
176
|
+
height: 8,
|
|
177
|
+
radius: 8,
|
|
178
|
+
},
|
|
179
|
+
itemMargin: {
|
|
180
|
+
horizontal: 5,
|
|
181
|
+
vertical: 10,
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export function barChartOptions(
|
|
188
|
+
xAxis,
|
|
189
|
+
yAxis,
|
|
190
|
+
is_sparkline,
|
|
191
|
+
is_horizontal,
|
|
192
|
+
is_stacked,
|
|
193
|
+
is_stacked_full
|
|
194
|
+
) {
|
|
195
|
+
let opts = mixedChartOptions(xAxis, yAxis, is_sparkline);
|
|
196
|
+
opts.chart.type = "bar";
|
|
197
|
+
opts.chart.stacked = is_stacked ? true : false;
|
|
198
|
+
opts.chart.stackType = is_stacked_full ? "100%" : false;
|
|
199
|
+
opts.plotOptions.bar.horizontal = is_horizontal ? true : false;
|
|
200
|
+
return opts;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export function lineChartOptions(xAxis, yAxis, is_sparkline) {
|
|
204
|
+
let opts = mixedChartOptions(xAxis, yAxis, is_sparkline);
|
|
205
|
+
opts.chart.type = "line";
|
|
206
|
+
return opts;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export function areaChartOptions(xAxis, yAxis, is_sparkline) {
|
|
210
|
+
let opts = mixedChartOptions(xAxis, yAxis, is_sparkline);
|
|
211
|
+
opts.chart.type = "area";
|
|
212
|
+
return opts;
|
|
213
|
+
}
|
package/controls/Checkbox.svelte
CHANGED
|
@@ -34,7 +34,7 @@ Ultimately defaults to `fa`, if family is not set anywhere, Default: `"null"`
|
|
|
34
34
|
class="checkbox kws-checkbox is-{size} is-{color} {klass}"
|
|
35
35
|
{style}>
|
|
36
36
|
<!--Checkbox change event-->
|
|
37
|
-
<input type="checkbox" {disabled} bind:checked on:change />
|
|
37
|
+
<input role="checkbox" type="checkbox" {disabled} bind:checked on:change />
|
|
38
38
|
<span class="kws-checkbox-label" style={label_style}>
|
|
39
39
|
<!-- Used for the Checkbox label--><slot />
|
|
40
40
|
</span>
|
|
@@ -28,6 +28,7 @@ This will be overridden if `min` is higher, or `max` is lower, Default: `0`
|
|
|
28
28
|
<div class="field has-addons">
|
|
29
29
|
<div class="control">
|
|
30
30
|
<button
|
|
31
|
+
role="button"
|
|
31
32
|
type="button"
|
|
32
33
|
class="button is-{size} is-{minus_button_color}"
|
|
33
34
|
style="box-shadow:none;"
|
|
@@ -41,6 +42,7 @@ This will be overridden if `min` is higher, or `max` is lower, Default: `0`
|
|
|
41
42
|
</div>
|
|
42
43
|
<div class="control is-{fullwidth ? 'expanded' : 'narrow'}">
|
|
43
44
|
<input
|
|
45
|
+
data-testid="input"
|
|
44
46
|
class="input has-text-centered is-{size} is-{value < min || value > max
|
|
45
47
|
? 'danger'
|
|
46
48
|
: ''}"
|
|
@@ -56,6 +58,7 @@ This will be overridden if `min` is higher, or `max` is lower, Default: `0`
|
|
|
56
58
|
</div>
|
|
57
59
|
<div class="control">
|
|
58
60
|
<button
|
|
61
|
+
role="button"
|
|
59
62
|
type="button"
|
|
60
63
|
class="button is-{size} is-{plus_button_color}"
|
|
61
64
|
style="box-shadow:none;"
|
|
@@ -73,6 +73,7 @@ Default value: `<span>{option[search_key] || option}</span>`
|
|
|
73
73
|
{#if !readonly && !disabled}
|
|
74
74
|
<button
|
|
75
75
|
on:click|self|stopPropagation={() => remove(tag)}
|
|
76
|
+
role="button"
|
|
76
77
|
type="button"
|
|
77
78
|
class="delete is-small"
|
|
78
79
|
data-tooltip="{remove_btn_tip} {tag[used_search_key]}" />
|
|
@@ -97,6 +98,7 @@ Default value: `<span>{option[search_key] || option}</span>`
|
|
|
97
98
|
</ul>
|
|
98
99
|
{#if !readonly && !disabled}
|
|
99
100
|
<button
|
|
101
|
+
role="button"
|
|
100
102
|
type="button"
|
|
101
103
|
class="remove-all delete is-small"
|
|
102
104
|
data-tooltip={remove_all_tip}
|
package/helpers/Nl2br.svelte
CHANGED