@kws3/ui 1.7.3 → 1.8.1
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/CHANGELOG.mdx +15 -0
- package/buttons/ConfirmButton.svelte +0 -2
- package/charts/AreaChart.svelte +59 -2
- package/charts/BarChart.svelte +66 -3
- package/charts/Chart.svelte +57 -13
- package/charts/DonutChart.svelte +60 -2
- package/charts/LineChart.svelte +59 -2
- package/charts/MixedChart.svelte +59 -2
- package/charts/PieChart.svelte +59 -2
- package/charts/RadialChart.svelte +59 -2
- package/charts/utils.js +5 -0
- package/controls/NumberInput.svelte +0 -2
- package/forms/select/MultiSelect.svelte +201 -80
- package/forms/select/SearchableSelect.svelte +29 -0
- package/helpers/ActionSheet.svelte +3 -1
- package/helpers/CardModal.svelte +11 -1
- package/helpers/Dialog/index.js +2 -0
- package/helpers/Modal.svelte +12 -3
- package/helpers/ScrollableList.svelte +231 -0
- package/index.js +1 -0
- package/package.json +4 -3
- package/sliding-panes/SlidingPane.svelte +13 -20
- package/styles/ActionSheet.scss +10 -0
- package/utils/resizeObserver.js +24 -0
package/CHANGELOG.mdx
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
## 1.8.1
|
|
2
|
+
- New `ScrollableList` component
|
|
3
|
+
|
|
4
|
+
## 1.8.0
|
|
5
|
+
- `Modal`, `CardModal` and `ActionSheet` components now play an outro transition instead of abruptly disappearing.
|
|
6
|
+
- Usability fixes for `SearchableSelect` and `MultiSelect`.
|
|
7
|
+
- `SearchableSelect` and `MultiSelect` now support loading options via an async function.
|
|
8
|
+
- `SearchableSelect` and `MultiSelect` now match results using a fuzzy `search_strategy`. This can be changed to old behaviour by specifying `search_strategy="strict"`.
|
|
9
|
+
|
|
10
|
+
## 1.7.4
|
|
11
|
+
- Update ApexCharts to version 3.33.2
|
|
12
|
+
- Added support for subscribing to chart events
|
|
13
|
+
- Added support for distributed bar charts using new `distributed` prop on `BarChart` component
|
|
14
|
+
- Added examples for leveraging advanced chart features
|
|
15
|
+
|
|
1
16
|
## 1.7.3
|
|
2
17
|
- Fix docs for `Popover`
|
|
3
18
|
- Increase performance for `SlidingPane` by using ResizeObserver when available
|
|
@@ -28,7 +28,6 @@
|
|
|
28
28
|
<p class="control">
|
|
29
29
|
{#if _confirm}
|
|
30
30
|
<button
|
|
31
|
-
role="button"
|
|
32
31
|
class="button is-success is-light is-shadowless is-{size} {button_class}"
|
|
33
32
|
type="button"
|
|
34
33
|
on:click|preventDefault|stopPropagation={cancel}>
|
|
@@ -38,7 +37,6 @@
|
|
|
38
37
|
</p>
|
|
39
38
|
<p class="control is-expanded">
|
|
40
39
|
<button
|
|
41
|
-
role="button"
|
|
42
40
|
class="button is-{size} {_doing
|
|
43
41
|
? main_color + ' is-loading'
|
|
44
42
|
: _error
|
package/charts/AreaChart.svelte
CHANGED
|
@@ -15,16 +15,60 @@ squeezed into small spaces, Default: `false`
|
|
|
15
15
|
@param {array} [colors=null] - Chart colors, can be modified globally in framework settings
|
|
16
16
|
|
|
17
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 {array} [captured_events=[]] - String array of event names that will be captured and fired as svelte events.
|
|
19
|
+
This is to prevent unnecessary event subscriptions., Default: `[]`
|
|
18
20
|
@param {string} [class=""] - CSS classes for container, Default: `""`
|
|
21
|
+
@method `getInstance()` - Returns the ApexCharts instance
|
|
22
|
+
|
|
23
|
+
### Events
|
|
24
|
+
- `animationEnd` - All chart events only fire when they are mentioned in `captured_events` list. See ApexChart Events https://apexcharts.com/docs/options/chart/events/ for full list of supported events.
|
|
25
|
+
- `beforeMount`
|
|
26
|
+
- `mounted`
|
|
27
|
+
- `updated`
|
|
28
|
+
- `mouseMove`
|
|
29
|
+
- `mouseLeave`
|
|
30
|
+
- `click`
|
|
31
|
+
- `legendClick`
|
|
32
|
+
- `markerClick`
|
|
33
|
+
- `selection`
|
|
34
|
+
- `dataPointSelection`
|
|
35
|
+
- `dataPointMouseEnter`
|
|
36
|
+
- `dataPointMouseLeave`
|
|
37
|
+
- `beforeZoom`
|
|
38
|
+
- `beforeResetZoom`
|
|
39
|
+
- `zoomed`
|
|
40
|
+
- `scrolled`
|
|
41
|
+
- `brushScrolled`
|
|
19
42
|
|
|
20
43
|
-->
|
|
44
|
+
<!-- All chart events only fire when they are mentioned in `captured_events` list. See ApexChart Events https://apexcharts.com/docs/options/chart/events/ for full list of supported events. -->
|
|
21
45
|
<Chart
|
|
46
|
+
bind:this={chart}
|
|
47
|
+
on:animationEnd
|
|
48
|
+
on:beforeMount
|
|
49
|
+
on:mounted
|
|
50
|
+
on:updated
|
|
51
|
+
on:mouseMove
|
|
52
|
+
on:mouseLeave
|
|
53
|
+
on:click
|
|
54
|
+
on:legendClick
|
|
55
|
+
on:markerClick
|
|
56
|
+
on:selection
|
|
57
|
+
on:dataPointSelection
|
|
58
|
+
on:dataPointMouseEnter
|
|
59
|
+
on:dataPointMouseLeave
|
|
60
|
+
on:beforeZoom
|
|
61
|
+
on:beforeResetZoom
|
|
62
|
+
on:zoomed
|
|
63
|
+
on:scrolled
|
|
64
|
+
on:brushScrolled
|
|
22
65
|
class={__class}
|
|
23
66
|
options={_options}
|
|
24
67
|
series={_data}
|
|
25
68
|
type="area"
|
|
26
69
|
{height}
|
|
27
|
-
{width}
|
|
70
|
+
{width}
|
|
71
|
+
{captured_events} />
|
|
28
72
|
|
|
29
73
|
<script>
|
|
30
74
|
import { Chart } from "@kws3/ui";
|
|
@@ -71,7 +115,12 @@ Send an array of colors to override the default colors, or do not send anything
|
|
|
71
115
|
* Send an array of colors to override the default colors, or do not send anything to use the default colors
|
|
72
116
|
* @type {array}
|
|
73
117
|
*/
|
|
74
|
-
colors = null
|
|
118
|
+
colors = null,
|
|
119
|
+
/**
|
|
120
|
+
* String array of event names that will be captured and fired as svelte events.
|
|
121
|
+
* This is to prevent unnecessary event subscriptions.
|
|
122
|
+
*/
|
|
123
|
+
captured_events = [];
|
|
75
124
|
|
|
76
125
|
/**
|
|
77
126
|
* CSS classes for container
|
|
@@ -79,6 +128,14 @@ Send an array of colors to override the default colors, or do not send anything
|
|
|
79
128
|
let klass = "";
|
|
80
129
|
export { klass as class };
|
|
81
130
|
|
|
131
|
+
let chart;
|
|
132
|
+
/**
|
|
133
|
+
* Returns the ApexCharts instance
|
|
134
|
+
*/
|
|
135
|
+
export function getInstance() {
|
|
136
|
+
return chart.getInstance();
|
|
137
|
+
}
|
|
138
|
+
|
|
82
139
|
$: __class =
|
|
83
140
|
"kws-area-chart " + `${sparklines ? "kws-sparklines" : ""} ` + klass;
|
|
84
141
|
|
package/charts/BarChart.svelte
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
These are charts with minimal UI and can be
|
|
11
11
|
squeezed into small spaces, Default: `false`
|
|
12
12
|
@param {boolean} [horizontal=false] - Whether the chart displays horizontal bars, Default: `false`
|
|
13
|
+
@param {boolean} [distributed=false] - Make bars discrete. Each value indicates one bar per series., Default: `false`
|
|
13
14
|
@param {boolean} [stacked=false] - Whether the bars are stacked on top of each other, Default: `false`
|
|
14
15
|
@param {boolean} [stacked_full_width=false] - When bars are stacked, should they span the full width/height of the chart, Default: `false`
|
|
15
16
|
@param {object} [y_axis_options={}] - Y Axis options, see ApexCharts options for Y Axis, Default: `{}`
|
|
@@ -18,16 +19,60 @@ squeezed into small spaces, Default: `false`
|
|
|
18
19
|
@param {array} [colors=null] - Chart colors, can be modified globally in framework settings
|
|
19
20
|
|
|
20
21
|
Send an array of colors to override the default colors, or do not send anything to use the default colors, Default: `null`
|
|
22
|
+
@param {array} [captured_events=[]] - String array of event names that will be captured and fired as svelte events.
|
|
23
|
+
This is to prevent unnecessary event subscriptions., Default: `[]`
|
|
21
24
|
@param {string} [class=""] - CSS classes for container, Default: `""`
|
|
25
|
+
@method `getInstance()` - Returns the ApexCharts instance
|
|
26
|
+
|
|
27
|
+
### Events
|
|
28
|
+
- `animationEnd` - All chart events only fire when they are mentioned in `captured_events` list. See ApexChart Events https://apexcharts.com/docs/options/chart/events/ for full list of supported events.
|
|
29
|
+
- `beforeMount`
|
|
30
|
+
- `mounted`
|
|
31
|
+
- `updated`
|
|
32
|
+
- `mouseMove`
|
|
33
|
+
- `mouseLeave`
|
|
34
|
+
- `click`
|
|
35
|
+
- `legendClick`
|
|
36
|
+
- `markerClick`
|
|
37
|
+
- `selection`
|
|
38
|
+
- `dataPointSelection`
|
|
39
|
+
- `dataPointMouseEnter`
|
|
40
|
+
- `dataPointMouseLeave`
|
|
41
|
+
- `beforeZoom`
|
|
42
|
+
- `beforeResetZoom`
|
|
43
|
+
- `zoomed`
|
|
44
|
+
- `scrolled`
|
|
45
|
+
- `brushScrolled`
|
|
22
46
|
|
|
23
47
|
-->
|
|
48
|
+
<!-- All chart events only fire when they are mentioned in `captured_events` list. See ApexChart Events https://apexcharts.com/docs/options/chart/events/ for full list of supported events. -->
|
|
24
49
|
<Chart
|
|
50
|
+
bind:this={chart}
|
|
51
|
+
on:animationEnd
|
|
52
|
+
on:beforeMount
|
|
53
|
+
on:mounted
|
|
54
|
+
on:updated
|
|
55
|
+
on:mouseMove
|
|
56
|
+
on:mouseLeave
|
|
57
|
+
on:click
|
|
58
|
+
on:legendClick
|
|
59
|
+
on:markerClick
|
|
60
|
+
on:selection
|
|
61
|
+
on:dataPointSelection
|
|
62
|
+
on:dataPointMouseEnter
|
|
63
|
+
on:dataPointMouseLeave
|
|
64
|
+
on:beforeZoom
|
|
65
|
+
on:beforeResetZoom
|
|
66
|
+
on:zoomed
|
|
67
|
+
on:scrolled
|
|
68
|
+
on:brushScrolled
|
|
25
69
|
class={__class}
|
|
26
70
|
options={_options}
|
|
27
71
|
series={_data}
|
|
28
72
|
type="bar"
|
|
29
73
|
{height}
|
|
30
|
-
{width}
|
|
74
|
+
{width}
|
|
75
|
+
{captured_events} />
|
|
31
76
|
|
|
32
77
|
<script>
|
|
33
78
|
import { Chart } from "@kws3/ui";
|
|
@@ -60,6 +105,10 @@ Send an array of colors to override the default colors, or do not send anything
|
|
|
60
105
|
* Whether the chart displays horizontal bars
|
|
61
106
|
*/
|
|
62
107
|
horizontal = false,
|
|
108
|
+
/**
|
|
109
|
+
* Make bars discrete. Each value indicates one bar per series.
|
|
110
|
+
*/
|
|
111
|
+
distributed = false,
|
|
63
112
|
/**
|
|
64
113
|
* Whether the bars are stacked on top of each other
|
|
65
114
|
*/
|
|
@@ -86,7 +135,12 @@ Send an array of colors to override the default colors, or do not send anything
|
|
|
86
135
|
* Send an array of colors to override the default colors, or do not send anything to use the default colors
|
|
87
136
|
* @type {array}
|
|
88
137
|
*/
|
|
89
|
-
colors = null
|
|
138
|
+
colors = null,
|
|
139
|
+
/**
|
|
140
|
+
* String array of event names that will be captured and fired as svelte events.
|
|
141
|
+
* This is to prevent unnecessary event subscriptions.
|
|
142
|
+
*/
|
|
143
|
+
captured_events = [];
|
|
90
144
|
|
|
91
145
|
/**
|
|
92
146
|
* CSS classes for container
|
|
@@ -94,6 +148,14 @@ Send an array of colors to override the default colors, or do not send anything
|
|
|
94
148
|
let klass = "";
|
|
95
149
|
export { klass as class };
|
|
96
150
|
|
|
151
|
+
let chart;
|
|
152
|
+
/**
|
|
153
|
+
* Returns the ApexCharts instance
|
|
154
|
+
*/
|
|
155
|
+
export function getInstance() {
|
|
156
|
+
return chart.getInstance();
|
|
157
|
+
}
|
|
158
|
+
|
|
97
159
|
$: __class =
|
|
98
160
|
"kws-bar-chart " + `${sparklines ? "kws-sparklines" : ""} ` + klass;
|
|
99
161
|
|
|
@@ -113,6 +175,7 @@ Send an array of colors to override the default colors, or do not send anything
|
|
|
113
175
|
yAxis,
|
|
114
176
|
sparklines,
|
|
115
177
|
horizontal,
|
|
178
|
+
distributed,
|
|
116
179
|
stacked,
|
|
117
180
|
stacked_full_width
|
|
118
181
|
),
|
|
@@ -120,7 +183,7 @@ Send an array of colors to override the default colors, or do not send anything
|
|
|
120
183
|
);
|
|
121
184
|
|
|
122
185
|
const normaliseAll = () => {
|
|
123
|
-
if (data.length !== sets.length) {
|
|
186
|
+
if (data.length !== sets.length && !distributed) {
|
|
124
187
|
console.warn("Data and sets lengths do not match");
|
|
125
188
|
}
|
|
126
189
|
normaliseSets();
|
package/charts/Chart.svelte
CHANGED
|
@@ -7,7 +7,10 @@
|
|
|
7
7
|
@param {array} [series=[]] - Series data, Default: `[]`
|
|
8
8
|
@param {string} [width="100%"] - Chart width, Default: `"100%"`
|
|
9
9
|
@param {string} [height="auto"] - Chart height, Default: `"auto"`
|
|
10
|
+
@param {array} [captured_events=[]] - String array of event names that will be captured and fired as svelte events.
|
|
11
|
+
This is to prevent unnecessary event subscriptions., Default: `[]`
|
|
10
12
|
@param {string} [class=""] - CSS classes for container, Default: `""`
|
|
13
|
+
@method `getInstance()` - Returns the ApexCharts instance
|
|
11
14
|
|
|
12
15
|
-->
|
|
13
16
|
<div class="kws-chart {klass}" bind:this={canvas} />
|
|
@@ -17,6 +20,14 @@
|
|
|
17
20
|
import ApexCharts from "apexcharts/dist/apexcharts.esm";
|
|
18
21
|
import { merge } from "./utils";
|
|
19
22
|
|
|
23
|
+
//some functions such as brush charts
|
|
24
|
+
//require ApexCharts to be globally available
|
|
25
|
+
if (window) {
|
|
26
|
+
if (!window.ApexCharts) {
|
|
27
|
+
window.ApexCharts = ApexCharts;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
20
31
|
const fire = createEventDispatcher();
|
|
21
32
|
let canvas, chart;
|
|
22
33
|
|
|
@@ -39,7 +50,12 @@
|
|
|
39
50
|
/**
|
|
40
51
|
* Chart height
|
|
41
52
|
*/
|
|
42
|
-
height = "auto"
|
|
53
|
+
height = "auto",
|
|
54
|
+
/**
|
|
55
|
+
* String array of event names that will be captured and fired as svelte events.
|
|
56
|
+
* This is to prevent unnecessary event subscriptions.
|
|
57
|
+
*/
|
|
58
|
+
captured_events = [];
|
|
43
59
|
|
|
44
60
|
/**
|
|
45
61
|
* CSS classes for container
|
|
@@ -47,6 +63,34 @@
|
|
|
47
63
|
let klass = "";
|
|
48
64
|
export { klass as class };
|
|
49
65
|
|
|
66
|
+
/**
|
|
67
|
+
* Returns the ApexCharts instance
|
|
68
|
+
*/
|
|
69
|
+
export function getInstance() {
|
|
70
|
+
return chart;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const supported_events = [
|
|
74
|
+
"animationEnd",
|
|
75
|
+
"beforeMount",
|
|
76
|
+
"mounted",
|
|
77
|
+
"updated",
|
|
78
|
+
"mouseMove",
|
|
79
|
+
"mouseLeave",
|
|
80
|
+
"click",
|
|
81
|
+
"legendClick",
|
|
82
|
+
"markerClick",
|
|
83
|
+
"selection",
|
|
84
|
+
"dataPointSelection",
|
|
85
|
+
"dataPointMouseEnter",
|
|
86
|
+
"dataPointMouseLeave",
|
|
87
|
+
"beforeZoom",
|
|
88
|
+
"beforeResetZoom",
|
|
89
|
+
"zoomed",
|
|
90
|
+
"scrolled",
|
|
91
|
+
"brushScrolled",
|
|
92
|
+
];
|
|
93
|
+
|
|
50
94
|
onMount(() => {
|
|
51
95
|
init();
|
|
52
96
|
return () => {
|
|
@@ -54,20 +98,23 @@
|
|
|
54
98
|
};
|
|
55
99
|
});
|
|
56
100
|
|
|
101
|
+
let Events;
|
|
102
|
+
|
|
57
103
|
$: width, height, type, refresh();
|
|
58
104
|
$: series, seriesChanged();
|
|
59
|
-
$: options, optionsChanged();
|
|
105
|
+
$: options, Events, optionsChanged();
|
|
106
|
+
$: captured_events, patchEvents();
|
|
60
107
|
|
|
61
|
-
const patchEvents = (
|
|
108
|
+
const patchEvents = () => {
|
|
62
109
|
const events = {};
|
|
63
|
-
|
|
64
|
-
|
|
110
|
+
supported_events.forEach((type) => {
|
|
111
|
+
if (captured_events && captured_events.indexOf(type) > -1) {
|
|
65
112
|
events[type] = (a, b, c) => {
|
|
66
113
|
fire(type, [a, b, c]);
|
|
67
114
|
};
|
|
68
115
|
}
|
|
69
|
-
}
|
|
70
|
-
|
|
116
|
+
});
|
|
117
|
+
Events = events;
|
|
71
118
|
};
|
|
72
119
|
|
|
73
120
|
const init = () => {
|
|
@@ -78,22 +125,20 @@
|
|
|
78
125
|
type,
|
|
79
126
|
height,
|
|
80
127
|
width,
|
|
128
|
+
events: Events,
|
|
81
129
|
},
|
|
82
130
|
type,
|
|
83
131
|
series,
|
|
84
132
|
};
|
|
85
133
|
|
|
86
|
-
|
|
87
|
-
|
|
134
|
+
//replace any user sent events with patched events
|
|
88
135
|
if (typeof options.chart.events != "undefined") {
|
|
89
|
-
events = patchEvents(options.chart.events);
|
|
90
136
|
options.chart.events = {};
|
|
91
137
|
}
|
|
92
138
|
|
|
93
139
|
const config = merge(options, newOptions);
|
|
94
140
|
|
|
95
141
|
if (canvas) {
|
|
96
|
-
config.chart.events = events;
|
|
97
142
|
chart = new ApexCharts(canvas, config);
|
|
98
143
|
chart.render();
|
|
99
144
|
}
|
|
@@ -111,12 +156,11 @@
|
|
|
111
156
|
const optionsChanged = () => {
|
|
112
157
|
if (chart) {
|
|
113
158
|
if (typeof options.chart.events != "undefined") {
|
|
114
|
-
options.chart.events =
|
|
159
|
+
options.chart.events = Events;
|
|
115
160
|
}
|
|
116
161
|
chart.updateOptions(options, true);
|
|
117
162
|
} else {
|
|
118
163
|
init();
|
|
119
164
|
}
|
|
120
|
-
chart ? chart.updateOptions(options, true) : init();
|
|
121
165
|
};
|
|
122
166
|
</script>
|
package/charts/DonutChart.svelte
CHANGED
|
@@ -13,16 +13,60 @@ squeezed into small spaces, Default: `false`
|
|
|
13
13
|
@param {array} [colors=null] - Chart colors, can be modified globally in framework settings
|
|
14
14
|
|
|
15
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 {array} [captured_events=[]] - String array of event names that will be captured and fired as svelte events.
|
|
17
|
+
This is to prevent unnecessary event subscriptions., Default: `[]`
|
|
16
18
|
@param {string} [class=""] - CSS classes for container, Default: `""`
|
|
19
|
+
@method `getInstance()` - Returns the ApexCharts instance
|
|
20
|
+
|
|
21
|
+
### Events
|
|
22
|
+
- `animationEnd` - All chart events only fire when they are mentioned in `captured_events` list. See ApexChart Events https://apexcharts.com/docs/options/chart/events/ for full list of supported events.
|
|
23
|
+
- `beforeMount`
|
|
24
|
+
- `mounted`
|
|
25
|
+
- `updated`
|
|
26
|
+
- `mouseMove`
|
|
27
|
+
- `mouseLeave`
|
|
28
|
+
- `click`
|
|
29
|
+
- `legendClick`
|
|
30
|
+
- `markerClick`
|
|
31
|
+
- `selection`
|
|
32
|
+
- `dataPointSelection`
|
|
33
|
+
- `dataPointMouseEnter`
|
|
34
|
+
- `dataPointMouseLeave`
|
|
35
|
+
- `beforeZoom`
|
|
36
|
+
- `beforeResetZoom`
|
|
37
|
+
- `zoomed`
|
|
38
|
+
- `scrolled`
|
|
39
|
+
- `brushScrolled`
|
|
17
40
|
|
|
18
41
|
-->
|
|
42
|
+
<!-- All chart events only fire when they are mentioned in `captured_events` list. See ApexChart Events https://apexcharts.com/docs/options/chart/events/ for full list of supported events. -->
|
|
19
43
|
<Chart
|
|
44
|
+
bind:this={chart}
|
|
45
|
+
on:animationEnd
|
|
46
|
+
on:beforeMount
|
|
47
|
+
on:mounted
|
|
48
|
+
on:updated
|
|
49
|
+
on:mouseMove
|
|
50
|
+
on:mouseLeave
|
|
51
|
+
on:click
|
|
52
|
+
on:legendClick
|
|
53
|
+
on:markerClick
|
|
54
|
+
on:selection
|
|
55
|
+
on:dataPointSelection
|
|
56
|
+
on:dataPointMouseEnter
|
|
57
|
+
on:dataPointMouseLeave
|
|
58
|
+
on:beforeZoom
|
|
59
|
+
on:beforeResetZoom
|
|
60
|
+
on:zoomed
|
|
61
|
+
on:scrolled
|
|
62
|
+
on:brushScrolled
|
|
20
63
|
class={__class}
|
|
21
64
|
options={_options}
|
|
22
65
|
series={_data}
|
|
23
66
|
type="donut"
|
|
24
67
|
{height}
|
|
25
|
-
{width}
|
|
68
|
+
{width}
|
|
69
|
+
{captured_events} />
|
|
26
70
|
|
|
27
71
|
<script>
|
|
28
72
|
import { Chart } from "@kws3/ui";
|
|
@@ -61,13 +105,27 @@ Send an array of colors to override the default colors, or do not send anything
|
|
|
61
105
|
* Send an array of colors to override the default colors, or do not send anything to use the default colors
|
|
62
106
|
* @type {array}
|
|
63
107
|
*/
|
|
64
|
-
colors = null
|
|
108
|
+
colors = null,
|
|
109
|
+
/**
|
|
110
|
+
* String array of event names that will be captured and fired as svelte events.
|
|
111
|
+
* This is to prevent unnecessary event subscriptions.
|
|
112
|
+
*/
|
|
113
|
+
captured_events = [];
|
|
114
|
+
|
|
65
115
|
/**
|
|
66
116
|
* CSS classes for container
|
|
67
117
|
*/
|
|
68
118
|
let klass = "";
|
|
69
119
|
export { klass as class };
|
|
70
120
|
|
|
121
|
+
let chart;
|
|
122
|
+
/**
|
|
123
|
+
* Returns the ApexCharts instance
|
|
124
|
+
*/
|
|
125
|
+
export function getInstance() {
|
|
126
|
+
return chart.getInstance();
|
|
127
|
+
}
|
|
128
|
+
|
|
71
129
|
$: __class =
|
|
72
130
|
"kws-donut-chart " + `${sparklines ? "kws-sparklines" : ""} ` + klass;
|
|
73
131
|
|
package/charts/LineChart.svelte
CHANGED
|
@@ -15,16 +15,60 @@ squeezed into small spaces, Default: `false`
|
|
|
15
15
|
@param {array} [colors=null] - Chart colors, can be modified globally in framework settings
|
|
16
16
|
|
|
17
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 {array} [captured_events=[]] - String array of event names that will be captured and fired as svelte events.
|
|
19
|
+
This is to prevent unnecessary event subscriptions., Default: `[]`
|
|
18
20
|
@param {string} [class=""] - CSS classes for container, Default: `""`
|
|
21
|
+
@method `getInstance()` - Returns the ApexCharts instance
|
|
22
|
+
|
|
23
|
+
### Events
|
|
24
|
+
- `animationEnd` - All chart events only fire when they are mentioned in `captured_events` list. See ApexChart Events https://apexcharts.com/docs/options/chart/events/ for full list of supported events.
|
|
25
|
+
- `beforeMount`
|
|
26
|
+
- `mounted`
|
|
27
|
+
- `updated`
|
|
28
|
+
- `mouseMove`
|
|
29
|
+
- `mouseLeave`
|
|
30
|
+
- `click`
|
|
31
|
+
- `legendClick`
|
|
32
|
+
- `markerClick`
|
|
33
|
+
- `selection`
|
|
34
|
+
- `dataPointSelection`
|
|
35
|
+
- `dataPointMouseEnter`
|
|
36
|
+
- `dataPointMouseLeave`
|
|
37
|
+
- `beforeZoom`
|
|
38
|
+
- `beforeResetZoom`
|
|
39
|
+
- `zoomed`
|
|
40
|
+
- `scrolled`
|
|
41
|
+
- `brushScrolled`
|
|
19
42
|
|
|
20
43
|
-->
|
|
44
|
+
<!-- All chart events only fire when they are mentioned in `captured_events` list. See ApexChart Events https://apexcharts.com/docs/options/chart/events/ for full list of supported events. -->
|
|
21
45
|
<Chart
|
|
46
|
+
bind:this={chart}
|
|
47
|
+
on:animationEnd
|
|
48
|
+
on:beforeMount
|
|
49
|
+
on:mounted
|
|
50
|
+
on:updated
|
|
51
|
+
on:mouseMove
|
|
52
|
+
on:mouseLeave
|
|
53
|
+
on:click
|
|
54
|
+
on:legendClick
|
|
55
|
+
on:markerClick
|
|
56
|
+
on:selection
|
|
57
|
+
on:dataPointSelection
|
|
58
|
+
on:dataPointMouseEnter
|
|
59
|
+
on:dataPointMouseLeave
|
|
60
|
+
on:beforeZoom
|
|
61
|
+
on:beforeResetZoom
|
|
62
|
+
on:zoomed
|
|
63
|
+
on:scrolled
|
|
64
|
+
on:brushScrolled
|
|
22
65
|
class={__class}
|
|
23
66
|
options={_options}
|
|
24
67
|
series={_data}
|
|
25
68
|
type="line"
|
|
26
69
|
{height}
|
|
27
|
-
{width}
|
|
70
|
+
{width}
|
|
71
|
+
{captured_events} />
|
|
28
72
|
|
|
29
73
|
<script>
|
|
30
74
|
import { Chart } from "@kws3/ui";
|
|
@@ -71,7 +115,12 @@ Send an array of colors to override the default colors, or do not send anything
|
|
|
71
115
|
* Send an array of colors to override the default colors, or do not send anything to use the default colors
|
|
72
116
|
* @type {array}
|
|
73
117
|
*/
|
|
74
|
-
colors = null
|
|
118
|
+
colors = null,
|
|
119
|
+
/**
|
|
120
|
+
* String array of event names that will be captured and fired as svelte events.
|
|
121
|
+
* This is to prevent unnecessary event subscriptions.
|
|
122
|
+
*/
|
|
123
|
+
captured_events = [];
|
|
75
124
|
|
|
76
125
|
/**
|
|
77
126
|
* CSS classes for container
|
|
@@ -79,6 +128,14 @@ Send an array of colors to override the default colors, or do not send anything
|
|
|
79
128
|
let klass = "";
|
|
80
129
|
export { klass as class };
|
|
81
130
|
|
|
131
|
+
let chart;
|
|
132
|
+
/**
|
|
133
|
+
* Returns the ApexCharts instance
|
|
134
|
+
*/
|
|
135
|
+
export function getInstance() {
|
|
136
|
+
return chart.getInstance();
|
|
137
|
+
}
|
|
138
|
+
|
|
82
139
|
$: __class =
|
|
83
140
|
"kws-line-chart " + `${sparklines ? "kws-sparklines" : ""} ` + klass;
|
|
84
141
|
|
package/charts/MixedChart.svelte
CHANGED
|
@@ -16,16 +16,60 @@ squeezed into small spaces, Default: `false`
|
|
|
16
16
|
@param {array} [colors=null] - Chart colors, can be modified globally in framework settings
|
|
17
17
|
|
|
18
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 {array} [captured_events=[]] - String array of event names that will be captured and fired as svelte events.
|
|
20
|
+
This is to prevent unnecessary event subscriptions., Default: `[]`
|
|
19
21
|
@param {string} [class=""] - CSS classes for container, Default: `""`
|
|
22
|
+
@method `getInstance()` - Returns the ApexCharts instance
|
|
23
|
+
|
|
24
|
+
### Events
|
|
25
|
+
- `animationEnd` - All chart events only fire when they are mentioned in `captured_events` list. See ApexChart Events https://apexcharts.com/docs/options/chart/events/ for full list of supported events.
|
|
26
|
+
- `beforeMount`
|
|
27
|
+
- `mounted`
|
|
28
|
+
- `updated`
|
|
29
|
+
- `mouseMove`
|
|
30
|
+
- `mouseLeave`
|
|
31
|
+
- `click`
|
|
32
|
+
- `legendClick`
|
|
33
|
+
- `markerClick`
|
|
34
|
+
- `selection`
|
|
35
|
+
- `dataPointSelection`
|
|
36
|
+
- `dataPointMouseEnter`
|
|
37
|
+
- `dataPointMouseLeave`
|
|
38
|
+
- `beforeZoom`
|
|
39
|
+
- `beforeResetZoom`
|
|
40
|
+
- `zoomed`
|
|
41
|
+
- `scrolled`
|
|
42
|
+
- `brushScrolled`
|
|
20
43
|
|
|
21
44
|
-->
|
|
45
|
+
<!-- All chart events only fire when they are mentioned in `captured_events` list. See ApexChart Events https://apexcharts.com/docs/options/chart/events/ for full list of supported events. -->
|
|
22
46
|
<Chart
|
|
47
|
+
bind:this={chart}
|
|
48
|
+
on:animationEnd
|
|
49
|
+
on:beforeMount
|
|
50
|
+
on:mounted
|
|
51
|
+
on:updated
|
|
52
|
+
on:mouseMove
|
|
53
|
+
on:mouseLeave
|
|
54
|
+
on:click
|
|
55
|
+
on:legendClick
|
|
56
|
+
on:markerClick
|
|
57
|
+
on:selection
|
|
58
|
+
on:dataPointSelection
|
|
59
|
+
on:dataPointMouseEnter
|
|
60
|
+
on:dataPointMouseLeave
|
|
61
|
+
on:beforeZoom
|
|
62
|
+
on:beforeResetZoom
|
|
63
|
+
on:zoomed
|
|
64
|
+
on:scrolled
|
|
65
|
+
on:brushScrolled
|
|
23
66
|
class={__class}
|
|
24
67
|
options={_options}
|
|
25
68
|
series={_data}
|
|
26
69
|
type="bar"
|
|
27
70
|
{height}
|
|
28
|
-
{width}
|
|
71
|
+
{width}
|
|
72
|
+
{captured_events} />
|
|
29
73
|
|
|
30
74
|
<script>
|
|
31
75
|
import { Chart } from "@kws3/ui";
|
|
@@ -76,7 +120,12 @@ Send an array of colors to override the default colors, or do not send anything
|
|
|
76
120
|
* Send an array of colors to override the default colors, or do not send anything to use the default colors
|
|
77
121
|
* @type {array}
|
|
78
122
|
*/
|
|
79
|
-
colors = null
|
|
123
|
+
colors = null,
|
|
124
|
+
/**
|
|
125
|
+
* String array of event names that will be captured and fired as svelte events.
|
|
126
|
+
* This is to prevent unnecessary event subscriptions.
|
|
127
|
+
*/
|
|
128
|
+
captured_events = [];
|
|
80
129
|
|
|
81
130
|
/**
|
|
82
131
|
* CSS classes for container
|
|
@@ -84,6 +133,14 @@ Send an array of colors to override the default colors, or do not send anything
|
|
|
84
133
|
let klass = "";
|
|
85
134
|
export { klass as class };
|
|
86
135
|
|
|
136
|
+
let chart;
|
|
137
|
+
/**
|
|
138
|
+
* Returns the ApexCharts instance
|
|
139
|
+
*/
|
|
140
|
+
export function getInstance() {
|
|
141
|
+
return chart.getInstance();
|
|
142
|
+
}
|
|
143
|
+
|
|
87
144
|
$: __class =
|
|
88
145
|
"kws-mixed-chart " + `${sparklines ? "kws-sparklines" : ""} ` + klass;
|
|
89
146
|
|